@privy-io/react-auth 1.84.0 → 1.85.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.
@@ -1,3276 +0,0 @@
1
- import{$ as Fm,A as bt,B as Et,C as pl,D as _m,E as Mm,F as Im,G as Je,H as D,I as Oa,J as Na,K as B,L as j,M as Wm,N as rr,O as Lm,P as Mt,Q as Bo,R as rp,S as qi,T as Om,U as Nm,V as Da,W as Dm,X as Ua,Y as Co,Z as Tt,_ as zi,a as Ui,b as Z,c as on,d as tl,e as rm,f as rl,g as om,h as jr,i as nm,j as am,k as Fi,l as ol,m as im,n as Hn,o as sm,p as Ia,q as lm,r as Uo,s as Or,t as Bi,u as cm,v as De,w as tp,x as La,y as cl,z as dl}from"./chunk-CMFOSIZZ.js";import{a as km,b as x,d as hl,e as yl}from"./chunk-BWEW65KO.js";import{$ as Nr,A as Jd,B as il,C as Hi,D as Gi,E as sl,F as Vi,G as Vn,H as qn,I as zn,J as Kn,K as ll,L as jd,M as $d,N as Yn,O as Fo,P as ep,Q as Wa,R as fm,S as hm,T as ym,U as gm,V as Cm,W as _t,X as $r,Y as vm,Z as ul,_ as wm,a as ju,aa as bm,b as el,ba as ml,c as Yd,ca as Em,d as $u,da as Dr,e as tr,ea as go,f as Lr,fa as Tm,g as C,ga as Ur,h as em,ha as Sm,i as Me,ia as Pm,j as ne,ja as Am,k as ze,l as Bn,m as yr,n as tm,na as xm,o as yo,oa as Be,p as nl,pa as fl,q as dm,qa as Rm,r as Le,ra as _,s as pm,sa as He,t as um,ta as q,u as Qd,ua as Um,v as Gn,va as Ho,w as Xd,x as al,y as mm,z as Zd}from"./chunk-KD3IIYQS.js";import{getAddress as ka}from"@ethersproject/address";import{Web3Provider as Ku}from"@ethersproject/providers";import{createStore as gP}from"mipd";import{useEffect as fo,useMemo as CP,useRef as Ra,useState as at}from"react";import{isAndroid as vP}from"react-device-detect";import{ProviderErrors as wP,calculateTotalGasEstimate as bP,populateTransactionRequest as EP}from"@privy-io/js-sdk-core";var gl="/api/v1/sessions",Cl="/api/v1/sessions/logout",Bm="/api/v1/sessions/fork",vl="/api/v1/sessions/fork/recover",Hm="/api/v1/siwe/init",Gm="/api/v1/siwe/authenticate",Vm="/api/v1/siwe/link",qm="/api/v1/siwe/link_smart_wallet",zm="/api/v1/siwe/unlink",Km="/api/v1/siws/init",Ym="/api/v1/siws/authenticate",Qm="/api/v1/siws/link",Xm="/api/v1/siws/unlink",Zm="/api/v1/farcaster/init",Jm="/api/v1/farcaster/authenticate",jm="/api/v1/farcaster/link",$m="/api/v1/farcaster/status",ef="/api/v1/farcaster/unlink",tf="/api/v1/passwordless/init",rf="/api/v1/passwordless/authenticate",of="/api/v1/passwordless/link",nf="/api/v1/passwordless/unlink",af="/api/v1/passwordless/update",sf="/api/v1/passwordless_sms/init",lf="/api/v1/passwordless_sms/link",cf="/api/v1/passwordless_sms/unlink",df="/api/v1/passwordless_sms/authenticate",pf="/api/v1/passwordless_sms/update",wl="/api/v1/oauth/init",bl="/api/v1/oauth/authenticate",El="/api/v1/oauth/link",uf="/api/v1/oauth/unlink",mf="/api/v1/recovery/oauth/init",ff="/api/v1/recovery/oauth/init_icloud",hf="/api/v1/recovery/oauth/authenticate",yf="/api/v1/passkeys/link/init",gf="/api/v1/passkeys/authenticate/init",Cf="/api/v1/passkeys/link",vf="/api/v1/passkeys/authenticate",wf="/api/v1/passkeys/unlink",bf="/api/v1/telegram/authenticate",Ef="/api/v1/telegram/link",Tf="/api/v1/telegram/unlink";var Sf="/api/v1/mfa/passwordless_sms/init",Pf="/api/v1/mfa/passkeys/init",Af="/api/v1/users/me/accept_terms",Tl="/api/v1/analytics_events",xf="/api/v1/custom_jwt_account/authenticate",kf="/api/v1/guest/authenticate",Rf="/api/v1/plugins/moonpay_on_ramp/sign",_f="/api/v1/funding/coinbase_on_ramp/init",Mf="/api/v1/funding/coinbase_on_ramp/status";var Fa=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(xf,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){throw new Error("Unimplemented")}};var nn=class{constructor(t,r,o=!1){this.meta={email:t,captchaToken:r,disableSignup:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(rf,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(of,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ne(t)}}async sendCodeEmail(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{return await this.api.post(tf,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ne(o)}}},Sl=class extends nn{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r,disableSignup:!1}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new C("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(af,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ne(r)}}};import{isMobile as g0,isIOS as C0}from"react-device-detect";var Pl=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Al))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Al={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}}};function If(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Wf(e,t){let r=If(t);if(r.deepLink)return Ff(r.deepLink,e);if(r.universalLink)return op(r.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}function Lf(e,t){let r=If(t);if(r.universalLink)return op(r.universalLink,e)}var Of="WALLETCONNECT_DEEPLINK_CHOICE";function Nf(){try{localStorage.removeItem(Of)}catch{}}function Df({href:e,name:t}){try{localStorage.setItem(Of,JSON.stringify({href:e,name:t}))}catch{}}function Uf(e){return e.startsWith("http://")||e.startsWith("https://")}function Ff(e,t){if(Uf(e))return op(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function op(e,t){if(!Uf(e))return Ff(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function xl(e,t){window.open(e,t,"noreferrer noopener")}var Ge=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Ki=class{constructor(t,r=!1){this._meta={disableSignup:!1};this.captchaToken=t,this.startChannelOnce=new Ge(this._startChannelOnce.bind(this)),this.pollForReady=new Ge(this._pollForReady.bind(this)),this._meta.disableSignup=r}get meta(){return this._meta}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");try{let t=await this.api.post(Jm,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});if(!t)throw new C("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(jm,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ne(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(Zm,{token:this.captchaToken});g0&&!C0&&t.connect_uri&&xl(t.connect_uri,"_blank"),this._meta={...this._meta,connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new C("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");let t=await this.api.get($m,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};import{base64url as Hf}from"jose";async function Bf(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Yi(e){return crypto.getRandomValues(new Uint8Array(e))}var Ba=class{constructor(t){this.meta={guestCredential:this.getOrCreateGuestCredential(t)}}getOrCreateGuestCredential(t){let r=sl(t);if(Ui()){if(Z.get(r))return Z.get(r);{let o=Hf.encode(Yi(32));return Z.put(r,o),o}}return Hf.encode(Yi(32))}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(kf,{guest_credential:this.meta.guestCredential});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){throw new Error("Linking is not supported for the guest flow")}};import{base64url as Gf}from"jose";var v0="S256",w0="S256";function Qn(){return Gf.encode(Yi(36))}function Ha(){return Qn()}async function Ga(e,t=v0){if(t==w0){let r=await Bf(e);return Gf.encode(r)}else return e}function Vf(){let e=Z.get(qn);if(!e)throw new C("Authentication error.");return e}function kl(){return!!Z.get(zn)}function qf(){return!!Z.get(Kn)}var vo=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:kl();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=Vf();try{let r=await this.api.post(bl,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Z.del(qn),Z.del(zn),Z.del(Kn),{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user,oauth_tokens:r.oauth_tokens}}catch(r){let o=ne(r);throw o.privyErrorCode?new C(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=Z.get(qn);if(!t)throw new C("Authentication error.");try{let r=await this.api.post(El,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Z.del(qn),r}catch(r){throw ne(r)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initializing OAuth authentication.");let t=Qn();Z.put(qn,t);let r=Ha();Z.put(Vn,r);let o=await Ga(t);this.meta.headless&&Z.put(zn,!0),this.meta.disableSignup&&Z.put(Kn,!0);try{return await this.api.post(wl,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ne(n)}}};function np(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{jsx as zf,jsxs as b0}from"react/jsx-runtime";var Rl=({style:e,...t})=>b0("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[zf("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),zf("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as Qi,jsxs as E0}from"react/jsx-runtime";var _l=({style:e,...t})=>E0("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[Qi("g",{clipPath:"url(#clip0)",children:Qi("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),Qi("defs",{children:Qi("clipPath",{id:"clip0",children:Qi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Kf}from"react/jsx-runtime";var Ml=({style:e,...t})=>Kf("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:Kf("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});import T0 from"@heroicons/react/24/outline/GlobeAltIcon";import{jsx as S0}from"react/jsx-runtime";var Yf=({style:e})=>S0(T0,{style:{color:"var(--privy-color-error)",...e}});import{jsx as Il,jsxs as P0}from"react/jsx-runtime";var Wl=({style:e,...t})=>P0("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Il("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Il("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Il("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Il("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Fr,jsxs as Ll}from"react/jsx-runtime";function Ol(e){return Ll("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[Ll("defs",{children:[Ll("linearGradient",{id:"b",children:[Fr("stop",{offset:"0",stopColor:"#3771c8"}),Fr("stop",{stopColor:"#3771c8",offset:".128"}),Fr("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),Ll("linearGradient",{id:"a",children:[Fr("stop",{offset:"0",stopColor:"#fd5"}),Fr("stop",{offset:".1",stopColor:"#fd5"}),Fr("stop",{offset:".5",stopColor:"#ff543e"}),Fr("stop",{offset:"1",stopColor:"#c837ab"})]}),Fr("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),Fr("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),Fr("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),Fr("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),Fr("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}import{jsx as Nl}from"react/jsx-runtime";function Dl({style:e,...t}){return Nl("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:Nl("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Nl("g",{transform:"scale(5.12,5.12)",children:Nl("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Qf,jsxs as A0}from"react/jsx-runtime";function Ul(e){return A0("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Qf("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),Qf("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}import{jsx as ap,jsxs as x0}from"react/jsx-runtime";function Fl(e){return x0("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[ap("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),ap("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),ap("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as Xf}from"react/jsx-runtime";var Bl=({style:e,...t})=>Xf("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:Xf("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});var Zf={google:{name:"Google",component:Wl},discord:{name:"Discord",component:_l},github:{name:"Github",component:Ml},linkedin:{name:"LinkedIn",component:Dl},twitter:{name:"Twitter",component:Bl},spotify:{name:"Spotify",component:Ul},instagram:{name:"Instagram",component:Ol},tiktok:{name:"Tiktok",component:Fl},apple:{name:"Apple",component:Rl}},Xi=e=>e in Zf?Zf[e]:{name:"Unknown",component:Yf};function Jf(e,t){let r={detail:"",retryable:!1},o=np(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=Xi(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Xi(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return e?.privyErrorCode==="cannot_link_more_of_type"&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode==="oauth_unexpected"&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}function Zi(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");if(!t||!r||!o)return{inProgress:!1};let n=!1;try{n=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:kl(),popupFlow:window.opener!==null&&n,disableSignup:qf()}}function Xn(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),Z.del(Vn),window.history.replaceState({},"",e)}var Zn=class{constructor(t){this.initAuthenticateOnce=new Ge(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Ge(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new C("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(vf,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ne(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new C("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new C("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Cf,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new C("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ne(r)}}async _initAuthenticateOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(gf,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new C("Auth flow has no API instance");return await this.api.post(yf,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var Hl=({address:e,chainId:t,nonce:r})=>{let o=window.location.host,n=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",i=new Date().toISOString();return`${o} wants you to sign in with your Ethereum account:
2
- ${e}
3
-
4
- ${a}
5
-
6
- URI: ${n}
7
- Version: 1
8
- Chain ID: ${t}
9
- Nonce: ${r}
10
- Issued At: ${i}
11
- Resources:
12
- - https://privy.io`};var Go=class{constructor(t,r,o,n=!1){this._meta={disableSignup:!1};this.getNonceOnce=new Ge(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=o,this.client=r,this._meta.disableSignup=n}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign(),o=await this.client.authenticateWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:o.user,token:o.token,refresh_token:o.refresh_token,identity_token:o.identity_token,is_new_user:o.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.client)throw new C("SiweFlow has no client instance");try{let{message:t,signature:r}=await this.sign();return await this.client.linkWithSiweInternal({message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ne(t)}}async sign(){if(!this.client)throw new C("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new C("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.client)throw new C("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new C("SiweFlow has no client instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Hl({address:t,chainId:r,nonce:this.nonce}),this.preparedMessage}};var jf=({address:e,nonce:t})=>{let r=window.location.host,o=window.location.origin,n=`You are proving you own ${e}.`,a=new Date().toISOString();return`${r} wants you to sign in with your Solana account:
13
- ${e}
14
-
15
- ${n}
16
-
17
- URI: ${o}
18
- Version: 1
19
- Chain ID: mainnet
20
- Nonce: ${t}
21
- Issued At: ${a}
22
- Resources:
23
- - https://privy.io`};var Jn=class{constructor(t,r,o,n=!1){this._meta={disableSignup:!1};this.getNonceOnce=new Ge(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=o,this.client=r,this._meta.disableSignup=n}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new C("SiwsFlow has no client instance");try{let{message:t,signature:r}=await this.sign(),o=await this.client.authenticateWithSiwsInternal({message:t,signature:r,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:o.user,token:o.token,refresh_token:o.refresh_token,identity_token:o.identity_token,is_new_user:o.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.client)throw new C("SiwsFlow has no client instance");try{let{message:t,signature:r}=await this.sign();return await this.client.linkWithSiwsInternal({message:t,signature:r,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ne(t)}}async sign(){if(!this.client)throw new C("SiwsFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new C("Could not prepare SIWS message");if(!this.wallet.signMessage)throw new C("Wallet does not support signMessage");let t=await this.wallet.signMessage(Buffer.from(this.preparedMessage));return{message:this.preparedMessage,signature:Buffer.from(t).toString("base64")}}async _getNonceOnce(){if(!this.client)throw new C("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new C("SiwsFlow has no client instance");let t=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=jf({address:t,nonce:this.nonce}),this.preparedMessage}};var an=class{constructor(t,r,o=!1){this.meta={phoneNumber:t,captchaToken:r,disableSignup:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(df,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(lf,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ne(t)}}async sendSmsCode(t,r){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(sf,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ne(o)}}},Gl=class extends an{constructor(r,o,n){super(o,n);this.meta={phoneNumber:o,captchaToken:n,oldPhoneNumber:r,disableSignup:!1}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new C("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(pf,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(r){throw ne(r)}}};var Va=class{constructor(t,r=!1){this.meta={disableSignup:!1};this.meta={captchaToken:t,disableSignup:!1},this.meta.disableSignup=r}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=await this.api.post(bf,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user}}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(Ef,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(t){throw ne(t)}}};function ip(e){let t={detail:"",retryable:!1};return e?.privyErrorCode==="linked_to_another_user"&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode==="disallowed_login_method"&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode==="invalid_data"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="cannot_link_more_of_type"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="invalid_credentials"&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode==="too_many_requests"&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),t}function eh(){let e;if(e=k0(),e)return $f(),{...e,flowType:"login-url"};if(e=R0(),e)return $f(),{...e,flowType:"web-app"}}function k0(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),o=Number(e.get("auth_date")||""),n=e.get("first_name"),a=e.get("last_name")||void 0,i=e.get("username")||void 0,l=e.get("photo_url")||void 0;if(!(!t||!n||!o||!r))return{id:t,first_name:n,last_name:a,username:i,photo_url:l,auth_date:o,hash:r}}function R0(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id")||void 0,o=t.get("user"),n=Number(t.get("auth_date")||""),a=t.get("hash"),i=t.get("chat_instance")||void 0,l=t.get("chat_type")||void 0,c=t.get("start_param")||void 0;if(!(!o||!n||!a))return{query_id:r,user:o,auth_date:n,hash:a,chat_instance:i,chat_type:l,start_param:c}}function $f(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),e.hash="",window.history.replaceState({},"",e)}import{v4 as sv}from"uuid";import{getAddress as fh}from"@ethersproject/address";import{isHexString as ev}from"@ethersproject/bytes";import tv from"eventemitter3";import D0 from"@coinbase/wallet-sdk";import{jsx as th,jsxs as _0}from"react/jsx-runtime";var Vo=({style:e,...t})=>_0("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[th("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),th("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{ErrorCode as M0}from"@ethersproject/logger";import{ProviderErrors as jn}from"@privy-io/js-sdk-core";var qa=class extends Me{constructor(){super("Wallet timeout");this.type="wallet_error"}},za=class extends Me{constructor(){super("User rejected connection");this.type="wallet_error"}},gr=e=>{if(e instanceof Me)return e;if(e?.code&&e?.reason){let t=new St(e);return e.code===M0.ACTION_REJECTED&&(t.details=jn.E4001_USER_REJECTED_REQUEST),t}return e?.code?new St(e):new Me("Unknown connector error",e)},Br=class extends tr{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},St=class extends Br{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(jn).find(a=>a.eipCode===o.code);this.details=n||jn.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=jn.E32002_CONNECTION_ALREADY_PENDING:this.details=jn.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=jn.E32002_WALLET_LOCKED))}},I0={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1}},wo={...I0,...jn};import{getAddress as Eo}from"@ethersproject/address";import{Web3Provider as sh}from"@ethersproject/providers";import{default as W0}from"eventemitter3";var $n=class extends W0{constructor(r){super();this.walletClientType=r,this.connected=!1,this.initialized=!1}};import O0 from"eventemitter3";var L0=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation"],rh=e=>L0.includes(e);var et=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new qa,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||Yn,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new Me(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw gr(r)})}},sn=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Ji=class extends O0{constructor({walletProxy:r,address:o,rootAddress:n,rpcConfig:a,chains:i,appId:l,chainId:c=1,walletIndex:d}){super();this.walletProxy=r,this.address=o,this.rootAddress=n,this.chainId=c,this.rpcConfig=a,this.chains=i,this.provider=Or(c,this.chains,a,{appId:l}),this.rpcTimeoutDuration=Ka(a,"privy"),this.appId=l,this.walletIndex=d}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new sn(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await ve()||!this.address)throw new sn("Disconnected",4900);return(await ah(o,void 0,void 0,this.address)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new sn(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new sn(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Or(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0],n=r.params[1];return await oh(o,void 0,n)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=r.params[0],n=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await nh(Bi(n),void 0,o)}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:Hn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch(n){console.warn(`Gas estimation failed with error: ${n}. Retrying gas estimation by omitting the 'from' address`);try{return delete o.from,await this.provider.send("eth_estimateGas",[o])}catch(a){throw console.warn(`Gas estimation failed with error: ${a} when omitting the 'from' address`),n}}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Hn(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(rh(r.method)){let o=await ve();if(await ih(),!o||!this.address)throw new sn("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.rootAddress,accessToken:o,hdWalletIndex:this.walletIndex,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new sn("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await ve();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},bo=class extends et{constructor(r){super(r,r.rpcTimeoutDuration)}},ln=class extends et{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var N0=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}};function Ya(e){return e.chainType==="ethereum"}function eo(e){return e.type==="ethereum"}var or=class extends $n{constructor(r,o,n,a){super(r);this.chainType="ethereum";this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=Ia(r),this.walletClientType==="privy"&&Z.put(ll(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=Ka(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n,a){let i=async()=>!!this.wallets.find(l=>Eo(l.address)===Eo(r));return{type:"ethereum",address:Eo(r),chainId:o,meta:n,imported:a,switchChain:async l=>{if(!i)throw new Me("Wallet is not currently connected.");let c=this.wallets.find(g=>Eo(g.address)===Eo(r))?.chainId;if(!c)throw new Me("Unable to determine current chainId.");let d,u;if(typeof l=="number"?(d=`0x${l.toString(16)}`,u=l):(d=l,u=Number(l)),c===Ia(d))return;let m=this.chains.find(g=>g.id===u);if(!m)throw new Me(`Unsupported chainId: ${l}`);let h=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:d}]})};try{return await h()}catch(g){if(N0(g,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:d,chainName:m.name,nativeCurrency:m.nativeCurrency,rpcUrls:[m.rpcUrls.default?.http[0]??""],blockExplorerUrls:[m.blockExplorers?.default.url??""]}]}),h();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new Me(`Rainbow does not support the chainId ${o}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new Me("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new Me("Wallet is not currently connected.");return new sh(new bo(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new Me("Wallet is not currently connected.");return new ln(this.proxyProvider)},sign:async l=>{if(!await i())throw new Me("Wallet is not currently connected.");return await this.sign(l)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let d=await Fi(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,d),Array.isArray(d)&&(o=d)}}catch(d){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",d)}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=Eo(n),i=[],l;if(this.walletClientType==="privy"){let d=Z.get(ll(a));this.chains.find(u=>u.id===Number(d))||(Z.del(ll(a)),d=null),l=d||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let d=await Fi(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,d),typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${ep}`,d),l=ep}let c=Ia(l);if(!i.find(d=>Eo(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(Eo(n),c,d,this.connectorType==="embedded_imported"))}ji(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>Eo(n)===Eo(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new sh(new bo(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var U0=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],lh=(e,t)=>e.makeWeb3Provider({options:t}),Vl,ql=class extends or{constructor(r,o,n,a,i,l){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.displayName="Coinbase Wallet";if(this.proxyProvider=new et(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=a.coinbaseWallet.connectionOptions??"all",this.walletClientType=this.connectionOptions==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.walletClientType==="coinbase_smart_wallet"&&(this.displayName="Coinbase Smart Wallet"),!Vl){let c=[o.id].concat(r.map(u=>u.id)),d=this.connectionOptions!=="eoaOnly"?c.filter(u=>!U0.includes(u)):[];d.length>0&&console.warn(`The following configured chains are not supported by the Coinbase Smart Wallet: ${d.join(", ")}`),Vl=new D0({appName:i,appLogoUrl:l,appChainIds:c})}this.proxyProvider.setWalletProvider(lh(Vl,this.connectionOptions))}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:Vo,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new Me("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw gr(r)}}updateConnectionPreference(r){this.connectionOptions=r,this.walletClientType=r==="smartWalletOnly"?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(lh(Vl,this.connectionOptions))}};var $i=class extends or{constructor({provider:r,chains:o,defaultChain:n,rpcConfig:a,imported:i,walletIndex:l}){super("privy",o,n,a);this.connectorType="embedded";this.proxyProvider=r,this.walletIndex=l,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Hn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:pl,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as ch}from"react/jsx-runtime";var Qa=({style:e,...t})=>ch("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:ch("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as Cr,jsxs as F0}from"react/jsx-runtime";var Xa=({style:e,...t})=>F0("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[Cr("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Cr("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Cr("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),Cr("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),Cr("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),Cr("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),Cr("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),Cr("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),Cr("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),Cr("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),Cr("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),Cr("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),Cr("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as dh,jsxs as B0}from"react/jsx-runtime";var To=({style:e,...t})=>B0("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[dh("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),dh("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Ja=class extends or{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new et(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let l=a.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new Me("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw gr(r)}}},Za,ja=class extends or{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";el(this,Za,void 0);this.proxyProvider=new et(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?Yd(this,Za,{name:"MetaMask",icon:Xa,id:"io.metamask"}):i==="phantom"&&Yd(this,Za,{name:"Phantom",icon:To,id:"phantom"})}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return ju(this,Za)??{name:"Browser Extension",icon:Qa,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new Me("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw gr(r)}}};Za=new WeakMap;import{getAddress as tR}from"@ethersproject/address";import{Web3Provider as oR}from"@ethersproject/providers";import{isMobile as H0}from"react-device-detect";var zl=class extends Ja{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{H0||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new Me("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw gr(t)}}};var Kl=class extends or{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new et(void 0,Yn);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var Yl=class extends Kl{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:To,id:"phantom"}}};var G0=["privy"],V0=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","crypto.com_wallet_extension"],q0=["coinbase_wallet","coinbase_smart_wallet"],z0=["metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet"],K0=["unknown"],Y0=["phantom","solflare"],Q0=[...V0,...q0,...z0,...G0,...K0,...Y0];function ph(e){return Q0.includes(e)}function mh(e){return e.chainType==="solana"}function sp(e){return e.type==="solana"}var uh=class extends $n{constructor(r,o){let n=ph(r.name.toLowerCase())?r.name.toLowerCase():"unknown";super(n);this.chainType="solana";this.connectorType="solana_adapter";this.disconnect=()=>{this.adapter.disconnect().then(()=>this.onDisconnect()).catch(r=>console.error("Error disconnecting",r))};this.promptConnection=async()=>{try{await this.adapter.connect()}catch(r){throw gr(r)}};this.onDisconnect=()=>{this.syncAccounts()};this.onConnect=r=>{this.syncAccounts()};this.onError=r=>{this.syncAccounts()};this.onReadyStateChange=r=>{r!=="Installed"&&(this.connected=!1),this.syncAccounts()};this.adapter=r,this.shouldAutoConnect=o,this.wallets=[]}get isInstalled(){return this.adapter.readyState==="Installed"}buildConnectedWallet(r,o){if(r.readyState!=="Installed"||!r.publicKey)throw Error("Wallet is not connected.");let n;"signMessage"in r&&(n=async(...l)=>{if(!r.connected)throw Error("Wallet is not connected.");return await r.signMessage(l[0])});let a;"sendTransaction"in r&&(a=async(...l)=>await r.sendTransaction(l[0],l[1],l[2]));let i;return"signTransaction"in r&&(i=async l=>await r.signTransaction(l)),{type:"solana",address:r.publicKey.toBase58(),meta:o,imported:!1,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:async()=>r.connected,disconnect:()=>{try{r.disconnect()}catch{console.error("Wallet does not support programmatic disconnect")}},getProvider:_t,signMessage:n,sendTransaction:a,signTransaction:i}}async syncAccounts(){if(this.adapter.readyState!=="Installed"||!this.adapter.publicKey)this.wallets.length>0&&(this.wallets=[],this.emit("walletsUpdated"));else{let r={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};this.wallets.find(o=>this.adapter.publicKey&&o.address===this.adapter.publicKey.toBase58())||(this.wallets=[this.buildConnectedWallet(this.adapter,r)],this.emit("walletsUpdated"))}}get walletBranding(){return{id:this.adapter.name,name:this.adapter.name,icon:this.adapter.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAutoConnect&&await this.adapter.autoConnect(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort((r,o)=>o.connectedAt-r.connectedAt)[0]||null}async isConnected(){return this.adapter.connected&&["Installed"].includes(this.adapter.readyState)}subscribeListeners(){this.adapter.addListener("disconnect",this.onDisconnect),this.adapter.addListener("connect",this.onConnect),this.adapter.addListener("error",this.onError),this.adapter.addListener("readyStateChange",this.onReadyStateChange)}unsubscribeListeners(){this.adapter.removeAllListeners()}};import{EthereumProvider as Z0,OPTIONAL_EVENTS as J0,OPTIONAL_METHODS as j0}from"@walletconnect/ethereum-provider";import{isMobile as $0}from"react-device-detect";import{jsx as $a,jsxs as X0}from"react/jsx-runtime";var es=({style:e,...t})=>{let{app:r}=x();return X0("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[$a("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),$a("g",{clipPath:"url(#clip0_1765_9946)",children:$a("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),$a("defs",{children:$a("clipPath",{id:"clip0_1765_9946",children:$a("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var to=class extends or{constructor(r,o,n,a,i,l,c,d){super(d||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.privyAppName=c,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new et(void 0,this.rpcTimeoutDuration),d&&(this.walletEntry=Al[d],this.walletClientType=d)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=Pl(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:Xa,id:"io.metamask"}:{name:im(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||es,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Al[r],this.walletClientType=r,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,Nf(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new za)};this.onQrModalClosed=n,(async()=>{let i="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(i=l[0]),!i||i==="")throw new Me("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let c=Pl(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=c?.entry,this.walletClientType=c?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Ka(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(gr(i));return}o(new Me("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let l=lm(i.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[i.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Z0.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:J0,optionalMethods:j0,rpcMap:r,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),$0&&this.walletEntry){let{redirect:l,href:c}=Wf(i,this.walletEntry);Df({href:c,name:this.walletEntry.displayName}),this.redirectUri=l;let d=Lf(i,this.walletEntry);d?.redirect&&(this.fallbackUniversalRedirectUri=d.redirect),xl(l,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=Pl(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var cp=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>ev(o)).map(o=>fh(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},Ka=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Yn:Yn,ts=class extends tv{constructor(r,o,n,a,i,l,c,d,u,m,h){super();this.addSolanaWalletConnector=async r=>{this.findWalletConnector("solana_adapter",r.walletClientType)||this.addWalletConnector(r)};this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new et:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=c,this.shouldEnforceDefaultChainOnConnect=d,this.externalWalletConfig=u,this.privyAppName=m,this.privyAppLogo=h,this.storedConnections=lp()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;Z.get(jd)&&(Z.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Z.del(o)}),Z.del(jd));let r=sm(this.store,this.walletList,this.externalWalletConfig).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createEthereumWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createEthereumWalletConnector("coinbase_wallet","coinbase_wallet"),!on()&&this.walletList.includes("phantom")&&this.createEthereumWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createEthereumWalletConnector("wallet_connect_v2","unknown"),this.externalWalletConfig.solana?.connectors?.forEach(this.addSolanaWalletConnector),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.filter(Ya).find(n=>n.connectorType===r)??null:this.walletConnectors.filter(Ya).find(n=>n.connectorType===r&&n.walletClientType===o)??null}findSolanaWalletConnector(r,o){return this.walletConnectors.filter(mh).find(n=>n.connectorType===r&&n.walletClientType===o)??null}findEmbeddedWalletConnectors(){return this.walletConnectors.filter(r=>r.connectorType==="embedded")}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnectors({walletProxy:r,rootWallet:o,embeddedWallets:n,defaultChain:a,appId:i}){for(let l of n){let c=this.findEmbeddedWalletConnectors().find(d=>d.walletIndex===l.walletIndex);if(c&&Ya(c))c.proxyProvider.walletProxy=r;else{let d=new Ji({walletProxy:r,address:l.address,rootAddress:o.address,rpcConfig:this.rpcConfig,chains:this.chains,appId:i,chainId:a.id,walletIndex:l.walletIndex}),u=new $i({provider:d,chains:this.chains,defaultChain:a,rpcConfig:this.rpcConfig,imported:!1,walletIndex:l.walletIndex});this.addWalletConnector(u)}}}addImportedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded_imported","privy");if(i&&Ya(i))i.proxyProvider.walletProxy=r;else{let l=new Ji({walletProxy:r,rootAddress:o,address:o,walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:a,chainId:n.id}),c=new $i({provider:l,chains:this.chains,walletIndex:0,defaultChain:n,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(c)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter(r=>r.connectorType!=="embedded"),this.saveConnectionHistory(),this.storedConnections=lp(),this.emit("walletsUpdated")}removeImportedWalletConnector(){let r=this.findWalletConnector("embedded_imported","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=lp(),this.emit("walletsUpdated")}}async createEthereumWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a&&Ya(a))return a instanceof to&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new zl(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new ja(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new ja(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new ja(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Ja(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new ql(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):r==="phantom"?new Yl(this.defaultChain):new to(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize().catch(o=>{console.debug("Failed to initialize connector",o)})}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Z.put($d,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return!n||!eo(n)?null:n.sign(r)}setActiveWallet(r){this.activeWallet=fh(r),this.emit("walletsUpdated")}};function ji(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o&&n&&eo(o)&&eo(n)&&o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var rv=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",lp=()=>{let e=Z.get($d);return e&&Array.isArray(e)&&e.map(o=>rv(o)).every(Boolean)?e:[]};import{ofetch as ov}from"ofetch";var nv=[gl,vl,Cl,Tl],Ql=class{constructor({appId:t,appClientId:r,client:o,defaults:n}){this.appId=t,this.appClientId=r,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=Qd,this.client=o,this.defaults=n,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=ov.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:a,options:i})=>{let l=new Headers(i.headers);l.set("privy-app-id",this.appId),this.appClientId&&l.set("privy-client-id",this.appClientId),l.set("privy-ca-id",this.clientAnalyticsId||""),l.set("privy-client",`react-auth:${this.sdkVersion}`);let c=nv.includes(a.toString());if(!l.has("authorization")){let d=await this.client.getAccessToken({disableAutoRefresh:c});d!==null&&l.set("authorization",`Bearer ${d}`)}i.headers=l,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:a})=>{if(a instanceof DOMException&&a.name==="AbortError")throw new em}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ne(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ne(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ne(o)}}};var hh=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});import cn from"js-cookie";function yh(e){return e instanceof nn?"email":e instanceof an?"sms":e instanceof Go?"siwe":e instanceof Ba?"guest":e instanceof Fa?"custom_auth":e instanceof vo?e.meta.provider:null}import{isSafari as av}from"react-device-detect";function Xl(){return!(av&&window.location.origin.startsWith("http://localhost"))}import*as gh from"jose";var Hr=class{static parse(t){try{return new Hr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=gh.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var iv=30,Zl=class{constructor(){this.authenticateOnce=new Ge(async t=>this._authenticate(t)),this.linkOnce=new Ge(async t=>this._link(t)),this.refreshOnce=new Ge(this._refresh.bind(this)),this.destroyOnce=new Ge(this._destroy.bind(this)),this.forkSessionOnce=new Ge(this._forkSession.bind(this))}get token(){try{let t=Z.get(Gn);return typeof t=="string"?new Hr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Z.get(al);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Z.get(Hi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}getProviderAccessToken(t){try{let r=Z.get(Vi(t));if(typeof r=="string"){let o=new Hr(r);return o.isExpired()?(Z.del(Vi(t)),null):o.value}else return null}catch(r){return console.error(r),null}}get mightHaveServerCookies(){try{let t=cn.get(il);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"&&this.refreshToken!==Cm}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Hr.parse(this.token);return t!==null&&!t.isExpired(iv)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(t,r){typeof r=="string"?Z.put(Vi(t),r):Z.del(Vi(t))}async _authenticate(t){try{let r=await t.authenticate(),{user:o,is_new_user:n,oauth_tokens:a}=r;this.handleTokenResponse(r);let i=a,l=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:i.scopes}:void 0,c=yh(t);return c&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:c,isNewUser:n}}),c==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:Et(o),isNewUser:n,oAuthTokens:l}}catch(r){throw console.warn("Error authenticating session"),ze(r)}}async _link(t){try{let r=await t.link(),o=r.oauth_tokens,n=o?{provider:o.provider,accessToken:o.access_token,accessTokenExpiresInSeconds:o.access_token_expires_in_seconds,refreshToken:o.refresh_token,refreshTokenExpiresInSeconds:o.refresh_token_expires_in_seconds,scopes:o.scopes}:void 0;return{user:Et(r),oAuthTokens:n}}catch(r){throw console.warn("Error linking account"),ze(r)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(gl,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(vl,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),Et(n.user)}catch(n){if(n instanceof Lr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw ze(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&(this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token)):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token),t.identity_token&&this.storeIdentityToken(t.identity_token))}async _destroy(){try{await this.api?.post(Cl,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new C("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Bm,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw ze(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=Z.get(Gn);if(Z.put(Gn,t),!this.client?.useServerCookies){let o=Hr.parse(t)?.expiration;cn.set(Xd,t,{sameSite:"Strict",secure:Xl(),expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else Z.del(Gn),cn.remove(Xd),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(Z.put(al,t),this.client?.useServerCookies||cn.set(il,"t",{sameSite:"Strict",secure:Xl(),expires:30})):(Z.del(al),cn.remove(mm),cn.remove(il))}storeIdentityToken(t){if(this.client?.useServerCookies)return;Z.put(Zd,t);let r=Hr.parse(t)?.expiration;cn.set(Jd,t,{sameSite:"Strict",secure:Xl(),expires:r?new Date(r*1e3):void 0})}clearIdentityToken(){Z.del(Zd),cn.remove(Jd)}clearForkedToken(){Z.del(Hi)}};var dp,Jl,Ch,rs=class{constructor(t){el(this,Jl);this.apiUrl=t.apiUrl||nl,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!t.apiUrl&&t.apiUrl.startsWith("https://privy."),this.timeout=t.timeout||dm,this.appId=t.appId,this.appClientId=t.appClientId,this.clientAnalyticsId=$u(this,Jl,Ch).call(this),dp||(dp=new Zl),this.session=dp,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:l,externalWalletConfig:c,appName:d}){this.connectors||(this.connectors=new ts(this.appId,t,r,o,n,a,i,l,c,d))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new Ql({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new C("No auth flow in progress.");let{oAuthTokens:t}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:t}}storeProviderAccessToken(t,r){this.session.storeProviderAccessToken(t,r)}getProviderAccessToken(t){return this.session.getProviderAccessToken(t)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(t){t.linkedAccounts.filter(o=>o.type==="cross_app").forEach(o=>{this.storeProviderAccessToken(o.providerApp.id,null)})}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(Sf,{action:"verify"})}catch(t){throw ne(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(Pf,{});return hh(t.options)}catch(t){throw ne(t)}}async acceptTerms(){try{let t=await this.api.post(Af,{});return Et(t)}catch(t){throw ze(t)}}async unlinkEmail(t){try{let r=await this.api.post(nf,{address:t});return await this.getAuthenticatedUser()??Et(r)}catch(r){throw ze(r)}}async unlinkPhone(t){try{let r=await this.api.post(cf,{phoneNumber:t});return await this.getAuthenticatedUser()??Et(r)}catch(r){throw ze(r)}}async unlinkEthereumWallet(t){try{let r=await this.api.post(zm,{address:t});return await this.getAuthenticatedUser()??Et(r)}catch(r){throw ze(r)}}async unlinkSolanaWallet(t){try{let r=await this.api.post(Xm,{address:t});return await this.getAuthenticatedUser()??Et(r)}catch(r){throw ze(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(uf,{provider:t,subject:r});return await this.getAuthenticatedUser()??Et(o)}catch(o){throw ze(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(ef,{fid:t});return await this.getAuthenticatedUser()??Et(r)}catch(r){throw ze(r)}}async unlinkTelegram(t){try{let r=await this.api.post(Tf,{telegram_user_id:t});return await this.getAuthenticatedUser()??Et(r)}catch(r){throw ze(r)}}async unlinkPasskey(t){try{let r=await this.api.post(wf,{credential_id:t});return await this.getAuthenticatedUser()??Et(r)}catch(r){throw ze(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Tl,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(Rf,t)}catch(r){throw ze(r)}}async initCoinbaseOnRamp(t){try{return this.api.post(_f,t)}catch(r){throw ze(r)}}async getCoinbaseOnRampStatus({partnerUserId:t}){try{return this.api.get(`${Mf}?partnerUserId=${t}`)}catch(r){throw ze(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?this.session.hasRefreshCredentials()?Hr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:(this.session.destroyLocalState(),null):!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getSmartWalletsConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}/smart_wallets`,{baseURL:this.fallbackApiUrl,headers:t});return o.enabled?{enabled:o.enabled,smartWalletType:o.smart_wallet_type,configuredNetworks:o.configured_networks.map(n=>({chainId:n.chain_id,bundlerUrl:n.bundler_url,paymasterUrl:n.paymaster_url}))}:{enabled:o.enabled}}catch(t){throw ze(t)}}async getServerConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t}),n=o.telegram_auth_config?{botId:o.telegram_auth_config.bot_id,botName:o.telegram_auth_config.bot_name,linkEnabled:o.telegram_auth_config.link_enabled,seamlessAuthEnabled:o.telegram_auth_config.seamless_auth_enabled}:void 0,a=o.funding_config?{methods:o.funding_config.methods,defaultRecommendedAmount:o.funding_config.default_recommended_amount,defaultRecommendedCurrency:o.funding_config.default_recommended_currency,promptFundingOnWalletCreation:o.funding_config.prompt_funding_on_wallet_creation}:void 0;return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,telegramAuth:o.telegram_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config,telegramAuthConfiguration:n,fundingConfig:a}}catch(t){throw ze(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:t,captchaToken:r}){try{return(await this.api.post(Hm,{address:t,token:r})).nonce}catch(o){throw ze(o)}}async authenticateWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a,mode:i}){return await this.api.post(Gm,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:a,mode:i})}async linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){return await this.api.post(Vm,{message:t,signature:r,chainId:o,walletClientType:n,connectorType:a})}async linkSmartWallet({message:t,signature:r,smartWalletType:o}){try{let n=await this.api.post(qm,{message:t,signature:r,smart_wallet_type:o});return Et(n)}catch(n){throw ze(n)}}async linkWithSiwe({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a}){try{let i=await this.linkWithSiweInternal({message:t,signature:r,chainId:o,walletClientType:n,connectorType:a});return Et(i)}catch(i){throw ze(i)}}async generateSiwsNonce({address:t,captchaToken:r}){try{return(await this.api.post(Km,{address:t,token:r})).nonce}catch(o){throw ze(o)}}async authenticateWithSiwsInternal({message:t,signature:r,walletClientType:o,connectorType:n,mode:a}){return await this.api.post(Ym,{message:t,signature:r,walletClientType:o,connectorType:n,mode:a})}async linkWithSiwsInternal({message:t,signature:r,walletClientType:o,connectorType:n}){return await this.api.post(Qm,{message:t,signature:r,walletClientType:o,connectorType:n})}async linkWithSiws({message:t,signature:r,walletClientType:o,connectorType:n}){try{let a=await this.linkWithSiwsInternal({message:t,signature:r,walletClientType:o,connectorType:n});return Et(a)}catch(a){throw ze(a)}}};Jl=new WeakSet,Ch=function(){if(typeof window>"u")return null;try{let r=Z.get(Gi);if(typeof r=="string"&&r.length>0)return r}catch{}let t=sv();try{return Z.put(Gi,t),t}catch{return t}};import{Turnstile as mv}from"@marsidev/react-turnstile";import{useEffect as fv,useMemo as hv}from"react";import{useMemo as lv,useRef as cv,useContext as dv,useState as pp,createContext as pv}from"react";import{jsx as uv}from"react/jsx-runtime";var vh=pv({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:_t,setError:_t,setExecuting:_t,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:_t,reset:_t,execute:_t}),Vt=class extends tr{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},wh=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=cv(null),[a,i]=pp(),[l,c]=pp(),[d,u]=pp(!1),m=lv(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return uv(vh.Provider,{value:{...m,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:c,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),c(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),c(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await am(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Vt("Captcha failed",null,"captcha_timeout")}}},children:e})},Ee=()=>dv(vh);import{jsx as bh}from"react/jsx-runtime";var up=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=Ee(),[,c]=hv(()=>r?.split("t:")||[],[r]);if(fv(()=>l.current?.remove,[]),!t)return null;if(!c)throw new Error("Unsupported captcha site key");return bh("div",{className:"hidden h-0 w-0",children:bh(mv,{...e,ref:l,siteKey:c,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as JS,useEffect as F3,useRef as jS,useState as $S}from"react";import G3 from"styled-components";function mp(e){Je("configureMfa",e)}import Dv from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import kh from"styled-components";import ea,{css as Eh}from"styled-components";import hp from"styled-components";import{Fragment as gv,jsx as fp,jsxs as Cv}from"react/jsx-runtime";var st=({success:e,fail:t})=>Cv(gv,{children:[fp(lt,{className:e?"success":t?"fail":""}),fp(os,{className:e?"success":t?"fail":""})]}),lt=hp.span`
24
- && {
25
- width: 82px;
26
- height: 82px;
27
- border-width: 4px;
28
- border-style: solid;
29
- border-color: ${e=>e.color??"var(--privy-color-accent)"};
30
- border-bottom-color: transparent;
31
- border-radius: 50%;
32
- display: inline-block;
33
- box-sizing: border-box;
34
- animation: rotation 1.2s linear infinite;
35
- transition: border-color 800ms;
36
- }
37
-
38
- @keyframes rotation {
39
- 0% {
40
- transform: rotate(0deg);
41
- }
42
- 100% {
43
- transform: rotate(360deg);
44
- }
45
- }
46
-
47
- &&&.success {
48
- border-color: var(--privy-color-success);
49
- border-bottom-color: var(--privy-color-success);
50
- }
51
-
52
- &&&.fail {
53
- border-color: var(--privy-color-error);
54
- border-bottom-color: var(--privy-color-error);
55
- }
56
- `,os=hp(lt)`
57
- && {
58
- border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
59
- animation: none;
60
- opacity: 0.5;
61
- }
62
- `,So=e=>fp(yv,{color:e.color||"var(--privy-color-foreground-3)"}),yv=hp(lt)`
63
- && {
64
- height: 1rem;
65
- width: 1rem;
66
- margin: 2px 0;
67
- border-width: 1.5px;
68
-
69
- /* Override default Loader to match button transitions */
70
- transition: border-color 200ms ease;
71
- }
72
- `;import{jsx as nr,jsxs as $l}from"react/jsx-runtime";var ns=ea.button`
73
- display: flex;
74
- flex-direction: row;
75
- align-items: center;
76
- justify-content: center;
77
- user-select: none;
78
-
79
- & {
80
- width: 100%;
81
- cursor: pointer;
82
- border-radius: var(--privy-border-radius-md);
83
-
84
- font-size: 1rem;
85
- font-style: normal;
86
- font-weight: 500;
87
- line-height: 22px; /* 137.5% */
88
- letter-spacing: -0.016px;
89
- }
90
-
91
- && {
92
- padding: 12px 16px;
93
- }
94
- `,U=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>nr(Th,{disabled:t||r,...n,children:t?$l("span",{children:[nr(So,{}),o?nr("span",{children:o}):null]}):e}),ta=({children:e,loading:t,disabled:r,...o})=>nr(vv,{disabled:r,...o,children:t?nr(So,{color:"var(--privy-color-foreground-accent)"}):e}),vv=ea(ns)`
95
- position: relative;
96
-
97
- && {
98
- background-color: var(--privy-color-accent);
99
- color: var(--privy-color-foreground-accent);
100
-
101
- transition: background-color 200ms ease;
102
- }
103
-
104
- &:hover {
105
- background-color: var(--privy-color-accent-dark);
106
- }
107
-
108
- &:active {
109
- background-color: var(--privy-color-accent-dark);
110
- }
111
-
112
- &:disabled,
113
- &:hover:disabled,
114
- &:active:disabled {
115
- cursor: not-allowed;
116
- pointer-events: none;
117
- color: var(--privy-color-foreground-accent);
118
- background-color: var(--privy-color-accent-dark);
119
- }
120
- `,jl=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>nr(Th,{as:"a",disabled:t||r,...n,children:t?$l("span",{children:[nr(So,{}),o?nr("span",{children:o}):null]}):e}),Th=ea(ns)`
121
- position: relative;
122
-
123
- && {
124
- background-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-accent)"};
125
- color: var(--privy-color-foreground-accent);
126
-
127
- transition: background-color 200ms ease;
128
- }
129
-
130
- &:hover {
131
- background-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-accent-dark)"};
132
- }
133
-
134
- &:active {
135
- background-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-accent-dark)"};
136
- }
137
-
138
- &:hover:disabled,
139
- &:active:disabled {
140
- background-color: var(--privy-color-background-2);
141
- color: var(--privy-color-foreground-3);
142
- cursor: not-allowed;
143
- }
144
-
145
- /* If an anchor tag, :disabled isn't a thing, so manually set state */
146
- ${e=>e.disabled?Eh`
147
- &&&,
148
- &&&:hover,
149
- &&&:active {
150
- background-color: var(--privy-color-background-2);
151
- color: var(--privy-color-foreground-3);
152
- cursor: not-allowed;
153
- pointer-events: none;
154
- }
155
- `:""}
156
-
157
- > span {
158
- display: flex;
159
- align-items: center;
160
- gap: 8px;
161
-
162
- opacity: 1;
163
- animation: fadein 200ms ease;
164
- }
165
- `,ro=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>nr(wv,{disabled:t||r,...n,children:t?$l("span",{children:[nr(So,{}),o?nr("span",{children:o}):null]}):e}),wv=ea(ns)`
166
- && {
167
- border-width: 1px;
168
- border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
169
- color: var(--privy-color-foreground);
170
-
171
- transition: border-color 200ms ease;
172
- }
173
-
174
- &:hover,
175
- &:active {
176
- border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
177
- }
178
-
179
- &:hover:disabled,
180
- &:active:disabled {
181
- border-color: var(--privy-color-foreground-accent);
182
- color: var(--privy-color-foreground-3);
183
- cursor: not-allowed;
184
- }
185
-
186
- > span {
187
- display: flex;
188
- align-items: center;
189
- gap: 8px;
190
-
191
- opacity: 1;
192
- animation: fadein 200ms ease;
193
- }
194
- `,dn=ea.button`
195
- && {
196
- padding: 12px 16px;
197
- font-weight: 500;
198
- text-align: center;
199
- color: var(--privy-color-foreground-accent);
200
- background-color: var(--privy-color-accent);
201
- border-radius: var(--privy-border-radius-sm);
202
- min-width: 144px;
203
- opacity: ${e=>e.invisible?"0":"1"};
204
- transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
205
- user-select: none;
206
-
207
- ${e=>e.invisible&&Eh`
208
- pointer-events: none;
209
- `}
210
-
211
- &:hover {
212
- background-color: var(--privy-color-accent-dark);
213
- }
214
- &:active {
215
- background-color: var(--privy-color-accent-dark);
216
- }
217
-
218
- &:hover:disabled,
219
- &:active:disabled {
220
- background-color: var(--privy-color-background-2);
221
- color: var(--privy-color-foreground-3);
222
- cursor: not-allowed;
223
- }
224
- }
225
- `,aM=ea.div`
226
- /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
227
- height: 44px;
228
- `,ei=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>$l(bv,{isSubmitting:o,onClick:t,disabled:r,...n,children:[nr("span",{children:e}),nr("span",{children:nr(So,{})})]}),bv=ea.button`
229
- && {
230
- color: var(--privy-color-accent);
231
- font-size: 16px;
232
- font-style: normal;
233
- font-weight: 500;
234
- line-height: 24px;
235
- cursor: pointer;
236
- border-radius: 0px var(--privy-border-radius-mdlg) var(--privy-border-radius-mdlg) 0px;
237
- border: none;
238
- transition: color 200ms ease;
239
-
240
- /* Tablet and Up */
241
- @media (min-width: 441px) {
242
- font-size: 14px;
243
- }
244
-
245
- :hover {
246
- color: var(--privy-color-accent-dark);
247
- }
248
-
249
- && > :first-child {
250
- opacity: ${e=>e.isSubmitting?0:1};
251
- }
252
-
253
- && > :last-child {
254
- position: absolute;
255
- display: flex;
256
- top: 50%;
257
- left: 50%;
258
- transform: translate3d(-50%, -50%, 0);
259
-
260
- /** Will map to the opposite of first span */
261
- opacity: ${e=>e.isSubmitting?1:0};
262
- }
263
-
264
- :disabled,
265
- :hover:disabled {
266
- color: var(--privy-color-foreground-3);
267
- cursor: not-allowed;
268
- }
269
- }
270
- `;import Ev from"styled-components";var Sh=Ev.span`
271
- && {
272
- width: 82px;
273
- height: 82px;
274
- border-width: 4px;
275
- border-style: solid;
276
- border-color: ${e=>e.color??"var(--privy-color-accent)"};
277
- background-color: ${e=>e.color??"var(--privy-color-accent)"};
278
- border-radius: 50%;
279
- display: inline-block;
280
- box-sizing: border-box;
281
- }
282
- `;import Tv from"@heroicons/react/24/outline/ArrowLeftIcon";import Sv from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Pv from"@heroicons/react/24/outline/XMarkIcon";import ti from"styled-components";import{jsx as ar,jsxs as Ph}from"react/jsx-runtime";var Av=({backFn:e})=>ar("div",{children:ar(yp,{onClick:e,children:ar(Tv,{height:"16px",width:"16px",strokeWidth:2})})}),xv=({infoFn:e})=>ar("div",{children:ar(Rv,{"aria-label":"info",onClick:e,children:ar(Sv,{height:"22px",width:"22px",strokeWidth:2})})}),kv=e=>ar("div",{children:ar(yp,{"aria-label":"close modal",onClick:e.onClose,children:ar(Pv,{height:"16px",width:"16px",strokeWidth:2})})});var k=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:a}=_(),i=Be();return Ph(_v,{children:[Ph(Mv,{children:[e&&ar(Av,{backFn:e}),t&&ar(xv,{infoFn:t})]}),o&&ar(Wv,{id:"privy-dialog-title",children:o}),ar(Iv,{children:!i.render.standalone&&n&&ar(kv,{onClose:r||(()=>a())})})]})},yp=ti.button`
283
- && {
284
- cursor: pointer;
285
- display: flex;
286
- opacity: 0.6;
287
-
288
- background-color: var(--privy-color-background-2);
289
- border-radius: var(--privy-border-radius-full);
290
- padding: 4px;
291
-
292
- > svg {
293
- margin: auto;
294
- color: var(--privy-color-foreground);
295
- }
296
-
297
- :hover {
298
- opacity: 1;
299
- }
300
- }
301
- `,Rv=ti(yp)`
302
- && {
303
- background-color: transparent;
304
- }
305
- `,_v=ti.div`
306
- padding: 16px 0;
307
- display: flex;
308
- align-items: center;
309
- justify-content: space-between;
310
-
311
- h2 {
312
- font-size: 16px;
313
- line-height: 24px;
314
- font-weight: 600;
315
- color: var(--privy-color-foreground);
316
- }
317
- `,Mv=ti.div`
318
- flex: 1;
319
- align-items: center;
320
- display: flex;
321
- gap: 8px;
322
- `,Iv=ti.div`
323
- flex: 1;
324
- display: flex;
325
- justify-content: flex-end;
326
- `,Wv=ti.div`
327
- overflow: hidden;
328
- white-space: nowrap;
329
- max-width: 100%;
330
- text-overflow: ellipsis;
331
- text-align: center;
332
- color: var(--privy-color-foreground-2);
333
- `;import Lv from"styled-components";var Ov=Lv.div`
334
- display: flex;
335
- flex-direction: column;
336
- justify-content: center;
337
- align-items: center;
338
- width: 100%;
339
- height: 82px;
340
-
341
- > div {
342
- position: relative;
343
- }
344
-
345
- > div > span {
346
- position: absolute;
347
- left: -41px;
348
- top: -41px;
349
- }
350
-
351
- > div > :last-child {
352
- position: absolute;
353
- left: -19px;
354
- top: -19px;
355
- }
356
- `,rt=Ov;import pn,{css as Nv}from"styled-components";var vr=pn.div`
357
- text-align: left;
358
- flex-grow: 1;
359
- `,ec=pn.div`
360
- display: flex;
361
- flex-direction: column;
362
- justify-content: flex-end;
363
- flex-grow: 1;
364
- `,ir=pn.div`
365
- display: flex;
366
- flex-direction: column;
367
- gap: 12px;
368
-
369
- /* for Internet Explorer, Edge */
370
- -ms-overflow-style: none;
371
-
372
- /* for Firefox */
373
- scrollbar-width: none;
374
-
375
- /* for Chrome, Safari, and Opera */
376
- &::-webkit-scrollbar {
377
- display: none;
378
- }
379
- `,Ah=pn(ir)`
380
- ${e=>{if(e.colorScheme==="light")return"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;";if(e.colorScheme==="dark")return"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;"}}
381
-
382
- background-repeat: no-repeat;
383
- background-size: 100% 32px, 100% 16px;
384
- background-attachment: local, scroll;
385
- `,xh=Nv`
386
- && {
387
- width: 100%;
388
- font-size: 16px;
389
- line-height: 24px;
390
-
391
- /* Tablet and Up */
392
- @media (min-width: 440px) {
393
- font-size: 14px;
394
- }
395
-
396
- display: flex;
397
- gap: 12px;
398
- align-items: center;
399
-
400
- padding: 12px 16px;
401
- border: 1px solid var(--privy-color-foreground-4) !important;
402
- border-radius: var(--privy-border-radius-mdlg);
403
- transition: background-color 200ms ease;
404
-
405
- cursor: pointer;
406
-
407
- &:hover {
408
- background-color: var(--privy-color-background-2);
409
- }
410
-
411
- &:disabled {
412
- cursor: pointer;
413
- background-color: var(--privy-color-background-2);
414
- }
415
-
416
- svg {
417
- height: 24px;
418
- max-height: 24px;
419
- max-width: 24px;
420
- }
421
- }
422
- `,tc=pn.div`
423
- text-align: center;
424
- font-size: 14px;
425
- margin-bottom: 24px;
426
- `,Te=pn.button`
427
- ${xh}
428
- `,gp=pn.a`
429
- ${xh}
430
- `,oo=pn.div`
431
- width: 100%;
432
- height: 100%;
433
- min-height: inherit;
434
- display: flex;
435
- flex-direction: column;
436
- ${e=>e.if?"display: none;":""}
437
- `;import{Fragment as Bv,jsx as ra,jsxs as as}from"react/jsx-runtime";var Rh=()=>{let{navigate:e,app:t}=x();return as(Bv,{children:[ra(k,{}),as(Uv,{children:[ra(rt,{children:as("div",{children:[ra(Sh,{color:"var(--privy-color-warn-light)"}),ra(Dv,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),as(Fv,{children:[ra("h3",{children:"Account not found"}),as("p",{children:["Please try logging in again or go to ",t.name," to create an account."]})]}),ra(vr,{}),ra(U,{onClick:()=>e("LANDING"),children:"Try logging in again"})]})]})},Uv=kh.div`
438
- display: flex;
439
- flex-direction: column;
440
- align-items: center;
441
- justify-content: center;
442
- gap: 24px;
443
- width: 100%;
444
- padding-bottom: 16px;
445
- margin-top: 24px;
446
- `,Fv=kh.div`
447
- display: flex;
448
- flex-direction: column;
449
- gap: 8px;
450
- `;import Mh from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Hv from"@heroicons/react/24/solid/DocumentCheckIcon";import Gv from"styled-components";import yt from"styled-components";var Ue=yt.div`
451
- display: flex;
452
- flex-direction: column;
453
- align-items: center;
454
- padding: 0px 0px 30px;
455
- @media (max-width: 440px) {
456
- padding: 10px 10px 20px;
457
- }
458
- `,pe=yt.div`
459
- font-size: 18px;
460
- line-height: 30px;
461
- text-align: center;
462
- font-weight: 600;
463
- margin-bottom: 10px;
464
- `,me=yt.div`
465
- font-size: 0.875rem;
466
-
467
- text-align: center;
468
- `,Gr=yt.div`
469
- display: flex;
470
- flex-direction: column;
471
- align-items: center;
472
- gap: 10px;
473
- flex-grow: 1;
474
- padding: 20px 0;
475
- @media (max-width: 440px) {
476
- padding: 10px 10px 20px;
477
- }
478
- `,oa=yt.div`
479
- display: flex;
480
- flex-direction: column;
481
- align-items: stretch;
482
- gap: 0.75rem;
483
- padding: 1rem 0rem 0rem;
484
- flex-grow: 1;
485
- width: 100%;
486
- `,sr=yt.div`
487
- width: 25px;
488
- display: flex;
489
- align-items: center;
490
- justify-content: flex-start;
491
-
492
- > svg {
493
- z-index: 2;
494
- height: 25px !important;
495
- width: 25px !important;
496
- color: var(--privy-color-accent);
497
- }
498
- `,lr=yt.div`
499
- display: flex;
500
- align-items: center;
501
- gap: 10px;
502
- font-size: 0.875rem;
503
- line-height: 1rem;
504
- text-align: left;
505
- `,Wt=yt.div`
506
- display: flex;
507
- flex-direction: column;
508
- gap: 10px;
509
- padding-top: 20px;
510
- `,rc=yt.div`
511
- display: flex;
512
- flex-direction: column;
513
- align-items: stretch;
514
- gap: 1rem;
515
- padding: 1rem 0rem 0rem;
516
- flex-grow: 1;
517
- width: 100%;
518
- `,oc=yt.div`
519
- display: flex;
520
- gap: 5px;
521
- width: 100%;
522
- `,nc=yt.button`
523
- && {
524
- background-color: transparent;
525
- color: var(--privy-color-foreground-3);
526
- padding: 0 10px;
527
- display: flex;
528
- align-items: center;
529
-
530
- > svg {
531
- z-index: 2;
532
- height: 20px !important;
533
- width: 20px !important;
534
- }
535
- }
536
-
537
- &&:hover {
538
- color: var(--privy-color-error);
539
- }
540
- `,ac=yt.div`
541
- display: flex;
542
- align-items: center;
543
- gap: 0.5rem;
544
-
545
- > svg {
546
- z-index: 2;
547
- height: 20px !important;
548
- width: 20px !important;
549
- }
550
- `,na=yt.div`
551
- display: flex;
552
- align-items: center;
553
- gap: 6px;
554
- font-weight: 400 !important;
555
- color: ${e=>e.isAccent?"var(--privy-color-accent)":"var(--privy-color-foreground-3)"};
556
-
557
- > svg {
558
- z-index: 2;
559
- height: 18px !important;
560
- width: 18px !important;
561
- display: flex !important;
562
- align-items: flex-end;
563
- }
564
- `,ic=yt.div`
565
- width: 100%;
566
- display: flex;
567
- justify-content: space-between;
568
- `,_h=yt.p`
569
- text-align: left;
570
- width: 100%;
571
- color: var(--privy-color-foreground-3) !important;
572
- `,is=yt.button`
573
- display: flex;
574
- flex-direction: row;
575
- align-items: center;
576
- justify-content: center;
577
- user-select: none;
578
-
579
- & {
580
- width: 100%;
581
- cursor: pointer;
582
- border-radius: var(--privy-border-radius-md);
583
-
584
- font-size: 0.875rem;
585
- line-height: 1rem;
586
- font-style: normal;
587
- font-weight: 500;
588
- line-height: 22px; /* 137.5% */
589
- letter-spacing: -0.016px;
590
- }
591
-
592
- && {
593
- color: ${e=>e.theme==="dark"?"var(--privy-color-foreground-2)":"var(--privy-color-accent)"};
594
- background-color: transparent;
595
-
596
- padding: 0.5rem 0px;
597
- }
598
-
599
- &:hover {
600
- text-decoration: underline;
601
- }
602
- `,tt=yt.div`
603
- display: flex;
604
- align-items: center;
605
- justify-content: center;
606
- width: 90px;
607
- height: 90px;
608
- border-radius: 50%;
609
- background-color: ${({status:e})=>e==="success"?"var(--privy-color-success)":"var(--privy-color-accent)"};
610
-
611
- > svg {
612
- z-index: 2;
613
- height: 50px !important;
614
- width: auto !important;
615
- color: white;
616
- }
617
- `,sc=yt.div`
618
- color: var(--privy-color-error);
619
- `;import{Fragment as zv,jsx as Po,jsxs as ss}from"react/jsx-runtime";var Ih=()=>{let{user:e,logout:t}=q(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=x(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:c}=_(),d=m=>{m?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=d;let u=async m=>{m.preventDefault(),await i(),e&&bt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>{console.error(h),c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:h,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return Po(Vv,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:d})},Vv=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>ss(zv,{children:[Po(k,{closeable:!1}),Po(Hv,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),Po(pe,{style:{marginTop:24},children:"One last step"}),Po(me,{children:"By signing up, you agree to our terms and privacy policy."}),ss(ir,{style:{marginTop:24},children:[e&&ss(gp,{target:"_blank",href:e,children:["View Terms ",Po(Mh,{style:{marginLeft:"auto"}})]}),t&&ss(gp,{target:"_blank",href:t,children:["View Privacy Policy ",Po(Mh,{style:{marginLeft:"auto"}})]})]}),ss(qv,{style:{marginTop:24},children:[Po(ro,{onClick:o,children:"No thanks"}),Po(U,{onClick:r,children:"Accept"})]}),Po(B,{})]}),qv=Gv.div`
620
- display: flex;
621
- gap: 10px;
622
- `;import Lh from"styled-components";import Kv from"styled-components";var lc=Kv.span`
623
- && {
624
- width: 82px;
625
- height: 82px;
626
- border-width: 4px;
627
- border-style: solid;
628
- border-color: ${e=>e.color??"var(--privy-color-accent)"};
629
- border-bottom-color: transparent;
630
- border-radius: 50%;
631
- display: inline-block;
632
- box-sizing: border-box;
633
- animation: rotation 1.2s linear infinite;
634
- transition: border-color 800ms;
635
- border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
636
- }
637
- `;import{jsx as Wh}from"react/jsx-runtime";var cc=({style:e,...t})=>Wh("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:Wh("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Cp,jsx as Ao,jsxs as dc}from"react/jsx-runtime";var Oh=()=>{let{navigate:e,app:t}=x(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return dc(Cp,{children:[Ao(k,{}),dc(Yv,{children:[Ao(rt,{children:dc("div",{children:[Ao(lc,{}),Ao(cc,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),dc(Qv,{children:[typeof r=="string"?Ao("h3",{children:r}):Ao(Cp,{children:r}),typeof o=="string"?Ao("p",{children:o}):Ao(Cp,{children:o})]}),t?.allowlistConfig.errorCtaLink?Ao(U,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):Ao(U,{onClick:()=>{e("LANDING")},children:n})]})]})},Yv=Lh.div`
638
- display: flex;
639
- flex-direction: column;
640
- align-items: center;
641
- justify-content: center;
642
- gap: 24px;
643
- width: 100%;
644
- padding-bottom: 16px;
645
- `,Qv=Lh.div`
646
- display: flex;
647
- flex-direction: column;
648
- gap: 8px;
649
- `;import Jv from"@heroicons/react/20/solid/CheckIcon";import jv from"@heroicons/react/24/outline/EnvelopeIcon";import $v from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as wp,useState as cs}from"react";import{isMobile as ew}from"react-device-detect";import ia from"styled-components";import cr from"styled-components";var dr=cr.div`
650
- display: flex;
651
- flex-direction: column;
652
- align-items: flex-start;
653
- justify-content: flex-end;
654
- margin-top: auto;
655
- gap: 16px;
656
- flex-grow: 100;
657
- `,Pt=cr.div`
658
- display: flex;
659
- flex-direction: column;
660
- align-items: center;
661
- justify-content: center;
662
- flex-grow: 1;
663
- width: 100%;
664
- `,Nh=cr.div`
665
- display: flex;
666
- flex-direction: column;
667
- align-items: center;
668
- width: 100%;
669
- `,ri=cr(Pt)`
670
- padding: 20px 0;
671
- `,wr=cr(Pt)`
672
- gap: 16px;
673
- `,un=cr.div`
674
- display: flex;
675
- flex-direction: column;
676
- width: 100%;
677
- `,je=cr.div`
678
- display: flex;
679
- flex-direction: column;
680
- gap: 8px;
681
- `,lI=cr.div`
682
- display: flex;
683
- flex-direction: column;
684
- justify-content: space-between;
685
- height: 100%;
686
- `,Dh=cr.div`
687
- display: flex;
688
- flex-direction: column;
689
- justify-content: flex-start;
690
- align-items: flex-start;
691
- text-align: left;
692
- gap: 8px;
693
- padding: 16px;
694
- margin-top: 16px;
695
- margin-bottom: 16px;
696
- width: 100%;
697
- background: var(--privy-color-background-2);
698
- border-radius: var(--privy-border-radius-md);
699
- && h4 {
700
- color: var(--privy-color-foreground-3);
701
- font-size: 14px;
702
- text-decoration: underline;
703
- font-weight: medium;
704
- }
705
- && p {
706
- color: var(--privy-color-foreground-3);
707
- font-size: 14px;
708
- }
709
- `,oe=cr.div`
710
- height: 16px;
711
- `,ae=cr.div`
712
- height: 12px;
713
- `,Uh=cr.div`
714
- position: relative;
715
- `,oi=cr.div`
716
- height: ${e=>e.height??"12"}px;
717
- `,Fh=cr.div`
718
- background-color: var(--privy-color-accent);
719
- display: flex;
720
- justify-content: center;
721
- align-items: center;
722
- border-radius: 50%;
723
- border-color: white;
724
- border-width: 2px !important;
725
- `;import vp from"styled-components";import{Fragment as Zv,jsx as ls,jsxs as Hh}from"react/jsx-runtime";var aa=({title:e,description:t,children:r,...o})=>ls(Bh,{...o,children:Hh(Zv,{children:[ls("h3",{children:e}),typeof t=="string"?ls("p",{children:t}):t,r]})}),xo=vp(aa)`
726
- margin-bottom: 24px;
727
- `,ye=({title:e,description:t,icon:r,children:o,...n})=>Hh(Xv,{...n,children:[r||null,ls("h3",{children:e}),t&&typeof t=="string"?ls("p",{children:t}):t,o]}),Bh=vp.div`
728
- display: flex;
729
- flex-direction: column;
730
- justify-content: flex-start;
731
- align-items: flex-start;
732
- text-align: left;
733
- gap: 8px;
734
- width: 100%;
735
- margin-bottom: 24px;
736
-
737
- && h3 {
738
- font-size: 17px;
739
- color: var(--privy-color-foreground);
740
- }
741
-
742
- /* Sugar assuming children are paragraphs. Otherwise, handling styling on your own */
743
- && p {
744
- color: var(--privy-color-foreground-2);
745
- font-size: 14px;
746
- }
747
- `,Xv=vp(Bh)`
748
- align-items: center;
749
- text-align: center;
750
- gap: 16px;
751
-
752
- h3 {
753
- margin-bottom: 24px;
754
- }
755
- `;import{Fragment as cw,jsx as qt,jsxs as qo}from"react/jsx-runtime";var bp=6,Gh=new Array(bp).fill(""),tw=1400,rw=30;var qh=()=>{let{app:e,navigate:t,lastScreen:r,navigateBack:o,setModalData:n,onUserCloseViaDialogOrKeybindRef:a}=x(),{closePrivyModal:i,resendEmailCode:l,resendSmsCode:c,getAuthMeta:d,loginWithCode:u,updateWallets:m,createAnalyticsEvent:h}=_(),{authenticated:g,logout:w,user:v}=q(),[E,R]=cs(Gh),[A,T]=cs(!1),[P,S]=cs(null),[M,N]=cs(null),[H,F]=cs(0);a.current=()=>null;let K=d()?.email?0:1,W=Le,X=W-500;wp(()=>{if(H){let te=setTimeout(()=>{F(H-1)},1e3);return()=>clearTimeout(te)}},[H]),wp(()=>{if(g&&A&&v){if(e?.legal.requireUsersAcceptTerms&&!v.hasAcceptedTerms){let Q=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},X);return()=>clearTimeout(Q)}if(bt(v,e?.embeddedWallets?.createOnLogin)){let Q=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:Re=>{console.error(Re),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Re,screen:"AwaitingPasswordlessCodeScreen"}}),w()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},X);return()=>clearTimeout(Q)}else{m();let Q=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),W);return()=>clearTimeout(Q)}}},[g,A,v]),wp(()=>{if(P&&M===0){let te=setTimeout(()=>{R(Gh),S(null),document.querySelector("input[name=code-0]")?.focus()},tw);return()=>clearTimeout(te)}},[P]);let L=te=>{te.preventDefault();let Q=te.currentTarget.value.replace(" ","");if(Q==="")return;if(isNaN(Number(Q))){S("Code should be numeric"),N(1);return}S(null),N(null);let Re=Number(te.currentTarget.name?.charAt(5)),he=[...Q||[""]].slice(0,bp-Re),re=[...E.slice(0,Re),...he,...E.slice(Re+he.length)];R(re);let se=he.length,Xe=Math.min(Math.max(Re+se,0),bp-1);isNaN(Number(te.currentTarget.value))||document.querySelector(`input[name=code-${Xe}]`)?.focus(),re.every($e=>$e&&!isNaN(+$e))&&(document.querySelector(`input[name=code-${Xe}]`)?.blur(),u(re.join("")).then(()=>T(!0)).catch(ce=>{if(ce instanceof Lr&&ce.privyErrorCode==="invalid_credentials")S("Invalid or expired verification code");else if(ce instanceof Lr&&ce.privyErrorCode==="cannot_link_more_of_type")S(ce.message);else if(ce instanceof Lr&&ce.privyErrorCode==="max_accounts_reached"){console.error(new yo(ce).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else if(ce instanceof Lr&&ce.privyErrorCode==="user_does_not_exist"){t("ACCOUNT_NOT_FOUND_SCREEN");return}else if(ce instanceof Lr&&ce.privyErrorCode==="linked_to_another_user"){n({errorModalData:{error:ce,previousScreen:r??"AWAITING_PASSWORDLESS_CODE"}}),t("ERROR_SCREEN",!1);return}else S("Issue verifying code");N(0)}))},Y=te=>{M===1&&(S(null),N(null));let Q=[...E.slice(0,te),"",...E.slice(te+1)];R(Q),te>0&&document.querySelector(`input[name=code-${te-1}]`)?.focus()},ke=K==0?qt(jv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):qt($v,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),be=K==0?qo("p",{children:["Please check ",qt(Vh,{children:d()?.email})," for an email from privy.io and enter your code below."]}):qo("p",{children:["Please check ",qt(Vh,{children:d()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return qo(cw,{children:[qt(k,{backFn:()=>o()},"header"),qo(ow,{children:[qt(ye,{title:"Enter confirmation code",description:be,icon:ke}),qo(Nh,{children:[qo(nw,{children:[qt(aw,{fail:!!P,success:A,children:qt("span",{children:P||(A?"Success!":"")})}),qt("div",{children:E.map((te,Q)=>qt("input",{name:`code-${Q}`,type:"text",value:E[Q],onChange:L,onKeyUp:Re=>{Re.key==="Backspace"&&Y(Q)},inputMode:"numeric",autoFocus:Q===0,pattern:"[0-9]",className:`${A?"success":""} ${P?"fail":""}`,autoComplete:ew?"one-time-code":"off"},Q))})]}),qo(iw,{children:[qo("span",{children:["Didn't get ",K==0?"an email":"a message","?"]}),H?qo(lw,{children:[qt(Jv,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),qt("span",{children:"Code sent"})]}):qt(sw,{children:qt("button",{onClick:async()=>{F(rw),K==0?await l():await c()},children:"Resend code"})})]})]})]}),qt(B,{})]})},ow=ia.div`
756
- display: flex;
757
- flex-direction: column;
758
- align-items: flex-start;
759
- justify-content: center;
760
- margin: auto;
761
- gap: 16px;
762
- flex-grow: 1;
763
- `,nw=ia.div`
764
- display: flex;
765
- flex-direction: column;
766
- width: 100%;
767
- gap: 8px;
768
-
769
- > div:last-child {
770
- display: flex;
771
- justify-content: center;
772
- gap: 0.5rem;
773
- width: 100%;
774
- border-radius: var(--privy-border-radius-md);
775
-
776
- > input {
777
- border: 1px solid var(--privy-color-foreground-4);
778
- background: var(--privy-color-background);
779
- border-radius: var(--privy-border-radius-md);
780
- padding: 8px 10px;
781
- height: 58px;
782
- width: 46px;
783
- text-align: center;
784
- font-size: 18px;
785
- }
786
-
787
- > input:focus {
788
- border: 1px solid var(--privy-color-accent);
789
- }
790
-
791
- > input:invalid {
792
- border: 1px solid var(--privy-color-error);
793
- }
794
-
795
- > input.success {
796
- border: 1px solid var(--privy-color-success);
797
- }
798
-
799
- > input.fail {
800
- border: 1px solid var(--privy-color-error);
801
- animation: shake 180ms;
802
- animation-iteration-count: 2;
803
- }
804
- }
805
-
806
- @keyframes shake {
807
- 0% {
808
- transform: translate(1px, 0px);
809
- }
810
- 33% {
811
- transform: translate(-1px, 0px);
812
- }
813
- 67% {
814
- transform: translate(-1px, 0px);
815
- }
816
- 100% {
817
- transform: translate(1px, 0px);
818
- }
819
- }
820
- `,aw=ia.div`
821
- line-height: 20px;
822
- height: 20px;
823
- font-size: 13px;
824
- color: ${e=>e.success?"var(--privy-color-success)":e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
825
- display: flex;
826
- justify-content: flex-end;
827
- width: 100%;
828
- `,iw=ia.div`
829
- font-size: 13px;
830
- color: var(--privy-color-foreground);
831
- display: flex;
832
- gap: 8px;
833
- align-items: center;
834
- width: 100%;
835
- margin-top: 16px;
836
- // Equal opposing size buffer to account for auto margining when the
837
- // success/fail text does not show up
838
- padding-bottom: 32px;
839
- `,sw=ia.div`
840
- color: var(--privy-color-accent);
841
- padding: 2px 0;
842
- > button {
843
- text-decoration: underline;
844
- }
845
- `,lw=ia.div`
846
- display: flex;
847
- align-items: center;
848
- justify-content: center;
849
- border-radius: var(--privy-border-radius-sm);
850
- padding: 2px 8px;
851
- gap: 4px;
852
- background: var(--privy-color-background-2);
853
- color: var(--privy-color-foreground-2);
854
- `,Vh=ia.span`
855
- font-weight: 500;
856
- word-break: break-all;
857
- `;import fw from"@heroicons/react/24/solid/CheckCircleIcon";import hw from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Ep,useRef as yw,useState as ai}from"react";import gw from"styled-components";import dw from"styled-components";import{Fragment as mw,jsx as ni,jsxs as uw}from"react/jsx-runtime";var zh=({icon:e})=>{let t=e;return ni(mw,{children:ni(pw,{children:uw("div",{children:[ni(st,{}),typeof t=="string"?ni("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?ni(t,{style:{width:"38px",height:"38px"}}):ni("span",{})]})})})},pw=dw.div`
858
- display: flex;
859
- flex-direction: column;
860
- justify-content: center;
861
- align-items: center;
862
- width: 100%;
863
- height: 82px;
864
-
865
- > div {
866
- position: relative;
867
- }
868
-
869
- > div > span {
870
- position: absolute;
871
- left: -41px;
872
- top: -41px;
873
- }
874
-
875
- > div > :last-child {
876
- position: absolute;
877
- left: -19px;
878
- top: -19px;
879
- }
880
- `;import{Fragment as vw,jsx as no,jsxs as Tp}from"react/jsx-runtime";var Yh=500,Kh=Yh*2,Qh=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=x(),{status:i,token:l,waitForResult:c,reset:d,execute:u}=Ee(),m=yw([]),h=X=>{m.current=[X,...m.current]},[g,w]=ai(!0);Ep(()=>{let X=setTimeout(w,Kh,!1);return h(X),()=>{m.current.forEach(L=>clearTimeout(L)),m.current=[]}},[]);let[v,E]=ai(""),[R,A]=ai("Checking that you are a human..."),[T,P]=ai(no(U,{onClick:()=>{},disabled:!0,children:"Continue"})),[S,M]=ai(!1),[N,H]=ai(3),F=r?.captchaModalData,K=async X=>{try{await F?.callback(X),F?.onSuccessNavigateTo&&n(F?.onSuccessNavigateTo,!1)}catch(L){if(L instanceof Vt)return;{let Y={error:L,previousScreen:e||"LANDING"};a({errorModalData:Y}),n(F?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};Ep(()=>{if(i==="success"){let X=setTimeout(async()=>{let L=await c();!L||F?.userIntentRequired||K(L)},Kh);h(X)}else if(i==="ready"){let X=setTimeout(()=>{i==="ready"&&u()},Yh);h(X)}},[i]),Ep(()=>{if(!g)switch(i){case"success":E("Success!"),A("CAPTCHA passed successfully."),P(no(U,{onClick:()=>{M(!0),K(l)},disabled:!F?.userIntentRequired,loading:S,children:F?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":E(""),A("Checking that you are a human..."),P(no(U,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":E("Something went wrong"),N<=0?(A("If you use an adblocker or VPN, try disabling and re-attempting."),P(null)):(A("You did not pass CAPTCHA. Please try again."),P(no(U,{onClick:W,children:"Retry"})));break;case"ready":default:break}},[i,g,S]);let W=async()=>{if(N<=0)return;H(L=>L-1),d(),u();let X=await c();!X||F?.userIntentRequired||K(X)};return Tp(vw,{children:[no(k,{backFn:!e||t===e?void 0:o}),Tp(Cw,{children:[i==="success"?no(fw,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?no(hw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):no(zh,{}),Tp(je,{children:[v?no("h3",{children:v}):null,no("p",{children:R})]}),T]}),no(j,{})]})},Cw=gw.div`
881
- display: flex;
882
- flex-direction: column;
883
- align-items: center;
884
- justify-content: center;
885
- gap: 24px;
886
- width: 100%;
887
- `;import{isMobile as ay}from"react-device-detect";import Pp from"styled-components";import ww from"@heroicons/react/24/outline/WalletIcon";import{jsx as Sp}from"react/jsx-runtime";var pc=({icon:e,name:t})=>typeof e=="string"?Sp("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Sp(ww,{}):e?Sp(e,{}):null;import{jsx as ao,jsxs as Xh}from"react/jsx-runtime";var Zh=({...e})=>Xh("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[ao("defs",{children:Xh("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[ao("stop",{offset:"0",stopColor:"#f1562b"}),ao("stop",{offset:"0.3",stopColor:"#f1542b"}),ao("stop",{offset:"0.41",stopColor:"#f04d2a"}),ao("stop",{offset:"0.49",stopColor:"#ef4229"}),ao("stop",{offset:"0.5",stopColor:"#ef4029"}),ao("stop",{offset:"0.56",stopColor:"#e83e28"}),ao("stop",{offset:"0.67",stopColor:"#e13c26"}),ao("stop",{offset:"1",stopColor:"#df3c26"})]})}),ao("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),ao("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as io,jsxs as ds}from"react/jsx-runtime";var Jh=({style:e,...t})=>ds("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[io("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),io("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:io("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),ds("g",{mask:"url(#mask0_16909_31415)",children:[io("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),io("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),io("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),io("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),ds("defs",{children:[ds("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[io("stop",{stopColor:"#002D72"}),io("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),ds("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[io("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),io("stop",{offset:"1",stopColor:"#002D72"})]})]})]});import{jsx as br,jsxs as ii}from"react/jsx-runtime";var jh=e=>ii("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[br("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),br("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),br("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),br("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),br("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),ii("defs",{children:[ii("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[br("stop",{stopColor:"white"}),br("stop",{offset:"1",stopColor:"white"})]}),ii("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[br("stop",{stopColor:"#8697FF"}),br("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),ii("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[br("stop",{stopColor:"#8697FF"}),br("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),ii("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[br("stop",{stopColor:"white"}),br("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]});import{jsx as ue,jsxs as Er}from"react/jsx-runtime";var $h=({style:e,...t})=>Er("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[ue("g",{clipPath:"url(#clip0_5_32)",children:Er("g",{clipPath:"url(#clip1_5_32)",children:[ue("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:ue("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),ue("g",{mask:"url(#mask0_5_32)",children:ue("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),ue("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),ue("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),ue("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),ue("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),ue("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),ue("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),ue("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),ue("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),ue("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),Er("defs",{children:[Er("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[ue("stop",{stopColor:"#174299"}),ue("stop",{offset:"1",stopColor:"#001E59"})]}),Er("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[ue("stop",{offset:"0.770277",stopColor:"#FF4000"}),ue("stop",{offset:"1",stopColor:"#8754C9"})]}),Er("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[ue("stop",{stopColor:"#FF4000"}),ue("stop",{offset:"1",stopColor:"#8754C9"})]}),Er("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[ue("stop",{stopColor:"#8754C9"}),ue("stop",{offset:"1",stopColor:"#FF4000"})]}),Er("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[ue("stop",{offset:"0.723929",stopColor:"#FFF700"}),ue("stop",{offset:"1",stopColor:"#FF9901"})]}),Er("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[ue("stop",{stopColor:"#FFF700"}),ue("stop",{offset:"1",stopColor:"#FF9901"})]}),Er("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[ue("stop",{stopColor:"#FFF700"}),ue("stop",{offset:"1",stopColor:"#FF9901"})]}),Er("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[ue("stop",{offset:"0.59513",stopColor:"#00AAFF"}),ue("stop",{offset:"1",stopColor:"#01DA40"})]}),Er("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[ue("stop",{stopColor:"#00AAFF"}),ue("stop",{offset:"1",stopColor:"#01DA40"})]}),Er("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[ue("stop",{stopColor:"#00AAFF"}),ue("stop",{offset:"1",stopColor:"#01DA40"})]}),ue("clipPath",{id:"clip0_5_32",children:ue("rect",{width:"120",height:"120",fill:"white"})}),ue("clipPath",{id:"clip1_5_32",children:ue("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as uc,jsxs as bw}from"react/jsx-runtime";var ey=({style:e,...t})=>bw("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[uc("rect",{width:"28",height:"28",rx:"3",fill:"#12FF80"}),uc("path",{d:"M22.5151 13.9979H20.4244C19.7981 13.9979 19.2945 14.5058 19.2945 15.128V18.163C19.2945 18.7894 18.7866 19.2931 18.1645 19.2931H9.8398C9.21344 19.2931 8.70981 19.8011 8.70981 20.4233V22.5185C8.70981 23.145 9.21767 23.6487 9.8398 23.6487H18.6427C19.2691 23.6487 19.7642 23.1407 19.7642 22.5185V20.8423C19.7642 20.2159 20.2721 19.7757 20.8942 19.7757H22.5151C23.1415 19.7757 23.6451 19.2677 23.6451 18.6455V15.1196C23.6451 14.4889 23.1373 13.9979 22.5151 13.9979Z",fill:"black"}),uc("path",{d:"M8.7098 9.84127C8.7098 9.21481 9.21766 8.71111 9.83978 8.71111H18.156C18.7823 8.71111 19.286 8.20317 19.286 7.58095V5.48995C19.286 4.86349 18.7781 4.35979 18.156 4.35979H9.35732C8.73096 4.35979 8.22733 4.86772 8.22733 5.48995V7.10264C8.22733 7.7291 7.71947 8.2328 7.09734 8.2328H5.48912C4.86276 8.2328 4.35913 8.74074 4.35913 9.36296V12.8931C4.35913 13.5196 4.86699 13.9979 5.49335 13.9979H7.58404C8.2104 13.9979 8.71403 13.4899 8.71403 12.8677L8.7098 9.84127Z",fill:"black"}),uc("path",{d:"M13.0139 11.8011H15.0242C15.6802 11.8011 16.2092 12.3344 16.2092 12.9862V14.9968C16.2092 15.6529 15.6759 16.182 15.0242 16.182H13.0139C12.3579 16.182 11.8289 15.6487 11.8289 14.9968V12.9862C11.8289 12.3302 12.3621 11.8011 13.0139 11.8011Z",fill:"black"})]});import{jsx as ko,jsxs as ty}from"react/jsx-runtime";var ry=({style:e,...t})=>ty("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[ko("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),ty("g",{children:[ko("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),ko("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),ko("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),ko("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),ko("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),ko("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),ko("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),ko("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),ko("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as ps,jsxs as oy}from"react/jsx-runtime";var ny=({style:e,...t})=>oy("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[oy("g",{clipPath:"url(#clip0_1704_1423)",children:[ps("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),ps("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),ps("defs",{children:ps("clipPath",{id:"clip0_1704_1423",children:ps("rect",{width:"176",height:"176",fill:"white"})})})]});var Vr={coinbase_wallet:{logo:Vo,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:Vo,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Xa,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:To,displayName:"Phantom"},rainbow:{logo:$h,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:es,displayName:"WalletConnect"},zerion:{logo:ny,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Zh,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Jh,displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:ry,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:jh,displayName:"Rabby Wallet",rdns:"io.rabby.wallet"},safe:{displayName:"Safe",logo:ey}},mn=(e,t,r)=>{if(Vr[e]?.displayName)return e==="coinbase_wallet"?Vr[r].displayName:Vr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},mc=(e,t,r)=>{if(Vr[e]?.logo)return e==="coinbase_wallet"?Vr[r].logo:Vr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return es};function si(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some(n=>t.includes(n))}import{jsx as us,jsxs as sy}from"react/jsx-runtime";var sa=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=x(),{connectWallet:i}=_(),l=Mt(),c=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,d=window.matchMedia("(display-mode: standalone)").matches,u;return n.connectorType==="phantom"||n.connectorType==="solana_adapter"&&n.walletClientType==="phantom"?u=()=>{on()||n.chainType==="solana"&&"isInstalled"in n&&n.isInstalled?(i(n,c),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(ay?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:n.connectorType==="coinbase_wallet"&&n.connectionOptions==="eoaOnly"&&ay&&!d&&!tl()?u=()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`}:u=()=>{si(window.navigator.userAgent)&&!event?.isTrusted||(i(n,c),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION"))},sy(Ew,{onClick:u,children:[us(pc,{icon:mc(e,n.connectorType,n.walletClientType)??r,name:n.walletClientType}),us("span",{children:mn(e,n.connectorType,n.walletClientType)||t||n.walletClientType}),sy(Tw,{id:"chip-container",children:[l?.connectorType===n.connectorType&&l?.walletClientType===c?us(iy,{color:"gray",children:"Recent"}):us("span",{id:"connect-text",children:"Connect"}),n.connectorType==="solana_adapter"&&us(iy,{color:"gray",children:"Solana"})]})]})},Ew=Pp(Te)`
888
- /* Show "Connect" on hover */
889
- > #chip-container > #connect-text {
890
- font-weight: 500;
891
- color: var(--privy-color-accent);
892
- opacity: 0;
893
- transition: opacity 0.1s ease-out;
894
- }
895
-
896
- :hover > #chip-container > #connect-text {
897
- opacity: 1;
898
- }
899
-
900
- @media (max-width: 440px) {
901
- > #chip-container > #connect-text {
902
- display: none;
903
- }
904
- }
905
- `,iy=Pp(rr)`
906
- margin-left: auto;
907
- `,Tw=Pp.div`
908
- display: flex;
909
- flex-wrap: wrap;
910
- gap: 8px;
911
- margin-left: auto;
912
- `;import{Fragment as kw,jsx as li,jsxs as Rw}from"react/jsx-runtime";var Sw=["coinbase_wallet"],Pw=["metamask","okx_wallet","rainbow","uniswap","uniswap_extension","zerion","rabby_wallet","cryptocom"],Aw=["safe"],xw=["phantom"],ci=({connectOnly:e})=>{let{connectors:t}=_(),{app:r,data:o}=x(),n=fn(o?.externalConnectWallet?.walletList??r.appearance.walletList,r.appearance.walletChainType,t,e,r.appearance.walletList,r.externalWallets.walletConnect.enabled);return Rw(kw,{children:[...n]})},fn=(e,t,r,o,n,a)=>{let i=[],l=[],c=[];r=r.filter(u=>t==="ethereum-only"?u.chainType==="ethereum":t==="solana-only"?u.chainType==="solana":!0);let d=r.find(u=>u.connectorType==="wallet_connect_v2");for(let u of e)if(u==="detected_wallets"){let m=r.filter(({chainType:h,connectorType:g,walletClientType:w})=>w==="uniswap_wallet_extension"||w==="uniswap_extension"?!n.includes("uniswap"):w==="crypto.com_wallet_extension"?!n.includes("cryptocom"):h==="solana"?t!=="ethereum-only":g==="injected"&&!n.includes(w));for(let h of m){let{walletClientType:g,walletBranding:w}=h;(g==="unknown"?l:i).push(li(sa,{connectOnly:o,provider:g,logo:w.icon,displayName:w.name,connector:h},`${u}-${g}`))}}else if(xw.includes(u)){let m=r.find(h=>h.connectorType==="injected"&&h.walletClientType===u||h.connectorType===u);m&&i.push(li(sa,{connectOnly:o,provider:u,connector:m},u))}else if(Pw.includes(u)){let m=r.find(h=>u==="uniswap"?h.walletClientType==="uniswap_wallet_extension"||h.walletClientType==="uniswap_extension":u==="cryptocom"?h.walletClientType==="crypto.com_wallet_extension":h.connectorType==="injected"&&h.walletClientType===u);a&&!m&&(m=d),m&&i.push(li(sa,{connectOnly:o,provider:u,connector:m,logo:m.connectorType==="injected"?m.walletBranding.icon:void 0,displayName:m.connectorType==="injected"?m.walletBranding.name:void 0},u))}else if(Sw.includes(u)){let m=r.find(({connectorType:h})=>h===u);m&&i.push(li(sa,{connectOnly:o,provider:u,connector:m},u))}else Aw.includes(u)?d&&c.push(li(sa,{connectOnly:o,provider:u,connector:d},u)):u==="wallet_connect"&&d&&c.push(li(sa,{connectOnly:o,provider:u,connector:d},u));return[...l,...i,...c]};import{Fragment as _w,jsx as ms,jsxs as Mw}from"react/jsx-runtime";var ly=()=>{let{app:e,data:t}=x(),r=t?.externalConnectWallet?.suggestedAddress,o=r?`Connect the wallet with address ${jr(r)} ${e?.name?`to ${e.name}.`:"."}`:`Connect a wallet to ${e?.name}`;return Mw(_w,{children:[ms(k,{},"header"),ms(xo,{title:"Connect your wallet",description:o}),ms(ir,{children:ms(ci,{connectOnly:!0})}),ms(B,{})]})};import{Fragment as Iw,jsx as la,jsxs as cy}from"react/jsx-runtime";var dy=()=>{let{app:e,data:t}=x(),r=t?.externalConnectWallet?.suggestedAddress,o=r?cy("span",{children:["Connect the wallet with address ",la(Bo,{showCopyIcon:!1,address:r})," ",e?.name?`to ${e.name}.`:"."]}):`Connect a wallet to your ${e?.name} account`;return cy(Iw,{children:[la(k,{},"header"),la(aa,{title:"Connect your wallet",description:o}),la(ir,{children:la(ci,{connectOnly:!0})}),e&&la(Na,{app:e,alwaysShowImplicitConsent:!0}),la(B,{})]})};import{useEffect as yy,useState as gy}from"react";import{isMobile as Bw}from"react-device-detect";import Hw from"styled-components";import{useEffect as Ap,useState as hn}from"react";import{isMobile as fc}from"react-device-detect";import fy from"styled-components";import{useEffect as py,useRef as Ww}from"react";var Lw=(e,t)=>{let r=Ww(()=>{});py(()=>{r.current=e}),py(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},uy=Lw;import{useState as Ow,useEffect as Nw,useCallback as Dw}from"react";function my(){let[e,t]=Ow(!1),r=Dw(()=>{document.hidden&&t(!0)},[]);return Nw(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as kp,jsx as gt,jsxs as di}from"react/jsx-runtime";var xp=2,Rp=e=>e?.privyErrorCode==="linked_to_another_user"?wo.ERROR_USER_EXISTS:e instanceof St&&!e.details.default?e.details:e instanceof qa?wo.ERROR_TIMED_OUT:e instanceof za?wo.ERROR_USER_REJECTED_CONNECTION:e?.privyErrorCode==="cannot_link_more_of_type"?wo.ERROR_USER_LIMIT_REACHED:wo.ERROR_WALLET_CONNECTION,hy=()=>{let[e,t]=hn(!1),[r,o]=hn(!1),[n,a]=hn(void 0),{authenticated:i,logout:l}=q(),{app:c,navigate:d,navigateBack:u,lastScreen:m,currentScreen:h,setModalData:g,data:w}=x(),{getAuthFlow:v,walletConnectionStatus:E,closePrivyModal:R,initLoginWithWallet:A,loginWithWallet:T,updateWallets:P,createAnalyticsEvent:S}=_(),{walletConnectors:M}=q(),[N,H]=hn(0),{user:F}=q(),[K]=hn(F?.linkedAccounts.length||0),[W,X]=hn(""),[L,Y]=hn(""),[ke,be]=hn(!1),{hasTabbedAway:te}=my(),{enabled:Q,token:Re}=Ee(),he=fc&&E?.connector?.connectorType==="wallet_connect_v2"||fc&&E?.connector?.connectorType==="coinbase_wallet"||fc&&E?.connector?.connectorType==="injected"&&E?.connector?.walletClientType==="phantom",re=E?.status==="connected",se=E?.status==="switching_to_supported_chain";Ap(()=>{let G=v(),J=G instanceof Go||G instanceof Jn?G:void 0;if(re&&!J&&(Q&&!Re&&!i?(g({captchaModalData:{callback:Rt=>A(E.connectedWallet,Rt,w?.login?.disableSignup).then(()=>{be(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN",!1)):A(E.connectedWallet,Re,w?.login?.disableSignup).then(()=>{be(!0)})),J&&he&&re&&!J.preparedMessage){J.buildMessage();return}!J||he||!re||r||(async()=>{o(!0),a(void 0);try{E?.connector?.connectorType==="wallet_connect_v2"&&E?.connector?.walletClientType==="metamask"&&await nm(2500),await $e()}catch(Rt){console.warn("Auto-prompted signature failed",Rt)}finally{o(!1)}})()},[N,re,ke]),Ap(()=>{if(F&&e){let J=Le-500;if(c?.legal.requireUsersAcceptTerms&&!F.hasAcceptedTerms){let Ce=setTimeout(()=>{d("AFFIRMATIVE_CONSENT_SCREEN")},J);return()=>clearTimeout(Ce)}if(bt(F,c?.embeddedWallets?.createOnLogin)){let Ce=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:ut=>{console.error(ut),S({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ut,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),d("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},J);return()=>clearTimeout(Ce)}P();let Rt=setTimeout(()=>R({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Le);return()=>clearTimeout(Rt)}},[F,e]);let Xe=G=>{if(G?.privyErrorCode==="allowlist_rejected"){d("ALLOWLIST_REJECTION_SCREEN");return}else if(G?.privyErrorCode==="max_accounts_reached"){console.error(new yo(G).toString()),d("USER_LIMIT_REACHED_SCREEN");return}else if(G?.privyErrorCode==="user_does_not_exist"){d("ACCOUNT_NOT_FOUND_SCREEN");return}a(Rp(G))};async function $e(){try{await T(),t(!0)}catch(G){Xe(G)}finally{o(!1)}}Ap(()=>{E?.connectError&&Xe(E?.connectError)},[E]),uy(()=>{let G=ce==="wallet_connect_v2"&&E?.connector instanceof to?E.connector.redirectUri:void 0;G&&X(G);let J=ce==="wallet_connect_v2"&&E?.connector instanceof to?E.connector.fallbackUniversalRedirectUri:void 0;J&&Y(J)},E?.connector instanceof to&&!W?500:null);let ce=E?.connector?.connectorType||"injected",ht=E?.connector?.walletClientType||"unknown",Mr=Vr[ht]?.displayName||E?.connector?.walletBranding.name||"Browser Extension",kt=Vr[ht]?.logo||E?.connector?.walletBranding.icon||(G=>gt(Qa,{...G})),it=Mr==="Browser Extension"?Mr.toLowerCase():Mr,Se;e?Se=`Successfully connected with ${it}`:n?Se=n.message:se?Se="Switching networks":re?Se=r&&he?"Signing":"Sign to verify":Se=`Waiting for ${it}`;let I="Don\u2019t see your wallet? Check your other browser windows.";if(e){let G=F?.linkedAccounts.length||0;K===G?I="Wallet was already linked.":I="You\u2019re good to go!"}else N>=xp&&n?I="Unable to connect wallet":n?I=n.detail:se?I="Switch your wallet to the requested network.":re&&he?I="Sign the message in your wallet to verify it belongs to you.":ht==="metamask"&&fc?I="Click continue to open and connect MetaMask.":ht==="metamask"?I="For the best experience, connect only one wallet at a time.":ce==="wallet_connect"?I="Open your mobile wallet app to continue":ce==="coinbase_wallet"&&(tl()||(cp(F)?I="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":I="Open the Coinbase app on your phone to continue."));let ie=M?.walletConnectors?.find(G=>G.walletClientType==="coinbase_wallet"),en=ht==="coinbase_wallet"&&(cp(F)||n===wo.ERROR_USER_EXISTS);return di(kp,{children:[gt(k,{backFn:!m||h===m?void 0:u}),di(Uw,{children:[gt(_p,{walletLogo:kt,success:e,fail:!!n}),di(je,{children:[gt("h3",{children:Se}),gt("p",{children:I}),!re&&W&&!te?di("p",{children:["Still here?"," ",gt("a",{href:W,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),L&&di(kp,{children:[" ","or"," ",gt("a",{href:L,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]}):null]}),en?gt(U,{onClick:()=>ie&&ie?.disconnect(),disabled:e,children:"Use a different wallet"}):n==wo.ERROR_USER_EXISTS&&h!==m?gt(U,{onClick:u,children:"Use a different wallet"}):re&&!e&&he?gt(U,{onClick:()=>{o(!0),$e()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&N<xp?gt(U,{onClick:()=>{H(N+1),a(void 0),re?(o(!0),$e()):E?.connectRetry()},disabled:!e&&(!n?.retryable||N>=xp),children:"Retry"}):!e&&!n?gt(U,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),gt(j,{})]})},Uw=fy.div`
913
- display: flex;
914
- flex-direction: column;
915
- align-items: center;
916
- justify-content: center;
917
- gap: 24px;
918
- width: 100%;
919
- `,Fw=fy.div`
920
- display: flex;
921
- flex-direction: column;
922
- justify-content: center;
923
- align-items: center;
924
- width: 100%;
925
- height: 82px;
926
-
927
- > div {
928
- position: relative;
929
- }
930
-
931
- > div > span {
932
- position: absolute;
933
- left: -41px;
934
- top: -41px;
935
- }
936
-
937
- > div > :last-child {
938
- position: absolute;
939
- left: -19px;
940
- top: -19px;
941
- }
942
- `,_p=e=>{let t=e.walletLogo;return gt(kp,{children:gt(Fw,{children:di("div",{children:[gt(st,{success:e.success,fail:e.fail}),typeof t=="string"?gt("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):gt(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as Vw,jsx as zo,jsxs as Mp}from"react/jsx-runtime";var hc=2,Cy=()=>{let{navigateBack:e,navigate:t,lastScreen:r,currentScreen:o,data:n}=x(),{walletConnectionStatus:a,closePrivyModal:i}=_(),[l,c]=gy(void 0),[d,u]=gy(0),m=a?.status==="connected",h=a?.status==="switching_to_supported_chain";yy(()=>{if(m){let S;if(n?.externalConnectWallet?.onCompleteNavigateTo){let M=n.externalConnectWallet.onCompleteNavigateTo;S=setTimeout(()=>{t(M)},Le)}else S=setTimeout(i,Le);return()=>clearTimeout(S)}},[m]);let g=S=>{c(Rp(S))};yy(()=>{a?.connectError&&g(a?.connectError)},[a]);let w=a?.connector?.connectorType||"injected",v=a?.connector?.walletClientType||"unknown",E=Vr[v]?.displayName||a?.connector?.walletBranding.name||"Browser Extension",R=Vr[v]?.logo||a?.connector?.walletBranding.icon||(S=>zo(Qa,{...S})),A=E==="Browser Extension"?E.toLowerCase():E,T;m?T=`Successfully connected with ${A}`:l?T=l.message:h?T="Switching networks":T=`Waiting for ${A}`;let P="Don\u2019t see your wallet? Check your other browser windows.";return m?P="You\u2019re good to go!":d>=hc&&l?P="Unable to connect wallet":l?P=l.detail:h?P="Switch your wallet to the requested network.":v==="metamask"&&Bw?P="Click to continue to open and connect MetaMask.":v==="metamask"?P="For the best experience, connect only one wallet at a time.":w==="wallet_connect_v2"?P="Open your mobile wallet app to continue":w==="coinbase_wallet"&&(P="Open the Coinbase app on your phone to continue."),Mp(Vw,{children:[zo(k,{backFn:o===r?void 0:e}),Mp(Gw,{children:[zo(_p,{walletLogo:R,success:m,fail:!!l}),Mp(je,{children:[zo("h3",{children:T}),zo("p",{children:P})]}),l==wo.ERROR_USER_EXISTS?zo(U,{onClick:e,children:"Use a different wallet"}):!m&&l?.retryable&&d<hc?zo(U,{onClick:()=>{u(d+1),c(void 0),a?.connectRetry()},disabled:!m&&(!l?.retryable||d>=hc),children:"Retry"}):!m&&l&&d>=hc?zo(U,{onClick:e,children:"Use a different wallet"}):null]}),zo(j,{})]})},Gw=Hw.div`
943
- display: flex;
944
- flex-direction: column;
945
- align-items: center;
946
- justify-content: center;
947
- gap: 24px;
948
- width: 100%;
949
- `;import{useEffect as by,useMemo as qw,useState as zw}from"react";import Kw from"styled-components";import{jsx as vy}from"react/jsx-runtime";var wy=({name:e,logoUrl:t})=>{let r=`${e??"Provider app"} logo`;return typeof t=="string"?vy("img",{src:t,alt:r,style:{width:"38px",height:"38px",maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):vy("span",{})};import{Fragment as Qw,jsx as Ko,jsxs as yc}from"react/jsx-runtime";var Ey=()=>{let e=Be(),{data:t,navigate:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{crossAppAuthFlow:a,updateWallets:i,closePrivyModal:l,createAnalyticsEvent:c}=_(),{logout:d}=rp(),[u,m]=zw({}),h=t?.crossAppAuth,g={id:h.appId,name:h.name,logoUrl:h.logoUrl},w=Le,v=new C(`There was an issue connecting your ${g.name} account. Please try again.`),E=new Ge(async P=>{if(!h.popup){m({error:v});return}try{let S=await a({appId:P,popup:h.popup,action:h.action});m({data:S})}catch(S){S instanceof C?m({error:S}):S instanceof Lr?(h.popup&&h.popup.close(),m({error:v})):m({error:v})}}),R=()=>{u.data&&(i(),h.onSuccess(u.data),l({shouldCallAuthOnSuccess:!0,isSuccess:!0})),h.onError(u.error??new C("User canceled flow")),l({shouldCallAuthOnSuccess:!1,isSuccess:!1})};n.current=R,by(()=>{g.id.length&&E.execute(g.id)},[g.id]),by(()=>{if(!u.data)return;let P=u.data;if(e.legal.requireUsersAcceptTerms&&!P.hasAcceptedTerms){let M=setTimeout(()=>{r("AFFIRMATIVE_CONSENT_SCREEN")},w);return()=>clearTimeout(M)}if(bt(P,e.embeddedWallets?.createOnLogin)){let M=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:N=>{console.error(N),c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:N,provider:`privy:${g.id}`,screen:"CrossAppAuthScreen"}}),d()},callAuthOnSuccessOnClose:!0}}),r("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},w);return()=>clearTimeout(M)}let S=setTimeout(R,w);return()=>clearTimeout(S)},[u.data]);let{title:A,subtitle:T}=qw(()=>u.data?{title:`Successfully connected with ${g.name}`,subtitle:"You're good to go!"}:u.error?{title:"Authentication failed",subtitle:u.error.message}:{title:`Connecting to ${g.name}`,subtitle:`Please check the pop-up from ${g.name} to continue`},[u,g.name]);return yc(Qw,{children:[Ko(k,{onClose:R}),Ko(oe,{}),yc(Yw,{children:[Ko(rt,{children:yc("div",{children:[Ko(st,{success:!!u.data,fail:!!u.error}),Ko(wy,{name:g.name,logoUrl:g.logoUrl})]})}),yc(je,{children:[Ko("h3",{children:A}),Ko("p",{children:T})]})]}),Ko(ae,{}),Ko(j,{})]})},Yw=Kw.div`
950
- display: flex;
951
- flex-direction: column;
952
- align-items: center;
953
- justify-content: center;
954
- margin-left: 27px;
955
- margin-right: 27px;
956
- gap: 24px;
957
- `;import t4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as r4,useMemo as o4,useState as n4}from"react";import a4 from"styled-components";import gc from"styled-components";import{jsx as Ip,jsxs as $w}from"react/jsx-runtime";var Cc=()=>Ip(Xw,{children:$w(Zw,{children:[Ip(Jw,{}),Ip(jw,{})]})}),Xw=gc.div`
958
- display: flex;
959
- justify-content: center;
960
- align-items: center;
961
- flex-grow: 1;
962
-
963
- margin: 12px;
964
- padding: 16px;
965
-
966
- @media all and (display-mode: standalone) {
967
- margin-bottom: 30px;
968
- }
969
- `,Zw=gc.div`
970
- position: relative;
971
- height: 140px;
972
- width: 140px;
973
-
974
- opacity: 1;
975
- animation: fadein 200ms ease;
976
- `,Jw=gc.div`
977
- position: absolute;
978
- top: 0;
979
- right: 0;
980
- bottom: 0;
981
- left: 0;
982
- width: 140px;
983
- height: 140px;
984
-
985
- && {
986
- border: 4px solid var(--privy-color-accent-light);
987
- border-radius: 50%;
988
- }
989
- `,jw=gc.div`
990
- position: absolute;
991
- top: 0;
992
- right: 0;
993
- bottom: 0;
994
- left: 0;
995
- width: 140px;
996
- height: 140px;
997
- animation: spin 1200ms linear infinite;
998
-
999
- && {
1000
- border: 4px solid;
1001
- border-color: var(--privy-color-accent) transparent transparent transparent;
1002
- border-radius: 50%;
1003
- }
1004
-
1005
- @keyframes spin {
1006
- from {
1007
- transform: rotate(0deg);
1008
- }
1009
- to {
1010
- transform: rotate(360deg);
1011
- }
1012
- }
1013
- `;var Ty=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var Oe=class extends Error{constructor(r,o){super(o);this.type=r}};function pi(e){let t=e.type;return typeof t=="string"&&Ty.includes(t)}function e4(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function ca(e){return pi(e)&&e.type==="wallet_not_on_device"}function Sy(e){return pi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function da(e){return!!(pi(e)&&e.type==="mfa_timeout")}function pa(e){return!!(pi(e)&&e.type==="missing_or_invalid_mfa")}function Wp(e){return!!(pi(e)&&e.type==="mfa_verification_max_attempts_reached")}function vc(e){return!!(pi(e)&&e.message.includes("code 429"))}function wc(e){return!!(e4(e)&&e.message==="MFA canceled")}function Lp({isCreatingWallet:e,skipSplashScreen:t}){return e?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":t?"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function bc({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r,isResettingPassword:o,showAutomaticRecovery:n}){return n?"EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN":r||t.length===1?Lp({isCreatingWallet:e==="create",skipSplashScreen:o}):"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"}function Ec(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";case"icloud":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function Op({api:e,provider:t}){let r=Qn(),o=Ha(),n=await Ga(r);try{return t==="icloud"?{url:(await e.post(ff,{client_type:"web"})).url}:{url:(await e.post(mf,{redirect_to:window.location.href,code_challenge:n,state_code:o})).url,codeVerifier:r,stateCode:o,provider:t}}catch(a){throw ne(a)}}async function Py({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new C("User denied confirmation during OAuth flow");try{return(await e.post(hf,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(a){let i=ne(a);throw i.privyErrorCode?new C(i.message||"Invalid code during OAuth flow.",void 0,i.privyErrorCode):i.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}import{Fragment as xy,jsx as ui,jsxs as Np}from"react/jsx-runtime";var Ay=1,ky=()=>{let{authenticated:e,user:t,getAccessToken:r}=q(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=_(),{navigate:i,data:l,setModalData:c,onUserCloseViaDialogOrKeybindRef:d}=x(),u=o4(()=>Date.now(),[]),[m,h]=n4(!1),{onCompleteNavigateTo:g,onFailure:w,shouldForceMFA:v,address:E}=l?.connectWallet,R=T=>{m||(h(!0),w(typeof T=="string"?new Error(T):T))};r4(()=>{let T=E?t?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy"&&M.address===E):De(t),P;return!e||!T?R("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let M=await r();if(!M)return R("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:M,address:T.address}),v&&await a.verifyMfa({accessToken:M});let N=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&N<Ay?P=setTimeout(()=>{i(g,!1)},(Ay-N)*1e3):i(g,!1)}catch(N){if(ca(N)&&T.recoveryMethod==="privy"){let H=await r();if(!H)return R("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:T.address}}),(await a?.recover({address:T.address,accessToken:H,recoveryMethod:T.recoveryMethod}))?.address||R(new Error("Unable to recover wallet")),g?i(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:T.address}}),i(g)}catch{R("An error has occurred, please try again.")}}else if(ca(N)&&T.recoveryMethod!=="privy"){c({...l,recoverWallet:{privyWallet:T,onCompleteNavigateTo:g,onFailure:w},recoveryOAuthStatus:{provider:T.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}});let H=Ec(T.recoveryMethod);i(H)}else R(N)}})(),()=>clearTimeout(P)):void 0},[e,t,a]);let A=()=>{R("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return d.current=A,Np(xy,{children:[ui(k,{onClose:A}),m?Np(xy,{children:[Np(wr,{children:[ui(t4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ui(ye,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),ui(U,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):ui(Cc,{}),ui(i4,{})]})},i4=a4.div`
1014
- height: 44px;
1015
- `;import s4 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as l4}from"react";import{Fragment as c4,jsx as mi,jsxs as Ry}from"react/jsx-runtime";var _y=()=>{let{user:e}=q(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=_(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=x(),{onSuccess:l,onFailure:c,callAuthOnSuccessOnClose:d}=a.createWallet,u=()=>{let m=De(e);m?(o(),l(m)):c(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:d})};return l4(()=>{let m=setTimeout(u,pm);return()=>clearTimeout(m)},[]),i.current=u,Ry(c4,{children:[mi(k,{onClose:u}),mi(oe,{}),Ry(wr,{children:[mi(s4,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),mi(ye,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),mi(ae,{}),mi(B,{})]})};import{useEffect as Wy,useRef as g4,useState as Dp}from"react";import Up from"styled-components";import{ExclamationTriangleIcon as d4}from"@heroicons/react/24/outline";import p4 from"styled-components";import{jsx as m4,jsxs as f4}from"react/jsx-runtime";var My=({children:e,theme:t})=>f4(u4,{$theme:t,children:[m4(d4,{width:"1.25rem",color:t==="dark"?"#FDE68A":"var(--privy-color-warn)"}),e]}),u4=p4.div`
1016
- display: flex;
1017
- gap: 0.5rem;
1018
- background-color: ${e=>e.$theme==="dark"?"var(--privy-color-background-2)":"var(--privy-color-warn-light)"};
1019
-
1020
- ${e=>e.$theme==="dark"?"color: #FDE68A;":""}
1021
-
1022
- align-items: flex-start;
1023
- text-align: left;
1024
- padding: 0.5rem 0.75rem;
1025
-
1026
- font-size: 0.8125rem;
1027
- font-weight: 400;
1028
- line-height: 1.125rem; /* 150% */
1029
-
1030
- padding: 0.75rem;
1031
-
1032
- && {
1033
- border-radius: var(--privy-border-radius-sm);
1034
- }
1035
- `;import h4 from"styled-components";var qr=h4.span`
1036
- margin-top: 4px;
1037
- color: var(--privy-color-foreground);
1038
- text-align: center;
1039
-
1040
- font-size: 0.875rem;
1041
- font-weight: 400;
1042
- line-height: 1.375rem; /* 157.143% */
1043
-
1044
- && a {
1045
- color: var(--privy-color-accent);
1046
- }
1047
- `;import y4 from"styled-components";var so=y4.span`
1048
- color: var(--privy-color-foreground);
1049
- font-size: 1.125rem;
1050
- font-weight: 600;
1051
- line-height: 1.875rem; /* 166.667% */
1052
- text-align: center;
1053
- `;import{Fragment as b4,jsx as zr,jsxs as Tc}from"react/jsx-runtime";var Ly=()=>{let[e,t]=Dp(null),{authenticated:r,user:o,getAccessToken:n}=q(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=_(),c=Be(),{data:d,onUserCloseViaDialogOrKeybindRef:u}=x(),{onFailure:m,onSuccess:h,origin:g,appId:w,appClientId:v,wallet:E}=d.keyExport,R=T=>{a({shouldCallAuthOnSuccess:!1}),m(typeof T=="string"?new Error(T):T)},A=()=>{a({shouldCallAuthOnSuccess:!1}),h(),i({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:E.address}})};return Wy(()=>{if(!r||!E)return R("User must be authenticated before exporting their wallet");n().then(t,R)},[r,o]),u.current=A,Tc(b4,{children:[zr(k,{onClose:A}),Tc(v4,{children:[zr(so,{children:"Transfer wallet"}),Tc(qr,{children:["Either copy your private key or seed phrase to transfer your wallet."," ",zr("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),zr(My,{theme:c.appearance.palette.colorScheme,children:"Never share your private key or seed phrase with anyone."}),zr(Da,{isLoading:!1,isPulsing:!1,title:"Your wallet",address:E.address,showIcon:!0}),zr("div",{style:{width:"100%"},children:e&&zr(C4,{origin:g,appId:w,appClientId:v,accessToken:e,clientAnalyticsId:l,wallet:E,dimensions:{height:"44px"}})})]}),zr(B,{})]})};function C4(e){let[t,r]=Dp(e.dimensions.width),[o,n]=Dp(void 0),a=g4(null);Wy(()=>{if(a.current&&t===void 0){let{width:c}=a.current.getBoundingClientRect();r(c)}let l=getComputedStyle(document.documentElement);n({background:l.getPropertyValue("--privy-color-background"),background2:l.getPropertyValue("--privy-color-background-2"),foreground3:l.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:l.getPropertyValue("--privy-color-foreground-accent"),accent:l.getPropertyValue("--privy-color-accent"),accentDark:l.getPropertyValue("--privy-color-accent-dark"),success:l.getPropertyValue("--privy-color-success")})},[]);let i=e.wallet.chainType==="ethereum"&&!e.wallet.imported;return zr("div",{ref:a,children:t&&Tc(w4,{children:[zr("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:ol(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{client_id:e.appClientId,address:e.wallet.address,width:`${t}px`,caid:e.clientAnalyticsId,phrase_export:i,...o},{token:e.accessToken})}),zr(Iy,{children:"Loading..."}),i&&zr(Iy,{children:"Loading..."})]})})}var v4=Up.div`
1054
- display: flex;
1055
- flex-direction: column;
1056
- gap: 1.25rem;
1057
- text-align: left;
1058
- `,w4=Up.div`
1059
- overflow: visible;
1060
- position: relative;
1061
- overflow: none;
1062
- height: 44px;
1063
- display: flex;
1064
- gap: 12px;
1065
- `,Iy=Up.div`
1066
- display: flex;
1067
- align-items: center;
1068
- justify-content: center;
1069
- width: 100%;
1070
- height: 100%;
1071
- font-size: 16px;
1072
- font-weight: 500;
1073
- border-radius: var(--privy-border-radius-md);
1074
- background-color: var(--privy-color-background-2);
1075
- color: var(--privy-color-foreground-3);
1076
- `;import S4 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as P4,useState as Oy}from"react";import A4 from"styled-components";import{useCallback as E4,useRef as T4}from"react";function Sc(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=_(),o=T4(!1);return{createWallet:E4(async a=>{let i=await ve();if(!i)throw t({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),new Error("An error has occured, please login again.");try{t({eventName:"embedded_wallet_creation_started"});let l=await r(Wa);if(!l)throw new Error("walletProxy does not exist.");let c=2e4,d=new Promise((g,w)=>{setTimeout(()=>{w(new Error("walletProxy.create timed out."))},c)});if(!await Promise.race([l.create({accessToken:i,recoveryPassword:a}),d]))throw new Error("walletProxy.create did not send a response.");let m=await e();if(!m)throw new Error("Failed to refresh user.");let h=De(m);if(!h)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:h.address}}),o.current=!0,h}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}import{Fragment as k4,jsx as fi,jsxs as Ny}from"react/jsx-runtime";var Dy=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=x(),[a,i]=Oy(""),{embeddedWallets:l}=Be(),{authenticated:c}=q(),{closePrivyModal:d}=_(),{onSuccess:u,onFailure:m,callAuthOnSuccessOnClose:h}=o.createWallet,g=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:w}=Sc(),[v,E]=Oy(null),R=new Ge(async()=>{try{let T=await w();if(!T)return;E(T),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(T){i(T.message)}});P4(()=>{if(!c){r("LANDING"),m(new Error("User must be authenticated before creating a Privy wallet"));return}if(g){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let T=bc({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:l.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1});return r(T)}R.execute()},[g,c]);let A=()=>{v?(u(v),d({shouldCallAuthOnSuccess:h})):(m(new yr("User wallet creation failed")),d({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,a?Ny(k4,{children:[fi(k,{closeable:!1}),Ny(wr,{children:[fi(S4,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),fi(ye,{title:"Something went wrong",description:a})]}),fi(U,{onClick:A,children:"Close"}),fi(x4,{})]}):fi(Cc,{})},x4=A4.div`
1077
- height: 44px;
1078
- `;import{useEffect as b5,useState as Rc}from"react";import{useCallback as zp,useEffect as w5}from"react";import W4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as L4,useState as Hp}from"react";import R4 from"@heroicons/react/24/outline/ArrowPathIcon";import _4 from"@heroicons/react/24/outline/EyeIcon";import M4 from"@heroicons/react/24/outline/EyeSlashIcon";import Lt,{css as Fp}from"styled-components";var I4=Fp`
1079
- font-size: 14px;
1080
- font-style: normal;
1081
- font-weight: 400;
1082
- line-height: 20px;
1083
- letter-spacing: -0.008px;
1084
- text-align: left;
1085
- transition: color 0.1s ease-in;
1086
- `,Pc=Lt.span`
1087
- ${I4}
1088
- transition: color 0.1s ease-in;
1089
- color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1090
- text-transform: ${({error:e})=>e?"":"capitalize"};
1091
-
1092
- &[aria-hidden='true'] {
1093
- visibility: hidden;
1094
- }
1095
- `,yn=Lt.div`
1096
- display: flex;
1097
- flex-direction: column;
1098
- justify-content: center;
1099
- flex-grow: 1;
1100
- `,gn=Lt(U)`
1101
- ${e=>e.hideAnimations&&Fp`
1102
- && {
1103
- transition: none;
1104
- }
1105
- `}
1106
- `,Uy=Fp`
1107
- && {
1108
- width: 100%;
1109
- border-width: 1px;
1110
- border-radius: var(--privy-border-radius-md);
1111
- border-color: var(--privy-color-foreground-3);
1112
- background: var(--privy-color-background);
1113
- color: var(--privy-color-foreground);
1114
-
1115
- padding: 12px;
1116
- font-size: 16px;
1117
- font-style: normal;
1118
- font-weight: 300;
1119
- line-height: 22px; /* 137.5% */
1120
- }
1121
- `,hi=Lt.input`
1122
- ${Uy}
1123
-
1124
- &::placeholder {
1125
- color: var(--privy-color-foreground-3);
1126
- font-style: italic;
1127
- font-size: 14px;
1128
- }
1129
-
1130
- overflow: hidden;
1131
- text-overflow: ellipsis;
1132
- white-space: nowrap;
1133
- `,Fy=Lt.div`
1134
- ${Uy}
1135
- `,Cn=Lt.div`
1136
- position: relative;
1137
- width: 100%;
1138
- display: flex;
1139
- align-items: center;
1140
- justify-content: ${({centered:e})=>e?"center":"space-between"};
1141
- `,vn=Lt.div`
1142
- display: flex;
1143
- flex-direction: column;
1144
- align-items: center;
1145
- justify-content: center;
1146
- margin: 32px 0;
1147
- gap: 4px;
1148
-
1149
- & h3 {
1150
- font-size: 18px;
1151
- font-style: normal;
1152
- font-weight: 600;
1153
- line-height: 24px;
1154
- }
1155
-
1156
- & p {
1157
- max-width: 300px;
1158
- font-size: 14px;
1159
- font-style: normal;
1160
- font-weight: 400;
1161
- line-height: 20px;
1162
- }
1163
- `,fs=Lt.div`
1164
- display: flex;
1165
- flex-direction: column;
1166
- gap: 10px;
1167
- padding-bottom: 1rem;
1168
- `,hs=Lt.div`
1169
- display: flex;
1170
- text-align: left;
1171
- align-items: center;
1172
-
1173
- gap: 8px;
1174
- max-width: 300px;
1175
-
1176
- font-size: 14px;
1177
- font-style: normal;
1178
- font-weight: 400;
1179
- line-height: 20px;
1180
- letter-spacing: -0.008px;
1181
-
1182
- margin: 0 8px;
1183
- color: var(--privy-color-foreground-2);
1184
-
1185
- > :first-child {
1186
- min-width: 24px;
1187
- }
1188
- `,nD=Lt.div`
1189
- height: var(--privy-height-modal-full);
1190
-
1191
- @media (max-width: 440px) {
1192
- height: var(--privy-height-modal-compact);
1193
- }
1194
- `,Bp=Lt(ns)`
1195
- display: flex;
1196
- flex: 1;
1197
- gap: 4px;
1198
- justify-content: center;
1199
-
1200
- && {
1201
- background: var(--privy-color-background);
1202
- border-radius: var(--privy-border-radius-md);
1203
- border-color: var(--privy-color-foreground-3);
1204
- border-width: 1px;
1205
- }
1206
- `,yi=Lt.div`
1207
- position: absolute;
1208
- right: 0.5rem;
1209
-
1210
- display: flex;
1211
- flex-direction: row;
1212
- justify-content: space-around;
1213
- align-items: center;
1214
- `,By=Lt(R4)`
1215
- height: 1.25rem;
1216
- width: 1.25rem;
1217
- stroke: var(--privy-color-accent);
1218
- cursor: pointer;
1219
-
1220
- :active {
1221
- stroke: var(--privy-color-accent-light);
1222
- }
1223
- `,gi=Lt(M4)`
1224
- height: 1.25rem;
1225
- width: 1.25rem;
1226
- stroke: var(--privy-color-accent);
1227
- cursor: pointer;
1228
-
1229
- :active {
1230
- stroke: var(--privy-color-accent-light);
1231
- }
1232
- `,Ci=Lt(_4)`
1233
- height: 1.25rem;
1234
- width: 1.25rem;
1235
- stroke: var(--privy-color-accent);
1236
- cursor: pointer;
1237
-
1238
- :active {
1239
- stroke: var(--privy-color-accent-light);
1240
- }
1241
- `,Hy=Lt.progress`
1242
- height: 4px;
1243
- width: 100%;
1244
- margin: 8px 0;
1245
-
1246
- /* border-radius: 9999px; */
1247
- ::-webkit-progress-bar {
1248
- border-radius: 8px;
1249
- background: var(--privy-color-foreground-4);
1250
- }
1251
-
1252
- ::-webkit-progress-value {
1253
- border-radius: 8px;
1254
- transition: all 0.1s ease-out;
1255
- background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1256
- }
1257
- `;import{Fragment as O4,jsx as Tr,jsxs as Ac}from"react/jsx-runtime";var Gy=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=Hp(!0),[l,c]=Hp(!1),[d,u]=Hp(""),m=r===d;return L4(()=>{d&&!l&&c(!0)},[d]),Ac(O4,{children:[Tr(k,{closeable:!1,backFn:n}),Tr(oe,{}),Ac(yn,{children:[Ac(vn,{children:[Tr(W4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Tr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),Tr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Ac(Cn,{children:[Tr(hi,{value:d,onChange:h=>u(h.target.value),onKeyUp:h=>{h.key==="Enter"&&o()},onBlur:()=>c(!0),placeholder:"confirm your password",type:a?"password":"text",style:{paddingRight:"2.3rem"}}),Tr(yi,{style:{right:"0.75rem"},children:a?Tr(gi,{onClick:()=>i(!1)}):Tr(Ci,{onClick:()=>i(!0)})})]}),Tr(Pc,{"aria-hidden":!l||m,error:!0,children:"Passwords do not match"})]}),Tr(gn,{onClick:o,loading:t,disabled:!m,hideAnimations:e,children:"Continue"}),Tr(ae,{}),Tr(B,{})]})};import F4 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as B4}from"react";import H4 from"styled-components";import gs from"styled-components";import{jsx as ys,jsxs as U4}from"react/jsx-runtime";var Vy=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>ys("label",{children:U4(N4,{className:e,children:[ys(zy,{checked:t,...o}),ys(D4,{color:r,checked:t,children:ys(qy,{viewBox:"0 0 24 24",children:ys("polyline",{points:"20 6 9 17 4 12"})})})]})});var yD=gs.label`
1258
- && {
1259
- cursor: pointer;
1260
- display: flex;
1261
- align-items: center;
1262
- gap: 0.75rem;
1263
- padding: 0.75rem 1rem;
1264
- text-align: left;
1265
- border-radius: 0.5rem;
1266
- border: 1px solid var(--privy-color-foreground-4);
1267
- width: 100%;
1268
- }
1269
- `,N4=gs.div`
1270
- display: inline-block;
1271
- vertical-align: middle;
1272
- `,qy=gs.svg`
1273
- fill: none;
1274
- stroke: white;
1275
- stroke-width: 3px;
1276
- `,zy=gs.input.attrs({type:"checkbox"})`
1277
- border: 0;
1278
- clip: rect(0 0 0 0);
1279
- clippath: inset(50%);
1280
- height: 1px;
1281
- margin: -1px;
1282
- overflow: hidden;
1283
- padding: 0;
1284
- position: absolute;
1285
- white-space: nowrap;
1286
- width: 1px;
1287
- `,D4=gs.div`
1288
- display: inline-block;
1289
- width: 18px;
1290
- height: 18px;
1291
- transition: all 150ms;
1292
- cursor: pointer;
1293
- border-color: ${e=>e.color};
1294
- border-radius: 3px;
1295
- background: ${e=>e.checked?e.color:"var(--privy-color-background)"};
1296
-
1297
- && {
1298
- /* This is necessary to override css reset for border width */
1299
- border-width: 1px;
1300
- }
1301
-
1302
- ${zy}:focus + & {
1303
- box-shadow: 0 0 0 1px ${e=>e.color};
1304
- }
1305
-
1306
- ${qy} {
1307
- visibility: ${e=>e.checked?"visible":"hidden"};
1308
- }
1309
- `;import{Fragment as Ky,jsx as Kr,jsxs as Cs}from"react/jsx-runtime";var Yy=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=B4(!1);return Cs(Ky,{children:[Kr(k,{closeable:!1,backFn:o}),Kr(oe,{}),Cs(yn,{children:[Cs(vn,{children:[Kr(F4,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),Kr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),Kr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),Kr(fs,{children:Cs(hs,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),i(c=>!c)},children:[Kr(Vy,{color:"var(--privy-color-error)",readOnly:!0,checked:a}),Kr(Ky,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),Cs(G4,{children:[n.initiatedBy==="user"&&Kr(ro,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Kr(gn,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),Kr(ae,{}),Kr(B,{})]})},G4=H4.div`
1310
- display: flex;
1311
- gap: 10px;
1312
- `;import n5 from"@heroicons/react/24/outline/KeyIcon";import eg from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as tg,useMemo as Gp,useEffect as a5}from"react";import rg from"styled-components";import V4 from"fast-password-entropy";import*as Qy from"secure-password-utilities";import{DEFAULT_WORDLIST as q4}from"secure-password-utilities/wordlists";var z4=95,K4=8,Y4=3,Q4=.3,X4=/[a-z]/,Z4=/[A-Z]/,J4=/[0-9]/,j4="a-zA-Z0-9",Xy="!@#$%^&*()\\-_+.",Zy=`${j4}${Xy}`,$4=new RegExp(`[${Xy}]`),e5=new RegExp(`[${Zy}]`),Jy=new RegExp(`^[${Zy}]{6,}$`),jy=(e="")=>{let t=e.split("").filter(r=>!e5.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},xc=()=>Qy.generatePassphrase(4,q4);function t5(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function r5(e){if(e.length<K4)return 0;let t=0;X4.test(e)&&(t+=1),Z4.test(e)&&(t+=1),J4.test(e)&&(t+=1),$4.test(e)&&(t+=1);let r=t/Y4;return Math.max(0,Math.min(1,r))}function o5(e=""){let t=r5(e),r=V4(e)/z4;return(t*Q4+r)/2}function $y(e=""){let t=o5(e);return{value:t,label:t5(t)}}import{Fragment as l5,jsx as Ot,jsxs as Ro}from"react/jsx-runtime";var og=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,isResettingPassword:n,onSubmit:a,onClose:i,onBack:l,onPasswordChange:c,onPasswordGenerate:d})=>{let[u,m]=tg(!1),[h,g]=tg(!1);a5(()=>{r&&!h&&g(!0)},[r]);let w=Gp(()=>h?(r?.length||0)<6?"Password must be at least 6 characters":Jy.test(r||"")?null:`Invalid characters used ( ${jy(r).join(" ")} )`:null,[r,h]),v=Gp(()=>w?{value:0,label:"Weak"}:$y(r),[r,w]),E=Gp(()=>!!(!r?.length||w),[w,r]);return Ro(l5,{children:[Ot(k,{onClose:i,closeable:o.initiatedBy==="user",backFn:l}),Ot(oe,{}),Ro(yn,{children:[Ro(vn,{children:[Ot(n5,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ro("h3",{style:{color:"var(--privy-color-foreground)"},children:[n?"Reset":"Set"," your password"]}),Ot("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),Ro(Cn,{children:[Ot(hi,{value:r,onChange:R=>c(R.target.value),onKeyUp:R=>{R.key==="Enter"&&a()},placeholder:"enter or generate a strong password",type:u?"password":"text",style:{paddingRight:"3.8rem"}}),Ro(yi,{style:{width:"3.5rem"},children:[u?Ot(gi,{onClick:()=>m(!1)}):Ot(Ci,{onClick:()=>m(!0)}),Ot(By,{onClick:d})]})]}),Ot(Hy,{value:v.value===0?.01:v.value,label:v.label}),Ot(Pc,{error:!!w,children:w||`Password Strength: ${h?v.label:"--"}`}),Ro(s5,{children:[Ot(i5,{children:Ro(fs,{children:[Ro(hs,{children:[Ot(eg,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Ro(hs,{children:[Ot(eg,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),Ot(gn,{onClick:a,loading:t,disabled:E,hideAnimations:e,children:"Continue"})]})]}),Ot(ae,{}),Ot(B,{})]})},i5=rg(fs)`
1313
- flex: 1;
1314
- padding-top: 1rem;
1315
- `,s5=rg.div`
1316
- display: flex;
1317
- flex-direction: column;
1318
- height: 100%;
1319
- `;import c5 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import d5 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import p5 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import u5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as m5,useCallback as ng}from"react";import{Fragment as Vp,jsx as pr,jsxs as ua}from"react/jsx-runtime";var ag=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,l]=m5(!1),c=ng(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),d=ng(()=>{let u=document.createElement("a"),m=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),h=new Blob([f5(r,o)],{type:"text/plain"}),g=URL.createObjectURL(h);u.href=g,u.target="_blank",u.download=`${m}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return ua(Vp,{children:[pr(k,{backFn:a,closeable:!1}),pr(oe,{}),ua(yn,{children:[ua(vn,{children:[pr(u5,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),pr("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),pr("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),pr(Cn,{centered:!0,children:pr(Fy,{children:o})}),ua("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[pr(Bp,{onClick:c,children:i?ua(Vp,{children:[pr(d5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):ua(Vp,{children:[pr(p5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),ua(Bp,{onClick:d,children:[pr(c5,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),pr(gn,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),pr(ae,{}),pr(B,{})]})},f5=(e,t)=>`Your wallet recovery password for ${e} is
1320
-
1321
- ${t}
1322
-
1323
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import h5 from"@heroicons/react/24/solid/CheckCircleIcon";import y5 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as g5,jsx as Yo,jsxs as qp}from"react/jsx-runtime";var ig=({error:e,onClose:t})=>qp(g5,{children:[Yo(k,{closeable:!1}),Yo(oe,{}),e?qp(wr,{children:[Yo(y5,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Yo(ye,{title:"Something went wrong",description:e})]}):qp(wr,{children:[Yo(h5,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),Yo(ye,{title:"Success"})]}),Yo(U,{onClick:t,children:"Close"}),Yo(ae,{}),Yo(B,{})]});import{useReducer as C5}from"react";var v5=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},sg=()=>{let[e,t]=C5(v5,"creating");return{send:t,state:e}};import{jsx as vs}from"react/jsx-runtime";var kc=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=x(),{send:n,state:a}=sg(),i=zp(async()=>{a==="finalizing"&&await e(),n("next")},[a,n,e]);w5(()=>{let d;return a==="done"&&t.config.initiatedBy==="automatic"&&(d=setTimeout(()=>t.onClose?.(),Le)),()=>{d&&clearTimeout(d)}},[a,t.config.initiatedBy,t.onClose]);let l=zp(()=>{n("back")},[n]),c=zp(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return a==="creating"?vs(og,{...t,onSubmit:i,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?c:void 0}):a==="saving"?vs(ag,{...t,onSubmit:i,onBack:l}):a==="confirming"?vs(Gy,{...t,onSubmit:i,onBack:l}):a==="finalizing"?vs(Yy,{...t,onSubmit:i,onBack:l}):a==="done"?vs(ig,{...t,onSubmit:i}):null};import{jsx as E5}from"react/jsx-runtime";var lg=()=>{let[e,t]=Rc(null),[r,o]=Rc(!1),[n,a]=Rc(null),[i,l]=Rc(""),{authenticated:c,getAccessToken:d,user:u}=q(),{walletProxy:m,refreshUser:h,closePrivyModal:g,createAnalyticsEvent:w}=_(),{app:v,navigate:E,data:R,onUserCloseViaDialogOrKeybindRef:A}=x(),{onSuccess:T,onFailure:P}=R.createWallet,S=De(u),M=e?.recoveryMethod==="user-passcode",N=S?.recoveryMethod==="user-passcode";b5(()=>{c||(E("LANDING"),P(new tm("User must be authenticated before setting a password on a Privy wallet")))},[c]);let H=()=>{if(n){P(n),g({shouldCallAuthOnSuccess:!1});return}if(!M){P(new yr("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}T(e),g({shouldCallAuthOnSuccess:!1})};A.current=H;let F=async()=>{let W=await d();if(W&&S?.address&&i&&m)try{if(w({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:S.address,existingRecoveryMethod:S.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:N}}),!(await m.setRecovery({accessToken:W,address:S.address,recoveryPassword:i,recoveryMethod:"user-passcode"})).address){a(new yr("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:S.address,existingRecoveryMethod:S.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:N,reason:"error setting password"}});return}let L=await h(),Y=De(L);if(!Y){a(new yr("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:S.address,existingRecoveryMethod:S.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:N,reason:"wallet disconnected"}});return}t(Y),w({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:S.address,existingRecoveryMethod:S.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:N}})}catch(X){console.warn(X),a(X instanceof Error?X:new Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:S.address,reason:X}})}},K=async()=>{M?(T(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await F(),o(!1))};return E5(kc,{appName:v?.name||"privy",config:{initiatedBy:"user",onCancel:H},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,isResettingPassword:N,onPasswordGenerate:()=>l(xc()),onPasswordChange:l,onSubmit:K,onClose:H})};import T5 from"@heroicons/react/24/outline/UserCircleIcon";import S5 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as P5,jsx as Qo,jsxs as _c}from"react/jsx-runtime";var cg=()=>{let{closePrivyModal:e}=_(),{data:t,setModalData:r,navigate:o,onUserCloseViaDialogOrKeybindRef:n}=x(),{onSuccess:a,onFailure:i}=t.setWalletPassword,l=()=>{i(new yr("Exited before password was added to wallet")),e({shouldCallAuthOnSuccess:!1})};return n.current=l,_c(P5,{children:[Qo(k,{onClose:l}),Qo(oe,{}),_c(wr,{children:[_c(Uh,{children:[Qo(T5,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Qo(Fh,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Qo(S5,{width:"12px",height:"12px",fill:"white"})})]}),_c(ye,{title:"Secure Your Account",children:["Please set a password to secure your account.",Qo("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),Qo(U,{onClick:()=>{r({createWallet:{onFailure:i,onSuccess:a,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Qo(ae,{}),Qo(B,{})]})};import A5 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import x5 from"@heroicons/react/24/outline/PhoneIcon";import dg from"styled-components";import{Fragment as M5,jsx as Yr,jsxs as Mc}from"react/jsx-runtime";var k5=(e,t)=>{let r=Yr(A5,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof C)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:r};case"insufficient_balance":return{title:"Insufficient balance",detail:e.message,ctaText:"Try again",icon:r};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:r}}else{if(e instanceof Oe&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:Yr(x5,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof tr)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:r};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:r};case"allowlist_rejected":return{title:t.errorTitle||"You don't have access to this app",detail:t.errorDetail||"Have you been invited?",ctaText:t.errorCtaText||"Try another account",icon:Yr(cc,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:Yr("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:Yr("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:r};case"not_supported":return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:r};case"too_many_requests":return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:r};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:r}}else return e instanceof Lr&&e.status&&[400,422].includes(e.status)?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:r}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:r}}},pg=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=x(),a=r?.errorModalData?.previousScreen||(o===n?void 0:o);return Yr(ma,{error:r?.errorModalData?.error||new Error,backFn:()=>a?e(a,!1):t(),onClick:()=>e(a||"LANDING",!1)})},ma=({error:e,backFn:t,onClick:r})=>{let{reset:o}=Ee(),{app:n}=x(),a=k5(e,n.allowlistConfig),i=()=>{if(e instanceof tr&&(e.privyErrorCode==="invalid_captcha"&&o(),e.privyErrorCode==="allowlist_rejected"&&n.allowlistConfig.errorCtaLink)){window.location.href=n.allowlistConfig.errorCtaLink;return}r?.()};return Mc(M5,{children:[Yr(k,{backFn:t}),Mc(R5,{children:[Yr(rt,{children:Mc("div",{children:[Yr(lc,{color:"var(--privy-color-error)"}),a.icon]})}),Mc(_5,{children:[Yr("h3",{children:a.title}),Yr("p",{children:a.detail})]}),Yr(U,{color:"var(--privy-color-error)",onClick:i,children:a.ctaText})]})]})},R5=dg.div`
1324
- display: flex;
1325
- flex-direction: column;
1326
- align-items: center;
1327
- justify-content: center;
1328
- gap: 24px;
1329
- width: 100%;
1330
- padding-bottom: 16px;
1331
- `,_5=dg.div`
1332
- display: flex;
1333
- flex-direction: column;
1334
- gap: 8px;
1335
- `;import{useEffect as gg,useRef as J5,useState as Yp}from"react";import{isIOS as j5,isMobile as Cg}from"react-device-detect";import bg from"styled-components";import{useState as I5}from"react";import W5 from"styled-components";import{jsx as ug}from"react/jsx-runtime";var vi=({style:e,color:t,...r})=>ug("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:ug("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as mg,jsxs as O5}from"react/jsx-runtime";var wn=e=>{let[t,r]=I5(!1);return O5(L5,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?mg(vi,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):mg(Dm,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},L5=W5.button`
1336
- display: flex;
1337
- align-items: center;
1338
- gap: 6px;
1339
-
1340
- && {
1341
- margin: 8px 2px;
1342
- font-size: 14px;
1343
- color: ${e=>e.justCopied?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"};
1344
- font-weight: ${e=>e.justCopied?"medium":"normal"};
1345
- transition: color 350ms ease;
1346
-
1347
- :focus,
1348
- :active {
1349
- background-color: transparent;
1350
- border: none;
1351
- outline: none;
1352
- box-shadow: none;
1353
- }
1354
-
1355
- :hover {
1356
- color: ${e=>e.justCopied?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"};
1357
- }
1358
-
1359
- :active {
1360
- color: 'var(--privy-color-foreground)';
1361
- font-weight: medium;
1362
- }
1363
-
1364
- @media (max-width: 440px) {
1365
- margin: 12px 2px;
1366
- }
1367
- }
1368
-
1369
- svg {
1370
- width: 14px;
1371
- height: 14px;
1372
- }
1373
- `;import{useState as N5}from"react";import D5 from"styled-components";import{jsx as F5}from"react/jsx-runtime";var Ic=e=>{let[t,r]=N5(!1);return F5(U5,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},U5=D5.a`
1374
- display: flex;
1375
- align-items: center;
1376
- gap: 6px;
1377
-
1378
- && {
1379
- margin: 8px 2px;
1380
- font-size: 14px;
1381
- color: ${e=>e.justOpened?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"};
1382
- font-weight: ${e=>e.justOpened?"medium":"normal"};
1383
- transition: color 350ms ease;
1384
-
1385
- :focus,
1386
- :active {
1387
- background-color: transparent;
1388
- border: none;
1389
- outline: none;
1390
- box-shadow: none;
1391
- }
1392
-
1393
- :hover {
1394
- color: ${e=>e.justOpened?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"};
1395
- }
1396
-
1397
- :active {
1398
- color: 'var(--privy-color-foreground)';
1399
- font-weight: medium;
1400
- }
1401
-
1402
- @media (max-width: 440px) {
1403
- margin: 12px 2px;
1404
- }
1405
- }
1406
-
1407
- svg {
1408
- width: 14px;
1409
- height: 14px;
1410
- }
1411
- `;import B5 from"qrcode";import H5 from"react";import G5 from"styled-components";import{jsx as fg}from"react/jsx-runtime";var hg=()=>fg("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:fg("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as ws,jsx as zt,jsxs as yg}from"react/jsx-runtime";var Sr=7,Kp=(e,t,r,o,n)=>{for(let a=t;a<t+o;a++)for(let i=r;i<r+n;i++){let l=e?.[i];l&&l[a]&&(l[a]=0)}return e},V5=(e,t)=>{let r=B5.create(e,{errorCorrectionLevel:t}).modules,o=om(Array.from(r.data),r.size);return o=Kp(o,0,0,Sr,Sr),o=Kp(o,o.length-Sr,0,Sr,Sr),o=Kp(o,0,o.length-Sr,Sr,Sr),o},q5=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>zt(ws,{children:[0,1,2].map(a=>zt("circle",{r:r*(Sr-a*2)/2,cx:e+r*Sr/2,cy:t+r*Sr/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),z5=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Sr)*e,0],[0,(t-Sr)*e]];return zt(ws,{children:n.map(([a,i])=>zt(q5,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},K5=({matrix:e,cellSize:t,color:r})=>zt(ws,{children:e.map((a,i)=>a.map((l,c)=>l?zt("rect",{height:t-.2*2,width:t-.2*2,x:i*t+t*(.2/2),y:c*t+t*(.2/2),rx:t*.5,ry:t*.5,fill:r},`cell-${i}-${c}`):zt(H5.Fragment,{},`circle-${i}-${c}`)))}),Y5=({cellSize:e,matrixSize:t,element:r,sizePercentage:o,bgColor:n})=>{if(!r)return zt(ws,{});let a=t*(o||.14),i=Math.floor(t/2-a/2),l=Math.floor(t/2+a/2);(l-i)%2!==t%2&&(l+=1);let c=(l-i)*e,d=.1,u=c-c*d*2,m=r,h=i*e;return yg(ws,{children:[zt("rect",{x:i*e,y:i*e,width:c,height:c,fill:n}),zt(m,{x:h+c*d,y:h+c*d,height:u,width:u})]})},Q5=e=>{let t=e.outputSize,r=V5(e.url,e.errorCorrectionLevel),o=t/r.length,n=cm(o*2,{min:t*.025,max:t*.036});return yg("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%",padding:`${n}px`},children:[zt(K5,{matrix:r,cellSize:o,color:e.fgColor}),zt(z5,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),zt(Y5,{cellSize:o,element:e.logo?.element,bgColor:e.bgColor,matrixSize:r.length})]})},X5=G5.div`
1412
- display: flex;
1413
- justify-content: center;
1414
- align-items: center;
1415
- height: ${e=>`${e.size}px`};
1416
- width: ${e=>`${e.size}px`};
1417
- margin: auto;
1418
- background-color: ${e=>e.bgColor};
1419
-
1420
- && {
1421
- border-width: 2px;
1422
- border-color: ${e=>e.borderColor};
1423
- border-radius: var(--privy-border-radius-md);
1424
- }
1425
- `,bn=e=>{let{appearance:t}=Be(),r=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",n=e.size||160,a=t.palette.colorScheme==="dark"?r:o;return zt(X5,{size:n,bgColor:r,fgColor:o,borderColor:a,children:zt(Q5,{url:e.url,logo:{element:e.squareLogoElement??hg},outputSize:n,bgColor:r,fgColor:o,errorCorrectionLevel:e.errorCorrectionLevel||"Q"})})};import{jsx as Wc,jsxs as Z5}from"react/jsx-runtime";var _o=({style:e,...t})=>Z5("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[Wc("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),Wc("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),Wc("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),Wc("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as Lc,jsx as Ie,jsxs as Mo}from"react/jsx-runtime";var vg="#8a63d2",Eg=1e3,$5=Eg*2,e6=Eg*120,Tg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:c}=x(),{getAuthFlow:d,loginWithFarcaster:u,closePrivyModal:m,createAnalyticsEvent:h}=_(),[g,w]=Yp(void 0),[v,E]=Yp(!1),[R,A]=Yp(!1),T=J5([]),P=Le,S=d(),M=S?.meta.connectUri;return gg(()=>{let N=Date.now(),H=setInterval(async()=>{let F=await S.pollForReady.execute(),K=Date.now()-N;if(F){clearInterval(H),E(!0);try{await u(),A(!0)}catch(W){let X={retryable:!1,message:"Authentication failed"};if(W?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else if(W?.privyErrorCode==="max_accounts_reached"){console.error(new yo(W).toString()),a("USER_LIMIT_REACHED_SCREEN");return}else if(W?.privyErrorCode==="user_does_not_exist"){a("ACCOUNT_NOT_FOUND_SCREEN");return}else W?.privyErrorCode==="linked_to_another_user"?X.detail=W.message||"This account has already been linked to another user.":W?.privyErrorCode==="invalid_credentials"?(X.retryable=!0,X.detail="Something went wrong. Try again."):W?.privyErrorCode==="too_many_requests"&&(X.detail="Too many requests. Please wait before trying again.");w(X)}}else K>e6&&(clearInterval(H),w({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},$5);return()=>{clearInterval(H),T.current.forEach(F=>clearTimeout(F))}},[]),gg(()=>{if(r&&e&&R&&o){if(c?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},P);return()=>clearTimeout(H)}R&&(bt(o,c?.embeddedWallets.createOnLogin)?T.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:H,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},P)):T.current.push(setTimeout(()=>m({shouldCallAuthOnSuccess:!0,isSuccess:!0}),P)))}},[R,r,e,o]),Cg||v?Mo(Lc,{children:[Ie(k,{backFn:n?i:void 0,onClose:m},"header"),Ie(oe,{}),j5?Ie(Lc,{children:Mo(t6,{children:[Ie(rt,{children:Mo("div",{children:[Ie(st,{success:R,fail:!!g}),Ie(_o,{style:{width:"38px",height:"38px"}})]})}),Mo(je,{children:[Ie(pe,{children:g?g.message:"Sign in with Farcaster"}),Ie(me,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),M&&Ie(U,{onClick:N=>{N.preventDefault(),window.location.href=M},children:"Open Warpcast app"})]})}):Ie(Lc,{children:Mo(wg,{children:[Ie(rt,{children:Mo("div",{children:[Ie(st,{success:R,fail:!!g}),Ie(_o,{style:{width:"38px",height:"38px"}})]})}),Mo(je,{children:[Ie(pe,{children:g?g.message:"Signing in with Farcaster"}),Ie(me,{children:g?g.detail:"This should only take a moment"}),Ie(Pt,{children:M&&Cg&&Ie(Ic,{text:"Take me to Warpcast",url:M,color:vg})})]})]})}),Ie(j,{})]}):Mo(Lc,{children:[Ie(k,{backFn:n?i:void 0,onClose:m},"header"),Ie(oe,{}),Ie(wg,{children:Mo("div",{children:[Ie(pe,{children:"Sign in with Farcaster"}),Ie(me,{children:"Scan with your phone's camera to continue."}),Ie(ri,{children:M?Ie(bn,{url:M,size:275,squareLogoElement:_o}):Ie(lt,{})}),Mo(Pt,{children:[Ie(me,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),M&&Ie(wn,{text:M,itemName:"link",color:vg})]})]})}),Ie(j,{})]})},wg=bg.div`
1426
- display: flex;
1427
- flex-direction: column;
1428
- align-items: center;
1429
- justify-content: center;
1430
- margin-left: 27px;
1431
- margin-right: 27px;
1432
- gap: 24px;
1433
- `,t6=bg.div`
1434
- display: flex;
1435
- flex-direction: column;
1436
- align-items: center;
1437
- justify-content: center;
1438
- gap: 24px;
1439
- width: 100%;
1440
- `;import{useEffect as r6,useRef as o6,useState as Qp}from"react";import{isIOS as n6,isMobile as Sg}from"react-device-detect";import xg from"styled-components";import{Fragment as Oc,jsx as Ne,jsxs as lo}from"react/jsx-runtime";var Pg="#8a63d2",kg=1e3,a6=kg*2,i6=kg*300,Rg=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=x(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=_(),[i,l]=Qp(void 0),[c,d]=Qp(!1),[u,m]=Qp(!1),h=o6([]),g=Le,w=r?.farcasterSigner;r6(()=>{let E=Date.now(),R=setInterval(async()=>{if(!w?.public_key){clearInterval(R),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}w.status==="approved"&&(clearInterval(R),d(!1),m(!0),h.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let A=await n(w?.public_key),T=Date.now()-E;A.status==="approved"?(clearInterval(R),d(!1),m(!0),h.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):T>i6?(clearInterval(R),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):A.status==="revoked"&&(clearInterval(R),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},a6);return()=>{clearInterval(R),h.current.forEach(A=>clearTimeout(A))}},[]);let v=w?.status==="pending_approval"?w.signer_approval_url:void 0;return Sg||c?lo(Oc,{children:[Ne(k,{backFn:e?t:void 0,onClose:a},"header"),Ne(oe,{}),n6?Ne(Oc,{children:lo(s6,{children:[Ne(rt,{children:lo("div",{children:[Ne(st,{success:u,fail:!!i}),Ne(_o,{style:{width:"38px",height:"38px"}})]})}),lo(je,{children:[Ne(pe,{children:i?i.message:"Add a signer to Farcaster"}),Ne(me,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),v&&Ne(U,{onClick:E=>{E.preventDefault(),window.location.href=v},children:"Open Warpcast app"})]})}):Ne(Oc,{children:lo(Ag,{children:[Ne(rt,{children:lo("div",{children:[Ne(st,{success:u,fail:!!i}),Ne(_o,{style:{width:"38px",height:"38px"}})]})}),lo(je,{children:[Ne(pe,{children:i?i.message:"Requesting signer from Farcaster"}),Ne(me,{children:i?i.detail:"This should only take a moment"}),Ne(Pt,{children:v&&Sg&&Ne(Ic,{text:"Take me to Warpcast",url:v,color:Pg})})]})]})}),Ne(j,{})]}):lo(Oc,{children:[Ne(k,{backFn:e?t:void 0,onClose:a},"header"),Ne(oe,{}),Ne(Ag,{children:lo("div",{children:[Ne(pe,{children:"Add a signer to Farcaster"}),lo(me,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),Ne(ri,{children:w?.status==="pending_approval"?Ne(bn,{url:w.signer_approval_url,size:275,squareLogoElement:_o}):Ne(lt,{})}),lo(Pt,{children:[Ne(me,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),w?.status==="pending_approval"&&Ne(wn,{text:w.signer_approval_url,itemName:"link",color:Pg})]})]})}),Ne(j,{})]})},Ag=xg.div`
1441
- display: flex;
1442
- flex-direction: column;
1443
- align-items: center;
1444
- justify-content: center;
1445
- margin-left: 27px;
1446
- margin-right: 27px;
1447
- gap: 24px;
1448
- `,s6=xg.div`
1449
- display: flex;
1450
- flex-direction: column;
1451
- align-items: center;
1452
- justify-content: center;
1453
- gap: 24px;
1454
- width: 100%;
1455
- `;import c7 from"@heroicons/react/24/outline/CheckCircleIcon";import{useEffect as En,useState as Xt}from"react";import{createPublicClient as v1,createWalletClient as d7,custom as p7,encodeFunctionData as u7,http as w1,parseEther as m7,publicActions as f7}from"viem";import{jsx as l6}from"react/jsx-runtime";function Nt({title:e}){let{currentScreen:t,navigateBack:r,navigate:o,data:n}=x(),a;return t==="FUNDING_MANUAL_TRANSFER_SCREEN"?a=r:t===n?.funding?.methodScreen?n.funding.comingFromSendTransactionScreen?a=()=>o("EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"):a=void 0:a=n?.funding?.methodScreen?()=>o(n.funding.methodScreen):void 0,l6(k,{title:e,backFn:a})}import Nc from"styled-components";import{jsx as Xp,jsxs as m6}from"react/jsx-runtime";var wi=({size:e})=>Xp(c6,{$size:e,children:m6(d6,{children:[Xp(p6,{}),Xp(u6,{})]})}),c6=Nc.div`
1456
- --spinner-size: ${e=>e.$size?e.$size:"96px"};
1457
-
1458
- display: flex;
1459
- justify-content: center;
1460
- align-items: center;
1461
- flex-grow: 1;
1462
-
1463
- @media all and (display-mode: standalone) {
1464
- margin-bottom: 30px;
1465
- }
1466
- `,d6=Nc.div`
1467
- position: relative;
1468
- height: var(--spinner-size);
1469
- width: var(--spinner-size);
1470
-
1471
- opacity: 1;
1472
- animation: fadein 200ms ease;
1473
- `,p6=Nc.div`
1474
- position: absolute;
1475
- top: 0;
1476
- right: 0;
1477
- bottom: 0;
1478
- left: 0;
1479
- width: var(--spinner-size);
1480
- height: var(--spinner-size);
1481
-
1482
- && {
1483
- border: 4px solid #f1f2f9;
1484
- border-radius: 50%;
1485
- }
1486
- `,u6=Nc.div`
1487
- position: absolute;
1488
- top: 0;
1489
- right: 0;
1490
- bottom: 0;
1491
- left: 0;
1492
- width: var(--spinner-size);
1493
- height: var(--spinner-size);
1494
- animation: spin 1200ms linear infinite;
1495
-
1496
- && {
1497
- border: 4px solid;
1498
- border-color: #cbcde1 transparent transparent transparent;
1499
- border-radius: 50%;
1500
- }
1501
-
1502
- @keyframes spin {
1503
- from {
1504
- transform: rotate(0deg);
1505
- }
1506
- to {
1507
- transform: rotate(360deg);
1508
- }
1509
- }
1510
- `;import{useState as Zp,useEffect as f6}from"react";var Io=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=_(),[n,a]=Zp(!0),[i,l]=Zp(void 0),[c,d]=Zp(void 0);return f6(()=>{let u=e.chainId||Fo,h=hl(o).find(w=>w.id===Number(u));(async()=>{if(!t){a(!1);return}if(!h){a(!1),l(new Error(`Unable to fetch token price on chain id ${u}`));return}try{a(!0);let w=await r(h);w?d(w):l(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(w){l(w)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:c,isTokenPriceLoading:n,tokenPriceError:i}};var bs=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}];var Dc=({amount:e,decimals:t})=>Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(e/10n**BigInt(t));var Xo="sdk_fiat_on_ramp_completed_with_status";var _g="0x0000000000000000000000000000000000000000",Mg=({destinationCurrency:e,...t})=>({tradeType:"EXACT_OUTPUT",originCurrency:_g,destinationCurrency:e??_g,...t}),h6="https://api.testnets.relay.link/execute/swap",y6="https://api.relay.link/execute/swap",Ig=async({input:e,isTestnet:t})=>{let r=await fetch(t?h6:y6,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),o=await r.json();if(!r.ok&&(typeof o.message!="string"||!o.message.startsWith("Invalid address")))throw console.error("Relay error:",o),new Error(o.message??"Error fetching quote from relay");return o},Wg=e=>{let t=e.steps[0]?.items?.[0];if(t)return{from:t.data.from,to:t.data.to,value:Number(t.data.value),chainId:Number(t.data.chainId),data:t.data.data}};import{createPublicClient as g6,http as C6}from"viem";var Lg=({chains:e,appId:t,address:r,rpcConfig:o})=>Promise.all(e.map(async n=>({balance:await g6({chain:n,transport:C6(Uo(n,o,t))}).getBalance({address:r}).catch(()=>0n),chain:n})));import{createPublicClient as v6,http as w6}from"viem";var Og=async({chain:e,address:t,appId:r,rpcConfig:o,erc20Address:n})=>({balance:await v6({chain:e,transport:w6(Uo(e,o,r))}).readContract({address:n,abi:b6,functionName:"balanceOf",args:[t]}).catch(()=>0n),chain:e}),b6=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];import Ng from"styled-components";var Uc=Ng.span`
1511
- display: flex;
1512
- flex-direction: column;
1513
- gap: 0.35rem;
1514
- width: 100%;
1515
- `,Dt=Ng.span`
1516
- display: flex;
1517
- width: 100%;
1518
- justify-content: space-between;
1519
- gap: 0.5rem;
1520
- `;import E6 from"styled-components";var Ut=E6.span`
1521
- color: var(--privy-color-foreground-3);
1522
- font-size: 0.875rem;
1523
- font-weight: 400;
1524
- line-height: 1.375rem; /* 157.143% */
1525
- `;import e1 from"styled-components";import T6 from"styled-components";var Kt=T6.span`
1526
- color: var(--privy-color-foreground);
1527
- font-size: 0.875rem;
1528
- font-weight: 500;
1529
- line-height: 1.375rem; /* 157.143% */
1530
- word-break: break-all;
1531
- text-align: right;
1532
-
1533
- ${Wm}
1534
- `;import _6 from"@heroicons/react/24/outline/GlobeAltIcon";import{jsx as Yt,jsxs as Fc}from"react/jsx-runtime";var Dg=e=>Yt("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",version:"1.1",id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 2500 2500",xmlSpace:"preserve",...e,children:Yt("g",{id:"Layer_x0020_1",children:Fc("g",{id:"_2405588477232",children:[Yt("rect",{fill:"none",width:"2500",height:"2500"}),Yt("g",{children:Fc("g",{children:[Yt("path",{fill:"#213147",d:"M226,760v980c0,63,33,120,88,152l849,490c54,31,121,31,175,0l849-490c54-31,88-89,88-152V760 c0-63-33-120-88-152l-849-490c-54-31-121-31-175,0L314,608c-54,31-87,89-87,152H226z"}),Yt("g",{children:Fc("g",{children:[Yt("g",{children:Yt("path",{fill:"#12AAFF",d:"M1435,1440l-121,332c-3,9-3,19,0,29l208,571l241-139l-289-793C1467,1422,1442,1422,1435,1440z"})}),Yt("g",{children:Yt("path",{fill:"#12AAFF",d:"M1678,882c-7-18-32-18-39,0l-121,332c-3,9-3,19,0,29l341,935l241-139L1678,883V882z"})})]})}),Yt("g",{children:Yt("path",{fill:"#9DCCED",d:"M1250,155c6,0,12,2,17,5l918,530c11,6,17,18,17,30v1060c0,12-7,24-17,30l-918,530c-5,3-11,5-17,5 s-12-2-17-5l-918-530c-11-6-17-18-17-30V719c0-12,7-24,17-30l918-530c5-3,11-5,17-5l0,0V155z M1250,0c-33,0-65,8-95,25L237,555 c-59,34-95,96-95,164v1060c0,68,36,130,95,164l918,530c29,17,62,25,95,25s65-8,95-25l918-530c59-34,95-96,95-164V719 c0-68-36-130-95-164L1344,25c-29-17-62-25-95-25l0,0H1250z"})}),Yt("polygon",{fill:"#213147",points:"642,2179 727,1947 897,2088 738,2234 "}),Fc("g",{children:[Yt("path",{fill:"#FFFFFF",d:"M1172,644H939c-17,0-33,11-39,27L401,2039l241,139l550-1507c5-14-5-28-19-28L1172,644z"}),Yt("path",{fill:"#FFFFFF",d:"M1580,644h-233c-17,0-33,11-39,27L738,2233l241,139l620-1701c5-14-5-28-19-28V644z"})]})]})})]})})});import{jsx as Ug,jsxs as S6}from"react/jsx-runtime";var Fg=e=>S6("svg",{width:"1503",height:"1504",viewBox:"0 0 1503 1504",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Ug("rect",{x:"287",y:"258",width:"928",height:"844",fill:"white"}),Ug("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M1502.5 752C1502.5 1166.77 1166.27 1503 751.5 1503C336.734 1503 0.5 1166.77 0.5 752C0.5 337.234 336.734 1 751.5 1C1166.27 1 1502.5 337.234 1502.5 752ZM538.688 1050.86H392.94C362.314 1050.86 347.186 1050.86 337.962 1044.96C327.999 1038.5 321.911 1027.8 321.173 1015.99C320.619 1005.11 328.184 991.822 343.312 965.255L703.182 330.935C718.495 303.999 726.243 290.531 736.021 285.55C746.537 280.2 759.083 280.2 769.599 285.55C779.377 290.531 787.126 303.999 802.438 330.935L876.42 460.079L876.797 460.738C893.336 489.635 901.723 504.289 905.385 519.669C909.443 536.458 909.443 554.169 905.385 570.958C901.695 586.455 893.393 601.215 876.604 630.549L687.573 964.702L687.084 965.558C670.436 994.693 661.999 1009.46 650.306 1020.6C637.576 1032.78 622.263 1041.63 605.474 1046.62C590.161 1050.86 573.004 1050.86 538.688 1050.86ZM906.75 1050.86H1115.59C1146.4 1050.86 1161.9 1050.86 1171.13 1044.78C1181.09 1038.32 1187.36 1027.43 1187.92 1015.63C1188.45 1005.1 1181.05 992.33 1166.55 967.307C1166.05 966.455 1165.55 965.588 1165.04 964.706L1060.43 785.75L1059.24 783.735C1044.54 758.877 1037.12 746.324 1027.59 741.472C1017.08 736.121 1004.71 736.121 994.199 741.472C984.605 746.453 976.857 759.552 961.544 785.934L857.306 964.891L856.949 965.507C841.69 991.847 834.064 1005.01 834.614 1015.81C835.352 1027.62 841.44 1038.5 851.402 1044.96C860.443 1050.86 875.94 1050.86 906.75 1050.86Z",fill:"#E84142"})]});import{jsx as Bg,jsxs as P6}from"react/jsx-runtime";var Hg=e=>P6("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Bg("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),Bg("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]});import{jsx as Gg,jsxs as A6}from"react/jsx-runtime";var Vg=e=>A6("svg",{fill:"none",height:"400",viewBox:"0 0 400 400",width:"400",xmlns:"http://www.w3.org/2000/svg",...e,children:[Gg("path",{d:"m0 0h400v400h-400z",fill:"#fcff52"}),Gg("path",{d:"m300 100h-200v200h199.996v-69.813h-33.191c-11.442 25.468-37.194 43.206-66.665 43.206-40.63 0-73.533-33.187-73.533-73.533s32.903-73.249 73.533-73.249c30.043 0 55.795 18.313 67.24 44.349h32.62z",fill:"#000"})]});import{jsx as bi,jsxs as qg}from"react/jsx-runtime";var zg=e=>qg("svg",{width:"200",height:"208",viewBox:"0 0 200 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[bi("rect",{width:"199.4",height:"207.623",fill:"#121212"}),qg("g",{"clip-path":"url(#clip0_2303_643)",children:[bi("path",{d:"M132.369 155.99H49.7001V68.8854H68.6148V139.109H132.369V155.981V155.99Z",fill:"white"}),bi("path",{d:"M132.369 85.7575C141.687 85.7575 149.241 78.2036 149.241 68.8855C149.241 59.5673 141.687 52.0134 132.369 52.0134C123.05 52.0134 115.497 59.5673 115.497 68.8855C115.497 78.2036 123.05 85.7575 132.369 85.7575Z",fill:"white"})]}),bi("defs",{children:bi("clipPath",{id:"clip0_2303_643",children:bi("rect",{width:"99.5407",height:"103.977",fill:"white",transform:"translate(49.7001 52.0134)"})})})]});import{jsx as Es,jsxs as x6}from"react/jsx-runtime";var Kg=e=>x6("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 327.5 533.3",enableBackground:"new 0 0 327.5 533.3;",xmlSpace:"preserve",...e,children:[Es("path",{fill:"#8492B2",d:"M163.7,197.2V0L0,271.6L163.7,197.2z"}),Es("path",{fill:"#62688F",d:"M163.7,368.4V197.2L0,271.6L163.7,368.4z M163.7,197.2l163.7,74.4L163.7,0V197.2z"}),Es("path",{fill:"#454A75",d:"M163.7,197.2v171.2l163.7-96.8L163.7,197.2z"}),Es("path",{fill:"#8492B2",d:"M163.7,399.4L0,302.7l163.7,230.7V399.4z"}),Es("path",{fill:"#62688F",d:"M327.5,302.7l-163.8,96.7v134L327.5,302.7z"})]});import{jsx as Jp,jsxs as k6}from"react/jsx-runtime";var Yg=e=>k6("svg",{width:"500",height:"500",viewBox:"0 0 500 500",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Jp("circle",{cx:"250",cy:"250",r:"250",fill:"#FF0420"}),Jp("path",{d:"M177.133 316.446C162.247 316.446 150.051 312.943 140.544 305.938C131.162 298.808 126.471 288.676 126.471 275.541C126.471 272.789 126.784 269.411 127.409 265.408C129.036 256.402 131.35 245.581 134.352 232.947C142.858 198.547 164.812 181.347 200.213 181.347C209.845 181.347 218.476 182.973 226.107 186.225C233.738 189.352 239.742 194.106 244.12 200.486C248.498 206.74 250.688 214.246 250.688 223.002C250.688 225.629 250.375 228.944 249.749 232.947C247.873 244.08 245.621 254.901 242.994 265.408C238.616 282.546 231.048 295.368 220.29 303.874C209.532 312.255 195.147 316.446 177.133 316.446ZM179.76 289.426C186.766 289.426 192.707 287.362 197.586 283.234C202.59 279.106 206.155 272.789 208.281 264.283C211.158 252.524 213.348 242.266 214.849 233.51C215.349 230.883 215.599 228.194 215.599 225.441C215.599 214.058 209.657 208.366 197.774 208.366C190.768 208.366 184.764 210.43 179.76 214.558C174.882 218.687 171.379 225.004 169.253 233.51C167.001 241.891 164.749 252.149 162.498 264.283C161.997 266.784 161.747 269.411 161.747 272.163C161.747 283.672 167.752 289.426 179.76 289.426Z",fill:"white"}),Jp("path",{d:"M259.303 314.57C257.927 314.57 256.863 314.132 256.113 313.256C255.487 312.255 255.3 311.13 255.55 309.879L281.444 187.914C281.694 186.538 282.382 185.412 283.508 184.536C284.634 183.661 285.822 183.223 287.073 183.223H336.985C350.87 183.223 362.003 186.1 370.384 191.854C378.891 197.609 383.144 205.927 383.144 216.81C383.144 219.937 382.769 223.19 382.018 226.567C378.891 240.953 372.574 251.586 363.067 258.466C353.685 265.346 340.8 268.786 324.413 268.786H299.082L290.451 309.879C290.2 311.255 289.512 312.38 288.387 313.256C287.261 314.132 286.072 314.57 284.822 314.57H259.303ZM325.727 242.892C330.98 242.892 335.546 241.453 339.424 238.576C343.427 235.699 346.054 231.571 347.305 226.192C347.68 224.065 347.868 222.189 347.868 220.563C347.868 216.935 346.805 214.183 344.678 212.307C342.551 210.305 338.924 209.305 333.795 209.305H311.278L304.148 242.892H325.727Z",fill:"white"})]});import{jsx as Qg,jsxs as R6}from"react/jsx-runtime";var Xg=e=>R6("svg",{width:"360",height:"360",viewBox:"0 0 360 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Qg("rect",{width:"360",height:"360",rx:"180",fill:"#6C00F6"}),Qg("path",{d:"M157.743 154.241L141.052 144.58L90.9766 173.561V231.519L141.052 260.5L191.13 231.519V141.359L218.948 125.26L246.77 141.359V173.561L218.948 189.66L202.257 180.002V205.759L218.948 215.42L269.024 186.439V128.481L218.948 99.5L168.873 128.481V218.641L141.052 234.74L113.233 218.641V186.439L141.052 170.34L157.743 179.998V154.241Z",fill:"white"})]});import{jsx as Bc,jsxs as Zg}from"react/jsx-runtime";var Jg=e=>Zg("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[Bc("rect",{width:"30",height:"30",fill:"url(#pattern0)"}),Zg("defs",{children:[Bc("pattern",{id:"pattern0",patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:Bc("use",{xlinkHref:"#image0_1_18",transform:"scale(0.00041841)"})}),Bc("image",{id:"image0_1_18",width:"2390",height:"2390",xlinkHref:"data:image/png;base64,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"})]})]});import{jsx as jg}from"react/jsx-runtime";var M6={[$r.id]:Dg,[ul.id]:Fg,[Nr.id]:Hg,[ml.id]:Vg,[Em.id]:zg,[Dr.id]:Kg,[go.id]:Yg,[Ur.id]:Xg,[Am.id]:Jg},Ei=({chainId:e,...t})=>{let r=M6[e];return r?jg(r,{...t}):jg(_6,{...t})};import{Fragment as L6,jsx as Ts,jsxs as $g}from"react/jsx-runtime";var t1=({balance:e,className:t,chain:r})=>Ts(Nm,{className:t,$state:void 0,children:Ts(Hc,{balance:e,chain:r})}),Hc=({balance:e,chain:t})=>$g(L6,{children:[$g(I6,{children:[Ts(W6,{chainId:t.id}),Ts(Kt,{children:t.name})]}),Ts(rr,{isLoading:!1,isPulsing:!1,color:"gray",children:e})]}),I6=e1.div`
1535
- display: flex;
1536
- align-items: center;
1537
- `,W6=e1(Ei)`
1538
- height: 1.25rem;
1539
- width: 1.25rem;
1540
- display: inline-block;
1541
- margin-right: 0.5rem;
1542
- border-radius: 4px;
1543
- `;import{Menu as Gc}from"@headlessui/react";import{ChevronDownIcon as O6}from"@heroicons/react/24/outline";import Ps from"styled-components";import{jsx as Ss,jsxs as r1}from"react/jsx-runtime";var o1=({options:e,onSelect:t,selected:r,className:o})=>r1(Gc,{as:N6,children:[r1(Gc.Button,{as:F6,children:[Ss(Hc,{balance:r.balance,chain:r.chain}),Ss(jp,{height:16})]}),Ss(Gc.Items,{as:D6,className:o,anchor:"bottom",children:e.map((n,a)=>Ss(Gc.Item,{as:U6,onClick:()=>t(a),children:Ss(Hc,{balance:n.balance,chain:n.chain})},a))})]}),N6=Ps.div`
1544
- width: 100%;
1545
- position: relative;
1546
- `,D6=Ps.div`
1547
- width: 100%;
1548
- margin-top: 0.5rem;
1549
- position: absolute;
1550
- background-color: var(--privy-color-background);
1551
- border-radius: var(--privy-border-radius-md);
1552
- overflow: hidden;
1553
- box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
1554
-
1555
- && {
1556
- border: solid 1px var(--privy-color-foreground-4);
1557
- }
1558
-
1559
- z-index: 1;
1560
- `,U6=Ps.button`
1561
- width: 100%;
1562
- display: flex;
1563
- justify-content: space-between;
1564
-
1565
- && {
1566
- padding: 1rem;
1567
- }
1568
-
1569
- :not(:last-child) {
1570
- border-bottom: solid 1px var(--privy-color-foreground-4);
1571
- }
1572
-
1573
- :hover {
1574
- background: var(--privy-color-background-2);
1575
- }
1576
- `,jp=Ps(O6)`
1577
- height: 1rem;
1578
- margin-left: 0.5rem;
1579
- `,F6=Ps.button`
1580
- ${Om}
1581
-
1582
- /* Push the chip all the way to the right */
1583
- span {
1584
- margin-left: auto;
1585
- }
1586
-
1587
- ${jp} {
1588
- transition: rotate 100ms ease-in;
1589
- }
1590
-
1591
- &[aria-expanded='true'] {
1592
- ${jp} {
1593
- rotate: -180deg;
1594
- }
1595
- }
1596
- `;import Xr,{keyframes as o7}from"styled-components";import B6 from"@heroicons/react/24/outline/ClockIcon";import H6 from"@heroicons/react/24/outline/TrashIcon";import G6 from"@heroicons/react/24/solid/CheckBadgeIcon";import V6 from"@heroicons/react/24/solid/CheckCircleIcon";import q6 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as z6,useState as As}from"react";import Qr,{css as l1}from"styled-components";import{jsx as n1}from"react/jsx-runtime";var fa=({style:e,...t})=>n1("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:n1("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Ke,jsxs as a1}from"react/jsx-runtime";var ha=({style:e,...t})=>a1("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[a1("g",{clipPath:"url(#clip0_113_33841)",children:[Ke("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),Ke("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),Ke("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),Ke("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),Ke("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),Ke("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),Ke("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),Ke("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),Ke("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),Ke("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),Ke("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),Ke("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),Ke("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),Ke("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),Ke("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),Ke("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),Ke("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),Ke("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),Ke("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),Ke("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),Ke("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),Ke("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),Ke("defs",{children:Ke("clipPath",{id:"clip0_113_33841",children:Ke("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as $p,jsx as ge,jsxs as ur}from"react/jsx-runtime";var i1=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,a]=As([]),i=t?e.length:2,l=d=>d.authenticatorName?d.createdWithBrowser?`${d.authenticatorName} on ${d.createdWithBrowser}`:d.authenticatorName:d.createdWithBrowser?d.createdWithOs?`${d.createdWithBrowser} on ${d.createdWithOs}`:`${d.createdWithBrowser}`:"Unknown device",c=async d=>{a(u=>u.concat([d])),await r(d),a(u=>u.filter(m=>m!==d))};return ur("div",{children:[ge(J6,{children:"Your passkeys"}),ur(d1,{children:[e.slice(0,i).map(d=>ur(e7,{children:[ur("div",{children:[ge(j6,{children:l(d)}),ur($6,{children:["Last used: ",(d.latestVerifiedAt??d.verifiedAt).toLocaleString()]})]}),ge(r7,{disabled:n.includes(d.credentialId),onClick:()=>c(d.credentialId),children:n.includes(d.credentialId)?ge(So,{}):ge(H6,{height:"1.6em"})})]},d.credentialId)),e.length>2&&!t&&ge(eu,{onClick:o,children:"View all"})]})]})},K6=()=>ur(d1,{children:[ur(lr,{children:[ge(sr,{children:ge(G6,{})}),"Log in with Touch ID, Face ID, or a security key."]}),ur(lr,{children:[ge(sr,{children:ge(q6,{})}),"More secure than a password."]}),ur(lr,{children:[ge(sr,{children:ge(B6,{})}),"Takes seconds to set up and use."]})]}),c1=()=>{let{user:e,unlinkPasskey:t}=q(),{linkWithPasskey:r,closePrivyModal:o}=_(),n=e?.linkedAccounts.filter(v=>v.type==="passkey"),[a,i]=As(!1),[l,c]=As(""),[d,u]=As(!1),[m,h]=As(!1);z6(()=>{n.length===0&&h(!1)},[n.length]);let g=()=>{i(!0),r().then(()=>u(!0)).catch(v=>{if(v instanceof tr){if(v.privyErrorCode==="cannot_link_more_of_type"){c("Cannot link more passkeys to account.");return}else if(v.privyErrorCode==="passkey_not_allowed"){c("Passkey request timed out or rejected by user.");return}}c("Unknown error occurred.")}).finally(()=>{i(!1)})},w=async v=>(i(!0),await t(v).then(()=>u(!0)).catch(E=>{if(E instanceof tr&&E.privyErrorCode==="missing_or_invalid_mfa"){c("Cannot unlink a passkey enrolled in MFA");return}c("Unknown error occurred.")}).finally(()=>{i(!1)}));return d?ur($p,{children:[ge(k,{onClose:()=>o()},"header"),ge(Ue,{children:ge(tt,{status:"success",children:ge(V6,{})})}),ge(s1,{children:"Passkey added"}),ge(X6,{children:"From now on, you can use your passkey to log in."}),ge(Wt,{children:ge(U,{onClick:()=>o(),children:"Done"})}),ge(j,{})]}):m?ur($p,{children:[ge(k,{backFn:()=>h(!1),onClose:()=>o()},"header"),ge(i1,{passkeys:n,expanded:m,onUnlink:w,onExpand:()=>h(!0)}),ge(j,{})]}):ur($p,{children:[ge(k,{onClose:()=>o()},"header"),ge(Ue,{children:ur(Vc,{children:[ge(fa,{}),ge(ha,{})]})}),ge(s1,{children:"Secure your account with a passkey"}),ge(Z6,{}),n.length===0?ge(K6,{}):ge(i1,{passkeys:n,expanded:m,onUnlink:w,onExpand:()=>h(!0)}),ur(Wt,{style:{marginTop:"12px"},children:[l&&ge(Y6,{fail:!0,children:l}),ge(U,{onClick:g,loading:a,children:"Add new passkey"})]}),ge(j,{})]})},Vc=Qr.div`
1597
- display: flex;
1598
- align-items: center;
1599
- justify-content: center;
1600
- width: 180px;
1601
- height: 90px;
1602
- border-radius: 50%;
1603
- svg + svg {
1604
- margin-left: 12px;
1605
- }
1606
- > svg {
1607
- z-index: 2;
1608
- color: var(--privy-color-accent) !important;
1609
- stroke: var(--privy-color-accent) !important;
1610
- fill: var(--privy-color-accent) !important;
1611
- }
1612
- `,Y6=Qr.div`
1613
- line-height: 20px;
1614
- height: 20px;
1615
- font-size: 13px;
1616
- color: ${e=>e.success?"var(--privy-color-success)":e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1617
- display: flex;
1618
- justify-content: flex-beginngin;
1619
- width: 100%;
1620
- `,Q6=l1`
1621
- && {
1622
- width: 100%;
1623
- font-size: 0.875rem;
1624
- line-height: 1rem;
1625
-
1626
- /* Tablet and Up */
1627
- @media (min-width: 440px) {
1628
- font-size: 14px;
1629
- }
1630
-
1631
- display: flex;
1632
- gap: 12px;
1633
- justify-content: center;
1634
-
1635
- padding: 6px 8px;
1636
- background-color: var(--privy-color-background);
1637
- transition: background-color 200ms ease;
1638
- color: var(--privy-color-accent) !important;
1639
-
1640
- :focus {
1641
- outline: none;
1642
- box-shadow: none;
1643
- }
1644
- }
1645
- `,eu=Qr.button`
1646
- ${Q6}
1647
- `,d1=Qr.div`
1648
- display: flex;
1649
- flex-direction: column;
1650
- align-items: stretch;
1651
- gap: 0.8rem;
1652
- padding: 0.5rem 0rem 0rem;
1653
- flex-grow: 1;
1654
- width: 100%;
1655
- `,s1=Qr.div`
1656
- font-size: 18px;
1657
- line-height: 18px;
1658
- text-align: center;
1659
- font-weight: 600;
1660
- `,X6=Qr.div`
1661
- font-size: 0.875rem;
1662
- text-align: center;
1663
- margin-top: 10px;
1664
- `,Z6=Qr.div`
1665
- height: 32px;
1666
- `,J6=Qr.div`
1667
- line-height: 20px;
1668
- height: 20px;
1669
- font-size: 1em;
1670
- font-weight: 450;
1671
- display: flex;
1672
- justify-content: flex-beginning;
1673
- width: 100%;
1674
- `,j6=Qr.div`
1675
- font-size: 1em;
1676
- line-height: 1.3em;
1677
- font-weight: 500;
1678
- color: var(--privy-color-foreground-2);
1679
- padding: 0.2em 0;
1680
- `,$6=Qr.div`
1681
- font-size: 0.875rem;
1682
- line-height: 1rem;
1683
- color: #64668b;
1684
- padding: 0.2em 0;
1685
- `,e7=Qr.div`
1686
- display: flex;
1687
- align-items: center;
1688
- justify-content: space-between;
1689
- padding: 1em;
1690
- gap: 10px;
1691
- font-size: 0.875rem;
1692
- line-height: 1rem;
1693
- text-align: left;
1694
- border-radius: 8px;
1695
- border: 1px solid #e2e3f0 !important;
1696
- width: 100%;
1697
- height: 5em;
1698
- `,t7=l1`
1699
- :focus,
1700
- :hover,
1701
- :active {
1702
- outline: none;
1703
- }
1704
- display: flex;
1705
- width: 2em;
1706
- height: 2em;
1707
- justify-content: center;
1708
- align-items: center;
1709
- svg {
1710
- color: var(--privy-color-error);
1711
- }
1712
- svg:hover {
1713
- color: var(--privy-color-foreground-3);
1714
- }
1715
- `,r7=Qr.button`
1716
- ${t7}
1717
- `;var p1=Xr.div`
1718
- display: flex;
1719
- flex-direction: column;
1720
- gap: 12px;
1721
- padding-top: 24px;
1722
- padding-bottom: 24px;
1723
- `,qc=Xr.div`
1724
- width: 24px;
1725
- height: 24px;
1726
- display: flex;
1727
- justify-content: center;
1728
- align-items: center;
1729
-
1730
- svg {
1731
- border-radius: var(--privy-border-radius-sm);
1732
- }
1733
- `,Ti=Xr.div`
1734
- display: flex;
1735
- flex-direction: column;
1736
- justify-content: center;
1737
- align-items: center;
1738
- gap: 8px;
1739
- `,Si=Xr.div`
1740
- display: flex;
1741
- align-items: baseline;
1742
- gap: 4px;
1743
- `,zc=Xr.div`
1744
- font-size: 42px !important;
1745
- `,u1=Xr.input`
1746
- font-size: 42px !important;
1747
- text-align: right;
1748
- background-color: var(--privy-color-background);
1749
-
1750
- // HACK: The only way this is centerable is to set a content-based width.
1751
- // The --funding-input-length is updated via the component.
1752
- // Note that 'ch' has 98.25% global browser adoption
1753
- width: calc(1ch * var(--funding-input-length));
1754
-
1755
- &:focus {
1756
- outline: none !important;
1757
- border: none !important;
1758
- box-shadow: none !important;
1759
- }
1760
- `,m1=Xr.div`
1761
- cursor: pointer;
1762
- padding-left: 4px;
1763
- `,Pi=Xr.div`
1764
- font-size: 18px;
1765
- `,Ai=Xr.div`
1766
- font-size: 12px;
1767
- color: var(--privy-color-foreground-3);
1768
- // we need this container to maintain a static height if there's no content
1769
- height: 20px;
1770
- `,f1=Xr.div`
1771
- display: flex;
1772
- flex-direction: row;
1773
- line-height: 22px;
1774
- font-size: 16px;
1775
- text-align: center;
1776
- svg {
1777
- margin-right: 6px;
1778
- margin: auto;
1779
- }
1780
- `,h1=Xr(eu)`
1781
- margin-top: 16px;
1782
- `,n7=o7`
1783
- from {
1784
- opacity: 0;
1785
- }
1786
- to {
1787
- opacity: 1;
1788
- }
1789
- `,y1=Xr(dn)`
1790
- border-radius: var(--privy-border-radius-md) !important;
1791
- animation: ${n7} 0.3s ease-in-out;
1792
- `;import{Fragment as a7,jsx as Qt,jsxs as xs}from"react/jsx-runtime";var g1=({displayName:e,errorMessage:t,configuredFundingChain:r,formattedBalance:o,fundingAmount:n,fundingCurrency:a,fundingAmountInUsd:i,options:l,selectedOption:c,isPreparing:d,isSubmitting:u,onSubmit:m,onSelect:h})=>xs(a7,{children:[Qt(Nt,{}),Qt(oe,{}),Qt(so,{children:"Transfer from another network"}),xs(qr,{children:["You need more funds on the ",r.name," network. Bridge from another blockchain network."]}),xs(Ti,{style:{marginTop:"2rem"},children:[xs(Si,{children:[Qt(zc,{children:n}),Qt(Pi,{children:a})]}),i&&Qt(Ai,{children:i})]}),Qt(Dt,{style:{marginTop:"1.5rem"},children:Qt(Ut,{children:"From"})}),Qt(o1,{selected:{chain:c.chain,balance:Tt(c.balance,c.chain.nativeCurrency.symbol,3,!0)},options:l.map(({chain:g,balance:w})=>({chain:g,balance:Tt(w,g.nativeCurrency.symbol,3,!0)})),onSelect:h}),Qt(Dt,{children:Qt(Ut,{style:{marginTop:"1.5rem"},children:"To"})}),Qt(t1,{chain:r,balance:o}),Qt(qi,{style:{marginTop:"1rem"},children:t}),xs(ta,{style:{marginTop:"1rem"},loading:u||d,disabled:d||u,onClick:m,children:["Confirm with ",e]}),Qt(ae,{}),Qt(B,{})]});import i7 from"styled-components";import{Fragment as l7,jsx as At,jsxs as ya}from"react/jsx-runtime";var C1=({wallet:e,displayName:t,addressToFund:r,chain:o,isBridging:n,isErc20Flow:a,totalPriceInNativeCurrency:i,totalPriceInUsd:l,gasPriceInNativeCurrency:c,gasPriceInUsd:d})=>ya(l7,{children:[At(Nt,{}),At(wi,{}),At(Pt,{style:{marginTop:"16px"},children:At(pc,{icon:mc(e.walletClientType,e.connectorType,e.walletClientType),name:e.walletClientType})}),At(ye,{style:{marginTop:"8px",marginBottom:"12px"},title:`${n?"Bridging":"Confirming"} with ${t}`}),!n&&!a&&ya(Uc,{children:[ya(Dt,{children:[At(Ut,{children:"Total"}),At(Kt,{children:l||i})]}),ya(Dt,{children:[At(Ut,{children:"To"}),At(Kt,{children:At(Bo,{address:r,showCopyIcon:!1})})]}),ya(Dt,{children:[At(Ut,{children:"Network"}),At(Kt,{children:ya(s7,{children:[At(Ei,{chainId:o.id,height:16,width:16})," ",o.name]})})]}),c&&ya(Dt,{children:[At(Ut,{children:"Estimated fee"}),At(Kt,{children:d||c})]})]}),At(oi,{height:24}),At(B,{})]}),s7=i7.div`
1793
- display: flex;
1794
- flex-direction: row;
1795
- align-items: center;
1796
- gap: 4px;
1797
- `;import{Fragment as b1,jsx as Zr,jsxs as tu}from"react/jsx-runtime";var E1=()=>{let{rpcConfig:e,appId:t,closePrivyModal:r,createAnalyticsEvent:o}=_(),{navigate:n,setModalData:a,app:i,data:l}=x(),{wallets:c}=Ho(),[d,u]=Xt(!1),[m,h]=Xt(0n),[g,w]=Xt(!1),[v,E]=Xt(null),[R,A]=Xt(null),[T,P]=Xt([]),[S,M]=Xt(0),[N,H]=Xt(!1),[F,K]=Xt(!1),[W,X]=Xt(!1),[L,Y]=Xt(!1),{erc20ContractInfo:ke,erc20Address:be,address:te,chain:Q,amount:Re}=l.funding;En(()=>{be&&!ke&&E(new Error("Unable to fetch token details"))},[]);let he=!!be&&!!ke,re=he?BigInt(parseFloat(Re)*10**ke.decimals):m7(Re),se=c[0],[Xe,$e]=Xt(null);En(()=>{(async()=>{if(!se)return;let wt=await se.getEthereumProvider(),Gt=d7({account:se.address,transport:p7(wt)}).extend(f7);$e(Gt)})().catch(console.error)},[se]);let[ce,ht]=Xt(0n);En(()=>{v1({chain:Q,transport:w1(Uo(Q,e,t))}).getBalance({address:te}).then(ht).catch(console.error)},[]);let[Mr,kt]=Xt(0n);En(()=>{he&&Og({chain:Q,address:te,appId:t,rpcConfig:e,erc20Address:be}).then(Pe=>kt(Pe.balance)).catch(console.error)},[]);let{tokenPrice:it}=Io({chainId:Q.id}),[Se,I]=Xt({to:te,chain:Q,value:re,data:void 0});En(()=>{(async()=>{if(!Xe||!se||N||W)return;H(!0);let wt,Gt=v1({chain:Se.chain,transport:w1(Uo(Se.chain,e,t))});if(he&&!Se.data){if(!await Gt.simulateContract({address:be,chain:Se.chain,abi:bs,functionName:"transfer",args:[te,re],account:se.address}).catch(We=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",We)})){H(!1),w(!0);return}H(!1),I({to:be,chain:Se.chain,data:u7({abi:bs,functionName:"transfer",args:[te,re]}),value:"0x0"});return}try{wt=await Gt.prepareTransactionRequest({account:se.address,to:Se.to,chain:Se.chain,data:Se.data,value:BigInt(Se.value??0)})}catch(jt){console.error(jt),T.length>1&&A(jt.shortMessage??"Something went wrong")}if(!wt){H(!1),w(!0);return}H(!1),X(!0),u(!0),h(wt.gas);try{await Xe.switchChain({id:Se.chain.id})}catch{await Xe.addChain({chain:Se.chain}),await Xe.switchChain({id:Se.chain.id})}let hr;try{hr=await Xe.sendTransaction(wt),o({eventName:Xo,payload:{provider:"external",status:"success",address:se.address,chainId:Se.chain.id,value:Se.value?.toString(),txHash:hr}})}catch(jt){console.error(jt);let We=jt;We.name==="TransactionExecutionError"&&(T.length<1?E(new C(We.shortMessage,void 0,"transaction_failure")):A(jt.shortMessage??"Something went wrong"))}if(!hr){X(!1);return}await Xe.waitForTransactionReceipt({hash:hr}),X(!1),Y(!0)})().catch(console.error)},[Xe,Se]),En(()=>{(async()=>{if(!g||!Xe||!se)return;let Gt=hl(i.chains).filter(Ze=>Ze.id!==l.funding.chain.id&&!!Ze.testnet==!!l.funding.chain.testnet);he&&Gt.unshift(l.funding.chain);let hr=await Lg({chains:Gt,address:se.address,appId:t,rpcConfig:e}),jt=he?hr.filter(Ze=>Ze.balance>0n):hr.filter(Ze=>Ze.balance>re);if(jt.length<1){E(new C(`Wallet ${jr(se.address)} does not have enough funds.`,void 0,"insufficient_balance"));return}jt.sort((Ze,zd)=>Number(zd.balance-Ze.balance));let We=(await Promise.allSettled(jt.map(async Ze=>({quote:await Ig({isTestnet:!!l.funding?.chain.testnet,input:Mg({amount:re.toString(),user:se.address,recipient:te,destinationChainId:Q.id,destinationCurrency:be,originChainId:Ze.chain.id})}),...Ze})))).filter(Ze=>Ze.status==="fulfilled").map(Ze=>Ze.value);if(We.length<1){E(new C(`Wallet ${jr(se.address)} does not have enough funds.`,void 0,"insufficient_balance"));return}let Fn=We.map(Ze=>({bridgeTx:Wg(Ze.quote),balance:Ze.balance,chain:Ze.chain})).filter(Ze=>!!Ze.bridgeTx);if(Fn.length>1){P(Fn);return}let tn=Fn[0];if(!tn){E(new C(`Wallet ${jr(se.address)} does not have enough funds.`,void 0,"insufficient_balance"));return}K(!0),I({data:tn.bridgeTx.data,to:tn.bridgeTx.to,value:tn.bridgeTx.value,chain:tn.chain})})().catch(console.error)},[g]),En(()=>{if(!v)return;let Pe={error:v,previousScreen:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};a({funding:l?.funding,sendTransaction:l?.sendTransaction,errorModalData:Pe}),n("ERROR_SCREEN",!1)},[v]);let ie=se?mn(se.walletClientType,se.connectorType,se.walletClientType)||"wallet":null,en=!he&&it?Ua(l?.funding?.amount??"0",it):void 0,G=he?m:zi([m,re]),J=G&&it?Co(G,it):void 0,Rt=G?Tt(G,"ETH"):void 0,Ce=m&&it?Co(m,it):void 0,ut=m?Tt(m,"ETH"):void 0;if(En(()=>{if(!L)return;let Pe=setTimeout(r,um);return()=>clearTimeout(Pe)},[L]),L)return tu(b1,{children:[Zr(Nt,{}),Zr(oe,{}),tu(wr,{children:[Zr(c7,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),Zr(ye,{title:"Success!",description:`You\u2019ve successfully added ${Re} ${he?ke.symbol:Q.nativeCurrency.symbol} to your ${i.name} wallet. It may take a minute before the funds are available to use.`})]}),Zr(ae,{}),Zr(B,{})]});let Di=he?`${Dc({amount:Mr,decimals:ke.decimals})} ${ke.symbol}`:Tt(ce,Q.nativeCurrency.symbol,3,!0),Do=T[S];return T.length>1&&Do?Zr(g1,{displayName:ie,configuredFundingChain:Q,formattedBalance:Di,fundingAmount:Re,fundingCurrency:he?ke.symbol:Q.nativeCurrency.symbol,fundingAmountInUsd:en,options:T,selectedOption:Do,isPreparing:N,isSubmitting:W,errorMessage:R,onSubmit:()=>{I({to:Do.bridgeTx.to,data:Do.bridgeTx.data,value:Do.bridgeTx.value,chain:Do.chain})},onSelect:Pe=>{Pe!==S&&(A(null),M(Pe))}}):d&&m&&se&&l?.funding?Zr(C1,{wallet:se,displayName:ie,addressToFund:te,isBridging:F,isErc20Flow:he,totalPriceInUsd:J,totalPriceInNativeCurrency:Rt,gasPriceInUsd:Ce,gasPriceInNativeCurrency:ut,chain:l.funding.chain}):tu(b1,{children:[Zr(Nt,{}),Zr(wi,{}),Zr("div",{style:{marginTop:"1rem"}}),Zr(B,{})]})};import w7 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import b7 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as E7,useMemo as T7,useState as k1}from"react";import R1 from"styled-components";var Kc=class{constructor({authorizationCode:t,stateCode:r,codeVerifier:o,provider:n}){this.meta={authorizationCode:t,stateCode:r,codeVerifier:o,provider:n}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(bl,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(t){throw ne(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(El,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(t){throw ne(t)}}};async function Yc({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(a=>a.provider_app_id===r);if(!n)throw new C("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}async function T1({api:e,appId:t}){let r=Qn(),o=Ha(),n=await Ga(r);try{let{url:a}=await e.post(wl,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:o});return{url:a,stateCode:o,codeVerifier:r}}catch(a){throw ne(a)}}async function S1({appId:e,stateCode:t,codeVerifier:r,authorizationCode:o,action:n,client:a}){if(!o||!t)throw new C("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(o==="undefined")throw new C("User denied confirmation during cross-app auth flow");try{let i=new Kc({authorizationCode:o,stateCode:t,codeVerifier:r,provider:`privy:${e}`});a.startAuthFlow(i);let c=(n==="link"?await a.link():await a.authenticate()).oAuthTokens?.accessToken;return console.debug(),c}catch(i){let l=ne(i);throw l.privyErrorCode?new C(l.message||"Invalid code during cross-app auth flow.",void 0,l.privyErrorCode):l.message==="User denied confirmation during cross-app auth flow"?new C("Invalid code during cross-app auth flow.",void 0,"oauth_user_denied"):new C("Invalid code during cross-app auth flow.",void 0,"unknown_auth_error")}}var Qc=async({user:e,address:t,client:r,request:o,requesterAppId:n,reconnect:a})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:o.method}});let i=e?.linkedAccounts.find(h=>!!(h.type==="cross_app"&&h.embeddedWallets.find(g=>g.address===t)));if(!e||!i)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new C("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(i.providerApp.id),c=await Yc({api:r.api,requesterAppId:n,providerAppId:i.providerApp.id});if(!l){if(c.readOnly)throw console.error("cannot transact against a read-only provider app"),new C("Cannot transact against a read-only provider app");await a({appId:i.providerApp.id,action:"link"})&&(l=r.getProviderAccessToken(i.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new C("Transactions require a valid token");let d=window.open(void 0,void 0,ks({w:400,h:680}));if(!d)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new C("Failed to initialize signature request");let u=new URL(`${c.apiUrl}/oauth/transact`);return u.searchParams.set("token",l||""),u.searchParams.set("request",h7(o)),d.location=u.href,new Promise((h,g)=>{let v=setTimeout(()=>{A(),g(new C("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),E=setInterval(()=>{d.closed&&(A(),g(new C("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),R=T=>{T.data&&(T.data.token?.action==="set"&&T.data.token?.value!==void 0?r.storeProviderAccessToken(i.providerApp.id,T.data.token.value):T.data.token?.action==="clear"&&r.storeProviderAccessToken(i.providerApp.id,null),T.data.type==="PRIVY_CROSS_APP_ACTION_RESPONSE"&&T.data.result&&(A(),h(T.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:o.method}})),T.data.type==="PRIVY_CROSS_APP_ACTION_ERROR"&&T.data.error&&(A(),g(T.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:T.data.error,address:t}})))};window.addEventListener("message",R);let A=()=>{d.close(),clearInterval(E),clearTimeout(v),window.removeEventListener("message",R)}})},h7=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin}),ks=({w:e,h:t})=>{let r=window.screenLeft!==void 0?window.screenLeft:window.screenX,o=window.screenTop!==void 0?window.screenTop:window.screenY,n=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,i=n/window.screen.availWidth,l=a/window.screen.availHeight,c=(n-e)/2/i+r,d=(a-t)/2/l+o;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${c},top=${d}`};var y7=new Set([Dr.id,Nr.id,go.id,Ur.id,$r.id]),g7=new Set([Dr.id,Nr.id,Ur.id,go.id]),C7={[Dr.id]:"ethereum",[Nr.id]:"base",[go.id]:"optimism",[Ur.id]:"polygon",[$r.id]:"arbitrum"},P1=(e,t)=>{switch(t){case"native-currency":return y7.has(e);case"USDC":return g7.has(e);default:return console.warn("Unknown asset passed to Coinbase Onramp"),!1}};function A1(e){let t=C7[e];if(!t)throw new C(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}function v7(e){return e.startsWith(".")?`0${e}`:e}var x1=({input:e,amount:t,blockchain:r})=>{let o=new URL("https://pay.coinbase.com/buy/select-asset");return o.searchParams.set("appId",e.app_id),o.searchParams.set("sessionToken",e.session_token),o.searchParams.set("defaultExperience","buy"),o.searchParams.set("presetCryptoAmount",v7(t)),o.searchParams.set("defaultNetwork",r),o.searchParams.set("partnerUserId",e.partner_user_id),{url:o}};import{Fragment as I1,jsx as Pr,jsxs as Rs}from"react/jsx-runtime";var S7=240,_1=1500,P7=Math.floor(S7*1e3/_1),M1=()=>{let{data:e,setModalData:t,navigate:r}=x(),{closePrivyModal:o,createAnalyticsEvent:n,initCoinbaseOnRamp:a,getCoinbaseOnRampStatus:i}=_(),l=e?.funding,c=l.isUSDC?"USDC":"ETH",[d,u]=k1(!1),[m,h]=k1(!1);return E7(()=>{if(d)return;u(!0);let g=async()=>{try{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:l.amount,chainId:l.chain.id}});let v=window.open(void 0,void 0,ks({w:440,h:680})),E=A1(l.chain.id),R=await a({addresses:[{address:l.address,blockchains:[E]}],assets:[c]}),{url:A}=x1({input:R,amount:l.amount,blockchain:E});if(!v)throw new Error("Unable to initiate Coinbase Onramp flow.");v.location=A.toString();let T=0,P=!1;for(;T<P7;){T++;let{status:S}=await i({partnerUserId:R.partner_user_id});if(S==="success"){P=!0;break}if(S==="failure")throw new Error("There was an error completing Coinbase Onramp flow.");if(v.closed)throw new Error("User exited Coinbase Onramp flow before transaction response.");await new Promise(M=>setTimeout(M,_1))}if(!P)throw new Error("Timed out waiting for transaction response from Coinbase Onramp.");h(!0)}catch(v){console.error(v),n({eventName:Xo,payload:{status:"failure",provider:"coinbase-onramp",error:v.message}}),t({funding:{...l,errorMessage:"Something went wrong adding funds from Coinbase Onramp. Please try again or use another method to fund your wallet."}}),r("FUNDING_METHOD_SELECTION_SCREEN")}finally{u(!1)}},w=setTimeout(()=>void g(),500);return()=>clearTimeout(w)},[]),Rs(I1,{children:[Pr(k,{title:"Fund account"},"header"),Pr(x7,{isSucccess:m,onClickCta:o}),Pr(B,{})]})},A7=e=>e?{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"}:{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""},x7=({isSucccess:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=T7(()=>A7(e),[e]);return Rs(I1,{children:[Rs(I7,{children:[Pr(_7,{isSucccess:e}),Rs(je,{children:[Pr("h3",{children:r}),Pr(M7,{children:o})]})]}),n&&Pr(U,{onClick:t,children:n})]})},k7=e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)",R7=e=>e?b7:()=>Pr(w7,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}),_7=({isSucccess:e})=>{if(!e){let o="var(--privy-color-foreground-4)";return Rs("div",{style:{position:"relative"},children:[Pr(lt,{color:o,style:{position:"absolute"}}),Pr(os,{color:o}),Pr(Vo,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let t=R7(e),r=k7(e);return Pr("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Pr(t,{width:"4rem",height:"4rem",color:r})})},M7=R1.p`
1798
- font-size: 1rem;
1799
- color: var(--privy-color-foreground-3);
1800
- margin-bottom: 1rem;
1801
- display: flex;
1802
- flex-direction: column;
1803
- gap: 1rem;
1804
- `,I7=R1.div`
1805
- display: flex;
1806
- flex-direction: column;
1807
- align-items: center;
1808
- justify-content: center;
1809
- margin-left: 1.75rem;
1810
- margin-right: 1.75rem;
1811
- padding: 2rem 0;
1812
- `;import{getAddress as H1}from"@ethersproject/address";import Q7 from"@heroicons/react/24/outline/PencilIcon";import X7 from"@heroicons/react/24/outline/WalletIcon";import{useEffect as G1,useRef as Z7,useState as J7}from"react";import{ExclamationTriangleIcon as W7}from"@heroicons/react/24/outline";import L7 from"styled-components";import{jsx as N7,jsxs as D7}from"react/jsx-runtime";var W1=({children:e})=>D7(O7,{children:[N7(W7,{width:"3rem",color:"var(--privy-color-error)"}),e]}),O7=L7.div`
1813
- display: flex;
1814
- gap: 0.5rem;
1815
- background-color: var(--privy-color-error-light);
1816
-
1817
- align-items: flex-start;
1818
- text-align: left;
1819
- padding: 0.5rem 0.75rem;
1820
-
1821
- font-size: 0.75rem;
1822
- font-weight: 400;
1823
- line-height: 1.125rem; /* 150% */
1824
-
1825
- padding: 0.5rem 0.75rem;
1826
-
1827
- && {
1828
- border: 1px solid var(--privy-color-error);
1829
- border-radius: var(--privy-border-radius-sm);
1830
- }
1831
- `;import{createPublicClient as U7,http as F7}from"viem";var Xc=async({address:e,chain:t,rpcConfig:r,privyAppId:o})=>{try{let n=U7({chain:t,transport:F7(Uo(t,r,o))}),[a,i]=await Promise.all([n.readContract({abi:L1,address:e,functionName:"symbol"}),n.readContract({abi:L1,address:e,functionName:"decimals"})]);return{decimals:i,symbol:a}}catch(n){return console.log(n),null}},L1=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];import{ofetch as B7}from"ofetch";import{useEffect as H7,useRef as G7,useState as V7}from"react";var Zc="moonpay",q7=new Set([Dr.id,$r.id,Nr.id,Ur.id]),z7=new Set([Dr.id,$r.id,go.id,Nr.id,Ur.id]);function O1(e,t){switch(e){case $r.id:return t==="native-currency"?"ETH_ARBITRUM":"USDC_ARBITRUM";case 43114:return"AVAX_CCHAIN";case Nr.id:return t==="native-currency"?"ETH_BASE":"USDC_BASE";case ml.id:return"CELO_CELO";case Ur.id:return t==="native-currency"?"MATIC_POLYGON":"USDC_POLYGON";case Dr.id:return t==="native-currency"?"ETH_ETHEREUM":"USDC_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}function N1(e){return parseFloat(e)}function D1(e){return!!e&&e.config!==void 0&&e.provider!==void 0}function Jc(e){return!!e&&(e.chain!==void 0||e.amount!==void 0)}async function U1(e,t,r,o,n=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},i=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...a,...i}})}async function K7(e,t){let r=t?hm:fm,o=t?gm:ym;return B7(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function F1(e,t=!1){let[r,o]=V7(null),{createAnalyticsEvent:n}=_(),{data:a,navigate:i,setModalData:l}=x(),c=a?.funding,d=G7(0);return H7(()=>{let u=setInterval(async()=>{if(e)try{let[m]=await K7(e,t),h=m.status==="waitingAuthorization"&&m.paymentMethod==="credit_debit_card"?"pending":m.status;if(["failed","completed","awaitingAuthorization"].includes(h)&&(n({eventName:Xo,payload:{status:h,provider:Zc,paymentMethod:m.paymentMethod,cardPaymentType:m.cardPaymentType,currency:m.currency?.code,baseCurrencyAmount:m.baseCurrencyAmount,quoteCurrencyAmount:m.quoteCurrencyAmount,feeAmount:m.feeAmount,extraFeeAmount:m.extraFeeAmount,networkFeeAmount:m.networkFeeAmount,isSandbox:t}}),clearInterval(u)),h==="failed"||h==="serviceFailure"){l({funding:{...c,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),i("FUNDING_METHOD_SELECTION_SCREEN");return}o(h)}catch(m){m.response?.status!==404&&(d.current+=1),d.current>=3&&(n({eventName:Xo,payload:{status:"serviceFailure",provider:Zc}}),clearInterval(u),l({funding:{...c,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),i("FUNDING_METHOD_SELECTION_SCREEN"))}},3e3);return()=>clearInterval(u)},[e,d]),r}var B1=(e,t)=>{switch(t){case"native-currency":return q7.has(e);case"USDC":return z7.has(e);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}};import{jsx as ru,jsxs as Y7}from"react/jsx-runtime";var xi=({size:e=61,...t})=>ru("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:Y7("g",{id:"moonpay_symbol_wht 2",children:[ru("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),ru("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as V1,jsx as Ct,jsxs as Tn}from"react/jsx-runtime";var q1=()=>{let{wallets:e}=Ho(),{navigate:t,data:r,setModalData:o}=x(),n=Be(),a=r?.funding,i=Z7(null),[l,c]=J7(!1);G1(()=>{i.current&&i.current.style.setProperty("--funding-input-length",Math.max(a.amount.length,1).toString())},[a.amount,i.current]);let d=n.fundingConfig?.methods.slice()??[],{tokenPrice:u}=Io({chainId:a.chain.id});G1(()=>{a.erc20Address&&a.chain&&!a.erc20ContractInfo&&Xc({address:a.erc20Address,chain:a.chain,rpcConfig:n.rpcConfig,privyAppId:n.id}).then(S=>o({...r,funding:{...r.funding,erc20ContractInfo:S?{symbol:S.symbol,decimals:S.decimals}:void 0}})).catch(console.error)},[a.erc20Address,a.chain]);let m=u?Ua(a.amount,u):void 0,h=e.find(S=>H1(S.address)===H1(a.address)),g=h&&h.walletClientType!=="privy"?mn(h.walletClientType,h.connectorType,h.walletClientType):n.name,w=parseFloat(a.amount),v=!isNaN(w)&&w>0,E=!!(a.erc20Address&&!a.erc20ContractInfo),R=a.isUSDC?"USDC":a.erc20Address?void 0:"native-currency",A=R&&B1(Number(a.chain.id),R),T=R&&P1(Number(a.chain.id),R),P=a.erc20Address||!a.erc20Address&&!a.isUSDC;return Tn(V1,{children:[Ct(Nt,{}),Tn("h3",{children:["Add funds to your"," ",g?.toLowerCase().endsWith("wallet")?g:g+" wallet"]}),Ct(un,{style:{marginTop:"32px"},children:Ct(Ti,{children:E?Ct(wi,{size:"50px"}):Tn(V1,{children:[Tn(Si,{onClick:()=>i.current?.focus(),children:[Ct(u1,{ref:i,value:a.amount,onFocus:()=>c(!0),onBlur:()=>c(!1),onChange:S=>{let M=S.target.value;/^[0-9.]*$/.test(M)&&M.split(".").length-1<=1&&o({...r,funding:{...a,amount:M}})}}),Ct(Pi,{children:a.erc20Address?a.erc20ContractInfo?.symbol:a.chain.nativeCurrency.symbol}),!l&&Ct(m1,{children:Ct(Q7,{width:12,height:12})})]}),!a.erc20Address&&Ct(Ai,{children:m&&v?m:""})]})})}),Tn(p1,{children:[a.errorMessage&&Ct(W1,{children:a.errorMessage}),d.sort().map(S=>{switch(S){case"moonpay":return A?Tn(Te,{disabled:!v||E,onClick:()=>{t("MOONPAY_PROMPT_SCREEN")},children:[Ct(qc,{children:Ct(xi,{style:{width:24}})}),"Moonpay"]},S):null;case"coinbase-onramp":return T?Tn(Te,{disabled:!v||E,onClick:()=>{t("COINBASE_ONRAMP_STATUS_SCREEN")},children:[Ct(qc,{children:Ct(Vo,{style:{width:24}})}),"Coinbase Onramp"]},S):null;case"external":return P?Tn(Te,{disabled:!v||E,onClick:()=>{t("FUNDING_TRANSFER_FROM_WALLET_SCREEN")},children:[Ct(qc,{children:Ct(X7,{style:{width:24}})}),"Transfer from wallet"]},S):null}}),Ct(h1,{disabled:!v,onClick:()=>t("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),Ct(B,{})]})};import{formatUnits as j7}from"@ethersproject/units";import $7 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import eb from"@heroicons/react/24/outline/InformationCircleIcon";import tb from"@heroicons/react/24/outline/QrCodeIcon";import{useEffect as rb,useMemo as ob,useState as ou}from"react";import ki from"styled-components";import{Fragment as jc,jsx as Ye,jsxs as Ft}from"react/jsx-runtime";var nb=2e3,z1=()=>{let{wallets:e}=Ho(),{app:t,data:r,setModalData:o,navigate:n,lastScreen:a}=x(),{chains:i,rpcConfig:l,appId:c,closePrivyModal:d,createAnalyticsEvent:u}=_(),[m,h]=ou("default"),[g,w]=ou(void 0),v=r?.funding,{tokenPrice:E}=Io({chainId:v.chain.id}),R=E?Ua(v.amount,E):void 0,A=e.find(M=>jr(M.address)===jr(v.address)),T=A&&A.walletClientType!=="privy"?mn(A.walletClientType,A.connectorType,A.walletClientType):t.name;if(!v)return o({errorModalData:{error:new Error("Couldn't find funding config"),previousScreen:a||"FUNDING_METHOD_SELECTION_SCREEN"},funding:r?.funding,sendTransaction:r?.sendTransaction}),n("ERROR_SCREEN"),Ye(jc,{});rb(()=>{let M=Or(v.chain.id,i,l,{appId:c});function N(){M.getBalance(v.address).then(F=>{let K=parseFloat(j7(F,"ether"));w(W=>(W&&K>W&&u({eventName:Xo,payload:{provider:"manual",status:"success",address:A?.address,value:(K-W).toString()}}),K))}).catch(()=>w(void 0))}let H=setInterval(N,nb);return N(),()=>clearInterval(H)},[]);let P=ob(()=>g!==void 0?g>=parseFloat(v.amount):!1,[g,v.amount]),S=Ft(jc,{children:[Ye(Da,{title:"Your wallet",errMsg:void 0,isLoading:!v||g===void 0,isPulsing:!P,balance:`${g!==void 0?g.toPrecision(2):""} ETH`,address:v.address,statusColor:P?"green":"gray"}),P&&Ye(y1,{onClick:()=>d(),children:"Close"})]});return m==="qr-code"?Ft(jc,{children:[Ye(k,{backFn:()=>h("default")}),Ft(un,{style:{gap:"24px",marginBottom:"24px"},children:[Ft("div",{children:[Ye(pe,{children:"Scan QR code"}),Ft(me,{children:["Scan this code using your mobile wallet to send funds to your ",T," ","wallet."]})]}),Ye(bn,{url:v.address,size:200,squareLogoElement:ab}),S]}),Ye(B,{})]}):Ft(jc,{children:[Ye(Nt,{}),Ye(ye,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),Ft(un,{style:{gap:"16px"},children:[Ft(lb,{children:[Ye(eb,{height:"20px",width:"20px",color:"var(--privy-color-accent-light)"}),Ft(cb,{children:["Make sure to send on ",v.chain.name,"."]})]}),Ft(db,{children:[Ye(oi,{height:16}),Ft(Ti,{children:[Ft(Si,{children:[Ye(zc,{children:v.amount}),Ye(Pi,{children:v.chain.nativeCurrency.symbol})]}),Ye(Ai,{children:R?`${R} USD`:"..."}),Ft(f1,{children:[Ye(Ei,{chainId:v.chain.id,height:16,width:16})," ",v.chain.name]})]}),Ye(oi,{height:8}),Ft(sb,{children:[Ye(ib,{text:v.address}),Ye(Y1,{onClick:()=>h("qr-code"),children:Ft(K1,{children:[Ye(tb,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),S]}),Ye(oi,{height:16}),Ye(B,{})]})},ab=({...e})=>Ye(pl,{color:"black",...e}),ib=e=>{let[t,r]=ou(!1);return Ye(Y1,{onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},children:Ft(K1,{children:[t?Ye(vi,{style:{height:"16px",width:"16px"},strokeWidth:"2"}):Ye($7,{style:{height:"16px",width:"16px"}}),t?"Copied":"Copy address"]})})},sb=ki.div`
1832
- display: flex;
1833
- flex-direction: row;
1834
- gap: 8px;
1835
- `,lb=ki.div`
1836
- display: flex;
1837
- flex-direction: row;
1838
- padding: 8px;
1839
- background-color: var(--privy-color-background-2);
1840
- border-radius: var(--privy-border-radius-md);
1841
- svg {
1842
- margin-right: 12px;
1843
- }
1844
- `,cb=ki.div`
1845
- line-height: 20px;
1846
- font-size: 18px
1847
- text-align: center;
1848
- `,db=ki.div`
1849
- display: flex;
1850
- flex-direction: column;
1851
- background-color: var(--privy-color-background-2);
1852
- border-radius: var(--privy-border-radius-md);
1853
- svg {
1854
- margin-right: 6px;
1855
- }
1856
- padding: 16px;
1857
- gap: 8px;
1858
- `,K1=ki.span`
1859
- display: flex;
1860
- align-items: center;
1861
- margin: auto;
1862
- `,Y1=ki.button`
1863
- display: flex;
1864
- align-items: center;
1865
- width: 100%;
1866
-
1867
- && {
1868
- border-radius: var(--privy-border-radius-md);
1869
- border: 1px solid var(--privy-color-foreground-4);
1870
- background-color: white;
1871
- line-height: 18px;
1872
- text-align: center;
1873
- padding: 8px;
1874
- font-size: 14px;
1875
- background-color: var(--privy-color-background);
1876
- color: ${e=>e.justCopied?"var(--privy-color-foreground-2)":"var(--privy-color-foreground-accent-dark)"};
1877
- font-weight: ${e=>e.justCopied?"medium":"normal"};
1878
- transition: color 350ms ease;
1879
-
1880
- :active {
1881
- outline: none;
1882
- box-shadow: none;
1883
- }
1884
-
1885
- :hover {
1886
- color: ${e=>e.justCopied?"var(--privy-color-foreground-2)":"var(--privy-color-foreground-accent-dark)"};
1887
- }
1888
-
1889
- :active {
1890
- color: 'var(--privy-color-foreground-accent-dark)';
1891
- font-weight: medium;
1892
- }
1893
- }
1894
-
1895
- svg {
1896
- width: 18px;
1897
- height: 18px;
1898
- }
1899
- `;import{useEffect as Sb,useState as Pb}from"react";import pb from"@heroicons/react/24/outline/ClockIcon";import ub from"@heroicons/react/24/outline/EyeSlashIcon";import mb from"@heroicons/react/24/outline/LinkIcon";import Wo from"styled-components";import{Fragment as Q1,jsx as Zt,jsxs as ga}from"react/jsx-runtime";var nu=({title:e,desc:t,icon:r})=>ga(vb,{children:[Zt(bb,{children:r}),ga(wb,{children:[Zt(gb,{children:e}),Zt(Cb,{children:t})]})]}),X1=({app:e,signedUrl:t,onContinue:r})=>ga(Q1,{children:[ga(hb,{children:[Zt(xi,{size:"3.75rem"}),ga(yb,{children:[e?.name," uses ",Zt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),ga(Eb,{children:[Zt(nu,{icon:Zt(mb,{width:"1rem"}),title:"Purchase assets to fund your account",desc:ga(Q1,{children:["Connect a payment method (",Zt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Zt(nu,{icon:Zt(pb,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Zt(nu,{icon:Zt(ub,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Zt(Tb,{className:"mobile-only"})]}),Zt(fb,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Zt(jl,{disabled:!t,href:t??"#",target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),fb=Wo.span`
1900
- display: inline-block;
1901
- color: var(--privy-color-foreground-3);
1902
- text-align: center;
1903
- font-size: 0.625rem;
1904
- font-style: normal;
1905
- font-weight: 400;
1906
- line-height: 140%; /* 0.875rem */
1907
- margin-bottom: 0.25rem;
1908
- `,hb=Wo.div`
1909
- display: flex;
1910
- flex-direction: column;
1911
- align-items: center;
1912
- justify-content: center;
1913
- padding: 1.5rem 0;
1914
- `,yb=Wo.span`
1915
- color: var(--privy-color-foreground);
1916
- text-align: center;
1917
- font-size: 1.125rem;
1918
- font-weight: 500;
1919
- line-height: 1.25rem; /* 111.111% */
1920
- margin: 1.5rem 0;
1921
- text-align: center;
1922
- max-width: 19.5rem;
1923
- `,gb=Wo.span`
1924
- color: var(--privy-color-foreground);
1925
- font-size: 0.875rem;
1926
- font-weight: 500;
1927
- line-height: 1.225rem;
1928
- width: 100%;
1929
- `,Cb=Wo.span`
1930
- color: var(--privy-color-foreground-2);
1931
- font-size: 0.875rem;
1932
- font-weight: 400;
1933
- line-height: 1.225rem;
1934
- `,vb=Wo.div`
1935
- display: flex;
1936
- align-items: flex-start;
1937
- gap: 0.5rem;
1938
- align-self: stretch;
1939
- `,wb=Wo.div`
1940
- display: flex;
1941
- flex-direction: column;
1942
- gap: 0.25rem;
1943
- align-items: flex-start;
1944
- text-align: left;
1945
- flex: 1 0 0;
1946
- `,bb=Wo.div`
1947
- padding-top: 2px;
1948
- `,Eb=Wo.div`
1949
- display: flex;
1950
- flex-direction: column;
1951
- gap: 1.25rem;
1952
- margin: 0 0.5rem;
1953
- `,Tb=Wo.div`
1954
- margin: 30px 0;
1955
- `;import{Fragment as Ab,jsx as au,jsxs as xb}from"react/jsx-runtime";var Z1=()=>{let{app:e,data:t,navigate:r,setModalData:o}=x(),{createAnalyticsEvent:n,getMoonpaySignedUrl:a}=_(),[i,l]=Pb(null),c=t?.funding,d=c.isUSDC?"USDC":"native-currency";return Sb(()=>{if(i||!c)return;async function u(){if(!e.fundingConfig)return;let{signedUrl:m,externalTransactionId:h}=await a(c.address,{...e.fundingMethodConfig.moonpay,...c.moonpayConfigOverride,currencyCode:c.moonpayConfigOverride?.currencyCode??O1(c.chain.id,d),quoteCurrencyAmount:c.moonpayConfigOverride?.quoteCurrencyAmount??N1(c.amount)});l(m),o({moonpayStatus:{externalTransactionId:h},funding:t?.funding})}u()},[i,c]),xb(Ab,{children:[au(Nt,{}),au(X1,{app:e,signedUrl:i,onContinue:()=>{n({eventName:"sdk_fiat_on_ramp_started",payload:{provider:Zc}}),r("MOONPAY_STATUS_SCREEN")}}),au(B,{})]})};import kb from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import Rb from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as _b}from"react";import J1 from"styled-components";import{Fragment as $1,jsx as Ar,jsxs as _s}from"react/jsx-runtime";var j1=()=>{let{app:e,data:t}=x(),{closePrivyModal:r}=_(),{externalTransactionId:o}=t?.moonpayStatus,n=F1(o||null,e.fundingMethodConfig.moonpay.useSandbox??!1);return _s($1,{children:[Ar(k,{title:"Fund account"},"header"),Ar(Ib,{status:n,onClickCta:r}),Ar(B,{})]})},Mb=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},Ib=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=_b(()=>Mb(e),[e]);return _s($1,{children:[_s(Db,{children:[Ar(Ob,{status:e}),_s(je,{children:[Ar("h3",{children:r}),Ar(Nb,{children:o})]})]}),n&&Ar(U,{onClick:t,children:n})]})},Wb=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",Lb=e=>{switch(e){case"completed":return Rb;case"waitingAuthorization":return()=>Ar(kb,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},Ob=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return _s("div",{style:{position:"relative"},children:[Ar(lt,{color:o,style:{position:"absolute"}}),Ar(os,{color:o}),Ar(xi,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=Lb(e),r=Wb(e);return Ar("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Ar(t,{width:"4rem",height:"4rem",color:r})})},Nb=J1.p`
1956
- font-size: 1rem;
1957
- color: var(--privy-color-foreground-3);
1958
- margin-bottom: 1rem;
1959
- display: flex;
1960
- flex-direction: column;
1961
- gap: 1rem;
1962
- `,Db=J1.div`
1963
- display: flex;
1964
- flex-direction: column;
1965
- align-items: center;
1966
- justify-content: center;
1967
- margin-left: 1.75rem;
1968
- margin-right: 1.75rem;
1969
- padding: 2rem 0;
1970
- `;import{useEffect as zb,useState as Kb}from"react";import Ub,{css as Fb}from"styled-components";import{jsx as Hb}from"react/jsx-runtime";var $c=()=>{let{enabled:e,token:t}=Ee(),{navigate:r,setModalData:o}=x(),{initLoginWithPasskey:n}=_();return Hb(iu,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:i=>n(i),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSKEY_SYSTEM_DIALOGUE",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await n(),r("AWAITING_PASSKEY_SYSTEM_DIALOGUE"))},children:"I have a passkey"})},Bb=Fb`
1971
- && {
1972
- width: 100%;
1973
- font-size: 0.875rem;
1974
- line-height: 1rem;
1975
-
1976
- /* Tablet and Up */
1977
- @media (min-width: 440px) {
1978
- font-size: 14px;
1979
- }
1980
-
1981
- display: flex;
1982
- gap: 12px;
1983
- justify-content: center;
1984
-
1985
- padding: 6px 8px;
1986
- background-color: var(--privy-color-background);
1987
- transition: background-color 200ms ease;
1988
- color: var(--privy-color-accent) !important;
1989
-
1990
- :focus {
1991
- outline: none;
1992
- box-shadow: none;
1993
- }
1994
- }
1995
- `,iu=Ub.button`
1996
- ${Bb}
1997
- `;import Gb from"@heroicons/react/24/outline/ChevronRightIcon";import Vb from"@heroicons/react/24/outline/WalletIcon";import{jsx as su,jsxs as qb}from"react/jsx-runtime";var ed=({onClick:e,text:t})=>qb(Te,{onClick:e,children:[su(Vb,{}),su(vr,{children:t}),su(Gb,{})]});import{Fragment as e2,jsx as Sn,jsxs as td}from"react/jsx-runtime";var t2=()=>{let{connectors:e}=_(),{app:t,setModalData:r,data:o,navigate:n}=x(),[a,i]=Kb("default"),l=fn(t.appearance.walletList,"ethereum-only",e,!0,t.appearance.walletList,t.externalWallets.walletConnect.enabled),c=Sn(ed,{text:"More wallets",onClick:()=>i("overflow")});return zb(()=>{r({...o,externalConnectWallet:{onCompleteNavigateTo:"FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"}})},[]),a==="overflow"?td(e2,{children:[Sn(k,{backFn:()=>i("default")},"header"),td(ir,{children:[Sn(qr,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),l]}),Sn(B,{})]}):td(e2,{children:[Sn(Nt,{}),Sn(ye,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),td(ir,{children:[...l.length>3?l.slice(0,2):l,l.length>3&&c,Sn(iu,{onClick:()=>n("FUNDING_MANUAL_TRANSFER_SCREEN"),children:"Send funds manually"})]}),Sn(B,{})]})};import Yb from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Qb from"styled-components";import{Fragment as Zb,jsx as Pn,jsxs as Jb}from"react/jsx-runtime";var r2=()=>{let{closePrivyModal:e}=_();return Jb(Zb,{children:[Pn(k,{},"header"),Pn(Xb,{children:Pn(Yb,{style:{width:32,height:32}})}),Pn(xo,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),Pn(dr,{children:Pn(U,{onClick:()=>e(),children:"Close"})}),Pn(ae,{}),Pn(B,{})]})},Xb=Qb.div`
1998
- border-radius: 50%;
1999
- height: 68px;
2000
- width: 68px;
2001
- display: flex;
2002
- align-items: center;
2003
- justify-content: center;
2004
- background-color: var(--privy-color-accent);
2005
- color: white;
2006
- margin: 0 auto 24px auto;
2007
- `;import*as i2 from"react-device-detect";import t8 from"styled-components";import lu from"styled-components";import{jsx as o2}from"react/jsx-runtime";var n2=({style:e,...t})=>o2("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:o2("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as $b,jsxs as e8}from"react/jsx-runtime";var a2=lu.div`
2008
- display: flex;
2009
- flex-direction: column;
2010
- justify-content: flex-start;
2011
- gap: 4px;
2012
- `,cu=lu.div`
2013
- &&& {
2014
- margin-left: 7px; /* TODO: This is a total hack */
2015
- border-left: 2px solid var(--privy-color-foreground-4);
2016
- height: 12px;
2017
- }
2018
- `,rd=({children:e})=>e8(jb,{children:[$b(n2,{style:{width:"16px",height:"16px"}}),e]}),jb=lu.div`
2019
- display: flex;
2020
- justify-content: flex-start;
2021
- justify-items: center;
2022
- text-align: left;
2023
- gap: 8px;
2024
-
2025
- && {
2026
- a {
2027
- text-decoration: underline;
2028
- color: var(--privy-color-accent);
2029
- }
2030
-
2031
- svg {
2032
- margin-top: auto;
2033
- margin-bottom: auto;
2034
- }
2035
- }
2036
- `;import{Fragment as n8,jsx as xt,jsxs as Ms}from"react/jsx-runtime";var r8=()=>Ms(o8,{children:[xt(aa,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),xt(Pt,{children:xt(To,{style:{width:"152px",height:"152px"}})}),Ms(a2,{children:[xt(rd,{children:Ms("div",{children:[xt("span",{children:"Install the "}),xt("a",{href:i2.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),xt(cu,{}),xt(rd,{children:"Set up your first wallet"}),xt(cu,{}),xt(rd,{children:"Store your recovery phrase in a safe place!"})]}),xt(dn,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),s2=()=>{let{navigateBack:e}=x();return Ms(n8,{children:[xt(k,{backFn:e},"header"),xt(oe,{}),xt(r8,{}),xt(ae,{}),Ms(j,{children:[xt("span",{children:"Still not sure? "}),xt("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},o8=t8(Pt)`
2037
- gap: 30px;
2038
-
2039
- > :first-child > svg {
2040
- margin-top: 20px;
2041
- }
2042
- `;import Q8 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as X8,useState as P2}from"react";import Z8 from"styled-components";var a8={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",twitter_oauth:"twitter",wallet:"siwe",smart_wallet:"siwe",cross_app:"privy:",guest:"guest"},An=e=>{let t=a8[e];return e==="wallet"||e==="phone"?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};import l8 from"styled-components";import i8 from"react";import{jsx as s8}from"react/jsx-runtime";var l2=()=>{let{app:e}=x(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?s8("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?i8.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as c2}from"react/jsx-runtime";var od=e=>{let{app:t}=x();return t?.appearance.logo?c2(c8,{...e,children:c2(l2,{})}):null},c8=l8.div`
2043
- display: flex;
2044
- flex-direction: column;
2045
- align-items: center;
2046
- padding: 24px 0;
2047
- flex-grow: 1;
2048
- justify-content: center;
2049
- `;import h8 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as y8}from"react";import d8 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as p8,useState as du}from"react";import p2 from"styled-components";import{Fragment as f8,jsx as Ca,jsxs as d2}from"react/jsx-runtime";var nd=p8((e,t)=>{let[r,o]=du(e.defaultValue||""),[n,a]=du(!1),{authenticated:i}=q(),{initLoginWithEmail:l}=_(),{navigate:c,setModalData:d,currentScreen:u,data:m}=x(),{enabled:h,token:g}=Ee(),[w,v]=du(!1),{accountType:E}=Mt(),R=rl(r),A=n,T=n||!R,P=M=>{a(!0),l(r,M,m?.login?.disableSignup).then(()=>{c("AWAITING_PASSWORDLESS_CODE")}).catch(N=>{d({errorModalData:{error:N,previousScreen:u||"LANDING"}}),c("ERROR_SCREEN")}).finally(()=>{a(!1)})},S=()=>{h&&!g&&!i?(d({captchaModalData:{callback:M=>l(r,M),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):P(g)};return d2(f8,{children:[Ca(u8,{children:d2(m8,{stacked:e.stacked,children:[Ca(d8,{}),Ca("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onFocus:()=>v(!0),onChange:M=>o(M.target.value),onKeyUp:M=>{M.key==="Enter"&&S()},value:r,autoComplete:"email"}),E==="email"&&!w?Ca(rr,{color:"gray",children:"Recent"}):e.stacked?Ca("span",{}):Ca(ei,{isSubmitting:A,onClick:S,disabled:T,children:"Submit"})]})}),e.stacked?Ca(U,{loadingText:null,loading:A,disabled:T,onClick:S,children:"Submit"}):null]})}),u8=p2.div`
2050
- width: 100%;
2051
- `,m8=p2.label`
2052
- display: block;
2053
- position: relative;
2054
- width: 100%;
2055
-
2056
- > svg {
2057
- position: absolute;
2058
- margin: 13px 17px;
2059
- height: 24px;
2060
- width: 24px;
2061
- color: var(--privy-color-foreground-3);
2062
- }
2063
-
2064
- && > input {
2065
- font-size: 16px;
2066
- line-height: 24px;
2067
-
2068
- overflow: hidden;
2069
- white-space: nowrap;
2070
- text-overflow: ellipsis;
2071
-
2072
- padding: 12px 88px 12px 52px;
2073
- padding-right: ${e=>e.stacked?"16px":"88px"};
2074
- flex-grow: 1;
2075
- background: var(--privy-color-background);
2076
- border: 1px solid var(--privy-color-foreground-4);
2077
- border-radius: var(--privy-border-radius-mdlg);
2078
- width: 100%;
2079
-
2080
- /* Tablet and Up */
2081
- @media (min-width: 441px) {
2082
- font-size: 14px;
2083
- padding-right: 78px;
2084
- }
2085
-
2086
- :focus {
2087
- outline: none;
2088
- border-color: var(--privy-color-accent);
2089
- }
2090
-
2091
- :autofill,
2092
- :-webkit-autofill {
2093
- background: var(--privy-color-background);
2094
- }
2095
- }
2096
-
2097
- && > :last-child {
2098
- right: 16px;
2099
- position: absolute;
2100
- top: 50%;
2101
- transform: translate(0, -50%);
2102
- }
2103
-
2104
- && > button:last-child {
2105
- right: 0px;
2106
- line-height: 24px;
2107
- padding: 13px 17px;
2108
-
2109
- :focus {
2110
- outline: none;
2111
- border-color: var(--privy-color-accent);
2112
- }
2113
- }
2114
-
2115
- && > input::placeholder {
2116
- color: var(--privy-color-foreground-3);
2117
- }
2118
- `;import{Fragment as g8,jsx as ad,jsxs as u2}from"react/jsx-runtime";var id=({isEditable:e,setIsEditable:t,defaultValue:r})=>{let o=y8(null);return u2(g8,{children:[ad(oo,{if:!e,children:ad(nd,{ref:o,defaultValue:r})}),ad(oo,{if:e,children:u2(Te,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[ad(h8,{})," Continue with Email"]})})]})};import{useState as C8}from"react";import v8 from"styled-components";import{jsx as pu,jsxs as b8}from"react/jsx-runtime";var sd=()=>{let[e,t]=C8(!1),{currentScreen:r,navigate:o,setModalData:n,data:a}=x(),{enabled:i,token:l}=Ee(),{initLoginWithFarcaster:c}=_(),{accountType:d}=Mt();return b8(Te,{onClick:async()=>{t(!0);try{i&&!l?(n({captchaModalData:{callback:m=>c(m,a?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await c(l,a?.login?.disableSignup),o("AWAITING_FARCASTER_CONNECTION"))}catch(m){n({errorModalData:{error:m,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[pu(_o,{})," Farcaster",e&&pu(So,{}),d==="farcaster"&&pu(w8,{color:"gray",children:"Recent"})]})},w8=v8(rr)`
2119
- margin-left: auto;
2120
- `;import L8 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as O8}from"react";import{forwardRef as R8,useEffect as _8,useState as dd}from"react";import w2 from"styled-components";import E8 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as T8,AsYouType as m2,getCountries as S8,getCountryCallingCode as ld,getExampleNumber as P8}from"libphonenumber-js/min";import{jsx as k8,jsxs as x8}from"react/jsx-runtime";var Is=(e,t)=>T8(String(e),t),cd=(e,t)=>`+${ld(t)} ${e}`,f2=e=>`*${e.replaceAll("-","").slice(-4)}`,h2=e=>new m2(e),A8=S8().map(e=>({code:e,callCode:ld(e)})),y2=e=>{let t=P8(e,E8)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},g2=({value:e,onChange:t})=>k8("select",{value:e,onChange:t,children:A8.map(r=>x8("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))}),C2=e=>{let t=new m2;t.input(e);let r=t.getCountry()||"US",o=t.getCallingCode()||"1";return{countryCode:r,phone:e.replace("+"+o,"")}};import{Fragment as W8,jsx as va,jsxs as v2}from"react/jsx-runtime";var xn=R8((e,t)=>{let{app:r}=x(),[o,n]=dd(!1),{accountType:a}=Mt(),[i,l]=dd(""),[c,d]=dd(r?.intl.defaultCountry??"US"),u=Is(i,c),m=h2(c),h=y2(c),g=ld(c),w=!u,[v,E]=dd(!1),R=g.length,A=S=>{let M=S.target.value;d(M),l(""),e.onChange&&e.onChange({rawPhoneNumber:i,qualifiedPhoneNumber:cd(i,M),countryCode:M,isValid:Is(i,c)})},T=(S,M)=>{try{let N=S.replace(/\D/g,""),H=i.replace(/\D/g,""),F=N===H?S:m.input(S);l(F),e.onChange&&e.onChange({rawPhoneNumber:F,qualifiedPhoneNumber:cd(S,M),countryCode:M,isValid:Is(S,M)})}catch(N){console.error("Error processing phone number:",N)}},P=()=>{E(!0);let S=cd(i,c);e.onSubmit({rawPhoneNumber:i,qualifiedPhoneNumber:S,countryCode:c,isValid:Is(i,c)}).finally(()=>E(!1))};return _8(()=>{if(e.defaultValue){let S=C2(e.defaultValue);m.reset(),A({target:{value:S.countryCode}}),T(S.phone,S.countryCode)}},[e.defaultValue]),v2(W8,{children:[va(M8,{children:v2(I8,{callingCodeLength:R,stacked:e.stacked,children:[va(g2,{value:c,onChange:A}),va("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:h,onFocus:()=>n(!0),onChange:S=>{T(S.target.value,c)},onKeyUp:S=>{S.key==="Enter"&&P()},value:i,autoComplete:"tel"}),a==="phone"&&!o&&!e.hideRecent?va(rr,{color:"gray",children:"Recent"}):!e.stacked&&!e.noIncludeSubmitButton?va(ei,{isSubmitting:v,onClick:P,disabled:w,children:"Submit"}):va("span",{})]})}),e.stacked&&!e.noIncludeSubmitButton?va(U,{loading:v,loadingText:null,onClick:P,disabled:w,children:"Submit"}):null]})}),M8=w2.div`
2121
- width: 100%;
2122
- `,I8=w2.label`
2123
- --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
2124
- --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
2125
- display: block;
2126
- position: relative;
2127
- width: 100%;
2128
-
2129
- /* Tablet and Up */
2130
- @media (min-width: 441px) {
2131
- --country-code-dropdown-width: calc(52px + calc(10 * ${e=>e.callingCodeLength}px));
2132
- }
2133
-
2134
- && > select {
2135
- font-size: 16px;
2136
- height: 24px;
2137
- position: absolute;
2138
- margin: 13px calc(var(--country-code-dropdown-width) / 4);
2139
- line-height: 24px;
2140
- width: var(--country-code-dropdown-width);
2141
- background-color: var(--privy-color-background);
2142
- background-size: auto;
2143
- background-position-x: right;
2144
- cursor: pointer;
2145
-
2146
- /* Tablet and Up */
2147
- @media (min-width: 441px) {
2148
- font-size: 14px;
2149
- width: var(--country-code-dropdown-width);
2150
- }
2151
-
2152
- :focus {
2153
- outline: none;
2154
- box-shadow: none;
2155
- }
2156
- }
2157
-
2158
- && > input {
2159
- font-size: 16px;
2160
- line-height: 24px;
2161
-
2162
- overflow: hidden;
2163
- white-space: nowrap;
2164
- text-overflow: ellipsis;
2165
-
2166
- width: calc(100% - var(--country-code-dropdown-width));
2167
-
2168
- padding: 12px 88px 12px
2169
- calc(var(--country-code-dropdown-width) + var(--phone-input-extra-padding-left));
2170
- padding-right: ${e=>e.stacked?"16px":"88px"};
2171
- flex-grow: 1;
2172
- background: var(--privy-color-background);
2173
- border: 1px solid var(--privy-color-foreground-4);
2174
- border-radius: var(--privy-border-radius-mdlg);
2175
- width: 100%;
2176
-
2177
- :focus {
2178
- outline: none;
2179
- border-color: var(--privy-color-accent);
2180
- }
2181
-
2182
- :autofill,
2183
- :-webkit-autofill {
2184
- background: var(--privy-color-background);
2185
- }
2186
-
2187
- /* Tablet and Up */
2188
- @media (min-width: 441px) {
2189
- font-size: 14px;
2190
- padding-right: 78px;
2191
- }
2192
- }
2193
-
2194
- && > :last-child {
2195
- right: 16px;
2196
- position: absolute;
2197
- top: 50%;
2198
- transform: translate(0, -50%);
2199
- }
2200
-
2201
- && > button:last-child {
2202
- right: 0px;
2203
- line-height: 24px;
2204
- padding: 13px 17px;
2205
-
2206
- :focus {
2207
- outline: none;
2208
- border-color: var(--privy-color-accent);
2209
- }
2210
- }
2211
-
2212
- && > input::placeholder {
2213
- color: var(--privy-color-foreground-3);
2214
- }
2215
- `;import{Fragment as N8,jsx as pd,jsxs as b2}from"react/jsx-runtime";var ud=({isEditable:e,setIsEditable:t,defaultValue:r})=>{let o=O8(null),{authenticated:n}=q(),{navigate:a,setModalData:i,currentScreen:l,data:c}=x(),{initLoginWithSms:d}=_(),{enabled:u,token:m}=Ee();async function h({qualifiedPhoneNumber:g}){if(u&&!m&&!n)i({captchaModalData:{callback:w=>d(g,w,c?.login?.disableSignup),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),a("CAPTCHA_SCREEN");else try{await d(g,m,c?.login?.disableSignup),a("AWAITING_PASSWORDLESS_CODE")}catch(w){i({errorModalData:{error:w,previousScreen:l||"LANDING"}}),a("ERROR_SCREEN")}}return b2(N8,{children:[pd(oo,{if:!e,children:pd(xn,{ref:o,onSubmit:h,defaultValue:r})}),pd(oo,{if:e,children:b2(Te,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[pd(L8,{})," Continue with SMS"]})})]})};import{useState as D8}from"react";import U8 from"styled-components";import{jsx as Lo,jsxs as H8}from"react/jsx-runtime";var F8={apple:{logo:Lo(Rl,{}),displayName:"Apple"},discord:{logo:Lo(_l,{}),displayName:"Discord"},github:{logo:Lo(Ml,{}),displayName:"GitHub"},google:{logo:Lo(Wl,{}),displayName:"Google"},linkedin:{logo:Lo(Dl,{}),displayName:"LinkedIn"},spotify:{logo:Lo(Ul,{}),displayName:"Spotify"},instagram:{logo:Lo(Ol,{}),displayName:"Instagram"},twitter:{logo:Lo(Bl,{}),displayName:"Twitter"},tiktok:{logo:Lo(Fl,{}),displayName:"TikTok"}},ct=({provider:e})=>{let{enabled:t,token:r}=Ee(),{navigate:o,setModalData:n,data:a}=x(),[i,l]=D8(!1),{initLoginWithOAuth:c}=_(),{accountType:d}=Mt(),u=d?An(d):null,{displayName:m,logo:h}=F8[e];return H8(Te,{onClick:()=>{l(!0),t&&!r?(n({captchaModalData:{callback:w=>c(e,w,a?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):c(e,void 0,a?.login?.disableSignup)},disabled:i,children:[h," ",m,u?.loginMethod===e&&Lo(B8,{color:"gray",children:"Recent"})]})},B8=U8(rr)`
2216
- margin-left: auto;
2217
- `;import{useState as G8}from"react";import V8 from"styled-components";import{jsx as kn,jsxs as E2}from"react/jsx-runtime";function md(e){return E2("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...e,children:[kn("defs",{children:E2("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[kn("stop",{offset:"0",stopColor:"#1d93d2"}),kn("stop",{offset:"1",stopColor:"#38b0e3"})]})}),kn("title",{children:"Telegram_logo"}),kn("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),kn("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),kn("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),kn("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}import{jsx as T2,jsxs as z8}from"react/jsx-runtime";var fd=()=>{let{enabled:e,token:t}=Ee(),{navigate:r,setModalData:o,data:n}=x(),[a,i]=G8(!1),{initLoginWithTelegram:l}=_(),{accountType:c}=Mt();async function d(m){try{await l(m,n?.login?.disableSignup),r("TELEGRAM_AUTH_SCREEN")}catch(h){console.error(h),i(!1)}}async function u(){if(i(!0),e&&!t){o({captchaModalData:{callback:d,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN");return}await d()}return z8(Te,{onClick:u,disabled:a,children:[T2(md,{}),"Telegram",c==="telegram"&&T2(q8,{color:"gray",children:"Recent"})]})},q8=V8(rr)`
2218
- margin-left: auto;
2219
- `;import K8 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as S2,jsxs as Y8}from"react/jsx-runtime";var hd=({onClick:e,text:t,icon:r})=>Y8(Te,{onClick:e,children:[r,S2(vr,{children:t}),S2(K8,{})]});import{Fragment as uu,jsx as ot,jsxs as gd}from"react/jsx-runtime";var Cd=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=_(),{app:o,onUserCloseViaDialogOrKeybindRef:n,data:a}=x(),{appearance:{palette:{colorScheme:i}}}=Be(),{accountType:l,walletClientType:c}=Mt(),d=l?An(l):null,u=o.loginMethodsAndOrder?.primary??[],m=o.loginMethodsAndOrder?.overflow??[],h=[...u,...m],g=o.loginMethods.passkey,w=a?.login,v=[];c&&h.includes(c)?v.push(c):l&&h.includes(d?.loginMethod)&&v.push(d?.loginMethod);let[E,R]=P2("default"),[A,T]=P2(l==="phone"?"sms":"email");X8(()=>{l==="phone"&&T("sms");let Y=h.indexOf("sms"),ke=h.indexOf("email");Y>-1&&Y<ke&&T("sms")},[l,u,m]);let P=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{R("default")},150)};n.current=P;let S=Y=>Y==="email"?ot(id,{isEditable:A==="email",setIsEditable:()=>{T("email")},defaultValue:w?.prefill?.type==="email"?w.prefill.value:void 0},Y):Y==="sms"?ot(ud,{isEditable:A==="sms",setIsEditable:()=>{T("sms")},defaultValue:w?.prefill?.type==="phone"?w.prefill.value:void 0},Y):Y==="apple"?ot(ct,{provider:"apple"},Y):Y==="discord"?ot(ct,{provider:"discord"},Y):Y==="farcaster"?ot(sd,{},Y):Y==="github"?ot(ct,{provider:"github"},Y):Y==="google"?ot(ct,{provider:"google"},Y):Y==="linkedin"?ot(ct,{provider:"linkedin"},Y):Y==="spotify"?ot(ct,{provider:"spotify"},Y):Y==="instagram"?ot(ct,{provider:"instagram"},Y):Y==="tiktok"?ot(ct,{provider:"tiktok"},Y):Y==="twitter"?ot(ct,{provider:"twitter"},Y):Y==="telegram"?ot(fd,{},Y):fn([Y],o.appearance.walletChainType,r,e,h,o.externalWallets.walletConnect.enabled),M=v.flatMap(S),N=u.filter(Y=>Y!==c&&Y!==d?.loginMethod).flatMap(S),H=m.filter(Y=>Y!==c&&Y!==d?.loginMethod).flatMap(S),F=[...M,...N,...H],K=J8({primary:N.length+M.length,overflow:H.length}),[W,X]=rm(F,K),L=E==="default"?void 0:()=>{R("default")};return gd(uu,{children:[ot(k,{title:o.appearance.landingHeader,onClose:P,backFn:L}),E==="default"&&ot(j8,{}),E==="default"&&(typeof o.appearance.loginMessage=="string"?ot(tc,{children:o.appearance.loginMessage}):o.appearance.loginMessage),ot(ec,{style:{overflow:"hidden"},children:gd(Ah,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[E==="default"&&gd(uu,{children:[...W,X.length>0&&ot(hd,{text:"More options",icon:ot(Q8,{}),onClick:()=>R("overflow")})]}),E==="overflow"&&gd(uu,{children:[...X]}),g&&E==="default"&&ot($c,{})]})}),o&&ot(Na,{app:o}),ot(B,{})]})},yd=5,J8=({primary:e,overflow:t})=>e<yd?e:e===yd&&t===0?yd:yd-1,j8=Z8(od)`
2220
- margin-bottom: 16px;
2221
- `;import $8 from"@heroicons/react/24/outline/EnvelopeIcon";import eE from"@heroicons/react/24/outline/PhoneIcon";import tE from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as rE,useMemo as k2,useState as R2}from"react";import oE from"styled-components";import{toObjectKeys as nE}from"@privy-io/js-sdk-core";import{jsx as Ws,jsxs as A2}from"react/jsx-runtime";var x2=({...e})=>A2("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[A2("g",{clipPath:"url(#clip0_2856_1743)",children:[Ws("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Ws("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ws("defs",{children:Ws("clipPath",{id:"clip0_2856_1743",children:Ws("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import{Fragment as Ls,jsx as Ve,jsxs as Ri}from"react/jsx-runtime";var vd=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=_(),{data:o,onUserCloseViaDialogOrKeybindRef:n}=x(),a=Be(),{accountType:i,walletClientType:l}=Mt(),c=i?An(i):null,d=o?.login,u=k2(()=>d?.loginMethods?nE(d.loginMethods,!0):null,[d]),{email:m,sms:h,google:g,twitter:w,discord:v,github:E,spotify:R,instagram:A,tiktok:T,linkedin:P,apple:S,wallet:M,farcaster:N,telegram:H}=u??a.loginMethods,{passkey:F}=a.loginMethods,K=[m&&"email",h&&"sms",g&&"google",w&&"twitter",v&&"discord",E&&"github",R&&"spotify",A&&"instagram",T&&"tiktok",P&&"linkedin",S&&"apple",N&&"farcaster",H&&"telegram"].filter(ie=>!!ie),W=K.length>0,X=k2(()=>M&&!W?"web3-first":M&&a?.appearance.loginGroupPriority||"web2-first",[M,W,a?.appearance.loginGroupPriority]),L=a?.appearance.hideDirectWeb2Inputs,[Y,ke]=R2("default"),[be,te]=R2(_2({mostRecentlyUsedAccountType:i,smsAvailable:h,emailAvailable:m,prefilledType:d?.prefill?.type}));rE(()=>{te(_2({mostRecentlyUsedAccountType:i,smsAvailable:h,emailAvailable:m,prefilledType:d?.prefill?.type}))},[m,h,i]);let Q=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{ke("default")},150)};n.current=Q;let Re=[];l&&M?Re.push(l):c?.loginMethod&&K.includes(c.loginMethod)&&Re.push(c.loginMethod);let he=ie=>ie==="email"?Ve(id,{isEditable:be==="email",setIsEditable:()=>{te("email")},defaultValue:d?.prefill?.type==="email"?d.prefill.value:void 0},ie):ie==="sms"?Ve(ud,{isEditable:be==="sms",setIsEditable:()=>{te("sms")},defaultValue:d?.prefill?.type==="phone"?d.prefill.value:void 0},ie):ie==="apple"?Ve(ct,{provider:"apple"},ie):ie==="discord"?Ve(ct,{provider:"discord"},ie):ie==="farcaster"?Ve(sd,{},ie):ie==="github"?Ve(ct,{provider:"github"},ie):ie==="google"?Ve(ct,{provider:"google"},ie):ie==="linkedin"?Ve(ct,{provider:"linkedin"},ie):ie==="tiktok"?Ve(ct,{provider:"tiktok"},ie):ie==="spotify"?Ve(ct,{provider:"spotify"},ie):ie==="instagram"?Ve(ct,{provider:"instagram"},ie):ie==="twitter"?Ve(ct,{provider:"twitter"},ie):ie==="telegram"?Ve(fd,{},ie):fn([ie],a.appearance.walletChainType,r,e,[],a.externalWallets.walletConnect.enabled),re=fn(a.appearance.walletList.filter(ie=>ie!==l),a.appearance.walletChainType,r,e,[...a.appearance.walletList,l],a.externalWallets.walletConnect.enabled),se=K.filter(ie=>ie!==c?.loginMethod).flatMap(he),Xe=Re.flatMap(he);X==="web3-first"&&Y==="default"?re.unshift(...Xe):X==="web2-first"&&se.unshift(...Xe);let $e=Y==="default"?void 0:()=>{ke("default")},ce=K.filter(ie=>ie!=="email"&&ie!=="sms"),ht=iE({priority:X,email:m,sms:h,social:ce}),Mr=sE({priority:X,email:m,sms:h,social:ce}),kt=lE({priority:X}),it=Ve(ed,{text:kt,onClick:()=>ke("web3-overflow")}),Se=Ve(hd,{text:ht,icon:Mr,onClick:()=>ke("web2-overflow")}),I=L?0:1;return Ri(Ls,{children:[Ve(k,{title:a.appearance.landingHeader,onClose:Q,backFn:$e}),Y==="default"&&Ve(aE,{}),Y==="default"&&(typeof a.appearance.loginMessage=="string"?Ve(tc,{children:a.appearance.loginMessage}):a.appearance.loginMessage),Ve(ec,{style:{overflow:"hidden",padding:2},children:Ri(ir,{children:[Y==="default"&&X==="web2-first"&&Ri(Ls,{children:[...se.length>4?se.slice(0,3):se,se.length>4&&Se,M&&it]}),Y==="default"&&X==="web3-first"&&Ri(Ls,{children:[M&&Ri(Ls,{children:[...re.length>4?re.slice(0,3):re,re.length>4&&it]}),se.length>I&&Se,se.length===I&&se[0]]}),Y==="web2-overflow"&&Ri(Ls,{children:[...X==="web3-first"?se:se.slice(3)]}),...Y==="web3-overflow"?re:[],F&&Y==="default"&&Ve($c,{})]})}),a&&Ve(Na,{app:a}),Ve(B,{})]})},aE=oE(od)`
2222
- margin-bottom: 16px;
2223
- `,iE=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",sE=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Ve(tE,{}):t&&r?Ve(x2,{}):t?Ve($8,{}):r?Ve(eE,{}):null,lE=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets",_2=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:r,prefilledType:o})=>r&&(e==="email"&&o!=="phone"||o==="email")?"email":t&&(e==="phone"||o==="phone")?"sms":"email";import{jsx as M2}from"react/jsx-runtime";var I2=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?M2(Cd,{connectOnly:!0}):M2(vd,{connectOnly:!0})};import{jsx as W2}from"react/jsx-runtime";var L2=()=>{let{app:e}=x();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?W2(Cd,{connectOnly:!1}):W2(vd,{connectOnly:!1})};import cE from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as dE,jsx as Rn,jsxs as pE}from"react/jsx-runtime";var O2=()=>{let{app:e}=x();return pE(dE,{children:[Rn(k,{},"header"),Rn(oe,{}),Rn(ye,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Rn(cE,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Rn(dr,{children:Rn(nd,{stacked:!0})}),Rn(ae,{}),Rn(B,{})]})};import uE from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as mE,jsx as _n,jsxs as fE}from"react/jsx-runtime";var N2=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=x(),{initLoginWithSms:a}=_();async function i({qualifiedPhoneNumber:l}){try{await a(l),o("AWAITING_PASSWORDLESS_CODE")}catch(c){n({errorModalData:{error:c,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return fE(mE,{children:[_n(k,{},"header"),_n(oe,{}),_n(ye,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:_n(uE,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),_n(dr,{children:_n(xn,{stacked:!0,onSubmit:i,hideRecent:!0})}),_n(ae,{}),_n(B,{})]})};import{Fragment as hE,jsx as _i,jsxs as D2}from"react/jsx-runtime";var U2=()=>{let{app:e,data:t}=x(),r=t?.externalConnectWallet?.suggestedAddress,o=r?D2("span",{children:["Link the wallet with address ",_i(Bo,{showCopyIcon:!1,address:r})," ",e?.name?`to ${e.name}.`:"."]}):`Link a wallet to your ${e?.name} account`;return D2(hE,{children:[_i(k,{},"header"),_i(xo,{title:"Link your wallet",description:o}),_i(ir,{children:_i(ci,{connectOnly:!1})}),_i(B,{})]})};import{jsx as F2,jsxs as yE}from"react/jsx-runtime";var B2=({style:e,...t})=>yE("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[F2("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),F2("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as gE,jsx as Mn,jsxs as H2}from"react/jsx-runtime";var G2=()=>{let{closePrivyModal:e}=_(),{navigate:t}=x();return H2(gE,{children:[Mn(k,{},"header"),Mn(oe,{}),Mn(B2,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Mn(xo,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),H2(dr,{children:[Mn(U,{onClick:()=>t("LANDING"),children:"Try again"}),Mn(ro,{onClick:()=>e(),children:"Cancel"})]}),Mn(ae,{}),Mn(B,{})]})};import e9 from"@heroicons/react/24/solid/CheckBadgeIcon";import t9 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import r9 from"@heroicons/react/24/solid/IdentificationIcon";import o9 from"@heroicons/react/24/solid/PhoneIcon";import n9 from"@heroicons/react/24/solid/QuestionMarkCircleIcon";import tC from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as a9,useState as Mi}from"react";import{useContext as CE}from"react";function Os(){let{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}=CE(He);return{promptMfa:e,init:t,submit:r,cancel:o,mfaMethods:n}}import{useContext as vE}from"react";function co(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:a,unenroll:i,enrollInMfa:l}=vE(He);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:a,unenrollWithSms:()=>i("sms"),unenrollWithTotp:()=>i("totp"),unenrollWithPasskey:()=>i("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}import wE from"styled-components";import{jsx as V2,jsxs as EE}from"react/jsx-runtime";var q2=e=>EE(bE,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[V2("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),V2("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),bE=wE.svg`
2224
- height: 90px;
2225
- width: 90px;
2226
-
2227
- > rect {
2228
- ${e=>e.color==="success"?"fill: var(--privy-color-success);":"fill: var(--privy-color-accent);"}
2229
- }
2230
-
2231
- > path {
2232
- fill: white;
2233
- }
2234
- `;import mu from"@heroicons/react/20/solid/CheckIcon";import TE from"@heroicons/react/24/outline/ChevronRightIcon";import SE from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import PE from"@heroicons/react/24/outline/FingerPrintIcon";import AE from"@heroicons/react/24/outline/PhoneIcon";import fu from"@heroicons/react/24/outline/TrashIcon";import xE from"@heroicons/react/24/solid/ShieldCheckIcon";import{Fragment as kE,jsx as xe,jsxs as mr}from"react/jsx-runtime";var z2=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:a,error:i,onClose:l,onBackToIntro:c,handleSelectMethod:d,setRemovingMfaMethod:u})=>{let m=t.reduce((g,w)=>({...g,[w]:!0}),{}),h=r.reduce((g,w)=>({...g,[w]:!0}),{});return mr(kE,{children:[xe(k,{backFn:e?c:void 0,onClose:l},"header"),xe(Ue,{children:xe(tt,{children:xe(xE,{})})}),xe(pe,{children:"Choose a verification method"}),t.length>0?xe(me,{children:"To add or delete verification methods, verification is required."}):xe(me,{children:"How would you like to verify your identity? You can change this later."}),i&&xe(sc,{style:{marginTop:"1.25rem"},children:i.message}),mr(rc,{children:[(h.totp||m.totp)&&mr(oc,{children:[xe(Te,{style:{justifyContent:"center"},disabled:m.totp||n,onClick:()=>d("totp"),children:n?xe(lt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):mr(ic,{children:[mr(ac,{children:[xe(SE,{}),"Authenticator App"]}),m.totp?mr(na,{children:[xe(mu,{}),"Added"]}):xe(na,{children:"Recommended"})]})}),m.totp&&xe(nc,{onClick:()=>u("totp"),children:xe(fu,{})})]},"totp"),(h.sms||m.sms)&&mr(oc,{children:[xe(Te,{disabled:m.sms||o,onClick:()=>d("sms"),children:mr(ic,{children:[mr(ac,{children:[xe(AE,{}),"SMS"]}),m.sms&&mr(na,{children:[xe(mu,{}),"Added"]}),o&&xe(na,{children:"Disabled"})]})}),m.sms&&xe(nc,{onClick:()=>u("sms"),children:xe(fu,{})})]},"sms"),(h.passkey||m.passkey)&&mr(oc,{children:[xe(Te,{style:{justifyContent:"center"},onClick:()=>d("passkey"),disabled:m.passkey||a,children:a?xe(lt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):mr(ic,{children:[mr(ac,{children:[xe(PE,{}),"Passkey"]}),m.passkey?mr(na,{children:[xe(mu,{}),"Added"]}):xe(na,{isAccent:!0,children:xe(TE,{})})]})}),m.passkey&&xe(nc,{onClick:()=>u("passkey"),children:xe(fu,{})})]},"passkey")]}),xe(j,{})]})};import RE from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import _E from"@heroicons/react/24/outline/ClockIcon";import ME from"@heroicons/react/24/outline/ShieldCheckIcon";import IE from"@heroicons/react/24/solid/CheckCircleIcon";import{useMemo as WE,useState as Ns}from"react";import wd from"styled-components";import{Fragment as hu,jsx as fe,jsxs as Jr}from"react/jsx-runtime";var Y2=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=q(),{data:n}=x(),{initLinkWithPasskey:a,linkWithPasskey:i}=_(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:c}=co(),[d,u]=Ns(!1),[m,h]=Ns(!1),[g,w]=Ns(!1),[v,E]=Ns(null),R=WE(()=>o?.linkedAccounts.filter(S=>S.type==="passkey")??[],[o]),A=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},T=async S=>{u(!0);try{await l(),await c({credentialIds:S}),w(!0)}catch(M){E(M)}finally{u(!1)}},P=async()=>{h(!0),E(null);try{await a();let M=(await i())?.linkedAccounts.filter(N=>N.type==="passkey").map(N=>N.credentialId)??[];await T(M)}catch(S){E(S)}finally{h(!1)}};return R.length===0||m?fe(LE,{onReset:r,onClose:t,onClick:P,isCreating:m}):g?fe(NE,{onClick:A,onClose:A}):v?fe(ma,{error:v,backFn:()=>E(null),onClick:()=>E(null)}):fe(OE,{passkeys:R,isSubmitting:d,isCreating:m,onReset:r,onClose:t,onSubmitEnrollment:()=>T(R.map(S=>S.credentialId)),onAddPasskey:P})},LE=({onReset:e,onClose:t,onClick:r,isCreating:o})=>Jr(hu,{children:[fe(k,{backFn:e,onClose:t},"header"),fe(Ue,{children:Jr(Vc,{children:[fe(fa,{}),fe(ha,{})]})}),fe(pe,{children:"Set up passkey verification"}),Jr(oa,{children:[Jr(lr,{children:[fe(sr,{children:fe(ME,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),Jr(lr,{children:[fe(sr,{children:fe(_E,{})}),"Takes seconds to set up and use"]}),Jr(lr,{children:[fe(sr,{children:fe(RE,{})}),"Use your passkey to verify transactions and login to your account"]})]}),fe(U,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),fe(j,{})]}),OE=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:a,isCreating:i})=>{let[l,c]=Ns(!1),d=l?n.length:n.length>3?2:3;return Jr(hu,{children:[fe(k,{backFn:l?()=>c(!1):e,onClose:t},"header"),!l&&fe(Ue,{children:Jr(Vc,{children:[fe(fa,{}),fe(ha,{})]})}),fe(pe,{children:"Enable your passkeys for verification"}),Jr(oa,{children:[n.slice(0,d).map(u=>Jr(DE,{children:[fe(UE,{children:BE(u)}),Jr(FE,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&fe(K2,{onClick:()=>c(!0),children:"View All"})]}),fe(U,{style:{marginTop:"1.5rem"},onClick:o,loading:a,children:"Enable passkeys"}),n.length<5&&fe(K2,{style:{marginTop:"0.5rem"},onClick:r,disabled:i,children:i?fe(lt,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),fe(j,{})]})},NE=({onClick:e,onClose:t})=>Jr(hu,{children:[fe(k,{onClose:t},"header"),fe(Ue,{children:fe(tt,{status:"success",children:fe(IE,{})})}),fe(pe,{children:"Passkey verification added"}),fe(me,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),fe(Wt,{children:fe(U,{onClick:e,children:"Done"})}),fe(j,{})]}),DE=wd.div`
2235
- && {
2236
- padding: 0.75rem 1rem;
2237
- text-align: left;
2238
- border-radius: 0.5rem;
2239
- border: 1px solid var(--privy-color-foreground-4);
2240
- width: 100%;
2241
- }
2242
- `,UE=wd.div`
2243
- font-size: 0.875rem;
2244
- line-height: 1.375rem;
2245
- font-weight: 500;
2246
-
2247
- color: var(--privy-color-foreground-1);
2248
- `,FE=wd.div`
2249
- font-size: 0.75rem;
2250
- font-weight: 400;
2251
- line-height: 1.125rem;
2252
-
2253
- color: var(--privy-color-foreground-2);
2254
- `,BE=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",K2=wd.button`
2255
- && {
2256
- width: 100%;
2257
- font-size: 0.875rem;
2258
- line-height: 1rem;
2259
-
2260
- /* Tablet and Up */
2261
- @media (min-width: 440px) {
2262
- font-size: 14px;
2263
- }
2264
-
2265
- display: flex;
2266
- gap: 12px;
2267
- justify-content: center;
2268
-
2269
- padding: 0.75rem 1rem;
2270
- background-color: var(--privy-color-background);
2271
- transition: background-color 200ms ease;
2272
- color: var(--privy-color-accent);
2273
-
2274
- :focus {
2275
- outline: none;
2276
- box-shadow: none;
2277
- }
2278
- }
2279
- `;import XE from"@heroicons/react/24/solid/CheckCircleIcon";import Z2 from"@heroicons/react/24/solid/PhoneIcon";import{useState as bd}from"react";import{useState as yu}from"react";import{isMobile as HE}from"react-device-detect";import X2 from"styled-components";import{Fragment as QE,jsx as Ds,jsxs as YE}from"react/jsx-runtime";var Us=6,GE=new Array(Us).fill("");function VE(e){return e.replace(/\s+/g,"")}function gu(e){return/^[0-9]{1}$/.test(e)}function Q2(e){return e.length===Us&&e.every(gu)}function qE(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var wa=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=yu(GE),[i,l]=yu(null),[c,d]=yu(null),u=async w=>{w.preventDefault();let v=VE(w.currentTarget.value);if(v==="")return;let E=qE(n,gu),R=v.split(""),A=!R.every(gu),T=R.length+E>Us;if(A){l("Passcode can only be numbers"),d(1);return}if(T){l("Passcode must be exactly 6 numbers"),d(1);return}l(null),d(null);let P=Number(w.currentTarget.name?.charAt(4)),S=[...v||[""]].slice(0,Us-P),M=[...n.slice(0,P),...S,...n.slice(P+S.length)];a(M);let N=S.length,H=Math.min(Math.max(P+N,0),Us-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),Q2(M))try{await e(M.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(K){d(1),l(K.message)}else try{await e(null)}catch(K){d(1),l(K.message)}},m=w=>{c===1&&(l(null),d(null));let v=[...n.slice(0,w),"",...n.slice(w+1)];a(v),w>0&&document.querySelector(`input[name=pin-${w-1}]`)?.focus(),Q2(v)?e(v.join("")):e(null)},g=o?"success":!!(r||i)?"fail":"";return Ds(QE,{children:YE(zE,{children:[Ds("div",{children:n.map((w,v)=>Ds("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:E=>{E.key==="Backspace"&&m(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:HE?"one-time-code":"off",disabled:t},v))}),Ds("div",{children:Ds(KE,{fail:!!r||!!i,children:r||i})})]})})},zE=X2.div`
2280
- display: flex;
2281
- flex-direction: column;
2282
- width: 100%;
2283
- gap: 8px;
2284
-
2285
- @media (max-width: 440px) {
2286
- margin-top: 8px;
2287
- margin-bottom: 8px;
2288
- }
2289
-
2290
- > div:nth-child(1) {
2291
- display: flex;
2292
- justify-content: center;
2293
- gap: 0.5rem;
2294
- width: 100%;
2295
- border-radius: var(--privy-border-radius-md);
2296
-
2297
- > input {
2298
- border: 1px solid var(--privy-color-foreground-4);
2299
- background: var(--privy-color-background);
2300
- border-radius: var(--privy-border-radius-md);
2301
- padding: 8px 10px;
2302
- height: 58px;
2303
- width: 46px;
2304
- text-align: center;
2305
- font-size: 18px;
2306
- }
2307
-
2308
- > input:disabled {
2309
- /* Use light-theme-bg-2 instead of disabled-bg for consistency with
2310
- the callout bubble */
2311
- background: var(--privy-color-background-2);
2312
- }
2313
-
2314
- > input:focus {
2315
- border: 1px solid var(--privy-color-accent);
2316
- }
2317
-
2318
- > input:invalid {
2319
- border: 1px solid var(--privy-color-error);
2320
- }
2321
-
2322
- > input.success {
2323
- border: 1px solid var(--privy-color-success);
2324
- }
2325
-
2326
- > input.fail {
2327
- border: 1px solid var(--privy-color-error);
2328
- animation: shake 180ms;
2329
- animation-iteration-count: 2;
2330
- }
2331
- }
2332
-
2333
- @keyframes shake {
2334
- 0% {
2335
- transform: translate(1px, 0px);
2336
- }
2337
- 33% {
2338
- transform: translate(-1px, 0px);
2339
- }
2340
- 67% {
2341
- transform: translate(-1px, 0px);
2342
- }
2343
- 100% {
2344
- transform: translate(1px, 0px);
2345
- }
2346
- }
2347
- `,KE=X2.div`
2348
- line-height: 20px;
2349
- font-size: 13px;
2350
- display: flex;
2351
- justify-content: flex-start;
2352
- width: 100%;
2353
-
2354
- color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
2355
- `;import{Fragment as Cu,jsx as qe,jsxs as ba}from"react/jsx-runtime";var J2=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=bd(""),[a,i]=bd(!1),[l,c]=bd(null),[d,u]=bd("enroll"),{initEnrollmentWithSms:m,submitEnrollmentWithSms:h}=co(),{app:g,data:w}=x();function v(){w?.mfaEnrollmentFlow?.onSuccess(),e()}async function E({qualifiedPhoneNumber:T}){try{await m({phoneNumber:T}),n(T),u("verify")}catch(P){c(P)}}async function R(T){try{if(!T)return;await h({phoneNumber:o,mfaCode:T}),i(!0)}catch(P){throw vc(P)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):pa(P)?new Error("The code you entered is not valid"):da(P)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):wc(P)?new Error("Verification canceled"):new Error("Unknown error")}}function A(){d==="verify"?u("enroll"):t()}return l?qe(ma,{error:l,backFn:()=>c(null),onClick:()=>c(null)}):d==="enroll"?ba(Cu,{children:[qe(k,{backFn:t,onClose:r},"header"),qe(Ue,{children:qe(tt,{children:qe(Z2,{})})}),qe(pe,{children:"Set up SMS verification"}),qe(me,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),ba(Gr,{children:[qe(xn,{onSubmit:E,hideRecent:!0}),ba(_h,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),qe(j,{})]}):a?ba(Cu,{children:[qe(k,{onClose:v},"header"),qe(Ue,{children:qe(tt,{status:"success",children:qe(XE,{})})}),qe(pe,{children:"SMS verification added"}),qe(me,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),qe(Wt,{children:qe(U,{onClick:v,children:"Done"})}),qe(j,{})]}):ba(Cu,{children:[qe(k,{backFn:A,onClose:r},"header"),qe(Ue,{children:qe(tt,{children:qe(Z2,{})})}),qe(pe,{children:"Enter enrollment code"}),ba(Gr,{children:[qe(wa,{onChange:R}),ba(me,{children:["To continue, enter the 6-digit code sent to ",qe("strong",{children:f2(o)})]})]}),qe(j,{})]})};import jE from"@heroicons/react/24/solid/CheckCircleIcon";import $E from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import{useState as $2}from"react";import ZE from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as JE}from"react/jsx-runtime";var j2=({size:e,authUrl:t})=>JE(bn,{url:t,squareLogoElement:ZE,size:e,fgColor:"#1F1F1F"});import{Fragment as vu,jsx as Fe,jsxs as Fs}from"react/jsx-runtime";var eC=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,a]=$2("enroll"),[i,l]=$2(!1),{submitEnrollmentWithTotp:c}=co(),{data:d}=x();function u(){d?.mfaEnrollmentFlow?.onSuccess(),e()}function m(){a("verify")}async function h(w){try{if(!w)return;await c({mfaCode:w}),l(!0)}catch(v){throw vc(v)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):pa(v)?new Error("The code you entered is not valid"):da(v)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):wc(v)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?a("enroll"):r()}return n==="enroll"?Fs(vu,{children:[Fe(k,{backFn:r,onClose:t},"header"),Fe(pe,{children:"Scan QR code"}),Fe(me,{children:"Open your authenticator app and scan the QR code to continue."}),Fe(ri,{children:Fe(j2,{authUrl:o.authUrl,size:200})}),Fs(Wt,{children:[Fe(Pt,{children:Fe(wn,{itemName:"secret",text:o.secret})}),Fe(U,{onClick:m,children:"Continue"})]}),Fe(j,{})]}):i?Fs(vu,{children:[Fe(k,{onClose:u},"header"),Fe(Ue,{children:Fe(tt,{status:"success",children:Fe(jE,{})})}),Fe(pe,{children:"Authenticator app verification added"}),Fe(me,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),Fe(Wt,{children:Fe(U,{onClick:u,children:"Done"})}),Fe(j,{})]}):Fs(vu,{children:[Fe(k,{backFn:g,onClose:t},"header"),Fe(Ue,{children:Fe(tt,{children:Fe($E,{})})}),Fe(pe,{children:"Enter enrollment code"}),Fe(Gr,{children:Fe(wa,{onChange:h})}),Fs(me,{children:["To continue, enter the 6-digit code generated from your ",Fe("strong",{children:"authenticator app"})]}),Fe(j,{})]})};import{Fragment as Ii,jsx as $,jsxs as xr}from"react/jsx-runtime";var rC=()=>{let{user:e,enrollInMfa:t}=q(),[r,o]=Mi(null),{unenrollWithSms:n,unenrollWithTotp:a,unenrollWithPasskey:i}=co(),{app:l,ready:c,data:d,onUserCloseViaDialogOrKeybindRef:u}=x(),{closePrivyModal:m}=_(),{promptMfa:h}=Os(),{initEnrollmentWithTotp:g}=co(),[w,v]=Mi(!1),[E,R]=Mi(null),[A,T]=Mi(null),P=()=>{m({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),R(null)},500)},{initEnrollmentWithPasskey:S,submitEnrollmentWithPasskey:M}=co(),[N,H]=Mi(!1),[F,K]=Mi(null);u.current=P;let W=e?.mfaMethods.includes("sms"),X=!!e?.phone,L=e?.mfaMethods.includes("totp"),Y=e?.mfaMethods.includes("passkey"),ke=W||L||Y,be=e?.linkedAccounts.filter(ce=>ce.type==="passkey").map(ce=>ce.credentialId)??[];a9(()=>{ke&&v(!0)},[ke]);function te(){o(null),R(null)}function Q(){v(!1)}async function Re(){H(!0);try{await S(),await M({credentialIds:be})}catch(ce){K(ce)}finally{H(!1)}}async function he(ce){if(await h().catch(K),ce==="totp"){R(ce),T(null),g().then(ht=>{T(ht)}).catch(()=>{T(null),te()});return}if(ce==="passkey"&&be.length===1)return await Re();R(ce)}if(!c||!e||!l)return xr(Ii,{children:[$(k,{onClose:P},"header"),$(Ue,{children:$(q2,{})}),$(Gr,{children:$(lt,{})}),$(j,{})]});async function re(){o(null);try{await n()}catch{o(null)}}async function se(){o(null);try{await a()}catch{o(null)}}async function Xe(){o(null);try{await h(),await i()}catch{o(null)}}if(r==="sms")return xr(Ii,{children:[$(k,{backFn:te,onClose:P},"header"),$(Ue,{children:$(tt,{children:$(o9,{})})}),$(pe,{children:"Remove SMS verification?"}),xr(me,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),$(Wt,{children:$(U,{warn:!0,onClick:re,children:"Remove SMS for MFA"})}),$(j,{})]});if(r==="totp")return xr(Ii,{children:[$(k,{backFn:te,onClose:P},"header"),$(Ue,{children:$(tt,{children:$(t9,{})})}),$(pe,{children:"Remove Authenticator App verification?"}),xr(me,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),$(Wt,{children:$(U,{warn:!0,onClick:se,children:"Remove Authenticator App for MFA"})}),$(j,{})]});if(r==="passkey")return xr(Ii,{children:[$(k,{backFn:te,onClose:P},"header"),$(Ue,{children:$(tt,{children:$(n9,{})})}),$(pe,{children:"Are you sure you want to remove passkey verification?"}),$(me,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),$(Wt,{children:$(U,{warn:!0,onClick:Xe,children:"Yes, remove"})}),$(j,{})]});if(d.mfaEnrollmentFlow.mfaMethods.length===0&&!ke)return xr(Ii,{children:[$(k,{onClose:P},"header"),$(Ue,{children:$(tt,{children:$(tC,{})})}),$(pe,{children:"Add more security"}),xr(me,{children:[l?.name," does not have any verification methods enabled."]}),$(Wt,{children:$(U,{onClick:P,children:"Close"})}),$(j,{})]});let $e=!ke&&!w;return $e?xr(Ii,{children:[$(k,{onClose:P},"header"),$(Ue,{children:$(tt,{children:$(tC,{})})}),$(pe,{children:"Transaction Protection"}),$(me,{children:"Set up transaction protection to add an extra layer of security to your account"}),xr(oa,{children:[xr(lr,{children:[$(sr,{children:$(e9,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),xr(lr,{children:[$(sr,{children:$(r9,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),xr(Wt,{children:[$(U,{onClick:()=>v(!0),children:"Continue"}),$(ro,{onClick:P,children:"Not now"})]}),$(j,{})]}):E==="sms"?$(J2,{onComplete:P,onReset:te,onClose:P}):E==="totp"&&A?$(eC,{onComplete:P,onClose:P,onReset:te,totpInfo:A}):E==="passkey"?$(Y2,{onComplete:P,onReset:te,onClose:P}):$(z2,{showIntro:$e,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:X,onBackToIntro:Q,handleSelectMethod:he,isTotpLoading:E==="totp"&&!A,isPasskeyLoading:N,error:F,onClose:P,setRemovingMfaMethod:o})};import D9 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import U9 from"@heroicons/react/24/outline/FingerPrintIcon";import F9 from"@heroicons/react/24/outline/PhoneIcon";import B9 from"@heroicons/react/24/outline/ShieldCheckIcon";import H9 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import G9 from"@heroicons/react/24/solid/PhoneIcon";import{useEffect as V9,useState as Gs}from"react";import{useMemo as k9,useEffect as R9,useState as TC}from"react";import _9 from"styled-components";import{calculateTotalGasEstimate as M9,populateTransactionRequest as I9}from"@privy-io/js-sdk-core";import EC from"styled-components";import nC from"styled-components";import{jsx as oC,jsxs as l9}from"react/jsx-runtime";var Ed=({label:e,children:t,valueStyles:r})=>l9(i9,{children:[oC("div",{children:e}),oC(s9,{style:{...r},children:t})]}),i9=nC.div`
2356
- display: flex;
2357
- align-items: center;
2358
- justify-content: space-between;
2359
- width: 100%;
2360
-
2361
- > :first-child {
2362
- color: var(--privy-color-foreground-3);
2363
- text-align: left;
2364
- }
2365
-
2366
- > :last-child {
2367
- color: var(--privy-color-foreground-2);
2368
- text-align: right;
2369
- }
2370
- `,s9=nC.div`
2371
- font-size: 14px;
2372
- line-height: 100%;
2373
- display: flex;
2374
- align-items: center;
2375
- justify-content: center;
2376
- border-radius: var(--privy-border-radius-full);
2377
- background-color: var(--privy-color-background-2);
2378
- padding: 4px 8px;
2379
- `;import Sd from"styled-components";import{Fragment as u9,jsx as Td,jsxs as aC}from"react/jsx-runtime";var iC=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=zi(e),n=t?Co(o,t):void 0,a=Tt(o,r);return Td(sC,{children:n||a})},wu=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=zi(e),n=t?Co(o,t):void 0,a=Tt(o,r);return Td(sC,{children:n?aC(u9,{children:[Td(c9,{children:"USD"}),n==="<$0.01"?aC(p9,{children:[Td(d9,{children:"<"}),"$0.01"]}):n]}):a})},sC=Sd.span`
2380
- font-size: 14px;
2381
- line-height: 140%;
2382
- display: flex;
2383
- gap: 4px;
2384
- align-items: center;
2385
- `,c9=Sd.span`
2386
- font-size: 12px;
2387
- line-height: 12px;
2388
- color: var(--privy-color-foreground-3);
2389
- `,d9=Sd.span`
2390
- font-size: 10px;
2391
- `,p9=Sd.span`
2392
- display: flex;
2393
- align-items: center;
2394
- `;import bu from"styled-components";import{QuantityToBigNumber as lC}from"@privy-io/js-sdk-core";import{jsx as In,jsxs as Pd}from"react/jsx-runtime";var cC=({gas:e,tokenPrice:t,tokenSymbol:r})=>Pd(un,{style:{paddingBottom:"12px"},children:[Pd(pC,{children:[In(mC,{children:"Est. Fees"}),In("div",{children:In(wu,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&In(uC,{children:`${Tt(e,r)}`})]}),dC=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=lC(e.value||0).add(lC(t)).toHexString();return Pd(un,{children:[Pd(pC,{children:[In(mC,{children:"Total (including fees)"}),In("div",{children:In(wu,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&In(uC,{children:Tt(n,o)})]})},pC=bu.div`
2395
- display: flex;
2396
- flex-direction: row;
2397
- justify-content: space-between;
2398
- align-items: center;
2399
- padding-top: 4px;
2400
- `,uC=bu.div`
2401
- display: flex;
2402
- flex-direction: row;
2403
- height: 12px;
2404
-
2405
- font-size: 12px;
2406
- line-height: 12px;
2407
- color: var(--privy-color-foreground-3);
2408
- font-weight: 400;
2409
- `,mC=bu.div`
2410
- font-size: 14px;
2411
- line-height: 22.4px;
2412
- font-weight: 400;
2413
- `;import m9 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Ea,useState as f9}from"react";import Wn from"styled-components";import{createContext as fC,useContext as t$}from"react";var Wi=fC(void 0);var Bs=fC(void 0);import{Fragment as E9,jsx as po,jsxs as hC}from"react/jsx-runtime";var yC=({defaultValue:e,children:t})=>{let[r,o]=f9(e||null),n=a=>{o(r===a?null:a)};return po(Wi.Provider,{value:{activePanel:r,togglePanel:n},children:po(h9,{children:t})})},gC=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=Ea(Wi),n=r===e;return po(Bs.Provider,{value:{onToggle:()=>o(e),value:e},children:po(v9,{isActive:n,"data-open":n,children:t})})},CC=({children:e})=>{let{activePanel:t}=Ea(Wi),{onToggle:r,value:o}=Ea(Bs),n=t===o;return hC(E9,{children:[hC(y9,{onClick:r,"data-open":n,children:[po(C9,{children:e}),po(b9,{isactive:n,children:po(m9,{height:"16px",width:"16px",strokeWidth:"2"})})]}),po(g9,{})]})},vC=({children:e})=>{let{activePanel:t}=Ea(Wi),{value:r}=Ea(Bs);return po(w9,{"data-open":t===r,children:po(bC,{children:e})})},wC=({children:e})=>{let{activePanel:t}=Ea(Wi),{value:r}=Ea(Bs);return po(bC,{children:typeof e=="function"?e({isActive:t===r}):e})},h9=Wn.div`
2414
- display: flex;
2415
- flex-direction: column;
2416
- width: 100%;
2417
- gap: 8px;
2418
- `,y9=Wn.div`
2419
- display: flex;
2420
- justify-content: space-between;
2421
- align-items: center;
2422
- width: 100%;
2423
- cursor: pointer;
2424
- padding-bottom: 8px;
2425
- `,g9=Wn.div`
2426
- width: 100%;
2427
-
2428
- && {
2429
- border-top: 1px solid;
2430
- border-color: var(--privy-color-foreground-4);
2431
- }
2432
- padding-bottom: 12px;
2433
- `,C9=Wn.div`
2434
- font-size: 14px;
2435
- font-weight: 500;
2436
- line-height: 19.6px;
2437
- width: 100%;
2438
- padding-right: 8px;
2439
- `,v9=Wn.div`
2440
- display: flex;
2441
- flex-direction: column;
2442
- width: 100%;
2443
- overflow: hidden;
2444
- padding: 12px;
2445
-
2446
- && {
2447
- border: 1px solid;
2448
- border-color: var(--privy-color-foreground-4);
2449
- border-radius: var(--privy-border-radius-md);
2450
- }
2451
- `,w9=Wn.div`
2452
- position: relative;
2453
- overflow: hidden;
2454
- transition: max-height 25ms ease-out;
2455
-
2456
- &[data-open='true'] {
2457
- max-height: 700px;
2458
- }
2459
-
2460
- &[data-open='false'] {
2461
- max-height: 0;
2462
- }
2463
- `,bC=Wn.div`
2464
- display: flex;
2465
- flex-direction: column;
2466
- gap: 12px;
2467
- flex: 1 1 auto;
2468
- min-height: 1px;
2469
- `,b9=Wn.div`
2470
- transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2471
- `;import T9 from"styled-components";import{jsx as P9}from"react/jsx-runtime";var Eu=({walletAddress:e,chainId:t=Fo})=>P9(S9,{href:Fm(t,e),target:"_blank",children:jr(e)}),S9=T9.a`
2472
- &:hover {
2473
- text-decoration: underline;
2474
- }
2475
- `;import{jsx as kr,jsxs as Tu}from"react/jsx-runtime";var Ad=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let l=r?.value||0,c=Be();return kr(yC,{...c.render.standalone?{defaultValue:"details"}:{},children:Tu(gC,{value:"details",children:[kr(CC,{children:Tu(A9,{children:[kr("div",{children:o?.title||o?.actionDescription||"Details"}),kr(x9,{children:kr(iC,{weiQuantities:[l],tokenPrice:n,tokenSymbol:i})})]})}),Tu(vC,{children:[kr(Ed,{label:"From",children:kr(Eu,{walletAddress:e,chainId:r.chainId||Fo})}),kr(Ed,{label:"To",children:kr(Eu,{walletAddress:t,chainId:r.chainId||Fo})}),o&&o.action&&kr(Ed,{label:"Action",children:o.action}),a&&kr(cC,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),kr(wC,{children:({isActive:d})=>kr(dC,{transactionData:r,displayFee:d,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},A9=EC.div`
2476
- display: flex;
2477
- flex-direction: row;
2478
- justify-content: space-between;
2479
- `,x9=EC.div`
2480
- flex-shrink: 0;
2481
- padding-left: 8px;
2482
- `;import{jsx as SC}from"react/jsx-runtime";var Hs=({pendingTransaction:e})=>{let{getAccessToken:t}=q(),{wallets:r}=Ho(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=_(),[c,d]=TC(null),[u,m]=TC(e),{tokenPrice:h}=Io(u),g=l(e.chainId)||"ETH",w=k9(()=>r.find(v=>v.walletClientType==="privy"),[r]);return R9(()=>{async function v(){if(!await t()||!o||!w)return u;let R=Or(u.chainId,a,n,{appId:i}),A=await I9(w.address,u,R),{totalGasEstimate:T}=await M9(A,R);return d(T.toHexString()),A}v().then(m).catch(console.error)},[o]),w?SC(W9,{children:SC(Ad,{from:w.address,to:u.to,txn:u,gas:c??void 0,tokenPrice:h,tokenSymbol:g})}):null},W9=_9.div`
2483
- width: 100%;
2484
- padding: 1rem 0;
2485
- `;import L9 from"@heroicons/react/24/outline/CalendarIcon";import O9 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import N9 from"@heroicons/react/24/outline/ShieldCheckIcon";import{Fragment as PC,jsx as Bt,jsxs as Li}from"react/jsx-runtime";var AC=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:a,submitSuccess:i})=>{let{pendingTransaction:l}=_();return Li(PC,{children:[Bt(k,{onClose:r},"header"),Bt(rt,{children:Li("div",{children:[Bt(st,{success:i,fail:!!t}),t?Bt(O9,{style:{width:"38px",height:"38px"}}):Bt(fa,{style:{width:"38px",height:"38px"}})]})}),Bt(pe,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),Li(oa,{children:[Li(lr,{children:[Bt(sr,{children:Bt(N9,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),Li(lr,{children:[Bt(sr,{children:Bt(L9,{})}),"You last added a passkey on"," ",a?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&Bt(Gr,{children:Bt(Hs,{pendingTransaction:l})}),t&&Li(PC,{children:[Bt(sc,{style:{marginTop:"1.25rem"},children:t.message}),Bt(U,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&Bt(is,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),Bt(j,{})]})};import{Fragment as Su,jsx as we,jsxs as uo}from"react/jsx-runtime";var Pu=({open:e,onClose:t})=>{let{user:r}=q(),[o,n]=Gs(null),{init:a,cancel:i,submit:l}=Os(),[c,d]=Gs(!1),[u,m]=Gs(!1),[h,g]=Gs(null),[w,v]=Gs(null);V9(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?A(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let E=S=>Wp(S)?(d(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):pa(S)?(d(!1),new Error("The code you entered is not valid")):da(S)?(d(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(S),d(!1),new Error("Something went wrong."));async function R(S){v(null);try{if(!S||!o)return;await l(o,S),m(!0),d(!1),t()}catch(M){throw E(M)}}async function A(S){if(S==="passkey"){try{n(S);let M=await a(S);if(!M)throw new Error("something went wrong");g(M),await l(S,M),m(!0),d(!1),t()}catch(M){v(E(M))}return}try{n(S),await a(S)}catch(M){console.error(M)}}let T=()=>{n(null),v(null),i(),t()},P=()=>{n(null),v(null)};if(!e||!r)return null;if(o==="passkey"){let S=r.linkedAccounts.filter(M=>M.type==="passkey"&&M.enrolledInMfa).sort((M,N)=>N.firstVerifiedAt.valueOf()-M.firstVerifiedAt.valueOf())[0];return we(AC,{account:S,selectedMethod:o,submitSuccess:u,hasBlockingError:c,error:w,onClose:T,onBack:P,handleSubmit:()=>R(h).catch(v)})}return o?we(q9,{submitSuccess:u,hasBlockingError:c,handleSubmitCode:R,selectedMethod:o,onClose:T,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):uo(Su,{children:[we(k,{onClose:T},"header"),we(Ue,{children:we(tt,{children:we(B9,{})})}),we(pe,{children:"Verify your identity"}),we(me,{children:"Choose a verification method"}),uo(rc,{children:[r.mfaMethods.includes("totp")&&uo(Te,{onClick:()=>A("totp"),children:[we(D9,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&uo(Te,{onClick:()=>A("sms"),children:[we(F9,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&uo(Te,{onClick:()=>A("passkey"),children:[we(U9,{}),"Passkey"]},"passkey")]}),we(j,{})]})},q9=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:a})=>{let{app:i}=x(),{pendingTransaction:l}=_();switch(e){case"sms":return uo(Su,{children:[we(k,{onClose:o},"header"),we(Ue,{children:we(tt,{children:we(G9,{})})}),we(pe,{children:"Enter verification code"}),uo(Gr,{children:[we(wa,{success:t,disabled:r,onChange:a}),uo(me,{children:["To continue, please enter the 6-digit code sent to your ",we("strong",{children:"mobile device"})]}),l&&we(Hs,{pendingTransaction:l})]}),n&&we(is,{theme:i?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),we(ro,{onClick:o,children:"Not now"}),we(j,{})]});case"totp":return uo(Su,{children:[we(k,{onClose:o},"header"),we(Ue,{children:we(tt,{children:we(H9,{})})}),we(pe,{children:"Enter verification code"}),uo(Gr,{children:[we(wa,{success:t,disabled:r,onChange:a}),uo(me,{children:["To continue, please enter the 6-digit code generated from your"," ",we("strong",{children:"authenticator app"})]}),l&&we(Hs,{pendingTransaction:l})]}),n&&we(is,{theme:i?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),we(ro,{onClick:o,children:"Not now"}),we(j,{})]});default:return null}};import{useEffect as xC,useState as kC}from"react";import z9 from"styled-components";import{Fragment as Y9,jsx as Oo,jsxs as xd}from"react/jsx-runtime";var RC=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=x(),{getAuthMeta:c,initLoginWithOAuth:d,loginWithOAuth:u,updateWallets:m,setReadyToTrue:h,closePrivyModal:g,createAnalyticsEvent:w}=_(),[v,E]=kC(!1),[R,A]=kC(void 0),T=c()?.provider||"google",{name:P,component:S}=Xi(T),M=Oa(),N=Le;xC(()=>{u(T).then(K=>{E(!0),h(!0),K&&M("login","onOAuthLoginComplete",K)}).catch(K=>{if(h(!1),K?.privyErrorCode==="allowlist_rejected"){A(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}if(K?.privyErrorCode==="max_accounts_reached"){console.error(new yo(K).toString()),A(void 0),l(),i("USER_LIMIT_REACHED_SCREEN");return}if(K?.privyErrorCode==="user_does_not_exist"){A(void 0),l(),i("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:W,detail:X}=Jf(K,T);A({retryable:W,detail:X,message:"Authentication failed"})}).finally(()=>{Xn()})},[P,T]),xC(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let W=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},N);return()=>clearTimeout(W)}if(bt(o,n?.embeddedWallets?.createOnLogin)){let W=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:X=>{console.error(X),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:X,provider:T,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},N);return()=>clearTimeout(W)}else{let W=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),N);return m(),()=>clearTimeout(W)}}},[r,e,v,o]);let H=v?`Successfully connected with ${P}`:R?R.message:`Verifying connection to ${P}`,F="";return v?F="You\u2019re good to go!":R?F=R.detail:F="Just a few moments more",xd(Y9,{children:[Oo(k,{}),Oo(oe,{}),xd(K9,{children:[Oo(rt,{children:xd("div",{children:[Oo(st,{success:v,fail:!!R}),Oo(S,{style:{width:"38px",height:"38px"}})]})}),xd(je,{children:[Oo("h3",{children:H}),Oo("p",{children:F})]}),R&&R?.retryable?Oo(dn,{onClick:()=>{Xn(),d(T),A(void 0)},disabled:!v&&!R?.retryable,children:"Retry"}):null]}),Oo(ae,{}),Oo(j,{})]})},K9=z9.div`
2486
- display: flex;
2487
- flex-direction: column;
2488
- align-items: center;
2489
- justify-content: center;
2490
- margin-left: 27px;
2491
- margin-right: 27px;
2492
- gap: 24px;
2493
- `;import{useEffect as Au,useRef as Q9,useState as _C}from"react";import MC from"styled-components";import{Fragment as Z9,jsx as Zo,jsxs as kd}from"react/jsx-runtime";var IC=()=>{let{lastScreen:e,currentScreen:t,navigateBack:r}=x(),{loginWithPasskey:o,closePrivyModal:n}=_(),a=Le,[i,l]=_C("loading"),[c,d]=_C(null),u=Q9([]),m=E=>{u.current=[E,...u.current]};Au(()=>()=>{u.current.forEach(E=>clearTimeout(E)),u.current=[]},[]);let h=()=>{switch(i){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},g=()=>{switch(i){case"loading":return`Please follow prompts to verify your passkey.
2494
- You will have to sign up with another method first to register a passkey for your account.`;case"success":return"You've successfully logged in with your passkey.";case"error":if(c instanceof tr){if(c.privyErrorCode==="cannot_link_more_of_type")return"Cannot link more passkeys to account.";if(c.privyErrorCode==="passkey_not_allowed")return`Passkey request timed out or rejected by user.
2495
- You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
2496
- You will have to sign up with another method first to register a passkey for your account.`}},w=()=>{switch(i){case"loading":case"success":return Zo(U,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return Zo(U,{onClick:v,disabled:!1,children:"Retry"})}},v=async()=>{l("loading");try{await o(),l("success")}catch(E){d(E),l("error")}};return Au(()=>{i==="success"&&m(setTimeout(()=>{n({shouldCallAuthOnSuccess:!0,isSuccess:!0})},a))},[i]),Au(()=>{v()},[]),kd(Z9,{children:[Zo(k,{backFn:!e||t===e?void 0:r}),kd(X9,{children:[Zo(rt,{children:kd("div",{children:[Zo(st,{success:i==="success",fail:i==="error"}),Zo(ha,{style:{width:"38px",height:"38px"}})]})}),kd(je,{children:[Zo("h3",{children:h()}),Zo("p",{style:{whiteSpace:"pre-wrap"},children:g()})]}),w()]}),Zo(j,{})]})},X9=MC.div`
2497
- display: flex;
2498
- flex-direction: column;
2499
- align-items: center;
2500
- justify-content: center;
2501
- gap: 24px;
2502
- width: 100%;
2503
- `,Zee=MC.div`
2504
- display: flex;
2505
- align-items: center;
2506
- justify-content: center;
2507
- width: 180px;
2508
- height: 90px;
2509
- border-radius: 50%;
2510
- svg + svg {
2511
- margin-left: 12px;
2512
- }
2513
- > svg {
2514
- z-index: 2;
2515
- color: var(--privy-color-accent) !important;
2516
- stroke: var(--privy-color-accent) !important;
2517
- fill: var(--privy-color-accent) !important;
2518
- }
2519
- `;import{useEffect as j9,useState as LC}from"react";import $9 from"styled-components";import{isMobile as J9}from"react-device-detect";var WC=(e,t,r)=>{let o=new URL(window.location.href),n=encodeURIComponent(o.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=${r?"solana_adapter":"injected"}&privy_wallet_client=${r?"phantom_solana":"phantom"}`);if(!on()&&J9)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${n}?ref=${n}`};import{Fragment as tT,jsx as Jo,jsxs as OC}from"react/jsx-runtime";var NC=()=>{let{forkSession:e,ready:t,authenticated:r}=q(),{walletConnectionStatus:o}=_(),[n,a]=LC(""),[i,l]=LC(!1);j9(()=>{t&&r&&e().then(a)},[t,r]);let c=o?.connector?.chainType==="solana"||!1,d=WC(n,!i,c),u={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(u.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",u.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(u.title="Still here?",u.description="You may need to install the Phantom mobile app.",u.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),OC(tT,{children:[Jo(k,{},"header"),Jo(oe,{}),Jo(xo,{title:u.title,description:u.description}),OC(dr,{children:[Jo(eT,{children:Jo(To,{style:{width:"72px",height:"72px"}})}),Jo(jl,{href:d,onClick:()=>{setTimeout(()=>l(!0),1e3)},loading:t&&!d,children:i?"Go to App Store":"Continue"}),u.footnote?Jo("p",{children:u.footnote}):null]}),Jo(ae,{}),Jo(B,{})]})},eT=$9(Pt)`
2520
- margin: 16px auto;
2521
- `;import rT from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as oT,useState as Rd}from"react";import _d,{css as nT}from"styled-components";import{Fragment as cT,jsx as Jt,jsxs as Ta}from"react/jsx-runtime";var DC=()=>{let[e,t]=Rd(!0),{authenticated:r,getAccessToken:o}=q(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=_(),{navigate:l,data:c,onUserCloseViaDialogOrKeybindRef:d}=x(),[u,m]=Rd(void 0),[h,g]=Rd(""),[w,v]=Rd(!1),{privyWallet:E,onCompleteNavigateTo:R,onSuccess:A,onFailure:T}=c.recoverWallet,P=(N="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),T(typeof N=="string"?new yr(N):N)};d.current=P,oT(()=>{if(!r||!E)return P("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let S=N=>{N&&m(N)};return Ta(cT,{children:[Jt(k,{onClose:P}),Jt(oe,{}),Ta(iT,{children:[Ta(aT,{children:[Jt(rT,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Jt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),Jt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),Ta("div",{children:[Ta(Cn,{children:[Jt(hi,{type:e?"password":"text",onChange:N=>S(N.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),Jt(yi,{style:{right:"0.75rem"},children:e?Jt(gi,{onClick:()=>t(!1)}):Jt(Ci,{onClick:()=>t(!0)})})]}),!!h&&Jt(sT,{children:h})]}),Ta("div",{children:[Ta(Dh,{children:[Jt("h4",{children:"Why is this necessary?"}),Jt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Jt(lT,{loading:w||!n,disabled:!u,onClick:async()=>{v(!0);let N=await o();if(N&&E&&u!==null)try{i({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:E.address}}),await n?.recover({address:E.address,accessToken:N,recoveryPin:u,recoveryMethod:E.recoveryMethod}),g(""),R?l(R):a({shouldCallAuthOnSuccess:!1}),A?.(E),i({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:E.address}})}catch(H){Sy(H)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return P("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!E&&w,children:"Recover your account"})]})]}),Jt(ae,{}),Jt(B,{})]})},aT=_d.div`
2522
- display: flex;
2523
- flex-direction: column;
2524
- align-items: center;
2525
- justify-content: center;
2526
- margin: 20px 0;
2527
- gap: 4px;
2528
-
2529
- & h3 {
2530
- font-size: 18px;
2531
- font-style: normal;
2532
- font-weight: 600;
2533
- line-height: 24px;
2534
- }
2535
-
2536
- & p {
2537
- max-width: 300px;
2538
- font-size: 14px;
2539
- font-style: normal;
2540
- font-weight: 400;
2541
- line-height: 20px;
2542
- }
2543
- `,iT=_d.div`
2544
- display: flex;
2545
- flex-direction: column;
2546
- justify-content: space-between;
2547
- `,sT=_d.div`
2548
- line-height: 20px;
2549
- height: 20px;
2550
- font-size: 13px;
2551
- color: var(--privy-color-error);
2552
- text-align: left;
2553
- margin-top: 0.5rem;
2554
- `,lT=_d(U)`
2555
- ${e=>e.hideAnimations&&nT`
2556
- && {
2557
- // Remove animations because the recoverWallet task on the iframe partially
2558
- // blocks the renderer, so the animation stutters and doesn't look good
2559
- transition: none;
2560
- }
2561
- `}
2562
- `;import{useCallback as dT,useEffect as GC,useState as xu}from"react";import{jsx as Md,jsxs as UC}from"react/jsx-runtime";var Id=e=>UC("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...e,children:[Md("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),Md("defs",{children:UC("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[Md("stop",{stopColor:"#3E82F4"}),Md("stop",{offset:1,stopColor:"#93DCF7"})]})})]});import{jsx as jo,jsxs as FC}from"react/jsx-runtime";var Wd=({style:e,...t})=>FC("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[FC("g",{clipPath:"url(#clip0_2115_829)",children:[jo("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),jo("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),jo("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),jo("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),jo("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),jo("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),jo("defs",{children:jo("clipPath",{id:"clip0_2115_829",children:jo("rect",{width:"16",height:"14",fill:"white"})})})]});import BC from"styled-components";var Vs=BC.div`
2563
- display: flex;
2564
- flex-direction: column;
2565
- gap: 12px;
2566
- padding-top: 24px;
2567
- padding-bottom: 24px;
2568
- `,HC=BC.div`
2569
- padding-bottom: 24px;
2570
- `;import{Fragment as qC,jsx as Ln,jsxs as Ld}from"react/jsx-runtime";var VC={"google-drive":{name:"Google Drive",component:Wd},icloud:{name:"iCloud",component:Id}},zC=()=>{let{logout:e}=q(),{navigate:t,setModalData:r,data:o}=x(),{recoveryOAuthFlow:n,closePrivyModal:a,createAnalyticsEvent:i}=_(),[l,c]=xu(!1),{provider:d,action:u,isInAccountCreateFlow:m}=o?.recoveryOAuthStatus,[h,g]=xu(void 0),[w,v]=xu(u==="create-wallet");if(d==="user-passcode")throw new Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let E=VC[d].name,R=VC[d].component,A=o?.recoverWallet?.onCompleteNavigateTo,T=new Ge(async(K="create-wallet")=>(v(!0),new Promise((W,X)=>{setTimeout(async()=>{try{let L=window.open();await n(d,K,L),c(!0),W()}catch{g({message:`${K==="recover"?"Recovery":"Back up"} with ${E} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${E} account associated with your backup.`:"",retryable:!0}),X()}},0)})));GC(()=>{u!=="recover"&&T.execute(m?"create-wallet":"set-recovery")},[]),GC(()=>{if(!l)return;let K=setTimeout(()=>{m?(r({createWallet:{onSuccess:()=>{},onFailure:W=>{i({eventName:"embedded_wallet_creation_failure_logout",payload:{error:W,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):a({shouldCallAuthOnSuccess:!1})},Le);return()=>clearTimeout(K)},[l]);let P=dT(async()=>{await T.execute("recover"),A?t(A):c(!0)},[]),S=d==="google-drive"?"Google Drive":"Apple iCloud",M=u==="recover"?"recovered":"backed up",N=u==="recover"?"Recovering":"Backing up",H=l&&`Successfully ${M} with ${S}.`||h&&h.message||`${N} with ${S}...`,F=h?h.detail:"";return Ld(qC,{children:[Ln(k,{}),w?Ln(qC,{children:Ld(Vs,{children:[Ln(ye,{title:H,icon:Ln(R,{style:{width:"38px",height:"38px"}}),description:F}),h&&h?.retryable?Ln(U,{onClick:()=>{Xn(),g(void 0),u==="create-wallet"?T.execute("create-wallet"):P()},disabled:!l&&!h?.retryable,children:"Try again"}):null]})}):Ld(Vs,{children:[Ln(ye,{title:"Confirm it's really you",icon:Ln(R,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${S} where your account is backed up.`}),Ld(U,{onClick:P,children:["Confirm with ",S]})]}),Ln(B,{})]})};import{useEffect as KC,useState as qs}from"react";import{jsx as pT}from"react/jsx-runtime";var YC=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=x(),[n,a]=qs(""),[i,l]=qs(!1),[c,d]=qs(),[u,m]=qs(null),{authenticated:h}=q(),{closePrivyModal:g,isNewUserThisSession:w,initializeWalletProxy:v}=_(),{onSuccess:E,onFailure:R,callAuthOnSuccessOnClose:A}=r.createWallet,{createWallet:T}=Sc(),[P,S]=qs(null),M=new Ge(async()=>{try{let F=await T(c);if(!F)return;S(F),w?t("EMBEDDED_WALLET_CREATED_SCREEN"):(E(F),g({shouldCallAuthOnSuccess:A}))}catch(F){a(F.message)}});KC(()=>{u||v(3e4).then(F=>m(F))},[u]),KC(()=>{if(!h){t("LANDING"),R(new Error("User must be authenticated before creating a Privy wallet"));return}},[h]);let N=()=>{P&&P?.recoveryMethod!=="user-passcode"?(R(new yr("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):P?(E(P),g({shouldCallAuthOnSuccess:A})):(R(new yr("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let H=async()=>{l(!0);let F=250;return M.execute().then(()=>new Promise(K=>setTimeout(K,F))).finally(()=>l(!1))};return pT(kc,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:i,buttonHideAnimations:!P&&i,isResettingPassword:!1,error:n,password:c||"",onClose:N,onPasswordChange:d,onPasswordGenerate:()=>d(xc()),onSubmit:H})};import uT from"@heroicons/react/24/outline/LockClosedIcon";import mT from"@heroicons/react/24/outline/PencilSquareIcon";import fT from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as hT}from"react";import yT from"styled-components";import{Fragment as Ru,jsx as vt,jsxs as On}from"react/jsx-runtime";var ku=yT.div`
2571
- width: 24px;
2572
- height: 24px;
2573
- display: flex;
2574
- justify-content: center;
2575
- align-items: center;
2576
- `,gT={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},CT=({onClose:e})=>On(HC,{children:[vt(ye,{title:"Why do I need to secure my account?",icon:vt(fT,{width:48}),description:On(Ru,{children:[vt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),vt("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It\u2019s important you don\u2019t lose access to the method you choose."})]})}),vt(U,{onClick:e,children:"Select backup method"})]}),QC=()=>{let[e,t]=hT(!1),{navigate:r,lastScreen:o,navigateBack:n,setModalData:a,data:i,onUserCloseViaDialogOrKeybindRef:l}=x(),{user:c}=q(),{embeddedWallets:d}=Be(),{closePrivyModal:u}=_(),m=De(c),h=m===null,{isInAccountCreateFlow:g,isResettingPassword:w}=i.recoverySelection,v=m&&m.recoveryMethod!=="privy",E=v?"Update backup method":"Secure your account",R=v?On("span",{children:["Your account is currently secured using"," ",vt("strong",{children:gT[m?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function A(P){a({recoveryOAuthStatus:{provider:P,action:h?"create-wallet":"set-recovery",isInAccountCreateFlow:g}}),r("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")}function T(){i?.setWalletPassword?.onFailure(new Error("User exited set recovery flow")),u({shouldCallAuthOnSuccess:i?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return l.current=T,On(Ru,{children:[vt(k,{onClose:T,backFn:e?()=>t(!1):o?n:void 0,infoFn:o||e?void 0:()=>t(!0)},"header"),e?vt(CT,{onClose:()=>t(!1)}):On(Ru,{children:[vt(ye,{title:E,icon:vt(uT,{width:48}),description:R}),vt(Vs,{children:d.userOwnedRecoveryOptions.filter(P=>["icloud","google-drive"].includes(m?.recoveryMethod||"")?P!==m?.recoveryMethod:!0).sort().map(P=>{switch(P){case"google-drive":return On(Te,{onClick:()=>A("google-drive"),children:[vt(ku,{children:vt(Wd,{style:{width:18}})}),"Back up to Google Drive"]},P);case"icloud":return On(Te,{onClick:()=>A("icloud"),children:[vt(ku,{children:vt(Id,{style:{width:24}})}),"Back up to Apple iCloud"]},P);case"user-passcode":return On(Te,{onClick:()=>{let S=Lp({isCreatingWallet:h,skipSplashScreen:!0});r(S)},children:[vt(ku,{children:vt(mT,{style:{width:18}})}),w?"Reset your":"Set a"," password"]},P);default:return null}})})]}),vt(B,{})]})};import wT from"@heroicons/react/24/outline/ExclamationTriangleIcon";import bT from"@heroicons/react/24/outline/LockClosedIcon";import{useState as _u}from"react";import vT from"styled-components";var XC=vT.div`
2577
- && {
2578
- border-width: 4px;
2579
- }
2580
-
2581
- display: flex;
2582
- justify-content: center;
2583
- align-items: center;
2584
- padding: 1rem;
2585
- aspect-ratio: 1;
2586
- border-style: solid;
2587
- border-color: ${e=>e.$color??"var(--privy-color-accent)"};
2588
- border-radius: 50%;
2589
- `;import{Fragment as ZC,jsx as fr,jsxs as JC}from"react/jsx-runtime";var jC=()=>{let{user:e,getAccessToken:t}=q(),r=De(e),{walletProxy:o,refreshUser:n,closePrivyModal:a}=_(),i=x(),[l,c]=_u(!1),[d,u]=_u(null),[m,h]=_u(null);function g(){if(!l){if(m){i.data?.setWalletPassword?.onFailure(m),a();return}if(!d){i.data?.setWalletPassword?.onFailure(new Error("User exited set recovery flow")),a();return}}}i.onUserCloseViaDialogOrKeybindRef.current=g;async function w(){c(!0);try{let E=await t();if(!E||!o||!r)return;if(!(await o.setRecovery({recoveryMethod:"privy",address:r.address,accessToken:E})).address)throw new Error("Unable to set recovery on wallet");let A=await n();if(!A)throw new Error("Unable to set recovery on wallet");let T=De(A);if(!T)throw new Error("Unabled to set recovery on wallet");u(!!A),setTimeout(()=>{i.data?.setWalletPassword?.onSuccess(T),a()},Le)}catch(E){h(E)}finally{c(!1)}}let v=!!(l||d);return m?JC(ZC,{children:[fr(k,{onClose:g},"header"),fr(XC,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:fr(wT,{height:38,width:38,stroke:"var(--privy-color-error)"})}),fr(so,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),fr(vr,{style:{minHeight:"2rem"}}),fr(ta,{onClick:()=>h(null),children:"Try again"}),fr(B,{})]}):JC(ZC,{children:[fr(k,{onClose:g},"header"),fr(bT,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),fr(so,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),fr(qr,{style:{marginTop:"1rem"},children:"When you log into a new device, you\u2019ll only need to authenticate to access your account. Never get logged out if you forget your password."}),fr(vr,{style:{minHeight:"2rem"}}),fr(ta,{loading:l,disabled:v,onClick:()=>w(),children:d?"Success":"Confirm"}),fr(B,{})]})};import{useEffect as m3,useMemo as Ou,useState as Aa}from"react";import{ProviderErrors as y3,QuantityToBigNumber as f3}from"@privy-io/js-sdk-core";import{EtherscanProvider as Jre}from"@ethersproject/providers";import{QuantityToBigNumber as ET}from"@privy-io/js-sdk-core";async function Od({accessToken:e,rootWallet:t,transactingWallet:r,walletProxy:o,transactionRequest:n,provider:a,requesterAppId:i}){n=Object.assign({chainId:Fo},n),TT(n);let c=(await o.rpc({address:t.address,hdWalletIndex:r.walletIndex??void 0,accessToken:e,requesterAppId:i,request:{method:"eth_signTransaction",params:[n]}})).response.data;return await a.sendTransaction(c)}async function Nd(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(ET(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function TT(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!ST(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function ST(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&PT(e);return t||r||o}function PT(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Dd(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}var Mu={[Dr.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[Pm.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[go.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[Tm.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[Ur.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[Sm.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[Nr.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[bm.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[ul.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[wm.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[$r.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[vm.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"},$C=(e,t)=>e===Mu[t.id];var Iu=({address:e,appConfig:t,fundWalletConfig:r,methodScreen:o,chainIdOverride:n,comingFromSendTransactionScreen:a=!1})=>{if(!t.fundingConfig||t.fundingConfig.methods.length===0)return;let i;n?i=n:Jc(r)&&r.chain?i=r.chain.id:i=yl(t.fundingConfig.defaultRecommendedCurrency.chain);let l=t.chains.find(h=>h.id===i);if(!l)throw new C(`Funding chain ${i} is not in PrivyProvider chains list`);let c=Jc(r)&&r.amount?r.amount:t.fundingConfig.defaultRecommendedAmount,d,u=!1;function m(){if(!i)return;let h=Mu[i];t.fundingConfig?.methods.includes("external")&&!h&&console.warn("Attempting to fund with USDC on chain where USDC address is not known. Funding via external wallet will be disabled."),d=h,u=!0}return Jc(r)&&"asset"in r?r.asset==="USDC"?m():typeof r.asset!="string"&&"erc20"in r.asset&&(d=r.asset.erc20,u=$C(d,l)):t.fundingConfig.defaultRecommendedCurrency.asset==="USDC"&&m(),{address:e,amount:c,chain:l,erc20Address:d,erc20ContractInfo:u?{symbol:"USDC",decimals:6}:void 0,isUSDC:u,methodScreen:o,comingFromSendTransactionScreen:a,...D1(r)?{moonpayConfigOverride:r.config}:{}}};var Wu=["FUNDING_METHOD_SELECTION_SCREEN","FUNDING_TRANSFER_FROM_WALLET_SCREEN","FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN","FUNDING_MANUAL_TRANSFER_SCREEN","MOONPAY_PROMPT_SCREEN","MOONPAY_STATUS_SCREEN"],e3={["FUNDING_METHOD_SELECTION_SCREEN"]:null,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:"external",["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:"external",["FUNDING_MANUAL_TRANSFER_SCREEN"]:"manual",["MOONPAY_PROMPT_SCREEN"]:"moonpay",["MOONPAY_STATUS_SCREEN"]:"moonpay"},AT={moonpay:"MOONPAY_PROMPT_SCREEN","coinbase-onramp":"COINBASE_ONRAMP_STATUS_SCREEN",external:"FUNDING_TRANSFER_FROM_WALLET_SCREEN"};function Ud({fundingMethods:e}){if(e.length===0)throw new Error("Wallet funding is not enabled");return e.length===1?AT[e[0]]:"FUNDING_METHOD_SELECTION_SCREEN"}import t3 from"styled-components";import{Fragment as IT,jsx as Qe,jsxs as mo}from"react/jsx-runtime";var xT=({transactionIndex:e,maxIndex:t})=>typeof e!="number"||t===0?"":` (${e+1} / ${t+1})`,r3=({img:e,submitError:t,prepareError:r,onClose:o,action:n,amount:a,title:i,subtitle:l,total:c,to:d,network:u,missingFunds:m,fee:h,from:g,cta:w,disabled:v,chain:E,isSubmitting:R,isPreparing:A,isTokenPriceLoading:T,isTokenContractInfoLoading:P,isSponsored:S,symbol:M,balance:N,onClick:H,spender:F,transactionIndex:K,maxIndex:W,onBack:X})=>mo(IT,{children:[Qe(k,{onClose:o,backFn:X}),e&&Qe(MT,{children:e}),mo(so,{style:{marginTop:e?"1.5rem":0},children:[i,Qe(xT,{maxIndex:W,transactionIndex:K})]}),Qe(qr,{children:l}),mo(Uc,{style:{marginTop:"2rem"},children:[c&&mo(Dt,{children:[Qe(Ut,{children:"Total"}),Qe(Kt,{$isLoading:A||T,children:c})]}),n&&n!=="transaction"&&mo(Dt,{children:[Qe(Ut,{children:"Action"}),Qe(Kt,{children:n})]}),a?mo(Dt,{children:[Qe(Ut,{children:"Amount"}),mo(Kt,{$isLoading:P,children:[_T(a)," ",M]})]}):null,F?mo(Dt,{children:[Qe(Ut,{children:"Spender"}),Qe(Kt,{children:Qe(Bo,{address:F,url:E?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,d&&mo(Dt,{children:[Qe(Ut,{children:"To"}),Qe(Kt,{children:Qe(Bo,{address:d,url:E?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),mo(Dt,{children:[Qe(Ut,{children:"Network"}),Qe(Kt,{children:u})]}),S===!1&&mo(Dt,{children:[Qe(Ut,{children:"Estimated fee"}),Qe(Kt,{$isLoading:A||T,children:h})]})]}),Qe(vr,{}),t?Qe(qi,{style:{marginTop:"2rem"},children:t.message}):r?Qe(qi,{style:{marginTop:"2rem"},children:RT}):null,Qe(kT,{$useSmallMargins:!!(r||t),address:g,balance:N,isLoading:A||T,errMsg:!A&&!r&&!t&&m?`Add funds on ${E?.name} to complete transaction.`:void 0}),Qe(U,{style:{marginTop:"1rem"},loading:R,disabled:v||A,onClick:H,children:w}),Qe(B,{})]}),kT=t3(Da)`
2590
- ${e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;"}
2591
- `,RT="There was an error preparing your transaction. Your transaction request will likely fail.",_T=e=>e.toLocaleString(),MT=t3.div`
2592
- display: flex;
2593
- width: 100%;
2594
- justify-content: center;
2595
- max-height: 40px;
2596
-
2597
- > img {
2598
- object-fit: contain;
2599
- border-radius: var(--privy-border-radius-sm);
2600
- }
2601
- `;import LT from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import OT from"@heroicons/react/24/outline/ClipboardDocumentIcon";import NT from"@heroicons/react/24/outline/ExclamationCircleIcon";import{useState as DT}from"react";import Rr from"styled-components";import{ErrorCode as Fd}from"@ethersproject/logger";var WT=new Set([Fd.CALL_EXCEPTION,Fd.NONCE_EXPIRED,Fd.REPLACEMENT_UNDERPRICED,Fd.TRANSACTION_REPLACED]),o3=e=>{let t;return e.code&&e.code!==-32e3&&WT.has(e.code)&&(t=e.transactionHash),t},n3=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";import{Fragment as JT,jsx as Ht,jsxs as Sa}from"react/jsx-runtime";var UT=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=o3(e),o=n3(e);return{errorCode:t,transactionHash:r,errorMessage:o}},FT=()=>Sa(VT,{children:[Ht(zT,{}),Ht(qT,{})]}),l3=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=_(),[a,i]=DT(!1),{errorCode:l,transactionHash:c,errorMessage:d}=UT(e),u=n.find(m=>m.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return Sa(JT,{children:[Ht(k,{onClose:r}),Sa(BT,{children:[Ht(FT,{}),Ht(HT,{children:l}),Ht(GT,{children:"Please try again."}),Sa(i3,{children:[Ht(a3,{children:"Error message"}),Ht(s3,{clickable:!1,children:d})]}),c&&Sa(i3,{children:[Ht(a3,{children:"Transaction hash"}),Sa(YT,{children:["Copy this hash to view details about the transaction on a"," ",Ht("u",{children:Ht("a",{href:u,children:"block explorer"})}),"."]}),Sa(s3,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(c),i(!0)},children:[c,Ht(ZT,{clicked:a})]})]}),Ht(KT,{onClick:()=>o({resetNonce:!!c}),children:"Retry transaction"})]}),Ht(j,{})]})},BT=Rr.div`
2602
- display: flex;
2603
- flex-direction: column;
2604
- align-items: center;
2605
- justify-content: center;
2606
- `,HT=Rr.span`
2607
- color: var(--privy-color-foreground);
2608
- text-align: center;
2609
- font-size: 1.125rem;
2610
- font-weight: 500;
2611
- line-height: 1.25rem; /* 111.111% */
2612
- text-align: center;
2613
- margin: 10px;
2614
- `,GT=Rr.span`
2615
- margin-top: 4px;
2616
- margin-bottom: 10px;
2617
- color: var(--privy-color-foreground-3);
2618
- text-align: center;
2619
-
2620
- font-size: 0.875rem;
2621
- font-style: normal;
2622
- font-weight: 400;
2623
- line-height: 20px; /* 142.857% */
2624
- letter-spacing: -0.008px;
2625
- `,VT=Rr.div`
2626
- position: relative;
2627
- width: 60px;
2628
- height: 60px;
2629
- margin: 10px;
2630
- display: flex;
2631
- justify-content: center;
2632
- align-items: center;
2633
- `,qT=Rr(NT)`
2634
- position: absolute;
2635
- width: 35px;
2636
- height: 35px;
2637
- color: var(--privy-color-error);
2638
- `,zT=Rr.div`
2639
- position: absolute;
2640
- width: 60px;
2641
- height: 60px;
2642
- border-radius: 50%;
2643
- background-color: var(--privy-color-error);
2644
- opacity: 0.1;
2645
- `,KT=Rr(U)`
2646
- && {
2647
- margin-top: 24px;
2648
- }
2649
- transition: color 350ms ease, background-color 350ms ease;
2650
- `,a3=Rr.span`
2651
- width: 100%;
2652
- text-align: left;
2653
- font-size: 0.825rem;
2654
- color: var(--privy-color-foreground);
2655
- padding: 4px;
2656
- `,i3=Rr.div`
2657
- width: 100%;
2658
- margin: 5px;
2659
- display: flex;
2660
- flex-direction: column;
2661
- justify-content: center;
2662
- align-items: center;
2663
- `,YT=Rr.text`
2664
- position: relative;
2665
- width: 100%;
2666
- padding: 5px;
2667
- font-size: 0.8rem;
2668
- color: var(--privy-color-foreground-3);
2669
- text-align: left;
2670
- word-wrap: break-word;
2671
- `,s3=Rr.span`
2672
- position: relative;
2673
- width: 100%;
2674
- background-color: var(--privy-color-background-2);
2675
- padding: 8px 12px;
2676
- border-radius: 10px;
2677
- margin-top: 5px;
2678
- font-size: 14px;
2679
- color: var(--privy-color-foreground-3);
2680
- text-align: left;
2681
- word-wrap: break-word;
2682
- ${e=>e.clickable&&`cursor: pointer;
2683
- transition: background-color 0.3s;
2684
- padding-right: 45px;
2685
-
2686
- &:hover {
2687
- background-color: var(--privy-color-foreground-4);
2688
- }`}
2689
- `,QT=Rr(OT)`
2690
- position: absolute;
2691
- top: 13px;
2692
- right: 13px;
2693
- width: 24px;
2694
- height: 24px;
2695
- `,XT=Rr(LT)`
2696
- position: absolute;
2697
- top: 13px;
2698
- right: 13px;
2699
- width: 24px;
2700
- height: 24px;
2701
- `,ZT=({clicked:e})=>e?Ht(XT,{}):Ht(QT,{});import{BigNumber as Lu}from"@ethersproject/bignumber";import jT from"styled-components";import{Fragment as tS,jsx as Pa,jsxs as rS}from"react/jsx-runtime";var $T=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Lu.from(e.gasUsed),o=Lu.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=Lu.from(t);n=n.add(a)}return n.toString()}catch{return}else return},c3=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i,receiptHeader:l,receiptDescription:c})=>rS(tS,{children:[Pa(k,{onClose:o}),Pa(aa,{title:l??"Transaction complete!",description:c??"You're all set."}),Pa(Ad,{tokenPrice:n,from:t.from,to:t.to,gas:$T(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),Pa(vr,{}),Pa(eS,{loading:!1,onClick:o,children:"All Done"}),Pa(ae,{}),Pa(B,{})]}),eS=jT(U)`
2702
- && {
2703
- margin-top: 24px;
2704
- }
2705
- transition: color 350ms ease, background-color 350ms ease;
2706
- `;import{decodeFunctionData as d3}from"viem";var p3=e=>{let t=nS(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=aS(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}},oS=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],nS=e=>{try{return d3({abi:oS,data:e})}catch{return null}},aS=e=>{try{return d3({abi:bs,data:e})}catch{return null}};import{BigNumber as iS}from"@ethersproject/bignumber";import{useEffect as sS,useState as lS}from"react";import{calculateTotalGasEstimate as cS,populateTransactionRequest as dS}from"@privy-io/js-sdk-core";var u3=(e,t,r)=>{let[o,n]=lS(null),{getAccessToken:a}=q(),{walletProxy:i}=_(),l=async()=>{if(!await a()||!i||!t)return null;let d=[],u=await dS(t.address,e,r).catch(v=>(d.push(v),e)),{totalGasEstimate:m,l1ExecutionFeeEstimate:h}=await cS(u,r).catch(v=>(d.push(v),{totalGasEstimate:null,l1ExecutionFeeEstimate:null})),{balance:g,hasSufficientFunds:w}=await Nd(t.address,u,m??iS.from(0),r).catch(v=>(d.push(v),{balance:null,hasSufficientFunds:!1}));return{tx:u,totalGasEstimate:m,l1ExecutionFeeEstimate:h,balance:g,hasFunds:w,errors:d}};return sS(()=>{o&&n(null),l().then(n)},[e]),o};import{jsx as zs}from"react/jsx-runtime";var h3=new St(new Br("There was an issue preparing your transaction",y3.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),pS=(e,t)=>{if(e?.sendTransaction)return"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]},uS=e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0,g3=()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t,setModalData:r,navigate:o}=x(),{rpcConfig:n,chains:a,closePrivyModal:i,walletProxy:l}=_(),{getAccessToken:c,user:d}=q(),u=Be(),[m,h]=Aa(0),g=uS(e),[w,v]=Aa(pS(e,m)),[E,R]=Aa(null),[A,T]=Aa(),[P,S]=Aa(!1),[M,N]=Aa(null),[H,F]=Aa(null);if(!w||!e?.sendTransaction||!e?.sendTransaction.transactingWallet)return zs(ma,{error:new Error("Invalid transaction request"),onClick:()=>{e?.sendTransaction?.onFailure(h3),i({shouldCallAuthOnSuccess:!1})}});let K=e.sendTransaction.rootWallet,W=e.sendTransaction.transactingWallet,X=Ou(()=>a.find(Pe=>Number(Pe.id)===Number(w.chainId)),[w.chainId]),L=X?.nativeCurrency.symbol??"ETH",{action:Y,amount:ke,spender:be,isErc20Ish:te}=Ou(()=>p3(w.data),[w.data]);m3(()=>{w.to&&X&&te&&Xc({address:w.to,chain:X,rpcConfig:u.rpcConfig,privyAppId:u.id}).then(R).catch(console.error)},[w.to,X]);let{tokenPrice:Q,isTokenPriceLoading:Re}=Io(w),he=Ou(()=>Or(Number(w.chainId),a,n,{appId:u.id}),[w.chainId,n]),re=u3(w,W,he);m3(()=>{e.sendTransaction?.getIsSponsored?e.sendTransaction.getIsSponsored().then(T).catch(console.error):T(!1)},[e.sendTransaction.getIsSponsored]);let se=()=>{if(!P)return M?(e?.sendTransaction?.onSuccess(M.response),i({shouldCallAuthOnSuccess:!1})):!H&&!re?.errors[0]?(e?.sendTransaction?.onFailure(new St(new Br("The user rejected the request",y3.E4001_USER_REJECTED_REQUEST.eipCode))),i({shouldCallAuthOnSuccess:!1})):(e?.sendTransaction?.onFailure(H??re?.errors[0]??h3),i({shouldCallAuthOnSuccess:!1}))};t.current=se;let Xe=async()=>{if(m<g){h(m+1);return}S(!0);try{let Pe=await c();if(P||!Pe||!W||!l||!d)return;let wt=e?.sendTransaction?.onConfirm?await e.sendTransaction.onConfirm():(await Od({accessToken:Pe,transactingWallet:W,rootWallet:K,walletProxy:l,transactionRequest:re?.tx??w,provider:he,requesterAppId:e.sendTransaction?.requesterAppId})).hash,Gt=await he.getTransaction(wt),hr=await Gt.wait();N({receipt:Dd(hr),response:Gt})}catch(Pe){console.warn({transaction:re?.tx??w,error:Pe}),F(Pe)}finally{S(!1)}},$e=!!(u.fundingConfig&&u.fundingConfig.methods.length>0&&e.funding),ce=async()=>{if(!W)return;if(!$e)throw new Error("Funding wallet is not enabled");let Pe=Ud({fundingMethods:u.fundingConfig.methods});r({...e,funding:{...e.funding,methodScreen:Pe}}),o(Pe)},ht=u.embeddedWallets.priceDisplay.primary==="fiat-currency",Mr=f3(re?.tx.value??0).add(f3(re?.totalGasEstimate?.toBigInt()??0)).toHexString(),kt=Tt(Mr,L),it=ht&&Q?Co(Mr,Q):void 0,Se=Tt(re?.totalGasEstimate?.toString()??0,L),I=ht&&Q?Co(re?.totalGasEstimate?.toString()??0,Q):void 0,ie=Tt(re?.balance?.toString()??0,L,void 0,!0),en=ht&&Q?Co(re?.balance?.toString()??0,Q):void 0,G=e.sendTransaction?.uiOptions?.transactionInfo?.title||(Y==="approve"?"Confirm address":`Approve ${Y}`),J=e.sendTransaction?.uiOptions?.description||`${u.name} wants your permission to approve the following transaction.`,Rt=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?zs("img",{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Ce=!!(re&&!re.errors[0]&&!re.hasFunds&&A===!1),ut=Ce&&$e,Di=ut?"Add funds":e.sendTransaction?.uiOptions?.buttonText||(m<g?"Continue":"Approve");return M?.receipt?zs(c3,{txn:re?.tx??w,onClose:se,receipt:M.receipt,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,tokenPrice:Q,tokenSymbol:L,l1GasEstimate:re?.l1ExecutionFeeEstimate?.toString(),receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription}):H?zs(l3,{transactionError:H,chainId:re?.tx.chainId??w.chainId,onClose:se,onRetry:({resetNonce:Pe})=>{F(null);let wt={...re?.tx??w};Pe&&(wt.nonce=void 0),v(wt)}}):zs(r3,{transactionIndex:m,onBack:g!==0&&typeof m=="number"&&m!==0?()=>{h(m-1)}:void 0,maxIndex:g,disabled:Ce&&!$e,isSubmitting:P,submitError:H,isPreparing:!re,isTokenPriceLoading:Re,isTokenContractInfoLoading:!E,prepareError:re?.errors[0],symbol:E?.symbol,chain:X,img:Rt,title:G,subtitle:J,spender:be,total:w.value?it??kt:void 0,fee:I??Se,isSponsored:A,to:w.to,network:u.chains.find(Pe=>Pe.id===w.chainId)?.name??"",from:W?.address??"",cta:Di,missingFunds:Ce,action:Y,balance:en??ie,amount:ke&&E?Dc({amount:ke,decimals:E.decimals}):ke,onClose:se,onClick:ut?ce:Xe})};import{isHexString as fS}from"@ethersproject/bytes";import{toUtf8String as hS}from"@ethersproject/strings";import{useEffect as v3,useState as Ks}from"react";import Oi from"styled-components";import{ProviderErrors as Nu}from"@privy-io/js-sdk-core";import mS from"styled-components";var C3=mS.img`
2707
- && {
2708
- height: ${e=>e.size==="sm"?"65px":"140px"};
2709
- width: ${e=>e.size==="sm"?"65px":"140px"};
2710
- border-radius: 16px;
2711
- margin-bottom: 12px;
2712
- }
2713
- `;import{Fragment as b3,jsx as nt,jsxs as Ys}from"react/jsx-runtime";var yS=e=>{if(!fS(e))return e;try{return hS(e)}catch{return e}},gS=e=>JSON.stringify(e,null,2),CS=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?nt(wS,{children:Object.entries(r).map(([o,n])=>Ys("li",{children:[Ys("strong",{children:[o,":"]})," ",t(n)]},o))}):nt("span",{children:String(r)});return nt("div",{children:t(e)})},vS=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Ys(b3,{children:[nt(Du,{children:nt(CS,{data:o})}),nt(wn,{text:gS(e.typedData),itemName:"full payload to clipboard"})," "]})},w3=()=>{let{authenticated:e}=q(),{initializeWalletProxy:t,closePrivyModal:r}=_(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=x(),[i,l]=Ks(!0),[c,d]=Ks(""),[u,m]=Ks(),[h,g]=Ks(null),[w,v]=Ks(!1),E=h!==null;v3(()=>{e||o("LANDING")},[e]),v3(()=>{t(Wa).then(F=>{l(!1),F||(d("An error has occurred, please try again."),m(new St(new Br(c,Nu.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:R,data:A,confirmAndSign:T,onSuccess:P,onFailure:S,uiOptions:M}=n.signMessage,N={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},H=F=>{F?P(F):S(u||new St(new Br("The user rejected the request.",Nu.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),setTimeout(()=>{g(null),d(""),m(void 0)},200)};return a.current=()=>{H(h)},Ys(b3,{children:[nt(k,{onClose:()=>H(h)}),nt(oe,{}),M.iconUrl&&typeof M.iconUrl=="string"?nt(TS,{children:nt(C3,{size:"sm",src:M.iconUrl,alt:"app image"})}):null,nt(so,{children:N.title}),nt(qr,{children:N.description}),R==="personal_sign"&&nt(Du,{children:yS(A)}),R==="eth_signTypedData_v4"&&nt(vS,{typedData:A}),R==="solana_signMessage"&&nt(Du,{children:A}),nt(SS,{}),nt(bS,{fail:!0,children:c}),nt(ta,{disabled:w||E||i,loading:w,onClick:async()=>{v(!0),d("");try{let F=await T();g(F),v(!1),setTimeout(()=>{H(F)},Le)}catch(F){console.error(F),d("An error has occurred, please try again."),m(new St(new Br(c,Nu.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),v(!1)}},children:w?"Signing...":E?Ys(ES,{children:[nt(vi,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",nt("span",{children:"Success"})]}):N.buttonText}),nt(ae,{}),nt(B,{})]})},Du=Oi.div`
2714
- margin-top: 1.5rem;
2715
- background-color: var(--privy-color-background-2);
2716
- border-radius: var(--privy-border-radius-md);
2717
- padding: 12px;
2718
- text-align: left;
2719
- max-height: 310px;
2720
- overflow: scroll;
2721
- white-space: pre-wrap;
2722
- width: 100%;
2723
-
2724
- // hide the scrollbars
2725
- -ms-overflow-style: none; /* Internet Explorer 10+ */
2726
- scrollbar-width: none; /* Firefox */
2727
-
2728
- &::-webkit-scrollbar {
2729
- display: none; /* Safari and Chrome */
2730
- }
2731
- }
2732
- `,wS=Oi.ul`
2733
- margin-left: 12px !important;
2734
- white-space: nowrap;
2735
-
2736
- &:first-child {
2737
- margin-left: 0 !important;
2738
- }
2739
-
2740
- strong {
2741
- font-weight: 500 !important;
2742
- }
2743
- }
2744
- `,bS=Oi.div`
2745
- line-height: 20px;
2746
- height: 20px;
2747
- font-size: 13px;
2748
- color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
2749
- display: flex;
2750
- justify-content: flex-start;
2751
- width: 100%;
2752
- margin-top: 16px;
2753
- margin-bottom: 4px;
2754
- `,ES=Oi.span`
2755
- display: flex;
2756
- align-items: center;
2757
- gap: 8px;
2758
- `,TS=Oi.div`
2759
- display: flex;
2760
- flex-direction: column;
2761
- justify-content: center;
2762
- align-items: center;
2763
- width: 100%;
2764
- height: 82px;
2765
- `,SS=Oi.div`
2766
- flex-grow: 1;
2767
- `;import{useEffect as E3,useState as T3}from"react";import PS from"styled-components";import{Fragment as xS,jsx as No,jsxs as Bd}from"react/jsx-runtime";var S3=()=>{let{authenticated:e,logout:t,ready:r,user:o}=q(),{app:n,setModalData:a,navigate:i,resetNavigation:l,data:c}=x(),{initLoginWithTelegram:d,loginWithTelegram:u,updateWallets:m,setReadyToTrue:h,closePrivyModal:g,createAnalyticsEvent:w}=_(),[v,E]=T3(!1),[R,A]=T3(void 0),T=Le;async function P(){try{await u(),E(!0),h(!0)}catch(N){if(N?.privyErrorCode==="allowlist_rejected"){A(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}if(N?.privyErrorCode==="max_accounts_reached"){console.error(new yo(N).toString()),A(void 0),l(),i("USER_LIMIT_REACHED_SCREEN");return}if(N?.privyErrorCode==="user_does_not_exist"){A(void 0),l(),i("ACCOUNT_NOT_FOUND_SCREEN");return}let{retryable:H,detail:F}=ip(N);A({retryable:H,detail:F,message:"Authentication failed"})}}E3(()=>{P()},[]),E3(()=>{if(!(r&&e&&v&&o))return;if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let F=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},T);return()=>clearTimeout(F)}if(bt(o,n?.embeddedWallets?.createOnLogin)){let F=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:K=>{console.error(K),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:K,provider:"telegram",screen:"TelegramAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},T);return()=>clearTimeout(F)}m();let H=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),T);return()=>clearTimeout(H)},[r,e,v,o]);let S=v?"Successfully connected with Telegram":R?R.message:"Verifying connection to Telegram",M="";return v?M="You\u2019re good to go!":R?M=R.detail:M="Just a few moments more",Bd(xS,{children:[No(k,{}),No(oe,{}),Bd(AS,{children:[No(rt,{children:Bd("div",{children:[No(st,{success:v,fail:!!R}),No(md,{style:{width:"38px",height:"38px"}})]})}),Bd(je,{children:[No("h3",{children:S}),No("p",{children:M})]}),R&&R?.retryable?No(dn,{onClick:()=>{d(void 0,c?.login?.disableSignup).then(async()=>P()).catch(N=>{let{retryable:H,detail:F}=ip(N);A({retryable:H,detail:F,message:"Authentication failed"})}),A(void 0)},disabled:!v&&!R?.retryable,children:"Retry"}):null]}),No(ae,{}),No(j,{})]})},AS=PS.div`
2768
- display: flex;
2769
- flex-direction: column;
2770
- align-items: center;
2771
- justify-content: center;
2772
- margin-left: 27px;
2773
- margin-right: 27px;
2774
- gap: 24px;
2775
- `;import WS from"@heroicons/react/24/outline/EnvelopeIcon";import kS from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as RS,useState as P3}from"react";import x3 from"styled-components";import{Fragment as IS,jsx as Qs,jsxs as A3}from"react/jsx-runtime";var k3=RS((e,t)=>{let[r,o]=P3(""),[n,a]=P3(!1),{authenticated:i,user:l}=q(),{initUpdateEmail:c}=_(),{navigate:d,setModalData:u,currentScreen:m}=x(),{enabled:h,token:g}=Ee(),w=rl(r),v=n,E=n||!w,R=async T=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await c(l.email.address,r,T),d("AWAITING_PASSWORDLESS_CODE")}catch(P){u({errorModalData:{error:P,previousScreen:m||"LANDING"}})}a(!1)},A=()=>{h&&!g&&!i?(u({captchaModalData:{callback:T=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return c(l.email.address,r,T)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN")):R(g)};return A3(IS,{children:[Qs(_S,{children:A3(MS,{children:[Qs(kS,{}),Qs("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:T=>o(T.target.value),onKeyUp:T=>{T.key==="Enter"&&A()},value:r,autoComplete:"email"}),e.stacked?null:Qs(ei,{isSubmitting:v,onClick:A,disabled:E,children:"Submit"})]})}),e.stacked?Qs(U,{loadingText:null,loading:v,disabled:E,onClick:A,children:"Submit"}):null]})}),_S=x3.div`
2776
- width: 100%;
2777
- `,MS=x3.label`
2778
- display: block;
2779
- position: relative;
2780
- width: 100%;
2781
- background-color: var(--privy-color-background);
2782
- transition: background-color 200ms ease;
2783
-
2784
- > svg {
2785
- position: absolute;
2786
- margin: 13px 17px;
2787
- height: 24px;
2788
- width: 24px;
2789
- color: var(--privy-color-foreground-3);
2790
- }
2791
-
2792
- && > input {
2793
- font-size: 16px;
2794
- line-height: 24px;
2795
-
2796
- padding: 12px 88px 12px 52px;
2797
- flex-grow: 1;
2798
- background: var(--privy-color-background);
2799
- border: 1px solid var(--privy-color-foreground-4);
2800
- border-radius: var(--privy-border-radius-mdlg);
2801
- width: 100%;
2802
-
2803
- /* Tablet and Up */
2804
- @media (min-width: 441px) {
2805
- font-size: 14px;
2806
- padding-right: 78px;
2807
- }
2808
-
2809
- :focus {
2810
- outline: none;
2811
- border-color: var(--privy-color-accent);
2812
- }
2813
-
2814
- :autofill,
2815
- :-webkit-autofill {
2816
- background: var(--privy-color-background);
2817
- }
2818
- }
2819
-
2820
- && > button {
2821
- right: 0;
2822
- line-height: 24px;
2823
- position: absolute;
2824
- padding: 13px 17px;
2825
-
2826
- :focus {
2827
- outline: none;
2828
- border-color: var(--privy-color-accent);
2829
- }
2830
- }
2831
-
2832
- && > input::placeholder {
2833
- color: var(--privy-color-foreground-3);
2834
- }
2835
- `;import{Fragment as LS,jsx as Nn,jsxs as OS}from"react/jsx-runtime";var R3=()=>OS(LS,{children:[Nn(k,{},"header"),Nn(oe,{}),Nn(ye,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:Nn(WS,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Nn(dr,{children:Nn(k3,{stacked:!0})}),Nn(ae,{}),Nn(B,{})]});import NS from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as DS,jsx as Dn,jsxs as US}from"react/jsx-runtime";var _3=()=>{let{currentScreen:e,data:t,navigate:r,setModalData:o}=x(),{user:n}=q(),{initUpdatePhone:a}=_();async function i({qualifiedPhoneNumber:l}){try{if(!n?.phone?.number)throw new Error("User is required to have an phone number to update it.");await a(n?.phone?.number,l),r("AWAITING_PASSWORDLESS_CODE")}catch(c){o({errorModalData:{error:c,previousScreen:t?.errorModalData?.previousScreen||e||"LINK_PHONE_SCREEN"}}),r("ERROR_SCREEN")}}return US(DS,{children:[Dn(k,{},"header"),Dn(oe,{}),Dn(ye,{title:"Update your phone number",description:"Add the phone number you'd like to use going forward. We'll send you a confirmation code",icon:Dn(NS,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Dn(dr,{children:Dn(xn,{stacked:!0,onSubmit:i,hideRecent:!0})}),Dn(ae,{}),Dn(B,{})]})};import Fu from"styled-components";import{jsx as M3}from"react/jsx-runtime";var I3=({style:e,...t})=>M3("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...t,children:M3("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});import{Fragment as GS,jsx as xa,jsxs as Uu}from"react/jsx-runtime";var W3=()=>{let{navigate:e}=x();return Uu(GS,{children:[xa(k,{}),Uu(FS,{children:[xa(BS,{children:xa(I3,{})}),Uu(HS,{children:[xa("h3",{children:"Unable to sign in"}),xa("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),xa(U,{onClick:()=>{e("LANDING")},children:"Go back"})]}),xa(B,{})]})},FS=Fu.div`
2836
- display: flex;
2837
- flex-direction: column;
2838
- align-items: center;
2839
- justify-content: center;
2840
- gap: 24px;
2841
- width: 100%;
2842
- padding-top: 8px;
2843
- padding-bottom: 32px;
2844
- `,BS=Fu.div`
2845
- display: flex;
2846
- align-items: center;
2847
- justify-content: center;
2848
- height: 72px;
2849
- aspect-ratio: 1;
2850
- color: var(--privy-color-error);
2851
- background-color: var(--privy-color-error-light);
2852
- border-radius: 50%;
2853
- `,HS=Fu.div`
2854
- display: flex;
2855
- flex-direction: column;
2856
- gap: 8px;
2857
- `;import qS,{createGlobalStyle as zS}from"styled-components";var VS=`
2858
- *,
2859
- ::before,
2860
- ::after {
2861
- box-sizing: border-box;
2862
- border-width: 0;
2863
- border-style: solid;
2864
- }
2865
-
2866
- line-height: 1.15;
2867
- -webkit-text-size-adjust: 100%;
2868
- -moz-tab-size: 4;
2869
- tab-size: 4;
2870
- font-feature-settings: normal;
2871
-
2872
- margin: 0;
2873
- font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
2874
- 'Apple Color Emoji', 'Segoe UI Emoji';
2875
-
2876
- hr {
2877
- height: 0;
2878
- color: inherit;
2879
- border-top-width: 1px;
2880
- }
2881
-
2882
- abbr:where([title]) {
2883
- text-decoration: underline dotted;
2884
- }
2885
-
2886
- h1,
2887
- h2,
2888
- h3,
2889
- h4,
2890
- h5,
2891
- h6 {
2892
- font-size: inherit;
2893
- font-weight: inherit;
2894
- font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
2895
- 'Apple Color Emoji', 'Segoe UI Emoji';
2896
- display: inline;
2897
- }
2898
-
2899
- a {
2900
- color: inherit;
2901
- text-decoration: inherit;
2902
- }
2903
-
2904
- b,
2905
- strong {
2906
- font-weight: bolder;
2907
- }
2908
-
2909
- code,
2910
- kbd,
2911
- samp,
2912
- pre {
2913
- font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
2914
- font-size: 1em;
2915
- }
2916
-
2917
- small {
2918
- font-size: 80%;
2919
- }
2920
-
2921
- sub,
2922
- sup {
2923
- font-size: 75%;
2924
- line-height: 0;
2925
- position: relative;
2926
- vertical-align: baseline;
2927
- }
2928
-
2929
- sub {
2930
- bottom: -0.25em;
2931
- }
2932
-
2933
- sup {
2934
- top: -0.5em;
2935
- }
2936
-
2937
- table {
2938
- text-indent: 0;
2939
- border-color: inherit;
2940
- border-collapse: collapse;
2941
- }
2942
-
2943
- button,
2944
- input,
2945
- optgroup,
2946
- select,
2947
- textarea {
2948
- font-family: inherit;
2949
- font-size: 100%;
2950
- font-weight: inherit;
2951
- line-height: inherit;
2952
- color: inherit;
2953
- margin: 0;
2954
- padding: 0;
2955
- }
2956
-
2957
- button,
2958
- select {
2959
- text-transform: none;
2960
- }
2961
-
2962
- button,
2963
- [type='button'],
2964
- [type='reset'],
2965
- [type='submit'] {
2966
- -webkit-appearance: button;
2967
- background-color: transparent;
2968
- background-image: none;
2969
- }
2970
-
2971
- ::-moz-focus-inner {
2972
- border-style: none;
2973
- padding: 0;
2974
- }
2975
-
2976
- :-moz-focusring {
2977
- outline: 1px dotted ButtonText;
2978
- }
2979
-
2980
- :-moz-ui-invalid {
2981
- box-shadow: none;
2982
- }
2983
-
2984
- legend {
2985
- padding: 0;
2986
- }
2987
-
2988
- progress {
2989
- vertical-align: baseline;
2990
- }
2991
-
2992
- ::-webkit-inner-spin-button,
2993
- ::-webkit-outer-spin-button {
2994
- height: auto;
2995
- }
2996
-
2997
- [type='search'] {
2998
- -webkit-appearance: textfield;
2999
- outline-offset: -2px;
3000
- }
3001
-
3002
- ::-webkit-search-decoration {
3003
- -webkit-appearance: none;
3004
- }
3005
-
3006
- ::-webkit-file-upload-button {
3007
- -webkit-appearance: button;
3008
- font: inherit;
3009
- }
3010
-
3011
- summary {
3012
- display: list-item;
3013
- }
3014
-
3015
- blockquote,
3016
- dl,
3017
- dd,
3018
- h1,
3019
- h2,
3020
- h3,
3021
- h4,
3022
- h5,
3023
- h6,
3024
- hr,
3025
- figure,
3026
- p,
3027
- pre {
3028
- margin: 0;
3029
- }
3030
-
3031
- fieldset {
3032
- margin: 0;
3033
- padding: 0;
3034
- }
3035
-
3036
- legend {
3037
- padding: 0;
3038
- }
3039
-
3040
- ol,
3041
- ul,
3042
- menu {
3043
- list-style: none;
3044
- margin: 0;
3045
- padding: 0;
3046
- }
3047
-
3048
- textarea {
3049
- resize: vertical;
3050
- }
3051
-
3052
- input::placeholder,
3053
- textarea::placeholder {
3054
- opacity: 1;
3055
- color: #9ca3af;
3056
- }
3057
-
3058
- button,
3059
- [role='button'] {
3060
- cursor: pointer;
3061
- }
3062
-
3063
- :disabled {
3064
- cursor: default;
3065
- }
3066
-
3067
- img,
3068
- svg,
3069
- video,
3070
- canvas,
3071
- audio,
3072
- iframe,
3073
- embed,
3074
- object {
3075
- display: block;
3076
- }
3077
-
3078
- img,
3079
- video {
3080
- max-width: 100%;
3081
- height: auto;
3082
- }
3083
-
3084
- [hidden] {
3085
- display: none;
3086
- }
3087
- `,L3=VS;var O3=zS`
3088
- :root {
3089
- // Borders
3090
- --privy-border-radius-sm: 6px;
3091
- --privy-border-radius-md: 12px;
3092
- --privy-border-radius-mdlg: 16px;
3093
- --privy-border-radius-lg: 24px;
3094
- --privy-border-radius-full: 9999px;
3095
-
3096
- // Colors
3097
- --privy-color-background: ${e=>e.theme.background};
3098
- --privy-color-background-2: ${e=>e.theme.background2};
3099
-
3100
- --privy-color-foreground: ${e=>e.theme.foreground};
3101
- --privy-color-foreground-2: ${e=>e.theme.foreground2};
3102
- --privy-color-foreground-3: ${e=>e.theme.foreground3};
3103
- --privy-color-foreground-4: ${e=>e.theme.foreground4};
3104
- --privy-color-foreground-accent: ${e=>e.theme.foregroundAccent};
3105
-
3106
- --privy-color-accent: ${e=>e.theme.accent};
3107
- --privy-color-accent-light: ${e=>e.theme.accentLight};
3108
- --privy-color-accent-dark: ${e=>e.theme.accentDark};
3109
-
3110
- --privy-color-success: ${e=>e.theme.success};
3111
- --privy-color-success-dark: ${e=>e.theme.successDark};
3112
- --privy-color-success-light: ${e=>e.theme.successLight};
3113
- --privy-color-error: ${e=>e.theme.error};
3114
- --privy-color-error-light: ${e=>e.theme.errorLight};
3115
- --privy-color-warn: ${e=>e.theme.warn};
3116
- --privy-color-warn-light: ${e=>e.theme.warnLight};
3117
-
3118
- // Space
3119
- --privy-height-modal-full: 620px;
3120
- --privy-height-modal-compact: 480px;
3121
- };
3122
- `,Bu=qS.div`
3123
- // css normalize only the privy application to avoid conflicts
3124
- // with consuming application
3125
- ${L3}
3126
-
3127
- // Privy styles
3128
- color: var(--privy-color-foreground-2);
3129
-
3130
- h3 {
3131
- font-size: 16px;
3132
- line-height: 24px;
3133
- font-weight: 500;
3134
- color: var(--privy-color-foreground-2);
3135
- }
3136
-
3137
- h4 {
3138
- font-size: 14px;
3139
- line-height: 20px;
3140
- font-weight: 500;
3141
- color: var(--privy-color-foreground);
3142
- }
3143
-
3144
- p {
3145
- font-size: 13px;
3146
- line-height: 20px;
3147
- color: var(--privy-color-foreground-2);
3148
- }
3149
-
3150
- button:focus,
3151
- input:focus,
3152
- optgroup:focus,
3153
- select:focus,
3154
- textarea:focus {
3155
- outline: none;
3156
- border-color: var(--privy-color-accent-light);
3157
- box-shadow: 0 0 0 1px var(--privy-color-accent-light);
3158
- }
3159
-
3160
- .mobile-only {
3161
- @media (min-width: 441px) {
3162
- display: none;
3163
- }
3164
- }
3165
-
3166
- /* Animations */
3167
-
3168
- @keyframes fadein {
3169
- 0% {
3170
- opacity: 0;
3171
- }
3172
- 100% {
3173
- opacity: 1;
3174
- }
3175
- }
3176
- `;import{Dialog as N3,Transition as Hu}from"@headlessui/react";import Gu from"react";import Xs from"styled-components";import{jsx as Ni,jsxs as ZS}from"react/jsx-runtime";var D3=({children:e,open:t,onClick:r,...o})=>Ni(Hu,{show:t,as:Gu.Fragment,children:ZS(N3,{onClose:r,...o,as:YS,children:[Ni(Hu.Child,{as:Gu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ni(KS,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Ni(QS,{children:Ni(Hu.Child,{as:Gu.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Ni(N3.Panel,{as:XS,children:e})})})]})}),KS=Xs.div`
3177
- position: fixed;
3178
- inset: 0;
3179
-
3180
- transition: backdrop-filter 100ms ease;
3181
- backdrop-filter: blur(3px);
3182
- -webkit-backdrop-filter: blur(3px);
3183
-
3184
- &.entering,
3185
- &.leaving {
3186
- backdrop-filter: unset;
3187
- -webkit-backdrop-filter: unset;
3188
- }
3189
- `,YS=Xs.div`
3190
- position: relative;
3191
- z-index: 999999;
3192
- `,QS=Xs.div`
3193
- position: fixed;
3194
- inset: 0;
3195
- display: flex;
3196
- align-items: center;
3197
- justify-content: center;
3198
- width: 100vw;
3199
- min-height: 100vh;
3200
- `,XS=Xs.div`
3201
- // reset some default dialog styles
3202
- padding: 0;
3203
- background: transparent;
3204
- border: none;
3205
- width: 100%;
3206
- pointer-events: auto;
3207
-
3208
- outline: none;
3209
- display: block;
3210
-
3211
- /*
3212
- * Normally it is bad to mix media queries like this We are doing
3213
- * this here specifically for animations to avoid weird jank.
3214
- */
3215
- /* Mobile animation is a bottom drawer */
3216
- @media (max-width: 440px) {
3217
- opacity: 1;
3218
- transform: translate3d(0, 0, 0);
3219
- transition: transform 200ms ease-in;
3220
- position: fixed;
3221
- bottom: 0;
3222
-
3223
- &.entering,
3224
- &.leaving {
3225
- opacity: 0;
3226
- transform: translate3d(0, 100%, 0);
3227
- transition: transform 150ms ease-in 0ms, opacity 0ms ease 150ms;
3228
- }
3229
- }
3230
-
3231
- /* Tablet/Desktop animation is a fade in */
3232
- @media (min-width: 441px) {
3233
- opacity: 1;
3234
- transition: opacity 100ms ease-in;
3235
-
3236
- &.entering,
3237
- &.leaving {
3238
- opacity: 0;
3239
- transition-delay: 5ms;
3240
- }
3241
-
3242
- margin: auto;
3243
- width: 360px;
3244
- box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3245
- border-radius: var(--privy-border-radius-lg);
3246
- }
3247
- `,U3=Xs.div`
3248
- display: flex;
3249
- flex-direction: column;
3250
- align-items: center;
3251
- justify-content: center;
3252
- height: 100%;
3253
- `;import{Fragment as B3,jsx as dt,jsxs as H3}from"react/jsx-runtime";var eP={["LANDING"]:L2,["CONNECT_OR_CREATE"]:I2,["AWAITING_PASSWORDLESS_CODE"]:qh,["AWAITING_CONNECTION"]:hy,["AWAITING_CONNECT_ONLY_CONNECTION"]:Cy,["AWAITING_FARCASTER_CONNECTION"]:Tg,["AWAITING_FARCASTER_SIGNER"]:Rg,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:IC,["PHANTOM_INTERSTITIAL_SCREEN"]:NC,["LOGIN_FAILED_SCREEN"]:G2,["AWAITING_OAUTH_SCREEN"]:RC,["CROSS_APP_AUTH_SCREEN"]:Ey,["ALLOWLIST_REJECTION_SCREEN"]:Oh,["ACCOUNT_NOT_FOUND_SCREEN"]:Rh,["USER_LIMIT_REACHED_SCREEN"]:W3,["INSTALL_PHANTOM_SCREEN"]:s2,["LINK_EMAIL_SCREEN"]:O2,["LINK_PHONE_SCREEN"]:N2,["LINK_WALLET_SCREEN"]:U2,["LINK_PASSKEY_SCREEN"]:c1,["UPDATE_EMAIL_SCREEN"]:R3,["UPDATE_PHONE_SCREEN"]:_3,["CONNECT_ONLY_LANDING_SCREEN"]:dy,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:ly,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Dy,["EMBEDDED_WALLET_CREATED_SCREEN"]:_y,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:ky,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:DC,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:QC,["EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN"]:jC,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:zC,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Ly,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:w3,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:g3,["FUNDING_METHOD_SELECTION_SCREEN"]:q1,["MOONPAY_PROMPT_SCREEN"]:Z1,["MOONPAY_STATUS_SCREEN"]:j1,["COINBASE_ONRAMP_STATUS_SCREEN"]:M1,["FUNDING_TRANSFER_FROM_WALLET_SCREEN"]:t2,["FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN"]:E1,["FUNDING_MANUAL_TRANSFER_SCREEN"]:z1,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:cg,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:lg,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:YC,["MFA_ENROLLMENT_FLOW_SCREEN"]:rC,["CAPTCHA_SCREEN"]:Qh,["ERROR_SCREEN"]:pg,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:r2,["AFFIRMATIVE_CONSENT_SCREEN"]:Ih,["TELEGRAM_AUTH_SCREEN"]:S3},tP=["LANDING","AWAITING_CONNECTION"],V3=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=q(),{headless:n}=Be(),{ready:a,currentScreen:i}=x(),{status:l,execute:c,reset:d,enabled:u}=Ee(),m=o&&i&&tP.includes(i)&&!n&&l==="ready";if(F3(()=>{m&&c()},[m]),F3(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN"&&i!=="CROSS_APP_AUTH_SCREEN"&&i!=="TELEGRAM_AUTH_SCREEN")return H3(B3,{children:[dt(k,{}),dt(oe,{}),dt(U3,{children:dt(lt,{})}),dt(ae,{}),dt(j,{})]});if(!i&&e)return dt(Pu,{open:e,onClose:t});if(!i)return null;let h=eP[i];return H3(B3,{children:[dt(oo,{if:!!e,children:dt(h,{})}),dt(oo,{if:!e,children:dt(Pu,{open:e,onClose:t})})]})},rP=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let r=jS(null),o=_m(r);return dt(nP,{style:{height:o},id:"privy-modal-content",children:dt("div",{ref:r,children:dt(V3,{isMfaVerifying:e,onMfaVerificationComplete:t})})})},oP=()=>{let{closePrivyModal:e}=_(),{onUserCloseViaDialogOrKeybindRef:t}=x();return{gracefulClosePrivyModal:JS(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Vu=({open:e})=>{let{app:t}=x(),{gracefulClosePrivyModal:r}=oP(),[o,n]=$S(!1);mp({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=e||o;return t.render.standalone?dt(Bu,{children:dt(q3,{id:"privy-modal-content",children:dt(V3,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})}):dt(D3,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:dt(Bu,{children:dt(rP,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})})})},q3=G3.div`
3254
- display: flex;
3255
- flex-direction: column;
3256
- text-align: center;
3257
- font-size: 14px;
3258
- line-height: 20px;
3259
- width: 100%;
3260
- background: var(--privy-color-background);
3261
- padding: 0 16px;
3262
- `,nP=G3(q3)`
3263
- transition: height 150ms ease-out;
3264
- overflow: hidden;
3265
-
3266
- // Ensure the modal gets pinned to the top if it ever gets too tall
3267
- max-height: calc(100svh - 48px);
3268
-
3269
- border-radius: var(--privy-border-radius-lg) var(--privy-border-radius-lg) 0 0;
3270
- box-shadow: 0px 0px 36px rgba(55, 65, 81, 0.15);
3271
-
3272
- @media (min-width: 441px) {
3273
- box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3274
- border-radius: var(--privy-border-radius-lg);
3275
- }
3276
- `;import{useRef as z3,useEffect as aP}from"react";import{jsx as sP}from"react/jsx-runtime";function iP({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:o}=new URL(t);return r.async=!0,r.src=`${o}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}function K3(e){let t=z3(null),r=z3();return aP(()=>{r.current?.remove(),r.current=iP(e),t.current?.after(r.current)},[e]),sP("div",{ref:t,hidden:!0})}import{useState as lP}from"react";import{useEffect as Y3,useRef as Q3}from"react";var Hd=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:create-additional":return o;case"privy:wallet:import":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;case"privy:solana-wallet:create":return o;case"privy:solana-wallet:connect":return o;case"privy:solana-wallet:recover":return o;case"privy:solana-wallet:rpc":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Un(e,t,r,o,n,a=!1){let i=a,l=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new Oe("missing_or_invalid_mfa","MFA verification failed, retry."));let m=await new Promise((h,g)=>{r.current={resolve:h,reject:g};let w=1e3*60*5;setTimeout(()=>{let v=new Oe("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},w)});return await e(m)}return await e()},c=4,d=null;for(let u=0;u<c;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(m){if(m.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),m}if(d===null){let u=new Oe("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}import{jsx as fP}from"react/jsx-runtime";var cP=function(e){return()=>`id-${e++}`}(0);function dP(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function mt(e){return e.error!==void 0}var pt=new Hd,qu=new Map,pP=(e,t)=>typeof t=="bigint"?t.toString():t,uP=(e,t)=>`${e}${JSON.stringify(t,pP)}`;function ft(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=uP(e,t);if(e==="privy:wallet:create"){let l=qu.get(a);if(l)return l}let i=new Promise((l,c)=>{let d=cP();pt.enqueue(d,{resolve:l,reject:c}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{qu.delete(a)});return qu.set(a,i),i}function mP(e){switch(e.event){case"privy:iframe:ready":let t=pt.dequeue(e.event,e.id);return mt(e)?t.reject(new Oe(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=pt.dequeue(e.event,e.id);return mt(e)?r.reject(new Oe(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:create-additional":let o=pt.dequeue(e.event,e.id);return mt(e)?o.reject(new Oe(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:import":let n=pt.dequeue(e.event,e.id);return mt(e)?n.reject(new Oe(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:connect":let a=pt.dequeue(e.event,e.id);return mt(e)?a.reject(new Oe(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:recover":let i=pt.dequeue(e.event,e.id);return mt(e)?i.reject(new Oe(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:rpc":let l=pt.dequeue(e.event,e.id);return mt(e)?l.reject(new Oe(e.error.type,e.error.message)):l.resolve(e.data);case"privy:wallet:set-recovery":let c=pt.dequeue(e.event,e.id);return mt(e)?c.reject(new Oe(e.error.type,e.error.message)):c.resolve(e.data);case"privy:mfa:verify":let d=pt.dequeue(e.event,e.id);return mt(e)?d.reject(new Oe(e.error.type,e.error.message)):d.resolve(e.data);case"privy:mfa:init-enrollment":{let g=pt.dequeue(e.event,e.id);return mt(e)?g.reject(new Oe(e.error.type,e.error.message)):g.resolve(e.data)}case"privy:mfa:submit-enrollment":{let g=pt.dequeue(e.event,e.id);return mt(e)?g.reject(new Oe(e.error.type,e.error.message)):g.resolve(e.data)}case"privy:mfa:unenroll":{let g=pt.dequeue(e.event,e.id);return mt(e)?g.reject(new Oe(e.error.type,e.error.message)):g.resolve(e.data)}case"privy:mfa:clear":{let g=pt.dequeue(e.event,e.id);return mt(e)?g.reject(new Oe(e.error.type,e.error.message)):g.resolve(e.data)}case"privy:farcaster:init-signer":{let g=pt.dequeue(e.event,e.id);return mt(e)?g.reject(new Oe(e.error.type,e.error.message)):g.resolve(e.data)}case"privy:farcaster:sign":{let g=pt.dequeue(e.event,e.id);return mt(e)?g.reject(new Oe(e.error.type,e.error.message)):g.resolve(e.data)}case"privy:solana-wallet:create":let u=pt.dequeue(e.event,e.id);return mt(e)?u.reject(new Oe(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:connect":let m=pt.dequeue(e.event,e.id);return mt(e)?m.reject(new Oe(e.error.type,e.error.message)):m.resolve(e.data);case"privy:solana-wallet:recover":let h=pt.dequeue(e.event,e.id);return mt(e)?h.reject(new Oe(e.error.type,e.error.message)):h.resolve(e.data);case"privy:solana-wallet:rpc":{let g=pt.dequeue(e.event,e.id);return mt(e)?g.reject(new Oe(e.error.type,e.error.message)):g.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function X3(e){let t=Q3(null),r=Q3(e.mfaMethods),o=Oa(),[n,a]=lP(!1);return Y3(()=>{r.current=e.mfaMethods},[e.mfaMethods]),Y3(()=>{if(!n)return;let i=t.current;if(!i)return;function l(h){h&&h.origin===e.origin&&dP(h.data)&&mP(h.data)}let c={create(h){return ft("privy:wallet:create",h,i,e.origin)},createAdditional(h){return ft("privy:wallet:create-additional",h,i,e.origin)},import(h){return ft("privy:wallet:import",h,i,e.origin)},connect(h){return ft("privy:wallet:connect",h,i,e.origin)},recover(h){return Un(g=>ft("privy:wallet:recover",{...h,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!h.recoveryMethod||h.recoveryMethod==="privy")},rpc(h){return Un(g=>ft("privy:wallet:rpc",{...h,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},createSolana(h){return ft("privy:solana-wallet:create",h,i,e.origin)},connectSolana(h){return ft("privy:solana-wallet:connect",h,i,e.origin)},recoverSolana(h){return ft("privy:solana-wallet:recover",h,i,e.origin)},rpcSolana(h){return ft("privy:solana-wallet:rpc",h,i,e.origin)},setRecovery(h){return Un(g=>ft("privy:wallet:set-recovery",{...h,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(h){return Un(g=>ft("privy:mfa:verify",{...h,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(h){return Un(g=>ft("privy:mfa:init-enrollment",{...h,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(h){return Un(g=>ft("privy:mfa:submit-enrollment",{...h,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(h){return Un(g=>ft("privy:mfa:unenroll",{...h,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(h){return ft("privy:mfa:clear",h,i,e.origin)},initFarcasterSigner(h){return ft("privy:farcaster:init-signer",h,i,e.origin)},signFarcasterMessage(h){return ft("privy:farcaster:sign",h,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(c),u=(...h)=>{console.warn("Privy iframe failed to load: ",...h),e.onLoadFailed()},m=new AbortController;return Fi(()=>ft("privy:iframe:ready",{},i,e.origin),{abortSignal:m.signal}).then(d,u),()=>{window.removeEventListener("message",l),m.abort()}},[n]),fP("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:ol(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}var Gd=class{constructor(t,r){this.walletProxy=t,this.address=r}async handleSignMessage(t){if(!t.params||typeof t.params.message!="string")throw new Error("Message must be provided as a string for Solana signMessage RPC");return await J3({message:t.params.message})}async request(t){if(console.debug("EmbeddedSolanaProvider.request() called with args",t),!await ve())throw new Error("User must be authenticated to use embedded Solana wallet");if(!await Z3())throw new C("Unable to connect to Solana embedded wallet");switch(t.method){case"signMessage":return await this.handleSignMessage(t);default:throw new Error("Embedded Solana provider does not yet support this RPC method.")}}};var Vd="popup-privy-oauth",qd="PRIVY_OAUTH_USE_BROADCAST_CHANNEL",hP="privy:";function j3(e){return e.startsWith(hP)}async function $3({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{let i=setTimeout(()=>{n(new C("Authorization request timed out after 2 minutes.")),l()},12e4);function l(){t?.close(),window.removeEventListener("message",u)}let c,d=setInterval(()=>{t?.closed&&!c&&(l(),clearInterval(d),clearTimeout(i),n(new C("User rejected request")))},300);function u(m){m.data&&(m.data.type==="PRIVY_OAUTH_RESPONSE"&&m.data.stateCode&&m.data.authorizationCode&&(clearTimeout(i),o(m.data),l()),m.data.type==="PRIVY_OAUTH_ERROR"&&(clearTimeout(i),n(new C(m.data.error)),l()),m.data.type===qd&&(c=new BroadcastChannel(Vd),c.onmessage=u))}window.addEventListener("message",u)})}var yP="https://cdn.apple-cloudkit.com";async function zu({url:e,popup:t,provider:r}){return t.location=e,new Promise((n,a)=>{function i(){t?.close(),window.removeEventListener("message",l)}function l(c){c.data&&(c.data.type==="PRIVY_OAUTH_RESPONSE"&&c.data.stateCode&&c.data.authorizationCode&&(n(c.data),i()),c.origin===yP&&c.data.ckSession&&(n({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:c.data.ckSession}),i()),c.data.type==="PRIVY_OAUTH_ERROR"&&(a(c.data.error),i()))}window.addEventListener("message",l)})}var e0=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});import{jsx as _r,jsxs as t0}from"react/jsx-runtime";var $o;function TP(e){return typeof e=="string"&&e.length===25}function ve(){if(!$o){let e=Z.get(Gn);return Promise.resolve(e||null)}return $o.getAccessToken()}var r0,oh=(e,t,r)=>r0(e,t,r),o0,nh=(e,t,r)=>o0(e,t,r),n0,ah=(e,t,r,o)=>n0(e,t,r,o),a0,ih=()=>a0(),i0,Z3=()=>i0(),s0,J3=({message:e})=>s0({message:e}),SP=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Z.put(Hi,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},PP=({config:e,...t})=>{if(typeof window<"u"&&["localhost","127.0.0.1"].indexOf(window.location.hostname)<0&&window.location.protocol!=="https:")throw new C("Embedded wallet is only available over HTTPS");if(!TP(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");$o||($o=new rs({appId:t.appId,appClientId:t.clientId,apiUrl:t.apiUrl}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),_r(xm,{client:$o,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:_r(AP,{...t,client:$o})})},AP=e=>{let t=e.client,[r,o]=at(!1),[n,a]=at(!1),[i,l]=at(!1),[c,d]=at(null),[u,m]=at([]),[h,g]=at([]),[w,v]=at(null),E=Ra(u),[R,A]=at(!1),[T,P]=at(null),[S,M]=at(!1),[N,H]=at({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:_t}),[F,K]=at({status:"initial"}),[W,X]=at(null),L=Be(),Y=fl(),[ke,be]=at(!0),[te,Q]=at({}),[Re,he]=at(null),[re,se]=at(null),[Xe,$e]=at(!1),[ce,ht]=at(!1),[Mr,kt]=at(L.customAuth?.enabled?{status:"initial"}:{status:"not-enabled"}),it=Ra(null),Se=Ra(null),I=Ra(Mm),[ie,en]=at(!1);t.onStoreToken=s=>{s&&D(I,"accessToken","onAccessTokenGranted",s)},t.onDeleteToken=()=>{d(null),l(!1),D(I,"accessToken","onAccessTokenRemoved")};let G=Ra(null),J=Ra(null),Rt=Ra(!1),Ce=s=>{P(s),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:s}})},ut=s=>{L.embeddedWallets.createOnLogin!=="off"&&be(!0),Ce(s)};fo(()=>{let s=La(c);if(!s||!W){v(null);return}let p={type:"solana",imported:!1,address:s.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund:()=>{throw new C("Funding is not supported for Solana embedded wallets.")},unlink:()=>{throw new C("Cannot unlink an embedded Solana wallet")},getProvider:async()=>new Gd(W,s.address),signMessage:async()=>{throw new C("Message signing is not supported for Solana embedded wallets.")},sendTransaction:async()=>{throw new C("Transaction sending is not supported for Solana embedded wallets.")},signTransaction:async()=>{throw new C("Transaction signing is not supported for Solana embedded wallets.")},loginOrLink:async()=>{throw new C("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{v(null)},isConnected:async()=>!0};v(p)},[W,c]),fo(()=>{if(!c){t.connectors?.removeEmbeddedWalletConnectors();return}let s=De(c),p=tp(c),f=cl(c);if((!s||!p.length)&&t.connectors?.removeEmbeddedWalletConnectors(),f||t.connectors?.removeImportedWalletConnector(),!t.connectors){console.debug("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!W){console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized");return}s&&t.connectors.addEmbeddedWalletConnectors({walletProxy:W,rootWallet:s,embeddedWallets:p,defaultChain:L.defaultChain,appId:e.appId}),f&&t.connectors.addImportedWalletConnector(W,f.address,L.defaultChain,e.appId)},[W,c]),fo(()=>{W&&re?.(W)},[W]),fo(()=>{(async()=>{if(!L.customAuth?.enabled){kt({status:"not-enabled"});return}be(!0),kt({status:"loading"});let{getCustomAccessToken:p,isLoading:f}=L.customAuth;if(!(!n||f))try{let y=await p();if(!y&&i){await _a.logout(),kt({status:"done"}),D(I,"customAuth","onUnauthenticated");return}if(!y){kt({status:"done"});return}if(i){kt({status:"done"});return}t.startAuthFlow(new Fa(y));let{user:b,isNewUser:O}=await t.authenticate();if(!b){await _a.logout(),kt({status:"error",error:new C("Failed to sync with custom auth provider")}),D(I,"customAuth","onUnauthenticated");return}O!==void 0&&D(I,"login","onComplete",b,O,!1,"custom",null),D(I,"customAuth","onAuthenticated",{user:b}),kt({status:"done"}),d(b||null),A(O||!1),l(!0),ht(!0)}catch(y){throw console.warn(y),i&&(await _a.logout(),D(I,"customAuth","onUnauthenticated")),D(I,"login","onError",y.privyErrorCode||"unknown_auth_error"),kt({status:"error",error:y}),y}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,i]),fo(()=>{ce&&W&&c&&bt(c,L.embeddedWallets.createOnLogin)&&(ht(!1),Kd(c,Wa).catch(console.error))},[ce&&W&&c]),fo(()=>{async function s(){let p=Di(),f=Do();SP();let y=gP();t.initializeConnectorManager({walletConnectCloudProjectId:L.walletConnectCloudProjectId,rpcConfig:L.rpcConfig,chains:L.chains,defaultChain:L.defaultChain,store:y,walletList:L.appearance.walletList,shouldEnforceDefaultChainOnConnect:L.shouldEnforceDefaultChainOnConnect,externalWalletConfig:L.externalWallets,appName:L.name??"Privy"});let b;t.connectors?.on("connectorInitialized",()=>{b&&clearTimeout(b);let V=t.connectors.walletConnectors.length,le=t.connectors.walletConnectors.reduce((de,Ae)=>de+(Ae.initialized?1:0),0);le===V?en(!0):b=setTimeout(()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:le,expected:V}),en(!0)},1500)}),t.connectors?.initialize().then(()=>{jt()});let O=await t.getAuthenticatedUser(),z=!!O;if(L.customAuth?.enabled||(l(!!O),O&&D(I,"login","onComplete",O,!1,!0,null,null),d(O)),p){J.current=z?"link":"login";return}if(f&&!z){J.current="login",ut("TELEGRAM_AUTH_SCREEN");return}ee.setReadyToTrue(!!O)}!n&&Y&&s()},[t,Re,n,Y]),fo(()=>{if(!n)return;if(!c){$e(!0);return}if(!!!c.linkedAccounts.find(f=>f.type==="wallet"&&f.walletClientType==="privy")){$e(!0);return}let p=!!u.find(f=>f.walletClientType==="privy");$e(p)},[n,c,u]);let Di=()=>{let s=Zi();if(s.inProgress&&s.popupFlow){if(window.opener.location.origin!==window.location.origin){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."});return}if(s.authorizationCode==="error"){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:s.stateCode,authorizationCode:s.authorizationCode});return}return s.inProgress&&j3(s.provider)&&!s.popupFlow&&(new BroadcastChannel(Vd).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:s.stateCode,authorizationCode:s.authorizationCode}),window.close()),!s.inProgress||s.headless?!1:(t.startAuthFlow(new vo(s)),ut("AWAITING_OAUTH_SCREEN"),!0)},Do=()=>{let s=eh();if(!s||!L.loginMethods.telegram||!L.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let p=new Va;return t.startAuthFlow(p),s.flowType==="login-url"&&(p.meta.telegramWebAppData=void 0,p.meta.telegramAuthResult={id:s.id,first_name:s.first_name,last_name:s.last_name,auth_date:s.auth_date,username:s.username,photo_url:s.photo_url,hash:s.hash}),s.flowType==="web-app"&&(p.meta.telegramAuthResult=void 0,p.meta.telegramWebAppData={query_id:s.query_id,user:s.user,auth_date:s.auth_date,hash:s.hash,chat_instance:s.chat_instance,chat_type:s.chat_type,start_param:s.start_param}),!0},Pe=async(s,p,f,y)=>{let b=await t.connectors?.createEthereumWalletConnector(s,p)||null;wt(b,p,f,y)};async function wt(s,p,f,y){if(s)H({status:"disconnected",connectedWallet:null,connectError:null,connector:s,connectRetry:_t});else return H({status:"disconnected",connectedWallet:null,connectError:new Me("Unable to connect to wallet."),connector:null,connectRetry:_t}),y?.(null,f);s instanceof to&&p&&await s.resetConnection(p),H({connector:s,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>wt(s,p,f,y)});try{let b=await s.connect({showPrompt:!0});if((!b||eo(b))&&L.shouldEnforceDefaultChainOnConnect&&!L.chains.find(O=>O.id===Number(b?.chainId.replace("eip155:","")))&&!(b?.connectorType==="wallet_connect_v2"&&b?.walletClientType==="metamask")){H(O=>({...O,connector:s,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:_t}));try{await b?.switchChain(L.defaultChain.id),b&&(b.chainId=Ia(Hn(L.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${L.defaultChain.id}`)}}return H(O=>({...O,status:"connected",connectedWallet:b,connectError:null,connectRetry:_t})),b&&D(I,"connectWallet","onSuccess",b),y?.(b,f)}catch(b){return b instanceof tr?(console.warn(b.cause?b.cause:b.message),D(I,"connectWallet","onError",b.privyErrorCode||"generic_connect_wallet_error")):(console.warn(b),D(I,"connectWallet","onError","unknown_connect_wallet_error")),H(O=>({...O,status:"disconnected",connectedWallet:null,connectError:b})),y?.(null,f)}}let Gt=async(s,p,f)=>{if(s===null||!eo(s))return;let y=new Go(s,t,p,f);t.startAuthFlow(y)},hr=async(s,p)=>{if(s===null||!sp(s))return;let f=new Jn(s,t,p);t.startAuthFlow(f)},jt=()=>{let s=new URLSearchParams(window.location.search),p=s.get("privy_connector"),f=s.get("privy_wallet_client");if(!p||!f)return;if(f==="phantom"&&!on()&&ut("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");Ce("AWAITING_CONNECTION");let y=new URL(window.location.href);y.searchParams.delete("privy_connector"),y.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",y),Pe(p,f,void 0,Gt)};fo(()=>{n&&i&&c===null&&t.getAuthenticatedUser().then(d)},[n,i,c,t]);let We=s=>{if(!i)throw D(I,"linkAccount","onError","must_be_authenticated",{linkMethod:s}),new C("User must be authenticated before linking an account.")},Fn=()=>{We("siwe"),G.current="siwe",J.current="link",Ce("LINK_WALLET_SCREEN")},tn=s=>{if(!i||!c)return!1;if(s.walletClientType==="privy")return!0;for(let p of c.linkedAccounts)if(p.type==="wallet"&&p.address===s.address&&p.walletClientType!=="privy")return!0;return!1},Ze=async s=>{if(!t.connectors)throw new C("Connector not initialized");let p;if(s.type==="ethereum"?p=t.connectors.findWalletConnector(s.connectorType,s.walletClientType)||null:p=t.connectors.findSolanaWalletConnector(s.connectorType,s.walletClientType)||null,H(f=>({...f,connector:p,status:"connected",connectedWallet:s,connectError:null,connectRetry:_t})),L.captchaEnabled&&!i){let f={callback:y=>eo(s)?Gt(s,y):hr(s,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};Q({captchaModalData:f}),ut("CAPTCHA_SCREEN")}else eo(s)?await Gt(s):await hr(s),ut("AWAITING_CONNECTION")},zd=async(s,p)=>{let{signedUrl:f,externalTransactionId:y}=await U1(t,s,p??{},L.appearance.palette,L.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:f,externalTransactionId:y}},Zs=()=>{m(s=>{let p=t.connectors?.wallets.filter(eo).map(f=>({...f,linked:tn(f),loginOrLink:async()=>{if(!await f.isConnected())throw new C("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");Ze(f)},fund:async y=>{await ee.fundWallet(f.address,y)},unlink:async()=>{if(!i)throw new C("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let y=await t.unlinkEthereumWallet(f.address);d(y)}}))||[];return ji(s,p)?s:p}),g(s=>{let p=t.connectors?.wallets.filter(sp).map(f=>({...f,linked:tn(f),loginOrLink:async()=>{if(!await f.isConnected())throw new C("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");Ze(f)},fund:async y=>{throw new C("Funding not supported for Solana wallets")},unlink:async()=>{if(!i)throw new C("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let y=await t.unlinkSolanaWallet(f.address);d(y)}}))||[];return ji(s,p)?s:p})};fo(()=>{Zs()},[c?.linkedAccounts,i,n]),fo(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");Zs(),t.connectors.on("walletsUpdated",Zs)}},[n]);let m0=s=>{s&&"target"in s&&s&&(s=void 0),Q({externalConnectWallet:{walletList:s?.walletList&&s?.walletList.length>0?s.walletList:void 0,suggestedAddress:s?.suggestedAddress}}),Ce(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};fo(()=>{if(!u[0])return;let s=u[0],p=E.current.find(y=>y.address===s.address),f;if(s.walletClientType==="privy"?f=c?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===s.address&&y.walletClientType==="privy"):f=c?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===s.address&&y.walletClientType!=="privy"),!p&&f){let y=Object.assign({},c);y.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType,imported:f.imported,walletIndex:f.walletIndex},d(y)}E.current=u},[u]);let Kd=async(s,p,f)=>{let y=De(s);if(y&&!f?.createAdditional)throw D(I,"createWallet","onError","embedded_wallet_already_exists"),new Error("User already has an embedded wallet.");let[b,O]=await Promise.all([ee.initializeWalletProxy(p),ve()]);if(!b&&L.customAuth?.enabled)throw D(I,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!b||!O||L.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((z,V)=>{be(!0),Q({createWallet:{onSuccess:de=>{D(I,"createWallet","onSuccess",de),z(de)},onFailure:de=>{D(I,"createWallet","onError","unknown_embedded_wallet_error"),V(de)},callAuthOnSuccessOnClose:!1}}),Ce("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{if(!y)await b.create({accessToken:O});else{let le=tp(s),Ae=(le?.length?Math.max(...le.map(_e=>_e.walletIndex)):y.walletIndex)+1;await ee.recoverEmbeddedEthereumWallet(),await b.createAdditional({accessToken:O,primaryWalletAddress:y?.address,hdWalletIndex:Ae})}let z=await ee.refreshUser(),V=De(z);if(!V)throw D(I,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return D(I,"createWallet","onSuccess",V),V}},f0=s=>{if(!L.chains.map(p=>p.id).includes(s))throw new Me(`Chain ID ${s} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Yu=(s,p,f,y)=>new Promise(async(b,O)=>{let{requesterAppId:z}=p||{};if(!i||!c){D(I,"sendTransaction","onError","must_be_authenticated"),O(new Error("User must be authenticated before signing with a Privy wallet"));return}let V=y??De(c)?.address;if(!V)throw new C("User must have an embedded wallet to send a transaction.");let{signingWallet:le,rootWallet:de}=dl(c,V);if(!de||!le){D(I,"sendTransaction","onError","embedded_wallet_not_found"),O(new Error("Must have a Privy wallet before signing"));return}be(!0);let Ae=Zu.wallets.find(er=>er.walletClientType==="privy"&&ka(er.address)===ka(le.address)),_e=await Ae?.getEthereumProvider();if(!Ae||!_e)throw new C(`Cannot sendTransaction before embedded wallet ${le.address} is connected`);let rn=s.chainId?Number(s.chainId):yl(Ae.chainId);f0(rn);let Ir=Object.assign({},s,{chainId:rn}),Wr=async()=>{let er=await ve();if(!er||!W){D(I,"sendTransaction","onError","embedded_wallet_not_found"),O(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ee.recoverEmbeddedEthereumWallet()){D(I,"sendTransaction","onError","unknown_connect_wallet_error"),O(new Error("Unable to connect to wallet"));return}let Ma=Or(Ir.chainId,L.chains,L.rpcConfig,{appId:e.appId}),ho=await EP(le.address,Ir,Ma);if(L.embeddedWallets.noPromptOnSignature||Rt.current){let{totalGasEstimate:h0}=await bP(ho,Ma),{hasSufficientFunds:y0}=await Nd(le.address,ho,h0,Ma);if(!y0)throw new St(new Br("Wallet has insufficient funds for this transaction.",wP.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Ju=await Od({accessToken:er,rootWallet:de,transactingWallet:le,walletProxy:W,transactionRequest:ho,provider:Ma,requesterAppId:z});D(I,"sendTransaction","onSuccess",Ju),b(Ju)}catch($s){D(I,"sendTransaction","onError","transaction_failure"),O($s)}};if(L.embeddedWallets.noPromptOnSignature||Rt.current)p&&L.embeddedWallets.noPromptOnSignature&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Wr();else{let er={transactionRequest:Ir,transactingWallet:le,rootWallet:de,onSuccess:ho=>{D(I,"sendTransaction","onSuccess",ho),b(ho)},onFailure:ho=>{D(I,"sendTransaction","onError","transaction_failure"),O(ho)},uiOptions:p||{},fundWalletConfig:f,requesterAppId:z},$s={address:de.address,onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:ho=>{D(I,"sendTransaction","onError","unknown_connect_wallet_error"),O(ho)}},Ma=Iu({address:le.address,appConfig:L,fundWalletConfig:f,chainIdOverride:Ir.chainId,comingFromSendTransactionScreen:!0});Q({connectWallet:$s,sendTransaction:er,funding:Ma}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Qu(){return new Promise(async(s,p)=>{let f=await ve();if(!f||!W)throw new Error("Must have valid access token to enroll in MFA");try{await W.verifyMfa({accessToken:f}),s()}catch(y){p(y)}})}let Js=s=>s?.linkedAccounts.filter(p=>p.latestVerifiedAt!==null&&!(p.type==="wallet"&&p.walletClientType==="privy")).sort((p,f)=>f.latestVerifiedAt.getTime()-p.latestVerifiedAt.getTime())[0],$t=s=>{let p=c?.linkedAccounts.filter(b=>b.type===s).length??0,{displayName:f,loginMethod:y}=An(s);if(s==="passkey"&&p>=5||s!=="passkey"&&p>=1)throw D(I,"linkAccount","onError","cannot_link_more_of_type",{linkMethod:y}),new C(`User already has an account of type ${f} linked.`)};async function Xu({showAutomaticRecovery:s=!1,legacySetWalletPasswordFlow:p=!1}){P(null);let f=p?"setWalletPassword":"setWalletRecovery";if(!i||!c)throw D(I,f,"onError","must_be_authenticated"),new Error("User must be authenticated before adding recovery method to Privy wallet");let y=De(c);if(!y||!W)throw D(I,f,"onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a recovery method");if(La(c))throw new Error("Cannot set user-controlled recovery for user with Solana.");try{await Qu()}catch(O){throw D(I,f,"onError","missing_or_invalid_mfa"),O}return new Promise((O,z)=>{be(!0);let V={onSuccess:_e=>{D(I,f,"onSuccess","user-passcode",_e),O(_e)},onFailure:_e=>{D(I,f,"onError","user_exited_set_password_flow"),z(_e)},callAuthOnSuccessOnClose:!1},le=y.recoveryMethod==="user-passcode",Ae={onCompleteNavigateTo:bc({walletAction:"update",availableRecoveryMethods:L.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:p,isResettingPassword:le,showAutomaticRecovery:s}),shouldForceMFA:!1,onFailure:_e=>{D(I,f,"onError","unknown_connect_wallet_error"),z(_e)}};Q({setWalletPassword:V,createWallet:V,connectWallet:Ae,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:le}}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")})}async function js({appId:s,action:p}){let f=await ve();if(p==="link"&&!f)throw D(I,"linkAccount","onError","must_be_authenticated",{linkMethod:`privy:${s}`}),new C("User must be authenticated before linking an account.");if(p==="login"&&f)throw D(I,"login","onError","unknown_auth_error"),new C("Attempted to log in, but user is already logged in. Use a `link` helper instead.");G.current=`privy:${s}`,J.current=p;let y=window.open(void 0,void 0,ks({w:440,h:680}));return t.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:s}}),new Promise(async(b,O)=>{let{name:z,logoUrl:V}=await Yc({api:t.api,providerAppId:s,requesterAppId:L.id});Q({crossAppAuth:{appId:s,name:z,logoUrl:V,action:p,popup:y,onSuccess:b,onError:O}}),ut("CROSS_APP_AUTH_SCREEN")})}let _a={ready:n,authenticated:i,user:c,walletConnectors:t.connectors||null,connectWallet:m0,importWallet:async({privateKey:s})=>{We("siwe");let[p,f]=await Promise.all([ee.initializeWalletProxy(15e3),ve()]);if(p&&f){await p.import({privateKey:s,accessToken:f});let y=await ee.refreshUser(),b=cl(y);if(!b)throw D(I,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to import wallet");return D(I,"createWallet","onSuccess",b),b}else throw new C("User is not authenticated")},linkWallet:Fn,startCrossAppAuthFlow:js,linkEmail:()=>{We("email"),$t("email"),G.current="email",J.current="link",Ce("LINK_EMAIL_SCREEN")},linkPhone:()=>{We("sms"),$t("phone"),G.current="sms",J.current="link",Ce("LINK_PHONE_SCREEN")},linkGoogle:async()=>{We("google"),$t("google_oauth"),J.current="link",await ee.initLoginWithOAuth("google")},linkTwitter:async()=>{We("twitter"),$t("twitter_oauth"),J.current="link",await ee.initLoginWithOAuth("twitter")},linkDiscord:async()=>{We("discord"),$t("discord_oauth"),J.current="link",await ee.initLoginWithOAuth("discord")},linkGithub:async()=>{We("github"),$t("github_oauth"),J.current="link",await ee.initLoginWithOAuth("github")},linkSpotify:async()=>{We("spotify"),$t("spotify_oauth"),J.current="link",await ee.initLoginWithOAuth("spotify")},linkInstagram:async()=>{We("instagram"),$t("instagram_oauth"),J.current="link",await ee.initLoginWithOAuth("instagram")},linkTiktok:async()=>{We("tiktok"),$t("tiktok_oauth"),J.current="link",await ee.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{We("linkedin"),$t("linkedin_oauth"),J.current="link",await ee.initLoginWithOAuth("linkedin")},linkApple:async()=>{We("apple"),$t("apple_oauth"),J.current="link",await ee.initLoginWithOAuth("apple")},linkPasskey:async()=>{We("passkey"),$t("passkey"),await ee.initLinkWithPasskey(),Ce("LINK_PASSKEY_SCREEN")},linkTelegram:async()=>{We("telegram"),$t("telegram"),J.current="link",G.current="telegram",await ee.initLoginWithTelegram(),Ce("TELEGRAM_AUTH_SCREEN")},linkFarcaster:async()=>{We("farcaster"),$t("farcaster"),await ee.initLoginWithFarcaster(),J.current="link",G.current="farcaster",Ce("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(We("email"),!c?.email)throw new C("User does not have an email linked to their account.");J.current="link",G.current="email",Ce("UPDATE_EMAIL_SCREEN")},updatePhone:()=>{if(We("sms"),!c?.phone)throw new C("User does not have a phone number linked to their account.");J.current="link",G.current="sms",Ce("UPDATE_PHONE_SCREEN")},login:async s=>{s&&"target"in s&&s&&(s=void 0);let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let f=await new Promise(y=>{he(b=>y.bind(b))});if(he(null),f){console.warn(p);return}}if(c&&!c.isGuest){console.warn(p);return}J.current="login",Q({login:s}),ut("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(s=>{he(()=>s)}),he(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}ut("CONNECT_OR_CREATE")},logout:async()=>{if(c&&t.clearProviderAcccessTokens(c),P(null),await t.logout(),c&&W)try{await W.clearMfa({userId:c.id})}catch{}d(null),l(!1),D(I,"logout","onSuccess"),J.current=null,G.current=null,o(!1),Z.del(Gi),Z.del(sl(L.id))},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!c||!c.wallet)return new et;let s=u.find(f=>c.wallet&&f.address===c.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(y=>y.address===s?.address));return!s||!p?new et:p.proxyProvider},getEthersProvider:()=>{if(!c||!c.wallet)return new Ku(new bo(new et));let s=u.find(f=>c.wallet&&f.address===c.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(y=>y.address===s?.address));return!s||!p?new Ku(new bo(new et)):new Ku(new bo(p.proxyProvider))},getWeb3jsProvider:()=>{if(!c||!c.wallet)return new ln(new et);let s=u.find(f=>c.wallet&&f.address===c.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(y=>y.address===s?.address));return!s||!p?new ln(new et):new ln(p.proxyProvider)},unlinkWallet:async s=>{let p;return s.startsWith("0x")?p=await t.unlinkEthereumWallet(s):p=await t.unlinkSolanaWallet(s),d(p),p},unlinkEmail:async s=>{let p=await t.unlinkEmail(s);return d(p),p},unlinkPhone:async s=>{let p=await t.unlinkPhone(s);return d(p),p},unlinkGoogle:async s=>{let p=await t.unlinkOAuth("google",s);return d(p),p},unlinkTwitter:async s=>{let p=await t.unlinkOAuth("twitter",s);return d(p),p},unlinkDiscord:async s=>{let p=await t.unlinkOAuth("discord",s);return d(p),p},unlinkGithub:async s=>{let p=await t.unlinkOAuth("github",s);return d(p),p},unlinkSpotify:async s=>{let p=await t.unlinkOAuth("spotify",s);return d(p),p},unlinkInstagram:async s=>{let p=await t.unlinkOAuth("instagram",s);return d(p),p},unlinkTiktok:async s=>{let p=await t.unlinkOAuth("tiktok",s);return d(p),p},unlinkLinkedIn:async s=>{let p=await t.unlinkOAuth("linkedin",s);return d(p),p},unlinkApple:async s=>{let p=await t.unlinkOAuth("apple",s);return d(p),p},unlinkFarcaster:async s=>{let p=await t.unlinkFarcaster(s);return d(p),p},unlinkTelegram:async s=>{let p=await t.unlinkTelegram(s);return d(p),p},unlinkPasskey:async s=>{let p=await t.unlinkPasskey(s);return d(p),p},unlinkCrossAppAccount:async({subject:s})=>{let p=c?.linkedAccounts.find(y=>y.type==="cross_app"&&y.subject===s)?.providerApp;if(!p)throw new C("Invalid subject");t.storeProviderAccessToken(p.id,null);let f=await t.unlinkOAuth(`privy:${p.id}`,s);return d(f),f},setActiveWallet:async s=>{let p=u.find(y=>ka(y.address)===ka(s)),f=c?.linkedAccounts.find(y=>y.type==="wallet"&&ka(y.address)===ka(s));if(!p||!await p.isConnected())Q({externalConnectWallet:{suggestedAddress:s}}),Fn();else if(!p.linked)p.loginOrLink();else{let y=Object.assign({},c);y.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType,imported:f.imported,walletIndex:f.walletIndex},d(y)}},forkSession:()=>t.forkSession(),createWallet:async s=>{if(s&&"target"in s&&s&&(s=void 0),!i||!c)throw D(I,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Kd(c,15e3,s)},setWalletRecovery:async s=>Xu({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:s?.showAutomaticRecovery??!1}),setWalletPassword:async()=>Xu({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(s,p,f)=>new Promise(async(y,b)=>{let{requesterAppId:O}=p||{};if(!i||!c){D(I,"signMessage","onError","must_be_authenticated"),b(new Error("User must be authenticated before signing with a Privy wallet"));return}let z=f??De(c)?.address;if(!z)throw new C("User must have an embedded wallet to sign a message.");let{signingWallet:V,rootWallet:le}=dl(c,z);if(!V||!le){D(I,"signMessage","onError","embedded_wallet_not_found"),b(new Error("Must have a Privy wallet before signing"));return}if(typeof s!="string"||s.length<1){D(I,"signMessage","onError","invalid_message"),b(new Error("Message must be a non-empty string"));return}be(!0);let de=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let Ae=await ve();if(!W||!Ae)throw new Error("Unable to connect to wallet");if(!await ee.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:V.address,requesterAppId:O}});let{response:rn}=await W.rpc({accessToken:Ae,address:le.address,hdWalletIndex:V.walletIndex??void 0,requesterAppId:O,request:{method:"personal_sign",params:[s,V.address]}}),Ir=rn.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:V.address,requesterAppId:O}}),Ir};if(L.embeddedWallets.noPromptOnSignature||Rt.current){p&&L.embeddedWallets.noPromptOnSignature&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Ae=await de();D(I,"signMessage","onSuccess",Ae),y(Ae)}catch(Ae){D(I,"signMessage","onError","unable_to_sign"),b(Ae??new St("Unable to sign message"))}}else{let rn={method:"personal_sign",data:s,confirmAndSign:de,onSuccess:Wr=>{D(I,"signMessage","onSuccess",Wr),y(Wr)},onFailure:Wr=>{D(I,"signMessage","onError","unable_to_sign"),b(Wr)},uiOptions:p||{}},Ir={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Wr=>{D(I,"signMessage","onError","unknown_connect_wallet_error"),b(Wr)},address:le.address};Q({signMessage:rn,connectWallet:Ir}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(s,p,f)=>new Promise(async(y,b)=>{let{requesterAppId:O}=p||{};if(!i||!c){D(I,"signTypedData","onError","must_be_authenticated"),b(new Error("User must be authenticated before signing with a Privy wallet"));return}let z=f??De(c)?.address;if(!z)throw new C("User must have an embedded wallet to sign a message.");let{signingWallet:V,rootWallet:le}=dl(c,z);if(!le||!V){D(I,"signTypedData","onError","embedded_wallet_not_found"),b(new Error("Must have a Privy wallet before signing"));return}be(!0);let de=Bi(s),Ae=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let _e=await ve();if(!W||!_e)throw new Error("Unable to connect to wallet");if(!await ee.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:V.address,requesterAppId:O}});let{response:Ir}=await W.rpc({accessToken:_e,address:le.address,hdWalletIndex:V.walletIndex??void 0,requesterAppId:O,request:{method:"eth_signTypedData_v4",params:[V.address,de]}}),Wr=Ir.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:V.address,requesterAppId:O}}),Wr};if(Rt.current||L.embeddedWallets.noPromptOnSignature||(L.legacyWalletUiConfig??!1)){p&&L.embeddedWallets.noPromptOnSignature&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let _e=await Ae();D(I,"signTypedData","onSuccess",_e),y(_e)}catch(_e){D(I,"signTypedData","onError","unable_to_sign"),b(_e??new St("Unable to sign message"))}}else{let Ir={method:"eth_signTypedData_v4",data:de,confirmAndSign:Ae,onSuccess:er=>{D(I,"signTypedData","onSuccess",er),y(er)},onFailure:er=>{D(I,"signTypedData","onError","unable_to_sign"),b(er)},uiOptions:p||{}},Wr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:er=>{D(I,"signMessage","onError","unknown_connect_wallet_error"),b(er)}};Q({signMessage:Ir,connectWallet:Wr}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(s,p,f,y)=>{let O=await(await Yu(s,p,f,y)).wait();return Dd(O)},exportWallet:s=>new Promise(async(p,f)=>{if(!i||!c){f(new Error("User must be authenticated before exporting their Privy wallet"));return}s&&"target"in s&&s&&(s=void 0);let y=s?.address,b=c.linkedAccounts.filter(de=>de.type==="wallet"&&de.walletClientType==="privy"&&de.chainType==="ethereum"),O=y?b.find(de=>de.address===ka(y)):b.find(de=>!de.imported)||b[0];if(!O){f(new Error("Must have a Privy wallet before exporting"));return}be(!0);let z={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:f,address:O.address,shouldForceMFA:!0};if(Q(te),!await ve()||!W){f(new Error("Must have valid access token to enroll in MFA"));return}if(!W){f(new Error("Must have a Privy wallet before exporting"));return}let le={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,wallet:O,onSuccess:p,onFailure:f};Q({keyExport:le,connectWallet:z}),Ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Qu,async init(s){switch(s){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${s}`)}},async submit(s,p){switch(s){case"totp":case"sms":if(typeof p!="string")throw new C("Invalid MFA code");it.current?.resolve({mfaMethod:s,mfaCode:p,relyingParty:window.origin}),await new Promise((O,z)=>{Se.current={resolve:O,reject:z}});break;case"passkey":if(typeof p=="string")throw new C("Invalid authenticator response");let y=await(await import("@simplewebauthn/browser")).startAuthentication(p),b=e0(y);it.current?.resolve({mfaMethod:s,mfaCode:b,relyingParty:window.origin}),await new Promise((O,z)=>{Se.current={resolve:O,reject:z}});break;default:throw it.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${s}`)}},cancel(){it.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(s){let p=await ve();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:s.phoneNumber})},enrollInMfa(s){return new Promise((p,f)=>{if(!s){ee.closePrivyModal(),p();return}L.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),Q({mfaEnrollmentFlow:{mfaMethods:L.mfa.methods,onSuccess:p,onFailure:f}}),Ce("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let s=await ve();if(!s||!W)throw new Error("Must have valid access token to enroll in MFA");let p=await W.initEnrollMfa({method:"totp",accessToken:s});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(s){let p=await ve();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:s.phoneNumber,code:s.mfaCode});let f=await t.getAuthenticatedUser();d(f)},async submitEnrollmentWithTotp(s){let p=await ve();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"totp",accessToken:p,code:s.mfaCode});let f=await t.getAuthenticatedUser();d(f)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:s}){let p=await ve();if(!p||!W)throw new Error("Must have valid access token to enroll in MFA");await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:s});let f=await t.getAuthenticatedUser();d(f)},async unenroll(s){let p=await ve();if(!p||!W)throw new Error("Must have valid access token to remove MFA");s==="passkey"?await W.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await W.unenrollMfa({method:s,accessToken:p});let f=await t.getAuthenticatedUser();d(f)},requestFarcasterSignerFromWarpcast:async()=>{let s=await ve(),p=c?.linkedAccounts.find(b=>b.type==="wallet"&&b.walletClientType==="privy");if(!s)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!c?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ee.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");let y=await W.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:s,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(y.status==="approved"){let b=await t.getAuthenticatedUser();d(b||c||null)}Q({farcasterSigner:y}),Ce("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let s=await ve(),p=c?.linkedAccounts.find(b=>b.type==="wallet"&&b.walletClientType==="privy");if(!s)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!c?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ee.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!c.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(b=>Uint8Array.from(b.match(/.{1,2}/g).map(O=>parseInt(O,16))))(c.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async s=>{let p=await ve(),f=c?.linkedAccounts.find(z=>z.type==="wallet"&&z.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!c?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ee.recoverEmbeddedEthereumWallet())throw new Error("Unable to connect to wallet");if(!c.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let b=await import("@simplewebauthn/browser"),O=await W.signFarcasterMessage({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:b.bufferToBase64URLString(s)},fid:BigInt(c.farcaster.fid),relyingParty:window.origin});return new Uint8Array(b.base64URLStringToBuffer(O.signature))},createGuestAccount:async()=>{if(c&&!c.isGuest)throw new Error("User cannot already be authenticated to create a guest account");return c?.isGuest?c:ee.loginWithGuestAccountFlow()},isHeadlessOAuthLoading:S,loginWithCode(s){return ee.loginWithCode(s)},initLoginWithEmail(s){return ee.initLoginWithEmail(s)},initLoginWithSms(s){return ee.initLoginWithSms(s)},otpState:F,fundWallet(s,p){return ee.fundWallet(s,p)},initLoginWithHeadlessOAuth(s,p){return ee.initLoginWithHeadlessOAuth(s,p)},loginWithHeadlessOAuth(s){return ee.loginWithHeadlessOAuth(s)},generateSiweMessage({address:s,chainId:p}){return ee.generateSiweMessage({address:s,chainId:p})},linkWithSiwe({message:s,signature:p,chainId:f,walletClientType:y,connectorType:b}){return We("siwe"),ee.linkWithSiwe({message:s,signature:p,chainId:f,walletClientType:y,connectorType:b})},signMessageWithCrossAppWallet(s,{address:p}){return Qc({user:c,client:t,address:p,requesterAppId:L.id,request:{method:"personal_sign",params:[s,p]},reconnect:js})},signTypedDataWithCrossAppWallet(s,{address:p}){let f=Bi(s);return Qc({user:c,client:t,address:p,requesterAppId:L.id,request:{method:"eth_signTypedData_v4",params:[p,f]},reconnect:js})},sendTransactionWithCrossAppWallet(s,{address:p}){return Qc({user:c,client:t,address:p,requesterAppId:L.id,request:{method:"eth_sendTransaction",params:[s]},reconnect:js})},isModalOpen:r,mfaMethods:L.mfa.methods};r0=_a.signMessage,o0=_a.signTypedData,n0=async(...s)=>{let p=await Yu(...s);return L.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let ee=(()=>({isNewUserThisSession:R,pendingTransaction:null,walletConnectionStatus:N,connectors:t.connectors?.walletConnectors??[],solanaWallets:h,rpcConfig:L.rpcConfig,chains:L.chains,appId:e.appId,showFiatPrices:L.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,customAuthStatus:Mr,noPromptOnSignature:Rt,nativeTokenSymbolForChainId:s=>L.chains.find(p=>p.id===Number(s))?.nativeCurrency.symbol,initializeWalletProxy:async s=>{if(W)return W;let p=new Promise(b=>{se(()=>O=>b(O))}),f=new Promise(b=>setTimeout(()=>b(null),s)),y=await Promise.race([p,f]);return se(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,client:t,closePrivyModal:async(s={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&c,f;p&&G.current&&(f=Js(c)),J.current==="login"?s.shouldCallAuthOnSuccess&&p&&G.current?(D(I,"login","onComplete",c,R,!1,G.current,f??null),e.onSuccess?.(c,R)):D(I,"login","onError","exited_auth_flow"):J.current==="link"&&f&&(s.isSuccess&&p&&G.current?D(I,"linkAccount","onSuccess",c,G.current,f):G.current&&D(I,"linkAccount","onError","exited_link_flow",{linkMethod:G.current}));let y=T&&Wu.includes(T),b=T==="ERROR_SCREEN"&&te.errorModalData&&Wu.includes(te.errorModalData.previousScreen);if((y||b)&&te.funding){let O=e3[T]??null,z=Or(te.funding.chain.id,L.chains,L.rpcConfig,{appId:e.appId}),V;try{V=(await z.getBalance(te.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}D(I,"fundWallet","onUserExited",{address:te.funding.address,chain:te.funding.chain,fundingMethod:O,balance:V})}Q({...te,externalConnectWallet:{suggestedAddress:void 0}}),J.current=null,G.current=null,A(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},solanaSignMessage:async({message:s})=>new Promise(async(p,f)=>{let y=async()=>{let b=await t.getAccessToken();if(!b)throw new Error("User must be authenticated to use their embedded wallet.");if(!w)throw new Error("User must have an embedded Solana wallet to sign messages for Solana.");let O=ee.walletProxy??await ee.initializeWalletProxy(15e3);if(!O)throw new Error("Failed to initialize embedded wallet proxy.");let{response:z}=await O.rpcSolana({accessToken:b,publicKey:w.address,request:{method:"signMessage",params:{message:s}}});return z.data.signature};if(L.embeddedWallets.noPromptOnSignature||Rt.current)try{let b=await y();p({signature:b})}catch(b){f(b)}else Q({signMessage:{method:"solana_signMessage",data:s,confirmAndSign:y,onSuccess:V=>{p({signature:V})},onFailure:V=>{f(V)},uiOptions:{}}}),ut("EMBEDDED_WALLET_SIGN_REQUEST_SCREEN")}),openPrivyModal:Ce,connectWallet:wt,initLoginWithWallet:async(s,p,f)=>{eo(s)?(G.current="siwe",Gt(s,p,f)):(G.current="siws",hr(s,p))},loginWithWallet:async()=>{if(!n)throw new Bn;let s;if(t.authFlow instanceof Go?s="siwe":t.authFlow instanceof Jn&&(s="siws"),!s)throw new C("Must initialize SIWE/SIWS flow first.");let p=await t.getAccessToken(),f,y;if(p!==null)try{({user:f}=await t.link()),G.current=s}catch(b){throw D(I,"linkAccount","onError",b.privyErrorCode||"failed_to_link_account",{linkMethod:s}),b}else try{({user:f,isNewUser:y}=await t.authenticate()),G.current=s}catch(b){throw D(I,"login","onError",b.privyErrorCode||"generic_connect_wallet_error"),b}d(f||c||null),A(y||!1),l(!0)},initLoginWithFarcaster:async(s,p)=>{let f=new Ki(s,p);t.startAuthFlow(f);try{G.current="farcaster",await f.initializeFarcasterConnect()}catch(y){throw J.current==="login"?D(I,"login","onError",y.privyErrorCode||"unknown_auth_error"):J.current==="link"&&D(I,"linkAccount","onError",y.privyErrorCode||"unknown_auth_error",{linkMethod:"farcaster"}),y}},loginWithFarcaster:async()=>{if(!n)throw new Bn;if(!(t.authFlow instanceof Ki))throw new C("Must initialize Farcaster flow first.");let s=await t.getAccessToken(),p,f;if(s!==null)try{({user:p}=await t.link()),G.current="farcaster"}catch(y){throw D(I,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account",{linkMethod:"farcaster"}),y}else try{({user:p,isNewUser:f}=await t.authenticate()),G.current="farcaster"}catch(y){throw D(I,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}d(p||null),A(f||!1),l(!0)},async loginWithGuestAccountFlow(){let s=new Ba(this.appId);t.startAuthFlow(s);try{J.current="login",G.current="guest";let p=await t.authenticate(),{user:f,isNewUser:y}=p;if(y=y||!1,!f)throw new C("Unable to authenticate guest account");if(bt(f,L.embeddedWallets.createOnLogin))try{await Kd(f,15e3),f=await ee.refreshUser()}catch{d(f),console.warn("Unable to create embedded wallet for guest account")}else d(f);return A(y),l(!0),D(I,"login","onComplete",f,y,!1,"guest",null),f}catch(p){throw D(I,"login","onError",p.privyErrorCode||"unknown_auth_error"),p}},async crossAppAuthFlow({appId:s,popup:p,action:f}){let y=`privy:${s}`;G.current=y;let{url:b,stateCode:O,codeVerifier:z}=await T1({api:t.api,appId:s});if(!b)throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:s}}),new C("No authorization URL returned for cross-app auth.");try{let V=await $3({url:b,popup:p,provider:y}),le=V.stateCode,de=V.authorizationCode;if(le!==O)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:y,storedStateCode:O??"",returnedStateCode:le??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let Ae=await S1({appId:s,codeVerifier:z,stateCode:le,authorizationCode:de,action:f,client:t});Ae&&t.storeProviderAccessToken(s,Ae);let _e=await ee.refreshUser();if(!_e)throw new C("Unable to update user");return t.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:s}}),_e}catch(V){throw t.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:V.toString(),provider:y}}),V}},async initLoginWithOAuth(s,p,f){if(G.current=s,Ui()){if(s==="google"&&si(window.navigator.userAgent)){ut("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{ut("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}s==="twitter"&&window.opener&&window.opener.postMessage({type:qd},"*"),Z.del(zn),Z.del(Kn);let y=new vo({provider:s,disableSignup:!!f});p&&y.addCaptchaToken(p),t.startAuthFlow(y);let b=await t.authFlow.getAuthorizationUrl();b&&b.url&&(s==="twitter"&&vP&&(b.url=b.url.replace("x.com","twitter.com")),window.location.assign(b.url))},async initLoginWithTelegram(s,p){if(!n)throw new Bn;G.current="telegram";let f=new Va(s,p);t.startAuthFlow(f),f.meta.telegramWebAppData=void 0,f.meta.telegramAuthResult=await new Promise((y,b)=>{if(!L.loginConfig.telegramAuthConfiguration)return b(new C("Telegram Auth configuration is not loaded"));if(!window.Telegram)return b(new C("Telegram was not initialized"));window.Telegram.Login.auth({bot_id:L.loginConfig.telegramAuthConfiguration.botId,request_access:!0},O=>O?y(O):b(new C("Telegram auth failed or was canceled by the client")))})},async loginWithTelegram(){if(!(t.authFlow instanceof Va))throw new C("Must initialize Telegram flow before calling loginWithTelegram");let s,p;if(J.current==="login")try{let f=await t.authenticate();s=f.user,p=f.isNewUser,G.current="telegram"}catch(f){throw D(I,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}else if(J.current==="link")try{s=(await t.link()).user,G.current="telegram"}catch(f){throw D(I,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account",{linkMethod:"telegram"}),f}else throw new C("Unknown auth intent");d(s),A(p||!1),l(!0)},async recoveryOAuthFlow(s,p,f){let y,b;function O(z){if(!z)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:s}}),new C("Recovery OAuth failed")}switch(s){case"google-drive":{let{url:z,codeVerifier:V,stateCode:le}=await Op({api:$o.api,provider:s});O(z);let de,Ae;try{let _e=await zu({url:z,popup:f,provider:s});if(de=_e.stateCode,Ae=_e.authorizationCode,de!==le)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:s,storedStateCode:le??"",returnedStateCode:de??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected")}catch(_e){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:_e.toString(),provider:s}}),new C("Recovery OAuth failed")}[y,b]=await Promise.all([ve(),Py({api:$o.api,provider:s,codeVerifier:V,stateCode:de,authorizationCode:Ae})]);break}case"icloud":{let{url:z}=await Op({api:$o.api,provider:s});O(z);let{ckWebAuthToken:V}=await zu({url:z,popup:f,provider:s});b=V,y=await ve();break}}if(!W)throw new C("Cannot connect to wallet proxy");if(!y)throw new C("Unable to authorize user");switch(p){case"recover":let z=te.recoverWallet?.privyWallet?.address;if(!z)throw new C("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:z,recoveryMethod:s}}),await W.recover({address:z,accessToken:y,recoveryAccessToken:b,recoveryMethod:s}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:z,recoveryMethod:s}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await W.create({accessToken:y,recoveryAccessToken:b,recoveryMethod:s});let V=await ee.refreshUser(),le=De(V);if(!le)throw D(I,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:le.address}}),D(I,"createWallet","onSuccess",le);break;case"set-recovery":let de=De(c);if(!de)throw D(I,"setWalletRecovery","onError","embedded_wallet_not_found"),new Error("Embedded wallet not found");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:de.address,existingRecoveryMethod:de.recoveryMethod,targetRecoveryMethod:s}}),await W.setRecovery({address:de.address,accessToken:y,recoveryAccessToken:b,recoveryMethod:s});let Ae=De(await ee.refreshUser());if(!Ae)throw D(I,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to set recovery on wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:de.address,existingRecoveryMethod:de.recoveryMethod,targetRecoveryMethod:s}}),D(I,"setWalletRecovery","onSuccess",s,Ae);break;default:throw new C("Unsupported recovery action")}},async loginWithOAuth(s){if(!(t.authFlow instanceof vo))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let p=Z.get(Vn),f=t.authFlow.meta.stateCode;if(p!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:s,storedStateCode:p??"",returnedStateCode:f??""}}),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let y=await t.getAccessToken(),b,O,z;if(y!==null)try{let V=await t.link();b=V.user,z=V.oAuthTokens,G.current=s}catch(V){throw D(I,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account",{linkMethod:s}),V}else try{let V=await t.authenticate();b=V.user,O=V.isNewUser,z=V.oAuthTokens,G.current=s}catch(V){throw J.current==="login"?D(I,"login","onError",V.privyErrorCode||"unknown_auth_error"):J.current==="link"&&D(I,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account",{linkMethod:s}),V}return d(b),A(O||!1),l(!0),z&&b&&D(I,"oAuthAuthorization","onOAuthTokenGrant",z,{user:b}),z},async initLoginWithPasskey(s){let p=new Zn(s);t.startAuthFlow(p),J.current="login";try{G.current="passkey",await p.initAuthenticationFlow()}catch(f){throw D(I,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}},async loginWithPasskey(){if(!n)throw new Bn;if(!(t.authFlow instanceof Zn))throw new C("Must initialize Passkey flow first.");if(G.current!=="passkey")throw new C("Must init login with Passkey flow first.");let s,p;try{G.current="passkey",{user:s,isNewUser:p}=await t.authenticate()}catch(f){throw D(I,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}d(s),A(p||!1),l(!0)},async initLinkWithPasskey(s){let p=new Zn(s);t.startAuthFlow(p),J.current="link",G.current="passkey";try{await p.initLinkFlow()}catch(f){throw D(I,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error",{linkMethod:"passkey"}),f}},async linkWithPasskey(){if(!n)throw new Bn;if(!(t.authFlow instanceof Zn))throw new C("Must initialize Passkey flow first.");if(G.current!=="passkey")throw new C("Must init login with Passkey flow first.");let s;try{G.current="passkey",{user:s}=await t.link()}catch(p){throw D(I,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account",{linkMethod:"passkey"}),p}return d(s||c||null),s},async initLoginWithHeadlessOAuth(s,p){if(Ui()){if(s==="google"&&si(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let f=new vo({provider:s,headless:!0,disableSignup:!1});p&&f.addCaptchaToken(p);let y=await t.startAuthFlow(f).getAuthorizationUrl();y?.url&&window.location.assign(y.url)},async loginWithHeadlessOAuth(s){M(!0),t.startAuthFlow(new vo(s));let p=Z.get(Vn),f=s.stateCode;if(p!==f)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:s.provider,storedStateCode:p??"",returnedStateCode:f??""}}),M(!1),new C("Unexpected auth flow. This may be a phishing attempt.",void 0,"oauth_unexpected");let y=await t.getAccessToken(),b,O,z;if(y!==null)try{({user:b,oAuthTokens:z}=await t.link()),G.current=s.provider;let V=Js(b);b&&V&&D(I,"linkAccount","onSuccess",b,G.current,V)}catch(V){throw M(!1),D(I,"linkAccount","onError",V.privyErrorCode||"failed_to_link_account",{linkMethod:s.provider}),V}else try{({user:b,isNewUser:O,oAuthTokens:z}=await t.authenticate()),G.current=s.provider;let V=Js(b);b&&V&&O!==void 0&&J.current==="login"&&D(I,"login","onComplete",b,O,!1,G.current,V)}catch(V){throw M(!1),D(I,"login","onError",V.privyErrorCode||"unknown_auth_error"),V}return d(b),A(O||!1),l(!0),M(!1),z&&b&&D(I,"oAuthAuthorization","onOAuthTokenGrant",z,{user:b}),b??void 0},initLoginWithEmail:async(s,p,f)=>{let y=new nn(s,p,f);t.startAuthFlow(y);try{G.current="email",await y.sendCodeEmail()}catch(b){throw J.current==="login"?D(I,"login","onError",b.privyErrorCode||"unknown_auth_error"):J.current==="link"&&D(I,"linkAccount","onError",b.privyErrorCode||"failed_to_link_account",{linkMethod:"email"}),b}},initUpdateEmail:async(s,p,f)=>{let y=new Sl(s,p,f);t.startAuthFlow(y),await y.sendCodeEmail()},initUpdatePhone:async(s,p,f)=>{let y=new Gl(s,p,f);t.startAuthFlow(y),await y.sendSmsCode()},initLoginWithSms:async(s,p,f)=>{K({status:"sending-code"});let y=new an(s,p,f);t.startAuthFlow(y);try{G.current="sms",await y.sendSmsCode(),K({status:"awaiting-code-input"})}catch(b){throw K({status:"error",error:b}),J.current==="login"?D(I,"login","onError",b.privyErrorCode||"unknown_auth_error"):J.current==="link"&&D(I,"linkAccount","onError",b.privyErrorCode||"failed_to_link_account",{linkMethod:"sms"}),b}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async s=>{if(K({status:"submitting-code"}),!n){let y=new Bn;throw K({status:"error",error:y}),y}if(t.authFlow instanceof nn)t.authFlow.meta.emailCode=s.trim();else if(t.authFlow instanceof an)t.authFlow.meta.smsCode=s.trim();else{let y=new C("Must initialize a passwordless code flow first");throw K({status:"error",error:y}),y}await ve();let p,f;if(J.current==="link")try{({user:p}=await t.link())}catch(y){throw K({status:"error",error:y}),D(I,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account",{linkMethod:G.current}),y}else try{({user:p,isNewUser:f}=await t.authenticate())}catch(y){throw K({status:"error",error:y}),D(I,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}d(p||c||null),A(f||!1),l(!0),K({status:"done"})},generateSiweMessage:async({address:s,chainId:p,captchaToken:f})=>{J.current="link",G.current="siwe";let y=await t.generateSiweNonce({address:s,captchaToken:f}),b=p.replace("eip155:","");return Hl({address:s,chainId:b,nonce:y})},linkSmartWallet:async({message:s,signature:p,smartWalletType:f})=>{J.current=null,G.current=null;let y;try{y=await t.linkSmartWallet({message:s,signature:p,smartWalletType:f}),y=await ee.refreshUser()??y}catch(b){throw b}d(y||c||null)},linkWithSiwe:async({message:s,signature:p,chainId:f,walletClientType:y,connectorType:b})=>{let O;try{O=await t.linkWithSiwe({message:s,signature:p,chainId:f,walletClientType:y,connectorType:b}),O=await ee.refreshUser()??O;let z=Js(O);z&&D(I,"linkAccount","onSuccess",O,"siwe",z)}catch(z){throw D(I,"linkAccount","onError",z.privyErrorCode||"failed_to_link_account",{linkMethod:"siwe"}),J.current=null,G.current=null,z}d(O||c||null),J.current=null,G.current=null},refreshUser:async()=>{let s=await t.getAuthenticatedUser();return l(!!s),d(s),s},walletProxy:W,createAnalyticsEvent:({eventName:s,payload:p,timestamp:f})=>t.createAnalyticsEvent({eventName:s,payload:p,timestamp:f}),acceptTerms:async()=>{let s=await t.acceptTerms();return d(s),s},getUsdTokenPrice:s=>t.getUsdTokenPrice(s),recoverEmbeddedEthereumWallet:async s=>new Promise(async(p,f)=>{let y=De(s?.user??c)||cl(s?.user??c),b=await ve();if(!b||!W||!y){f(new Error("Must have valid access token and Privy wallet to recover wallet"));return}be(!0);try{await W.connect({accessToken:b,address:y.address}),p(!0)}catch(O){if(ca(O)&&y.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:y.address}}),(await W.recover({address:y.address,accessToken:b,recoveryMethod:y.recoveryMethod})).address||f(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:y.address}}),p(!0);else if(ca(O)&&y.recoveryMethod!=="privy"){Q({recoverWallet:{privyWallet:y,onFailure:f,onSuccess:()=>p(!0)},recoveryOAuthStatus:{provider:y.recoveryMethod,action:"recover"}});let z=Ec(y.recoveryMethod);Ce(z)}else f(O)}}),embeddedSolanaWallet:w,createEmbeddedSolanaWallet:async()=>{be(!0);let s=await ve(),p=await ee.refreshUser(),f=La(p),y=De(p);if(!p||!s)throw new C("User must be logged in to create a Solana wallet");if(f)throw new C("User already has an embedded Solana wallet.");if(y)if(y.recoveryMethod==="privy")await ee.recoverEmbeddedEthereumWallet({user:p});else throw new C("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");let b=await ee.initializeWalletProxy(15e3);if(!b)throw new C("Unable to initialize wallet proxy");t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await b.createSolana({accessToken:s,ethereumAddress:y?.address});let O=await ee.refreshUser(),z=La(O);if(!z)throw new C("Could not get Solana wallet for user");return t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:z.address}}),z}catch(O){throw t.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new C("Failed to create Solana embedded wallet with error ",O)}},exportSolanaWallet:s=>new Promise(async(p,f)=>{if(!i||!c){f(new Error("User must be authenticated before exporting their Privy wallet"));return}let y=s?.address,b=c.linkedAccounts.filter(le=>le.type==="wallet"&&le.walletClientType==="privy"&&le.chainType==="solana"),O=y?b.find(le=>le.address.toLowerCase()===y.toLowerCase()):b.find(le=>!le.imported)||b[0];if(!O){f(new Error("Must have a Privy wallet before exporting"));return}if(be(!0),!await ve()||!W){f(new Error("Must have valid access token to enroll in MFA"));return}if(!W){f(new Error("Must have a Privy wallet before exporting"));return}await ee.recoverEmbeddedSolanaWallet();let V={appId:e.appId,appClientId:e.clientId,origin:t.apiUrl,wallet:O,onSuccess:p,onFailure:f};Q({keyExport:V}),Ce("EMBEDDED_WALLET_KEY_EXPORT_SCREEN")}),recoverEmbeddedSolanaWallet:async()=>new Promise(async(s,p)=>{let f=La(c),y=await ve();if(!y||!W||!f){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}be(!0);try{await W.connectSolana({accessToken:y,publicKey:f.address}),s(!0)}catch(b){ca(b)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:f.address}}),(await W.recoverSolana({publicKey:f.address,accessToken:y})).publicKey||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:f.address}}),s(!0)):p(b)}}),getMoonpaySignedUrl:zd,initCoinbaseOnRamp:t.initCoinbaseOnRamp.bind(t),getCoinbaseOnRampStatus:t.getCoinbaseOnRampStatus.bind(t),setReadyToTrue:s=>{a(!0),Re?.(s)},updateWallets:()=>Zs(),fundWallet:async(s,p)=>{if(!L.fundingConfig||L.fundingConfig.methods.length===0)throw new Error("Wallet funding is not enabled");let f=Ud({fundingMethods:L.fundingConfig.methods});Q({funding:Iu({address:s,appConfig:L,fundWalletConfig:p,methodScreen:f})}),Ce(f)},requestFarcasterSignerStatus:async s=>{let p=await ve(),f=c?.linkedAccounts.find(b=>b.type==="wallet"&&b.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!W||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!c?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let y=await t.requestFarcasterSignerStatus(s);if(y.status==="approved"){let b=await t.getAuthenticatedUser();d(b||c||null)}return y},connectCoinbaseSmartWallet:async()=>{L.externalWallets.coinbaseWallet.connectionOptions="smartWalletOnly";let s=t.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||t.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(s)return s.updateConnectionPreference("smartWalletOnly"),wt(s);await Pe("coinbase_wallet","coinbase_smart_wallet")}}))();a0=ee.recoverEmbeddedEthereumWallet,i0=ee.recoverEmbeddedSolanaWallet,s0=ee.solanaSignMessage;let Zu=CP(()=>({wallets:u,ready:Xe&&ie}),[u,Xe,ie]);return _r(He.Provider,{value:_a,children:_r(Im.Provider,{value:I,children:_r(Um.Provider,{value:Zu,children:_r(wh,{...L,children:t0(Rm.Provider,{value:ee,children:[_r(Lm,{children:t0(km,{data:te,setModalData:Q,setInitialScreen:P,initialScreen:T,authenticated:i,open:r,children:[e.children,!L.headless&&L.captchaEnabled&&n&&!i&&_r(up,{delayedExecution:!1}),_r(O3,{theme:{...L.appearance.palette||{}}}),!L.render.standalone&&_r(Vu,{open:r})]})}),ke&&Y?_r(X3,{appId:e.appId,appClientId:e.clientId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:c?.mfaMethods,mfaPromise:it,mfaSubmitPromise:Se,onLoad:X,onLoadFailed:()=>null}):null,L.loginConfig.telegramAuthConfiguration&&_r(oo,{if:!0,children:_r(K3,{scriptHost:e.apiUrl||nl,botUsername:L.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};import{useCallback as l0,useEffect as xP}from"react";var kP=e=>{Je("login",e);let t=Ee(),r=fl(),{initLoginWithHeadlessOAuth:o,loginWithHeadlessOAuth:n,isHeadlessOAuthLoading:a,ready:i,user:l}=q(),c=l0(async u=>{if(t.enabled&&t.status!=="success")throw new Vt(t.error,null,"captcha_failure");return o(u.provider,t.token)},[o,t]),d=l0(async()=>{let u=Zi();if(l)return console.warn("Cannot login with OAuth when already logged in"),l;if(!u.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!u.popupFlow)try{return await n(u)}catch(m){throw m}finally{Xn()}},[n]);return xP(()=>{let u=Zi();i&&r&&u.inProgress&&u.headless&&!u.popupFlow&&d()},[i,r]),{initOAuth:c,loginWithOAuth:d,loading:a}};import{useCallback as c0}from"react";var RP=()=>{let e=Ee(),{initLoginWithEmail:t,loginWithCode:r}=_(),o=c0(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");if(e.enabled&&e.status==="error")throw new Vt(e.error,null,"captcha_failure");let i;return e.enabled&&e.status!=="success"&&(e.execute(),i=await e.waitForResult()),t(a,i)},[t]),n=c0(async({code:a})=>{if(e.enabled&&e.status==="error")throw new Vt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as d0}from"react";var _P=()=>{let e=Ee(),{otpState:t}=q(),{initLoginWithSms:r,loginWithCode:o}=_(),n=d0(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");if(e.enabled&&e.status==="error")throw new Vt(e.error,null,"captcha_failure");let l;return e.enabled&&e.status!=="success"&&(e.execute(),l=await e.waitForResult()),r(i,l)},[r]),a=d0(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Vt(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:n,loginWithCode:a,state:t}};import{useCallback as p0}from"react";var MP=()=>{let e=Ee(),{generateSiweMessage:t,linkWithSiwe:r}=q(),o=p0(async({address:a,chainId:i})=>{if(!a||!i)throw new Error("wallet address and chainId required to generate nonce");return t({address:a,chainId:i}).then(l=>l)},[t]),n=p0(async({signature:a,message:i,chainId:l,walletClientType:c,connectorType:d})=>{if(e.enabled&&e.status!=="success")throw new Vt(e.error,null,"captcha_failure");return r({message:i,signature:a,chainId:l,walletClientType:c,connectorType:d})},[r,e.status]);return{generateSiweMessage:o,linkWithSiwe:n}};import{useContext as IP}from"react";function WP(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:c,linkLinkedIn:d,linkTiktok:u,linkSpotify:m,linkInstagram:h,linkTelegram:g,linkFarcaster:w}=IP(He);return Je("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:c,linkLinkedIn:d,linkTiktok:u,linkSpotify:m,linkInstagram:h,linkFarcaster:w,linkTelegram:g}}import{useContext as LP}from"react";function OP(e){let{createWallet:t}=LP(He);return Je("createWallet",e),{createWallet:t}}var NP=()=>{let{embeddedSolanaWallet:e,exportSolanaWallet:t,createEmbeddedSolanaWallet:r,solanaWallets:o}=_();return{createWallet:r,exportWallet:t,wallets:o.concat(e?[e]:[])}};var DP=()=>{let{connectCoinbaseSmartWallet:e}=_();return{connectCoinbaseSmartWallet:e}};var UP=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:n}=q();return{loginWithCrossAppAccount:({appId:a})=>e({appId:a,action:"login"}),linkCrossAppAccount:({appId:a})=>e({appId:a,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:n}};import{useContext as FP}from"react";function BP(e){let{sendTransaction:t}=FP(He);return Je("sendTransaction",e),{sendTransaction:t}}import{useContext as HP}from"react";function GP(e){let{setWalletPassword:t}=HP(He);return Je("setWalletPassword",e),{setWalletPassword:t}}import{useContext as VP}from"react";function qP(){let{createGuestAccount:e}=VP(He);return{createGuestAccount:e}}import{useContext as zP}from"react";function KP(e){let{setWalletRecovery:t}=zP(He);return Je("setWalletRecovery",e),{setWalletRecovery:t}}import{useContext as YP}from"react";function QP(e){let{signMessage:t}=YP(He);return Je("signMessage",e),{signMessage:t}}import{useContext as XP}from"react";function ZP(e){let{signTypedData:t}=XP(He);return Je("signTypedData",e),{signTypedData:t}}import{useContext as JP}from"react";var jP=()=>{let{isModalOpen:e}=JP(He);return{isOpen:e}};import{useContext as $P}from"react";function eA(e){let{getAccessToken:t}=$P(He);return Je("accessToken",e),{getAccessToken:t}}function tA(e){let{authenticated:t,user:r}=q(),{initLoginWithOAuth:o}=_(),n=Oa();return Je("oAuthAuthorization",e),{reauthorize:a=>rA(t,r,o,n,a.provider)}}var rA=async(e,t,r,o,n)=>{if(!e)throw o("linkAccount","onError","must_be_authenticated",{linkMethod:n}),new C("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some(i=>i.type.includes(n)))throw new C(`OAuth account of type ${n} not linked to the account.`);await r(n)};var oA=e=>{let{customAuthStatus:t}=_();return Je("customAuth",e),{status:t}};var nA=u0;function u0(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=q();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}export{$n as a,et as b,bo as c,or as d,uh as e,ts as f,rs as g,up as h,mp as i,da as j,pa as k,Wp as l,Os as m,co as n,Vu as o,ve as p,PP as q,kP as r,RP as s,_P as t,MP as u,WP as v,OP as w,NP as x,DP as y,UP as z,BP as A,GP as B,qP as C,KP as D,QP as E,ZP as F,jP as G,eA as H,tA as I,oA as J,nA as K,u0 as L};