@privy-io/react-auth 2.11.0 → 2.12.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.
Files changed (41) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/privy-provider-WROKgGLv.js +28 -0
  4. package/dist/cjs/smart-wallets-BOO4AAyW.js +1 -0
  5. package/dist/cjs/smart-wallets.js +1 -1
  6. package/dist/cjs/solana.js +1 -1
  7. package/dist/cjs/ui.js +1 -1
  8. package/dist/cjs/{useActiveWallet-OTRzJC3E.js → useActiveWallet-jRYT06Mr.js} +1 -1
  9. package/dist/cjs/{useFundWallet-DwAuhWQY.js → useFundWallet-Cgo-Ct91.js} +1 -1
  10. package/dist/dts/farcaster.d.mts +1 -1
  11. package/dist/dts/farcaster.d.ts +1 -1
  12. package/dist/dts/index.d.mts +67 -39
  13. package/dist/dts/index.d.ts +67 -39
  14. package/dist/dts/smart-wallets.d.mts +1 -1
  15. package/dist/dts/smart-wallets.d.ts +1 -1
  16. package/dist/dts/solana.d.mts +113 -7
  17. package/dist/dts/solana.d.ts +113 -7
  18. package/dist/dts/{types-B6jqW_Bc.d.mts → types-Nqh9YCV3.d.mts} +6 -12
  19. package/dist/dts/{types-B6jqW_Bc.d.ts → types-Nqh9YCV3.d.ts} +6 -12
  20. package/dist/dts/ui.d.mts +1 -1
  21. package/dist/dts/ui.d.ts +1 -1
  22. package/dist/dts/{useSolanaWallets-DtHAHWtA.d.mts → useSolanaWallets-BSVQS05e.d.mts} +1 -1
  23. package/dist/dts/{useSolanaWallets-DtHAHWtA.d.ts → useSolanaWallets-BSVQS05e.d.ts} +1 -1
  24. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  25. package/dist/esm/farcaster.mjs +1 -1
  26. package/dist/esm/{frame-BeG8p5X6.mjs → frame-B1kjU0LI.mjs} +1 -1
  27. package/dist/esm/index.mjs +1 -1
  28. package/dist/esm/{internal-context-eu0bC04Q.mjs → internal-context-lAHxpYRu.mjs} +1 -1
  29. package/dist/esm/privy-provider-CE4-s2JH.mjs +28 -0
  30. package/dist/esm/smart-wallets-C2dDEs0t.mjs +1 -0
  31. package/dist/esm/smart-wallets.mjs +1 -1
  32. package/dist/esm/solana.mjs +1 -1
  33. package/dist/esm/ui.mjs +2 -2
  34. package/dist/esm/useActiveWallet-B62Sy0KW.mjs +1 -0
  35. package/dist/esm/{useFundWallet-DWvzm1Lq.mjs → useFundWallet-D2_dle4r.mjs} +1 -1
  36. package/package.json +6 -5
  37. package/dist/cjs/privy-provider-DwACoZxD.js +0 -28
  38. package/dist/cjs/smart-wallets-C6WSci1J.js +0 -1
  39. package/dist/esm/privy-provider-ByLlzrb6.mjs +0 -28
  40. package/dist/esm/smart-wallets-CaacWb0W.mjs +0 -1
  41. package/dist/esm/useActiveWallet-AqaQS33S.mjs +0 -1
@@ -0,0 +1,28 @@
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createStore as r}from"mipd";import a,{useRef as i,useState as o,useMemo as s,useContext as l,createContext as c,useEffect as d,useCallback as h,useReducer as u,forwardRef as p}from"react";import*as m from"react-device-detect";import{isMobile as g,isIOS as y,isSafari as f,isAndroid as w}from"react-device-detect";import{getAddress as v,toHex as C,isAddress as b,isHex as k}from"viem/utils";import T,{ProviderErrors as x,DEFAULT_SUPPORTED_CHAIN_IDS as A,dedupeSupportedChains as I,DEFAULT_SUPPORTED_CHAINS as _,mainnet as E,addToDefaultChains as S,create as N,countryCodesAndNumbers as M,validatePhoneNumber as P,phoneNumberTypingFormatter as W,getPlaceholderPhoneNumber as U,getCountryCallingCode as O,getPhoneCountryCodeAndNumber as L,formatPhoneNumber as R,toObjectKeys as F,arbitrum as D,avalanche as B,base as z,celo as $,linea as j,optimism as V,polygon as H,zora as q,SolanaUsdcAddressMap as K,formatWalletAddress as Z,getCoinbaseOnRampUrl as G,chainToMoonpayCurrency as Y,isSupportedChainIdForMoonpay as J,isSupportedChainIdForCoinbaseOnramp as Q,sepolia as X,optimismSepolia as ee,polygonAmoy as te,baseSepolia as ne,avalancheFuji as re,arbitrumSepolia as ae,formatTokenAmount as ie,SolanaClient as oe,rpc as se,formatWeiAmount as le,lastFourDigits as ce}from"@privy-io/js-sdk-core";import{P as de,p as he,f as ue,c as pe,d as me,e as ge,g as ye,h as fe,i as we,j as ve,k as Ce,o as be,a as ke,l as Te,m as xe,q as Ae,r as Ie,s as _e,t as Ee,v as Se,w as Ne,x as Me,y as Pe,z as We,A as Ue,B as Oe,b as Le,C as Re,D as Fe,n as De,E as Be,F as ze,G as $e,H as je,J as Ve,K as He,L as qe,M as Ke,N as Ze,O as Ge,Q as Ye,R as Je,S as Qe,T as Xe,U as et,V as tt,W as nt,X as rt,Y as at,Z as it,_ as ot,$ as st,a0 as lt,a1 as ct,a2 as dt,a3 as ht,a4 as ut,a5 as pt,a6 as mt,a7 as gt,a8 as yt,a9 as ft,aa as wt,ab as vt,ac as Ct,ad as bt,ae as kt,u as Tt,af as xt,ag as At,ah as It,ai as _t,aj as Et,ak as St,al as Nt,I as Mt}from"./internal-context-lAHxpYRu.mjs";import{createPublicClient as Pt,http as Wt,getAddress as Ut,isHex as Ot,toHex as Lt,formatEther as Rt,formatUnits as Ft,parseEther as Dt,createWalletClient as Bt,custom as zt,publicActions as $t,encodeFunctionData as jt,isAddress as Vt,hexToString as Ht,decodeFunctionData as qt,decodeAbiParameters as Kt}from"viem";import{v4 as Zt}from"uuid";import*as Gt from"jose";import{base64url as Yt}from"jose";import Jt from"eventemitter3";import{CoinbaseWalletSDK as Qt}from"@coinbase/wallet-sdk";import{Turnstile as Xt}from"@marsidev/react-turnstile";import{styled as en,css as tn,createGlobalStyle as nn,keyframes as rn}from"styled-components";import an from"tinycolor2";import on from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import sn from"@heroicons/react/24/outline/FingerPrintIcon";import ln from"@heroicons/react/24/outline/PhoneIcon";import cn from"@heroicons/react/24/outline/ShieldCheckIcon";import dn from"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import hn from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import un from"@heroicons/react/24/outline/XMarkIcon";import pn from"@heroicons/react/24/outline/ChevronDownIcon";import mn from"@heroicons/react/24/outline/CalendarIcon";import gn from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{Transition as yn,Dialog as fn,TransitionChild as wn,DialogPanel as vn,Menu as Cn,MenuButton as bn,MenuItems as kn,MenuItem as Tn}from"@headlessui/react";import{EthereumProvider as xn,OPTIONAL_EVENTS as An,OPTIONAL_METHODS as In}from"@walletconnect/ethereum-provider";import{create as _n}from"zustand";import En from"fast-password-entropy";import*as Sn from"secure-password-utilities";import{DEFAULT_WORDLIST as Nn}from"secure-password-utilities/wordlists";import Mn from"@heroicons/react/24/outline/UserCircleIcon";import Pn from"@heroicons/react/24/outline/EnvelopeIcon";import Wn from"@heroicons/react/20/solid/CheckIcon";import Un from"@heroicons/react/24/outline/WalletIcon";import On from"@heroicons/react/24/outline/CheckIcon";import Ln from"@heroicons/react/24/outline/Square2StackIcon";import Rn from"@heroicons/react/24/outline/ExclamationCircleIcon";import Fn from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Dn from"@heroicons/react/24/solid/DocumentCheckIcon";import Bn from"@heroicons/react/24/solid/XCircleIcon";import zn from"@heroicons/react/24/solid/CheckCircleIcon";import $n from"qrcode";import jn from"@heroicons/react/24/outline/ChevronRightIcon";import Vn from"@heroicons/react/24/outline/LockClosedIcon";import Hn from"@heroicons/react/24/outline/PencilSquareIcon";import qn from"@heroicons/react/24/outline/ArrowPathIcon";import Kn from"@heroicons/react/24/outline/EyeIcon";import Zn from"@heroicons/react/24/outline/EyeSlashIcon";import Gn from"@heroicons/react/24/outline/KeyIcon";import Yn from"@heroicons/react/24/outline/ArrowDownTrayIcon";import Jn from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Qn from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Xn from"@heroicons/react/24/solid/LockClosedIcon";import er from"@heroicons/react/24/outline/CheckCircleIcon";import tr from"@heroicons/react/24/outline/InformationCircleIcon";import nr from"@heroicons/react/24/outline/CreditCardIcon";import rr from"@heroicons/react/24/outline/QrCodeIcon";import ar from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import ir from"@heroicons/react/24/outline/GlobeAltIcon";import{ofetch as or}from"ofetch";import{ChevronDownIcon as sr,ArrowRightIcon as lr}from"@heroicons/react/24/outline";import cr from"@heroicons/react/24/outline/ClipboardDocumentIcon";import dr from"@heroicons/react/24/outline/CloudArrowUpIcon";import hr from"@heroicons/react/24/outline/NoSymbolIcon";import ur from"@heroicons/react/24/outline/ClockIcon";import pr from"@heroicons/react/24/outline/TrashIcon";import mr from"@heroicons/react/24/solid/CheckBadgeIcon";import gr from"@heroicons/react/24/solid/IdentificationIcon";import yr from"@heroicons/react/24/outline/MinusCircleIcon";import fr from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import wr from"@heroicons/react/24/solid/ShieldCheckIcon";import vr from"js-cookie";function Cr(e){return e?{"privy-ui":"t"}:void 0}class br{async authenticate(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new de("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(he,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw ue(e)}}async link(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new de("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(pe,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw ue(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new de("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new de("Email must be set when initialzing authentication.");let r=Cr(n);try{return await this.api.post(me,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw ue(e)}}constructor({email:e,captchaToken:t,disableSignup:n}){this.meta={email:e,captchaToken:t,disableSignup:n??!1}}}class kr extends br{async link(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new de("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(ge,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw ue(e)}}constructor(e,t,n){super({email:t,captchaToken:n}),this.meta={email:t,captchaToken:n,oldAddress:e,disableSignup:!1}}}class Tr{get(e){let t=localStorage.getItem(e);return null===t?void 0:JSON.parse(t)}put(e,t){void 0!==t?localStorage.setItem(e,JSON.stringify(t)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map((([e])=>e))}}function xr(){try{let e="privy:__session_storage__test",t=new Tr;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}}var Ar="undefined"!=typeof window&&window.localStorage?new Tr:new class{get(e){return this._cache[e]}put(e,t){void 0!==t?this._cache[e]=t:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};const Ir=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom||"isPhantom"in e?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,_r=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==Ir(e))return!1;if(e.providers)for(let t of e.providers)if(!_r(t))return!1;return!0},Er=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},Sr=(e,t,n,r)=>{let a=Number(e),i=t.find((e=>e.id===a));if(!i)throw new ye(`Unsupported chainId ${e}`,4901);return Pt({transport:Wt(Nr(i,n,r.appId)),chain:i})},Nr=(e,t,n)=>{let r,a=e.id,i=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])r=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[i])r=t.rpcUrls[i];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",n),r=t.toString()}else r=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!r)throw new ye(`No RPC url found for ${a}`);return r},Mr=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Pr=(e,t=3,n=4,r="ethereum")=>{if(!e)return"";let a="ethereum"===r?2:0;return t+n+a+3>=e.length?e:`${e.slice(0,a+t)}...${e.slice(e.length-n,e.length)}`},Wr=(e,t=3,n=4)=>Pr(e,t,n,"solana"),Ur=e=>new Promise((t=>setTimeout(t,e)));const Or=(e,t={})=>{let n=t.delayMs||150,r=t.maxAttempts||270;return new Promise((async(a,i)=>{let o=!1,s=0;for(;!o&&s<r;){if(t.abortSignal?.aborted)return;e().then((e=>{o=!0,a(e)}),((...e)=>{o=!0,i(...e)})),s+=1,await Ur(n)}o||i(Error("Exceeded max attempts before resolving function"))}))},Lr=(e,t,n={},r={})=>{let a=new URL(t,e);for(let[e,t]of Object.entries(n))void 0!==t&&a.searchParams.set(e,t);let i=Object.entries(r);if(i.length>0){let e=new URLSearchParams;for(let[t,n]of i)e.append(t,n);a.hash=e.toString()}return a.href},Rr=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Fr=e=>"string"==typeof e?e:"0x"+e.toString(16);async function Dr({store:e,walletList:t,externalWalletConfig:n,walletChainType:r,timeout:a=3e3}){let i=!1,o=window;return new Promise((s=>{function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);let a=e.getProviders();console.debug("Detected injected providers:",a.map((e=>e.info)));let o=[];for(let e of a)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===r&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==r)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let n=[];if(t.providers?.length)for(let e of t.providers)e&&n.push(e);return n.push(e.ethereum),n}()){let t=Ir(e);if(!a.some((e=>e.info.name===t))){if(_r(e,!0)&&!o.find((e=>"metamask"===e.type))){o.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!o.find((e=>"phantom"===e.type))){o.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!o.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==n.coinbaseWallet?.connectionOptions))){o.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}o.find((e=>"unknown_browser_extension"===e.type))||o.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}s(o)}o.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout((()=>{l()}),a))}))}function Br(e){return`eip155:${String(Number(e))}`}const zr=(e,t,n,r)=>{let a=Number(e),i=t.find((e=>e.id===a));if(!i)throw new ye(`Unsupported chainId ${e}`,4901);return Nr(i,n,r)},$r=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},n=e.types.EIP712Domain??Object.entries(e.domain).map((([e,n])=>{if(null!=n&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:n}}};const jr=e=>e?.map((e=>({signer_id:e.signerId}))),Vr=["c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96","4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0","225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f","1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369","c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a","ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18","bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6","74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d","afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7","f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d","84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04","0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150","38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662","9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0","c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576","8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4","e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4","f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2","138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98","47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83","7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26","8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3","031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa","2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568","dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd","2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01","b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f","0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92","719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3","942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef","8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2","07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80","8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819","bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a","cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e","94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43","2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715","14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc","576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd","49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd","19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b","5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b","d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b","50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b","9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8","6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa","41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071","14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd","a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1","971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709","18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1","15c8b91ade1a4e58f3ce4e7a0dd7f42b47db0c8df7e0d84f63eb39bcb96c4e0f","541d5dcd4ede02f3afaf75bf8e3e4c4f1fb09edb5fa6c4377ebf31c2785d9adf"];function Hr(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let qr="WALLETCONNECT_DEEPLINK_CHOICE";function Kr(e){return e.startsWith("http://")||e.startsWith("https://")}function Zr(e,t){if(Kr(e))return Gr(e,t);let n=e;return n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function Gr(e,t){if(!Kr(e))return Zr(e,t);let n=e;return n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function Yr(e,t){window.open(e,t,"noreferrer noopener")}class Jr{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}class Qr{get meta(){return this._meta}async authenticate(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.channelToken)throw new de("Auth flow must be initialized first");try{let e=await this.api.post(fe,{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(!e)throw new de("No response from authentication");return e}catch(e){throw ue(e)}}async link(){if(!this.api)throw new de("Auth flow has no API instance");try{return await this.api.post(we,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw ue(e)}}async _startChannelOnce(){if(!this.api)throw new de("Auth flow has no API instance");let e=await this.api.post(ve,{token:this.captchaToken});g&&!y&&e.connect_uri&&Yr(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new de("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.channelToken)throw new de("Auth flow must be initialized first");let e=await this.api.get(Ce,{headers:{"farcaster-channel-token":this.meta.channelToken}});return"completed"===e.state&&(this.message=e.message,this.signature=e.signature,this.fid=e.fid,!0)}constructor(e,t=!1){this._meta={disableSignup:!1},this.captchaToken=e,this.startChannelOnce=new Jr(this._startChannelOnce.bind(this)),this.pollForReady=new Jr(this._pollForReady.bind(this)),this._meta.disableSignup=t}}const Xr="https://auth.privy.io",ea=1400,ta=2500,na=4e3,ra="2.12.0",aa="privy:token",ia="privy-token",oa="privy:refresh_token",sa="privy:pat",la="privy:id_token",ca="privy-id-token",da="privy-session",ha="privy:caid",ua=e=>`privy:guest:${e}`,pa=e=>`privy:cross-app:${e}`,ma="privy:state_code",ga="privy:code_verifier",ya="privy:headless_oauth",fa="privy:oauth_disable_signup",wa=e=>`privy:wallet:${e}`,va="privy:connectors",Ca="privy:connections",ba=12e4,ka=3e4,Ta="https://api.moonpay.com/v1",xa="https://api.moonpay.com/v1",Aa="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Ia="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";function _a(e){return crypto.getRandomValues(new Uint8Array(e))}function Ea(){return Yt.encode(_a(36))}function Sa(){return Ea()}async function Na(e,t="S256"){if("S256"!=t)return e;{let t=await async function(e){let t=(new TextEncoder).encode(e);return new Uint8Array(await crypto.subtle.digest("SHA-256",t))}(e);return Yt.encode(t)}}class Ma{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new de("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new de("User denied confirmation during OAuth flow");let e=function(){let e=Ar.get(ga);if(!e)throw new de("Authentication error.");return e}();try{let t=await this.api.post(be,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Ar.del(ga),Ar.del(ya),Ar.del(fa),t}catch(e){let t=ue(e);if(t.privyErrorCode)throw new de(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new de("Invalid code during oauth flow.",void 0,ke.OAUTH_USER_DENIED);throw new de("Invalid code during OAuth flow.",void 0,ke.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new de("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new de("User denied confirmation during OAuth flow");let e=Ar.get(ga);if(!e)throw new de("Authentication error.");try{let t=await this.api.post(Te,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Ar.del(ga),t}catch(e){throw ue(e)}}async getAuthorizationUrl(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.provider)throw new de("Provider must be set when initializing OAuth authentication.");let e=Ea();Ar.put(ga,e);let t=Sa();Ar.put(ma,t);let n=await Na(e);this.meta.withPrivyUi||Ar.put(ya,!0),this.meta.disableSignup&&Ar.put(fa,!0);let r=Cr(this.meta.withPrivyUi);try{return await this.api.post(xe,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:n,state_code:t},{headers:{...r}})}catch(e){throw ue(e)}}constructor(e){this.meta=e}}function Pa(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Wa=({style:n,...r})=>/*#__PURE__*/e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...n},...r,children:[/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]}),Ua=({style:n,...r})=>/*#__PURE__*/e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...n},...r,children:[/*#__PURE__*/t("g",{clipPath:"url(#clip0)",children:/*#__PURE__*/t("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"})}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0",children:/*#__PURE__*/t("rect",{width:"71",height:"55",fill:"white"})})})]}),Oa=({style:e,...n})=>/*#__PURE__*/t("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...n,children:/*#__PURE__*/t("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"})}),La=({style:e})=>/*#__PURE__*/t(ir,{style:{color:"var(--privy-color-error)",...e}}),Ra=({style:n,...r})=>/*#__PURE__*/e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...n},...r,children:[/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]});function Fa(n){/*#__PURE__*/return e("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",...n,children:[/*#__PURE__*/e("defs",{children:[/*#__PURE__*/e("linearGradient",{id:"b",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#3771c8"}),/*#__PURE__*/t("stop",{stopColor:"#3771c8",offset:".128"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),/*#__PURE__*/e("linearGradient",{id:"a",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#fd5"}),/*#__PURE__*/t("stop",{offset:".1",stopColor:"#fd5"}),/*#__PURE__*/t("stop",{offset:".5",stopColor:"#ff543e"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#c837ab"})]}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]}),/*#__PURE__*/t("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)"}),/*#__PURE__*/t("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)"}),/*#__PURE__*/t("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"})]})}function Da({style:e,...n}){/*#__PURE__*/return t("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},...n,children:/*#__PURE__*/t("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:/*#__PURE__*/t("g",{transform:"scale(5.12,5.12)",children:/*#__PURE__*/t("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"})})})})}function Ba(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...n,children:[/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]})}function za(n){/*#__PURE__*/return e("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,...n,children:[/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]})}const $a=({style:e,...n})=>/*#__PURE__*/t("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},...n,children:/*#__PURE__*/t("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"})});let ja={google:{name:"Google",component:Ra},discord:{name:"Discord",component:Ua},github:{name:"Github",component:Oa},linkedin:{name:"LinkedIn",component:Da},twitter:{name:"Twitter",component:$a},spotify:{name:"Spotify",component:Ba},instagram:{name:"Instagram",component:Fa},tiktok:{name:"Tiktok",component:za},apple:{name:"Apple",component:Wa}};const Va=e=>e in ja?ja[e]:{name:"Unknown",component:La};function Ha(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),n=e.get("privy_oauth_state"),r=e.get("privy_oauth_provider");if(!t||!n||!r)return{inProgress:!1};let a=!1;try{a=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:n,provider:r,withPrivyUi:!Ar.get(ya),popupFlow:null!==window.opener&&a,disableSignup:!!Ar.get(fa)}}function qa(){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"),Ar.del(ma),window.history.replaceState({},"",e)}class Ka{async initRegisterFlow(e){if(!this.api)throw new de("Auth flow has no API instance");this.authenticateForRegistration=!0,this.meta.initRegisterResponse=await this.initRegisterOnce.execute(e)}async initAuthenticationFlow(e){if(!this.api)throw new de("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new de("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async register(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new de("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new de("WebAuthn is not supported in this browser");this.meta.initRegisterResponse||(this.meta.initRegisterResponse=await this.initRegisterOnce.execute());try{let t=this.meta.initRegisterResponse.options,n=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Ae,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new de("Passkey request timed out or rejected by user.",void 0,ke.PASSKEY_NOT_ALLOWED);throw ue(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new de("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new de("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());let t=this.meta.allowedCredentialsIds?.map((e=>({type:"public-key",id:e})))??this.meta.initAuthenticateResponse.options.allow_credentials;try{let n=await e.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase({...this.meta.initAuthenticateResponse.options,allow_credentials:t}));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(Ie,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new de("Passkey request timed out or rejected by user.",void 0,ke.PASSKEY_NOT_ALLOWED);throw ue(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new de("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new de("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,n=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(_e,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(e){if("NotAllowedError"===e.name)throw new de("Passkey request timed out or rejected by user.",void 0,ke.PASSKEY_NOT_ALLOWED);throw ue(e)}}async _initRegisterOnce(e){if(!this.api)throw new de("Auth flow has no API instance");let t=Cr(e);return await this.api.post(Ee,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new de("Auth flow has no API instance");let t=Cr(e);return await this.api.post(Se,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new de("Auth flow has no API instance");return await this.api.post(Ne,{})}_transformInitLinkOptionsToCamelCase(e){return{rp:e.rp,user:{id:e.user.id,name:e.user.name,displayName:e.user.display_name},challenge:e.challenge,pubKeyCredParams:e.pub_key_cred_params.map((e=>({type:e.type,alg:e.alg}))),timeout:e.timeout,excludeCredentials:e.exclude_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports}))),authenticatorSelection:{authenticatorAttachment:e.authenticator_selection?.authenticator_attachment,requireResidentKey:e.authenticator_selection?.require_resident_key,residentKey:e.authenticator_selection?.resident_key,userVerification:e.authenticator_selection?.user_verification},attestation:e.attestation,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props?.rk,hmacCreateSecret:e.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData},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}}_transformInitAuthenticateOptionsToCamelCase(e){return{rpId:e.rp_id,challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.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}}_transformAuthenticationResponseToSnakeCase(e){return{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}}constructor({captchaToken:e,setPasskeyAuthState:t}){this.authenticateForRegistration=!1,this.initRegisterOnce=new Jr(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new Jr(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Jr(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}const Za=({address:e,chainId:t,nonce:n})=>`${window.location.host} wants you to sign in with your Ethereum account:\n${e}\n\nBy signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: ${t}\nNonce: ${n}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class Ga{get meta(){return{connectorType:this.wallet?.connectorType,walletClientType:this.wallet?.walletClientType,chainId:this.wallet?.chainId,address:this.wallet?.address,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new de("SiweFlow has no client instance");try{if(this.preparedMessage&&this.signature)return await this.client.authenticateWithSiweInternal({message:this.preparedMessage,signature:this.signature,chainId:this.wallet?.chainId,walletClientType:this.wallet?.walletClientType,connectorType:this.wallet?.connectorType,mode:this._meta.disableSignup?"no-signup":"login-or-sign-up"});if(!this.wallet)throw new de("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw ue(e)}}async link(){if(!this.client)throw new de("SiweFlow has no client instance");try{if(!this.wallet)throw new de("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw ue(e)}}async sign(){if(!this.client)throw new de("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new de("Could not prepare SIWE message");if(!this.wallet)throw new de("SiweFlow has no wallet instance");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new de("SiweFlow has no client instance");if(!this.wallet)throw new de("UI SiweFlow has no wallet instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new de("SiweFlow has no client instance");if(!this.wallet)throw new de("SiweFlow has no wallet instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Za({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,a){this._meta={disableSignup:!1},this.getNonceOnce=new Jr(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=n,this.client=e,this._meta.disableSignup=r,this.preparedMessage=a?.message,this.signature=a?.signature}}const Ya=(...e)=>{if("undefined"==typeof Buffer)throw new de("Buffer is not defined.",void 0,ke.BUFFER_NOT_DEFINED);return Buffer.from(...e)};class Ja{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new de("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw ue(e)}}async link(){if(!this.client)throw new de("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw ue(e)}}async sign(){if(!this.client)throw new de("SiwsFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new de("Could not prepare SIWS message");if(!this.wallet.signMessage)throw new de("Wallet does not support signMessage");let e=await this.wallet.signMessage(Ya(this.preparedMessage));return{message:this.preparedMessage,signature:Ya(e).toString("base64")}}async _getNonceOnce(){if(!this.client)throw new de("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new de("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=(({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\nYou are proving you own ${e}.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`)({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Jr(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=n,this.client=t,this._meta.disableSignup=r}}class Qa{async authenticate(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new de("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Me,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw ue(e)}}async link(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new de("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Pe,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw ue(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:n}){if(!this.api)throw new de("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new de("phone nNumber must be set when initialzing authentication.");let r=Cr(n);try{return await this.api.post(We,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...r}})}catch(e){throw ue(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:n}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:n??!1}}}class Xa extends Qa{async link(){if(!this.api)throw new de("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new de("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(Ue,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw ue(e)}}constructor(e,t,n){super({phoneNumber:t,captchaToken:n}),this.meta={phoneNumber:t,captchaToken:n,oldPhoneNumber:e,disableSignup:!1}}}const ei=/*#__PURE__*/c({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:Le,setError:Le,setExecuting:Le,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:Le,reset:Le,execute:Le});class ti extends Oe{constructor(e,t,n){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=n}}const ni=({children:e,id:n,captchaSiteKey:r,captchaEnabled:a})=>{let l=i(null),[c,d]=o(),[h,u]=o(),[p,m]=o(!1),g=s((()=>a?p||c||h?!p||c||h?c&&!h?{status:"success",token:c}:h?{status:"error",error:h}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,c,h,p]);/*#__PURE__*/return t(ei.Provider,{value:{...g,ref:l,enabled:a,siteKey:r,appId:n,setToken:d,setError:u,setExecuting:m,remove(){a&&(l.current?.remove(),m(!1),u(void 0),d(void 0))},reset(){a&&(l.current?.reset(),m(!1),u(void 0),d(void 0))},execute(){a&&(m(!0),l.current?.execute())},async waitForResult(){if(!a)return"";try{return await function(e,{interval:t=100,timeout:n=5e3}={}){return new Promise(((r,a)=>{let i,o=0,s=()=>{o>=n?a("Max attempts reached without result"):(i=e(),o+=t,null==i?setTimeout(s,t):r(i))};s()}))}((()=>l.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new ti("Captcha failed",null,ke.CAPTCHA_TIMEOUT)}}},children:e})},ri=()=>l(ei);class ai{async authenticate(){if(!this.api)throw new de("Auth flow has no API instance");try{return await this.api.post(Re,{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"})}catch(e){throw ue(e)}}async link(){if(!this.api)throw new de("Auth flow has no API instance");try{return await this.api.post(Fe,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw ue(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function ii(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===ke.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===ke.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===ke.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===ke.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===ke.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===ke.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===ke.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof ti&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function oi(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function si(){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)}class li{static parse(e){try{return new li(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return Gt.decodeJwt(e),e}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(e=0){return Date.now()>=1e3*(this.expiration-e)}constructor(e){this.value=e,this._decoded=Gt.decodeJwt(e)}}class ci extends li{static parse(e){try{return new ci(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}function di(e){return e?new Date(1e3*e):null}function hi(e,t){return e.slice().sort(((e,t)=>(e.firstVerifiedAt??e.verifiedAt).getTime()-(t.firstVerifiedAt??t.verifiedAt).getTime())).find((e=>e.type===t))}const ui=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"ethereum"===e.chainType&&0===e.walletIndex))||null,pi=e=>(e?.linkedAccounts??[]).filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"solana"===e.chainType)),mi=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"solana"===e.chainType&&0===e.walletIndex))||null,gi=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.imported&&"ethereum"===e.chainType))||null,yi=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&e.imported&&"privy"===e.walletClientType&&"solana"===e.chainType))||null;const fi=(e,t)=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&((e,t)=>e===t||!(!e.startsWith("0x")||!t.startsWith("0x"))&&Ut(e)===Ut(t))(e.address,t)))||null,wi=e=>ui(e)??mi(e);function vi(e){if(!e)return null;let t=function(e){let t=[];for(let n of e){let e=n.type;switch(n.type){case"wallet":let r={id:n.id,address:n.address,type:n.type,imported:n.imported,delegated:n.delegated,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at),chainType:n.chain_type,walletClientType:n.wallet_client_type,connectorType:n.connector_type,recoveryMethod:n.recovery_method,walletIndex:n.wallet_index};t.push(r);break;case"smart_wallet":let a={address:n.address,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at),smartWalletType:n.smart_wallet_type};t.push(a);break;case"cross_app":let i={type:n.type,subject:n.subject,embeddedWallets:n.embedded_wallets,smartWallets:n.smart_wallets,providerApp:{id:n.provider_app_id},verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(i);break;case"email":let o={address:n.address,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(o);break;case"phone":let s={number:n.phoneNumber,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(s);break;case"google_oauth":let l={subject:n.subject,email:n.email,name:n.name,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(l);break;case"spotify_oauth":let c={subject:n.subject,email:n.email,name:n.name,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(c);break;case"instagram_oauth":let d={subject:n.subject,username:n.username,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(d);break;case"twitter_oauth":let h={subject:n.subject,username:n.username,name:n.name,type:n.type,profilePictureUrl:n.profile_picture_url,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(h);break;case"discord_oauth":let u={subject:n.subject,username:n.username,email:n.email,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(u);break;case"github_oauth":let p={subject:n.subject,username:n.username,name:n.name,email:n.email,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(p);break;case"tiktok_oauth":let m={subject:n.subject,username:n.username,name:n.name,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(m);break;case"linkedin_oauth":let g={subject:n.subject,name:n.name,email:n.email,vanityName:n.vanity_name,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(g);break;case"apple_oauth":let y={subject:n.subject,email:n.email,type:n.type,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(y);break;case"custom_auth":t.push({type:n.type,customUserId:n.custom_user_id,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)});break;case"farcaster":let f={type:n.type,fid:n.fid,ownerAddress:n.owner_address,displayName:n.display_name,username:n.username,bio:n.bio,pfp:n.profile_picture_url,url:n.homepage_url,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at),signerPublicKey:n.signer_public_key};t.push(f);break;case"passkey":let w={type:n.type,enrolledInMfa:n.enrolled_in_mfa,credentialId:n.credential_id,authenticatorName:n.authenticator_name,createdWithDevice:n.created_with_device,createdWithOs:n.created_with_os,createdWithBrowser:n.created_with_browser,verifiedAt:di(n.verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(w);break;case"telegram":let v={type:n.type,telegramUserId:n.telegram_user_id,firstName:n.first_name,lastName:n.last_name,username:n.username,photoUrl:n.photo_url,verifiedAt:di(n.first_verified_at),firstVerifiedAt:di(n.first_verified_at),latestVerifiedAt:di(n.latest_verified_at)};t.push(v);break;default:console.warn(`Unrecognized account type: ${e}. Please consider upgrading the Privy SDK.`)}}return t}(e.linked_accounts),n=hi(t,"wallet"),r=hi(t,"smart_wallet"),a=hi(t,"email"),i=hi(t,"phone"),o=hi(t,"google_oauth"),s=hi(t,"twitter_oauth"),l=hi(t,"discord_oauth"),c=hi(t,"github_oauth"),d=hi(t,"spotify_oauth"),h=hi(t,"instagram_oauth"),u=hi(t,"tiktok_oauth"),p=hi(t,"linkedin_oauth"),m=hi(t,"apple_oauth"),g=hi(t,"farcaster"),y=hi(t,"telegram"),f=e.mfa_methods.map((({type:e,verified_at:t})=>({type:e,verifiedAt:di(t)})));return{id:e.id,createdAt:di(e.created_at),linkedAccounts:t,email:a&&{address:a?.address},phone:i&&{number:i?.number},wallet:n&&{id:n.id,address:n.address,chainType:n.chainType,walletClientType:n.walletClientType,connectorType:n.connectorType,recoveryMethod:n.recoveryMethod,imported:n.imported,delegated:n.delegated,walletIndex:n.walletIndex},smartWallet:r&&{address:r.address,smartWalletType:r.smartWalletType},google:o&&{subject:o.subject,email:o.email,name:o.name},twitter:s&&{subject:s.subject,username:s.username,name:s.name,profilePictureUrl:s.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:c&&{subject:c.subject,username:c.username,name:c.name,email:c.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},instagram:h&&{subject:h.subject,username:h.username},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:p&&{subject:p.subject,name:p.name,email:p.email,vanityName:p.vanityName},apple:m&&{subject:m.subject,email:m.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},telegram:y&&{telegramUserId:y.telegramUserId,firstName:y.firstName,lastName:y.lastName,username:y.username,photoUrl:y.photoUrl},delegatedWallets:[],mfaMethods:f.map((e=>e.type)),hasAcceptedTerms:e.has_accepted_terms??!1,isGuest:e.is_guest,customMetadata:e.custom_metadata}}let Ci=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")};const bi=(e,t)=>{if(t?.imported)return Ci(t);let n=wi(e);if(!n)throw Error("Failed to find primary wallet");return Ci(n)},ki=({style:n,...r})=>/*#__PURE__*/e("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),/*#__PURE__*/t("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"})]});class Ti extends ye{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class xi extends ye{constructor(){super("User rejected connection"),this.type="wallet_error"}}const Ai=e=>e instanceof ye?e:e?.code?new _i(e):new ye("Unknown connector error",e);class Ii extends Oe{constructor(e,t,n){super(e),this.type="provider_error",this.code=t,this.data=n}}class _i extends Ii{constructor(e){super(e.message,e.code,e.data);let t=Object.values(x).find((t=>t.eipCode===e.code));this.details=t||x.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=x.E32002_CONNECTION_ALREADY_PENDING:this.details=x.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=x.E32002_WALLET_LOCKED))}}const Ei={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},...x};function Si(e){return"ethereum"===e.type}function Ni(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],a=t[n];if(r?.address!==a?.address||r&&a&&Si(r)&&Si(a)&&r?.chainId!==a?.chainId||r?.connectorType!==a?.connectorType||r?.connectedAt!==a?.connectedAt||r?.walletClientType!==a?.walletClientType||r?.isConnected!==a?.isConnected||r?.linked!==a?.linked)return!1}return!0}class Mi extends Jt{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const Pi=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||ba;let Wi;function Ui(e){return"ethereum"===e.chainType}class Oi extends Mi{buildConnectedWallet(e,t,n,r){let a=async()=>!!this.wallets.find((t=>v(t.address)===v(e)));return{type:"ethereum",address:v(e),chainId:t,meta:n,imported:r,switchChain:async n=>{let r,i;if(!a)throw new ye("Wallet is not currently connected.");let o=this.wallets.find((t=>v(t.address)===v(e)))?.chainId;if(!o)throw new ye("Unable to determine current chainId.");if("number"==typeof n?(r=`0x${n.toString(16)}`,i=n):(r=n,i=Number(n)),o===Br(r))return;let s=this.chains.find((e=>e.id===i));if(!s)throw new ye(`Unsupported chainId: ${n}`);let l=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})};try{return await l()}catch(e){if(((e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");case"rabby_wallet":return e.message.includes("Unrecognized chain ID");default:return 4902===e.code||e.message?.includes("4902")}})(e,this.walletClientType))return"rabby_wallet"===this.walletClientType&&await Ur(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:r,chainName:s.name,nativeCurrency:s.nativeCurrency,rpcUrls:[s.rpcUrls.default?.http[0]??""],blockExplorerUrls:[s.blockExplorers?.default.url??""]}]}),l();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new ye(`Rainbow does not support the chainId ${t}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new ye("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await a())throw new ye("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t,n=e;try{if(void 0===n){let e=await Or((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(n=e)}}catch(e){console.debug("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let r=n[0],a=v(r),i=[];if("privy"===this.walletClientType){let e=Ar.get(wa(a));this.chains.find((t=>t.id===Number(e)))||(Ar.del(wa(a)),e=null),t=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${t} on initialization`)}}else try{let e=await Or((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)t=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");t=`0x${e.toString(16)}`}}catch(e){console.warn("Failed to get chainId from provider, defaulting to 0x1",e),t="0x1"}let o=Br(t);if(!i.find((e=>v(e.address)===a))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(v(r),o,e,"embedded_imported"===this.connectorType))}Ni(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((t=>e.find((e=>v(e)===v(t.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),this.proxyProvider.request({method:"personal_sign",params:[C(e),this.wallets[0]?.address]})}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)}constructor(e,t,n,r){super(e),this.chainType="ethereum",this.onAccountsChanged=e=>{0===e.length?this.onDisconnect():this.syncAccounts(e)},this.onChainChanged=e=>{this.wallets.forEach((t=>{t.chainId=Br(e),"privy"===this.walletClientType&&Ar.put(wa(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=async()=>{this.connected=!0,"coinbase_wallet"===this.connectorType&&await Ur(500),this.syncAccounts()},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=n,this.rpcConfig=r,this.rpcTimeoutDuration=Pi(r,e),this.connected=!1,this.initialized=!1}}class Li{on(e,t){if(this.walletProvider)return this.walletProvider.on(e,t);this._subscriptions.push({eventName:e,listener:t})}async request(e){if(!this.walletProvider)throw new ye(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw Ai(e)}))}constructor(e,t){this.removeListener=(e,t)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(e,t)}catch(e){console.warn("Unable to remove wallet provider listener")}},this.walletTimeout=(e=new Ti,t=this.rpcTimeoutDuration)=>new Promise(((n,r)=>setTimeout((()=>{r(e)}),t))),this.setWalletProvider=e=>{this.walletProvider&&this._subscriptions.forEach((e=>{this.removeListener(e.eventName,e.listener)})),this.walletProvider=e,this._subscriptions.forEach((e=>{this.walletProvider?.on(e.eventName,e.listener)}))},this.walletProvider=e,this.rpcTimeoutDuration=t||ba,this._subscriptions=[]}}let Ri=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],Fi=(e,t)=>e.makeWeb3Provider({options:t});class Di extends Oi{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:"data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",id:"com.coinbase.wallet"}}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new ye("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw Ai(e)}}updateConnectionPreference(e){this.connectionOptions=e,this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(Fi(Wi,this.connectionOptions))}constructor(e,t,n,r,a,i){if(super("coinbase_wallet",e,t,n),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new Li(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=r.coinbaseWallet.connectionOptions??"all",this.walletClientType="smartWalletOnly"===this.connectionOptions?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!Wi){let n=[t.id].concat(e.map((e=>e.id))),r="eoaOnly"!==this.connectionOptions?n.filter((e=>!Ri.includes(e))):[];r.length>0&&!r.every((e=>A.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${r.join(", ")}`),Wi=new Qt({appName:a,appLogoUrl:i,appChainIds:n})}this.proxyProvider.setWalletProvider(Fi(Wi,this.connectionOptions))}}const Bi=({...e})=>/*#__PURE__*/t("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});class zi extends Oi{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Fr(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Bi,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:n,rpcConfig:r,imported:a,walletIndex:i}){super("privy",t,n,r),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const $i=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];let ji={0:"legacy",1:"eip2930",2:"eip1559",3:"eip4844"};const Vi={legacy:0,eip2930:1,eip1559:2,eip4844:3};let Hi=e=>void 0!==e?BigInt(e):void 0;function qi(e){let t,{type:n=2,...r}=e;r.accessList&&Array.isArray(r.accessList)?t=r.accessList.map((e=>Array.isArray(e)?{address:e[0],storageKeys:e[1]}:e)):r.accessList&&(t=Object.entries(r.accessList).map((e=>({address:e[0],storageKeys:e[1]}))));let a=Number(r.chainId??1),i=Ot(r.data)?r.data:r.data?Lt(Uint8Array.from(r.data)):void 0,o=r.nonce?Number(r.nonce):void 0,s={chainId:a,data:i,nonce:o,value:Hi(r.value),gas:Hi(r.gas??r.gasLimit)},l=Number(n);if(0===l)return{...r,type:ji[l],...s,gasPrice:Hi(r.gasPrice),accessList:void 0,maxFeePerGas:void 0,maxPriorityFeePerGas:void 0};if(1===l)return{...r,type:ji[l],...s,gasPrice:Hi(r.gasPrice),accessList:t,maxFeePerGas:void 0,maxPriorityFeePerGas:void 0};if(2===l)return{...r,type:ji[l],...s,nonce:o,accessList:t,maxFeePerGas:Hi(r.maxFeePerGas),maxPriorityFeePerGas:Hi(r.maxPriorityFeePerGas),gasPrice:void 0,maxFeePerBlobGas:void 0};throw new de(`Unsupported transaction type: ${n}`)}class Ki extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n}}class Zi extends Jt{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new Ki(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await fb()||!this.address)throw new Ki("Disconnected",4900);let{hash:n}=await bb(t,{address:this.address});return n}async handleSignTransaction(e){if(!e.params||!Array.isArray(e.params))throw new Ki(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await fb()||!this.address)throw new Ki("Disconnected",4900);let{signature:n}=await Cb(t,{address:this.address});return n}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new Ki(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new Ki(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.publicClient=Sr(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",t)}async handlePersonalSign(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for personal_sign");let t=e.params[0],n=e.params[1],{signature:r}=await wb({message:t},{address:n});return r}async handleSignedTypedData(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_signTypedData_v4");let t=e.params[0],n="string"==typeof e.params[1]?JSON.parse(e.params[1]):e.params[1],{signature:r}=await vb($r(n),{address:t});return r}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");delete e.params[0].gasPrice,delete e.params[0].maxFeePerGas,delete e.params[0].maxPriorityFeePerGas;let t={...e.params[0],chainId:Fr(this.chainId)};return await this.publicClient.estimateGas({account:t.from??this.address,...qi(t)})}async request(e){switch(console.debug("Embedded1193Provider.request() called with args",e),e.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Fr(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_sendTransaction":return this.handleSendTransaction(e);case"eth_signTransaction":return this.handleSignTransaction(e);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"personal_sign":return this.handlePersonalSign(e);case"eth_signTypedData_v4":return this.handleSignedTypedData(e)}if(!(e=>$i.includes(e))(e.method))return this.publicClient.request({method:e.method,params:e.params});{let t=await fb();if(await kb(),!t||!this.address)throw new Ki("Disconnected",4900);try{return(await this.walletProxy.rpc({accessToken:t,entropyId:this.entropyId,entropyIdVerifier:this.entropyIdVerifier,chainType:"ethereum",hdWalletIndex:this.walletIndex,request:{method:e.method,params:e.params}})).response.data}catch(e){throw console.error(e),new Ki("Disconnected",4900)}}}constructor({walletProxy:e,address:t,entropyId:n,entropyIdVerifier:r,rpcConfig:a,chains:i,appId:o,chainId:s=1,walletIndex:l}){super(),this.walletProxy=e,this.address=t,this.entropyId=n,this.entropyIdVerifier=r,this.chainId=s,this.rpcConfig=a,this.chains=i,this.publicClient=Sr(s,this.chains,a,{appId:o}),this.rpcTimeoutDuration=Pi(a,"privy"),this.appId=o,this.walletIndex=l}}class Gi extends Oi{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the EthereumNullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the EthereumNullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the EthereumNullConnector for ${e}`)}constructor({id:e,name:t,icon:n,walletClientType:r,defaultChain:a}){super(r,[],a,{}),this.connectorType="null",this.proxyProvider=new Li(void 0,ba),this.id=e,this.name=t,this.icon=n,this.connectorType=r}}const Yi=({style:e,...n})=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...n,children:/*#__PURE__*/t("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"})}),Ji=({style:n,...r})=>/*#__PURE__*/e("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",...n},...r,children:[/*#__PURE__*/t("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),/*#__PURE__*/t("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]}),Qi=({style:n,...r})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),/*#__PURE__*/t("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"})]});function Xi(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var eo=0;class to extends Oi{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.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 e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new ye("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Ai(e)}}constructor(e,t,n,r,a){super(a||"unknown",e,t,n),this.connectorType="injected",this.proxyProvider=new Li(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=r;let i=r.provider;this.proxyProvider.setWalletProvider(i)}}var no="__private_"+eo+++"__walletBranding";class ro extends Oi{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Xi(this,no)[no]??{name:"Browser Extension",icon:Yi,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new ye("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Ai(e)}}constructor(e,t,n,r,a){super(a??"unknown",e,t,n),Object.defineProperty(this,no,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new Li(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(r),"metamask"===a?Xi(this,no)[no]={name:"MetaMask",icon:Ji,id:"io.metamask"}:"phantom"===a&&(Xi(this,no)[no]={name:"Phantom",icon:Qi,id:"phantom"})}}class ao extends to{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{g||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new ye("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Ai(e)}}}const io=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","ronin_wallet","haha_wallet","crypto.com_wallet_extension","crypto.com_onchain","binance","coinbase_wallet","coinbase_smart_wallet","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","bybit_wallet","ronin_wallet","haha_wallet","privy","unknown","phantom","solflare","glow","backpack"],oo=Object.freeze({phantom:{client:"phantom",name:"Phantom",installLink:m.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",chainTypes:["ethereum","solana"],get isInstalled(){if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId||e?.phantom?.solana?.isPhantom)return!0}return!1},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=lo({client:this.client,isSolana:t,connectOnly:n});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`}},solflare:{client:"solflare",name:"Solflare",installLink:m.isFirefox?"https://addons.mozilla.org/es/firefox/addon/solflare-wallet/":"https://chromewebstore.google.com/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic",chainTypes:["solana"],get isInstalled(){return"solflare"in window&&!!window?.solflare?.isSolflare},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=lo({client:this.client,isSolana:t,connectOnly:n});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${r}?ref=${r}`}},backpack:{client:"backpack",name:"Backpack",installLink:"https://chromewebstore.google.com/detail/backpack/aflkmfhebedbjioipglgcbcmnbpgliof",chainTypes:["ethereum","solana"],get isInstalled(){return!(!("backpack"in window)||!window?.backpack?.ethereum?.isBackpack&&!window?.backpack?.solana?.isBackpack)},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=lo({client:this.client,isSolana:t,connectOnly:n});return`${e?"backpack://ul/v1/":"https://backpack.com/ul/v1/"}browse/${r}?ref=${r}`}},okx_wallet:{client:"okx_wallet",name:"OKX Wallet",installLink:"https://chromewebstore.google.com/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge",chainTypes:["solana"],get isInstalled(){return"okxwallet"in window&&!!window?.okxwallet?.isOkxWallet},getMobileRedirect({isSolana:e,connectOnly:t}){return"https://www.okx.com/download?deeplink="+encodeURIComponent("okx://wallet/dapp/url?dappUrl="+lo({client:this.client,isSolana:e,connectOnly:t}))}}});function so({connectorType:e,walletClientType:t}){for(let n of io)if(e===n||t===n)return oo[n]}function lo({client:e,isSolana:t,connectOnly:n}){let r=new URL(window.location.href);return r.searchParams.set("privy_connector",t?"solana_adapter":"injected"),r.searchParams.set("privy_wallet_client",e),r.searchParams.set("privy_connect_only",String(n)),encodeURIComponent(r.href.replace(/\/$/g,""))}const co=()=>{let e=Ar.get(Ca);return e&&Array.isArray(e)&&e.map((e=>(e=>e&&"string"==typeof e.address&&"string"==typeof e.connectorType&&"string"==typeof e.walletClientType&&"number"==typeof e.connectedAt)(e))).every(Boolean)?e:[]};let ho=["phantom","glow","solflare","backpack","okx_wallet"];function uo(e){return"solana"===e.chainType}function po(e){return"solana"===e.type}class mo extends Mi{get isInstalled(){return"Installed"===this.adapter.readyState}buildConnectedWallet(e,t){let n,r,a,i;if("Installed"!==e.readyState||!e.publicKey)throw Error("Wallet is not connected.");return"signMessage"in e&&(n=async(...t)=>{if(!e.connected)throw Error("Wallet is not connected.");return await e.signMessage(t[0])}),"sendTransaction"in e&&(r=async(...t)=>await e.sendTransaction(t[0],t[1],t[2])),"signTransaction"in e&&(a=async t=>await e.signTransaction(t)),"signAllTransactions"in e&&(i=async t=>await e.signAllTransactions(t)),{type:"solana",address:e.publicKey.toBase58(),meta:t,imported:!1,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:async()=>e.connected,disconnect:()=>{try{e.disconnect()}catch(e){console.error("Wallet does not support programmatic disconnect")}},getProvider:De(`${this.walletClientType||""} wallet does not support 'getProvider'`),signMessage:n??De(`${this.walletClientType||""} wallet does not support 'signMessage'`),sendTransaction:r??De(`${this.walletClientType||""} wallet does not support 'sendTransaction'`),signTransaction:a??De(`${this.walletClientType||""} wallet does not support 'signTransaction'`),signAllTransactions:i??De(`${this.walletClientType||""} wallet does not support 'signAllTransactions'`)}}async syncAccounts(){if("Installed"===this.adapter.readyState&&this.adapter.publicKey){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};this.wallets.find((e=>this.adapter.publicKey&&e.address===this.adapter.publicKey.toBase58()))||(this.wallets=[this.buildConnectedWallet(this.adapter,e)],this.emit("walletsUpdated"))}else this.wallets.length>0&&(this.wallets=[],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.shouldAttemptAutoConnect()&&await this.adapter.autoConnect().catch((()=>{})),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.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()}shouldAttemptAutoConnect(){return!(!this.autoConnectEnabled||!ho.includes(this.walletClientType))&&("phantom"!==this.walletClientType||co().some((({walletClientType:e})=>"phantom"===e)))}constructor(e,t){super(function(e){return e.name.toLowerCase().split(" ").join("_")}(e)),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.adapter.disconnect().then((()=>this.onDisconnect())).catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await this.adapter.connect()}catch(e){throw Ai(e)}},this.onDisconnect=()=>{this.syncAccounts()},this.onConnect=e=>{this.syncAccounts()},this.onError=e=>{this.syncAccounts()},this.onReadyStateChange=e=>{"Installed"!==e&&(this.connected=!1),this.syncAccounts()},this.adapter=e,this.autoConnectEnabled=t,this.wallets=[]}}class go extends mo{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the SolanaNullConnector")}constructor({id:e,name:t,icon:n}){super({name:t},!1),this.connectorType="null",this.proxyProvider=new Li(void 0,ba),this.disconnect=async()=>{throw Error("disconnect called for an uninstalled wallet via the SolanaNullConnector")},this.promptConnection=async()=>{throw Error("promptConnection called for an uninstalled wallet via the SolanaNullConnector")},this.id=e,this.name=t,this.icon=n}}const yo=_n((()=>({listings:[]}))),fo=yo.setState,wo=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return yo.getState().listings.find((({homepage:e})=>{let n;try{n=new URL(e).hostname}catch(e){return!1}return t.includes(n)}))},vo=e=>yo((({listings:t})=>t.find((({slug:t})=>Co(t)===Co(e)))));function Co(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}function bo({src:e,...n}){/*#__PURE__*/return t("img",{src:e,...n,style:{display:"none"}})}const ko={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",externalWallets:{coinbaseWallet:{connectionOptions:"all"}},embeddedWallets:{extendedCalldataDecoding:!1},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let To=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","ronin_wallet","haha_wallet","wallet_connect","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe","solflare","backpack","binance"]),xo=e=>To.has(e),Ao=(e,t,n)=>n.indexOf(e)===t;const Io=792703809,_o="11111111111111111111111111111111";function Eo(e){return e.includes("testnet")?"testnet":e.includes("devnet")?"devnet":"mainnet-beta"}function So(e,t){return`https://explorer.solana.com/account/${e}?cluster=${t}`}let No="#FFFFFF";function Mo(e,t){let n=Math.max(0,Math.min(1,e.toHsl().l+t));return an({...e.toHsl(),l:n})}function Po({backgroundTheme:e,accentHex:t}){let n;switch(e){case"light":n=No;break;case"dark":n="#1E1E1D";break;default:n=e}let r=an(n),a=an(t),i=an("#51BA81"),o=an("#FFB74D"),s=an("#EC6351"),l=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(r.getLuminance()),c=Mo(r,"light"===l?-.04:.11),d=Mo(r,"light"===l?-.08:.16),h=Mo(r,"light"===l?-.88:.87),u=Mo(r,"light"===l?-.7:.75),p=Mo(r,"light"===l?-.43:.45).desaturate("light"===l?60:20),m=Mo(r,"light"===l?-.08:.25).desaturate("light"===l?60:20),g=Mo(a,.15),y=Mo(a,.25),f=Mo(a,-.06),w=Mo(a,-.6),v=Mo(s,.3),C=Mo(o,.3),b=an(a.getLuminance()>.5?"#040217":No),k=Mo(i,-.16),T=Mo(i,.4);return{colorScheme:l,background:r.toHslString(),background2:c.toHslString(),background3:d.toHslString(),foreground:h.toHslString(),foreground2:u.toHslString(),foreground3:p.toHslString(),foreground4:m.toHslString(),accent:a.toHslString(),accentLight:g.toHslString(),accentLightest:y.toHslString(),accentDark:f.toHslString(),accentDarkest:w.toHslString(),foregroundAccent:b.toHslString(),success:i.toHslString(),successDark:k.toHslString(),successLight:T.toHslString(),error:s.toHslString(),errorLight:v.toHslString(),warn:o.toHslString(),warnLight:C.toHslString()}}function Wo(e,t,n,r){let a,i,o,s,l,c,d,h,u,p,m,g,y,f,w,v=n?console.warn:()=>{};t?.loginMethods?(a=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),l=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),d=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),p=t.loginMethods.includes("instagram"),h=t.loginMethods.includes("tiktok"),g=t.loginMethods.includes("github"),m=t.loginMethods.includes("linkedin"),y=t.loginMethods.includes("apple"),f=t.loginMethods.includes("farcaster"),w=t.loginMethods.includes("telegram"),o=t.loginMethods.includes("passkey")):(a=e.email_auth,i=e.sms_auth,s=e.wallet_auth||e.solana_wallet_auth,l=e.google_oauth,c=e.twitter_oauth,d=e.discord_oauth,g=e.github_oauth,u=e.spotify_oauth,p=e.instagram_oauth,h=e.tiktok_oauth,m=e.linkedin_oauth,y=e.apple_oauth,f=e.farcaster_auth,w=e.telegram_auth,o=e.passkey_auth),e.passkey_auth&&(o=!0),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential&&(o=!1);let C=[a,i].filter(Boolean),b=[l,c,d,g,u,p,h,m,y,f,w].filter(Boolean),k=[s].filter(Boolean),T=t?.loginMethods?.includes("passkey")??!1,x=e.passkeys_for_signup_enabled??!1,A=[o&&(x||T)].filter(Boolean);if(C.length+b.length+k.length+A.length===0)throw Error("You must enable at least one login method");let S=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.show_wallet_login_first;S&&0===k.length?(v("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),S=!1):S||b.length+C.length!==0||(v("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),S=!0);let N=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&v("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let M=(({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(xo).filter(Ao):e?e.filter(xo).filter(Ao):ko.appearance.walletList)({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),P=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],n=[];for(let n of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(n)?console.warn(`Duplicated login method: ${n}`):t.push(n);for(let r of e.overflow??[])t.includes(r)||n.includes(r)?console.warn(`Duplicated login method: ${r}`):n.push(r);return{primary:t,overflow:n}})({input:t?.loginMethodsAndOrder}),W=t?.intl?.defaultCountry??"US",{chains:U,defaultChain:O}=function({supportedChains:e,defaultChainFromConfig:t}){let n;if(e){if(0===e.length)throw Error("`supportedChains` must contain at least one chain");n=I(e)}else n=[..._];let r=e?n[0]:E,a=t??r;if(!n.find((e=>e.id===a.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}({supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain}),L=!!t?.defaultChain,R=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,F=t?.embeddedWallets?.requireUserPasswordOnCreate,D=t?.embeddedWallets?.createOnLogin,B=R?"all-users":e.embedded_wallet_config.ethereum.create_on_login,z=e.embedded_wallet_config.solana.create_on_login,$={"mainnet-beta":{rpcUrl:"https://api.mainnet-beta.solana.com",blockExplorerUrl:"https://explorer.solana.com"},testnet:{rpcUrl:"https://api.testnet.solana.com",blockExplorerUrl:"https://explorer.solana.com/?cluster=testnet"},devnet:{rpcUrl:"https://api.devnet.solana.com",blockExplorerUrl:"https://explorer.solana.com/?cluster=devnet"}};if(t?.solanaClusters)for(let e of t.solanaClusters){let{name:t,rpcUrl:n,blockExplorerUrl:r}=e;$[t]={rpcUrl:n??$[t].rpcUrl,blockExplorerUrl:r??$[t].blockExplorerUrl}}e.solana_wallet_auth&&!t?.externalWallets?.solana?.connectors&&console.warn("App configuration has Solana wallet login enabled, but no Solana wallet connectors have been passed to Privy. Make sure to pass Solana connectors to the `config.externalWallets.solana.connectors` field of the `PrivyProvider`");let j=e.telegram_auth_config?{botId:e.telegram_auth_config.bot_id,botName:e.telegram_auth_config.bot_name,linkEnabled:e.telegram_auth_config.link_enabled,seamlessAuthEnabled:e.telegram_auth_config.seamless_auth_enabled}:void 0,V=e.funding_config?{methods:e.funding_config.methods,options:e.funding_config.options,defaultRecommendedAmount:e.funding_config.default_recommended_amount,defaultRecommendedCurrency:e.funding_config.default_recommended_currency,promptFundingOnWalletCreation:e.funding_config.prompt_funding_on_wallet_creation,crossChainBridgingEnabled:e.funding_config.cross_chain_bridging_enabled}:void 0;return{id:e.id,name:e.name,allowlistConfig:{errorTitle:e.allowlist_config.error_title,errorDetail:e.allowlist_config.error_detail,errorCtaText:e.allowlist_config.cta_text,errorCtaLink:e.allowlist_config.cta_link},legacyWalletUiConfig:e.legacy_wallet_ui_config,appearance:{logo:t?.appearance?.logo??e.logo_url??void 0,landingHeader:t?.appearance?.landingHeader??ko.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,footerLogo:t?.appearance?.footerLogo,palette:Po({backgroundTheme:t?.appearance?.theme??ko.appearance.theme,accentHex:t?.appearance?.accentColor??e.accent_color??ko.appearance.accentColor}),loginGroupPriority:S?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:M,walletChainType:t?.appearance?.walletChainType??(({evmWalletAuth:e,solanaWalletAuth:t})=>e&&t?"ethereum-and-solana":e?"ethereum-only":t?"solana-only":"ethereum-only")({evmWalletAuth:e.wallet_auth??!1,solanaWalletAuth:e.solana_wallet_auth??!1})},loginMethods:{wallet:s,email:a,sms:i,passkey:o,google:l,twitter:c,discord:d,github:g,spotify:u,instagram:p,tiktok:h,linkedin:m,apple:y,farcaster:f,telegram:w},disablePlusEmails:e.disable_plus_emails,loginMethodsAndOrder:P,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.terms_and_conditions_url,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacy_policy_url,requireUsersAcceptTerms:e.require_users_accept_terms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.wallet_connect_cloud_project_id??ko.walletConnectCloudProjectId,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},chains:U,solanaClusters:$,defaultChain:O,intl:{defaultCountry:W},shouldEnforceDefaultChainOnConnect:L,captchaEnabled:e.captcha_enabled??ko.captchaEnabled,captchaSiteKey:e.captcha_site_key,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??ko.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:N},solana:{connectors:t?.externalWallets?.solana?.connectors},disableAllExternalWallets:t?.externalWallets?.disableAllExternalWallets??!1},embeddedWallets:{requireUserOwnedRecoveryOnCreate:F??(!R&&(e.embedded_wallet_config.require_user_owned_recovery_on_create??!1)),userOwnedRecoveryOptions:R?["user-passcode"]:e.embedded_wallet_config.user_owned_recovery_options,priceDisplay:t?.embeddedWallets?.priceDisplay??{primary:"fiat-currency",secondary:"native-token"},ethereum:{createOnLogin:D??t?.embeddedWallets?.ethereum?.createOnLogin??B},solana:{createOnLogin:t?.embeddedWallets?.solana?.createOnLogin??z},mode:e.embedded_wallet_config.mode,showWalletUIs:t?.embeddedWallets?.showWalletUIs??e.enforce_wallet_uis??!0,extendedCalldataDecoding:t?.embeddedWallets?.extendedCalldataDecoding??!1,transactionScanning:{enabled:t?.embeddedWallets?.transactionScanning?.enabled??!1,domain:t?.embeddedWallets?.transactionScanning?.domain??r??"https://auth.privy.io"}},mfa:{methods:e.mfa_methods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},passkeys:{shouldUnlinkOnUnenrollMfa:t?.passkeys?.shouldUnlinkOnUnenrollMfa,shouldUnenrollMfaOnUnlink:t?.passkeys?.shouldUnenrollMfaOnUnlink},customAuth:R?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:j,passkeysForSignupEnabled:e.passkeys_for_signup_enabled},headless:!!t?.headless,render:{standalone:t?._render?.standalone??ko._render.standalone},fundingConfig:V,fundingMethodConfig:{...t?.fundingMethodConfig??ko.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??ko.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??ko.fundingMethodConfig.moonpay.useSandbox}},whatsAppEnabled:!!e.whatsapp_enabled}}const Uo={show_wallet_login_first:!0,allowlist_config:{error_title:null,error_detail:null,cta_text:null,cta_link:null},wallet_auth:!0,email_auth:!0,sms_auth:!1,google_oauth:!1,twitter_oauth:!1,discord_oauth:!1,github_oauth:!1,linkedin_oauth:!1,apple_oauth:!1,disable_plus_emails:!1,terms_and_conditions_url:null,privacy_policy_url:null,embedded_wallet_config:{create_on_login:"off",ethereum:{create_on_login:"off"},solana:{create_on_login:"off"},require_user_owned_recovery_on_create:!1,user_owned_recovery_options:["user-passcode"],mode:"legacy-embedded-wallets-only"},fiat_on_ramp_enabled:!1,captcha_enabled:!1,captcha_site_key:"",enforce_wallet_uis:!1,legacy_wallet_ui_config:!1,id:"",name:"",passkeys_for_signup_enabled:!1,whatsapp_enabled:!1},Oo=Wo(Uo,void 0,!1);let Lo=/*#__PURE__*/c({appConfig:Oo,isServerConfigLoaded:!1});const Ro=({children:e,client:n,legacyClient:r,clientConfig:a})=>{let[i,l]=o(null),c=s((()=>Wo(i??Uo,a,!!i,"undefined"!=typeof window?window.location.origin:void 0)),[i,a]);return d((()=>{if(!i)return;let e=function(e){if(!e)return{};let{appearance:t,supportedChains:n,defaultChain:r,externalWallets:a,...i}=e;return{...i,...n?{supportedChains:n.map((e=>e.id))}:void 0,...r?{defaultChain:r.id}:void 0,...a?{walletConnect:a.walletConnect,coinbaseWallet:a.coinbaseWallet,solana:{connectors:a.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0}}(a),t=function(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t,a=0;a<e.length;a++)n=Math.imul(n^(t=e.charCodeAt(a)),2654435761),r=Math.imul(r^t,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&(r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}(JSON.stringify(e)).toString(),n=`privy:sent:${i.id}:${t}`;localStorage.getItem(n)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(n,"t"))}),[a,i]),d((()=>{i||(async()=>{try{await n.initialize();let e=n.app.getConfig();e.custom_api_url&&r.updateApiUrl(e.custom_api_url),l(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),/*#__PURE__*/t(Lo.Provider,{value:{appConfig:c,isServerConfigLoaded:!!i},children:e})},Fo=()=>{let{appConfig:e}=l(Lo);return e},Do=()=>{let{isServerConfigLoaded:e}=l(Lo);return e},Bo=/*#__PURE__*/c({app:Oo,currentScreen:null,lastScreen:null,navigate:Le,navigateBack:Le,resetNavigation:Le,setModalData:Le,onUserCloseViaDialogOrKeybindRef:void 0}),zo=n=>{let r=Fo(),a=n.authenticated,[s,l]=o(n.initialScreen);d((()=>{a||!n.initialScreen||n.initialScreen.isUnauthenticatedScreem||n.setInitialScreen(null)}),[a]);let c=i(null);d((()=>{n.open||(c.current=null)}),[n.open]),d((()=>{c.current=null}),[n.initialScreen]);let h={app:r,data:n.data,setModalData:n.setModalData,currentScreen:n.initialScreen,lastScreen:s,navigate:(e,t=!0)=>{n.setInitialScreen(e),t&&l(n.initialScreen)},navigateBack:()=>{n.setInitialScreen(s)},resetNavigation:()=>{n.setInitialScreen(null),l(null)},onUserCloseViaDialogOrKeybindRef:c};/*#__PURE__*/return e(Bo.Provider,{value:h,children:[("string"==typeof r.appearance.logo||"img"===r.appearance.logo?.type)&&/*#__PURE__*/t(bo,{src:"string"==typeof r.appearance.logo?r.appearance.logo:r.appearance.logo.props.src}),n.children]})},$o=()=>l(Bo),jo=({style:n,...r})=>{let{app:a}=$o();/*#__PURE__*/return e("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"28",height:"28",rx:"3",fill:"dark"===a?.appearance.palette.colorScheme?"#3396ff":"#141414"}),/*#__PURE__*/t("g",{clipPath:"url(#clip0_1765_9946)",children:/*#__PURE__*/t("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"})}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_1765_9946",children:/*#__PURE__*/t("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};class Vo extends Oi{async initialize(){let e=await this.createProvider();this.provider=e,this.proxyProvider.setWalletProvider(e),this.subscribeListeners(),e.session&&(this.walletProvider?.session?.peer.metadata.url&&(this.walletEntry=wo(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown"),this.connected=!0,await this.syncAccounts()),this.initialized=!0,this.emit("initialized");let{createAppKit:t}=await import("@reown/appkit");this.modal=t({projectId:this.walletConnectCloudProjectId,themeVariables:{"--w3m-z-index":1e6},networks:this.chains,includeWalletIds:Vr}),this.modal.subscribeState((e=>{e.open||this.walletProvider?.session||!this.onQrModalClosed||this.onQrModalClosed()}))}async connect(e){return e.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){let e=this.walletProvider?.session?.peer.metadata.icons?.[0];return{name:Rr(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:"string"==typeof e?e:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAHdElNRQfoDAIVODUC+w+GAAAGsUlEQVRYw6WXbYwWVxXHf+fOLAtCXYS2QJdIaClipGCTknXXNqBQMVHbfmhItH4Aral+IAEaG03UxJgYKQJGTUxtDWjaxDSNtcZqIGDwpRuW1oYiVqpdpZSlpC3qysu+PHPP3w/3mXnmeXZbPzjJZO7cefn/z/mfe865xlscq3dGDIguGiHLaMQVLja4s87FShcLo5jtApdddnHexUmHIy475JmdUkPRAQMu7gzT4ljnxJpdk0QPmMFkyAKN2OfOFpc2uuh1J3MZDrjAvXmVEQUuoosRxw642FcEG7IoDxiFxNiu8NYE+vcUYIFYRKKs113bXWx2Z34CoQZsVHOiCZ7mopdzdsFhv8NexEgRDHMxUSNREbh1bwNZwBsFblmfu/a4a6AEENYO5i3AOoEWeEUCF4MOOxBDMQAOk99OJALA2u80sBCwWGBZWG/yRwMaCAbBIAsQTJT3gea1OWfNeaPzvjoHEI85rA8ObtB1v7cIdJkIHgkh9AXpocy0LJjIKvB2wPpZB0v3wkrw5jdNEjeYeMhFX3BAyfn2ke9NUrgB9LrrcZcGJFCld4fWNddXbvbWfWzGR6xJFZsBGh0cBh3bBIxIEGTQ3W0h4NuDaSAzyAxCmGq11Vzf5uaa1aG8p+WFtrEYQGwvjICJkAEqvC+YNmcmMlMNvEaCdrcbyUvQAWDTjVuESHObM6cPGWHmzDwLaEtmzG9Z3qF1zUpXmuuZBb1z4bqeNC6f0WE1NtUTwHzEloiy3BvFisy0sYoLlQtT6XW15md2Qf9SY+2Ngfdca/TMSm/9ewz+/Boc/It45h/i4kSTsKw90SQJsPTvjSZbkWemDW7qTRZ0JEYJWSKxZJ7xmf6M224MzMzbX1s8F1YugjtvMg6eErt/4/z1jUrz1rXUKxnZC2zIg2mdBTK1mFUOKC1fOt/48kdzVixIz86Nij+eEacvpJWyZJ5xy7th8VzjjpuMJfMCW58QL73ekXPVlhsyE+vyzFiplJyauEIyrGIquruMq7qTxk+dcB495rzyTzFepCUWLIFv/kBg081Gd55WUk1IDGFTS89K++TDYxddzKnWcbluHd450xgdh7EGrOo1rr868PMTzqWJRGZ2d8oB/xpL33Xnxl2rjeNn4blXRXduzJ4B5y+28kWscAwXl+yeR654FFZPHoUb710YuPeDOUdPO48di1xptKpeEeHqOcYXNwQKGd88EDk3mqxtxPSfGRlsXRtYt8z4ytPOH/7eqpg1Aso7fYKgK4NPrMpYvsC4/poMA34yVJIQC3sCD9yecdsNyaV5yPj6ryJnR1PAvSNP4J+/1cgDfLbfePaMGGtM7Qdyl12WmKOmXgKKAp54vmBRTxfLrjE+tSYjBPjRM5FrrzIeuD2jf2lLzw8vN4JlfPVp581LsO1DgXv7jSzAiXPw/d+JiYLpjsu26Yfjf5O0rF5WoxsNT9G/bX0XKxakmPjlSee6HlizJJXSX7/oRDc+vjKR+f2wODcKd78/gR8/C9uedF44myJxmhh4OY/ipMQyqaWxmjn95TfEroMFOzbkvG+RceeqViPx1Aln1yEnOow1AnffHCpJAJ5/Vex4UvzptZRdY/O/1dJIS/NkcNmR6MTYah6qzseA4TfFtw4UvHBW1bc/O+7sPhwZHYf/jMODh5yfPudVbXj2TAJ/8XxrOZagNamj4Ei2/GNfuyRxh8t6BG2l15up+MIVODEiFr8rcPS0+O6RBF6mrrEGHHtFzOo2Lo7Dl37hvPQ6mNV6R9JYKgnYWcE37K5HlE2OT/5A0udaPUBHH+BQOMzuNsYLuDyZflTW+fTcmJFDHhJhaZqewMuewXDxcDR9IYyPN6Jj+6K4MF2vV8qBtZJScqVRNi6lpGONVJis5mpKi1WbgwsY+zIsBpcR8mzIZfuTRVZrtdu9odrptR/Xx5XONXJqBmCN0P6YMUQq9WJiwt0Je102WHdbpxSqydMObBWYdwDWLVcqcIMYe3NPjg0Ht84od0Ajju1w2XCr9e6QoqM9V23ZtnmI6cfAMMb9AY0YEHdb6oobEh4y3H3Ize6LsmGvN5IdUnhttdQ9UVrfLk/ljWEZ9wXsqAdQk1EA+O22GcgdZTke/bAs3OPY4HSdcB20HhvVtTMu0jmI8ekAhz2IICj2hKpNqI60NcuIRUHEej1quzubXa2tmZhenrfZmv3YYQ9ipDAIgvHptmblccuDjdRcmjFpWbDi/9ycZjZkRbk5jYztai/AUwiUx+qdEQB/m+25i9lxyvbcjrg45Lmd0uT/3p7/Fw6ODf+WO019AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI0LTEyLTAyVDIxOjU2OjQ4KzAwOjAwMVpslgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNC0xMi0wMlQyMTo1Njo0OCswMDowMEAH1CoAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjQtMTItMDJUMjE6NTY6NTMrMDA6MDDZv6GRAAAAAElFTkSuQmCC",id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(e){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(qr)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new xi)},(async()=>{let t="",n=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(n?.length&&(t=n[0]),!t||""===t)throw new ye("Unable to retrieve address");this.walletProvider?.session?.peer.metadata.url&&(this.walletEntry=wo(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown",this.proxyProvider.rpcTimeoutDuration=Pi(this.rpcConfig,this.walletClientType)),this.connected=!0,await this.syncAccounts(n),e()})().catch((e=>{t(e?Ai(e):new ye("Unknown error during connection"))})).finally((()=>this.modal?.close()))}))}disconnect(){this.walletProvider?.disconnect().then((()=>this.onDisconnect())).catch((()=>console.warn("Unable to disconnect Wallet Connect provider")))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(e){this.proxyProvider.setWalletProvider(e)}async createProvider(){let e={};for(let t of this.chains){let n=zr(t.id,this.chains,this.rpcConfig,this.privyAppId);n&&(e[t.id]=n)}let t=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map((e=>e.id)),r=await xn.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:n,optionalEvents:An,optionalMethods:In,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return r.on("display_uri",(e=>{if(r.signer.abortPairingAttempt(),this.walletEntry){let{redirect:t,href:n}=function(e,t){let n=Hr(t);if(n.deepLink)return Zr(n.deepLink,e);if(n.universalLink)return Gr(n.universalLink,e);throw new de(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);(function({href:e,name:t}){try{localStorage.setItem(qr,JSON.stringify({href:e,name:t}))}catch{}})({href:n,name:this.walletEntry.metadata?.shortName||this.walletEntry.name}),this.redirectUri=t;let r=function(e,t){let n=Hr(t);if(n.universalLink)return Gr(n.universalLink,e)}(e,this.walletEntry);r?.redirect&&(this.fallbackUniversalRedirectUri=r.redirect),g?(Yr(t,"_self"),this.showPrivyQrModal?.({native:t,universal:this.fallbackUniversalRedirectUri})):this.showPrivyQrModal?this.showPrivyQrModal?.({native:t,universal:this.fallbackUniversalRedirectUri}):this.modal?.open({uri:e})}else this.modal?.open({uri:e})})),r.on("connect",(()=>{this.modal?.close(),r.session?.peer.metadata.url&&(this.walletEntry=wo(r.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown")})),r}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await(this.walletProvider?.enable())}setWalletEntry(e,t){this.walletEntry=e,this.showPrivyQrModal=t}constructor(e,t,n,r,a,i,o,s){super(s||"unknown",n,r,t),this.connectorType="wallet_connect_v2",this.privyAppId=i,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new Li(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=(e=>yo.getState().listings.find((({slug:t})=>Co(t)===Co(e))))(s),this.walletClientType=s)}}class Ho extends Jt{get wallets(){let e=new Set,t=this.walletConnectors.flatMap((e=>e.wallets)).sort(((e,t)=>e.connectedAt&&t.connectedAt?t.connectedAt-e.connectedAt:0)).filter((t=>{let n=`${t.address}${t.walletClientType}${t.connectorType}${t.meta.id}`;return!e.has(n)&&(e.add(n),!0)})),n=t.findIndex((e=>e.address===(this.activeWallet?this.activeWallet:"unknown")));return n>=0&&t.unshift(t.splice(n,1)[0]),t}async initialize(e){if(this.initialized&&!e||(e&&this.removeAllConnectors(),Ar.get(va)&&(Ar.getKeys().forEach((e=>{e.startsWith("walletconnect")&&Ar.del(e)})),Ar.del(va)),this.externalWalletConfig.disableAllExternalWallets))return;let t=Dr({store:this.store,walletList:this.walletList,externalWalletConfig:this.externalWalletConfig,walletChainType:this.walletChainType}).then((e=>{e.forEach((({type:e,eip6963InjectedProvider:t,legacyInjectedProvider:n})=>{this.createEthereumWalletConnector({connectorType:"injected",walletClientType:e,providers:{eip6963InjectedProvider:t,legacyInjectedProvider:n}})}))}));for(let e of(this.walletList.includes("coinbase_wallet")&&this.createEthereumWalletConnector({connectorType:"coinbase_wallet",walletClientType:"coinbase_wallet"}),Object.values(oo)))!e.isInstalled&&this.walletList.includes(e.client)&&(["ethereum-only","ethereum-and-solana"].includes(this.walletChainType)&&e.chainTypes.includes("ethereum")&&this.createEthereumWalletConnector({connectorType:"null",walletClientType:e.client,walletConfig:e}),["ethereum-and-solana","solana-only"].includes(this.walletChainType)&&e.chainTypes.includes("solana")&&this.addSolanaWalletConnector(new go({id:e.client,name:e.name})));this.externalWalletConfig.walletConnect.enabled&&this.createEthereumWalletConnector({connectorType:"wallet_connect_v2",walletClientType:"unknown"}),this.externalWalletConfig.solana.connectors?.get().forEach(this.addSolanaWalletConnector),this.externalWalletConfig.solana.connectors?._setOnConnectorsUpdated?.((e=>{e?.forEach(this.addSolanaWalletConnector)})),await t,this.initialized=!0}findWalletConnector(e,t){return"wallet_connect_v2"===e?this.walletConnectors.filter(Ui).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(Ui).find((n=>n.connectorType===e&&n.walletClientType===t))??null}findSolanaWalletConnector(e){return this.walletConnectors.filter(uo).find((t=>"unknown"===t.walletClientType?t.walletBranding.id===e:t.walletClientType===e))??null}findEmbeddedWalletConnectors(){return this.walletConnectors.filter((e=>"embedded"===e.connectorType))}onInitialized(e){e.wallets.forEach((e=>{let t=this.storedConnections.find((t=>t.address===e.address&&t.connectorType===e.connectorType&&("solana"===e.type&&"unknown"===t.walletClientType&&"unknown"===e.walletClientType?e.meta.id===t.id:t.walletClientType===e.walletClientType)));t&&(e.connectedAt=t.connectedAt)})),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(e){e.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnectors({walletProxy:e,user:t,embeddedWallets:n,defaultChain:r,appId:a}){let{entropyId:i,entropyIdVerifier:o}=bi(t);for(let t of n){let n=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===t.walletIndex));if(n&&Ui(n))n.proxyProvider.walletProxy=e;else{let n=new zi({provider:new Zi({walletProxy:e,address:t.address,entropyId:i,entropyIdVerifier:o,rpcConfig:this.rpcConfig,chains:this.chains,appId:a,chainId:r.id,walletIndex:t.walletIndex}),chains:this.chains,defaultChain:r,rpcConfig:this.rpcConfig,imported:!1,walletIndex:t.walletIndex});this.addWalletConnector(n)}}}addImportedWalletConnector(e,t,n,r){let a=this.findWalletConnector("embedded_imported","privy");if(a&&Ui(a))a.proxyProvider.walletProxy=e;else{let a=new zi({provider:new Zi({walletProxy:e,address:t,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:r,chainId:n.id}),chains:this.chains,walletIndex:0,defaultChain:n,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(a)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.saveConnectionHistory(),this.storedConnections=co(),this.emit("walletsUpdated")}removeImportedWalletConnector(){let e=this.findWalletConnector("embedded_imported","privy");if(e){let t=this.walletConnectors.indexOf(e);this.walletConnectors.splice(t,1),this.saveConnectionHistory(),this.storedConnections=co(),this.emit("walletsUpdated")}}async createEthereumWalletConnector({connectorType:e,walletClientType:t,providers:n,walletConfig:r}){let a=this.findWalletConnector(e,t);if(a&&Ui(a))return a instanceof Vo&&a.resetConnection(t),a;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new Di(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):"null"!==e?new Vo(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,t):r?new Gi({id:r.client,name:r.name,defaultChain:this.defaultChain,walletClientType:r.client}):null:"metamask"===t&&n?.eip6963InjectedProvider?new ao(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask"):"metamask"===t&&n?.legacyInjectedProvider?new ro(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask"):"phantom"===t&&n?.legacyInjectedProvider?new ro(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom"):n?.legacyInjectedProvider&&"unknown_browser_extension"===t?new ro(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider):n?.eip6963InjectedProvider?new to(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,t):void 0)();return i&&this.addWalletConnector(i),i||null}addWalletConnector(e){this.walletConnectors.push(e),e.on("initialized",(()=>this.onInitialized(e))),e.on("walletsUpdated",(()=>this.onWalletsUpdated(e))),e.initialize().catch((e=>{console.debug("Failed to initialize connector",e)}))}saveConnectionHistory(){let e=this.wallets.map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt,id:e.meta.id})));Ar.put(Ca,e)}async activeWalletSign(e){let t=this.wallets,n=t.length>0?t[0]:null;return n&&Si(n)?n.sign(e):null}setActiveWallet(e){this.activeWallet=v(e),this.emit("walletsUpdated")}setWalletList(e){this.walletList=e,this.initialized&&this.initialize(!0).catch(console.error)}removeAllConnectors(){for(let e of this.walletConnectors)e.removeAllListeners();this.walletConnectors=[]}constructor(e,t,n,r,a,i,o,s,l,c,d,h){super(),this.addSolanaWalletConnector=async e=>{let t=this.findSolanaWalletConnector(e.walletClientType);if(!t||"null"===t.connectorType){if("null"===t?.connectorType){let e=this.walletConnectors.indexOf(t);this.walletConnectors.splice(e,1)}this.addWalletConnector(e)}},this.getEthereumProvider=()=>{let e=this.wallets[0],t=this.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new Li},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=n,this.chains=r,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=i,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=c,this.privyAppLogo=d,this.walletChainType=h||"ethereum-only",this.storedConnections=co()}}let qo=[ze,$e,je];class Ko{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw ue(e)}}async post(e,t,n){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...n})}catch(e){throw ue(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw ue(e)}}constructor({appId:e,appClientId:t,client:n,defaults:r}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=n.clientAnalyticsId,this.sdkVersion=ra,this.client=n,this.defaults=r,this.fallbackApiUrl=n.fallbackApiUrl,this.baseFetch=or.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:e,options:t})=>{let n=new Headers(t.headers);n.set("privy-app-id",this.appId),this.appClientId&&n.set("privy-client-id",this.appClientId),n.set("privy-ca-id",this.clientAnalyticsId||""),n.set("privy-client",`react-auth:${this.sdkVersion}`);let r=qo.includes(e.toString());if(!n.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:r});null!==e&&n.set("authorization",`Bearer ${e}`)}t.headers=n,t.retryDelay&&"number"==typeof t.retryDelay&&(t.retryDelay=3*t.retryDelay)},onRequestError:({error:e})=>{if(e instanceof DOMException&&"AbortError"===e.name)throw new Be}})}}let Zo=/paymaster\.biconomy\.io\/api/i,Go={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}};const Yo=(e,t)=>e&&Zo.test(e)?Go:t&&t.policy_id?{policyId:t.policy_id}:void 0;class Jo{async authenticate(){if(!this.api)throw new de("Auth flow has no API instance");try{return await this.api.post(Ve,{token:this.meta.token})}catch(e){throw ue(e)}}async link(){throw Error("Unimplemented")}constructor(e){this.meta={token:e}}}class Qo{getOrCreateGuestCredential(e){let t=ua(e);if(xr()){if(Ar.get(t))return Ar.get(t);{let e=Yt.encode(_a(32));return Ar.put(t,e),e}}return Yt.encode(_a(32))}async authenticate(){if(!this.api)throw new de("Auth flow has no API instance");try{return await this.api.post(He,{guest_credential:this.meta.guestCredential})}catch(e){throw ue(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function Xo(){return!(f&&window.location.origin.startsWith("http://localhost"))}const es=_n((()=>({identityToken:null})));function ts(){let{identityToken:e}=es();return{identityToken:e}}var ns,rs=((ns={}).PRIVY="privy_access_token",ns.CUSTOMER="customer_access_token",ns);class as{get token(){return this.privyAccessToken||this.customerAccessToken}getToken(e){return"privy_access_token"===e?this.privyAccessToken:this.customerAccessToken}get customerAccessToken(){return this._getToken(aa)}get privyAccessToken(){return this._getToken(sa)}_getToken(e){try{let t=Ar.get(e);return"string"==typeof t?li.throwIfNotWellFormedJwt(t):null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=Ar.get(oa);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=Ar.get(pa(e));if("string"!=typeof t)return null;{let n=new li(t);return n.isExpired()?(Ar.del(pa(e)),null):n.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=vr.get(da);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(e="privy_access_token"){let t="string"==typeof this.getToken(e),n="string"==typeof this.refreshToken&&"deprecated"!==this.refreshToken;return this.mightHaveServerCookies||t&&n}hasActiveAccessToken(e){let t=li.parse(this.getToken(e));return null!==t&&!t.isExpired(30)}authenticate(e){return this.authenticateOnce.execute(e)}link(e){return this.linkOnce.execute(e)}refresh(){return this.refreshOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(e,t){"string"==typeof t?Ar.put(pa(e),t):Ar.del(pa(e))}updateIdentityToken(e){"string"==typeof e?this.storeIdentityToken(e):this.clearIdentityToken()}async _authenticate(e){try{let t=await e.authenticate(),{user:n,is_new_user:r,oauth_tokens:a}=t;this.handleTokenResponse(t);let i=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0;return this._trackAuthenticateEvents(e,r),{user:vi(n),isNewUser:r,oAuthTokens:i}}catch(e){throw console.warn("Error authenticating session"),qe(e)}}_trackAuthenticateEvents(e,t){let n=function(e){return e instanceof br?"email":e instanceof Qa?"sms":e instanceof Ga?"siwe":e instanceof Qo?"guest":e instanceof Jo?"custom_auth":e instanceof Ma?e.meta.provider:null}(e);n&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:n,isNewUser:t}}),"siwe"===n&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}})}async _link(e){try{let t=await e.link(),n=t.oauth_tokens,r=n?{provider:n.provider,accessToken:n.access_token,accessTokenExpiresInSeconds:n.access_token_expires_in_seconds,refreshToken:n.refresh_token,refreshTokenExpiresInSeconds:n.refresh_token_expires_in_seconds,scopes:n.scopes}:void 0;return{user:vi(t),oAuthTokens:r}}catch(e){throw console.warn("Error linking account"),qe(e)}}async _refresh(){if(!this.api)throw new de("Session has no API instance");if(!this.client)throw new de("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,t=this.refreshToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(!(e&&t||this.mightHaveServerCookies))return null;{let r={};e&&(r.authorization=`Bearer ${e}`),n=await this.api.post(ze,t?{refresh_token:t}:{},{headers:r})}return this.handleTokenResponse(n),vi(n.user)}catch(e){if(e instanceof Ke&&e.privyErrorCode===ke.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw qe(e)}}handleTokenResponse(e){e.session_update_action&&"set"!==e.session_update_action?"clear"===e.session_update_action?this.destroyLocalState():"ignore"===e.session_update_action&&(e.token&&(this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token)),e.identity_token&&this.storeIdentityToken(e.identity_token)):this._storeAllTokens(e)}_storeAllTokens(e){this.storeRefreshToken(e.refresh_token),this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token),e.identity_token&&this.storeIdentityToken(e.identity_token)}async _destroy(){try{await(this.api?.post($e,{refresh_token:this.refreshToken}))}catch(e){console.warn("Error destroying session")}this.destroyLocalState()}destroyLocalState(){this.storeRefreshToken(null),this.storeCustomerAccessToken(null),this.storePrivyAccessToken(null),this.clearIdentityToken()}storeCustomerAccessToken(e){if("string"==typeof e){let t=Ar.get(aa);if(Ar.put(aa,e),!this.client?.useServerCookies){let t=li.parse(e)?.expiration;vr.set(ia,e,{sameSite:"Strict",secure:Xo(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreCustomerAccessToken?.(e)}else Ar.del(aa),vr.remove(ia),this.client?.onDeleteCustomerAccessToken?.()}storeRefreshToken(e){"string"==typeof e?(Ar.put(oa,e),this.client?.useServerCookies||vr.set(da,"t",{sameSite:"Strict",secure:Xo(),expires:30})):(Ar.del(oa),vr.remove("privy-refresh-token"),vr.remove(da))}storePrivyAccessToken(e){"string"==typeof e?Ar.put(sa,e):Ar.del(sa)}storeIdentityToken(e){if(es.setState({identityToken:e}),this.client?.useServerCookies)return;Ar.put(la,e);let t=li.parse(e)?.expiration;vr.set(ca,e,{sameSite:"Strict",secure:Xo(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){Ar.del(la),es.setState({identityToken:null}),vr.remove(ca)}constructor(){this.authenticateOnce=new Jr((async e=>this._authenticate(e))),this.linkOnce=new Jr((async e=>this._link(e))),this.refreshOnce=new Jr(this._refresh.bind(this)),this.destroyOnce=new Jr(this._destroy.bind(this))}}let is;var os=0,ss="__private_"+os+++"__getOrGenerateClientAnalyticsId";class ls{initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:n,defaultChain:r,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l,walletChainType:c}){this.connectors||(this.connectors=new Ho(this.appId,e,t,n,r,a,i,o,s,l,void 0,c))}generateApi(){let e=new Ko({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=e,e}updateApiUrl(e){this.apiUrl=e||this.fallbackApiUrl,this.api=this.generateApi(),e&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new de("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new de("No auth flow in progress.");let{oAuthTokens:e}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:e}}storeProviderAccessToken(e,t){this.session.storeProviderAccessToken(e,t)}getProviderAccessToken(e){return this.session.getProviderAccessToken(e)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(e){e.linkedAccounts.filter((e=>"cross_app"===e.type)).forEach((e=>{this.storeProviderAccessToken(e.providerApp.id,null)}))}startAuthFlow(e){return e.api=this.api,this.authFlow=e,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(Ze,{action:"verify"})}catch(e){throw ue(e)}}async initMfaPasskeyVerification(){try{return(e=>({rpId:e.rp_id,challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.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}))((await this.api.post(Ge,{})).options)}catch(e){throw ue(e)}}async getCrossAppProviderDetails(e){try{return this._cachedProviderAppDetails[e]||(this._cachedProviderAppDetails[e]=await this.api.get(`/api/v1/apps/${e}/cross-app/details`)),this._cachedProviderAppDetails[e]}catch(e){console.error("Error fetching cross app provider details",e)}}async acceptTerms(){try{return vi(await this.api.post(Ye,{}))}catch(e){throw qe(e)}}async unlinkEmail(e){try{let t=await this.api.post(Je,{address:e});return await this.getAuthenticatedUser()??vi(t)}catch(e){throw qe(e)}}async unlinkPhone(e){try{let t=await this.api.post(Qe,{phoneNumber:e});return await this.getAuthenticatedUser()??vi(t)}catch(e){throw qe(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post(Xe,{address:e});return await this.getAuthenticatedUser()??vi(t)}catch(e){throw qe(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post(et,{address:e});return await this.getAuthenticatedUser()??vi(t)}catch(e){throw qe(e)}}async unlinkOAuth(e,t){try{let n=await this.api.post(tt,{provider:e,subject:t});return await this.getAuthenticatedUser()??vi(n)}catch(e){throw qe(e)}}async unlinkFarcaster(e){try{let t=await this.api.post(nt,{fid:e});return await this.getAuthenticatedUser()??vi(t)}catch(e){throw qe(e)}}async unlinkTelegram(e){try{let t=await this.api.post(rt,{telegram_user_id:e});return await this.getAuthenticatedUser()??vi(t)}catch(e){throw qe(e)}}async revokeDelegatedWallet(){try{await this.api.post(at,{})}catch(e){throw qe(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:n,options:r}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(je,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:n?n.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:r?.keepAlive??!1})}catch(e){console.log("Unable to submit event. This is not an issue.")}}async signMoonpayOnRampUrl(e){try{return this.api.post(it,e)}catch(e){throw qe(e)}}async initCoinbaseOnRamp(e){try{return this.api.post(ot,e)}catch(e){throw qe(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`${st}?partnerUserId=${e}`)}catch(e){throw qe(e)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()?this.session.refresh():null}async getAccessToken(e){return await this.getPrivyAccessToken(e)||await this.getCustomerAccessToken(e)}async getCustomerAccessToken(e){return await this._getToken(rs.CUSTOMER,e)}async getPrivyAccessToken(e){return await this._getToken(rs.PRIVY,e)}async _getToken(e,t){return this.session.getToken(e)?this.session.hasActiveAccessToken(e)?this.session.hasRefreshCredentials(e)?ci.parse(this.session.getToken(e))?.appId!==this.appId?(await this.logout(),null):this.session.getToken(e):(this.session.destroyLocalState(),null):!t?.disableAutoRefresh&&this.session.hasRefreshCredentials(e)?(await this.session.refresh(),this.session.getToken(e)):null:null}async getSmartWalletsConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let n=await this.api.get(`/api/v1/apps/${this.appId}/smart_wallets`,{baseURL:this.fallbackApiUrl,headers:e});return n.enabled?{enabled:n.enabled,smartWalletType:n.smart_wallet_type,configuredNetworks:n.configured_networks.map((e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url,paymasterContext:Yo(e.paymaster_url,e.paymaster_context)})))}:{enabled:n.enabled}}catch(e){throw qe(e)}}async getUsdTokenPrice(e){try{return(await this.api.get(`/api/v1/token_price?chainId=${e.id}&tokenSymbol=${e.nativeCurrency.symbol}`)).usd}catch(t){return void console.error(`Unable to fetch token price for chain with id ${e.id}`)}}async getUsdPriceForSol(){try{return(await this.api.get("/api/v1/token_price?chainId=0&tokenSymbol=SOL")).usd}catch(e){return void console.error("Unable to fetch token price for SOL")}}async getSplTokenMetadata({mintAddress:e,cluster:t}){try{return await this.api.get(`/api/v1/spl_token_info?mint_address=${e}&cluster=${t}`)}catch(n){return void console.error(`Unable to fetch token metadata for ${t}:${e}`)}}async requestFarcasterSignerStatus(e){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:e})}catch(e){throw console.error("Unable to fetch Farcaster signer status"),e}}async generateSiweNonce({address:e,captchaToken:t}){try{return(await this.api.post(lt,{address:e,token:t})).nonce}catch(e){throw qe(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a,mode:i}){return await this.api.post(ct,{message:e,signature:t,chainId:n,walletClientType:r,connectorType:a,mode:i})}async linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a}){return await this.api.post(dt,{message:e,signature:t,chainId:n,walletClientType:r,connectorType:a})}async linkSmartWallet({message:e,signature:t,smartWalletType:n}){try{return vi(await this.api.post(ht,{message:e,signature:t,smart_wallet_type:n}))}catch(e){throw qe(e)}}async linkWithSiwe({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a}){try{return vi(await this.linkWithSiweInternal({message:e,signature:t,chainId:n,walletClientType:r,connectorType:a}))}catch(e){throw qe(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post(ut,{address:e,token:t})).nonce}catch(e){throw qe(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r,mode:a}){return await this.api.post(pt,{message:e,signature:t,walletClientType:n,connectorType:r,mode:a})}async sendAccountTransferRequest({nonce:e,account:t,accountType:n,externalWalletMetadata:r,telegramAuthResult:a,telegramWebAppData:i,farcasterEmbeddedAddress:o,oAuthUserInfo:s}){try{let l,c;switch(n){case"email":l=vt,c={nonce:e,email:t};break;case"sms":l=wt,c={nonce:e,phoneNumber:t};break;case"siwe":if(l=ft,!r)throw Error("Wallet parameters must be defined");c={nonce:e,address:t,...r};break;case"farcaster":l=yt,c={nonce:e,farcaster_id:t,farcaster_embedded_address:o};break;case"telegram":l=gt,c={nonce:e,telegram_auth_result:a,telegram_web_app_data:i};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:l=mt,c={nonce:e,userInfo:s}}let d=await this.api.post(l,c);return await this.getAuthenticatedUser()??vi(d)}catch(e){throw qe(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r}){return await this.api.post(Ct,{message:e,signature:t,walletClientType:n,connectorType:r})}async linkWithSiws({message:e,signature:t,walletClientType:n,connectorType:r}){try{return vi(await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:n,connectorType:r}))}catch(e){throw qe(e)}}async updateUserAndIdToken(){try{let e=await this.api.get(bt);return this.session.updateIdentityToken(e.identity_token),vi(e.user)}catch(e){throw qe(e)}}async scanTransaction(e){try{return await this.api.post(kt,e)}catch(e){throw qe(e)}}constructor({apiUrl:e=Xr,appId:t,appClientId:n,timeout:r=2e4}){Object.defineProperty(this,ss,{value:cs}),this._cachedProviderAppDetails={},this.apiUrl=e,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=e!==Xr&&e.startsWith("https://privy."),this.timeout=r,this.appId=t,this.appClientId=n,this.clientAnalyticsId=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}(this,ss)[ss](),is||(is=new as),this.session=is,this.api=this.generateApi(),this.session.client=this}}function cs(){if("undefined"==typeof window)return null;try{let e=Ar.get(ha);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=Zt();try{return Ar.put(ha,e),e}catch(t){return e}}const ds=({delayedExecution:e,...n})=>{let{enabled:r,siteKey:a,appId:i,setError:o,setToken:l,setExecuting:c,ref:h}=ri(),[,u]=s((()=>a?.split("t:")||[]),[a]);if(d((()=>h.current?.remove),[]),!r)return null;if(!u)throw Error("Unsupported captcha site key");/*#__PURE__*/return t("div",{className:"hidden h-0 w-0",children:/*#__PURE__*/t(Xt,{...n,ref:h,siteKey:u,options:{action:i,size:"invisible",...e?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{n.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{n.onError?.(),o("Captcha failed"),c(!1)},onSuccess:e=>{n.onSuccess?.(e),l(e),c(!1)},onExpire:()=>{n.onExpire?.();try{h.current?.reset(),o(void 0),l(void 0)}catch(e){o("expired_and_failed_reset")}}})})},hs=/*#__PURE__*/c({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:Le,login:Le,connectOrCreateWallet:Le,linkEmail:Le,linkPhone:Le,linkFarcaster:Le,linkWallet:Le,startCrossAppAuthFlow:Le,linkGoogle:Le,linkTwitter:Le,linkDiscord:Le,linkGithub:Le,linkSpotify:Le,linkInstagram:Le,linkTelegram:Le,linkTiktok:Le,linkLinkedIn:Le,linkApple:Le,linkPasskey:Le,updateEmail:Le,updatePhone:Le,logout:Le,getAccessToken:Le,unlinkEmail:Le,unlinkPhone:Le,unlinkWallet:Le,unlinkGoogle:Le,unlinkTwitter:Le,unlinkDiscord:Le,unlinkGithub:Le,unlinkSpotify:Le,unlinkInstagram:Le,unlinkTiktok:Le,unlinkLinkedIn:Le,unlinkApple:Le,unlinkCrossAppAccount:Le,unlinkFarcaster:Le,unlinkTelegram:Le,unlinkPasskey:Le,signMessage:Le,signTypedData:Le,enrollInMfa:Le,initEnrollmentWithSms:Le,initEnrollmentWithTotp:Le,initEnrollmentWithPasskey:Le,promptMfa:Le,init:Le,submitEnrollmentWithSms:Le,submitEnrollmentWithTotp:Le,submitEnrollmentWithPasskey:Le,unenroll:Le,submit:Le,cancel:Le,sendTransaction:Le,signTransaction:Le,exportWallet:Le,setWalletPassword:Le,setWalletRecovery:Le,requestFarcasterSignerFromWarpcast:Le,getFarcasterSignerPublicKey:Le,signFarcasterMessage:Le,signMessageWithCrossAppWallet:Le,signTypedDataWithCrossAppWallet:Le,sendTransactionWithCrossAppWallet:Le,isModalOpen:!1,mfaMethods:[]}),us=()=>l(hs),ps=e=>{let[t,n]=o("auto");return d((()=>{let t=new ResizeObserver((e=>{n(e[0]?.contentRect.height??"auto")}));return e.current&&t.observe(e.current),()=>{e.current&&t.unobserve(e.current)}}),[e.current]),t},ms={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},connectOrCreateWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},update:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},signTransaction:{onSuccess:[],onError:[]},signSolanaTransaction:{onSuccess:[],onError:[]},signSolanaMessage:{onSuccess:[],onError:[]},sendSolanaTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},fundSolanaWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},gs=/*#__PURE__*/c(void 0);let ys=()=>l(gs);function fs(e,t){if(!t)return;let n=ys().current[e];return d((()=>{for(let[r,a]of Object.entries(t))Object.prototype.hasOwnProperty.call(n,r)||console.warn(`Invalid event type "${r}" for action "${e}"`),n[r]?.push(a);return()=>{for(let[r,a]of Object.entries(t))Object.prototype.hasOwnProperty.call(n,r)||console.warn(`Invalid event type "${r}" for action "${e}"`),n[r]=n[r]?.filter((e=>e!==a))}}),[t])}function ws(e,t,n,...r){for(let a of e.current[t][n])a(...r)}function vs(){let e=ys();return(t,n,...r)=>ws(e,t,n,...r)}function Cs(e){fs("configureMfa",e)}const bs=/*#__PURE__*/en.div.withConfig({displayName:"Grow",componentId:"sc-ddbf22b4-0"})(["text-align:left;flex-grow:1;"]),ks=/*#__PURE__*/en.div.withConfig({displayName:"AlignBottom",componentId:"sc-ddbf22b4-1"})(["display:flex;flex-direction:column;justify-content:flex-end;flex-grow:1;"]),Ts=/*#__PURE__*/en.div.withConfig({displayName:"LoginMethodContainer",componentId:"sc-ddbf22b4-2"})(["display:flex;flex-direction:column;gap:12px;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]),xs=/*#__PURE__*/en(Ts).withConfig({displayName:"LoginMethodContainerWithScrollShadows",componentId:"sc-ddbf22b4-3"})([""," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;max-height:400px;overflow-y:auto;scrollbar-width:none;padding:2px;"],(e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0));let As=/*#__PURE__*/tn(["&&{width:100%;font-size:16px;line-height:24px;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;align-items:center;padding:12px 16px;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-mdlg);transition:background-color 200ms ease;cursor:pointer;&:hover{background-color:var(--privy-color-background-2);}&:disabled{cursor:pointer;background-color:var(--privy-color-background-2);}svg{height:24px;max-height:24px;max-width:24px;}}"]);const Is=/*#__PURE__*/en.div.withConfig({displayName:"Subtitle",componentId:"sc-ddbf22b4-4"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),_s=/*#__PURE__*/en.button.attrs({className:"login-method-button"}).withConfig({displayName:"LoginMethodButton",componentId:"sc-ddbf22b4-5"})(["",""],As),Es=/*#__PURE__*/en.a.withConfig({displayName:"LoginMethodButtonLink",componentId:"sc-ddbf22b4-6"})(["",""],As),Ss=/*#__PURE__*/en.div.withConfig({displayName:"Hide",componentId:"sc-ddbf22b4-7"})(["width:100%;height:100%;min-height:inherit;display:flex;flex-direction:column;",""],(e=>e.$if?"display: none;":"")),Ns=/*#__PURE__*/en.div.withConfig({displayName:"EmptyWalletState",componentId:"sc-ddbf22b4-8"})(["width:100%;height:100%;padding:",";"],(e=>e.$withPadding?"64px 0px":"0px")),Ms=/*#__PURE__*/en.div.withConfig({displayName:"Header",componentId:"sc-ddbf22b4-9"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:32px;gap:12px;& h3{font-size:18px;font-style:normal;font-weight:600;line-height:24px;}& p{max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;}"]),Ps=({success:r,fail:a})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Ws,{className:r?"success":a?"fail":""}),/*#__PURE__*/t(Us,{className:r?"success":a?"fail":""})]}),Ws=/*#__PURE__*/en.span.withConfig({displayName:"Loader",componentId:"sc-ce7792e2-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;}@keyframes rotation{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}&&&.success{border-color:var(--privy-color-success);border-bottom-color:var(--privy-color-success);}&&&.fail{border-color:var(--privy-color-error);border-bottom-color:var(--privy-color-error);}"],(e=>e.color??"var(--privy-color-accent)")),Us=/*#__PURE__*/en(Ws).withConfig({displayName:"LoaderFaint",componentId:"sc-ce7792e2-1"})(["&&{border-bottom-color:",";animation:none;opacity:0.5;}"],(e=>e.color??"var(--privy-color-accent)")),Os=e=>/*#__PURE__*/t(Ls,{color:e.color||"var(--privy-color-foreground-3)"});let Ls=/*#__PURE__*/en(Ws).withConfig({displayName:"StyledButtonLoader",componentId:"sc-ce7792e2-2"})(["&&{height:1rem;width:1rem;margin:2px 0;border-width:1.5px;transition:border-color 200ms ease;}"]);const Rs=/*#__PURE__*/en.button.withConfig({displayName:"Button",componentId:"sc-b2dfb420-0"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;user-select:none;&{width:100%;cursor:pointer;border-radius:var(--privy-border-radius-md);font-size:1rem;font-style:normal;font-weight:500;line-height:22px;letter-spacing:-0.016px;}&&{padding:12px 16px;}"]),Fs=({children:n,loading:r,disabled:a,success:i,loadingText:o="Loading...",...s})=>/*#__PURE__*/t($s,{disabled:r||a,$success:i,...s,children:r?/*#__PURE__*/e("span",{children:[/*#__PURE__*/t(Os,{}),o?/*#__PURE__*/t("span",{children:o}):null]}):n}),Ds=({children:e,loading:n,disabled:r,...a})=>/*#__PURE__*/t(Bs,{disabled:r,...a,children:n?/*#__PURE__*/t(Os,{color:"var(--privy-color-foreground-accent)"}):e});let Bs=/*#__PURE__*/en(Rs).withConfig({displayName:"StyledPrimaryButtonWithoutGray",componentId:"sc-b2dfb420-1"})(["position:relative;&&{background-color:var(--privy-color-accent);color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:var(--privy-color-accent-dark);}&:active{background-color:var(--privy-color-accent-dark);}&:disabled,&:hover:disabled,&:active:disabled{cursor:not-allowed;pointer-events:none;color:var(--privy-color-foreground-accent);background-color:var(--privy-color-accent-dark);}"]);const zs=({children:n,loading:r,disabled:a,loadingText:i="Loading...",...o})=>/*#__PURE__*/t($s,{as:"a",disabled:r||a,...o,children:r?/*#__PURE__*/e("span",{children:[/*#__PURE__*/t(Os,{}),i?/*#__PURE__*/t("span",{children:i}):null]}):n});let $s=/*#__PURE__*/en(Rs).withConfig({displayName:"StyledPrimaryButton",componentId:"sc-b2dfb420-2"})(["position:relative;&&{background-color:",";color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:",";}&:active{background-color:",";}&:hover:disabled,&:active:disabled{background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);cursor:not-allowed;}"," > span{display:flex;align-items:center;gap:8px;opacity:1;animation:fadein 200ms ease;}"],(e=>e.$warn?"var(--privy-color-error)":e.$success?"var(--privy-color-success)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error)":e.$success?"var(--privy-color-success)":"var(--privy-color-accent-dark)"),(e=>e.$warn?"var(--privy-color-error)":e.$success?"var(--privy-color-success)":"var(--privy-color-accent-dark)"),(e=>e.disabled?/*#__PURE__*/tn(["&&&,&&&:hover,&&&:active{background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);cursor:not-allowed;pointer-events:none;}"]):""));const js=({children:n,loading:r,disabled:a,loadingText:i="Loading...",...o})=>/*#__PURE__*/t(Vs,{disabled:r||a,...o,children:r?/*#__PURE__*/e("span",{children:[/*#__PURE__*/t(Os,{}),i?/*#__PURE__*/t("span",{children:i}):null]}):n});let Vs=/*#__PURE__*/en(Rs).withConfig({displayName:"StyledSecondaryButton",componentId:"sc-b2dfb420-3"})(["&&{border-width:1px;border-color:",";color:var(--privy-color-foreground);transition:border-color 200ms ease;}&:hover,&:active{border-color:",";}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-foreground-accent);color:var(--privy-color-foreground-3);cursor:not-allowed;}> span{display:flex;align-items:center;gap:8px;opacity:1;animation:fadein 200ms ease;}"],(e=>e.$warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"),(e=>e.$warn?"var(--privy-color-error)":"var(--privy-color-foreground-3)"));const Hs=/*#__PURE__*/en.button.withConfig({displayName:"SoftCtaButton",componentId:"sc-b2dfb420-4"})(["&&{padding:12px 16px;font-weight:500;text-align:center;color:var(--privy-color-foreground-accent);background-color:var(--privy-color-accent);border-radius:var(--privy-border-radius-sm);min-width:144px;opacity:",";transition:opacity 200ms ease,background-color 200ms ease,color 200ms ease;user-select:none;"," &:hover{background-color:var(--privy-color-accent-dark);}&:active{background-color:var(--privy-color-accent-dark);}&:hover:disabled,&:active:disabled{background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);cursor:not-allowed;}}"],(e=>e.invisible?"0":"1"),(e=>e.invisible&&/*#__PURE__*/tn(["pointer-events:none;"]))),qs=({children:n,onClick:r,disabled:a,isSubmitting:i,...o})=>/*#__PURE__*/e(Ks,{$isSubmitting:i,onClick:r,disabled:a,...o,children:[/*#__PURE__*/t("span",{children:n}),
2
+ /*#__PURE__*/t("span",{children:/*#__PURE__*/t(Os,{})})]});let Ks=/*#__PURE__*/en.button.withConfig({displayName:"StyledEmbeddedButton",componentId:"sc-b2dfb420-6"})(["&&{color:var(--privy-color-accent);font-size:16px;font-style:normal;font-weight:500;line-height:24px;cursor:pointer;border-radius:0px var(--privy-border-radius-mdlg) var(--privy-border-radius-mdlg) 0px;border:none;transition:color 200ms ease;@media (min-width:441px){font-size:14px;}:hover{color:var(--privy-color-accent-dark);}&& > :first-child{opacity:",";}&& > :last-child{position:absolute;display:flex;top:50%;left:50%;transform:translate3d(-50%,-50%,0);opacity:",";}:disabled,:hover:disabled{color:var(--privy-color-foreground-3);cursor:not-allowed;}}"],(e=>e.$isSubmitting?0:1),(e=>e.$isSubmitting?1:0));function Zs(e){/*#__PURE__*/return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40",...e,children:/*#__PURE__*/t("g",{fill:e.color||"var(--privy-color-foreground)",children:/*#__PURE__*/t("path",{d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02ZM187.65 5.71v5.72h-.27l-.09-.14a15.9 15.9 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a8.98 8.98 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.13 8.13 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.13 6.13 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73.08-1.56.4-2.91.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02ZM210.07 15.39l.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.79 6.79 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13.05 13.05 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13.03 13.03 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.46 7.46 0 0 0-2.8.5A7.07 7.07 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6.03 6.03 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.46 5.46 0 0 1 2.3-.63 10 10 0 0 1 1.13.02ZM69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.71 8.71 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49ZM133.34 2.17V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a4.99 4.99 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.63 2.63 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49ZM293.41 2.36a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.49 14.49 0 0 0-8.74-2.35ZM350.8 2.36a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.49 10.49 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.78 9.78 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.35 7.35 0 0 1-1.26-2.32 14.09 14.09 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03ZM363.63 3.1l-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a911.57 911.57 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4V3.08h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46V3.09h-5.6c-4.46 0-5.6 0-5.6.02ZM390.8 16.95V30.8h3.87l3.86-.01V3.09h-7.73ZM400.6 3.1l-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4V3.1h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01ZM430.98 3.1c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88l-3.88.01ZM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.89 4.89 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a11.87 11.87 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07ZM51.08 7.41c-2.33.12-4.3.84-5.95 2.16a9.89 9.89 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18.04 18.04 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.78 9.78 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04Zm1.42 3.78c.88.1 1.62.34 2.28.75a6.13 6.13 0 0 1 1.99 2.15 10.31 10.31 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03ZM92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.64 7.64 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.44 8.44 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18.3 18.3 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.32 5.32 0 0 1 2.9-.95c.2-.01.97 0 1.17.03ZM116.79 7.41c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.37 9.37 0 0 0 3.6 1.8 12.06 12.06 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.48 5.48 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.32 5.32 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 10.98 10.98 0 0 0-4.88-.74ZM156.2 7.41a9.87 9.87 0 0 0-6 2.29 11.02 11.02 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02ZM233.58 7.82l8.37 23.22a49.22 49.22 0 0 1-.67 1.9 5.36 5.36 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8.05 8.05 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3H233.53ZM293.05 35.8c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a48.55 48.55 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41.09 41.09 0 0 0-5.8-.24Zm0 0"})})})}let Gs=/*#__PURE__*/en.div.withConfig({displayName:"TermsAndConditionsContainer",componentId:"sc-bdb69ecc-0"})(["margin-top:16px;font-size:13px;text-align:center;color:var(--privy-color-foreground-3);&& > a{color:var(--privy-color-accent);}"]);function Ys({app:{legal:{privacyPolicyUrl:n,termsAndConditionsUrl:r,requireUsersAcceptTerms:a}},alwaysShowImplicitConsent:i}){let o=!(!n||!r);return a&&!i||!r&&!n?
3
+ /*#__PURE__*/t(Gs,{}):
4
+ /*#__PURE__*/ /*#__PURE__*/e(Gs,{children:["By logging in I agree to the"," ",r&&/*#__PURE__*/t("a",{href:r,target:"_blank",children:o?"Terms":"Terms of Service"}),o&&" & ",n&&/*#__PURE__*/t("a",{href:n,target:"_blank",children:"Privacy Policy"})]})}const Js=()=>{let{appearance:e}=Fo();/*#__PURE__*/return t(Qs,{children:e.footerLogo??/*#__PURE__*/t("a",{href:"https://www.privy.io/",target:"_blank",id:"protected-by-privy",children:/*#__PURE__*/t(Zs,{height:13,width:150})})})},Qs=/*#__PURE__*/en.div.withConfig({displayName:"ModalFooter",componentId:"sc-bdb69ecc-1"})(["display:flex;align-items:center;justify-content:center;padding-top:8px;padding-bottom:12px;gap:8px;font-size:13px;&& a{padding:0.5rem 0;&:hover{text-decoration:none;}}@media all and (display-mode:standalone){padding-bottom:30px;}"]),Xs=({backFn:e})=>/*#__PURE__*/t("div",{children:/*#__PURE__*/t(rl,{onClick:e,children:/*#__PURE__*/t(dn,{height:"16px",width:"16px",strokeWidth:2})})}),el=({infoFn:e})=>/*#__PURE__*/t("div",{children:/*#__PURE__*/t(al,{"aria-label":"info",onClick:e,children:/*#__PURE__*/t(hn,{height:"22px",width:"22px",strokeWidth:2})})}),tl=e=>/*#__PURE__*/t("div",{children:/*#__PURE__*/t(rl,{"aria-label":"close modal",onClick:e.onClose,children:/*#__PURE__*/t(un,{height:"16px",width:"16px",strokeWidth:2})})}),nl=({backFn:n,infoFn:r,onClose:a,title:i,closeable:o=!0})=>{let{closePrivyModal:s}=Tt(),l=Fo();/*#__PURE__*/return e(il,{children:[/*#__PURE__*/e(ol,{children:[n&&/*#__PURE__*/t(Xs,{backFn:n}),r&&/*#__PURE__*/t(el,{infoFn:r})]}),i&&/*#__PURE__*/t(ll,{id:"privy-dialog-title",children:i}),/*#__PURE__*/t(sl,{children:!l.render.standalone&&o&&/*#__PURE__*/t(tl,{onClose:a||(()=>s())})})]})};let rl=/*#__PURE__*/en.button.withConfig({displayName:"StyledButton",componentId:"sc-f295093d-0"})(["&&{cursor:pointer;display:flex;opacity:0.6;background-color:var(--privy-color-background-2);border-radius:var(--privy-border-radius-full);padding:4px;> svg{margin:auto;color:var(--privy-color-foreground);}:hover{opacity:1;}}"]),al=/*#__PURE__*/en(rl).withConfig({displayName:"TransparentStyledButton",componentId:"sc-f295093d-1"})(["&&{background-color:transparent;}"]),il=/*#__PURE__*/en.div.withConfig({displayName:"StyledHeader",componentId:"sc-f295093d-2"})(["padding:16px 0;display:flex;align-items:center;justify-content:space-between;h2{font-size:16px;line-height:24px;font-weight:600;color:var(--privy-color-foreground);}"]),ol=/*#__PURE__*/en.div.withConfig({displayName:"LeftActionContainer",componentId:"sc-f295093d-3"})(["flex:1;align-items:center;display:flex;gap:8px;"]),sl=/*#__PURE__*/en.div.withConfig({displayName:"RightActionContainer",componentId:"sc-f295093d-4"})(["flex:1;display:flex;justify-content:flex-end;"]),ll=/*#__PURE__*/en.div.withConfig({displayName:"TitleContainer",componentId:"sc-f295093d-5"})(["overflow:hidden;white-space:nowrap;max-width:100%;text-overflow:ellipsis;text-align:center;color:var(--privy-color-foreground-2);"]),cl=Array(6).fill("");var dl,hl=((dl=hl||{})[dl.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",dl[dl.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",dl);function ul(e){return/^[0-9]{1}$/.test(e)}function pl(e){return 6===e.length&&e.every(ul)}const ml=({onChange:r,disabled:a,errorReasonOverride:i,success:s})=>{let[l,c]=o(cl),[d,h]=o(null),[u,p]=o(null),m=async e=>{e.preventDefault();let t=e.currentTarget.value.replace(/\s+/g,"");if(""===t)return;let n=l.reduce(((e,t)=>e+Number(ul(t))),0),a=t.split(""),i=!a.every(ul),o=a.length+n>6;if(i)return h("Passcode can only be numbers"),void p(1);if(o)return h("Passcode must be exactly 6 numbers"),void p(1);h(null),p(null);let s=Number(e.currentTarget.name?.charAt(4)),d=[...t||[""]].slice(0,6-s),u=[...l.slice(0,s),...d,...l.slice(s+d.length)];c(u);let m=Math.min(Math.max(s+d.length,0),5),g=document.querySelector(`input[name=pin-${m}]`);if(g?.focus(),pl(u))try{await r(u.join(""));let e=document.querySelector(`input[name=pin-${m}]`);e?.blur()}catch(e){p(1),h(e.message)}else try{await r(null)}catch(e){p(1),h(e.message)}},y=s?"success":!(!i&&!d)?"fail":"";/*#__PURE__*/return t(n,{children:/*#__PURE__*/e(gl,{children:[/*#__PURE__*/t("div",{children:l.map(((e,n)=>/*#__PURE__*/t("input",{name:`pin-${n}`,type:"text",value:l[n],onChange:m,onKeyUp:e=>{"Backspace"===e.key&&(e=>{1===u&&(h(null),p(null));let t=[...l.slice(0,e),"",...l.slice(e+1)];if(c(t),e>0){let t=document.querySelector(`input[name=pin-${e-1}]`);t?.focus()}pl(t)?r(t.join("")):r(null)})(n)},inputMode:"numeric",autoFocus:0===n,pattern:"[0-9]",className:y,autoComplete:g?"one-time-code":"off",disabled:a},n)))}),/*#__PURE__*/t("div",{children:/*#__PURE__*/t(yl,{$fail:!!i||!!d,children:i||d})})]})})};let gl=/*#__PURE__*/en.div.withConfig({displayName:"PinInputContainer",componentId:"sc-7a171f6-0"})(["display:flex;flex-direction:column;width:100%;gap:8px;@media (max-width:440px){margin-top:8px;margin-bottom:8px;}> div:nth-child(1){display:flex;justify-content:center;gap:0.5rem;width:100%;border-radius:var(--privy-border-radius-md);> input{border:1px solid var(--privy-color-foreground-4);background:var(--privy-color-background);border-radius:var(--privy-border-radius-md);padding:8px 10px;height:58px;width:46px;text-align:center;font-size:18px;}> input:disabled{background:var(--privy-color-background-2);}> input:focus{border:1px solid var(--privy-color-accent);}> input:invalid{border:1px solid var(--privy-color-error);}> input.success{border:1px solid var(--privy-color-success);}> input.fail{border:1px solid var(--privy-color-error);animation:shake 180ms;animation-iteration-count:2;}}@keyframes shake{0%{transform:translate(1px,0px);}33%{transform:translate(-1px,0px);}67%{transform:translate(-1px,0px);}100%{transform:translate(1px,0px);}}"]),yl=/*#__PURE__*/en.div.withConfig({displayName:"InputHelp",componentId:"sc-7a171f6-1"})(["line-height:20px;font-size:13px;display:flex;justify-content:flex-start;width:100%;color:",";"],(e=>e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"));const fl=({label:n,children:r,valueStyles:a})=>/*#__PURE__*/e(wl,{children:[/*#__PURE__*/t("div",{children:n}),/*#__PURE__*/t(vl,{style:{...a},children:r})]});let wl=/*#__PURE__*/en.div.withConfig({displayName:"StyledDetailsRow",componentId:"sc-4ebfdd45-0"})(["display:flex;align-items:center;justify-content:space-between;width:100%;> :first-child{color:var(--privy-color-foreground-3);text-align:left;}> :last-child{color:var(--privy-color-foreground-2);text-align:right;}"]),vl=/*#__PURE__*/en.div.withConfig({displayName:"ValueWrapper",componentId:"sc-4ebfdd45-1"})(["font-size:14px;line-height:100%;display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-full);background-color:var(--privy-color-background-2);padding:4px 8px;"]),Cl=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),bl=e=>Cl.format(e);const kl=(e,t)=>{let n=bl(t*parseFloat(e));return"$0.00"!==n?n:"<$0.01"},Tl=(e,t)=>{let n=bl(t*parseFloat(Rt(e)));return"$0.00"===n?"<$0.01":n},xl=(e,t,n=6,r=!1)=>`${Al(e,n,r)} ${t}`,Al=(e,t=6,n=!1)=>{let r=parseFloat(Rt(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return n?r:`${"0"===r?"<0.001":r}`},Il=e=>e.reduce(((e,t)=>e+t),0n),_l=(e,t)=>{let{chains:n}=Tt(),r=`https://etherscan.io/address/${t}`,a=`${((e,t)=>{let n=Number(e),r=t.find((e=>e.id===n));if(!r)throw new ye(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url})(e,n)}/address/${t}`;if(!a)return r;try{new URL(a)}catch{return r}return a};async function El(e,t){try{return await e}catch{return t}}const Sl="11111111111111111111111111111111",Nl=["CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C","CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"],Ml=["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"];let Pl=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2});function Wl(e,t=6,n=!1,r=!1){let a=(parseFloat(e.toString())/1e9).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),i=r?"":" SOL";return n?`${a}${i}`:`${"0"===a?"<0.001":a}${i}`}function Ul(e,t){let n=parseFloat(e.toString())/1e9,r=Pl.format(t*n);return"$0.00"===r?"<$0.01":r}function Ol({amount:e,fee:t,tokenPrice:n,isUsdc:r}){let a=BigInt(Math.floor(parseFloat(e)*10**(r?6:9))),i=r?a:a+t;return{fundingAmountInBaseUnit:a,fundingAmountInUsd:n?Ul(a,n):void 0,totalPriceInUsd:n?Ul(i,n):void 0,totalPriceInNativeCurrency:Wl(i),feePriceInNativeCurrency:Wl(t),feePriceInUsd:n?Ul(t,n):void 0}}let Ll={"mainnet-beta":{EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:{symbol:"USDC",decimals:6,address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:{symbol:"USDT",decimals:6,address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},devnet:{"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU":{symbol:"USDC",decimals:6,address:"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"},EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS:{symbol:"USDT",decimals:6,address:"EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},testnet:{}};async function Rl(e,t,n){let r=Ll[e];if(!r[n]){let a=await t.getSplTokenMetadata({mintAddress:n,cluster:e});a&&(r[n]={address:n,symbol:a.symbol,decimals:a.decimals})}return r[n]}function Fl(e){return"version"in e}function Dl(e,t){let n=(Fl(e)?e.message:e.compileMessage()).staticAccountKeys.find((e=>e.toBase58()===t));if(!n)throw Error(`Transaction does not contain public key ${t}`);return n}function Bl(e,t,n){return{signature:e,parsedTransaction:n??null,signedTransaction:t,fees:BigInt(n?.meta?.fee||0)}}async function zl(e,t){let{value:n}=await t.simulateTransaction(e);if("BlockhashNotFound"===n.err)throw Error("Simulation failed: Blockhash not found");return null==n.err&&n.logs?.every((e=>!/insufficient funds/gi.test(e)))}async function $l({tx:e,connection:t,client:n,checkFunds:r}){let a=Fl(e)?e.message:e.compileMessage(),i=a.staticAccountKeys[0]?.toBase58()??"",o=await async function(e,t){return BigInt((Fl(e)?(await t.getFeeForMessage(e.message)).value:await e.getEstimatedFee(t))??0)}(e,t),s=!r||await El(zl(e,t),!0),l={},c=[],d=await async function(e,t){return[...e.staticAccountKeys.map((e=>e)),...(await Promise.all(e.addressTableLookups.map((async e=>t.getAddressLookupTable(e.accountKey).then((({value:e})=>e)))))).map(((t,n)=>[...e.addressTableLookups[n]?.writableIndexes.map((e=>{let r=t?.state.addresses[e];if(r)return{key:r,isWritable:!0,altIdx:n}}))??[],...e.addressTableLookups[n]?.readonlyIndexes.map((e=>{let r=t?.state.addresses[e];if(r)return{key:r,isWritable:!1,altIdx:n}}))??[]])).flat().filter((e=>!!e)).sort(((e,t)=>e.isWritable!==t.isWritable?e.isWritable?-1:1:e.altIdx-t.altIdx)).map((({key:e})=>e))]}(a,t);for(let e of a.compiledInstructions){let r=a.staticAccountKeys[e.programIdIndex]?.toBase58()||"";if("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"!==r&&"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"!==r)if(r!==Sl){if("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"===r){let t=await El(function(e,t,n){let[r,a,i,o]=e.accountKeyIndexes.map((e=>t[e]));return{type:"ata-creation",program:n,payer:r?.toBase58(),ata:a?.toBase58(),owner:i?.toBase58(),mint:o?.toBase58()}}(e,d,r));if(!t){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}if(c.push(t),t.ata&&t.owner&&t.mint){l[t.ata]={owner:t.owner,mint:t.mint};continue}}if(Nl.includes(r)){let a=await El(ql(e,d,t,n,r));if(!a){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}c.push(a)}else if(Ml.includes(r)){let a=await El(Kl(e,d,t,n,r));if(!a){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}c.push(a)}else c.push({type:"unknown",program:r,discriminator:e.data[0]})}else{let t=await El(Hl(e,d));if(!t){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}c.push(t)}else{let a=await El(Vl(e,d,t,n,l,r));if(!a){c.push({type:"unknown",program:r,discriminator:e.data[0]});continue}c.push(a),"spl-transfer"===a.type&&(a.fromAta&&a.fromAccount&&a.token.address&&(l[a.fromAta]??={owner:a.fromAccount,mint:a.token.address}),a.toAta&&a.toAccount&&a.token.address&&(l[a.toAta]??={owner:a.toAccount,mint:a.token.address}))}}return{spender:i,fee:o,instructions:c,hasFunds:!!s}}function jl(e,t=0){try{return function(e,t=0){let n=0n;for(let r=0;r<8;r++)n|=BigInt(e[t+r])<<BigInt(8*r);return n}(e,t)}catch{}try{return e.readBigInt64LE(t)}catch{}let n=Ya(e);try{return((e,t=0)=>{let n=e[t],r=e[t+7];if(!n||!r)throw Error(`Buffer offset out of range: first: ${n}, last: ${r}.`);return(BigInt(e[t+4]+256*e[t+5]+65536*e[t+6]+(r<<24))<<32n)+BigInt(n+256*e[++t]+65536*e[++t]+16777216*e[++t])})(n)}catch{}try{return n.subarray(t).readBigInt64LE()}catch{}try{return n.readBigInt64LE(t)}catch{}return 0n}async function Vl(e,t,n,r,a,i){let o=e.data[0],s=e.accountKeyIndexes.map((e=>t[e]));if(1===o){let[e,t,n]=s;return{type:"spl-init-account",program:i,account:e?.toBase58(),mint:t?.toBase58(),owner:n?.toBase58()}}if(3===o){let t,o,[l,c,d]=s,h="",u=c?a[c.toBase58()]:void 0;if(u)t=u.owner,h=u.mint;else if(c){let e=await n.getParsedAccountInfo(c,"confirmed"),r=e.value?.data;t=r?.parsed?.info?.owner,h=r?.parsed?.info?.mint??"",o=r?.parsed?.info?.tokenAmount?.decimals}if(!h&&l){let e=await n.getParsedAccountInfo(l,"confirmed"),t=e.value?.data;h=t?.parsed?.info?.mint??""}let p=Eo(n.rpcEndpoint),m=await Rl(p,r,h),g=m?.symbol??"";return o??=m?.decimals??9,{type:"spl-transfer",program:i,fromAta:l?.toBase58(),fromAccount:d?.toBase58(),toAta:c?.toBase58(),toAccount:t,value:jl(e.data,1),token:{symbol:g,decimals:o,address:h}}}if(9===o){let[e,t,n]=s;return{type:"spl-close-account",program:i,source:e?.toBase58(),destination:t?.toBase58(),owner:n?.toBase58()}}if(17===o)return{type:"spl-sync-native",program:i};throw Error(`Token program instruction type ${o} not supported`)}async function Hl(e,t){let n=e.data[0],r=e.accountKeyIndexes.map((e=>t[e]));if(0===n){let[,t]=r;return{type:"create-account",program:Sl,account:t?.toBase58(),value:jl(e.data,4),withSeed:!1}}if(2===n){let[t,n]=r;return{type:"sol-transfer",program:Sl,fromAccount:t?.toBase58(),toAccount:n?.toBase58(),token:{symbol:"SOL",decimals:9},value:jl(e.data,4),withSeed:!1}}if(3===n){let[,t]=r,n=jl(e.data.slice(e.data.length-32-8-8));return{type:"create-account",program:Sl,account:t?.toBase58(),withSeed:!0,value:n}}if(11===n){let[t,n]=r;return{type:"sol-transfer",program:Sl,fromAccount:t?.toBase58(),toAccount:n?.toBase58(),value:jl(e.data,4),token:{symbol:"SOL",decimals:9},withSeed:!0}}throw Error(`System program instruction type ${n} not supported`)}async function ql(e,t,n,r,a){let i=e.accountKeyIndexes.map((e=>t[e]?.toBase58())),o=e.data[0],s=Eo(n.rpcEndpoint);if(143===o){let t=i[10],n=i[11];return{type:"raydium-swap-base-input",program:a,mintIn:t,mintOut:n,tokenIn:t?await Rl(s,r,t):void 0,tokenOut:n?await Rl(s,r,n):void 0,amountIn:jl(e.data,8),minimumAmountOut:jl(e.data,16)}}if(55===o){let t=i[10],n=i[11];return{type:"raydium-swap-base-output",program:a,mintIn:t,mintOut:n,tokenIn:t?await Rl(s,r,t):void 0,tokenOut:n?await Rl(s,r,n):void 0,maxAmountIn:jl(e.data,8),amountOut:jl(e.data,16)}}throw Error(`Raydium swap program instruction type ${o} not supported`)}async function Kl(e,t,n,r,a){let i=e.data[0],o=e.accountKeyIndexes.map((e=>t[e])),s=Eo(n.rpcEndpoint);if([208,51,239,151,123,43,237,92].includes(i)){let t=o[5]?.toBase58(),n=o[6]?.toBase58();return{type:"jupiter-swap-exact-out-route",program:a,mintIn:t,mintOut:n,tokenIn:t?await Rl(s,r,t):void 0,tokenOut:n?await Rl(s,r,n):void 0,outAmount:jl(e.data,e.data.length-1-2-8-8),quotedInAmount:jl(e.data,e.data.length-1-2-8)}}if([176,209,105,168,154,125,69,62].includes(i)){let t=o[7]?.toBase58(),n=o[8]?.toBase58();return{type:"jupiter-swap-exact-out-route",program:a,mintIn:t,mintOut:n,tokenIn:t?await Rl(s,r,t):void 0,tokenOut:n?await Rl(s,r,n):void 0,outAmount:jl(e.data,e.data.length-1-2-8-8),quotedInAmount:jl(e.data,e.data.length-1-2-8)}}if([193,32,155,51,65,214,156,129].includes(i)){let t=o[7]?.toBase58(),n=o[8]?.toBase58();return{type:"jupiter-swap-shared-accounts-route",program:a,mintIn:t,mintOut:n,tokenIn:t?await Rl(s,r,t):void 0,tokenOut:n?await Rl(s,r,n):void 0,inAmount:jl(e.data,e.data.length-1-2-8-8),quotedOutAmount:jl(e.data,e.data.length-1-2-8)}}throw[62,198,214,193,213,159,108,210].includes(i)&&console.warn("Jupiter swap program instruction 'claim' not implemented"),[116,206,27,191,166,19,0,73].includes(i)&&console.warn("Jupiter swap program instruction 'claim_token' not implemented"),[26,74,236,151,104,64,183,249].includes(i)&&console.warn("Jupiter swap program instruction 'close_token' not implemented"),[229,194,212,172,8,10,134,147].includes(i)&&console.warn("Jupiter swap program instruction 'create_open_orders' not implemented"),[28,226,32,148,188,136,113,171].includes(i)&&console.warn("Jupiter swap program instruction 'create_program_open_orders' not implemented"),[232,242,197,253,240,143,129,52].includes(i)&&console.warn("Jupiter swap program instruction 'create_token_ledger' not implemented"),[147,241,123,100,244,132,174,118].includes(i)&&console.warn("Jupiter swap program instruction 'create_token_account' not implemented"),[229,23,203,151,122,227,173,42].includes(i)&&console.warn("Jupiter swap program instruction 'route' not implemented"),[150,86,71,116,167,93,14,104].includes(i)&&console.warn("Jupiter swap program instruction 'route_with_token_ledger' not implemented"),[228,85,185,112,78,79,77,2].includes(i)&&console.warn("Jupiter swap program instruction 'set_token_ledger' not implemented"),[230,121,143,80,119,159,106,170].includes(i)&&console.warn("Jupiter swap program instruction 'shared_accounts_route_with_token_ledger' not implemented"),Error(`Jupiter swap program instruction type ${i} not supported`)}const Zl=({weiQuantities:e,tokenPrice:n,tokenSymbol:r})=>{let a=Il(e),i=n?Tl(a,n):void 0,o=xl(a,r);/*#__PURE__*/return t(Jl,{children:i||o})},Gl=({weiQuantities:r,tokenPrice:a,tokenSymbol:i})=>{let o=Il(r),s=a?Tl(o,a):void 0,l=xl(o,i);/*#__PURE__*/return t(Jl,{children:s?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Ql,{children:"USD"}),"<$0.01"===s?
5
+ /*#__PURE__*/e(ec,{children:[/*#__PURE__*/t(Xl,{children:"<"}),"$0.01"]}):s]}):l})},Yl=({quantities:r,tokenPrice:a,tokenSymbol:i="SOL",tokenDecimals:o=9})=>{let s=r.reduce(((e,t)=>e+t),0n),l=a&&"SOL"===i&&9===o?Ul(s,a):void 0,c="SOL"===i&&9===o?Wl(s):`${Ft(s,o)} ${i}`;/*#__PURE__*/return t(Jl,{children:l?/*#__PURE__*/t(n,{children:"<$0.01"===l?
6
+ /*#__PURE__*/e(ec,{children:[/*#__PURE__*/t(Xl,{children:"<"}),"$0.01"]}):l}):c})};let Jl=/*#__PURE__*/en.span.withConfig({displayName:"StyledPriceDisplay",componentId:"sc-596cd423-0"})(["font-size:14px;line-height:140%;display:flex;gap:4px;align-items:center;"]),Ql=/*#__PURE__*/en.span.withConfig({displayName:"StyledPriceUnit",componentId:"sc-596cd423-1"})(["font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);"]),Xl=/*#__PURE__*/en.span.withConfig({displayName:"TinyLessThan",componentId:"sc-596cd423-2"})(["font-size:10px;"]),ec=/*#__PURE__*/en.span.withConfig({displayName:"FlexCenter",componentId:"sc-596cd423-3"})(["display:flex;align-items:center;"]);const tc=/*#__PURE__*/en.div.withConfig({displayName:"BottomPusherContainer",componentId:"sc-cb963810-0"})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;margin-top:auto;gap:16px;flex-grow:100;"]),nc=/*#__PURE__*/en.div.withConfig({displayName:"CenteredItem",componentId:"sc-cb963810-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;flex-grow:1;width:100%;"]),rc=/*#__PURE__*/en.div.withConfig({displayName:"HorizontallyCenteredItem",componentId:"sc-cb963810-2"})(["display:flex;flex-direction:column;align-items:center;width:100%;"]),ac=/*#__PURE__*/en(nc).withConfig({displayName:"CenteredItemWithPadding",componentId:"sc-cb963810-3"})(["padding:20px 0;"]),ic=/*#__PURE__*/en(nc).withConfig({displayName:"CenteredItemWithGap",componentId:"sc-cb963810-4"})(["gap:16px;"]),oc=/*#__PURE__*/en.div.withConfig({displayName:"FlexContainer",componentId:"sc-cb963810-5"})(["display:flex;flex-direction:column;width:100%;"]),sc=/*#__PURE__*/en.div.withConfig({displayName:"FixedGappedContainer",componentId:"sc-cb963810-6"})(["display:flex;flex-direction:column;gap:8px;"]),lc=/*#__PURE__*/en.div.withConfig({displayName:"StyledCalloutSection",componentId:"sc-cb963810-8"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;padding:16px;margin-top:16px;margin-bottom:16px;width:100%;background:var(--privy-color-background-2);border-radius:var(--privy-border-radius-md);&& h4{color:var(--privy-color-foreground-3);font-size:14px;text-decoration:underline;font-weight:medium;}&& p{color:var(--privy-color-foreground-3);font-size:14px;}"]),cc=/*#__PURE__*/en.div.withConfig({displayName:"RefactorSpacerTop",componentId:"sc-cb963810-9"})(["height:16px;"]),dc=/*#__PURE__*/en.div.withConfig({displayName:"RefactorSpacerBottom",componentId:"sc-cb963810-10"})(["height:12px;"]),hc=/*#__PURE__*/en.div.withConfig({displayName:"RelativeContainer",componentId:"sc-cb963810-11"})(["position:relative;"]),uc=/*#__PURE__*/en.div.withConfig({displayName:"ConfigurableSpacer",componentId:"sc-cb963810-12"})(["height:","px;"],(e=>e.height??"12")),pc=/*#__PURE__*/en.div.withConfig({displayName:"Circle",componentId:"sc-cb963810-13"})(["background-color:var(--privy-color-accent);display:flex;justify-content:center;align-items:center;border-radius:50%;border-color:white;border-width:2px !important;"]),mc=({gas:n,tokenPrice:r,tokenSymbol:a})=>/*#__PURE__*/e(oc,{style:{paddingBottom:"12px"},children:[/*#__PURE__*/e(yc,{children:[/*#__PURE__*/t(wc,{children:"Est. Fees"}),/*#__PURE__*/t("div",{children:/*#__PURE__*/t(Gl,{weiQuantities:[BigInt(n)],tokenPrice:r,tokenSymbol:a})})]}),r&&/*#__PURE__*/t(fc,{children:`${xl(BigInt(n),a)}`})]}),gc=({value:n,gas:r,tokenPrice:a,tokenSymbol:i})=>{let o=BigInt(n??0)+BigInt(r);/*#__PURE__*/return e(oc,{children:[/*#__PURE__*/e(yc,{children:[/*#__PURE__*/t(wc,{children:"Total (including fees)"}),/*#__PURE__*/t("div",{children:/*#__PURE__*/t(Gl,{weiQuantities:[BigInt(n||0),BigInt(r)],tokenPrice:a,tokenSymbol:i})})]}),a&&/*#__PURE__*/t(fc,{children:xl(o,i)})]})};let yc=/*#__PURE__*/en.div.withConfig({displayName:"TransactionTotalRow",componentId:"sc-f8ef9b74-0"})(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-top:4px;"]),fc=/*#__PURE__*/en.div.withConfig({displayName:"ValueConversionRow",componentId:"sc-f8ef9b74-1"})(["display:flex;flex-direction:row;height:12px;font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);font-weight:400;"]),wc=/*#__PURE__*/en.div.withConfig({displayName:"TotalText",componentId:"sc-f8ef9b74-2"})(["font-size:14px;line-height:22.4px;font-weight:400;"]);const vc=/*#__PURE__*/c(void 0),Cc=/*#__PURE__*/c(void 0),bc=({defaultValue:e,children:n})=>{let[r,a]=o(e||null);/*#__PURE__*/return t(vc.Provider,{value:{activePanel:r,togglePanel:e=>{a(r===e?null:e)}},children:/*#__PURE__*/t(Ic,{children:n})})},kc=({value:e,children:n})=>{let{activePanel:r,togglePanel:a}=l(vc),i=r===e;/*#__PURE__*/return t(Cc.Provider,{value:{onToggle:()=>a(e),value:e},children:/*#__PURE__*/t(Nc,{isActive:i?"true":"false","data-open":String(i),children:n})})},Tc=({children:r})=>{let{activePanel:a}=l(vc),{onToggle:i,value:o}=l(Cc),s=a===o;/*#__PURE__*/
7
+ return e(n,{children:[/*#__PURE__*/e(_c,{onClick:i,"data-open":String(s),children:[/*#__PURE__*/t(Sc,{children:r}),/*#__PURE__*/t(Wc,{isactive:s?"true":"false",children:/*#__PURE__*/t(pn,{height:"16px",width:"16px",strokeWidth:"2"})})]}),/*#__PURE__*/t(Ec,{})]})},xc=({children:e})=>{let{activePanel:n}=l(vc),{value:r}=l(Cc);/*#__PURE__*/return t(Mc,{"data-open":String(n===r),children:/*#__PURE__*/t(Pc,{children:e})})},Ac=({children:e})=>{let{activePanel:n}=l(vc),{value:r}=l(Cc);/*#__PURE__*/return t(Pc,{children:"function"==typeof e?e({isActive:n===r}):e})};let Ic=/*#__PURE__*/en.div.withConfig({displayName:"AccordionRoot",componentId:"sc-d25f9267-0"})(["display:flex;flex-direction:column;width:100%;gap:8px;"]),_c=/*#__PURE__*/en.div.withConfig({displayName:"AccordionTriggerContainer",componentId:"sc-d25f9267-1"})(["display:flex;justify-content:space-between;align-items:center;width:100%;cursor:pointer;padding-bottom:8px;"]),Ec=/*#__PURE__*/en.div.withConfig({displayName:"AccordionDivider",componentId:"sc-d25f9267-2"})(["width:100%;&&{border-top:1px solid;border-color:var(--privy-color-foreground-4);}padding-bottom:12px;"]),Sc=/*#__PURE__*/en.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-d25f9267-3"})(["font-size:14px;font-weight:500;line-height:19.6px;width:100%;padding-right:8px;"]),Nc=/*#__PURE__*/en.div.withConfig({displayName:"AccordionPanelContainer",componentId:"sc-d25f9267-4"})(["display:flex;flex-direction:column;width:100%;overflow:hidden;padding:12px;&&{border:1px solid;border-color:var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);}"]),Mc=/*#__PURE__*/en.div.withConfig({displayName:"AccordionContentContainer",componentId:"sc-d25f9267-5"})(["position:relative;overflow:hidden;transition:max-height 25ms ease-out;&[data-open='true']{max-height:700px;}&[data-open='false']{max-height:0;}"]),Pc=/*#__PURE__*/en.div.withConfig({displayName:"ContentWrapper",componentId:"sc-d25f9267-6"})(["display:flex;flex-direction:column;gap:12px;flex:1 1 auto;min-height:1px;"]),Wc=/*#__PURE__*/en.div.withConfig({displayName:"IconWrapper",componentId:"sc-d25f9267-7"})(["transform:",";"],(e=>"true"===e.isactive?"rotate(180deg)":"rotate(0deg)"));const Uc=({walletAddress:e,chainId:n=1,network:r,rpcEndpoint:a})=>/*#__PURE__*/t(Oc,{href:"ethereum"===r?_l(n,e):So(e,Eo(a||"")),target:"_blank",children:Pr(e)});let Oc=/*#__PURE__*/en.a.withConfig({displayName:"StyledLink",componentId:"sc-adda23e5-0"})(["&:hover{text-decoration:underline;}"]);const Lc=({from:n,to:r,txn:a,transactionInfo:i,tokenPrice:o,gas:s,tokenSymbol:l})=>{let c=BigInt(a?.value||0);/*#__PURE__*/
8
+ return t(bc,{...Fo().render.standalone?{defaultValue:"details"}:{},children:/*#__PURE__*/e(kc,{value:"details",children:[/*#__PURE__*/t(Tc,{children:/*#__PURE__*/e(Rc,{children:[/*#__PURE__*/t("div",{children:i?.title||"Details"}),/*#__PURE__*/t(Fc,{children:/*#__PURE__*/t(Zl,{weiQuantities:[c],tokenPrice:o,tokenSymbol:l})})]})}),/*#__PURE__*/e(xc,{children:[/*#__PURE__*/t(fl,{label:"From",children:/*#__PURE__*/t(Uc,{walletAddress:n,chainId:a.chainId||1,network:"ethereum"})}),/*#__PURE__*/t(fl,{label:"To",children:/*#__PURE__*/t(Uc,{walletAddress:r,chainId:a.chainId||1,network:"ethereum"})}),i&&i.action&&/*#__PURE__*/t(fl,{label:"Action",children:i.action}),s&&/*#__PURE__*/t(mc,{value:a.value,gas:s,tokenPrice:o,tokenSymbol:l})]}),/*#__PURE__*/t(Ac,{children:({isActive:e})=>/*#__PURE__*/t(gc,{value:a.value,displayFee:e,gas:s||"0x0",tokenPrice:o,tokenSymbol:l})})]})})};let Rc=/*#__PURE__*/en.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-29499c17-0"})(["display:flex;flex-direction:row;justify-content:space-between;"]),Fc=/*#__PURE__*/en.div.withConfig({displayName:"TotalText",componentId:"sc-29499c17-1"})(["flex-shrink:0;padding-left:8px;"]);const Dc=({enabled:e=!0}={})=>{let{showFiatPrices:t,getUsdPriceForSol:n}=Tt(),[r,a]=o(!0),[i,s]=o(void 0),[l,c]=o(void 0);return d((()=>{(async()=>{if(t&&e)try{a(!0);let e=await n();e?c(e):s(Error("Unable to fetch SOL price"))}catch(e){s(e)}finally{a(!1)}else a(!1)})()}),[]),{solPrice:l,isSolPriceLoading:r,solPriceError:i}};function Bc(e){let{tokenPrice:t,isTokenPriceLoading:n,tokenPriceError:r}=(e=>{let{showFiatPrices:t,getUsdTokenPrice:n,chains:r}=Tt(),[a,i]=o(!0),[s,l]=o(void 0),[c,h]=o(void 0);return d((()=>{e||=1;let a=S(r).find((t=>t.id===Number(e)));(async()=>{if(t){if(!a)return i(!1),void l(Error(`Unable to fetch token price on chain id ${e}`));try{i(!0);let e=await n(a);e?h(e):l(Error(`Unable to fetch token price on chain id ${a.id}`))}catch(e){l(e)}finally{i(!1)}}else i(!1)})()}),[e]),{tokenPrice:c,isTokenPriceLoading:a,tokenPriceError:s}})("solana"===e?-1:e),{solPrice:a,isSolPriceLoading:i,solPriceError:s}=Dc({enabled:"solana"===e});return"solana"===e?{tokenPrice:a,isTokenPriceLoading:i,tokenPriceError:s}:{tokenPrice:t,isTokenPriceLoading:n,tokenPriceError:r}}const zc=/*#__PURE__*/c(null);function $c(){let e=l(zc);return null===e?(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1}):e}async function jc(e,t,n){let r=qi(e),a=await t.prepareTransactionRequest({...r,account:{address:n,type:"json-rpc"}});return{...a,type:Vi[a.type]}}const Vc=({pendingTransaction:e})=>{let{getAccessToken:n}=us(),{wallets:r}=$c(),{walletProxy:a,rpcConfig:i,chains:l,appId:c,nativeTokenSymbolForChainId:h}=Tt(),[u,p]=o(null),[m,g]=o(e),{tokenPrice:y}=Bc(m.chainId),f=h(e.chainId)||"ETH",w=s((()=>r.find((e=>"privy"===e.walletClientType))),[r]);return d((()=>{(async function(){if(!await n()||!a||!w)return m;let e=Sr(m.chainId,l,i,{appId:c}),t=await jc(m,e,w.address);return p(Lt(BigInt(t.gas??0))),t})().then(g).catch(console.error)}),[a]),w?/*#__PURE__*/t(Hc,{children:/*#__PURE__*/t(Lc,{from:w.address,to:m.to,txn:m,gas:u??void 0,tokenPrice:y,tokenSymbol:f})}):null};let Hc=/*#__PURE__*/en.div.withConfig({displayName:"TransactionInfoWrapper",componentId:"sc-731f1950-0"})(["width:100%;padding:1rem 0;"]);const qc=["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"];class Kc extends Error{constructor(e,t){super(t),this.type=e}}function Zc(e){let t=e.type;return"string"==typeof t&&qc.includes(t)}function Gc(e){return Zc(e)&&"wallet_not_on_device"===e.type}function Yc(e){return!!Zc(e)&&"mfa_timeout"===e.type}function Jc(e){return!!Zc(e)&&"missing_or_invalid_mfa"===e.type}function Qc(e){return!!Zc(e)&&"mfa_verification_max_attempts_reached"===e.type}function Xc(e){return!(!Zc(e)||!e.message.includes("code 429"))}function ed(e){return!!function(e){let t=e.type;return"string"==typeof t&&"client_error"===t}(e)&&"MFA canceled"===e.message}function td(){let{promptMfa:e,init:t,submit:n,cancel:r,mfaMethods:a}=l(hs);return{promptMfa:e,init:t,submit:n,cancel:r,mfaMethods:a}}const nd=/*#__PURE__*/en.div.withConfig({displayName:"AppLogoContainer",componentId:"sc-a63b1990-0"})(["display:flex;flex-direction:column;align-items:center;padding:0px 0px 30px;@media (max-width:440px){padding:10px 10px 20px;}"]),rd=/*#__PURE__*/en.div.withConfig({displayName:"Title",componentId:"sc-a63b1990-1"})(["font-size:18px;line-height:30px;text-align:center;font-weight:600;margin-bottom:10px;"]),ad=/*#__PURE__*/en.div.withConfig({displayName:"SubTitle",componentId:"sc-a63b1990-2"})(["font-size:0.875rem;text-align:center;"]),id=/*#__PURE__*/en.div.withConfig({displayName:"Container",componentId:"sc-a63b1990-3"})(["display:flex;flex-direction:column;align-items:center;gap:10px;flex-grow:1;padding:20px 0;@media (max-width:440px){padding:10px 10px 20px;}"]),od=/*#__PURE__*/en.div.withConfig({displayName:"List",componentId:"sc-a63b1990-4"})(["display:flex;flex-direction:column;align-items:stretch;gap:0.75rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),sd=/*#__PURE__*/en.div.withConfig({displayName:"ListItemIcon",componentId:"sc-a63b1990-5"})(["width:25px;display:flex;align-items:center;justify-content:flex-start;> svg{z-index:2;height:25px !important;width:25px !important;color:var(--privy-color-accent);}"]),ld=/*#__PURE__*/en.div.withConfig({displayName:"ListItem",componentId:"sc-a63b1990-6"})(["display:flex;align-items:center;gap:10px;font-size:0.875rem;line-height:1rem;text-align:left;"]),cd=/*#__PURE__*/en.div.withConfig({displayName:"BottomSection",componentId:"sc-a63b1990-7"})(["display:flex;flex-direction:column;gap:10px;padding-top:20px;"]),dd=/*#__PURE__*/en.div.withConfig({displayName:"MethodList",componentId:"sc-a63b1990-8"})(["display:flex;flex-direction:column;align-items:stretch;gap:1rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),hd=/*#__PURE__*/en.div.withConfig({displayName:"MethodListItem",componentId:"sc-a63b1990-9"})(["display:flex;gap:5px;width:100%;position:relative;"]),ud=/*#__PURE__*/en.button.withConfig({displayName:"RemoveMethodButton",componentId:"sc-a63b1990-10"})(["&&{background-color:transparent;color:var(--privy-color-foreground-3);padding:0 0.75rem;display:flex;align-items:center;height:100%;> svg{z-index:2;height:20px !important;width:20px !important;}}&&:hover{color:var(--privy-color-error);}"]),pd=/*#__PURE__*/en.div.withConfig({displayName:"MethodText",componentId:"sc-a63b1990-11"})(["display:flex;align-items:center;gap:0.5rem;> svg{z-index:2;height:20px !important;width:20px !important;}"]),md=/*#__PURE__*/en.div.withConfig({displayName:"ExtraText",componentId:"sc-a63b1990-12"})(["display:flex;align-items:center;gap:6px;font-weight:400 !important;color:",";> svg{z-index:2;height:18px !important;width:18px !important;display:flex !important;align-items:flex-end;}"],(e=>e.isAccent?"var(--privy-color-accent)":"var(--privy-color-foreground-3)")),gd=/*#__PURE__*/en.div.withConfig({displayName:"SmsInsecureText",componentId:"sc-a63b1990-13"})(["width:100%;display:flex;justify-content:space-between;"]),yd=/*#__PURE__*/en.p.withConfig({displayName:"TermsText",componentId:"sc-a63b1990-14"})(["text-align:left;width:100%;color:var(--privy-color-foreground-3) !important;"]),fd=/*#__PURE__*/en.button.withConfig({displayName:"PrimaryTextButton",componentId:"sc-a63b1990-15"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;user-select:none;&{width:100%;cursor:pointer;border-radius:var(--privy-border-radius-md);font-size:0.875rem;line-height:1rem;font-style:normal;font-weight:500;line-height:22px;letter-spacing:-0.016px;}&&{color:",";background-color:transparent;padding:0.5rem 0px;}&:hover{text-decoration:underline;}"],(e=>"dark"===e.theme?"var(--privy-color-foreground-2)":"var(--privy-color-accent)")),wd=/*#__PURE__*/en.div.withConfig({displayName:"IconWrapper",componentId:"sc-a63b1990-16"})(["display:flex;align-items:center;justify-content:center;color:var(--privy-color-accent);width:100%;> svg{z-index:2;width:3rem;height:3rem;}"]),vd=/*#__PURE__*/en.div.withConfig({displayName:"ErrorMessage",componentId:"sc-a63b1990-17"})(["color:var(--privy-color-error);"]);let Cd=/*#__PURE__*/en.div.withConfig({displayName:"StackedContainer",componentId:"sc-f7e7d474-0"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > span{position:absolute;left:-41px;top:-41px;}> div > :last-child{position:absolute;left:-19px;top:-19px;}"]);const bd=({style:e,...n})=>/*#__PURE__*/t("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",...n,children:/*#__PURE__*/t("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"})}),kd=({hasBlockingError:r,error:a,onClose:i,onBack:o,handleSubmit:s,account:l,submitSuccess:c})=>{let{pendingTransaction:d}=Tt();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:i},"header"),/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:c,fail:!!a}),/*#__PURE__*/t(a?gn:bd,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/t(rd,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),/*#__PURE__*/e(od,{children:[/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(cn,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(mn,{})}),"You last added a passkey on"," ",l?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),d&&/*#__PURE__*/t(id,{children:/*#__PURE__*/t(Vc,{pendingTransaction:d})}),a&&/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(vd,{style:{marginTop:"1.25rem"},children:a.message}),/*#__PURE__*/t(Fs,{disabled:r,onClick:s,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&/*#__PURE__*/t(fd,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),/*#__PURE__*/t(Qs,{})]})},Td=({open:r,onClose:a})=>{let{user:s}=us(),[l,c]=o(s?.mfaMethods[0]??null),{init:h,cancel:u,submit:p}=td(),[m,g]=o(!1),[y,f]=o(!1),[w,v]=o(null),[C,b]=o(null);d((()=>{c(s?.mfaMethods[0]??null)}),[s?.mfaMethods]);let k=i(!1);d((()=>{!k.current&&l&&r&&(k.current=!0,A(l).finally((()=>{k.current=!1})))}),[r]);let T=e=>Qc(e)?(g(!0),Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Jc(e)?(g(!1),Error("The code you entered is not valid")):Yc(e)?(g(!0),Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(e),g(!1),Error("Something went wrong."));async function x(e){b(null);try{if(!e||!l)return;await p(l,e),f(!0),g(!1),a()}catch(e){throw T(e)}}async function A(e){if("passkey"!==e)try{c(e),await h(e)}catch(e){console.error(e)}else try{c(e);let t=await h(e);if(!t)throw Error("something went wrong");v(t),await p(e,t),f(!0),g(!1),a()}catch(e){b(T(e))}}let I=()=>{c(null),b(null),u(),a()};return r&&s?"passkey"===l?/*#__PURE__*/t(kd,{account:s.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],selectedMethod:l,submitSuccess:y,hasBlockingError:m,error:C,onClose:I,onBack:()=>{c(null),b(null)},handleSubmit:()=>x(w).catch(b)}):l?/*#__PURE__*/t(xd,{submitSuccess:y,hasBlockingError:m,handleSubmitCode:x,selectedMethod:l,onClose:I,onBack:s.mfaMethods.length>1?()=>c(null):void 0}):/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:I},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(cn,{})}),/*#__PURE__*/t(rd,{children:"Verify your identity"}),/*#__PURE__*/t(ad,{children:"Choose a verification method"}),/*#__PURE__*/e(dd,{children:[s.mfaMethods.includes("totp")&&/*#__PURE__*/e(_s,{onClick:()=>A("totp"),children:[/*#__PURE__*/t(on,{}),"Authenticator App"]},"totp"),s.mfaMethods.includes("sms")&&/*#__PURE__*/e(_s,{onClick:()=>A("sms"),children:[/*#__PURE__*/t(ln,{}),"SMS"]},"sms"),s.mfaMethods.includes("passkey")&&/*#__PURE__*/e(_s,{onClick:()=>A("passkey"),children:[/*#__PURE__*/t(sn,{}),"Passkey"]},"passkey")]}),/*#__PURE__*/t(Qs,{})]}):null};let xd=({selectedMethod:r,submitSuccess:a,hasBlockingError:i,onClose:o,onBack:s,handleSubmitCode:l})=>{let{app:c}=$o(),{pendingTransaction:d}=Tt();switch(r){case"sms":/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:o},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(ln,{})}),/*#__PURE__*/t(rd,{children:"Enter verification code"}),/*#__PURE__*/e(id,{children:[/*#__PURE__*/t(ml,{success:a,disabled:i,onChange:l}),/*#__PURE__*/e(ad,{children:["To continue, please enter the 6-digit code sent to your ",/*#__PURE__*/t("strong",{children:"mobile device"})]}),d&&/*#__PURE__*/t(Vc,{pendingTransaction:d})]}),s&&/*#__PURE__*/t(fd,{theme:c?.appearance.palette.colorScheme,onClick:s,children:"Choose another method"}),/*#__PURE__*/t(js,{onClick:o,children:"Not now"}),/*#__PURE__*/t(Qs,{})]});case"totp":/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:o},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(on,{})}),/*#__PURE__*/t(rd,{children:"Enter verification code"}),/*#__PURE__*/e(id,{children:[/*#__PURE__*/t(ml,{success:a,disabled:i,onChange:l}),/*#__PURE__*/e(ad,{children:["To continue, please enter the 6-digit code generated from your"," ",/*#__PURE__*/t("strong",{children:"authenticator app"})]}),d&&/*#__PURE__*/t(Vc,{pendingTransaction:d})]}),s&&/*#__PURE__*/t(fd,{theme:c?.appearance.palette.colorScheme,onClick:s,children:"Choose another method"}),/*#__PURE__*/t(js,{onClick:o,children:"Not now"}),/*#__PURE__*/t(Qs,{})]});default:return null}};const Ad=/*#__PURE__*/nn([":root{--privy-border-radius-sm:6px;--privy-border-radius-md:12px;--privy-border-radius-mdlg:16px;--privy-border-radius-lg:24px;--privy-border-radius-full:9999px;--privy-color-background:",";--privy-color-background-2:",";--privy-color-background-3:",";--privy-color-foreground:",";--privy-color-foreground-2:",";--privy-color-foreground-3:",";--privy-color-foreground-4:",";--privy-color-foreground-accent:",";--privy-color-accent:",";--privy-color-accent-light:",";--privy-color-accent-lightest:",";--privy-color-accent-dark:",";--privy-color-accent-darkest:",";--privy-color-success:",";--privy-color-success-dark:",";--privy-color-success-light:",";--privy-color-error:",";--privy-color-error-light:",";--privy-color-warn:",";--privy-color-warn-light:",";--privy-height-modal-full:620px;--privy-height-modal-compact:480px;};"],(e=>e.theme.background),(e=>e.theme.background2),(e=>e.theme.background3),(e=>e.theme.foreground),(e=>e.theme.foreground2),(e=>e.theme.foreground3),(e=>e.theme.foreground4),(e=>e.theme.foregroundAccent),(e=>e.theme.accent),(e=>e.theme.accentLight),(e=>e.theme.accentLightest),(e=>e.theme.accentDark),(e=>e.theme.accentDarkest),(e=>e.theme.success),(e=>e.theme.successDark),(e=>e.theme.successLight),(e=>e.theme.error),(e=>e.theme.errorLight),(e=>e.theme.warn),(e=>e.theme.warnLight)),Id=/*#__PURE__*/en.div.withConfig({displayName:"StylesWrapper",componentId:"sc-bc1e45b4-0"})([""," color:var(--privy-color-foreground-2);h3{font-size:16px;line-height:24px;font-weight:500;color:var(--privy-color-foreground-2);}h4{font-size:14px;line-height:20px;font-weight:500;color:var(--privy-color-foreground);}p{font-size:13px;line-height:20px;color:var(--privy-color-foreground-2);}button:focus,input:focus,optgroup:focus,select:focus,textarea:focus{outline:none;border-color:var(--privy-color-accent-light);box-shadow:0 0 0 1px var(--privy-color-accent-light);}.mobile-only{@media (min-width:441px){display:none;}}@keyframes fadein{0%{opacity:0;}100%{opacity:1;}}"],"\n *,\n ::before,\n ::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n }\n\n line-height: 1.15;\n -webkit-text-size-adjust: 100%;\n -moz-tab-size: 4;\n tab-size: 4;\n font-feature-settings: normal;\n\n margin: 0;\n font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji';\n\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n\n abbr:where([title]) {\n text-decoration: underline dotted;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji';\n display: inline;\n }\n\n a {\n color: inherit;\n text-decoration: inherit;\n }\n\n b,\n strong {\n font-weight: bolder;\n }\n\n code,\n kbd,\n samp,\n pre {\n font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n font-size: 1em;\n }\n\n small {\n font-size: 80%;\n }\n\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n\n sub {\n bottom: -0.25em;\n }\n\n sup {\n top: -0.5em;\n }\n\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n\n button,\n input,\n optgroup,\n select,\n textarea {\n font-family: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n }\n\n button,\n select {\n text-transform: none;\n }\n\n button,\n [type='button'],\n [type='reset'],\n [type='submit'] {\n -webkit-appearance: button;\n background-color: transparent;\n background-image: none;\n }\n\n ::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n :-moz-focusring {\n outline: 1px dotted ButtonText;\n }\n\n :-moz-ui-invalid {\n box-shadow: none;\n }\n\n legend {\n padding: 0;\n }\n\n progress {\n vertical-align: baseline;\n }\n\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n\n [type='search'] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n }\n\n summary {\n display: list-item;\n }\n\n blockquote,\n dl,\n dd,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n hr,\n figure,\n p,\n pre {\n margin: 0;\n }\n\n fieldset {\n margin: 0;\n padding: 0;\n }\n\n legend {\n padding: 0;\n }\n\n ol,\n ul,\n menu {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n textarea {\n resize: vertical;\n }\n\n input::placeholder,\n textarea::placeholder {\n opacity: 1;\n color: #9ca3af;\n }\n\n button,\n [role='button'] {\n cursor: pointer;\n }\n\n :disabled {\n cursor: default;\n }\n\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n }\n\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n\n [hidden] {\n display: none;\n }\n"),_d=({children:n,open:r,onClick:i,...o})=>/*#__PURE__*/t(yn,{show:r,as:a.Fragment,children:/*#__PURE__*/e(fn,{onClose:i,...o,as:Sd,children:[/*#__PURE__*/t(wn,{as:a.Fragment,enterFrom:"entering",leaveTo:"leaving",children:/*#__PURE__*/t(Ed,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),/*#__PURE__*/t(Nd,{children:/*#__PURE__*/t(wn,{as:a.Fragment,enterFrom:"entering",leaveTo:"leaving",children:/*#__PURE__*/t(vn,{as:Md,children:n})})})]})});let Ed=/*#__PURE__*/en.div.withConfig({displayName:"Backdrop",componentId:"sc-3cfde0b5-0"})(["position:fixed;inset:0;transition:backdrop-filter 100ms ease;backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);&.entering,&.leaving{backdrop-filter:unset;-webkit-backdrop-filter:unset;}"]),Sd=/*#__PURE__*/en.div.withConfig({displayName:"DialogWrapper",componentId:"sc-3cfde0b5-1"})(["position:relative;z-index:999999;"]),Nd=/*#__PURE__*/en.div.withConfig({displayName:"DialogContainer",componentId:"sc-3cfde0b5-2"})(["position:fixed;inset:0;display:flex;align-items:center;justify-content:center;width:100vw;min-height:100vh;"]);const Md=/*#__PURE__*/en.div.withConfig({displayName:"Panel",componentId:"sc-3cfde0b5-3"})(["padding:0;background:transparent;border:none;width:100%;pointer-events:auto;outline:none;display:block;@media (max-width:440px){opacity:1;transform:translate3d(0,0,0);transition:transform 200ms ease-in;position:fixed;bottom:0;&.entering,&.leaving{opacity:0;transform:translate3d(0,100%,0);transition:transform 150ms ease-in 0ms,opacity 0ms ease 150ms;}}@media (min-width:441px){opacity:1;transition:opacity 100ms ease-in;&.entering,&.leaving{opacity:0;transition-delay:5ms;}margin:auto;width:360px;box-shadow:0px 8px 36px rgba(55,65,81,0.15);border-radius:var(--privy-border-radius-lg);}"]),Pd=/*#__PURE__*/en.div.withConfig({displayName:"CenterItem",componentId:"sc-3cfde0b5-4"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;"]);let Wd=({isMfaVerifying:r,onMfaVerificationComplete:a})=>{let{ready:i,isModalOpen:o}=us(),{headless:s}=Fo(),{currentScreen:l}=$o(),{status:c,execute:h,reset:u,enabled:p}=ri(),m=o&&l&&l.isCaptchaRequired&&!s&&"ready"===c;return d((()=>{m&&h()}),[m]),d((()=>{!o&&p&&u()}),[o,p]),l&&!i&&l.isShownBeforeReady?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(Pd,{children:/*#__PURE__*/t(Ws,{})}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Qs,{})]}):!l&&r?/*#__PURE__*/t(Td,{open:r,onClose:a}):l?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Ss,{$if:!!r,children:/*#__PURE__*/t(l.component,{})}),/*#__PURE__*/t(Ss,{$if:!r,children:/*#__PURE__*/t(Td,{open:r,onClose:a})})]}):null},Ud=({isMfaVerifying:e,onMfaVerificationComplete:n})=>{let r=i(null);/*#__PURE__*/return t(Rd,{style:{height:ps(r)},id:"privy-modal-content",children:/*#__PURE__*/t("div",{ref:r,children:/*#__PURE__*/t(Wd,{isMfaVerifying:e,onMfaVerificationComplete:n})})})};const Od=({open:e})=>{let n=Fo(),{gracefulClosePrivyModal:r}=(()=>{let{closePrivyModal:e}=Tt(),{onUserCloseViaDialogOrKeybindRef:t}=$o();return{gracefulClosePrivyModal:h((()=>{if(!t?.current)return e({shouldCallAuthOnSuccess:!1});t.current()}),[e])}})(),[a,i]=o(!1);Cs({onMfaRequired:()=>{n.mfa.noPromptOnMfaRequired||i(!0)}});let s=e||a;return n.render.standalone?/*#__PURE__*/t(Id,{children:/*#__PURE__*/t(Ld,{id:"privy-modal-content",children:/*#__PURE__*/t(Wd,{isMfaVerifying:a,onMfaVerificationComplete:()=>i(!1)})})}):/*#__PURE__*/t(_d,{open:s,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:/*#__PURE__*/t(Id,{children:/*#__PURE__*/t(Ud,{isMfaVerifying:a,onMfaVerificationComplete:()=>i(!1)})})})};let Ld=/*#__PURE__*/en.div.withConfig({displayName:"ContentWrapper",componentId:"sc-df48cc55-0"})(["display:flex;flex-direction:column;text-align:center;font-size:14px;line-height:20px;width:100%;background:var(--privy-color-background);padding:0 16px;"]),Rd=/*#__PURE__*/en(Ld).withConfig({displayName:"BaseModal",componentId:"sc-df48cc55-1"})(["transition:height 150ms ease-out;overflow-x:hidden;overflow-y:auto;scrollbar-width:none;max-height:calc(100svh - 32px);border-radius:var(--privy-border-radius-lg) var(--privy-border-radius-lg) 0 0;box-shadow:0px 0px 36px rgba(55,65,81,0.15);@media (min-width:441px){box-shadow:0px 8px 36px rgba(55,65,81,0.15);border-radius:var(--privy-border-radius-lg);}"]);function Fd(e){let n=i(null),r=i();return d((()=>{r.current?.remove(),r.current=function({botUsername:e,scriptHost:t}){let n=document.createElement("script"),{origin:r}=new URL(t);return n.async=!0,n.src=`${r}/js/telegram-login.js`,n.setAttribute("data-telegram-login",e),n.setAttribute("data-request-access","write"),n.setAttribute("data-lang","en"),n}(e),n.current?.after(r.current)}),[e]),/*#__PURE__*/t("div",{ref:n,hidden:!0})}async function Dd(e,t,n,r,a,i=!1){let o=i,s=async s=>{if(o&&t&&t.length>0){s===(i?0:1)?a("configureMfa","onMfaRequired",{mfaMethods:t}):r.current?.reject(new Kc("missing_or_invalid_mfa","MFA verification failed, retry."));let o=await new Promise(((e,t)=>{n.current={resolve:e,reject:t},setTimeout((()=>{let e=new Kc("mfa_timeout","Timed out waiting for MFA code");r.current?.reject(e),t(e)}),3e5)}));return await e(o)}return await e()},l=null;for(let e=0;e<4;e++)try{l=await s(e),r.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw r.current?.resolve(void 0),e;o=!0}if(null===l){let e=new Kc("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(e),e}return l}var Bd;let zd=(Bd=0,()=>"id-"+Bd++);function $d(e){return void 0!==e.error}let jd=new class{enqueue(e,t){this.callbacks[e]=t}dequeue(e,t){let n=this.callbacks[t];if(!n)throw Error(`cannot dequeue ${e} event: no event found for id ${t}`);switch(delete this.callbacks[t],e){case"privy:iframe:ready":case"privy:user-signer:sign":case"privy:wallets:add":case"privy:wallets:import":case"privy:wallets:set-recovery":case"privy:wallets:connect":case"privy:wallets:recover":case"privy:wallets:rpc":case"privy:wallet:create":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":case"privy:auth:unlink-passkey":case"privy:farcaster:init-signer":case"privy:farcaster:sign":case"privy:solana-wallet:create":case"privy:delegated-actions:consent":return n;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}},Vd=new Map,Hd=(e,t)=>"bigint"==typeof t?t.toString():t;function qd(e,t,n,r){let a=n.contentWindow;if(!a)throw Error("iframe not initialized");let i=((e,t)=>`${e}${JSON.stringify(t,Hd)}`)(e,t);if("privy:wallet:create"===e){let e=Vd.get(i);if(e)return e}let o=new Promise(((n,i)=>{let o=zd();jd.enqueue(o,{resolve:n,reject:i}),a.postMessage({id:o,event:e,data:t},r)})).finally((()=>{Vd.delete(i)}));return Vd.set(i,o),o}function Kd(e){let n=Do(),r=i(null),a=i(e.mfaMethods),s=vs(),[l,c]=o(!1);return d((()=>{a.current=e.mfaMethods}),[e.mfaMethods]),d((()=>{if(!l)return;let t=r.current;if(!t)return;function n(t){var n;t&&t.origin===e.origin&&"string"==typeof(n=t.data).event&&/^privy:.+/.test(n.event)&&function(e){switch(e.event){case"privy:iframe:ready":let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data);case"privy:user-signer:sign":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:add":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:set-recovery":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:connect":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:recover":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:rpc":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallet:create":let n=jd.dequeue(e.event,e.id);return $d(e)?n.reject(new Kc(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallets:import":let r=jd.dequeue(e.event,e.id);return $d(e)?r.reject(new Kc(e.error.type,e.error.message)):r.resolve(e.data);case"privy:mfa:verify":let a=jd.dequeue(e.event,e.id);return $d(e)?a.reject(new Kc(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:init-enrollment":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:submit-enrollment":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:unenroll":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:clear":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:auth:unlink-passkey":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:solana-wallet:create":let i=jd.dequeue(e.event,e.id);return $d(e)?i.reject(new Kc(e.error.type,e.error.message)):i.resolve(e.data);case"privy:farcaster:init-signer":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:sign":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:delegated-actions:consent":{let t=jd.dequeue(e.event,e.id);return $d(e)?t.reject(new Kc(e.error.type,e.error.message)):t.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}(t.data)}let i={signWithUserSigner:n=>Dd((r=>qd("privy:user-signer:sign",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),addWallet:n=>Dd((r=>qd("privy:wallets:add",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),setRecovery:n=>Dd((r=>qd("privy:wallets:set-recovery",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),connect:n=>Dd((r=>qd("privy:wallets:connect",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),recover:n=>Dd((r=>qd("privy:wallets:recover",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s,!n.recoveryAccessToken&&!n.recoveryPassword&&!n.recoverySecretOverride),rpc:n=>Dd((r=>qd("privy:wallets:rpc",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),create:n=>qd("privy:wallet:create",n,t,e.origin),importWallet:n=>qd("privy:wallets:import",n,t,e.origin),createSolana:n=>Dd((r=>qd("privy:solana-wallet:create",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),createDelegatedAction:n=>qd("privy:delegated-actions:consent",n,t,e.origin),verifyMfa:n=>Dd((r=>qd("privy:mfa:verify",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s,!0),initEnrollMfa:n=>Dd((r=>qd("privy:mfa:init-enrollment",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),submitEnrollMfa:n=>Dd((r=>qd("privy:mfa:submit-enrollment",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),unenrollMfa:n=>Dd((r=>qd("privy:mfa:unenroll",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),clearMfa:n=>qd("privy:mfa:clear",n,t,e.origin),unlinkPasskeyAccount:n=>Dd((r=>qd("privy:auth:unlink-passkey",{...n,...r},t,e.origin)),a.current,e.mfaPromise,e.mfaSubmitPromise,s),initFarcasterSigner:n=>qd("privy:farcaster:init-signer",n,t,e.origin),signFarcasterMessage:n=>qd("privy:farcaster:sign",n,t,e.origin)};window.addEventListener("message",n);let o=new AbortController;return Or((()=>qd("privy:iframe:ready",{},t,e.origin)),{abortSignal:o.signal}).then((()=>e.onLoad(i)),((...t)=>{console.warn("Privy iframe failed to load: ",...t),e.onLoadFailed()})),()=>{window.removeEventListener("message",n),o.abort()}}),[l]),n?
9
+ /*#__PURE__*/t("iframe",{ref:r,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>c(!0),src:Lr(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})}):null}const Zd=({address:e,user:t})=>{let n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new de("Address to delegate is not associated with current user.");return{address:n.address,chainType:n.chainType,walletIndex:n.walletIndex??0}},Gd=({address:e,user:t})=>{let n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new de("Address to delegate is not associated with current user.");let r=n.imported?n:wi(t);if(!r)throw new de("Unable to determine root address for delegated address.");return{address:r.address,chainType:r.chainType,imported:r.imported}},Yd=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.delegated));async function Jd({accessToken:e,entropyId:t,entropyIdVerifier:n,transactingWalletIndex:r,walletProxy:a,transactionRequest:i,requesterAppId:o}){return(await a.rpc({entropyId:t,entropyIdVerifier:n,hdWalletIndex:r??0,chainType:"ethereum",accessToken:e,requesterAppId:o,request:{method:"eth_signTransaction",params:[i]}})).response.data}const Qd=()=>{let e=Fo();d((()=>{e.externalWallets.walletConnect.enabled&&(async e=>{let t=new URL("v3/wallets","https://explorer-api.walletconnect.com");t.searchParams.append("projectId",e);let n=await fetch(t);return n.ok?Object.values((await n.json()).listings).sort((({slug:e},{slug:t})=>"rainbow"===e&&"metamask"===t?1:"metamask"===e||"rainbow"===e?-1:1)):(console.debug(`Failed to fetch WalletConnect listings: ${await n.text().catch((()=>"No response."))}`),[])})(e.walletConnectCloudProjectId).then((e=>fo({listings:e}))).catch(console.error)}),[e.walletConnectCloudProjectId,e.externalWallets.walletConnect.enabled])};function Xd(e){let t=e.replace("eip155:","");if(t)return parseInt(t);throw Error("Chain ID not compatible with CAIP-2 format.")}const eh="popup-privy-oauth",th="PRIVY_OAUTH_USE_BROADCAST_CHANNEL";class nh{async authenticate(){if(!this.api)throw new de("Auth flow has no API instance");try{return await this.api.post(be,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw ue(e)}}async link(){if(!this.api)throw new de("Auth flow has no API instance");try{return await this.api.post(Te,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw ue(e)}}constructor({authorizationCode:e,stateCode:t,codeVerifier:n,provider:r}){this.meta={authorizationCode:e,stateCode:t,codeVerifier:n,provider:r}}}async function rh({api:e,requesterAppId:t,providerAppId:n}){let r=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find((e=>e.provider_app_id===n));if(!r)throw new de("Invalid connected app");return{name:r.provider_app_name,logoUrl:r.provider_app_icon_url||void 0,apiUrl:r.provider_app_custom_api_url,readOnly:r.read_only}}const ah=()=>window.open(void 0,void 0,ih({w:440,h:680}));let ih=({w:e,h:t})=>{let n=void 0!==window.screenLeft?window.screenLeft:window.screenX,r=void 0!==window.screenTop?window.screenTop:window.screenY,a=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(a-e)/2/(a/window.screen.availWidth)+n},top=${(i-t)/2/(i/window.screen.availHeight)+r}`};const oh=async({user:e,address:t,client:n,request:r,requesterAppId:a,reconnect:i})=>{n.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:r.method}});let o=e?.linkedAccounts.find((e=>"cross_app"===e.type&&(e.embeddedWallets.some((e=>e.address===t))||e.smartWallets.some((e=>e.address===t)))));if(!e||!o)throw n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new de("Cannot request a signature with this wallet address");let s=n.getProviderAccessToken(o.providerApp.id),l=await rh({api:n.api,requesterAppId:a,providerAppId:o.providerApp.id});if(!s){if(l.readOnly)throw console.error("cannot transact against a read-only provider app"),new de("Cannot transact against a read-only provider app");await i({appId:o.providerApp.id,action:"link"})&&(s=n.getProviderAccessToken(o.providerApp.id))}if(!s)throw n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new de("Transactions require a valid token");let c=ah();if(!c)throw n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new de("Failed to initialize signature request");let d=new URL(`${l.apiUrl}/oauth/transact`);return d.searchParams.set("token",s||""),d.searchParams.set("request",sh(r)),c.location=d.href,new Promise(((e,a)=>{let i=setTimeout((()=>{d(),a(new de("Request timeout")),n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})}),12e4),s=setInterval((()=>{c.closed&&(d(),a(new de("User rejected request")),n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))}),300),l=i=>{i.data&&("set"===i.data.token?.action&&void 0!==i.data.token?.value?n.storeProviderAccessToken(o.providerApp.id,i.data.token.value):"clear"===i.data.token?.action&&n.storeProviderAccessToken(o.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===i.data.type&&i.data.result&&(d(),e(i.data.result),n.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:r.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===i.data.type&&i.data.error&&(d(),a(i.data.error),n.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:i.data.error,address:t}})))};window.addEventListener("message",l);let d=()=>{c.close(),clearInterval(s),clearTimeout(i),window.removeEventListener("message",l)}}))};let sh=e=>JSON.stringify({content:{request:{request:lh(e,Lt)}},timestamp:Date.now(),callbackUrl:window.origin});const lh=(e,t)=>"bigint"==typeof e?t(e):Array.isArray(e)?e.map((e=>lh(e,t))):e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,n])=>[e,lh(n,t)]))):e,ch=({title:r,description:a,children:i,...o})=>
10
+ /*#__PURE__*/t(uh,{...o,children:/*#__PURE__*/e(n,{children:[/*#__PURE__*/t("h3",{children:r}),"string"==typeof a?/*#__PURE__*/t("p",{children:a}):a,i]})}),dh=/*#__PURE__*/en(ch).withConfig({displayName:"PaddedScreenHeader",componentId:"sc-523a75d6-0"})(["margin-bottom:24px;"]),hh=({title:n,description:r,icon:a,children:i,...o})=>/*#__PURE__*/e(ph,{...o,children:[a||null,/*#__PURE__*/t("h3",{children:n}),r&&"string"==typeof r?/*#__PURE__*/t("p",{children:r}):r,i]});let uh=/*#__PURE__*/en.div.withConfig({displayName:"StyledSection",componentId:"sc-523a75d6-1"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;width:100%;margin-bottom:24px;&& h3{font-size:17px;color:var(--privy-color-foreground);}&& p{color:var(--privy-color-foreground-2);font-size:14px;}"]),ph=/*#__PURE__*/en(uh).withConfig({displayName:"CenteredStyledSection",componentId:"sc-523a75d6-2"})(["align-items:center;text-align:center;gap:16px;h3{margin-bottom:24px;}"]);const mh=n=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...n,children:[/*#__PURE__*/t("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"}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/e("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[/*#__PURE__*/t("stop",{stopColor:"#3E82F4"}),/*#__PURE__*/t("stop",{offset:1,stopColor:"#93DCF7"})]})})]}),gh=({style:n,...r})=>/*#__PURE__*/e("svg",{width:"16",height:"14",style:n,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[/*#__PURE__*/e("g",{clipPath:"url(#clip0_2115_829)",children:[/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_2115_829",children:/*#__PURE__*/t("rect",{width:"16",height:"14",fill:"white"})})})]});async function yh({url:e,popup:t,provider:n}){return t.location=e,new Promise(((e,n)=>{function r(){t?.close(),window.removeEventListener("message",a)}function a(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),r()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),r()),"PRIVY_OAUTH_ERROR"===t.data.type&&(n(t.data.error),r()))}window.addEventListener("message",a)}))}async function fh({api:e,provider:t,stateCode:n,codeVerifier:r,authorizationCode:a}){if(!a||!n)throw new de("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===a)throw new de("User denied confirmation during OAuth flow");try{return(await e.post(xt,{authorization_code:a,state_code:n,code_verifier:r,provider:t})).access_token}catch(e){let t=ue(e);if(t.privyErrorCode)throw new de(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new de("Invalid code during oauth flow.",void 0,ke.OAUTH_USER_DENIED);throw new de("Invalid code during OAuth flow.",void 0,ke.UNKNOWN_AUTH_ERROR)}}async function wh({api:e,provider:t}){let n=Ea(),r=Sa(),a=await Na(n);try{return"icloud"===t?{url:(await e.post(At,{client_type:"web"})).url}:{url:(await e.post(It,{redirect_to:window.location.href,code_challenge:a,state_code:r})).url,codeVerifier:n,stateCode:r,provider:t}}catch(e){throw ue(e)}}const vh=(e,{chainType:t,walletIndex:n}={})=>e?.linkedAccounts.filter((e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==n&&e.walletIndex!==n||void 0!==t&&e.chainType!==t)))??[],Ch=async({user:e,accessToken:t,proxy:n,refreshSessionAndUser:r,privy:a,appConfig:i,recoverPrimaryWallet:o,setUser:s,walletIndex:l,chainType:c,recoveryMethod:d,recoveryPassword:h,recoveryAccessToken:u})=>{if(0===l)if("user-controlled-server-wallets-only"===i.embeddedWallets.mode)await N(a,{request:{owner_id:void 0,chain_type:c}});else if("ethereum"===c){let r=mi(e);r&&await o(),await n.create({accessToken:t,solanaAddress:r?.address,recoveryMethod:d,recoveryPassword:h,recoveryAccessToken:u})}else{if("solana"!==c)throw Error("Invalid input to create wallet");{let r=ui(e);r&&await o(),await n.createSolana({accessToken:t,ethereumAddress:r?.address,recoveryMethod:d,recoveryPassword:h,recoveryAccessToken:u})}}else{if("user-controlled-server-wallets-only"===i.embeddedWallets.mode)throw Error("Cannot create additional wallets");let{entropyId:r,entropyIdVerifier:a}=bi(e);await o(),await n.addWallet({accessToken:t,entropyId:r,entropyIdVerifier:a,chainType:c,hdWalletIndex:l})}let p=await r(),m=vh(p,{chainType:c,walletIndex:l})[0];return s(p),{user:p,account:m}},bh=()=>{let{getAccessToken:e}=us(),{walletProxy:t,recoverPrimaryWallet:n,setUser:r,refreshSessionAndUser:a,privy:i}=Tt(),o=Fo();return{create:async({walletIndex:s,chainType:l,latestUser:c,recoveryMethod:d,recoveryPassword:h,recoveryAccessToken:u})=>{let p=c;p||(p=await a());let m=await e();if(!p||!m||!t)throw Error("User must be authenticated before creating a Privy wallet");return await Ch({appConfig:o,user:p,refreshSessionAndUser:a,privy:i,accessToken:m,proxy:t,recoverPrimaryWallet:n,setUser:r,walletIndex:s,chainType:l,recoveryMethod:d,recoveryPassword:h,recoveryAccessToken:u})}}},kh={component:()=>{let{user:r}=us(),{closePrivyModal:a,isNewUserThisSession:i,updateWallets:o}=Tt(),{app:s,data:l,onUserCloseViaDialogOrKeybindRef:c}=$o(),{onSuccess:h,onFailure:u,callAuthOnSuccessOnClose:p}=l.createWallet,m=()=>{let e=ui(r)??mi(r);r&&e?(o(),h({user:r,account:e})):u(Error("Failed to create wallet")),a({shouldCallAuthOnSuccess:p})};return d((()=>{let e=setTimeout(m,ta);return()=>clearTimeout(e)}),[]),c.current=m,/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:m}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(ic,{children:[/*#__PURE__*/t(zn,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),/*#__PURE__*/t(hh,{title:i?"Welcome"+(s?.name?` to ${s?.name}`:""):"All set!",description:i?"You’ve successfully created an account.":"Your account is secured."})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}},Th=/*#__PURE__*/en.div.withConfig({displayName:"RecoveryContainer",componentId:"sc-12b46968-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),xh=/*#__PURE__*/en.div.withConfig({displayName:"RecoveryExplainerContainer",componentId:"sc-12b46968-1"})(["padding-bottom:24px;"]);let Ah={"google-drive":{name:"Google Drive",component:gh},icloud:{name:"iCloud",component:mh}};const Ih={component:()=>{let{logout:r}=us(),{navigate:a,setModalData:i,data:s}=$o(),{closePrivyModal:l,createAnalyticsEvent:c}=Tt(),{execute:u}=(()=>{let{client:e,walletProxy:t,refreshSessionAndUser:n}=Tt(),{data:r}=$o(),{getAccessToken:a,user:i}=us(),o=vs(),{create:s}=bh();return{execute:async({provider:l,action:c,popup:d,shouldCreateEth:h,shouldCreateSol:u})=>{let p,m;if(!e)throw new de("Missing client");function g(t){if(!t&&e)throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:l}}),new de("Recovery OAuth failed")}switch(l){case"google-drive":{let t,n,{url:r,codeVerifier:i,stateCode:o}=await wh({api:e.api,provider:l});g(r);try{let a=await yh({url:r,popup:d,provider:l});if(t=a.stateCode,n=a.authorizationCode,t!==o)throw e.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:l,storedStateCode:o??"",returnedStateCode:t??""}}),new de("Unexpected auth flow. This may be a phishing attempt.",void 0,ke.OAUTH_UNEXPECTED)}catch(t){throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:l}}),new de("Recovery OAuth failed")}[p,m]=await Promise.all([a(),fh({api:e.api,provider:l,codeVerifier:i,stateCode:t,authorizationCode:n})]);break}case"icloud":{let{url:t}=await wh({api:e.api,provider:l});g(t);let{ckWebAuthToken:n}=await yh({url:t,popup:d,provider:l});m=n,p=await a()}}if(!t)throw new de("Cannot connect to wallet proxy");if(!p)throw new de("Unable to authorize user");switch(c){case"recover":{let n=r?.recoverWallet?.entropyId,a=r?.recoverWallet?.entropyIdVerifier;if(!n||!a)throw new de("Recovery OAuth failed");e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:n,recoveryMethod:l}}),await t.recover({accessToken:p,entropyId:n,entropyIdVerifier:a,recoveryAccessToken:m}),e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n,recoveryMethod:l}});break}case"create-wallet":{let t;if(e.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),h&&u)t=await s({recoveryMethod:l,recoveryAccessToken:m,chainType:"ethereum",walletIndex:0,latestUser:i}),t=await s({chainType:"solana",walletIndex:0,latestUser:t.user});else if(u)t=await s({recoveryMethod:l,recoveryAccessToken:m,chainType:"solana",walletIndex:0,latestUser:i});else{if(!h)throw Error("Invalid args to create wallet");t=await s({recoveryMethod:l,recoveryAccessToken:m,chainType:"ethereum",walletIndex:0,latestUser:i})}if(!t)throw o("createWallet","onError",ke.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:t.account.address}}),o("createWallet","onSuccess",{wallet:t.account});break}case"set-recovery":{let r=wi(i);if(!r)throw o("setWalletRecovery","onError",ke.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:r.address,existingRecoveryMethod:r.recoveryMethod,targetRecoveryMethod:l}});let{entropyId:a,entropyIdVerifier:s}=bi(i);await t.setRecovery({accessToken:p,entropyId:a,entropyIdVerifier:s,recoveryMethod:l,recoveryAccessToken:m});let c=wi(await n());if(!c)throw o("createWallet","onError",ke.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:r.address,existingRecoveryMethod:r.recoveryMethod,targetRecoveryMethod:l}}),o("setWalletRecovery","onSuccess",{method:l,wallet:c});break}default:throw new de("Unsupported recovery action")}}}})(),[p,m]=o(!1),{provider:g,action:y,isInAccountCreateFlow:f,shouldCreateEth:w,shouldCreateSol:v}=s?.recoveryOAuthStatus,[C,b]=o(void 0),[k,T]=o("create-wallet"===y);if("user-passcode"===g)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let x=Ah[g].name,A=Ah[g].component,I=s?.recoverWallet?.onCompleteNavigateTo,_=new Jr((async(e="create-wallet")=>(T(!0),new Promise(((t,n)=>{setTimeout((async()=>{try{let n=window.open();await u({provider:g,action:e,popup:n,shouldCreateEth:w,shouldCreateSol:v}),m(!0),t()}catch(t){b({message:`${"recover"===e?"Recovery":"Back up"} with ${x} unsuccessful`,detail:"recover"===y?`Please verify that you are selecting the ${x} account associated with your backup.`:"",retryable:!0}),n()}}),0)})))));d((()=>{"recover"!==y&&_.execute(f?"create-wallet":"set-recovery")}),[]),d((()=>{if(!p)return;let e=setTimeout((()=>{f?(i({createWallet:{onSuccess:()=>{},onFailure:e=>{c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),r()},callAuthOnSuccessOnClose:!0,shouldCreateEth:!1,shouldCreateSol:!1}}),a(kh)):l({shouldCallAuthOnSuccess:!1})}),ea);return()=>clearTimeout(e)}),[p]);let E=h((async()=>{await _.execute("recover"),I?a(I):m(!0)}),[]),S="google-drive"===g?"Google Drive":"Apple iCloud",N=p&&`Successfully ${"recover"===y?"recovered":"backed up"} with ${S}.`||C&&C.message||`${"recover"===y?"Recovering":"Backing up"} with ${S}...`,M=C?C.detail:"";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{}),k?/*#__PURE__*/t(n,{children:/*#__PURE__*/e(Th,{children:[/*#__PURE__*/t(hh,{title:N,icon:/*#__PURE__*/t(A,{style:{width:"38px",height:"38px"}}),description:M}),C&&C?.retryable?/*#__PURE__*/t(Fs,{onClick:()=>{qa(),b(void 0),"create-wallet"===y?_.execute("create-wallet"):E()},disabled:!p&&!C?.retryable,children:"Try again"}):null]})}):/*#__PURE__*/e(Th,{children:[/*#__PURE__*/t(hh,{title:"Confirm it's really you",icon:/*#__PURE__*/t(A,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${S} where your account is backed up.`}),/*#__PURE__*/e(Fs,{onClick:E,children:["Confirm with ",S]})]}),/*#__PURE__*/t(Js,{})]})}};let _h=/*#__PURE__*/en.div.withConfig({displayName:"IconContainer",componentId:"sc-ccfae04f-0"})(["width:24px;height:24px;display:flex;justify-content:center;align-items:center;"]),Eh={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy","privy-v2":"Privy"},Sh=({onClose:r})=>/*#__PURE__*/e(xh,{children:[/*#__PURE__*/t(hh,{title:"Why do I need to secure my account?",icon:/*#__PURE__*/t(hn,{width:48}),description:/*#__PURE__*/e(n,{children:[/*#__PURE__*/t("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),/*#__PURE__*/t("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),/*#__PURE__*/t(Fs,{onClick:r,children:"Select backup method"})]});const Nh={component:()=>{let[r,a]=o(!1),{navigate:i,lastScreen:s,navigateBack:l,setModalData:c,data:d,onUserCloseViaDialogOrKeybindRef:h}=$o(),{user:u}=us(),{embeddedWallets:p}=Fo(),{closePrivyModal:m}=Tt(),g=wi(u),y=null===g,{isInAccountCreateFlow:f,isResettingPassword:w,shouldCreateEth:v,shouldCreateSol:C}=d.recoverySelection,b=g&&"privy"!==g.recoveryMethod,k=b?/*#__PURE__*/e("span",{children:["Your account is currently secured using"," ",/*#__PURE__*/t("strong",{children:Eh[g?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function T(e){c({recoveryOAuthStatus:{provider:e,action:y?"create-wallet":"set-recovery",isInAccountCreateFlow:f,shouldCreateEth:v,shouldCreateSol:C}}),i(Ih)}function x(){d?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),m({shouldCallAuthOnSuccess:d?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return h.current=x,/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:x,backFn:r?()=>a(!1):s?l:void 0,infoFn:s||r?void 0:()=>a(!0)},"header"),r?/*#__PURE__*/t(Sh,{onClose:()=>a(!1)}):/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(hh,{title:b?"Update backup method":"Secure your account",icon:/*#__PURE__*/t(Vn,{width:48}),description:k}),/*#__PURE__*/t(Th,{children:p.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(g?.recoveryMethod||"")||e!==g?.recoveryMethod)).sort().map((n=>{switch(n){case"google-drive":/*#__PURE__*/return e(_s,{onClick:()=>T("google-drive"),children:[/*#__PURE__*/t(_h,{children:/*#__PURE__*/t(gh,{style:{width:18}})}),"Back up to Google Drive"]},n);case"icloud":/*#__PURE__*/return e(_s,{onClick:()=>T("icloud"),children:[/*#__PURE__*/t(_h,{children:/*#__PURE__*/t(mh,{style:{width:24}})}),"Back up to Apple iCloud"]},n);case"user-passcode":/*#__PURE__*/return e(_s,{onClick:()=>{i(oy({isCreatingWallet:y,skipSplashScreen:!0}))},children:[/*#__PURE__*/t(_h,{children:/*#__PURE__*/t(Hn,{style:{width:18}})}),w?"Reset your":"Set a"," password"]},n);default:return null}}))})]}),/*#__PURE__*/t(Js,{})]})}};let Mh=/*#__PURE__*/tn(["font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;text-align:left;transition:color 0.1s ease-in;"]);const Ph=/*#__PURE__*/en.span.withConfig({displayName:"StatusText",componentId:"sc-acac4b9-0"})([""," transition:color 0.1s ease-in;color:",";text-transform:",";&[aria-hidden='true']{visibility:hidden;}"],Mh,(({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"),(({error:e})=>e?"":"capitalize")),Wh=/*#__PURE__*/en.div.withConfig({displayName:"EmbeddedWalletScreenContainer",componentId:"sc-acac4b9-1"})(["display:flex;flex-direction:column;justify-content:center;flex-grow:1;"]),Uh=/*#__PURE__*/en(Fs).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-acac4b9-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/tn(["&&{transition:none;}"])));let Oh=/*#__PURE__*/tn(["&&{width:100%;border-width:1px;border-radius:var(--privy-border-radius-md);border-color:var(--privy-color-foreground-3);background:var(--privy-color-background);color:var(--privy-color-foreground);padding:12px;font-size:16px;font-style:normal;font-weight:300;line-height:22px;}"]);const Lh=/*#__PURE__*/en.input.withConfig({displayName:"PasswordInput",componentId:"sc-acac4b9-3"})([""," &::placeholder{color:var(--privy-color-foreground-3);font-style:italic;font-size:14px;}overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"],Oh),Rh=/*#__PURE__*/en.div.withConfig({displayName:"PasswordDisplay",componentId:"sc-acac4b9-4"})(["",""],Oh),Fh=/*#__PURE__*/en.div.withConfig({displayName:"PasswordContainer",componentId:"sc-acac4b9-5"})(["position:relative;width:100%;display:flex;align-items:center;justify-content:",";"],(({centered:e})=>e?"center":"space-between")),Dh=/*#__PURE__*/en.div.withConfig({displayName:"Header",componentId:"sc-acac4b9-6"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:32px 0;gap:4px;& h3{font-size:18px;font-style:normal;font-weight:600;line-height:24px;}& p{max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;}"]),Bh=/*#__PURE__*/en.div.withConfig({displayName:"Details",componentId:"sc-acac4b9-7"})(["display:flex;flex-direction:column;gap:10px;padding-bottom:1rem;"]),zh=/*#__PURE__*/en.div.withConfig({displayName:"DetailItem",componentId:"sc-acac4b9-8"})(["display:flex;text-align:left;align-items:center;gap:8px;max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;margin:0 8px;color:var(--privy-color-foreground-2);> :first-child{min-width:24px;}"]),$h=/*#__PURE__*/en(Rs).withConfig({displayName:"ExportButton",componentId:"sc-acac4b9-10"})(["display:flex;flex:1;gap:4px;justify-content:center;&&{background:var(--privy-color-background);border-radius:var(--privy-border-radius-md);border-color:var(--privy-color-foreground-3);border-width:1px;}"]),jh=/*#__PURE__*/en.div.withConfig({displayName:"InputRightIcons",componentId:"sc-acac4b9-11"})(["position:absolute;right:0.5rem;display:flex;flex-direction:row;justify-content:space-around;align-items:center;"]),Vh=/*#__PURE__*/en(qn).withConfig({displayName:"RegenerateIcon",componentId:"sc-acac4b9-12"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),Hh=/*#__PURE__*/en(Zn).withConfig({displayName:"HiddenIcon",componentId:"sc-acac4b9-13"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),qh=/*#__PURE__*/en(Kn).withConfig({displayName:"ShownIcon",componentId:"sc-acac4b9-14"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),Kh=/*#__PURE__*/en.progress.withConfig({displayName:"StrengthMeter",componentId:"sc-acac4b9-15"})(["height:4px;width:100%;margin:8px 0;::-webkit-progress-bar{border-radius:8px;background:var(--privy-color-foreground-4);}::-webkit-progress-value{border-radius:8px;transition:all 0.1s ease-out;background:",";}"],(({label:e})=>("Strong"===e?"#78dca6":"Medium"===e&&"var(--privy-color-warn)")||"var(--privy-color-error)")),Zh=({buttonHideAnimations:r,buttonLoading:a,password:i,onSubmit:s,onBack:l})=>{let[c,h]=o(!0),[u,p]=o(!1),[m,g]=o(""),y=i===m;return d((()=>{m&&!u&&p(!0)}),[m]),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{closeable:!1,backFn:l}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(Wh,{children:[/*#__PURE__*/e(Dh,{children:[/*#__PURE__*/t(gn,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),/*#__PURE__*/e(Fh,{children:[/*#__PURE__*/t(Lh,{value:m,onChange:e=>g(e.target.value),onKeyUp:e=>{"Enter"===e.key&&s()},onBlur:()=>p(!0),placeholder:"confirm your password",type:c?"password":"text",style:{paddingRight:"2.3rem"}}),/*#__PURE__*/t(jh,{style:{right:"0.75rem"},children:c?/*#__PURE__*/t(Hh,{onClick:()=>h(!1)}):/*#__PURE__*/t(qh,{onClick:()=>h(!0)})})]}),
11
+ /*#__PURE__*/t(Ph,{"aria-hidden":!u||y,error:!0,children:"Passwords do not match"})]}),/*#__PURE__*/t(Uh,{onClick:s,loading:a,disabled:!y,$hideAnimations:r,children:"Continue"}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})},Gh=({className:n,checked:r,color:a="var(--privy-color-accent)",...i})=>/*#__PURE__*/t("label",{children:/*#__PURE__*/e(Yh,{className:n,children:[/*#__PURE__*/t(Qh,{checked:r,...i}),/*#__PURE__*/t(Xh,{color:a,checked:r,children:/*#__PURE__*/t(Jh,{viewBox:"0 0 24 24",children:/*#__PURE__*/t("polyline",{points:"20 6 9 17 4 12"})})})]})});let Yh=/*#__PURE__*/en.div.withConfig({displayName:"CheckboxContainer",componentId:"sc-db51b935-1"})(["display:inline-block;vertical-align:middle;"]),Jh=/*#__PURE__*/en.svg.withConfig({displayName:"Icon",componentId:"sc-db51b935-2"})(["fill:none;stroke:white;stroke-width:3px;"]),Qh=/*#__PURE__*/en.input.attrs({type:"checkbox"}).withConfig({displayName:"HiddenCheckbox",componentId:"sc-db51b935-3"})(["border:0;clip:rect(0 0 0 0);clippath:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px;"]),Xh=/*#__PURE__*/en.div.withConfig({displayName:"StyledCheckbox",componentId:"sc-db51b935-4"})(["display:inline-block;width:18px;height:18px;transition:all 150ms;cursor:pointer;border-color:",";border-radius:3px;background:",";&&{border-width:1px;}",":focus + &{box-shadow:0 0 0 1px ",";}","{visibility:",";}"],(e=>e.color),(e=>e.checked?e.color:"var(--privy-color-background)"),Qh,(e=>e.color),Jh,(e=>e.checked?"visible":"hidden"));const eu=({buttonHideAnimations:r,buttonLoading:a,onSubmit:i,onBack:s,config:l})=>{let[c,d]=o(!1);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{closeable:!1,backFn:s}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(Wh,{children:[/*#__PURE__*/e(Dh,{children:[/*#__PURE__*/t(gn,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),/*#__PURE__*/t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),/*#__PURE__*/t(Bh,{children:/*#__PURE__*/e(zh,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:e=>{e.preventDefault(),d((e=>!e))},children:[/*#__PURE__*/t(Gh,{color:"var(--privy-color-error)",readOnly:!0,checked:c}),/*#__PURE__*/t(n,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),/*#__PURE__*/e(tu,{children:["user"===l.initiatedBy&&/*#__PURE__*/t(js,{onClick:l.onCancel,disabled:a,children:"Cancel"}),/*#__PURE__*/t(Uh,{onClick:i,loading:a,$hideAnimations:r,disabled:!c,children:"Set Password"})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})};let tu=/*#__PURE__*/en.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-d1659c5f-0"})(["display:flex;gap:10px;"]),nu=/[a-z]/,ru=/[A-Z]/,au=/[0-9]/,iu="!@#$%^&*()\\-_+.",ou=`a-zA-Z0-9${iu}`,su=RegExp(`[${iu}]`),lu=RegExp(`[${ou}]`);const cu=RegExp(`^[${ou}]{6,}$`),du=()=>Sn.generatePassphrase(4,Nn);function hu(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function uu(e=""){return(.3*function(e){if(e.length<8)return 0;let t=0;return nu.test(e)&&(t+=1),ru.test(e)&&(t+=1),au.test(e)&&(t+=1),su.test(e)&&(t+=1),Math.max(0,Math.min(1,t/3))}(e)+En(e)/95)/2}const pu=({buttonHideAnimations:r,buttonLoading:a,password:i="",config:l,isResettingPassword:c,onSubmit:h,onClose:u,onBack:p,onPasswordChange:m,onPasswordGenerate:g})=>{let[y,f]=o(!1),[w,v]=o(!1);d((()=>{i&&!w&&v(!0)}),[i]);let C=s((()=>w?6>(i?.length||0)?"Password must be at least 6 characters":cu.test(i||"")?null:`Invalid characters used ( ${((e="")=>[...new Set(e.split("").filter((e=>!lu.test(e))).map((e=>e.replace(" ","SPACE"))))])(i).join(" ")} )`:null),[i,w]),b=s((()=>C?{value:0,label:"Weak"}:function(e=""){let t=uu(e);return{value:t,label:hu(t)}}(i)),[i,C]),k=s((()=>!i?.length||!!C),[C,i]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:u,closeable:"user"===l.initiatedBy,backFn:p}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(Wh,{children:[/*#__PURE__*/e(Dh,{children:[/*#__PURE__*/t(Gn,{height:48,width:48,stroke:"var(--privy-color-accent)"}),/*#__PURE__*/e("h3",{style:{color:"var(--privy-color-foreground)"},children:[c?"Reset":"Set"," your password"]}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),/*#__PURE__*/e(Fh,{children:[/*#__PURE__*/t(Lh,{value:i,onChange:e=>m(e.target.value),onKeyUp:e=>{"Enter"===e.key&&h()},placeholder:"enter or generate a strong password",type:y?"password":"text",style:{paddingRight:"3.8rem"}}),/*#__PURE__*/e(jh,{style:{width:"3.5rem"},children:[y?/*#__PURE__*/t(Hh,{onClick:()=>f(!1)}):/*#__PURE__*/t(qh,{onClick:()=>f(!0)}),/*#__PURE__*/t(Vh,{onClick:g})]})]}),/*#__PURE__*/t(Kh,{value:0===b.value?.01:b.value,label:b.label}),/*#__PURE__*/t(Ph,{error:!!C,children:C||`Password Strength: ${w?b.label:"--"}`}),/*#__PURE__*/e(gu,{children:[/*#__PURE__*/t(mu,{children:/*#__PURE__*/e(Bh,{children:[/*#__PURE__*/e(zh,{children:[/*#__PURE__*/t(zn,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),/*#__PURE__*/e(zh,{children:[/*#__PURE__*/t(zn,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),/*#__PURE__*/t(Uh,{onClick:h,loading:a,disabled:k,$hideAnimations:r,children:"Continue"})]})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})};let mu=/*#__PURE__*/en(Bh).withConfig({displayName:"DetailsContainer",componentId:"sc-2da5fe90-0"})(["flex:1;padding-top:1rem;"]),gu=/*#__PURE__*/en.div.withConfig({displayName:"LowerContainer",componentId:"sc-2da5fe90-1"})(["display:flex;flex-direction:column;height:100%;"]);const yu=({buttonHideAnimations:r,buttonLoading:a,appName:i,password:s,onSubmit:l,onBack:c})=>{let[d,u]=o(!1),[p,m]=o(!0),g=h((()=>{u(!0),s&&navigator.clipboard.writeText(s)}),[s]),y=h((()=>{let e=document.createElement("a"),t=i.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),n=new Blob([fu(i,s)],{type:"text/plain"}),r=URL.createObjectURL(n);e.href=r,e.target="_blank",e.download=`${t}-privy-wallet-recovery.txt`,document.body.appendChild(e),e.click(),setTimeout((()=>{e.remove(),URL.revokeObjectURL(r)}),5e3)}),[s]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:c,closeable:!1}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(Wh,{children:[/*#__PURE__*/e(Dh,{children:[/*#__PURE__*/t(gn,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),/*#__PURE__*/e(Fh,{centered:!0,children:[/*#__PURE__*/t(Rh,{children:p?"•".repeat(s.length):s}),/*#__PURE__*/t(jh,{style:{right:"0.75rem"},children:p?/*#__PURE__*/t(Hh,{onClick:()=>m(!1)}):/*#__PURE__*/t(qh,{onClick:()=>m(!0)})})]}),/*#__PURE__*/e("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[/*#__PURE__*/t($h,{onClick:g,children:/*#__PURE__*/e(n,d?{children:[/*#__PURE__*/t(Jn,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}:{children:[/*#__PURE__*/t(Qn,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),/*#__PURE__*/e($h,{onClick:y,children:[/*#__PURE__*/t(Yn,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),/*#__PURE__*/t(Uh,{onClick:l,loading:a,$hideAnimations:r,children:"Continue"}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})};let fu=(e,t)=>`Your wallet recovery password for ${e} is\n\n${t}\n\nYou will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;const wu=({error:r,onClose:a})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{closeable:!1}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(ic,r?{children:[/*#__PURE__*/t(Bn,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),/*#__PURE__*/t(hh,{title:"Something went wrong",description:r})]}:{children:[/*#__PURE__*/t(zn,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(hh,{title:"Success"})]}),/*#__PURE__*/t(Fs,{onClick:a,children:"Close"}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]});let vu=(e,t)=>{switch(e){case"creating":return"back"===t?e:"saving";case"saving":return"back"===t?"creating":"confirming";case"confirming":return"back"===t?"saving":"finalizing";case"finalizing":return"back"===t?"confirming":"done";default:return e}};const Cu=({onSubmit:e,...n})=>{let{lastScreen:r,navigate:a}=$o(),{send:i,state:o}=(()=>{let[e,t]=u(vu,"creating");return{send:t,state:e}})(),s=h((async()=>{"finalizing"===o&&await e(),i("next")}),[o,i,e]);d((()=>{let e;return"done"===o&&"automatic"===n.config.initiatedBy&&(e=setTimeout((()=>n.onClose?.()),ea)),()=>{e&&clearTimeout(e)}}),[o,n.config.initiatedBy,n.onClose]);let l=h((()=>{i("back")}),[i]),c=h((()=>{a(Nh)}),[r,a]);return"creating"===o?/*#__PURE__*/t(pu,{...n,onSubmit:s,onBack:r===Nh?c:void 0}):"saving"===o?/*#__PURE__*/t(yu,{...n,onSubmit:s,onBack:l}):"confirming"===o?/*#__PURE__*/t(Zh,{...n,onSubmit:s,onBack:l}):"finalizing"===o?/*#__PURE__*/t(eu,{...n,onSubmit:s,onBack:l}):"done"===o?/*#__PURE__*/t(wu,{...n,onSubmit:s}):null};let bu={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:"};const ku=e=>{let t=bu[e];return"wallet"===e||"phone"===e?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};let Tu=/*#__PURE__*/c({});const xu=({children:e})=>{let n=Fo(),[r,a]=o({});return fs("login",{onComplete:({loginAccount:e})=>{e&&"passkey"!==e.type&&"cross_app"!==e.type&&("wallet"!==e.type||"privy"!==e.walletClientType)&&(Ar.put(Au(n.id),e.type),"wallet"===e.type?(Ar.put(Iu(n.id),e.walletClientType),Ar.put(_u(n.id),e.chainType),a({accountType:e.type,walletClientType:e.walletClientType,chainType:e.chainType})):(Ar.del(Iu(n.id)),Ar.del(_u(n.id)),a({accountType:e.type})))}}),d((()=>{if(!n.id)return;let e=Ar.get(Au(n.id)),t=Ar.get(Iu(n.id)),r=Ar.get(_u(n.id));e&&a("wallet"===e?{accountType:e,walletClientType:t,chainType:r}:{accountType:e})}),[n.id]),/*#__PURE__*/t(Tu.Provider,{value:r,children:e})};let Au=e=>`privy:${e}:recent-login-method`,Iu=e=>`privy:${e}:recent-login-wallet-client`,_u=e=>`privy:${e}:recent-login-chain-type`;const Eu=()=>l(Tu),Su=()=>{let{app:e}=$o(),n=e?.appearance?.logo,r=`${e?.name} logo`,i={maxHeight:"90px",maxWidth:"180px"};return n?"string"==typeof n?/*#__PURE__*/t("img",{src:n,alt:r,style:i}):"svg"===n.type||"img"===n.type?/*#__PURE__*/a.cloneElement(n,{alt:r,style:i}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},Nu=e=>{let{app:n}=$o();return n?.appearance.logo?/*#__PURE__*/t(Mu,{...e,children:/*#__PURE__*/t(Su,{})}):null},Mu=/*#__PURE__*/en.div.withConfig({displayName:"AppLogoContainer",componentId:"sc-a206bd44-0"})(["display:flex;flex-direction:column;align-items:center;padding:24px 0;flex-grow:1;justify-content:center;"]),Pu=({name:e,logoUrl:n,size:r="38px"})=>"string"==typeof n?/*#__PURE__*/t("img",{src:n,alt:`${e??"Provider app"} logo`,style:{width:r,height:r,maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):
12
+ /*#__PURE__*/t("span",{}),Wu=({appId:r})=>{let[a,i]=o(void 0),{startCrossAppAuthFlow:s,authenticated:l}=us(),{client:c}=Tt();return d((()=>{(async()=>{c&&i(await c.getCrossAppProviderDetails(r))})()}),[c]),/*#__PURE__*/t(_s,{onClick:()=>s({appId:r,action:l?"link":"login"}),disabled:!a,children:a?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Pu,{name:a.name,logoUrl:a.icon_url||void 0,size:"24px"})," ",a.name]}):/*#__PURE__*/t(Os,{})})},Uu=(e,t)=>!ui(e)&&("all-users"===t||"users-without-wallets"===t&&!Ou(e).length);let Ou=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"ethereum"===e.chainType));const Lu=(e,t)=>!mi(e)&&("all-users"===t||"users-without-wallets"===t&&!Ru(e).length);let Ru=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"solana"===e.chainType));const Fu=(e,t)=>Uu(e,t.ethereum.createOnLogin)||Lu(e,t.solana.createOnLogin),Du=/*#__PURE__*/en.span.withConfig({displayName:"CircleBackground",componentId:"sc-c9f33cd-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";background-color:",";border-radius:50%;display:inline-block;box-sizing:border-box;}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)")),Bu={component:()=>{let{navigate:r,app:a,setModalData:i,data:o}=$o(),{getAuthMeta:s,client:l}=Tt();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{}),/*#__PURE__*/e(zu,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Du,{color:"var(--privy-color-warn-light)"}),/*#__PURE__*/t(hn,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),/*#__PURE__*/e($u,{children:[/*#__PURE__*/t("h3",{children:"Account not found"}),/*#__PURE__*/e("p",{children:["Please try logging in again or go to ",a.name," to create an account."]})]}),/*#__PURE__*/t(bs,{}),/*#__PURE__*/t(Fs,{onClick:()=>{let e=s();i({...o,login:{...o?.login,...e?.disableSignup?{disableSignup:!0}:{}}}),l?.authFlow&&(l.authFlow=void 0),r(Kg)},children:"Try logging in again"})]})]})}};let zu=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-feca2100-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-bottom:16px;margin-top:24px;"]),$u=/*#__PURE__*/en.div.withConfig({displayName:"GappedContainer",componentId:"sc-feca2100-1"})(["display:flex;flex-direction:column;gap:8px;"]);const ju=/*#__PURE__*/en.span.withConfig({displayName:"CircleBorder",componentId:"sc-9056b8b8-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;border-bottom-color:",";}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)")),Vu=({address:n,showCopyIcon:r,url:a,className:i})=>{let[s,l]=o(!1);return d((()=>{if(s){let e=setTimeout((()=>l(!1)),2e3);return()=>clearTimeout(e)}}),[s]),a?/*#__PURE__*/t("a",{title:n,className:i,href:`${a}/address/${n}`,target:"_blank",children:Pr(n)}):/*#__PURE__*/e("button",{title:n,className:i,onClick:e=>(e.stopPropagation(),navigator.clipboard.writeText(n).then((()=>l(!0))).catch(console.error)),children:[Pr(n),/*#__PURE__*/t(r&&s?qu:Hu,{})]})};let Hu=/*#__PURE__*/en(Ln).withConfig({displayName:"StyledSquare2StackIcon",componentId:"sc-980a92a-0"})(["&&{display:inline;}stroke-width:2;height:0.875rem;width:0.875rem;margin-left:0.125rem;color:var(--privy-color-foreground-3);"]),qu=/*#__PURE__*/en(On).withConfig({displayName:"StyledCheckIcon",componentId:"sc-980a92a-1"})(["&&{display:inline;}stroke-width:2;height:0.875rem;width:0.875rem;margin-left:0.125rem;color:var(--privy-color-success);"]);function Ku(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...n,children:[/*#__PURE__*/t("circle",{cx:"12",cy:"12",r:"10"}),/*#__PURE__*/t("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),/*#__PURE__*/t("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}let Zu="0x0000000000000000000000000000000000000000";const Gu=({destinationCurrency:e,...t})=>({tradeType:"EXPECTED_OUTPUT",originCurrency:Zu,destinationCurrency:e??Zu,...t});let Yu="https://api.relay.link",Ju="https://api.testnets.relay.link";const Qu=async({input:e,isTestnet:t})=>{let n=await fetch((t?Ju:Yu)+"/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await n.json();if(!(n.ok||"string"==typeof r.message&&r.message.startsWith("Invalid address")))throw console.error("Relay error:",r),Error(r.message??"Error fetching quote from relay");return r},Xu=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}};function ep({transactionHash:e,wallet:t,isTestnet:n,bridgingStatus:r,setBridgingStatus:a,onSuccess:i,onFailure:o}){d((()=>{if(e&&t&&r){if(["delayed","waiting","pending"].includes(r)){let t=setInterval((async()=>{try{let t=await async function({transactionHash:e,isTestnet:t}){let n=await fetch((t?Ju:Yu)+"/requests/v2?hash="+e),r=await n.json();if(!n.ok){if("message"in r&&"string"==typeof r.message)throw Error(r.message);throw Error("Error fetching request from relay")}return r.requests.at(0)?.status??"pending"}({transactionHash:e,isTestnet:n});a(t)}catch(e){console.error(e)}}),1e3);return()=>clearInterval(t)}"success"===r?i({transactionHash:e,wallet:t}):["refund","failure"].includes(r)&&o({error:new tp(e,n)})}}),[r,e,n,t])}class tp extends de{constructor(e,t){super("We were unable to complete the bridging transaction. Funds will be refunded on your wallet.",void 0,ke.TRANSACTION_FAILURE),this.relayLink=t?`https://testnets.relay.link/transaction/${e}`:`https://relay.link/transaction/${e}`}}const np=({style:e,...n})=>/*#__PURE__*/t("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},...n,children:/*#__PURE__*/t("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"})});const rp={component:()=>{let{navigate:e,navigateBack:n,data:r,lastScreen:a,currentScreen:i}=$o(),o=r?.errorModalData?.previousScreen||(a===i?void 0:a);/*#__PURE__*/return t(ap,{error:r?.errorModalData?.error||Error(),backFn:()=>o?e(o,!1):n(),onClick:()=>e(o||Kg,!1)})}},ap=({error:r,backFn:a,onClick:i})=>{let{reset:o}=ri(),{app:s}=$o(),l=((r,a)=>{let i=/*#__PURE__*/t(gn,{height:38,width:38,stroke:"var(--privy-color-error)"});if(r instanceof tp)return{title:"Transaction failed",detail:/*#__PURE__*/e(n,{children:[/*#__PURE__*/t("p",{children:r.message}),/*#__PURE__*/e("p",{children:["Check the"," ",/*#__PURE__*/t(sp,{href:r.relayLink,target:"_blank",children:"refund status"}),"."]})]}),ctaText:"Try again",icon:i};if(r instanceof de)switch(r.privyErrorCode){case ke.CLIENT_REQUEST_TIMEOUT:return{title:"Timed out",detail:r.message,ctaText:"Try again",icon:i};case ke.INSUFFICIENT_BALANCE:return{title:"Insufficient balance",detail:r.message,ctaText:"Try again",icon:i};case ke.TRANSACTION_FAILURE:return{title:"Transaction failure",detail:r.message,ctaText:"Try again",icon:i};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:i}}else{if(r instanceof Kc&&"twilio_verification_failed"===r.type)return{title:"Something went wrong",detail:r.message,ctaText:"Try again",icon:/*#__PURE__*/t(ln,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(!(r instanceof Oe))return r instanceof Ke&&r.status&&[400,422].includes(r.status)?{title:"Something went wrong",detail:r.message,ctaText:"Try again",icon:i}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:i};switch(r.privyErrorCode){case ke.INVALID_CAPTCHA:return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:i};case ke.DISALLOWED_LOGIN_METHOD:return{title:"Not allowed",detail:r.message,ctaText:"Try another method",icon:i};case ke.ALLOWLIST_REJECTED:return{title:a.errorTitle||"You don't have access to this app",detail:a.errorDetail||"Have you been invited?",ctaText:a.errorCtaText||"Try another account",icon:/*#__PURE__*/t(np,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case ke.CAPTCHA_FAILURE:return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:/*#__PURE__*/t("span",{})};case ke.CAPTCHA_TIMEOUT:return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:/*#__PURE__*/t("span",{})};case ke.LINKED_TO_ANOTHER_USER:return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:i};case ke.NOT_SUPPORTED:return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:i};case ke.TOO_MANY_REQUESTS:return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:i};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:i}}}})(r,s.allowlistConfig);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:a}),/*#__PURE__*/e(ip,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(ju,{color:"var(--privy-color-error)"}),l.icon]})}),/*#__PURE__*/e(op,{children:[/*#__PURE__*/t("h3",{children:l.title}),"string"==typeof l.detail?/*#__PURE__*/t("p",{children:l.detail}):l.detail]}),/*#__PURE__*/t(Fs,{color:"var(--privy-color-error)",onClick:()=>{r instanceof Oe&&(r.privyErrorCode===ke.INVALID_CAPTCHA&&o(),r.privyErrorCode===ke.ALLOWLIST_REJECTED&&s.allowlistConfig.errorCtaLink)?window.location.href=s.allowlistConfig.errorCtaLink:i?.()},children:l.ctaText})]})]})};let ip=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-b0d5228e-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-bottom:16px;"]),op=/*#__PURE__*/en.div.withConfig({displayName:"GappedContainer",componentId:"sc-b0d5228e-1"})(["display:flex;flex-direction:column;gap:8px;"]),sp=/*#__PURE__*/en.a.withConfig({displayName:"Link",componentId:"sc-b0d5228e-2"})(["color:var(--privy-color-accent) !important;font-weight:600;"]);const lp=({onTransfer:e,isTransferring:n,transferSuccess:r})=>/*#__PURE__*/t(Fs,{...r?{success:!0,children:"Success!"}:{warn:!0,loading:n,onClick:e,children:"Transfer and delete account"}}),cp=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-3505eb4c-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;width:100%;padding-bottom:16px;"]),dp=/*#__PURE__*/en.div.withConfig({displayName:"GappedContainer",componentId:"sc-3505eb4c-1"})(["display:flex;flex-direction:column;&& p{font-size:14px;}width:100%;gap:16px;"]),hp=/*#__PURE__*/en.div.withConfig({displayName:"DisclosedAccountContainer",componentId:"sc-3505eb4c-2"})(["display:flex;cursor:pointer;align-items:center;width:100%;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);padding:8px 10px;font-size:14px;font-weight:500;gap:8px;"]),up=/*#__PURE__*/en(Rn).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-3505eb4c-3"})(["position:relative;width:",";height:",";color:var(--privy-color-foreground-3);margin-left:auto;"],(({$iconSize:e})=>`${e}px`),(({$iconSize:e})=>`${e}px`)),pp=/*#__PURE__*/en(Ln).withConfig({displayName:"StyledCopyIcon",componentId:"sc-3505eb4c-4"})(["position:relative;width:15px;height:15px;color:var(--privy-color-foreground-3);margin-left:auto;"]),mp=/*#__PURE__*/en.ol.withConfig({displayName:"ListContainer",componentId:"sc-3505eb4c-5"})(["display:flex;flex-direction:column;font-size:14px;width:100%;text-align:left;"]),gp=/*#__PURE__*/en.li.withConfig({displayName:"ListItem",componentId:"sc-3505eb4c-6"})(["font-size:14px;list-style-type:auto;list-style-position:outside;margin-left:1rem;margin-bottom:0.5rem;&:last-child{margin-bottom:0;}"]),yp=/*#__PURE__*/en.div.withConfig({displayName:"CircleContainer",componentId:"sc-3505eb4c-7"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]);let fp=()=>/*#__PURE__*/t(yp,{children:/*#__PURE__*/t(up,{$iconSize:60})});const wp=({address:r,onClose:a,onRetry:i,onTransfer:o,isTransferring:s,transferSuccess:l})=>{let{defaultChain:c}=Fo(),d=c.blockExplorers?.default.url??"https://etherscan.io";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:a,backFn:i}),/*#__PURE__*/e(cp,{children:[/*#__PURE__*/t(fp,{}),/*#__PURE__*/e(dp,{children:[/*#__PURE__*/t("h3",{children:"Check account assets before transferring"}),/*#__PURE__*/t("p",{children:"Before transferring, ensure there are no assets in the other account. Assets in that account will not transfer automatically and may be lost."}),/*#__PURE__*/e(mp,{children:[/*#__PURE__*/t("p",{children:" To check your balance, you can:"}),/*#__PURE__*/t(gp,{children:"Log out and log back into the other account, or "}),/*#__PURE__*/e(gp,{children:["Copy your wallet address and use a"," ",/*#__PURE__*/t("u",{children:/*#__PURE__*/t("a",{target:"_blank",href:d,children:"block explorer"})})," ","to see if the account holds any assets."]})]}),/*#__PURE__*/e(hp,{onClick:()=>navigator.clipboard.writeText(r).catch(console.error),children:[/*#__PURE__*/t(Un,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/t(Vu,{address:r,showCopyIcon:!1}),/*#__PURE__*/t(pp,{})]}),/*#__PURE__*/t(lp,{onTransfer:o,isTransferring:s,transferSuccess:l})]})]}),/*#__PURE__*/t(Js,{})]})},vp={component:()=>{let{initiateAccountTransfer:e,closePrivyModal:n}=Tt(),{data:r,navigate:a,lastScreen:i,setModalData:s}=$o(),[l,c]=o(void 0),[d,h]=o(!1),[u,p]=o(!1),m=async()=>{try{if(!r?.accountTransfer?.nonce||!r?.accountTransfer?.account)throw Error("missing account transfer inputs");p(!0),await e({nonce:r?.accountTransfer?.nonce,account:r?.accountTransfer?.account,accountType:r?.accountTransfer?.linkMethod,externalWalletMetadata:r?.accountTransfer?.externalWalletMetadata,telegramWebAppData:r?.accountTransfer?.telegramWebAppData,telegramAuthResult:r?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:r?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:r?.accountTransfer?.oAuthUserInfo}),h(!0),p(!1),setTimeout(n,1e3)}catch(e){s({errorModalData:{error:e,previousScreen:i||vp}}),a(rp,!0)}};return l?/*#__PURE__*/t(wp,{address:l,onClose:n,onRetry:()=>c(void 0),onTransfer:m,isTransferring:u,transferSuccess:d}):/*#__PURE__*/t(Cp,{onClose:n,onInfo:()=>c(r?.accountTransfer?.embeddedWalletAddress),onContinue:()=>c(r?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:u,transferSuccess:d,data:r})}},Cp=({onClose:r,onContinue:a,onInfo:i,onTransfer:o,transferSuccess:s,isTransferring:l,data:c})=>{if(!c?.accountTransfer?.linkMethod||!c?.accountTransfer?.displayName)return;let d={method:c?.accountTransfer?.linkMethod,handle:c?.accountTransfer?.displayName,disclosedAccount:c?.accountTransfer?.embeddedWalletAddress?{type:"wallet",handle:c?.accountTransfer?.embeddedWalletAddress}:void 0};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{closeable:!0}),/*#__PURE__*/e(cp,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(ju,{color:"var(--privy-color-error)"}),/*#__PURE__*/t(gn,{height:38,width:38,stroke:"var(--privy-color-error)"})]})}),/*#__PURE__*/e(dp,{children:[/*#__PURE__*/e("h3",{children:[function(e){switch(e){case"sms":return"Phone number";case"email":return"Email address";case"siwe":return"Wallet address";case"linkedin":return"LinkedIn profile";case"google":case"apple":case"discord":case"github":case"instagram":case"spotify":case"tiktok":case"twitter":case"telegram":case"farcaster":return`${Pa(e.replace("_oauth",""))} profile`;default:return e}}(d.method)," is associated with another account"]}),/*#__PURE__*/e("p",{children:["Do you want to transfer",/*#__PURE__*/t("b",{children:d.handle?` ${d.handle}`:""})," to this account instead? This will delete your other account."]}),/*#__PURE__*/t(bp,{onClick:i,disclosedAccount:d.disclosedAccount})]}),/*#__PURE__*/e(dp,{style:{gap:12,marginTop:12},children:[c?.accountTransfer?.embeddedWalletAddress?/*#__PURE__*/t(Fs,{onClick:a,children:"Continue"}):/*#__PURE__*/t(lp,{onTransfer:o,transferSuccess:s,isTransferring:l}),/*#__PURE__*/t(js,{onClick:r,children:"No thanks"})]})]}),/*#__PURE__*/t(Js,{})]})};function bp({disclosedAccount:n,onClick:r}){return n?/*#__PURE__*/e(hp,{onClick:r,children:[/*#__PURE__*/t(Un,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/t(Vu,{address:n.handle,showCopyIcon:!1}),/*#__PURE__*/t(Ku,{width:15,height:15,color:"var(--privy-color-foreground-3)",style:{marginLeft:"auto"}})]}):null}const kp=()=>/*#__PURE__*/t(Tp,{children:/*#__PURE__*/e(xp,{children:[/*#__PURE__*/t(Ap,{}),/*#__PURE__*/t(Ip,{})]})});let Tp=/*#__PURE__*/en.div.withConfig({displayName:"LoadingContainer",componentId:"sc-85b54ede-0"})(["display:flex;justify-content:center;align-items:center;flex-grow:1;margin:12px;padding:16px;@media all and (display-mode:standalone){margin-bottom:30px;}"]),xp=/*#__PURE__*/en.div.withConfig({displayName:"SpinnerContainer",componentId:"sc-85b54ede-1"})(["position:relative;height:140px;width:140px;opacity:1;animation:fadein 200ms ease;"]),Ap=/*#__PURE__*/en.div.withConfig({displayName:"CircleFixed",componentId:"sc-85b54ede-2"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:140px;height:140px;&&{border:4px solid var(--privy-color-accent-light);border-radius:50%;}"]),Ip=/*#__PURE__*/en.div.withConfig({displayName:"CircleRotate",componentId:"sc-85b54ede-3"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:140px;height:140px;animation:spin 1200ms linear infinite;&&{border:4px solid;border-color:var(--privy-color-accent) transparent transparent transparent;border-radius:50%;}@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}"]);const _p={component:()=>{let{app:r,setModalData:a,navigate:i,data:s,onUserCloseViaDialogOrKeybindRef:l}=$o(),[c,h]=o(""),{embeddedWallets:u}=Fo(),{authenticated:p,user:m,getAccessToken:g}=us(),{closePrivyModal:y,walletProxy:f}=Tt(),{onSuccess:w,onFailure:v,callAuthOnSuccessOnClose:C,shouldCreateEth:b,shouldCreateSol:k}=s.createWallet,T=!0===r?.embeddedWallets.requireUserOwnedRecoveryOnCreate,[x,A]=o(null),{create:I}=bh(),_=b??(!!m&&Uu(m,r.embeddedWallets.ethereum.createOnLogin)),E=k??(!!m&&Lu(m,r.embeddedWallets.solana.createOnLogin)),S=new Jr((async()=>{let e=await g();if(m&&e&&f)try{let e;if(_&&E)e=await I({chainType:"ethereum",walletIndex:0,latestUser:m}),e=await I({chainType:"solana",walletIndex:0,latestUser:e.user});else if(E)e=await I({chainType:"solana",walletIndex:0,latestUser:m});else{if(!_)return void y({shouldCallAuthOnSuccess:C});e=await I({chainType:"ethereum",walletIndex:0,latestUser:m})}A(e),i(kh)}catch(e){h(e.message)}}));return d((()=>p&&m?T?(a({...s,createWallet:{...s.createWallet,shouldCreateEth:_,shouldCreateSol:E},recoverySelection:{...s?.recoverySelection,isInAccountCreateFlow:!0,shouldCreateEth:_,shouldCreateSol:E}}),i(sy({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:u.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void S.execute():(i(Kg),void v(Error("User must be authenticated before creating a Privy wallet")))),[T,p]),l.current=()=>null,c?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{closeable:!1}),/*#__PURE__*/e(ic,{children:[/*#__PURE__*/t(Bn,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),/*#__PURE__*/t(hh,{title:"Something went wrong",description:c})]}),/*#__PURE__*/t(Fs,{onClick:()=>{x?(w(x),y({shouldCallAuthOnSuccess:C})):(v(new _t("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))},children:"Close"}),/*#__PURE__*/t(Ep,{})]}):/*#__PURE__*/t(kp,{})}};let Ep=/*#__PURE__*/en.div.withConfig({displayName:"BottomSpacing",componentId:"sc-1a8a319a-0"})(["height:44px;"]);const Sp={component:()=>{let{user:e,logout:n}=us(),{app:r,onUserCloseViaDialogOrKeybindRef:a,setModalData:i,navigate:o}=$o(),{acceptTerms:s,closePrivyModal:l,createAnalyticsEvent:c}=Tt(),d=e=>{e?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),n()};a.current=d;/*#__PURE__*/return t(Np,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:async t=>{t.preventDefault(),await s(),e&&Fu(e,r.embeddedWallets)?(i({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),o(_p)):l()},onDecline:d})}},Np=({termsAndConditionsUrl:r,privacyPolicyUrl:a,onAccept:i,onDecline:o})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{closeable:!1}),/*#__PURE__*/t(Dn,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),/*#__PURE__*/t(rd,{style:{marginTop:24},children:"One last step"}),/*#__PURE__*/t(ad,{children:"By signing up, you agree to our terms and privacy policy."}),/*#__PURE__*/e(Ts,{style:{marginTop:24},children:[r&&/*#__PURE__*/e(Es,{target:"_blank",href:r,children:["View Terms ",/*#__PURE__*/t(Fn,{style:{marginLeft:"auto"}})]}),a&&/*#__PURE__*/e(Es,{target:"_blank",href:a,children:["View Privacy Policy ",/*#__PURE__*/t(Fn,{style:{marginLeft:"auto"}})]})]}),/*#__PURE__*/e(Mp,{style:{marginTop:24},children:[/*#__PURE__*/t(js,{onClick:o,children:"No thanks"}),/*#__PURE__*/t(Fs,{onClick:i,children:"Accept"})]}),/*#__PURE__*/t(Js,{})]});let Mp=/*#__PURE__*/en.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-9abb9a03-0"})(["display:flex;gap:10px;"]);const Pp=({...n})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...n,children:[/*#__PURE__*/e("g",{clipPath:"url(#clip0_2856_1743)",children:[/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_2856_1743",children:/*#__PURE__*/t("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),Wp=({chainType:n,withPadding:r})=>{let a="";return a="ethereum-only"===n||"ethereum-and-solana"===n?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/t(Ns,{$withPadding:r,children:/*#__PURE__*/e(Ms,{children:[/*#__PURE__*/t(hn,{style:{color:"var(--privy-color-warn)",height:48,width:48}}),/*#__PURE__*/t("h3",{children:"No wallets available"}),/*#__PURE__*/e("p",{children:["Please download an external wallet provider, like ",a,"."]})]})},"empty-wallet-state")};let Up=/*#__PURE__*/rn(["from,to{background:var(--privy-color-foreground-4);color:var(--privy-color-foreground-4);}50%{background:var(--privy-color-foreground-accent);color:var(--privy-color-foreground-accent);}"]);const Op=/*#__PURE__*/tn(["",""],(e=>e.$isLoading?/*#__PURE__*/tn(["width:35%;animation:"," 2s linear infinite;border-radius:var(--privy-border-radius-sm);"],Up):"")),Lp=({children:e,color:n,isLoading:r,isPulsing:a,...i})=>/*#__PURE__*/t(Rp,{$color:n,$isLoading:r,$isPulsing:a,...i,children:e});let Rp=/*#__PURE__*/en.span.withConfig({displayName:"StyledSpan",componentId:"sc-eba15c9-0"})(["padding:0.125rem 0.5rem;font-size:0.75rem;font-weight:500;line-height:1.125rem;border-radius:var(--privy-border-radius-sm);display:flex;align-items:center;"," ",""],(e=>{let t,n;"green"===e.$color&&(t="var(--privy-color-success-dark)",n="var(--privy-color-success-light)"),"red"===e.$color&&(t="var(--privy-color-error)",n="var(--privy-color-error-light)"),"gray"===e.$color&&(t="var(--privy-color-foreground-2)",n="var(--privy-color-background-2)");let r=/*#__PURE__*/rn(["from,to{background-color:",";}50%{background-color:rgba(",",0.8);}"],n,n);/*#__PURE__*/return tn(["color:",";background-color:",";",";"],t,n,e.$isPulsing&&/*#__PURE__*/tn(["animation:"," 3s linear infinite;"],r))}),Op);const Fp=({style:n,...r})=>/*#__PURE__*/e("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...n},...r,children:[/*#__PURE__*/t("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]}),Dp=({icon:r})=>/*#__PURE__*/t(n,{children:/*#__PURE__*/t(Bp,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{}),"string"==typeof r?
13
+ /*#__PURE__*/t("span",{style:{background:`url('${r}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):r?/*#__PURE__*/t(r,{style:{width:"38px",height:"38px"}}):
14
+ /*#__PURE__*/t("span",{})]})})});let Bp=/*#__PURE__*/en.div.withConfig({displayName:"StackedContainer",componentId:"sc-26c1d9b9-0"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > span{position:absolute;left:-41px;top:-41px;}> div > :last-child{position:absolute;left:-19px;top:-19px;}"]);const zp={component:()=>{let{lastScreen:r,currentScreen:a,data:s,navigateBack:l,navigate:c,setModalData:h}=$o(),{status:u,token:p,waitForResult:m,reset:g,execute:y}=ri(),f=i([]),w=e=>{f.current=[e,...f.current]},[v,C]=o(!0);d((()=>(w(setTimeout(C,1e3,!1)),()=>{f.current.forEach((e=>clearTimeout(e))),f.current=[]})),[]);let[b,k]=o(""),[T,x]=o("Checking that you are a human..."),[A,I]=o(/*#__PURE__*/t(Fs,{onClick:()=>{},disabled:!0,children:"Continue"})),[_,E]=o(!1),[S,N]=o(3),M=s?.captchaModalData,P=async e=>{try{await(M?.callback(e)),M?.onSuccessNavigateTo&&c(M?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof ti)return;h({errorModalData:{error:e,previousScreen:r||Kg}}),c(M?.onErrorNavigateTo||rp,!1)}};d((()=>{"success"===u?w(setTimeout((async()=>{let e=await m();!e||M?.userIntentRequired||P(e)}),1e3)):"ready"===u&&w(setTimeout((()=>{"ready"===u&&y()}),500))}),[u]),d((()=>{if(!v)switch(u){case"success":k("Success!"),x("CAPTCHA passed successfully."),I(/*#__PURE__*/t(Fs,{onClick:()=>{E(!0),P(p)},disabled:!M?.userIntentRequired,loading:_,children:M?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":k(""),x("Checking that you are a human..."),I(/*#__PURE__*/t(Fs,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":k("Something went wrong"),S<=0?(x("If you use an adblocker or VPN, try disabling and re-attempting."),I(null)):(x("You did not pass CAPTCHA. Please try again."),I(/*#__PURE__*/t(Fs,{onClick:W,children:"Retry"})))}}),[u,v,_]);let W=async()=>{if(S<=0)return;N((e=>e-1)),g(),y();let e=await m();!e||M?.userIntentRequired||P(e)};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:r&&a!==r?l:void 0}),/*#__PURE__*/e($p,{children:["success"===u?/*#__PURE__*/t(zn,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):"error"===u?/*#__PURE__*/t(Bn,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):/*#__PURE__*/t(Dp,{}),/*#__PURE__*/e(sc,{children:[b?/*#__PURE__*/t("h3",{children:b}):null,/*#__PURE__*/t("p",{children:T})]}),A]}),/*#__PURE__*/t(Qs,{})]})}};let $p=/*#__PURE__*/en.div.withConfig({displayName:"CaptchaContainer",componentId:"sc-ae138086-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const jp=({style:e,color:n,...r})=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:n||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:/*#__PURE__*/t("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Vp=({color:e,...n})=>/*#__PURE__*/t("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 115.77 122.88",xmlSpace:"preserve",...n,children:/*#__PURE__*/t("g",{children:/*#__PURE__*/t("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})}),Hp=n=>{let[r,a]=o(!1);/*#__PURE__*/return e(qp,{color:n.color,onClick:()=>{a(!0),navigator.clipboard.writeText(n.text),setTimeout((()=>a(!1)),1500)},$justCopied:r,children:[r?/*#__PURE__*/t(jp,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):/*#__PURE__*/t(Vp,{style:{height:"14px",width:"14px"}}),r?"Copied":"Copy"," ",n.itemName?n.itemName:"to Clipboard"]})};let qp=/*#__PURE__*/en.button.withConfig({displayName:"StyledCopytoClipboardButton",componentId:"sc-46f4187f-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.$justCopied?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.$justCopied?"medium":"normal"),(e=>e.$justCopied?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"));const Kp=e=>{let[n,r]=o(!1);/*#__PURE__*/return t(Zp,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout((()=>r(!1)),1500)},justOpened:n,children:e.text})};let Zp=/*#__PURE__*/en.a.withConfig({displayName:"StyledOpenLinkButton",componentId:"sc-4e695c83-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.justOpened?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.justOpened?"medium":"normal"),(e=>e.justOpened?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"));const Gp=()=>/*#__PURE__*/t("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:/*#__PURE__*/t("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});let Yp=(e,t,n,r,a)=>{for(let i=t;i<t+r;i++)for(let t=n;t<n+a;t++){let n=e?.[t];n&&n[i]&&(n[i]=0)}return e},Jp=({x:e,y:r,cellSize:a,bgColor:i,fgColor:o})=>
15
+ /*#__PURE__*/t(n,{children:[0,1,2].map((n=>/*#__PURE__*/t("circle",{r:a*(7-2*n)/2,cx:e+7*a/2,cy:r+7*a/2,fill:n%2!=0?i:o},`finder-${e}-${r}-${n}`)))}),Qp=({cellSize:e,matrixSize:r,bgColor:a,fgColor:i})=>/*#__PURE__*/t(n,{children:[[0,0],[(r-7)*e,0],[0,(r-7)*e]].map((([n,r])=>/*#__PURE__*/t(Jp,{x:n,y:r,cellSize:e,bgColor:a,fgColor:i},`finder-${n}-${r}`)))}),Xp=({matrix:e,cellSize:r,color:i})=>/*#__PURE__*/t(n,{children:e.map(((e,n)=>e.map(((e,o)=>e?/*#__PURE__*/t("rect",{height:r-.4,width:r-.4,x:n*r+.1*r,y:o*r+.1*r,rx:.5*r,ry:.5*r,fill:i},`cell-${n}-${o}`):/*#__PURE__*/t(a.Fragment,{},`circle-${n}-${o}`)))))}),em=({cellSize:r,matrixSize:a,element:i,sizePercentage:o,bgColor:s})=>{if(!i)/*#__PURE__*/return t(n,{});let l=a*(o||.14),c=Math.floor(a/2-l/2),d=Math.floor(a/2+l/2);(d-c)%2!=a%2&&(d+=1);let h=(d-c)*r,u=h-.2*h,p=c*r;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t("rect",{x:c*r,y:c*r,width:h,height:h,fill:s}),/*#__PURE__*/t(i,{x:p+.1*h,y:p+.1*h,height:u,width:u})]})},tm=n=>{let r=n.outputSize,a=((e,t)=>{let n=$n.create(e,{errorCorrectionLevel:t}).modules,r=((e,t)=>{let n=e.slice(0),r=[];for(;n.length;)r.push(n.splice(0,t));return r})(Array.from(n.data),n.size);return r=Yp(r,0,0,7,7),r=Yp(r,r.length-7,0,7,7),Yp(r,0,r.length-7,7,7)})(n.url,n.errorCorrectionLevel),i=r/a.length,o=function(e,{min:t,max:n}){return Math.min(Math.max(e,t),n)}(2*i,{min:.025*r,max:.036*r});/*#__PURE__*/return e("svg",{height:n.outputSize,width:n.outputSize,viewBox:`0 0 ${n.outputSize} ${n.outputSize}`,style:{height:"100%",width:"100%",padding:`${o}px`},children:[/*#__PURE__*/t(Xp,{matrix:a,cellSize:i,color:n.fgColor}),/*#__PURE__*/t(Qp,{cellSize:i,matrixSize:a.length,fgColor:n.fgColor,bgColor:n.bgColor}),/*#__PURE__*/t(em,{cellSize:i,element:n.logo?.element,bgColor:n.bgColor,matrixSize:a.length})]})},nm=/*#__PURE__*/en.div.attrs({className:"ph-no-capture"}).withConfig({displayName:"QrContainer",componentId:"sc-597e27f3-0"})(["display:flex;justify-content:center;align-items:center;height:",";width:",";margin:auto;background-color:",";&&{border-width:2px;border-color:",";border-radius:var(--privy-border-radius-md);}"],(e=>`${e.$size}px`),(e=>`${e.$size}px`),(e=>e.$bgColor),(e=>e.$borderColor));const rm=e=>{let{appearance:n}=Fo(),r=e.bgColor||"#FFFFFF",a=e.fgColor||"#000000",i=e.size||160,o="dark"===n.palette.colorScheme?r:a;/*#__PURE__*/return t(nm,{$size:i,$bgColor:r,$fgColor:a,$borderColor:o,children:/*#__PURE__*/t(tm,{url:e.url,logo:{element:e.squareLogoElement??Gp},outputSize:i,bgColor:r,fgColor:a,errorCorrectionLevel:e.errorCorrectionLevel||"Q"})})},am={component:()=>{let{navigate:r,app:a}=$o(),i=a?.allowlistConfig.errorTitle||"You don't have access to this app",o=a?.allowlistConfig.errorDetail||"Have you been invited?",s=a?.allowlistConfig.errorCtaText||"Try another account";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{}),/*#__PURE__*/e(im,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(ju,{}),/*#__PURE__*/t(np,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),/*#__PURE__*/e(om,{children:[/*#__PURE__*/t("string"==typeof i?"h3":n,{children:i}),/*#__PURE__*/t("string"==typeof o?"p":n,{children:o})]}),a?.allowlistConfig.errorCtaLink?
16
+ /*#__PURE__*/t(Fs,{as:"a",href:a.allowlistConfig.errorCtaLink,children:s}):/*#__PURE__*/t(Fs,{onClick:()=>{r(Kg)},children:s})]})]})}};let im=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-274cb2fe-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-bottom:16px;"]),om=/*#__PURE__*/en.div.withConfig({displayName:"GappedContainer",componentId:"sc-274cb2fe-1"})(["display:flex;flex-direction:column;gap:8px;"]);const sm=({style:e,...n})=>/*#__PURE__*/t("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},...n,children:/*#__PURE__*/t("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"})}),lm={component:()=>{let{navigate:r}=$o();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{}),/*#__PURE__*/e(cm,{children:[/*#__PURE__*/t(dm,{children:/*#__PURE__*/t(sm,{})}),/*#__PURE__*/e(hm,{children:[/*#__PURE__*/t("h3",{children:"Unable to sign in"}),/*#__PURE__*/t("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),/*#__PURE__*/t(Fs,{onClick:()=>{r(Kg)},children:"Go back"})]}),/*#__PURE__*/t(Js,{})]})}};let cm=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-b3ae112e-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;padding-top:8px;padding-bottom:32px;"]),dm=/*#__PURE__*/en.div.withConfig({displayName:"IconContainer",componentId:"sc-b3ae112e-1"})(["display:flex;align-items:center;justify-content:center;height:72px;aspect-ratio:1;color:var(--privy-color-error);background-color:var(--privy-color-error-light);border-radius:50%;"]),hm=/*#__PURE__*/en.div.withConfig({displayName:"GappedContainer",componentId:"sc-b3ae112e-2"})(["display:flex;flex-direction:column;gap:8px;"]),um="#8a63d2";const pm={component:()=>{let{authenticated:r,logout:a,ready:s,user:l}=us(),{lastScreen:c,navigate:h,navigateBack:u,setModalData:p,app:m}=$o(),{getAuthFlow:f,loginWithFarcaster:w,closePrivyModal:v,createAnalyticsEvent:C}=Tt(),[b,k]=o(void 0),[T,x]=o(!1),[A,I]=o(!1),_=i([]),E=f(),S=E?.meta.connectUri;return d((()=>{let e=Date.now(),t=setInterval((async()=>{let n=await E.pollForReady.execute(),r=Date.now()-e;if(n){clearInterval(t),x(!0);try{await w(),I(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===ke.ALLOWLIST_REJECTED)return void h(am);if(e?.privyErrorCode===ke.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),void h(lm);if(e?.privyErrorCode===ke.USER_DOES_NOT_EXIST)return void h(Bu);if(e?.privyErrorCode===ke.LINKED_TO_ANOTHER_USER)t.detail=e.message??"This account has already been linked to another user.";else{if(e?.privyErrorCode===ke.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return p({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:"farcaster",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,farcasterEmbeddedAddress:e.data?.data?.otherUser?.farcasterEmbeddedAddress}}),void h(vp);e?.privyErrorCode===ke.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===ke.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}k(t)}}else r>12e4&&(clearInterval(t),k({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),_.current.forEach((e=>clearTimeout(e)))}}),[]),d((()=>{if(s&&r&&A&&l){if(m?.legal.requireUsersAcceptTerms&&!l.hasAcceptedTerms){let e=setTimeout((()=>{h(Sp)}),ea);return()=>clearTimeout(e)}A&&(Fu(l,m.embeddedWallets)?_.current.push(setTimeout((()=>{p({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),h(_p)}),ea)):_.current.push(setTimeout((()=>v({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ea)))}}),[A,s,r,l]),/*#__PURE__*/e(n,g||T?{children:[/*#__PURE__*/t(nl,{backFn:c?u:void 0,onClose:v},"header"),/*#__PURE__*/t(cc,{}),
17
+ /*#__PURE__*/t(n,y?{children:/*#__PURE__*/e(gm,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:A,fail:!!b}),/*#__PURE__*/t(Fp,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t(rd,{children:b?b.message:"Sign in with Farcaster"}),/*#__PURE__*/t(ad,{children:b?b.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),S&&/*#__PURE__*/t(Fs,{onClick:e=>{e.preventDefault(),window.location.href=S},children:"Open Warpcast app"})]})}:{children:/*#__PURE__*/e(mm,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:A,fail:!!b}),/*#__PURE__*/t(Fp,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t(rd,{children:b?b.message:"Signing in with Farcaster"}),/*#__PURE__*/t(ad,{children:b?b.detail:"This should only take a moment"}),/*#__PURE__*/t(nc,{children:S&&g&&/*#__PURE__*/t(Kp,{text:"Take me to Warpcast",url:S,color:um})})]})]})}),/*#__PURE__*/t(Qs,{})]}:{children:[/*#__PURE__*/t(nl,{backFn:c?u:void 0,onClose:v},"header"),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(mm,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(rd,{children:"Sign in with Farcaster"}),/*#__PURE__*/t(ad,{children:"Scan with your phone's camera to continue."}),/*#__PURE__*/t(ac,{children:S?/*#__PURE__*/t(rm,{url:S,size:275,squareLogoElement:Fp}):/*#__PURE__*/t(Ws,{})}),/*#__PURE__*/e(nc,{children:[/*#__PURE__*/t(ad,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),S&&/*#__PURE__*/t(Hp,{text:S,itemName:"link",color:um})]})]})}),/*#__PURE__*/t(Qs,{})]})}};let mm=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-69a6d91f-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]),gm=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainerButton",componentId:"sc-69a6d91f-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const ym=()=>{let[n,r]=o(!1),{currentScreen:a,navigate:i,setModalData:s,data:l}=$o(),{enabled:c,token:d}=ri(),{initLoginWithFarcaster:h}=Tt(),{accountType:u}=Eu();/*#__PURE__*/return e(_s,{onClick:async()=>{r(!0);try{c&&!d?(s({captchaModalData:{callback:e=>h(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:pm,onErrorNavigateTo:rp}}),i(zp)):(await h(d,l?.login?.disableSignup),i(pm))}catch(e){s({errorModalData:{error:e,previousScreen:a||Kg}}),i(rp)}finally{r(!1)}},disabled:!1,children:[/*#__PURE__*/t(Fp,{})," Farcaster",n&&/*#__PURE__*/t(Os,{}),"farcaster"===u&&/*#__PURE__*/t(fm,{color:"gray",children:"Recent"})]})};let fm=/*#__PURE__*/en(Lp).withConfig({displayName:"StyledChip",componentId:"sc-30c9632d-0"})(["margin-left:auto;"]);const wm=({style:n,...r})=>/*#__PURE__*/e("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...n},xmlns:"http://www.w3.org/2000/svg",...r,children:[/*#__PURE__*/e("g",{clipPath:"url(#clip0_113_33841)",children:[/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_113_33841",children:/*#__PURE__*/t("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]}),vm={component:()=>{let{app:r,lastScreen:a,currentScreen:s,navigateBack:l,data:c,setModalData:h,navigate:u}=$o(),{loginWithPasskey:p,signupWithPasskey:m,closePrivyModal:g,createAnalyticsEvent:y}=Tt(),{user:f,logout:w}=us(),{passkeySignupFlow:v}=c?.passkeyAuthModalData??{},[C,b]=o("loading"),[k,T]=o(null),x=i([]),A=e=>{x.current=[e,...x.current]};d((()=>()=>{x.current.forEach((e=>clearTimeout(e))),x.current=[]}),[]);let I=async()=>{b("loading");try{v?await m():await p(),b("success")}catch(e){T(e),b("error")}};return d((()=>{if("success"===C&&f){if(r?.legal.requireUsersAcceptTerms&&!f.hasAcceptedTerms)return void A(setTimeout((()=>{u(Sp)}),900));if(!Fu(f,r?.embeddedWallets))return void A(setTimeout((()=>{g({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),ea));A(setTimeout((()=>{h({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"PasskeyStatusScreen"}}),w()},callAuthOnSuccessOnClose:!0}}),u(_p)}),900))}}),[f,C]),d((()=>{I()}),[]),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{backFn:a&&s!==a?l:void 0}),/*#__PURE__*/e(Cm,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:"success"===C,fail:"error"===C}),/*#__PURE__*/t(wm,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t("h3",{children:(()=>{switch(C){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})()}),/*#__PURE__*/t("p",{style:{whiteSpace:"pre-wrap"},children:(()=>{switch(C){case"loading":return v?"Please follow prompts to register your passkey.":"Please follow prompts to verify your passkey.\nYou 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(k instanceof Oe){if(k.privyErrorCode===ke.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(k.privyErrorCode===ke.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()})]}),(()=>{switch(C){case"loading":case"success":/*#__PURE__*/return t(Fs,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":/*#__PURE__*/return t(Fs,{onClick:I,disabled:!1,children:"Retry"})}})()]}),/*#__PURE__*/t(Qs,{})]})}};let Cm=/*#__PURE__*/en.div.withConfig({displayName:"Container",componentId:"sc-46c03a59-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const bm={component:()=>{let{enabled:r,token:a}=ri(),{lastScreen:i,currentScreen:o,navigateBack:s,navigate:l,setModalData:c}=$o(),{initSignupWithPasskey:d,initLoginWithPasskey:h}=Tt();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:i&&o!==i?s:void 0}),/*#__PURE__*/t(nd,{children:/*#__PURE__*/e(km,{children:[/*#__PURE__*/t(bd,{}),/*#__PURE__*/t(wm,{})]})}),/*#__PURE__*/t(rd,{children:"Log in or create a new account?"}),/*#__PURE__*/t(ad,{children:"Create a new account with a passkey or use a passkey to log in to an existing account."}),/*#__PURE__*/e(cd,{children:[/*#__PURE__*/t(Fs,{onClick:async()=>{r&&!a?(c({passkeyAuthModalData:{passkeySignupFlow:!0},captchaModalData:{callback:e=>d({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:vm,onErrorNavigateTo:rp}}),l(zp)):(await d({withPrivyUi:!0}),c({passkeyAuthModalData:{passkeySignupFlow:!0}}),l(vm))},children:"Create new account"}),/*#__PURE__*/t(fd,{onClick:async()=>{r&&!a?(c({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>h({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:vm,onErrorNavigateTo:rp}}),l(zp)):(await h({withPrivyUi:!0}),c({passkeyAuthModalData:{passkeySignupFlow:!1}}),l(vm))},children:"Log in with a passkey"})]}),/*#__PURE__*/t(Js,{})]})}},km=/*#__PURE__*/en.div.withConfig({displayName:"DoubleIconWrapper",componentId:"sc-f058c8a2-0"})(["display:flex;align-items:center;justify-content:center;width:180px;height:90px;border-radius:50%;svg + svg{margin-left:12px;}> svg{z-index:2;color:var(--privy-color-accent);stroke:var(--privy-color-accent);fill:var(--privy-color-accent);}"]),Tm=()=>{let{enabled:n,token:r}=ri(),{navigate:a,setModalData:i,app:o,data:l}=$o(),{initLoginWithPasskey:c}=Tt(),d=()=>{o.loginConfig.passkeysForSignupEnabled?a(bm):(async()=>{n&&!r?(i({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>c({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:vm,onErrorNavigateTo:rp}}),a(zp)):(await c({withPrivyUi:!0}),i({passkeyAuthModalData:{passkeySignupFlow:!1}}),a(vm))})()};return 0===s((()=>{let e=l?.login?.loginMethods;return e?e.filter((e=>"passkey"!==e)).length:Object.entries(o.loginMethods).filter((([e,t])=>t)).filter((([e])=>"passkey"!==e)).length}),[o.loginMethods,l?.login])?/*#__PURE__*/e(_s,{onClick:d,children:[/*#__PURE__*/t(sn,{})," Continue with passkey"]}):/*#__PURE__*/t(Am,{onClick:d,children:"I have a passkey"})};let xm=/*#__PURE__*/tn(["&&{width:100%;font-size:0.875rem;line-height:1rem;display:flex;gap:0.5rem;justify-content:center;align-items:center;padding:6px 8px;background-color:var(--privy-color-background);transition:background-color 200ms ease;color:var(--privy-color-accent) !important;:focus{outline:none;box-shadow:none;}}"]);const Am=/*#__PURE__*/en.button.withConfig({displayName:"StyledLink",componentId:"sc-1c6127e5-0"})(["",""],xm),Im=({value:n,onChange:r})=>/*#__PURE__*/t("select",{value:n,onChange:r,children:M.map((t=>/*#__PURE__*/e("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),_m=/*#__PURE__*/p(((r,a)=>{let{app:i}=$o(),[s,l]=o(!1),{accountType:c}=Eu(),[h,u]=o(""),[p,m]=o(i?.intl.defaultCountry??"US"),g=P(h,p),y=W(p),f=U(p),w=O(p),v=!g,[C,b]=o(!1),k=w.length,T=e=>{let t=e.target.value;m(t),u(""),r.onChange&&r.onChange({rawPhoneNumber:h,qualifiedPhoneNumber:R(h,t),countryCode:t,isValid:P(h,p)})},x=(e,t)=>{try{let n=e.replace(/\D/g,"")===h.replace(/\D/g,"")?e:y.input(e);u(n),r.onChange&&r.onChange({rawPhoneNumber:n,qualifiedPhoneNumber:R(e,t),countryCode:t,isValid:P(e,t)})}catch(e){console.error("Error processing phone number:",e)}},A=()=>{b(!0);let e=R(h,p);r.onSubmit({rawPhoneNumber:h,qualifiedPhoneNumber:e,countryCode:p,isValid:P(h,p)}).finally((()=>b(!1)))};return d((()=>{if(r.defaultValue){let e=L(r.defaultValue);y.reset(),T({target:{value:e.countryCode}}),x(e.phone,e.countryCode)}}),[r.defaultValue]),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Em,{children:/*#__PURE__*/e(Sm,{$callingCodeLength:k,$stacked:r.stacked,children:[/*#__PURE__*/t(Im,{value:p,onChange:T}),/*#__PURE__*/t("input",{ref:a,id:"phone-number-input",className:"login-method-button",type:"tel",placeholder:f,onFocus:()=>l(!0),onChange:e=>{x(e.target.value,p)},onKeyUp:e=>{"Enter"===e.key&&A()},value:h,autoComplete:"tel"}),"phone"!==c||s||r.hideRecent?r.stacked||r.noIncludeSubmitButton?/*#__PURE__*/t("span",{}):/*#__PURE__*/t(qs,{isSubmitting:C,onClick:A,disabled:v,children:"Submit"}):/*#__PURE__*/t(Lp,{color:"gray",children:"Recent"})]})}),r.stacked&&!r.noIncludeSubmitButton?/*#__PURE__*/t(Fs,{loading:C,loadingText:null,onClick:A,disabled:v,children:"Submit"}):null]})}));let Em=/*#__PURE__*/en.div.withConfig({displayName:"InputContainer",componentId:"sc-2a729487-0"})(["width:100%;"]),Sm=/*#__PURE__*/en.label.withConfig({displayName:"PhoneNumberInput",componentId:"sc-2a729487-1"})(["--country-code-dropdown-width:calc(54px + calc(12 * ","px));--phone-input-extra-padding-left:calc(12px + calc(3 * ","px));display:block;position:relative;width:100%;@media (min-width:441px){--country-code-dropdown-width:calc(52px + calc(10 * ","px));}&& > select{font-size:16px;height:24px;position:absolute;margin:13px calc(var(--country-code-dropdown-width) / 4);line-height:24px;width:var(--country-code-dropdown-width);background-color:var(--privy-color-background);background-size:auto;background-position-x:right;cursor:pointer;@media (min-width:441px){font-size:14px;width:var(--country-code-dropdown-width);}:focus{outline:none;box-shadow:none;}}&& > input{font-size:16px;line-height:24px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;width:calc(100% - var(--country-code-dropdown-width));padding:12px 88px 12px calc(var(--country-code-dropdown-width) + var(--phone-input-extra-padding-left));padding-right:",";flex-grow:1;background:var(--privy-color-background);border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-mdlg);width:100%;:focus{outline:none;border-color:var(--privy-color-accent);}:autofill,:-webkit-autofill{background:var(--privy-color-background);}@media (min-width:441px){font-size:14px;padding-right:78px;}}&& > :last-child{right:16px;position:absolute;top:50%;transform:translate(0,-50%);}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;border-color:var(--privy-color-accent);}}&& > input::placeholder{color:var(--privy-color-foreground-3);}"],(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$stacked?"16px":"88px"));const Nm=({isEditable:r,setIsEditable:a,defaultValue:o})=>{let s=i(null),{authenticated:l}=us(),{navigate:c,setModalData:d,currentScreen:h,data:u}=$o(),{initLoginWithSms:p}=Tt(),{enabled:m,token:g}=ri(),{whatsAppEnabled:y}=Fo();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Ss,{$if:!r,children:/*#__PURE__*/t(_m,{ref:s,onSubmit:async function({qualifiedPhoneNumber:e}){if(!m||g||l)try{await p({phoneNumber:e,captchaToken:g,withPrivyUi:!0,disableSignup:u?.login?.disableSignup}),c(_g)}catch(e){d({errorModalData:{error:e,previousScreen:h||Kg}}),c(rp)}else d({captchaModalData:{callback:t=>p({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:u?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:_g,onErrorNavigateTo:rp}}),c(zp)},defaultValue:o})}),/*#__PURE__*/t(Ss,{$if:r,children:/*#__PURE__*/e(_s,{onClick:()=>{a(),setTimeout((()=>{s.current?.focus()}),0)},children:[/*#__PURE__*/t(ln,{})," Continue with ",y?"WhatsApp":"SMS"]})})]})};let Mm={apple:{logo:/*#__PURE__*/t(Wa,{}),displayName:"Apple"},discord:{logo:/*#__PURE__*/t(Ua,{}),displayName:"Discord"},github:{logo:/*#__PURE__*/t(Oa,{}),displayName:"GitHub"},google:{logo:/*#__PURE__*/t(Ra,{}),displayName:"Google"},linkedin:{logo:/*#__PURE__*/t(Da,{}),displayName:"LinkedIn"},spotify:{logo:/*#__PURE__*/t(Ba,{}),displayName:"Spotify"},instagram:{logo:/*#__PURE__*/t(Fa,{}),displayName:"Instagram"},twitter:{logo:/*#__PURE__*/t($a,{}),displayName:"Twitter"},tiktok:{logo:/*#__PURE__*/t(za,{}),displayName:"TikTok"}};const Pm=({provider:n})=>{let{enabled:r,token:a}=ri(),{navigate:i,setModalData:l,data:c}=$o(),[d,h]=o(!1),{initLoginWithOAuth:u}=Tt(),{accountType:p}=Eu(),m=s((()=>p&&"guest"!==p&&"authorization_key"!==p&&"cross_app"!==p?ku(p):null),[p]),{displayName:g,logo:y}=Mm[n];/*#__PURE__*/return e(_s,{onClick:()=>{h(!0),r&&!a?(l({captchaModalData:{callback:e=>u(n,e,c?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:rp}}),i(zp)):u(n,void 0,c?.login?.disableSignup)},disabled:d,children:[y," ",g,m?.loginMethod===n&&/*#__PURE__*/t(Wm,{color:"gray",children:"Recent"})]})};let Wm=/*#__PURE__*/en(Lp).withConfig({displayName:"StyledChip",componentId:"sc-30b71852-0"})(["margin-left:auto;"]);function Um(n){/*#__PURE__*/return e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...n,children:[/*#__PURE__*/t("defs",{children:/*#__PURE__*/e("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#1d93d2"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#38b0e3"})]})}),/*#__PURE__*/t("title",{children:"Telegram_logo"}),/*#__PURE__*/t("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]})}const Om={component:()=>{let{authenticated:r,logout:a,ready:i,user:s}=us(),{app:l,setModalData:c,navigate:h,resetNavigation:u,data:p}=$o(),{initLoginWithTelegram:m,loginWithTelegram:g,updateWallets:y,setReadyToTrue:f,closePrivyModal:w,createAnalyticsEvent:v,getAuthMeta:C}=Tt(),[b,k]=o(!1),[T,x]=o(void 0),A=ri();async function I(){try{let e=await async function(){let e;if(!r){if(A.enabled&&"error"===A.status)throw new ti(A.error,null,ke.CAPTCHA_FAILURE);return A.enabled&&"success"!==A.status&&(A.execute(),e=await A.waitForResult()),e}}();await g({captchaToken:e}),k(!0),f(!0)}catch(e){if(e?.privyErrorCode===ke.ALLOWLIST_REJECTED)return x(void 0),u(),void h(am);if(e?.privyErrorCode===ke.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),x(void 0),u(),void h(lm);if(e?.privyErrorCode===ke.USER_DOES_NOT_EXIST)return x(void 0),u(),void h(Bu);if(e?.privyErrorCode===ke.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return x(void 0),u(),c({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:C()?.telegramAuthResult,telegramWebAppData:C()?.telegramWebAppData,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void h(vp);let{retryable:t,detail:n}=ii(e);x({retryable:t,detail:n,message:"Authentication failed"})}}d((()=>{I()}),[]),d((()=>{if(!(i&&r&&b&&s))return;if(l?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{h(Sp)}),ea);return()=>clearTimeout(e)}if(Fu(s,l.embeddedWallets)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),h(_p)}),ea);return()=>clearTimeout(e)}y();let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ea);return()=>clearTimeout(e)}),[i,r,b,s]);let _=b?"Successfully connected with Telegram":T?T.message:"Verifying connection to Telegram",E="";return E=b?"You’re good to go!":T?T.detail:"Just a few moments more",/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(Lm,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:b,fail:!!T}),/*#__PURE__*/t(Um,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t("h3",{children:_}),/*#__PURE__*/t("p",{children:E})]}),T&&T?.retryable?/*#__PURE__*/t(Hs,{onClick:async()=>{try{x(void 0),p?.telegramAuthModalData?.seamlessAuth||await m(void 0,p?.login?.disableSignup),await I()}catch(e){let{retryable:t,detail:n}=ii(e);x({retryable:t,detail:n,message:"Authentication failed"})}},disabled:!b&&!T?.retryable,children:"Retry"}):null]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Qs,{})]})},isCaptchaRequired:!0};let Lm=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-491d0b9b-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]);const Rm=()=>{let{enabled:n,token:r}=ri(),{navigate:a,setModalData:i,data:s}=$o(),[l,c]=o(!1),{initLoginWithTelegram:d}=Tt(),{accountType:h}=Eu();async function u(e){try{await d(e,s?.login?.disableSignup),i({telegramAuthModalData:{seamlessAuth:!1}}),a(Om)}catch(e){console.error(e),c(!1)}}/*#__PURE__*/return e(_s,{onClick:async function(){if(c(!0),n&&!r)return i({captchaModalData:{callback:u,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:rp}}),void a(zp);await u(r)},disabled:l,children:[/*#__PURE__*/t(Um,{}),"Telegram","telegram"===h&&/*#__PURE__*/t(Fm,{color:"gray",children:"Recent"})]})};let Fm=/*#__PURE__*/en(Lp).withConfig({displayName:"StyledChip",componentId:"sc-d81b85b5-0"})(["margin-left:auto;"]);const Dm=({icon:e,name:n})=>"string"==typeof e?/*#__PURE__*/t("img",{alt:`${n||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):void 0===e?/*#__PURE__*/t(Un,{}):e?/*#__PURE__*/t(e,{}):null;function Bm(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const zm=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>Ot(e,{strict:!0}))).map((e=>Ut(e)));return!!t?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&t.includes(e.address))).length};const $m=e=>e?.privyErrorCode===ke.LINKED_TO_ANOTHER_USER?Ei.ERROR_USER_EXISTS:e instanceof _i&&!e.details.default?e.details:e instanceof Ti?Ei.ERROR_TIMED_OUT:e instanceof xi?Ei.ERROR_USER_REJECTED_CONNECTION:e?.privyErrorCode===ke.CANNOT_LINK_MORE_OF_TYPE?Ei.ERROR_USER_LIMIT_REACHED:Ei.ERROR_WALLET_CONNECTION,jm={component:()=>{let r,[a,s]=o(!1),[l,c]=o(!1),[u,p]=o(void 0),{authenticated:m,logout:y}=us(),{app:f,navigate:w,navigateBack:v,lastScreen:C,currentScreen:b,setModalData:k,data:T}=$o(),{getAuthFlow:x,walletConnectionStatus:A,closePrivyModal:I,initLoginWithWallet:_,loginWithWallet:E,updateWallets:S,createAnalyticsEvent:N}=Tt(),{walletConnectors:M}=us(),[P,W]=o(0),{user:U}=us(),[O]=o(U?.linkedAccounts.length||0),[L,R]=o(""),[F,D]=o(""),[B,z]=o(!1),{hasTabbedAway:$}=function(){let[e,t]=o(!1),n=h((()=>{document.hidden&&t(!0)}),[]);return d((()=>(document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n))),[n]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:j,token:V}=ri(),H=vo(A?.connector?.walletClientType||"unknown"),q=g&&"wallet_connect_v2"===A?.connector?.connectorType||g&&"coinbase_wallet"===A?.connector?.connectorType||g&&"injected"===A?.connector?.connectorType&&"phantom"===A?.connector?.walletClientType,K="connected"===A?.status,Z="switching_to_supported_chain"===A?.status;d((()=>{let e=x(),t=e instanceof Ga||e instanceof Ja?e:void 0;K&&!t&&(!j||V||m?_(A.connectedWallet,V,T?.login?.disableSignup).then((()=>{z(!0)})):(k({captchaModalData:{callback:e=>_(A.connectedWallet,e,T?.login?.disableSignup).then((()=>{z(!0)})),userIntentRequired:!1,onSuccessNavigateTo:jm,onErrorNavigateTo:rp}}),w(zp,!1))),t&&q&&K&&!t.preparedMessage?t.buildMessage():t&&!q&&K&&(l||(async()=>{c(!0),p(void 0);try{"wallet_connect_v2"===A?.connector?.connectorType&&"metamask"===A?.connector?.walletClientType&&await Ur(2500),await Y()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{c(!1)}})())}),[P,K,B]),d((()=>{if(U&&a){let e=900;if(f?.legal.requireUsersAcceptTerms&&!U.hasAcceptedTerms){let t=setTimeout((()=>{w(Sp)}),e);return()=>clearTimeout(t)}if(Fu(U,f.embeddedWallets)){let t=setTimeout((()=>{k({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),N({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),y()},callAuthOnSuccessOnClose:!0}}),w(_p)}),e);return()=>clearTimeout(t)}S();let t=setTimeout((()=>I({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ea);return()=>clearTimeout(t)}}),[U,a]);let G=e=>{if(e?.privyErrorCode!==ke.ALLOWLIST_REJECTED){if(e?.privyErrorCode===ke.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),void w(lm);if(e?.privyErrorCode!==ke.USER_DOES_NOT_EXIST)return e?.privyErrorCode===ke.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(k({accountTransfer:{nonce:e.data?.data?.nonce,account:x()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:x()?.meta.walletClientType,chainId:x()?.meta.chainId,connectorType:x()?.meta.connectorType},linkMethod:"siwe",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void w(vp)):void p($m(e));w(Bu)}else w(am)};async function Y(){try{await E(),s(!0)}catch(e){G(e)}finally{c(!1)}}d((()=>{A?.connectError&&G(A?.connectError)}),[A]),((e,t)=>{let n=i((()=>{}));d((()=>{n.current=e})),d((()=>{if(null!==t){let e=setInterval((()=>n.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===J&&A?.connector instanceof Vo?A.connector.redirectUri:void 0;e&&R(e);let t="wallet_connect_v2"===J&&A?.connector instanceof Vo?A.connector.fallbackUniversalRedirectUri:void 0;t&&D(t)}),A?.connector instanceof Vo&&!L?500:null);let J=A?.connector?.connectorType||"injected",Q=A?.connector?.walletClientType||"unknown",X=H?.metadata?.shortName||H?.name||A?.connector?.walletBranding.name||"Browser Extension",ee=H?.image_url?.md||A?.connector?.walletBranding.icon||(e=>/*#__PURE__*/t(Yi,{...e})),te="Browser Extension"===X?X.toLowerCase():X;r=a?`Successfully connected with ${te}`:u?u.message:Z?"Switching networks":K?l&&q?"Signing":"Sign to verify":`Waiting for ${te}`;let ne="Don’t see your wallet? Check your other browser windows.";a?ne=O===(U?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":P>=2&&u?ne="Unable to connect wallet":u?ne=u.detail:Z?ne="Switch your wallet to the requested network.":K&&q?ne="Sign the message in your wallet to verify it belongs to you.":"metamask"===Q&&g?ne="Click continue to open and connect MetaMask.":"metamask"===Q?ne="For the best experience, connect only one wallet at a time.":"wallet_connect"===J?ne="Open your mobile wallet app to continue":"coinbase_wallet"===J?Er()||(ne=zm(U)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue."):T?.login?.isLedgerSolana&&(ne="Ledger requires a transaction to verify your identity. You’ll sign a transaction that performs no onchain action.");let re=M?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),ae="coinbase_wallet"===Q&&(zm(U)||u===Ei.ERROR_USER_EXISTS);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:C&&b!==C?v:void 0}),/*#__PURE__*/e(Vm,{children:[/*#__PURE__*/t(qm,{walletLogo:ee,success:a,fail:!!u}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t("h3",{children:r}),/*#__PURE__*/t("p",{children:ne}),K||!L||$?null:/*#__PURE__*/e("p",{children:["Still here?"," ",/*#__PURE__*/t("a",{href:L,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),F&&/*#__PURE__*/e(n,{children:[" ","or"," ",/*#__PURE__*/t("a",{href:F,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]})]}),ae?/*#__PURE__*/t(Fs,{onClick:()=>re&&re?.disconnect(),disabled:a,children:"Use a different wallet"}):u==Ei.ERROR_USER_EXISTS&&b!==C?/*#__PURE__*/t(Fs,{onClick:v,children:"Use a different wallet"}):K&&!a&&q?/*#__PURE__*/t(Fs,{onClick:()=>{c(!0),Y()},disabled:l,children:l?"Signing":"Sign with your wallet"}):!a&&u?.retryable&&P<2?/*#__PURE__*/t(Fs,{onClick:()=>{W(P+1),p(void 0),K?(c(!0),Y()):A?.connectRetry()},disabled:!a&&(!u?.retryable||P>=2),children:"Retry"}):a||u?null:/*#__PURE__*/t(Fs,{onClick:()=>{},disabled:!0,children:"Connecting"})]}),/*#__PURE__*/t(Qs,{})]})}};let Vm=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-ad9f7869-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]),Hm=/*#__PURE__*/en.div.withConfig({displayName:"StackedContainer",componentId:"sc-ad9f7869-1"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > span{position:absolute;left:-41px;top:-41px;}> div > :last-child{position:absolute;left:-19px;top:-19px;}"]);const qm=r=>{let a=r.walletLogo;/*#__PURE__*/return t(n,{children:/*#__PURE__*/t(Hm,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:r.success,fail:r.fail}),"string"==typeof a?
18
+ /*#__PURE__*/t("span",{style:{background:`url('${a}') 0 0 / contain`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"contain"}}):/*#__PURE__*/t(a,{style:{width:"38px",height:"38px"}})]})})})},Km={component:()=>{let r,{navigateBack:a,navigate:i,lastScreen:s,currentScreen:l,data:c,setModalData:h}=$o(),{walletConnectionStatus:u,closePrivyModal:p}=Tt(),[m,y]=o(void 0),[f,w]=o(0),v=vo(u?.connector?.walletClientType||"unknown"),C="connected"===u?.status,b="switching_to_supported_chain"===u?.status;d((()=>{if(C){let e;if(c?.externalConnectWallet?.onCompleteNavigateTo){let t=c.externalConnectWallet.onCompleteNavigateTo,n=u.connectedWallet?.address;e=setTimeout((()=>{c.funding&&h({...c,funding:{...c.funding,connectedWalletAddress:n}}),i(t({walletChainType:u.connector?.chainType}))}),ea)}else e=setTimeout(p,ea);return()=>clearTimeout(e)}}),[C]);d((()=>{u?.connectError&&(e=>{y($m(e))})(u?.connectError)}),[u]);let k=u?.connector?.connectorType||"injected",T=u?.connector?.walletClientType||"unknown",x=v?.metadata?.shortName||v?.name||u?.connector?.walletBranding.name||"Browser Extension",A=v?.image_url?.md||u?.connector?.walletBranding.icon||(e=>/*#__PURE__*/t(Yi,{...e})),I="Browser Extension"===x?x.toLowerCase():x;r=C?`Successfully connected with ${I}`:m?m.message:b?"Switching networks":`Waiting for ${I}`;let _="Don’t see your wallet? Check your other browser windows.";return C?_="You’re good to go!":f>=2&&m?_="Unable to connect wallet":m?_=m.detail:b?_="Switch your wallet to the requested network.":"metamask"===T&&g?_="Click to continue to open and connect MetaMask.":"metamask"===T?_="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===k?_="Open your mobile wallet app to continue":"coinbase_wallet"===k&&(_="Open the Coinbase app on your phone to continue."),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{backFn:l===s?void 0:a}),/*#__PURE__*/e(Zm,{children:[/*#__PURE__*/t(qm,{walletLogo:A,success:C,fail:!!m}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t("h3",{children:r}),/*#__PURE__*/t("p",{children:_})]}),m==Ei.ERROR_USER_EXISTS?/*#__PURE__*/t(Fs,{onClick:a,children:"Use a different wallet"}):!C&&m?.retryable&&f<2?/*#__PURE__*/t(Fs,{onClick:()=>{w(f+1),y(void 0),u?.connectRetry()},disabled:!C&&(!m?.retryable||f>=2),children:"Retry"}):!C&&m&&f>=2?/*#__PURE__*/t(Fs,{onClick:a,children:"Use a different wallet"}):null]}),/*#__PURE__*/t(Qs,{})]})}};let Zm=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-604d07cd-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const Gm=({style:e,...n})=>/*#__PURE__*/t("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},...n,children:/*#__PURE__*/t("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)"})}),Ym=/*#__PURE__*/en.div.withConfig({displayName:"TodoList",componentId:"sc-491785d-0"})(["display:flex;flex-direction:column;justify-content:flex-start;gap:4px;"]),Jm=/*#__PURE__*/en.div.withConfig({displayName:"TodoSpacer",componentId:"sc-491785d-1"})(["&&&{margin-left:7px;border-left:2px solid var(--privy-color-foreground-4);height:12px;}"]),Qm=({children:n})=>/*#__PURE__*/e(Xm,{children:[/*#__PURE__*/t(Gm,{style:{width:"16px",height:"16px"}}),n]});let Xm=/*#__PURE__*/en.div.withConfig({displayName:"TodoItemWrapper",componentId:"sc-491785d-2"})(["display:flex;justify-content:flex-start;justify-items:center;text-align:left;gap:8px;&&{a{text-decoration:underline;color:var(--privy-color-accent);}svg{margin-top:auto;margin-bottom:auto;}}"]),eg=({name:n,installLink:r})=>/*#__PURE__*/e(nc,{children:[/*#__PURE__*/t(ch,{title:`Create a ${n} wallet`.replace(/wallet wallet/gi,"wallet"),description:"Follow the instructions below to get started."}),/*#__PURE__*/e(Ym,{children:[/*#__PURE__*/t(Qm,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t("span",{children:"Install the "})," ",/*#__PURE__*/e("a",{href:r,target:"_blank",children:[n," browser extension"]})]})}),/*#__PURE__*/t(Jm,{}),/*#__PURE__*/t(Qm,{children:"Set up your first wallet"}),/*#__PURE__*/t(Jm,{}),/*#__PURE__*/t(Qm,{children:"Store your recovery phrase in a safe place!"})]}),/*#__PURE__*/t(Hs,{onClick:()=>window.location.reload(),style:{marginTop:"20px"},children:"Reload the page to use your wallet"})]});const tg={component:()=>{let{navigateBack:r,data:a}=$o();if(!a?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:i}=a.installWalletModalData;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:r},"header"),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(eg,{...i}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/e(Qs,{children:[/*#__PURE__*/t("span",{children:"Still not sure? "}),/*#__PURE__*/t("a",{target:"_blank",href:"https://solana.com/docs/intro/wallets",children:"Learn more"})]})]})}},ng={component:()=>{let{ready:r}=us(),{data:a}=$o(),[i,s]=o(!1);if(!a?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:l,connectOnly:c,chainType:d}=a.installWalletModalData,h=l.getMobileRedirect({useUniversalLink:!i,isSolana:"solana"===d,connectOnly:c}),u=l.name.replace(/ wallet/gi,""),p={title:`Redirecting to ${u} Mobile Wallet`,description:`We'll take you to the ${u} Mobile Wallet app to continue your login experience.`,footnote:""};return r&&(p.description=`For the best experience, we'll automatically log you into the ${u} Mobile Wallet in-app browser.`,p.footnote="You can always return here to login via other methods."),i&&(p.title="Still here?",p.description=`You may need to install the ${l.name} mobile app.`,p.footnote=`Once you're done, you can connect with ${l.name} wallet to complete the login.`),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{},"header"),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(dh,{title:p.title,description:p.description}),/*#__PURE__*/e(tc,{children:[/*#__PURE__*/t(zs,{href:h,onClick:()=>setTimeout((()=>s(!0)),1e3),loading:r&&!h,children:i?"Go to App Store":"Continue"}),p.footnote?/*#__PURE__*/t("p",{children:p.footnote}):null]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}},rg=({provider:n,displayName:r,logo:a,connectOnly:i,connector:o})=>{let s,{navigate:l,setModalData:c}=$o(),{connectWallet:d}=Tt(),h=Eu(),u=vo(n),p="wallet_connect_v2"===o.connectorType?n:o.walletClientType,m=window.matchMedia("(display-mode: standalone)").matches,y=so({connectorType:o.connectorType,walletClientType:p});s=y&&y.chainTypes.includes(o.chainType)?()=>{y.isInstalled||"solana"===o.chainType&&"isInstalled"in o&&o.isInstalled?(d(o,p),l(i?Km:jm)):g?(c({installWalletModalData:{walletConfig:y,chainType:o.chainType,connectOnly:i}}),l(ng)):(c({installWalletModalData:{walletConfig:y,chainType:o.chainType,connectOnly:i}}),l(tg))}:"coinbase_wallet"!==o.connectorType||"eoaOnly"!==o.connectionOptions||!g||m||Er()?()=>{(!Bm(window.navigator.userAgent)||event?.isTrusted)&&(d(o,p),l(i?Km:jm))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`};let f=r||u?.metadata?.shortName||u?.name||o.walletClientType;/*#__PURE__*/return e(ag,{onClick:s,children:[/*#__PURE__*/t(Dm,{icon:a||u?.image_url?.md,name:f}),/*#__PURE__*/t("span",{children:f}),/*#__PURE__*/e(og,{id:"chip-container",children:[h?.walletClientType===p&&h?.chainType===o.chainType?/*#__PURE__*/t(ig,{color:"gray",children:"Recent"}):/*#__PURE__*/t("span",{id:"connect-text",children:"Connect"}),"solana"===o.chainType&&/*#__PURE__*/t(ig,{color:"gray",children:"Solana"})]})]})};let ag=/*#__PURE__*/en(_s).withConfig({displayName:"ConnectWalletButton",componentId:"sc-d36fbdf7-0"})(["> #chip-container > #connect-text{font-weight:500;color:var(--privy-color-accent);opacity:0;transition:opacity 0.1s ease-out;}:hover > #chip-container > #connect-text{opacity:1;}@media (max-width:440px){> #chip-container > #connect-text{display:none;}}"]),ig=/*#__PURE__*/en(Lp).withConfig({displayName:"StyledChip",componentId:"sc-d36fbdf7-1"})(["margin-left:auto;"]),og=/*#__PURE__*/en.div.withConfig({displayName:"ChipContainer",componentId:"sc-d36fbdf7-2"})(["display:flex;flex-wrap:wrap;gap:8px;margin-left:auto;"]);const sg=["coinbase_wallet"];let lg=["metamask","okx_wallet","rainbow","uniswap","bybit_wallet","ronin_wallet","haha_wallet","uniswap_extension","zerion","rabby_wallet","cryptocom","binance"];const cg=["safe"],dg=["phantom","backpack","solflare","universal_profile"],hg=({wallets:e})=>{let{app:r}=$o();return 0===e.length?/*#__PURE__*/t(Wp,{chainType:r.appearance.walletChainType,withPadding:!0}):/*#__PURE__*/t(n,{children:e})},ug=({walletList:e,walletChainType:n,connectors:r,connectOnly:a,ignore:i,walletConnectEnabled:o,forceWallet:s})=>{let l=[],c=[],d=[],h=r.filter((e=>"ethereum-only"===n?"ethereum"===e.chainType:"solana-only"!==n||"solana"===e.chainType)),u=h.find((e=>"wallet_connect_v2"===e.connectorType));for(let[r,p]of(s?[s.wallet]:e).entries()){if("detected_ethereum_wallets"===p||"detected_wallets"===p)for(let[e,n]of h.filter((({chainType:e,connectorType:t,walletClientType:n})=>"solana"!==e&&("uniswap_wallet_extension"===n||"uniswap_extension"===n?!i.includes("uniswap"):"crypto.com_wallet_extension"===n||"crypto.com_onchain"===n?!i.includes("cryptocom"):"injected"===t&&!i.includes(n)))).entries()){let{walletClientType:i,walletBranding:o,chainType:s}=n;("unknown"===i?c:l).push(/*#__PURE__*/t(rg,{connectOnly:a,provider:i,logo:o.icon,displayName:o.name,connector:n},`${r}-${p}-${i}-${s}-${e}`))}if("detected_solana_wallets"===p||"detected_wallets"===p)for(let[e,o]of h.filter((({chainType:e,walletClientType:t})=>{if("solana"===e)return"ethereum-only"!==n&&!i.includes(t)})).entries()){let{walletClientType:n,walletBranding:i,chainType:s}=o;("unknown"===n?c:l).push(/*#__PURE__*/t(rg,{connectOnly:a,provider:n,logo:i.icon,displayName:i.name,connector:o},`${r}-${p}-${n}-${s}-${e}`))}if(dg.includes(p)){let e=h.find((e=>"injected"===e.connectorType&&e.walletClientType===p||e.connectorType===p));if(e&&l.push(/*#__PURE__*/t(rg,{connectOnly:a,provider:p,connector:e},`${r}-${p}`)),"solana-only"===n||"ethereum-and-solana"===n){let e=h.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===p));e&&l.push(/*#__PURE__*/t(rg,{connectOnly:a,provider:p,connector:e},`${p}-solana`))}}else if(lg.includes(p)){let e=h.find((e=>"uniswap"===p?"uniswap_wallet_extension"===e.walletClientType||"uniswap_extension"===e.walletClientType:"cryptocom"===p?"crypto.com_wallet_extension"===e.walletClientType||"crypto.com_onchain"===e.walletClientType:"injected"===e.connectorType&&e.walletClientType===p));if(o&&!e&&(e=u),e&&l.push(/*#__PURE__*/t(rg,{connectOnly:a,provider:p,connector:e,logo:"injected"===e.connectorType?e.walletBranding.icon:void 0,displayName:"injected"===e.connectorType?e.walletBranding.name:void 0},`${r}-${p}`)),"solana-only"===n||"ethereum-and-solana"===n){let e=h.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===p));e&&l.push(/*#__PURE__*/t(rg,{connectOnly:a,provider:p,connector:e},`${p}-solana`))}}else if(sg.includes(p)){let e=h.find((({connectorType:e})=>e===p));e&&l.push(/*#__PURE__*/t(rg,{connectOnly:a,provider:p,connector:e},`${r}-${p}`))}else if(cg.includes(p))u&&d.push(/*#__PURE__*/t(rg,{connectOnly:a,provider:p,connector:u},`${r}-${p}`));else if("wallet_connect"===p)u&&d.push(/*#__PURE__*/t(rg,{connectOnly:a,provider:p,connector:u,logo:u.walletBranding.icon,displayName:"Wallet Connect"},`${r}-${p}`));else if(p===s?.wallet){let n="ethereum"===s.chainType&&e.includes("detected_ethereum_wallets"),i="solana"===s.chainType&&e.includes("detected_solana_wallets");if(e.includes("detected_wallets")||n||i){let e=h.find((({walletClientType:e})=>e===p));e&&l.push(/*#__PURE__*/t(rg,{connectOnly:a,provider:p,displayName:e.walletBranding?.name,logo:e.walletBranding?.icon,connector:e},`${r}-${p}`))}}}return[...c,...l,...d]},pg=({onClick:n,text:r})=>/*#__PURE__*/e(_s,{onClick:n,children:[/*#__PURE__*/t(Un,{}),/*#__PURE__*/t(bs,{children:r}),/*#__PURE__*/t(jn,{})]}),mg=({onClick:n,text:r,icon:a})=>/*#__PURE__*/e(_s,{onClick:n,children:[a,/*#__PURE__*/t(bs,{children:r}),/*#__PURE__*/t(jn,{})]}),gg=({connectOnly:r})=>{let{closePrivyModal:a,connectors:i}=Tt(),{data:l,onUserCloseViaDialogOrKeybindRef:c}=$o(),h=Fo(),{accountType:u,walletClientType:p,chainType:m}=Eu(),g=s((()=>u&&"guest"!==u&&"authorization_key"!==u&&"cross_app"!==u?ku(u):null),[u]),y=l?.login,{email:f,sms:w,google:v,twitter:C,discord:b,github:k,spotify:T,instagram:x,tiktok:A,linkedin:I,apple:_,wallet:E,farcaster:S,telegram:N}=s((()=>y?.loginMethods?F(y.loginMethods,!0):null),[y])??h.loginMethods,{passkey:M}=h.loginMethods,P=[f&&"email",w&&"sms",v&&"google",C&&"twitter",b&&"discord",k&&"github",T&&"spotify",x&&"instagram",A&&"tiktok",I&&"linkedin",_&&"apple",S&&"farcaster",N&&"telegram"].filter((e=>!!e)),W=P.length>0,U=s((()=>E&&!W?"web3-first":E&&h?.appearance.loginGroupPriority||"web2-first"),[E,W,h?.appearance.loginGroupPriority]),O=h?.appearance.hideDirectWeb2Inputs,[L,R]=o("default"),[D,B]=o(Cg({mostRecentlyUsedAccountType:u,smsAvailable:w,emailAvailable:f,prefilledType:y?.prefill?.type}));d((()=>{B(Cg({mostRecentlyUsedAccountType:u,smsAvailable:w,emailAvailable:f,prefilledType:y?.prefill?.type}))}),[f,w,u]);let z=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{R("default")}),150)};c.current=z;let $=[];p&&E?$.push(p):g?.loginMethod&&P.includes(g.loginMethod)&&$.push(g.loginMethod);let j=e=>"email"===e?/*#__PURE__*/t(jg,{isEditable:"email"===D,setIsEditable:()=>{B("email")},defaultValue:"email"===y?.prefill?.type?y.prefill.value:void 0},e):"sms"===e?/*#__PURE__*/t(Nm,{isEditable:"sms"===D,setIsEditable:()=>{B("sms")},defaultValue:"phone"===y?.prefill?.type?y.prefill.value:void 0},e):"apple"===e?/*#__PURE__*/t(Pm,{provider:"apple"},e):"discord"===e?/*#__PURE__*/t(Pm,{provider:"discord"},e):"farcaster"===e?/*#__PURE__*/t(ym,{},e):"github"===e?/*#__PURE__*/t(Pm,{provider:"github"},e):"google"===e?/*#__PURE__*/t(Pm,{provider:"google"},e):"linkedin"===e?/*#__PURE__*/t(Pm,{provider:"linkedin"},e):"tiktok"===e?/*#__PURE__*/t(Pm,{provider:"tiktok"},e):"spotify"===e?/*#__PURE__*/t(Pm,{provider:"spotify"},e):"instagram"===e?/*#__PURE__*/t(Pm,{provider:"instagram"},e):"twitter"===e?/*#__PURE__*/t(Pm,{provider:"twitter"},e):"telegram"===e?/*#__PURE__*/t(Rm,{},e):ug({walletList:h.appearance.walletList,walletChainType:y?.walletChainType??h.appearance.walletChainType,connectors:i,connectOnly:r,ignore:[],walletConnectEnabled:h.externalWallets.walletConnect.enabled,forceWallet:{wallet:e,chainType:m??"ethereum"}}),V=ug({walletList:h.appearance.walletList.filter((e=>e!==p)),walletChainType:y?.walletChainType??h.appearance.walletChainType,connectors:i,connectOnly:r,ignore:[...h.appearance.walletList,p],walletConnectEnabled:h.externalWallets.walletConnect.enabled}),H=P.filter((e=>e!==g?.loginMethod)).flatMap(j),q=$.flatMap(j);"web3-first"===U&&"default"===L?V.unshift(...q):"web2-first"===U&&H.unshift(...q);let K=P.filter((e=>"email"!==e&&"sms"!==e)),Z=fg({priority:U,email:f,sms:w,social:K}),G=wg({priority:U,email:f,sms:w,social:K}),Y=/*#__PURE__*/t(pg,{text:vg({priority:U}),onClick:()=>R("web3-overflow")}),J=/*#__PURE__*/t(mg,{text:Z,icon:G,onClick:()=>R("web2-overflow")}),Q=O?0:1,X=E&&V.length>0,ee=0===H.length&&E&&0===V.length,te=5-(X?1:0),ne=V.length>0?V:/*#__PURE__*/t(Wp,{chainType:h.appearance.walletChainType,withPadding:!0});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{title:h.appearance.landingHeader,onClose:z,backFn:"default"===L?void 0:()=>{R("default")}}),"default"===L&&/*#__PURE__*/t(yg,{}),"default"===L&&("string"==typeof h.appearance.loginMessage?/*#__PURE__*/t(Is,{children:h.appearance.loginMessage}):h.appearance.loginMessage),/*#__PURE__*/t(ks,{style:{overflow:"hidden",padding:2},children:/*#__PURE__*/e(Ts,{children:["default"===L&&"web2-first"===U&&/*#__PURE__*/e(n,{children:[H.length>te?H.slice(0,te-1):H,H.length>te&&J,X&&Y,ee&&/*#__PURE__*/t(Wp,{chainType:h.appearance.walletChainType})]}),"default"===L&&"web3-first"===U&&/*#__PURE__*/e(n,{children:[E&&/*#__PURE__*/e(n,{children:[V.length>te?V.slice(0,te-1):V,V.length>te&&Y]}),H.length>Q&&J,H.length===Q&&H[0],ee&&/*#__PURE__*/t(Wp,{chainType:h.appearance.walletChainType})]}),"web2-overflow"===L&&/*#__PURE__*/t(n,{children:"web3-first"===U?H:H.slice(3)}),"web3-overflow"===L?ne:[],M&&"default"===L&&/*#__PURE__*/t(Tm,{})]})}),h&&/*#__PURE__*/t(Ys,{app:h}),/*#__PURE__*/t(Js,{})]})};let yg=/*#__PURE__*/en(Nu).withConfig({displayName:"StyledAppLogoHeader",componentId:"sc-b8a55e6-0"})(["margin-bottom:16px;"]),fg=({priority:e,email:t,sms:n,social:r})=>"web2-first"===e?"Other socials":t&&n&&r.length>0||t&&r.length>0?"Log in with email or socials":n&&r.length>0?"Log in with sms or socials":t&&n?"Continue with email or sms":t?"Continue with email":n?"Continue with sms":"Log in with a social account",wg=({priority:e,email:n,sms:r,social:a})=>"web2-first"===e||a.length>0?/*#__PURE__*/t(Mn,{}):n&&r?/*#__PURE__*/t(Pp,{}):n?/*#__PURE__*/t(Pn,{}):r?/*#__PURE__*/t(ln,{}):null,vg=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets";const Cg=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:n,prefilledType:r})=>n&&("email"===e&&"phone"!==r||"email"===r)||!t||"phone"!==e&&"phone"!==r?"email":"sms",bg={component:()=>{let{app:e}=$o();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/t(Vg,{connectOnly:!0}):/*#__PURE__*/t(gg,{connectOnly:!0})}};let kg=Array(6).fill("");var Tg,xg,Ag=((Tg=Ag||{})[Tg.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",Tg[Tg.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",Tg),Ig=((xg=Ig||{})[xg.EMAIL=0]="EMAIL",xg[xg.SMS=1]="SMS",xg);const _g={component:()=>{let{app:r,navigate:a,lastScreen:i,navigateBack:s,setModalData:l,onUserCloseViaDialogOrKeybindRef:c}=$o(),{closePrivyModal:h,resendEmailCode:u,resendSmsCode:p,getAuthMeta:m,loginWithCode:y,updateWallets:f,createAnalyticsEvent:w}=Tt(),{authenticated:v,logout:C,user:b}=us(),{whatsAppEnabled:k}=Fo(),[T,x]=o(kg),[A,I]=o(!1),[_,E]=o(null),[S,N]=o(null),[M,P]=o(0);c.current=()=>null;let W=m()?.email?0:1;d((()=>{if(M){let e=setTimeout((()=>{P(M-1)}),1e3);return()=>clearTimeout(e)}}),[M]),d((()=>{if(v&&A&&b){if(r?.legal.requireUsersAcceptTerms&&!b.hasAcceptedTerms){let e=setTimeout((()=>{a(Sp)}),900);return()=>clearTimeout(e)}if(Fu(b,r.embeddedWallets)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),C()},callAuthOnSuccessOnClose:!0}}),a(_p)}),900);return()=>clearTimeout(e)}{f();let e=setTimeout((()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ea);return()=>clearTimeout(e)}}}),[v,A,b]),d((()=>{if(_&&0===S){let e=setTimeout((()=>{x(kg),E(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[_]);let U=e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return E("Code should be numeric"),void N(1);E(null),N(null);let n=Number(e.currentTarget.name?.charAt(5)),r=[...t||[""]].slice(0,6-n),o=[...T.slice(0,n),...r,...T.slice(n+r.length)];x(o);let s=Math.min(Math.max(n+r.length,0),5);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${s}]`);e?.focus()}if(o.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${s}]`);e?.blur(),y(o.join("")).then((()=>I(!0))).catch((e=>{if(e instanceof Ke&&e.privyErrorCode===ke.INVALID_CREDENTIALS)E("Invalid or expired verification code");else if(e instanceof Ke&&e.privyErrorCode===ke.CANNOT_LINK_MORE_OF_TYPE)E(e.message);else{if(e instanceof Ke&&e.privyErrorCode===ke.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),void a(lm);if(e instanceof Ke&&e.privyErrorCode===ke.USER_DOES_NOT_EXIST)return void a(Bu);if(e instanceof Ke&&e.privyErrorCode===ke.LINKED_TO_ANOTHER_USER)return l({errorModalData:{error:e,previousScreen:i??_g}}),void a(rp,!1);if(e instanceof Ke&&e.privyErrorCode===ke.DISALLOWED_PLUS_EMAIL)return l({inlineError:{error:e}}),void a(bg,!1);if(e instanceof Ke&&e.privyErrorCode===ke.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return l({accountTransfer:{nonce:e.data?.data?.nonce,account:0===W?m()?.email:m()?.phoneNumber,displayName:e.data?.data?.account?.displayName,linkMethod:0===W?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void a(vp);E("Issue verifying code")}N(0)}))}},O=0==W?/*#__PURE__*/t(Pn,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):
19
+ /*#__PURE__*/t(ln,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),L=/*#__PURE__*/e("p",0==W?{children:["Please check ",/*#__PURE__*/t(Ug,{children:m()?.email})," for an email from privy.io and enter your code below."]}:{children:["Please check ",/*#__PURE__*/t(Ug,{children:m()?.phoneNumber})," for a",k?" WhatsApp":""," message from ",r?.name||"Privy"," and enter your code below."]});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:()=>s()},"header"),/*#__PURE__*/e(Eg,{children:[/*#__PURE__*/t(hh,{title:"Enter confirmation code",description:L,icon:O}),/*#__PURE__*/e(rc,{children:[/*#__PURE__*/e(Sg,{children:[/*#__PURE__*/t(Ng,{$fail:!!_,$success:A,children:/*#__PURE__*/t("span",{children:_||(A?"Success!":"")})}),/*#__PURE__*/t("div",{children:T.map(((e,n)=>/*#__PURE__*/t("input",{name:`code-${n}`,type:"text",value:T[n],onChange:U,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(1===S&&(E(null),N(null)),x([...T.slice(0,e),"",...T.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(n)},inputMode:"numeric",autoFocus:0===n,pattern:"[0-9]",className:`${A?"success":""} ${_?"fail":""}`,autoComplete:g?"one-time-code":"off"},n)))})]}),/*#__PURE__*/e(Mg,{children:[/*#__PURE__*/e("span",{children:["Didn't get ",0==W?"an email":"a message","?"]}),M?/*#__PURE__*/e(Wg,{children:[/*#__PURE__*/t(Wn,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),/*#__PURE__*/t("span",{children:"Code sent"})]}):/*#__PURE__*/t(Pg,{children:/*#__PURE__*/t("button",{onClick:async()=>{P(30),0==W?await u():await p()},children:"Resend code"})})]})]})]}),/*#__PURE__*/t(Js,{})]})}};let Eg=/*#__PURE__*/en.div.withConfig({displayName:"PasswordlessCodeContainer",componentId:"sc-2171637e-0"})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin:auto;gap:16px;flex-grow:1;"]),Sg=/*#__PURE__*/en.div.withConfig({displayName:"CodeInput",componentId:"sc-2171637e-1"})(["display:flex;flex-direction:column;width:100%;gap:8px;> div:last-child{display:flex;justify-content:center;gap:0.5rem;width:100%;border-radius:var(--privy-border-radius-md);> input{border:1px solid var(--privy-color-foreground-4);background:var(--privy-color-background);border-radius:var(--privy-border-radius-md);padding:8px 10px;height:58px;width:46px;text-align:center;font-size:18px;}> input:focus{border:1px solid var(--privy-color-accent);}> input:invalid{border:1px solid var(--privy-color-error);}> input.success{border:1px solid var(--privy-color-success);}> input.fail{border:1px solid var(--privy-color-error);animation:shake 180ms;animation-iteration-count:2;}}@keyframes shake{0%{transform:translate(1px,0px);}33%{transform:translate(-1px,0px);}67%{transform:translate(-1px,0px);}100%{transform:translate(1px,0px);}}"]),Ng=/*#__PURE__*/en.div.withConfig({displayName:"InputHelp",componentId:"sc-2171637e-2"})(["line-height:20px;height:20px;font-size:13px;color:",";display:flex;justify-content:flex-end;width:100%;"],(e=>e.$success?"var(--privy-color-success)":e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)")),Mg=/*#__PURE__*/en.div.withConfig({displayName:"HelpText",componentId:"sc-2171637e-3"})(["font-size:13px;color:var(--privy-color-foreground);display:flex;gap:8px;align-items:center;width:100%;margin-top:16px;padding-bottom:32px;"]),Pg=/*#__PURE__*/en.div.withConfig({displayName:"ResendButtonContainer",componentId:"sc-2171637e-4"})(["color:var(--privy-color-accent);padding:2px 0;> button{text-decoration:underline;}"]),Wg=/*#__PURE__*/en.div.withConfig({displayName:"Badge",componentId:"sc-2171637e-5"})(["display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-sm);padding:2px 8px;gap:4px;background:var(--privy-color-background-2);color:var(--privy-color-foreground-2);"]),Ug=/*#__PURE__*/en.span.withConfig({displayName:"BoldWrappingSpan",componentId:"sc-2171637e-6"})(["font-weight:500;word-break:break-all;"]);const Og=/*#__PURE__*/en.span.withConfig({displayName:"ErrorMessage",componentId:"sc-fcb8cd50-0"})(["text-align:left;font-size:0.75rem;font-weight:500;line-height:1.125rem;color:var(--privy-color-error);"]);let Lg=/*#__PURE__*/en.label.withConfig({displayName:"BaseEmailForm",componentId:"sc-6423bc41-0"})(["display:block;position:relative;width:100%;> svg{position:absolute;margin:13px 17px;height:24px;width:24px;color:var(--privy-color-foreground-3);}&& > input{background-color:#f00;font-size:16px;line-height:24px;padding:12px 88px 12px 52px;flex-grow:1;background:var(--privy-color-background);border:1px solid ",";border-radius:var(--privy-border-radius-mdlg);width:100%;@media (min-width:441px){font-size:14px;padding-right:78px;}:focus{outline:none;border-color:",";box-shadow:",";}:autofill,:-webkit-autofill{background:var(--privy-color-background);}&& > input::placeholder{color:var(--privy-color-foreground-3);}&:disabled{opacity:0.4;cursor:not-allowed;}&:disabled,&:disabled:hover,&:disabled > span{color:var(--privy-color-foreground-3);}}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;}&:disabled{opacity:0.4;cursor:not-allowed;}&:disabled,&:disabled:hover,&:disabled > span{color:var(--privy-color-foreground-3);}}"],(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-foreground-4)"),(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-accent-light)"),(({$error:e})=>e?"none":"0 0 0 1px var(--privy-color-accent-light)"));const Rg=/*#__PURE__*/en(Lg).withConfig({displayName:"EmailUpdateForm",componentId:"sc-6423bc41-1"})(["background-color:var(--privy-color-background);transition:background-color 200ms ease;&& > button{right:0;line-height:24px;position:absolute;padding:13px 17px;background-color:#090;:focus{outline:none;border-color:var(--privy-color-accent);}}"]),Fg=/*#__PURE__*/en(Lg).withConfig({displayName:"EmailInputForm",componentId:"sc-6423bc41-2"})(["&& > input{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-right:",";border:1px solid ",";&& > input::placeholder{color:var(--privy-color-foreground-3);}}&& > :last-child{right:16px;position:absolute;top:50%;transform:translate(0,-50%);}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;}}"],(e=>e.$stacked?"16px":"88px"),(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-foreground-4)")),Dg=/*#__PURE__*/en.div.withConfig({displayName:"InputContainerForm",componentId:"sc-6423bc41-3"})(["width:100%;&& > ","{display:block;text-align:left;padding-left:var(--privy-border-radius-mdlg);padding-bottom:5px;}"],Og),Bg=/*#__PURE__*/p(((r,a)=>{let[i,s]=o(r.defaultValue||""),[l,c]=o(""),[h,u]=o(!1),{authenticated:p}=us(),{initLoginWithEmail:m}=Tt(),{navigate:g,setModalData:y,currentScreen:f,data:w}=$o(),{enabled:v,token:C}=ri(),[b,k]=o(!1),{accountType:T}=Eu(),x=Fo();d((()=>{!i&&x.disablePlusEmails&&w?.inlineError?.error instanceof Oe&&w?.inlineError?.error.privyErrorCode===ke.DISALLOWED_PLUS_EMAIL&&!l&&c("Please enter a valid email address without a '+'."),l&&c("")}),[i]);let A=Mr(i),I=h||!A,_=()=>{y({login:w?.login,inlineError:void 0}),!v||C||p?(e=>{u(!0),m({email:i,captchaToken:e,disableSignup:w?.login?.disableSignup,withPrivyUi:!0}).then((()=>{g(_g)})).catch((e=>{y({errorModalData:{error:e,previousScreen:f||Kg}}),g(rp)})).finally((()=>{u(!1)}))})(C):(y({captchaModalData:{callback:e=>m({email:i,captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:_g,onErrorNavigateTo:rp}}),g(zp))};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(zg,{children:[l&&/*#__PURE__*/t(Og,{style:{display:"block",marginTop:"0.25rem",textAlign:"left"},children:l}),/*#__PURE__*/e($g,{stacked:r.stacked,$error:!!l,children:[/*#__PURE__*/t(Pn,{}),/*#__PURE__*/t("input",{ref:a,id:"email-input",className:"login-method-button",type:"email",placeholder:"your@email.com",onFocus:()=>k(!0),onChange:e=>s(e.target.value),onKeyUp:e=>{"Enter"===e.key&&_()},value:i,autoComplete:"email"}),"email"!==T||b?r.stacked?/*#__PURE__*/t("span",{}):/*#__PURE__*/t(qs,{isSubmitting:h,onClick:_,disabled:I,children:"Submit"}):/*#__PURE__*/t(Lp,{color:"gray",children:"Recent"})]})]}),r.stacked?/*#__PURE__*/t(Fs,{loadingText:null,loading:h,disabled:I,onClick:_,children:"Submit"}):null]})}));let zg=Dg,$g=Fg;const jg=({isEditable:r,setIsEditable:a,defaultValue:o})=>{let s=i(null);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(Ss,{$if:!r,children:/*#__PURE__*/t(Bg,{ref:s,defaultValue:o})}),/*#__PURE__*/t(Ss,{$if:r,children:/*#__PURE__*/e(_s,{onClick:()=>{a(),setTimeout((()=>{s.current?.focus()}),0)},children:[/*#__PURE__*/t(Pn,{})," Continue with Email"]})})]})},Vg=({connectOnly:r})=>{let{closePrivyModal:a,connectors:i}=Tt(),{app:l,onUserCloseViaDialogOrKeybindRef:c,data:h}=$o(),{appearance:{palette:{colorScheme:u}}}=Fo(),{accountType:p,walletClientType:m,chainType:g}=Eu(),y=s((()=>p&&"guest"!==p&&"authorization_key"!==p&&"cross_app"!==p?ku(p):null),[p]),f=l.loginMethodsAndOrder?.primary??[],w=l.loginMethodsAndOrder?.overflow??[],v=s((()=>[...f,...w]),[f,w]),C=l.loginMethods.passkey,b=h?.login,k=[];m&&v.includes(m)?k.push(m):p&&v.includes(y?.loginMethod)&&k.push(y?.loginMethod);let[T,x]=o("default"),[A,I]=o(Cg({mostRecentlyUsedAccountType:p,smsAvailable:v.includes("sms"),emailAvailable:v.includes("email"),prefilledType:b?.prefill?.type}));d((()=>{I(Cg({mostRecentlyUsedAccountType:p,smsAvailable:v.includes("sms"),emailAvailable:v.includes("email"),prefilledType:b?.prefill?.type}))}),[v,p]),d((()=>{"phone"===p&&I("sms");let e=v.indexOf("sms"),t=v.indexOf("email");e>-1&&e<t&&I("sms")}),[p,f,w]);let _=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{x("default")}),150)};c.current=_;let E=e=>"email"===e?/*#__PURE__*/t(jg,{isEditable:"email"===A,setIsEditable:()=>{I("email")},defaultValue:"email"===b?.prefill?.type?b.prefill.value:void 0},e):"sms"===e?/*#__PURE__*/t(Nm,{isEditable:"sms"===A,setIsEditable:()=>{I("sms")},defaultValue:"phone"===b?.prefill?.type?b.prefill.value:void 0},e):"apple"===e?/*#__PURE__*/t(Pm,{provider:"apple"},e):"discord"===e?/*#__PURE__*/t(Pm,{provider:"discord"},e):"farcaster"===e?/*#__PURE__*/t(ym,{},e):"github"===e?/*#__PURE__*/t(Pm,{provider:"github"},e):"google"===e?/*#__PURE__*/t(Pm,{provider:"google"},e):"linkedin"===e?/*#__PURE__*/t(Pm,{provider:"linkedin"},e):"spotify"===e?/*#__PURE__*/t(Pm,{provider:"spotify"},e):"instagram"===e?/*#__PURE__*/t(Pm,{provider:"instagram"},e):"tiktok"===e?/*#__PURE__*/t(Pm,{provider:"tiktok"},e):"twitter"===e?/*#__PURE__*/t(Pm,{provider:"twitter"},e):"telegram"===e?/*#__PURE__*/t(Rm,{},e):e.startsWith("privy:")?/*#__PURE__*/t(Wu,{appId:e.replace("privy:","")},e):ug({walletList:l.appearance.walletList,walletChainType:b?.walletChainType??l.appearance.walletChainType,connectors:i,connectOnly:r,ignore:v,walletConnectEnabled:l.externalWallets.walletConnect.enabled,forceWallet:{wallet:e,chainType:g??"ethereum"}}),S=k.flatMap(E),N=f.filter((e=>e!==m&&e!==y?.loginMethod)).flatMap(E),M=w.filter((e=>e!==m&&e!==y?.loginMethod)).flatMap(E),[P,W]=((e,t)=>{let n=[],r=[];for(let[a,i]of e.entries())a<t?n.push(i):r.push(i);return[n,r]})([...S,...N,...M],Hg({primary:N.length+S.length,overflow:M.length}));/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{title:l.appearance.landingHeader,onClose:_,backFn:"default"===T?void 0:()=>{x("default")}}),"default"===T&&/*#__PURE__*/t(qg,{}),"default"===T&&("string"==typeof l.appearance.loginMessage?/*#__PURE__*/t(Is,{children:l.appearance.loginMessage}):l.appearance.loginMessage),/*#__PURE__*/t(ks,{style:{overflow:"hidden"},children:/*#__PURE__*/e(xs,{$colorScheme:u,children:["default"===T&&/*#__PURE__*/e(n,{children:[P,W.length>0&&/*#__PURE__*/t(mg,{text:"More options",icon:/*#__PURE__*/t(Mn,{}),onClick:()=>x("overflow")})]}),"overflow"===T&&/*#__PURE__*/t(n,{children:W}),C&&"default"===T&&/*#__PURE__*/t(Tm,{})]})}),l&&/*#__PURE__*/t(Ys,{app:l}),/*#__PURE__*/t(Js,{})]})};let Hg=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,qg=/*#__PURE__*/en(Nu).withConfig({displayName:"StyledAppLogoHeader",componentId:"sc-2108f0c0-0"})(["margin-bottom:16px;"]);const Kg={component:()=>{let{app:e}=$o();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/t(Vg,{connectOnly:!1}):/*#__PURE__*/t(gg,{connectOnly:!1})},isCaptchaRequired:!0,isUnauthenticatedScreem:!0},Zg={component:()=>{let[e,n]=o(null),[r,a]=o(!1),[i,s]=o(null),[l,c]=o(""),{authenticated:h,getAccessToken:u,user:p}=us(),{walletProxy:m,refreshSessionAndUser:g,closePrivyModal:y,createAnalyticsEvent:f}=Tt(),{app:w,navigate:v,data:C,onUserCloseViaDialogOrKeybindRef:b}=$o(),{onSuccess:k,onFailure:T}=C.setWalletPassword,x=wi(p),A="user-passcode"===e?.recoveryMethod,I="user-passcode"===x?.recoveryMethod;d((()=>{h||(v(Kg),T(new St("User must be authenticated before setting a password on a Privy wallet")))}),[h]);let _=()=>i?(T(i),void y({shouldCallAuthOnSuccess:!1})):A?(k(e),void y({shouldCallAuthOnSuccess:!1})):(T(new _t("Exited before password was added to wallet")),void y({shouldCallAuthOnSuccess:!1}));b.current=_;/*#__PURE__*/return t(Cu,{appName:w?.name||"privy",config:{initiatedBy:"user",onCancel:_},error:i?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:l,isResettingPassword:I,onPasswordGenerate:()=>c(du()),onPasswordChange:c,onSubmit:async()=>{A?(k(e),y({shouldCallAuthOnSuccess:!1})):(a(!0),s(null),await(async()=>{let e=await u();if(e&&p&&x?.address&&l&&m)try{f({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:x.address,existingRecoveryMethod:x.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I}});let{entropyId:t,entropyIdVerifier:r}=bi(p);if(!(await m.setRecovery({accessToken:e,entropyId:t,entropyIdVerifier:r,recoveryPassword:l,recoveryMethod:"user-passcode"})).entropyId)return s(new _t("Error setting password on privy wallet")),void f({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:x.address,existingRecoveryMethod:x.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I,reason:"error setting password"}});let a=await g(),i=wi(a);if(!i)return s(new _t("Error setting password on privy wallet")),void f({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:x.address,existingRecoveryMethod:x.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I,reason:"wallet disconnected"}});n(i),f({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:x.address,existingRecoveryMethod:x.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I}})}catch(e){console.warn(e),s(e instanceof Error?e:Error("Error setting password on privy wallet")),f({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:x.address,reason:e}})}})(),a(!1))},onClose:_})}},Gg={component:()=>{let{closePrivyModal:r}=Tt(),{data:a,navigate:i,onUserCloseViaDialogOrKeybindRef:o}=$o(),{onFailure:s}=a.setWalletPassword,l=()=>{s(new _t("Exited before password was added to wallet")),r({shouldCallAuthOnSuccess:!1})};return o.current=l,/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:l}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(ic,{children:[/*#__PURE__*/e(hc,{children:[/*#__PURE__*/t(Mn,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),/*#__PURE__*/t(pc,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:/*#__PURE__*/t(Xn,{width:"12px",height:"12px",fill:"white"})})]}),/*#__PURE__*/e(hh,{title:"Secure Your Account",children:["Please set a password to secure your account.",/*#__PURE__*/t("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),/*#__PURE__*/t(Fs,{onClick:()=>{i(Zg)},children:"Add password"}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}},Yg={component:()=>{let[r,a]=o(!0),{authenticated:i,getAccessToken:s,user:l}=us(),{walletProxy:c,closePrivyModal:h,createAnalyticsEvent:u}=Tt(),{navigate:p,data:m,onUserCloseViaDialogOrKeybindRef:g}=$o(),[y,f]=o(void 0),[w,v]=o(""),[C,b]=o(!1),{entropyId:k,entropyIdVerifier:T,onCompleteNavigateTo:x,onSuccess:A,onFailure:I}=m.recoverWallet,_=(e="User exited before their wallet could be recovered")=>{h({shouldCallAuthOnSuccess:!1}),I("string"==typeof e?new _t(e):e)};g.current=_,d((()=>{if(!i)return _("User must be authenticated and have a Privy wallet before it can be recovered")}),[i]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:_}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(Qg,{children:[/*#__PURE__*/e(Jg,{children:[/*#__PURE__*/t(cn,{height:48,width:48,stroke:"var(--privy-color-accent)"}),/*#__PURE__*/t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),/*#__PURE__*/t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),/*#__PURE__*/e("div",{children:[/*#__PURE__*/e(Fh,{children:[/*#__PURE__*/t(Lh,{type:r?"password":"text",onChange:e=>(e=>{e&&f(e)})(e.target.value),disabled:C,style:{paddingRight:"2.3rem"}}),/*#__PURE__*/t(jh,{style:{right:"0.75rem"},children:r?/*#__PURE__*/t(Hh,{onClick:()=>a(!1)}):/*#__PURE__*/t(qh,{onClick:()=>a(!0)})})]}),!!w&&/*#__PURE__*/t(Xg,{children:w})]}),/*#__PURE__*/e("div",{children:[/*#__PURE__*/e(lc,{children:[/*#__PURE__*/t("h4",{children:"Why is this necessary?"}),/*#__PURE__*/t("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),/*#__PURE__*/t(ey,{loading:C||!c,disabled:!y,onClick:async()=>{b(!0);let e=await s(),t=fi(l,k);if(!e||!t||null===y)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{u({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t.address}}),await(c?.recover({accessToken:e,entropyId:k,entropyIdVerifier:T,recoveryPassword:y})),v(""),x?p(x):h({shouldCallAuthOnSuccess:!1}),A?.(t),u({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}})}catch(e){!function(e){return Zc(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?v("An error has occurred, please try again."):v("Invalid recovery password, please try again.")}finally{b(!1)}},warn:!1,$hideAnimations:!k&&C,children:"Recover your account"})]})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}},Jg=/*#__PURE__*/en.div.withConfig({displayName:"Header",componentId:"sc-93ed4ea8-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:20px 0;gap:4px;& h3{font-size:18px;font-style:normal;font-weight:600;line-height:24px;}& p{max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;}"]);let Qg=/*#__PURE__*/en.div.withConfig({displayName:"Content",componentId:"sc-93ed4ea8-1"})(["display:flex;flex-direction:column;justify-content:space-between;"]),Xg=/*#__PURE__*/en.div.withConfig({displayName:"ErrorMessage",componentId:"sc-93ed4ea8-2"})(["line-height:20px;height:20px;font-size:13px;color:var(--privy-color-error);text-align:left;margin-top:0.5rem;"]),ey=/*#__PURE__*/en(Fs).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-93ed4ea8-3"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/tn(["&&{transition:none;}"])));const ty={component:()=>{let{app:e,navigate:n,data:r,onUserCloseViaDialogOrKeybindRef:a}=$o(),[i,s]=o(""),[l,c]=o(!1),[h,u]=o(),[p,m]=o(null),{create:g}=bh(),{authenticated:y,user:f}=us(),{closePrivyModal:w,isNewUserThisSession:v,initializeWalletProxy:C}=Tt(),{onSuccess:b,onFailure:k,callAuthOnSuccessOnClose:T,shouldCreateEth:x,shouldCreateSol:A}=r.createWallet,[I,_]=o(null),E=new Jr((async()=>{try{let e;if(x&&A)e=await g({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:f}),e=await g({chainType:"solana",walletIndex:0,latestUser:e.user});else if(A)e=await g({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"solana",walletIndex:0,latestUser:f});else{if(!x)throw Error("Invalid args to create wallet");e=await g({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:f})}_(e),v?n(kh):(b(e),w({shouldCallAuthOnSuccess:T}))}catch(e){s(e.message)}}));d((()=>{p||C(3e4).then((e=>m(e)))}),[p]),d((()=>{if(!y||!f)return n(Kg),void k(Error("User must be authenticated before creating a Privy wallet"))}),[y]),a.current=()=>null;/*#__PURE__*/return t(Cu,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!p,buttonLoading:l,buttonHideAnimations:!I&&l,isResettingPassword:!1,error:i,password:h||"",onClose:()=>{I&&"user-passcode"!==I.account.recoveryMethod?(k(new _t("User created a wallet but failed to set a password for it")),w({shouldCallAuthOnSuccess:!1})):I?(b(I),w({shouldCallAuthOnSuccess:T})):(k(new _t("User wallet creation failed")),w({shouldCallAuthOnSuccess:!1}))},onPasswordChange:u,onPasswordGenerate:()=>u(du()),onSubmit:async()=>(c(!0),E.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>c(!1))))})}},ny=/*#__PURE__*/en.div.withConfig({displayName:"WithCircleBorder",componentId:"sc-e4fc5563-0"})(["&&{border-width:4px;}display:flex;justify-content:center;align-items:center;padding:1rem;aspect-ratio:1;border-style:solid;border-color:",";border-radius:50%;"],(e=>e.$color??"var(--privy-color-accent)")),ry=/*#__PURE__*/en.span.withConfig({displayName:"Subtitle",componentId:"sc-7a11f796-0"})(["margin-top:4px;color:var(--privy-color-foreground);text-align:center;font-size:0.875rem;font-weight:400;line-height:1.375rem;&& a{color:var(--privy-color-accent);}"]),ay=/*#__PURE__*/en.span.withConfig({displayName:"Title",componentId:"sc-66de63c-0"})(["color:var(--privy-color-foreground);font-size:1.125rem;font-weight:600;line-height:1.875rem;text-align:center;"]),iy={component:()=>{let{user:r,getAccessToken:a}=us(),{walletProxy:i,refreshSessionAndUser:s,closePrivyModal:l}=Tt(),c=$o(),{entropyId:d,entropyIdVerifier:h}=c.data?.recoverWallet,[u,p]=o(!1),[m,g]=o(null),[y,f]=o(null);function w(){if(!u){if(y)return c.data?.setWalletPassword?.onFailure(y),void l();if(!m)return c.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void l()}}c.onUserCloseViaDialogOrKeybindRef.current=w;let v=!(!u&&!m);/*#__PURE__*/return e(n,y?{children:[/*#__PURE__*/t(nl,{onClose:w},"header"),/*#__PURE__*/t(ny,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:/*#__PURE__*/t(gn,{height:38,width:38,stroke:"var(--privy-color-error)"})}),/*#__PURE__*/t(ay,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),/*#__PURE__*/t(bs,{style:{minHeight:"2rem"}}),/*#__PURE__*/t(Ds,{onClick:()=>f(null),children:"Try again"}),/*#__PURE__*/t(Js,{})]}:{children:[/*#__PURE__*/t(nl,{onClose:w},"header"),/*#__PURE__*/t(Vn,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),/*#__PURE__*/t(ay,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),/*#__PURE__*/t(ry,{style:{marginTop:"1rem"},children:"When you log into a new device, you’ll only need to authenticate to access your account. Never get logged out if you forget your password."}),/*#__PURE__*/t(bs,{style:{minHeight:"2rem"}}),/*#__PURE__*/t(Ds,{loading:u,disabled:v,onClick:()=>async function(){p(!0);try{let e=await a(),t=fi(r,d);if(!e||!i||!t)return;if(!(await i.setRecovery({accessToken:e,entropyId:d,entropyIdVerifier:h,existingRecoveryMethod:t.recoveryMethod,recoveryMethod:"privy"})).entropyId)throw Error("Unable to set recovery on wallet");let n=await s();if(!n)throw Error("Unable to set recovery on wallet");let o=fi(n,t.address);if(!o)throw Error("Unabled to set recovery on wallet");g(!!n),setTimeout((()=>{c.data?.setWalletPassword?.onSuccess(o),l()}),ea)}catch(e){f(e)}finally{p(!1)}}(),children:m?"Success":"Confirm"}),/*#__PURE__*/t(Js,{})]})}};function oy({isCreatingWallet:e,skipSplashScreen:t}){return e?ty:t?Zg:Gg}function sy({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:n,isResettingPassword:r,showAutomaticRecovery:a}){return a?iy:n||1===t.length?oy({isCreatingWallet:"create"===e,skipSplashScreen:r}):Nh}function ly(e){switch(e){case"user-passcode":return Yg;case"google-drive":case"icloud":return Ih;default:throw Error("Recovery method not supported")}}const cy=({children:n,theme:r})=>/*#__PURE__*/e(dy,{$theme:r,children:[/*#__PURE__*/t(tr,{width:"1.25rem",color:"dark"===r?"var(--privy-color-accent-light)":"var(--privy-color-accent-dark)",style:{minWidth:"1.25rem"}}),n]});let dy=/*#__PURE__*/en.div.withConfig({displayName:"Container",componentId:"sc-c3403117-0"})(["display:flex;gap:0.5rem;background-color:var(--privy-color-warn-light);color:var(--privy-color-foreground);align-items:flex-start;text-align:left;font-size:0.8125rem;font-weight:400;line-height:1.125rem;padding:0.75rem;&&{border-radius:var(--privy-border-radius-sm);}"]);const hy=/*#__PURE__*/en.div.withConfig({displayName:"Column",componentId:"sc-cfc52180-0"})(["display:flex;flex-direction:column;"]),uy=/*#__PURE__*/en.span.withConfig({displayName:"LabelXs",componentId:"sc-4c43f9fd-0"})(["color:var(--privy-color-foreground-3);font-size:0.75rem;font-weight:500;line-height:1.125rem;"]),py=/*#__PURE__*/tn(["&&{border-width:1px;padding:0.5rem 1rem;}width:100%;text-align:left;border:solid 1px var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);display:flex;justify-content:space-between;align-items:center;",""],(e=>"error"===e.$state?"border-color: var(--privy-color-error);":"")),my=/*#__PURE__*/en.div.withConfig({displayName:"Box",componentId:"sc-1660059c-0"})(["",""],py),gy=({errMsg:r,balance:a,address:i,isLoading:o,className:s,title:l,isPulsing:c,showIcon:d,statusColor:h="green"})=>{let u;return u=h||(r?"red":"green"),/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(my,{className:s,$state:r?"error":void 0,children:[/*#__PURE__*/e(hy,{children:[/*#__PURE__*/t(uy,{children:l||"Pay with"}),/*#__PURE__*/t(Vu,{address:i,showCopyIcon:d||!!r})]}),void 0!==a&&/*#__PURE__*/t(Lp,{isLoading:o,isPulsing:c,color:u,children:a})]}),r&&/*#__PURE__*/t(Og,{style:{marginTop:"0.25rem"},children:r})]})};function yy({rpcConfig:e,appId:t,address:n,chain:r}){let{chains:a}=Tt(),[i,l]=o(0n),[c,u]=o(!1),p=s((()=>{let n=r||a[0];if(n)return Pt({chain:r,transport:Wt(Nr(n,e,t))})}),[r,e,t]),m=h((async()=>{if(!n||!p)return;u(!0);let e=await p.getBalance({address:n}).catch(console.error);return e?(l(e),u(!1),e):void 0}),[p,n,l]);return d((()=>{m().catch(console.error)}),[]),{balance:i,isLoading:c,reloadBalance:m}}const fy="sdk_fiat_on_ramp_completed_with_status",wy=async({chain:e,address:t,appId:n,rpcConfig:r,erc20Address:a})=>{let i=Pt({chain:e,transport:Wt(Nr(e,r,n))});return{balance:await i.readContract({address:a,abi:vy,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}};let vy=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],Cy=/*#__PURE__*/c({plugins:{current:{}}});const by=({children:e})=>{let n=i({});/*#__PURE__*/return t(Cy.Provider,{value:{plugins:n},children:e})},ky=(...e)=>{let{plugins:t}=l(Cy);d((()=>{for(let n of e)t.current[n.id]=n;return()=>{for(let n of e)delete t.current[n.id]}}),[t])},Ty=()=>{let{plugins:e}=l(Cy);return h((t=>e.current[t]),[e])},xy=Symbol("solana-funding-plugin"),Ay=async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:n,refreshSessionAndUser:r,user:a},{privateKey:i,chainType:o})=>{if(!a)throw e("linkAccount","onError",ke.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new de("User must be authenticated before linking an account.");let[s,l]=await Promise.all([t(),n(15e3)]);if(!l||!s)throw e("linkAccount","onError",ke.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new de("User must be authenticated before linking an account.");await l.importWallet({privateKey:i,accessToken:s,chainType:o});let c=await r(),d="solana"===o?yi(c):gi(c);if(!d)throw e("createWallet","onError",ke.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",{wallet:d}),d};class Iy{async handleSignMessage(e){if(!e.params||"string"!=typeof e.params.message)throw Error("Message must be provided as a string for Solana signMessage RPC");let t=await this.signMessage(Ya(e.params.message,"base64"));return{signature:Ya(t).toString("base64")}}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await fb())throw Error("User must be authenticated to use embedded Solana wallet");if(!await Tb())throw new de("Unable to connect to Solana embedded wallet");if("signMessage"===e.method)return await this.handleSignMessage(e);throw Error("Embedded Solana provider does not yet support this RPC method.")}constructor(e,t,n){this.walletProxy=e,this.address=t,this.signMessage=n}}async function _y({tx:e,accessToken:t,walletProxy:n,entropyId:r,entropyIdVerifier:a,transactingWalletAddress:i,transactingWalletIndex:o}){let s=Dl(e,i),l=Fl(e)?Ya(e.message.serialize()):e.serializeMessage(),{response:c}=await n.rpc({accessToken:t,entropyId:r,entropyIdVerifier:a,chainType:"solana",hdWalletIndex:o,request:{method:"signMessage",params:{message:l.toString("base64")}}}),d=Ya(c.data.signature,"base64");return e.addSignature(s,d),e}const Ey=e=>!!e.id&&"privy-v2"===e.recoveryMethod,Sy=e=>e.reduce(((e,t)=>!e||e.walletIndex<t.walletIndex?t:e),null);let Ny=async({accessToken:e,appConfig:t,privy:n,emitPrivyEvent:r,proxy:a,refreshSessionAndUser:i,recoverPrimaryWallet:o,user:s,walletIndex:l,setModalData:c,openModal:d,chainType:h,setUser:u})=>{if(l<0)throw r("createWallet","onError",ke.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${l}) is invalid.`);let p=wi(s);if(l>0&&!p)throw r("createWallet","onError",ke.EMBEDDED_WALLET_NOT_FOUND),Error("Must have an existing embedded wallet to create an additional wallet.");if(t.embeddedWallets.requireUserOwnedRecoveryOnCreate&&"user-controlled-server-wallets-only"===t.embeddedWallets.mode)throw r("createWallet","onError",ke.EMBEDDED_WALLET_CREATE_ERROR),Error("User owned recovery not yet supported for this app.");if(!p&&t.embeddedWallets.requireUserOwnedRecoveryOnCreate)return await My({emitPrivyEvent:r,setModalData:c,openModal:d,chainType:h});let m=vh(s,{chainType:h,walletIndex:l})[0];if(m)return{user:s,account:m};if(0===l&&!a)return My({emitPrivyEvent:r,setModalData:c,openModal:d,chainType:h});if(!a)throw r("createWallet","onError",ke.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");return Ch({appConfig:t,walletIndex:l,chainType:h,user:s,accessToken:e,proxy:a,refreshSessionAndUser:i,privy:n,recoverPrimaryWallet:o,setUser:u})},My=async({emitPrivyEvent:e,setModalData:t,openModal:n,chainType:r})=>new Promise(((a,i)=>{t({createWallet:{onSuccess:({user:t,account:n})=>{e("createWallet","onSuccess",{wallet:n}),a({user:t,account:n})},onFailure:t=>{e("createWallet","onError",ke.UNKNOWN_EMBEDDED_WALLET_ERROR),i(t)},callAuthOnSuccessOnClose:!1,shouldCreateEth:"ethereum"===r,shouldCreateSol:"solana"===r}}),n(_p)}));const Py=()=>{let e=Fo(),t=vs(),{setModalData:n}=$o(),{getAccessToken:r}=us(),{initializeWalletProxy:a,recoverPrimaryWallet:i,setUser:o,openModal:s,refreshSessionAndUser:l,privy:c}=Tt();return{create:async({chainType:d,options:h,latestUser:u})=>{let p=u;if(p||(p=await l()),!p)throw t("createWallet","onError",ke.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return await(async({appConfig:e,getAccessToken:t,initializeWalletProxy:n,user:r,privy:a,emitPrivyEvent:i,recoverPrimaryWallet:o,setModalData:s,openModal:l,setUser:c,options:d,timeoutDuration:h,refreshSessionAndUser:u,chainType:p})=>{let[m,g]=await Promise.all([n(h),t()]);if(!g||!r)throw i("createWallet","onError",ke.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");if(!m&&e.customAuth?.enabled)throw i("createWallet","onError",ke.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(d&&"walletIndex"in d&&"number"==typeof d.walletIndex)return Ny({accessToken:g,appConfig:e,privy:a,emitPrivyEvent:i,openModal:l,proxy:m,refreshSessionAndUser:u,recoverPrimaryWallet:o,setModalData:s,user:r,walletIndex:d.walletIndex,chainType:p,setUser:c});let y=d&&"createAdditional"in d&&d.createAdditional,f=vh(r,{chainType:p});if(f[0]&&!y)throw i("createWallet","onError",ke.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");return Ny({accessToken:g,appConfig:e,privy:a,emitPrivyEvent:i,openModal:l,proxy:m,recoverPrimaryWallet:o,setModalData:s,user:r,walletIndex:(Sy(f)?.walletIndex??-1)+1,chainType:p,refreshSessionAndUser:u,setUser:c})})({appConfig:e,privy:c,getAccessToken:r,refreshSessionAndUser:l,initializeWalletProxy:a,user:p,emitPrivyEvent:t,recoverPrimaryWallet:i,setModalData:n,openModal:s,setUser:o,options:h,timeoutDuration:ka,chainType:d})}}},Wy=()=>{let{getAccessToken:e}=us(),{walletProxy:t}=Tt();return s((()=>({signWithUserSigner:async({message:n})=>{if(!t)throw Error("Wallet proxy not initialized");let r=await e();if(!r)throw Error("User must be authenticated");let{signature:a}=await t.signWithUserSigner({accessToken:r,message:n});return{signature:a}}})),[t,e])};function Uy(e){let{create:t}=Py();return fs("createWallet",e),{createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:n}=await t({chainType:"ethereum",options:e});return n}}}const Oy=()=>{let{getAccessToken:e,user:t}=us(),{refreshSessionAndUser:n,initializeWalletProxy:r}=Tt(),a=vs();return{importWallet:h((({privateKey:i})=>Ay({getAccessToken:e,user:t,initializeWalletProxy:r,refreshSessionAndUser:n,emitPrivyEvent:a},{privateKey:i,chainType:"ethereum"})),[t,e,n,r,a])}},Ly=()=>{let{importWallet:e}=Oy(),{createWallet:t}=Uy();return{...l(hs),importWallet:e,createWallet:t}},Ry=e=>e.filter((e=>"wallets"===e.method||("exchange"===e.method?"coinbase"===e.provider:"card"===e.method||"payment-request"===e.method?"coinbase"===e.provider||"moonpay"===e.provider:(e.method,!1)))),Fy=e=>!!e.fundingConfig&&Ry(e.fundingConfig.options).length>=1,Dy=({children:n,theme:r})=>/*#__PURE__*/e(By,{$theme:r,children:[/*#__PURE__*/t(gn,{width:"3rem",color:"var(--privy-color-error)"}),n]});let By=/*#__PURE__*/en.div.withConfig({displayName:"Container",componentId:"sc-5400b18f-0"})(["display:flex;gap:0.5rem;"," align-items:flex-start;text-align:left;padding:0.5rem 0.75rem;font-size:0.75rem;font-weight:400;line-height:1.125rem;padding:0.5rem 0.75rem;&&{border:1px solid var(--privy-color-error);border-radius:var(--privy-border-radius-sm);}"],(e=>"dark"===e.$theme?"color: var(--privy-color-error);":"background-color: var(--privy-color-error-light);"));const zy=e=>/*#__PURE__*/t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 210.2",xmlSpace:"preserve",...e,children:/*#__PURE__*/t("path",{d:"M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9 C103.4,10,99.5,19.8,93.6,27.1 M102.3,40.9c-13.9-0.8-25.8,7.9-32.4,7.9c-6.7,0-16.8-7.5-27.8-7.3c-14.3,0.2-27.6,8.3-34.9,21.2 c-15,25.8-3.9,64,10.6,85c7.1,10.4,15.6,21.8,26.8,21.4c10.6-0.4,14.8-6.9,27.6-6.9c12.9,0,16.6,6.9,27.8,6.7 c11.6-0.2,18.9-10.4,26-20.8c8.1-11.8,11.4-23.3,11.6-23.9c-0.2-0.2-22.4-8.7-22.6-34.3c-0.2-21.4,17.5-31.6,18.3-32.2 C123.3,42.9,107.7,41.3,102.3,40.9 M182.6,11.9v155.9h24.2v-53.3h33.5c30.6,0,52.1-21,52.1-51.4c0-30.4-21.1-51.2-51.3-51.2H182.6z M206.8,32.3h27.9c21,0,33,11.2,33,30.9c0,19.7-12,31-33.1,31h-27.8V32.3z M336.6,169c15.2,0,29.3-7.7,35.7-19.9h0.5v18.7h22.4V90.2 c0-22.5-18-37-45.7-37c-25.7,0-44.7,14.7-45.4,34.9h21.8c1.8-9.6,10.7-15.9,22.9-15.9c14.8,0,23.1,6.9,23.1,19.6v8.6l-30.2,1.8 c-28.1,1.7-43.3,13.2-43.3,33.2C298.4,155.6,314.1,169,336.6,169z M343.1,150.5c-12.9,0-21.1-6.2-21.1-15.7c0-9.8,7.9-15.5,23-16.4 l26.9-1.7v8.8C371.9,140.1,359.5,150.5,343.1,150.5z M425.1,210.2c23.6,0,34.7-9,44.4-36.3L512,54.7h-24.6l-28.5,92.1h-0.5 l-28.5-92.1h-25.3l41,113.5l-2.2,6.9c-3.7,11.7-9.7,16.2-20.4,16.2c-1.9,0-5.6-0.2-7.1-0.4v18.7C417.3,210,423.3,210.2,425.1,210.2z"})}),$y=n=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 38.1",xmlSpace:"preserve",...n,children:[/*#__PURE__*/t("path",{style:{fill:"#5F6368"},d:"M37.8,19.7V29h-3V6h7.8c1.9,0,3.7,0.7,5.1,2c1.4,1.2,2.1,3,2.1,4.9c0,1.9-0.7,3.6-2.1,4.9c-1.4,1.3-3.1,2-5.1,2 L37.8,19.7L37.8,19.7z M37.8,8.8v8h5c1.1,0,2.2-0.4,2.9-1.2c1.6-1.5,1.6-4,0.1-5.5c0,0-0.1-0.1-0.1-0.1c-0.8-0.8-1.8-1.3-2.9-1.2 L37.8,8.8L37.8,8.8z"}),/*#__PURE__*/t("path",{style:{fill:"#5F6368"},d:"M56.7,12.8c2.2,0,3.9,0.6,5.2,1.8s1.9,2.8,1.9,4.8V29H61v-2.2h-0.1c-1.2,1.8-2.9,2.7-4.9,2.7 c-1.7,0-3.2-0.5-4.4-1.5c-1.1-1-1.8-2.4-1.8-3.9c0-1.6,0.6-2.9,1.8-3.9c1.2-1,2.9-1.4,4.9-1.4c1.8,0,3.2,0.3,4.3,1v-0.7 c0-1-0.4-2-1.2-2.6c-0.8-0.7-1.8-1.1-2.9-1.1c-1.7,0-3,0.7-3.9,2.1l-2.6-1.6C51.8,13.8,53.9,12.8,56.7,12.8z M52.9,24.2 c0,0.8,0.4,1.5,1,1.9c0.7,0.5,1.5,0.8,2.3,0.8c1.2,0,2.4-0.5,3.3-1.4c1-0.9,1.5-2,1.5-3.2c-0.9-0.7-2.2-1.1-3.9-1.1 c-1.2,0-2.2,0.3-3,0.9C53.3,22.6,52.9,23.3,52.9,24.2z"}),/*#__PURE__*/t("path",{style:{fill:"#5F6368"},d:"M80,13.3l-9.9,22.7h-3l3.7-7.9l-6.5-14.7h3.2l4.7,11.3h0.1l4.6-11.3H80z"}),/*#__PURE__*/t("path",{style:{fill:"#4285F4"},d:"M25.9,17.7c0-0.9-0.1-1.8-0.2-2.7H13.2v5.1h7.1c-0.3,1.6-1.2,3.1-2.6,4v3.3H22C24.5,25.1,25.9,21.7,25.9,17.7z"}),/*#__PURE__*/t("path",{style:{fill:"#34A853"},d:"M13.2,30.6c3.6,0,6.6-1.2,8.8-3.2l-4.3-3.3c-1.2,0.8-2.7,1.3-4.5,1.3c-3.4,0-6.4-2.3-7.4-5.5H1.4v3.4 C3.7,27.8,8.2,30.6,13.2,30.6z"}),/*#__PURE__*/t("path",{style:{fill:"#FBBC04"},d:"M5.8,19.9c-0.6-1.6-0.6-3.4,0-5.1v-3.4H1.4c-1.9,3.7-1.9,8.1,0,11.9L5.8,19.9z"}),/*#__PURE__*/t("path",{style:{fill:"#EA4335"},d:"M13.2,9.4c1.9,0,3.7,0.7,5.1,2l0,0l3.8-3.8c-2.4-2.2-5.6-3.5-8.8-3.4c-5,0-9.6,2.8-11.8,7.3l4.4,3.4 C6.8,11.7,9.8,9.4,13.2,9.4z"})]}),jy=e=>{let[t,n]=o();return d((()=>{e().then((e=>{n(e)})).catch((()=>{}))}),[]),t},Vy=({...n})=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...n,children:[/*#__PURE__*/t("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),/*#__PURE__*/t("path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2"}),/*#__PURE__*/t("path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21"})]}),Hy=async({address:e,chain:t,rpcConfig:n,privyAppId:r})=>{try{let a=Pt({chain:t,transport:Wt(Nr(t,n,r))}),[i,o]=await Promise.all([a.readContract({abi:qy,address:e,functionName:"symbol"}),a.readContract({abi:qy,address:e,functionName:"decimals"})]);return{decimals:o,symbol:i}}catch(e){return console.log(e),null}};let qy=[{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"}];const Ky=({size:n})=>/*#__PURE__*/t(Zy,{$size:n,children:/*#__PURE__*/e(Gy,{children:[/*#__PURE__*/t(Yy,{}),/*#__PURE__*/t(Jy,{})]})});let Zy=/*#__PURE__*/en.div.withConfig({displayName:"LoadingContainer",componentId:"sc-3ddaba1c-0"})(["--spinner-size:",";display:flex;justify-content:center;align-items:center;flex-grow:1;@media all and (display-mode:standalone){margin-bottom:30px;}"],(e=>e.$size?e.$size:"96px")),Gy=/*#__PURE__*/en.div.withConfig({displayName:"SpinnerContainer",componentId:"sc-3ddaba1c-1"})(["position:relative;height:var(--spinner-size);width:var(--spinner-size);opacity:1;animation:fadein 200ms ease;"]),Yy=/*#__PURE__*/en.div.withConfig({displayName:"CircleFixed",componentId:"sc-3ddaba1c-2"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);&&{border:4px solid #f1f2f9;border-radius:50%;}"]),Jy=/*#__PURE__*/en.div.withConfig({displayName:"CircleRotate",componentId:"sc-3ddaba1c-3"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);animation:spin 1200ms linear infinite;&&{border:4px solid;border-color:#cbcde1 transparent transparent transparent;border-radius:50%;}@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}"]);const Qy=/*#__PURE__*/en.span.withConfig({displayName:"Rows",componentId:"sc-b764aab6-0"})(["display:flex;flex-direction:column;gap:0.35rem;width:100%;"]),Xy=/*#__PURE__*/en.span.withConfig({displayName:"Row",componentId:"sc-b764aab6-1"})(["display:flex;width:100%;justify-content:space-between;gap:0.5rem;"]),ef=/*#__PURE__*/en.span.withConfig({displayName:"LabelSm",componentId:"sc-6c002d6-0"})(["color:var(--privy-color-foreground-3);font-size:0.875rem;font-weight:400;line-height:1.375rem;"]),tf=/*#__PURE__*/en(ef).withConfig({displayName:"LabelSmPrimary",componentId:"sc-6c002d6-1"})(["color:var(--privy-color-accent);"]),nf=/*#__PURE__*/en.span.withConfig({displayName:"Value",componentId:"sc-72aa026-0"})(["color:var(--privy-color-foreground);font-size:0.875rem;font-weight:500;line-height:1.375rem;word-break:break-all;text-align:right;",""],Op),rf=n=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 397.7 311.7",enableBackground:"new 0 0 397.7 311.7",xmlSpace:"preserve",...n,children:[/*#__PURE__*/e("linearGradient",{id:"SVGID_1_",gradientUnits:"userSpaceOnUse",x1:"360.8791",y1:"351.4553",x2:"141.213",y2:"-69.2936",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/t("path",{d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5 c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z",fill:"url(#SVGID_1_)"}),/*#__PURE__*/e("linearGradient",{id:"SVGID_2_",gradientUnits:"userSpaceOnUse",x1:"264.8291",y1:"401.6014",x2:"45.163",y2:"-19.1475",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/t("path",{d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5 c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z",fill:"url(#SVGID_2_)"}),/*#__PURE__*/e("linearGradient",{id:"SVGID_3_",gradientUnits:"userSpaceOnUse",x1:"312.5484",y1:"376.688",x2:"92.8822",y2:"-44.061",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/t("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/t("path",{d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4 c5.8,0,8.7-7,4.6-11.1L333.1,120.1z",fill:"url(#SVGID_3_)"})]});let af={[D.id]:n=>/*#__PURE__*/t("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",...n,children:/*#__PURE__*/t("g",{id:"Layer_x0020_1",children:/*#__PURE__*/e("g",{id:"_2405588477232",children:[/*#__PURE__*/t("rect",{fill:"none",width:"2500",height:"2500"}),/*#__PURE__*/t("g",{children:/*#__PURE__*/e("g",{children:[/*#__PURE__*/t("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"}),/*#__PURE__*/t("g",{children:/*#__PURE__*/e("g",{children:[/*#__PURE__*/t("g",{children:/*#__PURE__*/t("path",{fill:"#12AAFF",d:"M1435,1440l-121,332c-3,9-3,19,0,29l208,571l241-139l-289-793C1467,1422,1442,1422,1435,1440z"})}),/*#__PURE__*/t("g",{children:/*#__PURE__*/t("path",{fill:"#12AAFF",d:"M1678,882c-7-18-32-18-39,0l-121,332c-3,9-3,19,0,29l341,935l241-139L1678,883V882z"})})]})}),/*#__PURE__*/t("g",{children:/*#__PURE__*/t("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"})}),/*#__PURE__*/t("polygon",{fill:"#213147",points:"642,2179 727,1947 897,2088 738,2234 "}),/*#__PURE__*/e("g",{children:[/*#__PURE__*/t("path",{fill:"#FFFFFF",d:"M1172,644H939c-17,0-33,11-39,27L401,2039l241,139l550-1507c5-14-5-28-19-28L1172,644z"}),/*#__PURE__*/t("path",{fill:"#FFFFFF",d:"M1580,644h-233c-17,0-33,11-39,27L738,2233l241,139l620-1701c5-14-5-28-19-28V644z"})]})]})})]})})}),[B.id]:n=>/*#__PURE__*/e("svg",{width:"1503",height:"1504",viewBox:"0 0 1503 1504",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("rect",{x:"287",y:"258",width:"928",height:"844",fill:"white"}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"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"})]}),[z.id]:n=>/*#__PURE__*/e("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),/*#__PURE__*/t("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"})]}),[$.id]:n=>/*#__PURE__*/e("svg",{fill:"none",height:"400",viewBox:"0 0 400 400",width:"400",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("path",{d:"m0 0h400v400h-400z",fill:"#fcff52"}),/*#__PURE__*/t("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"})]}),[j.id]:n=>/*#__PURE__*/e("svg",{width:"200",height:"208",viewBox:"0 0 200 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("rect",{width:"199.4",height:"207.623",fill:"#121212"}),/*#__PURE__*/e("g",{"clip-path":"url(#clip0_2303_643)",children:[/*#__PURE__*/t("path",{d:"M132.369 155.99H49.7001V68.8854H68.6148V139.109H132.369V155.981V155.99Z",fill:"white"}),/*#__PURE__*/t("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"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_2303_643",children:/*#__PURE__*/t("rect",{width:"99.5407",height:"103.977",fill:"white",transform:"translate(49.7001 52.0134)"})})})]}),[E.id]:n=>/*#__PURE__*/e("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",...n,children:[/*#__PURE__*/t("path",{fill:"#8492B2",d:"M163.7,197.2V0L0,271.6L163.7,197.2z"}),/*#__PURE__*/t("path",{fill:"#62688F",d:"M163.7,368.4V197.2L0,271.6L163.7,368.4z M163.7,197.2l163.7,74.4L163.7,0V197.2z"}),/*#__PURE__*/t("path",{fill:"#454A75",d:"M163.7,197.2v171.2l163.7-96.8L163.7,197.2z"}),/*#__PURE__*/t("path",{fill:"#8492B2",d:"M163.7,399.4L0,302.7l163.7,230.7V399.4z"}),/*#__PURE__*/t("path",{fill:"#62688F",d:"M327.5,302.7l-163.8,96.7v134L327.5,302.7z"})]}),[V.id]:n=>/*#__PURE__*/e("svg",{width:"500",height:"500",viewBox:"0 0 500 500",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("circle",{cx:"250",cy:"250",r:"250",fill:"#FF0420"}),/*#__PURE__*/t("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"}),/*#__PURE__*/t("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"})]}),[H.id]:n=>/*#__PURE__*/e("svg",{width:"360",height:"360",viewBox:"0 0 360 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/t("rect",{width:"360",height:"360",rx:"180",fill:"#6C00F6"}),/*#__PURE__*/t("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"})]}),[q.id]:n=>/*#__PURE__*/e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",...n,children:[/*#__PURE__*/t("g",{clipPath:"url(#clip0)",children:/*#__PURE__*/t("g",{clipPath:"url(#clip1)",children:/*#__PURE__*/t("path",{d:"M14.9188 29.8373C6.67944 29.8373 0.00012207 23.1581 0.00012207 14.9187C0.00012207 6.67931 6.67944 0 14.9188 0C23.1581 0 29.8373 6.67931 29.8373 14.9187C29.8373 23.1581 23.1581 29.8373 14.9188 29.8373Z",fill:"url(#paint0)"})})}),/*#__PURE__*/e("defs",{children:[/*#__PURE__*/e("radialGradient",{id:"paint0",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(21.6921 8.02215) rotate(180) scale(25.2008)",children:[/*#__PURE__*/t("stop",{offset:"0.00682297",stopColor:"#F2CEFE"}),/*#__PURE__*/t("stop",{offset:"0.1913",stopColor:"#AFBAF1"}),/*#__PURE__*/t("stop",{offset:"0.4982",stopColor:"#4281D3"}),/*#__PURE__*/t("stop",{offset:"0.666667",stopColor:"#2E427D"}),/*#__PURE__*/t("stop",{offset:"0.822917",stopColor:"#230101"}),/*#__PURE__*/t("stop",{offset:"1",stopColor:"#8F6B40"})]}),/*#__PURE__*/t("clipPath",{id:"clip0",children:/*#__PURE__*/t("rect",{width:"30",height:"30",fill:"white"})}),/*#__PURE__*/t("clipPath",{id:"clip1",children:/*#__PURE__*/t("rect",{width:"30",height:"30",fill:"white"})})]})]})};const of=({chainId:e,...n})=>{if("solana"===e)/*#__PURE__*/return t(rf,{...n});let r=af[e];/*#__PURE__*/return t(r||ir,{...n})},sf=({wallet:r,displayName:a,addressToFund:i,chainId:o,chainName:s,isBridging:l,isErc20Flow:c,totalPriceInNativeCurrency:d,totalPriceInUsd:h,gasPriceInNativeCurrency:u,gasPriceInUsd:p})=>{let m=vo(r.walletClientType);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(Ky,{}),/*#__PURE__*/t(nc,{style:{marginTop:"16px"},children:/*#__PURE__*/t(Dm,{icon:m?.image_url?.md,name:r.walletClientType})}),/*#__PURE__*/t(hh,{style:{marginTop:"8px",marginBottom:"12px"},title:`${l?"Bridging":"Confirming"} with ${a}`}),!l&&!c&&/*#__PURE__*/e(Qy,{children:[/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Total"}),/*#__PURE__*/t(nf,{children:h||d})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"To"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:i,showCopyIcon:!1})})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Network"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/e(lf,{children:[/*#__PURE__*/t(of,{chainId:o,height:16,width:16})," ",s]})})]}),u&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Estimated fee"}),/*#__PURE__*/t(nf,{children:p||u})]})]}),/*#__PURE__*/t(uc,{height:24}),/*#__PURE__*/t(Js,{})]})};let lf=/*#__PURE__*/en.div.withConfig({displayName:"NetworkColumn",componentId:"sc-ec6320ce-0"})(["display:flex;flex-direction:row;align-items:center;gap:4px;"]);const cf={component:()=>{let{closePrivyModal:r,createAnalyticsEvent:a}=Tt(),{navigate:s,setModalData:l,app:c,data:h}=$o(),{wallets:u}=Rv(),p=Ty(),[m,g]=o(0n),[y,f]=o(null),[w,v]=o(!1),[C,b]=o(!1),k=i(!1);if(!h?.funding||"solana"!==h.funding.chainType)throw Error("Invalid funding data");let{address:T,amount:x,cluster:A,connectedWalletAddress:I}=h.funding,_=function({name:e,rpcUrl:t}){if(t)return t;switch(e){case"mainnet-beta":return"https://api.mainnet-beta.solana.com";case"testnet":return"https://api.testnet.solana.com";case"devnet":return"https://api.devnet.solana.com"}}(A),{tokenPrice:E}=Bc("solana"),{fundingAmountInBaseUnit:S,totalPriceInUsd:N,totalPriceInNativeCurrency:M,feePriceInNativeCurrency:P,feePriceInUsd:W}=Ol({amount:x,fee:m,tokenPrice:E,isUsdc:h.funding.isUSDC}),U=I?u.find((({address:e})=>e===I)):u[0],O=vo(U?.walletClientType||"unknown"),L=O?.name||"wallet";return d((()=>{(async()=>{if("solana"===U?.type&&U.sendTransaction&&!w&&!k.current){k.current=!0;try{let e=p(xy);if(!e)throw new de("Unable to load solana plugin");let{connection:t,transaction:n}=h.funding?.isUSDC?await e.createSplTransferTransaction({from:U.address,to:T,amount:S,mintAddress:K[A.name],cluster:A}):await e.createTransferTransaction({from:U.address,to:T,amount:S,cluster:A}),r=await n.getEstimatedFee(t);null!=r&&g(BigInt(r)),v(!0);let i=await t.simulateTransaction(n);if(i.value.err)return i.value.logs?.find((e=>/insufficient (lamports|funds)/gi.test(e)))?void f(new de(`Wallet ${Pr(U.address,void 0,void 0,"solana")} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",i.value.err),void f(new de("Something went wrong",void 0,ke.TRANSACTION_FAILURE)));let o=await U.sendTransaction(n,t),{value:s,token:l}=h.funding?.isUSDC?{value:Ft(S,6),token:"USDC"}:{value:Ft(S,9),token:"SOL"};a({eventName:fy,payload:{provider:"external",status:"success",txHash:o,rpcEndpoint:_,address:U.address,value:s,chainType:"solana",clusterName:A.name,token:l,destinationAddress:T,destinationValue:s,destinationChainType:"solana",destinationClusterName:A.name,destinationToken:l}}),v(!1),b(!0)}catch(e){if(console.error(e),v(!1),/user rejected the request/gi.test(e.message||""))return void f(new de("Transaction was rejected by the user",void 0,ke.TRANSACTION_FAILURE));f(new de("Something went wrong",void 0,ke.TRANSACTION_FAILURE))}}})().catch(console.error).finally((()=>k.current=!1))}),[]),d((()=>{y&&(l({funding:h?.funding,sendTransaction:h?.sendTransaction,errorModalData:{error:y,previousScreen:nw}}),s(rp,!1))}),[y]),d((()=>{if(!C)return;let e=setTimeout(r,na);return()=>clearTimeout(e)}),[C]),C?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(ic,{children:[/*#__PURE__*/t(er,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(hh,{title:"Success!",description:`You’ve successfully added ${x} ${h.funding?.isUSDC?"USDC":"SOL"} to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]}):U&&w?/*#__PURE__*/t(sf,{wallet:U,displayName:L,addressToFund:T,isBridging:!1,isErc20Flow:!!h.funding?.isUSDC,totalPriceInUsd:N,totalPriceInNativeCurrency:M,gasPriceInUsd:W,gasPriceInNativeCurrency:P,chainId:"solana",chainName:A.name}):
20
+ /*#__PURE__*/e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(Ky,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(Js,{})]})}},df=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}];let hf=2n**256n-1n;const uf=({amount:e,decimals:t})=>e===hf?"Maximum":Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t),pf=({chains:e,appId:t,address:n,rpcConfig:r})=>Promise.all(e.map((async e=>{let a=Pt({chain:e,transport:Wt(Nr(e,r,t))});return{balance:await a.getBalance({address:n}).catch((()=>0n)),chain:e}}))),mf=({balance:e,className:n,chain:r})=>/*#__PURE__*/t(my,{className:n,$state:void 0,children:/*#__PURE__*/t(gf,{balance:e,chain:r})}),gf=({balance:r,chain:a})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(yf,{children:[/*#__PURE__*/t(wf,{chainId:"id"in a?a.id:"solana"}),/*#__PURE__*/t(nf,{children:a.name})]}),/*#__PURE__*/e(Lp,{isLoading:!1,isPulsing:!1,color:"gray",children:[/*#__PURE__*/t(ff,{children:/*#__PURE__*/t(Un,{})}),r]})]});let yf=/*#__PURE__*/en.div.withConfig({displayName:"Container",componentId:"sc-d24ae982-0"})(["display:flex;align-items:center;"]),ff=/*#__PURE__*/en.div.withConfig({displayName:"IconContainer",componentId:"sc-d24ae982-1"})(["height:0.75rem;width:0.75rem;margin-right:0.2rem;"]),wf=/*#__PURE__*/en(of).withConfig({displayName:"StyledNetworkIcon",componentId:"sc-d24ae982-2"})(["height:1.25rem;width:1.25rem;display:inline-block;margin-right:0.5rem;border-radius:4px;"]);const vf=({options:n,onSelect:r,selected:a,className:i})=>/*#__PURE__*/e(Cn,{as:Cf,children:[/*#__PURE__*/e(bn,{as:xf,children:[/*#__PURE__*/t(gf,{balance:a.balance,chain:a.chain}),/*#__PURE__*/t(Tf,{height:16})]}),/*#__PURE__*/t(kn,{as:bf,className:i,children:n.map(((e,n)=>/*#__PURE__*/t(Tn,{as:kf,onClick:()=>r(n),children:/*#__PURE__*/t(gf,{balance:e.balance,chain:e.chain})},n)))})]});let Cf=/*#__PURE__*/en.div.withConfig({displayName:"Wrapper",componentId:"sc-31c00f79-0"})(["width:100%;position:relative;"]),bf=/*#__PURE__*/en.div.withConfig({displayName:"Popover",componentId:"sc-31c00f79-1"})(["width:100%;margin-top:0.5rem;position:absolute;background-color:var(--privy-color-background);border-radius:var(--privy-border-radius-md);overflow-x:hidden;overflow-y:auto;box-shadow:0px 1px 2px 0px rgba(16,24,40,0.05);max-height:11.75rem;&&{border:solid 1px var(--privy-color-foreground-4);}z-index:1;"]),kf=/*#__PURE__*/en.button.withConfig({displayName:"Button",componentId:"sc-31c00f79-2"})(["width:100%;display:flex;justify-content:space-between;&&{padding:1rem;}:not(:last-child){border-bottom:solid 1px var(--privy-color-foreground-4);}:hover{background:var(--privy-color-background-2);}"]),Tf=/*#__PURE__*/en(pn).withConfig({displayName:"StyledChevronIcon",componentId:"sc-31c00f79-3"})(["height:1rem;margin-left:0.5rem;"]),xf=/*#__PURE__*/en.button.withConfig({displayName:"StyledMenuButton",componentId:"sc-31c00f79-4"})([""," span{margin-left:auto;}","{transition:rotate 100ms ease-in;}&[aria-expanded='true']{","{rotate:-180deg;}}"],py,Tf,Tf),Af=({passkeys:n,expanded:r,onUnlink:a,onExpand:i})=>{let[s,l]=o([]),c=r?n.length:2,d=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";/*#__PURE__*/return e("div",{children:[/*#__PURE__*/t(Lf,{children:"Your passkeys"}),/*#__PURE__*/e(Pf,{children:[n.slice(0,c).map((n=>/*#__PURE__*/e(Df,{children:[/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Rf,{children:d(n)}),/*#__PURE__*/e(Ff,{children:["Last used: ",(n.latestVerifiedAt??n.verifiedAt).toLocaleString()]})]}),/*#__PURE__*/t(zf,{disabled:s.includes(n.credentialId),onClick:()=>(async e=>{l((t=>t.concat([e]))),await a(e),l((t=>t.filter((t=>t!==e))))})(n.credentialId),children:s.includes(n.credentialId)?/*#__PURE__*/t(Os,{}):/*#__PURE__*/t(pr,{height:"1.6em"})})]},n.credentialId))),n.length>2&&!r&&/*#__PURE__*/t(Mf,{onClick:i,children:"View all"})]})]})},If=()=>/*#__PURE__*/e(Pf,{children:[/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(mr,{})}),"Log in with Touch ID, Face ID, or a security key."]}),/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(Xn,{})}),"More secure than a password."]}),/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(ur,{})}),"Takes seconds to set up and use."]})]});const _f={component:()=>{let{user:r,unlinkPasskey:a}=us(),{linkWithPasskey:i,closePrivyModal:s}=Tt(),l=r?.linkedAccounts.filter((e=>"passkey"===e.type)),[c,h]=o(!1),[u,p]=o(""),[m,g]=o(!1),[y,f]=o(!1);d((()=>{0===l.length&&f(!1)}),[l.length]);let w=async e=>(h(!0),await a(e).then((()=>g(!0))).catch((e=>{e instanceof Oe&&e.privyErrorCode===ke.MISSING_MFA_CREDENTIALS?p("Cannot unlink a passkey enrolled in MFA"):p("Unknown error occurred.")})).finally((()=>{h(!1)})));/*#__PURE__*/return e(n,m?{children:[/*#__PURE__*/t(nl,{onClose:()=>s()},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(er,{})}),/*#__PURE__*/t(Wf,{style:{marginBottom:"1.5rem"},children:"Passkeys updated"}),/*#__PURE__*/t(Uf,{children:" "}),/*#__PURE__*/t(cd,{children:/*#__PURE__*/t(Fs,{onClick:()=>s(),children:"Done"})}),/*#__PURE__*/t(Qs,{})]}:y?{children:[/*#__PURE__*/t(nl,{backFn:()=>f(!1),onClose:()=>s()},"header"),/*#__PURE__*/t(Af,{passkeys:l,expanded:y,onUnlink:w,onExpand:()=>f(!0)}),/*#__PURE__*/t(Qs,{})]}:{children:[/*#__PURE__*/t(nl,{onClose:()=>s()},"header"),/*#__PURE__*/t(nd,{children:/*#__PURE__*/e(Ef,{children:[/*#__PURE__*/t(bd,{}),/*#__PURE__*/t(wm,{})]})}),/*#__PURE__*/t(Wf,{children:"Secure your account with a passkey"}),/*#__PURE__*/t(Of,{}),0===l.length?/*#__PURE__*/t(If,{}):/*#__PURE__*/t(Af,{passkeys:l,expanded:y,onUnlink:w,onExpand:()=>f(!0)}),/*#__PURE__*/e(cd,{style:{marginTop:"12px"},children:[u&&/*#__PURE__*/t(Sf,{$fail:!0,children:u}),/*#__PURE__*/t(Fs,{onClick:()=>{h(!0),i().then((()=>g(!0))).catch((e=>{if(e instanceof Oe){if(e.privyErrorCode===ke.CANNOT_LINK_MORE_OF_TYPE)return void p("Cannot link more passkeys to account.");if(e.privyErrorCode===ke.PASSKEY_NOT_ALLOWED)return void p("Passkey request timed out or rejected by user.")}p("Unknown error occurred.")})).finally((()=>{h(!1)}))},loading:c,children:"Add new passkey"})]}),/*#__PURE__*/t(Qs,{})]})}},Ef=/*#__PURE__*/en.div.withConfig({displayName:"DoubleIconWrapper",componentId:"sc-d6832d36-0"})(["display:flex;align-items:center;justify-content:center;width:180px;height:90px;border-radius:50%;svg + svg{margin-left:12px;}> svg{z-index:2;color:var(--privy-color-accent) !important;stroke:var(--privy-color-accent) !important;fill:var(--privy-color-accent) !important;}"]);let Sf=/*#__PURE__*/en.div.withConfig({displayName:"InputHelp",componentId:"sc-d6832d36-1"})(["line-height:20px;height:20px;font-size:13px;color:",";display:flex;justify-content:flex-beginngin;width:100%;"],(e=>e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)")),Nf=/*#__PURE__*/tn(["&&{width:100%;font-size:0.875rem;line-height:1rem;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;justify-content:center;padding:6px 8px;background-color:var(--privy-color-background);transition:background-color 200ms ease;color:var(--privy-color-accent) !important;:focus{outline:none;box-shadow:none;}}"]);const Mf=/*#__PURE__*/en.button.withConfig({displayName:"LinkButton",componentId:"sc-d6832d36-2"})(["",""],Nf);let Pf=/*#__PURE__*/en.div.withConfig({displayName:"List",componentId:"sc-d6832d36-3"})(["display:flex;flex-direction:column;align-items:stretch;gap:0.8rem;padding:0.5rem 0rem 0rem;flex-grow:1;width:100%;"]),Wf=/*#__PURE__*/en.div.withConfig({displayName:"ModalTitle",componentId:"sc-d6832d36-4"})(["font-size:18px;line-height:18px;text-align:center;font-weight:600;"]),Uf=/*#__PURE__*/en.div.withConfig({displayName:"ModalSubTitle",componentId:"sc-d6832d36-5"})(["font-size:0.875rem;text-align:center;margin-top:10px;"]),Of=/*#__PURE__*/en.div.withConfig({displayName:"SectionSpacer",componentId:"sc-d6832d36-6"})(["height:32px;"]),Lf=/*#__PURE__*/en.div.withConfig({displayName:"PasskeyListTitle",componentId:"sc-d6832d36-7"})(["line-height:20px;height:20px;font-size:1em;font-weight:450;display:flex;justify-content:flex-beginning;width:100%;"]),Rf=/*#__PURE__*/en.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-d6832d36-8"})(["font-size:1em;line-height:1.3em;font-weight:500;color:var(--privy-color-foreground-2);padding:0.2em 0;"]),Ff=/*#__PURE__*/en.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-d6832d36-9"})(["font-size:0.875rem;line-height:1rem;color:#64668b;padding:0.2em 0;"]),Df=/*#__PURE__*/en.div.withConfig({displayName:"PasskeyListItem",componentId:"sc-d6832d36-10"})(["display:flex;align-items:center;justify-content:space-between;padding:1em;gap:10px;font-size:0.875rem;line-height:1rem;text-align:left;border-radius:8px;border:1px solid #e2e3f0 !important;width:100%;height:5em;"]),Bf=/*#__PURE__*/tn([":focus,:hover,:active{outline:none;}display:flex;width:2em;height:2em;justify-content:center;align-items:center;svg{color:var(--privy-color-error);}svg:hover{color:var(--privy-color-foreground-3);}"]),zf=/*#__PURE__*/en.button.withConfig({displayName:"PasskeyItemUnlinkButton",componentId:"sc-d6832d36-11"})(["",""],Bf);const $f=/*#__PURE__*/en.div.withConfig({displayName:"FundingMethodContainer",componentId:"sc-eaaa12a-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),jf=/*#__PURE__*/en.div.withConfig({displayName:"IconContainer",componentId:"sc-eaaa12a-1"})(["width:24px;height:24px;display:flex;justify-content:center;align-items:center;svg{border-radius:var(--privy-border-radius-sm);}"]),Vf=/*#__PURE__*/en.div.withConfig({displayName:"FundingQuantityWrapper",componentId:"sc-eaaa12a-2"})(["display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:8px;"]),Hf=/*#__PURE__*/en.div.withConfig({displayName:"FundingQuantity",componentId:"sc-eaaa12a-3"})(["display:flex;align-items:center;gap:4px;width:100%;padding:0 16px;border-width:1px !important;border-radius:12px;cursor:text;&:focus-within{border-color:var(--privy-color-accent);}"]),qf=/*#__PURE__*/en.input.withConfig({displayName:"FundingAmountInput",componentId:"sc-eaaa12a-5"})(["background-color:var(--privy-color-background);width:100%;&:focus{outline:none !important;border:none !important;box-shadow:none !important;}&&{font-size:26px;}"]),Kf=/*#__PURE__*/en(qf).withConfig({displayName:"FundingAmountInputLarge",componentId:"sc-eaaa12a-6"})(["&&{font-size:42px;}"]),Zf=/*#__PURE__*/en.div.withConfig({displayName:"FundingCurrency",componentId:"sc-eaaa12a-8"})(["font-size:18px;"]),Gf=/*#__PURE__*/en.div.withConfig({displayName:"FundingDollars",componentId:"sc-eaaa12a-9"})(["font-size:12px;color:var(--privy-color-foreground-3);height:20px;"]),Yf=/*#__PURE__*/en.div.withConfig({displayName:"InfoButtonText",componentId:"sc-eaaa12a-13"})([""]),Jf=/*#__PURE__*/en.a.withConfig({displayName:"InfoButtonLink",componentId:"sc-eaaa12a-14"})(["&&{color:var(--privy-color-accent);}cursor:pointer;"]),Qf=({displayName:r,errorMessage:a,configuredFundingChain:o,formattedBalance:s,fundingAmount:l,fundingCurrency:c,fundingAmountInUsd:d,options:h,selectedOption:u,isPreparing:p,isSubmitting:m,addressToFund:g,fundingWalletAddress:y,onSubmit:f,onSelect:w,onAmountChange:v})=>{let C=i(null);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(ay,{children:"Transfer from another network"}),/*#__PURE__*/e(ry,{children:["You need more funds on the ",o.name," network. Bridge from another blockchain network."]}),/*#__PURE__*/e(Vf,{style:{marginTop:"2rem"},children:[/*#__PURE__*/e(Hf,{onClick:()=>C.current?.focus(),children:[/*#__PURE__*/t(qf,{ref:C,value:l,onChange:e=>{let t=e.target.value;if(/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1){let e=/\.$/.test(t)?".":"",n=Number(t.replace(/\.$/,"")||"0");if(Number.isNaN(n))return void v("0");v(n.toString()+e)}}}),/*#__PURE__*/t(Zf,{children:c})]}),d&&/*#__PURE__*/t(Gf,{children:d})]}),/*#__PURE__*/e(Xy,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/t(ef,{children:"From"}),/*#__PURE__*/t(ef,{children:Z(y)})]}),/*#__PURE__*/t(vf,{selected:{chain:u.chain,balance:xl(u.balance,u.chain.nativeCurrency.symbol,3,!0)},options:h.map((({chain:e,balance:t})=>({chain:e,balance:xl(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:w}),/*#__PURE__*/e(Xy,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/t(ef,{children:"To"}),/*#__PURE__*/t(ef,{children:Z(g)})]}),/*#__PURE__*/t(mf,{chain:o,balance:s}),/*#__PURE__*/t(Og,{style:{marginTop:"1rem"},children:a}),/*#__PURE__*/e(Ds,{style:{marginTop:"1rem"},loading:m||p,disabled:p||m,onClick:f,children:["Confirm with ",r]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})},Xf={component:()=>{let{rpcConfig:r,appId:a,closePrivyModal:i,createAnalyticsEvent:s}=Tt(),{navigate:l,setModalData:c,app:h,data:u}=$o(),{wallets:p}=$c(),[m,g]=o(!1),[y,f]=o(0n),[w,v]=o(!1),[C,b]=o(null),[k,T]=o(null),[x,A]=o([]),[I,_]=o(0),[E,N]=o(!1),[M,P]=o(!1),[W,U]=o(!1),[O,L]=o(!1),[R,F]=o(),[D,B]=o();if(!u?.funding||"ethereum"!==u.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:z,chain:$,connectedWalletAddress:j}=u.funding,V=u.funding.address,H=u.funding.erc20Address,[q,K]=o(u.funding.amount);d((()=>{H&&!z&&b(Error("Unable to fetch token details"))}),[]);let Z=!!H&&!!z,G=Z?BigInt(parseFloat(q)*10**z.decimals):Dt(q),Y=j?p.find((({address:e})=>e===j)):p[0],J=vo(Y?.walletClientType||"unknown"),Q=J?.name||"wallet",[X,ee]=o(null);d((()=>{(async()=>{if(!Y)return;let e=await Y.getEthereumProvider();ee(Bt({account:Y.address,transport:zt(e)}).extend($t))})().catch(console.error)}),[Y]);let[te,ne]=o(0n);d((()=>{Pt({chain:$,transport:Wt(Nr($,r,a))}).getBalance({address:V}).then(ne).catch(console.error)}),[]);let[re,ae]=o(0n);d((()=>{Z&&wy({chain:$,address:V,appId:a,rpcConfig:r,erc20Address:H}).then((e=>ae(e.balance))).catch(console.error)}),[]);let{tokenPrice:ie}=Bc($.id),[oe,se]=o({to:V,chain:$,value:G,data:void 0});d((()=>{(async()=>{let e,t;if(!X||!Y||E||W)return;N(!0);let n=Pt({chain:oe.chain,transport:Wt(Nr(oe.chain,r,a))});if(Z&&!oe.data)return await n.simulateContract({address:H,chain:oe.chain,abi:df,functionName:"transfer",args:[V,G],account:Y.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(N(!1),void se({to:H,chain:oe.chain,data:jt({abi:df,functionName:"transfer",args:[V,G]}),value:"0x0"})):(N(!1),void v(!0));try{e=await n.prepareTransactionRequest({account:Y.address,to:oe.to,chain:oe.chain,data:oe.data,value:BigInt(oe.value??0)})}catch(e){if(console.error(e),x.length>1)T(e.shortMessage??"Something went wrong");else if(M&&0===x.length)return void b(new de(`Wallet ${Pr(Y.address)} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE))}if(!e)return N(!1),void v(!0);N(!1),U(!0),g(!0),f(e.gas);try{await X.switchChain({id:oe.chain.id})}catch(e){await X.addChain({chain:oe.chain}),await X.switchChain({id:oe.chain.id})}try{t=await X.sendTransaction(e)}catch(e){if(console.error(e),"TransactionExecutionError"===e.name)if(x.length<1){let t=e.shortMessage;(e.shortMessage.includes("rejected the request")||e.details.includes("rejected the request"))&&(t="User rejected the request."),b(new de(t,void 0,ke.TRANSACTION_FAILURE))}else T(e.shortMessage??"Something went wrong")}if(t)return await X.waitForTransactionReceipt({hash:t}),U(!1),M?(F(t),void B("pending")):(L(!0),void s({eventName:fy,payload:{provider:"external",status:"success",txHash:t,address:Y.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?Ft(BigInt(oe.value),z?.decimals??18):void 0,token:z?.symbol??H??"ETH",destinationAddress:V,destinationChainId:$.id,destinationChainType:"ethereum",destinationValue:G?Ft(G,z?.decimals??18):void 0,destinationToken:z?.symbol??H??$.nativeCurrency.name}}));U(!1)})().catch(console.error)}),[X,oe]),d((()=>{(async()=>{if(!w||!X||!Y)return;let e=S(h.chains).filter((e=>e.id!==$.id&&!!e.testnet==!!$.testnet));Z&&e.unshift($);let t=await pf({chains:e,address:Y.address,appId:a,rpcConfig:r}),n=Z?t.filter((e=>e.balance>0n)):t.filter((e=>e.balance>G));if(n.length<1)return void b(new de(`Wallet ${Pr(Y.address)} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE));n.sort(((e,t)=>Number(t.balance-e.balance)));let i=(await Promise.allSettled(n.map((async e=>({quote:await Qu({isTestnet:!!$.testnet,input:Gu({amount:G.toString(),user:Y.address,recipient:V,destinationChainId:$.id,destinationCurrency:H,originChainId:e.chain.id})}),...e}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(i.length<1)return void b(new de(`Wallet ${Pr(Y.address)} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE));let o=i.map((e=>({bridgeTx:Xu(e.quote),balance:e.balance,chain:e.chain}))).filter((e=>!!e.bridgeTx));if(o.length>1)return void A(o);let s=o[0];s?(P(!0),se({data:s.bridgeTx.data,to:s.bridgeTx.to,value:s.bridgeTx.value,chain:s.chain})):b(new de(`Wallet ${Pr(Y.address)} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE))})().catch(console.error)}),[w]),ep({transactionHash:R,wallet:Y,isTestnet:!!$.testnet,bridgingStatus:D,setBridgingStatus:B,onSuccess({transactionHash:e,wallet:t}){P(!1),L(!0),s({eventName:fy,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?Ft(BigInt(oe.value),z?.decimals??18):void 0,token:z?.symbol??H??"ETH",destinationAddress:V,destinationChainId:$.id,destinationChainType:"ethereum",destinationValue:G?Ft(G,z?.decimals??18):void 0,destinationToken:z?.symbol??H??$.nativeCurrency.name}})},onFailure({error:e}){P(!1),b(e)}}),d((()=>{C&&(c({funding:u?.funding,sendTransaction:u?.sendTransaction,errorModalData:{error:C,previousScreen:nw}}),l(rp,!1))}),[C]);let le=!Z&&ie?kl(q??"0",ie):void 0,ce=Z?y:Il([y,G]),he=ce&&ie?Tl(ce,ie):void 0,ue=ce?xl(ce,u?.funding?.erc20Address?u?.funding?.erc20ContractInfo?.symbol||"ETH":u?.funding?.chain.nativeCurrency.symbol||"ETH"):void 0,pe=y&&ie?Tl(y,ie):void 0,me=y?xl(y,$?.nativeCurrency?.symbol||"ETH"):void 0;if(d((()=>{if(!O)return;let e=setTimeout(i,na);return()=>clearTimeout(e)}),[O]),O/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(ic,{children:[/*#__PURE__*/t(er,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(hh,{title:"Success!",description:`You’ve successfully added ${q} ${Z?z.symbol:$.nativeCurrency.symbol} to your ${h.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]});let ge=Z?`${uf({amount:re,decimals:z.decimals})} ${z.symbol}`:xl(te,$.nativeCurrency.symbol,3,!0),ye=x[I];return x.length>1&&ye?/*#__PURE__*/t(Qf,{displayName:Q,configuredFundingChain:$,formattedBalance:ge,fundingAmount:q,fundingCurrency:Z?z.symbol:$.nativeCurrency.symbol,fundingAmountInUsd:le,options:x,selectedOption:ye,isPreparing:E,isSubmitting:W,addressToFund:V,fundingWalletAddress:Y?.address||"",errorMessage:k,onSubmit:()=>{u.funding?.amount!==q?async function(){if(Y&&ye)try{let e=await Qu({isTestnet:!!$.testnet,input:Gu({amount:G.toString(),user:Y.address,recipient:V,destinationChainId:$.id,destinationCurrency:H,originChainId:ye.chain.id})}),t=Xu(e);if(!t)throw Error("Invalid transaction request");P(!0),se({data:t.data,to:t.to,value:t.value,chain:ye.chain})}catch(e){console.error(e),b(new de("Unable to fetch quotes for bridging",e,ke.INSUFFICIENT_BALANCE))}}().catch(console.error):se({to:ye.bridgeTx.to,data:ye.bridgeTx.data,value:ye.bridgeTx.value,chain:ye.chain})},onSelect:e=>{e!==I&&(T(null),_(e))},onAmountChange:K}):m&&y&&Y&&u?.funding?/*#__PURE__*/t(sf,{wallet:Y,displayName:Q,addressToFund:V,isBridging:M,isErc20Flow:Z,totalPriceInUsd:he,totalPriceInNativeCurrency:ue,gasPriceInUsd:pe,gasPriceInNativeCurrency:me,chainId:$.id,chainName:$.name}):
21
+ /*#__PURE__*/e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(Ky,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(Js,{})]})}},ew={component:function(){let{closePrivyModal:r,createAnalyticsEvent:a}=Tt(),{navigate:s,setModalData:l,app:c,data:h}=$o(),{wallets:u}=Rv(),p=i(!1),m=Ty(),[g,y]=o(!1),[f,w]=o(!1),[v,C]=o(null),[b,k]=o(),[T,x]=o();if(!h?.funding||"ethereum"!==h.funding.chainType)throw Error("Invalid funding data");let{amount:A,connectedWalletAddress:I,chain:_,cluster:E,isUSDC:S}=h.funding,N=h.funding.address,M=h.funding.erc20Address,P=h.funding.isUSDC?"USDC":_.nativeCurrency.symbol,W=E??{name:"mainnet-beta"},U=I?u.find((({address:e})=>e===I)):u[0],O=vo(U?.walletClientType||"unknown"),L=O?.name||"wallet";return d((()=>{(async function(){if(!U||!_||p.current)return;let e=m(xy);if(!e)return void C(new de("Unable to solana plugin"));p.current=!0,_?.testnet&&console.warn("Solana testnets are not supported for bridging");let t=S?1e6*parseFloat(A):Dt(A),n=await Qu({isTestnet:!!_.testnet,input:Gu({amount:t.toString(),user:U.address,recipient:N,destinationChainId:_.id,originChainId:Io,originCurrency:S?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":_o,destinationCurrency:S?M:void 0})}).catch(console.error);if(!n)return void C(new de(`Unable to fetch quotes for bridging. Wallet ${Wr(U.address)} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE));let r=await e.createBridgeTransactionFromRelayQuote({quote:n,from:U.address,cluster:W});if(r)try{y(!0);let{connection:e,transaction:t}=r,a=await e.simulateTransaction(t);if(a.value.err)return a.value.logs?.find((e=>/insufficient (lamports|funds)/gi.test(e)))?void C(new de(`Wallet ${Wr(U?.address)} does not have enough funds. ${n.details.currencyIn.amountFormatted} ${P} are needed to complete the transaction.`,void 0,ke.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",a.value.err),void C(new de("Something went wrong",void 0,ke.TRANSACTION_FAILURE)));let i=await U.sendTransaction(t,e),o=await e.confirmTransaction(i);if(o.value.err)return console.error("Transaction failed:",o.value.err),void C(new de("Something went wrong",void 0,ke.TRANSACTION_FAILURE));k(i),x("pending")}catch(e){if(console.error(e),/user rejected the request/gi.test(e.message||""))return void C(new de("Transaction was rejected by the user",void 0,ke.TRANSACTION_FAILURE));C(new de("Something went wrong",void 0,ke.TRANSACTION_FAILURE))}else C(new de(`Unable to select bridge option from quotes. Wallet ${Wr(U.address)} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE))})().catch(console.error)}),[]),ep({transactionHash:b,wallet:U,isTestnet:!1,bridgingStatus:T,setBridgingStatus:x,onSuccess({transactionHash:e,wallet:t}){y(!1),w(!0),a({eventName:fy,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainType:"solana",clusterName:W.name,token:"SOL",destinationAddress:N,destinationChainId:_.id,destinationChainType:"ethereum",destinationValue:A,destinationToken:S?"USDC":"ETH"}})},onFailure({error:e}){y(!1),C(e)}}),d((()=>{if(!f)return;let e=setTimeout(r,na);return()=>clearTimeout(e)}),[f]),d((()=>{v&&(l({funding:h?.funding,sendTransaction:h?.sendTransaction,errorModalData:{error:v,previousScreen:nw}}),s(rp,!1))}),[v]),f?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(ic,{children:[/*#__PURE__*/t(er,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(hh,{title:"Success!",description:`You’ve successfully added ${A} ${P} to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]}):g&&U?/*#__PURE__*/t(sf,{wallet:U,displayName:L,addressToFund:N,isBridging:g,isErc20Flow:!1,chainId:_.id,chainName:_.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
22
+ /*#__PURE__*/e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(Ky,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(Js,{})]})}},tw={component:()=>{let{data:r,setModalData:a}=$o(),o=r?.funding,s="solana"===o.chainType,l=i(null),{tokenPrice:c}=Bc(s?"solana":o.chain.id),d=s?void 0:o,h=!(!d?.erc20Address||d?.erc20ContractInfo),u=s?o.isUSDC?"USDC":"SOL":o.erc20Address?o.erc20ContractInfo?.symbol:o.chain.nativeCurrency.symbol||"ETH",p=parseFloat(o.amount),m=!isNaN(p)&&p>0,g=c?kl(o.amount,c):void 0;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(ay,{children:"Confirm or edit amount"}),/*#__PURE__*/e(oc,{style:{marginTop:"32px"},children:[/*#__PURE__*/t(Vf,{children:h?/*#__PURE__*/t(Ky,{size:"50px"}):/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(Hf,{onClick:()=>l.current?.focus(),children:[/*#__PURE__*/t(Kf,{ref:l,value:o.amount,onChange:e=>{let t=e.target.value;/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1&&a({...r,funding:{...o,amount:t}})}}),/*#__PURE__*/t(Zf,{children:u})]}),!d?.erc20Address&&/*#__PURE__*/t(Gf,{children:g&&m?`${g} USD`:""})]})}),/*#__PURE__*/t(Ds,{style:{marginTop:"1rem"},disabled:!m,onClick:o.onContinueWithExternalWallet,children:"Continue"})]}),/*#__PURE__*/t(Js,{})]})}},nw={component:()=>{let r,{connectors:a}=Tt(),{app:i,setModalData:s,data:l,navigate:c}=$o(),{wallets:h}=$c(),{wallets:u}=Rv(),[p,m]=o("default"),g="solana"===l?.funding?.chainType,y=!!l?.funding?.crossChainBridgingEnabled;r="ethereum"===l?.funding?.chainType?l.funding.erc20Address&&!l.funding.isUSDC?"ethereum-only":y&&!l.funding.chain.testnet?"ethereum-and-solana":"ethereum-only":y&&!l.funding?.isUSDC?"ethereum-and-solana":"solana-only";let f=h.filter((e=>"privy"!==e.walletClientType)),w=f.map((e=>e.walletClientType)),v=u.filter((e=>"privy"!==e.walletClientType)),C=v.map((e=>e.walletClientType)),b=[],k={...l.funding};k.usingDefaultFundingMethod&&(k.usingDefaultFundingMethod=!1);let T=({address:e,walletChainType:t})=>{s({...l,funding:{...k,connectedWalletAddress:e,onContinueWithExternalWallet:()=>c(A({destChainType:g?"solana":"ethereum",sourceChainType:t}))}}),c(tw)};"solana-only"!==r&&b.push(...f.map(((e,n)=>/*#__PURE__*/t(rw,{onClick:()=>T({address:e.address,walletChainType:"ethereum"}),icon:e.meta.icon,name:e.meta.name,chainType:e.type},n)))),"ethereum-only"!==r&&b.push(...v.map(((e,n)=>/*#__PURE__*/t(rw,{onClick:()=>T({address:e.address,walletChainType:"solana"}),icon:e.meta.icon,name:e.meta.name,chainType:e.type},n)))),b.push(...ug({walletList:i.appearance.walletList.filter((e=>!f.some((t=>t.walletClientType===e))&&!v.some((t=>t.walletClientType===e)))),walletChainType:r,connectors:a,connectOnly:!0,ignore:[...i.appearance.walletList,...w,...C],walletConnectEnabled:i.externalWallets.walletConnect.enabled}));let x=/*#__PURE__*/t(pg,{text:"More wallets",onClick:()=>m("overflow")}),A=({sourceChainType:e,destChainType:t})=>"ethereum"===e&&"solana"===t?dC:"ethereum"===e&&"ethereum"===t?Xf:"solana"===e&&"ethereum"===t?ew:cf;return d((()=>{s({...l,externalConnectWallet:{onCompleteNavigateTo:({walletChainType:e})=>(s({...l,funding:{...k,onContinueWithExternalWallet:()=>{c(A({destChainType:g?"solana":"ethereum",sourceChainType:e??"ethereum"}))}}}),tw)}})}),[]),/*#__PURE__*/e(n,"overflow"===p?{children:[/*#__PURE__*/t(nl,{backFn:()=>m("default")},"header"),/*#__PURE__*/e(Ts,{children:[/*#__PURE__*/t(ry,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),b]}),/*#__PURE__*/t(Js,{})]}:{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(hh,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),/*#__PURE__*/e(Ts,{children:[b.length>4?b.slice(0,3):b,b.length>4&&x]}),/*#__PURE__*/t(Js,{})]})}};let rw=({onClick:n,icon:r,name:a,chainType:i})=>/*#__PURE__*/e(_s,{onClick:n,children:[/*#__PURE__*/t(jf,{style:{width:20},children:/*#__PURE__*/t("img",{src:r})}),a,/*#__PURE__*/t(Lp,{color:"gray",style:{marginLeft:"auto"},children:"Connected"}),"solana"===i&&/*#__PURE__*/t(Lp,{color:"gray",children:"Solana"})]});const aw={component:()=>{let{data:r,setModalData:a,navigate:s,navigateBack:l}=$o(),{closePrivyModal:c,createAnalyticsEvent:h,client:u}=Tt(),[p,m]=o("pending-in-flow"),g=i(0),y={...r?.funding,showAlternateFundingMethod:!0};y.usingDefaultFundingMethod&&(y.usingDefaultFundingMethod=!1);let{partnerUserId:f,popup:w}=r?.coinbaseOnrampStatus??{};return d((()=>{if("pending-in-flow"===p||"pending-after-flow"===p){let e=setInterval((async()=>{if(f)try{let{status:e}=await u.getCoinbaseOnRampStatus({partnerUserId:f});if("success"===e)return void m("success");if("failure"===e)throw Error("There was an error completing Coinbase Onramp flow.");if(g.current>=3)return a({funding:y}),void s(bw);w?.closed&&(g.current=g.current+1,m("pending-after-flow"))}catch(e){console.error(e),m("error"),h({eventName:fy,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),a({funding:{...y,errorMessage:"Something went wrong adding funds. Please try again or use another method."}}),s(bw)}}),1500);return()=>clearInterval(e)}}),[f,w,p]),/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{title:"Fund account",backFn:()=>{a({funding:y}),l()}},"header"),/*#__PURE__*/t(iw,{status:p,onClickCta:c}),/*#__PURE__*/t(Js,{})]})}};let iw=({status:r,onClickCta:a})=>{let{title:i,body:o,cta:l}=s((()=>(e=>{switch(e){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Almost done. Retrieving transaction status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(r)),[r]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(lw,{children:[/*#__PURE__*/t(ow,{isSucccess:"success"===r}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t("h3",{children:i}),/*#__PURE__*/t(sw,{children:o})]})]}),l&&/*#__PURE__*/t(Fs,{onClick:a,children:l})]})},ow=({isSucccess:n})=>{if(!n){let n="var(--privy-color-foreground-4)";/*#__PURE__*/return e("div",{style:{position:"relative"},children:[/*#__PURE__*/t(Ws,{color:n,style:{position:"absolute"}}),/*#__PURE__*/t(Us,{color:n}),/*#__PURE__*/t(ki,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let r=(e=>e?zn:()=>/*#__PURE__*/t(ar,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}))(n),a=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(n);/*#__PURE__*/return t("div",{style:{borderColor:a,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&/*#__PURE__*/t(r,{width:"4rem",height:"4rem",color:a})})},sw=/*#__PURE__*/en.p.withConfig({displayName:"StatusBody",componentId:"sc-ebf88779-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),lw=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-ebf88779-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);let cw={[E.id]:"ethereum",[z.id]:"base",[V.id]:"optimism",[H.id]:"polygon",[D.id]:"arbitrum"};const dw=(e,t,n,r,a,i)=>new Promise((async(o,s)=>{let l=ah();if(!l)return void s(Error("Unable to initialize flow"));let c="ethereum"===t.chainType?function(e){let t=cw[e];if(!t)throw new de(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(t.chain.id):"solana",d=t.isUSDC?"USDC":"ethereum"===t.chainType?"ETH":"SOL",h=await e.initCoinbaseOnRamp({addresses:[{address:t.address,blockchains:[c]}],assets:[d]}),{url:u}=G({input:h,amount:t.amount,blockchain:c,asset:d,experience:i});l.location=u.toString();let p={...a?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(p.usingDefaultFundingMethod=!1),n({funding:p,coinbaseOnrampStatus:{popup:l}}),r(aw),e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.cluster.name}}),setTimeout((()=>{n({funding:p,coinbaseOnrampStatus:{partnerUserId:h.partner_user_id,popup:l}})}),5e3),o()})),hw=({size:n=61,...r})=>/*#__PURE__*/t("svg",{width:n,height:n,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:/*#__PURE__*/e("g",{id:"moonpay_symbol_wht 2",children:[/*#__PURE__*/t("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),/*#__PURE__*/t("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"})]})});const uw={component:()=>{let{app:r,data:a,setModalData:s,navigateBack:l}=$o(),{closePrivyModal:c}=Tt(),{externalTransactionId:h}=a?.moonpayStatus,u=function(e,t=!1){let[n,r]=o(null),{createAnalyticsEvent:a}=Tt(),{data:s,navigate:l,setModalData:c}=$o(),h=s?.funding,u=i(0);return d((()=>{let n=setInterval((async()=>{if(e)try{let[i]=await async function(e,t){return or(`${t?xa:Ta}/transactions/ext/${e}`,{query:{apiKey:t?Ia:Aa}})}(e,t),o="waitingAuthorization"===i.status&&"credit_debit_card"===i.paymentMethod?"pending":i.status;if(["failed","completed","awaitingAuthorization"].includes(o)&&(a({eventName:fy,payload:{status:o,provider:kw,paymentMethod:i.paymentMethod,cardPaymentType:i.cardPaymentType,currency:i.currency?.code,baseCurrencyAmount:i.baseCurrencyAmount,quoteCurrencyAmount:i.quoteCurrencyAmount,feeAmount:i.feeAmount,extraFeeAmount:i.extraFeeAmount,networkFeeAmount:i.networkFeeAmount,isSandbox:t}}),clearInterval(n)),"failed"===o||"serviceFailure"===o)return c({funding:{...h,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),void l(bw);r(o)}catch(e){404!==e.response?.status&&(u.current+=1),u.current>=3&&(a({eventName:fy,payload:{status:"serviceFailure",provider:kw}}),clearInterval(n),c({funding:{...h,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),l(bw))}}),3e3);return()=>clearInterval(n)}),[e,u]),n}(h||null,r.fundingMethodConfig.moonpay.useSandbox??!1);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{title:"Fund account",backFn:()=>{let e={...a?.funding,showAlternateFundingMethod:!0};e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),s({funding:e}),l()}}),/*#__PURE__*/t(pw,{status:u,onClickCta:c}),/*#__PURE__*/t(Js,{})]})}};let pw=({status:r,onClickCta:a})=>{let{title:i,body:o,cta:l}=s((()=>(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:""}}})(r)),[r]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(yw,{children:[/*#__PURE__*/t(mw,{status:r}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t("h3",{children:i}),/*#__PURE__*/t(gw,{children:o})]})]}),l&&/*#__PURE__*/t(Fs,{onClick:a,children:l})]})},mw=({status:n})=>{if(!n||"pending"===n){let n="var(--privy-color-foreground-4)";/*#__PURE__*/return e("div",{style:{position:"relative"},children:[/*#__PURE__*/t(Ws,{color:n,style:{position:"absolute"}}),/*#__PURE__*/t(Us,{color:n}),/*#__PURE__*/t(hw,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let r=(e=>{switch(e){case"completed":return zn;case"waitingAuthorization":return()=>/*#__PURE__*/t(ar,{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}})(n),a=(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)")(n);/*#__PURE__*/return t("div",{style:{borderColor:a,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&/*#__PURE__*/t(r,{width:"4rem",height:"4rem",color:a})})},gw=/*#__PURE__*/en.p.withConfig({displayName:"StatusBody",componentId:"sc-7f0a56e4-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),yw=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-7f0a56e4-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);const fw=async(e,t,n,r,a,i,o,s)=>{let l=ah();if(!l)throw Error("Unable to initialize flow");let c="ethereum"===t.chainType?t.moonpayConfigOverride?.currencyCode??Y(t.chain.id,r):t.isUSDC?"USDC_SOL":"SOL",{signedUrl:d,externalTransactionId:h}=await e.signMoonpayOnRampUrl({address:t.address,useSandbox:n.fundingMethodConfig.moonpay.useSandbox??!1,config:{uiConfig:{accentColor:n.appearance.palette.accent,theme:n.appearance.palette.colorScheme},...t.moonpayConfigOverride,paymentMethod:s,currencyCode:c,quoteCurrencyAmount:t.moonpayConfigOverride?.quoteCurrencyAmount??Tw(t.amount)}});e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"moonpay",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.cluster.name}}),l.location=d;let u={...o?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(u.usingDefaultFundingMethod=!1),a({moonpayStatus:{},funding:u}),i(uw),setTimeout((()=>{a({moonpayStatus:{externalTransactionId:h},funding:u})}),8e3)};let ww=async e=>"undefined"!=typeof window&&"PaymentRequest"in window&&await new window.PaymentRequest([{supportedMethods:e}],{id:"0",total:{label:"Item",amount:{currency:"USD",value:"1.00"}}}).canMakePayment();const vw=()=>ww("https://apple.com/apple-pay"),Cw=()=>ww("https://google.com/pay"),bw={component:()=>{let{wallets:r}=$c(),{wallets:a}=Rv(),{navigate:i,data:o,setModalData:l}=$o(),{client:c}=Tt(),h=Fo(),u=o?.funding,p=jy(vw),m=jy(Cw),g="solana"===u.chainType,y=g?void 0:u,f=s((()=>((e,t,n,r,a,i)=>{let o,s,l="solana"===n.chainType,c=l?void 0:n,d=n.isUSDC?"USDC":c?.erc20Address?void 0:"native-currency",h=!!l||d&&J(Number(n.chain.id),d),u=!!l||d&&Q(Number(n.chain.id),d),p=[];for(let o of(n.preferredCardProvider&&n.supportedOptions.sort((e=>e.provider===n.preferredCardProvider?-1:1)),n.supportedOptions))"card"===o.method&&"coinbase"===o.provider&&u&&p.push((()=>dw(t,n,r,a,i,"buy"))),"card"===o.method&&"moonpay"===o.provider&&h&&d&&p.push((()=>fw(t,n,e,d,r,a,i,"credit_debit_card")));for(let e of n.supportedOptions)"exchange"===e.method&&"coinbase"===e.provider&&u&&(o=()=>dw(t,n,r,a,i,"buy"));for(let e of i?.funding?.supportedOptions??[])"wallets"===e.method&&(s=()=>a(nw));return{onFundWithCard:p,onFundWithExchange:o,onFundWithWallet:s}})(h,c,u,l,i,o)),[h,c,u,o,l,i]);d((()=>{if(u?.defaultFundingMethod&&u.usingDefaultFundingMethod)switch(l({funding:{...u,usingDefaultFundingMethod:!1}}),u?.defaultFundingMethod){case"card":f.onFundWithCard[0]&&f.onFundWithCard[0]();break;case"exchange":f.onFundWithExchange&&f.onFundWithExchange();break;case"wallet":f.onFundWithWallet&&f.onFundWithWallet();break;case"manual":i(Fv)}}),[]),d((()=>{y?.erc20Address&&!y.erc20ContractInfo&&Hy({address:y.erc20Address,chain:y.chain,rpcConfig:h.rpcConfig,privyAppId:h.id}).then((e=>{l({...o,funding:{...y,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}})})).catch(console.error)}),[y?.erc20Address,y?.chain]);let w=g?a.find((({address:e})=>e===u.address)):r.find((({address:e})=>v(e)===v(u.address))),C=vo(w?.walletClientType||"unknown"),b=C?.name||"wallet",k=w&&"privy"!==w.walletClientType?b:h.name,T=!(!y?.erc20Address||y?.erc20ContractInfo);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/e("h3",{children:["Add funds to your"," ",k?.toLowerCase().endsWith("wallet")?k:k+" wallet"]}),/*#__PURE__*/e($f,{children:[u.errorMessage&&/*#__PURE__*/t(Dy,{theme:h.appearance.palette.colorScheme,children:u.errorMessage}),f.onFundWithCard?.[0]&&/*#__PURE__*/e(_s,{disabled:T,onClick:f.onFundWithCard[0],children:[/*#__PURE__*/t(jf,{children:/*#__PURE__*/t(nr,{style:{width:24}})}),"Pay with card",p?/*#__PURE__*/t(zy,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):m?/*#__PURE__*/t($y,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):null]}),f.onFundWithExchange&&/*#__PURE__*/e(_s,{disabled:T,onClick:f.onFundWithExchange,children:[/*#__PURE__*/t(jf,{children:/*#__PURE__*/t(ar,{style:{width:24}})}),"Transfer from an exchange"]}),f.onFundWithWallet&&/*#__PURE__*/e(_s,{disabled:T,onClick:f.onFundWithWallet,children:[/*#__PURE__*/t(jf,{children:/*#__PURE__*/t(Vy,{style:{width:24}})}),"Transfer from wallet"]}),/*#__PURE__*/e(_s,{disabled:T,onClick:()=>i(Fv),children:[/*#__PURE__*/t(jf,{children:/*#__PURE__*/t(rr,{style:{width:24}})}),"Receive funds"]}),u?.showAlternateFundingMethod&&f.onFundWithCard?.[1]&&/*#__PURE__*/t(cy,{theme:h.appearance.palette.colorScheme,children:/*#__PURE__*/e(Yf,{children:["Having trouble or facing location restrictions?"," ",/*#__PURE__*/t(Jf,{onClick:f.onFundWithCard[1],children:"Try a different provider."})]})})]}),/*#__PURE__*/t(Js,{})]})}},kw="moonpay";function Tw(e){return parseFloat(e)}function xw(e){return!!e&&void 0!==e.config&&void 0!==e.provider}function Aw(e){return!!e&&(void 0!==e.chain||void 0!==e.amount)}const Iw={[E.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[X.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[V.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[ee.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[H.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[te.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[z.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[ne.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[B.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[re.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[D.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[ae.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"},_w=({address:e,appConfig:t,fundWalletConfig:n,methodScreen:r,chainIdOverride:a,comingFromSendTransactionScreen:i=!1})=>{let o,s;if(!t.fundingConfig)throw Error("Wallet funding is not enabled");let l=Ry(t.fundingConfig.options);if(l.length<1)throw Error("Wallet funding is not enabled");o=a||(Aw(n)&&n.chain?n.chain.id:Xd(t.fundingConfig.defaultRecommendedCurrency.chain));let c=t.chains.find((e=>e.id===o));if(!c)throw new de(`Funding chain ${o} is not in PrivyProvider chains list`);let d=Aw(n)&&n.amount?n.amount:t.fundingConfig.defaultRecommendedAmount,h=!1;function u(){if(!o)return;let e=Iw[o];l.find((e=>"wallets"===e.method))&&!e&&console.warn("Attempting to fund with USDC on chain where USDC address is not known. Funding via external wallet will be disabled."),s=e,h=!0}Aw(n)&&"asset"in n?"USDC"===n.asset?u():"string"!=typeof n.asset&&"erc20"in n.asset&&(h=((e,t)=>e===Iw[t.id])(s=n.asset.erc20,c)):"USDC"===t.fundingConfig.defaultRecommendedCurrency.asset&&u();let p=n?.defaultFundingMethod;return{chainType:"ethereum",address:e,amount:d,chain:c,erc20Address:s,erc20ContractInfo:h?{symbol:"USDC",decimals:6}:void 0,isUSDC:h,methodScreen:r,supportedOptions:l,comingFromSendTransactionScreen:i,defaultFundingMethod:p,usingDefaultFundingMethod:!!p,preferredCardProvider:n?.card?.preferredProvider,crossChainBridgingEnabled:t.fundingConfig.crossChainBridgingEnabled??!1,cluster:{name:"mainnet-beta",rpcUrl:t.solanaClusters["mainnet-beta"].rpcUrl},...xw(n)?{moonpayConfigOverride:n.config}:{},uiConfig:n&&"uiConfig"in n?n.uiConfig:void 0}};function Ew({address:e,fundWalletConfig:t,appConfig:n,comingFromSendTransactionScreen:r,methodScreen:a}){if(!n.fundingConfig)throw Error("Wallet funding is not enabled");let i=Ry(n.fundingConfig.options);if(i.length<1)throw Error("Wallet funding is not enabled");if("USDC"===t?.asset&&"testnet"===t?.cluster?.name)throw Error("USDC funding is not supported on the Solana testnet");let o=t?.amount??n.fundingConfig.defaultRecommendedAmount,s=t?.defaultFundingMethod;return{chainType:"solana",address:e,supportedOptions:i,amount:o,isUSDC:"USDC"===t?.asset,methodScreen:a,comingFromSendTransactionScreen:r,cluster:{name:t?.cluster?.name??"mainnet-beta",rpcUrl:n.solanaClusters[t?.cluster?.name??"mainnet-beta"].rpcUrl},crossChainBridgingEnabled:n.fundingConfig.crossChainBridgingEnabled??!1,defaultFundingMethod:s,preferredCardProvider:t?.card?.preferredProvider,usingDefaultFundingMethod:!!s,uiConfig:t?.uiConfig}}const Sw=({children:n,theme:r})=>/*#__PURE__*/e(Nw,{$theme:r,children:[/*#__PURE__*/t(gn,{width:"1.25rem",color:"dark"===r?"#FDE68A":"var(--privy-color-warn)"}),n]});let Nw=/*#__PURE__*/en.div.withConfig({displayName:"Container",componentId:"sc-97f152b3-0"})(["display:flex;gap:0.5rem;background-color:",";"," align-items:flex-start;text-align:left;padding:0.5rem 0.75rem;font-size:0.8125rem;font-weight:400;line-height:1.125rem;padding:0.75rem;&&{border-radius:var(--privy-border-radius-sm);}"],(e=>"dark"===e.$theme?"var(--privy-color-background-2)":"var(--privy-color-warn-light)"),(e=>"dark"===e.$theme?"color: #FDE68A;":""));function Mw(n){let[r,a]=o(n.dimensions.width),[s,l]=o(void 0),c=i(null);d((()=>{if(c.current&&void 0===r){let{width:e}=c.current.getBoundingClientRect();a(e)}let e=getComputedStyle(document.documentElement);l({background:e.getPropertyValue("--privy-color-background"),background2:e.getPropertyValue("--privy-color-background-2"),foreground3:e.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:e.getPropertyValue("--privy-color-foreground-accent"),accent:e.getPropertyValue("--privy-color-accent"),accentDark:e.getPropertyValue("--privy-color-accent-dark"),success:e.getPropertyValue("--privy-color-success"),colorScheme:e.getPropertyValue("color-scheme")})}),[]);let h="ethereum"===n.walletToExport.chainType&&!n.walletToExport.imported;/*#__PURE__*/return t("div",{ref:c,children:r&&
23
+ /*#__PURE__*/e(Uw,{children:[/*#__PURE__*/t("iframe",{style:{position:"absolute",zIndex:1},width:r,height:n.dimensions.height,allow:"clipboard-write self *",src:Lr(n.origin,`/apps/${n.appId}/embedded-wallets/export`,{client_id:n.appClientId,primaryAddress:n.primaryWallet.address,address:n.walletToExport.address,walletIndex:n.walletToExport.walletIndex,width:`${r}px`,caid:n.clientAnalyticsId,phrase_export:h,...s},{token:n.accessToken})}),/*#__PURE__*/t(Ow,{children:"Loading..."}),h&&/*#__PURE__*/t(Ow,{children:"Loading..."})]})})}const Pw={component:()=>{let[r,a]=o(null),{authenticated:i,user:s,getAccessToken:l}=us(),{closePrivyModal:c,createAnalyticsEvent:h,clientAnalyticsId:u}=Tt(),p=Fo(),{data:m,onUserCloseViaDialogOrKeybindRef:g}=$o(),{onFailure:y,onSuccess:f,origin:w,appId:v,appClientId:C,walletToExport:b,primaryWallet:k}=m.keyExport,T=e=>{c({shouldCallAuthOnSuccess:!1}),y("string"==typeof e?Error(e):e)},x=()=>{c({shouldCallAuthOnSuccess:!1}),f(),h({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:b.address}})};return d((()=>{if(!i||!b)return T("User must be authenticated before exporting their wallet");l().then(a,T)}),[i,s]),g.current=x,/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:x}),/*#__PURE__*/e(Ww,{children:[/*#__PURE__*/t(ay,{children:"Transfer wallet"}),/*#__PURE__*/e(ry,{children:["Either copy your private key or seed phrase to transfer your wallet."," ",/*#__PURE__*/t("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),/*#__PURE__*/t(Sw,{theme:p.appearance.palette.colorScheme,children:"Never share your private key or seed phrase with anyone."}),/*#__PURE__*/t(gy,{isLoading:!1,isPulsing:!1,title:"Your wallet",address:b.address,showIcon:!0}),/*#__PURE__*/t("div",{style:{width:"100%"},children:r&&/*#__PURE__*/t(Mw,{origin:w,appId:v,appClientId:C,accessToken:r,clientAnalyticsId:u,walletToExport:b,primaryWallet:k,dimensions:{height:"44px"}})})]}),/*#__PURE__*/t(Js,{})]})}};let Ww=/*#__PURE__*/en.div.withConfig({displayName:"EmbeddedWalletScreenContainer",componentId:"sc-ab6268d6-0"})(["display:flex;flex-direction:column;gap:1.25rem;text-align:left;"]),Uw=/*#__PURE__*/en.div.withConfig({displayName:"ButtonContainer",componentId:"sc-ab6268d6-1"})(["overflow:visible;position:relative;overflow:none;height:44px;display:flex;gap:12px;"]),Ow=/*#__PURE__*/en.div.withConfig({displayName:"LoadingButton",componentId:"sc-ab6268d6-2"})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:16px;font-weight:500;border-radius:var(--privy-border-radius-md);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);"]);const Lw={component:()=>{let{authenticated:r,user:a,getAccessToken:i}=us(),{closePrivyModal:l,createAnalyticsEvent:c,walletProxy:h}=Tt(),{navigate:u,data:p,setModalData:m,onUserCloseViaDialogOrKeybindRef:g}=$o(),y=s((()=>Date.now()),[]),[f,w]=o(!1),{onCompleteNavigateTo:v,onFailure:C,shouldForceMFA:b,entropyId:k,entropyIdVerifier:T,recoveryMethod:x,connectingWalletAddress:A,isUnifiedWallet:I=!1}=p?.connectWallet,_=e=>{f||(w(!0),C("string"==typeof e?Error(e):e))};d((()=>{let e;return r?h?((async()=>{let t=await i();if(!t)return _("User must be authenticated and have a Privy wallet before it can be connected");try{I||await h.connect({accessToken:t,entropyId:k,entropyIdVerifier:T}),b&&await h.verifyMfa({accessToken:t});let n=(Date.now()-y)/1e3;v===Pw&&n<1?e=setTimeout((()=>{u(v,!1)}),1e3*(1-n)):u(v,!1)}catch(e){if(Gc(e)&&"privy"===x){let e=await i();if(!e)return _("User must be authenticated and have a Privy wallet before it can be recovered");try{c({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:A}});let t=await(h?.recover({accessToken:e,entropyId:k,entropyIdVerifier:T}));t?.entropyId||_(Error("Unable to recover wallet")),v?u(v):l({shouldCallAuthOnSuccess:!1}),c({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:A}}),u(v)}catch(e){_("An error has occurred, please try again.")}}else Gc(e)&&"privy"!==x&&"privy-v2"!==x?(m({...p,recoverWallet:{entropyId:k,entropyIdVerifier:T,onCompleteNavigateTo:v,onFailure:C},recoveryOAuthStatus:{provider:x,action:"recover",isInAccountCreateFlow:!1,shouldCreateEth:!1,shouldCreateSol:!1}}),u(ly(x))):_(e)}})(),()=>clearTimeout(e)):void 0:_("User must be authenticated and have a Privy wallet before it can be connected")}),[r,a,h]);let E=()=>{_("User exited before wallet could be connected"),l({shouldCallAuthOnSuccess:!1})};return g.current=E,/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:E}),f?/*#__PURE__*/e(n,{children:[/*#__PURE__*/e(ic,{children:[/*#__PURE__*/t(Bn,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),/*#__PURE__*/t(hh,{title:"Something went wrong",description:"We’re on it. Please try again later."})]}),/*#__PURE__*/t(Fs,{onClick:()=>l({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):/*#__PURE__*/t(kp,{}),/*#__PURE__*/t(Rw,{})]})}};let Rw=/*#__PURE__*/en.div.withConfig({displayName:"BottomSpacing",componentId:"sc-1ec92f42-0"})(["height:44px;"]);const Fw=/*#__PURE__*/en(ef).withConfig({displayName:"InteractiveLabel",componentId:"sc-b57d0824-0"})(["cursor:pointer;display:inline-flex;gap:8px;align-items:center;color:var(--privy-color-accent);svg{fill:var(--privy-color-accent);}"]);var Dw=({iconUrl:n,value:r,symbol:a,usdValue:i,nftName:o,nftCount:s,$isLoading:l})=>l?/*#__PURE__*/t(Bw,{$isLoading:l}):/*#__PURE__*/e("div",{children:[/*#__PURE__*/e(Bw,{$isLoading:l,children:[n&&/*#__PURE__*/t($w,{src:n,alt:"Token icon"}),s&&s>1?s+"x":void 0," ",o,r," ",a]}),i&&/*#__PURE__*/e(zw,{$isLoading:l,children:["$",i]})]});let Bw=/*#__PURE__*/en.span.withConfig({displayName:"Value",componentId:"sc-f3c0f2da-0"})(["color:var(--privy-color-foreground);font-size:0.875rem;font-weight:500;line-height:1.375rem;word-break:break-all;text-align:right;display:flex;justify-content:flex-end;",""],Op);const zw=/*#__PURE__*/en.span.withConfig({displayName:"Subvalue",componentId:"sc-f3c0f2da-1"})(["color:var(--privy-color-foreground-2);font-size:12px;font-weight:400;line-height:18px;word-break:break-all;text-align:right;display:flex;justify-content:flex-end;",""],Op);let $w=/*#__PURE__*/en.img.withConfig({displayName:"TokenIcon",componentId:"sc-f3c0f2da-2"})(["height:14px;width:14px;margin-right:4px;object-fit:contain;"]);const jw=r=>{let{chain:a,transactionDetails:i,isTokenContractInfoLoading:o,symbol:s}=r,{action:l,functionName:c}=i;/*#__PURE__*/return t(my,{children:/*#__PURE__*/e(Qy,{children:["transaction"!==l&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Action"}),/*#__PURE__*/t(nf,{children:c})]}),"mint"===c&&"args"in i&&i.args.filter((e=>e)).map(((n,r)=>/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:`Param ${r}`}),/*#__PURE__*/t(nf,{children:"string"==typeof n&&Vt(n)?/*#__PURE__*/t(Vu,{address:n,url:a?.blockExplorers?.default?.url,showCopyIcon:!1}):n?.toString()})]},r))),"setApprovalForAll"===c&&i.operator&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Operator"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:i.operator,url:a?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),"setApprovalForAll"===c&&void 0!==i.approved&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Set approval to"}),/*#__PURE__*/t(nf,{children:i.approved?"true":"false"})]}),"transfer"===c||"transferFrom"===c||"safeTransferFrom"===c||"approve"===c?/*#__PURE__*/e(n,{children:["formattedAmount"in i&&i.formattedAmount&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Amount"}),/*#__PURE__*/e(nf,{$isLoading:o,children:[i.formattedAmount," ",s]})]}),"tokenId"in i&&i.tokenId&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token ID"}),/*#__PURE__*/t(nf,{children:i.tokenId.toString()})]})]}):null,"safeBatchTransferFrom"===c&&/*#__PURE__*/e(n,{children:["amounts"in i&&i.amounts&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Amounts"}),/*#__PURE__*/t(nf,{children:i.amounts.join(", ")})]}),"tokenIds"in i&&i.tokenIds&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token IDs"}),/*#__PURE__*/t(nf,{children:i.tokenIds.join(", ")})]})]}),"approve"===c&&i.spender&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Spender"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:i.spender,url:a?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&i.transferFrom&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Transferring from"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:i.transferFrom,url:a?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&i.transferTo&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Transferring to"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:i.transferTo,url:a?.blockExplorers?.default?.url,showCopyIcon:!1})})]})]})})};let Vw={success:"background: var(--privy-color-success-lightest, #dcfce7);",warn:"background: var(--privy-color-warn-lightest, #fff7e6);",error:"background: var(--privy-color-error-lightest, #fde8e8);"};const Hw=/*#__PURE__*/en.div.withConfig({displayName:"Pill",componentId:"sc-8c138024-0"})(["border-radius:var(--privy-border-radius-md,8px);padding:12px;text-align:left;margin-top:23px;",""],(e=>Vw[e.variant])),qw=({variant:n,setPreventMaliciousTransaction:r,preventMaliciousTransaction:a})=>"warn"===n?/*#__PURE__*/t(Hw,{variant:n,children:/*#__PURE__*/e("div",{className:"flex flex-row",children:[/*#__PURE__*/t(Kw,{$variant:n}),/*#__PURE__*/e("p",{children:[/*#__PURE__*/t("b",{children:"Warning: Suspicious transaction"}),/*#__PURE__*/t("br",{}),"This has been flagged as a potentially deceptive request. Approving could put your assets or funds at risk."]})]})}):"error"===n?/*#__PURE__*/t(Hw,{variant:n,children:/*#__PURE__*/e("div",{className:"flex flex-col",children:[/*#__PURE__*/e("div",{className:"flex flex-row",children:[/*#__PURE__*/t(Kw,{$variant:n}),/*#__PURE__*/e("p",{children:[/*#__PURE__*/t("b",{children:"This is a malicious transaction"}),/*#__PURE__*/t("br",{}),"This transaction transfers tokens to a known malicious address. Proceeding may result in the loss of valuable assets."]})]}),/*#__PURE__*/e("div",{className:"mt-3 flex flex-row gap-2",children:[/*#__PURE__*/t(Gh,{color:"var(--privy-color-error)",checked:!a,readOnly:!0,onClick:()=>r(!a)}),/*#__PURE__*/t("p",{children:"I understand and want to proceed anyways."})]})]})}):void 0;let Kw=/*#__PURE__*/en(gn).withConfig({displayName:"StyledExclamationTriangleIcon",componentId:"sc-91effb27-0"})(["width:20px;height:20px;stroke-width:2px;flex-shrink:0;display:inline-block;margin-right:8px;",";"],(({$variant:e})=>"error"===e?"color: var(--privy-color-error)":"color: var(--privy-color-warn)"));const Zw=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,Gw=({img:r,submitError:a,prepareError:i,onClose:s,action:l,title:c,subtitle:d,txValue:h,to:u,tokenAddress:p,network:m,missingFunds:g,fee:y,from:f,cta:w,disabled:v,chain:C,isSubmitting:b,isPreparing:k,isTokenPriceLoading:T,isTokenContractInfoLoading:x,isSponsored:A,symbol:I,balance:_,onClick:E,transactionDetails:S,transactionIndex:N,maxIndex:M,onBack:P,chainName:W,validation:U,hasScanDetails:O,setIsScanDetailsOpen:L,preventMaliciousTransaction:R,setPreventMaliciousTransaction:F,tokensSent:D,tokensReceived:B,isScanning:z,isCancellable:$})=>{let{showTransactionDetails:j,setShowTransactionDetails:V,hasMoreDetails:H,isErc20Ish:q}=(e=>{let[t,n]=o(!1),r=!0,a=!1;return(!e||e.isErc20Ish||"transaction"===e.action)&&(r=!1),r&&(a=Object.entries(e||{}).some((([e,t])=>t&&!["action","isErc20Ish","isNFTIsh"].includes(e)))),{showTransactionDetails:t,setShowTransactionDetails:n,hasMoreDetails:r&&a,isErc20Ish:e?.isErc20Ish}})(S),K=q&&x||k||T||z;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:s,backFn:P}),r&&/*#__PURE__*/t(ev,{children:r}),/*#__PURE__*/e(ay,{style:{marginTop:r?"1.5rem":0},children:[c,/*#__PURE__*/t(Zw,{maxIndex:M,transactionIndex:N})]}),/*#__PURE__*/t(ry,{children:d}),/*#__PURE__*/e(Qy,{style:{marginTop:"2rem"},children:[(!!D[0]||K)&&/*#__PURE__*/e(Xy,{children:[B.length>0?/*#__PURE__*/t(ef,{children:"Send"}):/*#__PURE__*/t(ef,{children:"Amount"}),/*#__PURE__*/t("div",{className:"flex flex-col",children:D.map(((e,n)=>/*#__PURE__*/t(Dw,{iconUrl:e.iconUrl,value:e.value,usdValue:e.usdValue,symbol:e.symbol,nftName:e.nftName,nftCount:e.nftCount},n)))})]}),B.length>0&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Receive"}),/*#__PURE__*/t("div",{className:"flex flex-col",children:B.map(((e,n)=>/*#__PURE__*/t(Dw,{iconUrl:e.iconUrl,value:e.value,usdValue:e.usdValue,symbol:e.symbol,nftName:e.nftName,nftCount:e.nftCount},n)))})]}),S&&"spender"in S&&S?.spender?/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Spender"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:S.spender,url:C?.blockExplorers?.default?.url})})]}):null,u&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"To"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:u,url:C?.blockExplorers?.default?.url})})]}),p&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token address"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:p,url:C?.blockExplorers?.default?.url})})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Network"}),/*#__PURE__*/t(nf,{children:m})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Estimated fee"}),/*#__PURE__*/t(nf,{$isLoading:k||T||void 0===A,children:A?"Sponsored":y})]}),H&&!O&&/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(Xy,{className:"cursor-pointer",onClick:()=>V(!j),children:/*#__PURE__*/e(tf,{className:"flex items-center gap-x-1",children:["Details"," ",/*#__PURE__*/t(sr,{style:{width:"0.75rem",marginLeft:"0.25rem",transform:j?"rotate(180deg)":void 0}})]})}),j&&S&&/*#__PURE__*/t(jw,{action:l,chain:C,transactionDetails:S,isTokenContractInfoLoading:x,symbol:I})]}),O&&/*#__PURE__*/t(Xy,{children:/*#__PURE__*/e(Fw,{onClick:()=>L(!0),children:[/*#__PURE__*/t("span",{className:"text-color-primary",children:"Details"}),/*#__PURE__*/t(lr,{height:"14px",width:"14px",strokeWidth:"2"})]})})]}),/*#__PURE__*/t(bs,{}),a?/*#__PURE__*/t(Og,{style:{marginTop:"2rem"},children:a.message}):i&&0===N?
24
+ /*#__PURE__*/t(Og,{style:{marginTop:"2rem"},children:i.shortMessage??Xw}):null,/*#__PURE__*/t(qw,{variant:U,preventMaliciousTransaction:R,setPreventMaliciousTransaction:F}),/*#__PURE__*/t(Jw,{$useSmallMargins:!(!i&&!a&&"warn"!==U&&"error"!==U),title:Number(h)>0?void 0:!1!==A?"Your wallet":void 0,address:f,balance:_,isLoading:k||T,errMsg:k||i||a||!g?void 0:`Add funds on ${C?.name??W} to complete transaction.`}),/*#__PURE__*/t(Fs,{style:{marginTop:"1rem"},loading:b,disabled:v||k,onClick:E,children:w}),$&&/*#__PURE__*/t(qs,{style:{marginTop:"1rem"},onClick:s,isSubmitting:!1,children:"Not now"}),/*#__PURE__*/t(Js,{})]})},Yw=({img:r,title:a,subtitle:i,cta:s,instructions:l,network:c,blockExplorerUrl:d,isMissingFunds:h,submitError:u,parseError:p,total:m,swap:g,transactingWalletAddress:y,fee:f,balance:w,disabled:v,isSubmitting:C,isPreparing:b,isTokenPriceLoading:k,onClick:T,onClose:x,onBack:A})=>{let I=b||k,[_,E]=o(!1);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:x,backFn:A}),r&&/*#__PURE__*/t(ev,{children:r}),/*#__PURE__*/t(ay,{style:{marginTop:r?"1.5rem":0},children:a}),/*#__PURE__*/t(ry,{children:i}),/*#__PURE__*/e(Qy,{style:{marginTop:"2rem",marginBottom:".5rem"},children:[(m||I)&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Amount"}),/*#__PURE__*/t(nf,{$isLoading:I,children:m})]}),g&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Swap"}),/*#__PURE__*/t(nf,{children:g})]}),c&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Network"}),/*#__PURE__*/t(nf,{children:c})]}),(f||I)&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Estimated fee"}),/*#__PURE__*/t(nf,{$isLoading:I,children:f})]})]}),/*#__PURE__*/t(Xy,{children:/*#__PURE__*/e(Fw,{onClick:()=>E((e=>!e)),children:[/*#__PURE__*/t("span",{children:"Advanced"}),/*#__PURE__*/t(sr,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:_?"rotate(180deg)":void 0}})]})}),_&&/*#__PURE__*/t(n,{children:l.map(((n,r)=>"sol-transfer"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/e(uy,{children:["Transfer ",n.withSeed?"with seed":""]})}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Amount"}),/*#__PURE__*/e(nf,{children:[ie({amount:n.value,decimals:n.token.decimals})," ",n.token.symbol]})]}),!!n.toAccount&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Destination"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.toAccount,url:d})})]})]},r):"spl-transfer"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/e(uy,{children:["Transfer ",n.token.symbol]})}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Amount"}),/*#__PURE__*/t(nf,{children:n.value.toString()})]}),!!n.fromAta&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Source"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.fromAta,url:d})})]}),!!n.toAta&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Destination"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.toAta,url:d})})]}),!!n.token.address&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.token.address,url:d})})]})]},r):"ata-creation"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/t(uy,{children:"Create token account"})}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Program ID"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.program,url:d})})]}),!!n.owner&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Owner"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.owner,url:d})})]})]},r):"create-account"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/e(uy,{children:["Create account ",n.withSeed?"with seed":""]})}),!!n.account&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Account"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.account,url:d})})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Amount"}),/*#__PURE__*/e(nf,{children:[ie({amount:n.value,decimals:9})," SOL"]})]})]},r):"spl-init-account"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/t(uy,{children:"Initialize token account"})}),!!n.account&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Account"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.account,url:d})})]}),!!n.mint&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Mint"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.mint,url:d})})]}),!!n.owner&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Owner"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.owner,url:d})})]})]},r):"spl-close-account"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/t(uy,{children:"Close token account"})}),!!n.source&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Source"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.source,url:d})})]}),!!n.destination&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Destination"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.destination,url:d})})]}),!!n.owner&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Owner"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.owner,url:d})})]})]},r):"spl-sync-native"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/t(uy,{children:"Sync native"})}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Program ID"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.program,url:d})})]})]},r):"raydium-swap-base-input"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/e(uy,{children:["Raydium swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Amount in"}),/*#__PURE__*/t(nf,{children:n.amountIn.toString()})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Minimum amount out"}),/*#__PURE__*/t(nf,{children:n.minimumAmountOut.toString()})]}),n.mintIn&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token in"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token out"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.mintOut,url:d})})]})]},r):"raydium-swap-base-output"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/e(uy,{children:["Raydium swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Max amount in"}),/*#__PURE__*/t(nf,{children:n.maxAmountIn.toString()})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Amount out"}),/*#__PURE__*/t(nf,{children:n.amountOut.toString()})]}),n.mintIn&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token in"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token out"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.mintOut,url:d})})]})]},r):"jupiter-swap-shared-accounts-route"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/e(uy,{children:["Jupiter swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"In amount"}),/*#__PURE__*/t(nf,{children:n.inAmount.toString()})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Quoted out amount"}),/*#__PURE__*/t(nf,{children:n.quotedOutAmount.toString()})]}),n.mintIn&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token in"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token out"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.mintOut,url:d})})]})]},r):"jupiter-swap-exact-out-route"===n.type?/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/t(Xy,{children:/*#__PURE__*/e(uy,{children:["Jupiter swap"," ",n.tokenIn&&n.tokenOut?`${n.tokenIn.symbol} → ${n.tokenOut.symbol}`:""]})}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Quoted in amount"}),/*#__PURE__*/t(nf,{children:n.quotedInAmount.toString()})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Amount out"}),/*#__PURE__*/t(nf,{children:n.outAmount.toString()})]}),n.mintIn&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token in"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.mintIn,url:d})})]}),n.mintOut&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Token out"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.mintOut,url:d})})]})]},r):/*#__PURE__*/e(Qw,{children:[/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Program ID"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Vu,{address:n.program,url:d})})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Data"}),/*#__PURE__*/t(nf,{children:n.discriminator})]})]},r)))}),/*#__PURE__*/t(bs,{}),u?/*#__PURE__*/t(Og,{style:{marginTop:"2rem"},children:u.message}):p?/*#__PURE__*/t(Og,{style:{marginTop:"2rem"},children:Xw}):null,/*#__PURE__*/t(Jw,{$useSmallMargins:!(!p&&!u),title:"Your wallet",address:y,balance:w,isLoading:b||k,errMsg:b||p||u||!h?void 0:"Add funds on Solana to complete transaction."}),/*#__PURE__*/t(Fs,{style:{marginTop:"1rem"},loading:C,disabled:v||b,onClick:T,children:s}),/*#__PURE__*/t(Js,{})]})};let Jw=/*#__PURE__*/en(gy).withConfig({displayName:"StyledWalletInfoCard",componentId:"sc-c5b70898-0"})(["",""],(e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;")),Qw=/*#__PURE__*/en(Qy).withConfig({displayName:"InstructionRows",componentId:"sc-c5b70898-1"})(["margin-top:0.5rem;border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-sm);padding:0.5rem;"]),Xw="There was an error preparing your transaction. Your transaction request will likely fail.",ev=/*#__PURE__*/en.div.withConfig({displayName:"ImageContainer",componentId:"sc-c5b70898-2"})(["display:flex;width:100%;justify-content:center;max-height:40px;> img{object-fit:contain;border-radius:var(--privy-border-radius-sm);}"]),tv=()=>/*#__PURE__*/e(ov,{children:[/*#__PURE__*/t(lv,{}),/*#__PURE__*/t(sv,{})]});const nv=({transactionError:r,chainId:a,onClose:i,onRetry:s,network:l,connection:c,transactionHash:d})=>{let{chains:h}=Tt(),[u,p]=o(!1),{errorCode:m,errorMessage:g}=((e,t)=>{if("ethereum"===t)return{errorCode:e.details??e.message,errorMessage:e.shortMessage};let n=e.txSignature,r=e?.transactionMessage||"Something went wrong.";if(Array.isArray(e.logs)){let t=e.logs.find((e=>/insufficient (lamports|funds)/gi.test(e)));t&&(r=t)}return{transactionHash:n,errorMessage:r}})(r,l),y=(({chains:e,chainId:t,network:n,connection:r,transactionHash:a})=>"ethereum"===n?e.find((e=>e.id===t))?.blockExplorers?.default.url??"https://etherscan.io":function(e,t){return`https://explorer.solana.com/tx/${e}?cluster=${t}`}(a||"",Eo(r?.rpcEndpoint||"")))({chains:h,chainId:a,network:l,connection:c,transactionHash:d});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:i}),/*#__PURE__*/e(rv,{children:[/*#__PURE__*/t(tv,{}),/*#__PURE__*/t(av,{children:m}),/*#__PURE__*/t(iv,{children:"Please try again."}),/*#__PURE__*/e(hv,{children:[/*#__PURE__*/t(dv,{children:"Error message"}),/*#__PURE__*/t(pv,{$clickable:!1,children:g})]}),d&&/*#__PURE__*/e(hv,{children:[/*#__PURE__*/t(dv,{children:"Transaction hash"}),/*#__PURE__*/e(uv,{children:["Copy this hash to view details about the transaction on a"," ",/*#__PURE__*/t("u",{children:/*#__PURE__*/t("a",{href:y,children:"block explorer"})}),"."]}),/*#__PURE__*/e(pv,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(d),p(!0)},children:[d,/*#__PURE__*/t(yv,{clicked:u})]})]}),/*#__PURE__*/t(cv,{onClick:()=>s({resetNonce:!!d}),children:"Retry transaction"})]}),/*#__PURE__*/t(Qs,{})]})};let rv=/*#__PURE__*/en.div.withConfig({displayName:"TransactionErrorScreenContainer",componentId:"sc-92716bea-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;"]),av=/*#__PURE__*/en.span.withConfig({displayName:"ErrorCode",componentId:"sc-92716bea-1"})(["color:var(--privy-color-foreground);text-align:center;font-size:1.125rem;font-weight:500;line-height:1.25rem;text-align:center;margin:10px;"]),iv=/*#__PURE__*/en.span.withConfig({displayName:"Subtitle",componentId:"sc-92716bea-2"})(["margin-top:4px;margin-bottom:10px;color:var(--privy-color-foreground-3);text-align:center;font-size:0.875rem;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;"]),ov=/*#__PURE__*/en.div.withConfig({displayName:"CircleContainer",componentId:"sc-92716bea-3"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]),sv=/*#__PURE__*/en(Rn).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-92716bea-4"})(["position:absolute;width:35px;height:35px;color:var(--privy-color-error);"]),lv=/*#__PURE__*/en.div.withConfig({displayName:"StyledRedCircle",componentId:"sc-92716bea-5"})(["position:absolute;width:60px;height:60px;border-radius:50%;background-color:var(--privy-color-error);opacity:0.1;"]),cv=/*#__PURE__*/en(Fs).withConfig({displayName:"RetryButton",componentId:"sc-92716bea-6"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]),dv=/*#__PURE__*/en.span.withConfig({displayName:"TextBoxTitle",componentId:"sc-92716bea-7"})(["width:100%;text-align:left;font-size:0.825rem;color:var(--privy-color-foreground);padding:4px;"]),hv=/*#__PURE__*/en.div.withConfig({displayName:"TextBoxContainer",componentId:"sc-92716bea-8"})(["width:100%;margin:5px;display:flex;flex-direction:column;justify-content:center;align-items:center;"]),uv=/*#__PURE__*/en.text.withConfig({displayName:"HelperText",componentId:"sc-92716bea-9"})(["position:relative;width:100%;padding:5px;font-size:0.8rem;color:var(--privy-color-foreground-3);text-align:left;word-wrap:break-word;"]),pv=/*#__PURE__*/en.span.withConfig({displayName:"TextBox",componentId:"sc-92716bea-10"})(["position:relative;width:100%;background-color:var(--privy-color-background-2);padding:8px 12px;border-radius:10px;margin-top:5px;font-size:14px;color:var(--privy-color-foreground-3);text-align:left;word-wrap:break-word;",""],(e=>e.$clickable&&"cursor: pointer;\n transition: background-color 0.3s;\n padding-right: 45px;\n\n &:hover {\n background-color: var(--privy-color-foreground-4);\n }")),mv=/*#__PURE__*/en(cr).withConfig({displayName:"StyledClipboardIcon",componentId:"sc-92716bea-11"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),gv=/*#__PURE__*/en(Jn).withConfig({displayName:"StyledClipboardCheckIcon",componentId:"sc-92716bea-12"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),yv=({clicked:e})=>/*#__PURE__*/t(e?gv:mv,{});const fv=({instruction:n,fees:r,transactionInfo:a,solPrice:i,rpcEndpoint:o})=>/*#__PURE__*/e(Qy,{children:[a?.action&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Action"}),/*#__PURE__*/t(nf,{children:a.action})]}),null!=n?.total&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Total"}),/*#__PURE__*/t(nf,{children:n.total})]}),!n?.total&&null!=n?.amount&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Total"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Yl,{quantities:[n.amount,r],tokenPrice:i})})]}),/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"Fees"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Yl,{quantities:[r],tokenPrice:i})})]}),n?.to&&/*#__PURE__*/e(Xy,{children:[/*#__PURE__*/t(ef,{children:"To"}),/*#__PURE__*/t(nf,{children:/*#__PURE__*/t(Uc,{walletAddress:n.to,rpcEndpoint:o,network:"solana"})})]})]}),wv=({fees:r,onClose:a,receiptHeader:i,receiptDescription:o,transactionInfo:s,solPrice:l,rpcEndpoint:c,signOnly:d,instruction:h})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:a}),/*#__PURE__*/t(Cd,{style:{marginBottom:"16px"},children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Du,{color:"var(--privy-color-success-light)"}),/*#__PURE__*/t(er,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-success)"})]})}),/*#__PURE__*/t(hh,{title:i??`Transaction ${d?"signed":"complete"}!`,description:o??"You're all set."}),/*#__PURE__*/t(fv,{solPrice:l,instruction:h,fees:r,transactionInfo:s,rpcEndpoint:c}),/*#__PURE__*/t(bs,{}),/*#__PURE__*/t(vv,{loading:!1,onClick:a,children:"Close"}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]});let vv=/*#__PURE__*/en(Fs).withConfig({displayName:"SubmitButton",componentId:"sc-df6d4eec-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const Cv={component:()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:n,setModalData:r,navigate:a}=$o(),{client:i,closePrivyModal:l,walletProxy:c,showFiatPrices:h}=Tt(),u=Fo(),{user:p}=us(),[m,g]=o(e?.sendSolanaTransaction?.transactionRequest),[y,f]=o(),[w,v]=o(),[C,b]=o({value:0n,isLoading:!1}),[k,T]=o(!1),[x,A]=o(),[I,_]=o(),E=e?.sendSolanaTransaction?.connection,S=e?.sendSolanaTransaction?.transactingWallet,N=!!e?.sendSolanaTransaction?.signOnly,M=S?.imported?yi(p):wi(p),P=Eo(E?.rpcEndpoint||""),{solPrice:W,isSolPriceLoading:U}=Dc({enabled:h}),O=s((()=>{if(!y)return;let e=y.spender,t=Wl(y.fee),n=Wl(C.value,3,!0),r=y.instructions.filter((e=>["sol-transfer","spl-transfer","raydium-swap-base-input","raydium-swap-base-output","jupiter-swap-shared-accounts-route","jupiter-swap-exact-out-route"].includes(e.type))),a=r.at(0);if(!a||r.length>1)return{fee:t,spender:e,balance:n};if("sol-transfer"===a.type)return{fee:t,spender:e,balance:n,total:Wl(a.value)};if("spl-transfer"===a.type)return{fee:t,spender:e,balance:n,total:`${ie({amount:a.value,decimals:a.token.decimals})} ${a.token.symbol}`};if("raydium-swap-base-input"===a.type&&a.tokenIn&&a.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${ie({amount:a.amountIn,decimals:a.tokenIn.decimals})} ${a.tokenIn.symbol}`} → ${`${ie({amount:a.minimumAmountOut,decimals:a.tokenOut.decimals})} ${a.tokenOut.symbol}`}`}}if("raydium-swap-base-output"===a.type&&a.tokenIn&&a.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${ie({amount:a.maxAmountIn,decimals:a.tokenIn.decimals})} ${a.tokenIn.symbol}`} → ${`${ie({amount:a.amountOut,decimals:a.tokenOut.decimals})} ${a.tokenOut.symbol}`}`}}if("jupiter-swap-shared-accounts-route"===a.type&&a.tokenIn&&a.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${ie({amount:a.inAmount,decimals:a.tokenIn.decimals})} ${a.tokenIn.symbol}`} → ${`${ie({amount:a.quotedOutAmount,decimals:a.tokenOut.decimals})} ${a.tokenOut.symbol}`}`}}if("jupiter-swap-exact-out-route"===a.type&&a.tokenIn&&a.tokenOut){return{fee:t,spender:e,balance:n,swap:`${`${ie({amount:a.quotedInAmount,decimals:a.tokenIn.decimals})} ${a.tokenIn.symbol}`} → ${`${ie({amount:a.outAmount,decimals:a.tokenOut.decimals})} ${a.tokenOut.symbol}`}`}}return{fee:t,spender:e,balance:n}}),[y,S?.address,C]),L=s((()=>{let e;if(!y||!h||!W||U)return;function t(...e){return Ul(e.reduce(((e,t)=>e+t),0n),W??0)}S?.address===y.spender&&(e=t(y.fee));let n=t(C.value),r=y.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)).at(0);return!r||y.instructions.length>1?{fee:e,balance:n}:"sol-transfer"===r.type?{fee:e,balance:n,total:t(r.value,S?.address===y.spender?y.fee:0n)}:"spl-transfer"===r.type?{fee:e,balance:n,total:`${ie({amount:r.value,decimals:r.token.decimals})} ${r.token.symbol}`}:{fee:e,balance:n}}),[y,h,W,U,S?.address,C]);if(d((()=>{!async function(){if(m&&E&&i)try{v(void 0);let e=await $l({tx:m,connection:E,client:i,checkFunds:!N});f(e)}catch(e){console.error("Failed to prepare transaction",e),v(e)}}()}),[m,E,i,N]),d((()=>{(async function(){if(!S||!E)return;b({value:C.value,isLoading:!0});let e=new oe({name:"mainnet-beta",rpcUrl:E.rpcEndpoint});b({value:await e.getBalance(S.address).catch((()=>0n))??0n,isLoading:!1})})().catch(console.error)}),[y,E]),!(m&&e?.sendSolanaTransaction&&S&&E)){let n=Error("Invalid transaction request");/*#__PURE__*/return t(ap,{error:n,onClick:()=>{e?.sendSolanaTransaction?.onFailure(n),l({shouldCallAuthOnSuccess:!1})}})}let R=()=>{if(!k)return x?e?.sendSolanaTransaction?.onSuccess(x):e?.sendSolanaTransaction?.onFailure(I??w??Error("User exited the modal before submitting the transaction")),l({shouldCallAuthOnSuccess:!1})};n.current=R;let F=e.sendSolanaTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/t("img",{src:e.sendSolanaTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendSolanaTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,D=!!(e.funding&&e.funding.supportedOptions.length>0),B=!y?.hasFunds&&D;if(x){let n=y?.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)),r=1===n?.length?n?.at(0):void 0;/*#__PURE__*/return t(wv,{fees:x.fees,onClose:R,transactionInfo:e.sendSolanaTransaction?.uiOptions.transactionInfo,solPrice:W,receiptHeader:e.sendSolanaTransaction?.uiOptions.successHeader,receiptDescription:e.sendSolanaTransaction?.uiOptions.successDescription,rpcEndpoint:E.rpcEndpoint,signOnly:N,instruction:"sol-transfer"===r?.type?{to:r.toAccount,amount:r.value}:{to:r?.toAccount||r?.toAta,total:O?.total}})}return I?/*#__PURE__*/t(nv,{transactionError:I,connection:E,onClose:R,network:"solana",onRetry:async()=>{_(void 0);let{blockhash:e}=await E.getLatestBlockhash();Fl(m)?m.message.recentBlockhash=e:m.recentBlockhash=e,g(m)}}):/*#__PURE__*/t(Yw,{img:F,title:e.sendSolanaTransaction?.uiOptions?.transactionInfo?.title||"Confirm transaction",subtitle:e.sendSolanaTransaction?.uiOptions?.description||`${u.name} wants your permission to approve the following transaction.`,cta:B?"Add funds":e.sendSolanaTransaction?.uiOptions?.buttonText||"Approve",instructions:y?.instructions??[],network:"mainnet-beta"==P?"Solana":P,blockExplorerUrl:u.solanaClusters[P].blockExplorerUrl,total:h?L?.total:O?.total,fee:h?L?.fee:O?.fee,balance:h?L?.balance:O?.balance,swap:O?.swap,transactingWalletAddress:S.address,disabled:!y?.hasFunds&&!D,isSubmitting:k,isPreparing:!y||C.isLoading,isTokenPriceLoading:h&&U,isMissingFunds:!y?.hasFunds,submitError:I??void 0,parseError:w,onClick:B?async()=>{if(S){if(!D)throw Error("Funding wallet is not enabled");r({...e,funding:{...e.funding,methodScreen:bw}}),a(bw)}}:async()=>{try{if(T(!0),k||!S||!c||!p||!M)return;let t=await e.sendSolanaTransaction.onConfirm();A(t)}catch(e){console.warn({transaction:m,error:e}),_(e)}finally{T(!1)}},onClose:R})}},bv=({privy:e,appConfig:t,getAccessToken:n,isHeadlessSigning:r,emitPrivyEvent:a,setModalData:i,openModal:o,walletProxy:s,user:l,signWithUserSigner:c,recoverPrimaryWallet:d},{transaction:h,connection:u,transactionOptions:p,fundWalletConfig:m,uiOptions:g,address:y,signOnly:f})=>new Promise((async(w,v)=>{let{requesterAppId:C}=g||{},b=f?"signSolanaTransaction":"sendSolanaTransaction";if(!l)return a(b,"onError",ke.MUST_BE_AUTHENTICATED),void v(new de("User must be authenticated before signing with a Privy wallet",ke.MUST_BE_AUTHENTICATED));let k=y?fi(l,y):mi(l);if(!k)return a(b,"onError",ke.EMBEDDED_WALLET_NOT_FOUND),void v(new de("Must have a Privy wallet before signing",ke.EMBEDDED_WALLET_NOT_FOUND));let T=Ey(k);if(!await d().catch((()=>!1)))throw a(b,"onError",ke.EMBEDDED_WALLET_NOT_FOUND),new de(`Cannot sendSolanaTransaction before embedded wallet ${k.address} is connected`,ke.EMBEDDED_WALLET_NOT_FOUND);let x=async()=>{let t=await n();if(!t||!s)throw a(b,"onError",ke.EMBEDDED_WALLET_NOT_FOUND),v(new de("Must have valid access token and Privy wallet to send transaction",ke.EMBEDDED_WALLET_NOT_FOUND)),new de("Must have valid access token and Privy wallet to send transaction",ke.EMBEDDED_WALLET_NOT_FOUND);try{let n,i;if(!await d())throw a(b,"onError",ke.UNKNOWN_CONNECT_WALLET_ERROR),v(new de("Unable to connect to wallet",ke.UNKNOWN_CONNECT_WALLET_ERROR)),new de("Unable to connect to wallet",ke.UNKNOWN_CONNECT_WALLET_ERROR);if(r({showWalletUIs:g?.showWalletUIs})&&!f)try{if(!await zl(h,u))throw a(b,"onError",ke.INSUFFICIENT_BALANCE),v(new de("Solana wallet has insufficient funds for this transaction.",ke.INSUFFICIENT_BALANCE)),new de("Solana wallet has insufficient funds for this transaction.",ke.INSUFFICIENT_BALANCE)}catch(e){throw console.error(e),a(b,"onError",ke.TRANSACTION_FAILURE),v(new de(e instanceof Error?e.message:"Transaction failed.",ke.TRANSACTION_FAILURE)),new de(e instanceof Error?e.message:"Transaction failed.",ke.TRANSACTION_FAILURE)}let{entropyId:o,entropyIdVerifier:m}=bi(l);if(T){let t=Fl(h)?Ya(h.message.serialize()):h.serializeMessage(),r=await se(e,c,{chain_type:"solana",method:"signMessage",params:{message:t.toString("base64"),encoding:"base64"},wallet_id:k.id});if(!r.data||!("signature"in r.data))throw Error("Failed to sign transaction");h.addSignature(Dl(h,k.address),Ya(r.data.signature,"base64")),n=h}else n=await _y({accessToken:t,tx:h,walletProxy:s,entropyId:o,entropyIdVerifier:m,transactingWalletAddress:k.address,transactingWalletIndex:k.walletIndex??0});if(f)return i=Bl("",n,null),a("signSolanaTransaction","onSuccess",{signedTransaction:n}),i;{let{signature:e,receipt:t}=await async function({tx:e,connection:t,transactionOptions:n}){let r;try{let a=e.serialize();r=await t.sendRawTransaction(a,n);let i=await t.confirmTransaction(r);if(i.value.err||i.value.err){let e=i.value.err||i.value.err;if("string"==typeof e)throw Error(e);throw e}return{signature:r,signedTransaction:e,receipt:await t.getParsedTransaction(r,{maxSupportedTransactionVersion:0})}}catch(e){throw e.txSignature=r,e}}({tx:n,connection:u,transactionOptions:p});i=Bl(e,h,t),a("sendSolanaTransaction","onSuccess",{response:i})}return w(i),i}catch(e){throw a(b,"onError",ke.TRANSACTION_FAILURE),v(e),e}};if(r({showWalletUIs:g?.showWalletUIs}))x();else{let{entropyId:e,entropyIdVerifier:n}=bi(l,k),r={recoveryMethod:k.recoveryMethod,connectingWalletAddress:k.address,entropyId:e,entropyIdVerifier:n,isUnifiedWallet:T,onCompleteNavigateTo:Cv,onFailure:e=>{a(b,"onError",ke.UNKNOWN_CONNECT_WALLET_ERROR),v(e)}},s=Fy(t)?Ew({address:k.address,appConfig:t,methodScreen:bw,fundWalletConfig:m,comingFromSendTransactionScreen:!0}):void 0;i({connectWallet:r,sendSolanaTransaction:{transactionRequest:h,connection:u,transactionOptions:p,transactingWallet:k,onConfirm:x,onSuccess:e=>{f?a("signSolanaTransaction","onSuccess",{signedTransaction:e.signedTransaction}):a("sendSolanaTransaction","onSuccess",{response:e}),w(e)},onFailure:e=>{a(b,"onError",ke.TRANSACTION_FAILURE),v(e)},uiOptions:g||{},requesterAppId:C,signOnly:f},funding:s}),o(Lw)}}));function kv(e){let t=Fo(),{getAccessToken:n,user:r}=Ly(),{setModalData:a}=$o(),{isHeadlessSigning:i,openModal:o,walletProxy:s,recoverPrimaryWallet:l,privy:c}=Tt(),d=vs(),{signWithUserSigner:h}=Wy();return fs("sendSolanaTransaction",e),{sendTransaction:async({transaction:e,connection:u,uiOptions:p,transactionOptions:m,fundWalletConfig:g,address:y})=>await bv({privy:c,appConfig:t,getAccessToken:n,isHeadlessSigning:i,emitPrivyEvent:d,setModalData:a,openModal:o,walletProxy:s,user:r,signWithUserSigner:h,recoverPrimaryWallet:l},{transaction:e,connection:u,transactionOptions:m,uiOptions:p,fundWalletConfig:g,address:y,signOnly:!1})}}const Tv=/*#__PURE__*/en.img.withConfig({displayName:"StyledLogo",componentId:"sc-68c1b1ea-0"})(["&&{height:",";width:",";border-radius:16px;margin-bottom:12px;}"],(e=>"sm"===e.size?"65px":"140px"),(e=>"sm"===e.size?"65px":"140px"));let xv=({data:n})=>{let r=n=>"object"==typeof n&&null!==n?/*#__PURE__*/t(Iv,{children:Object.entries(n).map((([t,n])=>/*#__PURE__*/e("li",{children:[/*#__PURE__*/e("strong",{children:[t,":"]})," ",r(n)]},t)))}):/*#__PURE__*/t("span",{children:String(n)});/*#__PURE__*/return t("div",{children:r(n)})};const Av=/*#__PURE__*/en.div.withConfig({displayName:"Message",componentId:"sc-ccf49562-0"})(["margin-top:1.5rem;background-color:var(--privy-color-background-2);border-radius:var(--privy-border-radius-md);padding:12px;text-align:left;max-height:310px;overflow:scroll;white-space:pre-wrap;width:100%;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]);let Iv=/*#__PURE__*/en.ul.withConfig({displayName:"MessageList",componentId:"sc-ccf49562-1"})(["margin-left:12px !important;white-space:nowrap;&:first-child{margin-left:0 !important;}strong{font-weight:500 !important;}"]);const _v=({data:e})=>/*#__PURE__*/t(Av,{children:/*#__PURE__*/t(xv,{data:e})});let Ev=e=>{if(!Ot(e))return e;try{return Ht(e)}catch{return e}},Sv=e=>JSON.stringify(e,null,2),Nv=r=>{let{types:a,primaryType:i,...o}=r.typedData;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(_v,{data:o}),/*#__PURE__*/t(Hp,{text:Sv(r.typedData),itemName:"full payload to clipboard"})," "]})};const Mv={component:()=>{let{authenticated:r}=us(),{initializeWalletProxy:a,closePrivyModal:i}=Tt(),{navigate:s,data:l,onUserCloseViaDialogOrKeybindRef:c}=$o(),[h,u]=o(!0),[p,m]=o(""),[g,y]=o(),[f,w]=o(null),[v,C]=o(!1),b=null!==f;d((()=>{r||s(Kg)}),[r]),d((()=>{a(ka).then((e=>{u(!1),e||(m("An error has occurred, please try again."),y(new _i(new Ii(p,x.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:k,data:T,confirmAndSign:A,onSuccess:I,onFailure:_,uiOptions:E}=l.signMessage,S={title:E?.title||"Sign message",description:E?.description||"Signing this message will not cost you any fees.",buttonText:E?.buttonText||"Sign and continue"},N=e=>{e?I(e):_(g||new _i(new Ii("The user rejected the request.",x.E4001_USER_REJECTED_REQUEST.eipCode))),i({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{w(null),m(""),y(void 0)}),200)};return c.current=()=>{N(f)},/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:()=>N(f)}),/*#__PURE__*/t(cc,{}),E?.iconUrl&&"string"==typeof E.iconUrl?/*#__PURE__*/t(Uv,{children:/*#__PURE__*/t(Tv,{size:"sm",src:E.iconUrl,alt:"app image"})}):null,/*#__PURE__*/t(ay,{children:S.title}),/*#__PURE__*/t(ry,{children:S.description}),"personal_sign"===k&&/*#__PURE__*/t(Av,{children:Ev(T)}),"eth_signTypedData_v4"===k&&/*#__PURE__*/t(Nv,{typedData:T}),"solana_signMessage"===k&&/*#__PURE__*/t(Av,{children:T}),/*#__PURE__*/t(Ov,{}),/*#__PURE__*/t(Pv,{$fail:!0,children:p}),/*#__PURE__*/t(Ds,{disabled:v||b||h,loading:v,onClick:async()=>{C(!0),m("");try{let e=await A();w(e),C(!1),setTimeout((()=>{N(e)}),ea)}catch(e){console.error(e),m("An error has occurred, please try again."),y(new _i(new Ii(p,x.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),C(!1)}},children:v?"Signing...":b?/*#__PURE__*/e(Wv,{children:[/*#__PURE__*/t(jp,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",/*#__PURE__*/t("span",{children:"Success"})]}):S.buttonText}),E?.isCancellable&&/*#__PURE__*/t(qs,{style:{marginTop:"1rem"},onClick:()=>N(null),isSubmitting:!1,children:"Not now"}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}};let Pv=/*#__PURE__*/en.div.withConfig({displayName:"InputHelp",componentId:"sc-1a9f17a4-0"})(["line-height:20px;height:20px;font-size:13px;color:",";display:flex;justify-content:flex-start;width:100%;margin-top:16px;margin-bottom:4px;"],(e=>e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)")),Wv=/*#__PURE__*/en.span.withConfig({displayName:"ContentWithIcon",componentId:"sc-1a9f17a4-1"})(["display:flex;align-items:center;gap:8px;"]),Uv=/*#__PURE__*/en.div.withConfig({displayName:"IconContainer",componentId:"sc-1a9f17a4-2"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;"]),Ov=/*#__PURE__*/en.div.withConfig({displayName:"Grow",componentId:"sc-1a9f17a4-3"})(["flex-grow:1;"]);function Lv(e){let{isHeadlessSigning:t,walletProxy:n,initializeWalletProxy:r,recoverPrimaryWallet:a,openModal:i,privy:o}=Tt(),{user:s,getAccessToken:l}=Ly(),c=vs(),{setModalData:d}=$o(),{signWithUserSigner:h}=Wy();return fs("signSolanaMessage",e),{signMessage:({message:e,options:u})=>new Promise((async(p,m)=>{if(!s)return c("signSolanaMessage","onError",ke.MUST_BE_AUTHENTICATED),void m(Error("User must be authenticated before signing with a Privy wallet"));let g=u?.address?fi(s,u.address):mi(s);if(!g)return c("signSolanaMessage","onError",ke.EMBEDDED_WALLET_NOT_FOUND),void m(Error("Must have a Privy wallet before signing"));let{entropyId:y,entropyIdVerifier:f}=bi(s,g),w=Ey(g),v=Ya(e).toString("base64");if(v.length<1)return c("signMessage","onError",ke.INVALID_MESSAGE),void m(Error("Message must be a non-empty string"));let C=async()=>{let e;if(!s)throw Error("User must be authenticated before signing with a Privy wallet");let t=await l();if(!t)throw Error("User must be authenticated to use their embedded wallet.");let i=n??await r(15e3);if(!i)throw Error("Failed to initialize embedded wallet proxy.");if(!await a())throw Error("Unable to connect to wallet");if(w){let t=await se(o,h,{chain_type:"solana",method:"signMessage",params:{message:v,encoding:"base64"},wallet_id:g.id});if(!t.data||!("signature"in t.data))throw Error("Failed to sign message");e=t.data.signature}else{let{response:n}=await i.rpc({accessToken:t,entropyId:y,entropyIdVerifier:f,chainType:"solana",hdWalletIndex:g.walletIndex??0,request:{method:"signMessage",params:{message:v}}});e=n.data.signature}return e};if(t({showWalletUIs:u?.uiOptions?.showWalletUIs}))try{let e=await C(),t=new Uint8Array(Ya(e,"base64"));c("signSolanaMessage","onSuccess",{signature:t}),p(t)}catch(e){m(e)}else d({signMessage:{method:"solana_signMessage",data:v,confirmAndSign:C,onSuccess:e=>{let t=new Uint8Array(Ya(e,"base64"));c("signSolanaMessage","onSuccess",{signature:t}),p(t)},onFailure:e=>{m(e)},uiOptions:u?.uiOptions},connectWallet:{recoveryMethod:g.recoveryMethod,connectingWalletAddress:g.address,entropyId:y,entropyIdVerifier:f,isUnifiedWallet:w,onCompleteNavigateTo:Mv,onFailure:e=>{c("signSolanaMessage","onError",ke.UNKNOWN_CONNECT_WALLET_ERROR),m(e)}}}),i(Lw)}))}}const Rv=()=>{let{exportSolanaWallet:e,solanaWallets:t,walletProxy:n,recoverPrimaryWallet:r,privy:a}=Tt(),{sendTransaction:i}=kv(),{signMessage:o}=Lv(),{create:l}=Py(),{signWithUserSigner:c}=Wy(),{user:d,getAccessToken:h}=Ly(),{ready:u}=$c(),p=s((()=>{if(!n)return t;let e=[...pi(d),yi(d)].filter((e=>!!e)).map((e=>({type:"solana",imported:e.imported,address:e.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",walletIndex:e.walletIndex??void 0,meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund(){throw new de("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:()=>{throw new de("Cannot unlink an embedded Solana wallet")},async getProvider(){return new Iy(n,e.address,this.signMessage)},signMessage:async t=>await o({message:t,options:{address:e.address,uiOptions:{showWalletUIs:!1}}}),async sendTransaction(t,n,r){let{signature:a}=await i({transaction:t,connection:n,transactionOptions:r,address:e.address});return a},async signTransaction(t){let i=await h();if(!i||!n)throw new de("Must have valid access token and Privy wallet to send transaction",ke.MUST_BE_AUTHENTICATED);if(!await r().catch((()=>!1)))throw new de("Wallet couldn't be connected",ke.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:o,entropyIdVerifier:s}=bi(d,e);if(Ey(e)){let n=Fl(t)?Ya(t.message.serialize()):t.serializeMessage(),r=await se(a,c,{chain_type:"solana",method:"signMessage",params:{message:n.toString("base64"),encoding:"base64"},wallet_id:e.id});if(r.data&&"signature"in r.data)return t.addSignature(Dl(t,e.address),Ya(r.data.signature,"base64")),t;throw Error("Failed to sign transaction")}return await _y({tx:t,accessToken:i,walletProxy:n,entropyId:o,entropyIdVerifier:s,transactingWalletAddress:e.address,transactingWalletIndex:e.walletIndex??0})},async signAllTransactions(t){let i=await h();if(!i||!n)throw new de("Must have valid access token and Privy wallet to send transaction",ke.MUST_BE_AUTHENTICATED);if(!await r().catch((()=>!1)))throw new de("Wallet couldn't be connected",ke.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:o,entropyIdVerifier:s}=bi(d,e);if(Ey(e))return await Promise.all(t.map((async t=>{let n=Fl(t)?Ya(t.message.serialize()):t.serializeMessage(),r=await se(a,c,{chain_type:"solana",method:"signMessage",params:{message:n.toString("base64"),encoding:"base64"},wallet_id:e.id});if(r.data&&"signature"in r.data)return t.addSignature(Dl(t,e.address),Ya(r.data.signature,"base64")),t;throw Error("Failed to sign transaction")})));for(let r of t)await _y({tx:r,accessToken:i,walletProxy:n,entropyId:o,entropyIdVerifier:s,transactingWalletAddress:e.address,transactingWalletIndex:e.walletIndex??0});return t},loginOrLink:async()=>{throw new de("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{},isConnected:async()=>!0})));return t.concat(e)}),[d,n,h,t]);return{ready:!(!u||!n),createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:t}=await l({chainType:"solana",options:e});return t},exportWallet:e,wallets:p}},Fv={component:()=>{let{wallets:r}=$c(),{wallets:a}=Rv(),{data:i,setModalData:l,navigate:c,lastScreen:h}=$o(),{rpcConfig:u,appId:p,createAnalyticsEvent:m,closePrivyModal:g}=Tt(),y=Fo(),[f,w]=o(void 0),[v,C]=o(!1),b=Ty(),k=i?.funding,{reloadBalance:T}=yy({rpcConfig:u,appId:p,address:"ethereum"===k.chainType?k.address:void 0,chain:"ethereum"===k.chainType?k.chain:void 0}),x="solana"===k.chainType,A=x?k.isUSDC?"USDC":"SOL":k.erc20Address?k.erc20ContractInfo?.symbol:k.chain.nativeCurrency.symbol,I=x?a.find((({address:e})=>e===k.address)):r.find((({address:e})=>Pr(e)===Pr(k.address)));if(!k)return l({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:h||bw},funding:i?.funding,sendTransaction:i?.sendTransaction}),c(rp),/*#__PURE__*/t(n,{});d((()=>{let e=x?async function(){if("solana"!==k.chainType)return;let e=b(xy);e?(k.isUSDC?e.getTokenBalance({address:k.address,cluster:k.cluster,mintAddress:K[k.cluster.name]}).then((({amount:e})=>e)):e.getBalance({address:k.address,cluster:k.cluster})).then((e=>{let t=BigInt(e);f&&t>f&&(C(!0),m({eventName:fy,payload:{provider:"manual",status:"success",chainType:"solana",address:I?.address,value:k.isUSDC?Ft(t-f,6):Ft(t-f,9),token:k.isUSDC?"USDC":"SOL"}})),w(t)})):console.warn("Unable to load solana plugin, skipping balance")}:async function(){"ethereum"===k.chainType&&(async()=>{if(!k.erc20Address)return await T()??BigInt(0);{let{balance:e}=await wy({chain:k.chain,address:k.address,erc20Address:k.erc20Address,rpcConfig:u,appId:p});return e}})().then((e=>{f&&e>f&&(C(!0),m({eventName:fy,payload:{provider:"manual",status:"success",chainType:"ethereum",address:I?.address,chainId:k.chain.id,value:Ft(e-f,k.erc20ContractInfo?.decimals??18),token:k.erc20ContractInfo?.symbol??k.erc20Address??"ETH"}})),w(e)})).catch((()=>w(void 0)))},t=setInterval(e,2e3);return e(),()=>clearInterval(t)}),[f]);let _=s((()=>void 0!==f&&f>=parseFloat(k.amount)),[f,k.amount]),E=s((()=>null==f?"":k.isUSDC?ie({amount:f,decimals:6}):x?Wl(f,3,!0,!0):null!=k.erc20ContractInfo?.decimals?ie({amount:f,decimals:k.erc20ContractInfo.decimals}):le({wei:f})),[f,x,k]),S="ethereum"===k.chainType?k.chain.name:Bv[k.cluster.name],N=s((()=>""===k.uiConfig?.receiveFundsTitle?null:/*#__PURE__*/t(ay,{children:k.uiConfig?.receiveFundsTitle??`Receive ${k.amount} ${A??""}`.trim()})),[k.uiConfig?.receiveFundsTitle,k.amount,A]),M=s((()=>""===k.uiConfig?.receiveFundsSubtitle?null:/*#__PURE__*/t(ry,{children:k.uiConfig?.receiveFundsSubtitle??`Scan this code or copy your wallet address to receive funds on ${S}.`})),[k.uiConfig?.receiveFundsSubtitle,S]),P="solana"===k.chainType&&k.isUSDC&&K[k.cluster.name]?`?spl-token=${K[k.cluster.name]}`:"";/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(cC,{}),N,M,/*#__PURE__*/e(oc,{style:{gap:"1rem",margin:N||M?"1rem 0":"0"},children:[/*#__PURE__*/t(rm,{url:`${k.chainType}:${k.address}${P}`,size:200,squareLogoElement:Dv}),/*#__PURE__*/e(cy,{theme:y.appearance.palette.colorScheme,children:["Make sure to send funds on ",S,"."]}),/*#__PURE__*/t(gy,{title:"Your wallet",errMsg:void 0,showIcon:!0,isLoading:!k||void 0===f,isPulsing:!_,balance:`${E} ${A}`,address:k.address,statusColor:_?"green":"gray"}),v&&/*#__PURE__*/t(Fs,{onClick:()=>g({shouldCallAuthOnSuccess:!1,isSuccess:!0}),children:"Continue"})]}),/*#__PURE__*/t(Js,{})]})}};let Dv=({...e})=>/*#__PURE__*/t(Bi,{color:"black",...e}),Bv={devnet:"Devnet","mainnet-beta":"Solana",testnet:"Testnet"},zv=/*#__PURE__*/en.div.withConfig({displayName:"Container",componentId:"sc-b3a607dd-0"})(["display:flex;flex-direction:column;min-height:72px;"]);var $v=({onBack:n,details:r})=>/*#__PURE__*/e(zv,{children:[/*#__PURE__*/t(nl,{backFn:n}),/*#__PURE__*/t(_v,{data:r}),/*#__PURE__*/t(Js,{})]});let jv=({gasUsed:e,effectiveGasPrice:t})=>{if(e&&t)try{return Lt(e*t)}catch(e){return}};const Vv=({txn:r,receipt:a,transactionInfo:i,onClose:o,tokenPrice:s,tokenSymbol:l,receiptHeader:c,receiptDescription:d})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:o}),/*#__PURE__*/t(ch,{title:c??"Transaction complete!",description:d??"You're all set."}),/*#__PURE__*/t(Lc,{tokenPrice:s,from:a.from,to:a.to,gas:jv(a),txn:r,transactionInfo:i,tokenSymbol:l}),/*#__PURE__*/t(bs,{}),/*#__PURE__*/t(Hv,{loading:!1,onClick:o,children:"All Done"}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]});let Hv=/*#__PURE__*/en(Fs).withConfig({displayName:"SubmitButton",componentId:"sc-f857236b-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const qv=[{constant:!1,inputs:[{name:"_salt",type:"bytes32"},{name:"_initializer",type:"bytes"}],name:"deployAccount",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Kv=[{name:"from",type:"address"},{name:"param2",type:"address"},{name:"param3",type:"bytes"},{name:"param4",type:"tuple",components:[]},{type:"tuple",components:[{name:"param5",type:"address"},{name:"param6",type:"uint256"},{name:"param7",type:"uint256"},{name:"encodedInitData",type:"bytes"}]}],Zv=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Gv=[{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"payable",type:"function"}],Yv=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Jv=[{constant:!1,inputs:[{name:"_operator",type:"address"},{name:"_approved",type:"bool"}],name:"setApprovalForAll",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Qv=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Xv=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenIds",type:"uint256[]"},{name:"_amounts",type:"uint256[]"},{name:"_data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],eC=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"},{name:"_amount",type:"uint256"},{name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],tC=(e,t)=>{let n=nC(Zv,e);if(n)return{action:"approve",functionName:"approve",isErc20Ish:!0,isNFTIsh:!1,spender:n.args[0],amount:n.args[1]};let r=nC(df,e);if(r)return{action:"transfer",functionName:"transfer",isErc20Ish:!0,isNFTIsh:!1,transferTo:r.args[0],amount:r.args[1]};if(!t)return{action:"transaction",functionName:"",isErc20Ish:!1,isNFTIsh:!1};let a=nC(qv,e);if(a&&"string"==typeof a.args[1]){let e=rC(a.args[1]);if(e&&e[4].encodedInitData)return tC(e[4].encodedInitData,t)}let i=nC(Jv,e);if(i)return{action:"approve",functionName:"setApprovalForAll",isNFTIsh:!0,isErc20Ish:!1,operator:i.args[0],approved:i.args[1]};let o=nC(Qv,e);if(o)return{action:"transfer",functionName:"transferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:o.args[0],transferTo:o.args[1],tokenId:o.args[2]};let s=nC(Yv,e);if(s)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:s.args[0],transferTo:s.args[1],tokenId:s.args[2]};let l=nC(eC,e);if(l)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:l.args[0],transferTo:l.args[1],tokenId:l.args[2],amount:l.args[3]};let c=nC(Xv,e);if(c)return{action:"batch transfer",functionName:"safeBatchTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:c.args[0],transferTo:c.args[1],tokenIds:c.args[2],amounts:c.args[3]};let d=nC(Gv,e);return d?{action:"mint",functionName:d.functionName,isNFTIsh:!0,isErc20Ish:!1,args:d.args}:{action:"transaction",isErc20Ish:!1,isNFTIsh:!1}};let nC=(e,t)=>{try{let n=qt({abi:e,data:t});return{functionName:n.functionName,args:n.args||[]}}catch(e){return null}},rC=e=>{try{if("string"==typeof e)return Kt(Kv,`0x${e.slice(10)}`)}catch(e){return null}},aC=e=>`${parseFloat(e).toFixed(2)}`;const iC=(e,t,n)=>{let[r,a]=o(null),{getAccessToken:i}=us(),{walletProxy:s}=Tt();return d((()=>{r&&a(null),(async()=>{if(!await i()||!s||!t)return null;let r=[],a=!0,o=await jc(e,n,t).catch((t=>(t.details.includes("insufficient funds")?a=!1:r.push(t),e)));return{tx:o,totalGasEstimate:o.gas,hasFunds:a,errors:r}})().then(a)}),[e]),r};let oC=new _i(new Ii("There was an issue preparing your transaction",x.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),sC=(e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0;const lC={component:()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:n,setModalData:r,navigate:a}=$o(),{rpcConfig:i,chains:l,closePrivyModal:c,walletProxy:h,showFiatPrices:u}=Tt(),{getAccessToken:p,user:m}=us(),g=Fo(),[y,f]=o(0),[w,v]=o(0),[C,b]=o(sC(e,y)),[k,T]=o(null),[A,I]=o(),[_,E]=o(!1),[S,N]=o(null),[M,P]=o(null),[W,U]=o(null),[O,L]=o(void 0),[R,F]=o(void 0),[D,B]=o(!1),[z,$]=o(!1),[j,V]=o([]),[H,q]=o([]),[K,Z]=o("uninitiated"),[G,Y]=o(void 0);if(!C||!e?.sendTransaction||!e?.sendTransaction)/*#__PURE__*/return t(ap,{error:Error("Invalid transaction request"),onClick:()=>{e?.sendTransaction?.onFailure(oC),c({shouldCallAuthOnSuccess:!1})}});let{entropyId:J,entropyIdVerifier:Q,transactingWalletIndex:X,transactingWalletAddress:ee}=e.sendTransaction,te=s((()=>l.find((e=>Number(e.id)===Number(C.chainId)))),[C.chainId]),ne=te?.nativeCurrency.symbol??"ETH",re=s((()=>tC(C.data,!!g.embeddedWallets.extendedCalldataDecoding)),[C.data]),{action:ae,isErc20Ish:ie,isNFTIsh:oe}=re,{toAddress:se,tokenAddress:le}=s((()=>({toAddress:re.isErc20Ish?re.transferTo:C.to??void 0,tokenAddress:re.isErc20Ish?C.to:void 0})),[re]);d((()=>{C.to&&te&&ie&&Hy({address:C.to,chain:te,rpcConfig:g.rpcConfig,privyAppId:g.id}).then(T).catch(console.error)}),[C.to,te]);let{tokenPrice:ce,isTokenPriceLoading:de}=Bc(C.chainId),{balance:he}=yy({rpcConfig:g.rpcConfig,appId:g.id,address:ee,chain:te}),ue=s((()=>Sr(Number(C.chainId),l,i,{appId:g.id})),[C.chainId,i]),pe=iC(C,ee,ue);d((()=>{b(sC(e,y))}),[y]),d((()=>{e.sendTransaction?.getIsSponsored?e.sendTransaction.getIsSponsored().then(I).catch(console.error):I(!1)}),[e.sendTransaction.getIsSponsored]);let me=()=>{if(!_)return S?e?.sendTransaction?.onSuccess({hash:S}):W||pe?.errors[0]?e?.sendTransaction?.onFailure(W??pe?.errors[0]??oC):e?.sendTransaction?.onFailure(new _i(new Ii("The user rejected the request",x.E4001_USER_REJECTED_REQUEST.eipCode))),c({shouldCallAuthOnSuccess:!1})};n.current=me;let ge=!!(e.funding&&e.funding.supportedOptions.length>0),ye=xl(BigInt(pe?.totalGasEstimate??0n),ne),fe=u&&ce?Tl(BigInt(pe?.totalGasEstimate??0n),ce):void 0,we=xl(he??0n,ne,void 0,!0),ve=u&&ce?Tl(he??0n,ce):void 0,Ce=e.sendTransaction?.uiOptions?.transactionInfo?.title;Ce||(Ce="approve"===ae?ie?"Confirm address":"Confirm action":`Approve ${ae}`);let be=e.sendTransaction?.uiOptions?.description||(ie&&"approve"===ae?`${g.name} would like your permission for ${Pr(re.spender)} to spend tokens on your behalf.`:`${g.name} wants your permission to approve the following transaction.`),ke=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/t("img",{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Te=!(!pe||pe.errors[0]||pe.hasFunds||!1!==A),xe=Te&&ge,Ae=xe?"Add funds":e.sendTransaction?.uiOptions?.buttonText||(y<w?"Continue":"Approve"),Ie=e=>{if(!e)throw Error("Transaction scan failed");if("Success"===e.validation.status&&("Benign"===e.validation.result_type?F("safe"):"Warning"===e.validation.result_type?F("warn"):"Malicious"===e.validation.result_type&&(F("error"),$(!0))),"Success"!==e.simulation.status)throw Error("Simulation failed");{L(e.simulation.params);let{assetsIn:t,assetsOut:n}=function(e,t){let n=[],r=[];if(e)for(let t of e)if(t.in[0]){let e;e="ERC721"===t.asset.type||"approve_for_all"===t.in[0].value?{nftName:t.asset.name,nftCount:t.in.length}:{iconUrl:t.asset.logo_url,value:t.in[0].value,symbol:t.asset.symbol,usdValue:t.in[0].usd_price?aC(t.in[0].usd_price):void 0},n.push(e)}else if(t.out[0]?.value){let e;e="ERC721"===t.asset.type||"approve_for_all"===t.out[0].value?{nftName:t.asset.name}:{iconUrl:t.asset.logo_url,value:t.out[0].value,symbol:t.asset.symbol,usdValue:t.out[0].usd_price?aC(t.out[0].usd_price):void 0},r.push(e)}for(let e of t)for(let t of Object.keys(e.spenders)){let n;n="ERC721"===e.asset.type||"approve_for_all"===e.spenders[t]?.value?{nftName:e.asset.name}:{iconUrl:e.asset.logo_url,value:e.spenders[t]?.value,symbol:e.asset.symbol,usdValue:e.spenders[t]?.usd_price?aC(e.spenders[t]?.usd_price):void 0},r.push(n)}return{assetsIn:n,assetsOut:r}}(e.simulation.assets_diffs,e.simulation.exposures);if(0===n.length&&0===t.length)throw Error("No tokens found");V(n),q(t)}};if(d((()=>{e.sendTransaction?.scanTransaction&&g.embeddedWallets.transactionScanning.enabled&&"uninitiated"===K&&(Z("in progress"),e.sendTransaction.scanTransaction().then((e=>{Ie(e),Z("completed")})).catch((()=>Z("failed"))))}),[!!e.sendTransaction?.scanTransaction]),d((()=>{e.sendTransaction?.scanTransaction&&"failed"!==K||((t,n,r)=>{if(v((e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(e)),n.isErc20Ish&&n.amount&&r){let e=uf({amount:n.amount,decimals:r.decimals});Y(e),V([{value:e,symbol:r?.symbol}])}else if(t.value){let e=BigInt(t.value),n=ce&&Tl(e,ce);V(u&&n?[{value:n}]:[{value:Al(e),symbol:ne}])}else V(u?[{value:"$0"}]:[{value:"0",symbol:ne}])})(pe?.tx??C,re,k)}),[C,pe?.tx,re,k,K]),M/*#__PURE__*/)return t(Vv,{txn:pe?.tx??C,onClose:me,receipt:M,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,tokenPrice:ce,tokenSymbol:ne,receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription});if(W)/*#__PURE__*/return t(nv,{transactionError:W,transactionHash:S??void 0,network:"ethereum",chainId:pe?.tx.chainId??C.chainId,onClose:me,onRetry:({resetNonce:e})=>{U(null);let t={...pe?.tx??C};e&&(t.nonce=void 0),b(t)}});let _e=0!==w&&"number"==typeof y&&0!==y?()=>{f(y-1)}:void 0;return D&&O?/*#__PURE__*/t($v,{details:O,onBack:()=>B(!1)}):/*#__PURE__*/t(Gw,{transactionIndex:y,onBack:_e,maxIndex:w,disabled:Te&&!ge||z,isSubmitting:_,submitError:W,isPreparing:!pe,isTokenPriceLoading:de,isTokenContractInfoLoading:!oe&&!k,prepareError:pe?.errors[0],symbol:k?.symbol,chain:te,img:ke,title:Ce,subtitle:be,txValue:C.value,fee:fe??ye,isSponsored:A,from:ee??"",to:se,tokenAddress:le??void 0,network:g.chains.find((e=>e.id===C.chainId))?.name??"",transactionDetails:{...re,formattedAmount:G},cta:Ae,missingFunds:Te,action:ae,balance:ve??we,onClose:me,onClick:xe?async()=>{if(ee){if(!ge)throw Error("Funding wallet is not enabled");r({...e,funding:{...e.funding,methodScreen:bw,chainType:"ethereum",amount:Rt(BigInt(pe?.tx.value??0)+BigInt(pe?.totalGasEstimate?.toString()??0)),chain:te}}),a(bw)}}:async()=>{if(y<w)f(y+1);else{E(!0);try{let t=await p();if(_||!t||!h||!m)return;let n=e?.sendTransaction?.onConfirm?await e.sendTransaction.onConfirm():await async function({accessToken:e,entropyId:t,entropyIdVerifier:n,transactingWalletIndex:r,walletProxy:a,transactionRequest:i,publicClient:o,requesterAppId:s}){let l=await Jd({accessToken:e,entropyId:t,entropyIdVerifier:n,transactingWalletIndex:r,walletProxy:a,transactionRequest:i,requesterAppId:s});return await o.sendRawTransaction({serializedTransaction:l})}({accessToken:t,transactingWalletIndex:X,entropyId:J,entropyIdVerifier:Q,walletProxy:h,transactionRequest:pe?.tx??C,publicClient:ue,requesterAppId:e.sendTransaction?.requesterAppId});if(N(n),e.sendTransaction?.signOnly)return await new Promise((e=>setTimeout(e,ea))),e?.sendTransaction?.onSuccess({hash:n}),c({shouldCallAuthOnSuccess:!1});let r=await ue.waitForTransactionReceipt({hash:n});if("reverted"===r.status)throw Error("Transaction failed");P(r)}catch(e){console.warn({transaction:pe?.tx??C,error:e}),U(e)}finally{E(!1)}}},validation:R,hasScanDetails:!!O,setIsScanDetailsOpen:B,preventMaliciousTransaction:z,setPreventMaliciousTransaction:$,tokensSent:j,tokensReceived:H,isScanning:"in progress"===K,isCancellable:e.sendTransaction?.uiOptions?.isCancellable??!1})}};function cC({title:e}){let{currentScreen:n,navigateBack:r,navigate:a,data:i,setModalData:o}=$o();/*#__PURE__*/return t(nl,{title:e,backFn:n===Fv?r:n===i?.funding?.methodScreen?i.funding.comingFromSendTransactionScreen?()=>a(lC):void 0:i?.funding?.methodScreen?()=>{let e=i.funding;e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),o({funding:e}),a(e.methodScreen)}:void 0})}const dC={component:()=>{let{rpcConfig:r,appId:a,closePrivyModal:i,createAnalyticsEvent:s}=Tt(),{navigate:l,setModalData:c,app:h,data:u}=$o(),{wallets:p}=$c(),m=Ty(),[g,y]=o(null),[f,w]=o(null),[v,C]=o([]),[b,k]=o(0),[T,x]=o(!1),[A,I]=o(!1),[_,E]=o(!1),[N,M]=o(!1),[P,W]=o(),[U,O]=o();if(!u?.funding||"solana"!==u.funding.chainType)throw Error("Invalid funding data");let{address:L,cluster:R,connectedWalletAddress:F}=u.funding,[D,B]=o(u.funding.amount),z=F?p.find((({address:e})=>e===F)):p[0],$=vo(z?.walletClientType||"unknown"),j=$?.name||"wallet",[V,H]=o(null);d((()=>{(async()=>{if(!z)return;let e=await z.getEthereumProvider();H(Bt({account:z.address,transport:zt(e)}).extend($t))})().catch(console.error)}),[z]);let[q,K]=o(0n),Z=Wl(q);d((()=>{let e=m(xy);e?e.getBalance({address:L,cluster:R}).then((e=>K(BigInt(e)))):console.warn("Unable to load solana plugin, skipping balance")}),[]);let[G,Y]=o(),{tokenPrice:J}=Bc("solana"),{fundingAmountInBaseUnit:Q,fundingAmountInUsd:X}=Ol({amount:D,fee:0n,tokenPrice:J,isUsdc:u.funding.isUSDC});if(d((()=>{(async()=>{if(!V||!z)return;let e=["testnet","devnet"].includes(R.name);e&&console.warn("Solana testnets are not supported for bridging");let t=S(h.chains).filter((({testnet:t})=>!!t===e)),n=(await pf({chains:t,address:z.address,appId:a,rpcConfig:r})).filter((e=>e.balance>0n));if(n.length<1)return void y(new de(`Wallet ${Pr(z.address)} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE));n.sort(((e,t)=>Number(t.balance-e.balance)));let i=(await Promise.allSettled(n.map((async e=>({...e,quote:await Qu({isTestnet:!1,input:Gu({amount:Q.toString(),user:z.address,recipient:L,destinationChainId:Io,destinationCurrency:_o,originChainId:e.chain.id})})}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(i.length<1)return void y(new de(`Unable to fetch quotes for bridging. Wallet ${Pr(z.address)} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE));let o=i.map((({quote:e,balance:t,chain:n})=>({bridgeTx:Xu(e),balance:t,chain:n}))).filter((({bridgeTx:e})=>!!e));if(o.length>1)return void C(o);let s=o.at(0);s?(I(!0),Y({data:s.bridgeTx.data,to:s.bridgeTx.to,value:s.bridgeTx.value,chain:s.chain})):y(new de(`Unable to select bridge option from quotes. Wallet ${Pr(z.address)} does not have enough funds.`,void 0,ke.INSUFFICIENT_BALANCE))})().catch(console.error)}),[V]),d((()=>{(async()=>{let e,t;if(!V||!z||T||_||!G)return;x(!0);let n=Pt({chain:G.chain,transport:Wt(Nr(G.chain,r,a))});try{e=await n.prepareTransactionRequest({account:z.address,to:G.to,chain:G.chain,data:G.data,value:BigInt(G.value??0)})}catch(e){console.error(e),v.length>1&&w(e.shortMessage??"Something went wrong")}if(e){x(!1),E(!0);try{await V.switchChain({id:G.chain.id})}catch(e){await V.addChain({chain:G.chain}),await V.switchChain({id:G.chain.id})}try{t=await V.sendTransaction(e)}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(v.length<1?y(new de(e.shortMessage,void 0,ke.TRANSACTION_FAILURE)):w(e.shortMessage??"Something went wrong"))}if(t)return await V.waitForTransactionReceipt({hash:t}),A?(O("pending"),void W(t)):(E(!1),M(!0),void s({eventName:fy,payload:{provider:"external",status:"success",txHash:t,address:z.address,chainId:G.chain.id,chainType:"ethereum",value:G.value?Ft(BigInt(G.value),18):void 0,token:"ETH",destination:L,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:Ft(Q,9),destinationToken:"SOL"}}));E(!1)}else x(!1)})().catch(console.error)}),[V,G]),ep({transactionHash:P,wallet:z,isTestnet:!1,bridgingStatus:U,setBridgingStatus:O,onSuccess({transactionHash:e,wallet:t}){I(!1),M(!0),s({eventName:fy,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainId:G?.chain.id,chainType:"ethereum",value:G?.value?Ft(BigInt(G.value),18):void 0,token:"ETH",destination:L,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:Ft(Q,9),destinationToken:"SOL"}})},onFailure({error:e}){I(!1),y(e)}}),d((()=>{g&&(c({funding:u?.funding,sendTransaction:u?.sendTransaction,errorModalData:{error:g,previousScreen:nw}}),l(rp,!1))}),[g]),d((()=>{if(!N)return;let e=setTimeout(i,na);return()=>clearTimeout(e)}),[N]),N/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(ic,{children:[/*#__PURE__*/t(er,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(hh,{title:"Success!",description:`You’ve successfully added ${D} SOL to your ${h.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]});let ee=v[b];return v.length>1&&ee?/*#__PURE__*/t(Qf,{displayName:j,configuredFundingChain:R,formattedBalance:Z,fundingAmount:D,fundingCurrency:"SOL",fundingAmountInUsd:X,options:v,selectedOption:ee,isPreparing:T,isSubmitting:_,addressToFund:L,fundingWalletAddress:z?.address||"",errorMessage:f,onSubmit:()=>{u.funding?.amount!==D?async function(){if(z&&ee)try{let e=await Qu({isTestnet:!1,input:Gu({amount:Q.toString(),user:z.address,recipient:L,destinationChainId:Io,destinationCurrency:_o,originChainId:ee.chain.id})}),t=Xu(e);if(!t)throw Error("Invalid transaction request");I(!0),Y({data:t.data,to:t.to,value:t.value,chain:ee.chain})}catch(e){console.error(e),y(new de("Unable to fetch quotes for bridging",e,ke.INSUFFICIENT_BALANCE))}}().catch(console.error):Y({to:ee.bridgeTx.to,data:ee.bridgeTx.data,value:ee.bridgeTx.value,chain:ee.chain})},onSelect:e=>{e!==b&&(w(null),k(e))},onAmountChange:B}):_&&z?/*#__PURE__*/t(sf,{wallet:z,displayName:j,addressToFund:L,isBridging:A,isErc20Flow:!1,chainId:"solana",chainName:R.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
25
+ /*#__PURE__*/e(n,{children:[/*#__PURE__*/t(cC,{}),/*#__PURE__*/t(Ky,{}),/*#__PURE__*/t("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/t(Js,{})]})}},hC=new Map([[bw,null],[nw,"external"],[Xf,"external"],[cf,"external"],[dC,"external"],[ew,"external"],[Fv,"manual"],[uw,"moonpay"]]),uC={component:()=>{let{app:r,data:a}=$o(),i=Fo(),o=a?.externalConnectWallet?.suggestedAddress,s=o?`Connect the wallet with address ${Pr(o)} ${r?.name?`to ${r.name}.`:"."}`:`Connect a wallet to ${r?.name}`,{connectors:l}=Tt(),c=ug({walletList:a?.externalConnectWallet?.walletList??r.appearance.walletList,walletChainType:a?.externalConnectWallet?.walletChainType??r.appearance.walletChainType,connectors:l,connectOnly:!0,ignore:r.appearance.walletList,walletConnectEnabled:r.externalWallets.walletConnect.enabled});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{},"header"),c.length>0&&/*#__PURE__*/t(dh,{title:"Connect your wallet",description:s}),/*#__PURE__*/t(xs,{$colorScheme:i.appearance.palette.colorScheme,children:/*#__PURE__*/t(hg,{wallets:c})}),/*#__PURE__*/t(Js,{})]})}},pC={component:()=>{let{app:r,data:a}=$o(),i=Fo(),o=a?.externalConnectWallet?.suggestedAddress,s=o?/*#__PURE__*/e("span",{children:["Connect the wallet with address ",/*#__PURE__*/t(Vu,{showCopyIcon:!1,address:o})," ",r?.name?`to ${r.name}.`:"."]}):`Connect a wallet to your ${r?.name} account`,{connectors:l}=Tt(),c=ug({walletList:a?.externalConnectWallet?.walletList??r.appearance.walletList,walletChainType:a?.externalConnectWallet?.walletChainType??r.appearance.walletChainType,connectors:l,connectOnly:!0,ignore:r.appearance.walletList,walletConnectEnabled:r.externalWallets.walletConnect.enabled});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{},"header"),c.length>0&&/*#__PURE__*/t(ch,{title:"Connect your wallet",description:s}),/*#__PURE__*/t(xs,{$colorScheme:i.appearance.palette.colorScheme,children:/*#__PURE__*/t(hg,{wallets:c})}),r&&/*#__PURE__*/t(Ys,{app:r,alwaysShowImplicitConsent:!0}),/*#__PURE__*/t(Js,{})]})},isUnauthenticatedScreem:!0};function mC(e){let{logout:t}=l(hs);return fs("logout",e),{logout:t}}const gC={component:()=>{let r=Fo(),{data:a,navigate:i,setModalData:l,onUserCloseViaDialogOrKeybindRef:c}=$o(),{crossAppAuthFlow:h,updateWallets:u,closePrivyModal:p,createAnalyticsEvent:m}=Tt(),{logout:g}=mC(),[y,f]=o({}),w=a?.crossAppAuth,v={id:w.appId,name:w.name,logoUrl:w.logoUrl},C=new de(`There was an issue connecting your ${v.name} account. Please try again.`),b=new Jr((async e=>{if(w.popup)try{let t=await h({appId:e,popup:w.popup,action:w.action});f({data:t})}catch(e){e instanceof de?f({error:e}):(e instanceof Ke&&w.popup&&w.popup.close(),f({error:C}))}else f({error:C})})),k=()=>{y.data&&(u(),w.onSuccess(y.data),p({shouldCallAuthOnSuccess:!0,isSuccess:!0})),w.onError(y.error??new de("User canceled flow")),p({shouldCallAuthOnSuccess:!1,isSuccess:!1})};c.current=k,d((()=>{v.id.length&&b.execute(v.id)}),[v.id]),d((()=>{if(!y.data)return;let e=y.data;if(r.legal.requireUsersAcceptTerms&&!e.hasAcceptedTerms){let e=setTimeout((()=>{i(Sp)}),ea);return()=>clearTimeout(e)}if(Fu(e,r.embeddedWallets)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${v.id}`,screen:"CrossAppAuthScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),i(_p)}),ea);return()=>clearTimeout(e)}let t=setTimeout(k,ea);return()=>clearTimeout(t)}),[y.data]);let{title:T,subtitle:x}=s((()=>y.data?{title:`Successfully connected with ${v.name}`,subtitle:"You're good to go!"}:y.error?{title:"Authentication failed",subtitle:y.error.message}:{title:`Connecting to ${v.name}`,subtitle:`Please check the pop-up from ${v.name} to continue`}),[y,v.name]);/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:k}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(yC,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:!!y.data,fail:!!y.error}),/*#__PURE__*/t(Pu,{name:v.name,logoUrl:v.logoUrl})]})}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t("h3",{children:T}),/*#__PURE__*/t("p",{children:x})]})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Qs,{})]})}};let yC=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-33c02367-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]);const fC={component:()=>{let{app:r,data:a}=$o(),{closePrivyModal:i}=Tt(),[s,l]=o(!1),[c,h]=o(),{address:u,onDelegate:p,onSuccess:m,onError:g}=a.delegatedActions.consent,y=async()=>{s?m():g(c??new de("User declined delegating actions.")),i({shouldCallAuthOnSuccess:!1})};return d((()=>{if(!s&&!c)return;let e=setTimeout(y,ta);return()=>clearTimeout(e)}),[s,c]),/*#__PURE__*/e(n,s||c?{children:[/*#__PURE__*/t(nl,{onClose:y}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(rc,{children:[c?/*#__PURE__*/t(Rn,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):/*#__PURE__*/t(er,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(uc,{height:20}),/*#__PURE__*/t(hh,{title:c?"Something went wrong":"Success!",description:c?"Please try again.":`You’ve successfully granted delegated action permissions to ${r.name}.`})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]}:{children:[/*#__PURE__*/t(nl,{closeable:!0,onClose:y}),/*#__PURE__*/t(dr,{width:56,height:56,style:{margin:"auto"}}),/*#__PURE__*/t(rd,{style:{marginTop:24,color:"var(--privy-color-foreground)"},children:"Enable offline access"}),/*#__PURE__*/e(ad,{style:{marginBottom:24,textWrap:"pretty"},children:["By confirming, ",r.name," will be able to use your wallet for you even when you're not around. You can revoke this later."]}),/*#__PURE__*/t(vC,{showIcon:!0,address:u,title:"Wallet",isLoading:!1}),/*#__PURE__*/e(wC,{style:{marginTop:24},children:[/*#__PURE__*/t(js,{onClick:y,children:"Not now"}),/*#__PURE__*/t(Fs,{onClick:async()=>{try{await p(),l(!0)}catch(e){h(e)}},children:"Accept"})]}),/*#__PURE__*/t(Js,{})]})}};let wC=/*#__PURE__*/en.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-bdb7bc51-0"})(["display:flex;gap:10px;"]),vC=/*#__PURE__*/en(gy).withConfig({displayName:"StyledWalletInfoCard",componentId:"sc-bdb7bc51-1"})(["margin-top:1.5rem;"]);const CC={component:()=>{let{app:r,data:a}=$o(),{closePrivyModal:i}=Tt(),[s,l]=o(!1),[c,h]=o(),{onRevoke:u,onSuccess:p,onError:m}=a.delegatedActions.revoke,g=async()=>{s?p():m(c??new de("User declined revoking access to their delegated wallet.")),i({shouldCallAuthOnSuccess:!1})};return d((()=>{if(!s&&!c)return;let e=setTimeout(g,ta);return()=>clearTimeout(e)}),[s,c]),/*#__PURE__*/e(n,s||c?{children:[/*#__PURE__*/t(nl,{onClose:g}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(rc,{children:[c?/*#__PURE__*/t(Rn,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):/*#__PURE__*/t(er,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/t(uc,{height:20}),/*#__PURE__*/t(hh,{title:c?"Something went wrong":"Success!",description:c?"Please try again.":"You've successfully revoked permissions."})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]}:{children:[/*#__PURE__*/t(nl,{closeable:!0,onClose:g}),/*#__PURE__*/t(hr,{width:56,height:56,style:{margin:"auto"}}),/*#__PURE__*/t(rd,{style:{marginTop:24},children:"Revoke offline access to wallet"}),/*#__PURE__*/e(ad,{children:["By confirming, ",r.name," will no longer be able to use this wallet on your behalf when you are not online."]}),/*#__PURE__*/e(bC,{style:{marginTop:24},children:[/*#__PURE__*/t(js,{onClick:g,children:"Deny"}),/*#__PURE__*/t(Fs,{onClick:async()=>{try{await u(),l(!0)}catch(e){h(e)}},children:"Confirm"})]}),/*#__PURE__*/t(Js,{})]})}};let bC=/*#__PURE__*/en.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-993a839-0"})(["display:flex;gap:10px;"]),kC="#8a63d2";const TC={component:()=>{let{lastScreen:r,navigateBack:a,data:s,app:l}=$o(),{requestFarcasterSignerStatus:c,closePrivyModal:h}=Tt(),[u,p]=o(void 0),[m,f]=o(!1),[w,v]=o(!1),C=i([]),b=s?.farcasterSigner;d((()=>{let e=Date.now(),t=setInterval((async()=>{if(!b?.public_key)return clearInterval(t),void p({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===b.status&&(clearInterval(t),f(!1),v(!0),C.current.push(setTimeout((()=>h({shouldCallAuthOnSuccess:!1,isSuccess:!0})),ea)));let n=await c(b?.public_key),r=Date.now()-e;"approved"===n.status?(clearInterval(t),f(!1),v(!0),C.current.push(setTimeout((()=>h({shouldCallAuthOnSuccess:!1,isSuccess:!0})),ea))):r>3e5?(clearInterval(t),p({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):"revoked"===n.status&&(clearInterval(t),p({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))}),2e3);return()=>{clearInterval(t),C.current.forEach((e=>clearTimeout(e)))}}),[]);let k="pending_approval"===b?.status?b.signer_approval_url:void 0;/*#__PURE__*/return e(n,g||m?{children:[/*#__PURE__*/t(nl,{backFn:r?a:void 0,onClose:h},"header"),/*#__PURE__*/t(cc,{}),
26
+ /*#__PURE__*/t(n,y?{children:/*#__PURE__*/e(AC,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:w,fail:!!u}),/*#__PURE__*/t(Fp,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t(rd,{children:u?u.message:"Add a signer to Farcaster"}),/*#__PURE__*/t(ad,{children:u?u.detail:"This will allow "+l.name+" to add casts, likes, follows, and more on your behalf."})]}),k&&/*#__PURE__*/t(Fs,{onClick:e=>{e.preventDefault(),window.location.href=k},children:"Open Warpcast app"})]})}:{children:/*#__PURE__*/e(xC,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:w,fail:!!u}),/*#__PURE__*/t(Fp,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t(rd,{children:u?u.message:"Requesting signer from Farcaster"}),/*#__PURE__*/t(ad,{children:u?u.detail:"This should only take a moment"}),/*#__PURE__*/t(nc,{children:k&&g&&/*#__PURE__*/t(Kp,{text:"Take me to Warpcast",url:k,color:kC})})]})]})}),/*#__PURE__*/t(Qs,{})]}:{children:[/*#__PURE__*/t(nl,{backFn:r?a:void 0,onClose:h},"header"),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(xC,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(rd,{children:"Add a signer to Farcaster"}),/*#__PURE__*/e(ad,{children:["This will allow ",l.name," to add casts, likes, follows, and more on your behalf."]}),/*#__PURE__*/t(ac,{children:"pending_approval"===b?.status?/*#__PURE__*/t(rm,{url:b.signer_approval_url,size:275,squareLogoElement:Fp}):/*#__PURE__*/t(Ws,{})}),/*#__PURE__*/e(nc,{children:[/*#__PURE__*/t(ad,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),"pending_approval"===b?.status&&/*#__PURE__*/t(Hp,{text:b.signer_approval_url,itemName:"link",color:kC})]})]})}),/*#__PURE__*/t(Qs,{})]})}};let xC=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-6e8f76e5-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]),AC=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainerButton",componentId:"sc-6e8f76e5-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;width:100%;"]);const IC={component:()=>{let{closePrivyModal:r}=Tt();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{},"header"),/*#__PURE__*/t(_C,{children:/*#__PURE__*/t(Fn,{style:{width:32,height:32}})}),/*#__PURE__*/t(dh,{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"}}),/*#__PURE__*/t(tc,{children:/*#__PURE__*/t(Fs,{onClick:()=>r(),children:"Close"})}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}};let _C=/*#__PURE__*/en.div.withConfig({displayName:"StyledCircle",componentId:"sc-7bde5742-0"})(["border-radius:50%;height:68px;width:68px;display:flex;align-items:center;justify-content:center;background-color:var(--privy-color-accent);color:white;margin:0 auto 24px auto;"]);const EC={component:()=>{let{app:r}=$o();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{},"header"),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(hh,{title:"Connect your email",description:`Add your email to your ${r?.name} account`,icon:/*#__PURE__*/t(Pn,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),/*#__PURE__*/t(tc,{children:/*#__PURE__*/t(Bg,{stacked:!0})}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}},SC={component:()=>{let{app:r,currentScreen:a,data:i,navigate:o,setModalData:s}=$o(),{initLoginWithSms:l}=Tt();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{},"header"),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(hh,{title:"Connect your phone",description:`Add your number to your ${r?.name} account`,icon:/*#__PURE__*/t(ln,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),/*#__PURE__*/t(tc,{children:/*#__PURE__*/t(_m,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{await l({phoneNumber:e,withPrivyUi:!0}),o(_g)}catch(e){s({errorModalData:{error:e,previousScreen:i?.errorModalData?.previousScreen||a||SC}}),o(rp)}},hideRecent:!0})}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}},NC={component:()=>{let{app:r,data:a}=$o(),i=a?.externalConnectWallet?.suggestedAddress,o=i?/*#__PURE__*/e("span",{children:["Link the wallet with address ",/*#__PURE__*/t(Vu,{showCopyIcon:!1,address:i})," ",r?.name?`to ${r.name}.`:"."]}):`Link a wallet to your ${r?.name} account`,{connectors:s}=Tt(),l=ug({walletList:a?.externalConnectWallet?.walletList??r.appearance.walletList,walletChainType:a?.externalConnectWallet?.walletChainType??r.appearance.walletChainType,connectors:s,connectOnly:!1,ignore:r.appearance.walletList,walletConnectEnabled:r.externalWallets.walletConnect.enabled});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{},"header"),l.length>0&&/*#__PURE__*/t(dh,{title:"Link your wallet",description:o}),/*#__PURE__*/t(Ts,{children:/*#__PURE__*/t(hg,{wallets:l})}),/*#__PURE__*/t(Js,{})]})}},MC=({style:n,...r})=>/*#__PURE__*/e("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...n},...r,children:[/*#__PURE__*/t("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),/*#__PURE__*/t("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"})]}),PC={component:()=>{let{closePrivyModal:r}=Tt(),{navigate:a}=$o();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{},"header"),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(MC,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),/*#__PURE__*/t(dh,{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"}}),/*#__PURE__*/e(tc,{children:[/*#__PURE__*/t(Fs,{onClick:()=>a(Kg),children:"Try again"}),/*#__PURE__*/t(js,{onClick:()=>r(),children:"Cancel"})]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}};function WC(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:i,unenroll:o,enrollInMfa:s}=l(hs);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>o("sms"),unenrollWithTotp:()=>o("totp"),unenrollWithPasskey:e=>o("passkey",e),showMfaEnrollmentModal:()=>s(!0),closeMfaEnrollmentModal:()=>s(!1)}}const UC=n=>/*#__PURE__*/e(OC,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...n,children:[/*#__PURE__*/t("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),/*#__PURE__*/t("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"})]});let OC=/*#__PURE__*/en.svg.withConfig({displayName:"StyledSvg",componentId:"sc-59fa943f-0"})(["height:90px;width:90px;> rect{","}> path{fill:white;}"],(e=>"success"===e.color?"fill: var(--privy-color-success);":"fill: var(--privy-color-accent);"));const LC=({showIntro:r,userMfaMethods:a,appMfaMethods:i,userHasAuthSms:o,isTotpLoading:s,isPasskeyLoading:l,error:c,onClose:d,onBackToIntro:h,handleSelectMethod:u,setRemovingMfaMethod:p})=>{let m=a.reduce(((e,t)=>({...e,[t]:!0})),{}),g=i.reduce(((e,t)=>({...e,[t]:!0})),{});/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:r?h:void 0,onClose:d},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(cn,{})}),/*#__PURE__*/t(rd,{children:"Choose a verification method"}),a.length>0?/*#__PURE__*/t(ad,{children:"To add or delete verification methods, verification is required."}):/*#__PURE__*/t(ad,{children:"How would you like to verify your identity? You can change this later."}),c&&/*#__PURE__*/t(vd,{style:{marginTop:"1.25rem"},children:c.message}),/*#__PURE__*/e(dd,{children:[(g.totp||m.totp)&&/*#__PURE__*/e(hd,{children:[/*#__PURE__*/t(_s,{style:{justifyContent:"center"},disabled:m.totp||s,onClick:()=>u("totp"),children:s?/*#__PURE__*/t(Ws,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):/*#__PURE__*/e(gd,{children:[/*#__PURE__*/e(pd,{children:[/*#__PURE__*/t(on,{}),"Authenticator app"]}),m.totp?/*#__PURE__*/t(RC,{color:"green",children:"Enabled"}):/*#__PURE__*/t(md,{children:"Recommended"})]})}),m.totp&&/*#__PURE__*/t(ud,{style:{position:"absolute",right:0},onClick:()=>p("totp"),children:/*#__PURE__*/t(yr,{})})]},"totp"),(g.sms||m.sms)&&/*#__PURE__*/e(hd,{children:[/*#__PURE__*/t(_s,{disabled:m.sms||o,onClick:()=>u("sms"),children:/*#__PURE__*/e(gd,{children:[/*#__PURE__*/e(pd,{children:[/*#__PURE__*/t(ln,{}),"SMS"]}),m.sms&&/*#__PURE__*/t(RC,{color:"green",children:"Enabled"}),o&&/*#__PURE__*/t(md,{children:"Disabled"})]})}),m.sms&&/*#__PURE__*/t(ud,{style:{position:"absolute",right:0},onClick:()=>p("sms"),children:/*#__PURE__*/t(yr,{})})]},"sms"),(g.passkey||m.passkey)&&/*#__PURE__*/e(hd,{children:[/*#__PURE__*/t(_s,{style:{justifyContent:"center"},onClick:()=>u("passkey"),disabled:m.passkey||l,children:l?/*#__PURE__*/t(Ws,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):/*#__PURE__*/e(gd,{children:[/*#__PURE__*/e(pd,{children:[/*#__PURE__*/t(sn,{}),"Passkey"]}),m.passkey?/*#__PURE__*/t(RC,{color:"green",children:"Enabled"}):/*#__PURE__*/t(md,{isAccent:!0,children:/*#__PURE__*/t(jn,{})})]})}),m.passkey&&/*#__PURE__*/t(ud,{style:{position:"absolute",right:0},onClick:()=>p("passkey"),children:/*#__PURE__*/t(yr,{})})]},"passkey")]}),/*#__PURE__*/t(Qs,{})]})};let RC=/*#__PURE__*/en(Lp).withConfig({displayName:"StyledChip",componentId:"sc-998ca5bc-0"})(["margin-right:1.5rem;"]);const FC=({appName:e,onComplete:n,onClose:r,onReset:a})=>{let{user:i}=us(),{data:l}=$o(),{initLinkWithPasskey:c,linkWithPasskey:d}=Tt(),{initEnrollmentWithPasskey:h,submitEnrollmentWithPasskey:u}=WC(),[p,m]=o(!1),[g,y]=o(!1),[f,w]=o(!1),[v,C]=o(null),b=s((()=>i?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[i]),k=()=>{l?.mfaEnrollmentFlow?.onSuccess(),n()},T=async e=>{m(!0);try{await h(),await u({credentialIds:e},{removeForLogin:l?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa}),w(!0)}catch(e){C(e)}finally{m(!1)}},x=async()=>{y(!0),C(null);try{await c();let e=await d(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await T(t)}catch(e){C(e)}finally{y(!1)}};return 0===b.length||g?/*#__PURE__*/t(DC,{onReset:a,onClose:r,onClick:x,isCreating:g}):f?/*#__PURE__*/t(zC,{appName:e,onClick:k,onClose:k}):v?/*#__PURE__*/t(ap,{error:v,backFn:()=>C(null),onClick:()=>C(null)}):/*#__PURE__*/t(BC,{passkeys:b,isSubmitting:p,isCreating:g,onReset:a,onClose:r,onSubmitEnrollment:()=>T(b.map((e=>e.credentialId))),onAddPasskey:x})};let DC=({onReset:r,onClose:a,onClick:i,isCreating:o})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{backFn:r,onClose:a},"header"),/*#__PURE__*/t(nd,{children:/*#__PURE__*/e(Ef,{children:[/*#__PURE__*/t(bd,{}),/*#__PURE__*/t(wm,{})]})}),/*#__PURE__*/t(rd,{children:"Set up passkey verification"}),/*#__PURE__*/e(od,{children:[/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(cn,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(ur,{})}),"Takes seconds to set up and use"]}),/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(fr,{})}),"Use your passkey to verify transactions and login to your account"]})]}),/*#__PURE__*/t(Fs,{style:{marginTop:"2.25rem"},onClick:i,loading:o,children:"Add a new passkey"}),/*#__PURE__*/t(Qs,{})]}),BC=({onReset:r,onClose:a,onAddPasskey:i,onSubmitEnrollment:s,passkeys:l,isSubmitting:c,isCreating:d})=>{let[h,u]=o(!1),p=h?l.length:l.length>3?2:3;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:h?()=>u(!1):r,onClose:a},"header"),!h&&/*#__PURE__*/t(nd,{children:/*#__PURE__*/e(Ef,{children:[/*#__PURE__*/t(bd,{}),/*#__PURE__*/t(wm,{})]})}),/*#__PURE__*/t(rd,{children:"Enable your passkeys for verification"}),/*#__PURE__*/e(od,{children:[l.slice(0,p).map((n=>/*#__PURE__*/e($C,{children:[/*#__PURE__*/t(jC,{children:HC(n)}),/*#__PURE__*/e(VC,{children:["Last used: ",n.latestVerifiedAt?.toLocaleString()]})]},n.credentialId))),!h&&l.length>3&&/*#__PURE__*/t(qC,{onClick:()=>u(!0),children:"View All"})]}),/*#__PURE__*/t(Fs,{style:{marginTop:"1.5rem"},onClick:s,loading:c,children:"Enable passkeys"}),l.length<5&&/*#__PURE__*/t(qC,{style:{marginTop:"0.5rem"},onClick:i,disabled:d,children:d?/*#__PURE__*/t(Ws,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),/*#__PURE__*/t(Qs,{})]})},zC=({appName:r,onClick:a,onClose:i})=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:i},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(er,{})}),/*#__PURE__*/t(rd,{children:"Passkey verification added"}),/*#__PURE__*/e(ad,{children:["From now on, you'll use the passkey whenever you use your ",r," wallet."]}),/*#__PURE__*/t(cd,{children:/*#__PURE__*/t(Fs,{onClick:a,children:"Done"})}),/*#__PURE__*/t(Qs,{})]}),$C=/*#__PURE__*/en.div.withConfig({displayName:"PasskeyItem",componentId:"sc-d5b2bf9c-0"})(["&&{padding:0.75rem 1rem;text-align:left;border-radius:0.5rem;border:1px solid var(--privy-color-foreground-4);width:100%;}"]),jC=/*#__PURE__*/en.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-d5b2bf9c-1"})(["font-size:0.875rem;line-height:1.375rem;font-weight:500;color:var(--privy-color-foreground-1);"]),VC=/*#__PURE__*/en.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-d5b2bf9c-2"})(["font-size:0.75rem;font-weight:400;line-height:1.125rem;color:var(--privy-color-foreground-2);"]),HC=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";const qC=/*#__PURE__*/en.button.withConfig({displayName:"StyledLink",componentId:"sc-d5b2bf9c-3"})(["&&{width:100%;font-size:0.875rem;line-height:1rem;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;justify-content:center;padding:0.75rem 1rem;background-color:var(--privy-color-background);transition:background-color 200ms ease;color:var(--privy-color-accent);:focus{outline:none;box-shadow:none;}}"]),KC=({appName:r,onComplete:a,onReset:i,onClose:s})=>{let[l,c]=o(""),[d,h]=o(!1),[u,p]=o(null),[m,g]=o("enroll"),{initEnrollmentWithSms:y,submitEnrollmentWithSms:f}=WC(),{app:w,data:v}=$o();function C(){v?.mfaEnrollmentFlow?.onSuccess(),a()}return u?/*#__PURE__*/t(ap,{error:u,backFn:()=>p(null),onClick:()=>p(null)}):/*#__PURE__*/e(n,"enroll"===m?{children:[/*#__PURE__*/t(nl,{backFn:i,onClose:s},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(ln,{})}),/*#__PURE__*/t(rd,{children:"Set up SMS verification"}),/*#__PURE__*/e(ad,{children:["We'll text a verification code to this mobile device whenever you use your ",r," ","wallet."]}),/*#__PURE__*/e(id,{children:[/*#__PURE__*/t(_m,{onSubmit:async function({qualifiedPhoneNumber:e}){try{await y({phoneNumber:e}),c(e),g("verify")}catch(e){p(e)}},hideRecent:!0}),/*#__PURE__*/e(yd,{children:["By providing your mobile number, you agree to receive text messages from ",w?.name,". Some carrier charges may apply"]})]}),/*#__PURE__*/t(Qs,{})]}:d?{children:[/*#__PURE__*/t(nl,{onClose:C},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(er,{})}),/*#__PURE__*/t(rd,{children:"SMS verification added"}),/*#__PURE__*/e(ad,{children:["From now on, you'll enter the verification code sent to your mobile device whenever you use your ",r," wallet."]}),/*#__PURE__*/t(cd,{children:/*#__PURE__*/t(Fs,{onClick:C,children:"Done"})}),/*#__PURE__*/t(Qs,{})]}:{children:[/*#__PURE__*/t(nl,{backFn:function(){"verify"===m?g("enroll"):i()},onClose:s},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(ln,{})}),/*#__PURE__*/t(rd,{children:"Enter enrollment code"}),/*#__PURE__*/e(id,{children:[/*#__PURE__*/t(ml,{onChange:async function(e){try{if(!e)return;await f({phoneNumber:l,mfaCode:e}),h(!0)}catch(e){if(Xc(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Jc(e))throw Error("The code you entered is not valid");if(Yc(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw ed(e)?Error("Verification canceled"):Error("Unknown error")}}}),/*#__PURE__*/e(ad,{children:["To continue, enter the 6-digit code sent to ",/*#__PURE__*/t("strong",{children:ce(l)})]})]}),/*#__PURE__*/t(Qs,{})]})},ZC=({size:e,authUrl:n})=>/*#__PURE__*/t(rm,{url:n,squareLogoElement:wr,size:e,fgColor:"#1F1F1F"}),GC=({onComplete:r,onClose:a,onReset:i,totpInfo:s})=>{let[l,c]=o("enroll"),[d,h]=o(!1),{submitEnrollmentWithTotp:u}=WC(),{data:p}=$o();function m(){p?.mfaEnrollmentFlow?.onSuccess(),r()}/*#__PURE__*/return e(n,"enroll"===l?{children:[/*#__PURE__*/t(nl,{backFn:i,onClose:a},"header"),/*#__PURE__*/t(rd,{children:"Scan QR code"}),/*#__PURE__*/t(ad,{children:"Open your authenticator app and scan the QR code to continue."}),/*#__PURE__*/t(ac,{children:/*#__PURE__*/t(ZC,{authUrl:s.authUrl,size:200})}),/*#__PURE__*/e(cd,{children:[/*#__PURE__*/t(nc,{children:/*#__PURE__*/t(Hp,{itemName:"setup key",text:s.secret})}),/*#__PURE__*/t(Fs,{onClick:function(){c("verify")},children:"Continue"})]}),/*#__PURE__*/t(Qs,{})]}:d?{children:[/*#__PURE__*/t(nl,{onClose:m},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(er,{})}),/*#__PURE__*/t(rd,{children:"Authenticator app verification added"}),/*#__PURE__*/e(ad,{children:["From now on, you'll enter the verification code generated by your authenticator app whenever you use your ",s.appName," wallet."]}),/*#__PURE__*/t(cd,{children:/*#__PURE__*/t(Fs,{onClick:m,children:"Done"})}),/*#__PURE__*/t(Qs,{})]}:{children:[/*#__PURE__*/t(nl,{backFn:function(){"verify"===l?c("enroll"):i()},onClose:a},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(on,{})}),/*#__PURE__*/t(rd,{children:"Enter enrollment code"}),/*#__PURE__*/t(id,{children:/*#__PURE__*/t(ml,{onChange:async function(e){try{if(!e)return;await u({mfaCode:e}),h(!0)}catch(e){if(Xc(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Jc(e))throw Error("The code you entered is not valid");if(Yc(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw ed(e)?Error("Verification canceled"):Error("Unknown error")}}})}),/*#__PURE__*/e(ad,{children:["To continue, enter the 6-digit code generated from your ",/*#__PURE__*/t("strong",{children:"authenticator app"})]}),/*#__PURE__*/t(Qs,{})]})},YC={component:()=>{let{user:r,enrollInMfa:a,ready:i}=us(),[s,l]=o(null),{unenrollWithSms:c,unenrollWithTotp:h,unenrollWithPasskey:u}=WC(),{app:p,data:m,onUserCloseViaDialogOrKeybindRef:g}=$o(),{closePrivyModal:y}=Tt(),{promptMfa:f}=td(),{initEnrollmentWithTotp:w}=WC(),[v,C]=o(!1),[b,k]=o(null),[T,x]=o(null),A=()=>{y({shouldCallAuthOnSuccess:!0}),a(!1),setTimeout((()=>{l(null),k(null)}),500)},{initEnrollmentWithPasskey:I,submitEnrollmentWithPasskey:_}=WC(),[E,S]=o(!1),[N,M]=o(null);g.current=A;let P=r?.mfaMethods.includes("sms"),W=!!r?.phone,U=r?.mfaMethods.includes("totp"),O=r?.mfaMethods.includes("passkey"),L=P||U||O,R=r?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function F(){l(null),k(null)}if(d((()=>{L&&C(!0)}),[L]),!i||!r||!p/*#__PURE__*/)return e(n,{children:[/*#__PURE__*/t(nl,{onClose:A},"header"),/*#__PURE__*/t(nd,{children:/*#__PURE__*/t(UC,{})}),/*#__PURE__*/t(id,{children:/*#__PURE__*/t(Ws,{})}),/*#__PURE__*/t(Qs,{})]});if("sms"===s)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:F,onClose:A},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(hn,{})}),/*#__PURE__*/t(rd,{children:"Remove SMS verification?"}),/*#__PURE__*/e(ad,{children:["MFA adds an extra layer of security to your ",p?.name," account. Make sure you have other methods to secure your account."]}),/*#__PURE__*/t(cd,{children:/*#__PURE__*/t(Fs,{warn:!0,onClick:async function(){l(null);try{await c()}catch(e){l(null)}},children:"Remove SMS for MFA"})}),/*#__PURE__*/t(Qs,{})]});if("totp"===s)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:F,onClose:A},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(hn,{})}),/*#__PURE__*/t(rd,{children:"Remove Authenticator App verification?"}),/*#__PURE__*/e(ad,{children:["MFA adds an extra layer of security to your ",p?.name," account. Make sure you have other methods to secure your account."]}),/*#__PURE__*/t(cd,{children:/*#__PURE__*/t(Fs,{warn:!0,onClick:async function(){l(null);try{await h()}catch(e){l(null)}},children:"Remove Authenticator App for MFA"})}),/*#__PURE__*/t(Qs,{})]});if("passkey"===s){let r=m?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa??!0;/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{backFn:F,onClose:A},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(hn,{})}),/*#__PURE__*/t(rd,{children:"Are you sure you want to remove this passkey?"}),/*#__PURE__*/t(ad,{children:r?"Removing your passkey will remove as both a verification method and a login method.":"Removing your passkey will remove as a verification method."}),/*#__PURE__*/t(cd,{children:/*#__PURE__*/t(Fs,{warn:!0,onClick:async function(){l(null);try{await u({removeForLogin:m?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa})}catch(e){l(null)}},children:"Yes, remove"})}),/*#__PURE__*/t(Qs,{})]})}if(0===m.mfaEnrollmentFlow.mfaMethods.length&&!L)/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{onClose:A},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(cn,{})}),/*#__PURE__*/t(rd,{children:"Add more security"}),/*#__PURE__*/e(ad,{children:[p?.name," does not have any verification methods enabled."]}),/*#__PURE__*/t(cd,{children:/*#__PURE__*/t(Fs,{onClick:A,children:"Close"})}),/*#__PURE__*/t(Qs,{})]});let D=!L&&!v;return D?/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{onClose:A},"header"),/*#__PURE__*/t(wd,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(cn,{})}),/*#__PURE__*/t(rd,{children:"Transaction Protection"}),/*#__PURE__*/t(ad,{children:"Set up transaction protection to add an extra layer of security to your account"}),/*#__PURE__*/e(od,{children:[/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(mr,{})}),"Enable 2-Step verification for your ",p?.name," wallet."]}),/*#__PURE__*/e(ld,{children:[/*#__PURE__*/t(sd,{children:/*#__PURE__*/t(gr,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),/*#__PURE__*/e(cd,{children:[/*#__PURE__*/t(Fs,{onClick:()=>C(!0),children:"Continue"}),/*#__PURE__*/t(js,{onClick:A,children:"Not now"})]}),/*#__PURE__*/t(Qs,{})]}):"sms"===b?/*#__PURE__*/t(KC,{appName:p?.name||"Privy",onComplete:A,onReset:F,onClose:A}):"totp"===b&&T?/*#__PURE__*/t(GC,{onComplete:A,onClose:A,onReset:F,totpInfo:{...T,appName:p?.name||"Privy"}}):"passkey"===b?/*#__PURE__*/t(FC,{appName:p?.name||"Privy",onComplete:A,onReset:F,onClose:A}):/*#__PURE__*/t(LC,{showIntro:D,userMfaMethods:r.mfaMethods,appMfaMethods:p.mfa.methods,userHasAuthSms:W,onBackToIntro:function(){C(!1)},handleSelectMethod:async function(e){return await f().catch(M),"totp"===e?(k(e),x(null),void w().then((e=>{x(e)})).catch((()=>{x(null),F()}))):"passkey"===e&&1===R.length?await async function(){S(!0);try{await I(),await _({credentialIds:R},{removeForLogin:m?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa})}catch(e){M(e)}finally{S(!1)}}():void k(e)},isTotpLoading:"totp"===b&&!T,isPasskeyLoading:E,error:N,onClose:A,setRemovingMfaMethod:async e=>{await f().catch(M),l(e)}})}},JC={component:()=>{let{authenticated:r,logout:a,ready:i,user:s}=us(),{app:l,setModalData:c,navigate:h,resetNavigation:u}=$o(),{getAuthMeta:p,initLoginWithOAuth:m,loginWithOAuth:g,updateWallets:y,setReadyToTrue:f,closePrivyModal:w,createAnalyticsEvent:v}=Tt(),[C,b]=o(!1),[k,T]=o(void 0),x=p()?.provider||"google",{name:A,component:I}=Va(x);d((()=>{g(x).then((()=>{b(!0),f(!0)})).catch((e=>{if(f(!1),e?.privyErrorCode===ke.ALLOWLIST_REJECTED)return T(void 0),u(),void h(am);if(e?.privyErrorCode===ke.USER_LIMIT_REACHED)return console.error(new Et(e).toString()),T(void 0),u(),void h(lm);if(e?.privyErrorCode===ke.USER_DOES_NOT_EXIST)return T(void 0),u(),void h(Bu);if(e?.privyErrorCode===ke.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return T(void 0),u(),c({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:p()?.provider,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void h(vp);let{retryable:t,detail:n}=function(e,t){let n={detail:"",retryable:!1},r=Pa(t);if(e?.privyErrorCode===ke.LINKED_TO_ANOTHER_USER&&(n.detail="This account has already been linked to another user."),e?.privyErrorCode===ke.INVALID_CREDENTIALS&&(n.retryable=!0,n.detail="Something went wrong. Try again."),e.privyErrorCode===ke.OAUTH_USER_DENIED&&(n.detail=`Retry and check ${r} to finish connecting your account.`,n.retryable=!0),e?.privyErrorCode===ke.TOO_MANY_REQUESTS&&(n.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===ke.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let e=Va(t).name;n.detail=`Request limit reached for ${e}. Please wait a moment and try again.`}if(e?.privyErrorCode===ke.OAUTH_ACCOUNT_SUSPENDED){let e=Va(t).name;n.detail=`Your ${e} account is suspended. Please try another login method.`}return e?.privyErrorCode===ke.CANNOT_LINK_MORE_OF_TYPE&&(n.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode===ke.OAUTH_UNEXPECTED&&t.startsWith("privy:")&&(n.detail="Something went wrong. Please try again."),n}(e,x);T({retryable:t,detail:n,message:"Authentication failed"})})).finally((()=>{qa()}))}),[A,x]),d((()=>{if(i&&r&&C&&s){if(l?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{h(Sp)}),ea);return()=>clearTimeout(e)}if(Fu(s,l.embeddedWallets)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:x,screen:"OAuthStatusScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),h(_p)}),ea);return()=>clearTimeout(e)}{let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),ea);return y(),()=>clearTimeout(e)}}}),[i,r,C,s]);let _=C?`Successfully connected with ${A}`:k?k.message:`Verifying connection to ${A}`,E="";return E=C?"You’re good to go!":k?k.detail:"Just a few moments more",/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{}),/*#__PURE__*/t(cc,{}),/*#__PURE__*/e(QC,{children:[/*#__PURE__*/t(Cd,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/t(Ps,{success:C,fail:!!k}),/*#__PURE__*/t(I,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e(sc,{children:[/*#__PURE__*/t("h3",{children:_}),/*#__PURE__*/t("p",{children:E})]}),k&&k?.retryable?/*#__PURE__*/t(Hs,{onClick:()=>{qa(),m(x),T(void 0)},disabled:!C&&!k?.retryable,children:"Retry"}):null]}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Qs,{})]})}};let QC=/*#__PURE__*/en.div.withConfig({displayName:"ConnectContainer",componentId:"sc-89bb91a9-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:27px;margin-right:27px;gap:24px;"]);const XC=/*#__PURE__*/p(((r,a)=>{let[i,s]=o(""),[l,c]=o(""),[d,h]=o(!1),{authenticated:u,user:p}=us(),{initUpdateEmail:m}=Tt(),{navigate:g,setModalData:y,currentScreen:f}=$o(),{enabled:w,token:v}=ri(),C=Fo(),b=Mr(i)&&(C.disablePlusEmails&&i.includes("+")?(l||c("Please enter a valid email address without a '+'."),!1):(l&&c(""),!0)),k=d||!b,T=()=>{!w||v||u?(async e=>{if(!p?.email)throw Error("User is required to have an email address to update it.");h(!0);try{await m(p.email.address,i,e),g(_g)}catch(e){y({errorModalData:{error:e,previousScreen:f||Kg}})}h(!1)})(v):(y({captchaModalData:{callback:e=>{if(!p?.email)throw Error("User is required to have an email address to update it.");return m(p.email.address,i,e)},userIntentRequired:!1,onSuccessNavigateTo:_g,onErrorNavigateTo:rp}}),g(zp))};/*#__PURE__*/return e(n,{children:[/*#__PURE__*/e(eb,{children:[l&&/*#__PURE__*/t(Og,{style:{marginTop:"0.25rem",textAlign:"left"},children:l}),/*#__PURE__*/e(tb,{$error:!!l,children:[/*#__PURE__*/t(Pn,{}),/*#__PURE__*/t("input",{ref:a,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>s(e.target.value),onKeyUp:e=>{"Enter"===e.key&&T()},value:i,autoComplete:"email"}),r.stacked?null:/*#__PURE__*/t(qs,{isSubmitting:d,onClick:T,disabled:k,children:"Submit"})]})]}),r.stacked?/*#__PURE__*/t(Fs,{loadingText:null,loading:d,disabled:k,onClick:T,children:"Submit"}):null]})}));let eb=Dg,tb=Rg;const nb={component:()=>/*#__PURE__*/e(n,{children:[/*#__PURE__*/t(nl,{},"header"),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(hh,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:/*#__PURE__*/t(Pn,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),/*#__PURE__*/t(tc,{children:/*#__PURE__*/t(XC,{stacked:!0})}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})},rb={component:()=>{let{currentScreen:r,data:a,navigate:i,setModalData:o}=$o(),{user:s}=us(),{initUpdatePhone:l}=Tt();/*#__PURE__*/return e(n,{children:[/*#__PURE__*/t(nl,{},"header"),/*#__PURE__*/t(cc,{}),/*#__PURE__*/t(hh,{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:/*#__PURE__*/t(ln,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),/*#__PURE__*/t(tc,{children:/*#__PURE__*/t(_m,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{if(!s?.phone?.number)throw Error("User is required to have an phone number to update it.");await l(s?.phone?.number,e),i(_g)}catch(e){o({errorModalData:{error:e,previousScreen:a?.errorModalData?.previousScreen||r||SC}}),i(rp)}},hideRecent:!0})}),/*#__PURE__*/t(dc,{}),/*#__PURE__*/t(Js,{})]})}};function ab({subscribe:e,getExternalJwt:t,enabled:n=!0,onAuthenticated:r,onUnauthenticated:a,onError:s}){let{client:l,onCustomAuthAuthenticated:c}=Tt(),{logout:h,authenticated:u,ready:p}=Ly();if(!l)throw new de("`useSyncJwtBasedAuthState` must be used within a `PrivyProvider`");let[m,g]=o({status:"initial"}),y=i(),f=i(!1),w=i(t);d((()=>{w.current=t}),[t]);let v=i(r);d((()=>{v.current=r}),[r]);let C=i(a);d((()=>{C.current=a}),[a]);let b=i(s);return d((()=>{b.current=s}),[s]),d((()=>{if(!n||!p)return;let t=async()=>{if(!f.current){f.current=!0;try{g({status:"loading"});let e=await w.current();if(void 0!==y.current&&y.current===e)return void g({status:"done"});if(!e)return u&&(await h(),C.current?.()),y.current=e,void g({status:"done"});l.startAuthFlow(new Jo(e));let{user:t,isNewUser:n=!1}=await l.authenticate();if(!t)throw new de("Failed to sync with custom auth provider");v.current?.({user:t,isNewUser:n}),c(t,n),y.current=e,g({status:"done"})}catch(e){if(console.warn(e),await h().catch((()=>{})),C.current?.(),e instanceof Ke&&e.privyErrorCode===ke.LINKED_TO_ANOTHER_USER)return g({status:"initial"}),void setTimeout((()=>{t()}),0);b.current?.(e),g({status:"error",error:e})}finally{f.current=!1}}};return t(),e(t)}),[e,l,c,u,h,n,p]),n?{state:m}:{state:{status:"not-enabled"}}}let ib=_n((()=>({jwtAuthFlowState:{status:"not-enabled"}})));const ob=()=>ib((e=>e.jwtAuthFlowState));function sb({customAuth:e}){let{jwtAuthFlowState:t}=function({customAuth:e}){let t=vs(),n=i(),r=h((e=>(n.current=e,()=>{n.current=void 0})),[]),a=e?.getCustomAccessToken??(()=>Promise.resolve(void 0)),{state:o}=ab({enabled:!0===e?.enabled,subscribe:r,getExternalJwt:a,onAuthenticated:({user:e,isNewUser:n})=>{t("login","onComplete",{user:e,isNewUser:n,wasAlreadyAuthenticated:!1,loginMethod:"custom",loginAccount:null}),t("customAuth","onAuthenticated",{user:e})},onUnauthenticated:()=>{t("customAuth","onUnauthenticated")},onError:e=>{t("login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR)}});return d((()=>{(async()=>{e&&!e.isLoading&&n.current?.()})()}),[e?.enabled,e?.getCustomAccessToken,e?.isLoading]),{jwtAuthFlowState:o}}({customAuth:e});return d((()=>{ib.setState({jwtAuthFlowState:t})}),[t]),null}const lb=/*#__PURE__*/c(!1);let cb,db,hb,ub,pb,mb,gb;function yb(){return cb?cb.getCustomerAccessToken():Promise.resolve(Ar.get(aa)||null)}async function fb(){return cb?cb.getAccessToken():Promise.resolve(Ar.get(sa)||Ar.get(aa)||null)}const wb=(e,t)=>db(e,t),vb=(e,t)=>hb(e,t),Cb=(e,t)=>ub(e,t),bb=(e,t)=>pb(e,t),kb=()=>mb(),Tb=()=>gb(),xb=({config:e,...n})=>{var r;if((()=>{if(l(lb))throw new de("Multiple PrivyProvider instances found","Found multiple instances of PrivyProvider, ensure there is only one mounted in your application tree.")})(),"undefined"!=typeof window&&0>["localhost","127.0.0.1"].indexOf(window.location.hostname)&&"https:"!==window.location.protocol)throw new de("Embedded wallet is only available over HTTPS");if("string"!=typeof(r=n.appId)||25!==r.length)throw new de("Cannot initialize the Privy provider with an invalid Privy app ID");cb||(cb=new ls({appId:n.appId,appClientId:n.clientId,apiUrl:n.apiUrl}));let a=Object.assign({},e),i=s((()=>new T({appId:n.appId,clientId:n.clientId,storage:Ar,baseUrl:n.apiUrl,sdkVersion:"react-auth:2.12.0"})),[]);/*#__PURE__*/
27
+ return t(Ro,{client:i,legacyClient:cb,clientConfig:a,children:/*#__PURE__*/t(by,{children:/*#__PURE__*/t(Ab,{...n,client:cb,privy:i})})})};let Ab=n=>{let a=n.client,l=n.privy,c=Ty();Qd();let[u,p]=o(!1),[m,g]=o(!1),[y,f]=o(!1),[T,x]=o(null),[A,I]=o([]),[_,E]=o([]),[S,N]=o(!1),[M,P]=o(null),[W,U]=o(!1),[O,L]=o({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:Le}),[R,F]=o({status:"initial"}),[D,B]=o({status:"initial"}),[z,$]=o({status:"initial"}),[j,V]=o({status:"initial"}),[H,q]=o({status:"initial"}),[K,Z]=o({status:"initial"}),[G,Y]=o(null),J=Fo(),Q=Do(),[X,ee]=o({}),[te,ne]=o(null),re=i(null),[ae,ie]=o(!1),[oe,le]=o(!1),ce=i(null),he=i(null),pe=i(ms),[me,ge]=o(!1);a.onStoreCustomerAccessToken=e=>{e&&ws(pe,"accessToken","onAccessTokenGranted",{accessToken:e})},a.onDeleteCustomerAccessToken=()=>{x(null),f(!1),ws(pe,"accessToken","onAccessTokenRemoved")};let fe=i(null),we=i(null),ve=i(!1),Ce=({showWalletUIs:e})=>ve.current?ve.current:void 0!==e?!e:!J.embeddedWallets.showWalletUIs,be=e=>{P(e),setTimeout((()=>{p(!0)}),15)};d((()=>{if(!T)return void a.connectors?.removeEmbeddedWalletConnectors();let e=ui(T),t=(e=>(e?.linkedAccounts??[]).filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"ethereum"===e.chainType)))(T),r=gi(T);e&&t.length||a.connectors?.removeEmbeddedWalletConnectors(),r||a.connectors?.removeImportedWalletConnector(),a.connectors?G?(e&&a.connectors.addEmbeddedWalletConnectors({walletProxy:G,user:T,embeddedWallets:t,defaultChain:J.defaultChain,appId:n.appId}),r&&a.connectors.addImportedWalletConnector(G,r.address,J.defaultChain,n.appId)):console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized"):console.debug("Failed to add embedded wallet connector: Client connectors not initialized")}),[G,T]),d((()=>{G&&re.current?.(G)}),[G]);let Te=h(((e,t)=>{x(e),N(t),f(!0),le(!0)}),[]);d((()=>{oe&&G&&T&&(async()=>{let e=Uu(T,J.embeddedWallets.ethereum.createOnLogin),t=Lu(T,J.embeddedWallets.solana.createOnLogin),n=await fb();if(n){if(e&&t){let e=await G.create({accessToken:n});return await G.createSolana({accessToken:n,ethereumAddress:e?.address}),void le(!1)}if(t)return await G.createSolana({accessToken:n,ethereumAddress:ui(T)?.address}),await He.refreshSessionAndUser(),void le(!1);if(e)return await G.create({accessToken:n}),void le(!1)}})().catch(console.error)}),[oe&&G&&T]),d((()=>{if(J.externalWallets.solana.connectors)return J.externalWallets.solana.connectors.onMount(),()=>J.externalWallets.solana.connectors?.onUnmount()}),[J.externalWallets.solana.connectors]),d((()=>{!m&&Q&&async function(){let e,t=Ae(),n=Ie(),i=r();a.initializeConnectorManager({walletConnectCloudProjectId:J.walletConnectCloudProjectId,rpcConfig:J.rpcConfig,chains:J.chains,defaultChain:J.defaultChain,store:i,walletList:J.appearance.walletList,shouldEnforceDefaultChainOnConnect:J.shouldEnforceDefaultChainOnConnect,externalWalletConfig:J.externalWallets,appName:J.name??"Privy",walletChainType:J.appearance.walletChainType}),a.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=a.connectors.walletConnectors.length,n=a.connectors.walletConnectors.reduce(((e,t)=>e+(t.initialized?1:0)),0);n===t?ge(!0):e=setTimeout((()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:n,expected:t}),ge(!0)}),1500)})),a.connectors?.initialize().then((()=>{Me()}));let o=await a.getAuthenticatedUser(),s=!!o;J.legal.requireUsersAcceptTerms&&o&&!o.hasAcceptedTerms?(await a.logout(),He.setReadyToTrue(!0),ws(pe,"logout","onSuccess")):(J.customAuth?.enabled||(f(!!o),o&&ws(pe,"login","onComplete",{user:o,isNewUser:!1,wasAlreadyAuthenticated:!0,loginMethod:null,loginAccount:null}),x(o)),t?we.current=s?"link":"login":n&&!s?(we.current="login",ee({telegramAuthModalData:{seamlessAuth:!0}}),be(Om)):He.setReadyToTrue(!!o))}()}),[a,te,m,Q]),d((()=>{if(m){if(!T||!T.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void ie(!!G);if([...A].some((e=>"privy"===e.walletClientType)))return void ie(!0);ie(!!G)}}),[m,T,A,G]),d((()=>{a.connectors?.setWalletList(J.appearance.walletList)}),[J.appearance.walletList.join()]);let Ae=()=>{let e=Ha();return e.inProgress&&e.popupFlow?window.opener.location.origin!==window.location.origin?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."}):"error"===e.authorizationCode?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."}):void window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}):(e.inProgress&&function(e){return e.startsWith("privy:")}(e.provider)&&!e.popupFlow&&(new BroadcastChannel(eh).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!!e.withPrivyUi&&(a.startAuthFlow(new Ma(e)),be(JC),!0))},Ie=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),n=e.get("hash"),r=Number(e.get("auth_date")||""),a=e.get("first_name");if(t&&a&&r&&n)return Object.fromEntries(e.entries())}())?(si(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=oi(e.replace("#tgWebAppData=","")),{user:n,auth_date:r,hash:a}=t;return n&&r&&a?t:void 0}())?(si(),{flowType:"web-app",authData:e}):void 0}();if(!e||!J.loginMethods.telegram||!J.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new ai;return a.startAuthFlow(t),"login-url"===e.flowType&&(t.meta.telegramWebAppData=void 0,t.meta.telegramAuthResult=e.authData),"web-app"===e.flowType&&(t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData=e.authData),!0},_e=async(e,t,n,r)=>{if("solana_adapter"!==e)Ee(await(a.connectors?.createEthereumWalletConnector({connectorType:e,walletClientType:t}))||null,t,n,r);else{let e=a.connectors?.findSolanaWalletConnector(t);if(!e)return;Ee(e,t,n,r)}};async function Ee(e,t,n,r){if(!e)return L({status:"disconnected",connectedWallet:null,connectError:new ye("Unable to connect to wallet."),connector:null,connectRetry:Le}),r?.(null,n);L({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:Le}),e instanceof Vo&&t&&await e.resetConnection(t),L({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Ee(e,t,n,r)});try{let t=await e.connect({showPrompt:!0});if((!t||Si(t))&&J.shouldEnforceDefaultChainOnConnect&&!J.chains.find((e=>e.id===Number(t?.chainId.replace("eip155:",""))))&&("wallet_connect_v2"!==t?.connectorType||"metamask"!==t?.walletClientType)){L((t=>({...t,connector:e,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:Le})));try{await(t?.switchChain(J.defaultChain.id)),t&&(t.chainId=Br(C(J.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${J.defaultChain.id}`)}}return L((e=>({...e,status:"connected",connectedWallet:t,connectError:null,connectRetry:Le}))),t&&ws(pe,"connectWallet","onSuccess",{wallet:t}),r?.(t,n)}catch(e){return e instanceof Oe?(console.warn(e.cause?e.cause:e.message),ws(pe,"connectWallet","onError",e.privyErrorCode||ke.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),ws(pe,"connectWallet","onError",ke.UNKNOWN_CONNECT_WALLET_ERROR)),L((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),r?.(null,n)}}let Se=async(e,t,n)=>{if(null===e||!Si(e))return;let r=new Ga(a,e,t,n);a.startAuthFlow(r)},Ne=async(e,t,n)=>{if(null===e||!po(e))return;let r=new Ja(e,a,t,n);a.startAuthFlow(r)},Me=()=>{let e=new URLSearchParams(window.location.search),t=e.get("privy_connector"),n=e.get("privy_wallet_client"),r="true"===e.get("privy_connect_only");if(!t||!n)return;let i=so({connectorType:t,walletClientType:n});if(!i||!i.isInstalled)return be(PC);if(!a.connectors)throw new de("Connector not initialized");be(r?Km:jm);let o=new URL(window.location.href);o.searchParams.delete("privy_connector"),o.searchParams.delete("privy_wallet_client"),o.searchParams.delete("privy_connect_only"),window.history.pushState({},"",o),_e(t,n,void 0,r?void 0:"solana_adapter"===t?Ne:Se)};d((()=>{m&&y&&null===T&&a.getAuthenticatedUser().then(x)}),[m,y,T,a]);let Pe=e=>{if(!y)throw ws(pe,"linkAccount","onError",ke.MUST_BE_AUTHENTICATED,{linkMethod:e}),new de("User must be authenticated before linking an account.")},We=e=>{if(!y||!T)return!1;if("privy"===e.walletClientType)return!0;for(let t of T.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},Ue=async e=>{let t;if(!a.connectors)throw new de("Connector not initialized");t="ethereum"===e.type?a.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:a.connectors.findSolanaWalletConnector(e.walletClientType)||null,L((n=>({...n,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:Le}))),J.captchaEnabled&&!y?(ee({captchaModalData:{callback:t=>Si(e)?Se(e,t):Ne(e,t),userIntentRequired:!1,onSuccessNavigateTo:jm,onErrorNavigateTo:rp}}),be(zp)):(Si(e)?await Se(e):await Ne(e),be(jm))},Re=()=>{I((e=>{let t=a.connectors?.wallets.filter(Si).map((e=>({...e,linked:We(e),loginOrLink:async()=>{if(!await e.isConnected())throw new de("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new de("Cannot link or login with embedded wallet");Ue(e)},fund:async t=>{await He.fundWallet(e.address,t)},unlink:async()=>{if(!y)throw new de("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new de("Cannot unlink an embedded wallet");x(await a.unlinkEthereumWallet(e.address))}})))||[];return Ni(e,t)?e:t})),E((e=>{let t=(a.connectors?.wallets??[]).filter(po).map((e=>({...e,linked:We(e),loginOrLink:async()=>{if(!await e.isConnected())throw new de("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new de("Cannot link or login with embedded wallet");Ue(e)},fund:async()=>{throw new de("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:async()=>{if(!y)throw new de("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new de("Cannot unlink an embedded wallet");x(await a.unlinkSolanaWallet(e.address))}})));return Ni(e,t)?e:t}))};d((()=>{Re()}),[T?.linkedAccounts,y,m]),d((()=>{if(m){if(!a.connectors)throw new de("Connector not initialized");Re(),a.connectors.on("walletsUpdated",Re)}}),[m]),d((()=>{[...J.loginMethodsAndOrder?.primary??[],...J.loginMethodsAndOrder?.overflow??[]].filter((e=>e.startsWith("privy:"))).forEach((e=>a.getCrossAppProviderDetails(e.replace("privy:",""))))}),[!!a]);let Fe=({transaction:e,uiOptions:t,fundWalletConfig:r,address:i,signOnly:o})=>new Promise((async(s,c)=>{let{requesterAppId:d}=t||{},h=o?"signTransaction":"sendTransaction";if(!y||!T)return ws(pe,h,"onError",ke.MUST_BE_AUTHENTICATED),void c(Error("User must be authenticated before signing with a Privy wallet"));let u=i?fi(T,i):ui(T);if(!u)return ws(pe,h,"onError",ke.EMBEDDED_WALLET_NOT_FOUND),void c(new de("User must have an embedded wallet."));let p=u.address,m=u.walletIndex??0,{entropyId:g,entropyIdVerifier:f}=bi(T,u),w=qe.wallets.find((e=>"privy"===e.walletClientType&&v(e.address)===v(p)));if(!w)return ws(pe,h,"onError",ke.EMBEDDED_WALLET_NOT_FOUND),void c(Error("Must have a Privy wallet before signing"));let b=await w.getEthereumProvider(),x=await b.request({method:"eth_chainId"}),A=e.chainId?Number(e.chainId):Xd(x);(e=>{if(!J.chains.map((e=>e.id)).includes(e))throw new ye(`Chain ID ${e} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,ke.UNSUPPORTED_CHAIN_ID)})(A);let I={...e,from:e.from??p,chainId:A},_=await fb();if(!_||!G)return ws(pe,h,"onError",ke.EMBEDDED_WALLET_NOT_FOUND),void c(Error("Must have valid access token and Privy wallet to send transaction"));let E=Sr(I.chainId,J.chains,J.rpcConfig,{appId:n.appId}),S=Ey(u),N=async()=>{try{let e;if(!await He.recoverPrimaryWallet())throw ws(pe,h,"onError",ke.UNKNOWN_CONNECT_WALLET_ERROR),c(Error("Unable to connect to wallet")),Error("Unable to connect to wallet");let t=o?I:await jc(I,E,I.from);if(S){let n=e=>null==e?void 0:C(e),r=await se(l,(async({message:e})=>await G.signWithUserSigner({accessToken:_,requesterAppId:d,message:e})),{chain_type:"ethereum",method:"eth_signTransaction",params:{transaction:{from:t.from,to:t.to,nonce:n(t.nonce),chain_id:n(t.chainId),data:k(t.data)?t.data?t.data:C(Uint8Array.from(t.data)):void 0,value:n(t.value),type:t.type,gas_limit:n(t.gasLimit??t.gas),gas_price:n(t.gasPrice??t.gas),max_fee_per_gas:n(t.maxFeePerGas),max_priority_fee_per_gas:n(t.maxPriorityFeePerGas)}},wallet_id:u.id});if(!r.data||!("signed_transaction"in r.data))throw new _i("Unable to sign transaction");e=r.data.signed_transaction}else e=await Jd({accessToken:_,entropyId:g,entropyIdVerifier:f,transactingWalletIndex:m,walletProxy:G,transactionRequest:t,requesterAppId:d});if(o)return ws(pe,"signTransaction","onSuccess",{signature:e}),e;{let t=await E.sendRawTransaction({serializedTransaction:e});return ws(pe,"sendTransaction","onSuccess",{hash:t}),t}}catch(e){throw ws(pe,h,"onError",ke.TRANSACTION_FAILURE),e}};if(Ce({showWalletUIs:t?.showWalletUIs}))N().then((e=>{o?ws(pe,"signTransaction","onSuccess",{signature:e}):ws(pe,"sendTransaction","onSuccess",{hash:e}),s({hash:e})})).catch((e=>{ws(pe,h,"onError",ke.TRANSACTION_FAILURE),c(e)}));else{let e={connectingWalletAddress:p,recoveryMethod:u.recoveryMethod,entropyId:g,entropyIdVerifier:f,onCompleteNavigateTo:lC,isUnifiedWallet:S,onFailure:e=>{ws(pe,h,"onError",ke.UNKNOWN_CONNECT_WALLET_ERROR),c(e)}},n=Fy(J)?_w({address:p,appConfig:J,fundWalletConfig:r,methodScreen:bw,chainIdOverride:I.chainId,comingFromSendTransactionScreen:!0}):void 0;ee({connectWallet:e,sendTransaction:{transactionRequest:I,transactingWalletIndex:m,transactingWalletAddress:p,entropyId:g,entropyIdVerifier:f,signOnly:o,scanTransaction:async()=>{let e=await jc(I,E,I.from);return await a.scanTransaction({metadata:{domain:J.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:e.from,to:e.to,value:e.value?.toString(),gas:e.gas?.toString(),gasPrice:e.gasPrice?.toString(),nonce:e.nonce?.toString(),data:e.data}]}})},onConfirm:()=>N(),onSuccess:e=>{o?ws(pe,"signTransaction","onSuccess",{signature:e.hash}):ws(pe,"sendTransaction","onSuccess",{hash:e.hash}),s(e)},onFailure:e=>{ws(pe,h,"onError",ke.TRANSACTION_FAILURE),c(e)},uiOptions:t||{},fundWalletConfig:r,requesterAppId:d},funding:n}),be(Lw)}}));function De(){return new Promise((async(e,t)=>{let n=await fb();if(!n||!G)throw Error("Must have valid access token to enroll in MFA");try{await G.verifyMfa({accessToken:n}),e()}catch(e){t(e)}}))}let Be=e=>e?.linkedAccounts.filter((e=>null!==e.latestVerifiedAt&&!("wallet"===e.type&&"privy"===e.walletClientType))).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0],ze=e=>{let t=T?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:n,loginMethod:r}=ku(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw ws(pe,"linkAccount","onError",ke.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:r}),new de(`User already has an account of type ${n} linked.`)};async function $e({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){P(null);let n=t?"setWalletPassword":"setWalletRecovery";if(!y||!T)throw ws(pe,n,"onError",ke.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let r=wi(T);if(!r||!G)throw ws(pe,n,"onError",ke.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");let a=Ey(r);if(a)throw ws(pe,n,"onError",ke.NOT_SUPPORTED),Error("Unsupported operation");try{await De()}catch(e){throw ws(pe,n,"onError",ke.MISSING_MFA_CREDENTIALS),e}return new Promise(((i,o)=>{let s="user-passcode"===r.recoveryMethod,l=sy({walletAction:"update",availableRecoveryMethods:J.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:s,showAutomaticRecovery:e}),{entropyId:c,entropyIdVerifier:d}=bi(T),h={recoveryMethod:r.recoveryMethod,connectingWalletAddress:r.address,onCompleteNavigateTo:l,shouldForceMFA:!1,entropyId:c,isUnifiedWallet:a,entropyIdVerifier:d,onFailure:e=>{ws(pe,n,"onError",ke.UNKNOWN_CONNECT_WALLET_ERROR),o(e)}};ee({setWalletPassword:{onSuccess:e=>{ws(pe,n,"onSuccess",{method:"user-passcode",wallet:e}),i(e)},onFailure:e=>{ws(pe,n,"onError",ke.USER_EXITED_SET_PASSWORD_FLOW),o(e)},callAuthOnSuccessOnClose:!1},recoverWallet:{entropyId:c,entropyIdVerifier:d,onFailure:o},connectWallet:h,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:s,shouldCreateEth:!1,shouldCreateSol:!1}}),be(Lw)}))}async function je({appId:e,action:t}){let n=await fb();if("link"===t&&!n)throw ws(pe,"linkAccount","onError",ke.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new de("User must be authenticated before linking an account.");if("login"===t&&n)throw ws(pe,"login","onError",ke.UNKNOWN_AUTH_ERROR),new de("Attempted to log in, but user is already logged in. Use a `link` helper instead.");fe.current=`privy:${e}`,we.current=t;let r=ah();return a.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(n,i)=>{let{name:o,logoUrl:s}=await rh({api:a.api,providerAppId:e,requesterAppId:J.id});ee({crossAppAuth:{appId:e,name:o,logoUrl:s,action:t,popup:r,onSuccess:n,onError:i}}),be(gC)}))}let Ve={ready:m,authenticated:y,user:T,walletConnectors:a.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),ee({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress,walletChainType:e?.walletChainType}}),be(y?uC:pC)},linkWallet:e=>{e&&"target"in e&&e&&(e=void 0),Pe("siwe"),fe.current="siwe",we.current="link",ee({...X,externalConnectWallet:{...X.externalConnectWallet,suggestedAddress:e?.suggestedAddress,walletList:e?.walletList,walletChainType:e?.walletChainType}}),be(NC)},startCrossAppAuthFlow:je,linkEmail:()=>{Pe("email"),ze("email"),fe.current="email",we.current="link",be(EC)},linkPhone:()=>{Pe("sms"),ze("phone"),fe.current="sms",we.current="link",be(SC)},linkGoogle:async()=>{Pe("google"),ze("google_oauth"),we.current="link",await He.initLoginWithOAuth("google")},linkTwitter:async()=>{Pe("twitter"),ze("twitter_oauth"),we.current="link",await He.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Pe("discord"),ze("discord_oauth"),we.current="link",await He.initLoginWithOAuth("discord")},linkGithub:async()=>{Pe("github"),ze("github_oauth"),we.current="link",await He.initLoginWithOAuth("github")},linkSpotify:async()=>{Pe("spotify"),ze("spotify_oauth"),we.current="link",await He.initLoginWithOAuth("spotify")},linkInstagram:async()=>{Pe("instagram"),ze("instagram_oauth"),we.current="link",await He.initLoginWithOAuth("instagram")},linkTiktok:async()=>{Pe("tiktok"),ze("tiktok_oauth"),we.current="link",await He.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Pe("linkedin"),ze("linkedin_oauth"),we.current="link",await He.initLoginWithOAuth("linkedin")},linkApple:async()=>{Pe("apple"),ze("apple_oauth"),we.current="link",await He.initLoginWithOAuth("apple")},linkPasskey:async()=>{Pe("passkey"),ze("passkey"),await He.initLinkWithPasskey(),be(_f)},linkTelegram:async e=>{if(Pe("telegram"),ze("telegram"),we.current="link",fe.current="telegram",e?.launchParams)if(e.launchParams.initDataRaw){let t=new ai;a.startAuthFlow(t),t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData=oi(e.launchParams.initDataRaw),ee({telegramAuthModalData:{seamlessAuth:!0}}),be(Om)}else ws(pe,"linkAccount","onError",ke.INVALID_DATA,{linkMethod:"telegram"});else await He.initLoginWithTelegram();be(Om)},linkFarcaster:async()=>{Pe("farcaster"),ze("farcaster"),await He.initLoginWithFarcaster(),we.current="link",fe.current="farcaster",be(pm)},updateEmail:()=>{if(Pe("email"),!T?.email)throw new de("User does not have an email linked to their account.");we.current="update",fe.current="email",be(nb)},updatePhone:()=>{if(Pe("sms"),!T?.phone)throw new de("User does not have a phone number linked to their account.");we.current="update",fe.current="sms",be(rb)},login:async e=>{e&&"target"in e&&e&&(e=void 0);let t="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!m){let e=await new Promise((e=>{ne((t=>e.bind(t)))}));if(ne(null),e)return void console.warn(t)}!T||T.isGuest?(we.current="login",ee({login:e}),be(Kg)):console.warn(t)},connectOrCreateWallet:async()=>{m||(await new Promise((e=>{ne((()=>e))})),ne(null)),y?console.warn("User must be unauthenticated to `connectOrCreateWallet`"):(we.current="connect-or-create",be(bg))},logout:async()=>{if(we.current=null,fe.current=null,T&&a.clearProviderAcccessTokens(T),P(null),await a.logout(),T&&G)try{await G.clearMfa({userId:T.id})}catch(e){}x(null),f(!1),ws(pe,"logout","onSuccess"),p(!1),Ar.del(ha),Ar.del(ua(J.id))},getAccessToken:h((()=>a.getCustomerAccessToken()),[a]),unlinkWallet:async e=>{let t;return x(t=e.startsWith("0x")?await a.unlinkEthereumWallet(e):await a.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await a.unlinkEmail(e);return x(t),t},unlinkPhone:async e=>{let t=await a.unlinkPhone(e);return x(t),t},unlinkGoogle:async e=>{let t=await a.unlinkOAuth("google",e);return x(t),t},unlinkTwitter:async e=>{let t=await a.unlinkOAuth("twitter",e);return x(t),t},unlinkDiscord:async e=>{let t=await a.unlinkOAuth("discord",e);return x(t),t},unlinkGithub:async e=>{let t=await a.unlinkOAuth("github",e);return x(t),t},unlinkSpotify:async e=>{let t=await a.unlinkOAuth("spotify",e);return x(t),t},unlinkInstagram:async e=>{let t=await a.unlinkOAuth("instagram",e);return x(t),t},unlinkTiktok:async e=>{let t=await a.unlinkOAuth("tiktok",e);return x(t),t},unlinkLinkedIn:async e=>{let t=await a.unlinkOAuth("linkedin",e);return x(t),t},unlinkApple:async e=>{let t=await a.unlinkOAuth("apple",e);return x(t),t},unlinkFarcaster:async e=>{let t=await a.unlinkFarcaster(e);return x(t),t},unlinkTelegram:async e=>{let t=await a.unlinkTelegram(e);return x(t),t},unlinkPasskey:async e=>{let t=await fb();if(!t)throw Error("Must have valid access token to enroll in MFA");if(!G)throw Error("Wallet proxy not initialized.");let n=J.passkeys.shouldUnenrollMfaOnUnlink;await G.unlinkPasskeyAccount({credentialId:e,accessToken:t,removeAsMfa:n});let r=await a.getAuthenticatedUser();return x(r),r},unlinkCrossAppAccount:async({subject:e})=>{let t=T?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new de("Invalid subject");a.storeProviderAccessToken(t.id,null);let n=await a.unlinkOAuth(`privy:${t.id}`,e);return x(n),n},setWalletRecovery:async e=>$e({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>$e({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t)=>new Promise((async(n,r)=>{let{requesterAppId:i}=t?.uiOptions||{},o=e.message;if(!y||!T)return ws(pe,"signMessage","onError",ke.MUST_BE_AUTHENTICATED),void r(Error("User must be authenticated before signing with a Privy wallet"));let s=t?.address?fi(T,t.address):ui(T);if(!s)throw new de("User must have an embedded wallet.");let c=s.address,d=s.walletIndex??0,{entropyId:h,entropyIdVerifier:u}=bi(T,s),p=Ey(s);if("string"!=typeof o||o.length<1)return ws(pe,"signMessage","onError",ke.INVALID_MESSAGE),void r(Error("Message must be a non-empty string"));let m=async()=>{let e;if(!y)throw Error("User must be authenticated before signing with a Privy wallet");let t=await fb();if(!G||!t||!await He.recoverPrimaryWallet())throw Error("Unable to connect to wallet");if(a.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:c,requesterAppId:i}}),p){let n=await se(l,(async({message:e})=>await G.signWithUserSigner({accessToken:t,requesterAppId:i,message:e})),{chain_type:"ethereum",method:"personal_sign",params:{message:o,encoding:"utf-8"},wallet_id:s.id});if(!n.data||!("signature"in n.data))throw new _i("Unable to sign message");e=n.data.signature}else{let{response:n}=await G.rpc({accessToken:t,entropyId:h,entropyIdVerifier:u,chainType:"ethereum",hdWalletIndex:d,requesterAppId:i,request:{method:"personal_sign",params:[o,c]}});e=n.data}return a.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:c,requesterAppId:i}}),e};if(Ce({showWalletUIs:t?.uiOptions?.showWalletUIs}))try{let e=await m();ws(pe,"signMessage","onSuccess",{signature:e}),n({signature:e})}catch(e){ws(pe,"signMessage","onError",ke.UNABLE_TO_SIGN),r(e??new _i("Unable to sign message"))}else ee({signMessage:{method:"personal_sign",data:o,confirmAndSign:m,onSuccess:e=>{ws(pe,"signMessage","onSuccess",{signature:e}),n({signature:e})},onFailure:e=>{ws(pe,"signMessage","onError",ke.UNABLE_TO_SIGN),r(e)},uiOptions:t?.uiOptions||{}},connectWallet:{recoveryMethod:s.recoveryMethod,connectingWalletAddress:c,entropyId:h,entropyIdVerifier:u,onCompleteNavigateTo:Mv,isUnifiedWallet:p,onFailure:e=>{ws(pe,"signMessage","onError",ke.UNKNOWN_CONNECT_WALLET_ERROR),r(e)}}}),be(Lw)})),signTypedData:(e,t)=>new Promise((async(n,r)=>{let{requesterAppId:i}=t?.uiOptions||{};if(!y||!T)return ws(pe,"signTypedData","onError",ke.MUST_BE_AUTHENTICATED),void r(Error("User must be authenticated before signing with a Privy wallet"));let o=t?.address?fi(T,t.address):ui(T);if(!o)throw new de("User must have an embedded wallet.");let s=o.address,c=o.walletIndex??0,{entropyId:d,entropyIdVerifier:h}=bi(T,o),u=Ey(o),p=$r(e),m=async()=>{let e;if(!y)throw Error("User must be authenticated before signing with a Privy wallet");let t=await fb();if(!G||!t||!await He.recoverPrimaryWallet())throw Error("Unable to connect to wallet");if(a.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:s,requesterAppId:i}}),u){let{domain:n,types:r,primaryType:a,message:s}=p,c=await se(l,(async({message:e})=>await G.signWithUserSigner({accessToken:t,requesterAppId:i,message:e})),{chain_type:"ethereum",method:"eth_signTypedData_v4",params:{typed_data:{domain:n,types:r,primary_type:a,message:s}},wallet_id:o.id});if(!c.data||!("signature"in c.data))throw new _i("Unable to sign message");e=c.data.signature}else{let{response:n}=await G.rpc({accessToken:t,entropyId:d,entropyIdVerifier:h,chainType:"ethereum",hdWalletIndex:c,requesterAppId:i,request:{method:"eth_signTypedData_v4",params:[s,p]}});e=n.data}return a.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:s,requesterAppId:i}}),e};if(Ce({showWalletUIs:t?.uiOptions?.showWalletUIs}))try{let e=await m();ws(pe,"signTypedData","onSuccess",{signature:e}),n({signature:e})}catch(e){ws(pe,"signTypedData","onError",ke.UNABLE_TO_SIGN),r(e??new _i("Unable to sign message"))}else ee({signMessage:{method:"eth_signTypedData_v4",data:p,confirmAndSign:m,onSuccess:e=>{ws(pe,"signTypedData","onSuccess",{signature:e}),n({signature:e})},onFailure:e=>{ws(pe,"signTypedData","onError",ke.UNABLE_TO_SIGN),r(e)},uiOptions:t?.uiOptions||{}},connectWallet:{recoveryMethod:o.recoveryMethod,connectingWalletAddress:o.address,entropyId:d,isUnifiedWallet:u,entropyIdVerifier:h,onCompleteNavigateTo:Mv,onFailure:e=>{ws(pe,"signMessage","onError",ke.UNKNOWN_CONNECT_WALLET_ERROR),r(e)}}}),be(Lw)})),sendTransaction:async(e,t)=>await Fe({transaction:e,uiOptions:t?.uiOptions,fundWalletConfig:t?.fundWalletConfig,address:t?.address,signOnly:!1}),signTransaction:async(e,t)=>({signature:(await Fe({transaction:e,uiOptions:t?.uiOptions,address:t?.address,signOnly:!0})).hash}),exportWallet:e=>new Promise((async(t,r)=>{if(!y||!T)return void r(Error("User must be authenticated before exporting their Privy wallet"));e&&"target"in e&&e&&(e=void 0);let i=e?.address?fi(T,e.address):ui(T),o=wi(T);if(!i||!o)return void r(new de("User must have an embedded wallet."));let s=i.address,{entropyId:l,entropyIdVerifier:c}=bi(T,i),d=Ey(i);if(!s)return void r(Error("User does not have an HD Ethereum wallet. To export an imported wallet, pass the `address` of the wallet to `exportWallet`."));if(!b(s))return void r(Error("Must provide a valid Ethereum address."));let h={recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,isUnifiedWallet:d,entropyId:l,entropyIdVerifier:c,onCompleteNavigateTo:Pw,onFailure:r,shouldForceMFA:!0};ee(X),await fb()&&G?G?(ee({keyExport:{appId:n.appId,appClientId:n.clientId,origin:a.apiUrl,walletToExport:i,primaryWallet:o,onSuccess:t,onFailure:r},connectWallet:h}),be(Lw)):r(Error("Must have a Privy wallet before exporting")):r(Error("Must have valid access token to enroll in MFA"))})),promptMfa:De,async init(e){switch(e){case"sms":return void await a.initMfaSmsVerification();case"passkey":return await a.initMfaPasskeyVerification();case"totp":return;default:throw Error(`Unsupported MFA method: ${e}`)}},async submit(e,t){switch(e){case"totp":case"sms":if("string"!=typeof t)throw new de("Invalid MFA code");ce.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{he.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new de("Invalid authenticator response");let n=await import("@simplewebauthn/browser"),r=(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}))(await n.startAuthentication(t));ce.current?.resolve({mfaMethod:e,mfaCode:r,relyingParty:window.origin}),await new Promise(((e,t)=>{he.current={resolve:e,reject:t}}));break;default:throw ce.current?.reject(new de("Unsupported MFA method")),new de(`Unsupported MFA method: ${e}`)}},cancel(){ce.current?.reject(new de("MFA canceled"))},async initEnrollmentWithSms(e){let t=await fb();if(!t||!G)throw Error("Must have valid access token to enroll in MFA");await G.initEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber})},enrollInMfa:e=>new Promise(((t,n)=>{if(!e)return He.closePrivyModal(),void t();J.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."),ee({mfaEnrollmentFlow:{mfaMethods:J.mfa.methods,shouldUnlinkOnUnenrollMfa:J.passkeys.shouldUnlinkOnUnenrollMfa,onSuccess:t,onFailure:n}}),be(YC)})),async initEnrollmentWithTotp(){let e=await fb();if(!e||!G)throw Error("Must have valid access token to enroll in MFA");let t=await G.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await fb();if(!t||!G)throw Error("Must have valid access token to enroll in MFA");await G.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),x(await a.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await fb();if(!t||!G)throw Error("Must have valid access token to enroll in MFA");await G.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),x(await a.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e},t={}){let n=await fb();if(!n||!G)throw Error("Must have valid access token to enroll in MFA");await G.submitEnrollMfa({method:"passkey",accessToken:n,credentialIds:e,removeForLogin:t.removeForLogin}),x(await a.getAuthenticatedUser())},async unenroll(e,t={}){let n=await fb();if(!n||!G)throw Error("Must have valid access token to remove MFA");"passkey"===e?await G.submitEnrollMfa({method:"passkey",accessToken:n,credentialIds:[],removeForLogin:t.removeForLogin}):await G.unenrollMfa({method:e,accessToken:n}),x(await a.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await fb(),t=T?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!G||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(!T?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await He.recoverPrimaryWallet())throw Error("Unable to connect to wallet");let n=await G.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===n.status&&x(await a.getAuthenticatedUser()||T||null),ee({farcasterSigner:n}),be(TC)},getFarcasterSignerPublicKey:async()=>{let e,t=await fb(),n=T?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!G||!n)throw Error("Must have an embedded wallet to use Farcaster signers");if(!T?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await He.recoverPrimaryWallet())throw Error("Unable to connect to wallet");if(!T.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=T.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await fb(),n=T?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!G||!n)throw Error("Must have an embedded wallet to use Farcaster signers");if(!T?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await He.recoverPrimaryWallet())throw Error("Unable to connect to wallet");if(!T.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let r=await import("@simplewebauthn/browser"),a=await G.signFarcasterMessage({address:n.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:r.bufferToBase64URLString(e)},fid:BigInt(T.farcaster.fid),relyingParty:window.origin});return new Uint8Array(r.base64URLStringToBuffer(a.signature))},signMessageWithCrossAppWallet(e,{address:t,chainId:n}){let r=T?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return oh({user:T,client:a,address:t,requesterAppId:J.id,request:{method:r?"privy_signSmartWalletMessage":"personal_sign",params:[e,t],chainId:n},reconnect:je})},signTypedDataWithCrossAppWallet(e,{address:t,chainId:n}){let r=T?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t)))),i=$r(e);return oh({user:T,client:a,address:t,requesterAppId:J.id,request:{method:r?"privy_signSmartWalletTypedData":"eth_signTypedData_v4",params:[t,i],chainId:n},reconnect:je})},sendTransactionWithCrossAppWallet(e,{address:t}){let n=T?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return oh({user:T,client:a,address:t,requesterAppId:J.id,request:{method:n?"privy_sendSmartWalletTx":"eth_sendTransaction",params:[e],chainId:e.chainId},reconnect:je})},isModalOpen:u,mfaMethods:J.mfa.methods};db=Ve.signMessage,hb=Ve.signTypedData,pb=async(e,t)=>await Fe({transaction:e,...t,signOnly:!1}),ub=async(e,t)=>({signature:(await Fe({transaction:e,...t,signOnly:!0})).hash});let He={privy:l,setAuthenticated:f,setUser:x,setIsNewUser:N,isNewUserThisSession:S,pendingTransaction:null,walletConnectionStatus:O,connectors:a.connectors?.walletConnectors??[],solanaWallets:_,rpcConfig:J.rpcConfig,chains:J.chains,appId:n.appId,showFiatPrices:"native-token"!==J.embeddedWallets.priceDisplay.primary,clientAnalyticsId:a.clientAnalyticsId,onCustomAuthAuthenticated:Te,hideWalletUIs:ve,isHeadlessSigning:h(Ce,[J.embeddedWallets.showWalletUIs]),emailOtpState:D,setEmailOtpState:B,smsOtpState:z,setSmsOtpState:$,oAuthState:H,setOAuthState:q,telegramAuthState:K,setTelegramAuthState:Z,siweState:j,setSiweState:V,isHeadlessOAuthLoading:W,nativeTokenSymbolForChainId:e=>J.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(G)return G;let t=new Promise((e=>{re.current=e})),n=new Promise((t=>setTimeout((()=>t(null)),e))),r=await Promise.race([t,n]);return re.current=null,r},getAuthFlow:()=>a.authFlow,getAuthMeta:()=>a.authFlow?.meta,client:a,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,r=m&&y&&T;r&&fe.current&&(t=Be(T)),"login"===we.current?e.shouldCallAuthOnSuccess&&r&&fe.current?ws(pe,"login","onComplete",{user:T,isNewUser:S,wasAlreadyAuthenticated:!1,loginMethod:fe.current,loginAccount:t??null}):ws(pe,"login","onError",ke.USER_EXITED_AUTH_FLOW):"link"===we.current&&t?e.isSuccess&&r&&fe.current?ws(pe,"linkAccount","onSuccess",{user:T,linkMethod:fe.current,linkedAccount:t}):fe.current&&ws(pe,"linkAccount","onError",ke.USER_EXITED_LINK_FLOW,{linkMethod:fe.current}):"update"===we.current&&t?e.isSuccess&&r&&fe.current?ws(pe,"update","onSuccess",{user:T,updateMethod:fe.current,updatedAccount:t}):fe.current&&ws(pe,"update","onError",ke.USER_EXITED_UPDATE_FLOW,{linkMethod:fe.current}):"connect-or-create"===we.current&&(A[0]?ws(pe,"connectOrCreateWallet","onSuccess",{wallet:A[0]}):ws(pe,"connectOrCreateWallet","onError",ke.USER_EXITED_AUTH_FLOW));let i=M&&hC.has(M),o=M===rp&&X.errorModalData&&hC.has(X.errorModalData.previousScreen);if((i||o)&&X.funding){let e,t=hC.get(M)??null;if("solana"===X.funding.chainType){let n=c(xy);if(n)try{e=BigInt(await n.getBalance({address:X.funding.address,cluster:X.funding.cluster}))}catch{console.error("Unable to pull wallet balance")}else console.warn("Unable to load solana plugin, skipping balance");ws(pe,"fundSolanaWallet","onUserExited",{address:X.funding.address,cluster:X.funding.cluster,fundingMethod:t,balance:e})}else{let r=Sr(X.funding.chain.id,J.chains,J.rpcConfig,{appId:n.appId});try{e=await r.getBalance({address:X.funding.address})}catch{console.error("Unable to pull wallet balance")}ws(pe,"fundWallet","onUserExited",{address:X.funding.address,chain:X.funding.chain,fundingMethod:t,balance:e})}}ee({...X,externalConnectWallet:{suggestedAddress:void 0}}),we.current=null,fe.current=null,N(!1),p(!1),setTimeout((()=>{a.authFlow=void 0}),200)},openPrivyModal:be,connectWallet:Ee,initLoginWithWallet:async(e,t,n)=>{Si(e)?(fe.current="siwe",Se(e,t,n)):(fe.current="siws",Ne(e,t,n))},loginWithWallet:async()=>{let e,t,n;if(!m)throw new Nt;if(a.authFlow instanceof Ga?e="siwe":a.authFlow instanceof Ja&&(e="siws"),!e)throw new de("Must initialize SIWE/SIWS flow first.");if(null!==await a.getAccessToken())try{({user:t}=await a.link()),fe.current=e}catch(t){throw ws(pe,"linkAccount","onError",t.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:n}=await a.authenticate()),fe.current=e}catch(e){throw ws(pe,"login","onError",e.privyErrorCode||ke.GENERIC_CONNECT_WALLET_ERROR),e}x(t||T||null),N(n||!1),f(!0)},delegateWallet:async({address:e,chainType:t,showDelegationUIs:n})=>new Promise((async(r,a)=>{let i=await fb();if(!y||!T||!i)throw new de("User must be authenticated and have an embedded wallet to delegate actions.");if("solana"!==t&&"ethereum"!==t)throw new de("Only Solana and Ethereum embedded wallets are supported for delegation and revocation.");let o=He.walletProxy??await He.initializeWalletProxy(15e3);if(!o)throw new de("Wallet proxy not initialized.");if((({address:e,user:t})=>!!Yd(t).find((t=>t.address===e)))({address:e,user:T}))return r();let s=Zd({address:e,user:T}),l=Gd({address:e,user:T}),c=async()=>{await o.createDelegatedAction({accessToken:i,rootWallet:l,delegatedWallets:[s]}),await He.refreshSessionAndUser()};if(await He.recoverPrimaryWallet(),n)ee({delegatedActions:{consent:{address:e,onDelegate:c,onSuccess:async()=>{r()},onError:async e=>{a(e)}}}}),be(fC);else try{await c(),r()}catch(e){a(e)}})),revokeDelegatedWallets:async({showDelegationUIs:e})=>new Promise((async(t,n)=>{if(!y||!T)throw new de("User must be authenticated and have an embedded wallet to revoke a delegated wallet.");if(0===Yd(T).length)throw new de("User has no delegated wallets to revoke.");let r=async()=>{await a.revokeDelegatedWallet(),await He.refreshSessionAndUser()};if(e)ee({delegatedActions:{revoke:{onRevoke:r,onSuccess:async()=>{t()},onError:async e=>{n(e)}}}}),be(CC);else try{await r(),t()}catch(e){n(e)}})),initLoginWithFarcaster:async(e,t)=>{let n=new Qr(e,t);a.startAuthFlow(n);try{fe.current="farcaster",await n.initializeFarcasterConnect()}catch(e){throw"login"===we.current?ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR):"link"===we.current&&ws(pe,"linkAccount","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!m)throw new Nt;if(!(a.authFlow instanceof Qr))throw new de("Must initialize Farcaster flow first.");if(null!==await a.getAccessToken())try{({user:e}=await a.link()),fe.current="farcaster"}catch(e){throw ws(pe,"linkAccount","onError",e.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await a.authenticate()),fe.current="farcaster"}catch(e){throw ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR),e}x(e||null),N(t||!1),f(!0)},async crossAppAuthFlow({appId:e,popup:t,action:n}){let r=`privy:${e}`;fe.current=r;let{url:i,stateCode:o,codeVerifier:s}=await async function({api:e,appId:t}){let n=Ea(),r=Sa(),a=await Na(n);try{let{url:i}=await e.post(xe,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:a,state_code:r});return{url:i,stateCode:r,codeVerifier:n}}catch(e){throw ue(e)}}({api:a.api,appId:e});if(!i)throw a.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new de("No authorization URL returned for cross-app auth.");try{let l=await async function({url:e,popup:t}){return t.location=e,new Promise(((e,n)=>{let r,a=setTimeout((()=>{n(new de("Authorization request timed out after 2 minutes.")),i()}),12e4);function i(){t?.close(),window.removeEventListener("message",s)}let o=setInterval((()=>{t?.closed&&!r&&(i(),clearInterval(o),clearTimeout(a),n(new de("User rejected request")))}),300);function s(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(a),e(t.data),i()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(a),n(new de(t.data.error)),i()),t.data.type===th&&((r=new BroadcastChannel(eh)).onmessage=s))}window.addEventListener("message",s)}))}({url:i,popup:t,provider:r}),c=l.stateCode,d=l.authorizationCode;if(c!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:r,storedStateCode:o??"",returnedStateCode:c??""}}),new de("Unexpected auth flow. This may be a phishing attempt.",void 0,ke.OAUTH_UNEXPECTED);let h=await async function({appId:e,stateCode:t,codeVerifier:n,authorizationCode:r,action:a,client:i}){if(!r||!t)throw new de("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===r)throw new de("User denied confirmation during cross-app auth flow");try{let o=new nh({authorizationCode:r,stateCode:t,codeVerifier:n,provider:`privy:${e}`});i.startAuthFlow(o);let s="link"===a?await i.link():await i.authenticate(),l=s.oAuthTokens?.accessToken;return console.debug(),l}catch(e){let t=ue(e);if(t.privyErrorCode)throw new de(t.message||"Invalid code during cross-app auth flow.",void 0,t.privyErrorCode);if("User denied confirmation during cross-app auth flow"===t.message)throw new de("Invalid code during cross-app auth flow.",void 0,ke.OAUTH_USER_DENIED);throw new de("Invalid code during cross-app auth flow.",void 0,ke.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:s,stateCode:c,authorizationCode:d,action:n,client:a});h&&a.storeProviderAccessToken(e,h);let u=await He.refreshSessionAndUser();if(!u)throw new de("Unable to update user");return a.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),u}catch(e){throw a.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:r}}),e}},async initLoginWithOAuth(e,t,n){if(fe.current=e,!xr())return void be(IC);if("google"===e&&Bm(window.navigator.userAgent))return void be(IC);"twitter"===e&&window.opener&&window.opener.postMessage({type:th},"*"),Ar.del(ya),Ar.del(fa);let r=new Ma({provider:e,disableSignup:!!n,withPrivyUi:!0});t&&r.addCaptchaToken(t),a.startAuthFlow(r);let i=await a.authFlow.getAuthorizationUrl();i&&i.url&&("twitter"===e&&w&&(i.url=i.url.replace("x.com","twitter.com")),window.location.assign(i.url))},async initLoginWithTelegram(e,t){if(!m)throw new Nt;fe.current="telegram";let n=new ai(e,t);a.startAuthFlow(n),Z({status:"loading"}),n.meta.telegramWebAppData=void 0,n.meta.telegramAuthResult=await new Promise(((e,t)=>J.loginConfig.telegramAuthConfiguration?window.Telegram?void window.Telegram.Login.auth({bot_id:J.loginConfig.telegramAuthConfiguration.botId,request_access:!0},(n=>n?e(n):t(new de("Telegram auth failed or was canceled by the client")))):t(new de("Telegram was not initialized")):t(new de("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(e){let t,n;if(!(a.authFlow instanceof ai))throw new de("Must initialize Telegram flow before calling loginWithTelegram");a.authFlow.meta.captchaToken||=e?.captchaToken;let r=await fb(),i=e?.intent||we.current;if("login"===i)try{let e=await a.authenticate();t=e.user,n=e.isNewUser,fe.current="telegram"}catch(e){throw ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR),e}else{if("link"!==i)throw new de("Unknown auth intent");try{t=(await a.link()).user,fe.current="telegram"}catch(e){throw ws(pe,"linkAccount","onError",e.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}x(t),N(n||!1),f(!0),Z({status:"done"});let o=t?.linkedAccounts.find((({type:e})=>"telegram"===e))||null;return{user:t,isNewUser:n||!1,wasAlreadyAuthenticated:!!r,loginAccount:o}},async loginWithOAuth(e){let t,n,r;if(!(a.authFlow instanceof Ma))throw new de("Must initialize OAuth flow before calling loginWithOAuth");let i=Ar.get(ma),o=a.authFlow.meta.stateCode;if(i!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:o??""}}),new de("Unexpected auth flow. This may be a phishing attempt.",void 0,ke.OAUTH_UNEXPECTED);if(null!==await a.getAccessToken())try{let n=await a.link();t=n.user,r=n.oAuthTokens,fe.current=e}catch(t){throw ws(pe,"linkAccount","onError",t.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await a.authenticate();t=i.user,n=i.isNewUser,r=i.oAuthTokens,fe.current=e}catch(t){throw"login"===we.current?ws(pe,"login","onError",t.privyErrorCode||ke.UNKNOWN_AUTH_ERROR):"link"===we.current&&ws(pe,"linkAccount","onError",t.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return x(t),N(n||!1),f(!0),r&&t&&ws(pe,"oAuthAuthorization","onOAuthTokenGrant",{oAuthTokens:r,user:t}),r},passkeyAuthState:R,setPasskeyAuthState:F,async initSignupWithPasskey({captchaToken:e,withPrivyUi:t}){let n=new Ka({captchaToken:e,setPasskeyAuthState:F});a.startAuthFlow(n),we.current="login";try{fe.current="passkey",F({status:"generating-challenge"}),await n.initRegisterFlow(t),F({status:"awaiting-passkey"})}catch(e){throw F({status:"error",error:e}),ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR),e}},async signupWithPasskey(){let e,t;if(!m)throw new Nt;if(!(a.authFlow instanceof Ka))throw new de("Must initialize Passkey flow first.");if("passkey"!==fe.current){let e=new de("Must init login with Passkey flow first.");throw F({status:"error",error:e}),e}let n=await fb();try{fe.current="passkey",F({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await a.authenticate())}catch(e){throw F({status:"error",error:e}),ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR),e}x(e),N(t||!1),f(!0),F({status:"done"});let r=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!n,loginAccount:r}},async initLoginWithPasskey({captchaToken:e,withPrivyUi:t}){let n=new Ka({captchaToken:e,setPasskeyAuthState:F});a.startAuthFlow(n),we.current="login";try{fe.current="passkey",F({status:"generating-challenge"}),await n.initAuthenticationFlow(t),F({status:"awaiting-passkey"})}catch(e){throw F({status:"error",error:e}),ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(e){let t,n;if(!m)throw new Nt;if(!(a.authFlow instanceof Ka))throw new de("Must initialize Passkey flow first.");if(e?.credentialIds&&(a.authFlow.meta.allowedCredentialsIds=e.credentialIds),"passkey"!==fe.current){let e=new de("Must init login with Passkey flow first.");throw F({status:"error",error:e}),e}let r=await fb();try{fe.current="passkey",F({status:"awaiting-passkey"}),({user:t,isNewUser:n}=await a.authenticate())}catch(e){throw F({status:"error",error:e}),ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR),e}x(t),N(n||!1),f(!0),F({status:"done"});let i=t?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:t,isNewUser:n||!1,wasAlreadyAuthenticated:!!r,loginAccount:i}},async initLinkWithPasskey(e){let t=new Ka({captchaToken:e});a.startAuthFlow(t),we.current="link",fe.current="passkey",F({status:"generating-challenge"});try{await t.initLinkFlow(),F({status:"awaiting-passkey"})}catch(e){throw ws(pe,"linkAccount","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),F({status:"error",error:e}),e}},async linkWithPasskey(){let e;if(!m)throw new Nt;if(!(a.authFlow instanceof Ka))throw new de("Must initialize Passkey flow first.");if("passkey"!==fe.current)throw new de("Must init login with Passkey flow first.");try{fe.current="passkey",({user:e}=await a.link())}catch(e){throw ws(pe,"linkAccount","onError",e.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return x(e||T||null),F({status:"done"}),e},async initLoginWithHeadlessOAuth(e,t,n){if(!xr())throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");if("google"===e&&Bm(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.");let r=new Ma({provider:e,withPrivyUi:!1,disableSignup:n??!1});t&&r.addCaptchaToken(t),q({status:"loading"});let i=await a.startAuthFlow(r).getAuthorizationUrl();i?.url&&window.location.assign(i.url)},async loginWithHeadlessOAuth(e){let t,n,r;U(!0),q({status:"loading"}),a.startAuthFlow(new Ma(e));let i=Ar.get(ma),o=e.stateCode;if(i!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:o??""}}),U(!1),new de("Unexpected auth flow. This may be a phishing attempt.",void 0,ke.OAUTH_UNEXPECTED);if(null!==await a.getAccessToken())try{({user:t,oAuthTokens:r}=await a.link()),fe.current=e.provider;let n=Be(t);t&&n&&ws(pe,"linkAccount","onSuccess",{user:t,linkMethod:fe.current,linkedAccount:n})}catch(t){throw U(!1),ws(pe,"linkAccount","onError",t.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:n,oAuthTokens:r}=await a.authenticate()),fe.current=e.provider;let i=Be(t);t&&i&&void 0!==n&&ws(pe,"login","onComplete",{user:t,isNewUser:n,wasAlreadyAuthenticated:!1,loginMethod:fe.current,loginAccount:i})}catch(e){throw U(!1),q({status:"error",error:e}),ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR),e}return x(t),N(n||!1),f(!0),U(!1),q({status:"done"}),r&&t&&ws(pe,"oAuthAuthorization","onOAuthTokenGrant",{oAuthTokens:r,user:t}),t??void 0},initLoginWithEmail:async({email:e,captchaToken:t,disableSignup:n,withPrivyUi:r})=>{let i=new br({email:e,captchaToken:t,disableSignup:n});a.startAuthFlow(i);try{fe.current="email",B({status:"sending-code"}),await i.sendCodeEmail({withPrivyUi:r}),B({status:"awaiting-code-input"})}catch(e){throw B({status:"error",error:e}),"login"===we.current?ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR):"link"===we.current&&ws(pe,"linkAccount","onError",e.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async(e,t,n)=>{let r=new kr(e,t,n);a.startAuthFlow(r);try{await r.sendCodeEmail({withPrivyUi:!0})}catch(e){ws(pe,"update","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR,{linkMethod:fe.current})}},initUpdatePhone:async(e,t,n)=>{let r=new Xa(e,t,n);a.startAuthFlow(r);try{await r.sendSmsCode({withPrivyUi:!0})}catch(e){ws(pe,"update","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR,{linkMethod:fe.current})}},initLoginWithSms:async({phoneNumber:e,captchaToken:t,disableSignup:n,withPrivyUi:r})=>{$({status:"sending-code"});let i=new Qa({phoneNumber:e,captchaToken:t,disableSignup:n});a.startAuthFlow(i);try{fe.current="sms",await i.sendSmsCode({withPrivyUi:r}),$({status:"awaiting-code-input"})}catch(e){throw $({status:"error",error:e}),"login"===we.current?ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR):"link"===we.current&&ws(pe,"linkAccount","onError",e.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(a.authFlow?.sendCodeEmail({withPrivyUi:!0}))},resendSmsCode:async()=>{await(a.authFlow?.sendSmsCode({withPrivyUi:!0}))},loginWithCode:async e=>{let t,n;function r(e){a.authFlow instanceof br?B(e):a.authFlow instanceof Qa&&$(e)}if(r({status:"submitting-code"}),!m){let e=new Nt;throw r({status:"error",error:e}),e}if(a.authFlow instanceof br)a.authFlow.meta.emailCode=e.trim();else{if(!(a.authFlow instanceof Qa)){let e=new de("Must initialize a passwordless code flow first");throw r({status:"error",error:e}),e}a.authFlow.meta.smsCode=e.trim()}let i=await fb();if("link"===we.current)try{({user:t}=await a.link())}catch(e){throw r({status:"error",error:e}),ws(pe,"linkAccount","onError",e.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:fe.current}),e}else if("update"===we.current)try{({user:t}=await a.link())}catch(e){throw r({status:"error",error:e}),ws(pe,"update","onError",e.privyErrorCode||ke.FAILED_TO_UPDATE_ACCOUNT,{linkMethod:fe.current}),e}else try{({user:t,isNewUser:n}=await a.authenticate())}catch(e){throw r({status:"error",error:e}),ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR),e}let o=t||T;x(o||null),N(n||!1),f(!0),r({status:"done"});let s=null;return a.authFlow instanceof br?s=o?.linkedAccounts.find((({type:e})=>"email"===e))||null:a.authFlow instanceof Qa&&(s=o?.linkedAccounts.find((({type:e})=>"phone"===e))||null),{user:o,isNewUser:n||!1,wasAlreadyAuthenticated:!!i,linkedAccount:s}},generateSiweMessage:async({address:e,chainId:t,captchaToken:n})=>{we.current=y?"link":"login",fe.current="siwe",V({status:"generating-message"});let r=await a.generateSiweNonce({address:e,captchaToken:n});return V({status:"awaiting-signature"}),Za({address:e,chainId:t.replace("eip155:",""),nonce:r})},generateSiweMessageForSmartWallet:async({address:e,chainId:t})=>{let n=await a.generateSiweNonce({address:e});return Za({address:e,chainId:t.replace("eip155:",""),nonce:n})},linkSmartWallet:async({message:e,signature:t,smartWalletType:n})=>{let r;r=await a.linkSmartWallet({message:e,signature:t,smartWalletType:n}),x((r=await He.refreshSessionAndUser()??r)||T||null)},loginWithSiwe:async({message:e,signature:t,captchaToken:n,disableSignup:r})=>{let i,o=null;try{if(T)throw Error("User already authenticated");let s=new Ga(a,void 0,n,r,{message:e,signature:t});a.startAuthFlow(s),fe.current="siwe",we.current="login",V({status:"submitting-signature"});let l=await a.authenticate();if(({user:o,isNewUser:i}=l),!o)throw Error("Authentication failed - no user returned")}catch(e){throw ws(pe,"login","onError",e.privyErrorCode||ke.UNKNOWN_AUTH_ERROR),V({status:"error",error:e}),e}return x(o),N(i||!1),f(!0),V({status:"done"}),we.current=null,fe.current=null,o},linkWithSiwe:async({message:e,signature:t,chainId:n,walletClientType:r,connectorType:i})=>{let o;Pe("siwe");let s=null;try{V({status:"submitting-signature"}),o=await a.linkWithSiwe({message:e,signature:t,chainId:n,walletClientType:r,connectorType:i}),o=await He.refreshSessionAndUser()??o,V({status:"done"}),(s=Be(o)||null)&&ws(pe,"linkAccount","onSuccess",{user:o,linkMethod:"siwe",linkedAccount:s})}catch(e){throw ws(pe,"linkAccount","onError",e.privyErrorCode||ke.FAILED_TO_LINK_ACCOUNT,{linkMethod:"siwe"}),we.current=null,fe.current=null,V({status:"error",error:e}),e}let l=o||T;return x(l||null),we.current=null,fe.current=null,{user:l,linkedAccount:s}},refreshSessionAndUser:async()=>{let e=await a.getAuthenticatedUser();return f(!!e),x(e),e},walletProxy:G,createAnalyticsEvent:({eventName:e,payload:t,timestamp:n})=>a.createAnalyticsEvent({eventName:e,payload:t,timestamp:n}),acceptTerms:async()=>{let e=await a.acceptTerms();return x(e),e},getUsdTokenPrice:e=>a.getUsdTokenPrice(e),getUsdPriceForSol:()=>a.getUsdPriceForSol(),getSplTokenMetadata:e=>a.getSplTokenMetadata(e),recoverPrimaryWallet:async e=>new Promise((async(t,n)=>{if(!T)return void t(!0);let r=wi(e?.user??T)||gi(e?.user??T)||yi(e?.user??T);if(!r||Ey(r))return void t(!0);let i=await fb();if(!i||!G||!r)return void n(Error("Must have valid access token and Privy wallet to recover wallet"));let{entropyId:o,entropyIdVerifier:s}=bi(T,r);try{await G.connect({accessToken:i,entropyId:o,entropyIdVerifier:s}),t(!0)}catch(e){Gc(e)&&"privy"===r.recoveryMethod?(a.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:r.address}}),(await G.recover({entropyId:o,entropyIdVerifier:s,accessToken:i})).entropyId||n(Error("Unable to recover wallet")),a.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:r.address}}),t(!0)):Gc(e)&&"privy"!==r.recoveryMethod&&"privy-v2"!==r.recoveryMethod?(ee({recoverWallet:{entropyId:o,entropyIdVerifier:s,onFailure:n,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:r.recoveryMethod,action:"recover",shouldCreateEth:!1,shouldCreateSol:!1}}),be(ly(r.recoveryMethod))):n(e)}})),exportSolanaWallet:e=>new Promise((async(t,r)=>{if(!y||!T)return void r(Error("User must be authenticated before exporting their Privy wallet"));let i=e?.address?fi(T,e.address):mi(T),o=mi(T);if(!i||!o)return void r(Error("Must have a Privy wallet before exporting"));let s=Ey(o);await fb()&&G?G?(ee({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,entropyId:o.address,entropyIdVerifier:"solana-address-verifier",isUnifiedWallet:s,onCompleteNavigateTo:Pw,onFailure:r,shouldForceMFA:!0},keyExport:{appId:n.appId,appClientId:n.clientId,origin:a.apiUrl,walletToExport:i,primaryWallet:o,onSuccess:t,onFailure:r}}),be(Lw)):r(Error("Must have a Privy wallet before exporting")):r(Error("Must have valid access token to enroll in MFA"))})),setReadyToTrue:e=>{g(!0),te?.(e)},updateWallets:()=>Re(),fundWallet:async(e,t)=>{ee({funding:_w({address:e,appConfig:J,fundWalletConfig:t,methodScreen:bw})}),be(bw)},openModal:be,requestFarcasterSignerStatus:async e=>{let t=await fb(),n=T?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!G||!n)throw Error("Must have an embedded wallet to use Farcaster signers");if(!T?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let r=await a.requestFarcasterSignerStatus(e);return"approved"===r.status&&x(await a.getAuthenticatedUser()||T||null),r},connectCoinbaseSmartWallet:async()=>{J.externalWallets.coinbaseWallet.connectionOptions="smartWalletOnly";let e=a.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||a.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),Ee(e);await _e("coinbase_wallet","coinbase_smart_wallet")},initiateAccountTransfer:async({nonce:e,account:t,accountType:n,externalWalletMetadata:r,telegramAuthResult:i,telegramWebAppData:o,farcasterEmbeddedAddress:s,oAuthUserInfo:l})=>{let c=await a.sendAccountTransferRequest({nonce:e,account:t,accountType:n,externalWalletMetadata:r,telegramAuthResult:i,telegramWebAppData:o,farcasterEmbeddedAddress:s,oAuthUserInfo:l});return x(c),c}};mb=He.recoverPrimaryWallet,gb=He.recoverPrimaryWallet;let qe=s((()=>({wallets:A,ready:ae&&me})),[A,ae,me]),Ke=a.authFlow instanceof ai,Ze=!J.headless&&J.captchaEnabled&&!y&&(m||Ke);/*#__PURE__*/return t(lb.Provider,{value:!0,children:/*#__PURE__*/t(hs.Provider,{value:Ve,children:/*#__PURE__*/t(gs.Provider,{value:pe,children:/*#__PURE__*/t(zc.Provider,{value:qe,children:/*#__PURE__*/t(ni,{...J,children:/*#__PURE__*/e(Mt.Provider,{value:He,children:[/*#__PURE__*/t(xu,{children:/*#__PURE__*/e(zo,{data:X,setModalData:ee,setInitialScreen:P,initialScreen:M,authenticated:y,open:u,children:[n.children,/*#__PURE__*/t(sb,{customAuth:J.customAuth}),Ze&&/*#__PURE__*/t(ds,{delayedExecution:!1}),/*#__PURE__*/t(Ad,{theme:{...J.appearance.palette||{}}}),!J.render.standalone&&/*#__PURE__*/t(Od,{open:u})]})}),/*#__PURE__*/t(Kd,{appId:n.appId,appClientId:n.clientId,clientAnalyticsId:a.clientAnalyticsId,origin:a.apiUrl,mfaMethods:T?.mfaMethods,mfaPromise:ce,mfaSubmitPromise:he,onLoad:Y,onLoadFailed:()=>null}),J.loginConfig.telegramAuthConfiguration&&
28
+ /*#__PURE__*/t(Ss,{$if:!0,children:/*#__PURE__*/t(Fd,{scriptHost:n.apiUrl||Xr,botUsername:J.loginConfig.telegramAuthConfiguration.botName})})]})})})})})})};export{yy as $,ds as A,Ho as B,ti as C,Mi as D,Oi as E,Ly as F,Qo as G,td as H,WC as I,Jc as J,Qc as K,Yc as L,ls as M,ts as N,mC as O,hs as P,Cs as Q,Uy as R,Rv as S,Oy as T,Od as U,ra as V,ka as W,Vp as X,Vy as Y,Pr as Z,Eu as _,bi as a,gy as a0,xl as a1,ps as a2,Js as a3,Os as a4,yo as a5,ay as a6,ry as a7,Rg as a8,qm as a9,xy as aA,Ya as aB,Ew as aC,bw as aD,Mv as aE,Lw as aF,lC as aG,rm as aa,jo as ab,Fs as ac,ea as ad,Si as ae,po as af,Xd as ag,Hy as ah,wy as ai,uf as aj,hy as ak,Xy as al,of as am,Vu as an,Qy as ao,Ar as ap,mo as aq,Ay as ar,Fl as as,$o as at,bv as au,Lv as av,kv as aw,pi as ax,yi as ay,ky as az,fs as b,ri as c,Do as d,Ha as e,Fo as f,fb as g,vs as h,Py as i,Uu as j,Lu as k,$c as l,ui as m,Nr as n,ob as o,ab as p,Wy as q,fi as r,qa as s,Ey as t,us as u,jr as v,Zd as w,Gd as x,xb as y,yb as z};