@privy-io/react-auth
Version:
React client for the Privy Auth API
2 lines (1 loc) • 23.8 kB
JavaScript
import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import{MagnifyingGlassIcon as i}from"@heroicons/react/24/outline";import{useVirtualizer as l}from"@tanstack/react-virtual";import{useState as a,useMemo as o,useCallback as r,useRef as c,useEffect as s}from"react";import{isMobile as d}from"react-device-detect";import{styled as h}from"styled-components";import{B as m}from"./Button-B8mqatRx.mjs";import p from"@heroicons/react/24/outline/CheckIcon";import{C as u}from"./copy-Bx2Jwc5_.mjs";import{T as g}from"./ModalHeader-BLGC-7ev.mjs";import{Q as w}from"./QrCode-DR5LogOp.mjs";import{E as f}from"./EmailInputForm-B4hjCxRU.mjs";import{u as y,q as v}from"./context-Bycd1SKV.mjs";import{u as b}from"./useI18n-BtdAZuQ8.mjs";import{M as C,q as x,d as W,e as k,K as T,V as _,w as z,S}from"./useActiveWallet-Bsy5GTCV.mjs";import{u as L,P as I,b as N}from"./internal-context-e-Eni5bG.mjs";import{W as A}from"./WalletCards-DH1rqayz.mjs";import{W as B,h as E}from"./prepareFundingModalData-CIgFwA7s.mjs";import{S as j}from"./Screen-BTyXgDrd.mjs";let O=/*#__PURE__*/h.button.withConfig({displayName:"CopyTextButton",componentId:"sc-4b0620dc-0"})(["display:flex;align-items:center;gap:0.5rem;&:hover{text-decoration:underline;}svg{width:0.875rem;height:0.875rem;}"]),q=/*#__PURE__*/h.span.withConfig({displayName:"CopiedText",componentId:"sc-4b0620dc-1"})(["display:flex;align-items:center;gap:0.25rem;font-size:0.875rem;color:var(--privy-color-foreground-2);"]),U=/*#__PURE__*/h(p).withConfig({displayName:"GreenCheck",componentId:"sc-4b0620dc-2"})(["color:var(--privy-color-success);"]),F=/*#__PURE__*/h(u).withConfig({displayName:"StyledCopy",componentId:"sc-4b0620dc-3"})(["color:var(--privy-color-foreground-3);opactiy:0.5;"]);function M({children:t,iconOnly:i,value:l,hideCopyIcon:o,...r}){let[c,s]=a(!1);/*#__PURE__*/return e(O,{...r,onClick:()=>{navigator.clipboard.writeText(l||t).catch(console.error),s(!0),setTimeout((()=>s(!1)),1500)},children:[t," ",c?/*#__PURE__*/e(q,{children:[/*#__PURE__*/n(U,{})," ",!i&&"Copied"]}):!o&&/*#__PURE__*/n(F,{})]})}const $={phantom:{mobile:{native:"phantom://",universal:"https://phantom.app/ul/"}},solflare:{mobile:{native:void 0,universal:"https://solflare.com/ul/v1/"}},metamask:{image_url:{sm:C,md:C}}};class P{static normalize(e){return e.replace(/[-_]wallet$/,"").replace(/[-_]extension$/,"").toLowerCase()}isEth(e){return e.chains.some((e=>e.includes("eip155:")))}isSol(e){return e.chains.some((e=>e.includes("solana:")))}inAllowList(e,n){if(!this.normalizedAllowList||0===this.normalizedAllowList.length||"listing"===n&&this.includeWalletConnect)return!0;let t=P.normalize(e);return this.normalizedAllowList.some((e=>t===P.normalize(e)))}inDenyList(e,n){return"listing"===n&&"rabby"===e}chainMatches(e){return"ethereum-only"===this.chainFilter?"ethereum"===e:"solana-only"!==this.chainFilter||"solana"===e}connectorOk(e){return!!("null"!==e.connectorType&&"walletconnect_solana"!==e.walletBranding.id&&this.chainMatches(e.chainType)&&(this.inAllowList(e.walletClientType,"connector")||("injected"===e.connectorType||"solana_adapter"===e.connectorType)&&("ethereum"===e.chainType&&this.detectedEth||"solana"===e.chainType&&this.detectedSol)))}listingOk(e){if(e.slug.includes("coinbase"))return!1;if("ethereum-only"===this.chainFilter){if(!this.isEth(e))return!1}else if("solana-only"===this.chainFilter&&!this.isSol(e))return!1;return!(!this.inAllowList(e.slug,"listing")||this.inDenyList(e.slug,"listing"))}getWallets(e,n){let t=new Map,i=e=>{let n=t.get(e.id);if(n){n.chainType!==e.chainType&&(n.chainType="multi");let t=new Set(n.chains);e.chains.forEach((e=>t.add(e))),n.chains=Array.from(t),!n.icon&&e.icon&&(n.icon=e.icon),!n.url&&e.url&&(n.url=e.url),!n.listing&&e.listing&&(n.listing=e.listing)}else t.set(e.id,e)};e.filter((e=>this.connectorOk(e))).forEach((e=>{let n=P.normalize(e.walletClientType);i({id:n,label:e.walletBranding?.name??n,source:"connector",connector:e,chainType:e.chainType,icon:e.walletBranding?.icon,url:void 0,chains:["ethereum"===e.chainType?"eip155":"solana"]})}));let l=e.find((e=>"wallet_connect_v2"===e.connectorType)),a=e.find((e=>"walletconnect_solana"===e.walletBranding.id));n.filter((e=>this.listingOk(e))).forEach((n=>{let t=[...n.chains].filter((e=>e.includes("eip155:")||e.includes("solana:")));if(e.some((e=>P.normalize(e.walletClientType)===P.normalize(n.slug)&&"ethereum"===e.chainType&&"null"!==e.connectorType))||l||n.mobile.native||n.mobile.universal||x[n.slug]?.chainTypes.includes("ethereum")||(t=t.filter((e=>!e.includes("eip155:")))),e.some((e=>P.normalize(e.walletClientType)===P.normalize(n.slug)&&"solana"===e.chainType&&"null"!==e.connectorType))||a||n.mobile.native||n.mobile.universal||x[n.slug]?.chainTypes.includes("solana")||(t=t.filter((e=>!e.includes("solana:")))),!t.length)return;let o=P.normalize(n.slug),r=$[n.slug],c=r?.image_url?.sm||n.image_url?.sm;t.some((e=>e.includes("eip155:")))&&i({id:o,label:n.name||o,source:"listing",listing:n,chainType:"ethereum",icon:c,url:n.homepage,chains:t}),t.some((e=>e.includes("solana:")))&&i({id:o,label:n.name||o,source:"listing",listing:n,chainType:"solana",icon:c,url:n.homepage,chains:t})})),this.includeWalletConnectQr&&l&&i({id:"wallet_connect_qr",label:"WalletConnect",source:"connector",connector:l,chainType:"ethereum",icon:B,url:void 0,chains:["eip155"]}),this.includeWalletConnectQrSolana&&a&&i({id:"wallet_connect_qr_solana",label:"WalletConnect",source:"connector",connector:a,chainType:"solana",icon:B,url:void 0,chains:["solana"]});let o=Array.from(t.values());o.forEach((e=>{let n=$[e.listing?.slug||e.id];n?.image_url?.sm&&(e.icon=n.image_url.sm)}));let r=new Map;return this.normalizedAllowList?.forEach(((e,n)=>{r.set(P.normalize(e),n)})),{wallets:o.slice().sort(((e,n)=>{let t=P.normalize(e.id),i=P.normalize(n.id);"binance-defi"===t?t="binance":"universalprofiles"===t?t="universal_profile":"cryptocom-defi"===t?t="cryptocom":"bitkeep"===t&&(t="bitget_wallet"),"binance-defi"===i?i="binance":"universalprofiles"===i?i="universal_profile":"cryptocom-defi"===i?i="cryptocom":"bitkeep"===i&&(i="bitget_wallet");let l=r.has(t),a=r.has(i);return l&&a?r.get(t)-r.get(i):l?-1:a?1:"connector"===e.source&&"listing"===n.source?-1:"listing"===e.source&&"connector"===n.source?1:e.label.toLowerCase().localeCompare(n.label.toLowerCase())})),walletCount:o.length}}constructor(e,n){this.chainFilter=e,n&&n.length>0&&(this.normalizedAllowList=n.map(String),this.normalizedAllowList.includes("binance")&&this.normalizedAllowList.push("binance-defi-wallet"),this.normalizedAllowList.includes("bitget_wallet")&&this.normalizedAllowList.push("bitkeep")),this.detectedEth=this.normalizedAllowList?.includes("detected_ethereum_wallets")??!1,this.detectedSol=this.normalizedAllowList?.includes("detected_solana_wallets")??!1,this.includeWalletConnect=this.normalizedAllowList?.includes("wallet_connect")??!1,this.includeWalletConnectQr=this.normalizedAllowList?.includes("wallet_connect_qr")??!1,this.includeWalletConnectQrSolana=this.normalizedAllowList?.includes("wallet_connect_qr_solana")??!1}}var Q=t=>/*#__PURE__*/e("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/n("path",{d:"m0 0h32v32h-32z",fill:"#5469d4"}),/*#__PURE__*/n("path",{d:"m15.997 5.333-.143.486v14.106l.143.143 6.548-3.87z",fill:"#c2ccf4"}),/*#__PURE__*/n("path",{d:"m15.996 5.333-6.548 10.865 6.548 3.87z",fill:"#fff"}),/*#__PURE__*/n("path",{d:"m15.997 21.306-.08.098v5.025l.08.236 6.552-9.227z",fill:"#c2ccf4"}),/*#__PURE__*/n("path",{d:"m15.996 26.665v-5.36l-6.548-3.867z",fill:"#fff"}),/*#__PURE__*/n("path",{d:"m15.995 20.07 6.548-3.87-6.548-2.976v6.847z",fill:"#8698e8"}),/*#__PURE__*/n("path",{d:"m9.448 16.2 6.548 3.87v-6.846z",fill:"#c2ccf4"})]}),D=t=>/*#__PURE__*/e("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e("linearGradient",{id:"a",gradientUnits:"userSpaceOnUse",x1:"7.233",x2:"24.766",y1:"24.766",y2:"7.234",children:[/*#__PURE__*/n("stop",{offset:"0",stopColor:"#9945ff"}),/*#__PURE__*/n("stop",{offset:".2",stopColor:"#7962e7"}),/*#__PURE__*/n("stop",{offset:"1",stopColor:"#00d18c"})]}),/*#__PURE__*/n("path",{d:"m0 0h32v32h-32z",fill:"#10111a"}),/*#__PURE__*/n("path",{clipRule:"evenodd",d:"m9.873 20.41a.645.645 0 0 1 .476-.21l14.662.012a.323.323 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54zm15.376-2.862a.322.322 0 0 1 -.238.54l-14.662.012a.642.642 0 0 1 -.476-.21l-3.122-3.44a.323.323 0 0 1 .238-.54l14.662-.012a.644.644 0 0 1 .475.21zm-15.376-9.738a.644.644 0 0 1 .476-.21l14.662.012a.322.322 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54z",fill:"url(#a)",fillRule:"evenodd"})]});const H=/*#__PURE__*/h.div.withConfig({displayName:"Header",componentId:"sc-9b65f2b6-0"})(["display:flex;justify-content:space-between;align-items:center;"]),R=/*#__PURE__*/h.button.withConfig({displayName:"CloseButton",componentId:"sc-9b65f2b6-1"})(["padding:0.25rem;height:30px;width:30px;display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-full);background:var(--privy-color-background-2);"]),V=/*#__PURE__*/h.div.withConfig({displayName:"WalletIconWithActiveIndicator",componentId:"sc-9b65f2b6-2"})(["position:relative;display:inline-flex;align-items:center;&::after{content:' ';border-radius:var(--privy-border-radius-full);height:6px;width:6px;background-color:var(--privy-color-icon-success);position:absolute;right:-3px;top:-3px;}"]),G=/*#__PURE__*/h.img.withConfig({displayName:"WalletIcon",componentId:"sc-9b65f2b6-3"})(["width:32px;height:32px;border-radius:0.25rem;object-fit:contain;"]),Y=/*#__PURE__*/h.span.withConfig({displayName:"Chip",componentId:"sc-9b65f2b6-4"})(["display:flex;gap:0.25rem;align-items:center;padding:0.25rem 0.5rem;font-size:0.75rem;font-weight:500;line-height:1.125rem;border-radius:var(--privy-border-radius-sm);background-color:var(--privy-color-background-2);svg{width:100%;max-width:1rem;max-height:1rem;stroke-width:2;}"]),K=/*#__PURE__*/h.div.withConfig({displayName:"ScrollContainer",componentId:"sc-9b65f2b6-5"})(["display:flex;flex-direction:column;gap:0.5rem;max-height:24rem;overflow-y:scroll;&::-webkit-scrollbar{display:none;}scrollbar-gutter:stable both-edges;scrollbar-width:none;-ms-overflow-style:none;"," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;"],(e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0));function J({enabled:e=!0,walletList:n,walletChainType:t}){let i=y(),{connectors:l}=L(),{listings:r,loading:c}=W(e),s=t??i.appearance.walletChainType,d=n??i.appearance?.walletList,h=o((()=>new P(s,d)),[s,d]),{wallets:m,walletCount:p}=o((()=>h.getWallets(l,r)),[h,l,r]),[u,g]=a(""),w=o((()=>u?m.filter((e=>e.label.toLowerCase().includes(u.toLowerCase()))):m),[u,m]),[f,v]=a();return{selected:f,setSelected:v,search:u,setSearch:g,loadingListings:c,wallets:w,walletCount:p}}let X=e=>!e||"string"!=typeof e&&(e instanceof z||e instanceof S);const Z=({index:i,style:l,data:a,recent:o})=>{let r=a.wallets[i],{walletChainType:c,handleWalletClick:s}=a,{t:d}=b(),h={...l,boxSizing:"border-box"};return r?/*#__PURE__*/e(ie,{style:h,onClick:()=>s(r),children:[r.icon&&(r.connector&&!X(r.connector)?/*#__PURE__*/n(V,{children:"string"==typeof r.icon?/*#__PURE__*/n(G,{src:r.icon}):/*#__PURE__*/n(r.icon,{style:{width:"32px",height:"32px"}})}):"string"==typeof r.icon?/*#__PURE__*/n(G,{src:r.icon}):/*#__PURE__*/n(r.icon,{style:{width:"32px",height:"32px"}})),/*#__PURE__*/n(oe,{children:r.label}),o?/*#__PURE__*/e(t,{children:[/*#__PURE__*/n(Y,{children:d("connectWallet.lastUsed")}),/*#__PURE__*/n(le,{children:/*#__PURE__*/e(t,{children:["ethereum-only"===c&&/*#__PURE__*/n(Q,{}),"solana-only"===c&&/*#__PURE__*/n(D,{})]})})]}):/*#__PURE__*/n(le,{children:!("ethereum-only"===c||"solana-only"===c)&&/*#__PURE__*/e(t,{children:[r.chains?.some((e=>e.startsWith("eip155")))&&/*#__PURE__*/n(Q,{}),r.chains?.some((e=>e.startsWith("solana")))&&/*#__PURE__*/n(D,{})]})})]}):null};var ee=({className:h,customDescription:p,connectOnly:u,preSelectedWalletId:C,hideHeader:W,...B})=>{let O=y(),{t:q}=b(),{connectors:U}=L(),F=B.walletChainType||O.appearance.walletChainType,M=B.walletList||O.appearance?.walletList,{onBack:H,onClose:R,app:V}=B,{selected:Y,setSelected:K,qrUrl:ee,setQrUrl:ce,connecting:se,uiState:de,errorCode:he,wallets:me,walletCount:pe,handleConnect:ue,handleBack:ge,showSearchBar:we,isInitialConnectView:fe,title:ye,search:ve,setSearch:be}=function({onConnect:e,onBack:n,onClose:t,onConnectError:i,walletList:l,walletChainType:c,app:s}){let h=y(),{connectors:m}=L(),{t:p}=b(),{wallets:u,walletCount:g,search:w,setSearch:f,selected:C,setSelected:x}=J({enabled:k(l??[]),walletList:l,walletChainType:c}),[W,_]=a(),[z,S]=a(),[N,A]=a(),[B,E]=a(),j=!C&&!N&&!B,O=j&&(g>6||w.length>0),q=m.find((e=>"wallet_connect_v2"===e.connectorType)),U=r((async(n,t)=>{if(n){if(B?.connector===n&&"loading"===W)return void console.log("Already connecting to this wallet, skipping duplicate attempt");if(_("loading"),"string"==typeof n)return E({connector:n,name:t?.name??"Wallet",icon:t?.icon}),void window.open(n,"_blank");E({connector:n,name:t?.name??n.walletBranding.name??"Wallet",icon:t?.icon??n.walletBranding.icon});try{let t=await n.connect({showPrompt:!0});if(!t)return _("error"),S(void 0),void i?.(new I("Unable to connect wallet"));_("success"),S(void 0),T({address:t.address,client:t.walletClientType,appId:h.id}),setTimeout((()=>{e({connector:n,wallet:t})}),v)}catch(n){if(console.error("ERROR: ",{e:n}),n?.message?.includes("already pending for origin")||n?.message?.includes("wallet_requestPermissions"))return void console.log("Connection request already pending, maintaining loading state");_("error"),S(n?.privyErrorCode),i?.(n instanceof Error?n:new I(n?.message||"Unable to connect wallet"))}}}),[h.id,e,B,W]),F=r((()=>N?(_(void 0),S(void 0),E(void 0),void A(void 0)):B?(_(void 0),S(void 0),void E(void 0)):C?(_(void 0),S(void 0),E(void 0),void x(void 0)):"error"===W||"loading"===W?(_(void 0),S(void 0),void E(void 0)):void n?.()),[N,B,C,W,n]),M=o((()=>B?.connector===q&&N&&d&&B?.name?p("connectWallet.goToWallet",{walletName:B.name}):B?.connector===q&&N&&B?.name?p("connectWallet.scanToConnect",{walletName:B.name}):N&&B?.name?p(d?"connectWallet.goToWallet":"connectWallet.scanToConnect",{walletName:B.name}):"string"==typeof B?.connector?p("connectWallet.openOrInstall",{walletName:B.name}):C&&!B?p("connectWallet.selectNetwork"):B?null:p("connectWallet.selectYourWallet")),[B,N,C,q,p]);return{selected:C,setSelected:x,qrUrl:N,setQrUrl:A,connecting:B,uiState:W,errorCode:z,search:w,setSearch:f,wallets:u,walletCount:g,wc:q,isInitialConnectView:j,showSearchBar:O,title:M,handleConnect:U,handleBack:F,onClose:t,onConnect:e,app:s}}({...B,walletList:M,walletChainType:F}),Ce=U.find((e=>"wallet_connect_v2"===e.connectorType)),xe=U.find((e=>"walletconnect_solana"===e.walletBranding.id)),We=c(null),ke=l({count:me.length,getScrollElement:()=>We.current,estimateSize:()=>56,overscan:6,gap:5}),Te=r((async e=>{let n="solana-only"!==F&&e.chains?.some((e=>e.startsWith("eip155"))),t="ethereum-only"!==F&&e.chains?.some((e=>e.startsWith("solana"))),i=n=>{let t=P.normalize(e.id);return U.find((e=>P.normalize(e.walletClientType)===t&&e.chainType===n&&!("ethereum"===e.chainType&&e instanceof z||"solana"===e.chainType&&e instanceof S)))},l=async()=>{if(!Ce||!e.listing)return!1;let n=$[e.listing.slug]?{...e.listing,...$[e.listing.slug]}:e.listing;return Ce.setWalletEntry(n,ce),await Ce.resetConnection(e.id),await ue(Ce,{name:e.label,icon:e.icon}),!0},a=async()=>!!xe&&!!e.listing&&(await xe.disconnect(),xe.wallet.setWalletEntry(e.listing,ce),await new Promise((e=>setTimeout(e,100))),await ue(xe,{name:e.label,icon:e.icon}),!0),o=async n=>{let t=(n=>{let t=x[e.id];if(t)return t.getMobileRedirect({isSolana:n,connectOnly:!!u,useUniversalLink:!1})})(n);return!!t&&(await ue(t,{name:e.label,icon:e.icon}),!0)};if(n&&t)K(e);else{if(n&&!t){let n=i("ethereum");if(n&&!X(n))return void await ue(n,{name:e.label,icon:e.icon});if(d&&"phantom"===e.id){if(await o(!1)||await l())return}else if(await l()||await o(!1))return}if(t&&!n){let n=i("solana");if(n&&!X(n))return void await ue(n,{name:e.label,icon:e.icon});if(d){if(await o(!0)||await a())return}else if(await a()||await o(!0))return}if(!X(e.connector)){if(Ce&&"wallet_connect_v2"===e.connector?.connectorType)if(await Ce.resetConnection(e.id),"wallet_connect_qr"!==e.id&&e.listing){let n=$[e.listing.slug]?{...e.listing,...$[e.listing.slug]}:e.listing;Ce.setWalletEntry(n,ce)}else Ce.setWalletEntry({id:"wallet_connect_qr",name:"WalletConnect",rdns:"",slug:"wallet-connect",homepage:"",chains:["eip155"],mobile:{native:"",universal:void 0}},ce);return xe&&"walletconnect_solana"===e.connector?.walletBranding.id&&(await xe.disconnect(),"wallet_connect_qr_solana"!==e.id&&e.listing?xe.wallet.setWalletEntry(e.listing,ce):xe.wallet.setWalletEntry({id:"wallet_connect_solana_qr",name:"WalletConnect",rdns:"",slug:"wallet-connect-solana",homepage:"",chains:["solana"],mobile:{native:"",universal:void 0}},ce),await new Promise((e=>setTimeout(e,100)))),void await ue(e.connector,{name:e.label,icon:e.icon})}e.url&&await ue(e.url,{name:e.label,icon:e.icon})}}),[Ce,xe,ue,K,ce,F,u,U]);return s((()=>{if(!C)return;let e=me.find((({id:e})=>e===C));e&&Te(e).catch(console.error)}),[C]),/*#__PURE__*/e(j,{className:h,children:[/*#__PURE__*/n(j.Header,{icon:W&&fe?void 0:se&&!ee||ee&&d&&se?.icon?se.icon:se?void 0:A,iconVariant:se&&!ee||ee&&d?"loading":void 0,iconLoadingStatus:se&&!ee||ee&&d?{success:"success"===de,fail:"error"===de}:void 0,title:W&&fe?void 0:se&&!ee?q("connectWallet.waitingForWallet",{walletName:se.name}):ee&&d?q("connectWallet.waitingForWallet",{walletName:se?.name??"connection"}):ye,subtitle:W&&fe?void 0:se&&!ee&&"string"==typeof se.connector?q("connectWallet.installAndConnect",{walletName:se.name}):se&&!ee&&"string"!=typeof se.connector?"error"===de?he===N.NO_SOLANA_ACCOUNTS?`The connected wallet has no Solana accounts. Please add a Solana account in ${se.name} and try again.`:q("connectWallet.tryConnectingAgain"):q("connectionStatus.connectOneWallet"):fe?p??(V?q("connectWallet.connectToAccount",{appName:V.name}):null):null,showBack:!!H||!fe,showClose:!0,onBack:H||ge,onClose:R}),/*#__PURE__*/e(j.Body,{ref:We,$colorScheme:O.appearance.palette.colorScheme,style:{marginBottom:ee?"0.5rem":void 0},children:[we&&/*#__PURE__*/n(ne,{children:/*#__PURE__*/e(f,{style:{background:"transparent"},children:[/*#__PURE__*/n(_,{children:/*#__PURE__*/n(i,{})}),/*#__PURE__*/n("input",{className:"login-method-button",type:"text",placeholder:q("connectWallet.searchPlaceholder",{count:String(pe)}),onChange:e=>be(e.target.value),value:ve})]})}),ee&&d&&"loading"===de&&/*#__PURE__*/e("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:[/*#__PURE__*/n(m,{variant:"primary",onClick:()=>window.open(ee.universal??ee.native,"_blank"),style:{width:"100%"},children:q("connectWallet.openInApp")}),/*#__PURE__*/n(re,{value:ee.universal??ee.native,iconOnly:!0,children:"Copy link"})]}),ee&&!d&&"loading"===de&&/*#__PURE__*/n("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:/*#__PURE__*/n(re,{value:ee.universal??ee.native,iconOnly:!0,children:q("connectWallet.copyLink")})}),ee&&!d&&/*#__PURE__*/n(w,{size:280,url:ee.universal??ee.native,squareLogoElement:se?.icon?"string"==typeof se.icon?e=>/*#__PURE__*/n("svg",{...e,children:/*#__PURE__*/n("image",{href:se.icon,height:e.height,width:e.width})}):se.icon:E}),/*#__PURE__*/e(te,{children:[se&&!ee&&"string"==typeof se.connector&&/*#__PURE__*/e(ie,{onClick:()=>window.open(se.connector,"_blank"),children:[se.icon&&("string"==typeof se.icon?/*#__PURE__*/n(G,{src:se.icon}):/*#__PURE__*/n(se.icon,{})),/*#__PURE__*/n(oe,{children:se.name})]}),Y?.chains.some((e=>e.startsWith("eip155")))&&!se&&/*#__PURE__*/e(ie,{onClick:()=>Te({...Y,chains:Y.chains.filter((e=>e.startsWith("eip155")))}),children:[Y.icon&&("string"==typeof Y.icon?/*#__PURE__*/n(G,{src:Y.icon}):/*#__PURE__*/n(Y.icon,{})),/*#__PURE__*/n(oe,{children:Y.label}),/*#__PURE__*/n(le,{children:/*#__PURE__*/n(Q,{})})]}),Y?.chains.some((e=>e.startsWith("solana")))&&!se&&/*#__PURE__*/e(ie,{onClick:()=>Te({...Y,chains:Y.chains.filter((e=>e.startsWith("solana")))}),children:[Y.icon&&("string"==typeof Y.icon?/*#__PURE__*/n(G,{src:Y.icon}):/*#__PURE__*/n(Y.icon,{})),/*#__PURE__*/n(oe,{children:Y.label}),/*#__PURE__*/n(le,{children:/*#__PURE__*/n(D,{})})]}),fe&&/*#__PURE__*/e(t,{children:[!(pe>0)&&/*#__PURE__*/n(ae,{children:q("connectWallet.noWalletsFound")}),pe>0&&!ee&&/*#__PURE__*/n("div",{style:{maxHeight:56*Math.min(me.length,5)+5,width:"100%"},children:/*#__PURE__*/n("div",{style:{height:`${ke.getTotalSize()}px`,width:"100%",position:"relative"},children:ke.getVirtualItems().map((e=>/*#__PURE__*/n(Z,{index:e.index,style:{position:"absolute",top:0,left:0,height:`${e.size}px`,transform:`translateY(${e.start}px)`},data:{wallets:me,walletChainType:F,handleWalletClick:Te}},e.key)))})})]})]})]}),/*#__PURE__*/e(j.Footer,{children:[se&&!ee&&"string"!=typeof se.connector&&"error"===de&&/*#__PURE__*/n(j.Actions,{children:/*#__PURE__*/n(m,{style:{width:"100%",alignItems:"center"},variant:"error",onClick:()=>ue(se.connector,{name:se.name,icon:se.icon}),children:q("connectWallet.retry")})}),!!(V&&V.legal.privacyPolicyUrl&&V.legal.termsAndConditionsUrl)&&/*#__PURE__*/n(g,{app:V,alwaysShowImplicitConsent:!0}),/*#__PURE__*/n(j.Watermark,{})]})]})};let ne=/*#__PURE__*/h.div.withConfig({displayName:"StickySearchContainer",componentId:"sc-34a6bff4-0"})(["position:sticky;margin-top:-3px;padding-top:3px;top:-3px;z-index:1;background:var(--privy-color-background);padding-bottom:calc(var(--screen-space) / 2);"]),te=/*#__PURE__*/h.div.withConfig({displayName:"WalletListContainer",componentId:"sc-34a6bff4-1"})(["display:flex;flex-direction:column;gap:","px;"],5),ie=/*#__PURE__*/h.button.withConfig({displayName:"Button",componentId:"sc-34a6bff4-2"})(["&&{gap:0.5rem;align-items:center;display:flex;position:relative;text-align:left;font-weight:500;transition:background 200ms ease-in;width:calc(100% - 4px);border-radius:var(--privy-border-radius-md);padding:0.75em;border:1px solid var(--privy-color-foreground-4);justify-content:space-between;}&:hover{background:var(--privy-color-background-2);}"]),le=/*#__PURE__*/h.span.withConfig({displayName:"ButtonBadge",componentId:"sc-34a6bff4-3"})(["display:flex;align-items:center;justify-content:end;position:relative;& > svg{border-radius:var(--privy-border-radius-full);stroke-width:2.5;width:100%;max-height:1rem;max-width:1rem;flex-shrink:0;}& > svg:not(:last-child){border-radius:var(--privy-border-radius-full);margin-right:-0.375rem;}"]),ae=/*#__PURE__*/h.div.withConfig({displayName:"EmptyContainer",componentId:"sc-34a6bff4-4"})(["height:60px;display:flex;align-items:center;justify-content:center;text-align:center;"]),oe=/*#__PURE__*/h.span.withConfig({displayName:"WalletName",componentId:"sc-34a6bff4-5"})(["text-overflow:ellipsis;white-space:nowrap;color:var(--privy-color-foreground);font-weight:400;flex:1;"]),re=/*#__PURE__*/h(M).withConfig({displayName:"StyledCopyableText",componentId:"sc-34a6bff4-6"})(["&&{margin:0.5rem auto 0 auto;}"]);export{M as C,H,K as S,G as W,Y as a,R as b,P as c,Z as d,ee as i,J as u};