@privy-io/react-auth 2.21.4 → 2.22.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.
- package/dist/cjs/abstract-smart-wallets.js +1 -1
- package/dist/cjs/extended-chains.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/privy-provider-DXrPQcjO.js +34 -0
- package/dist/cjs/{smart-wallets-Cgv0XYXg.js → smart-wallets-ohOqJE5r.js} +1 -1
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/cjs/solana.js +1 -1
- package/dist/cjs/ui.js +2 -2
- package/dist/cjs/use-sign-with-user-signer-mIruAdfm.js +1 -0
- package/dist/cjs/{useActiveWallet-CYfVhCkS.js → useActiveWallet-BOhTaQoP.js} +1 -1
- package/dist/cjs/{useFundWallet-CdT-bV73.js → useFundWallet-BlDOcTKs.js} +1 -1
- package/dist/dts/extended-chains.d.mts +1 -1
- package/dist/dts/extended-chains.d.ts +1 -1
- package/dist/dts/farcaster.d.mts +1 -1
- package/dist/dts/farcaster.d.ts +1 -1
- package/dist/dts/index.d.mts +16 -4
- package/dist/dts/index.d.ts +16 -4
- package/dist/dts/smart-wallets.d.mts +1 -1
- package/dist/dts/smart-wallets.d.ts +1 -1
- package/dist/dts/solana.d.mts +63 -6
- package/dist/dts/solana.d.ts +63 -6
- package/dist/dts/{types-DRqchVAL.d.mts → types-koC7eIOP.d.mts} +62 -3
- package/dist/dts/{types-DRqchVAL.d.ts → types-koC7eIOP.d.ts} +62 -3
- package/dist/dts/ui.d.mts +1 -1
- package/dist/dts/ui.d.ts +1 -1
- package/dist/dts/{useSolanaWallets-yARRzx3f.d.mts → useSolanaWallets-CDu74ZFA.d.mts} +4 -1
- package/dist/dts/{useSolanaWallets-yARRzx3f.d.ts → useSolanaWallets-CDu74ZFA.d.ts} +4 -1
- package/dist/esm/abstract-smart-wallets.mjs +1 -1
- package/dist/esm/extended-chains.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/privy-provider-CoOSBvfN.mjs +31 -0
- package/dist/esm/{smart-wallets-ScQvzONo.mjs → smart-wallets-TO2YIcTb.mjs} +1 -1
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/solana.mjs +1 -1
- package/dist/esm/ui.mjs +2 -2
- package/dist/esm/{use-sign-with-user-signer-DYa7HrQH.mjs → use-sign-with-user-signer-u7zZ9cLA.mjs} +1 -1
- package/dist/esm/{useActiveWallet-CBnd9EMy.mjs → useActiveWallet-DknggGRp.mjs} +1 -1
- package/dist/esm/{useFundWallet-DSxHvjFr.mjs → useFundWallet-DvuaQdcB.mjs} +1 -1
- package/package.json +19 -8
- package/dist/cjs/privy-provider-dT3e7Jkf.js +0 -29
- package/dist/cjs/use-sign-with-user-signer-gh4MDT3P.js +0 -1
- package/dist/esm/privy-provider-BkunMgHl.mjs +0 -29
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("mipd"),r=require("react"),n=require("react-device-detect"),i=require("viem/utils"),a=require("@privy-io/js-sdk-core"),o=require("./paths-B00ZrFQm.js"),s=require("./internal-context-B_aIJuQh.js"),l=require("viem"),c=require("uuid"),d=require("jose"),u=require("./use-sign-with-user-signer-mIruAdfm.js"),p=require("eventemitter3"),h=require("@coinbase/wallet-sdk"),y=require("@privy-io/ethereum"),m=require("@marsidev/react-turnstile"),g=require("styled-components"),f=require("tinycolor2"),w=require("@heroicons/react/24/outline/DevicePhoneMobileIcon"),v=require("@heroicons/react/24/outline/FingerPrintIcon"),x=require("@heroicons/react/24/outline/PhoneIcon"),C=require("@heroicons/react/24/outline/ShieldCheckIcon"),b=require("@heroicons/react/24/outline/ArrowLeftIcon");require("@heroicons/react/24/outline/ArrowRightIcon");var k=require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),E=require("@heroicons/react/24/outline/XMarkIcon"),A=require("@heroicons/react/24/outline/CalendarIcon"),T=require("@heroicons/react/24/outline/ExclamationTriangleIcon"),j=require("@heroicons/react/24/outline/ChevronDownIcon"),I=require("zustand"),S=require("@headlessui/react"),P=require("lucide-react"),_=require("@walletconnect/ethereum-provider"),N=require("fast-password-entropy"),M=require("secure-password-utilities"),W=require("secure-password-utilities/wordlists"),F=require("@heroicons/react/24/outline/UserCircleIcon"),U=require("@heroicons/react/20/solid/CheckIcon"),R=require("@heroicons/react/24/outline/EnvelopeIcon"),O=require("@heroicons/react/24/outline/WalletIcon"),L=require("@heroicons/react/24/outline/ExclamationCircleIcon"),D=require("@heroicons/react/24/outline/Square2StackIcon"),B=require("@heroicons/react/24/outline"),z=require("@tanstack/react-virtual"),H=require("@heroicons/react/24/outline/CheckIcon"),$=require("qrcode"),q=require("@heroicons/react/24/outline/LockClosedIcon"),V=require("@heroicons/react/24/outline/PencilSquareIcon"),K=require("@heroicons/react/24/outline/ArrowPathIcon"),G=require("@heroicons/react/24/outline/EyeIcon"),Y=require("@heroicons/react/24/outline/EyeSlashIcon"),Z=require("@heroicons/react/24/outline/KeyIcon"),Q=require("@heroicons/react/24/solid/CheckCircleIcon"),X=require("@heroicons/react/24/outline/ArrowDownTrayIcon"),J=require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),ee=require("@heroicons/react/24/outline/DocumentDuplicateIcon"),te=require("@heroicons/react/24/solid/XCircleIcon"),re=require("@heroicons/react/24/outline/CheckCircleIcon"),ne=require("@heroicons/react/24/outline/InformationCircleIcon"),ie=require("@heroicons/react/24/outline/CreditCardIcon"),ae=require("@heroicons/react/24/outline/QrCodeIcon"),oe=require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),se=require("@heroicons/react/24/outline/GlobeAltIcon"),le=require("ofetch"),ce=require("@heroicons/react/24/outline/ClipboardDocumentIcon"),de=require("@heroicons/react/24/solid/CheckBadgeIcon"),ue=require("@heroicons/react/24/solid/IdentificationIcon"),pe=require("@heroicons/react/24/outline/ChevronRightIcon"),he=require("@heroicons/react/24/outline/MinusCircleIcon"),ye=require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon"),me=require("@heroicons/react/24/outline/ClockIcon"),ge=require("@heroicons/react/24/solid/ShieldCheckIcon"),fe=require("js-cookie");function we(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function ve(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var xe=/*#__PURE__*/we(r),Ce=/*#__PURE__*/ve(n),be=/*#__PURE__*/we(a),ke=/*#__PURE__*/ve(d),Ee=/*#__PURE__*/we(p),Ae=/*#__PURE__*/we(f),Te=/*#__PURE__*/we(w),je=/*#__PURE__*/we(v),Ie=/*#__PURE__*/we(x),Se=/*#__PURE__*/we(C),Pe=/*#__PURE__*/we(b),_e=/*#__PURE__*/we(k),Ne=/*#__PURE__*/we(E),Me=/*#__PURE__*/we(A),We=/*#__PURE__*/we(T),Fe=/*#__PURE__*/we(j),Ue=/*#__PURE__*/we(N),Re=/*#__PURE__*/ve(M),Oe=/*#__PURE__*/we(F),Le=/*#__PURE__*/we(U),De=/*#__PURE__*/we(R),Be=/*#__PURE__*/we(O),ze=/*#__PURE__*/we(L),He=/*#__PURE__*/we(D),$e=/*#__PURE__*/we(H),qe=/*#__PURE__*/we($),Ve=/*#__PURE__*/we(q),Ke=/*#__PURE__*/we(V),Ge=/*#__PURE__*/we(K),Ye=/*#__PURE__*/we(G),Ze=/*#__PURE__*/we(Y),Qe=/*#__PURE__*/we(Z),Xe=/*#__PURE__*/we(Q),Je=/*#__PURE__*/we(X),et=/*#__PURE__*/we(J),tt=/*#__PURE__*/we(ee),rt=/*#__PURE__*/we(te),nt=/*#__PURE__*/we(re),it=/*#__PURE__*/we(ne),at=/*#__PURE__*/we(ie),ot=/*#__PURE__*/we(ae),st=/*#__PURE__*/we(oe),lt=/*#__PURE__*/we(se),ct=/*#__PURE__*/we(ce),dt=/*#__PURE__*/we(de),ut=/*#__PURE__*/we(ue),pt=/*#__PURE__*/we(pe),ht=/*#__PURE__*/we(he),yt=/*#__PURE__*/we(ye),mt=/*#__PURE__*/we(me),gt=/*#__PURE__*/we(ge),ft=/*#__PURE__*/we(fe);function wt(e){return e?{"privy-ui":"t"}:void 0}class vt{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new o.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(o.passwordlessAuthenticatePath,{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new o.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(o.passwordlessLinkPath,{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw o.formatApiError(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:r}){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new o.PrivyClientError("Email must be set when initialzing authentication.");let n=wt(r);try{return await this.api.post(o.passwordlessInitPath,{email:this.meta.email,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw o.formatApiError(e)}}constructor({email:e,captchaToken:t,disableSignup:r}){this.meta={email:e,captchaToken:t,disableSignup:r??!1}}}class xt extends vt{async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new o.PrivyClientError("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(o.updateEmailPath,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r){super({email:t,captchaToken:r}),this.meta={email:t,captchaToken:r,oldAddress:e,disableSignup:!1}}}class Ct{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 bt(){try{let e="privy:__session_storage__test",t=new Ct;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}}var kt="undefined"!=typeof window&&window.localStorage?new Ct: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={}}};function Et(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function At(e,t){let r=Et(t);if(r.universalLink)return St(r.universalLink,e)}let Tt="WALLETCONNECT_DEEPLINK_CHOICE";function jt(e){return e.startsWith("http://")||e.startsWith("https://")}function It(e,t){if(jt(e))return St(e,t);let r=e;return r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function St(e,t){if(!jt(e))return It(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function Pt(e,t){window.open(e,t,"noreferrer noopener")}class _t{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 Nt{get meta(){return this._meta}async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new o.PrivyClientError("Auth flow must be initialized first");try{let e=await this.api.post(o.farcasterAuthenticatePath,{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 o.PrivyClientError("No response from authentication");return e}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(o.farcasterLinkPath,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw o.formatApiError(e)}}async _startChannelOnce(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");let e=await this.api.post(o.farcasterInitPath,{token:this.captchaToken});n.isMobile&&!n.isIOS&&e.connect_uri&&Pt(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new o.PrivyClientError("Auth flow must be initialized first");let e=await this.api.get(o.farcasterStatusPath,{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 _t(this._startChannelOnce.bind(this)),this.pollForReady=new _t(this._pollForReady.bind(this)),this._meta.disableSignup=t}}const Mt="https://auth.privy.io",Wt=1400,Ft=2500,Ut=4e3,Rt="2.22.0",Ot="privy:token",Lt="privy-token",Dt="privy:refresh_token",Bt="privy:pat",zt="privy:id_token",Ht="privy-id-token",$t="privy-session",qt="privy:caid",Vt=e=>`privy:guest:${e}`,Kt=e=>`privy:cross-app:${e}`,Gt="privy:state_code",Yt="privy:code_verifier",Zt="privy:headless_oauth",Qt="privy:oauth_disable_signup",Xt=e=>`privy:wallet:${e}`,Jt="privy:connectors",er="privy:connections",tr=12e4,rr=3e4,nr="https://api.moonpay.com/v1",ir="https://api.moonpay.com/v1",ar="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",or="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";function sr(){return"undefined"!=typeof window&&"chrome-extension:"===window.location.protocol&&"chrome"in window}function lr(){if(!sr())return;let e=window.chrome;return e?.runtime?.id}function cr(){if(!sr())return!1;let e=window.chrome;return"function"==typeof e?.identity?.launchWebAuthFlow}async function dr(e){return new Promise(((t,r)=>{cr()?window.chrome.identity.launchWebAuthFlow({url:e,interactive:!0},(async e=>{try{let r=function(){if(!sr())return;let e=window.chrome;return e?.runtime?.lastError?.message}();if(r||!e){let e=`WebAuthFlow failed: ${r||"Response URI missing"}`;throw Error(e)}let n=new URL(e),i=lr();if(!i)throw Error("Invalid extension context");if("chrome-extension:"===n.protocol){if(n.hostname!==i)throw Error("Invalid responseUri origin")}else{if("https:"!==n.protocol)throw Error("Invalid responseUri protocol");{let e=n.hostname.split(".");if(3!==e.length||"chromiumapp"!==e[1]||"org"!==e[2]||e[0]!==i)throw Error("Invalid responseUri origin")}}let a=n.searchParams.get("privy_oauth_state"),o=n.searchParams.get("privy_oauth_code");if(!a||!o)throw Error("Invalid responseUri - missing required parameters");t({privyOAuthState:a,privyOAuthCode:o})}catch(e){r(e)}})):r(Error("Chrome identity API not available"))}))}function ur(e){return crypto.getRandomValues(new Uint8Array(e))}function pr(){return d.base64url.encode(ur(36))}function hr(){return pr()}async function yr(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 d.base64url.encode(t)}}class mr{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new o.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new o.PrivyClientError("User denied confirmation during OAuth flow");let e=function(){let e=kt.get(Yt);if(!e)throw new o.PrivyClientError("Authentication error.");return e}();try{let t=await this.api.post(o.oAuthAuthenticatePath,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return kt.del(Yt),kt.del(Zt),kt.del(Qt),t}catch(e){let t=o.formatApiError(e);if(t.privyErrorCode)throw new o.PrivyClientError(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new o.PrivyClientError("Invalid code during oauth flow.",void 0,o.PrivyErrorCode.OAUTH_USER_DENIED);throw new o.PrivyClientError("Invalid code during OAuth flow.",void 0,o.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new o.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new o.PrivyClientError("User denied confirmation during OAuth flow");let e=kt.get(Yt);if(!e)throw new o.PrivyClientError("Authentication error.");try{let t=await this.api.post(o.oAuthLinkPath,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return kt.del(Yt),t}catch(e){throw o.formatApiError(e)}}async getAuthorizationUrl(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.provider)throw new o.PrivyClientError("Provider must be set when initializing OAuth authentication.");let e=pr();kt.put(Yt,e);let t=hr();kt.put(Gt,t);let r=await yr(e);this.meta.withPrivyUi||kt.put(Zt,!0),this.meta.disableSignup?kt.put(Qt,!0):kt.del(Qt);let n=wt(this.meta.withPrivyUi),i=window.location.href,a=function(){let e=lr();if(e)return`https://${e}.chromiumapp.org`}();a&&(i=a);try{return await this.api.post(o.oAuthInitPath,{provider:this.meta.provider,redirect_to:i,token:this.meta.captchaToken,code_challenge:r,state_code:t},{headers:{...n}})}catch(e){throw o.formatApiError(e)}}constructor(e){this.meta=e}}function gr(e){return e.charAt(0).toUpperCase()+e.slice(1)}const fr=({style:t,...r})=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...t},...r,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#040507"}),/*#__PURE__*/e.jsx("path",{d:"M17.2949 6.37537C18.0156 5.44684 19.4671 4.57877 20.4927 4.46512C20.8178 4.42885 20.8581 4.43127 20.9312 4.50139L20.9967 4.56426L20.9816 4.99225C20.9564 5.65963 20.8682 6.12873 20.6716 6.6341C20.4751 7.13705 20.1198 7.71738 19.8426 7.97852C19.7594 8.06074 19.6007 8.22516 19.4948 8.34848C19.0563 8.84901 18.439 9.20205 17.5973 9.4366C17.2823 9.52606 17.2596 9.52848 16.8917 9.52606C16.4482 9.52365 16.3852 9.51156 16.3524 9.43176C16.3398 9.39791 16.3272 9.18996 16.3222 8.9675L16.3171 8.56127L16.423 8.17922C16.6347 7.41512 16.8791 6.90733 17.2949 6.37537Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M17.4512 10.2081C18.4163 9.84541 19.7595 9.48754 20.2584 9.46336C20.6616 9.4416 21.2966 9.49238 21.7225 9.57943C22.1383 9.66164 22.4357 9.76078 22.8666 9.96148C23.5571 10.2831 24.1442 10.7135 24.6104 11.2382C24.9582 11.6299 24.9783 11.6807 24.8397 11.8113C24.7944 11.8548 24.6885 11.9249 24.6054 11.9709C24.4542 12.0507 23.8368 12.5464 23.8368 12.5875C23.8368 12.5971 23.736 12.7108 23.6125 12.8341C23.2068 13.25 23.0279 13.5861 22.7683 14.4252C22.7078 14.6186 22.6448 14.8725 22.6272 14.9934C22.5566 15.4577 22.5919 16.125 22.7154 16.7344C22.7885 17.1044 23.0808 17.7306 23.3706 18.1489C23.7763 18.7317 24.3786 19.2491 24.9909 19.5514C25.316 19.7086 25.5 19.8464 25.5 19.9334C25.5 19.96 25.4773 20.0205 25.4521 20.064C25.4244 20.1075 25.3866 20.2164 25.3639 20.3034C25.311 20.521 25.001 21.244 24.807 21.5971C24.0862 22.9052 23.3731 23.8748 22.6095 24.5833C21.8611 25.2725 21.1606 25.582 20.4348 25.5385C19.9359 25.5094 19.4596 25.3934 18.7842 25.1322C18.2248 24.917 18.0081 24.8493 17.7939 24.8203C17.688 24.8058 17.4915 24.7768 17.3604 24.7574C16.9774 24.697 16.7254 24.6921 16.4533 24.7478C15.5461 24.9267 15.5133 24.9364 15.0144 25.1371C14.2231 25.4562 13.8073 25.5578 13.2907 25.5578C12.8875 25.5602 12.696 25.5143 12.2575 25.3087C11.8694 25.125 11.5948 24.9315 11.2546 24.5978C10.9295 24.2811 10.7052 24.0151 10.2642 23.4323C9.18818 22.0081 9.02187 21.7276 8.49519 20.4582C8.28612 19.9546 8.19971 19.7502 8.13026 19.5402C8.07498 19.373 8.03043 19.2023 7.94332 18.8744C7.73164 18.074 7.70896 17.9869 7.70896 17.8709C7.70896 17.8153 7.68628 17.675 7.66108 17.5565C7.44184 16.5917 7.44688 15.0007 7.67116 14.1713C7.82236 13.6127 8.02648 13.088 8.30367 12.5512C8.92863 11.3325 9.71738 10.5539 10.874 10.0123C11.2571 9.8309 11.5444 9.74627 12.0534 9.65922C12.2903 9.62054 12.5523 9.56976 12.6355 9.54799C12.8421 9.49238 13.3184 9.49963 13.6057 9.56008C14.2911 9.71 14.7548 9.84058 15.2059 10.0123C16.0551 10.3411 16.549 10.4789 16.7506 10.4475C16.7692 10.4444 16.7848 10.4418 16.8002 10.4387C16.8815 10.4225 16.9601 10.3929 17.4512 10.2081Z",fill:"white"})]}),wr=({style:t,...r})=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...t},...r,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#5462EB"}),/*#__PURE__*/e.jsx("path",{d:"M23.5433 8.87438C22.2479 8.26174 20.8587 7.81038 19.4063 7.55187C19.3799 7.54688 19.3534 7.55934 19.3398 7.58428C19.1612 7.91179 18.9633 8.33905 18.8247 8.67487C17.2625 8.43382 15.7084 8.43382 14.1782 8.67487C14.0396 8.33158 13.8345 7.91179 13.6551 7.58428C13.6414 7.56018 13.615 7.54771 13.5886 7.55187C12.1369 7.80955 10.7478 8.26092 9.45159 8.87438C9.44037 8.87937 9.43075 8.88769 9.42437 8.89849C6.78947 12.9558 6.06766 16.9134 6.42176 20.8219C6.42336 20.841 6.43378 20.8593 6.4482 20.871C8.18663 22.1868 9.87059 22.9857 11.5233 23.5152C11.5497 23.5235 11.5778 23.5135 11.5946 23.491C11.9855 22.9408 12.334 22.3606 12.6328 21.7504C12.6505 21.7147 12.6336 21.6723 12.5976 21.6581C12.0448 21.442 11.5185 21.1785 11.0122 20.8793C10.9721 20.8552 10.9689 20.7961 11.0058 20.7679C11.1123 20.6856 11.2189 20.6 11.3206 20.5135C11.339 20.4977 11.3647 20.4944 11.3863 20.5044C14.7125 22.0696 18.3136 22.0696 21.6006 20.5044C21.6222 20.4936 21.6479 20.4969 21.6671 20.5127C21.7688 20.5991 21.8754 20.6856 21.9827 20.7679C22.0196 20.7961 22.0172 20.8552 21.9771 20.8793C21.4708 21.1843 20.9445 21.442 20.3909 21.6573C20.3548 21.6715 20.3388 21.7147 20.3564 21.7504C20.6617 22.3597 21.0101 22.9399 21.3939 23.4902C21.4099 23.5135 21.4387 23.5235 21.4652 23.5152C23.1259 22.9857 24.8099 22.1868 26.5483 20.871C26.5635 20.8593 26.5731 20.8419 26.5747 20.8228C26.9985 16.3041 25.8649 12.3789 23.5697 8.89931C23.5641 8.88769 23.5545 8.87937 23.5433 8.87438ZM13.1295 18.442C12.1281 18.442 11.303 17.4944 11.303 16.3307C11.303 15.1669 12.1121 14.2193 13.1295 14.2193C14.155 14.2193 14.9721 15.1752 14.9561 16.3307C14.9561 17.4944 14.1469 18.442 13.1295 18.442ZM19.883 18.442C18.8816 18.442 18.0564 17.4944 18.0564 16.3307C18.0564 15.1669 18.8655 14.2193 19.883 14.2193C20.9084 14.2193 21.7255 15.1752 21.7095 16.3307C21.7095 17.4944 20.9084 18.442 19.883 18.442Z",fill:"#F7F7F7"})]}),vr=({style:t,...r})=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...t},...r,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.5083 5.62451C10.8896 5.62451 6.34741 10.2078 6.34741 15.878C6.34741 20.4104 9.25774 24.2471 13.2951 25.605C13.7999 25.7071 13.9848 25.3844 13.9848 25.1129C13.9848 24.8752 13.9682 24.0604 13.9682 23.2115C11.1417 23.8227 10.5531 21.9892 10.5531 21.9892C10.0988 20.8009 9.42579 20.4954 9.42579 20.4954C8.50068 19.8673 9.49318 19.8673 9.49318 19.8673C10.5194 19.9352 11.0578 20.9198 11.0578 20.9198C11.9661 22.4815 13.4297 22.0402 14.0185 21.7686C14.1025 21.1065 14.3719 20.6482 14.6579 20.3936C12.4035 20.1559 10.0317 19.2732 10.0317 15.3347C10.0317 14.2142 10.4351 13.2976 11.0745 12.5847C10.9736 12.3301 10.6202 11.2774 11.1756 9.86844C11.1756 9.86844 12.0335 9.59678 13.968 10.9209C14.7962 10.6965 15.6503 10.5823 16.5083 10.5814C17.3662 10.5814 18.2408 10.7003 19.0484 10.9209C20.9831 9.59678 21.841 9.86844 21.841 9.86844C22.3963 11.2774 22.0428 12.3301 21.9419 12.5847C22.5981 13.2976 22.9849 14.2142 22.9849 15.3347C22.9849 19.2732 20.6131 20.1388 18.3419 20.3936C18.7121 20.7161 19.0316 21.3271 19.0316 22.2948C19.0316 23.6698 19.0149 24.7733 19.0149 25.1127C19.0149 25.3844 19.2 25.7071 19.7046 25.6052C23.742 24.2469 26.6523 20.4104 26.6523 15.878C26.669 10.2078 22.1102 5.62451 16.5083 5.62451Z",fill:"white"})]}),xr=({style:t})=>/*#__PURE__*/e.jsx(lt.default,{style:{color:"var(--privy-color-error)",...t}}),Cr=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#F1F2F9"}),/*#__PURE__*/e.jsx("path",{d:"M26.1001 16.2273C26.1001 15.5182 26.0365 14.8364 25.9183 14.1818H16.5001V18.05H21.8819C21.6501 19.3 20.9456 20.3591 19.8865 21.0682V23.5773H23.1183C25.0092 21.8364 26.1001 19.2727 26.1001 16.2273Z",fill:"#4285F4"}),/*#__PURE__*/e.jsx("path",{d:"M16.5001 26C19.2001 26 21.4637 25.1046 23.1182 23.5773L19.8864 21.0682C18.991 21.6682 17.8455 22.0227 16.5001 22.0227C13.8955 22.0227 11.691 20.2637 10.9046 17.9H7.56372V20.4909C9.20917 23.7591 12.591 26 16.5001 26Z",fill:"#34A853"}),/*#__PURE__*/e.jsx("path",{d:"M10.9047 17.8999C10.7047 17.2999 10.591 16.659 10.591 15.9999C10.591 15.3408 10.7047 14.6999 10.9047 14.0999V11.509H7.56376C6.86376 12.9025 6.49951 14.4405 6.50012 15.9999C6.50012 17.6136 6.88649 19.1408 7.56376 20.4908L10.9047 17.8999Z",fill:"#FBBC05"}),/*#__PURE__*/e.jsx("path",{d:"M16.5001 9.97726C17.9682 9.97726 19.2864 10.4818 20.3228 11.4727L23.191 8.60454C21.4591 6.99091 19.1955 6 16.5001 6C12.591 6 9.20917 8.2409 7.56372 11.5091L10.9046 14.1C11.691 11.7364 13.8955 9.97726 16.5001 9.97726Z",fill:"#EA4335"})]});function br(t){/*#__PURE__*/return e.jsxs("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",...t,children:[/*#__PURE__*/e.jsxs("defs",{children:[/*#__PURE__*/e.jsxs("linearGradient",{id:"b",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#3771c8"}),/*#__PURE__*/e.jsx("stop",{stopColor:"#3771c8",offset:".128"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),/*#__PURE__*/e.jsxs("linearGradient",{id:"a",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#fd5"}),/*#__PURE__*/e.jsx("stop",{offset:".1",stopColor:"#fd5"}),/*#__PURE__*/e.jsx("stop",{offset:".5",stopColor:"#ff543e"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#c837ab"})]}),/*#__PURE__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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 kr(t){/*#__PURE__*/return e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#06C755"}),/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"url(#pattern0_1769_69)"}),/*#__PURE__*/e.jsxs("defs",{children:[/*#__PURE__*/e.jsx("pattern",{id:"pattern0_1769_69",patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:/*#__PURE__*/e.jsx("use",{xlinkHref:"#image0_1769_69",transform:"scale(0.003125)"})}),/*#__PURE__*/e.jsx("image",{id:"image0_1769_69",width:"320",height:"320",preserveAspectRatio:"none",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAYAAADNkKWqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABpkSURBVHgB7d1fbFTXtcfxdWZs45h7g6lClajoetJIRKIqGKmhTSvF5qEvqUqIitM+XEIikYf+QWlVaF+IACVPBamN0ps8NFL5cx+qmioOVXsf+oCJ1Pg2VMKkKlKRSMZVqlalCiaSHf9hZvesMx5jm/k/58w5Z+/vR3KM8cSAPf55rbX32ccTx/Rf3tO/uNiXWygsDnri5UTMgOd5/UZMTozXX3qU/2vAOl4++K+Y4LUR8V97U5KRyUwxM93bOzc5vWNsWhziicU07GYXeoY9I0P+mzljZJBwA6rzv0emM55MGvEuajD29SyM2xyKVgWgBt7cXO+g8YpP+BXdsASBB6AtfiD63dK4ZzJvzj36i3GxSOoDUENvZq57T0Zkf9EPPM+TfgEQGX9kNFY05s31vYtjaa8OUxuAvRPfGDZSOEroAfHRMDSenF74/C/HJIVSFYDBTG+u53ljzHcJPSBR8hqGfpv8st8m5yUlUhGAWu0VTfF58cweAZB0pzKSPZ6GIEx0AJbbXH+5flgApE3igzCRAdj9+5HBTEZ+TPABVkhsECYqAIMV3fmeo54/4xMAtklcECYmANf9/9efLxaLx1jcAKyW9zu744uPjp6SBIg9AP05X86f8/2cdhdwSt6vBnfFXQ1mJEZa9RVM4TLhBzgnV5TC+z0TTx2VGMVSAVL1AVjmyWTGZJ+MoxrseAXY84ev7aHqA7DMyKBfDV7onhh5RjqsowHY8we/3C1m3mChA8AaOb8d/XmnW+KOtMC6veXjue43qPoA1KOX1N2zbuHZThy0EHkA6ryvKMULnMMHoAkdWSWOtAXWKzoIPwAt0FXiC1pASYQiqwA1/PyPfoF5H4CWeTLdnZFdMztHJyUCkQQg4QcgNBGGYOgBSPgBCF1EIRhqABJ+ACITQQiGFoA6rNQNzoQfgMiEHIKhrAKXt7oQfgAiZaR/sSBvhLU63HYA6iZntroA6KBgi4xmj7Sp7QCc/bjn54QfgA7L6dVl0qa2AjC4tpcbFQGIgV5a2+61wy0vgujJDXrxsgBAnDLFJxc+/6uW7kvcUgByfS+AxPBXhjMmu6OV64ZbaoGLXuENwg9AIvgrw3rAsrSg6QAM5n5GBgUAEkLngeve/nrTd5NsqgUutb6F9wUAkqaFVripCrA09wOABGqhFW44AEvn9TP3A5BczbbCDbXArPoCSA2/Fe5bt/hgI0fqN1QB+nO/o4QfgFTwW+GZj3sa2iBdtwJk4QNAGnVnZUe9U2PqVoCl6g8A0uV2QX5c7zE1K0CqPwBplhGza+7Rc+PV318D1R+ANDPi1cywqhUg1R8AG9SqAqtWgFR/AGxgvMzz1d5XsQKk+gNgk77exY2V9gVWrAAL3u2qiQkAaTM721Px6pCKAeiZDKc8A7BH1lQs6u4KwJ63v7aHqz4AWMVIf+/E3uG1v31XAHqZ7H4BAMtU2hKzehHkwp7+nt7umwIAtqlwSMKqCrC7t5vZHwA76SEJc6szblUAZjzvCQEAS/mBt3/N23cYwz1+AdjLeDLYf3lPf/nt5QDsnfjGsACAzfw2eG6ua/mmbssBWDAFqj8A1jPGW8665QD0l4OHBAAsZ1ZkXWkbDNtfADikfG1wUAH2rMsOCwA4YvbjnmF9XWqBveygAIAjPDHD+rpr6Y0hI0B7+rvWy4bsehlYtyl4CX4v2ycb/N9XuXWfbOjj5Of/Gby+dXtGpguzcqvgv749G7w9tXDD//WMAG3K6X+CADRGBhu7QzBcpgE30LNJtq3PBQGngVYOu3Lgdcq7s/kgFKfmbwSBWX679JqARG3Gk+362mMBBJUM+OH22L1bZbuGnR9625dCLw3KQXjFf3nroz/L1NyN4NfASroQ4ukG6KIULgicpZWdht1j935GtvflZJv/0t/VJzYph+JFPxDf+ugqlSKkO9u9o6toFvvFq3t7YFhEA09DbvcnHpEhP/j017bTQC+F/Nbl3ysF4lU5/+GloFKEWxYKi4NdpRVglkBspy3t7o2f80Nvp5UVXiu2LVW7B+9/PHhbK8OzN8aDUJxaWoiBvTzxcroIkhNYSVtarfD2bRpOzfwuTisrRK0O3/Qrw1/7L8wPLeWZAW/dxMgFv/4bFlhBK72nNw0ReiHSleZX/v4bOX/zj1SGFvGMvEkAWkBnevvuGwra25UzLoSv3Caf8V+QckYmvZ6Jp97nJkjppC2uLmTsu2+YmV6HaVWoCycvfnCOqjC98gRgCmmlp4N7qr1koCpMLQ3AEZaAU0DbXA2979z/Faq9hNKq8KUPRgnCFCEAE47gSx8WTdKDAEwogi/9NAhLrfFFgjChCMCEIfjsQ2ucXARggujevZMDzxB8liIIk4cATADdzvLC5hFWdR1xZSYvI9dO0hYnAAEYI213Twzsl6f9yg/u0fkg+wjjRQDGROd8RzY/RbvrONrieBGAHabX6r7+0Ldod7EK1WA8CMAOoupDLXpA6+Gp01SDHUQAdgBVH5pBNdg5BGDE9LCCn33621R9aIrOBg9cf5WTqiPGWfgROpl7Rka3HCb80DQ9y/F3W48G26MQHSrACGjLe+7hQ07cawPR0yrwwPXXaIkjQAUYMt3UrD+5CT+EpfycGmjwxvJoHAEYIl3lLT1ROYoe4dLn1LUdP12+gRPCQQCGRGc1OvMDoqTPMeaC4ekStEUvZzs5sD84yADohCN+AG7I9smhqdOC9hCAbdDwY96HOBx84CtBW/zce68FG6jRGlrgFulAmvBDnPTeMPoc1B/EaA0B2ALCD0mhz8F3PvsjVohbRAA2qRx+rPQiKcqbpgnB5hGATSD8kFTlEKQdbg4B2CDCD0lHCDaPAGyAPqH00jbCD0mnM8HRLYcEjSEAG/CzT3+LBQ+khl46p8evoT4CsA7dda9HWgFpohvzuWKkPgKwBn0CHeFJhJTS5y7XDtdGAFahbQThh7TTa4e3M76pigCsoHyEPWCD0YcPs0ewCgKwAra7wCb6XH79oW8K7kYArqEtA+EH2+hIR08twmoE4Aq6csbQGLbSE2Q0CHEHAbhEZyRsG4DtdLbNlSJ3EIBLjmzeS+sL6+lz/Min9gpKCEAptb5Pc6IzHEErfIfzAUjrCxfRCpc4H4C0vnARrXCJ0wGoBxzQ+sJV2gq7fpWI0wF47uHDArjsZM7tvYHOBqAufND6wnW6GOLygoizAcjCB1Di8nXvTgYg1R9wh34vuDoLdzIAqf6A1Vw9+s25AKT6A+7mahXoXABS/QGVuVgFOhWAVH9Adfq94dqKsFMBSPUH1PbCZreuDnEmAPUnG9UfUJtr+wKdCcB9m4YEQH0u3QbWiQDUE1+45hdozL77hpw5KcaJAHzs3q0CoDEafo/9pxvfM13igCRUf1PzN2q+P+75ZL2/n0rLDHX69ozcKszWfMyGbB/n4dVw8IHH5fzNS2I76wNQ2984K8Cp+X/Kl68ebygAdR9WHGF94PqrcvbGeN3H6fFhl7b9qOZjzvgf55W//7ZuAOnXJIprUPXzvfNPPwxCsJ7RLYdrzrvenc0HX7tGPlZU9DkRx+4F/VrrD4g4/+2dYH0LHHf7q2HQSHWlj3npg1HptLc+utpQ+CkNhDM1Hqvh85wfpvo4/XWtF/0zD02dlrAdyp9u+Jv2lX/8tub7v9/Ex4qKPiemb89Kp2n4fXWj/Ysh1gdg3O3vdKHzT964TM3/q6nHv/L33/gB/GcJUzOfbw3iWv5a5/2dMl2IJ4SHHJidWx2AwTCXBZBEG7l2sm4QIR5UgCm3zfHjvtNAW8wD118TJE+pgLB7U7TVAejShs400zb4xRjmn6jP9g7K6gB0/YYvaaLD/rDngWif7XNAawOQ+V/66HacOFY8UZ3tYyRrA5D5X/roVqCRaycEyaGFhM2dlMUBOCBIH22D6+3PQ2dtW58TW1kbgEMb3L3VX9odyp9iHrhEr2TKxXwJ4naLA9DaS+H6s1znmWY6D3znsyf8FqxP0kCDKuwj17T93HffsMRtoOc+sZW1AcgMMN10Hvjce6/K6JZDkgZ6LbetJ45vX/+g2MrKFlh/cqalckB15z98h3lgAmi423pyjpUBSPVnD90fqIcrIF79WTsLCmsrQNhBL5Xb+5cT7A+Mma1FhZUB+F8WD21dpPPAQ1OnBPHZQAucHlSA9tHzA5kHxocWOEW4/aWddB7I0VnxsLUCdOKeILCDzgP1iPok7g/UhRrduxgmrbr03hy6xzBucW/GjoqVAUgLbK/g1gF/G5WTA/slSTScG721QDP0xkRp2hCeNnbOALkKJBUOPvCVln5Y6VH6ZyIImyTSwI/rSHwXOHFfYCSTHlhx5FN7pRWHp04zD0TbCEDESqvAVm5cVdofeFKAdhCAiN0Jf57XyqBfFx6iuLUm3GFlAOZpjVJF54DnHm7t0AOdB57/8JIAraACRCLopVatruzqqTHMA6Nl6/2tCUAkhs4DW7kNI7fWjJ5+jm1kZQDq1gGkk57/18o8UE+QZh4YnVsEYHoQgOml88DXH/qmtELngTYenZWEfa20wECHaBvc6jzQplZNfxiczD2TiKtAbC0qrLwU7t3ZKUG66Tzw/M0/pubmSBrav9t6VGxFC5wirAja4fWHvpWIgwAgcsXSU7mtDEBtgzhBOP30WLNW54EIz5WZvNjK2hngXxeoAm2greXB+x8XxOeWpQsgytoAnLT4p5ZrdCGglf2BCIet7a+yNgBtLttdpPNAznmMx1u30rEQ1QprA5CVYLvoPPBnn2YeGAeb99VaeyR+WjfEhv1k25Dts6Zy2v2JncE8MIk3R9I5mY1fO91RYXMLbG0A6kqw7iFL0+xIv4G2XP62hE331CXtCPlW6TzwrY+uJu6b8srM+5F87Y5sHpEX/Je42D5KsvpKkCu0wQHbLhEbffiwM/NAvRNePsYW9Nc3/yg2szoAOSfuDpv2Reo80JaKNumoAFNMqx42RNtp36Zh9gdGzPb5n7I6AHUO+O7s+wI76Xxse19OEA2dtdrO+tNg3qQNtpbOAV2aB3bamRsXxXbWB+D//sv+L6LLdB7Y6q01UZ22v2k5iacd1gdgeTsM7KXbfJgHhsuF9lc5cSAqbbD9dB7I0VnhefGDUXGBEwGobTCrweFI6rytfGvNZv5+/V3/Ibibbn1x5bYSTgSgtsFn/zUucRi6d6vETSsjnZVVsq1voOHKScOl1qqrfqxmAmgo5Kt09NaazcwDd2/8XM33//emYYmbfm1yVb52UflpAi81jIrXMzFixAFxHlmu85SLMc0hNZB2b3ykagAq/Wl/5sZ42x9Hnf/wHXnlH/9X52P1yVf9j/V0RAGjn2/9oVfrHDv9dzzWwA+ns/7nJa4rMfRzvu++4Y7eE0QXP7Zc/o64wpkAVBqAnCsHVKeXTbp0e1Gn7grnwr4moB1JPGknSk4F4K9vXmIxBKhC233X7qntVADqXOiVf/xGANzNla0vKzl3Y3Rd4aIKBFZzsfpTzgUgVSCwmn5PuFj9KecCUFEFAnfowoeL1Z9yMgD1J96hqVMCuE73/b3kaPWnnAxApTMPDkmA61764Jy4zNkAVC86/sWH2/SWEfWuALKd0wGoFaDrTwC4izGQ4wGoDk+dZkEEztFVX1cXPlZyPgB1QeSlv7k7BIZ7XF/4WMn5AFR6ATgLInDFl68eF5QQgEsOXH+VVhjWo/VdjQBcok+K5957VQBb6aovre9qBOAKpcM83ToOCG7QuR+rvncjANd4KWgR/imATfb+5SStbwUE4Bq6KqxDYuaBsIXO/d6dzQvuRgBWwDwQttBLPpn7VUcAVqHzQFePCIIdSnM/d+7v0QoCsAb9ycmiCNJIw680ypkRVEcA1nEof4pN0kgVDT0WPRpDADZg5NpJhshIDZ1f83xtDAHYgNJP1BNsj0Hi6dxaNzyjMQRgg7Sd0JkKIYik0vBjxbc5BGATCEEklS7WEX7NIwCbRAgiabTl1cU6NI8AbAEhiKTQxQ427beOAGxROQRZbUNc9LnHXr/2EIBtKIcgq27oNDY6h4MAbJM+AUeuneCyOXQM4RceAjAkugJHCCJq5fDjKo9wEIAh0hBkcQRR0Znfzj/9kPALEQEYMr1umBBE2FjwiAYBGAH9Cb3l8nc4SQaheOujq4RfRAjACOnmVL3bHNUgWnXmxrgffscIv4gQgBE7GzyBj3OkFpqmi2rPXWeTc5QIwA4o7xdklRiN4mCDzvB6JkaMoGMG1m2Scw8flm19OQEq0dEJ8+POIABjsm/TsLywea8fiJ8UQJU21Z9kXNJBBGCMtBo8snlEnvbDEG5jg3M8CMAE2L4+J6NbDlENOkr3+JVOHCf8Oo1FkAS4MpMP9g2yZcY9Z5Z2CRB+8aACTCDmg25gpTd+BGBC6XxQg/DpTUMEoWV0sUNvWK57RBEvAjDhNAgfu/czVISW0BGH3rOXg3STgQBMEVrjdGOxI3kIwBTa/YmdcvD+x/3KcKsgHXRjMzcuSh4CMMXK+wiH/CCkKkwuruxILgLQEtoe7974iF8dPiJIBuZ9yUcAWqa8aKJXl9Aix0fP8Dtw/X+Y9yUcAWgxwjAe7O9LDwLQEf1d6+WrfousQcjMMBocZpA+BKCj9DguDUKtEDUUNSDROra4pBMBiIAGoh7KoGE46L/mvMLGscUlvQhAVKQVYRCKfQMy0PtJ/7WG4gCV4gra8j733qty/sNLgnQiANGUcjDq6/I80cVqkVVeOxCAaJuuNusexIMPPO7E4gotrz0IQITK5uuVdWPzgeuvscprEQIQodOK8OTAM1ZdlaJzPp33cX9eu3AiNEKnc7GRayesqJSCs/v8dlf/PYSffQhAREYP/Uwz3du3808/4CADixGAiIze6yStBwFo6D3y7g9Y5bVclwARmvRDME3bZFjocAsBiEilqYLSqk8PMWDW5w4CEJFKQwBS9bmLAITTqPrcRgDCSVzHC0UAIlK6KTpp2NSMMgIQkUrS6TFUfViLAESkklIBMutDJQQgItWfjbcCZIUXtRCAiFScm6Cp+lAPAYjIbF//oD8D7JNOo+pDowhARGZDtrPhp5VeueoDGkEAIjJ6D5FO4Yh6tIIARGSGNnxGoqZV3+Gp03LmxrgAzfID0MuLmJwAIYt6BZhFDrQpTwWIyES1Aqzt7ot+8LHIgXZ1iTHT4gkQqihWgLXS04qPE5oRBk8rQC/j5Y0xgwKEKOwVYNpdRKHLGLklQMjCWgFmdRdRMV5pBpgXIGS53vbuC6z3Evl+/jRzPkTHeFNdRkyeESDC1moLzLYWdIyRya6erEwuFgQI1a3CbFOPL1/F8VP/hTkfOiHjFae7ZmYW8z293QKESWd3B+9/vO7jCD7Epbf39mTQ/fZMPPU+m6ERtkvbflR1LyB7+RArT6YXvjC6MdgI7Xky6a8G5wQIkd5YfN+mYRm6t3RJ3HRhJgg+DT2qPcTJ8+d/+joIwGLRTHmshCACZ/3FjLMsaCBhjHgX9XVG/+NJcVwAwBVLFWAQgAvzhXEBAEf03bMwrq+DAJRdY9PlRAQAq/lZN73DzzwpB2Dwe3JRAMBy3oqsWw7ArGfGBAAs563IuuUAnJu7PemXgdMCABabe/TcePnXywGoc0DdDygAYCnPyJsr386sfKMocloAwFJ+kbdq1LcqABfnFsdogwHYqrd3sXoA0gYDsJW2v+XtL2WZux4k5rgAgGWMeKfW/l7FK4B73h656b+nXwDAAnoDpPlHRx9c+/uZyo/2XhYAsETR8yruc64YgAtzCz8RALBE1mQqFnWVK8BgMcTjyhAA6efJqblHf5Gv9K5M1f/HFGmDAaRexmSrLuxWDUC9XMQfHI4LAKRVjepPZWr/v2yJAZBetaq/4P213kkVCCC16lR/qmYAqmJRvicAkDL1qr/gMfUesPil0UnDggiANGmg+lN1A1AtzheOcUgCgDTQqz4aqf5UQwEY7AvMsCACIPn8ADzeSPW39NjGrZsYuWBEhgUAEqjaNb/VNFYBLn/w7LO0wgCSys+oXc08vqkA1LKSVhhAIhVNw61vWVMtcBmtMIAk0YOc578wukOa1FQFuPyH0QoDSAid+3km+6S0oKUALJWZxWcFAGLWzKrvWi0FoFr44q/GhGuFAcQpmPuNnpIWtTQDXIl5IIBYeN7Ywhd+2VLrW9ZyBVg2P7f4pCdeXgCgQ3Tu17duoe0xXNsBGFwlIpldhCCATggWPSS7a+0tLlv8WOHo/v3IoL8UfYG7yQGIjJHpjJfd0eqix1rtV4BLSqfGyC62xwCIhJ8tmjFhhZ8KrQIsoxIEELql8NNCS0IUegAqQhBAaCIKPxVJACpCEEDbIgw/FdoMcC39C+uwktVhAK3Q1d4ow2/pz4hW78Q3ckaKF4yYnABAA8pbXcJc8KgksgqwTP8B83MLO8R4YwIAdeidKO/pXdwRdfgt/Vmd0zOx95j/Rx4VAKikaI4vfOncMemQjgag6p0Yecb4IUhLDGCZv9jRlS0+O/v5X3W0U+x4ACqdCxZN4Q3/Tx8UAE7TllfPGO1Ey7tWLAFYRksMOMyv+jwxx+e/eO4nEpNYA1CxSgy4J86qb83fIxmYDQIOSEDVt1JiAlAFs0G5fcz/a+0XAFbxTPHle+4pHAvjGKuwJCoAywhCwB7a7haL8r0or+hoVSIDsIwgBNKrNOfTe3acG5eESnQAlhGEQHp4njem7W6Sg68sFQFYpkFYMIvfzXjZJ1gsARJED0L2zMt9vbd/kqQZXz2pCsCVet7+2h6R7H7/k75HAHSeruh6Mpn0NreW1AZgWf/lPf1zc917isZ7gjAEIrYUekWR0+t7F8fSVO1VkvoAXKt3Yu+w8bw9pihDXGoHhMD4VV5GLnrGjPX23p5Me+itZF0ArqTV4ezH2WHxsoN+mT5kjB+InFAN1ODlS4FnpkyxON53T2HcpsBby+oArKTUMncNFo3p12D0f7wN+J+EnL7PiJcrPYoFFtho6XR2Y6aDX3vB6yl/QTEvRZlc37eYtznsKvk3kqxyUwkTXfIAAAAASUVORK5CYII="})]})]})}function Er(t){/*#__PURE__*/return e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_1715_1956)",children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#0977B6"}),/*#__PURE__*/e.jsx("path",{d:"M9.46878 6.82104C10.6699 6.82104 11.6461 7.79742 11.6461 8.999C11.6461 10.2017 10.6699 11.1782 9.46878 11.1782C8.26447 11.1782 7.28967 10.2017 7.28967 8.999C7.28967 7.79742 8.26447 6.82104 9.46878 6.82104ZM7.58908 12.8309H11.3467V24.9207H7.58908V12.8309Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M13.7032 12.8309H17.3076V14.4827H17.3576C17.8589 13.5322 19.0846 12.53 20.9127 12.53C24.7175 12.53 25.42 15.0341 25.42 18.2891V24.9207H21.6651V19.0415C21.6651 17.6388 21.6394 15.8355 19.7126 15.8355C17.7573 15.8355 17.4579 17.363 17.4579 18.9399V24.9207H13.7032L13.7032 12.8309Z",fill:"white"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1715_1956",children:/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"white"})})})]})}function Ar(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...t,children:[/*#__PURE__*/e.jsx("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__*/e.jsx("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 Tr(t){/*#__PURE__*/return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","shape-rendering":"geometricPrecision","text-rendering":"geometricPrecision","image-rendering":"optimizeQuality","fill-rule":"evenodd","clip-rule":"evenodd",viewBox:"0 0 1000 1000",...t,children:/*#__PURE__*/e.jsx("path",{d:"M906.25 0H93.75C42.19 0 0 42.19 0 93.75v812.49c0 51.57 42.19 93.75 93.75 93.75l812.5.01c51.56 0 93.75-42.19 93.75-93.75V93.75C1000 42.19 957.81 0 906.25 0zM684.02 319.72c-32.42-21.13-55.81-54.96-63.11-94.38-1.57-8.51-2.45-17.28-2.45-26.25H515l-.17 414.65c-1.74 46.43-39.96 83.7-86.8 83.7-14.57 0-28.27-3.63-40.35-9.99-27.68-14.57-46.63-43.58-46.63-76.97 0-47.96 39.02-86.98 86.97-86.98 8.95 0 17.54 1.48 25.66 4.01V421.89c-8.41-1.15-16.95-1.86-25.66-1.86-105.01 0-190.43 85.43-190.43 190.45 0 64.42 32.18 121.44 81.3 155.92 30.93 21.72 68.57 34.51 109.14 34.51 105.01 0 190.43-85.43 190.43-190.43V400.21c40.58 29.12 90.3 46.28 143.95 46.28V343.03c-28.89 0-55.8-8.59-78.39-23.31z"})})}const jr=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/e.jsx("path",{d:"M8.53901 8L14.7164 16.2153L8.5 22.8947H9.89907L15.3415 17.0468L19.7389 22.8947H24.5L17.975 14.2173L23.7612 8H22.3621L17.3499 13.3858L13.3001 8H8.53901ZM10.5964 9.02501H12.7837L22.4422 21.8695H20.255L10.5964 9.02501Z",fill:"#F7F7F7"})]});let Ir={google:{name:"Google",component:Cr},discord:{name:"Discord",component:wr},github:{name:"Github",component:vr},linkedin:{name:"LinkedIn",component:Er},twitter:{name:"Twitter",component:jr},spotify:{name:"Spotify",component:Ar},instagram:{name:"Instagram",component:br},tiktok:{name:"Tiktok",component:Tr},line:{name:"LINE",component:kr},apple:{name:"Apple",component:fr}};const Sr=e=>e in Ir?Ir[e]:{name:"Unknown",component:xr};function Pr(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),n=e.get("privy_oauth_provider");if(!t||!r||!n)return{inProgress:!1};let i=!1;try{i=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:n,withPrivyUi:!kt.get(Zt),popupFlow:null!==window.opener&&i,disableSignup:!!kt.get(Qt)}}function _r(){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"),kt.del(Gt),window.history.replaceState({},"",e)}class Nr{async initRegisterFlow(e){if(!this.api)throw new o.PrivyClientError("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 o.PrivyClientError("Auth flow has no API instance");this.authenticateForRegistration=!1,this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new o.PrivyClientError("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 o.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new o.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initRegisterResponse||(this.meta.initRegisterResponse=await this.initRegisterOnce.execute());try{let t=this.meta.initRegisterResponse.options,r=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(o.passkeyRegisterPath,{relying_party:this.meta.initRegisterResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new o.PrivyClientError("Passkey request timed out or rejected by user.",void 0,o.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw o.formatApiError(e)}}async authenticate(){if(this.authenticateForRegistration)return this.register();let e=await import("@simplewebauthn/browser");if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new o.PrivyClientError("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 r=await e.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase({...this.meta.initAuthenticateResponse.options,allow_credentials:t}));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(o.passkeyAuthenticatePath,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new o.PrivyClientError("Passkey request timed out or rejected by user.",void 0,o.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw o.formatApiError(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new o.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,r=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post(o.passkeyLinkPath,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new o.PrivyClientError("Passkey request timed out or rejected by user.",void 0,o.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw o.formatApiError(e)}}async _initRegisterOnce(e){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");let t=wt(e);return await this.api.post(o.passkeyInitRegisterPath,{token:this.meta.captchaToken},{headers:{...t}})}async _initAuthenticateOnce(e){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");let t=wt(e);return await this.api.post(o.passkeyInitAuthenticatePath,{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");return await this.api.post(o.passkeyInitLinkPath,{})}_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 _t(this._initRegisterOnce.bind(this)),this.initAuthenticateOnce=new _t(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new _t(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}const Mr=({address:e,chainId:t,nonce:r})=>`${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: ${r}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class Wr{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 o.PrivyClientError("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 o.PrivyClientError("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 o.formatApiError(e)}}async link(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");try{if(!this.wallet)throw new o.PrivyClientError("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 o.formatApiError(e)}}async sign(){if(!this.client)throw new o.PrivyClientError("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new o.PrivyClientError("Could not prepare SIWE message");if(!this.wallet)throw new o.PrivyClientError("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 o.PrivyClientError("SiweFlow has no client instance");if(!this.wallet)throw new o.PrivyClientError("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 o.PrivyClientError("SiweFlow has no client instance");if(!this.wallet)throw new o.PrivyClientError("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=Mr({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1,i){this._meta={disableSignup:!1},this.getNonceOnce=new _t(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r,this.client=e,this._meta.disableSignup=n,this.preparedMessage=i?.message,this.signature=i?.signature}}const Fr=(...e)=>{if("undefined"==typeof Buffer)throw new o.PrivyClientError("Buffer is not defined.",void 0,o.PrivyErrorCode.BUFFER_NOT_DEFINED);return Buffer.from(...e)},Ur=({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\n${`You 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`;class Rr{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup,messageType:this._meta.messageType,address:this.wallet?.address}}set messageType(e){this._meta.messageType=e}async authenticate(){if(!this.client)throw new o.PrivyClientError("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",messageType:this.meta.messageType})}catch(e){throw o.formatApiError(e)}}async link(){if(!this.client)throw new o.PrivyClientError("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,messageType:this.meta.messageType})}catch(e){throw o.formatApiError(e)}}async sign(){let e,t;if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");await this.buildMessage();let r="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new o.PrivyClientError("Could not prepare SIWS message");if(!r&&!this.wallet.signMessage||r&&!this.wallet.signTransaction)throw new o.PrivyClientError("Wallet does not support the necessary signing methods");if(r&&this._siwsTransactionMethods){let r=await this.wallet.signTransaction(this._siwsTransactionMethods.deserializeTransactionFromB64String(this.preparedMessage));e=r.serialize().toString("base64"),t=Fr(r.signatures[0]?.signature??Buffer.from("missing signature")).toString("base64")}else e=this.preparedMessage,t=Fr(await this.wallet.signMessage(Fr(this.preparedMessage))).toString("base64");return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new o.PrivyClientError("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),"transaction"===this.meta.messageType&&this._siwsTransactionMethods?this.preparedMessage=this._siwsTransactionMethods.prepareSiwsTransactionWithMemo({address:e,nonce:this.nonce}):this.preparedMessage=Ur({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1,i="plain",a){this._meta={disableSignup:!1,messageType:"plain"},this.getNonceOnce=new _t(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n,this._meta.messageType=i,this._siwsTransactionMethods=a}}class Or{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new o.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(o.passwordlessSmsAuthenticatePath,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new o.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(o.passwordlessSmsLinkPath,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw o.formatApiError(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:r}){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new o.PrivyClientError("phone nNumber must be set when initialzing authentication.");let n=wt(r);try{return await this.api.post(o.passwordlessSmsInitPath,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw o.formatApiError(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:r}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:r??!1}}}class Lr extends Or{async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new o.PrivyClientError("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post(o.updatePhonePath,{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw o.formatApiError(e)}}constructor(e,t,r){super({phoneNumber:t,captchaToken:r}),this.meta={phoneNumber:t,captchaToken:r,oldPhoneNumber:e,disableSignup:!1}}}const Dr=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,Br=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==Dr(e))return!1;if(e.providers)for(let t of e.providers)if(!Br(t))return!1;return!0},zr=()=>{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},Hr=(e,t,r,n)=>{let i=Number(e),a=t.find((e=>e.id===i));if(!a)throw new o.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return l.createPublicClient({transport:l.http($r(a,r,n.appId)),chain:a})},$r=(e,t,r)=>{let n,i=e.id,a=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])n=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[a])n=t.rpcUrls[a];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",r),n=t.toString()}else n=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!n)throw new o.PrivyConnectorError(`No RPC url found for ${i}`);return n},qr=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,}))$/),Vr=(e,t=3,r=4,n="ethereum")=>{if(!e)return"";let i="ethereum"===n?2:0;return t+r+i+3>=e.length?e:`${e.slice(0,i+t)}...${e.slice(e.length-r,e.length)}`},Kr=(e,t=3,r=4)=>Vr(e,t,r,"solana"),Gr=e=>new Promise((t=>setTimeout(t,e)));const Yr=(e,t={})=>{let r=t.delayMs||150,n=t.maxAttempts||270;return new Promise((async(i,a)=>{let o=!1,s=0;for(;!o&&s<n;){if(t.abortSignal?.aborted)return;e().then((e=>{o=!0,i(e)}),((...e)=>{o=!0,a(...e)})),s+=1,await Gr(r)}o||a(Error("Exceeded max attempts before resolving function"))}))},Zr=(e,t,r={},n={})=>{let i=new URL(t,e);for(let[e,t]of Object.entries(r))void 0!==t&&i.searchParams.set(e,t);let a=Object.entries(n);if(a.length>0){let e=new URLSearchParams;for(let[t,r]of a)e.append(t,r);i.hash=e.toString()}return i.href},Qr=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Xr=e=>"string"==typeof e?e:"0x"+e.toString(16);async function Jr({store:e,walletList:t,externalWalletConfig:r,walletChainType:n,timeout:i=3e3}){let a=!1,o=window;return new Promise((s=>{function l(){if(a)return;a=!0,window.removeEventListener("ethereum#initialized",l);let i=e.getProviders();console.debug("Detected injected providers:",i.map((e=>e.info)));let o=[];for(let e of i)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===n&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==n)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let e of t.providers)e&&r.push(e);return r.push(e.ethereum),r}()){let t=Dr(e);if(!i.some((e=>e.info.name===t))){if(Br(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"!==r.coinbaseWallet?.config?.preference?.options))){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()}),i))}))}function en(e){return`eip155:${String(Number(e))}`}const tn=(e,t,r,n)=>{let i=Number(e),a=t.find((e=>e.id===i));if(!a)throw new o.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return $r(a,r,n)},rn=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map((([e,r])=>{if(null!=r&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:r}}};const nn=/*#__PURE__*/r.createContext({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:s.notImplemented,setError:s.notImplemented,setExecuting:s.notImplemented,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:s.notImplemented,reset:s.notImplemented,execute:s.notImplemented});class an extends o.PrivyError{constructor(e,t,r){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}const on=({children:t,id:n,captchaSiteKey:i,captchaEnabled:a})=>{let s=r.useRef(null),[l,c]=r.useState(),[d,u]=r.useState(),[p,h]=r.useState(!1),y=r.useMemo((()=>a?p||l||d?!p||l||d?l&&!d?{status:"success",token:l}:d?{status:"error",error:d}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,l,d,p]);/*#__PURE__*/return e.jsx(nn.Provider,{value:{...y,ref:s,enabled:a,siteKey:i,appId:n,setToken:c,setError:u,setExecuting:h,remove(){a&&(s.current?.remove(),h(!1),u(void 0),c(void 0))},reset(){a&&(s.current?.reset(),h(!1),u(void 0),c(void 0))},execute(){a&&(h(!0),s.current?.execute())},async waitForResult(){if(!a)return"";try{return await function(e,{interval:t=100,timeout:r=5e3}={}){return new Promise(((n,i)=>{let a,o=0,s=()=>{o>=r?i("Max attempts reached without result"):(a=e(),o+=t,null==a?setTimeout(s,t):n(a))};s()}))}((()=>s.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new an("Captcha failed",null,o.PrivyErrorCode.CAPTCHA_TIMEOUT)}}},children:t})},sn=()=>r.useContext(nn);class ln{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(o.telegramAccountAuthenticatePath,{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 o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(o.telegramAccountLinkPath,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw o.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function cn(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===o.PrivyErrorCode.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===o.PrivyErrorCode.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof an&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function dn(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function un(){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 pn{static parse(e){try{return new pn(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return ke.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=ke.decodeJwt(e)}}class hn extends pn{static parse(e){try{return new hn(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}let yn=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 mn=(e,t)=>{if(t?.imported)return yn(t);let r=u.getPrivyPrimaryWallet(e);if(!r)throw Error("Failed to find primary wallet");return yn(r)},gn=({style:t,...r})=>/*#__PURE__*/e.jsxs("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[/*#__PURE__*/e.jsx("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),/*#__PURE__*/e.jsx("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"})]}),fn="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",wn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAALZJREFUaEPtmjEOhDAMBNc/O14GvOzys3CAKK6eAlmaVGl2Zc+kTOU685vkc9/bnD2prZK5/TZY24z9P+g4F5hNh7/GdoG37WlAA5CATwgCxHENYISwQAMQII5rACOEBRqAAHFcAxghLNAABIjjGsAIYYEGIEAc1wBGCAs0AAHiuAYwQligAQgQxzWAEcICDUCAOK4BjBAWaAACxHENYISwQAMQII6fBjr+VHkW3+u+tfyxMpJaDgYzYxb/ALZVAAAAAElFTkSuQmCC";class vn extends o.PrivyConnectorError{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class xn extends o.PrivyConnectorError{constructor(){super("User rejected connection"),this.type="wallet_error"}}const Cn=e=>e instanceof o.PrivyConnectorError?e:e?.code?new kn(e):new o.PrivyConnectorError("Unknown connector error",e);class bn extends o.PrivyError{constructor(e,t,r){super(e),this.type="provider_error",this.code=t,this.data=r}}class kn extends bn{constructor(e){super(e.message,e.code,e.data);let t=Object.values(a.ProviderErrors).find((t=>t.eipCode===e.code));this.details=t||a.ProviderErrors.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=a.ProviderErrors.E32002_CONNECTION_ALREADY_PENDING:this.details=a.ProviderErrors.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=a.ProviderErrors.E32002_WALLET_LOCKED))}}const En={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},...a.ProviderErrors};function An(e){return"ethereum"===e.type}function Tn(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n?.address!==i?.address||n&&i&&An(n)&&An(i)&&n?.chainId!==i?.chainId||n?.connectorType!==i?.connectorType||n?.connectedAt!==i?.connectedAt||n?.walletClientType!==i?.walletClientType||n?.isConnected!==i?.isConnected||n?.linked!==i?.linked)return!1}return!0}class jn extends Ee.default{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const In=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||tr;let Sn,Pn;function _n(e){return"ethereum"===e.chainType}class Nn extends jn{buildConnectedWallet(e,t,r,n){let a=async()=>!!this.wallets.find((t=>i.getAddress(t.address)===i.getAddress(e)));return{type:"ethereum",address:i.getAddress(e),chainId:t,meta:r,imported:n,switchChain:async r=>{let n,s;if(!a)throw new o.PrivyConnectorError("Wallet is not currently connected.");let l=this.wallets.find((t=>i.getAddress(t.address)===i.getAddress(e)))?.chainId;if(!l)throw new o.PrivyConnectorError("Unable to determine current chainId.");if("number"==typeof r?(n=`0x${r.toString(16)}`,s=r):(n=r,s=Number(r)),l===en(n))return;let c=this.chains.find((e=>e.id===s));if(!c)throw new o.PrivyConnectorError(`Unsupported chainId: ${r}`);let d=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})};try{return await d()}catch(e){if(((e,t)=>{switch(t){case"coinbase_wallet":case"base_account":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 Gr(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:[c.rpcUrls.default?.http[0]??""],blockExplorerUrls:[c.blockExplorers?.default.url??""]}]}),d();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new o.PrivyConnectorError(`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 o.PrivyConnectorError("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await a())throw new o.PrivyConnectorError("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t,r=e;try{if(void 0===r){let e=await Yr((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(r=e)}}catch(e){console.debug("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],a=i.getAddress(n),o=[];if("privy"===this.walletClientType){let e=kt.get(Xt(a));this.chains.find((t=>t.id===Number(e)))||(kt.del(Xt(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 Yr((()=>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 s=en(t);if(!o.find((e=>i.getAddress(e.address)===a))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};o.push(this.buildConnectedWallet(i.getAddress(n),s,e,"embedded_imported"===this.connectorType))}Tn(o,this.wallets)||(this.wallets=o,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=>i.getAddress(e)===i.getAddress(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:[i.toHex(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,r,n){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=en(e),"privy"===this.walletClientType&&kt.put(Xt(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=async()=>{"base_account"===this.connectorType&&this.connected||(this.connected=!0,"coinbase_wallet"===this.connectorType&&await Gr(500),this.syncAccounts())},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=r,this.rpcConfig=n,this.rpcTimeoutDuration=In(n,e),this.connected=!1,this.initialized=!1}}class Mn{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 o.PrivyConnectorError(`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 Cn(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 vn,t=this.rpcTimeoutDuration)=>new Promise(((r,n)=>setTimeout((()=>{n(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||tr,this._subscriptions=[]}}class Wn extends Nn{async initialize(){await this.importPromise,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:wn,id:"com.coinbase.wallet"}}async promptConnection(){try{await this.importPromise;let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new o.PrivyConnectorError("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw Cn(e)}}constructor(e,t,r,n,i){super("base_account",e,t,r),this.connectorType="base_account",this.walletClientType="base_account",this.displayName="Base",this.setBaseAccountSdk=i,this.proxyProvider=new Mn(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.baseAccountConfig={...n,appChainIds:[t.id].concat(e.map((e=>e.id)))},Sn?(this.proxyProvider.setWalletProvider(Sn.getProvider()),this.setBaseAccountSdk(Sn),console.log("Base Account SDK Initialized")):this.importPromise=import("@base-org/account").then((({createBaseAccountSDK:e})=>{Sn=e(this.baseAccountConfig),this.proxyProvider.setWalletProvider(Sn.getProvider()),this.setBaseAccountSdk(Sn),console.log("Base Account SDK Initialized")})).catch(console.error)}}let Fn=[1,11155111,137,10,8453,84532,42161,7777777,43114,56];class Un extends Nn{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:fn,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 o.PrivyConnectorError("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw Cn(e)}}updateConnectionPreference(e){this.coinbaseWalletConfig={...this.coinbaseWalletConfig,preference:{...this.coinbaseWalletConfig.preference,options:e}},this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",Pn=h.createCoinbaseWalletSDK({...this.coinbaseWalletConfig}),this.proxyProvider.setWalletProvider(Pn.getProvider())}constructor(e,t,r,n){if(super("coinbase_wallet",e,t,r),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new Mn(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.coinbaseWalletConfig={...n,appChainIds:[t.id].concat(e.map((e=>e.id)))},this.walletClientType="smartWalletOnly"===this.coinbaseWalletConfig.preference?.options?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!Pn){let e="eoaOnly"!==this.coinbaseWalletConfig.preference?.options?(this.coinbaseWalletConfig.appChainIds??[]).filter((e=>!Fn.includes(e))):[];e.length>0&&!e.every((e=>a.DEFAULT_SUPPORTED_CHAIN_IDS.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${e.join(", ")}`),Pn=h.createCoinbaseWalletSDK(this.coinbaseWalletConfig)}this.proxyProvider.setWalletProvider(Pn.getProvider())}}const Rn=({...t})=>/*#__PURE__*/e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:/*#__PURE__*/e.jsx("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:t.color||"var(--privy-color-foreground-3)"})});class On extends Nn{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:[Xr(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Rn,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:r,rpcConfig:n,imported:i,walletIndex:a}){super("privy",t,r,n),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=a,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const Ln=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];class Dn extends Error{constructor(e,t,r){super(e),this.code=t,this.data=r}}class Bn extends Ee.default{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new Dn(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await Bx()||!this.address)throw new Dn("Disconnected",4900);let{hash:r}=await qx(t,{address:this.address});return r}async handleSignTransaction(e){if(!e.params||!Array.isArray(e.params))throw new Dn(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await Bx()||!this.address)throw new Dn("Disconnected",4900);let{signature:r}=await $x(t,{address:this.address});return r}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new Dn(`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 Dn(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.publicClient=Hr(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],r=e.params[1],{signature:n}=await zx({message:t},{address:r});return n}async handleSignedTypedData(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_signTypedData_v4");let t=e.params[0],r="string"==typeof e.params[1]?JSON.parse(e.params[1]):e.params[1],{signature:n}=await Hx(rn(r),{address:t});return n}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:Xr(this.chainId)};return await this.publicClient.estimateGas({account:t.from??this.address,...y.toViemTransactionSerializable(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 Xr(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=>Ln.includes(e))(e.method))return this.publicClient.request({method:e.method,params:e.params});{let t=await Bx();if(await Vx({address:this.address}),!t||!this.address)throw new Dn("Disconnected",4900);try{let r={method:e.method,params:e.params},n=this.walletAccount;return n&&u.getIsUnifiedWallet(n)?this.handleWalletApiRequest(r,n,t):(await this.walletProxy.rpc({accessToken:t,entropyId:this.entropyId,entropyIdVerifier:this.entropyIdVerifier,chainType:"ethereum",hdWalletIndex:this.walletIndex,request:r})).response.data}catch(e){throw console.error(e),new Dn("Disconnected",4900)}}}async handleWalletApiRequest(e,t,r){let n=this.privyClient;if(!n)throw new Dn("Disconnected",4900);if("secp256k1_sign"===e.method){let i=await a.rpc(n,(async({message:e})=>this.walletProxy.signWithUserSigner({accessToken:r,message:e})),{chain_type:"ethereum",method:"secp256k1_sign",wallet_id:t.id,params:{hash:e.params[0]}});if("secp256k1_sign"!==i.method)throw new Dn(`Invalid params for ${e.method}`,4200);return i.data.signature}throw new Dn(`Method not supported: ${e.method}`,4200)}constructor({walletProxy:e,address:t,entropyId:r,entropyIdVerifier:n,rpcConfig:i,chains:a,appId:o,chainId:s=1,walletIndex:l,privyClient:c,walletAccount:d}){super(),this.walletProxy=e,this.address=t,this.entropyId=r,this.entropyIdVerifier=n,this.chainId=s,this.rpcConfig=i,this.chains=a,this.publicClient=Hr(s,this.chains,i,{appId:o}),this.rpcTimeoutDuration=In(i,"privy"),this.appId=o,this.walletIndex=l,this.privyClient=c,this.walletAccount=d}}class zn extends Nn{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:r,walletClientType:n,defaultChain:i}){super(n,[],i,{}),this.connectorType="null",this.proxyProvider=new Mn(void 0,tr),this.id=e,this.name=t,this.icon=r,this.connectorType=n}}const Hn=({style:t,...r})=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...t},...r,children:/*#__PURE__*/e.jsx("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"})}),$n=({...t})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"32",height:"32",rx:"6",fill:"#121314"}),/*#__PURE__*/e.jsx("g",{transform:"translate(4, 4)",children:/*#__PURE__*/e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 318.6 318.6",children:[/*#__PURE__*/e.jsx("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),/*#__PURE__*/e.jsx("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),/*#__PURE__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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"})]})})]}),qn=({style:t,...r})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...t},...r,children:[/*#__PURE__*/e.jsx("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),/*#__PURE__*/e.jsx("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 Vn(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Kn=0;class Gn extends Nn{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 o.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Cn(e)}}constructor(e,t,r,n,i){super(i||"unknown",e,t,r),this.connectorType="injected",this.proxyProvider=new Mn(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=n;let a=n.provider;this.proxyProvider.setWalletProvider(a)}}var Yn="__private_"+Kn+++"__walletBranding";class Zn extends Nn{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 Vn(this,Yn)[Yn]??{name:"Browser Extension",icon:Hn,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 o.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Cn(e)}}constructor(e,t,r,n,i){super(i??"unknown",e,t,r),Object.defineProperty(this,Yn,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new Mn(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(n),"metamask"===i?Vn(this,Yn)[Yn]={name:"MetaMask",icon:$n,id:"io.metamask"}:"phantom"===i&&(Vn(this,Yn)[Yn]={name:"Phantom",icon:qn,id:"phantom"})}}class Qn extends Gn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{n.isMobile||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 o.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw Cn(e)}}}const Xn=["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","base_account","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"],Jn=Object.freeze({phantom:{client:"phantom",name:"Phantom",installLink:Ce.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:r}){let n=ti({client:this.client,isSolana:t,connectOnly:r});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${n}?ref=${n}`}},solflare:{client:"solflare",name:"Solflare",installLink:Ce.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:r}){let n=ti({client:this.client,isSolana:t,connectOnly:r});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${n}?ref=${n}`}},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:r}){let n=ti({client:this.client,isSolana:t,connectOnly:r});return`${e?"backpack://ul/v1/":"https://backpack.com/ul/v1/"}browse/${n}?ref=${n}`}},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="+ti({client:this.client,isSolana:e,connectOnly:t}))}}});function ei({connectorType:e,walletClientType:t}){for(let r of Xn)if(e===r||t===r)return Jn[r]}function ti({client:e,isSolana:t,connectOnly:r}){let n=new URL(window.location.href);return n.searchParams.set("privy_connector",t?"solana_adapter":"injected"),n.searchParams.set("privy_wallet_client",e),n.searchParams.set("privy_connect_only",String(r)),encodeURIComponent(n.href.replace(/\/$/g,""))}const ri=()=>{let e=kt.get(er);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 ni=["phantom","glow","solflare","backpack","okx_wallet","walletconnect"];function ii(e){return"solana"===e.chainType}function ai(e){return"solana"===e.type}class oi extends jn{get isInstalled(){return"Installed"===this.adapter.readyState}get wallet(){return this.adapter.wallet}buildConnectedWallet(e,t){let r,n,i,a;if("Installed"!==e.readyState||!e.publicKey)throw Error("Wallet is not connected.");return"signMessage"in e&&(r=async(...t)=>{if(!e.connected)throw Error("Wallet is not connected.");return await e.signMessage(t[0])}),"sendTransaction"in e&&(n=async(...t)=>await e.sendTransaction(t[0],t[1],t[2])),"signTransaction"in e&&(i=async t=>await e.signTransaction(t)),"signAllTransactions"in e&&(a=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:s.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'getProvider'`),signMessage:r??s.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'signMessage'`),sendTransaction:n??s.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'sendTransaction'`),signTransaction:i??s.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'signTransaction'`),signAllTransactions:a??s.notImplementedWithMessage(`${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||!ni.includes(this.walletClientType))&&("phantom"!==this.walletClientType||ri().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 Cn(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 si 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 SolanaNullConnector")}constructor({id:e,name:t,icon:r}){super({name:t},!1),this.connectorType="null",this.proxyProvider=new Mn(void 0,tr),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=r}}const li=I.create((()=>({listings:[]}))),ci=li.setState,di=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return li.getState().listings.find((({homepage:e})=>{let r;try{r=new URL(e).hostname}catch(e){return!1}return t.includes(r)}))},ui=e=>li((({listings:t})=>t.find((({slug:t})=>pi(t)===pi(e)))));function pi(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}function hi({src:t,...r}){/*#__PURE__*/return e.jsx("img",{src:t,...r,style:{display:"none"}})}const yi={appearance:{landingHeader:"Log in or sign up",theme:"light",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 mi=new Set(["coinbase_wallet","base_account","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","ronin_wallet","haha_wallet","wallet_connect","wallet_connect_qr","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe","solflare","backpack","binance","binanceus"]),gi=e=>mi.has(e),fi=(e,t,r)=>r.indexOf(e)===t;const wi=792703809,vi="11111111111111111111111111111111";function xi(e){return e.includes("testnet")?"testnet":e.includes("devnet")?"devnet":"mainnet-beta"}function Ci(e,t){return`https://explorer.solana.com/account/${e}?cluster=${t}`}function bi(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Ae.default({...e.toHsl(),l:r})}function ki(e,t){let r=e.getLuminance(),n=t.getLuminance();return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function Ei({backgroundTheme:e,accentHex:t}){let r,n;"light"===e?r=!1:"dark"===e?r=!0:(r=.5>=Ae.default(e).getLuminance(),n=Ae.default(e).toHslString());let i=r?"dark":"light",a=r?Ai:Ti,{accent:o,accentLight:s,accentHover:l,accentDark:c,accentDarkest:d}=function(e,t){if(!e){let e=t?Ai:Ti;return{accent:Ae.default(e.background.interactive),accentLight:Ae.default(e.background.interactive),accentHover:Ae.default(e.background["interactive-hover"]),accentDark:Ae.default(e.background["interactive-clicked"]),accentDarkest:Ae.default(e.background["interactive-disabled"])}}let r=Ae.default(e);return{accent:r,accentLight:bi(r,.15),accentHover:bi(r,.3),accentDark:bi(r,-.06),accentDarkest:bi(r,-.6)}}(t,r),u=function(e){let t=Ae.default(Ti.text.default),r=Ae.default(Ai.text.default),n=ki(e,t),i=ki(e,r),a=e.toHsl();return a.h>=220&&a.h<=300&&i>=3?Ai.text.default:n>i?Ti.text.default:Ai.text.default}(o),p=Ae.default(u),h=ki(o,Ae.default(a.background.default))>=3;return{colorScheme:i,background:n||a.background.default,background2:a.background.elevated,background3:a.background.interactive,foreground:a.text.default,foreground2:a.text.muted,foreground3:a.text.placeholder,foreground4:a.border.default,accent:o.toHslString(),accentLight:s.toHslString(),accentHover:l.toHslString(),accentDark:c.toHslString(),accentDarkest:d.toHslString(),foregroundAccent:p.toHslString(),success:a.background.success,successDark:a.text.success,successLight:a.background.success,error:a.text.error,errorLight:a.background.error,warn:a.background.warning,warnLight:a.background.warning,warningDark:a.text.warning,errorDark:a.text.error,successBg:a.background.success,errorBg:a.background.error,errorBgHover:a.background["error-hover"],warnBg:a.background.warning,infoBg:a.background.info,infoBgHover:a.background["info-hover"],borderDefault:a.border.default,borderHover:a.border["default-hover"],borderFocus:a.border.focused,borderError:a.border.error,borderSuccess:a.border.success,borderWarning:a.border.warning,borderInfo:a.border.info,borderInteractive:a.border.interactive,borderInteractiveHover:a.border["interactive-hover"],backgroundHover:a.background["default-hover"],backgroundClicked:a.background["default-clicked"],backgroundDisabled:a.background["default-disabled"],backgroundInteractive:a.background.interactive,backgroundInteractiveHover:a.background["interactive-hover"],backgroundInteractiveClicked:a.background["interactive-clicked"],backgroundInteractiveDisabled:a.background["interactive-disabled"],foregroundHover:a.text.default,foregroundClicked:a.text.default,foregroundDisabled:a.text["default-disabled"],foregroundInteractive:a.text.interactive,foregroundInteractiveHover:a.text["interactive-hover"],accentHasGoodContrast:h?"1":"0",linkNavigationColor:h?o.toHslString():a.text.default,linkNavigationDecoration:h?"none":"underline",iconDefault:a.icon.default,iconMuted:a.icon.muted,iconSubtle:a.icon.subtle,iconInverse:a.icon.inverse,iconSuccess:a.icon.success,iconWarning:a.icon.warning,iconError:a.icon.error,iconInteractive:a.icon.interactive,iconDefaultHover:a.icon["default-hover"],iconMutedHover:a.icon["muted-hover"],iconSubtleHover:a.icon["subtle-hover"],iconDefaultClicked:a.icon["default-clicked"],iconMutedClicked:a.icon["muted-clicked"],iconSubtleClicked:a.icon["subtle-clicked"],iconDefaultDisabled:a.icon["default-disabled"],iconMutedDisabled:a.icon["muted-disabled"],iconSubtleDisabled:a.icon["subtle-disabled"],iconErrorHover:a.icon["error-hover"],iconInteractiveHover:a.icon["interactive-hover"],iconErrorClicked:a.icon["error-clicked"],iconInteractiveClicked:a.icon["interactive-clicked"],iconMutedDisabledAlt:a.icon["muted-disabled"],iconSubtleDisabledAlt:a.icon["subtle-disabled"]}}const Ai={background:{default:"#020713",elevated:"#1A2230","default-hover":"#101724","elevated-hover":"#242B3B","default-clicked":"#1A2230","elevated-clicked":"#2C3444","default-disabled":"#020713","elevated-disabled":"#141824",success:"#0E3E2D",warning:"#373827",error:"#2E0C18",interactive:"#8B86FF","error-hover":"#441821","interactive-hover":"#7B73E5","interactive-clicked":"#6560CC","interactive-disabled":"#141824",info:"#1F2937","info-hover":"#141824"},icon:{default:"#F8F8F8",muted:"#9BA2AE",subtle:"#7B8491",inverse:"#020713",success:"#88E3B5",warning:"#FDF27B",error:"#EF4444",interactive:"#88B6FF","default-hover":"#F8F8F8","muted-hover":"#AEB3BD","subtle-hover":"#8B939E","default-clicked":"#F8F8F8","muted-clicked":"#9097A5","subtle-clicked":"#78818E","default-disabled":"#404452","muted-disabled":"#404452","subtle-disabled":"#404452","error-hover":"#F05555","interactive-hover":"#7B73E5","error-clicked":"#EF4444","interactive-clicked":"#6560CC","muted-disabled-alt":"#404452","subtle-disabled-alt":"#404452"},text:{default:"#F8F8F8",muted:"#9BA2AE",placeholder:"#7B8491",inverse:"#020713",success:"#ACEECB",warning:"#FEF9A0",error:"#FCA5A5",interactive:"#A29EFF","default-hover":"#F8F8F8","muted-hover":"#9BA2AE","placeholder-hover":"#656C78","default-clicked":"#F8F8F8","muted-clicked":"#9BA2AE","placeholder-clicked":"#656C78","default-disabled":"#404452","muted-disabled":"#404452","placeholder-disabled":"#404452","error-hover":"#FA8B8B","interactive-hover":"#8C88E5","error-clicked":"#F87171","interactive-clicked":"#7671CC","error-disabled":"#404452","interactive-disabled":"#404452"},border:{default:"#1F2937",primary:"#110F2A",interactive:"#88B0FF",focused:"#F8F8FC",info:"#5B83D3",success:"#317056",warning:"#FBBF24",error:"#F87171","default-hover":"#34304A","interactive-hover":"#88B0FF","default-clicked":"#1F2937","interactive-clicked":"#88B0FF","default-active":"#F8F8F8","default-disabled":"#1F2937","interactive-disabled":"#1F2937","error-hover":"#971B1C","error-clicked":"#971B1C","error-disabled":"#1F2937"}},Ti={background:{default:"#FFFFFF",elevated:"#F1F2F9","default-hover":"#F8F9FC","elevated-hover":"#E8E9F4","default-clicked":"#F1F2F9","elevated-clicked":"#DFE0EF","default-disabled":"#FFFFFF","elevated-disabled":"#F1F2F9",success:"#DCFCE7",warning:"#FEF3C7",error:"#FEE2E2",interactive:"#5B4FFF","error-hover":"#FECACA","interactive-hover":"#4F46E5","interactive-clicked":"#4338CA","interactive-disabled":"#F1F2F9",info:"#E0E7FF","info-hover":"#EEF2FF"},icon:{default:"#110F2A",muted:"#64668B",subtle:"#9498B8",inverse:"#FFFFFF",success:"#33B287",warning:"#F59E0B",error:"#EF4444",interactive:"#564FFF","default-hover":"#1D1B35","muted-hover":"#64668B","subtle-hover":"#888AAE","default-clicked":"#060C23","muted-clicked":"#64668B","subtle-clicked":"#788804","default-disabled":"#CBCDE1","muted-disabled":"#CBCDE1","subtle-disabled":"#CBCDE1","error-hover":"#F06060","interactive-hover":"#4F46E5","error-clicked":"#DC3838","interactive-clicked":"#2BA482","error-disabled":"#CBCDE1","interactive-disabled":"#CBCDE1"},text:{default:"#040217",muted:"#64668B",placeholder:"#9498B8",inverse:"#FFFFFF",success:"#135638",warning:"#906218",error:"#991B1B",interactive:"#5B4FFF","default-hover":"#040217","muted-hover":"#64668B","placeholder-hover":"#9498B8","default-clicked":"#040217","muted-clicked":"#64668B","placeholder-clicked":"#9498B8","default-disabled":"#CBCDE1","muted-disabled":"#CBCDE1","placeholder-disabled":"#CBCDE1","error-hover":"#991B1B","interactive-hover":"#5B4FFF","error-clicked":"#991B1B","interactive-clicked":"#5B4FFF","error-disabled":"#CBCDE1","interactive-disabled":"#CBCDE1"},border:{default:"#E2E3F0",primary:"#110F2A",interactive:"#5B4FFF",focused:"#949DF9",info:"#F1F2F9",success:"#87D7B7",warning:"#FACD63",error:"#F69393","default-hover":"#E2E3F0","interactive-hover":"#5B4FFF","default-clicked":"#E2E3F0","interactive-clicked":"#5B4FFF","default-active":"#110F2A","default-disabled":"#E2E3F0","interactive-disabled":"#E2E3F0","error-hover":"#F69393","error-clicked":"#F69393","error-disabled":"#E2E3F0"}};function ji(e,t,r,n){let i,o,s,l,c,d,u,p,h,y,m,g,f,w,v,x,C=r?console.warn:()=>{};t?.loginMethods?(i=t.loginMethods.includes("email"),o=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),c=t.loginMethods.includes("google"),d=t.loginMethods.includes("twitter"),u=t.loginMethods.includes("discord"),y=t.loginMethods.includes("spotify"),m=t.loginMethods.includes("instagram"),p=t.loginMethods.includes("tiktok"),h=t.loginMethods.includes("line"),f=t.loginMethods.includes("github"),g=t.loginMethods.includes("linkedin"),w=t.loginMethods.includes("apple"),v=t.loginMethods.includes("farcaster"),x=t.loginMethods.includes("telegram"),s=t.loginMethods.includes("passkey")):(i=e.email_auth,o=e.sms_auth,l=e.wallet_auth||e.solana_wallet_auth,c=e.google_oauth,d=e.twitter_oauth,u=e.discord_oauth,f=e.github_oauth,y=e.spotify_oauth,m=e.instagram_oauth,p=e.tiktok_oauth,h=e.line_oauth,g=e.linkedin_oauth,w=e.apple_oauth,v=e.farcaster_auth,x=e.telegram_auth,s=e.passkey_auth),e.passkey_auth&&(s=!0),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential&&(s=!1);let b=[i,o].filter(Boolean),k=[c,d,u,f,y,m,p,h,g,w,v,x].filter(Boolean),E=[l].filter(Boolean),A=t?.loginMethods?.includes("passkey")??!1,T=e.passkeys_for_signup_enabled??!1,j=[s&&(T||A)].filter(Boolean);if(b.length+k.length+E.length+j.length===0)throw Error("You must enable at least one login method");let I=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.show_wallet_login_first;I&&0===E.length?(C("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),I=!1):I||k.length+b.length!==0||(C("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),I=!0);let S=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&C("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let P=(({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(gi).filter(fi):e?e.filter(gi).filter(fi):yi.appearance.walletList)({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),_=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];for(let r 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(r)?console.warn(`Duplicated login method: ${r}`):t.push(r);for(let n of e.overflow??[])t.includes(n)||r.includes(n)?console.warn(`Duplicated login method: ${n}`):r.push(n);return{primary:t,overflow:r}})({input:t?.loginMethodsAndOrder}),N=t?.intl?.defaultCountry??"US",{chains:M,defaultChain:W}=function({supportedChains:e,defaultChainFromConfig:t}){let r;if(e){if(0===e.length)throw Error("`supportedChains` must contain at least one chain");r=a.dedupeSupportedChains(e)}else r=[...a.DEFAULT_SUPPORTED_CHAINS];let n=e?r[0]:a.mainnet,i=t??n;if(!r.find((e=>e.id===i.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:i}}({supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain}),F=!!t?.defaultChain,U=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,R=t?.embeddedWallets?.requireUserPasswordOnCreate,O=t?.embeddedWallets?.createOnLogin,L=U?"all-users":e.embedded_wallet_config.ethereum.create_on_login,D=e.embedded_wallet_config.solana.create_on_login,B={"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:r,blockExplorerUrl:n}=e;B[t]={rpcUrl:r??B[t].rpcUrl,blockExplorerUrl:n??B[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 z=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,H=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??yi.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,footerLogo:t?.appearance?.footerLogo,palette:Ei({backgroundTheme:t?.appearance?.theme??yi.appearance.theme,accentHex:t?.appearance?.accentColor??e.accent_color}),loginGroupPriority:I?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:P,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:l,email:i,sms:o,passkey:s,google:c,twitter:d,discord:u,github:f,spotify:y,instagram:m,tiktok:p,line:h,linkedin:g,apple:w,farcaster:v,telegram:x},disablePlusEmails:e.disable_plus_emails,loginMethodsAndOrder:_,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??yi.walletConnectCloudProjectId,rpcConfig:{rpcUrls:{},rpcTimeouts:t?.externalWallets?.signatureRequestTimeouts??{}},chains:M,solanaClusters:B,defaultChain:W,intl:{defaultCountry:N},shouldEnforceDefaultChainOnConnect:F,captchaEnabled:e.captcha_enabled??yi.captchaEnabled,captchaSiteKey:e.captcha_site_key,externalWallets:{coinbaseWallet:{config:{appName:e.name,appLogoUrl:e.logo_url,preference:{options:t?.externalWallets?.coinbaseWallet?.connectionOptions??yi.externalWallets.coinbaseWallet.connectionOptions,...t?.externalWallets?.coinbaseWallet?.config?.preference},...t?.externalWallets?.coinbaseWallet?.config}},baseAccount:{config:{appName:e.name,appLogoUrl:e.logo_url,...t?.externalWallets?.baseAccount?.config,preference:{...t?.externalWallets?.baseAccount?.config?.preference,telemetry:!1}}},walletConnect:{enabled:S,appKit:t?.externalWallets?.walletConnect?.appKit},solana:{connectors:t?.externalWallets?.solana?.connectors},disableAllExternalWallets:t?.externalWallets?.disableAllExternalWallets??!1},embeddedWallets:{requireUserOwnedRecoveryOnCreate:R??(!U&&(e.embedded_wallet_config.require_user_owned_recovery_on_create??!1)),userOwnedRecoveryOptions:U?["user-passcode"]:e.embedded_wallet_config.user_owned_recovery_options,priceDisplay:t?.embeddedWallets?.priceDisplay??{primary:"fiat-currency",secondary:"native-token"},ethereum:{createOnLogin:O??t?.embeddedWallets?.ethereum?.createOnLogin??L},solana:{createOnLogin:t?.embeddedWallets?.solana?.createOnLogin??D},disableAutomaticMigration:t?.embeddedWallets?.disableAutomaticMigration??!1,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??n??"https://auth.privy.io"}},mfa:{methods:e.mfa_methods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},passkeys:{shouldUnlinkOnUnenrollMfa:t?.passkeys?.shouldUnlinkOnUnenrollMfa,shouldUnenrollMfaOnUnlink:t?.passkeys?.shouldUnenrollMfaOnUnlink},customAuth:U?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:z,passkeysForSignupEnabled:e.passkeys_for_signup_enabled},headless:!!t?.headless,render:{standalone:t?._render?.standalone??yi._render.standalone},fundingConfig:H,fundingMethodConfig:{...t?.fundingMethodConfig??yi.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??yi.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??yi.fundingMethodConfig.moonpay.useSandbox}},whatsAppEnabled:!!e.whatsapp_enabled}}const Ii={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:"user-controlled-server-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},Si=ji(Ii,void 0,!1);let Pi=/*#__PURE__*/r.createContext({appConfig:Si,isServerConfigLoaded:!1});const _i=({children:t,client:n,legacyClient:i,clientConfig:a})=>{let[o,s]=r.useState(null),l=r.useMemo((()=>ji(o??Ii,a,!!o,"undefined"!=typeof window?window.location.origin:void 0)),[o,a]);return r.useEffect((()=>{if(!o)return;let e=function(e){if(!e)return{};let{appearance:t,supportedChains:r,defaultChain:n,externalWallets:i,...a}=e;return{...a,...r?{supportedChains:r.map((e=>e.id))}:void 0,...n?{defaultChain:n.id}:void 0,...i?{walletConnect:i.walletConnect?{enabled:i.walletConnect.enabled}:void 0,coinbaseWallet:i.coinbaseWallet,solana:{connectors:i.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0}}(a),t=function(e,t=0){let r=3735928559^t,n=1103547991^t;for(let t,i=0;i<e.length;i++)r=Math.imul(r^(t=e.charCodeAt(i)),2654435761),n=Math.imul(n^t,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&(n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909)))+(r>>>0)}(JSON.stringify(e)).toString(),r=`privy:sent:${o.id}:${t}`;localStorage.getItem(r)||(i.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(r,"t"))}),[a,o]),r.useEffect((()=>{o||(async()=>{try{await n.initialize();let e=n.app.getConfig();e.custom_api_url&&i.updateApiUrl(e.custom_api_url),s(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),/*#__PURE__*/e.jsx(Pi.Provider,{value:{appConfig:l,isServerConfigLoaded:!!o},children:t})},Ni=()=>{let{appConfig:e}=r.useContext(Pi);return e},Mi=()=>{let{isServerConfigLoaded:e}=r.useContext(Pi);return e},Wi=/*#__PURE__*/r.createContext({app:Si,currentScreen:null,lastScreen:null,navigate:s.notImplemented,navigateBack:s.notImplemented,resetNavigation:s.notImplemented,setModalData:s.notImplemented,onUserCloseViaDialogOrKeybindRef:void 0}),Fi=t=>{let n=Ni(),i=t.authenticated,[a,o]=r.useState(t.initialScreen);r.useEffect((()=>{i||!t.initialScreen||t.initialScreen.isUnauthenticatedScreem||t.setInitialScreen(null)}),[i]);let s=r.useRef(null);r.useEffect((()=>{t.open||(s.current=null)}),[t.open]),r.useEffect((()=>{s.current=null}),[t.initialScreen]);let l={app:n,data:t.data,setModalData:t.setModalData,currentScreen:t.initialScreen,lastScreen:a,navigate:(e,r=!0)=>{t.setInitialScreen(e),r&&o(t.initialScreen)},navigateBack:()=>{t.setInitialScreen(a)},resetNavigation:()=>{t.setInitialScreen(null),o(null)},onUserCloseViaDialogOrKeybindRef:s};/*#__PURE__*/return e.jsxs(Wi.Provider,{value:l,children:[("string"==typeof n.appearance.logo||"img"===n.appearance.logo?.type)&&/*#__PURE__*/e.jsx(hi,{src:"string"==typeof n.appearance.logo?n.appearance.logo:n.appearance.logo.props.src}),t.children]})},Ui=()=>r.useContext(Wi),Ri=({style:t,...r})=>{let{app:n}=Ui();/*#__PURE__*/return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[/*#__PURE__*/e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"dark"===n?.appearance.palette.colorScheme?"#3396ff":"#141414"}),/*#__PURE__*/e.jsx("g",{clipPath:"url(#clip0_1765_9946)",children:/*#__PURE__*/e.jsx("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__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1765_9946",children:/*#__PURE__*/e.jsx("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})},Oi="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";class Li extends Nn{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=di(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown"),this.connected=!0,await this.syncAccounts()),this.initialized=!0,this.emit("initialized"),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:Qr(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:"string"==typeof e?e:Oi,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(Tt)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new xn)},(async()=>{let t="",r=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(r?.length&&(t=r[0]),!t||""===t)throw new o.PrivyConnectorError("Unable to retrieve address");this.walletProvider?.session?.peer.metadata.url&&(this.walletEntry=di(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown",this.proxyProvider.rpcTimeoutDuration=In(this.rpcConfig,this.walletClientType)),this.connected=!0,await this.syncAccounts(r),e()})().catch((e=>{t(e?Cn(e):new o.PrivyConnectorError("Unknown error during connection"))})).finally((()=>this.modal?.close()))}))}disconnect(){this.walletProvider?.disconnect().then((()=>this.onDisconnect())).catch((()=>console.warn("Unable to disconnect WalletConnect provider")))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(e){this.proxyProvider.setWalletProvider(e)}async createProvider(){let e={};for(let t of this.chains){let r=tn(t.id,this.chains,this.rpcConfig,this.privyAppId);r&&(e[t.id]=r)}let t=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],r=this.chains.map((e=>e.id)),i=await _.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:r,optionalEvents:_.OPTIONAL_EVENTS,optionalMethods:_.OPTIONAL_METHODS,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.origin,icons:[]}});return i.on("display_uri",(e=>{if(i.signer.abortPairingAttempt(),function(){try{localStorage.removeItem(Tt)}catch{}}(),!this.showPrivyQrModal){if(!this.modal)throw new o.PrivyConnectorError("Unable to open connect modal");return this.modal?.open({uri:e})}if(n.isMobile&&this.walletEntry){let{redirect:t,href:r}=function(e,t){let r=Et(t);if(r.deepLink)return It(r.deepLink,e);if(r.universalLink)return St(r.universalLink,e);throw new o.PrivyClientError(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);Pt(t,"_self"),function({href:e,name:t}){try{localStorage.setItem(Tt,JSON.stringify({href:e,name:t}))}catch{}}({href:r,name:this.walletEntry.metadata?.shortName||this.walletEntry.name});let n=At(e,this.walletEntry);return this.redirectUri=t,this.fallbackUniversalRedirectUri=n?.redirect,this.showPrivyQrModal({native:t,universal:t})}if(this.redirectUri=void 0,this.walletEntry){let t=At(e,this.walletEntry);this.fallbackUniversalRedirectUri=t?.redirect}this.showPrivyQrModal({native:e,universal:void 0})})),i.on("connect",(()=>{this.modal?.close(),i.session?.peer.metadata.url&&(this.walletEntry=di(i.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown")})),i}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({walletConnectCloudProjectId:e,rpcConfig:t,chains:r,defaultChain:n,shouldEnforceDefaultChainOnConnect:i,privyAppId:a,privyAppName:o,walletClientType:s,appKit:l}){super(s||"unknown",r,n,t),this.connectorType="wallet_connect_v2",this.privyAppId=a,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new Mn(void 0,this.rpcTimeoutDuration),this.modal=l,s&&(this.walletEntry=(e=>li.getState().listings.find((({slug:t})=>pi(t)===pi(e))))(s),this.walletClientType=s)}}class Di extends Ee.default{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 r=`${t.address}${t.walletClientType}${t.connectorType}${t.meta.id}`;return!e.has(r)&&(e.add(r),!0)})),r=t.findIndex((e=>e.address===(this.activeWallet?this.activeWallet:"unknown")));return r>=0&&t.unshift(t.splice(r,1)[0]),t}async initialize(e){if(this.initialized&&!e||(e&&this.removeAllConnectors(),kt.get(Jt)&&(kt.getKeys().forEach((e=>{e.startsWith("walletconnect")&&kt.del(e)})),kt.del(Jt)),this.externalWalletConfig.disableAllExternalWallets))return;let t=Jr({store:this.store,walletList:this.walletList,externalWalletConfig:this.externalWalletConfig,walletChainType:this.walletChainType}).then((e=>{e.forEach((({type:e,eip6963InjectedProvider:t,legacyInjectedProvider:r})=>{this.createEthereumWalletConnector({connectorType:"injected",walletClientType:e,providers:{eip6963InjectedProvider:t,legacyInjectedProvider:r}})}))}));for(let e of(this.walletList.includes("coinbase_wallet")&&this.createEthereumWalletConnector({connectorType:"coinbase_wallet",walletClientType:"coinbase_wallet"}),this.walletList.includes("base_account")&&this.createEthereumWalletConnector({connectorType:"base_account",walletClientType:"base_account"}),Object.values(Jn)))!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 si({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(_n).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(_n).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findSolanaWalletConnector(e){return this.walletConnectors.filter(ii).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.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(e){e.initialized&&this.emit("walletsUpdated")}addEmbeddedWalletConnectors({walletProxy:e,user:t,embeddedWallets:r,defaultChain:n,appId:i,privyClient:a}){let{entropyId:o,entropyIdVerifier:s}=mn(t);for(let t of r){let r=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===t.walletIndex));if(r&&_n(r))r.proxyProvider.walletProxy=e;else{let r=new On({provider:new Bn({walletProxy:e,address:t.address,entropyId:o,entropyIdVerifier:s,rpcConfig:this.rpcConfig,chains:this.chains,appId:i,chainId:n.id,walletIndex:t.walletIndex,privyClient:a,walletAccount:t}),chains:this.chains,defaultChain:n,rpcConfig:this.rpcConfig,imported:!1,walletIndex:t.walletIndex});this.addWalletConnector(r)}}}addImportedWalletConnector(e,t,r,n){let i=this.findWalletConnector("embedded_imported","privy");if(i&&_n(i))i.proxyProvider.walletProxy=e;else{let i=new On({provider:new Bn({walletProxy:e,address:t,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:n,chainId:r.id}),chains:this.chains,walletIndex:0,defaultChain:r,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(i)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.storedConnections=ri(),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.storedConnections=ri(),this.emit("walletsUpdated")}}async createEthereumWalletConnector({connectorType:e,walletClientType:t,providers:r,walletConfig:n}){let i=this.findWalletConnector(e,t);if(i&&_n(i))return i instanceof Li&&i.resetConnection(t),i;let a=(()=>"injected"!==e?"coinbase_wallet"===e?new Un(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig.coinbaseWallet.config):"base_account"===e?new Wn(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig.baseAccount.config,this.setBaseAccountSdk):"null"!==e?new Li({walletConnectCloudProjectId:this.walletConnectCloudProjectId,rpcConfig:this.rpcConfig,chains:this.chains,defaultChain:this.defaultChain,shouldEnforceDefaultChainOnConnect:this.shouldEnforceDefaultChainOnConnect,privyAppId:this.privyAppId,privyAppName:this.privyAppName,walletClientType:t,appKit:this.appKit}):n?new zn({id:n.client,name:n.name,defaultChain:this.defaultChain,walletClientType:n.client}):null:"metamask"===t&&r?.eip6963InjectedProvider?new Qn(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,"metamask"):"metamask"===t&&r?.legacyInjectedProvider?new Zn(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"metamask"):"phantom"===t&&r?.legacyInjectedProvider?new Zn(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"phantom"):r?.legacyInjectedProvider&&"unknown_browser_extension"===t?new Zn(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider):r?.eip6963InjectedProvider?new Gn(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,t):void 0)();return a&&this.addWalletConnector(a),a||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)}))}async activeWalletSign(e){let t=this.wallets,r=t.length>0?t[0]:null;return r&&An(r)?r.sign(e):null}setActiveWallet(e){this.activeWallet=i.getAddress(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,r,n,i,a,o,s,l,c,d,u,p){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 Mn},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=a,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=c,this.walletChainType=u||"ethereum-only",this.appKit=p,this.setBaseAccountSdk=d,this.storedConnections=ri()}}let Bi=[o.sessionsRefreshPath,o.sessionsLogoutPath,o.analyticsEventsPath];class zi{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw o.formatApiError(e)}}async post(e,t,r){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...r})}catch(e){throw o.formatApiError(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw o.formatApiError(e)}}constructor({appId:e,appClientId:t,client:r,defaults:n}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=Rt,this.client=r,this.defaults=n,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=le.ofetch.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 r=new Headers(t.headers);r.set("privy-app-id",this.appId),this.appClientId&&r.set("privy-client-id",this.appClientId),r.set("privy-ca-id",this.clientAnalyticsId||""),r.set("privy-client",`react-auth:${this.sdkVersion}`);let n=Bi.includes(e.toString());if(!r.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:n});null!==e&&r.set("authorization",`Bearer ${e}`)}t.headers=r,t.retryDelay&&"number"==typeof t.retryDelay&&(t.retryDelay=3*t.retryDelay)},onRequestError:({error:e})=>{if(e instanceof DOMException&&"AbortError"===e.name)throw new o.PrivyTimeoutError}})}}let Hi=/paymaster\.biconomy\.io\/api/i,$i={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}};const qi=(e,t)=>e&&Hi.test(e)?$i:t&&t.policy_id?{policyId:t.policy_id}:void 0,Vi=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});class Ki{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(o.customJwtAccountAuthenticatePath,{token:this.meta.token})}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(o.customJwtAccountLinkPath,{token:this.meta.token})}catch(e){throw o.formatApiError(e)}}constructor(e){this.meta={token:e}}}class Gi{getOrCreateGuestCredential(e){let t=Vt(e);if(bt()){if(kt.get(t))return kt.get(t);{let e=d.base64url.encode(ur(32));return kt.put(t,e),e}}return d.base64url.encode(ur(32))}async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(o.guestAccountAuthenticatePath,{guest_credential:this.meta.guestCredential})}catch(e){throw o.formatApiError(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function Yi(){return!(n.isSafari&&window.location.origin.startsWith("http://localhost"))}const Zi=I.create((()=>({identityToken:null})));var Qi,Xi=((Qi={}).PRIVY="privy_access_token",Qi.CUSTOMER="customer_access_token",Qi);class Ji{get token(){return this.privyAccessToken||this.customerAccessToken}getToken(e){return"privy_access_token"===e?this.privyAccessToken:this.customerAccessToken}get customerAccessToken(){return this._getToken(Ot)}get privyAccessToken(){return this._getToken(Bt)}_getToken(e){try{let t=kt.get(e);return"string"==typeof t?pn.throwIfNotWellFormedJwt(t):null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=kt.get(Dt);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=kt.get(Kt(e));if("string"!=typeof t)return null;{let r=new pn(t);return r.isExpired()?(kt.del(Kt(e)),null):r.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=ft.default.get($t);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),r="string"==typeof this.refreshToken&&"deprecated"!==this.refreshToken;return this.mightHaveServerCookies||t&&r}hasActiveAccessToken(e){let t=pn.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?kt.put(Kt(e),t):kt.del(Kt(e))}updateIdentityToken(e){"string"==typeof e?this.storeIdentityToken(e):this.clearIdentityToken()}async _authenticate(e){try{let t=await e.authenticate(),{user:r,is_new_user:n,oauth_tokens:i}=t;this.handleTokenResponse(t);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:i.scopes}:void 0;return this._trackAuthenticateEvents(e,n),{user:u.convertUserResponseToUser(r),isNewUser:n,oAuthTokens:a}}catch(e){throw console.warn("Error authenticating session"),o.formatPrivyError(e)}}_trackAuthenticateEvents(e,t){let r=function(e){return e instanceof vt?"email":e instanceof Or?"sms":e instanceof Wr?"siwe":e instanceof Gi?"guest":e instanceof Ki?"custom_auth":e instanceof mr?e.meta.provider:null}(e);r&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:r,isNewUser:t}}),"siwe"===r&&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(),r=t.oauth_tokens,n=r?{provider:r.provider,accessToken:r.access_token,accessTokenExpiresInSeconds:r.access_token_expires_in_seconds,refreshToken:r.refresh_token,refreshTokenExpiresInSeconds:r.refresh_token_expires_in_seconds,scopes:r.scopes}:void 0;return{user:u.convertUserResponseToUser(t),oAuthTokens:n}}catch(e){throw console.warn("Error linking account"),o.formatPrivyError(e)}}async _refresh(){if(!this.api)throw new o.PrivyClientError("Session has no API instance");if(!this.client)throw new o.PrivyClientError("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 r;if(!(e&&t||this.mightHaveServerCookies))return null;{let n={};e&&(n.authorization=`Bearer ${e}`),r=await this.api.post(o.sessionsRefreshPath,t?{refresh_token:t}:{},{headers:n})}return this.handleTokenResponse(r),u.convertUserResponseToUser(r.user)}catch(e){if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw o.formatPrivyError(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(o.sessionsLogoutPath,{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=kt.get(Ot);if(kt.put(Ot,e),!this.client?.useServerCookies){let t=pn.parse(e)?.expiration;ft.default.set(Lt,e,{sameSite:"Strict",secure:Yi(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreCustomerAccessToken?.(e)}else kt.del(Ot),ft.default.remove(Lt),this.client?.onDeleteCustomerAccessToken?.()}storeRefreshToken(e){"string"==typeof e?(kt.put(Dt,e),this.client?.useServerCookies||ft.default.set($t,"t",{sameSite:"Strict",secure:Yi(),expires:30})):(kt.del(Dt),ft.default.remove("privy-refresh-token"),ft.default.remove($t))}storePrivyAccessToken(e){"string"==typeof e?kt.put(Bt,e):kt.del(Bt)}storeIdentityToken(e){if(Zi.setState({identityToken:e}),this.client?.useServerCookies)return;kt.put(zt,e);let t=pn.parse(e)?.expiration;ft.default.set(Ht,e,{sameSite:"Strict",secure:Yi(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){kt.del(zt),Zi.setState({identityToken:null}),ft.default.remove(Ht)}constructor(){this.authenticateOnce=new _t((async e=>this._authenticate(e))),this.linkOnce=new _t((async e=>this._link(e))),this.refreshOnce=new _t(this._refresh.bind(this)),this.destroyOnce=new _t(this._destroy.bind(this))}}let ea;var ta=0,ra="__private_"+ta+++"__getOrGenerateClientAnalyticsId";class na{getAppId(){return this.appId}initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:r,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l,walletChainType:c,setBaseAccountSdk:d,appKit:u}){this.connectors||(this.connectors=new Di(this.appId,e,t,r,n,i,a,o,s,l,d,c,u))}generateApi(){let e=new zi({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 o.PrivyClientError("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new o.PrivyClientError("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(o.mfaPasswordlessSmsInitPath,{action:"verify"})}catch(e){throw o.formatApiError(e)}}async initMfaPasskeyVerification(){try{let e=await this.api.post(o.mfaPasskeyInitPath,{});return Vi(e.options)}catch(e){throw o.formatApiError(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{let e=await this.api.post(o.acceptTermsPath,{});return u.convertUserResponseToUser(e)}catch(e){throw o.formatPrivyError(e)}}async unlinkEmail(e){try{let t=await this.api.post(o.unlinkEmailPath,{address:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkPhone(e){try{let t=await this.api.post(o.unlinkPhonePath,{phoneNumber:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post(o.unlinkWalletPath,{address:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post(o.siwsUnlinkWalletPath,{address:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkOAuth(e,t){try{let r=await this.api.post(o.unlinkOAuthPath,{provider:e,subject:t});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(r)}catch(e){throw o.formatPrivyError(e)}}async unlinkFarcaster(e){try{let t=await this.api.post(o.unlinkFarcasterPath,{fid:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async unlinkTelegram(e){try{let t=await this.api.post(o.telegramAccountUnlinkPath,{telegram_user_id:e});return await this.getAuthenticatedUser()??u.convertUserResponseToUser(t)}catch(e){throw o.formatPrivyError(e)}}async revokeDelegatedWallet(){try{await this.api.post(o.delegatedActionsRevokePath,{})}catch(e){throw o.formatPrivyError(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:r,options:n}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(o.analyticsEventsPath,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:r?r.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch(e){console.log("Unable to submit event. This is not an issue.")}}async signMoonpayOnRampUrl(e){try{return this.api.post(o.moonpayPluginOnRampPath,e)}catch(e){throw o.formatPrivyError(e)}}async initCoinbaseOnRamp(e){try{return this.api.post(o.coinbaseOnRampInitPath,e)}catch(e){throw o.formatPrivyError(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`${o.coinbaseOnRampStatusPath}?partnerUserId=${e}`)}catch(e){throw o.formatPrivyError(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(Xi.CUSTOMER,e)}async getPrivyAccessToken(e){return await this._getToken(Xi.PRIVY,e)}async _getToken(e,t){return this.session.getToken(e)?this.session.hasActiveAccessToken(e)?this.session.hasRefreshCredentials(e)?hn.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 r=await this.api.get(`/api/v1/apps/${this.appId}/smart_wallets`,{baseURL:this.fallbackApiUrl,headers:e});return r.enabled?{enabled:r.enabled,smartWalletVersion:r.smart_wallet_version,smartWalletType:r.smart_wallet_type,configuredNetworks:r.configured_networks.map((e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url,paymasterContext:qi(e.paymaster_url,e.paymaster_context)})))}:{enabled:r.enabled}}catch(e){throw o.formatPrivyError(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(r){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(o.siweInitPath,{address:e,token:t})).nonce}catch(e){throw o.formatPrivyError(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a}){return await this.api.post(o.siweAuthenticatePath,{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a})}async linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){return await this.api.post(o.siweLinkPath,{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})}async linkSmartWallet({message:e,signature:t,smartWalletType:r,smartWalletVersion:n}){try{let i=await this.api.post(o.smartWalletLinkPath,{message:e,signature:t,smart_wallet_type:r,smart_wallet_version:n});return u.convertUserResponseToUser(i)}catch(e){throw o.formatPrivyError(e)}}async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i});return u.convertUserResponseToUser(a)}catch(e){throw o.formatPrivyError(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post(o.siwsInitPath,{address:e,token:t})).nonce}catch(e){throw o.formatPrivyError(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n,mode:i,messageType:a="plain"}){return await this.api.post(o.siwsAuthenticatePath,{message:e,signature:t,walletClientType:r,connectorType:n,mode:i,message_type:a})}async sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,telegramWebAppData:a,farcasterEmbeddedAddress:s,oAuthUserInfo:l}){try{let c,d;switch(r){case"email":c=o.transferEmailPath,d={nonce:e,email:t};break;case"sms":c=o.transferPhonePath,d={nonce:e,phoneNumber:t};break;case"siwe":if(c=o.transferWalletPath,!n)throw Error("Wallet parameters must be defined");d={nonce:e,address:t,...n};break;case"farcaster":c=o.transferFarcasterPath,d={nonce:e,farcaster_id:t,farcaster_embedded_address:s};break;case"telegram":c=o.telegramAccountTransferPath,d={nonce:e,telegram_auth_result:i,telegram_web_app_data:a};break;case"siws":c=o.siwsTransferPath,d={nonce:e,address:t,...n};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:c=o.transferOAuthPath,d={nonce:e,userInfo:l}}let p=await this.api.post(c,d);return await this.getAuthenticatedUser()??u.convertUserResponseToUser(p)}catch(e){throw o.formatPrivyError(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n,messageType:i="plain"}){return await this.api.post(o.siwsLinkPath,{message:e,signature:t,walletClientType:r,connectorType:n,message_type:i})}async linkWithSiws({message:e,signature:t,walletClientType:r,connectorType:n,messageType:i="plain"}){try{let a=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n,messageType:i});return u.convertUserResponseToUser(a)}catch(e){throw o.formatPrivyError(e)}}async updateUserAndIdToken(){try{let e=await this.api.get(o.usersMePath);return this.session.updateIdentityToken(e.identity_token),u.convertUserResponseToUser(e.user)}catch(e){throw o.formatPrivyError(e)}}async scanTransaction(e){try{return await this.api.post(o.transactionScanningPath,e)}catch(e){throw o.formatPrivyError(e)}}constructor({apiUrl:e=Mt,appId:t,appClientId:r,timeout:n=2e4}){Object.defineProperty(this,ra,{value:ia}),this._cachedProviderAppDetails={},this.apiUrl=e,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=e!==Mt&&e.startsWith("https://privy."),this.timeout=n,this.appId=t,this.appClientId=r,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,ra)[ra](),ea||(ea=new Ji),this.session=ea,this.api=this.generateApi(),this.session.client=this}}function ia(){if("undefined"==typeof window)return null;try{let e=kt.get(qt);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=c.v4();try{return kt.put(qt,e),e}catch(t){return e}}const aa=({delayedExecution:t,...n})=>{let{enabled:i,siteKey:a,appId:o,setError:s,setToken:l,setExecuting:c,ref:d}=sn(),[,u]=r.useMemo((()=>a?.split("t:")||[]),[a]);if(r.useEffect((()=>d.current?.remove),[]),!i)return null;if(!u)throw Error("Unsupported captcha site key");/*#__PURE__*/return e.jsx("div",{className:"hidden h-0 w-0",children:/*#__PURE__*/e.jsx(m.Turnstile,{...n,ref:d,siteKey:u,options:{action:o,size:"invisible",...t?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{n.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{n.onError?.(),s("Captcha failed"),c(!1)},onSuccess:e=>{n.onSuccess?.(e),l(e),c(!1)},onExpire:()=>{n.onExpire?.();try{d.current?.reset(),s(void 0),l(void 0)}catch(e){s("expired_and_failed_reset")}}})})},oa=e=>{let[t,n]=r.useState("auto");return r.useEffect((()=>{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},sa={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:[]}},la=/*#__PURE__*/r.createContext(void 0);let ca=()=>r.useContext(la);function da(e,t){if(!t)return;let n=ca().current[e];return r.useEffect((()=>{for(let[r,i]of Object.entries(t))Object.prototype.hasOwnProperty.call(n,r)||console.warn(`Invalid event type "${r}" for action "${e}"`),n[r]?.push(i);return()=>{for(let[r,i]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!==i))}}),[t])}function ua(e,t,r,...n){for(let i of e.current[t][r])i(...n)}function pa(){let e=ca();return(t,r,...n)=>ua(e,t,r,...n)}function ha(e){da("configureMfa",e)}const ya=/*#__PURE__*/g.styled.div.withConfig({displayName:"Grow",componentId:"sc-681ff332-0"})(["text-align:left;flex-grow:1;"]),ma=/*#__PURE__*/g.styled.div.withConfig({displayName:"AlignBottom",componentId:"sc-681ff332-1"})(["display:flex;flex-direction:column;justify-content:flex-end;flex-grow:1;"]),ga=/*#__PURE__*/g.styled.div.withConfig({displayName:"LoginMethodContainer",componentId:"sc-681ff332-2"})(["display:flex;flex-direction:column;gap:8px;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]),fa=/*#__PURE__*/g.styled(ga).withConfig({displayName:"LoginMethodContainerWithScrollShadows",componentId:"sc-681ff332-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:3px;"],(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 wa=/*#__PURE__*/g.css(["&&{width:100%;font-size:16px;line-height:24px;min-height:56px;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;align-items:center;color:var(--privy-color-foreground);padding:10px 12px;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);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);}}"]);const va=/*#__PURE__*/g.styled.div.withConfig({displayName:"Subtitle",componentId:"sc-681ff332-4"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),xa=/*#__PURE__*/g.styled.button.attrs({className:"login-method-button"}).withConfig({displayName:"LoginMethodButton",componentId:"sc-681ff332-5"})(["",""],wa),Ca=/*#__PURE__*/g.styled.div.withConfig({displayName:"LoginMethodIconWrapper",componentId:"sc-681ff332-7"})(["width:32px;height:32px;border-radius:",";background:",";display:flex;align-items:center;justify-content:center;flex-shrink:0;svg{width:",";height:",";color:",";}"],(e=>e.$fullSize?"0":"4px"),(e=>e.$fullSize?"transparent":"var(--privy-color-background-2)"),(e=>e.$fullSize?"32px":"18px"),(e=>e.$fullSize?"32px":"18px"),(e=>e.$fullSize?"inherit":"var(--privy-color-icon-muted)")),ba=/*#__PURE__*/g.styled.div.withConfig({displayName:"Hide",componentId:"sc-681ff332-8"})(["width:100%;height:100%;min-height:inherit;display:flex;flex-direction:column;",""],(e=>e.$if?"display: none;":"")),ka=/*#__PURE__*/g.styled.div.withConfig({displayName:"EmptyWalletState",componentId:"sc-681ff332-9"})(["width:100%;height:100%;padding:",";"],(e=>e.$withPadding?"64px 0px":"0px")),Ea=/*#__PURE__*/g.styled.div.withConfig({displayName:"Header",componentId:"sc-681ff332-10"})(["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;}"]);function Aa(t){/*#__PURE__*/return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40",...t,children:/*#__PURE__*/e.jsx("g",{fill:t.color||"var(--privy-color-foreground)",children:/*#__PURE__*/e.jsx("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 Ta=/*#__PURE__*/g.styled.span.withConfig({displayName:"TermsAndConditionsContainer",componentId:"sc-ff3bd734-0"})(["margin-top:16px;font-size:13px;text-align:center;color:var(--privy-color-foreground-3);display:block;&& > a{color:var(--privy-color-accent);}"]);function ja({app:{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:n}},alwaysShowImplicitConsent:i}){let a=!(!t||!r);return n&&!i||!r&&!t?
|
|
2
|
+
/*#__PURE__*/e.jsx(Ta,{}):
|
|
3
|
+
/*#__PURE__*/ /*#__PURE__*/e.jsxs(Ta,{children:["By logging in I agree to the"," ",r&&/*#__PURE__*/e.jsx("a",{href:r,target:"_blank",children:a?"Terms":"Terms of Service"}),a&&" & ",t&&/*#__PURE__*/e.jsx("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}const Ia=({className:t})=>{let{appearance:r}=Ni();/*#__PURE__*/return e.jsx(Pa,{className:t,children:r.footerLogo??/*#__PURE__*/e.jsx(Sa,{href:"https://www.privy.io/",target:"_blank",id:"protected-by-privy",children:/*#__PURE__*/e.jsx(Aa,{color:"currentColor",height:13,width:150})})})};let Sa=/*#__PURE__*/g.styled.a.withConfig({displayName:"PrivyLink",componentId:"sc-ff3bd734-1"})(["&&{padding:0;color:var(--privy-color-foreground-3);}"]);const Pa=/*#__PURE__*/g.styled.div.withConfig({displayName:"ModalFooter",componentId:"sc-ff3bd734-2"})(["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;}"]),_a=({backFn:t})=>/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Fa,{onClick:t,children:/*#__PURE__*/e.jsx(Pe.default,{height:"16px",width:"16px",strokeWidth:2})})}),Na=({infoFn:t})=>/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Ua,{"aria-label":"info",onClick:t,children:/*#__PURE__*/e.jsx(_e.default,{height:"22px",width:"22px",strokeWidth:2})})}),Ma=t=>/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Fa,{"aria-label":"close modal",onClick:t.onClose,children:/*#__PURE__*/e.jsx(Ne.default,{height:"16px",width:"16px",strokeWidth:2})})}),Wa=({backFn:t,infoFn:r,onClose:n,title:i,closeable:a=!0,className:o})=>{let{closePrivyModal:l}=s.usePrivyInternal(),c=Ni();/*#__PURE__*/return e.jsxs(Ra,{className:o,children:[/*#__PURE__*/e.jsxs(Oa,{children:[t&&/*#__PURE__*/e.jsx(_a,{backFn:t}),r&&/*#__PURE__*/e.jsx(Na,{infoFn:r})]}),i&&/*#__PURE__*/e.jsx(Da,{id:"privy-dialog-title",children:i}),/*#__PURE__*/e.jsx(La,{children:!c.render.standalone&&a&&/*#__PURE__*/e.jsx(Ma,{onClose:n||(()=>l())})})]})};let Fa=/*#__PURE__*/g.styled.button.withConfig({displayName:"StyledButton",componentId:"sc-e033e17a-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;}}"]),Ua=/*#__PURE__*/g.styled(Fa).withConfig({displayName:"TransparentStyledButton",componentId:"sc-e033e17a-1"})(["&&{background-color:transparent;}"]),Ra=/*#__PURE__*/g.styled.div.withConfig({displayName:"StyledHeader",componentId:"sc-e033e17a-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);}"]),Oa=/*#__PURE__*/g.styled.div.withConfig({displayName:"LeftActionContainer",componentId:"sc-e033e17a-3"})(["flex:1;align-items:center;display:flex;gap:8px;"]),La=/*#__PURE__*/g.styled.div.withConfig({displayName:"RightActionContainer",componentId:"sc-e033e17a-4"})(["flex:1;display:flex;justify-content:flex-end;"]),Da=/*#__PURE__*/g.styled.div.withConfig({displayName:"TitleContainer",componentId:"sc-e033e17a-5"})(["overflow:hidden;white-space:nowrap;max-width:100%;text-overflow:ellipsis;text-align:center;color:var(--privy-color-foreground-2);"]);const Ba=/*#__PURE__*/g.styled.div.withConfig({displayName:"AppLogoContainer",componentId:"sc-ba98f772-0"})(["display:flex;flex-direction:column;align-items:center;padding:0px 0px 30px;@media (max-width:440px){padding:10px 10px 20px;}"]),za=/*#__PURE__*/g.styled.div.withConfig({displayName:"Title",componentId:"sc-ba98f772-1"})(["font-size:18px;line-height:30px;text-align:center;font-weight:600;margin-bottom:10px;"]),Ha=/*#__PURE__*/g.styled.div.withConfig({displayName:"SubTitle",componentId:"sc-ba98f772-2"})(["font-size:0.875rem;text-align:center;"]),$a=/*#__PURE__*/g.styled.div.withConfig({displayName:"Container",componentId:"sc-ba98f772-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;}"]),qa=/*#__PURE__*/g.styled.div.withConfig({displayName:"List",componentId:"sc-ba98f772-4"})(["display:flex;flex-direction:column;align-items:stretch;gap:0.75rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),Va=/*#__PURE__*/g.styled.div.withConfig({displayName:"ListItemIcon",componentId:"sc-ba98f772-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);}"]),Ka=/*#__PURE__*/g.styled.div.withConfig({displayName:"ListItem",componentId:"sc-ba98f772-6"})(["display:flex;align-items:center;gap:10px;font-size:0.875rem;line-height:1rem;text-align:left;"]),Ga=/*#__PURE__*/g.styled.div.withConfig({displayName:"BottomSection",componentId:"sc-ba98f772-7"})(["display:flex;flex-direction:column;gap:10px;padding-top:20px;"]),Ya=/*#__PURE__*/g.styled.div.withConfig({displayName:"MethodList",componentId:"sc-ba98f772-8"})(["display:flex;flex-direction:column;align-items:stretch;gap:1rem;padding:1rem 0rem 0rem;flex-grow:1;width:100%;"]),Za=/*#__PURE__*/g.styled.div.withConfig({displayName:"MethodListItem",componentId:"sc-ba98f772-9"})(["display:flex;gap:5px;width:100%;position:relative;"]),Qa=/*#__PURE__*/g.styled.button.withConfig({displayName:"RemoveMethodButton",componentId:"sc-ba98f772-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);}"]),Xa=/*#__PURE__*/g.styled.div.withConfig({displayName:"MethodText",componentId:"sc-ba98f772-11"})(["display:flex;align-items:center;gap:0.5rem;> svg{z-index:2;height:20px !important;width:20px !important;}"]),Ja=/*#__PURE__*/g.styled.div.withConfig({displayName:"ExtraText",componentId:"sc-ba98f772-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)")),eo=/*#__PURE__*/g.styled.div.withConfig({displayName:"SmsInsecureText",componentId:"sc-ba98f772-13"})(["width:100%;display:flex;justify-content:space-between;"]),to=/*#__PURE__*/g.styled.p.withConfig({displayName:"TermsText",componentId:"sc-ba98f772-14"})(["text-align:left;width:100%;color:var(--privy-color-foreground-3) !important;"]),ro=/*#__PURE__*/g.styled.button.withConfig({displayName:"PrimaryTextButton",componentId:"sc-ba98f772-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)")),no=/*#__PURE__*/g.styled.div.withConfig({displayName:"IconWrapper",componentId:"sc-ba98f772-16"})(["display:flex;align-items:center;justify-content:center;color:var(--privy-color-accent);width:100%;> svg{z-index:2;width:3rem;height:3rem;}"]),io=/*#__PURE__*/g.styled.div.withConfig({displayName:"ErrorMessage",componentId:"sc-ba98f772-17"})(["color:var(--privy-color-error);"]),ao=({handleClose:t,user:r,onSelect:n})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:t},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(Se.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Verify your identity"}),/*#__PURE__*/e.jsx(Ha,{children:"Choose a verification method"}),/*#__PURE__*/e.jsxs(Ya,{children:[r.mfaMethods.includes("totp")&&/*#__PURE__*/e.jsxs(xa,{onClick:()=>n("totp"),children:[/*#__PURE__*/e.jsx(Te.default,{}),"Authenticator app"]},"totp"),r.mfaMethods.includes("sms")&&/*#__PURE__*/e.jsxs(xa,{onClick:()=>n("sms"),children:[/*#__PURE__*/e.jsx(Ie.default,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&/*#__PURE__*/e.jsxs(xa,{onClick:()=>n("passkey"),children:[/*#__PURE__*/e.jsx(je.default,{}),"Passkey"]},"passkey")]}),/*#__PURE__*/e.jsx(Pa,{})]}),oo=({success:t,fail:r})=>/*#__PURE__*/e.jsxs(lo,{children:[/*#__PURE__*/e.jsx(so,{children:/*#__PURE__*/e.jsx(uo,{className:t?"success":r?"fail":""})}),/*#__PURE__*/e.jsx(so,{children:/*#__PURE__*/e.jsx(co,{className:t?"success":r?"fail":""})})]});let so=/*#__PURE__*/g.styled.span.withConfig({displayName:"PositionedAbsoluteLoader",componentId:"sc-aba6339d-0"})(["&&{position:absolute;top:0;left:0;z-index:2;}"]),lo=/*#__PURE__*/g.styled.span.withConfig({displayName:"ConnectionLoaderContainer",componentId:"sc-aba6339d-1"})(["position:relative;width:82px;height:82px;display:inline-block;"]);const co=/*#__PURE__*/g.styled.span.withConfig({displayName:"Loader",componentId:"sc-aba6339d-2"})(["&&{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-icon-success);border-bottom-color:var(--privy-color-icon-success);}&&&.fail{border-color:var(--privy-color-icon-error);border-bottom-color:var(--privy-color-icon-error);}"],(e=>e.color??"var(--privy-color-icon-subtle)")),uo=/*#__PURE__*/g.styled(co).withConfig({displayName:"LoaderFaint",componentId:"sc-aba6339d-3"})(["&&{border-bottom-color:",";border-color:",";animation:none;opacity:0.5;}"],(e=>e.color??"var(--privy-color-border-default)"),(e=>e.color??"var(--privy-color-border-default)")),po=t=>/*#__PURE__*/e.jsx(ho,{color:t.color||"var(--privy-color-foreground-3)"});let ho=/*#__PURE__*/g.styled(co).withConfig({displayName:"StyledButtonLoader",componentId:"sc-aba6339d-4"})(["&&{height:1rem;width:1rem;margin:2px 0;border-width:1.5px;transition:border-color 200ms ease;}"]);const yo=({variant:t="primary",size:r="lg",children:n,success:i,...a})=>{switch(t){case"secondary":/*#__PURE__*/return e.jsx(xo,{size:r,...a,children:n});case"error":/*#__PURE__*/return e.jsx(xo,{$warn:!0,size:r,...a,children:n});case"muted":/*#__PURE__*/return e.jsx(Co,{size:r,...a,children:n});default:/*#__PURE__*/return e.jsx(go,{size:r,success:i,...a,children:n})}},mo=/*#__PURE__*/g.styled.button.withConfig({displayName:"BaseButton",componentId:"sc-e537b447-0"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;user-select:none;&{width:auto;cursor:pointer;border-radius:",";font-size:14px;font-style:normal;font-weight:500;line-height:22px;letter-spacing:-0.016px;}&&{height:",";padding:0 ",";}"],(({$size:e})=>"sm"===e?"6px":"var(--privy-border-radius-sm)"),(({$size:e})=>"sm"===e?"28px":"48px"),(({$size:e})=>"sm"===e?"10px":"16px")),go=({children:t,loading:r,disabled:n,success:i,size:a="lg",loadingText:o="Loading...",as:s,onClick:l,...c})=>{let d="a"===s,u=!(!r&&!n);/*#__PURE__*/return e.jsx(vo,{as:s,disabled:d?void 0:u,"aria-disabled":d?u:void 0,$success:i,$size:a,onClick:e=>{d&&u?e.preventDefault():l?.(e)},...c,children:r?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(po,{}),o?/*#__PURE__*/e.jsx("span",{style:{marginLeft:"8px"},children:o}):null]}):t})},fo=({children:t,loading:r,disabled:n,...i})=>/*#__PURE__*/e.jsx(wo,{disabled:n,...i,children:r?/*#__PURE__*/e.jsx(po,{color:"var(--privy-color-foreground-accent)"}):t});let wo=/*#__PURE__*/g.styled(mo).withConfig({displayName:"StyledPrimaryButtonWithoutGray",componentId:"sc-e537b447-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;color:var(--privy-color-foreground-disabled);background-color:var(--privy-color-accent-dark);}"]),vo=/*#__PURE__*/g.styled(mo).withConfig({displayName:"StyledPrimaryButton",componentId:"sc-e537b447-2"})(["position:relative;&&{background-color:",";color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:",";}&:active{background-color:",";}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;}&:disabled{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent-dark)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent-dark)"),(e=>e.disabled&&/*#__PURE__*/g.css(["&&&,&&&:hover,&&&:active{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"])));const xo=({children:t,loading:r,disabled:n,size:i="lg",loadingText:a="Loading...",as:o,onClick:s,...l})=>{let c="a"===o,d=!(!r&&!n);/*#__PURE__*/return e.jsx(bo,{as:o,disabled:c?void 0:d,"aria-disabled":c?d:void 0,$size:i,onClick:e=>{c&&d?e.preventDefault():s?.(e)},...l,children:r?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(po,{}),a?/*#__PURE__*/e.jsx("span",{style:{marginLeft:"8px"},children:a}):null]}):t})},Co=({children:t,loading:r,disabled:n,size:i="lg",loadingText:a="Loading...",as:o,onClick:s,...l})=>{let c="a"===o,d=!(!r&&!n);/*#__PURE__*/return e.jsx(ko,{as:o,disabled:c?void 0:d,"aria-disabled":c?d:void 0,$size:i,onClick:e=>{c&&d?e.preventDefault():s?.(e)},...l,children:r?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(po,{}),a?/*#__PURE__*/e.jsx("span",{style:{marginLeft:"8px"},children:a}):null]}):t})};let bo=/*#__PURE__*/g.styled(mo).withConfig({displayName:"StyledSecondaryButton",componentId:"sc-e537b447-3"})(["&&{border-width:1px;border-style:solid;border-color:",";background-color:var(--privy-color-background);color:",";transition:border-color 200ms ease,color 200ms ease,background-color 200ms ease;}&:hover{border-color:",";background-color:",";color:",";}&:active{border-color:",";background-color:",";color:",";}&:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-border-interactive-hover)"),(e=>e.$warn?"var(--privy-color-error-light)":"var(--privy-color-info-bg-hover)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-border-interactive)"),(e=>e.$warn?"var(--privy-color-error-bg-hover)":"var(--privy-color-info-bg)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.disabled&&/*#__PURE__*/g.css(["&&&,&&&:hover,&&&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"]))),ko=/*#__PURE__*/g.styled(mo).withConfig({displayName:"StyledMutedButton",componentId:"sc-e537b447-4"})(["&&{border-width:1px;border-style:solid;border-color:var(--privy-color-border-default);background-color:transparent;color:var(--privy-color-text-muted);transition:border-color 200ms ease,color 200ms ease,background-color 200ms ease;}&:hover{border-color:var(--privy-color-border-default);background-color:var(--privy-color-info-bg-hover);color:var(--privy-color-foreground-2);}&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-info-bg);color:var(--privy-color-foreground-2);}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;}&:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.disabled&&/*#__PURE__*/g.css(["&&&,&&&:hover,&&&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"])));const Eo=({children:t,onClick:r,disabled:n,isSubmitting:i,...a})=>/*#__PURE__*/e.jsxs(Ao,{$isSubmitting:i,onClick:r,disabled:n,...a,children:[/*#__PURE__*/e.jsx("span",{children:t}),
|
|
4
|
+
/*#__PURE__*/e.jsx("span",{children:/*#__PURE__*/e.jsx(po,{})})]});let Ao=/*#__PURE__*/g.styled.button.withConfig({displayName:"StyledEmbeddedButton",componentId:"sc-e537b447-7"})(["&&{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-disabled);cursor:not-allowed;}}"],(e=>e.$isSubmitting?0:1),(e=>e.$isSubmitting?1:0));const To=({label:t,children:r,valueStyles:n})=>/*#__PURE__*/e.jsxs(jo,{children:[/*#__PURE__*/e.jsx("div",{children:t}),/*#__PURE__*/e.jsx(Io,{style:{...n},children:r})]});let jo=/*#__PURE__*/g.styled.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;}"]),Io=/*#__PURE__*/g.styled.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;"]),So=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),Po=e=>So.format(e);const _o=(e,t)=>{let r=Po(t*parseFloat(e));return"$0.00"!==r?r:"<$0.01"},No=(e,t)=>{let r=Po(t*parseFloat(l.formatEther(e)));return"$0.00"===r?"<$0.01":r},Mo=(e,t,r=6,n=!1)=>`${Wo(e,r,n)} ${t}`,Wo=(e,t=6,r=!1)=>{let n=parseFloat(l.formatEther(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return r?n:`${"0"===n?"<0.001":n}`},Fo=e=>e.reduce(((e,t)=>e+t),0n),Uo=(e,t)=>{let{chains:r}=s.usePrivyInternal(),n=`https://etherscan.io/address/${t}`,i=`${((e,t)=>{let r=Number(e),n=t.find((e=>e.id===r));if(!n)throw new o.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return n.blockExplorers?.default.url})(e,r)}/address/${t}`;if(!i)return n;try{new URL(i)}catch{return n}return i};async function Ro(e,t){try{return await e}catch{return t}}const Oo="11111111111111111111111111111111",Lo=["CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C","CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"],Do=["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"];let Bo=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2});function zo(e,t=6,r=!1,n=!1){let i=(parseFloat(e.toString())/1e9).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),a=n?"":" SOL";return r?`${i}${a}`:`${"0"===i?"<0.001":i}${a}`}function Ho(e,t){let r=parseFloat(e.toString())/1e9,n=Bo.format(t*r);return"$0.00"===n?"<$0.01":n}function $o({amount:e,fee:t,tokenPrice:r,isUsdc:n}){let i=BigInt(Math.floor(parseFloat(e)*10**(n?6:9))),a=n?i:i+t;return{fundingAmountInBaseUnit:i,fundingAmountInUsd:r?Ho(i,r):void 0,totalPriceInUsd:r?Ho(a,r):void 0,totalPriceInNativeCurrency:zo(a),feePriceInNativeCurrency:zo(t),feePriceInUsd:r?Ho(t,r):void 0}}let qo={"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 Vo(e,t,r){let n=qo[e];if(!n[r]){let i=await t.getSplTokenMetadata({mintAddress:r,cluster:e});i&&(n[r]={address:r,symbol:i.symbol,decimals:i.decimals})}return n[r]}function Ko(e){return"version"in e}function Go(e,t){let r=(Ko(e)?e.message:e.compileMessage()).staticAccountKeys.find((e=>e.toBase58()===t));if(!r)throw Error(`Transaction does not contain public key ${t}`);return r}function Yo(e,t,r){return{signature:e,parsedTransaction:r??null,signedTransaction:t,fees:BigInt(r?.meta?.fee||0)}}async function Zo(e,t){let{value:r}=await t.simulateTransaction(e);if("BlockhashNotFound"===r.err)throw Error("Simulation failed: Blockhash not found");return null==r.err&&r.logs?.every((e=>!/insufficient funds/gi.test(e)))}async function Qo({tx:e,connection:t,client:r,checkFunds:n}){let i=Ko(e)?e.message:e.compileMessage(),a=i.staticAccountKeys[0]?.toBase58()??"",o=await async function(e,t){return BigInt((Ko(e)?(await t.getFeeForMessage(e.message)).value:await e.getEstimatedFee(t))??0)}(e,t),s=!n||await Ro(Zo(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,r)=>[...e.addressTableLookups[r]?.writableIndexes.map((e=>{let n=t?.state.addresses[e];if(n)return{key:n,isWritable:!0,altIdx:r}}))??[],...e.addressTableLookups[r]?.readonlyIndexes.map((e=>{let n=t?.state.addresses[e];if(n)return{key:n,isWritable:!1,altIdx:r}}))??[]])).flat().filter((e=>!!e)).sort(((e,t)=>e.isWritable!==t.isWritable?e.isWritable?-1:1:e.altIdx-t.altIdx)).map((({key:e})=>e))]}(i,t);for(let e of i.compiledInstructions){let n=i.staticAccountKeys[e.programIdIndex]?.toBase58()||"";if("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"!==n&&"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"!==n)if(n!==Oo){if("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"===n){let t=await Ro(function(e,t,r){let[n,i,a,o]=e.accountKeyIndexes.map((e=>t[e]));return{type:"ata-creation",program:r,payer:n?.toBase58(),ata:i?.toBase58(),owner:a?.toBase58(),mint:o?.toBase58()}}(e,d,n));if(!t){c.push({type:"unknown",program:n,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(Lo.includes(n)){let i=await Ro(ts(e,d,t,r,n));if(!i){c.push({type:"unknown",program:n,discriminator:e.data[0]});continue}c.push(i)}else if(Do.includes(n)){let i=await Ro(rs(e,d,t,r,n));if(!i){c.push({type:"unknown",program:n,discriminator:e.data[0]});continue}c.push(i)}else c.push({type:"unknown",program:n,discriminator:e.data[0]})}else{let t=await Ro(es(e,d));if(!t){c.push({type:"unknown",program:n,discriminator:e.data[0]});continue}c.push(t)}else{let i=await Ro(Jo(e,d,t,r,l,n));if(!i){c.push({type:"unknown",program:n,discriminator:e.data[0]});continue}c.push(i),"spl-transfer"===i.type&&(i.fromAta&&i.fromAccount&&i.token.address&&(l[i.fromAta]??={owner:i.fromAccount,mint:i.token.address}),i.toAta&&i.toAccount&&i.token.address&&(l[i.toAta]??={owner:i.toAccount,mint:i.token.address}))}}return{spender:a,fee:o,instructions:c,hasFunds:!!s}}function Xo(e,t=0){try{return function(e,t=0){let r=0n;for(let n=0;n<8;n++)r|=BigInt(e[t+n])<<BigInt(8*n);return r}(e,t)}catch{}try{return e.readBigInt64LE(t)}catch{}let r=Fr(e);try{return((e,t=0)=>{let r=e[t],n=e[t+7];if(!r||!n)throw Error(`Buffer offset out of range: first: ${r}, last: ${n}.`);return(BigInt(e[t+4]+256*e[t+5]+65536*e[t+6]+(n<<24))<<32n)+BigInt(r+256*e[++t]+65536*e[++t]+16777216*e[++t])})(r)}catch{}try{return r.subarray(t).readBigInt64LE()}catch{}try{return r.readBigInt64LE(t)}catch{}return 0n}async function Jo(e,t,r,n,i,a){let o=e.data[0],s=e.accountKeyIndexes.map((e=>t[e]));if(1===o){let[e,t,r]=s;return{type:"spl-init-account",program:a,account:e?.toBase58(),mint:t?.toBase58(),owner:r?.toBase58()}}if(3===o){let t,o,[l,c,d]=s,u="",p=c?i[c.toBase58()]:void 0;if(p)t=p.owner,u=p.mint;else if(c){let e=await r.getParsedAccountInfo(c,"confirmed"),n=e.value?.data;t=n?.parsed?.info?.owner,u=n?.parsed?.info?.mint??"",o=n?.parsed?.info?.tokenAmount?.decimals}if(!u&&l){let e=await r.getParsedAccountInfo(l,"confirmed"),t=e.value?.data;u=t?.parsed?.info?.mint??""}let h=xi(r.rpcEndpoint),y=await Vo(h,n,u),m=y?.symbol??"";return o??=y?.decimals??9,{type:"spl-transfer",program:a,fromAta:l?.toBase58(),fromAccount:d?.toBase58(),toAta:c?.toBase58(),toAccount:t,value:Xo(e.data,1),token:{symbol:m,decimals:o,address:u}}}if(9===o){let[e,t,r]=s;return{type:"spl-close-account",program:a,source:e?.toBase58(),destination:t?.toBase58(),owner:r?.toBase58()}}if(17===o)return{type:"spl-sync-native",program:a};throw Error(`Token program instruction type ${o} not supported`)}async function es(e,t){let r=e.data[0],n=e.accountKeyIndexes.map((e=>t[e]));if(0===r){let[,t]=n;return{type:"create-account",program:Oo,account:t?.toBase58(),value:Xo(e.data,4),withSeed:!1}}if(2===r){let[t,r]=n;return{type:"sol-transfer",program:Oo,fromAccount:t?.toBase58(),toAccount:r?.toBase58(),token:{symbol:"SOL",decimals:9},value:Xo(e.data,4),withSeed:!1}}if(3===r){let[,t]=n,r=Xo(e.data.slice(e.data.length-32-8-8));return{type:"create-account",program:Oo,account:t?.toBase58(),withSeed:!0,value:r}}if(11===r){let[t,r]=n;return{type:"sol-transfer",program:Oo,fromAccount:t?.toBase58(),toAccount:r?.toBase58(),value:Xo(e.data,4),token:{symbol:"SOL",decimals:9},withSeed:!0}}throw Error(`System program instruction type ${r} not supported`)}async function ts(e,t,r,n,i){let a=e.accountKeyIndexes.map((e=>t[e]?.toBase58())),o=e.data[0],s=xi(r.rpcEndpoint);if(143===o){let t=a[10],r=a[11];return{type:"raydium-swap-base-input",program:i,mintIn:t,mintOut:r,tokenIn:t?await Vo(s,n,t):void 0,tokenOut:r?await Vo(s,n,r):void 0,amountIn:Xo(e.data,8),minimumAmountOut:Xo(e.data,16)}}if(55===o){let t=a[10],r=a[11];return{type:"raydium-swap-base-output",program:i,mintIn:t,mintOut:r,tokenIn:t?await Vo(s,n,t):void 0,tokenOut:r?await Vo(s,n,r):void 0,maxAmountIn:Xo(e.data,8),amountOut:Xo(e.data,16)}}throw Error(`Raydium swap program instruction type ${o} not supported`)}async function rs(e,t,r,n,i){let a=e.data[0],o=e.accountKeyIndexes.map((e=>t[e])),s=xi(r.rpcEndpoint);if([208,51,239,151,123,43,237,92].includes(a)){let t=o[5]?.toBase58(),r=o[6]?.toBase58();return{type:"jupiter-swap-exact-out-route",program:i,mintIn:t,mintOut:r,tokenIn:t?await Vo(s,n,t):void 0,tokenOut:r?await Vo(s,n,r):void 0,outAmount:Xo(e.data,e.data.length-1-2-8-8),quotedInAmount:Xo(e.data,e.data.length-1-2-8)}}if([176,209,105,168,154,125,69,62].includes(a)){let t=o[7]?.toBase58(),r=o[8]?.toBase58();return{type:"jupiter-swap-exact-out-route",program:i,mintIn:t,mintOut:r,tokenIn:t?await Vo(s,n,t):void 0,tokenOut:r?await Vo(s,n,r):void 0,outAmount:Xo(e.data,e.data.length-1-2-8-8),quotedInAmount:Xo(e.data,e.data.length-1-2-8)}}if([193,32,155,51,65,214,156,129].includes(a)){let t=o[7]?.toBase58(),r=o[8]?.toBase58();return{type:"jupiter-swap-shared-accounts-route",program:i,mintIn:t,mintOut:r,tokenIn:t?await Vo(s,n,t):void 0,tokenOut:r?await Vo(s,n,r):void 0,inAmount:Xo(e.data,e.data.length-1-2-8-8),quotedOutAmount:Xo(e.data,e.data.length-1-2-8)}}throw[62,198,214,193,213,159,108,210].includes(a)&&console.warn("Jupiter swap program instruction 'claim' not implemented"),[116,206,27,191,166,19,0,73].includes(a)&&console.warn("Jupiter swap program instruction 'claim_token' not implemented"),[26,74,236,151,104,64,183,249].includes(a)&&console.warn("Jupiter swap program instruction 'close_token' not implemented"),[229,194,212,172,8,10,134,147].includes(a)&&console.warn("Jupiter swap program instruction 'create_open_orders' not implemented"),[28,226,32,148,188,136,113,171].includes(a)&&console.warn("Jupiter swap program instruction 'create_program_open_orders' not implemented"),[232,242,197,253,240,143,129,52].includes(a)&&console.warn("Jupiter swap program instruction 'create_token_ledger' not implemented"),[147,241,123,100,244,132,174,118].includes(a)&&console.warn("Jupiter swap program instruction 'create_token_account' not implemented"),[229,23,203,151,122,227,173,42].includes(a)&&console.warn("Jupiter swap program instruction 'route' not implemented"),[150,86,71,116,167,93,14,104].includes(a)&&console.warn("Jupiter swap program instruction 'route_with_token_ledger' not implemented"),[228,85,185,112,78,79,77,2].includes(a)&&console.warn("Jupiter swap program instruction 'set_token_ledger' not implemented"),[230,121,143,80,119,159,106,170].includes(a)&&console.warn("Jupiter swap program instruction 'shared_accounts_route_with_token_ledger' not implemented"),Error(`Jupiter swap program instruction type ${a} not supported`)}const ns=({weiQuantities:t,tokenPrice:r,tokenSymbol:n})=>{let i=Fo(t),a=r?No(i,r):void 0,o=Mo(i,n);/*#__PURE__*/return e.jsx(os,{children:a||o})},is=({weiQuantities:t,tokenPrice:r,tokenSymbol:n})=>{let i=Fo(t),a=r?No(i,r):void 0,o=Mo(i,n);/*#__PURE__*/return e.jsx(os,{children:a?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(ss,{children:"USD"}),"<$0.01"===a?
|
|
5
|
+
/*#__PURE__*/e.jsxs(cs,{children:[/*#__PURE__*/e.jsx(ls,{children:"<"}),"$0.01"]}):a]}):o})},as=({quantities:t,tokenPrice:r,tokenSymbol:n="SOL",tokenDecimals:i=9})=>{let a=t.reduce(((e,t)=>e+t),0n),o=r&&"SOL"===n&&9===i?Ho(a,r):void 0,s="SOL"===n&&9===i?zo(a):`${l.formatUnits(a,i)} ${n}`;/*#__PURE__*/return e.jsx(os,{children:o?/*#__PURE__*/e.jsx(e.Fragment,{children:"<$0.01"===o?
|
|
6
|
+
/*#__PURE__*/e.jsxs(cs,{children:[/*#__PURE__*/e.jsx(ls,{children:"<"}),"$0.01"]}):o}):s})};let os=/*#__PURE__*/g.styled.span.withConfig({displayName:"StyledPriceDisplay",componentId:"sc-596cd423-0"})(["font-size:14px;line-height:140%;display:flex;gap:4px;align-items:center;"]),ss=/*#__PURE__*/g.styled.span.withConfig({displayName:"StyledPriceUnit",componentId:"sc-596cd423-1"})(["font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);"]),ls=/*#__PURE__*/g.styled.span.withConfig({displayName:"TinyLessThan",componentId:"sc-596cd423-2"})(["font-size:10px;"]),cs=/*#__PURE__*/g.styled.span.withConfig({displayName:"FlexCenter",componentId:"sc-596cd423-3"})(["display:flex;align-items:center;"]);const ds=/*#__PURE__*/g.styled.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;"]),us=/*#__PURE__*/g.styled.div.withConfig({displayName:"CenteredItem",componentId:"sc-cb963810-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;flex-grow:1;width:100%;"]),ps=/*#__PURE__*/g.styled.div.withConfig({displayName:"HorizontallyCenteredItem",componentId:"sc-cb963810-2"})(["display:flex;flex-direction:column;align-items:center;width:100%;"]),hs=/*#__PURE__*/g.styled(us).withConfig({displayName:"CenteredItemWithPadding",componentId:"sc-cb963810-3"})(["padding:20px 0;"]),ys=/*#__PURE__*/g.styled(us).withConfig({displayName:"CenteredItemWithGap",componentId:"sc-cb963810-4"})(["gap:16px;"]),ms=/*#__PURE__*/g.styled.div.withConfig({displayName:"FlexContainer",componentId:"sc-cb963810-5"})(["display:flex;flex-direction:column;width:100%;"]),gs=/*#__PURE__*/g.styled.div.withConfig({displayName:"FixedGappedContainer",componentId:"sc-cb963810-6"})(["display:flex;flex-direction:column;gap:8px;"]),fs=/*#__PURE__*/g.styled.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;}"]),ws=/*#__PURE__*/g.styled.div.withConfig({displayName:"RefactorSpacerTop",componentId:"sc-cb963810-9"})(["height:16px;"]),vs=/*#__PURE__*/g.styled.div.withConfig({displayName:"RefactorSpacerBottom",componentId:"sc-cb963810-10"})(["height:12px;"]),xs=/*#__PURE__*/g.styled.div.withConfig({displayName:"ConfigurableSpacer",componentId:"sc-cb963810-12"})(["height:","px;"],(e=>e.height??"12")),Cs=({gas:t,tokenPrice:r,tokenSymbol:n})=>/*#__PURE__*/e.jsxs(ms,{style:{paddingBottom:"12px"},children:[/*#__PURE__*/e.jsxs(ks,{children:[/*#__PURE__*/e.jsx(As,{children:"Est. Fees"}),/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(is,{weiQuantities:[BigInt(t)],tokenPrice:r,tokenSymbol:n})})]}),r&&/*#__PURE__*/e.jsx(Es,{children:`${Mo(BigInt(t),n)}`})]}),bs=({value:t,gas:r,tokenPrice:n,tokenSymbol:i})=>{let a=BigInt(t??0)+BigInt(r);/*#__PURE__*/return e.jsxs(ms,{children:[/*#__PURE__*/e.jsxs(ks,{children:[/*#__PURE__*/e.jsx(As,{children:"Total (including fees)"}),/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(is,{weiQuantities:[BigInt(t||0),BigInt(r)],tokenPrice:n,tokenSymbol:i})})]}),n&&/*#__PURE__*/e.jsx(Es,{children:Mo(a,i)})]})};let ks=/*#__PURE__*/g.styled.div.withConfig({displayName:"TransactionTotalRow",componentId:"sc-f8ef9b74-0"})(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-top:4px;"]),Es=/*#__PURE__*/g.styled.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;"]),As=/*#__PURE__*/g.styled.div.withConfig({displayName:"TotalText",componentId:"sc-f8ef9b74-2"})(["font-size:14px;line-height:22.4px;font-weight:400;"]);const Ts=/*#__PURE__*/r.createContext(void 0),js=/*#__PURE__*/r.createContext(void 0),Is=({defaultValue:t,children:n})=>{let[i,a]=r.useState(t||null);/*#__PURE__*/return e.jsx(Ts.Provider,{value:{activePanel:i,togglePanel:e=>{a(i===e?null:e)}},children:/*#__PURE__*/e.jsx(Ms,{children:n})})},Ss=({value:t,children:n})=>{let{activePanel:i,togglePanel:a}=r.useContext(Ts),o=i===t;/*#__PURE__*/return e.jsx(js.Provider,{value:{onToggle:()=>a(t),value:t},children:/*#__PURE__*/e.jsx(Rs,{isActive:o?"true":"false","data-open":String(o),children:n})})},Ps=({children:t})=>{let{activePanel:n}=r.useContext(Ts),{onToggle:i,value:a}=r.useContext(js),o=n===a;/*#__PURE__*/
|
|
7
|
+
return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Ws,{onClick:i,"data-open":String(o),children:[/*#__PURE__*/e.jsx(Us,{children:t}),/*#__PURE__*/e.jsx(Ds,{isactive:o?"true":"false",children:/*#__PURE__*/e.jsx(Fe.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),/*#__PURE__*/e.jsx(Fs,{})]})},_s=({children:t})=>{let{activePanel:n}=r.useContext(Ts),{value:i}=r.useContext(js);/*#__PURE__*/return e.jsx(Os,{"data-open":String(n===i),children:/*#__PURE__*/e.jsx(Ls,{children:t})})},Ns=({children:t})=>{let{activePanel:n}=r.useContext(Ts),{value:i}=r.useContext(js);/*#__PURE__*/return e.jsx(Ls,{children:"function"==typeof t?t({isActive:n===i}):t})};let Ms=/*#__PURE__*/g.styled.div.withConfig({displayName:"AccordionRoot",componentId:"sc-d25f9267-0"})(["display:flex;flex-direction:column;width:100%;gap:8px;"]),Ws=/*#__PURE__*/g.styled.div.withConfig({displayName:"AccordionTriggerContainer",componentId:"sc-d25f9267-1"})(["display:flex;justify-content:space-between;align-items:center;width:100%;cursor:pointer;padding-bottom:8px;"]),Fs=/*#__PURE__*/g.styled.div.withConfig({displayName:"AccordionDivider",componentId:"sc-d25f9267-2"})(["width:100%;&&{border-top:1px solid;border-color:var(--privy-color-foreground-4);}padding-bottom:12px;"]),Us=/*#__PURE__*/g.styled.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-d25f9267-3"})(["font-size:14px;font-weight:500;line-height:19.6px;width:100%;padding-right:8px;"]),Rs=/*#__PURE__*/g.styled.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);}"]),Os=/*#__PURE__*/g.styled.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;}"]),Ls=/*#__PURE__*/g.styled.div.withConfig({displayName:"ContentWrapper",componentId:"sc-d25f9267-6"})(["display:flex;flex-direction:column;gap:12px;flex:1 1 auto;min-height:1px;"]),Ds=/*#__PURE__*/g.styled.div.withConfig({displayName:"IconWrapper",componentId:"sc-d25f9267-7"})(["transform:",";"],(e=>"true"===e.isactive?"rotate(180deg)":"rotate(0deg)"));const Bs=({walletAddress:t,chainId:r=1,network:n,rpcEndpoint:i})=>/*#__PURE__*/e.jsx(zs,{href:"ethereum"===n?Uo(r,t):Ci(t,xi(i||"")),target:"_blank",children:Vr(t)});let zs=/*#__PURE__*/g.styled.a.withConfig({displayName:"StyledLink",componentId:"sc-adda23e5-0"})(["&:hover{text-decoration:underline;}"]);const Hs=({from:t,to:r,txn:n,transactionInfo:i,tokenPrice:a,gas:o,tokenSymbol:s})=>{let l=BigInt(n?.value||0);/*#__PURE__*/
|
|
8
|
+
return e.jsx(Is,{...Ni().render.standalone?{defaultValue:"details"}:{},children:/*#__PURE__*/e.jsxs(Ss,{value:"details",children:[/*#__PURE__*/e.jsx(Ps,{children:/*#__PURE__*/e.jsxs($s,{children:[/*#__PURE__*/e.jsx("div",{children:i?.title||"Details"}),/*#__PURE__*/e.jsx(qs,{children:/*#__PURE__*/e.jsx(ns,{weiQuantities:[l],tokenPrice:a,tokenSymbol:s})})]})}),/*#__PURE__*/e.jsxs(_s,{children:[/*#__PURE__*/e.jsx(To,{label:"From",children:/*#__PURE__*/e.jsx(Bs,{walletAddress:t,chainId:n.chainId||1,network:"ethereum"})}),/*#__PURE__*/e.jsx(To,{label:"To",children:/*#__PURE__*/e.jsx(Bs,{walletAddress:r,chainId:n.chainId||1,network:"ethereum"})}),i&&i.action&&/*#__PURE__*/e.jsx(To,{label:"Action",children:i.action}),o&&/*#__PURE__*/e.jsx(Cs,{value:n.value,gas:o,tokenPrice:a,tokenSymbol:s})]}),/*#__PURE__*/e.jsx(Ns,{children:({isActive:t})=>/*#__PURE__*/e.jsx(bs,{value:n.value,displayFee:t,gas:o||"0x0",tokenPrice:a,tokenSymbol:s})})]})})};let $s=/*#__PURE__*/g.styled.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-e1259f7b-0"})(["display:flex;flex-direction:row;justify-content:space-between;"]),qs=/*#__PURE__*/g.styled.div.withConfig({displayName:"TotalText",componentId:"sc-e1259f7b-1"})(["flex-shrink:0;padding-left:8px;"]);const Vs=({enabled:e=!0}={})=>{let{showFiatPrices:t,getUsdPriceForSol:n}=s.usePrivyInternal(),[i,a]=r.useState(!0),[o,l]=r.useState(void 0),[c,d]=r.useState(void 0);return r.useEffect((()=>{(async()=>{if(t&&e)try{a(!0);let e=await n();e?d(e):l(Error("Unable to fetch SOL price"))}catch(e){l(e)}finally{a(!1)}else a(!1)})()}),[]),{solPrice:c,isSolPriceLoading:i,solPriceError:o}};function Ks(e){let{tokenPrice:t,isTokenPriceLoading:n,tokenPriceError:i}=(e=>{let{showFiatPrices:t,getUsdTokenPrice:n,chains:i}=s.usePrivyInternal(),[o,l]=r.useState(!0),[c,d]=r.useState(void 0),[u,p]=r.useState(void 0);return r.useEffect((()=>{e||=1;let r=a.addToDefaultChains(i).find((t=>t.id===Number(e)));(async()=>{if(t){if(!r)return l(!1),void d(Error(`Unable to fetch token price on chain id ${e}`));try{l(!0);let e=await n(r);e?p(e):d(Error(`Unable to fetch token price on chain id ${r.id}`))}catch(e){d(e)}finally{l(!1)}}else l(!1)})()}),[e]),{tokenPrice:u,isTokenPriceLoading:o,tokenPriceError:c}})("solana"===e?-1:e),{solPrice:o,isSolPriceLoading:l,solPriceError:c}=Vs({enabled:"solana"===e});return"solana"===e?{tokenPrice:o,isTokenPriceLoading:l,tokenPriceError:c}:{tokenPrice:t,isTokenPriceLoading:n,tokenPriceError:i}}const Gs=/*#__PURE__*/r.createContext(null);function Ys(){let e=r.useContext(Gs);return null===e?(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1}):e}async function Zs(e,t,r,n){let i=y.toViemTransactionSerializable(e),a=await(async()=>n?await n():await t.prepareTransactionRequest({...i,account:{address:r,type:"json-rpc"}}))();return{...a,type:y.STRING_TO_NUMBER_TXN_TYPE[a.type]}}const Qs=({pendingTransaction:t})=>{let{wallets:n}=Ys(),{walletProxy:i,rpcConfig:a,chains:o,appId:c,nativeTokenSymbolForChainId:d}=s.usePrivyInternal(),[u,p]=r.useState(null),[h,y]=r.useState(t),{tokenPrice:m}=Ks(h.chainId),g=d(t.chainId)||"ETH",f=r.useMemo((()=>n.find((e=>"privy"===e.walletClientType))),[n]);return r.useEffect((()=>{(async function(){if(!i||!f)return h;let e=Hr(h.chainId,o,a,{appId:c}),t=await Zs(h,e,f.address);return p(l.toHex(BigInt(t.gas??0))),t})().then(y).catch(console.error)}),[i]),f?/*#__PURE__*/e.jsx(Xs,{children:/*#__PURE__*/e.jsx(Hs,{from:f.address,to:h.to,txn:h,gas:u??void 0,tokenPrice:m,tokenSymbol:g})}):null};let Xs=/*#__PURE__*/g.styled.div.withConfig({displayName:"TransactionInfoWrapper",componentId:"sc-8d9a2f57-0"})(["width:100%;padding:1rem 0;"]),Js=/*#__PURE__*/g.styled.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 el=({style:t,...r})=>/*#__PURE__*/e.jsx("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...t},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...r,children:/*#__PURE__*/e.jsx("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"})}),tl=({hasBlockingError:t,error:r,onClose:n,onBack:i,handleSubmit:a,account:o,submitSuccess:l})=>{let{pendingTransaction:c}=s.usePrivyInternal();/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:n},"header"),/*#__PURE__*/e.jsx(Js,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx(oo,{success:l,fail:!!r}),r?/*#__PURE__*/e.jsx(We.default,{style:{width:"38px",height:"38px"}}):/*#__PURE__*/e.jsx(el,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/e.jsx(za,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),/*#__PURE__*/e.jsxs(qa,{children:[/*#__PURE__*/e.jsxs(Ka,{children:[/*#__PURE__*/e.jsx(Va,{children:/*#__PURE__*/e.jsx(Se.default,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),/*#__PURE__*/e.jsxs(Ka,{children:[/*#__PURE__*/e.jsx(Va,{children:/*#__PURE__*/e.jsx(Me.default,{})}),"You last added a passkey on"," ",o?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),c&&/*#__PURE__*/e.jsx($a,{children:/*#__PURE__*/e.jsx(Qs,{pendingTransaction:c})}),r&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(io,{style:{marginTop:"1.25rem"},children:r.message}),/*#__PURE__*/e.jsx(go,{disabled:t,onClick:a,style:{marginTop:"1.25rem"},children:"Try again"})]}),i&&/*#__PURE__*/e.jsx(ro,{style:{marginTop:"1rem"},onClick:i,children:"Choose another method"}),/*#__PURE__*/e.jsx(Pa,{})]})};let rl=Array(6).fill("");var nl,il=((nl=il||{})[nl.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",nl[nl.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",nl);function al(e){return/^[0-9]{1}$/.test(e)}function ol(e){return 6===e.length&&e.every(al)}const sl=({onChange:t,disabled:i,errorReasonOverride:a,success:o})=>{let[s,l]=r.useState(rl),[c,d]=r.useState(null),[u,p]=r.useState(null),h=async e=>{e.preventDefault();let r=e.currentTarget.value.replace(/\s+/g,"");if(""===r)return;let n=s.reduce(((e,t)=>e+Number(al(t))),0),i=r.split(""),a=!i.every(al),o=i.length+n>6;if(a)return d("Passcode can only be numbers"),void p(1);if(o)return d("Passcode must be exactly 6 numbers"),void p(1);d(null),p(null);let c=Number(e.currentTarget.name?.charAt(4)),u=[...r||[""]].slice(0,6-c),h=[...s.slice(0,c),...u,...s.slice(c+u.length)];l(h);let y=Math.min(Math.max(c+u.length,0),5),m=document.querySelector(`input[name=pin-${y}]`);if(m?.focus(),ol(h))try{await t(h.join(""));let e=document.querySelector(`input[name=pin-${y}]`);e?.blur()}catch(e){p(1),d(e.message)}else try{await t(null)}catch(e){p(1),d(e.message)}},y=o?"success":!(!a&&!c)?"fail":"";/*#__PURE__*/return e.jsx(e.Fragment,{children:/*#__PURE__*/e.jsxs(ll,{children:[/*#__PURE__*/e.jsx("div",{children:s.map(((r,a)=>/*#__PURE__*/e.jsx("input",{name:`pin-${a}`,type:"text",value:s[a],onChange:h,onKeyUp:e=>{"Backspace"===e.key&&(e=>{1===u&&(d(null),p(null));let r=[...s.slice(0,e),"",...s.slice(e+1)];if(l(r),e>0){let t=document.querySelector(`input[name=pin-${e-1}]`);t?.focus()}ol(r)?t(r.join("")):t(null)})(a)},inputMode:"numeric",autoFocus:0===a,pattern:"[0-9]",className:y,autoComplete:n.isMobile?"one-time-code":"off",disabled:i},a)))}),/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(cl,{$fail:!!a||!!c,children:a||c})})]})})};let ll=/*#__PURE__*/g.styled.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);}}"]),cl=/*#__PURE__*/g.styled.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 dl=({selectedMethod:t,submitSuccess:r,hasBlockingError:n,onClose:i,onBack:a,handleSubmitCode:o})=>{let{app:l}=Ui(),{pendingTransaction:c}=s.usePrivyInternal();switch(t){case"sms":/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:i},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(Ie.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Enter verification code"}),/*#__PURE__*/e.jsxs($a,{children:[/*#__PURE__*/e.jsx(sl,{success:r,disabled:n,onChange:o}),/*#__PURE__*/e.jsxs(Ha,{children:["To continue, please enter the 6-digit code sent to your ",/*#__PURE__*/e.jsx("strong",{children:"mobile device"})]}),c&&/*#__PURE__*/e.jsx(Qs,{pendingTransaction:c})]}),a&&/*#__PURE__*/e.jsx(ro,{theme:l?.appearance.palette.colorScheme,onClick:a,children:"Choose another method"}),/*#__PURE__*/e.jsx(xo,{onClick:i,children:"Cancel"}),/*#__PURE__*/e.jsx(Pa,{})]});case"totp":/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:i},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(Te.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Enter verification code"}),/*#__PURE__*/e.jsxs($a,{children:[/*#__PURE__*/e.jsx(sl,{success:r,disabled:n,onChange:o}),/*#__PURE__*/e.jsxs(Ha,{children:["To continue, please enter the 6-digit code generated from your"," ",/*#__PURE__*/e.jsx("strong",{children:"authenticator app"})]}),c&&/*#__PURE__*/e.jsx(Qs,{pendingTransaction:c})]}),a&&/*#__PURE__*/e.jsx(ro,{theme:l?.appearance.palette.colorScheme,onClick:a,children:"Choose another method"}),/*#__PURE__*/e.jsx(xo,{onClick:i,children:"Cancel"}),/*#__PURE__*/e.jsx(Pa,{})]});default:return null}},ul=["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 pl extends Error{constructor(e,t){super(t),this.type=e}}function hl(e){let t=e.type;return"string"==typeof t&&ul.includes(t)}function yl(e){return hl(e)&&"wallet_not_on_device"===e.type}function ml(e){return!!hl(e)&&"mfa_timeout"===e.type}function gl(e){return!!hl(e)&&"missing_or_invalid_mfa"===e.type}function fl(e){return!!hl(e)&&"mfa_verification_max_attempts_reached"===e.type}function wl(e){return!(!hl(e)||!e.message.includes("code 429"))}function vl(e){return!!function(e){let t=e.type;return"string"==typeof t&&"client_error"===t}(e)&&"MFA canceled"===e.message}const xl=e=>fl(e)?{isBlocking:!0,error:Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")}:gl(e)?{isBlocking:!1,error:Error("The code you entered is not valid")}:ml(e)?{isBlocking:!0,error:Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")}:(console.error(e),{isBlocking:!1,error:Error("Something went wrong.")}),Cl={component:()=>{let{user:t}=u.usePrivyContext(),{data:n}=Ui(),[i,a]=r.useState(t?.mfaMethods[0]),[o,s]=r.useState(!1),[l,c]=r.useState(),[d,p]=r.useState();if(r.useEffect((()=>{a(t?.mfaMethods[0])}),[t?.mfaMethods]),!n?.mfaVerify)throw Error("Missing modal data for MFA verification screen.");let{onFailure:h,onSuccess:y,generateOptions:m,verifyTotpCode:g,verifyPasskey:f,verifySmsCode:w,sendSmsCode:v}=n.mfaVerify,x=async e=>{if("passkey"!==e)try{a(e),"sms"===e&&(a(e),await v()),"totp"===e&&a(e)}catch(e){console.error(e)}else try{a(e);let t=await m();if(!t)throw Error("something went wrong");c(t),await f(t),s(!0),p(void 0),y()}catch(e){p(xl(e))}},C=async e=>{p(void 0);try{if(!e||!i)return;if("passkey"===i){if(!l)throw Error("Missing passkey challenge");await f(l)}else"sms"===i?await w(e):"totp"===i&&await g(e);p(void 0),s(!0),y()}catch(e){throw xl(e).error}},b=()=>{d||!o?h(d?.error??Error("Canceled MFA verification.")):y()},k=r.useRef(!1);return r.useEffect((()=>{!k.current&&i&&(k.current=!0,x(i).finally((()=>{k.current=!1})))}),[open]),t?"passkey"===i?/*#__PURE__*/e.jsx(tl,{account:t.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],submitSuccess:o,hasBlockingError:d?.isBlocking??!1,error:d?.error,onClose:b,onBack:()=>{a(void 0),p(void 0)},handleSubmit:()=>C(l).catch(p)}):"sms"===i||"totp"===i?/*#__PURE__*/e.jsx(dl,{selectedMethod:i,submitSuccess:o,hasBlockingError:d?.isBlocking??!1,handleSubmitCode:C,onClose:b,onBack:t.mfaMethods.length>1?()=>a(void 0):void 0}):/*#__PURE__*/e.jsx(ao,{user:t,onSelect:x,handleClose:b}):null}};function bl(){let{promptMfa:e,init:t,submit:n,cancel:i,mfaMethods:a}=r.useContext(u.PrivyContext);return{promptMfa:e,init:t,submit:n,cancel:i,mfaMethods:a}}const kl=({onClose:t})=>{let{user:n}=u.usePrivyContext(),[i,a]=r.useState(n?.mfaMethods[0]??null),{init:o,cancel:s,submit:l}=bl(),[c,d]=r.useState(!1),[p,h]=r.useState(null),[y,m]=r.useState();r.useEffect((()=>{a(n?.mfaMethods[0]??null)}),[n?.mfaMethods]);let g=r.useRef(!1);async function f(e){m(void 0);try{if(!e||!i)return;await l(i,e),d(!0),m(void 0),t()}catch(e){throw xl(e).error}}async function w(e){if("passkey"!==e)try{a(e),await o(e)}catch(e){console.error(e)}else try{a(e);let r=await o(e);if(!r)throw Error("something went wrong");h(r),await l(e,r),d(!0),m(void 0),t()}catch(e){m(xl(e))}}r.useEffect((()=>{!g.current&&i&&(g.current=!0,w(i).finally((()=>{g.current=!1})))}),[]);let v=()=>{a(null),m(void 0),s(),t()};return n?"passkey"===i?/*#__PURE__*/e.jsx(tl,{account:n.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],submitSuccess:c,hasBlockingError:y?.isBlocking??!1,error:y?.error,onClose:v,onBack:()=>{a(null),m(void 0)},handleSubmit:()=>f(p).catch(m)}):i?/*#__PURE__*/e.jsx(dl,{submitSuccess:c,hasBlockingError:y?.isBlocking??!1,handleSubmitCode:f,selectedMethod:i,onClose:v,onBack:n.mfaMethods.length>1?()=>a(null):void 0}):/*#__PURE__*/e.jsx(ao,{user:n,onSelect:w,handleClose:v}):null},El=I.create((()=>({inProgressMfaFlow:void 0})));const Al=/*#__PURE__*/g.createGlobalStyle([":root{","};"],(e=>Tl(e.palette)));const Tl=e=>
|
|
9
|
+
/*#__PURE__*/g.css(["",""],Object.entries(function(e){return{"--privy-color-background":e.background,"--privy-color-background-2":e.background2,"--privy-color-background-3":e.background3,"--privy-color-foreground":e.foreground,"--privy-color-foreground-2":e.foreground2,"--privy-color-foreground-3":e.foreground3,"--privy-color-foreground-4":e.foreground4,"--privy-color-foreground-accent":e.foregroundAccent,"--privy-color-accent":e.accent,"--privy-color-accent-light":e.accentLight,"--privy-color-accent-hover":e.accentHover,"--privy-color-accent-dark":e.accentDark,"--privy-color-accent-darkest":e.accentDarkest,"--privy-color-success":e.success,"--privy-color-success-dark":e.successDark,"--privy-color-success-light":e.successLight,"--privy-color-success-bg":e.successBg,"--privy-color-error":e.error,"--privy-color-error-light":e.errorLight,"--privy-color-error-bg":e.errorBg,"--privy-color-error-bg-hover":e.errorBgHover,"--privy-color-warn":e.warn,"--privy-color-warn-light":e.warnLight,"--privy-color-warn-bg":e.warnBg,"--privy-color-warning-dark":e.warningDark,"--privy-color-error-dark":e.errorDark,"--privy-color-info-bg":e.infoBg,"--privy-color-info-bg-hover":e.infoBgHover,"--privy-color-border-default":e.borderDefault,"--privy-color-border-hover":e.borderHover,"--privy-color-border-focus":e.borderFocus,"--privy-color-border-error":e.borderError,"--privy-color-border-success":e.borderSuccess,"--privy-color-border-warning":e.borderWarning,"--privy-color-border-info":e.borderInfo,"--privy-color-border-interactive":e.borderInteractive,"--privy-color-border-interactive-hover":e.borderInteractiveHover,"--privy-color-background-hover":e.backgroundHover,"--privy-color-background-clicked":e.backgroundClicked,"--privy-color-background-disabled":e.backgroundDisabled,"--privy-color-background-interactive":e.backgroundInteractive,"--privy-color-background-interactive-hover":e.backgroundInteractiveHover,"--privy-color-background-interactive-clicked":e.backgroundInteractiveClicked,"--privy-color-background-interactive-disabled":e.backgroundInteractiveDisabled,"--privy-color-foreground-hover":e.foregroundHover,"--privy-color-foreground-clicked":e.foregroundClicked,"--privy-color-foreground-disabled":e.foregroundDisabled,"--privy-color-foreground-interactive":e.foregroundInteractive,"--privy-color-foreground-interactive-hover":e.foregroundInteractiveHover,"--privy-link-navigation-color":e.linkNavigationColor,"--privy-link-navigation-decoration":e.linkNavigationDecoration,"--privy-accent-has-good-contrast":e.accentHasGoodContrast,"--privy-color-icon-default":e.iconDefault,"--privy-color-icon-muted":e.iconMuted,"--privy-color-icon-subtle":e.iconSubtle,"--privy-color-icon-inverse":e.iconInverse,"--privy-color-icon-success":e.iconSuccess,"--privy-color-icon-warning":e.iconWarning,"--privy-color-icon-error":e.iconError,"--privy-color-icon-interactive":e.iconInteractive,"--privy-color-icon-default-hover":e.iconDefaultHover,"--privy-color-icon-muted-hover":e.iconMutedHover,"--privy-color-icon-subtle-hover":e.iconSubtleHover,"--privy-color-icon-default-clicked":e.iconDefaultClicked,"--privy-color-icon-muted-clicked":e.iconMutedClicked,"--privy-color-icon-subtle-clicked":e.iconSubtleClicked,"--privy-color-icon-default-disabled":e.iconDefaultDisabled,"--privy-color-icon-muted-disabled":e.iconMutedDisabled,"--privy-color-icon-subtle-disabled":e.iconSubtleDisabled,"--privy-color-icon-error-hover":e.iconErrorHover,"--privy-color-icon-interactive-hover":e.iconInteractiveHover,"--privy-color-icon-error-clicked":e.iconErrorClicked,"--privy-color-icon-interactive-clicked":e.iconInteractiveClicked,"--privy-color-icon-muted-disabled-alt":e.iconMutedDisabledAlt,"--privy-color-icon-subtle-disabled-alt":e.iconSubtleDisabledAlt,"--privy-border-radius-xs":"6px","--privy-border-radius-sm":"8px","--privy-border-radius-md":"12px","--privy-border-radius-mdlg":"16px","--privy-border-radius-lg":"24px","--privy-border-radius-full":"9999px","--privy-height-modal-full":"620px","--privy-height-modal-compact":"480px"}}(e)).map((([e,t])=>`${e}: ${t};`)).join("\n")),jl=/*#__PURE__*/g.styled.div.withConfig({displayName:"StylesWrapper",componentId:"sc-188229e4-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 3px var(--privy-color-border-focus);}.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"),Il=({children:t,open:r,onClick:n,...i})=>/*#__PURE__*/e.jsx(S.Transition,{show:r,as:xe.default.Fragment,children:/*#__PURE__*/e.jsxs(S.Dialog,{onClose:n,...i,as:Pl,children:[/*#__PURE__*/e.jsx(S.TransitionChild,{as:xe.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:/*#__PURE__*/e.jsx(Sl,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),/*#__PURE__*/e.jsx(_l,{children:/*#__PURE__*/e.jsx(S.TransitionChild,{as:xe.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:/*#__PURE__*/e.jsx(S.DialogPanel,{as:Nl,children:t})})})]})});let Sl=/*#__PURE__*/g.styled.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;}"]),Pl=/*#__PURE__*/g.styled.div.withConfig({displayName:"DialogWrapper",componentId:"sc-3cfde0b5-1"})(["position:relative;z-index:999999;"]),_l=/*#__PURE__*/g.styled.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 Nl=/*#__PURE__*/g.styled.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);}"]),Ml=/*#__PURE__*/g.styled.div.withConfig({displayName:"CenterItem",componentId:"sc-3cfde0b5-4"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;"]);let Wl=()=>{let{ready:t,isModalOpen:n}=u.usePrivyContext(),{headless:i}=Ni(),{currentScreen:a}=Ui(),{status:o,execute:s,reset:l,enabled:c}=sn(),d=El((e=>e.inProgressMfaFlow)),p=()=>El.setState({inProgressMfaFlow:void 0}),h=n&&a&&a.isCaptchaRequired&&!i&&"ready"===o;return r.useEffect((()=>{h&&s()}),[h]),r.useEffect((()=>{!n&&c&&l()}),[n,c]),a&&!t&&a.isShownBeforeReady?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsx(Ml,{children:/*#__PURE__*/e.jsx(co,{})}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Pa,{})]}):a||"txn"!==d?a?
|
|
10
|
+
/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(ba,{$if:!!d,children:/*#__PURE__*/e.jsx(a.component,{})}),"txn"===d&&/*#__PURE__*/e.jsx(kl,{onClose:p}),"auth"===d&&/*#__PURE__*/e.jsx(Cl.component,{})]}):null:/*#__PURE__*/e.jsx(kl,{onClose:p})},Fl=()=>{let t=r.useRef(null);/*#__PURE__*/return e.jsx(Ol,{style:{height:oa(t)},id:"privy-modal-content",children:/*#__PURE__*/e.jsx("div",{ref:t,children:/*#__PURE__*/e.jsx(Wl,{})})})};const Ul=({open:t})=>{let n=Ni(),{gracefulClosePrivyModal:i}=(()=>{let{closePrivyModal:e}=s.usePrivyInternal(),{onUserCloseViaDialogOrKeybindRef:t}=Ui();return{gracefulClosePrivyModal:r.useCallback((()=>{if(!t?.current)return e({shouldCallAuthOnSuccess:!1});t.current()}),[e])}})(),a=El((e=>e.inProgressMfaFlow));return ha({onMfaRequired:()=>{n.mfa.noPromptOnMfaRequired||El.setState({inProgressMfaFlow:"txn"})}}),n.render.standalone?/*#__PURE__*/e.jsx(jl,{children:/*#__PURE__*/e.jsx(Rl,{id:"privy-modal-content",children:/*#__PURE__*/e.jsx(Wl,{})})}):/*#__PURE__*/e.jsx(Il,{open:!(!t&&!a),id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>i(),children:/*#__PURE__*/e.jsx(jl,{children:/*#__PURE__*/e.jsx(Fl,{})})})};let Rl=/*#__PURE__*/g.styled.div.withConfig({displayName:"ContentWrapper",componentId:"sc-b220e1ee-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;"]),Ol=/*#__PURE__*/g.styled(Rl).withConfig({displayName:"BaseModal",componentId:"sc-b220e1ee-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 Ll(t){let n=r.useRef(null),i=r.useRef();return r.useEffect((()=>{i.current?.remove(),i.current=function({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:n}=new URL(t);return r.async=!0,r.src=`${n}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}(t),n.current?.after(i.current)}),[t]),/*#__PURE__*/e.jsx("div",{ref:n,hidden:!0})}const Dl=({address:t,showCopyIcon:n,url:i,className:a})=>{let[o,s]=r.useState(!1);function l(e){e.stopPropagation(),navigator.clipboard.writeText(t).then((()=>s(!0))).catch(console.error)}return r.useEffect((()=>{if(o){let e=setTimeout((()=>s(!1)),3e3);return()=>clearTimeout(e)}}),[o]),i?/*#__PURE__*/e.jsxs(Bl,{children:[/*#__PURE__*/e.jsx(Hl,{title:t,className:a,href:`${i}/address/${t}`,target:"_blank",children:Vr(t)}),n&&/*#__PURE__*/e.jsx(xo,{onClick:l,size:"sm",style:{gap:"0.375rem"},children:o?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(P.Check,{size:16})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(P.Copy,{size:16})]})})]}):/*#__PURE__*/e.jsxs(Bl,{children:[/*#__PURE__*/e.jsx(zl,{title:t,className:a,children:Vr(t)}),n&&/*#__PURE__*/e.jsx(xo,{onClick:l,size:"sm",style:{gap:"0.375rem",fontSize:"14px"},children:o?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(P.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(P.Copy,{size:14})]})})]})};let Bl=/*#__PURE__*/g.styled.span.withConfig({displayName:"AddressContainer",componentId:"sc-3a987cc8-0"})(["display:inline-flex;align-items:center;gap:0.5rem;"]),zl=/*#__PURE__*/g.styled.span.withConfig({displayName:"AddressText",componentId:"sc-3a987cc8-1"})(["font-size:14px;font-weight:500;color:var(--privy-color-foreground);"]),Hl=/*#__PURE__*/g.styled.a.withConfig({displayName:"AddressLink",componentId:"sc-3a987cc8-2"})(["font-size:14px;color:var(--privy-color-foreground);text-decoration:none;&:hover{text-decoration:underline;}"]);const $l=()=>{let{solanaWallets:e}=s.usePrivyInternal(),{ready:t,wallets:n}=Ys();return r.useEffect((()=>{if(t){let t=[...n,...e].map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt,id:e.meta.id})));kt.put(er,t)}}),[t,n,e]),null};async function ql(e,t,r,n,i,a=!1){let o=a,s=async s=>{if(o&&t&&t.length>0){s===(a?0:1)?i("configureMfa","onMfaRequired",{mfaMethods:t}):n.current?.reject(new pl("missing_or_invalid_mfa","MFA verification failed, retry."));let o=await new Promise(((e,t)=>{r.current={resolve:e,reject:t},setTimeout((()=>{let e=new pl("mfa_timeout","Timed out waiting for MFA code");n.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),n.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw n.current?.resolve(void 0),e;o=!0}if(null===l){let e=new pl("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw n.current?.reject(e),e}return l}var Vl;let Kl=(Vl=0,()=>"id-"+Vl++);function Gl(e){return void 0!==e.error}let Yl=new class{enqueue(e,t){this.callbacks[e]=t}dequeue(e,t){let r=this.callbacks[t];if(!r)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 r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}},Zl=new Map,Ql=(e,t)=>"bigint"==typeof t?t.toString():t;function Xl(e,t,r,n){let i=r.contentWindow;if(!i)throw Error("iframe not initialized");let a=((e,t)=>`${e}${JSON.stringify(t,Ql)}`)(e,t);if("privy:wallet:create"===e){let e=Zl.get(a);if(e)return e}let o=new Promise(((r,a)=>{let o=Kl();Yl.enqueue(o,{resolve:r,reject:a}),i.postMessage({id:o,event:e,data:t},n)})).finally((()=>{Zl.delete(a)}));return Zl.set(a,o),o}function Jl(t){let n=Mi(),i=r.useRef(null),a=r.useRef(t.mfaMethods),o=pa(),[s,l]=r.useState(!1);return r.useEffect((()=>{a.current=t.mfaMethods}),[t.mfaMethods]),r.useEffect((()=>{if(!s)return;let e=i.current;if(!e)return;function r(e){var r;e&&e.origin===t.origin&&"string"==typeof(r=e.data).event&&/^privy:.+/.test(r.event)&&function(e){switch(e.event){case"privy:iframe:ready":let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data);case"privy:user-signer:sign":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:add":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:set-recovery":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:connect":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:recover":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:rpc":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallet:create":let r=Yl.dequeue(e.event,e.id);return Gl(e)?r.reject(new pl(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallets:import":let n=Yl.dequeue(e.event,e.id);return Gl(e)?n.reject(new pl(e.error.type,e.error.message)):n.resolve(e.data);case"privy:mfa:verify":let i=Yl.dequeue(e.event,e.id);return Gl(e)?i.reject(new pl(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:init-enrollment":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:submit-enrollment":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:unenroll":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:clear":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:auth:unlink-passkey":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:solana-wallet:create":let a=Yl.dequeue(e.event,e.id);return Gl(e)?a.reject(new pl(e.error.type,e.error.message)):a.resolve(e.data);case"privy:farcaster:init-signer":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:sign":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:delegated-actions:consent":{let t=Yl.dequeue(e.event,e.id);return Gl(e)?t.reject(new pl(e.error.type,e.error.message)):t.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}(e.data)}let n={signWithUserSigner:r=>ql((n=>Xl("privy:user-signer:sign",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),addWallet:r=>ql((n=>Xl("privy:wallets:add",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),setRecovery:r=>ql((n=>Xl("privy:wallets:set-recovery",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),connect:r=>ql((n=>Xl("privy:wallets:connect",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),recover:r=>ql((n=>Xl("privy:wallets:recover",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o,!r.recoveryAccessToken&&!r.recoveryPassword&&!r.recoverySecretOverride),rpc:r=>ql((n=>Xl("privy:wallets:rpc",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),create:r=>Xl("privy:wallet:create",r,e,t.origin),importWallet:r=>Xl("privy:wallets:import",r,e,t.origin),createSolana:r=>ql((n=>Xl("privy:solana-wallet:create",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),createDelegatedAction:r=>Xl("privy:delegated-actions:consent",r,e,t.origin),verifyMfa:r=>ql((n=>Xl("privy:mfa:verify",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o,!0),initEnrollMfa:r=>ql((n=>Xl("privy:mfa:init-enrollment",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),submitEnrollMfa:r=>ql((n=>Xl("privy:mfa:submit-enrollment",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),unenrollMfa:r=>ql((n=>Xl("privy:mfa:unenroll",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),clearMfa:r=>Xl("privy:mfa:clear",r,e,t.origin),unlinkPasskeyAccount:r=>ql((n=>Xl("privy:auth:unlink-passkey",{...r,...n},e,t.origin)),a.current,t.mfaPromise,t.mfaSubmitPromise,o),initFarcasterSigner:r=>Xl("privy:farcaster:init-signer",r,e,t.origin),signFarcasterMessage:r=>Xl("privy:farcaster:sign",r,e,t.origin)};window.addEventListener("message",r);let l=new AbortController;return Yr((()=>Xl("privy:iframe:ready",{},e,t.origin)),{abortSignal:l.signal}).then((()=>t.onLoad(n)),((...e)=>{console.warn("Privy iframe failed to load: ",...e),t.onLoadFailed()})),()=>{window.removeEventListener("message",r),l.abort()}}),[s]),n?
|
|
11
|
+
/*#__PURE__*/e.jsx("iframe",{ref:i,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>l(!0),src:Zr(t.origin,`/apps/${t.appId}/embedded-wallets`,{caid:t.clientAnalyticsId,client_id:t.appClientId})}):null}function ec(e){return["ethereum","solana"].includes(e.chainType)}const tc=({address:e,user:t})=>{let r=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!r)throw new o.PrivyClientError("Address to delegate is not associated with current user.");if(!ec(r))throw new o.PrivyClientError(`useDelegatedActions is not supported for ${r.chainType} wallets. Use the useSessionSigners hook to provision server side access on behalf of your users.`);return{address:r.address,chainType:r.chainType,walletIndex:r.walletIndex??0}},rc=({address:e,user:t})=>{let r=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!r)throw new o.PrivyClientError("Address to delegate is not associated with current user.");let n=r.imported?r:u.getPrivyPrimaryWallet(t);if(!n)throw new o.PrivyClientError("Unable to determine root address for delegated address.");if(!ec(n))throw new o.PrivyClientError(`useDelegatedActions is not supported for ${n.chainType} wallets. Use the useSessionSigners hook to provision server side access on behalf of your users.`);return{address:n.address,chainType:n.chainType,imported:n.imported}},nc=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.delegated));const ic=()=>{let e=Ni();r.useEffect((()=>{(async e=>{let t=new URL("v3/wallets","https://explorer-api.walletconnect.com");t.searchParams.append("projectId",e);let r=await fetch(t);return r.ok?Object.values((await r.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 r.text().catch((()=>"No response."))}`),[])})(e.walletConnectCloudProjectId).then((e=>ci({listings:e}))).catch(console.error)}),[e.walletConnectCloudProjectId])};function ac(e){let t=e.replace("eip155:","");if(t)return parseInt(t);throw Error("Chain ID not compatible with CAIP-2 format.")}const oc="popup-privy-oauth",sc="PRIVY_OAUTH_USE_BROADCAST_CHANNEL";class lc{async authenticate(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(o.oAuthAuthenticatePath,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw o.formatApiError(e)}}async link(){if(!this.api)throw new o.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(o.oAuthLinkPath,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw o.formatApiError(e)}}constructor({authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}){this.meta={authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}}}async function cc({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find((e=>e.provider_app_id===r));if(!n)throw new o.PrivyClientError("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}const dc=()=>window.open(void 0,void 0,uc({w:440,h:680}));let uc=({w:e,h:t})=>{let r=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,i=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(i-e)/2/(i/window.screen.availWidth)+r},top=${(a-t)/2/(a/window.screen.availHeight)+n}`};const pc=async({user:e,address:t,client:r,request:n,requesterAppId:i,reconnect:a})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:n.method}});let s=e?.linkedAccounts.find((e=>"cross_app"===e.type&&(e.embeddedWallets.some((e=>e.address===t))||e.smartWallets.some((e=>e.address===t)))));if(!e||!s)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new o.PrivyClientError("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(s.providerApp.id),c=await cc({api:r.api,requesterAppId:i,providerAppId:s.providerApp.id});if(!l){if(c.readOnly)throw console.error("cannot transact against a read-only provider app"),new o.PrivyClientError("Cannot transact against a read-only provider app");await a({appId:s.providerApp.id,action:"link"})&&(l=r.getProviderAccessToken(s.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new o.PrivyClientError("Transactions require a valid token");let d=dc();if(!d)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new o.PrivyClientError("Failed to initialize signature request");let u=new URL(`${c.apiUrl}/oauth/transact`);return u.searchParams.set("token",l||""),u.searchParams.set("request",hc(n)),d.location=u.href,new Promise(((e,i)=>{let a=setTimeout((()=>{u(),i(new o.PrivyClientError("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})}),12e4),l=setInterval((()=>{d.closed&&(u(),i(new o.PrivyClientError("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))}),300),c=a=>{a.data&&("set"===a.data.token?.action&&void 0!==a.data.token?.value?r.storeProviderAccessToken(s.providerApp.id,a.data.token.value):"clear"===a.data.token?.action&&r.storeProviderAccessToken(s.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===a.data.type&&a.data.result&&(u(),e(a.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:n.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===a.data.type&&a.data.error&&(u(),i(a.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:a.data.error,address:t}})))};window.addEventListener("message",c);let u=()=>{d.close(),clearInterval(l),clearTimeout(a),window.removeEventListener("message",c)}}))};let hc=e=>JSON.stringify({content:{request:{request:yc(e,l.toHex)}},timestamp:Date.now(),callbackUrl:window.origin});const yc=(e,t)=>"bigint"==typeof e?t(e):Array.isArray(e)?e.map((e=>yc(e,t))):e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,r])=>[e,yc(r,t)]))):e,mc=({title:t,description:r,children:n,...i})=>
|
|
12
|
+
/*#__PURE__*/e.jsx(fc,{...i,children:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("h3",{children:t}),"string"==typeof r?/*#__PURE__*/e.jsx("p",{children:r}):r,n]})}),gc=({title:t,description:r,icon:n,children:i,...a})=>/*#__PURE__*/e.jsxs(wc,{...a,children:[n||null,/*#__PURE__*/e.jsx("h3",{children:t}),r&&"string"==typeof r?/*#__PURE__*/e.jsx("p",{children:r}):r,i]});let fc=/*#__PURE__*/g.styled.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;}"]),wc=/*#__PURE__*/g.styled(fc).withConfig({displayName:"CenteredStyledSection",componentId:"sc-523a75d6-2"})(["align-items:center;text-align:center;gap:16px;h3{margin-bottom:24px;}"]);const vc=t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...t,children:[/*#__PURE__*/e.jsx("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__*/e.jsx("defs",{children:/*#__PURE__*/e.jsxs("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[/*#__PURE__*/e.jsx("stop",{stopColor:"#3E82F4"}),/*#__PURE__*/e.jsx("stop",{offset:1,stopColor:"#93DCF7"})]})})]}),xc=({style:t,...r})=>/*#__PURE__*/e.jsxs("svg",{width:"16",height:"14",style:t,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[/*#__PURE__*/e.jsxs("g",{clipPath:"url(#clip0_2115_829)",children:[/*#__PURE__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2115_829",children:/*#__PURE__*/e.jsx("rect",{width:"16",height:"14",fill:"white"})})})]});async function Cc({url:e,popup:t,provider:r}){return t.location=e,new Promise(((e,r)=>{function n(){t?.close(),window.removeEventListener("message",i)}function i(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),n()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),n()),"PRIVY_OAUTH_ERROR"===t.data.type&&(r(t.data.error),n()))}window.addEventListener("message",i)}))}async function bc({api:e,provider:t,stateCode:r,codeVerifier:n,authorizationCode:i}){if(!i||!r)throw new o.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===i)throw new o.PrivyClientError("User denied confirmation during OAuth flow");try{return(await e.post(o.recoveryOAuthAuthenticatePath,{authorization_code:i,state_code:r,code_verifier:n,provider:t})).access_token}catch(e){let t=o.formatApiError(e);if(t.privyErrorCode)throw new o.PrivyClientError(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new o.PrivyClientError("Invalid code during oauth flow.",void 0,o.PrivyErrorCode.OAUTH_USER_DENIED);throw new o.PrivyClientError("Invalid code during OAuth flow.",void 0,o.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}async function kc({api:e,provider:t}){let r=pr(),n=hr(),i=await yr(r);try{return"icloud"===t?{url:(await e.post(o.recoveryOAuthInitICloudPath,{client_type:"web"})).url}:{url:(await e.post(o.recoveryOAuthInitPath,{redirect_to:window.location.href,code_challenge:i,state_code:n})).url,codeVerifier:r,stateCode:n,provider:t}}catch(e){throw o.formatApiError(e)}}const Ec=(e,{chainType:t,walletIndex:r}={})=>e?.linkedAccounts.filter((e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==r&&e.walletIndex!==r||void 0!==t&&e.chainType!==t)))??[],Ac=async({user:e,accessToken:t,proxy:r,refreshSessionAndUser:n,privy:i,appConfig:o,recoverEmbeddedWallet:s,setUser:l,walletIndex:c,chainType:d,recoveryMethod:p,recoveryPassword:h,recoveryAccessToken:y})=>{if(0===c)if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await a.create(i,{request:{chain_type:d}});else if("ethereum"===d){let n=u.getPrivySolanaWallet(e);n&&await s({address:n.address}),await r.create({accessToken:t,solanaAddress:n?.address,recoveryMethod:p,recoveryPassword:h,recoveryAccessToken:y})}else{if("solana"!==d)throw Error("Invalid input to create wallet");{let n=u.getPrivyEthereumWallet(e);n&&await s({address:n.address}),await r.createSolana({accessToken:t,ethereumAddress:n?.address,recoveryMethod:p,recoveryPassword:h,recoveryAccessToken:y})}}else if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await a.create(i,{request:{chain_type:d}});else{let{entropyId:n,entropyIdVerifier:i}=mn(e);await s(),await r.addWallet({accessToken:t,entropyId:n,entropyIdVerifier:i,chainType:d,hdWalletIndex:c})}let m=await n(),g=Ec(m,{chainType:d,walletIndex:c})[0];return l(m),{user:m,account:g}},Tc=()=>{let{walletProxy:e,recoverEmbeddedWallet:t,setUser:r,refreshSessionAndUser:n,privy:i,client:a}=s.usePrivyInternal(),o=Ni();return{create:async({walletIndex:s,chainType:l,latestUser:c,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})=>{let h=c;h||(h=await n());let y=await a.getAccessToken();if(!h||!y||!e)throw Error("User must be authenticated before creating a Privy wallet");return await Ac({appConfig:o,user:h,refreshSessionAndUser:n,privy:i,accessToken:y,proxy:e,recoverEmbeddedWallet:t,setUser:r,walletIndex:s,chainType:l,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})}}},jc=({size:t})=>/*#__PURE__*/e.jsx(Ic,{$size:t,children:/*#__PURE__*/e.jsxs(Sc,{children:[/*#__PURE__*/e.jsx(Pc,{}),/*#__PURE__*/e.jsx(_c,{})]})});let Ic=/*#__PURE__*/g.styled.div.withConfig({displayName:"LoadingContainer",componentId:"sc-5be8451e-0"})(["--spinner-size:",";display:inline-flex;justify-content:center;align-items:center;@media all and (display-mode:standalone){margin-bottom:30px;}"],(e=>e.$size?e.$size:"96px")),Sc=/*#__PURE__*/g.styled.div.withConfig({displayName:"SpinnerContainer",componentId:"sc-5be8451e-1"})(["position:relative;height:var(--spinner-size);width:var(--spinner-size);opacity:1;animation:fadein 200ms ease;"]),Pc=/*#__PURE__*/g.styled.div.withConfig({displayName:"CircleFixed",componentId:"sc-5be8451e-2"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);&&{border:4px solid var(--privy-color-border-default);border-radius:50%;}"]),_c=/*#__PURE__*/g.styled.div.withConfig({displayName:"CircleRotate",componentId:"sc-5be8451e-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:var(--privy-color-icon-subtle) transparent transparent transparent;border-radius:50%;}@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}"]);const Nc=/*#__PURE__*/g.styled.div.withConfig({displayName:"ScreenRoot",componentId:"sc-cc9e9a32-0"})(["--screen-space:16px;--screen-space-lg:calc(var(--screen-space) * 1.5);position:relative;overflow:hidden;margin:0 calc(-1 * var(--screen-space));height:100%;border-radius:var(--privy-border-radius-lg);"]),Mc=/*#__PURE__*/g.styled.div.withConfig({displayName:"ScreenRootInner",componentId:"sc-cc9e9a32-1"})(["display:flex;flex-direction:column;gap:calc(var(--screen-space) * 1.5);width:100%;background:var(--privy-color-background);padding:0 var(--screen-space-lg) var(--screen-space);height:100%;border-radius:var(--privy-border-radius-lg);"]),Wc=/*#__PURE__*/g.styled.div.withConfig({displayName:"HeaderContainer",componentId:"sc-cc9e9a32-2"})(["position:relative;display:flex;flex-direction:column;"]),Fc=/*#__PURE__*/g.styled(Wa).withConfig({displayName:"StyledModalHeader",componentId:"sc-cc9e9a32-3"})(["margin:0 -8px;"]),Uc=/*#__PURE__*/g.styled.div.withConfig({displayName:"BodyContainer",componentId:"sc-cc9e9a32-4"})(["flex:1 1 auto;display:flex;flex-direction:column;overflow-y:auto;padding:3px;margin:-3px;&::-webkit-scrollbar{display:none;}scrollbar-gutter:stable both-edges;scrollbar-width:none;-ms-overflow-style:none;"," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;"],(({$colorScheme:e})=>"light"===e?"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?"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)),Rc=/*#__PURE__*/g.styled.div.withConfig({displayName:"FooterContainer",componentId:"sc-cc9e9a32-5"})(["display:flex;flex-direction:column;gap:var(--screen-space-lg);"]);let Oc=/*#__PURE__*/g.styled.div.withConfig({displayName:"CenteredHeader",componentId:"sc-cc9e9a32-6"})(["text-align:center;display:flex;flex-direction:column;align-items:center;gap:var(--screen-space);"]),Lc=/*#__PURE__*/g.styled.div.withConfig({displayName:"TitleContainer",componentId:"sc-cc9e9a32-7"})(["display:flex;flex-direction:column;gap:4px;"]),Dc=/*#__PURE__*/g.styled.h3.withConfig({displayName:"HeaderTitle",componentId:"sc-cc9e9a32-8"})(["&&{font-size:20px;line-height:32px;font-weight:500;color:var(--privy-color-foreground);margin:0;}"]),Bc=/*#__PURE__*/g.styled.p.withConfig({displayName:"HeaderSubtitle",componentId:"sc-cc9e9a32-9"})(["&&{margin:0;font-size:16px;font-weight:300;line-height:24px;color:var(--privy-color-foreground);}"]),zc=/*#__PURE__*/g.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-cc9e9a32-10"})(["background:",";border-radius:50%;width:64px;height:64px;display:flex;align-items:center;justify-content:center;"],(({$variant:e})=>{switch(e){case"success":return"var(--privy-color-success-bg, #EAFCEF)";case"warning":return"var(--privy-color-warn, #FEF3C7)";case"error":return"var(--privy-color-error-bg, #FEE2E2)";case"loading":case"logo":return"transparent";default:return"var(--privy-color-background-2)"}})),Hc=/*#__PURE__*/g.styled.div.withConfig({displayName:"LogoContainer",componentId:"sc-cc9e9a32-11"})(["display:flex;align-items:center;justify-content:center;margin-bottom:var(--screen-space);img,svg{max-height:90px;max-width:180px;}"]),$c=/*#__PURE__*/g.styled.div.withConfig({displayName:"LoadingWithIconContainer",componentId:"sc-cc9e9a32-12"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > :first-child{position:relative;}> div > :last-child{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);}"]);const qc=({children:t,...r})=>/*#__PURE__*/e.jsx(Nc,{children:/*#__PURE__*/e.jsx(Mc,{...r,children:t})});let Vc=/*#__PURE__*/g.styled.div.withConfig({displayName:"ProgressBarContainer",componentId:"sc-cc9e9a32-13"})(["position:absolute;top:0;left:calc(-1 * var(--screen-space-lg));width:calc(100% + calc(var(--screen-space-lg) * 2));height:4px;background:var(--privy-color-background-2);border-top-left-radius:inherit;border-top-right-radius:inherit;overflow:hidden;"]),Kc=/*#__PURE__*/g.styled(Ia).withConfig({displayName:"StyledBlobbyFooter",componentId:"sc-cc9e9a32-14"})(["padding:0;&& a{padding:0;color:var(--privy-color-foreground-3);}"]),Gc=/*#__PURE__*/g.styled.div.withConfig({displayName:"ProgressBarFill",componentId:"sc-cc9e9a32-15"})(["height:100%;width:","%;background:var(--privy-color-foreground-3);border-radius:2px;transition:width 300ms ease-in-out;"],(({pct:e})=>e)),Yc=({step:t})=>t?/*#__PURE__*/e.jsx(Vc,{children:/*#__PURE__*/e.jsx(Gc,{pct:Math.min(100,t.current/t.total*100)})}):null;qc.Header=({title:t,subtitle:r,icon:n,iconVariant:i,iconLoadingStatus:a,showBack:o,onBack:s,showInfo:l,onInfo:c,showClose:d,onClose:u,step:p,...h})=>/*#__PURE__*/e.jsxs(Wc,{...h,children:[/*#__PURE__*/e.jsx(Fc,{backFn:o?s:void 0,infoFn:l?c:void 0,onClose:d?u:void 0,closeable:d}),(n||i||t||r)&&/*#__PURE__*/e.jsxs(Oc,{children:[n||i?/*#__PURE__*/e.jsx(qc.Icon,{icon:n,variant:i,loadingStatus:a}):null,/*#__PURE__*/e.jsxs(Lc,{children:[t&&/*#__PURE__*/e.jsx(Dc,{children:t}),r&&/*#__PURE__*/e.jsx(Bc,{children:r})]})]}),p&&/*#__PURE__*/e.jsx(Yc,{step:p})]}),qc.Body=/*#__PURE__*/xe.default.forwardRef((({children:t,...r},n)=>/*#__PURE__*/e.jsx(Uc,{ref:n,...r,children:t}))),qc.Body.displayName="Screen.Body",qc.Footer=({children:t,...r})=>/*#__PURE__*/e.jsx(Rc,{...r,children:t}),qc.Actions=({children:t,...r})=>/*#__PURE__*/e.jsx(Zc,{...r,children:t}),qc.HelpText=({children:t,...r})=>/*#__PURE__*/e.jsx(Qc,{...r,children:t}),qc.Watermark=()=>/*#__PURE__*/e.jsx(Kc,{}),qc.Icon=({icon:t,variant:r="subtle",loadingStatus:n})=>"logo"===r&&t?"string"==typeof t?/*#__PURE__*/e.jsx(Hc,{children:/*#__PURE__*/e.jsx("img",{src:t,alt:""})}):/*#__PURE__*/xe.default.isValidElement(t)?/*#__PURE__*/e.jsx(Hc,{children:t}):
|
|
13
|
+
/*#__PURE__*/e.jsx(Hc,{children:/*#__PURE__*/xe.default.createElement(t)}):"loading"===r?t?
|
|
14
|
+
/*#__PURE__*/e.jsx($c,{children:/*#__PURE__*/e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[/*#__PURE__*/e.jsx(oo,{success:n?.success,fail:n?.fail}),"string"==typeof t?
|
|
15
|
+
/*#__PURE__*/e.jsx("span",{style:{background:`url('${t}') 0 0 / contain`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"contain"}}):/*#__PURE__*/xe.default.isValidElement(t)?
|
|
16
|
+
/*#__PURE__*/xe.default.cloneElement(t,{style:{width:"38px",height:"38px"}}):
|
|
17
|
+
/*#__PURE__*/xe.default.createElement(t,{style:{width:"38px",height:"38px"}})]})}):
|
|
18
|
+
/*#__PURE__*/e.jsx(zc,{$variant:r,children:/*#__PURE__*/e.jsx(jc,{size:"64px"})}):/*#__PURE__*/e.jsx(zc,{$variant:r,children:t&&("string"==typeof t?
|
|
19
|
+
/*#__PURE__*/e.jsx("img",{src:t,alt:"",style:{width:"32px",height:"32px",borderRadius:"6px"}}):/*#__PURE__*/xe.default.isValidElement(t)?t:
|
|
20
|
+
/*#__PURE__*/xe.default.createElement(t,{width:32,height:32,stroke:(()=>{switch(r){case"success":return"var(--privy-color-icon-success)";case"warning":return"var(--privy-color-icon-warning)";case"error":return"var(--privy-color-icon-error)";default:return"var(--privy-color-icon-muted)"}})(),strokeWidth:2}))});let Zc=/*#__PURE__*/g.styled.div.withConfig({displayName:"ActionsContainer",componentId:"sc-cc9e9a32-16"})(["width:100%;display:flex;flex-direction:column;gap:calc(var(--screen-space) / 2);"]),Qc=/*#__PURE__*/g.styled.p.withConfig({displayName:"HelpTextContainer",componentId:"sc-cc9e9a32-17"})(["&&{margin:0;width:100%;text-align:center;color:var(--privy-color-foreground-3);font-size:14px;line-height:22px;& a{color:var(--privy-color-accent);}}"]);const Xc=({primaryCta:t,secondaryCta:r,helpText:n,watermark:i=!0,children:a,...o})=>{let s=t||r?/*#__PURE__*/e.jsxs(e.Fragment,{children:[t&&(()=>{let{label:r,...n}=t,i=n.variant||"primary";/*#__PURE__*/return e.jsx(yo,{...n,variant:i,style:{width:"100%",...n.style},children:r})})(),r&&(()=>{let{label:t,...n}=r,i=n.variant||"secondary";/*#__PURE__*/return e.jsx(yo,{...n,variant:i,style:{width:"100%",...n.style},children:t})})()]}):null;/*#__PURE__*/return e.jsxs(qc,{id:o.id,className:o.className,children:[/*#__PURE__*/e.jsx(qc.Header,{...o}),a?/*#__PURE__*/e.jsx(qc.Body,{children:a}):null,n||s||i?/*#__PURE__*/e.jsxs(qc.Footer,{children:[n?/*#__PURE__*/e.jsx(qc.HelpText,{children:n}):null,s?/*#__PURE__*/e.jsx(qc.Actions,{children:s}):null,i?/*#__PURE__*/e.jsx(qc.Watermark,{}):null]}):null]})},Jc=({title:t,description:r,onClose:n})=>/*#__PURE__*/e.jsx(Xc,{title:t,subtitle:r,icon:P.CheckCircle,iconVariant:"success",watermark:!0,onBack:n}),ed={component:()=>{let{user:t}=u.usePrivyContext(),{closePrivyModal:n,isNewUserThisSession:i,updateWallets:a}=s.usePrivyInternal(),{app:o,data:l,onUserCloseViaDialogOrKeybindRef:c}=Ui(),{onSuccess:d,onFailure:p,callAuthOnSuccessOnClose:h}=l.createWallet,y=()=>{let e=u.getPrivyEthereumWallet(t)??u.getPrivySolanaWallet(t);t&&e?(a(),d({user:t,account:e})):p(Error("Failed to create wallet")),n({shouldCallAuthOnSuccess:h})};r.useEffect((()=>{let e=setTimeout(y,Ft);return()=>clearTimeout(e)}),[]),c.current=y;let m=i?"Welcome"+(o?.name?` to ${o?.name}`:""):"All set!";/*#__PURE__*/return e.jsx(Jc,{title:m,description:i?"You've successfully created an account.":"Your account is secured.",onClose:y})}},td=/*#__PURE__*/g.styled.div.withConfig({displayName:"RecoveryContainer",componentId:"sc-12b46968-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),rd=/*#__PURE__*/g.styled.div.withConfig({displayName:"RecoveryExplainerContainer",componentId:"sc-12b46968-1"})(["padding-bottom:24px;"]);let nd={"google-drive":{name:"Google Drive",component:xc},icloud:{name:"iCloud",component:vc}};const id={component:()=>{let{logout:t}=u.usePrivyContext(),{navigate:n,setModalData:i,data:a}=Ui(),{closePrivyModal:l,createAnalyticsEvent:c}=s.usePrivyInternal(),{execute:d}=(()=>{let{client:e,walletProxy:t,refreshSessionAndUser:r}=s.usePrivyInternal(),{data:n}=Ui(),{user:i}=u.usePrivyContext(),a=pa(),{create:l}=Tc();return{execute:async({provider:s,action:c,popup:d,shouldCreateEth:p,shouldCreateSol:h})=>{let y,m;if(!e)throw new o.PrivyClientError("Missing client");function g(t){if(!t&&e)throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:s}}),new o.PrivyClientError("Recovery OAuth failed")}switch(s){case"google-drive":{let t,r,{url:n,codeVerifier:i,stateCode:a}=await kc({api:e.api,provider:s});g(n);try{let i=await Cc({url:n,popup:d,provider:s});if(t=i.stateCode,r=i.authorizationCode,t!==a)throw e.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:s,storedStateCode:a??"",returnedStateCode:t??""}}),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED)}catch(t){throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:s}}),new o.PrivyClientError("Recovery OAuth failed")}[y,m]=await Promise.all([e.getAccessToken(),bc({api:e.api,provider:s,codeVerifier:i,stateCode:t,authorizationCode:r})]);break}case"icloud":{let{url:t}=await kc({api:e.api,provider:s});g(t);let{ckWebAuthToken:r}=await Cc({url:t,popup:d,provider:s});m=r,y=await e.getAccessToken()}}if(!t)throw new o.PrivyClientError("Cannot connect to wallet proxy");if(!y)throw new o.PrivyClientError("Unable to authorize user");switch(c){case"recover":{let r=n?.recoverWallet?.entropyId,i=n?.recoverWallet?.entropyIdVerifier;if(!r||!i)throw new o.PrivyClientError("Recovery OAuth failed");e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:r,recoveryMethod:s}}),await t.recover({accessToken:y,entropyId:r,entropyIdVerifier:i,recoveryAccessToken:m}),e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:r,recoveryMethod:s}});break}case"create-wallet":{let t;if(e.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),p&&h)t=await l({recoveryMethod:s,recoveryAccessToken:m,chainType:"ethereum",walletIndex:0,latestUser:i}),t=await l({chainType:"solana",walletIndex:0,latestUser:t.user});else if(h)t=await l({recoveryMethod:s,recoveryAccessToken:m,chainType:"solana",walletIndex:0,latestUser:i});else{if(!p)throw Error("Invalid args to create wallet");t=await l({recoveryMethod:s,recoveryAccessToken:m,chainType:"ethereum",walletIndex:0,latestUser:i})}if(!t)throw a("createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:t.account.address}}),a("createWallet","onSuccess",{wallet:t.account});break}case"set-recovery":{let n=u.getPrivyPrimaryWallet(i);if(!n)throw a("setWalletRecovery","onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:n.address,existingRecoveryMethod:n.recoveryMethod,targetRecoveryMethod:s}});let{entropyId:l,entropyIdVerifier:c}=mn(i);await t.setRecovery({accessToken:y,entropyId:l,entropyIdVerifier:c,recoveryMethod:s,recoveryAccessToken:m});let d=u.getPrivyPrimaryWallet(await r());if(!d)throw a("createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:n.address,existingRecoveryMethod:n.recoveryMethod,targetRecoveryMethod:s}}),a("setWalletRecovery","onSuccess",{method:s,wallet:d});break}default:throw new o.PrivyClientError("Unsupported recovery action")}}}})(),[p,h]=r.useState(!1),{provider:y,action:m,isInAccountCreateFlow:g,shouldCreateEth:f,shouldCreateSol:w}=a?.recoveryOAuthStatus,[v,x]=r.useState(void 0),[C,b]=r.useState("create-wallet"===m);if("user-passcode"===y)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let k=nd[y].name,E=nd[y].component,A=a?.recoverWallet?.onCompleteNavigateTo,T=new _t((async(e="create-wallet")=>(b(!0),new Promise(((t,r)=>{setTimeout((async()=>{try{let r=window.open();await d({provider:y,action:e,popup:r,shouldCreateEth:f,shouldCreateSol:w}),h(!0),t()}catch(t){x({message:`${"recover"===e?"Recovery":"Back up"} with ${k} unsuccessful`,detail:"recover"===m?`Please verify that you are selecting the ${k} account associated with your backup.`:"",retryable:!0}),r()}}),0)})))));r.useEffect((()=>{"recover"!==m&&T.execute(g?"create-wallet":"set-recovery")}),[]),r.useEffect((()=>{if(!p)return;let e=setTimeout((()=>{g?(i({createWallet:{onSuccess:()=>{},onFailure:e=>{c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0,shouldCreateEth:!1,shouldCreateSol:!1}}),n(ed)):l({shouldCallAuthOnSuccess:!1})}),Wt);return()=>clearTimeout(e)}),[p]);let j=r.useCallback((async()=>{await T.execute("recover"),A?n(A):h(!0)}),[]),I="google-drive"===y?"Google Drive":"Apple iCloud",S=p&&`Successfully ${"recover"===m?"recovered":"backed up"} with ${I}.`||v&&v.message||`${"recover"===m?"Recovering":"Backing up"} with ${I}...`,P=v?v.detail:"";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{}),C?/*#__PURE__*/e.jsx(e.Fragment,{children:/*#__PURE__*/e.jsxs(td,{children:[/*#__PURE__*/e.jsx(gc,{title:S,icon:/*#__PURE__*/e.jsx(E,{style:{width:"38px",height:"38px"}}),description:P}),v&&v?.retryable?/*#__PURE__*/e.jsx(go,{onClick:()=>{_r(),x(void 0),"create-wallet"===m?T.execute("create-wallet"):j()},disabled:!p&&!v?.retryable,children:"Try again"}):null]})}):/*#__PURE__*/e.jsxs(td,{children:[/*#__PURE__*/e.jsx(gc,{title:"Confirm it's really you",icon:/*#__PURE__*/e.jsx(E,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${I} where your account is backed up.`}),/*#__PURE__*/e.jsxs(go,{onClick:j,children:["Confirm with ",I]})]}),/*#__PURE__*/e.jsx(Ia,{})]})}};let ad=/*#__PURE__*/g.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-ccfae04f-0"})(["width:24px;height:24px;display:flex;justify-content:center;align-items:center;"]),od={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy","privy-v2":"Privy"},sd=({onClose:t})=>/*#__PURE__*/e.jsxs(rd,{children:[/*#__PURE__*/e.jsx(gc,{title:"Why do I need to secure my account?",icon:/*#__PURE__*/e.jsx(_e.default,{width:48}),description:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),/*#__PURE__*/e.jsx("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__*/e.jsx(go,{onClick:t,children:"Select backup method"})]});const ld={component:()=>{let[t,n]=r.useState(!1),{navigate:i,lastScreen:a,navigateBack:o,setModalData:l,data:c,onUserCloseViaDialogOrKeybindRef:d}=Ui(),{user:p}=u.usePrivyContext(),{embeddedWallets:h}=Ni(),{closePrivyModal:y}=s.usePrivyInternal(),m=u.getPrivyPrimaryWallet(p),g=null===m,{isInAccountCreateFlow:f,isResettingPassword:w,shouldCreateEth:v,shouldCreateSol:x}=c.recoverySelection,C=m&&"privy"!==m.recoveryMethod,b=C?/*#__PURE__*/e.jsxs("span",{children:["Your account is currently secured using"," ",/*#__PURE__*/e.jsx("strong",{children:od[m?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function k(e){l({recoveryOAuthStatus:{provider:e,action:g?"create-wallet":"set-recovery",isInAccountCreateFlow:f,shouldCreateEth:v,shouldCreateSol:x}}),i(id)}function E(){c?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),y({shouldCallAuthOnSuccess:c?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return d.current=E,/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:E,backFn:t?()=>n(!1):a?o:void 0,infoFn:a||t?void 0:()=>n(!0)},"header"),t?/*#__PURE__*/e.jsx(sd,{onClose:()=>n(!1)}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gc,{title:C?"Update backup method":"Secure your account",icon:/*#__PURE__*/e.jsx(Ve.default,{width:48}),description:b}),/*#__PURE__*/e.jsx(td,{children:h.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(m?.recoveryMethod||"")||e!==m?.recoveryMethod)).sort().map((t=>{switch(t){case"google-drive":/*#__PURE__*/return e.jsxs(xa,{onClick:()=>k("google-drive"),children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsx(xc,{style:{width:18}})}),"Back up to Google Drive"]},t);case"icloud":/*#__PURE__*/return e.jsxs(xa,{onClick:()=>k("icloud"),children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsx(vc,{style:{width:24}})}),"Back up to Apple iCloud"]},t);case"user-passcode":/*#__PURE__*/return e.jsxs(xa,{onClick:()=>{i(vm({isCreatingWallet:g,skipSplashScreen:!0}))},children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsx(Ke.default,{style:{width:18}})}),w?"Reset your":"Set a"," password"]},t);default:return null}}))})]}),/*#__PURE__*/e.jsx(Ia,{})]})}};let cd=/*#__PURE__*/g.css(["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 dd=/*#__PURE__*/g.styled.span.withConfig({displayName:"StatusText",componentId:"sc-acac4b9-0"})([""," transition:color 0.1s ease-in;color:",";text-transform:",";&[aria-hidden='true']{visibility:hidden;}"],cd,(({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"),(({error:e})=>e?"":"capitalize")),ud=/*#__PURE__*/g.styled.div.withConfig({displayName:"EmbeddedWalletScreenContainer",componentId:"sc-acac4b9-1"})(["display:flex;flex-direction:column;justify-content:center;flex-grow:1;"]),pd=/*#__PURE__*/g.styled(go).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-acac4b9-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/g.css(["&&{transition:none;}"])));let hd=/*#__PURE__*/g.css(["&&{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 yd=/*#__PURE__*/g.styled.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;"],hd),md=/*#__PURE__*/g.styled.div.withConfig({displayName:"PasswordDisplay",componentId:"sc-acac4b9-4"})(["",""],hd),gd=/*#__PURE__*/g.styled.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")),fd=/*#__PURE__*/g.styled.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;}"]),wd=/*#__PURE__*/g.styled.div.withConfig({displayName:"Details",componentId:"sc-acac4b9-7"})(["display:flex;flex-direction:column;gap:10px;padding-bottom:1rem;"]),vd=/*#__PURE__*/g.styled.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;}"]),xd=/*#__PURE__*/g.styled(yo).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;}"]),Cd=/*#__PURE__*/g.styled.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;"]),bd=/*#__PURE__*/g.styled(Ge.default).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);}"]),kd=/*#__PURE__*/g.styled(Ze.default).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);}"]),Ed=/*#__PURE__*/g.styled(Ye.default).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);}"]),Ad=/*#__PURE__*/g.styled.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)")),Td=({buttonHideAnimations:t,buttonLoading:n,password:i,onSubmit:a,onBack:o})=>{let[s,l]=r.useState(!0),[c,d]=r.useState(!1),[u,p]=r.useState(""),h=i===u;return r.useEffect((()=>{u&&!c&&d(!0)}),[u]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{closeable:!1,backFn:o}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsxs(ud,{children:[/*#__PURE__*/e.jsxs(fd,{children:[/*#__PURE__*/e.jsx(We.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),/*#__PURE__*/e.jsxs(gd,{children:[/*#__PURE__*/e.jsx(yd,{value:u,onChange:e=>p(e.target.value),onKeyUp:e=>{"Enter"===e.key&&a()},onBlur:()=>d(!0),placeholder:"confirm your password",type:s?"password":"text",style:{paddingRight:"2.3rem"}}),/*#__PURE__*/e.jsx(Cd,{style:{right:"0.75rem"},children:s?/*#__PURE__*/e.jsx(kd,{onClick:()=>l(!1)}):/*#__PURE__*/e.jsx(Ed,{onClick:()=>l(!0)})})]}),
|
|
21
|
+
/*#__PURE__*/e.jsx(dd,{"aria-hidden":!c||h,error:!0,children:"Passwords do not match"})]}),/*#__PURE__*/e.jsx(pd,{onClick:a,loading:n,disabled:!h,$hideAnimations:t,children:"Continue"}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]})},jd=({className:t,checked:r,color:n="var(--privy-color-accent)",...i})=>/*#__PURE__*/e.jsx("label",{children:/*#__PURE__*/e.jsxs(Id,{className:t,children:[/*#__PURE__*/e.jsx(Pd,{checked:r,...i}),/*#__PURE__*/e.jsx(_d,{color:n,checked:r,children:/*#__PURE__*/e.jsx(Sd,{viewBox:"0 0 24 24",children:/*#__PURE__*/e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})});let Id=/*#__PURE__*/g.styled.div.withConfig({displayName:"CheckboxContainer",componentId:"sc-db51b935-1"})(["display:inline-block;vertical-align:middle;"]),Sd=/*#__PURE__*/g.styled.svg.withConfig({displayName:"Icon",componentId:"sc-db51b935-2"})(["fill:none;stroke:white;stroke-width:3px;"]),Pd=/*#__PURE__*/g.styled.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;"]),_d=/*#__PURE__*/g.styled.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)"),Pd,(e=>e.color),Sd,(e=>e.checked?"visible":"hidden"));const Nd=({buttonHideAnimations:t,buttonLoading:n,onSubmit:i,onBack:a,config:o})=>{let[s,l]=r.useState(!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{closeable:!1,backFn:a}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsxs(ud,{children:[/*#__PURE__*/e.jsxs(fd,{children:[/*#__PURE__*/e.jsx(We.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),/*#__PURE__*/e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),/*#__PURE__*/e.jsx(wd,{children:/*#__PURE__*/e.jsxs(vd,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:e=>{e.preventDefault(),l((e=>!e))},children:[/*#__PURE__*/e.jsx(jd,{color:"var(--privy-color-error)",readOnly:!0,checked:s}),/*#__PURE__*/e.jsx(e.Fragment,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),/*#__PURE__*/e.jsxs(Md,{children:["user"===o.initiatedBy&&/*#__PURE__*/e.jsx(xo,{onClick:o.onCancel,disabled:n,children:"Cancel"}),/*#__PURE__*/e.jsx(pd,{onClick:i,loading:n,$hideAnimations:t,disabled:!s,children:"Set Password"})]}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]})};let Md=/*#__PURE__*/g.styled.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-d1659c5f-0"})(["display:flex;gap:10px;"]),Wd=/[a-z]/,Fd=/[A-Z]/,Ud=/[0-9]/,Rd="!@#$%^&*()\\-_+.",Od=`a-zA-Z0-9${Rd}`,Ld=RegExp(`[${Rd}]`),Dd=RegExp(`[${Od}]`);const Bd=RegExp(`^[${Od}]{6,}$`),zd=()=>Re.generatePassphrase(4,W.DEFAULT_WORDLIST);function Hd(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function $d(e=""){return(.3*function(e){if(e.length<8)return 0;let t=0;return Wd.test(e)&&(t+=1),Fd.test(e)&&(t+=1),Ud.test(e)&&(t+=1),Ld.test(e)&&(t+=1),Math.max(0,Math.min(1,t/3))}(e)+Ue.default(e)/95)/2}const qd=({buttonHideAnimations:t,buttonLoading:n,password:i="",config:a,isResettingPassword:o,onSubmit:s,onClose:l,onBack:c,onPasswordChange:d,onPasswordGenerate:u})=>{let[p,h]=r.useState(!1),[y,m]=r.useState(!1);r.useEffect((()=>{i&&!y&&m(!0)}),[i]);let g=r.useMemo((()=>y?6>(i?.length||0)?"Password must be at least 6 characters":Bd.test(i||"")?null:`Invalid characters used ( ${((e="")=>[...new Set(e.split("").filter((e=>!Dd.test(e))).map((e=>e.replace(" ","SPACE"))))])(i).join(" ")} )`:null),[i,y]),f=r.useMemo((()=>g?{value:0,label:"Weak"}:function(e=""){let t=$d(e);return{value:t,label:Hd(t)}}(i)),[i,g]),w=r.useMemo((()=>!i?.length||!!g),[g,i]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:l,closeable:"user"===a.initiatedBy,backFn:c}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsxs(ud,{children:[/*#__PURE__*/e.jsxs(fd,{children:[/*#__PURE__*/e.jsx(Qe.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),/*#__PURE__*/e.jsxs("h3",{style:{color:"var(--privy-color-foreground)"},children:[o?"Reset":"Set"," your password"]}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),/*#__PURE__*/e.jsxs(gd,{children:[/*#__PURE__*/e.jsx(yd,{value:i,onChange:e=>d(e.target.value),onKeyUp:e=>{"Enter"===e.key&&s()},placeholder:"enter or generate a strong password",type:p?"password":"text",style:{paddingRight:"3.8rem"}}),/*#__PURE__*/e.jsxs(Cd,{style:{width:"3.5rem"},children:[p?/*#__PURE__*/e.jsx(kd,{onClick:()=>h(!1)}):/*#__PURE__*/e.jsx(Ed,{onClick:()=>h(!0)}),/*#__PURE__*/e.jsx(bd,{onClick:u})]})]}),/*#__PURE__*/e.jsx(Ad,{value:0===f.value?.01:f.value,label:f.label}),/*#__PURE__*/e.jsx(dd,{error:!!g,children:g||`Password Strength: ${y?f.label:"--"}`}),/*#__PURE__*/e.jsxs(Kd,{children:[/*#__PURE__*/e.jsx(Vd,{children:/*#__PURE__*/e.jsxs(wd,{children:[/*#__PURE__*/e.jsxs(vd,{children:[/*#__PURE__*/e.jsx(Xe.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),/*#__PURE__*/e.jsxs(vd,{children:[/*#__PURE__*/e.jsx(Xe.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),/*#__PURE__*/e.jsx(pd,{onClick:s,loading:n,disabled:w,$hideAnimations:t,children:"Continue"})]})]}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]})};let Vd=/*#__PURE__*/g.styled(wd).withConfig({displayName:"DetailsContainer",componentId:"sc-2da5fe90-0"})(["flex:1;padding-top:1rem;"]),Kd=/*#__PURE__*/g.styled.div.withConfig({displayName:"LowerContainer",componentId:"sc-2da5fe90-1"})(["display:flex;flex-direction:column;height:100%;"]);const Gd=({buttonHideAnimations:t,buttonLoading:n,appName:i,password:a,onSubmit:o,onBack:s})=>{let[l,c]=r.useState(!1),[d,u]=r.useState(!0),p=r.useCallback((()=>{c(!0),a&&navigator.clipboard.writeText(a)}),[a]),h=r.useCallback((()=>{let e=document.createElement("a"),t=i.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),r=new Blob([Yd(i,a)],{type:"text/plain"}),n=URL.createObjectURL(r);e.href=n,e.target="_blank",e.download=`${t}-privy-wallet-recovery.txt`,document.body.appendChild(e),e.click(),setTimeout((()=>{e.remove(),URL.revokeObjectURL(n)}),5e3)}),[a]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:s,closeable:!1}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsxs(ud,{children:[/*#__PURE__*/e.jsxs(fd,{children:[/*#__PURE__*/e.jsx(We.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),/*#__PURE__*/e.jsxs(gd,{centered:!0,children:[/*#__PURE__*/e.jsx(md,{children:d?"•".repeat(a.length):a}),/*#__PURE__*/e.jsx(Cd,{style:{right:"0.75rem"},children:d?/*#__PURE__*/e.jsx(kd,{onClick:()=>u(!1)}):/*#__PURE__*/e.jsx(Ed,{onClick:()=>u(!0)})})]}),/*#__PURE__*/e.jsxs("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[/*#__PURE__*/e.jsx(xd,{onClick:p,children:l?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(et.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(tt.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),/*#__PURE__*/e.jsxs(xd,{onClick:h,children:[/*#__PURE__*/e.jsx(Je.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),/*#__PURE__*/e.jsx(pd,{onClick:o,loading:n,$hideAnimations:t,children:"Continue"}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]})};let Yd=(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 Zd=({error:t,onClose:r})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{closeable:!1}),/*#__PURE__*/e.jsx(ws,{}),t?/*#__PURE__*/e.jsxs(ys,{children:[/*#__PURE__*/e.jsx(rt.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(gc,{title:"Something went wrong",description:t})]}):/*#__PURE__*/e.jsxs(ys,{children:[/*#__PURE__*/e.jsx(Xe.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(gc,{title:"Success"})]}),/*#__PURE__*/e.jsx(go,{onClick:r,children:"Close"}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]});let Qd=(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 Xd=({onSubmit:t,...n})=>{let{lastScreen:i,navigate:a}=Ui(),{send:o,state:s}=(()=>{let[e,t]=r.useReducer(Qd,"creating");return{send:t,state:e}})(),l=r.useCallback((async()=>{"finalizing"===s&&await t(),o("next")}),[s,o,t]);r.useEffect((()=>{let e;return"done"===s&&"automatic"===n.config.initiatedBy&&(e=setTimeout((()=>n.onClose?.()),Wt)),()=>{e&&clearTimeout(e)}}),[s,n.config.initiatedBy,n.onClose]);let c=r.useCallback((()=>{o("back")}),[o]),d=r.useCallback((()=>{a(ld)}),[i,a]);return"creating"===s?/*#__PURE__*/e.jsx(qd,{...n,onSubmit:l,onBack:i===ld?d:void 0}):"saving"===s?/*#__PURE__*/e.jsx(Gd,{...n,onSubmit:l,onBack:c}):"confirming"===s?/*#__PURE__*/e.jsx(Td,{...n,onSubmit:l,onBack:c}):"finalizing"===s?/*#__PURE__*/e.jsx(Nd,{...n,onSubmit:l,onBack:c}):"done"===s?/*#__PURE__*/e.jsx(Zd,{...n,onSubmit:l}):null};let Jd={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",line_oauth:"line",twitter_oauth:"twitter",wallet:"siwe",smart_wallet:"siwe",cross_app:"privy:"};const eu=e=>{let t=Jd[e];return"wallet"===e||"phone"===e?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};let tu=/*#__PURE__*/r.createContext({});const ru=({children:t})=>{let n=Ni(),[i,a]=r.useState({});return da("login",{onComplete:({loginAccount:e})=>{e&&"passkey"!==e.type&&"cross_app"!==e.type&&("wallet"!==e.type||"privy"!==e.walletClientType)&&(kt.put(nu(n.id),e.type),"wallet"===e.type?(kt.put(iu(n.id),e.walletClientType),kt.put(au(n.id),e.chainType),a({accountType:e.type,walletClientType:e.walletClientType,chainType:e.chainType})):(kt.del(iu(n.id)),kt.del(au(n.id)),a({accountType:e.type})))}}),r.useEffect((()=>{if(!n.id)return;let e=kt.get(nu(n.id)),t=kt.get(iu(n.id)),r=kt.get(au(n.id));e&&a("wallet"===e?{accountType:e,walletClientType:t,chainType:r}:{accountType:e})}),[n.id]),/*#__PURE__*/e.jsx(tu.Provider,{value:i,children:t})};let nu=e=>`privy:${e}:recent-login-method`,iu=e=>`privy:${e}:recent-login-wallet-client`,au=e=>`privy:${e}:recent-login-chain-type`;const ou=()=>r.useContext(tu),su=()=>{let{app:t}=Ui(),r=t?.appearance?.logo,n=`${t?.name} logo`,i={maxHeight:"90px",maxWidth:"180px"};return r?"string"==typeof r?/*#__PURE__*/e.jsx("img",{src:r,alt:n,style:i}):"svg"===r.type||"img"===r.type?/*#__PURE__*/xe.default.cloneElement(r,{alt:n,style:i}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},lu=t=>{let{app:r}=Ui();return r?.appearance.logo?/*#__PURE__*/e.jsx(cu,{...t,children:/*#__PURE__*/e.jsx(su,{})}):null},cu=/*#__PURE__*/g.styled.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;"]),du=({name:t,logoUrl:r,size:n="38px"})=>{let i=`${t??"Provider app"} logo`;return"string"==typeof r?/*#__PURE__*/e.jsx("img",{src:r,alt:i,style:{width:n,height:n,maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):
|
|
22
|
+
/*#__PURE__*/e.jsx("span",{})},uu=({appId:t})=>{let[n,i]=r.useState(void 0),{startCrossAppAuthFlow:a,authenticated:o}=u.usePrivyContext(),{client:l}=s.usePrivyInternal();return r.useEffect((()=>{(async()=>{l&&i(await l.getCrossAppProviderDetails(t))})()}),[l]),/*#__PURE__*/e.jsx(xa,{onClick:()=>a({appId:t,action:o?"link":"login"}),disabled:!n,children:n?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(du,{name:n.name,logoUrl:n.icon_url||void 0,size:"24px"})," ",n.name]}):/*#__PURE__*/e.jsx(po,{})})};let pu=/*#__PURE__*/g.styled.a.withConfig({displayName:"StyledLink",componentId:"sc-c8577138-0"})(["&&{color:",";font-weight:400;text-decoration:",";text-underline-offset:4px;text-decoration-thickness:1px;cursor:",";opacity:",";font-size:",";line-height:",";transition:color 200ms ease,text-decoration-color 200ms ease,opacity 200ms ease;&:hover{color:",";text-decoration:",";text-underline-offset:4px;}&:active{color:",";}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;border-radius:2px;}}"],(({$variant:e})=>"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))"),(({$variant:e})=>"underlined"===e?"underline":"var(--privy-link-navigation-decoration, none)"),(({$disabled:e})=>e?"not-allowed":"pointer"),(({$disabled:e})=>e?.5:1),(({$size:e})=>{switch(e){case"xs":return"12px";case"sm":return"14px";default:return"16px"}}),(({$size:e})=>{switch(e){case"xs":return"18px";case"sm":return"22px";default:return"24px"}}),(({$variant:e,$disabled:t})=>"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))"),(({$disabled:e})=>e?"none":"underline"),(({$variant:e,$disabled:t})=>t?"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))":"var(--privy-color-foreground)"));const hu=({size:t="md",variant:r="navigation",disabled:n=!1,as:i,children:a,onClick:o,...s})=>/*#__PURE__*/e.jsx(pu,{as:i,$size:t,$variant:r,$disabled:n,onClick:e=>{n?e.preventDefault():o?.(e)},...s,children:a}),yu=(e,t)=>!u.getPrivyEthereumWallet(e)&&("all-users"===t||"users-without-wallets"===t&&!mu(e).length);let mu=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"ethereum"===e.chainType));const gu=(e,t)=>!u.getPrivySolanaWallet(e)&&("all-users"===t||"users-without-wallets"===t&&!fu(e).length);let fu=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"solana"===e.chainType));const wu=(e,t)=>yu(e,t.ethereum.createOnLogin)||gu(e,t.solana.createOnLogin),vu=({title:t="Account not found",subtitle:r,appName:n="this app",ctaText:i="Try logging in again",onRetry:a})=>/*#__PURE__*/e.jsx(Xc,{title:t,subtitle:r||`Please try logging in again or go to ${n} to create an account.`,icon:P.HelpCircle,iconVariant:"warning",primaryCta:{label:i,onClick:a},watermark:!0}),xu={component:()=>{let{navigate:t,app:r,setModalData:n,data:i}=Ui(),{getAuthMeta:a,client:o}=s.usePrivyInternal();/*#__PURE__*/return e.jsx(vu,{appName:r?.name,onRetry:()=>{let e=a();n({...i,login:{...i?.login,...e?.disableSignup?{disableSignup:!0}:{}}}),o?.authFlow&&(o.authFlow=void 0),t(om)}})}},Cu=/*#__PURE__*/g.styled.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)"));function bu(t){/*#__PURE__*/return e.jsxs("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",...t,children:[/*#__PURE__*/e.jsx("circle",{cx:"12",cy:"12",r:"10"}),/*#__PURE__*/e.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),/*#__PURE__*/e.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}let ku="0x0000000000000000000000000000000000000000";const Eu=({originCurrency:e,destinationCurrency:t,...r})=>({tradeType:"EXPECTED_OUTPUT",originCurrency:e??ku,destinationCurrency:t??ku,...r});let Au="https://api.relay.link",Tu="https://api.testnets.relay.link";const ju=async({input:e,isTestnet:t})=>{let r=await fetch((t?Tu:Au)+"/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await r.json();if(!(r.ok||"string"==typeof n.message&&n.message.startsWith("Invalid address")))throw console.error("Relay error:",n),Error(n.message??"Error fetching quote from relay");return n},Iu=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 Su({transactionHash:e,wallet:t,isTestnet:n,bridgingStatus:i,setBridgingStatus:a,onSuccess:o,onFailure:s}){r.useEffect((()=>{if(e&&t&&i){if(["delayed","waiting","pending"].includes(i)){let t=setInterval((async()=>{try{let t=await async function({transactionHash:e,isTestnet:t}){let r=await fetch((t?Tu:Au)+"/requests/v2?hash="+e),n=await r.json();if(!r.ok){if("message"in n&&"string"==typeof n.message)throw Error(n.message);throw Error("Error fetching request from relay")}return n.requests.at(0)?.status??"pending"}({transactionHash:e,isTestnet:n});a(t)}catch(e){console.error(e)}}),1e3);return()=>clearInterval(t)}"success"===i?o({transactionHash:e,wallet:t}):["refund","failure"].includes(i)&&s({error:new Pu(e,n)})}}),[i,e,n,t])}class Pu extends o.PrivyClientError{constructor(e,t){super("We were unable to complete the bridging transaction. Funds will be refunded on your wallet.",void 0,o.PrivyErrorCode.TRANSACTION_FAILURE),this.relayLink=t?`https://testnets.relay.link/transaction/${e}`:`https://relay.link/transaction/${e}`}}const _u=({error:t,allowlistConfig:r,onRetry:n,onCaptchaReset:i,onBack:a})=>{let s=((t,r)=>{if(t instanceof Pu)return{title:"Transaction failed",detail:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("span",{children:t.message}),/*#__PURE__*/e.jsxs("span",{children:[" ","Check the"," ",/*#__PURE__*/e.jsx(Mu,{href:t.relayLink,target:"_blank",children:"refund status"}),"."]})]}),ctaText:"Try again",icon:P.AlertTriangle};if(t instanceof o.PrivyClientError)switch(t.privyErrorCode){case o.PrivyErrorCode.CLIENT_REQUEST_TIMEOUT:return{title:"Timed out",detail:t.message,ctaText:"Try again",icon:P.AlertTriangle};case o.PrivyErrorCode.INSUFFICIENT_BALANCE:return{title:"Insufficient balance",detail:t.message,ctaText:"Try again",icon:P.AlertTriangle};case o.PrivyErrorCode.TRANSACTION_FAILURE:return{title:"Transaction failure",detail:t.message,ctaText:"Try again",icon:P.AlertTriangle};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:P.AlertTriangle}}else{if(t instanceof pl&&"twilio_verification_failed"===t.type)return{title:"Something went wrong",detail:t.message,ctaText:"Try again",icon:P.Phone};if(!(t instanceof o.PrivyError))return t instanceof o.PrivyApiError&&t.status&&[400,422].includes(t.status)?{title:"Something went wrong",detail:t.message,ctaText:"Try again",icon:P.AlertTriangle}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:P.AlertTriangle};switch(t.privyErrorCode){case o.PrivyErrorCode.INVALID_CAPTCHA:return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:P.AlertTriangle};case o.PrivyErrorCode.DISALLOWED_LOGIN_METHOD:return{title:"Not allowed",detail:t.message,ctaText:"Try another method",icon:P.AlertTriangle};case o.PrivyErrorCode.ALLOWLIST_REJECTED:return{title:r.errorTitle||"You don't have access to this app",detail:r.errorDetail||"Have you been invited?",ctaText:r.errorCtaText||"Try another account",icon:P.Lock};case o.PrivyErrorCode.CAPTCHA_FAILURE:return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:null};case o.PrivyErrorCode.CAPTCHA_TIMEOUT:return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:null};case o.PrivyErrorCode.LINKED_TO_ANOTHER_USER:return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:P.AlertTriangle};case o.PrivyErrorCode.NOT_SUPPORTED:return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:P.AlertTriangle};case o.PrivyErrorCode.TOO_MANY_REQUESTS:return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:P.AlertTriangle};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:P.AlertTriangle}}}})(t,r);/*#__PURE__*/return e.jsx(Xc,{title:s.title,subtitle:s.detail,icon:s.icon,onBack:a,iconVariant:"error",primaryCta:{label:s.ctaText,onClick:()=>{t instanceof o.PrivyError&&(t.privyErrorCode===o.PrivyErrorCode.INVALID_CAPTCHA&&i?.(),t.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED&&r.errorCtaLink)?window.location.href=r.errorCtaLink:n?.()},variant:"error"},watermark:!0})},Nu={component:()=>{let{navigate:t,data:r,lastScreen:n,currentScreen:i,app:a}=Ui(),{reset:o}=sn(),s=r?.errorModalData?.previousScreen||(n===i?void 0:n);/*#__PURE__*/return e.jsx(_u,{error:r?.errorModalData?.error||Error(),allowlistConfig:a.allowlistConfig,onRetry:()=>{t(s||om,!1)},onCaptchaReset:o})}};let Mu=/*#__PURE__*/g.styled.a.withConfig({displayName:"Link",componentId:"sc-89a5a605-0"})(["color:var(--privy-color-accent) !important;font-weight:600;"]);const Wu=({onTransfer:t,isTransferring:r,transferSuccess:n})=>/*#__PURE__*/e.jsx(go,{...n?{success:!0,children:"Success!"}:{warn:!0,loading:r,onClick:t,children:"Transfer and delete account"}}),Fu=/*#__PURE__*/g.styled.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;"]),Uu=/*#__PURE__*/g.styled.div.withConfig({displayName:"GappedContainer",componentId:"sc-3505eb4c-1"})(["display:flex;flex-direction:column;&& p{font-size:14px;}width:100%;gap:16px;"]),Ru=/*#__PURE__*/g.styled.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;"]),Ou=/*#__PURE__*/g.styled(ze.default).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`)),Lu=/*#__PURE__*/g.styled(He.default).withConfig({displayName:"StyledCopyIcon",componentId:"sc-3505eb4c-4"})(["position:relative;width:15px;height:15px;color:var(--privy-color-foreground-3);margin-left:auto;"]),Du=/*#__PURE__*/g.styled.ol.withConfig({displayName:"ListContainer",componentId:"sc-3505eb4c-5"})(["display:flex;flex-direction:column;font-size:14px;width:100%;text-align:left;"]),Bu=/*#__PURE__*/g.styled.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;}"]),zu=/*#__PURE__*/g.styled.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 Hu=()=>/*#__PURE__*/e.jsx(zu,{children:/*#__PURE__*/e.jsx(Ou,{$iconSize:60})});const $u=({address:t,onClose:r,onRetry:n,onTransfer:i,isTransferring:a,transferSuccess:o})=>{let{defaultChain:s}=Ni(),l=s.blockExplorers?.default.url??"https://etherscan.io";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:r,backFn:n}),/*#__PURE__*/e.jsxs(Fu,{children:[/*#__PURE__*/e.jsx(Hu,{}),/*#__PURE__*/e.jsxs(Uu,{children:[/*#__PURE__*/e.jsx("h3",{children:"Check account assets before transferring"}),/*#__PURE__*/e.jsx("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.jsxs(Du,{children:[/*#__PURE__*/e.jsx("p",{children:" To check your balance, you can:"}),/*#__PURE__*/e.jsx(Bu,{children:"Log out and log back into the other account, or "}),/*#__PURE__*/e.jsxs(Bu,{children:["Copy your wallet address and use a"," ",/*#__PURE__*/e.jsx("u",{children:/*#__PURE__*/e.jsx("a",{target:"_blank",href:l,children:"block explorer"})})," ","to see if the account holds any assets."]})]}),/*#__PURE__*/e.jsxs(Ru,{onClick:()=>navigator.clipboard.writeText(t).catch(console.error),children:[/*#__PURE__*/e.jsx(Be.default,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/e.jsx(Dl,{address:t,showCopyIcon:!1}),/*#__PURE__*/e.jsx(Lu,{})]}),/*#__PURE__*/e.jsx(Wu,{onTransfer:i,isTransferring:a,transferSuccess:o})]})]}),/*#__PURE__*/e.jsx(Ia,{})]})},qu={component:()=>{let{initiateAccountTransfer:t,closePrivyModal:n}=s.usePrivyInternal(),{data:i,navigate:a,lastScreen:o,setModalData:l}=Ui(),[c,d]=r.useState(void 0),[u,p]=r.useState(!1),[h,y]=r.useState(!1),m=async()=>{try{if(!i?.accountTransfer?.nonce||!i?.accountTransfer?.account)throw Error("missing account transfer inputs");y(!0),await t({nonce:i?.accountTransfer?.nonce,account:i?.accountTransfer?.account,accountType:i?.accountTransfer?.linkMethod,externalWalletMetadata:i?.accountTransfer?.externalWalletMetadata,telegramWebAppData:i?.accountTransfer?.telegramWebAppData,telegramAuthResult:i?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:i?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:i?.accountTransfer?.oAuthUserInfo}),p(!0),y(!1),setTimeout(n,1e3)}catch(e){l({errorModalData:{error:e,previousScreen:o||qu}}),a(Nu,!0)}};return c?/*#__PURE__*/e.jsx($u,{address:c,onClose:n,onRetry:()=>d(void 0),onTransfer:m,isTransferring:h,transferSuccess:u}):/*#__PURE__*/e.jsx(Vu,{onClose:n,onInfo:()=>d(i?.accountTransfer?.embeddedWalletAddress),onContinue:()=>d(i?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:h,transferSuccess:u,data:i})}},Vu=({onClose:t,onContinue:r,onInfo:n,onTransfer:i,transferSuccess:a,isTransferring:o,data:s})=>{if(!s?.accountTransfer?.linkMethod||!s?.accountTransfer?.displayName)return;let l={method:s?.accountTransfer?.linkMethod,handle:s?.accountTransfer?.displayName,disclosedAccount:s?.accountTransfer?.embeddedWalletAddress?{type:"wallet",handle:s?.accountTransfer?.embeddedWalletAddress}:void 0};/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{closeable:!0}),/*#__PURE__*/e.jsxs(Fu,{children:[/*#__PURE__*/e.jsx(Js,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx(Cu,{color:"var(--privy-color-error)"}),/*#__PURE__*/e.jsx(We.default,{height:38,width:38,stroke:"var(--privy-color-error)"})]})}),/*#__PURE__*/e.jsxs(Uu,{children:[/*#__PURE__*/e.jsxs("h3",{children:[function(e){switch(e){case"sms":return"Phone number";case"email":return"Email address";case"siwe":return"Wallet address";case"siws":return"Solana wallet address";case"linkedin":return"LinkedIn profile";case"google":case"apple":case"discord":case"github":case"instagram":case"spotify":case"tiktok":case"line":case"twitter":case"telegram":case"farcaster":return`${gr(e.replace("_oauth",""))} profile`;default:return e.startsWith("privy:")?"Cross-app account":e}}(l.method)," is associated with another account"]}),/*#__PURE__*/e.jsxs("p",{children:["Do you want to transfer",/*#__PURE__*/e.jsx("b",{children:l.handle?` ${l.handle}`:""})," to this account instead? This will delete your other account."]}),/*#__PURE__*/e.jsx(Ku,{onClick:n,disclosedAccount:l.disclosedAccount})]}),/*#__PURE__*/e.jsxs(Uu,{style:{gap:12,marginTop:12},children:[s?.accountTransfer?.embeddedWalletAddress?/*#__PURE__*/e.jsx(go,{onClick:r,children:"Continue"}):/*#__PURE__*/e.jsx(Wu,{onTransfer:i,transferSuccess:a,isTransferring:o}),/*#__PURE__*/e.jsx(xo,{onClick:t,children:"No thanks"})]})]}),/*#__PURE__*/e.jsx(Ia,{})]})};function Ku({disclosedAccount:t,onClick:r}){return t?/*#__PURE__*/e.jsxs(Ru,{onClick:r,children:[/*#__PURE__*/e.jsx(Be.default,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/e.jsx(Dl,{address:t.handle,showCopyIcon:!1}),/*#__PURE__*/e.jsx(bu,{width:15,height:15,color:"var(--privy-color-foreground-3)",style:{marginLeft:"auto"}})]}):null}const Gu=({errorMessage:t,onClose:r})=>t?/*#__PURE__*/e.jsx(Xc,{title:"Something went wrong",subtitle:t,icon:P.XCircle,iconVariant:"error",primaryCta:{label:"Close",onClick:r},watermark:!0}):/*#__PURE__*/e.jsx(Xc,{title:"Creating your wallet",subtitle:"Please wait...",iconVariant:"loading",watermark:!1}),Yu={component:()=>{let{app:t,setModalData:n,navigate:i,data:a,onUserCloseViaDialogOrKeybindRef:l}=Ui(),[c,d]=r.useState(""),{embeddedWallets:p}=Ni(),{authenticated:h,user:y}=u.usePrivyContext(),{closePrivyModal:m,walletProxy:g,client:f}=s.usePrivyInternal(),{onSuccess:w,onFailure:v,callAuthOnSuccessOnClose:x,shouldCreateEth:C,shouldCreateSol:b}=a.createWallet,k="legacy-embedded-wallets-only"===t.embeddedWallets.mode&&!0===t?.embeddedWallets.requireUserOwnedRecoveryOnCreate,[E,A]=r.useState(null),{create:T}=Tc(),j=C??(!!y&&yu(y,t.embeddedWallets.ethereum.createOnLogin)),I=b??(!!y&&gu(y,t.embeddedWallets.solana.createOnLogin)),S=new _t((async()=>{let e=await f.getAccessToken();if(y&&e&&g)try{let e;if(j&&I)e=await T({chainType:"ethereum",walletIndex:0,latestUser:y}),e=await T({chainType:"solana",walletIndex:0,latestUser:e.user});else if(I)e=await T({chainType:"solana",walletIndex:0,latestUser:y});else{if(!j)return void m({shouldCallAuthOnSuccess:x});e=await T({chainType:"ethereum",walletIndex:0,latestUser:y})}A(e),i(ed)}catch(e){d(e.message)}}));return r.useEffect((()=>h&&y?k?(n({...a,createWallet:{...a.createWallet,shouldCreateEth:j,shouldCreateSol:I},recoverySelection:{...a?.recoverySelection,isInAccountCreateFlow:!0,shouldCreateEth:j,shouldCreateSol:I}}),i(xm({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:p.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void S.execute():(i(om),void v(Error("User must be authenticated before creating a Privy wallet")))),[k,h]),l.current=()=>null/*#__PURE__*/,e.jsx(Gu,{errorMessage:c||void 0,onClose:()=>{E?(w(E),m({shouldCallAuthOnSuccess:x})):(v(new o.PrivyEmbeddedWalletError("User wallet creation failed")),m({shouldCallAuthOnSuccess:!1}))}})}},Zu={component:()=>{let{user:t,logout:r}=u.usePrivyContext(),{app:n,onUserCloseViaDialogOrKeybindRef:i,setModalData:a,navigate:o}=Ui(),{acceptTerms:l,closePrivyModal:c,createAnalyticsEvent:d}=s.usePrivyInternal(),p=e=>{e?.preventDefault(),c({shouldCallAuthOnSuccess:!1}),r()};i.current=p;/*#__PURE__*/return e.jsx(Qu,{termsAndConditionsUrl:n?.legal.termsAndConditionsUrl,privacyPolicyUrl:n?.legal.privacyPolicyUrl,onAccept:async e=>{e?.preventDefault(),await l(),t&&wu(t,n.embeddedWallets)?(a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),d({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),o(Yu)):c()},onDecline:p})}},Qu=({termsAndConditionsUrl:t,privacyPolicyUrl:r,onAccept:n,onDecline:i,title:a="One last step",subtitle:o="By signing up, you agree to our terms and privacy policy."})=>/*#__PURE__*/e.jsx(Xc,{title:a,subtitle:o,icon:P.FileCheck,primaryCta:{label:"Accept",onClick:n},secondaryCta:{label:"No thanks",onClick:i},watermark:!0,children:(t||r)&&/*#__PURE__*/e.jsxs(Xu,{children:[t&&/*#__PURE__*/e.jsxs(yo,{variant:"muted",href:t,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Terms",/*#__PURE__*/e.jsx(P.ExternalLink,{width:16,height:16,strokeWidth:2.25})]}),r&&/*#__PURE__*/e.jsxs(yo,{variant:"muted",href:r,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Privacy Policy",/*#__PURE__*/e.jsx(P.ExternalLink,{width:16,height:16,strokeWidth:2.25})]})]})});let Xu=/*#__PURE__*/g.styled.div.withConfig({displayName:"LinksContainer",componentId:"sc-b9d25a6d-0"})(["display:flex;flex-direction:column;gap:12px;margin-top:var(--screen-space);"]);const Ju=({color:t,...r})=>/*#__PURE__*/e.jsx("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",...r,children:/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:t||"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"})})});let ep=/*#__PURE__*/g.styled.button.withConfig({displayName:"CopyTextButton",componentId:"sc-4b0620dc-0"})(["display:flex;align-items:center;gap:0.5rem;&:hover{text-decoration:underline;}svg{width:0.875rem;height:0.875rem;}"]),tp=/*#__PURE__*/g.styled.span.withConfig({displayName:"CopiedText",componentId:"sc-4b0620dc-1"})(["display:flex;align-items:center;gap:0.25rem;font-size:0.875rem;color:var(--privy-color-foreground-2);"]),rp=/*#__PURE__*/g.styled($e.default).withConfig({displayName:"GreenCheck",componentId:"sc-4b0620dc-2"})(["color:var(--privy-color-success);"]),np=/*#__PURE__*/g.styled(Ju).withConfig({displayName:"StyledCopy",componentId:"sc-4b0620dc-3"})(["color:var(--privy-color-foreground-3);opactiy:0.5;"]);function ip({children:t,iconOnly:n,value:i,hideCopyIcon:a,...o}){let[s,l]=r.useState(!1);/*#__PURE__*/return e.jsxs(ep,{...o,onClick:()=>{navigator.clipboard.writeText(i||t).catch(console.error),l(!0),setTimeout((()=>l(!1)),1500)},children:[t," ",s?/*#__PURE__*/e.jsxs(tp,{children:[/*#__PURE__*/e.jsx(rp,{})," ",!n&&"Copied"]}):!a&&/*#__PURE__*/e.jsx(np,{})]})}const ap=()=>/*#__PURE__*/e.jsx("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__*/e.jsx("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});let op=(e,t,r,n,i)=>{for(let a=t;a<t+n;a++)for(let t=r;t<r+i;t++){let r=e?.[t];r&&r[a]&&(r[a]=0)}return e},sp=({x:t,y:r,cellSize:n,bgColor:i,fgColor:a})=>
|
|
23
|
+
/*#__PURE__*/e.jsx(e.Fragment,{children:[0,1,2].map((o=>/*#__PURE__*/e.jsx("circle",{r:n*(7-2*o)/2,cx:t+7*n/2,cy:r+7*n/2,fill:o%2!=0?i:a},`finder-${t}-${r}-${o}`)))}),lp=({cellSize:t,matrixSize:r,bgColor:n,fgColor:i})=>/*#__PURE__*/e.jsx(e.Fragment,{children:[[0,0],[(r-7)*t,0],[0,(r-7)*t]].map((([r,a])=>/*#__PURE__*/e.jsx(sp,{x:r,y:a,cellSize:t,bgColor:n,fgColor:i},`finder-${r}-${a}`)))}),cp=({matrix:t,cellSize:r,color:n})=>/*#__PURE__*/e.jsx(e.Fragment,{children:t.map(((t,i)=>t.map(((t,a)=>t?/*#__PURE__*/e.jsx("rect",{height:r-.4,width:r-.4,x:i*r+.1*r,y:a*r+.1*r,rx:.5*r,ry:.5*r,fill:n},`cell-${i}-${a}`):/*#__PURE__*/e.jsx(xe.default.Fragment,{},`circle-${i}-${a}`)))))}),dp=({cellSize:t,matrixSize:r,element:n,sizePercentage:i,bgColor:a})=>{if(!n)/*#__PURE__*/return e.jsx(e.Fragment,{});let o=r*(i||.14),s=Math.floor(r/2-o/2),l=Math.floor(r/2+o/2);(l-s)%2!=r%2&&(l+=1);let c=(l-s)*t,d=c-.2*c,u=s*t;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("rect",{x:s*t,y:s*t,width:c,height:c,fill:a}),/*#__PURE__*/e.jsx(n,{x:u+.1*c,y:u+.1*c,height:d,width:d})]})},up=t=>{let r=t.outputSize,n=((e,t)=>{let r=qe.default.create(e,{errorCorrectionLevel:t}).modules,n=((e,t)=>{let r=e.slice(0),n=[];for(;r.length;)n.push(r.splice(0,t));return n})(Array.from(r.data),r.size);return n=op(n,0,0,7,7),n=op(n,n.length-7,0,7,7),op(n,0,n.length-7,7,7)})(t.url,t.errorCorrectionLevel),i=r/n.length,a=function(e,{min:t,max:r}){return Math.min(Math.max(e,t),r)}(2*i,{min:.025*r,max:.036*r});/*#__PURE__*/return e.jsxs("svg",{height:t.outputSize,width:t.outputSize,viewBox:`0 0 ${t.outputSize} ${t.outputSize}`,style:{height:"100%",width:"100%",padding:`${a}px`},children:[/*#__PURE__*/e.jsx(cp,{matrix:n,cellSize:i,color:t.fgColor}),/*#__PURE__*/e.jsx(lp,{cellSize:i,matrixSize:n.length,fgColor:t.fgColor,bgColor:t.bgColor}),/*#__PURE__*/e.jsx(dp,{cellSize:i,element:t.logo?.element,bgColor:t.bgColor,matrixSize:n.length})]})},pp=/*#__PURE__*/g.styled.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 hp=t=>{let{appearance:r}=Ni(),n=t.bgColor||"#FFFFFF",i=t.fgColor||"#000000",a=t.size||160,o="dark"===r.palette.colorScheme?n:i;/*#__PURE__*/return e.jsx(pp,{$size:a,$bgColor:n,$fgColor:i,$borderColor:o,children:/*#__PURE__*/e.jsx(up,{url:t.url,logo:{element:t.squareLogoElement??ap},outputSize:a,bgColor:n,fgColor:i,errorCorrectionLevel:t.errorCorrectionLevel||"Q"})})},yp=/*#__PURE__*/g.styled.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 mp=/*#__PURE__*/g.styled.label.withConfig({displayName:"BaseEmailForm",componentId:"sc-f34af797-0"})(["display:block;position:relative;width:100%;height:56px;&& > :first-child{position:absolute;left:0.75em;top:50%;transform:translate(0,-50%);}&& > input{font-size:16px;line-height:24px;color:var(--privy-color-foreground);padding:12px 88px 12px 52px;flex-grow:1;background:var(--privy-color-background);border:1px solid ",";border-radius:var(--privy-border-radius-md);width:100%;height: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 gp=/*#__PURE__*/g.styled(mp).withConfig({displayName:"EmailUpdateForm",componentId:"sc-f34af797-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);}}"]),fp=/*#__PURE__*/g.styled(mp).withConfig({displayName:"EmailInputForm",componentId:"sc-f34af797-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)")),wp=/*#__PURE__*/g.styled.div.withConfig({displayName:"InputContainerForm",componentId:"sc-f34af797-3"})(["width:100%;&& > ","{display:block;text-align:left;padding-left:var(--privy-border-radius-md);padding-bottom:5px;}"],yp),vp=({...t})=>/*#__PURE__*/e.jsxs("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",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),/*#__PURE__*/e.jsx("path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2"}),/*#__PURE__*/e.jsx("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"})]}),xp={phantom:{mobile:{native:"phantom://",universal:"https://phantom.app/ul/"}},solflare:{mobile:{native:void 0,universal:"https://solflare.com/ul/v1/"}},metamask:{image_url:{sm:$n,md:$n}}};class Cp{static normalize(e){return e.replace(/[-_]wallet$/,"").replace(/[-_]extension$/,"").toLowerCase()}isEth(e){return e.chains.some((e=>e.startsWith("eip155:")))}isSol(e){return e.chains.some((e=>e.startsWith("solana:")))}inAllowList(e,t){if(!this.normalizedAllowList||0===this.normalizedAllowList.length||"listing"===t&&this.includeWalletConnect)return!0;let r=Cp.normalize(e);return this.normalizedAllowList.some((e=>r===Cp.normalize(e)))}chainMatches(e){return"ethereum-only"===this.chainFilter?"ethereum"===e:"solana-only"!==this.chainFilter||"solana"===e}connectorOk(e){return!!("null"!==e.connectorType&&this.chainMatches(e.chainType)&&(this.inAllowList(e.walletClientType,"connector")||("injected"===e.connectorType||"solana_adapter"===e.connectorType)&&(this.detectedGeneric||"ethereum"===e.chainType&&this.detectedEth||"solana"===e.chainType&&this.detectedSol)))}listingOk(e){if(e.slug.includes("coinbase"))return!1;if("ethereum-only"===this.chainFilter){if(!this.isEth(e))return!1}else if("solana-only"===this.chainFilter&&!this.isSol(e))return!1;return!!this.inAllowList(e.slug,"listing")}getWallets(e,t){let r=new Map,n=e=>{let t=r.get(e.id);if(t){t.chainType!==e.chainType&&(t.chainType="multi");let r=new Set(t.chains);e.chains.forEach((e=>r.add(e))),t.chains=Array.from(r),!t.icon&&e.icon&&(t.icon=e.icon),!t.url&&e.url&&(t.url=e.url),!t.listing&&e.listing&&(t.listing=e.listing)}else r.set(e.id,e)};e.filter((e=>this.connectorOk(e))).forEach((e=>{let t=Cp.normalize(e.walletClientType);n({id:t,label:e.walletBranding?.name??t,source:"connector",connector:e,chainType:e.chainType,icon:e.walletBranding?.icon,url:void 0,chains:["ethereum"===e.chainType?"eip155":"solana"]})})),t.filter((e=>this.listingOk(e))).forEach((e=>{let t=this.isEth(e),r=this.isSol(e),i=Cp.normalize(e.slug),a=xp[e.slug],o=a?.image_url?.sm||e.image_url?.sm;n({id:i,label:e.name||i,source:"listing",listing:e,chainType:t&&r?"multi":t?"ethereum":"solana",icon:o,url:e.homepage,chains:e.chains})}));let i=e.find((e=>"wallet_connect_v2"===e.connectorType));this.includeWalletConnectQr&&i&&n({id:"wallet_connect_qr",label:"WalletConnect",source:"connector",connector:i,chainType:"ethereum",icon:Oi,url:void 0,chains:["ethereum"===i.chainType?"eip155":"solana"]});let a=Array.from(r.values());a.forEach((e=>{let t=xp[e.listing?.slug||e.id];t?.image_url?.sm&&(e.icon=t.image_url.sm)}));let o=new Map;return this.normalizedAllowList?.forEach(((e,t)=>{o.set(Cp.normalize(e),t)})),{wallets:a.slice().sort(((e,t)=>{let r=Cp.normalize(e.id),n=Cp.normalize(t.id);"binance-defi"===r?r="binance":"universalprofiles"===r?r="universal_profile":"cryptocom-defi"===r&&(r="cryptocom"),"binance-defi"===n?n="binance":"universalprofiles"===n?n="universal_profile":"cryptocom-defi"===n&&(n="cryptocom");let i=o.has(r),a=o.has(n);return i&&a?o.get(r)-o.get(n):i?-1:a?1:"connector"===e.source&&"listing"===t.source?-1:"listing"===e.source&&"connector"===t.source?1:e.label.toLowerCase().localeCompare(t.label.toLowerCase())})),walletCount:a.length}}constructor(e,t){this.chainFilter=e,t&&t.length>0&&(this.normalizedAllowList=t.map(String),this.normalizedAllowList.includes("binance")&&this.normalizedAllowList.push("binance-defi-wallet")),this.detectedGeneric=this.normalizedAllowList?.includes("detected_wallets")??!1,this.detectedEth=this.normalizedAllowList?.includes("detected_ethereum_wallets")??!1,this.detectedSol=this.normalizedAllowList?.includes("detected_solana_wallets")??!1,this.includeWalletConnect=this.normalizedAllowList?.includes("wallet_connect")??!1,this.includeWalletConnectQr=this.normalizedAllowList?.includes("wallet_connect_qr")??!1}}var bp=t=>/*#__PURE__*/e.jsxs("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("path",{d:"m0 0h32v32h-32z",fill:"#5469d4"}),/*#__PURE__*/e.jsx("path",{d:"m15.997 5.333-.143.486v14.106l.143.143 6.548-3.87z",fill:"#c2ccf4"}),/*#__PURE__*/e.jsx("path",{d:"m15.996 5.333-6.548 10.865 6.548 3.87z",fill:"#fff"}),/*#__PURE__*/e.jsx("path",{d:"m15.997 21.306-.08.098v5.025l.08.236 6.552-9.227z",fill:"#c2ccf4"}),/*#__PURE__*/e.jsx("path",{d:"m15.996 26.665v-5.36l-6.548-3.867z",fill:"#fff"}),/*#__PURE__*/e.jsx("path",{d:"m15.995 20.07 6.548-3.87-6.548-2.976v6.847z",fill:"#8698e8"}),/*#__PURE__*/e.jsx("path",{d:"m9.448 16.2 6.548 3.87v-6.846z",fill:"#c2ccf4"})]}),kp=t=>/*#__PURE__*/e.jsxs("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsxs("linearGradient",{id:"a",gradientUnits:"userSpaceOnUse",x1:"7.233",x2:"24.766",y1:"24.766",y2:"7.234",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#9945ff"}),/*#__PURE__*/e.jsx("stop",{offset:".2",stopColor:"#7962e7"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#00d18c"})]}),/*#__PURE__*/e.jsx("path",{d:"m0 0h32v32h-32z",fill:"#10111a"}),/*#__PURE__*/e.jsx("path",{clipRule:"evenodd",d:"m9.873 20.41a.645.645 0 0 1 .476-.21l14.662.012a.323.323 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54zm15.376-2.862a.322.322 0 0 1 -.238.54l-14.662.012a.642.642 0 0 1 -.476-.21l-3.122-3.44a.323.323 0 0 1 .238-.54l14.662-.012a.644.644 0 0 1 .475.21zm-15.376-9.738a.644.644 0 0 1 .476-.21l14.662.012a.322.322 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54z",fill:"url(#a)",fillRule:"evenodd"})]});const Ep=/*#__PURE__*/g.styled.div.withConfig({displayName:"Header",componentId:"sc-9b65f2b6-0"})(["display:flex;justify-content:space-between;align-items:center;"]),Ap=/*#__PURE__*/g.styled.button.withConfig({displayName:"CloseButton",componentId:"sc-9b65f2b6-1"})(["padding:0.25rem;height:30px;width:30px;display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-full);background:var(--privy-color-background-2);"]),Tp=/*#__PURE__*/g.styled.div.withConfig({displayName:"WalletIconWithActiveIndicator",componentId:"sc-9b65f2b6-2"})(["position:relative;display:inline-flex;align-items:center;&::after{content:' ';border-radius:var(--privy-border-radius-full);height:6px;width:6px;background-color:var(--privy-color-icon-success);position:absolute;right:-3px;top:-3px;}"]),jp=/*#__PURE__*/g.styled.img.withConfig({displayName:"WalletIcon",componentId:"sc-9b65f2b6-3"})(["width:32px;height:32px;border-radius:0.25rem;object-fit:contain;"]),Ip=/*#__PURE__*/g.styled.span.withConfig({displayName:"Chip",componentId:"sc-9b65f2b6-4"})(["display:flex;gap:0.25rem;align-items:center;padding:0.25rem 0.5rem;font-size:0.75rem;font-weight:500;line-height:1.125rem;border-radius:var(--privy-border-radius-sm);background-color:var(--privy-color-background-2);svg{width:100%;max-width:1rem;max-height:1rem;stroke-width:2;}"]),Sp=/*#__PURE__*/g.styled.div.withConfig({displayName:"ScrollContainer",componentId:"sc-9b65f2b6-5"})(["display:flex;flex-direction:column;gap:0.5rem;max-height:24rem;overflow-y:scroll;&::-webkit-scrollbar{display:none;}scrollbar-gutter:stable both-edges;scrollbar-width:none;-ms-overflow-style:none;"," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;"],(e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0)),Pp=I.create((()=>({isModalOpen:!1,resolvers:null})));let _p=I.create((()=>({})));const Np=({address:e,client:t,appId:r})=>{let n=`${t}:${e}`;r&&kt.put(Mp(r),n),Pp.setState({wallet:n})},Mp=e=>`privy:${e}:active-wallet-connection`;function Wp({walletList:e,walletChainType:t}){let n=Ni(),{connectors:i}=s.usePrivyInternal(),a=li((e=>e.listings)),o=t??n.appearance.walletChainType,l=e??n.appearance?.walletList,c=r.useMemo((()=>new Cp(o,l)),[o,l]),{wallets:d,walletCount:u}=r.useMemo((()=>c.getWallets(i,a)),[c,i,a]),[p,h]=r.useState(""),y=r.useMemo((()=>p?d.filter((e=>e.label.toLowerCase().includes(p.toLowerCase()))):d),[p,d]),[m,g]=r.useState();return{selected:m,setSelected:g,search:p,setSearch:h,wallets:y,walletCount:u}}let Fp=e=>!e||"string"!=typeof e&&(e instanceof zn||e instanceof si);const Up=({index:t,style:r,data:n,recent:i})=>{let a=n.wallets[t],{walletChainType:o,handleWalletClick:s}=n,l={...r,boxSizing:"border-box"};return a?/*#__PURE__*/e.jsxs(Dp,{style:l,onClick:()=>s(a),children:[a.icon&&(a.connector&&!Fp(a.connector)?/*#__PURE__*/e.jsx(Tp,{children:"string"==typeof a.icon?/*#__PURE__*/e.jsx(jp,{src:a.icon}):/*#__PURE__*/e.jsx(a.icon,{style:{width:"32px",height:"32px"}})}):"string"==typeof a.icon?/*#__PURE__*/e.jsx(jp,{src:a.icon}):/*#__PURE__*/e.jsx(a.icon,{style:{width:"32px",height:"32px"}})),/*#__PURE__*/e.jsx(Hp,{children:a.label}),i?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ip,{children:"Last used"}),/*#__PURE__*/e.jsx(Bp,{children:/*#__PURE__*/e.jsxs(e.Fragment,{children:["ethereum-only"===o&&/*#__PURE__*/e.jsx(bp,{}),"solana-only"===o&&/*#__PURE__*/e.jsx(kp,{})]})})]}):/*#__PURE__*/e.jsx(Bp,{children:!("ethereum-only"===o||"solana-only"===o)&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[a.chains?.some((e=>e.startsWith("eip155")))&&/*#__PURE__*/e.jsx(bp,{}),a.chains?.some((e=>e.startsWith("solana")))&&/*#__PURE__*/e.jsx(kp,{})]})})]}):null};var Rp=({className:t,suggestedAddress:i,customDescription:a,connectOnly:l,preSelectedWalletId:c,...d})=>{let u=Ni(),{connectors:p}=s.usePrivyInternal(),h=d.walletChainType||u.appearance.walletChainType,y=d.walletList||u.appearance?.walletList,{onBack:m,onClose:g,app:f}=d,{selected:w,setSelected:v,qrUrl:x,setQrUrl:C,connecting:b,uiState:k,wallets:E,walletCount:A,handleConnect:T,handleBack:j,showSearchBar:I,isInitialConnectView:S,title:P,search:_,setSearch:N}=function({onConnect:e,onBack:t,onClose:i,onConnectError:a,walletList:l,walletChainType:c,app:d}){let u=Ni(),{connectors:p}=s.usePrivyInternal(),{wallets:h,walletCount:y,search:m,setSearch:g,selected:f,setSelected:w}=Wp({walletList:l,walletChainType:c}),[v,x]=r.useState(),[C,b]=r.useState(),[k,E]=r.useState(),A=!f&&!C&&!k,T=A&&(y>6||m.length>0),j=p.find((e=>"wallet_connect_v2"===e.connectorType)),I=r.useCallback((async(t,r)=>{if(t){if(k?.connector===t)return void console.log("Already connecting to this wallet, skipping duplicate attempt");if(x("loading"),"string"==typeof t)return E({connector:t,name:r?.name??"Wallet",icon:r?.icon}),void window.open(t,"_blank");E({connector:t,name:r?.name??t.walletBranding.name??"Wallet",icon:r?.icon??t.walletBranding.icon});try{let r=await t.connect({showPrompt:!0});if(!r)return x("error"),void a?.(new o.PrivyConnectorError("Unable to connect wallet"));x("success"),Np({address:r.address,client:r.walletClientType,appId:u.id}),setTimeout((()=>{e({connector:t,wallet:r})}),Wt)}catch(t){if(console.error("ERROR: ",{e:t}),t?.message?.includes("already pending for origin")||t?.message?.includes("wallet_requestPermissions"))return void console.log("Connection request already pending, maintaining loading state");x("error"),a?.(new o.PrivyConnectorError("Unable to connect wallet"))}}}),[u.id,e,k]),S=r.useCallback((()=>C?(x(void 0),E(void 0),void b(void 0)):k?(x(void 0),void E(void 0)):f?(x(void 0),E(void 0),void w(void 0)):"error"===v||"loading"===v?(x(void 0),void E(void 0)):void t?.()),[C,k,f,v,t]),P=r.useMemo((()=>k?.connector===j&&C&&n.isMobile?`Go to ${k.name} to continue`:k?.connector===j&&C?`Scan code to connect to ${k.name}`:"string"==typeof k?.connector?`Open or install ${k.name}`:f&&!k?"Select network":k?null:"Select your wallet"),[k,C,f,j]);return{selected:f,setSelected:w,qrUrl:C,setQrUrl:b,connecting:k,uiState:v,search:m,setSearch:g,wallets:h,walletCount:y,wc:j,isInitialConnectView:A,showSearchBar:T,title:P,handleConnect:I,handleBack:S,onClose:i,onConnect:e,app:d}}({...d,walletList:y,walletChainType:h}),M=p.find((e=>"wallet_connect_v2"===e.connectorType)),W=r.useRef(null),F=z.useVirtualizer({count:E.length,getScrollElement:()=>W.current,estimateSize:()=>56,overscan:6,gap:5}),U=r.useCallback((async e=>{let t,r="solana-only"!==h&&e.chains?.some((e=>e.startsWith("eip155"))),n="ethereum-only"!==h&&e.chains?.some((e=>e.startsWith("solana"))),i=Jn[e.id];if(n&&i)t=i.getMobileRedirect({isSolana:!0,connectOnly:!!l,useUniversalLink:!1});else{let r=e.listing?.mobile?.native;t=e.listing?.mobile?.universal||r||e.url}if(r&&n){let r=Cp.normalize(e.id),n=p.filter((e=>Cp.normalize(e.walletClientType)===r&&!("ethereum"===e.chainType&&e instanceof zn||"solana"===e.chainType&&e instanceof si))),i=n.find((e=>"ethereum"===e.chainType)),a=n.find((e=>"solana"===e.chainType));if(!i&&e.listing){let t=xp[e.listing.slug]?{...e.listing,...xp[e.listing.slug]}:e.listing;M.setWalletEntry(t,C),await M.resetConnection(e.id),i=M}if(!a&&t&&(a=t),i||a)return void v({eth:i,sol:a,name:e.label,icon:e.icon})}if(!Fp(e.connector))return"wallet_connect_v2"===e.connector?.connectorType&&(await M.resetConnection(e.id),M.setWalletEntry({id:"wallet_connect_qr",name:"WalletConnect",rdns:"",slug:"wallet-connect",homepage:"",chains:["eip155"],mobile:{native:"",universal:void 0}},C)),void await T(e.connector,{name:e.label,icon:e.icon});if(r||n||e.url||e.listing){if(r&&e.listing){let t=xp[e.listing.slug]?{...e.listing,...xp[e.listing.slug]}:e.listing;M.setWalletEntry(t,C),await M.resetConnection(e.id)}if(r&&n)return void v({eth:M,sol:t,name:e.label,icon:e.icon});if(n)return void await T(t,{name:e.label,icon:e.icon});if(r)return void(e.listing?await T(M,{name:e.label,icon:e.icon}):e.url?await T(e.url,{name:e.label,icon:e.icon}):console.warn("Cannot connect to EVM wallet without connector or listing details:",e.label));if(e.url)return void await T(e.url,{name:e.label,icon:e.icon})}}),[M,T,v,C,j,g,f,S,P,a,i,u,p]),R=m||j,O=!!m||!S;return r.useEffect((()=>{if(!c)return;let e=E.find((({id:e})=>e===c));e&&U(e).catch(console.error)}),[c]),/*#__PURE__*/e.jsxs(qc,{className:t,children:[/*#__PURE__*/e.jsx(qc.Header,{icon:b&&!x||x&&n.isMobile&&b?.icon?b.icon:b?void 0:vp,iconVariant:b&&!x||x&&n.isMobile?"loading":void 0,iconLoadingStatus:b&&!x||x&&n.isMobile?{success:"success"===k,fail:"error"===k}:void 0,title:b&&!x?`Waiting for ${b.name}`:x&&n.isMobile?`Waiting for ${b?.name??"connection"}`:P,subtitle:b&&!x&&"string"==typeof b.connector?`To connect to ${b.name}, install and open the app. Then confirm the connection when prompted.`:b&&!x&&"string"!=typeof b.connector?"error"===k?"Please try connecting again.":"For the best experience, connect only one wallet at a time.":S?a??(i?/*#__PURE__*/e.jsxs("span",{children:["Connect the wallet with address ",/*#__PURE__*/e.jsx(Dl,{address:i})," ",f?.name?`to ${f.name}.`:"."]}):f?`Connect a wallet to your ${f.name} account`:null):null,showBack:O,showClose:!0,onBack:R,onClose:g}),/*#__PURE__*/e.jsxs(qc.Body,{ref:W,$colorScheme:u.appearance.palette.colorScheme,style:{marginBottom:x?"0.5rem":void 0},children:[I&&/*#__PURE__*/e.jsx(Op,{children:/*#__PURE__*/e.jsxs(gp,{style:{background:"transparent"},children:[/*#__PURE__*/e.jsx(Ca,{children:/*#__PURE__*/e.jsx(B.MagnifyingGlassIcon,{})}),/*#__PURE__*/e.jsx("input",{className:"login-method-button",type:"text",placeholder:"Search wallets",onChange:e=>N(e.target.value),value:_})]})}),x&&n.isMobile&&"loading"===k&&/*#__PURE__*/e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:/*#__PURE__*/e.jsx(yo,{variant:"primary",onClick:()=>window.open(x.universal??x.native,"_blank"),style:{width:"100%"},children:"Open in app"})}),x&&!n.isMobile&&"loading"===k&&/*#__PURE__*/e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:/*#__PURE__*/e.jsx($p,{value:x.universal??x.native,iconOnly:!0,children:"Copy link"})}),x&&!n.isMobile&&/*#__PURE__*/e.jsx(hp,{size:280,url:x.universal??x.native,squareLogoElement:b?.icon?"string"==typeof b.icon?t=>/*#__PURE__*/e.jsx("svg",{...t,children:/*#__PURE__*/e.jsx("image",{href:b.icon,height:t.height,width:t.width})}):b.icon:Ri}),/*#__PURE__*/e.jsxs(Lp,{children:[b&&!x&&"string"==typeof b.connector&&/*#__PURE__*/e.jsxs(Dp,{onClick:()=>window.open(b.connector,"_blank"),children:[b.icon&&("string"==typeof b.icon?/*#__PURE__*/e.jsx(jp,{src:b.icon}):/*#__PURE__*/e.jsx(b.icon,{})),/*#__PURE__*/e.jsx(Hp,{children:b.name})]}),w?.eth&&!b&&/*#__PURE__*/e.jsxs(Dp,{onClick:()=>T(w.eth,{name:w.name,icon:w.icon}),children:[w.icon&&("string"==typeof w.icon?/*#__PURE__*/e.jsx(jp,{src:w.icon}):/*#__PURE__*/e.jsx(w.icon,{})),/*#__PURE__*/e.jsx(Hp,{children:w.name}),/*#__PURE__*/e.jsx(Bp,{children:/*#__PURE__*/e.jsx(bp,{})})]}),w?.sol&&!b&&/*#__PURE__*/e.jsxs(Dp,{onClick:()=>T(w.sol,{name:w.name,icon:w.icon}),children:[w.icon&&("string"==typeof w.icon?/*#__PURE__*/e.jsx(jp,{src:w.icon}):/*#__PURE__*/e.jsx(w.icon,{})),/*#__PURE__*/e.jsx(Hp,{children:w.name}),/*#__PURE__*/e.jsx(Bp,{children:/*#__PURE__*/e.jsx(kp,{})})]}),S&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[!(A>0)&&/*#__PURE__*/e.jsx(zp,{children:"No wallets found. Try another search."}),A>0&&!x&&/*#__PURE__*/e.jsx("div",{style:{maxHeight:56*Math.min(E.length,5)+5,width:"100%"},children:/*#__PURE__*/e.jsx("div",{style:{height:`${F.getTotalSize()}px`,width:"100%",position:"relative"},children:F.getVirtualItems().map((t=>/*#__PURE__*/e.jsx(Up,{index:t.index,style:{position:"absolute",top:0,left:0,height:`${t.size}px`,transform:`translateY(${t.start}px)`},data:{wallets:E,walletChainType:h,handleWalletClick:U}},t.key)))})})]})]})]}),/*#__PURE__*/e.jsxs(qc.Footer,{children:[b&&!x&&"string"!=typeof b.connector&&"error"===k&&/*#__PURE__*/e.jsx(qc.Actions,{children:/*#__PURE__*/e.jsx(yo,{style:{width:"100%",alignItems:"center"},variant:"error",onClick:()=>T(b.connector,{name:b.name,icon:b.icon}),children:"Retry"})}),!!(f&&f.legal.privacyPolicyUrl&&f.legal.termsAndConditionsUrl)&&/*#__PURE__*/e.jsx(ja,{app:f,alwaysShowImplicitConsent:!0}),/*#__PURE__*/e.jsx(qc.Watermark,{})]})]})};let Op=/*#__PURE__*/g.styled.div.withConfig({displayName:"StickySearchContainer",componentId:"sc-271e6fe7-0"})(["position:sticky;margin-top:-3px;padding-top:3px;top:-3px;z-index:1;background:var(--privy-color-background);padding-bottom:calc(var(--screen-space) / 2);"]),Lp=/*#__PURE__*/g.styled.div.withConfig({displayName:"WalletListContainer",componentId:"sc-271e6fe7-1"})(["display:flex;flex-direction:column;gap:","px;"],5),Dp=/*#__PURE__*/g.styled.button.withConfig({displayName:"Button",componentId:"sc-271e6fe7-2"})(["button&{gap:0.5rem;align-items:center;display:flex;position:relative;text-align:left;font-weight:500;transition:background 200ms ease-in;width:calc(100% - 4px);border-radius:var(--privy-border-radius-md);padding:0.75em;border:1px solid var(--privy-color-foreground-4);justify-content:space-between;}&:hover{background:var(--privy-color-background-2);}"]),Bp=/*#__PURE__*/g.styled.span.withConfig({displayName:"ButtonBadge",componentId:"sc-271e6fe7-3"})(["display:flex;align-items:center;justify-content:end;position:relative;& > svg{border-radius:var(--privy-border-radius-full);stroke-width:2.5;width:100%;max-height:1rem;max-width:1rem;flex-shrink:0;}& > svg:not(:last-child){border-radius:var(--privy-border-radius-full);margin-right:-0.375rem;}"]),zp=/*#__PURE__*/g.styled.div.withConfig({displayName:"EmptyContainer",componentId:"sc-271e6fe7-4"})(["height:60px;display:flex;align-items:center;justify-content:center;text-align:center;"]),Hp=/*#__PURE__*/g.styled.span.withConfig({displayName:"WalletName",componentId:"sc-271e6fe7-5"})(["text-overflow:ellipsis;white-space:nowrap;color:var(--privy-color-foreground);font-weight:400;flex:1;"]),$p=/*#__PURE__*/g.styled(ip).withConfig({displayName:"StyledCopyableText",componentId:"sc-271e6fe7-6"})(["&&{margin:0.5rem auto 0 auto;}"]);const qp=({...t})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...t,children:[/*#__PURE__*/e.jsxs("g",{clipPath:"url(#clip0_2856_1743)",children:[/*#__PURE__*/e.jsx("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__*/e.jsx("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__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2856_1743",children:/*#__PURE__*/e.jsx("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),Vp=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>l.isHex(e,{strict:!0}))).map((e=>l.getAddress(e)));return!!t?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&t.includes(e.address))).length};let Kp=/*#__PURE__*/r.createContext({plugins:{current:{}}});const Gp=({children:t})=>{let n=r.useRef({});/*#__PURE__*/return e.jsx(Kp.Provider,{value:{plugins:n},children:t})},Yp=()=>{let{plugins:e}=r.useContext(Kp);return r.useCallback((t=>e.current[t]),[e])},Zp=Symbol("solana-ledger-plugin"),Qp=({title:t="You don't have access to this app",subtitle:r="Have you been invited?",ctaText:n="Try another account",ctaLink:i,onCtaClick:a})=>/*#__PURE__*/e.jsx(Xc,{title:t,subtitle:r,icon:P.Lock,iconVariant:"warning",primaryCta:{label:n,onClick:()=>{i?window.open(i,"_blank"):a?.()}},watermark:!0}),Xp={component:()=>{let{navigate:t,app:r}=Ui(),n=r?.allowlistConfig.errorTitle||"You don't have access to this app",i=r?.allowlistConfig.errorDetail||"Have you been invited?",a=r?.allowlistConfig.errorCtaText||"Try another account",o=r?.allowlistConfig.errorCtaLink;/*#__PURE__*/return e.jsx(Qp,{title:n,subtitle:i,ctaText:a,ctaLink:o??void 0,onCtaClick:()=>{t(om)}})}},Jp=({status:t,title:n,description:i,userIntentRequired:a,retriesRemaining:o,hasSelectedCta:s,onContinue:l,onRetry:c})=>{let d=r.useMemo((()=>{switch(t){case"loading":default:return;case"success":return a?{label:s?"Continuing...":"Continue",onClick:l,disabled:s,loading:s}:void 0;case"error":return o>0?{label:"Retry",onClick:c}:void 0}}),[t,s,l,c]),u=r.useMemo((()=>({loading:"loading",ready:"subtle",disabled:"subtle",success:"success",error:"error"}[t]||"loading")),[t]);/*#__PURE__*/return e.jsx(Xc,{icon:"loading"===t||"ready"===t?void 0:"success"===t?P.CheckCircle:P.XCircle,iconVariant:u,title:n,subtitle:i,primaryCta:d,watermark:!0})},eh={component:()=>{let{lastScreen:t,data:n,navigate:i,setModalData:a}=Ui(),{status:o,token:s,waitForResult:l,reset:c,execute:d}=sn(),u=r.useRef([]),p=e=>{u.current=[e,...u.current]},[h,y]=r.useState(!0);r.useEffect((()=>(p(setTimeout(y,1e3,!1)),()=>{u.current.forEach((e=>clearTimeout(e))),u.current=[]})),[]);let[m,g]=r.useState(""),[f,w]=r.useState("Checking that you are a human..."),[v,x]=r.useState(!1),[C,b]=r.useState(3),k=n?.captchaModalData,E=async e=>{try{await(k?.callback(e)),k?.onSuccessNavigateTo&&i(k?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof an)return;a({errorModalData:{error:e,previousScreen:t||om}}),i(k?.onErrorNavigateTo||Nu,!1)}};r.useEffect((()=>{"success"===o?p(setTimeout((async()=>{let e=await l();!e||k?.userIntentRequired||E(e)}),1e3)):"ready"===o&&p(setTimeout((()=>{"ready"===o&&d()}),500))}),[o]),r.useEffect((()=>{if(!h)switch(o){case"success":g("Success!"),w("CAPTCHA passed successfully."),k?.userIntentRequired||setTimeout((()=>{x(!0),E(s)}),2e3);break;case"loading":g(""),w("Checking that you are a human...");break;case"error":g("Something went wrong"),w(C<=0?"If you use an adblocker or VPN, try disabling and re-attempting.":"You did not pass CAPTCHA. Please try again.")}}),[o,h,v]);/*#__PURE__*/return e.jsx(Jp,{status:o,title:m,description:f,userIntentRequired:k?.userIntentRequired,retriesRemaining:C,hasSelectedCta:v,onContinue:()=>{x(!0),E(s)},onRetry:async()=>{if(C<=0)return;b((e=>e-1)),c(),d();let e=await l();!e||k?.userIntentRequired||E(e)}})}},th=t=>/*#__PURE__*/e.jsx("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"-0.625 12.48 397.647 399.546",width:"2500",height:"674",preserveAspectRatio:"none",...t,children:/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#333745",d:"M 333.9 12.8 L 150.9 12.8 L 150.9 258.4 L 396.5 258.4 L 396.5 76.7 C 396.6 42.2 368.4 12.8 333.9 12.8 Z M 94.7 12.8 L 64 12.8 C 29.5 12.8 0 40.9 0 76.8 L 0 107.5 L 94.7 107.5 L 94.7 12.8 Z M 0 165 L 94.7 165 L 94.7 259.7 L 0 259.7 L 0 165 Z M 301.9 410.6 L 332.6 410.6 C 367.1 410.6 396.6 382.5 396.6 346.6 L 396.6 316 L 301.9 316 L 301.9 410.6 Z M 150.9 316 L 245.6 316 L 245.6 410.7 L 150.9 410.7 L 150.9 316 Z M 0 316 L 0 346.7 C 0 381.2 28.1 410.7 64 410.7 L 94.7 410.7 L 94.7 316 L 0 316 Z"})})}),rh=({onContinueWithLedger:t,onContinueWithoutLedger:r,title:n="Phantom supports Ledger",subtitle:i="Are you using a Ledger hardware wallet?\nContinue to sign with Ledger"})=>/*#__PURE__*/e.jsx(Xc,{title:n,subtitle:/*#__PURE__*/e.jsx(ah,{children:i}),primaryCta:{label:"Continue with Ledger",onClick:t},secondaryCta:{label:"Continue without Ledger",onClick:r},watermark:!0,children:/*#__PURE__*/e.jsxs(ih,{children:[/*#__PURE__*/e.jsx(qn,{style:{width:"48px",height:"48px"}}),/*#__PURE__*/e.jsx(P.ArrowRightLeft,{strokeWidth:2,color:"var(--privy-color-icon-subtle)",width:22,height:22}),/*#__PURE__*/e.jsx(th,{style:{width:"48px",height:"48px"}})]})});const nh={component:function(){let{data:t,setModalData:r,navigate:n}=Ui();/*#__PURE__*/return e.jsx(rh,{onContinueWithLedger:function(){r({...t,login:{...t?.login,isSigningInWithLedgerSolana:!0}}),n(uh)},onContinueWithoutLedger:function(){r({...t,login:{...t?.login,isSigningInWithLedgerSolana:!1}}),n(uh)}})}};let ih=/*#__PURE__*/g.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-218811f1-0"})(["display:flex;align-items:center;justify-content:center;gap:8px;margin-bottom:var(--screen-space);"]),ah=/*#__PURE__*/g.styled.span.withConfig({displayName:"SubtitleText",componentId:"sc-218811f1-1"})(["white-space:pre-wrap;"]);const oh=({style:t,...r})=>/*#__PURE__*/e.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...t},...r,children:/*#__PURE__*/e.jsx("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"})}),sh=({title:t="Unable to sign in",subtitle:r="This is a test application that has reached its user limit. To allow more users, this app needs to be upgraded to production.",onGoBack:n})=>/*#__PURE__*/e.jsx(Xc,{title:t,subtitle:r,icon:oh,iconVariant:"subtle",primaryCta:{label:"Go back",onClick:n},showBack:!0,onBack:n,watermark:!0}),lh={component:()=>{let{navigate:t}=Ui();/*#__PURE__*/return e.jsx(sh,{onGoBack:()=>{t(om)}})}},ch=e=>e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER?En.ERROR_USER_EXISTS:e instanceof kn&&!e.details.default?e.details:e instanceof vn?En.ERROR_TIMED_OUT:e instanceof xn?En.ERROR_USER_REJECTED_CONNECTION:e?.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE?En.ERROR_USER_LIMIT_REACHED:En.ERROR_WALLET_CONNECTION,dh=({walletLogo:t,title:r,subtitle:n,signSuccess:i,errorMessage:a,connectSuccess:o,separateConnectAndSign:s,signing:l,walletConnectRedirectUri:c,walletConnectFallbackUniversalUri:d,hasTabbedAway:u,showCoinbaseWalletResetCta:p,numRetries:h,onBack:y,onSign:m,onRetry:g,onCoinbaseReset:f,onDifferentWallet:w})=>{let v=p?{label:"Use a different wallet",onClick:f,disabled:i}:a===En.ERROR_USER_EXISTS&&y?{label:"Use a different wallet",onClick:w}:o&&!i&&s?{label:l?"Signing":"Sign with your wallet",onClick:m,disabled:l}:!i&&a?.retryable&&h<2?{label:"Retry",onClick:g,disabled:!1}:i||a?void 0:{label:"Connecting",onClick:()=>{},disabled:!0};/*#__PURE__*/return e.jsx(Xc,{title:r,subtitle:n,icon:t,iconVariant:"loading",iconLoadingStatus:{success:i,fail:!!a},primaryCta:v,onBack:y,watermark:!0,children:!o&&c&&!u&&/*#__PURE__*/e.jsxs(ph,{children:["Still here?"," ",/*#__PURE__*/e.jsx(hu,{href:c,target:"_blank",variant:"underlined",size:"sm",children:"Try connecting again"}),d&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[" ","or"," ",/*#__PURE__*/e.jsx(hu,{href:d,target:"_blank",variant:"underlined",size:"sm",children:"use this different link"})]})]})})},uh={component:()=>{let t,[i,a]=r.useState(!1),[l,c]=r.useState(!1),[d,p]=r.useState(void 0),{authenticated:h,logout:y}=u.usePrivyContext(),{app:m,navigate:g,navigateBack:f,lastScreen:w,currentScreen:v,setModalData:x,data:C}=Ui(),{getAuthFlow:b,walletConnectionStatus:k,closePrivyModal:E,initLoginWithWallet:A,loginWithWallet:T,updateWallets:j,createAnalyticsEvent:I}=s.usePrivyInternal(),{walletConnectors:S}=u.usePrivyContext(),[P,_]=r.useState(0),{user:N}=u.usePrivyContext(),M=Yp(),[W]=r.useState(N?.linkedAccounts.length||0),[F,U]=r.useState(""),[R,O]=r.useState(""),[L,D]=r.useState(!1),{hasTabbedAway:B}=function(){let[e,t]=r.useState(!1),n=r.useCallback((()=>{document.hidden&&t(!0)}),[]);return r.useEffect((()=>(document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n))),[n]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:z,token:H}=sn(),$=ui(k?.connector?.walletClientType||"unknown"),q=n.isMobile&&"wallet_connect_v2"===k?.connector?.connectorType||n.isMobile&&"coinbase_wallet"===k?.connector?.connectorType||n.isMobile&&"base_account"===k?.connector?.connectorType||n.isMobile&&"injected"===k?.connector?.connectorType&&"phantom"===k?.connector?.walletClientType,V="connected"===k?.status,K="switching_to_supported_chain"===k?.status;r.useEffect((()=>{let e=b(),t=e instanceof Wr||e instanceof Rr?e:void 0;V&&"solana"===k.connector?.chainType&&"phantom"===k.connector?.walletClientType&&M(Zp)&&void 0===C?.login?.isSigningInWithLedgerSolana?g(nh,!1):(V&&!t&&(!z||H||h?A(k.connectedWallet,H,C?.login?.disableSignup,C?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{D(!0)})):(x({captchaModalData:{callback:e=>A(k.connectedWallet,e,C?.login?.disableSignup,C?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{D(!0)})),userIntentRequired:!1,onSuccessNavigateTo:uh,onErrorNavigateTo:Nu}}),g(eh,!1))),t instanceof Rr&&C?.login?.isSigningInWithLedgerSolana&&(t.messageType="transaction"),t&&q&&V&&!t.preparedMessage?t.buildMessage():t&&!q&&V&&(l||(async()=>{c(!0),p(void 0);try{"wallet_connect_v2"===k?.connector?.connectorType&&"metamask"===k?.connector?.walletClientType&&await Gr(2500),await Y()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{c(!1)}})()))}),[P,V,L]),r.useEffect((()=>{if(N&&i){let e=900;if(m?.legal.requireUsersAcceptTerms&&!N.hasAcceptedTerms){let t=setTimeout((()=>{g(Zu)}),e);return()=>clearTimeout(t)}if(wu(N,m.embeddedWallets)){let t=setTimeout((()=>{x({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),I({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),y()},callAuthOnSuccessOnClose:!0}}),g(Yu)}),e);return()=>clearTimeout(t)}j();let t=setTimeout((()=>E({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Wt);return()=>clearTimeout(t)}}),[N,i]);let G=e=>{if(e?.privyErrorCode!==o.PrivyErrorCode.ALLOWLIST_REJECTED){if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),void g(lh);if(e?.privyErrorCode!==o.PrivyErrorCode.USER_DOES_NOT_EXIST)return e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(x({accountTransfer:{nonce:e.data?.data?.nonce,account:b()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:b()?.meta.walletClientType,chainId:b()?.meta.chainId,connectorType:b()?.meta.connectorType},linkMethod:b()instanceof Wr?"siwe":"siws",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void g(qu)):void p(ch(e));g(xu)}else g(Xp)};async function Y(){try{await T(),a(!0)}catch(e){G(e)}finally{c(!1)}}r.useEffect((()=>{k?.connectError&&G(k?.connectError)}),[k]),((e,t)=>{let n=r.useRef((()=>{}));r.useEffect((()=>{n.current=e})),r.useEffect((()=>{if(null!==t){let e=setInterval((()=>n.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===Z&&k?.connector instanceof Li?k.connector.redirectUri:void 0;e&&U(e);let t="wallet_connect_v2"===Z&&k?.connector instanceof Li?k.connector.fallbackUniversalRedirectUri:void 0;t&&O(t)}),k?.connector instanceof Li&&!F?500:null);let Z=k?.connector?.connectorType||"injected",Q=k?.connector?.walletClientType||"unknown",X=$?.metadata?.shortName||$?.name||k?.connector?.walletBranding.name||"Browser Extension",J=$?.image_url?.md||k?.connector?.walletBranding.icon||(t=>/*#__PURE__*/e.jsx(Hn,{...t})),ee="Browser Extension"===X?X.toLowerCase():X;t=i?`Successfully connected with ${ee}`:d?d.message:K?"Switching networks":V?l&&q?"Signing":"Sign to verify":`Waiting for ${ee}`;let te="Don’t see your wallet? Check your other browser windows.";i?te=W===(N?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":P>=2&&d?te="Unable to connect wallet":d?te=d.detail:K?te="Switch your wallet to the requested network.":V&&q?te="Sign the message in your wallet to verify it belongs to you.":"metamask"===Q&&n.isMobile?te="Click continue to open and connect MetaMask.":"metamask"===Q?te="For the best experience, connect only one wallet at a time.":"wallet_connect"===Z?te="Open your mobile wallet app to continue":"coinbase_wallet"===Z?zr()||(te=Vp(N)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue."):C?.login?.isSigningInWithLedgerSolana&&(te="Ledger requires a transaction to verify your identity. You’ll sign a transaction that performs no onchain action.");let re=S?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),ne="coinbase_wallet"===Q&&(Vp(N)||d===En.ERROR_USER_EXISTS);/*#__PURE__*/return e.jsx(dh,{walletLogo:J,title:t,subtitle:te,signSuccess:i,errorMessage:d,connectSuccess:V,separateConnectAndSign:q,signing:l,walletConnectRedirectUri:F,walletConnectFallbackUniversalUri:R,hasTabbedAway:B,showCoinbaseWalletResetCta:ne,numRetries:P,onBack:w&&v!==w?f:void 0,onSign:()=>{c(!0),Y()},onRetry:()=>{_(P+1),p(void 0),V?(c(!0),Y()):k?.connectRetry()},onCoinbaseReset:()=>{re&&re?.disconnect()},onDifferentWallet:f})}};let ph=/*#__PURE__*/g.styled.p.withConfig({displayName:"RedirectLinksContainer",componentId:"sc-36e4fa39-0"})(["text-align:center;color:var(--privy-color-foreground-2);font-size:14px;line-height:22px;margin:16px 0;"]);const hh={component:()=>{let{setWalletConnectionStatus:t,closePrivyModal:n,inProgressAuthFlowRef:i}=s.usePrivyInternal(),{app:a,data:l,navigate:c}=Ui(),d=pa(),u=l?.externalConnectWallet?.description,p=r.useRef(l?.externalConnectWallet?.suggestedAddress).current,h=r.useRef(l?.externalConnectWallet?.walletList??a.appearance.walletList),y=r.useRef(l?.externalConnectWallet?.walletChainType??a.appearance.walletChainType),m=h.current,g=y.current,f="link"===i.current?void 0:()=>c(om);/*#__PURE__*/return e.jsx(Rp,{walletList:m,walletChainType:g,onClose:n,onConnect:r.useCallback((({connector:e,wallet:r})=>{d("connectWallet","onSuccess",{wallet:r}),t({status:"connected",connectedWallet:r,connector:e,connectError:null,connectRetry:()=>null}),c(uh,!l?.externalConnectWallet?.preSelectedWalletId)}),[t,c,l?.login?.disableSignup,l?.externalConnectWallet?.preSelectedWalletId]),onConnectError:e=>{e instanceof o.PrivyError?(console.warn(e.cause?e.cause:e.message),d("connectWallet","onError",e.privyErrorCode||o.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),d("connectWallet","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR))},onBack:f,suggestedAddress:p,customDescription:u||"",preSelectedWalletId:l?.externalConnectWallet?.preSelectedWalletId,app:a})},isUnauthenticatedScreem:!0},yh={component:()=>{let{closePrivyModal:t}=s.usePrivyInternal(),{app:n,data:i}=Ui(),a=pa(),l=i?.externalConnectWallet?.description,c=r.useRef(i?.externalConnectWallet?.suggestedAddress).current,d=r.useRef(i?.externalConnectWallet?.walletList??n.appearance.walletList),u=r.useRef(i?.externalConnectWallet?.walletChainType??n.appearance.walletChainType);/*#__PURE__*/return e.jsx(Rp,{walletList:d.current,walletChainType:u.current,onClose:()=>{a("connectWallet","onError",o.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR),t()},onConnect:({wallet:e})=>{a("connectWallet","onSuccess",{wallet:e}),t()},onConnectError:e=>{e instanceof o.PrivyError?(console.warn(e.cause?e.cause:e.message),a("connectWallet","onError",e.privyErrorCode||o.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),a("connectWallet","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR))},suggestedAddress:c,customDescription:l,app:n})},isUnauthenticatedScreem:!0},mh=({chainType:t,withPadding:r})=>{let n="";return n="ethereum-only"===t||"ethereum-and-solana"===t?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/e.jsx(ka,{$withPadding:r,children:/*#__PURE__*/e.jsxs(Ea,{children:[/*#__PURE__*/e.jsx(_e.default,{style:{color:"var(--privy-color-warn)",height:48,width:48}}),/*#__PURE__*/e.jsx("h3",{children:"No wallets available"}),/*#__PURE__*/e.jsxs("p",{children:["Please download an external wallet provider, like ",n,"."]})]})},"empty-wallet-state")};let gh=/*#__PURE__*/g.keyframes(["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 fh=/*#__PURE__*/g.css(["",""],(e=>e.$isLoading?/*#__PURE__*/g.css(["width:35%;animation:"," 2s linear infinite;border-radius:var(--privy-border-radius-sm);"],gh):"")),wh=({children:t,color:r,isLoading:n,isPulsing:i,...a})=>/*#__PURE__*/e.jsx(vh,{$color:r,$isLoading:n,$isPulsing:i,...a,children:t});let vh=/*#__PURE__*/g.styled.span.withConfig({displayName:"StyledSpan",componentId:"sc-80725f4-0"})(["padding:0.25rem;font-size:0.75rem;font-weight:500;line-height:1rem;border-radius:var(--privy-border-radius-xs);display:flex;align-items:center;"," ",""],(e=>{let t,r;"green"===e.$color&&(t="var(--privy-color-success-dark)",r="var(--privy-color-success-light)"),"red"===e.$color&&(t="var(--privy-color-error)",r="var(--privy-color-error-light)"),"gray"===e.$color&&(t="var(--privy-color-foreground-2)",r="var(--privy-color-background-2)");let n=/*#__PURE__*/g.keyframes(["from,to{background-color:",";}50%{background-color:rgba(",",0.8);}"],r,r);/*#__PURE__*/return g.css(["color:",";background-color:",";",";"],t,r,e.$isPulsing&&/*#__PURE__*/g.css(["animation:"," 3s linear infinite;"],n))}),fh);const xh=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#855DCD"}),/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_1715_1960)",children:[/*#__PURE__*/e.jsx("path",{d:"M4.5 4H28.5V28H4.5V4Z",fill:"#855DCD"}),/*#__PURE__*/e.jsx("path",{d:"M11.1072 8.42105H21.6983V23.5789H20.1437V16.6357H20.1284C19.9566 14.7167 18.3542 13.2129 16.4028 13.2129C14.4514 13.2129 12.849 14.7167 12.6771 16.6357H12.6619V23.5789H11.1072V8.42105Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M8.28943 10.5725L8.92101 12.7239H9.45542V21.4275C9.1871 21.4275 8.96959 21.6464 8.96959 21.9165V22.5032H8.87242C8.60411 22.5032 8.38659 22.7221 8.38659 22.9922V23.5789H13.8279V22.9922C13.8279 22.7221 13.6104 22.5032 13.3421 22.5032H13.2449V21.9165C13.2449 21.6464 13.0274 21.4275 12.7591 21.4275H12.1761V10.5725H8.28943Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M20.2408 21.4275C19.9725 21.4275 19.755 21.6464 19.755 21.9165V22.5032H19.6579C19.3895 22.5032 19.172 22.7221 19.172 22.9922V23.5789H24.6133V22.9922C24.6133 22.7221 24.3958 22.5032 24.1275 22.5032H24.0303V21.9165C24.0303 21.6464 23.8128 21.4275 23.5445 21.4275V12.7239H24.0789L24.7105 10.5725H20.8238V21.4275H20.2408Z",fill:"white"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1715_1960",children:/*#__PURE__*/e.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(4.5 4)"})})})]}),Ch=t=>{let[n,i]=r.useState(!1);/*#__PURE__*/return e.jsx(bh,{color:t.color,href:t.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{i(!0),setTimeout((()=>i(!1)),1500)},justOpened:n,children:t.text})};let bh=/*#__PURE__*/g.styled.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 kh=/*#__PURE__*/g.styled.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;"]);let Eh=/*#__PURE__*/g.styled.div.withConfig({displayName:"Container",componentId:"sc-913deead-0"})(["width:100%;"]),Ah=/*#__PURE__*/g.styled.div.withConfig({displayName:"InputContainer",componentId:"sc-913deead-1"})(["display:flex;align-items:center;justify-content:space-between;gap:0.75rem;padding:0.75rem;height:56px;background:",";border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);&:hover{border-color:",";}"],(e=>e.$disabled?"var(--privy-color-background-2)":"var(--privy-color-background)"),(e=>e.$disabled?"var(--privy-color-foreground-4)":"var(--privy-color-foreground-3)")),Th=/*#__PURE__*/g.styled.div.withConfig({displayName:"TextContainer",componentId:"sc-913deead-2"})(["flex:1;min-width:0;display:flex;align-items:center;"]),jh=/*#__PURE__*/g.styled.span.withConfig({displayName:"Text",componentId:"sc-913deead-3"})(["display:block;font-size:16px;line-height:24px;color:",";overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;word-break:break-all;@media (min-width:441px){font-size:14px;line-height:20px;}"],(e=>e.$disabled?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)")),Ih=/*#__PURE__*/g.styled(jh).withConfig({displayName:"PlaceholderText",componentId:"sc-913deead-4"})(["color:var(--privy-color-foreground-3);font-style:italic;"]),Sh=/*#__PURE__*/g.styled(kh).withConfig({displayName:"TitleLabel",componentId:"sc-913deead-5"})(["margin-bottom:0.5rem;"]),Ph=/*#__PURE__*/g.styled(xo).withConfig({displayName:"CopyButton",componentId:"sc-913deead-6"})(["&&{gap:0.375rem;font-size:14px;flex-shrink:0;}"]);const _h=({value:t,title:n,placeholder:i,className:a,showCopyButton:o=!0,truncate:s,maxLength:l=40,disabled:c=!1})=>{let[d,u]=r.useState(!1),p=s&&t?((e,t,r)=>{if((e=e.startsWith("https://")?e.slice(8):e).length<=r)return e;if("middle"===t){let t=Math.ceil(r/2)-2,n=Math.floor(r/2)-1;return`${e.slice(0,t)}...${e.slice(-n)}`}return`${e.slice(0,r-3)}...`})(t,s,l):t;return r.useEffect((()=>{if(d){let e=setTimeout((()=>u(!1)),3e3);return()=>clearTimeout(e)}}),[d]),/*#__PURE__*/e.jsxs(Eh,{className:a,children:[n&&/*#__PURE__*/e.jsx(Sh,{children:n}),/*#__PURE__*/e.jsxs(Ah,{$disabled:c,children:[/*#__PURE__*/e.jsx(Th,{children:t?/*#__PURE__*/e.jsx(jh,{$disabled:c,title:t,children:p}):/*#__PURE__*/e.jsx(Ih,{$disabled:c,children:i||"No value"})}),o&&t&&/*#__PURE__*/e.jsx(Ph,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(t).then((()=>u(!0))).catch(console.error)},size:"sm",children:d?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(P.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(P.Copy,{size:14})]})})]})]})},Nh=({connectUri:t,loading:r,success:i,errorMessage:a,onBack:o,onClose:s,onOpenFarcaster:l})=>n.isMobile||r?n.isIOS?/*#__PURE__*/e.jsx(Xc,{title:a?a.message:"Sign in with Farcaster",subtitle:a?a.detail:"To sign in with Farcaster, please open the Farcaster app.",icon:xh,iconVariant:"loading",iconLoadingStatus:{success:i,fail:!!a},primaryCta:t&&l?{label:"Open Farcaster app",onClick:l}:void 0,onBack:o,onClose:s,watermark:!0}):/*#__PURE__*/e.jsx(Xc,{title:a?a.message:"Signing in with Farcaster",subtitle:a?a.detail:"This should only take a moment",icon:xh,iconVariant:"loading",iconLoadingStatus:{success:i,fail:!!a},onBack:o,onClose:s,watermark:!0,children:t&&n.isMobile&&/*#__PURE__*/e.jsx(Wh,{children:/*#__PURE__*/e.jsx(Ch,{text:"Take me to Farcaster",url:t,color:"#8a63d2"})})}):
|
|
24
|
+
/*#__PURE__*/e.jsx(Xc,{title:"Sign in with Farcaster",subtitle:"Scan with your phone's camera to continue.",onBack:o,onClose:s,watermark:!0,children:/*#__PURE__*/e.jsxs(Fh,{children:[/*#__PURE__*/e.jsx(Uh,{children:t?/*#__PURE__*/e.jsx(hp,{url:t,size:275,squareLogoElement:xh}):/*#__PURE__*/e.jsx(Lh,{children:/*#__PURE__*/e.jsx(co,{})})}),/*#__PURE__*/e.jsxs(Rh,{children:[/*#__PURE__*/e.jsx(Oh,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),t&&/*#__PURE__*/e.jsx(_h,{value:t,truncate:"end",maxLength:30,showCopyButton:!0,disabled:!0})]})]})}),Mh={component:()=>{let{authenticated:t,logout:n,ready:i,user:a}=u.usePrivyContext(),{lastScreen:l,navigate:c,navigateBack:d,setModalData:p,app:h}=Ui(),{getAuthFlow:y,loginWithFarcaster:m,closePrivyModal:g,createAnalyticsEvent:f}=s.usePrivyInternal(),[w,v]=r.useState(void 0),[x,C]=r.useState(!1),[b,k]=r.useState(!1),E=r.useRef([]),A=y(),T=A?.meta.connectUri;return r.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{let r=await A.pollForReady.execute(),n=Date.now()-e;if(r){clearInterval(t),C(!0);try{await m(),k(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED)return void c(Xp);if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),void c(lh);if(e?.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return void c(xu);if(e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER)t.detail=e.message??"This account has already been linked to another user.";else{if(e?.privyErrorCode===o.PrivyErrorCode.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 c(qu);e?.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}v(t)}}else n>12e4&&(clearInterval(t),v({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),E.current.forEach((e=>clearTimeout(e)))}}),[]),r.useEffect((()=>{if(i&&t&&b&&a){if(h?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{c(Zu)}),Wt);return()=>clearTimeout(e)}b&&(wu(a,h.embeddedWallets)?E.current.push(setTimeout((()=>{p({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),c(Yu)}),Wt)):E.current.push(setTimeout((()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Wt)))}}),[b,i,t,a]),/*#__PURE__*/e.jsx(Nh,{connectUri:T,loading:x,success:b,errorMessage:w,onBack:l?d:void 0,onClose:g,onOpenFarcaster:()=>{T&&(window.location.href=T)}})}};let Wh=/*#__PURE__*/g.styled.div.withConfig({displayName:"MobileLinkContainer",componentId:"sc-8d74ecf6-0"})(["margin-top:24px;"]),Fh=/*#__PURE__*/g.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-8d74ecf6-1"})(["display:flex;flex-direction:column;align-items:center;gap:24px;"]),Uh=/*#__PURE__*/g.styled.div.withConfig({displayName:"QrContainer",componentId:"sc-8d74ecf6-2"})(["display:flex;align-items:center;justify-content:center;min-height:275px;"]),Rh=/*#__PURE__*/g.styled.div.withConfig({displayName:"InstructionsContainer",componentId:"sc-8d74ecf6-3"})(["display:flex;flex-direction:column;align-items:center;gap:16px;"]),Oh=/*#__PURE__*/g.styled.div.withConfig({displayName:"InstructionText",componentId:"sc-8d74ecf6-4"})(["font-size:0.875rem;text-align:center;color:var(--privy-color-foreground-2);"]),Lh=/*#__PURE__*/g.styled.div.withConfig({displayName:"LoaderWrapper",componentId:"sc-8d74ecf6-5"})(["position:relative;width:82px;height:82px;"]);const Dh=()=>{let[t,n]=r.useState(!1),{currentScreen:i,navigate:a,setModalData:o,data:l}=Ui(),{enabled:c,token:d}=sn(),{initLoginWithFarcaster:u}=s.usePrivyInternal(),{accountType:p}=ou();/*#__PURE__*/return e.jsxs(xa,{onClick:async()=>{n(!0);try{c&&!d?(o({captchaModalData:{callback:e=>u(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:Mh,onErrorNavigateTo:Nu}}),a(eh)):(await u(d,l?.login?.disableSignup),a(Mh))}catch(e){o({errorModalData:{error:e,previousScreen:i||om}}),a(Nu)}finally{n(!1)}},disabled:!1,children:[/*#__PURE__*/e.jsx(xh,{width:32,height:32})," Farcaster",t&&/*#__PURE__*/e.jsx(po,{}),"farcaster"===p&&/*#__PURE__*/e.jsx(Bh,{color:"gray",children:"Recent"})]})};let Bh=/*#__PURE__*/g.styled(wh).withConfig({displayName:"StyledChip",componentId:"sc-c6317ff9-0"})(["margin-left:auto;"]);const zh=({status:t,passkeySignupFlow:r=!1,error:n,onRetry:i})=>/*#__PURE__*/e.jsx(Xc,{title:(()=>{switch(t){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})(),subtitle:/*#__PURE__*/e.jsx($h,{children:(()=>{switch(t){case"loading":return r?"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(n instanceof o.PrivyError){if(n.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(n.privyErrorCode===o.PrivyErrorCode.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."}})()}),icon:P.FingerprintIcon,iconVariant:"loading",iconLoadingStatus:{success:"success"===t,fail:"error"===t},primaryCta:"error"===t&&i?{label:"Retry",onClick:i}:"success"===t?{label:"Continue",disabled:!0}:void 0,watermark:!0}),Hh={component:()=>{let{app:t,data:n,setModalData:i,navigate:a}=Ui(),{loginWithPasskey:o,signupWithPasskey:l,closePrivyModal:c,createAnalyticsEvent:d}=s.usePrivyInternal(),{user:p,logout:h}=u.usePrivyContext(),{passkeySignupFlow:y}=n?.passkeyAuthModalData??{},[m,g]=r.useState("loading"),[f,w]=r.useState(null),v=r.useRef([]),x=e=>{v.current=[e,...v.current]};r.useEffect((()=>()=>{v.current.forEach((e=>clearTimeout(e))),v.current=[]}),[]);let C=async()=>{g("loading");try{y?await l():await o(),g("success")}catch(e){w(e),g("error")}};return r.useEffect((()=>{if("success"===m&&p){if(t?.legal.requireUsersAcceptTerms&&!p.hasAcceptedTerms)return void x(setTimeout((()=>{a(Zu)}),900));if(!wu(p,t?.embeddedWallets))return void x(setTimeout((()=>{c({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),Wt));x(setTimeout((()=>{i({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),d({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"PasskeyStatusScreen"}}),h()},callAuthOnSuccessOnClose:!0}}),a(Yu)}),900))}}),[p,m]),r.useEffect((()=>{C()}),[]),/*#__PURE__*/e.jsx(zh,{status:m,passkeySignupFlow:y,error:f,onRetry:C})}};let $h=/*#__PURE__*/g.styled.span.withConfig({displayName:"SubtitleText",componentId:"sc-ad4f7fb3-0"})(["white-space:pre-wrap;"]);const qh=({title:t="Log in or create a new account?",subtitle:r="Create a new account with a passkey or use a passkey to log in to an existing account.",onSignup:n,onLogin:i})=>/*#__PURE__*/e.jsx(Xc,{title:t,subtitle:r,icon:P.FingerprintIcon,primaryCta:{label:"Create new account",onClick:n},secondaryCta:{label:"Log in with a passkey",onClick:i},watermark:!0}),Vh={component:()=>{let{enabled:t,token:r}=sn(),{navigate:n,setModalData:i}=Ui(),{initSignupWithPasskey:a,initLoginWithPasskey:o}=s.usePrivyInternal();/*#__PURE__*/return e.jsx(qh,{onSignup:async()=>{t&&!r?(i({passkeyAuthModalData:{passkeySignupFlow:!0},captchaModalData:{callback:e=>a({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Hh,onErrorNavigateTo:Nu}}),n(eh)):(await a({withPrivyUi:!0}),i({passkeyAuthModalData:{passkeySignupFlow:!0}}),n(Hh))},onLogin:async()=>{t&&!r?(i({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>o({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Hh,onErrorNavigateTo:Nu}}),n(eh)):(await o({withPrivyUi:!0}),i({passkeyAuthModalData:{passkeySignupFlow:!1}}),n(Hh))}})}},Kh=()=>{let{enabled:t,token:n}=sn(),{navigate:i,setModalData:a,app:o,data:l}=Ui(),{initLoginWithPasskey:c}=s.usePrivyInternal(),d=()=>{o.loginConfig.passkeysForSignupEnabled?i(Vh):(async()=>{t&&!n?(a({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>c({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Hh,onErrorNavigateTo:Nu}}),i(eh)):(await c({withPrivyUi:!0}),a({passkeyAuthModalData:{passkeySignupFlow:!1}}),i(Hh))})()};return 0===r.useMemo((()=>{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.jsxs(xa,{onClick:d,children:[/*#__PURE__*/e.jsx(je.default,{})," Continue with passkey"]}):/*#__PURE__*/e.jsx(hu,{as:"button",onClick:d,size:"sm",variant:"navigation",style:{width:"100%",justifyContent:"center"},children:"I have a passkey"})},Gh=({value:t,onChange:r})=>/*#__PURE__*/e.jsx("select",{value:t,onChange:r,children:a.countryCodesAndNumbers.map((t=>/*#__PURE__*/e.jsxs("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),Yh=/*#__PURE__*/r.forwardRef(((t,n)=>{let{app:i}=Ui(),[o,s]=r.useState(!1),{accountType:l}=ou(),[c,d]=r.useState(""),[u,p]=r.useState(i?.intl.defaultCountry??"US"),h=a.validatePhoneNumber(c,u),y=a.phoneNumberTypingFormatter(u),m=a.getPlaceholderPhoneNumber(u),g=a.getCountryCallingCode(u),f=!h,[w,v]=r.useState(!1),x=g.length,C=e=>{let r=e.target.value;p(r),d(""),t.onChange&&t.onChange({rawPhoneNumber:c,qualifiedPhoneNumber:a.formatPhoneNumber(c,r),countryCode:r,isValid:a.validatePhoneNumber(c,u)})},b=(e,r)=>{try{let n=e.replace(/\D/g,"")===c.replace(/\D/g,"")?e:y.input(e);d(n),t.onChange&&t.onChange({rawPhoneNumber:n,qualifiedPhoneNumber:a.formatPhoneNumber(e,r),countryCode:r,isValid:a.validatePhoneNumber(e,r)})}catch(e){console.error("Error processing phone number:",e)}},k=()=>{v(!0);let e=a.formatPhoneNumber(c,u);t.onSubmit({rawPhoneNumber:c,qualifiedPhoneNumber:e,countryCode:u,isValid:a.validatePhoneNumber(c,u)}).finally((()=>v(!1)))};return r.useEffect((()=>{if(t.defaultValue){let e=a.getPhoneCountryCodeAndNumber(t.defaultValue);y.reset(),C({target:{value:e.countryCode}}),b(e.phone,e.countryCode)}}),[t.defaultValue]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Zh,{children:/*#__PURE__*/e.jsxs(Qh,{$callingCodeLength:x,$stacked:t.stacked,children:[/*#__PURE__*/e.jsx(Gh,{value:u,onChange:C}),/*#__PURE__*/e.jsx("input",{ref:n,id:"phone-number-input",className:"login-method-button",type:"tel",placeholder:m,onFocus:()=>s(!0),onChange:e=>{b(e.target.value,u)},onKeyUp:e=>{"Enter"===e.key&&k()},value:c,autoComplete:"tel"}),"phone"!==l||o||t.hideRecent?t.stacked||t.noIncludeSubmitButton?/*#__PURE__*/e.jsx("span",{}):/*#__PURE__*/e.jsx(Eo,{isSubmitting:w,onClick:k,disabled:f,children:"Submit"}):/*#__PURE__*/e.jsx(wh,{color:"gray",children:"Recent"})]})}),t.stacked&&!t.noIncludeSubmitButton?/*#__PURE__*/e.jsx(go,{loading:w,loadingText:null,onClick:k,disabled:f,children:"Submit"}):null]})}));let Zh=/*#__PURE__*/g.styled.div.withConfig({displayName:"InputContainer",componentId:"sc-f29a1304-0"})(["width:100%;"]),Qh=/*#__PURE__*/g.styled.label.withConfig({displayName:"PhoneNumberInput",componentId:"sc-f29a1304-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;color:var(--privy-color-foreground);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-md);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 Xh=({isEditable:t,setIsEditable:n,defaultValue:i})=>{let a=r.useRef(null),{authenticated:o}=u.usePrivyContext(),{navigate:l,setModalData:c,currentScreen:d,data:p}=Ui(),{initLoginWithSms:h}=s.usePrivyInternal(),{enabled:y,token:m}=sn(),{whatsAppEnabled:g}=Ni();/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(ba,{$if:!t,children:/*#__PURE__*/e.jsx(Yh,{ref:a,onSubmit:async function({qualifiedPhoneNumber:e}){if(!y||m||o)try{await h({phoneNumber:e,captchaToken:m,withPrivyUi:!0,disableSignup:p?.login?.disableSignup}),l(Ey)}catch(e){c({errorModalData:{error:e,previousScreen:d||om}}),l(Nu)}else c({captchaModalData:{callback:t=>h({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:p?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:Ey,onErrorNavigateTo:Nu}}),l(eh)},defaultValue:i})}),/*#__PURE__*/e.jsx(ba,{$if:t,children:/*#__PURE__*/e.jsxs(xa,{onClick:()=>{n(),setTimeout((()=>{a.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(Ca,{children:/*#__PURE__*/e.jsx(P.Smartphone,{})}),"Continue with ",g?"WhatsApp":"SMS"]})})]})};let Jh={apple:{logo:fr,displayName:"Apple"},discord:{logo:wr,displayName:"Discord"},github:{logo:vr,displayName:"GitHub"},google:{logo:Cr,displayName:"Google"},linkedin:{logo:Er,displayName:"LinkedIn"},spotify:{logo:Ar,displayName:"Spotify"},instagram:{logo:br,displayName:"Instagram"},twitter:{logo:jr,displayName:"Twitter"},tiktok:{logo:Tr,displayName:"TikTok"},line:{logo:kr,displayName:"LINE"}};const ey=({provider:t})=>{let{enabled:n,token:i}=sn(),{navigate:a,setModalData:o,data:l}=Ui(),[c,d]=r.useState(!1),{initLoginWithOAuth:u}=s.usePrivyInternal(),{accountType:p}=ou(),h=r.useMemo((()=>p&&"guest"!==p&&"authorization_key"!==p&&"cross_app"!==p?eu(p):null),[p]),{displayName:y,logo:m}=Jh[t];/*#__PURE__*/return e.jsxs(xa,{onClick:()=>{d(!0),setTimeout((()=>{d(!1)}),2e3),n&&!i?(o({captchaModalData:{callback:e=>u(t,e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Nu}}),a(eh)):u(t,void 0,l?.login?.disableSignup)},disabled:c,children:[/*#__PURE__*/e.jsx(Ca,{$fullSize:!0,children:/*#__PURE__*/e.jsx(m,{style:{width:"32px",height:"32px"}})}),y,h?.loginMethod===t&&/*#__PURE__*/e.jsx(ty,{color:"gray",children:"Recent"})]})};let ty=/*#__PURE__*/g.styled(wh).withConfig({displayName:"StyledChip",componentId:"sc-afd4ca87-0"})(["margin-left:auto;"]);function ry(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"512",height:"512",rx:"15%",fill:"#37aee2"}),/*#__PURE__*/e.jsx("path",{fill:"#c8daea",d:"M199 404c-11 0-10-4-13-14l-32-105 245-144"}),/*#__PURE__*/e.jsx("path",{fill:"#a9c9dd",d:"M199 404c7 0 11-4 16-8l45-43-56-34"}),/*#__PURE__*/e.jsx("path",{fill:"#f6fbfe",d:"M204 319l135 99c14 9 26 4 30-14l55-258c5-22-9-32-24-25L79 245c-21 8-21 21-4 26l83 26 190-121c9-5 17-3 11 4"})]})}const ny=({success:t,errorMessage:r,onRetry:n})=>{let i=t?"Successfully connected with Telegram":r?r.message:"Verifying connection to Telegram";/*#__PURE__*/return e.jsx(Xc,{title:i,subtitle:t?"You're good to go!":r?r.detail:"Just a few moments more",icon:ry,iconVariant:"loading",iconLoadingStatus:{success:t,fail:!!r},secondaryCta:r?.retryable&&n?{label:"Retry",onClick:n}:void 0,watermark:!0})},iy={component:()=>{let{authenticated:t,logout:n,ready:i,user:a}=u.usePrivyContext(),{app:l,setModalData:c,navigate:d,resetNavigation:p,data:h}=Ui(),{initLoginWithTelegram:y,loginWithTelegram:m,updateWallets:g,setReadyToTrue:f,closePrivyModal:w,createAnalyticsEvent:v,getAuthMeta:x}=s.usePrivyInternal(),[C,b]=r.useState(!1),[k,E]=r.useState(void 0),A=sn();async function T(){try{let e=await async function(){let e;if(!t){if(A.enabled&&"error"===A.status)throw new an(A.error,null,o.PrivyErrorCode.CAPTCHA_FAILURE);return A.enabled&&"success"!==A.status&&(A.execute(),e=await A.waitForResult()),e}}();await m({captchaToken:e}),b(!0),f(!0)}catch(e){if(e?.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED)return E(void 0),p(),void d(Xp);if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),E(void 0),p(),void d(lh);if(e?.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return E(void 0),p(),void d(xu);if(e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return E(void 0),p(),c({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:x()?.telegramAuthResult,telegramWebAppData:x()?.telegramWebAppData,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void d(qu);let{retryable:t,detail:r}=cn(e);E({retryable:t,detail:r,message:"Authentication failed"})}}r.useEffect((()=>{T()}),[]),r.useEffect((()=>{if(!(i&&t&&C&&a))return;if(l?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{d(Zu)}),Wt);return()=>clearTimeout(e)}if(wu(a,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"}}),n()},callAuthOnSuccessOnClose:!0}}),d(Yu)}),Wt);return()=>clearTimeout(e)}g();let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Wt);return()=>clearTimeout(e)}),[i,t,C,a]);/*#__PURE__*/return e.jsx(ny,{success:C,errorMessage:k,onRetry:k?.retryable?async()=>{try{E(void 0),h?.telegramAuthModalData?.seamlessAuth||await y(void 0,h?.login?.disableSignup),await T()}catch(e){let{retryable:t,detail:r}=cn(e);E({retryable:t,detail:r,message:"Authentication failed"})}}:void 0})},isCaptchaRequired:!0},ay=()=>{let{enabled:t,token:n}=sn(),{navigate:i,setModalData:a,data:o}=Ui(),[l,c]=r.useState(!1),{initLoginWithTelegram:d}=s.usePrivyInternal(),{accountType:u}=ou();async function p(e){try{await d(e,o?.login?.disableSignup),a({telegramAuthModalData:{seamlessAuth:!1}}),i(iy)}catch(e){console.error(e),c(!1)}}/*#__PURE__*/return e.jsxs(xa,{onClick:async function(){if(c(!0),t&&!n)return a({captchaModalData:{callback:p,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Nu}}),void i(eh);await p(n)},disabled:l,children:[/*#__PURE__*/e.jsx(ry,{width:32,height:32}),"Telegram","telegram"===u&&/*#__PURE__*/e.jsx(oy,{color:"gray",children:"Recent"})]})};let oy=/*#__PURE__*/g.styled(wh).withConfig({displayName:"StyledChip",componentId:"sc-4b233cf1-0"})(["margin-left:auto;"]);const sy=({onClick:t,text:r})=>/*#__PURE__*/e.jsxs(xa,{onClick:t,children:[/*#__PURE__*/e.jsx(Ca,{children:/*#__PURE__*/e.jsx(P.Wallet,{})}),/*#__PURE__*/e.jsx(ya,{children:r})]}),ly=({onClick:t,text:r,icon:n})=>/*#__PURE__*/e.jsxs(xa,{onClick:t,children:[/*#__PURE__*/e.jsx(Ca,{children:n}),/*#__PURE__*/e.jsx(ya,{children:r})]}),cy=({connectOnly:t})=>{let{closePrivyModal:n}=s.usePrivyInternal(),{data:i,setModalData:o,onUserCloseViaDialogOrKeybindRef:l,navigate:c}=Ui(),d=Ni(),u=i?.login,p=d.appearance.walletList,h=u?.walletChainType??d.appearance.walletChainType,{accountType:y,walletClientType:m,chainType:g}=ou(),{wallets:f}=Wp({walletList:p,walletChainType:h}),w=r.useMemo((()=>y&&"guest"!==y&&"authorization_key"!==y&&"cross_app"!==y?eu(y):null),[y]),{email:v,sms:x,google:C,twitter:b,discord:k,github:E,spotify:A,instagram:T,tiktok:j,line:I,linkedin:S,apple:P,wallet:_,farcaster:N,telegram:M}=r.useMemo((()=>u?.loginMethods?a.toObjectKeys(u.loginMethods,!0):null),[u])??d.loginMethods,{passkey:W}=d.loginMethods,F=[v&&"email",x&&"sms",C&&"google",b&&"twitter",k&&"discord",E&&"github",A&&"spotify",T&&"instagram",j&&"tiktok",I&&"line",S&&"linkedin",P&&"apple",N&&"farcaster",M&&"telegram"].filter((e=>!!e)),U=F.length>0,R=r.useMemo((()=>_&&!U?"web3-first":_&&d?.appearance.loginGroupPriority||"web2-first"),[_,U,d?.appearance.loginGroupPriority]),O=d?.appearance.hideDirectWeb2Inputs,[L,D]=r.useState("default"),[B,z]=r.useState(my({mostRecentlyUsedAccountType:y,smsAvailable:x,emailAvailable:v,prefilledType:u?.prefill?.type}));r.useEffect((()=>{z(my({mostRecentlyUsedAccountType:y,smsAvailable:x,emailAvailable:v,prefilledType:u?.prefill?.type}))}),[v,x,y]);let H=()=>{n({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{D("default")}),150)};l.current=H;let $=[];m&&_?$.push(m):w?.loginMethod&&F.includes(w.loginMethod)&&$.push(w.loginMethod);let q=r=>{if("email"===r)/*#__PURE__*/return e.jsx(Fy,{isEditable:"email"===B,setIsEditable:()=>{z("email")},defaultValue:"email"===u?.prefill?.type?u.prefill.value:void 0},r);if("sms"===r)/*#__PURE__*/return e.jsx(Xh,{isEditable:"sms"===B,setIsEditable:()=>{z("sms")},defaultValue:"phone"===u?.prefill?.type?u.prefill.value:void 0},r);if("apple"===r)/*#__PURE__*/return e.jsx(ey,{provider:"apple"},r);if("discord"===r)/*#__PURE__*/return e.jsx(ey,{provider:"discord"},r);if("farcaster"===r)/*#__PURE__*/return e.jsx(Dh,{},r);if("github"===r)/*#__PURE__*/return e.jsx(ey,{provider:"github"},r);if("google"===r)/*#__PURE__*/return e.jsx(ey,{provider:"google"},r);if("linkedin"===r)/*#__PURE__*/return e.jsx(ey,{provider:"linkedin"},r);if("tiktok"===r)/*#__PURE__*/return e.jsx(ey,{provider:"tiktok"},r);if("line"===r)/*#__PURE__*/return e.jsx(ey,{provider:"line"},r);if("spotify"===r)/*#__PURE__*/return e.jsx(ey,{provider:"spotify"},r);if("instagram"===r)/*#__PURE__*/return e.jsx(ey,{provider:"instagram"},r);if("twitter"===r)/*#__PURE__*/return e.jsx(ey,{provider:"twitter"},r);if("telegram"===r)/*#__PURE__*/return e.jsx(ay,{},r);let n=f.findIndex((({id:e})=>e===Cp.normalize(r))),i="solana"===g?"solana-only":"ethereum-only";/*#__PURE__*/return e.jsx(Up,{recent:!0,index:n,data:{wallets:f,walletChainType:i,handleWalletClick(e){o((t=>({...t,externalConnectWallet:{walletList:p,walletChainType:i,preSelectedWalletId:e.id}}))),c(t?yh:hh)}}})},V=f.filter((e=>e.id!==Cp.normalize(m||""))),K=V.map(((r,n)=>/*#__PURE__*/e.jsx(Up,{index:n,data:{walletChainType:h,wallets:V,handleWalletClick(e){o((t=>({...t,externalConnectWallet:{walletList:p,walletChainType:h,preSelectedWalletId:e.id}}))),c(t?yh:hh)}}},r.id))),G=F.filter((e=>e!==w?.loginMethod)).flatMap(q),Y=$.flatMap(q);"web3-first"===R&&"default"===L?K.unshift(...Y):"web2-first"===R&&G.unshift(...Y);let Z="web2-overflow"===L?()=>D("default"):void 0,Q=F.filter((e=>"email"!==e&&"sms"!==e)),X=py({priority:R,email:v,sms:x,social:Q}),J=hy({priority:R,email:v,sms:x,social:Q}),ee=/*#__PURE__*/e.jsx(sy,{text:yy({priority:R}),onClick:()=>{o({...i,externalConnectWallet:{walletChainType:u?.walletChainType??d.appearance.walletChainType}}),c(hh)}}),te=/*#__PURE__*/e.jsx(ly,{text:X,icon:J,onClick:()=>D("web2-overflow")}),re=O?0:1,ne=_&&K.length>0,ie=0===G.length&&_&&0===K.length,ae=5-(ne?1:0),oe="default"===L&&d?.appearance.logo,se="default"===L&&d.appearance.loginMessage;/*#__PURE__*/return e.jsxs(Xc,{title:d.appearance.landingHeader,icon:oe?/*#__PURE__*/e.jsx(su,{}):void 0,iconVariant:oe?"logo":void 0,onClose:H,showClose:!0,onBack:Z,showBack:!!Z,helpText:d||W&&"default"===L?/*#__PURE__*/e.jsxs(e.Fragment,{children:[W&&"default"===L&&/*#__PURE__*/e.jsx(Kh,{}),d&&/*#__PURE__*/e.jsx(ja,{app:d})]}):void 0,watermark:!0,children:[se&&("string"==typeof d.appearance.loginMessage?/*#__PURE__*/e.jsx(dy,{children:d.appearance.loginMessage}):/*#__PURE__*/e.jsx(uy,{children:d.appearance.loginMessage})),/*#__PURE__*/e.jsx(fa,{$colorScheme:d.appearance.palette.colorScheme,children:"default"===L&&"web2-first"===R?/*#__PURE__*/e.jsxs(e.Fragment,{children:[G.length>ae?G.slice(0,ae-1):G,G.length>ae&&te,ne&&ee,ie&&/*#__PURE__*/e.jsx(mh,{chainType:d.appearance.walletChainType})]}):"default"===L&&"web3-first"===R?/*#__PURE__*/e.jsxs(e.Fragment,{children:[_&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[K.length>ae?K.slice(0,ae-1):K,K.length>ae&&ee]}),G.length>re&&te,G.length===re&&G[0],ie&&/*#__PURE__*/e.jsx(mh,{chainType:d.appearance.walletChainType})]}):"web2-overflow"===L?/*#__PURE__*/e.jsx(e.Fragment,{children:"web3-first"===R?G:G.slice(3)}):null})]})};let dy=/*#__PURE__*/g.styled.div.withConfig({displayName:"StyledSubtitle",componentId:"sc-a0c826dc-0"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),uy=/*#__PURE__*/g.styled.div.withConfig({displayName:"MessageContainer",componentId:"sc-a0c826dc-1"})(["margin-bottom:24px;"]),py=({priority:e,email:t,sms:r,social:n})=>"web2-first"===e?"Other socials":t&&r&&n.length>0||t&&n.length>0?"Log in with email or socials":r&&n.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",hy=({priority:t,email:r,sms:n,social:i})=>"web2-first"===t||i.length>0?/*#__PURE__*/e.jsx(P.UserCircle,{}):r&&n?/*#__PURE__*/e.jsx(qp,{}):r?/*#__PURE__*/e.jsx(P.Mail,{}):n?/*#__PURE__*/e.jsx(P.Smartphone,{}):null,yy=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets";const my=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:r,prefilledType:n})=>r&&("email"===e&&"phone"!==n||"email"===n)||!t||"phone"!==e&&"phone"!==n?"email":"sms",gy={component:()=>{let{app:t}=Ui();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/e.jsx(nm,{connectOnly:!0}):/*#__PURE__*/e.jsx(cy,{connectOnly:!0})}},fy=({contactMethod:t,authFlow:i,appName:a="Privy",whatsAppEnabled:o=!1,onBack:s,onCodeSubmit:l,onResend:c,errorMessage:d,success:u=!1,resendCountdown:p=0,onInvalidInput:h,onClearError:y})=>{let[m,g]=r.useState(vy);r.useEffect((()=>{d||g(vy)}),[d]);let f="email"===i?/*#__PURE__*/e.jsxs("span",{children:["Please check ",/*#__PURE__*/e.jsx(Py,{children:t})," for an email from privy.io and enter your code below."]}):/*#__PURE__*/e.jsxs("span",{children:["Please check ",/*#__PURE__*/e.jsx(Py,{children:t})," for a",o?" WhatsApp":""," message from ",a," and enter your code below."]}),w=/*#__PURE__*/e.jsxs(Iy,{children:[/*#__PURE__*/e.jsxs("span",{children:["Didn't get ","email"===i?"an email":"a message","?"]}),p?/*#__PURE__*/e.jsxs(Sy,{children:[/*#__PURE__*/e.jsx(Le.default,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),/*#__PURE__*/e.jsx("span",{children:"Code sent"})]}):/*#__PURE__*/e.jsx(hu,{as:"button",size:"sm",onClick:c,children:"Resend code"})]}),v=async e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return void h?.("Code should be numeric");y?.();let r=Number(e.currentTarget.name?.charAt(5)),n=[...t||[""]].slice(0,wy-r),i=[...m.slice(0,r),...n,...m.slice(r+n.length)];g(i);let a=Math.min(Math.max(r+n.length,0),wy-1);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${a}]`);e?.focus()}if(i.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${a}]`);e?.blur(),await(l?.(i.join("")))}};/*#__PURE__*/return e.jsx(Xc,{title:"Enter confirmation code",subtitle:f,icon:"email"===i?De.default:Ie.default,onBack:s,showBack:!0,helpText:w,children:/*#__PURE__*/e.jsx(Ay,{children:/*#__PURE__*/e.jsx(ps,{children:/*#__PURE__*/e.jsxs(Ty,{children:[/*#__PURE__*/e.jsx("div",{children:m.map(((t,r)=>/*#__PURE__*/e.jsx("input",{name:`code-${r}`,type:"text",value:m[r],onChange:v,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(y?.(),g([...m.slice(0,e),"",...m.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(r)},inputMode:"numeric",autoFocus:0===r,pattern:"[0-9]",className:`${u?"success":""} ${d?"fail":""}`,autoComplete:n.isMobile?"one-time-code":"off"},r)))}),/*#__PURE__*/e.jsx(jy,{$fail:!!d,$success:u,children:/*#__PURE__*/e.jsx("span",{children:"Invalid or expired verification code"===d?"Incorrect code":d||(u?"Success!":"")})})]})})})})};let wy=6,vy=Array(6).fill("");var xy,Cy,by=((xy=by||{})[xy.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",xy[xy.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",xy),ky=((Cy=ky||{})[Cy.EMAIL=0]="EMAIL",Cy[Cy.SMS=1]="SMS",Cy);const Ey={component:()=>{let{app:t,navigate:n,lastScreen:i,navigateBack:a,setModalData:l,onUserCloseViaDialogOrKeybindRef:c}=Ui(),{closePrivyModal:d,resendEmailCode:p,resendSmsCode:h,getAuthMeta:y,loginWithCode:m,updateWallets:g,createAnalyticsEvent:f}=s.usePrivyInternal(),{authenticated:w,logout:v,user:x}=u.usePrivyContext(),{whatsAppEnabled:C}=Ni(),[b,k]=r.useState(!1),[E,A]=r.useState(null),[T,j]=r.useState(null),[I,S]=r.useState(0);c.current=()=>null;let P=y()?.email?0:1,_=0===P?y()?.email||"":y()?.phoneNumber||"";r.useEffect((()=>{if(I){let e=setTimeout((()=>{S(I-1)}),1e3);return()=>clearTimeout(e)}}),[I]),r.useEffect((()=>{if(w&&b&&x){if(t?.legal.requireUsersAcceptTerms&&!x.hasAcceptedTerms){let e=setTimeout((()=>{n(Zu)}),900);return()=>clearTimeout(e)}if(wu(x,t.embeddedWallets)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),v()},callAuthOnSuccessOnClose:!0}}),n(Yu)}),900);return()=>clearTimeout(e)}{g();let e=setTimeout((()=>d({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Wt);return()=>clearTimeout(e)}}}),[w,b,x]),r.useEffect((()=>{if(E&&0===T){let e=setTimeout((()=>{A(null),j(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[E,T]);/*#__PURE__*/return e.jsx(fy,{contactMethod:_,authFlow:0===P?"email":"sms",appName:t?.name,whatsAppEnabled:C,onBack:()=>a(),onCodeSubmit:async e=>{try{await m(e),k(!0)}catch(e){if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS)A("Invalid or expired verification code"),j(0);else if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)A(e.message);else{if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),void n(lh);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return void n(xu);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER)return l({errorModalData:{error:e,previousScreen:i??Ey}}),void n(Nu,!1);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.DISALLOWED_PLUS_EMAIL)return l({inlineError:{error:e}}),void n(gy,!1);if(e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return l({accountTransfer:{nonce:e.data?.data?.nonce,account:_,displayName:e.data?.data?.account?.displayName,linkMethod:0===P?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void n(qu);A("Issue verifying code"),j(0)}}},onResend:async()=>{S(30),0===P?await p():await h()},errorMessage:E||void 0,success:b,resendCountdown:I,onInvalidInput:e=>{A(e),j(1)},onClearError:()=>{1===T&&(A(null),j(null))}})}};let Ay=/*#__PURE__*/g.styled.div.withConfig({displayName:"PasswordlessCodeContainer",componentId:"sc-5dd8bc26-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:auto;gap:16px;flex-grow:1;width:100%;"]),Ty=/*#__PURE__*/g.styled.div.withConfig({displayName:"CodeInput",componentId:"sc-5dd8bc26-1"})(["display:flex;flex-direction:column;width:100%;gap:12px;> div:first-child{display:flex;justify-content:center;gap:0.5rem;width:100%;border-radius:var(--privy-border-radius-sm);> input{border:1px solid var(--privy-color-foreground-4);background:var(--privy-color-background);border-radius:var(--privy-border-radius-sm);padding:8px 10px;height:48px;width:40px;text-align:center;font-size:18px;font-weight:600;color:var(--privy-color-foreground);transition:all 0.2s ease;}> input:focus{border:1px solid var(--privy-color-foreground);box-shadow:0 0 0 1px var(--privy-color-foreground);}> input:invalid{border:1px solid var(--privy-color-error);}> input.success{border:1px solid var(--privy-color-border-success);background:var(--privy-color-success-bg);}> input.fail{border:1px solid var(--privy-color-border-error);background:var(--privy-color-error-bg);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);}}"]),jy=/*#__PURE__*/g.styled.div.withConfig({displayName:"InputHelp",componentId:"sc-5dd8bc26-2"})(["line-height:20px;min-height:20px;font-size:14px;font-weight:400;color:",";display:flex;justify-content:center;width:100%;text-align:center;"],(e=>e.$success?"var(--privy-color-success-dark)":e.$fail?"var(--privy-color-error-dark)":"transparent")),Iy=/*#__PURE__*/g.styled.div.withConfig({displayName:"HelpTextContainer",componentId:"sc-5dd8bc26-3"})(["display:flex;gap:8px;align-items:center;justify-content:center;width:100%;color:var(--privy-color-foreground-2);"]),Sy=/*#__PURE__*/g.styled.div.withConfig({displayName:"Badge",componentId:"sc-5dd8bc26-4"})(["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);"]),Py=/*#__PURE__*/g.styled.span.withConfig({displayName:"BoldWrappingSpan",componentId:"sc-5dd8bc26-5"})(["font-weight:500;word-break:break-all;color:var(--privy-color-foreground);"]);const _y=/*#__PURE__*/r.forwardRef(((t,n)=>{let[i,a]=r.useState(t.defaultValue||""),[l,c]=r.useState(""),[d,p]=r.useState(!1),{authenticated:h}=u.usePrivyContext(),{initLoginWithEmail:y}=s.usePrivyInternal(),{navigate:m,setModalData:g,currentScreen:f,data:w}=Ui(),{enabled:v,token:x}=sn(),[C,b]=r.useState(!1),{accountType:k}=ou(),E=Ni();r.useEffect((()=>{!i&&E.disablePlusEmails&&w?.inlineError?.error instanceof o.PrivyError&&w?.inlineError?.error.privyErrorCode===o.PrivyErrorCode.DISALLOWED_PLUS_EMAIL&&!l&&c("Please enter a valid email address without a '+'."),l&&c("")}),[i]);let A=qr(i),T=d||!A,j=()=>{g({login:w?.login,inlineError:void 0}),!v||x||h?(e=>{p(!0),y({email:i,captchaToken:e,disableSignup:w?.login?.disableSignup,withPrivyUi:!0}).then((()=>{m(Ey)})).catch((e=>{g({errorModalData:{error:e,previousScreen:f||om}}),m(Nu)})).finally((()=>{p(!1)}))})(x):(g({captchaModalData:{callback:e=>y({email:i,captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Ey,onErrorNavigateTo:Nu}}),m(eh))};/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Ny,{children:[l&&/*#__PURE__*/e.jsx(yp,{style:{display:"block",marginTop:"0.25rem",textAlign:"left"},children:l}),/*#__PURE__*/e.jsxs(My,{stacked:t.stacked,$error:!!l,children:[/*#__PURE__*/e.jsx(Wy,{children:/*#__PURE__*/e.jsx(P.Mail,{})}),/*#__PURE__*/e.jsx("input",{ref:n,id:"email-input",className:"login-method-button",type:"email",placeholder:"your@email.com",onFocus:()=>b(!0),onChange:e=>a(e.target.value),onKeyUp:e=>{"Enter"===e.key&&j()},value:i,autoComplete:"email"}),"email"!==k||C?t.stacked?/*#__PURE__*/e.jsx("span",{}):/*#__PURE__*/e.jsx(Eo,{isSubmitting:d,onClick:j,disabled:T,children:"Submit"}):/*#__PURE__*/e.jsx(wh,{color:"gray",children:"Recent"})]})]}),t.stacked?/*#__PURE__*/e.jsx(go,{loadingText:null,loading:d,disabled:T,onClick:j,style:{width:"100%"},children:"Submit"}):null]})}));let Ny=wp,My=fp,Wy=/*#__PURE__*/g.styled(Ca).withConfig({displayName:"StyledLoginMethodIconWrapper",componentId:"sc-e33d938a-0"})(["display:inline-flex;"]);const Fy=({isEditable:t,setIsEditable:n,defaultValue:i})=>{let a=r.useRef(null);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(ba,{$if:!t,children:/*#__PURE__*/e.jsx(_y,{ref:a,defaultValue:i})}),/*#__PURE__*/e.jsx(ba,{$if:t,children:/*#__PURE__*/e.jsxs(xa,{onClick:()=>{n(),setTimeout((()=>{a.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(Ca,{children:/*#__PURE__*/e.jsx(P.Mail,{})}),"Continue with Email"]})})]})},Uy=({icon:t,name:r})=>"string"==typeof t?/*#__PURE__*/e.jsx("img",{alt:`${r||"wallet"} logo`,src:t,style:{height:24,width:24,borderRadius:4}}):void 0===t?/*#__PURE__*/e.jsx(Be.default,{}):t?/*#__PURE__*/e.jsx(t,{}):null;function Ry(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const Oy=({walletLogo:t,success:r,errorMessage:n,title:i,subtitle:a,onRetry:o,onUseDifferentWallet:s,onBack:l,numRetries:c,maxRetries:d})=>/*#__PURE__*/e.jsx(Xc,{title:i,subtitle:a,icon:t,iconVariant:"loading",iconLoadingStatus:{success:r,fail:!!n},primaryCta:n===En.ERROR_USER_EXISTS?{label:"Use a different wallet",onClick:s}:!r&&n?.retryable&&c<d?{label:"Retry",onClick:o,disabled:!n?.retryable||c>=d}:!r&&n&&c>=d?{label:"Use a different wallet",onClick:s}:void 0,onBack:l,watermark:!0}),Ly={component:()=>{let t,{navigateBack:i,navigate:a,lastScreen:o,currentScreen:l,data:c,setModalData:d}=Ui(),{walletConnectionStatus:u,closePrivyModal:p}=s.usePrivyInternal(),[h,y]=r.useState(void 0),[m,g]=r.useState(0),f=ui(u?.connector?.walletClientType||"unknown"),w="connected"===u?.status,v="switching_to_supported_chain"===u?.status;r.useEffect((()=>{if(w){let e;if(c?.externalConnectWallet?.onCompleteNavigateTo){let t=c.externalConnectWallet.onCompleteNavigateTo,r=u.connectedWallet?.address;e=setTimeout((()=>{c.funding&&d({...c,funding:{...c.funding,connectedWalletAddress:r}}),a(t({walletChainType:u.connector?.chainType}))}),Wt)}else e=setTimeout(p,Wt);return()=>clearTimeout(e)}}),[w]);r.useEffect((()=>{u?.connectError&&(e=>{y(ch(e))})(u?.connectError)}),[u]);let x=u?.connector?.connectorType||"injected",C=u?.connector?.walletClientType||"unknown",b=f?.metadata?.shortName||f?.name||u?.connector?.walletBranding.name||"Browser Extension",k=f?.image_url?.md||u?.connector?.walletBranding.icon||(t=>/*#__PURE__*/e.jsx(Hn,{...t})),E="Browser Extension"===b?b.toLowerCase():b;t=w?`Successfully connected with ${E}`:h?h.message:v?"Switching networks":`Waiting for ${E}`;let A="Don’t see your wallet? Check your other browser windows.";return w?A="You’re good to go!":m>=2&&h?A="Unable to connect wallet":h?A=h.detail:v?A="Switch your wallet to the requested network.":"metamask"===C&&n.isMobile?A="Click to continue to open and connect MetaMask.":"metamask"===C?A="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===x?A="Open your mobile wallet app to continue":"coinbase_wallet"===x&&(A="Open the Coinbase app on your phone to continue."),/*#__PURE__*/e.jsx(Oy,{walletName:b,walletLogo:k,success:w,errorMessage:h,title:t,subtitle:A,onRetry:()=>{g(m+1),y(void 0),u?.connectRetry()},onUseDifferentWallet:i,onBack:l===o?void 0:i,numRetries:m,maxRetries:2})}},Dy=/*#__PURE__*/g.styled.div.withConfig({displayName:"TodoList",componentId:"sc-bcc78743-0"})(["display:flex;flex-direction:column;justify-content:flex-start;gap:10px;padding-left:8px;"]),By=({children:t,variant:r="default",icon:n})=>{let i=()=>{switch(r){case"success":return"var(--privy-color-icon-success)";case"error":return"var(--privy-color-icon-error)";default:return"var(--privy-color-icon-muted)"}};/*#__PURE__*/return e.jsxs(Hy,{children:[/*#__PURE__*/e.jsx(zy,{$variant:r,"data-variant":r,children:(()=>{if(n)
|
|
25
|
+
/*#__PURE__*/return xe.default.isValidElement(n)?/*#__PURE__*/xe.default.cloneElement(n,{stroke:i(),strokeWidth:2}):n;switch(r){case"success":default:/*#__PURE__*/return e.jsx(P.Check,{size:12,stroke:i(),strokeWidth:3});case"error":/*#__PURE__*/return e.jsx(P.X,{size:12,stroke:i(),strokeWidth:3})}})()}),t]})};let zy=/*#__PURE__*/g.styled.div.withConfig({displayName:"IconBackground",componentId:"sc-bcc78743-2"})(["display:flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background-color:",";flex-shrink:0;"],(({$variant:e})=>{switch(e){case"success":return"var(--privy-color-success-bg, #EAFCEF)";case"error":return"var(--privy-color-error-bg, #FEE2E2)";default:return"var(--privy-color-background-2)"}})),Hy=/*#__PURE__*/g.styled.div.withConfig({displayName:"TodoItemWrapper",componentId:"sc-bcc78743-3"})(["display:flex;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;&&{a{color:var(--privy-color-accent);}}"]);const $y=({walletName:t,installLink:r,title:n,subtitle:i="Follow the instructions below to get started.",onReload:a,onBack:o})=>{let s=n||`Create a ${t} wallet`.replace(/wallet wallet/gi,"wallet"),l=/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("span",{children:"Still not sure? "}),/*#__PURE__*/e.jsx(hu,{size:"sm",target:"_blank",href:"https://solana.com/docs/intro/wallets",children:"Learn more"})]});/*#__PURE__*/return e.jsx(Xc,{title:s,subtitle:i,onBack:o,showBack:!0,primaryCta:{label:"Reload the page to use your wallet",onClick:a},helpText:l,watermark:!0,children:/*#__PURE__*/e.jsxs(Dy,{children:[/*#__PURE__*/e.jsx(By,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx("span",{children:"Install the "})," ",/*#__PURE__*/e.jsxs(hu,{href:r,target:"_blank",children:[t," browser extension"]})]})}),/*#__PURE__*/e.jsx(By,{children:"Set up your first wallet"}),/*#__PURE__*/e.jsx(By,{children:"Store your recovery phrase in a safe place!"})]})})},qy={component:()=>{let{navigateBack:t,data:r}=Ui();if(!r?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:n}=r.installWalletModalData;/*#__PURE__*/return e.jsx($y,{walletName:n.name,installLink:n.installLink,onReload:()=>{window.location.reload()},onBack:t})}},Vy=({title:t,subtitle:r,buttonText:n,buttonHref:i,isLoading:a=!1,helpText:o,onButtonClick:s})=>/*#__PURE__*/e.jsx(Xc,{title:t,subtitle:r,primaryCta:{label:n,onClick:()=>{i&&window.open(i,"_self"),s?.()},disabled:a},helpText:o,watermark:!0}),Ky={component:()=>{let{ready:t}=u.usePrivyContext(),{data:n}=Ui(),[i,a]=r.useState(!1);if(!n?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:o,connectOnly:s,chainType:l}=n.installWalletModalData,c=o.getMobileRedirect({useUniversalLink:!i,isSolana:"solana"===l,connectOnly:s}),d=o.name.replace(/ wallet/gi,""),p={title:`Redirecting to ${d} Mobile Wallet`,description:`We'll take you to the ${d} Mobile Wallet app to continue your login experience.`,footnote:""};return t&&(p.description=`For the best experience, we'll automatically log you into the ${d} 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 ${o.name} mobile app.`,p.footnote=`Once you're done, you can connect with ${o.name} wallet to complete the login.`),/*#__PURE__*/e.jsx(Vy,{title:p.title,subtitle:p.description,buttonText:i?"Go to App Store":"Continue",buttonHref:c,isLoading:t&&!c,helpText:p.footnote||void 0,onButtonClick:()=>{setTimeout((()=>a(!0)),1e3)}})}},Gy=({provider:t,displayName:r,logo:i,connectOnly:a,connector:o})=>{let l,{navigate:c,setModalData:d}=Ui(),{connectWallet:u}=s.usePrivyInternal(),p=ou(),h=ui(t),y="wallet_connect_v2"===o.connectorType?t:o.walletClientType,m=window.matchMedia("(display-mode: standalone)").matches,g=ei({connectorType:o.connectorType,walletClientType:y});l=g&&g.chainTypes.includes(o.chainType)?()=>{g.isInstalled||"solana"===o.chainType&&"isInstalled"in o&&o.isInstalled?(u(o,y),c(a?Ly:uh)):n.isMobile?(d({installWalletModalData:{walletConfig:g,chainType:o.chainType,connectOnly:a}}),c(Ky)):(d({installWalletModalData:{walletConfig:g,chainType:o.chainType,connectOnly:a}}),c(qy))}:"coinbase_wallet"!==o.connectorType||"eoaOnly"!==o.coinbaseWalletConfig.preference?.options||!n.isMobile||m||zr()?()=>{(!Ry(window.navigator.userAgent)||event?.isTrusted)&&(u(o,y),c(a?Ly:uh))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`};let f=r||h?.metadata?.shortName||h?.name||o.walletClientType;/*#__PURE__*/return e.jsxs(Yy,{onClick:l,children:[/*#__PURE__*/e.jsx(Uy,{icon:i||h?.image_url?.md,name:f}),/*#__PURE__*/e.jsx("span",{children:f}),/*#__PURE__*/e.jsxs(Qy,{id:"chip-container",children:[p?.walletClientType===y&&p?.chainType===o.chainType?/*#__PURE__*/e.jsx(Zy,{color:"gray",children:"Recent"}):/*#__PURE__*/e.jsx("span",{id:"connect-text",children:"Connect"}),"solana"===o.chainType&&/*#__PURE__*/e.jsx(Zy,{color:"gray",children:"Solana"})]})]})};let Yy=/*#__PURE__*/g.styled(xa).withConfig({displayName:"ConnectWalletButton",componentId:"sc-42d67b97-0"})(["> span{color:var(--privy-color-foreground);}> #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;}}"]),Zy=/*#__PURE__*/g.styled(wh).withConfig({displayName:"StyledChip",componentId:"sc-42d67b97-1"})(["margin-left:auto;"]),Qy=/*#__PURE__*/g.styled.div.withConfig({displayName:"ChipContainer",componentId:"sc-42d67b97-2"})(["display:flex;flex-wrap:wrap;gap:8px;margin-left:auto;"]);const Xy=["coinbase_wallet","base_account"];let Jy=["metamask","okx_wallet","rainbow","uniswap","bybit_wallet","ronin_wallet","haha_wallet","uniswap_extension","zerion","rabby_wallet","cryptocom","binance"];const em=["safe"],tm=["phantom","backpack","solflare","universal_profile"],rm=({walletList:t,walletChainType:r,connectors:n,connectOnly:i,ignore:a,walletConnectEnabled:o,forceWallet:s})=>{let l=[],c=[],d=[],u=n.filter((e=>"ethereum-only"===r?"ethereum"===e.chainType:"solana-only"!==r||"solana"===e.chainType)),p=u.find((e=>"wallet_connect_v2"===e.connectorType));for(let[n,h]of(s?[s.wallet]:t).entries()){if("detected_ethereum_wallets"===h||"detected_wallets"===h)for(let[t,r]of u.filter((({chainType:e,connectorType:t,walletClientType:r})=>"solana"!==e&&("uniswap_wallet_extension"===r||"uniswap_extension"===r?!a.includes("uniswap"):"crypto.com_wallet_extension"===r||"crypto.com_onchain"===r?!a.includes("cryptocom"):"injected"===t&&!a.includes(r)))).entries()){let{walletClientType:a,walletBranding:o,chainType:s}=r;("unknown"===a?c:l).push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:a,logo:o.icon,displayName:o.name,connector:r},`${n}-${h}-${a}-${s}-${t}`))}if("detected_solana_wallets"===h||"detected_wallets"===h)for(let[t,o]of u.filter((({chainType:e,walletClientType:t})=>{if("solana"===e)return"ethereum-only"!==r&&!a.includes(t)})).entries()){let{walletClientType:r,walletBranding:a,chainType:s}=o;("unknown"===r?c:l).push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:r,logo:a.icon,displayName:a.name,connector:o},`${n}-${h}-${r}-${s}-${t}`))}if(tm.includes(h)){let t=u.find((e=>"injected"===e.connectorType&&e.walletClientType===h||e.connectorType===h));if(t&&l.push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:h,connector:t},`${n}-${h}`)),"solana-only"===r||"ethereum-and-solana"===r){let t=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===h));t&&l.push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:h,connector:t},`${h}-solana`))}}else if(Jy.includes(h)){let t=u.find((e=>"uniswap"===h?"uniswap_wallet_extension"===e.walletClientType||"uniswap_extension"===e.walletClientType:"cryptocom"===h?"crypto.com_wallet_extension"===e.walletClientType||"crypto.com_onchain"===e.walletClientType:"injected"===e.connectorType&&e.walletClientType===h));if(o&&!t&&(t=p),t&&l.push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:h,connector:t,logo:"injected"===t.connectorType?t.walletBranding.icon:void 0,displayName:"injected"===t.connectorType?t.walletBranding.name:void 0},`${n}-${h}`)),"solana-only"===r||"ethereum-and-solana"===r){let t=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===h));t&&l.push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:h,connector:t},`${h}-solana`))}}else if(Xy.includes(h)){let t=u.find((({connectorType:e})=>e===h));t&&l.push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:h,connector:t,displayName:"coinbase_wallet"===t.walletClientType?"Coinbase":"Base",logo:"coinbase_wallet"===t.walletClientType?fn:wn},`${n}-${h}`))}else if(em.includes(h))p&&d.push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:h,connector:p},`${n}-${h}`));else if("wallet_connect"===h)p&&d.push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:h,connector:p,logo:p.walletBranding.icon,displayName:"WalletConnect"},`${n}-${h}`));else if(h===s?.wallet){let r="ethereum"===s.chainType&&t.includes("detected_ethereum_wallets"),a="solana"===s.chainType&&t.includes("detected_solana_wallets");if(t.includes("detected_wallets")||r||a){let t=u.find((({walletClientType:e})=>e===h));t&&l.push(/*#__PURE__*/e.jsx(Gy,{connectOnly:i,provider:h,displayName:t.walletBranding?.name,logo:t.walletBranding?.icon,connector:t},`${n}-${h}`))}}}return[...c,...l,...d]},nm=({connectOnly:t})=>{let{closePrivyModal:n,connectors:i}=s.usePrivyInternal(),{app:a,onUserCloseViaDialogOrKeybindRef:o,data:l}=Ui(),{appearance:{palette:{colorScheme:c}}}=Ni(),{accountType:d,walletClientType:u,chainType:p}=ou(),h=r.useMemo((()=>d&&"guest"!==d&&"authorization_key"!==d&&"cross_app"!==d?eu(d):null),[d]),y=a.loginMethodsAndOrder?.primary??[],m=a.loginMethodsAndOrder?.overflow??[],g=r.useMemo((()=>[...y,...m]),[y,m]),f=a.loginMethods.passkey,w=l?.login,v=[];u&&g.includes(u)?v.push(u):d&&g.includes(h?.loginMethod)&&v.push(h?.loginMethod);let[x,C]=r.useState("default"),[b,k]=r.useState(my({mostRecentlyUsedAccountType:d,smsAvailable:g.includes("sms"),emailAvailable:g.includes("email"),prefilledType:w?.prefill?.type}));r.useEffect((()=>{k(my({mostRecentlyUsedAccountType:d,smsAvailable:g.includes("sms"),emailAvailable:g.includes("email"),prefilledType:w?.prefill?.type}))}),[g,d]),r.useEffect((()=>{"phone"===d&&k("sms");let e=g.indexOf("sms"),t=g.indexOf("email");e>-1&&e<t&&k("sms")}),[d,y,m]);let E=()=>{n({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{C("default")}),150)};o.current=E;let A=r=>"email"===r?/*#__PURE__*/e.jsx(Fy,{isEditable:"email"===b,setIsEditable:()=>{k("email")},defaultValue:"email"===w?.prefill?.type?w.prefill.value:void 0},r):"sms"===r?/*#__PURE__*/e.jsx(Xh,{isEditable:"sms"===b,setIsEditable:()=>{k("sms")},defaultValue:"phone"===w?.prefill?.type?w.prefill.value:void 0},r):"apple"===r?/*#__PURE__*/e.jsx(ey,{provider:"apple"},r):"discord"===r?/*#__PURE__*/e.jsx(ey,{provider:"discord"},r):"farcaster"===r?/*#__PURE__*/e.jsx(Dh,{},r):"github"===r?/*#__PURE__*/e.jsx(ey,{provider:"github"},r):"google"===r?/*#__PURE__*/e.jsx(ey,{provider:"google"},r):"linkedin"===r?/*#__PURE__*/e.jsx(ey,{provider:"linkedin"},r):"spotify"===r?/*#__PURE__*/e.jsx(ey,{provider:"spotify"},r):"instagram"===r?/*#__PURE__*/e.jsx(ey,{provider:"instagram"},r):"tiktok"===r?/*#__PURE__*/e.jsx(ey,{provider:"tiktok"},r):"line"===r?/*#__PURE__*/e.jsx(ey,{provider:"line"},r):"twitter"===r?/*#__PURE__*/e.jsx(ey,{provider:"twitter"},r):"telegram"===r?/*#__PURE__*/e.jsx(ay,{},r):r.startsWith("privy:")?/*#__PURE__*/e.jsx(uu,{appId:r.replace("privy:","")},r):rm({walletList:a.appearance.walletList,walletChainType:w?.walletChainType??a.appearance.walletChainType,connectors:i,connectOnly:t,ignore:g,walletConnectEnabled:a.externalWallets.walletConnect.enabled,forceWallet:{wallet:r,chainType:p??"ethereum"}}),T=v.flatMap(A),j=y.filter((e=>e!==u&&e!==h?.loginMethod)).flatMap(A),I=m.filter((e=>e!==u&&e!==h?.loginMethod)).flatMap(A),[S,P]=((e,t)=>{let r=[],n=[];for(let[i,a]of e.entries())i<t?r.push(a):n.push(a);return[r,n]})([...T,...j,...I],im({primary:j.length+T.length,overflow:I.length}));/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{title:a.appearance.landingHeader,onClose:E,backFn:"default"===x?void 0:()=>{C("default")}}),"default"===x&&/*#__PURE__*/e.jsx(am,{}),"default"===x&&("string"==typeof a.appearance.loginMessage?/*#__PURE__*/e.jsx(va,{children:a.appearance.loginMessage}):a.appearance.loginMessage),/*#__PURE__*/e.jsx(ma,{style:{overflow:"hidden"},children:/*#__PURE__*/e.jsxs(fa,{$colorScheme:c,children:["default"===x&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[S,P.length>0&&/*#__PURE__*/e.jsx(ly,{text:"More options",icon:/*#__PURE__*/e.jsx(Oe.default,{}),onClick:()=>C("overflow")})]}),"overflow"===x&&/*#__PURE__*/e.jsx(e.Fragment,{children:P}),f&&"default"===x&&/*#__PURE__*/e.jsx(Kh,{})]})}),a&&/*#__PURE__*/e.jsx(ja,{app:a}),/*#__PURE__*/e.jsx(Ia,{})]})};let im=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,am=/*#__PURE__*/g.styled(lu).withConfig({displayName:"StyledAppLogoHeader",componentId:"sc-d846420a-0"})(["margin-bottom:16px;"]);const om={component:()=>{let{app:t}=Ui();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/e.jsx(nm,{connectOnly:!1}):/*#__PURE__*/e.jsx(cy,{connectOnly:!1})},isCaptchaRequired:!0,isUnauthenticatedScreem:!0},sm={component:()=>{let[t,n]=r.useState(null),[i,a]=r.useState(!1),[l,c]=r.useState(null),[d,p]=r.useState(""),{authenticated:h,user:y}=u.usePrivyContext(),{client:m,walletProxy:g,refreshSessionAndUser:f,closePrivyModal:w,createAnalyticsEvent:v}=s.usePrivyInternal(),{app:x,navigate:C,data:b,onUserCloseViaDialogOrKeybindRef:k}=Ui(),{onSuccess:E,onFailure:A}=b.setWalletPassword,T=u.getPrivyPrimaryWallet(y),j="user-passcode"===t?.recoveryMethod,I="user-passcode"===T?.recoveryMethod;r.useEffect((()=>{h||(C(om),A(new o.PrivyUnauthenticatedError("User must be authenticated before setting a password on a Privy wallet")))}),[h]);let S=()=>l?(A(l),void w({shouldCallAuthOnSuccess:!1})):j?(E(t),void w({shouldCallAuthOnSuccess:!1})):(A(new o.PrivyEmbeddedWalletError("Exited before password was added to wallet")),void w({shouldCallAuthOnSuccess:!1}));k.current=S;/*#__PURE__*/return e.jsx(Xd,{appName:x?.name||"privy",config:{initiatedBy:"user",onCancel:S},error:l?"An error has occurred, please try again.":void 0,buttonLoading:i,buttonHideAnimations:!1,password:d,isResettingPassword:I,onPasswordGenerate:()=>p(zd()),onPasswordChange:p,onSubmit:async()=>{j?(E(t),w({shouldCallAuthOnSuccess:!1})):(a(!0),c(null),await(async()=>{let e=await m.getAccessToken();if(e&&y&&T?.address&&d&&g)try{v({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I}});let{entropyId:t,entropyIdVerifier:r}=mn(y);if(!(await g.setRecovery({accessToken:e,entropyId:t,entropyIdVerifier:r,recoveryPassword:d,recoveryMethod:"user-passcode"})).entropyId)return c(new o.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I,reason:"error setting password"}});let i=await f(),a=u.getPrivyPrimaryWallet(i);if(!a)return c(new o.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I,reason:"wallet disconnected"}});n(a),v({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:I}})}catch(e){console.warn(e),c(e instanceof Error?e:Error("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:T.address,reason:e}})}})(),a(!1))},onClose:S})}},lm=({onClose:t,onProceed:r})=>/*#__PURE__*/e.jsx(Xc,{title:"Secure Your Account",subtitle:/*#__PURE__*/e.jsxs(e.Fragment,{children:["Please set a password to secure your account.",/*#__PURE__*/e.jsx("br",{}),"Losing access to this password and this device will make your account inaccessible."]}),icon:P.Lock,primaryCta:{label:"Add password",onClick:r},onClose:t,watermark:!0}),cm={component:()=>{let{closePrivyModal:t}=s.usePrivyInternal(),{data:r,navigate:n,onUserCloseViaDialogOrKeybindRef:i}=Ui(),{onFailure:a}=r.setWalletPassword,l=()=>{a(new o.PrivyEmbeddedWalletError("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=l,/*#__PURE__*/e.jsx(lm,{onClose:l,onProceed:()=>{n(sm)}})}},dm={component:()=>{let[t,n]=r.useState(!0),{authenticated:i,user:a}=u.usePrivyContext(),{walletProxy:l,closePrivyModal:c,createAnalyticsEvent:d,client:p}=s.usePrivyInternal(),{navigate:h,data:y,onUserCloseViaDialogOrKeybindRef:m}=Ui(),[g,f]=r.useState(void 0),[w,v]=r.useState(""),[x,C]=r.useState(!1),{entropyId:b,entropyIdVerifier:k,onCompleteNavigateTo:E,onSuccess:A,onFailure:T}=y.recoverWallet,j=(e="User exited before their wallet could be recovered")=>{c({shouldCallAuthOnSuccess:!1}),T("string"==typeof e?new o.PrivyEmbeddedWalletError(e):e)};m.current=j,r.useEffect((()=>{if(!i)return j("User must be authenticated and have a Privy wallet before it can be recovered")}),[i]);/*#__PURE__*/return e.jsxs(qc,{children:[/*#__PURE__*/e.jsx(qc.Header,{icon:Se.default,title:"Enter your password",subtitle:"Please provision your account on this new device. To continue, enter your recovery password.",showClose:!0,onClose:j}),/*#__PURE__*/e.jsx(qc.Body,{children:/*#__PURE__*/e.jsx(um,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsxs(gd,{children:[/*#__PURE__*/e.jsx(yd,{type:t?"password":"text",onChange:e=>(e=>{e&&f(e)})(e.target.value),disabled:x,style:{paddingRight:"2.3rem"}}),/*#__PURE__*/e.jsx(Cd,{style:{right:"0.75rem"},children:t?/*#__PURE__*/e.jsx(kd,{onClick:()=>n(!1)}):/*#__PURE__*/e.jsx(Ed,{onClick:()=>n(!0)})})]}),!!w&&/*#__PURE__*/e.jsx(pm,{children:w})]})})}),/*#__PURE__*/e.jsxs(qc.Footer,{children:[/*#__PURE__*/e.jsx(qc.HelpText,{children:/*#__PURE__*/e.jsxs(fs,{children:[/*#__PURE__*/e.jsx("h4",{children:"Why is this necessary?"}),/*#__PURE__*/e.jsx("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]})}),/*#__PURE__*/e.jsx(qc.Actions,{children:/*#__PURE__*/e.jsx(hm,{loading:x||!l,disabled:!g,onClick:async()=>{C(!0);let e=await p.getAccessToken(),t=u.getPrivyWalletWithAddress(a,b);if(!e||!t||null===g)return j("User must be authenticated and have a Privy wallet before it can be recovered");try{d({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t.address}}),await(l?.recover({accessToken:e,entropyId:b,entropyIdVerifier:k,recoveryPassword:g})),v(""),E?h(E):c({shouldCallAuthOnSuccess:!1}),A?.(t),d({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}})}catch(e){!function(e){return hl(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{C(!1)}},$hideAnimations:!b&&x,children:"Recover your account"})}),/*#__PURE__*/e.jsx(qc.Watermark,{})]})]})}};let um=/*#__PURE__*/g.styled.div.withConfig({displayName:"Content",componentId:"sc-f366413c-0"})(["display:flex;flex-direction:column;gap:1.5rem;"]),pm=/*#__PURE__*/g.styled.div.withConfig({displayName:"ErrorMessage",componentId:"sc-f366413c-1"})(["line-height:20px;height:20px;font-size:13px;color:var(--privy-color-error);text-align:left;margin-top:0.5rem;"]),hm=/*#__PURE__*/g.styled(go).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-f366413c-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/g.css(["&&{transition:none;}"])));const ym={component:()=>{let{app:t,navigate:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=Ui(),[l,c]=r.useState(""),[d,p]=r.useState(!1),[h,y]=r.useState(),[m,g]=r.useState(null),{create:f}=Tc(),{authenticated:w,user:v}=u.usePrivyContext(),{closePrivyModal:x,isNewUserThisSession:C,initializeWalletProxy:b}=s.usePrivyInternal(),{onSuccess:k,onFailure:E,callAuthOnSuccessOnClose:A,shouldCreateEth:T,shouldCreateSol:j}=i.createWallet,[I,S]=r.useState(null),P=new _t((async()=>{try{let e;if(T&&j)e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:v}),e=await f({chainType:"solana",walletIndex:0,latestUser:e.user});else if(j)e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"solana",walletIndex:0,latestUser:v});else{if(!T)throw Error("Invalid args to create wallet");e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:v})}S(e),C?n(ed):(k(e),x({shouldCallAuthOnSuccess:A}))}catch(e){c(e.message)}}));r.useEffect((()=>{m||b(3e4).then((e=>g(e)))}),[m]),r.useEffect((()=>{if(!w||!v)return n(om),void E(Error("User must be authenticated before creating a Privy wallet"))}),[w]),a.current=()=>null;/*#__PURE__*/return e.jsx(Xd,{config:{initiatedBy:"automatic"},appName:t?.name||"privy",loading:!m,buttonLoading:d,buttonHideAnimations:!I&&d,isResettingPassword:!1,error:l,password:h||"",onClose:()=>{I&&"user-passcode"!==I.account.recoveryMethod?(E(new o.PrivyEmbeddedWalletError("User created a wallet but failed to set a password for it")),x({shouldCallAuthOnSuccess:!1})):I?(k(I),x({shouldCallAuthOnSuccess:A})):(E(new o.PrivyEmbeddedWalletError("User wallet creation failed")),x({shouldCallAuthOnSuccess:!1}))},onPasswordChange:y,onPasswordGenerate:()=>y(zd()),onSubmit:async()=>(p(!0),P.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>p(!1))))})}},mm=/*#__PURE__*/g.styled.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)")),gm=/*#__PURE__*/g.styled.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);}"]),fm=/*#__PURE__*/g.styled.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;"]),wm={component:()=>{let{user:t}=u.usePrivyContext(),{client:n,walletProxy:i,refreshSessionAndUser:a,closePrivyModal:o}=s.usePrivyInternal(),l=Ui(),{entropyId:c,entropyIdVerifier:d}=l.data?.recoverWallet,[p,h]=r.useState(!1),[y,m]=r.useState(null),[g,f]=r.useState(null);function w(){if(!p){if(g)return l.data?.setWalletPassword?.onFailure(g),void o();if(!y)return l.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void o()}}l.onUserCloseViaDialogOrKeybindRef.current=w;let v=!(!p&&!y);return g?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:w},"header"),/*#__PURE__*/e.jsx(mm,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:/*#__PURE__*/e.jsx(We.default,{height:38,width:38,stroke:"var(--privy-color-error)"})}),/*#__PURE__*/e.jsx(fm,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),/*#__PURE__*/e.jsx(ya,{style:{minHeight:"2rem"}}),/*#__PURE__*/e.jsx(fo,{onClick:()=>f(null),children:"Try again"}),/*#__PURE__*/e.jsx(Ia,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:w},"header"),/*#__PURE__*/e.jsx(Ve.default,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),/*#__PURE__*/e.jsx(fm,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),/*#__PURE__*/e.jsx(gm,{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__*/e.jsx(ya,{style:{minHeight:"2rem"}}),/*#__PURE__*/e.jsx(fo,{loading:p,disabled:v,onClick:()=>async function(){h(!0);try{let e=await n.getAccessToken(),r=u.getPrivyWalletWithAddress(t,c);if(!e||!i||!r)return;if(!(await i.setRecovery({accessToken:e,entropyId:c,entropyIdVerifier:d,existingRecoveryMethod:r.recoveryMethod,recoveryMethod:"privy"})).entropyId)throw Error("Unable to set recovery on wallet");let s=await a();if(!s)throw Error("Unable to set recovery on wallet");let p=u.getPrivyWalletWithAddress(s,r.address);if(!p)throw Error("Unabled to set recovery on wallet");m(!!s),setTimeout((()=>{l.data?.setWalletPassword?.onSuccess(p),o()}),Wt)}catch(e){f(e)}finally{h(!1)}}(),children:y?"Success":"Confirm"}),/*#__PURE__*/e.jsx(Ia,{})]})}};function vm({isCreatingWallet:e,skipSplashScreen:t}){return e?ym:t?sm:cm}function xm({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:r,isResettingPassword:n,showAutomaticRecovery:i}){return i?wm:r||1===t.length?vm({isCreatingWallet:"create"===e,skipSplashScreen:n}):ld}function Cm(e){switch(e){case"user-passcode":return dm;case"google-drive":case"icloud":return id;default:throw Error("Recovery method not supported")}}const bm=({children:t,theme:r})=>/*#__PURE__*/e.jsxs(km,{$theme:r,children:[/*#__PURE__*/e.jsx(it.default,{width:"20px",height:"20px",color:"var(--privy-color-icon-subtle)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/e.jsx(Em,{$theme:r,children:t})]});let km=/*#__PURE__*/g.styled.div.withConfig({displayName:"Container",componentId:"sc-1b5ed8dd-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-background-2);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),Em=/*#__PURE__*/g.styled.div.withConfig({displayName:"Content",componentId:"sc-1b5ed8dd-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const Am=/*#__PURE__*/g.css(["&&{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?"\n border-color: var(--privy-color-error);\n background: var(--privy-color-error-bg);\n ":"")),Tm=/*#__PURE__*/g.styled.div.withConfig({displayName:"Box",componentId:"sc-7252360a-0"})(["",""],Am);let jm=/*#__PURE__*/g.styled(Tm).withConfig({displayName:"StyledBox",componentId:"sc-4010d8f3-0"})(["&&{padding:0.75rem;height:56px;}"]),Im=/*#__PURE__*/g.styled.div.withConfig({displayName:"WalletContent",componentId:"sc-4010d8f3-1"})(["display:flex;align-items:center;justify-content:space-between;width:100%;"]),Sm=/*#__PURE__*/g.styled.div.withConfig({displayName:"AddressContainer",componentId:"sc-4010d8f3-2"})(["display:flex;flex-direction:column;gap:0;"]),Pm=/*#__PURE__*/g.styled.div.withConfig({displayName:"BalanceText",componentId:"sc-4010d8f3-3"})(["font-size:12px;line-height:1rem;color:var(--privy-color-foreground-3);"]),_m=/*#__PURE__*/g.styled(kh).withConfig({displayName:"TitleLabel",componentId:"sc-4010d8f3-4"})(["text-align:left;margin-bottom:0.5rem;"]),Nm=/*#__PURE__*/g.styled(yp).withConfig({displayName:"StyledErrorMessage",componentId:"sc-4010d8f3-5"})(["margin-top:0.25rem;"]),Mm=/*#__PURE__*/g.styled(xo).withConfig({displayName:"CopyButton",componentId:"sc-4010d8f3-6"})(["&&{gap:0.375rem;font-size:14px;}"]);const Wm=({errMsg:t,balance:n,address:i,className:a,title:o,showCopyButton:s=!1})=>{let[l,c]=r.useState(!1);return r.useEffect((()=>{if(l){let e=setTimeout((()=>c(!1)),3e3);return()=>clearTimeout(e)}}),[l]),/*#__PURE__*/e.jsxs("div",{children:[o&&/*#__PURE__*/e.jsx(_m,{children:o}),/*#__PURE__*/e.jsx(jm,{className:a,$state:t?"error":void 0,children:/*#__PURE__*/e.jsxs(Im,{children:[/*#__PURE__*/e.jsxs(Sm,{children:[/*#__PURE__*/e.jsx(Dl,{address:i,showCopyIcon:!1}),void 0!==n&&/*#__PURE__*/e.jsx(Pm,{children:n})]}),s&&/*#__PURE__*/e.jsx(Mm,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(i).then((()=>c(!0))).catch(console.error)},size:"sm",children:l?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(P.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(P.Copy,{size:14})]})})]})}),t&&/*#__PURE__*/e.jsx(Nm,{children:t})]})};function Fm({rpcConfig:e,appId:t,address:n,chain:i}){let{chains:a}=s.usePrivyInternal(),[o,c]=r.useState(0n),[d,u]=r.useState(!1),p=r.useMemo((()=>{let r=i||a[0];if(r)return l.createPublicClient({chain:i,transport:l.http($r(r,e,t))})}),[i,e,t]),h=r.useCallback((async()=>{if(!n||!p)return;u(!0);let e=await p.getBalance({address:n}).catch(console.error);return e?(c(e),u(!1),e):void 0}),[p,n,c]);return r.useEffect((()=>{h().catch(console.error)}),[]),{balance:o,isLoading:d,reloadBalance:h}}const Um="sdk_fiat_on_ramp_completed_with_status",Rm=async({chain:e,address:t,appId:r,rpcConfig:n,erc20Address:i})=>{let a=l.createPublicClient({chain:e,transport:l.http($r(e,n,r))});return{balance:await a.readContract({address:i,abi:Om,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}};let Om=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];const Lm=Symbol("solana-funding-plugin"),Dm=async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:r,refreshSessionAndUser:n,user:i,appConfig:a},{privateKey:s,chainType:l})=>{if(!i)throw e("linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new o.PrivyClientError("User must be authenticated before linking an account.");let[c,d]=await Promise.all([t(),r(15e3)]);if(!d||!c)throw e("linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new o.PrivyClientError("User must be authenticated before linking an account.");await d.importWallet({privateKey:s,accessToken:c,chainType:l,mode:"user-controlled-server-wallets-only"===a.embeddedWallets.mode?"tee":"on-device"});let p=await n(),h="solana"===l?u.getImportedPrivySolanaWallet(p):u.getImportedPrivyEthereumWallet(p);if(!h)throw e("createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",{wallet:h}),h};class Bm{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(Fr(e.params.message,"base64"));return{signature:Fr(t).toString("base64")}}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await Bx())throw Error("User must be authenticated to use embedded Solana wallet");if(!await Kx({address:this.address}))throw new o.PrivyClientError("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,r){this.walletProxy=e,this.address=t,this.signMessage=r}}async function zm({tx:e,accessToken:t,walletProxy:r,entropyId:n,entropyIdVerifier:i,transactingWalletAddress:a,transactingWalletIndex:o}){let s=Go(e,a),l=Ko(e)?Fr(e.message.serialize()):e.serializeMessage(),{response:c}=await r.rpc({accessToken:t,entropyId:n,entropyIdVerifier:i,chainType:"solana",hdWalletIndex:o,request:{method:"signMessage",params:{message:l.toString("base64")}}}),d=Fr(c.data.signature,"base64");return e.addSignature(s,d),e}const Hm=e=>e.reduce(((e,t)=>!e||e.walletIndex<t.walletIndex?t:e),null);let $m=async({accessToken:e,appConfig:t,privy:r,emitPrivyEvent:n,proxy:i,refreshSessionAndUser:a,recoverEmbeddedWallet:s,user:l,walletIndex:c,setModalData:d,openModal:p,chainType:h,setUser:y})=>{if(c<0)throw n("createWallet","onError",o.PrivyErrorCode.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${c}) is invalid.`);let m=u.getPrivyPrimaryWallet(l);if(c>0&&!m)throw n("createWallet","onError",o.PrivyErrorCode.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 n("createWallet","onError",o.PrivyErrorCode.EMBEDDED_WALLET_CREATE_ERROR),Error("User owned recovery not yet supported for this app.");if(!m&&t.embeddedWallets.requireUserOwnedRecoveryOnCreate)return await qm({emitPrivyEvent:n,setModalData:d,openModal:p,chainType:h});let g=Ec(l,{chainType:h,walletIndex:c})[0];if(g)return{user:l,account:g};if(0===c&&!i)return qm({emitPrivyEvent:n,setModalData:d,openModal:p,chainType:h});if(!i)throw n("createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");return Ac({appConfig:t,walletIndex:c,chainType:h,user:l,accessToken:e,proxy:i,refreshSessionAndUser:a,privy:r,recoverEmbeddedWallet:s,setUser:y})},qm=async({emitPrivyEvent:e,setModalData:t,openModal:r,chainType:n})=>new Promise(((i,a)=>{t({createWallet:{onSuccess:({user:t,account:r})=>{e("createWallet","onSuccess",{wallet:r}),i({user:t,account:r})},onFailure:t=>{e("createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),a(t)},callAuthOnSuccessOnClose:!1,shouldCreateEth:"ethereum"===n,shouldCreateSol:"solana"===n}}),r(Yu)}));const Vm=()=>{let e=Ni(),t=pa(),{setModalData:r}=Ui(),{initializeWalletProxy:n,recoverEmbeddedWallet:i,setUser:a,openModal:l,refreshSessionAndUser:c,privy:d,client:u}=s.usePrivyInternal();return{create:async({chainType:s,options:p,latestUser:h})=>{let y=h;if(y||(y=await c()),!y)throw t("createWallet","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return await(async({appConfig:e,getAccessToken:t,initializeWalletProxy:r,user:n,privy:i,emitPrivyEvent:a,recoverEmbeddedWallet:s,setModalData:l,openModal:c,setUser:d,options:u,timeoutDuration:p,refreshSessionAndUser:h,chainType:y})=>{let[m,g]=await Promise.all([r(p),t()]);if(!g||!n)throw a("createWallet","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");if(!m&&e.customAuth?.enabled)throw a("createWallet","onError",o.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(u&&"walletIndex"in u&&"number"==typeof u.walletIndex){if("user-controlled-server-wallets-only"===e.embeddedWallets.mode)throw a("createWallet","onError",o.PrivyErrorCode.INVALID_DATA),Error("Invalid input, use `createAdditional` instead of `walletIndex` to create additional wallets.");return $m({accessToken:g,appConfig:e,privy:i,emitPrivyEvent:a,openModal:c,proxy:m,refreshSessionAndUser:h,recoverEmbeddedWallet:s,setModalData:l,user:n,walletIndex:u.walletIndex,chainType:y,setUser:d})}let f=u&&"createAdditional"in u&&u.createAdditional,w=Ec(n,{chainType:y});if(w[0]&&!f)throw a("createWallet","onError",o.PrivyErrorCode.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");return $m({accessToken:g,appConfig:e,privy:i,emitPrivyEvent:a,openModal:c,proxy:m,recoverEmbeddedWallet:s,setModalData:l,user:n,walletIndex:(Hm(w)?.walletIndex??-1)+1,chainType:y,refreshSessionAndUser:h,setUser:d})})({appConfig:e,privy:d,getAccessToken:()=>u.getAccessToken(),refreshSessionAndUser:c,initializeWalletProxy:n,user:y,emitPrivyEvent:t,recoverEmbeddedWallet:i,setModalData:r,openModal:l,setUser:a,options:p,timeoutDuration:rr,chainType:s})}}};function Km(e){let{create:t}=Vm();return da("createWallet",e),{createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:r}=await t({chainType:"ethereum",options:e});return r}}}const Gm=()=>{let{user:e}=u.usePrivyContext(),{client:t,refreshSessionAndUser:n,initializeWalletProxy:i}=s.usePrivyInternal(),a=pa(),o=Ni();return{importWallet:r.useCallback((({privateKey:r})=>Dm({getAccessToken:()=>t.getAccessToken(),user:e,initializeWalletProxy:i,refreshSessionAndUser:n,emitPrivyEvent:a,appConfig:o},{privateKey:r,chainType:"ethereum"})),[e,t,n,i,a])}},Ym=()=>{let{importWallet:e}=Gm(),{createWallet:t}=Km();return{...r.useContext(u.PrivyContext),importWallet:e,createWallet:t}},Zm=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)))),Qm=e=>!!e.fundingConfig&&Zm(e.fundingConfig.options).length>=1,Xm=({children:t,theme:r})=>/*#__PURE__*/e.jsxs(Jm,{$theme:r,children:[/*#__PURE__*/e.jsx(ze.default,{width:"20px",height:"20px",color:"var(--privy-color-icon-error)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/e.jsx(eg,{$theme:r,children:t})]});let Jm=/*#__PURE__*/g.styled.div.withConfig({displayName:"Container",componentId:"sc-34910fd1-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-error-bg);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),eg=/*#__PURE__*/g.styled.div.withConfig({displayName:"Content",componentId:"sc-34910fd1-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const tg=t=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 210.2",xmlSpace:"preserve",...t,children:/*#__PURE__*/e.jsx("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"})}),rg=t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 38.1",xmlSpace:"preserve",...t,children:[/*#__PURE__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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"})]}),ng=e=>{let[t,n]=r.useState();return r.useEffect((()=>{e().then((e=>{n(e)})).catch((()=>{}))}),[]),t},ig=async({address:e,chain:t,rpcConfig:r,privyAppId:n})=>{try{let i=l.createPublicClient({chain:t,transport:l.http($r(t,r,n))}),[a,o]=await Promise.all([i.readContract({abi:ag,address:e,functionName:"symbol"}),i.readContract({abi:ag,address:e,functionName:"decimals"})]);return{decimals:o,symbol:a}}catch(e){return console.log(e),null}};let ag=[{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 og=/*#__PURE__*/g.styled.span.withConfig({displayName:"Rows",componentId:"sc-b764aab6-0"})(["display:flex;flex-direction:column;gap:0.35rem;width:100%;"]),sg=/*#__PURE__*/g.styled.span.withConfig({displayName:"Row",componentId:"sc-b764aab6-1"})(["display:flex;width:100%;justify-content:space-between;gap:0.5rem;"]),lg=/*#__PURE__*/g.styled.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;"]),cg=/*#__PURE__*/g.styled(lg).withConfig({displayName:"LabelSmPrimary",componentId:"sc-6c002d6-1"})(["color:var(--privy-color-accent);"]),dg=/*#__PURE__*/g.styled.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;",""],fh),ug=t=>/*#__PURE__*/e.jsxs("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",...t,children:[/*#__PURE__*/e.jsxs("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__*/e.jsx("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/e.jsx("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.jsxs("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__*/e.jsx("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/e.jsx("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.jsxs("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__*/e.jsx("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/e.jsx("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 pg={[a.arbitrum.id]:t=>/*#__PURE__*/e.jsx("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",...t,children:/*#__PURE__*/e.jsx("g",{id:"Layer_x0020_1",children:/*#__PURE__*/e.jsxs("g",{id:"_2405588477232",children:[/*#__PURE__*/e.jsx("rect",{fill:"none",width:"2500",height:"2500"}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsxs("g",{children:[/*#__PURE__*/e.jsx("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__*/e.jsx("g",{children:/*#__PURE__*/e.jsxs("g",{children:[/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#12AAFF",d:"M1435,1440l-121,332c-3,9-3,19,0,29l208,571l241-139l-289-793C1467,1422,1442,1422,1435,1440z"})}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#12AAFF",d:"M1678,882c-7-18-32-18-39,0l-121,332c-3,9-3,19,0,29l341,935l241-139L1678,883V882z"})})]})}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("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__*/e.jsx("polygon",{fill:"#213147",points:"642,2179 727,1947 897,2088 738,2234 "}),/*#__PURE__*/e.jsxs("g",{children:[/*#__PURE__*/e.jsx("path",{fill:"#FFFFFF",d:"M1172,644H939c-17,0-33,11-39,27L401,2039l241,139l550-1507c5-14-5-28-19-28L1172,644z"}),/*#__PURE__*/e.jsx("path",{fill:"#FFFFFF",d:"M1580,644h-233c-17,0-33,11-39,27L738,2233l241,139l620-1701c5-14-5-28-19-28V644z"})]})]})})]})})}),[a.avalanche.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"1503",height:"1504",viewBox:"0 0 1503 1504",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"287",y:"258",width:"928",height:"844",fill:"white"}),/*#__PURE__*/e.jsx("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"})]}),[a.base.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),/*#__PURE__*/e.jsx("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"})]}),[a.celo.id]:t=>/*#__PURE__*/e.jsxs("svg",{fill:"none",height:"400",viewBox:"0 0 400 400",width:"400",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("path",{d:"m0 0h400v400h-400z",fill:"#fcff52"}),/*#__PURE__*/e.jsx("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"})]}),[a.linea.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"200",height:"208",viewBox:"0 0 200 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"199.4",height:"207.623",fill:"#121212"}),/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_2303_643)",children:[/*#__PURE__*/e.jsx("path",{d:"M132.369 155.99H49.7001V68.8854H68.6148V139.109H132.369V155.981V155.99Z",fill:"white"}),/*#__PURE__*/e.jsx("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__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2303_643",children:/*#__PURE__*/e.jsx("rect",{width:"99.5407",height:"103.977",fill:"white",transform:"translate(49.7001 52.0134)"})})})]}),[a.mainnet.id]:t=>/*#__PURE__*/e.jsxs("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",...t,children:[/*#__PURE__*/e.jsx("path",{fill:"#8492B2",d:"M163.7,197.2V0L0,271.6L163.7,197.2z"}),/*#__PURE__*/e.jsx("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__*/e.jsx("path",{fill:"#454A75",d:"M163.7,197.2v171.2l163.7-96.8L163.7,197.2z"}),/*#__PURE__*/e.jsx("path",{fill:"#8492B2",d:"M163.7,399.4L0,302.7l163.7,230.7V399.4z"}),/*#__PURE__*/e.jsx("path",{fill:"#62688F",d:"M327.5,302.7l-163.8,96.7v134L327.5,302.7z"})]}),[a.optimism.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"500",height:"500",viewBox:"0 0 500 500",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("circle",{cx:"250",cy:"250",r:"250",fill:"#FF0420"}),/*#__PURE__*/e.jsx("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__*/e.jsx("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"})]}),[a.polygon.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"360",height:"360",viewBox:"0 0 360 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"360",height:"360",rx:"180",fill:"#6C00F6"}),/*#__PURE__*/e.jsx("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"})]}),[a.zora.id]:t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",...t,children:[/*#__PURE__*/e.jsx("g",{clipPath:"url(#clip0)",children:/*#__PURE__*/e.jsx("g",{clipPath:"url(#clip1)",children:/*#__PURE__*/e.jsx("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.jsxs("defs",{children:[/*#__PURE__*/e.jsxs("radialGradient",{id:"paint0",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(21.6921 8.02215) rotate(180) scale(25.2008)",children:[/*#__PURE__*/e.jsx("stop",{offset:"0.00682297",stopColor:"#F2CEFE"}),/*#__PURE__*/e.jsx("stop",{offset:"0.1913",stopColor:"#AFBAF1"}),/*#__PURE__*/e.jsx("stop",{offset:"0.4982",stopColor:"#4281D3"}),/*#__PURE__*/e.jsx("stop",{offset:"0.666667",stopColor:"#2E427D"}),/*#__PURE__*/e.jsx("stop",{offset:"0.822917",stopColor:"#230101"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#8F6B40"})]}),/*#__PURE__*/e.jsx("clipPath",{id:"clip0",children:/*#__PURE__*/e.jsx("rect",{width:"30",height:"30",fill:"white"})}),/*#__PURE__*/e.jsx("clipPath",{id:"clip1",children:/*#__PURE__*/e.jsx("rect",{width:"30",height:"30",fill:"white"})})]})]})};const hg=({chainId:t,...r})=>{if("solana"===t)/*#__PURE__*/return e.jsx(ug,{...r});let n=pg[t];return n?/*#__PURE__*/e.jsx(n,{...r}):/*#__PURE__*/e.jsx(lt.default,{...r})},yg=({wallet:t,displayName:r,addressToFund:n,chainId:i,chainName:a,isBridging:o,isErc20Flow:s,totalPriceInNativeCurrency:l,totalPriceInUsd:c,gasPriceInNativeCurrency:d,gasPriceInUsd:u})=>{let p=ui(t.walletClientType);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(jc,{}),/*#__PURE__*/e.jsx(us,{style:{marginTop:"16px"},children:/*#__PURE__*/e.jsx(Uy,{icon:p?.image_url?.md,name:t.walletClientType})}),/*#__PURE__*/e.jsx(gc,{style:{marginTop:"8px",marginBottom:"12px"},title:`${o?"Bridging":"Confirming"} with ${r}`}),!o&&!s&&/*#__PURE__*/e.jsxs(og,{children:[/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Total"}),/*#__PURE__*/e.jsx(dg,{children:c||l})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"To"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:n,showCopyIcon:!1})})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Network"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsxs(mg,{children:[/*#__PURE__*/e.jsx(hg,{chainId:i,height:16,width:16})," ",a]})})]}),d&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(dg,{children:u||d})]})]}),/*#__PURE__*/e.jsx(xs,{height:24}),/*#__PURE__*/e.jsx(Ia,{})]})};let mg=/*#__PURE__*/g.styled.div.withConfig({displayName:"NetworkColumn",componentId:"sc-ec6320ce-0"})(["display:flex;flex-direction:row;align-items:center;gap:4px;"]);const gg={component:()=>{let{closePrivyModal:t,createAnalyticsEvent:n}=s.usePrivyInternal(),{navigate:i,setModalData:c,app:d,data:u}=Ui(),{wallets:p}=Xw(),h=Yp(),[y,m]=r.useState(0n),[g,f]=r.useState(null),[w,v]=r.useState(!1),[x,C]=r.useState(!1),b=r.useRef(!1);if(!u?.funding||"solana"!==u.funding.chainType)throw Error("Invalid funding data");let{address:k,amount:E,cluster:A,connectedWalletAddress:T}=u.funding,j=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:I}=Ks("solana"),{fundingAmountInBaseUnit:S,totalPriceInUsd:P,totalPriceInNativeCurrency:_,feePriceInNativeCurrency:N,feePriceInUsd:M}=$o({amount:E,fee:y,tokenPrice:I,isUsdc:u.funding.isUSDC}),W=T?p.find((({address:e})=>e===T)):p[0],F=ui(W?.walletClientType||"unknown"),U=F?.name||"wallet";return r.useEffect((()=>{(async()=>{if("solana"===W?.type&&W.sendTransaction&&!w&&!b.current){b.current=!0;try{let e=h(Lm);if(!e)throw new o.PrivyClientError("Unable to load solana plugin");let{connection:t,transaction:r}=u.funding?.isUSDC?await e.createSplTransferTransaction({from:W.address,to:k,amount:S,mintAddress:a.SolanaUsdcAddressMap[A.name],cluster:A}):await e.createTransferTransaction({from:W.address,to:k,amount:S,cluster:A}),i=await r.getEstimatedFee(t);null!=i&&m(BigInt(i)),v(!0);let s=await t.simulateTransaction(r);if(s.value.err)return s.value.logs?.find((e=>/insufficient (lamports|funds)/gi.test(e)))?void f(new o.PrivyClientError(`Wallet ${Vr(W.address,void 0,void 0,"solana")} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",s.value.err),void f(new o.PrivyClientError("Something went wrong",void 0,o.PrivyErrorCode.TRANSACTION_FAILURE)));let c=await W.sendTransaction(r,t),{value:d,token:p}=u.funding?.isUSDC?{value:l.formatUnits(S,6),token:"USDC"}:{value:l.formatUnits(S,9),token:"SOL"};n({eventName:Um,payload:{provider:"external",status:"success",txHash:c,rpcEndpoint:j,address:W.address,value:d,chainType:"solana",clusterName:A.name,token:p,destinationAddress:k,destinationValue:d,destinationChainType:"solana",destinationClusterName:A.name,destinationToken:p}}),v(!1),C(!0)}catch(e){if(console.error(e),v(!1),/user rejected the request/gi.test(e.message||""))return void f(new o.PrivyClientError("Transaction was rejected by the user",void 0,o.PrivyErrorCode.TRANSACTION_FAILURE));f(new o.PrivyClientError("Something went wrong",void 0,o.PrivyErrorCode.TRANSACTION_FAILURE))}}})().catch(console.error).finally((()=>b.current=!1))}),[]),r.useEffect((()=>{g&&(c({funding:u?.funding,sendTransaction:u?.sendTransaction,errorModalData:{error:g,previousScreen:lf}}),i(Nu,!1))}),[g]),r.useEffect((()=>{if(!x)return;let e=setTimeout(t,Ut);return()=>clearTimeout(e)}),[x]),x?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsxs(ys,{children:[/*#__PURE__*/e.jsx(nt.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(gc,{title:"Success!",description:`You’ve successfully added ${E} ${u.funding?.isUSDC?"USDC":"SOL"} to your ${d.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]}):W&&w?/*#__PURE__*/e.jsx(yg,{wallet:W,displayName:U,addressToFund:k,isBridging:!1,isErc20Flow:!!u.funding?.isUSDC,totalPriceInUsd:P,totalPriceInNativeCurrency:_,gasPriceInUsd:M,gasPriceInNativeCurrency:N,chainId:"solana",chainName:A.name}):
|
|
26
|
+
/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(jc,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(Ia,{})]})}},fg=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}];let wg=2n**256n-1n;const vg=({amount:e,decimals:t})=>e===wg?"Maximum":Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t),xg=({chains:e,appId:t,address:r,rpcConfig:n,includeUsdc:i})=>Promise.all(e.map((async e=>{let o=l.createPublicClient({chain:e,transport:l.http($r(e,n,t))}),s=await o.getBalance({address:r}).catch((()=>0n)),c=null,d=a.UsdcAddressMap[e.id];if(i&&d){let{balance:i}=await Rm({address:r,chain:e,rpcConfig:n,appId:t,erc20Address:d});c=i}return{balance:s,erc20Balance:c,erc20Address:d,chain:e}}))),Cg=({balance:t,className:r,chain:n})=>/*#__PURE__*/e.jsx(Tm,{className:r,$state:void 0,children:/*#__PURE__*/e.jsx(bg,{balance:t,chain:n})}),bg=({balance:t,chain:r})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(kg,{children:[/*#__PURE__*/e.jsx(Ag,{chainId:"id"in r?r.id:"solana"}),/*#__PURE__*/e.jsx(dg,{children:r.name})]}),/*#__PURE__*/e.jsxs(wh,{isLoading:!1,isPulsing:!1,color:"gray",children:[/*#__PURE__*/e.jsx(Eg,{children:/*#__PURE__*/e.jsx(Be.default,{})}),t]})]});let kg=/*#__PURE__*/g.styled.div.withConfig({displayName:"Container",componentId:"sc-d24ae982-0"})(["display:flex;align-items:center;"]),Eg=/*#__PURE__*/g.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-d24ae982-1"})(["height:0.75rem;width:0.75rem;margin-right:0.2rem;"]),Ag=/*#__PURE__*/g.styled(hg).withConfig({displayName:"StyledNetworkIcon",componentId:"sc-d24ae982-2"})(["height:1.25rem;width:1.25rem;display:inline-block;margin-right:0.5rem;border-radius:4px;"]);const Tg=({options:t,onSelect:r,selected:n,className:i})=>/*#__PURE__*/e.jsxs(S.Menu,{as:jg,children:[/*#__PURE__*/e.jsxs(S.MenuButton,{as:_g,children:[/*#__PURE__*/e.jsx(bg,{balance:n.balance,chain:n.chain}),/*#__PURE__*/e.jsx(Pg,{height:16})]}),/*#__PURE__*/e.jsx(S.MenuItems,{as:Ig,className:i,children:t.map(((t,n)=>/*#__PURE__*/e.jsx(S.MenuItem,{as:Sg,onClick:()=>r(n),children:/*#__PURE__*/e.jsx(bg,{balance:t.balance,chain:t.chain})},n)))})]});let jg=/*#__PURE__*/g.styled.div.withConfig({displayName:"Wrapper",componentId:"sc-31c00f79-0"})(["width:100%;position:relative;"]),Ig=/*#__PURE__*/g.styled.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;"]),Sg=/*#__PURE__*/g.styled.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);}"]),Pg=/*#__PURE__*/g.styled(Fe.default).withConfig({displayName:"StyledChevronIcon",componentId:"sc-31c00f79-3"})(["height:1rem;margin-left:0.5rem;"]),_g=/*#__PURE__*/g.styled.button.withConfig({displayName:"StyledMenuButton",componentId:"sc-31c00f79-4"})([""," span{margin-left:auto;}","{transition:rotate 100ms ease-in;}&[aria-expanded='true']{","{rotate:-180deg;}}"],Am,Pg,Pg);const Ng=({passkeys:t,isLoading:r,errorReason:n,success:i,expanded:a,onLinkPasskey:o,onUnlinkPasskey:s,onExpand:l,onBack:c,onClose:d})=>i?/*#__PURE__*/e.jsx(Xc,{title:"Passkeys updated",icon:P.CheckCircle,iconVariant:"success",primaryCta:{label:"Done",onClick:d},onClose:d,watermark:!0}):a?/*#__PURE__*/e.jsx(Xc,{icon:P.FingerprintIcon,title:"Your passkeys",onBack:c,onClose:d,watermark:!0,children:/*#__PURE__*/e.jsx(Wg,{passkeys:t,expanded:a,onUnlink:s,onExpand:l})}):/*#__PURE__*/e.jsx(Xc,{icon:P.FingerprintIcon,title:"Set up passkey verification",subtitle:"Verify with passkey",primaryCta:{label:"Add new passkey",onClick:o,loading:r},onClose:d,watermark:!0,helpText:n||void 0,children:0===t.length?/*#__PURE__*/e.jsx(Fg,{}):/*#__PURE__*/e.jsx(Mg,{children:/*#__PURE__*/e.jsx(Wg,{passkeys:t,expanded:a,onUnlink:s,onExpand:l})})});let Mg=/*#__PURE__*/g.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-e693657c-0"})(["margin-bottom:12px;"]),Wg=({passkeys:t,expanded:n,onUnlink:i,onExpand:a})=>{let[o,s]=r.useState([]),l=n?t.length:2,c=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.jsxs("div",{children:[/*#__PURE__*/e.jsx(Bg,{children:"Your passkeys"}),/*#__PURE__*/e.jsxs(Dg,{children:[t.slice(0,l).map((t=>/*#__PURE__*/e.jsxs($g,{children:[/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx(zg,{children:c(t)}),/*#__PURE__*/e.jsxs(Hg,{children:["Last used: ",(t.latestVerifiedAt??t.verifiedAt).toLocaleString()]})]}),/*#__PURE__*/e.jsx(Vg,{disabled:o.includes(t.credentialId),onClick:()=>(async e=>{s((t=>t.concat([e]))),await i(e),s((t=>t.filter((t=>t!==e))))})(t.credentialId),children:o.includes(t.credentialId)?/*#__PURE__*/e.jsx(po,{}):/*#__PURE__*/e.jsx(P.Trash2,{size:16})})]},t.credentialId))),t.length>2&&!n&&/*#__PURE__*/e.jsx(Lg,{onClick:a,children:"View all"})]})]})},Fg=()=>/*#__PURE__*/e.jsxs(Dy,{style:{color:"var(--privy-color-foreground)"},children:[/*#__PURE__*/e.jsx(By,{children:"Verify with Touch ID, Face ID, PIN, or hardware key"}),/*#__PURE__*/e.jsx(By,{children:"Takes seconds to set up and use"}),/*#__PURE__*/e.jsx(By,{children:"Use your passkey to verify transactions and login to your account"})]});const Ug={component:()=>{let{user:t,unlinkPasskey:n}=u.usePrivyContext(),{linkWithPasskey:i,closePrivyModal:a}=s.usePrivyInternal(),l=t?.linkedAccounts.filter((e=>"passkey"===e.type)),[c,d]=r.useState(!1),[p,h]=r.useState(""),[y,m]=r.useState(!1),[g,f]=r.useState(!1);return r.useEffect((()=>{0===l.length&&f(!1)}),[l.length]),/*#__PURE__*/e.jsx(Ng,{passkeys:l,isLoading:c,errorReason:p,success:y,expanded:g,onLinkPasskey:()=>{d(!0),i().then((()=>m(!0))).catch((e=>{if(e instanceof o.PrivyError){if(e.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return void h("Cannot link more passkeys to account.");if(e.privyErrorCode===o.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return void h("Passkey request timed out or rejected by user.")}h("Unknown error occurred.")})).finally((()=>{d(!1)}))},onUnlinkPasskey:async e=>(d(!0),await n(e).then((()=>m(!0))).catch((e=>{e instanceof o.PrivyError&&e.privyErrorCode===o.PrivyErrorCode.MISSING_MFA_CREDENTIALS?h("Cannot unlink a passkey enrolled in MFA"):h("Unknown error occurred.")})).finally((()=>{d(!1)}))),onExpand:()=>f(!0),onBack:()=>f(!1),onClose:()=>a()})}},Rg=/*#__PURE__*/g.styled.div.withConfig({displayName:"DoubleIconWrapper",componentId:"sc-e693657c-1"})(["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 Og=/*#__PURE__*/g.css(["&&{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 Lg=/*#__PURE__*/g.styled.button.withConfig({displayName:"LinkButton",componentId:"sc-e693657c-2"})(["",""],Og);let Dg=/*#__PURE__*/g.styled.div.withConfig({displayName:"List",componentId:"sc-e693657c-3"})(["display:flex;flex-direction:column;align-items:stretch;gap:0.8rem;padding:0.5rem 0rem 0rem;flex-grow:1;width:100%;"]),Bg=/*#__PURE__*/g.styled.div.withConfig({displayName:"PasskeyListTitle",componentId:"sc-e693657c-4"})(["line-height:20px;height:20px;font-size:1em;font-weight:450;display:flex;justify-content:flex-beginning;width:100%;"]),zg=/*#__PURE__*/g.styled.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-e693657c-5"})(["font-size:1em;line-height:1.3em;font-weight:500;color:var(--privy-color-foreground-2);padding:0.2em 0;"]),Hg=/*#__PURE__*/g.styled.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-e693657c-6"})(["font-size:0.875rem;line-height:1rem;color:#64668b;padding:0.2em 0;"]),$g=/*#__PURE__*/g.styled.div.withConfig({displayName:"PasskeyListItem",componentId:"sc-e693657c-7"})(["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;"]),qg=/*#__PURE__*/g.css([":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);}"]),Vg=/*#__PURE__*/g.styled.button.withConfig({displayName:"PasskeyItemUnlinkButton",componentId:"sc-e693657c-8"})(["",""],qg);const Kg=/*#__PURE__*/g.styled.div.withConfig({displayName:"FundingMethodContainer",componentId:"sc-eaaa12a-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),Gg=/*#__PURE__*/g.styled.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);}"]),Yg=/*#__PURE__*/g.styled.div.withConfig({displayName:"FundingQuantityWrapper",componentId:"sc-eaaa12a-2"})(["display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:8px;"]),Zg=/*#__PURE__*/g.styled.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);}"]),Qg=/*#__PURE__*/g.styled.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;}"]),Xg=/*#__PURE__*/g.styled(Qg).withConfig({displayName:"FundingAmountInputLarge",componentId:"sc-eaaa12a-6"})(["&&{font-size:42px;}"]),Jg=/*#__PURE__*/g.styled.div.withConfig({displayName:"FundingCurrency",componentId:"sc-eaaa12a-8"})(["font-size:18px;"]),ef=/*#__PURE__*/g.styled.div.withConfig({displayName:"FundingDollars",componentId:"sc-eaaa12a-9"})(["font-size:12px;color:var(--privy-color-foreground-3);height:20px;"]),tf=/*#__PURE__*/g.styled.div.withConfig({displayName:"InfoButtonText",componentId:"sc-eaaa12a-13"})([""]),rf=/*#__PURE__*/g.styled.a.withConfig({displayName:"InfoButtonLink",componentId:"sc-eaaa12a-14"})(["&&{color:var(--privy-color-accent);}cursor:pointer;"]),nf=({displayName:t,errorMessage:n,configuredFundingChain:i,formattedBalance:o,fundingAmount:s,fundingCurrency:l,fundingAmountInUsd:c,options:d,selectedOption:u,isPreparing:p,isSubmitting:h,addressToFund:y,fundingWalletAddress:m,onSubmit:g,onSelect:f,onAmountChange:w,erc20ContractInfo:v})=>{let x=r.useRef(null);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsx(fm,{children:"Transfer from another network"}),/*#__PURE__*/e.jsxs(gm,{children:["You need more funds on the ",i.name," network. Bridge from another blockchain network."]}),/*#__PURE__*/e.jsxs(Yg,{style:{marginTop:"2rem"},children:[/*#__PURE__*/e.jsxs(Zg,{onClick:()=>x.current?.focus(),children:[/*#__PURE__*/e.jsx(Qg,{ref:x,value:s,onChange:e=>{let t=e.target.value;if(/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1){let e=/\.$/.test(t)?".":"",r=Number(t.replace(/\.$/,"")||"0");if(Number.isNaN(r))return void w("0");w(r.toString()+e)}}}),/*#__PURE__*/e.jsx(Jg,{children:l})]}),c&&/*#__PURE__*/e.jsx(ef,{children:c})]}),/*#__PURE__*/e.jsxs(sg,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/e.jsx(lg,{children:"From"}),/*#__PURE__*/e.jsx(lg,{children:a.formatWalletAddress(m)})]}),/*#__PURE__*/e.jsx(Tg,{selected:{chain:u.chain,balance:u.isErc20Quote?vg({amount:u.erc20Balance??0n,decimals:v?.decimals??6})+` ${v?.symbol||""}`:Mo(u.balance,u.chain.nativeCurrency.symbol,3,!0)},options:d.map((({chain:e,balance:t,isErc20Quote:r,erc20Balance:n})=>({chain:e,balance:r?vg({amount:n??0n,decimals:v?.decimals??6})+` ${v?.symbol||""}`:Mo(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:f}),/*#__PURE__*/e.jsxs(sg,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/e.jsx(lg,{children:"To"}),/*#__PURE__*/e.jsx(lg,{children:a.formatWalletAddress(y)})]}),/*#__PURE__*/e.jsx(Cg,{chain:i,balance:o}),/*#__PURE__*/e.jsx(yp,{style:{marginTop:"1rem"},children:n}),/*#__PURE__*/e.jsxs(fo,{style:{marginTop:"1rem"},loading:h||p,disabled:p||h,onClick:g,children:["Confirm with ",t]}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]})},af={component:()=>{let{rpcConfig:t,appId:n,closePrivyModal:i,createAnalyticsEvent:c}=s.usePrivyInternal(),{navigate:d,setModalData:u,app:p,data:h}=Ui(),{wallets:y}=Ys(),[m,g]=r.useState(!1),[f,w]=r.useState(0n),[v,x]=r.useState(!1),[C,b]=r.useState(null),[k,E]=r.useState(null),[A,T]=r.useState([]),[j,I]=r.useState(0),[S,P]=r.useState(!1),[_,N]=r.useState(!1),[M,W]=r.useState(!1),[F,U]=r.useState(!1),[R,O]=r.useState(),[L,D]=r.useState();if(!h?.funding||"ethereum"!==h.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:B,chain:z,connectedWalletAddress:H}=h.funding,$=h.funding.address,q=h.funding.erc20Address,[V,K]=r.useState(h.funding.amount);r.useEffect((()=>{q&&!B&&b(Error("Unable to fetch token details"))}),[]);let G=!!q&&!!B,Y=G?BigInt(parseFloat(V)*10**B.decimals):l.parseEther(V),Z=H?y.find((({address:e})=>e===H)):y[0],Q=ui(Z?.walletClientType||"unknown"),X=Q?.name||"wallet",[J,ee]=r.useState(null);r.useEffect((()=>{(async()=>{if(!Z)return;let e=await Z.getEthereumProvider();ee(l.createWalletClient({account:Z.address,transport:l.custom(e)}).extend(l.publicActions))})().catch(console.error)}),[Z]);let[te,re]=r.useState(0n);r.useEffect((()=>{l.createPublicClient({chain:z,transport:l.http($r(z,t,n))}).getBalance({address:$}).then(re).catch(console.error)}),[]);let[ne,ie]=r.useState(0n);r.useEffect((()=>{G&&Rm({chain:z,address:$,appId:n,rpcConfig:t,erc20Address:q}).then((e=>ie(e.balance))).catch(console.error)}),[]);let{tokenPrice:ae}=Ks(z.id),[oe,se]=r.useState({to:$,chain:z,value:Y,data:void 0});r.useEffect((()=>{(async()=>{let e,r;if(!J||!Z||S||M)return;P(!0);let i=l.createPublicClient({chain:oe.chain,transport:l.http($r(oe.chain,t,n))});if(G&&!oe.data)return await i.simulateContract({address:q,chain:oe.chain,abi:fg,functionName:"transfer",args:[$,Y],account:Z.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(P(!1),void se({to:q,chain:oe.chain,data:l.encodeFunctionData({abi:fg,functionName:"transfer",args:[$,Y]}),value:"0x0"})):(P(!1),void x(!0));try{e=await i.prepareTransactionRequest({account:Z.address,to:oe.to,chain:oe.chain,data:oe.data,value:BigInt(oe.value??0)})}catch(e){if(console.error(e),A.length>1)E(e.shortMessage??"Something went wrong");else if(_&&0===A.length)return void b(new o.PrivyClientError(`Wallet ${Vr(Z.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE))}if(!e)return P(!1),void x(!0);P(!1),W(!0),g(!0),w(e.gas);try{await J.switchChain({id:oe.chain.id})}catch(e){await J.addChain({chain:oe.chain}),await J.switchChain({id:oe.chain.id})}try{r=await J.sendTransaction(e)}catch(e){if(console.error(e),"TransactionExecutionError"===e.name)if(A.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 o.PrivyClientError(t,void 0,o.PrivyErrorCode.TRANSACTION_FAILURE))}else E(e.shortMessage??"Something went wrong")}if(r)return await J.waitForTransactionReceipt({hash:r}),W(!1),_?(O(r),void D("pending")):(U(!0),void c({eventName:Um,payload:{provider:"external",status:"success",txHash:r,address:Z.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?l.formatUnits(BigInt(oe.value),B?.decimals??18):void 0,token:B?.symbol??q??"ETH",destinationAddress:$,destinationChainId:z.id,destinationChainType:"ethereum",destinationValue:Y?l.formatUnits(Y,B?.decimals??18):void 0,destinationToken:B?.symbol??q??z.nativeCurrency.name}}));W(!1)})().catch(console.error)}),[J,oe]),r.useEffect((()=>{(async()=>{if(!v||!J||!Z)return;let e=a.addToDefaultChains(p.chains).filter((e=>e.id!==z.id&&!!e.testnet==!!z.testnet));G&&e.unshift(z);let r=await xg({chains:e,address:Z.address,appId:n,rpcConfig:t,includeUsdc:h.funding?.isUSDC}),i=G?r.filter((e=>e.balance>0n)):r.filter((e=>e.balance>Y));if(i.length<1)return void b(new o.PrivyClientError(`Wallet ${Vr(Z.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE));i.sort(((e,t)=>Number(G?(t.erc20Balance??0n)-(e.erc20Balance??0n):t.balance-e.balance)));let s=i.flatMap((e=>{let t=[{...e,isErc20Quote:!1,isTestnet:!!z.testnet,input:Eu({amount:Y.toString(),user:Z.address,recipient:$,destinationChainId:z.id,destinationCurrency:q,originChainId:e.chain.id})}];return G&&q&&(e.erc20Balance??0n)>=Y&&t.push({...e,isErc20Quote:!0,isTestnet:!!z.testnet,input:Eu({amount:Y.toString(),user:Z.address,recipient:$,destinationChainId:z.id,destinationCurrency:q,originChainId:e.chain.id,originCurrency:e.erc20Address})}),t})),l=(await Promise.allSettled(s.map((async e=>({...e,quote:await ju(e)}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(l.length<1)return void b(new o.PrivyClientError(`Wallet ${Vr(Z.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE));let c=l.map((e=>({bridgeTx:Iu(e.quote),balance:e.balance,chain:e.chain,erc20Balance:e.erc20Balance,isErc20Quote:e.isErc20Quote}))).filter((e=>!!e.bridgeTx));if(c.length>1)return void T(c);let d=c[0];d?(N(!0),se({data:d.bridgeTx.data,to:d.bridgeTx.to,value:d.bridgeTx.value,chain:d.chain})):b(new o.PrivyClientError(`Wallet ${Vr(Z.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[v]),Su({transactionHash:R,wallet:Z,isTestnet:!!z.testnet,bridgingStatus:L,setBridgingStatus:D,onSuccess({transactionHash:e,wallet:t}){N(!1),U(!0),c({eventName:Um,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?l.formatUnits(BigInt(oe.value),B?.decimals??18):void 0,token:B?.symbol??q??"ETH",destinationAddress:$,destinationChainId:z.id,destinationChainType:"ethereum",destinationValue:Y?l.formatUnits(Y,B?.decimals??18):void 0,destinationToken:B?.symbol??q??z.nativeCurrency.name}})},onFailure({error:e}){N(!1),b(e)}}),r.useEffect((()=>{C&&(u({funding:h?.funding,sendTransaction:h?.sendTransaction,errorModalData:{error:C,previousScreen:lf}}),d(Nu,!1))}),[C]);let le=!G&&ae?_o(V??"0",ae):void 0,ce=G?f:Fo([f,Y]),de=ce&&ae?No(ce,ae):void 0,ue=ce?Mo(ce,h?.funding?.erc20Address?h?.funding?.erc20ContractInfo?.symbol||"ETH":h?.funding?.chain.nativeCurrency.symbol||"ETH"):void 0,pe=f&&ae?No(f,ae):void 0,he=f?Mo(f,z?.nativeCurrency?.symbol||"ETH"):void 0;if(r.useEffect((()=>{if(!F)return;let e=setTimeout(i,Ut);return()=>clearTimeout(e)}),[F]),F/*#__PURE__*/)return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsxs(ys,{children:[/*#__PURE__*/e.jsx(nt.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(gc,{title:"Success!",description:`You’ve successfully added ${V} ${G?B.symbol:z.nativeCurrency.symbol} to your ${p.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]});let ye=G?`${vg({amount:ne,decimals:B.decimals})} ${B.symbol}`:Mo(te,z.nativeCurrency.symbol,3,!0),me=A[j];return A.length>1&&me?/*#__PURE__*/e.jsx(nf,{displayName:X,configuredFundingChain:z,erc20ContractInfo:B,formattedBalance:ye,fundingAmount:V,fundingCurrency:G?B.symbol:z.nativeCurrency.symbol,fundingAmountInUsd:le,options:A,selectedOption:me,isPreparing:S,isSubmitting:M,addressToFund:$,fundingWalletAddress:Z?.address||"",errorMessage:k,onSubmit:()=>{h.funding?.amount!==V?async function(){if(Z&&me)try{let e=await ju({isTestnet:!!z.testnet,input:Eu({amount:Y.toString(),user:Z.address,recipient:$,destinationChainId:z.id,destinationCurrency:q,originChainId:me.chain.id})}),t=Iu(e);if(!t)throw Error("Invalid transaction request");N(!0),se({data:t.data,to:t.to,value:t.value,chain:me.chain})}catch(e){console.error(e),b(new o.PrivyClientError("Unable to fetch quotes for bridging",e,o.PrivyErrorCode.INSUFFICIENT_BALANCE))}}().catch(console.error):se({to:me.bridgeTx.to,data:me.bridgeTx.data,value:me.bridgeTx.value,chain:me.chain})},onSelect:e=>{e!==j&&(E(null),I(e))},onAmountChange:K}):m&&f&&Z&&h?.funding?/*#__PURE__*/e.jsx(yg,{wallet:Z,displayName:X,addressToFund:$,isBridging:_,isErc20Flow:G,totalPriceInUsd:de,totalPriceInNativeCurrency:ue,gasPriceInUsd:pe,gasPriceInNativeCurrency:he,chainId:z.id,chainName:z.name}):
|
|
27
|
+
/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(jc,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(Ia,{})]})}},of={component:function(){let{closePrivyModal:t,createAnalyticsEvent:n}=s.usePrivyInternal(),{navigate:i,setModalData:a,app:c,data:d}=Ui(),{wallets:u}=Xw(),p=r.useRef(!1),h=Yp(),[y,m]=r.useState(!1),[g,f]=r.useState(!1),[w,v]=r.useState(null),[x,C]=r.useState(),[b,k]=r.useState();if(!d?.funding||"ethereum"!==d.funding.chainType)throw Error("Invalid funding data");let{amount:E,connectedWalletAddress:A,chain:T,cluster:j,isUSDC:I}=d.funding,S=d.funding.address,P=d.funding.erc20Address,_=d.funding.isUSDC?"USDC":T.nativeCurrency.symbol,N=j??{name:"mainnet-beta"},M=A?u.find((({address:e})=>e===A)):u[0],W=ui(M?.walletClientType||"unknown"),F=W?.name||"wallet";return r.useEffect((()=>{(async function(){if(!M||!T||p.current)return;let e=h(Lm);if(!e)return void v(new o.PrivyClientError("Unable to solana plugin"));p.current=!0,T?.testnet&&console.warn("Solana testnets are not supported for bridging");let t=I?1e6*parseFloat(E):l.parseEther(E),r=await ju({isTestnet:!!T.testnet,input:Eu({amount:t.toString(),user:M.address,recipient:S,destinationChainId:T.id,originChainId:wi,originCurrency:I?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":vi,destinationCurrency:I?P:void 0})}).catch(console.error);if(!r)return void v(new o.PrivyClientError(`Unable to fetch quotes for bridging. Wallet ${Kr(M.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE));let n=await e.createBridgeTransactionFromRelayQuote({quote:r,from:M.address,cluster:N});if(n)try{m(!0);let{connection:e,transaction:t}=n,i=await e.simulateTransaction(t);if(i.value.err)return i.value.logs?.find((e=>/insufficient (lamports|funds)/gi.test(e)))?void v(new o.PrivyClientError(`Wallet ${Kr(M?.address)} does not have enough funds. ${r.details.currencyIn.amountFormatted} ${_} are needed to complete the transaction.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",i.value.err),void v(new o.PrivyClientError("Something went wrong",void 0,o.PrivyErrorCode.TRANSACTION_FAILURE)));let a=await M.sendTransaction(t,e),s=await e.confirmTransaction(a);if(s.value.err)return console.error("Transaction failed:",s.value.err),void v(new o.PrivyClientError("Something went wrong",void 0,o.PrivyErrorCode.TRANSACTION_FAILURE));C(a),k("pending")}catch(e){if(console.error(e),/user rejected the request/gi.test(e.message||""))return void v(new o.PrivyClientError("Transaction was rejected by the user",void 0,o.PrivyErrorCode.TRANSACTION_FAILURE));v(new o.PrivyClientError("Something went wrong",void 0,o.PrivyErrorCode.TRANSACTION_FAILURE))}else v(new o.PrivyClientError(`Unable to select bridge option from quotes. Wallet ${Kr(M.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[]),Su({transactionHash:x,wallet:M,isTestnet:!1,bridgingStatus:b,setBridgingStatus:k,onSuccess({transactionHash:e,wallet:t}){m(!1),f(!0),n({eventName:Um,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainType:"solana",clusterName:N.name,token:"SOL",destinationAddress:S,destinationChainId:T.id,destinationChainType:"ethereum",destinationValue:E,destinationToken:I?"USDC":"ETH"}})},onFailure({error:e}){m(!1),v(e)}}),r.useEffect((()=>{if(!g)return;let e=setTimeout(t,Ut);return()=>clearTimeout(e)}),[g]),r.useEffect((()=>{w&&(a({funding:d?.funding,sendTransaction:d?.sendTransaction,errorModalData:{error:w,previousScreen:lf}}),i(Nu,!1))}),[w]),g?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsxs(ys,{children:[/*#__PURE__*/e.jsx(nt.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(gc,{title:"Success!",description:`You’ve successfully added ${E} ${_} to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]}):y&&M?/*#__PURE__*/e.jsx(yg,{wallet:M,displayName:F,addressToFund:S,isBridging:y,isErc20Flow:!1,chainId:T.id,chainName:T.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
|
|
28
|
+
/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(jc,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(Ia,{})]})}},sf={component:()=>{let{data:t,setModalData:n}=Ui(),i=t?.funding,a="solana"===i.chainType,o=r.useRef(null),{tokenPrice:s}=Ks(a?"solana":i.chain.id),l=a?void 0:i,c=!(!l?.erc20Address||l?.erc20ContractInfo),d=a?i.isUSDC?"USDC":"SOL":i.erc20Address?i.erc20ContractInfo?.symbol:i.chain.nativeCurrency.symbol||"ETH",u=parseFloat(i.amount),p=!isNaN(u)&&u>0,h=s?_o(i.amount,s):void 0;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(fm,{children:"Confirm or edit amount"}),/*#__PURE__*/e.jsxs(ms,{style:{marginTop:"32px"},children:[/*#__PURE__*/e.jsx(Yg,{children:c?/*#__PURE__*/e.jsx(jc,{size:"50px"}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Zg,{onClick:()=>o.current?.focus(),children:[/*#__PURE__*/e.jsx(Xg,{ref:o,value:i.amount,onChange:e=>{let r=e.target.value;/^[0-9.]*$/.test(r)&&r.split(".").length-1<=1&&n({...t,funding:{...i,amount:r}})}}),/*#__PURE__*/e.jsx(Jg,{children:d})]}),!l?.erc20Address&&/*#__PURE__*/e.jsx(ef,{children:h&&p?`${h} USD`:""})]})}),/*#__PURE__*/e.jsx(fo,{style:{marginTop:"1rem"},disabled:!p,onClick:i.onContinueWithExternalWallet,children:"Continue"})]}),/*#__PURE__*/e.jsx(Ia,{})]})}},lf={component:()=>{let t,{connectors:n}=s.usePrivyInternal(),{app:i,setModalData:a,data:o,navigate:l}=Ui(),{wallets:c}=Ys(),{wallets:d}=Xw(),[u,p]=r.useState("default"),h="solana"===o?.funding?.chainType,y=!!o?.funding?.crossChainBridgingEnabled;t="ethereum"===o?.funding?.chainType?o.funding.erc20Address&&!o.funding.isUSDC?"ethereum-only":y&&!o.funding.chain.testnet?"ethereum-and-solana":"ethereum-only":y&&!o.funding?.isUSDC?"ethereum-and-solana":"solana-only";let m=c.filter((e=>"privy"!==e.walletClientType)),g=m.map((e=>e.walletClientType)),f=d.filter((e=>"privy"!==e.walletClientType)),w=f.map((e=>e.walletClientType)),v=[],x={...o.funding};x.usingDefaultFundingMethod&&(x.usingDefaultFundingMethod=!1);let C=({address:e,walletChainType:t})=>{a({...o,funding:{...x,connectedWalletAddress:e,onContinueWithExternalWallet:()=>l(k({destChainType:h?"solana":"ethereum",sourceChainType:t}))}}),l(sf)};"solana-only"!==t&&v.push(...m.map(((t,r)=>/*#__PURE__*/e.jsx(cf,{onClick:()=>C({address:t.address,walletChainType:"ethereum"}),icon:t.meta.icon,name:t.meta.name,chainType:t.type},r)))),"ethereum-only"!==t&&v.push(...f.map(((t,r)=>/*#__PURE__*/e.jsx(cf,{onClick:()=>C({address:t.address,walletChainType:"solana"}),icon:t.meta.icon,name:t.meta.name,chainType:t.type},r)))),v.push(...rm({walletList:i.appearance.walletList.filter((e=>!m.some((t=>t.walletClientType===e))&&!f.some((t=>t.walletClientType===e)))),walletChainType:t,connectors:n,connectOnly:!0,ignore:[...i.appearance.walletList,...g,...w],walletConnectEnabled:i.externalWallets.walletConnect.enabled}));let b=/*#__PURE__*/e.jsx(sy,{text:"More wallets",onClick:()=>p("overflow")}),k=({sourceChainType:e,destChainType:t})=>"ethereum"===e&&"solana"===t?Tv:"ethereum"===e&&"ethereum"===t?af:"solana"===e&&"ethereum"===t?of:gg;return r.useEffect((()=>{a({...o,externalConnectWallet:{onCompleteNavigateTo:({walletChainType:e})=>(a({...o,funding:{...x,onContinueWithExternalWallet:()=>{l(k({destChainType:h?"solana":"ethereum",sourceChainType:e??"ethereum"}))}}}),sf)}})}),[]),"overflow"===u?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:()=>p("default")},"header"),/*#__PURE__*/e.jsxs(ga,{children:[/*#__PURE__*/e.jsx(gm,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),v]}),/*#__PURE__*/e.jsx(Ia,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(gc,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),/*#__PURE__*/e.jsxs(ga,{children:[v.length>4?v.slice(0,3):v,v.length>4&&b]}),/*#__PURE__*/e.jsx(Ia,{})]})}};let cf=({onClick:t,icon:r,name:n,chainType:i})=>/*#__PURE__*/e.jsxs(xa,{onClick:t,children:[/*#__PURE__*/e.jsx(Gg,{style:{width:20},children:/*#__PURE__*/e.jsx("img",{src:r})}),n,/*#__PURE__*/e.jsx(wh,{color:"gray",style:{marginLeft:"auto"},children:"Connected"}),"solana"===i&&/*#__PURE__*/e.jsx(wh,{color:"gray",children:"Solana"})]});const df={component:()=>{let{data:t,setModalData:n,navigate:i,navigateBack:a}=Ui(),{closePrivyModal:o,createAnalyticsEvent:l,client:c}=s.usePrivyInternal(),[d,u]=r.useState("pending-in-flow"),p=r.useRef(0),h={...t?.funding,showAlternateFundingMethod:!0};h.usingDefaultFundingMethod&&(h.usingDefaultFundingMethod=!1);let{partnerUserId:y,popup:m}=t?.coinbaseOnrampStatus??{};return r.useEffect((()=>{if("pending-in-flow"===d||"pending-after-flow"===d){let e=setInterval((async()=>{if(y)try{let{status:e}=await c.getCoinbaseOnRampStatus({partnerUserId:y});if("success"===e)return void u("success");if("failure"===e)throw Error("There was an error completing Coinbase Onramp flow.");if(p.current>=3)return n({funding:h}),void i(jf);m?.closed&&(p.current=p.current+1,u("pending-after-flow"))}catch(e){console.error(e),u("error"),l({eventName:Um,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),n({funding:{...h,errorMessage:"Something went wrong adding funds. Please try again or use another method."}}),i(jf)}}),1500);return()=>clearInterval(e)}}),[y,m,d]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{title:"Fund account",backFn:()=>{n({funding:h}),a()}},"header"),/*#__PURE__*/e.jsx(uf,{status:d,onClickCta:o}),/*#__PURE__*/e.jsx(Ia,{})]})}};let uf=({status:t,onClickCta:n})=>{let{title:i,body:a,cta:o}=r.useMemo((()=>(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:""}}})(t)),[t]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(yf,{children:[/*#__PURE__*/e.jsx(pf,{isSucccess:"success"===t}),/*#__PURE__*/e.jsxs(gs,{children:[/*#__PURE__*/e.jsx("h3",{children:i}),/*#__PURE__*/e.jsx(hf,{children:a})]})]}),o&&/*#__PURE__*/e.jsx(go,{onClick:n,children:o})]})},pf=({isSucccess:t})=>{if(!t){let t="var(--privy-color-foreground-4)";/*#__PURE__*/return e.jsxs("div",{style:{position:"relative"},children:[/*#__PURE__*/e.jsx(co,{color:t,style:{position:"absolute"}}),/*#__PURE__*/e.jsx(uo,{color:t}),/*#__PURE__*/e.jsx(gn,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let r=(t=>t?Xe.default:()=>/*#__PURE__*/e.jsx(st.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}))(t),n=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(t);/*#__PURE__*/return e.jsx("div",{style:{borderColor:n,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&/*#__PURE__*/e.jsx(r,{width:"4rem",height:"4rem",color:n})})},hf=/*#__PURE__*/g.styled.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;"]),yf=/*#__PURE__*/g.styled.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 mf={[a.mainnet.id]:"ethereum",[a.base.id]:"base",[a.optimism.id]:"optimism",[a.polygon.id]:"polygon",[a.arbitrum.id]:"arbitrum"};const gf=(e,t,r,n,i,s)=>new Promise((async(l,c)=>{let d=dc();if(!d)return void c(Error("Unable to initialize flow"));let u="ethereum"===t.chainType?function(e){let t=mf[e];if(!t)throw new o.PrivyClientError(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(t.chain.id):"solana",p=t.isUSDC?"USDC":"ethereum"===t.chainType?a.toCoinbaseAssetId(t.chain.id,"native-currency"):"SOL",h=await e.initCoinbaseOnRamp({addresses:[{address:t.address,blockchains:[u]}],assets:[p]}),{url:y}=a.getCoinbaseOnRampUrl({appId:e.getAppId(),input:h,amount:t.amount,blockchain:u,asset:p,experience:s});d.location=y.toString();let m={...i?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(m.usingDefaultFundingMethod=!1),r({funding:m,coinbaseOnrampStatus:{popup:d}}),n(df),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((()=>{r({funding:m,coinbaseOnrampStatus:{partnerUserId:h.partner_user_id,popup:d}})}),5e3),l()})),ff=({size:t=61,...r})=>/*#__PURE__*/e.jsx("svg",{width:t,height:t,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:/*#__PURE__*/e.jsxs("g",{id:"moonpay_symbol_wht 2",children:[/*#__PURE__*/e.jsx("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),/*#__PURE__*/e.jsx("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 wf={component:()=>{let{app:t,data:n,setModalData:i,navigateBack:a}=Ui(),{closePrivyModal:o}=s.usePrivyInternal(),{externalTransactionId:l}=n?.moonpayStatus,c=function(e,t=!1){let[n,i]=r.useState(null),{createAnalyticsEvent:a}=s.usePrivyInternal(),{data:o,navigate:l,setModalData:c}=Ui(),d=o?.funding,u=r.useRef(0);return r.useEffect((()=>{let r=setInterval((async()=>{if(e)try{let[n]=await async function(e,t){return le.ofetch(`${t?ir:nr}/transactions/ext/${e}`,{query:{apiKey:t?or:ar}})}(e,t),o="waitingAuthorization"===n.status&&"credit_debit_card"===n.paymentMethod?"pending":n.status;if(["failed","completed","awaitingAuthorization"].includes(o)&&(a({eventName:Um,payload:{status:o,provider:If,paymentMethod:n.paymentMethod,cardPaymentType:n.cardPaymentType,currency:n.currency?.code,baseCurrencyAmount:n.baseCurrencyAmount,quoteCurrencyAmount:n.quoteCurrencyAmount,feeAmount:n.feeAmount,extraFeeAmount:n.extraFeeAmount,networkFeeAmount:n.networkFeeAmount,isSandbox:t}}),clearInterval(r)),"failed"===o||"serviceFailure"===o)return c({funding:{...d,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),void l(jf);i(o)}catch(e){404!==e.response?.status&&(u.current+=1),u.current>=3&&(a({eventName:Um,payload:{status:"serviceFailure",provider:If}}),clearInterval(r),c({funding:{...d,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),l(jf))}}),3e3);return()=>clearInterval(r)}),[e,u]),n}(l||null,t.fundingMethodConfig.moonpay.useSandbox??!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{title:"Fund account",backFn:()=>{let e={...n?.funding,showAlternateFundingMethod:!0};e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),i({funding:e}),a()}}),/*#__PURE__*/e.jsx(vf,{status:c,onClickCta:o}),/*#__PURE__*/e.jsx(Ia,{})]})}};let vf=({status:t,onClickCta:n})=>{let{title:i,body:a,cta:o}=r.useMemo((()=>(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:""}}})(t)),[t]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(bf,{children:[/*#__PURE__*/e.jsx(xf,{status:t}),/*#__PURE__*/e.jsxs(gs,{children:[/*#__PURE__*/e.jsx("h3",{children:i}),/*#__PURE__*/e.jsx(Cf,{children:a})]})]}),o&&/*#__PURE__*/e.jsx(go,{onClick:n,children:o})]})},xf=({status:t})=>{if(!t||"pending"===t){let t="var(--privy-color-foreground-4)";/*#__PURE__*/return e.jsxs("div",{style:{position:"relative"},children:[/*#__PURE__*/e.jsx(co,{color:t,style:{position:"absolute"}}),/*#__PURE__*/e.jsx(uo,{color:t}),/*#__PURE__*/e.jsx(ff,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let r=(t=>{switch(t){case"completed":return Xe.default;case"waitingAuthorization":return()=>/*#__PURE__*/e.jsx(st.default,{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}})(t),n=(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)")(t);/*#__PURE__*/return e.jsx("div",{style:{borderColor:n,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&/*#__PURE__*/e.jsx(r,{width:"4rem",height:"4rem",color:n})})},Cf=/*#__PURE__*/g.styled.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;"]),bf=/*#__PURE__*/g.styled.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 kf=async(e,t,r,n,i,o,s,l)=>{let c=dc();if(!c)throw Error("Unable to initialize flow");let d="ethereum"===t.chainType?t.moonpayConfigOverride?.currencyCode??a.chainToMoonpayCurrency(t.chain.id,n):t.isUSDC?"USDC_SOL":"SOL",{signedUrl:u,externalTransactionId:p}=await e.signMoonpayOnRampUrl({address:t.address,useSandbox:r.fundingMethodConfig.moonpay.useSandbox??!1,config:{uiConfig:{accentColor:r.appearance.palette.accent,theme:r.appearance.palette.colorScheme},...t.moonpayConfigOverride,paymentMethod:l,currencyCode:d,quoteCurrencyAmount:t.moonpayConfigOverride?.quoteCurrencyAmount??Sf(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}}),c.location=u;let h={...s?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(h.usingDefaultFundingMethod=!1),i({moonpayStatus:{},funding:h}),o(wf),setTimeout((()=>{i({moonpayStatus:{externalTransactionId:p},funding:h})}),8e3)};let Ef=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 Af=()=>Ef("https://apple.com/apple-pay"),Tf=()=>Ef("https://google.com/pay"),jf={component:()=>{let{wallets:t}=Ys(),{wallets:n}=Xw(),{navigate:o,data:l,setModalData:c}=Ui(),{client:d}=s.usePrivyInternal(),u=Ni(),p=l?.funding,h=ng(Af),y=ng(Tf),m="solana"===p.chainType,g=m?void 0:p,f=r.useMemo((()=>((e,t,r,n,i,o)=>{let s,l,c="solana"===r.chainType,d=c?void 0:r,u=r.isUSDC?"USDC":d?.erc20Address?void 0:"native-currency",p=!!c||u&&a.isSupportedChainIdForMoonpay(Number(r.chain.id),u),h=!!c||u&&a.isSupportedChainIdForCoinbaseOnramp(Number(r.chain.id),u),y=[];for(let a of(r.preferredCardProvider&&r.supportedOptions.sort((e=>e.provider===r.preferredCardProvider?-1:1)),r.supportedOptions))"card"===a.method&&"coinbase"===a.provider&&h&&y.push((()=>gf(t,r,n,i,o,"buy"))),"card"===a.method&&"moonpay"===a.provider&&p&&u&&y.push((()=>kf(t,r,e,u,n,i,o,"credit_debit_card")));for(let e of r.supportedOptions)"exchange"===e.method&&"coinbase"===e.provider&&h&&(s=()=>gf(t,r,n,i,o,"buy"));for(let e of o?.funding?.supportedOptions??[])"wallets"===e.method&&(l=()=>i(lf));return{onFundWithCard:y,onFundWithExchange:s,onFundWithWallet:l}})(u,d,p,c,o,l)),[u,d,p,l,c,o]),w=m?n.find((({address:e})=>e===p.address)):t.find((({address:e})=>i.getAddress(e)===i.getAddress(p.address))),v=ui(w?.walletClientType||"unknown"),x=v?.name||"wallet",C=w&&"privy"!==w.walletClientType?x:u.name,b=r.useMemo((()=>p.uiConfig?.landing?.title?p.uiConfig?.landing?.title:`Add funds to your ${C?.toLowerCase().endsWith("wallet")?C:C+" wallet"}`),[p.uiConfig?.landing?.title,C]);r.useEffect((()=>{if(p?.defaultFundingMethod&&p.usingDefaultFundingMethod)switch(c({funding:{...p,usingDefaultFundingMethod:!1}}),p?.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":o(Jw)}}),[]),r.useEffect((()=>{g?.erc20Address&&!g.erc20ContractInfo&&ig({address:g.erc20Address,chain:g.chain,rpcConfig:u.rpcConfig,privyAppId:u.id}).then((e=>{c({...l,funding:{...g,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}})})).catch(console.error)}),[g?.erc20Address,g?.chain]);let k=!(!g?.erc20Address||g?.erc20ContractInfo);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx("h3",{children:b}),/*#__PURE__*/e.jsxs(Kg,{children:[p.errorMessage&&/*#__PURE__*/e.jsx(Xm,{theme:u.appearance.palette.colorScheme,children:p.errorMessage}),f.onFundWithCard?.[0]&&/*#__PURE__*/e.jsxs(xa,{disabled:k,onClick:f.onFundWithCard[0],children:[/*#__PURE__*/e.jsx(Gg,{children:/*#__PURE__*/e.jsx(at.default,{style:{width:24}})}),"Pay with card",h?/*#__PURE__*/e.jsx(tg,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):y?/*#__PURE__*/e.jsx(rg,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):null]}),f.onFundWithExchange&&/*#__PURE__*/e.jsxs(xa,{disabled:k,onClick:f.onFundWithExchange,children:[/*#__PURE__*/e.jsx(Gg,{children:/*#__PURE__*/e.jsx(st.default,{style:{width:24}})}),"Transfer from an exchange"]}),f.onFundWithWallet&&/*#__PURE__*/e.jsxs(xa,{disabled:k,onClick:f.onFundWithWallet,children:[/*#__PURE__*/e.jsx(Gg,{children:/*#__PURE__*/e.jsx(vp,{style:{width:24}})}),"Transfer from wallet"]}),/*#__PURE__*/e.jsxs(xa,{disabled:k,onClick:()=>o(Jw),children:[/*#__PURE__*/e.jsx(Gg,{children:/*#__PURE__*/e.jsx(ot.default,{style:{width:24}})}),"Receive funds"]}),p?.showAlternateFundingMethod&&f.onFundWithCard?.[1]&&/*#__PURE__*/e.jsx(bm,{theme:u.appearance.palette.colorScheme,children:/*#__PURE__*/e.jsxs(tf,{children:["Having trouble or facing location restrictions?"," ",/*#__PURE__*/e.jsx(rf,{onClick:f.onFundWithCard[1],children:"Try a different provider."})]})})]}),/*#__PURE__*/e.jsx(Ia,{})]})}},If="moonpay";function Sf(e){return parseFloat(e)}function Pf(e){return!!e&&void 0!==e.config&&void 0!==e.provider}function _f(e){return!!e&&(void 0!==e.chain||void 0!==e.amount)}const Nf={[a.mainnet.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[a.sepolia.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[a.optimism.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[a.optimismSepolia.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[a.polygon.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[a.polygonAmoy.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[a.base.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[a.baseSepolia.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[a.avalanche.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[a.avalancheFuji.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[a.arbitrum.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[a.arbitrumSepolia.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"},Mf=({address:e,appConfig:t,fundWalletConfig:r,methodScreen:n,chainIdOverride:i,comingFromSendTransactionScreen:a=!1})=>{let s,l;if(!t.fundingConfig)throw Error("Wallet funding is not enabled");let c=Zm(t.fundingConfig.options);if(c.length<1)throw Error("Wallet funding is not enabled");s=i||(_f(r)&&r.chain?r.chain.id:ac(t.fundingConfig.defaultRecommendedCurrency.chain));let d=t.chains.find((e=>e.id===s));if(!d)throw new o.PrivyClientError(`Funding chain ${s} is not in PrivyProvider chains list`);let u=_f(r)&&r.amount?r.amount:t.fundingConfig.defaultRecommendedAmount,p=!1;function h(){if(!s)return;let e=Nf[s];c.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."),l=e,p=!0}_f(r)&&"asset"in r?"USDC"===r.asset?h():"string"!=typeof r.asset&&"erc20"in r.asset&&(p=((e,t)=>e===Nf[t.id])(l=r.asset.erc20,d)):"USDC"===t.fundingConfig.defaultRecommendedCurrency.asset&&h();let y=r?.defaultFundingMethod;return{chainType:"ethereum",address:e,amount:u,chain:d,erc20Address:l,erc20ContractInfo:p?{symbol:"USDC",decimals:6}:void 0,isUSDC:p,methodScreen:n,supportedOptions:c,comingFromSendTransactionScreen:a,defaultFundingMethod:y,usingDefaultFundingMethod:!!y,preferredCardProvider:r?.card?.preferredProvider,crossChainBridgingEnabled:t.fundingConfig.crossChainBridgingEnabled??!1,cluster:{name:"mainnet-beta",rpcUrl:t.solanaClusters["mainnet-beta"].rpcUrl},...Pf(r)?{moonpayConfigOverride:r.config}:{},uiConfig:r&&"uiConfig"in r?r.uiConfig:void 0}};function Wf({address:e,fundWalletConfig:t,appConfig:r,comingFromSendTransactionScreen:n,methodScreen:i}){if(!r.fundingConfig)throw Error("Wallet funding is not enabled");let a=Zm(r.fundingConfig.options);if(a.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??r.fundingConfig.defaultRecommendedAmount,s=t?.defaultFundingMethod;return{chainType:"solana",address:e,supportedOptions:a,amount:o,isUSDC:"USDC"===t?.asset,methodScreen:i,comingFromSendTransactionScreen:n,cluster:{name:t?.cluster?.name??"mainnet-beta",rpcUrl:r.solanaClusters[t?.cluster?.name??"mainnet-beta"].rpcUrl},crossChainBridgingEnabled:r.fundingConfig.crossChainBridgingEnabled??!1,defaultFundingMethod:s,preferredCardProvider:t?.card?.preferredProvider,usingDefaultFundingMethod:!!s,uiConfig:t?.uiConfig}}const Ff=({children:t,theme:r})=>/*#__PURE__*/e.jsxs(Uf,{$theme:r,children:[/*#__PURE__*/e.jsx(We.default,{width:"20px",height:"20px",color:"var(--privy-color-icon-warning)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/e.jsx(Rf,{$theme:r,children:t})]});let Uf=/*#__PURE__*/g.styled.div.withConfig({displayName:"Container",componentId:"sc-a77c2854-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-warn-bg);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),Rf=/*#__PURE__*/g.styled.div.withConfig({displayName:"Content",componentId:"sc-a77c2854-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const Of=({address:t,accessToken:r,appConfigTheme:n,onClose:i,isLoading:a=!1,exportButtonProps:o})=>/*#__PURE__*/e.jsx(Xc,{title:"Export wallet",subtitle:/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy either your private key or seed phrase to export your wallet."," ",/*#__PURE__*/e.jsx("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),onClose:i,watermark:!0,children:/*#__PURE__*/e.jsxs(Lf,{children:[/*#__PURE__*/e.jsx(Ff,{theme:n,children:"Never share your private key or seed phrase with anyone."}),/*#__PURE__*/e.jsx(Wm,{title:"Your wallet",address:t,showCopyButton:!0}),/*#__PURE__*/e.jsx("div",{style:{width:"100%"},children:a?/*#__PURE__*/e.jsx(Df,{}):r&&o&&/*#__PURE__*/e.jsx(Hf,{accessToken:r,dimensions:{height:"44px"},...o})})]})});let Lf=/*#__PURE__*/g.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-e0132ced-0"})(["display:flex;flex-direction:column;gap:1.25rem;text-align:left;"]),Df=()=>/*#__PURE__*/e.jsx(Bf,{children:/*#__PURE__*/e.jsx(zf,{children:"Loading..."})}),Bf=/*#__PURE__*/g.styled.div.withConfig({displayName:"PlaceholderContainer",componentId:"sc-e0132ced-1"})(["display:flex;gap:12px;height:44px;"]),zf=/*#__PURE__*/g.styled.div.withConfig({displayName:"PlaceholderButton",componentId:"sc-e0132ced-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);"]);function Hf(t){let[n,i]=r.useState(t.dimensions.width),[a,o]=r.useState(void 0),s=r.useRef(null);r.useEffect((()=>{if(s.current&&void 0===n){let{width:e}=s.current.getBoundingClientRect();i(e)}let e=getComputedStyle(document.documentElement);o({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 l="ethereum"===t.chainType&&!t.imported&&!t.isUnifiedWallet;/*#__PURE__*/return e.jsx("div",{ref:s,children:n&&
|
|
29
|
+
/*#__PURE__*/e.jsxs(qf,{children:[/*#__PURE__*/e.jsx("iframe",{style:{position:"absolute",zIndex:1},width:n,height:t.dimensions.height,allow:"clipboard-write self *",src:Zr(t.origin,`/apps/${t.appId}/embedded-wallets/export`,t.isUnifiedWallet?{v:"1-unified",wallet_id:t.walletId,client_id:t.appClientId,width:`${n}px`,caid:t.clientAnalyticsId,phrase_export:l,...a}:{v:"1",entropy_id:t.entropyId,entropy_id_verifier:t.entropyIdVerifier,hd_wallet_index:t.hdWalletIndex,chain_type:t.chainType,client_id:t.appClientId,width:`${n}px`,caid:t.clientAnalyticsId,phrase_export:l,...a},{token:t.accessToken})}),/*#__PURE__*/e.jsx(Vf,{children:"Loading..."}),l&&/*#__PURE__*/e.jsx(Vf,{children:"Loading..."})]})})}const $f={component:()=>{let[t,n]=r.useState(null),{authenticated:i,user:a}=u.usePrivyContext(),{closePrivyModal:o,createAnalyticsEvent:l,clientAnalyticsId:c,client:d}=s.usePrivyInternal(),p=Ni(),{data:h,onUserCloseViaDialogOrKeybindRef:y}=Ui(),{onFailure:m,onSuccess:g,origin:f,appId:w,appClientId:v,entropyId:x,entropyIdVerifier:C,walletId:b,hdWalletIndex:k,chainType:E,address:A,isUnifiedWallet:T,imported:j}=h.keyExport,I=e=>{o({shouldCallAuthOnSuccess:!1}),m("string"==typeof e?Error(e):e)},S=()=>{o({shouldCallAuthOnSuccess:!1}),g(),l({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:A}})};return r.useEffect((()=>{if(!i)return I("User must be authenticated before exporting their wallet");d.getAccessToken().then(n).catch(I)}),[i,a]),y.current=S,/*#__PURE__*/e.jsx(Of,{address:A,accessToken:t,appConfigTheme:p.appearance.palette.colorScheme,onClose:S,isLoading:!t,exportButtonProps:t?{origin:f,appId:w,appClientId:v,clientAnalyticsId:c,entropyId:x,entropyIdVerifier:C,walletId:b,hdWalletIndex:k,isUnifiedWallet:T,imported:j,chainType:E}:void 0})}};let qf=/*#__PURE__*/g.styled.div.withConfig({displayName:"ButtonContainer",componentId:"sc-e0132ced-3"})(["overflow:visible;position:relative;overflow:none;height:44px;display:flex;gap:12px;"]),Vf=/*#__PURE__*/g.styled.div.withConfig({displayName:"LoadingButton",componentId:"sc-e0132ced-4"})(["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 Kf=({connectionFailed:t,onClose:r})=>t?/*#__PURE__*/e.jsx(Xc,{title:"Something went wrong",subtitle:"We're on it. Please try again later.",icon:P.XCircle,iconVariant:"error",primaryCta:{label:"Close",onClick:r},watermark:!0}):/*#__PURE__*/e.jsx(Xc,{title:"Connecting to your wallet",subtitle:"Please wait...",iconVariant:"loading",showClose:!0,onClose:r,watermark:!1}),Gf={component:()=>{let{authenticated:t,user:n}=u.usePrivyContext(),{client:i,closePrivyModal:a,createAnalyticsEvent:o,walletProxy:l}=s.usePrivyInternal(),{navigate:c,data:d,setModalData:p,onUserCloseViaDialogOrKeybindRef:h}=Ui(),y=r.useMemo((()=>Date.now()),[]),[m,g]=r.useState(!1),{onCompleteNavigateTo:f,onFailure:w,shouldForceMFA:v,entropyId:x,entropyIdVerifier:C,recoveryMethod:b,connectingWalletAddress:k,isUnifiedWallet:E=!1}=d?.connectWallet,A=e=>{m||(g(!0),w("string"==typeof e?Error(e):e))};return r.useEffect((()=>{let e;return t?l?((async()=>{let t=await i.getAccessToken();if(!t)return A("User must be authenticated and have a Privy wallet before it can be connected");try{E||await l.connect({accessToken:t,entropyId:x,entropyIdVerifier:C}),v&&await l.verifyMfa({accessToken:t});let r=(Date.now()-y)/1e3;f===$f&&r<1?e=setTimeout((()=>{c(f,!1)}),1e3*(1-r)):c(f,!1)}catch(e){if(yl(e)&&"privy"===b){let e=await i.getAccessToken();if(!e)return A("User must be authenticated and have a Privy wallet before it can be recovered");try{o({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:k}});let t=await(l?.recover({accessToken:e,entropyId:x,entropyIdVerifier:C}));t?.entropyId||A(Error("Unable to recover wallet")),f?c(f):a({shouldCallAuthOnSuccess:!1}),o({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:k}}),c(f)}catch(e){A("An error has occurred, please try again.")}}else yl(e)&&"privy"!==b&&"privy-v2"!==b?(p({...d,recoverWallet:{entropyId:x,entropyIdVerifier:C,onCompleteNavigateTo:f,onFailure:w},recoveryOAuthStatus:{provider:b,action:"recover",isInAccountCreateFlow:!1,shouldCreateEth:!1,shouldCreateSol:!1}}),c(Cm(b))):A(e)}})(),()=>clearTimeout(e)):void 0:A("User must be authenticated and have a Privy wallet before it can be connected")}),[t,n,l]),h.current=()=>{A("User exited before wallet could be connected"),a({shouldCallAuthOnSuccess:!1})},/*#__PURE__*/e.jsx(Kf,{connectionFailed:m,onClose:()=>a({shouldCallAuthOnSuccess:!1})})}},Yf=/*#__PURE__*/g.styled(lg).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 Zf=({iconUrl:t,value:r,symbol:n,usdValue:i,nftName:a,nftCount:o,decimals:s,$isLoading:l})=>{if(l)/*#__PURE__*/return e.jsx(Qf,{$isLoading:l});let c=r&&i&&s?function(e,t,r){let n=parseFloat(e),i=parseFloat(r);if(0===n||0===i||Number.isNaN(n)||Number.isNaN(i))return e;let a=Math.ceil(-Math.log10(.01/(i/n))),o=Math.pow(10,a=Math.max(a=Math.min(a,t),1)),s=+(Math.floor(n*o)/o).toFixed(a).replace(/\.?0+$/,"");return Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(s)}(r,s,i):r;/*#__PURE__*/return e.jsxs("div",{children:[/*#__PURE__*/e.jsxs(Qf,{$isLoading:l,children:[t&&/*#__PURE__*/e.jsx(Jf,{src:t,alt:"Token icon"}),o&&o>1?o+"x":void 0," ",a,c," ",n]}),i&&/*#__PURE__*/e.jsxs(Xf,{$isLoading:l,children:["$",i]})]})};let Qf=/*#__PURE__*/g.styled.span.withConfig({displayName:"Value",componentId:"sc-991db279-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;",""],fh);const Xf=/*#__PURE__*/g.styled.span.withConfig({displayName:"Subvalue",componentId:"sc-991db279-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;",""],fh);let Jf=/*#__PURE__*/g.styled.img.withConfig({displayName:"TokenIcon",componentId:"sc-991db279-2"})(["height:14px;width:14px;margin-right:4px;object-fit:contain;"]);const ew=t=>{let{chain:r,transactionDetails:n,isTokenContractInfoLoading:i,symbol:a}=t,{action:o,functionName:s}=n;/*#__PURE__*/return e.jsx(Tm,{children:/*#__PURE__*/e.jsxs(og,{children:["transaction"!==o&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Action"}),/*#__PURE__*/e.jsx(dg,{children:s})]}),"mint"===s&&"args"in n&&n.args.filter((e=>e)).map(((t,n)=>/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:`Param ${n}`}),/*#__PURE__*/e.jsx(dg,{children:"string"==typeof t&&l.isAddress(t)?/*#__PURE__*/e.jsx(Dl,{address:t,url:r?.blockExplorers?.default?.url,showCopyIcon:!1}):t?.toString()})]},n))),"setApprovalForAll"===s&&n.operator&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Operator"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:n.operator,url:r?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),"setApprovalForAll"===s&&void 0!==n.approved&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Set approval to"}),/*#__PURE__*/e.jsx(dg,{children:n.approved?"true":"false"})]}),"transfer"===s||"transferFrom"===s||"safeTransferFrom"===s||"approve"===s?/*#__PURE__*/e.jsxs(e.Fragment,{children:["formattedAmount"in n&&n.formattedAmount&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Amount"}),/*#__PURE__*/e.jsxs(dg,{$isLoading:i,children:[n.formattedAmount," ",a]})]}),"tokenId"in n&&n.tokenId&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token ID"}),/*#__PURE__*/e.jsx(dg,{children:n.tokenId.toString()})]})]}):null,"safeBatchTransferFrom"===s&&/*#__PURE__*/e.jsxs(e.Fragment,{children:["amounts"in n&&n.amounts&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Amounts"}),/*#__PURE__*/e.jsx(dg,{children:n.amounts.join(", ")})]}),"tokenIds"in n&&n.tokenIds&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token IDs"}),/*#__PURE__*/e.jsx(dg,{children:n.tokenIds.join(", ")})]})]}),"approve"===s&&n.spender&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Spender"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:n.spender,url:r?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===s||"safeTransferFrom"===s||"safeBatchTransferFrom"===s)&&n.transferFrom&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Transferring from"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:n.transferFrom,url:r?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===s||"safeTransferFrom"===s||"safeBatchTransferFrom"===s)&&n.transferTo&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Transferring to"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:n.transferTo,url:r?.blockExplorers?.default?.url,showCopyIcon:!1})})]})]})})},tw=({variant:t,setPreventMaliciousTransaction:r,colorScheme:n="light",preventMaliciousTransaction:i})=>"warn"===t?/*#__PURE__*/e.jsx(rw,{children:/*#__PURE__*/e.jsxs(Ff,{theme:n,children:[/*#__PURE__*/e.jsx("span",{style:{fontWeight:"500"},children:"Warning: Suspicious transaction"}),/*#__PURE__*/e.jsx("br",{}),"This has been flagged as a potentially deceptive request. Approving could put your assets or funds at risk."]})}):"error"===t?/*#__PURE__*/e.jsx(e.Fragment,{children:/*#__PURE__*/e.jsxs(rw,{children:[/*#__PURE__*/e.jsx(Xm,{theme:n,children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx("strong",{children:"This is a malicious transaction"}),/*#__PURE__*/e.jsx("br",{}),"This transaction transfers tokens to a known malicious address. Proceeding may result in the loss of valuable assets."]})}),/*#__PURE__*/e.jsxs(nw,{children:[/*#__PURE__*/e.jsx(jd,{color:"var(--privy-color-error)",checked:!i,readOnly:!0,onClick:()=>r(!i)}),/*#__PURE__*/e.jsx("span",{children:"I understand and want to proceed anyways."})]})]})}):null;let rw=/*#__PURE__*/g.styled.div.withConfig({displayName:"BannerContainer",componentId:"sc-ab8a5a0b-0"})(["margin-top:1.5rem;"]),nw=/*#__PURE__*/g.styled.div.withConfig({displayName:"CheckboxContainer",componentId:"sc-ab8a5a0b-1"})(["display:flex;align-items:center;gap:0.5rem;margin-top:0.75rem;"]);const iw=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,aw=({img:t,submitError:n,prepareError:i,onClose:a,action:o,title:s,subtitle:l,txValue:c,to:d,tokenAddress:u,network:p,missingFunds:h,fee:y,from:m,cta:g,disabled:f,chain:w,isSubmitting:v,isPreparing:x,isTokenPriceLoading:C,isTokenContractInfoLoading:b,isSponsored:k,symbol:E,balance:A,onClick:T,transactionDetails:j,transactionIndex:I,maxIndex:S,onBack:P,chainName:_,validation:N,hasScanDetails:M,setIsScanDetailsOpen:W,preventMaliciousTransaction:F,setPreventMaliciousTransaction:U,tokensSent:R,tokensReceived:O,isScanning:L,isCancellable:D,functionName:z})=>{let{showTransactionDetails:H,setShowTransactionDetails:$,hasMoreDetails:q,isErc20Ish:V}=(e=>{let[t,n]=r.useState(!1),i=!0,a=!1;return(!e||e.isErc20Ish||"transaction"===e.action)&&(i=!1),i&&(a=Object.entries(e||{}).some((([e,t])=>t&&!["action","isErc20Ish","isNFTIsh"].includes(e)))),{showTransactionDetails:t,setShowTransactionDetails:n,hasMoreDetails:i&&a,isErc20Ish:e?.isErc20Ish}})(j),K=V&&b||x||C||L;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:a,backFn:P}),t&&/*#__PURE__*/e.jsx(dw,{children:t}),/*#__PURE__*/e.jsxs(fm,{style:{marginTop:t?"1.5rem":0},children:[s,/*#__PURE__*/e.jsx(iw,{maxIndex:S,transactionIndex:I})]}),/*#__PURE__*/e.jsx(gm,{children:l}),/*#__PURE__*/e.jsxs(og,{style:{marginTop:"2rem"},children:[(!!R[0]||K)&&/*#__PURE__*/e.jsxs(sg,{children:[O.length>0?/*#__PURE__*/e.jsx(lg,{children:"Send"}):/*#__PURE__*/e.jsx(lg,{children:"approve"===o?"Approval amount":"Amount"}),/*#__PURE__*/e.jsx("div",{className:"flex flex-col",children:R.map(((t,r)=>/*#__PURE__*/e.jsx(Zf,{iconUrl:t.iconUrl,value:"setApprovalForAll"===z?"All":t.value,usdValue:t.usdValue,symbol:t.symbol,nftName:t.nftName,nftCount:t.nftCount,decimals:t.decimals},r)))})]}),O.length>0&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Receive"}),/*#__PURE__*/e.jsx("div",{className:"flex flex-col",children:O.map(((t,r)=>/*#__PURE__*/e.jsx(Zf,{iconUrl:t.iconUrl,value:t.value,usdValue:t.usdValue,symbol:t.symbol,nftName:t.nftName,nftCount:t.nftCount,decimals:t.decimals},r)))})]}),j&&"spender"in j&&j?.spender?/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Spender"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:j.spender,url:w?.blockExplorers?.default?.url})})]}):null,d&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"To"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:d,url:w?.blockExplorers?.default?.url,showCopyIcon:!0})})]}),u&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token address"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:u,url:w?.blockExplorers?.default?.url})})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Network"}),/*#__PURE__*/e.jsx(dg,{children:p})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(dg,{$isLoading:x||C||void 0===k,children:k?"Sponsored":y})]}),q&&!M&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(sg,{className:"cursor-pointer",onClick:()=>$(!H),children:/*#__PURE__*/e.jsxs(cg,{className:"flex items-center gap-x-1",children:["Details"," ",/*#__PURE__*/e.jsx(B.ChevronDownIcon,{style:{width:"0.75rem",marginLeft:"0.25rem",transform:H?"rotate(180deg)":void 0}})]})}),H&&j&&/*#__PURE__*/e.jsx(ew,{action:o,chain:w,transactionDetails:j,isTokenContractInfoLoading:b,symbol:E})]}),M&&/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsxs(Yf,{onClick:()=>W(!0),children:[/*#__PURE__*/e.jsx("span",{className:"text-color-primary",children:"Details"}),/*#__PURE__*/e.jsx(B.ArrowRightIcon,{height:"14px",width:"14px",strokeWidth:"2"})]})})]}),/*#__PURE__*/e.jsx(ya,{}),n?/*#__PURE__*/e.jsx(yp,{style:{marginTop:"2rem"},children:n.message}):i&&0===I?
|
|
30
|
+
/*#__PURE__*/e.jsx(yp,{style:{marginTop:"2rem"},children:i.shortMessage??cw}):null,/*#__PURE__*/e.jsx(tw,{variant:N,preventMaliciousTransaction:F,setPreventMaliciousTransaction:U}),/*#__PURE__*/e.jsx(sw,{$useSmallMargins:!(!i&&!n&&"warn"!==N&&"error"!==N),title:Number(c)>0?void 0:!1!==k?"Your wallet":void 0,address:m,balance:A,errMsg:x||i||n||!h?void 0:`Add funds on ${w?.name??_} to complete transaction.`}),/*#__PURE__*/e.jsx(go,{style:{marginTop:"1rem"},loading:v,disabled:f||x,onClick:T,children:g}),D&&/*#__PURE__*/e.jsx(Eo,{style:{marginTop:"1rem"},onClick:a,isSubmitting:!1,children:"Not now"}),/*#__PURE__*/e.jsx(Ia,{})]})},ow=({img:t,title:n,subtitle:i,cta:o,instructions:s,network:l,blockExplorerUrl:c,isMissingFunds:d,submitError:u,parseError:p,total:h,swap:y,transactingWalletAddress:m,fee:g,balance:f,disabled:w,isSubmitting:v,isPreparing:x,isTokenPriceLoading:C,onClick:b,onClose:k,onBack:E})=>{let A=x||C,[T,j]=r.useState(!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:k,backFn:E}),t&&/*#__PURE__*/e.jsx(dw,{children:t}),/*#__PURE__*/e.jsx(fm,{style:{marginTop:t?"1.5rem":0},children:n}),/*#__PURE__*/e.jsx(gm,{children:i}),/*#__PURE__*/e.jsxs(og,{style:{marginTop:"2rem",marginBottom:".5rem"},children:[(h||A)&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Amount"}),/*#__PURE__*/e.jsx(dg,{$isLoading:A,children:h})]}),y&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Swap"}),/*#__PURE__*/e.jsx(dg,{children:y})]}),l&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Network"}),/*#__PURE__*/e.jsx(dg,{children:l})]}),(g||A)&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(dg,{$isLoading:A,children:g})]})]}),/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsxs(Yf,{onClick:()=>j((e=>!e)),children:[/*#__PURE__*/e.jsx("span",{children:"Advanced"}),/*#__PURE__*/e.jsx(B.ChevronDownIcon,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:T?"rotate(180deg)":void 0}})]})}),T&&/*#__PURE__*/e.jsx(e.Fragment,{children:s.map(((t,r)=>"sol-transfer"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsxs(kh,{children:["Transfer ",t.withSeed?"with seed":""]})}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Amount"}),/*#__PURE__*/e.jsxs(dg,{children:[a.formatTokenAmount({amount:t.value,decimals:t.token.decimals})," ",t.token.symbol]})]}),!!t.toAccount&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Destination"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.toAccount,url:c})})]})]},r):"spl-transfer"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsxs(kh,{children:["Transfer ",t.token.symbol]})}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Amount"}),/*#__PURE__*/e.jsx(dg,{children:t.value.toString()})]}),!!t.fromAta&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Source"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.fromAta,url:c})})]}),!!t.toAta&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Destination"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.toAta,url:c})})]}),!!t.token.address&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.token.address,url:c})})]})]},r):"ata-creation"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsx(kh,{children:"Create token account"})}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Program ID"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.program,url:c})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Owner"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.owner,url:c})})]})]},r):"create-account"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsxs(kh,{children:["Create account ",t.withSeed?"with seed":""]})}),!!t.account&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Account"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.account,url:c})})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Amount"}),/*#__PURE__*/e.jsxs(dg,{children:[a.formatTokenAmount({amount:t.value,decimals:9})," SOL"]})]})]},r):"spl-init-account"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsx(kh,{children:"Initialize token account"})}),!!t.account&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Account"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.account,url:c})})]}),!!t.mint&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Mint"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.mint,url:c})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Owner"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.owner,url:c})})]})]},r):"spl-close-account"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsx(kh,{children:"Close token account"})}),!!t.source&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Source"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.source,url:c})})]}),!!t.destination&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Destination"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.destination,url:c})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Owner"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.owner,url:c})})]})]},r):"spl-sync-native"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsx(kh,{children:"Sync native"})}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Program ID"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.program,url:c})})]})]},r):"raydium-swap-base-input"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsxs(kh,{children:["Raydium swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Amount in"}),/*#__PURE__*/e.jsx(dg,{children:t.amountIn.toString()})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Minimum amount out"}),/*#__PURE__*/e.jsx(dg,{children:t.minimumAmountOut.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token in"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.mintIn,url:c})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token out"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.mintOut,url:c})})]})]},r):"raydium-swap-base-output"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsxs(kh,{children:["Raydium swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Max amount in"}),/*#__PURE__*/e.jsx(dg,{children:t.maxAmountIn.toString()})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Amount out"}),/*#__PURE__*/e.jsx(dg,{children:t.amountOut.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token in"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.mintIn,url:c})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token out"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.mintOut,url:c})})]})]},r):"jupiter-swap-shared-accounts-route"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsxs(kh,{children:["Jupiter swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"In amount"}),/*#__PURE__*/e.jsx(dg,{children:t.inAmount.toString()})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Quoted out amount"}),/*#__PURE__*/e.jsx(dg,{children:t.quotedOutAmount.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token in"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.mintIn,url:c})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token out"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.mintOut,url:c})})]})]},r):"jupiter-swap-exact-out-route"===t.type?/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsx(sg,{children:/*#__PURE__*/e.jsxs(kh,{children:["Jupiter swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Quoted in amount"}),/*#__PURE__*/e.jsx(dg,{children:t.quotedInAmount.toString()})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Amount out"}),/*#__PURE__*/e.jsx(dg,{children:t.outAmount.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token in"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.mintIn,url:c})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Token out"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.mintOut,url:c})})]})]},r):/*#__PURE__*/e.jsxs(lw,{children:[/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Program ID"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Dl,{address:t.program,url:c})})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Data"}),/*#__PURE__*/e.jsx(dg,{children:t.discriminator})]})]},r)))}),/*#__PURE__*/e.jsx(ya,{}),u?/*#__PURE__*/e.jsx(yp,{style:{marginTop:"2rem"},children:u.message}):p?/*#__PURE__*/e.jsx(yp,{style:{marginTop:"2rem"},children:cw}):null,/*#__PURE__*/e.jsx(sw,{$useSmallMargins:!(!p&&!u),title:"Your wallet",address:m,balance:f,errMsg:x||p||u||!d?void 0:"Add funds on Solana to complete transaction."}),/*#__PURE__*/e.jsx(go,{style:{marginTop:"1rem"},loading:v,disabled:w||x,onClick:b,children:o}),/*#__PURE__*/e.jsx(Ia,{})]})};let sw=/*#__PURE__*/g.styled(Wm).withConfig({displayName:"StyledWalletInfoCard",componentId:"sc-fd202ddf-0"})(["",""],(e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;")),lw=/*#__PURE__*/g.styled(og).withConfig({displayName:"InstructionRows",componentId:"sc-fd202ddf-1"})(["margin-top:0.5rem;border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-sm);padding:0.5rem;"]),cw="There was an error preparing your transaction. Your transaction request will likely fail.",dw=/*#__PURE__*/g.styled.div.withConfig({displayName:"ImageContainer",componentId:"sc-fd202ddf-2"})(["display:flex;width:100%;justify-content:center;max-height:40px;> img{object-fit:contain;border-radius:var(--privy-border-radius-sm);}"]),uw=()=>/*#__PURE__*/e.jsxs(gw,{children:[/*#__PURE__*/e.jsx(ww,{}),/*#__PURE__*/e.jsx(fw,{})]});const pw=({transactionError:t,chainId:n,onClose:i,onRetry:a,network:o,connection:l,transactionHash:c})=>{let{chains:d}=s.usePrivyInternal(),[u,p]=r.useState(!1),{errorCode:h,errorMessage:y}=((e,t)=>{if("ethereum"===t)return{errorCode:e.details??e.message,errorMessage:e.shortMessage};let r=e.txSignature,n=e?.transactionMessage||"Something went wrong.";if(Array.isArray(e.logs)){let t=e.logs.find((e=>/insufficient (lamports|funds)/gi.test(e)));t&&(n=t)}return{transactionHash:r,errorMessage:n}})(t,o),m=(({chains:e,chainId:t,network:r,connection:n,transactionHash:i})=>"ethereum"===r?e.find((e=>e.id===t))?.blockExplorers?.default.url??"https://etherscan.io":function(e,t){return`https://explorer.solana.com/tx/${e}?cluster=${t}`}(i||"",xi(n?.rpcEndpoint||"")))({chains:d,chainId:n,network:o,connection:l,transactionHash:c});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:i}),/*#__PURE__*/e.jsxs(hw,{children:[/*#__PURE__*/e.jsx(uw,{}),/*#__PURE__*/e.jsx(yw,{children:h}),/*#__PURE__*/e.jsx(mw,{children:"Please try again."}),/*#__PURE__*/e.jsxs(Cw,{children:[/*#__PURE__*/e.jsx(xw,{children:"Error message"}),/*#__PURE__*/e.jsx(kw,{$clickable:!1,children:y})]}),c&&/*#__PURE__*/e.jsxs(Cw,{children:[/*#__PURE__*/e.jsx(xw,{children:"Transaction hash"}),/*#__PURE__*/e.jsxs(bw,{children:["Copy this hash to view details about the transaction on a"," ",/*#__PURE__*/e.jsx("u",{children:/*#__PURE__*/e.jsx("a",{href:m,children:"block explorer"})}),"."]}),/*#__PURE__*/e.jsxs(kw,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(c),p(!0)},children:[c,/*#__PURE__*/e.jsx(Tw,{clicked:u})]})]}),/*#__PURE__*/e.jsx(vw,{onClick:()=>a({resetNonce:!!c}),children:"Retry transaction"})]}),/*#__PURE__*/e.jsx(Pa,{})]})};let hw=/*#__PURE__*/g.styled.div.withConfig({displayName:"TransactionErrorScreenContainer",componentId:"sc-92716bea-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;"]),yw=/*#__PURE__*/g.styled.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;"]),mw=/*#__PURE__*/g.styled.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;"]),gw=/*#__PURE__*/g.styled.div.withConfig({displayName:"CircleContainer",componentId:"sc-92716bea-3"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]),fw=/*#__PURE__*/g.styled(ze.default).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-92716bea-4"})(["position:absolute;width:35px;height:35px;color:var(--privy-color-error);"]),ww=/*#__PURE__*/g.styled.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;"]),vw=/*#__PURE__*/g.styled(go).withConfig({displayName:"RetryButton",componentId:"sc-92716bea-6"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]),xw=/*#__PURE__*/g.styled.span.withConfig({displayName:"TextBoxTitle",componentId:"sc-92716bea-7"})(["width:100%;text-align:left;font-size:0.825rem;color:var(--privy-color-foreground);padding:4px;"]),Cw=/*#__PURE__*/g.styled.div.withConfig({displayName:"TextBoxContainer",componentId:"sc-92716bea-8"})(["width:100%;margin:5px;display:flex;flex-direction:column;justify-content:center;align-items:center;"]),bw=/*#__PURE__*/g.styled.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;"]),kw=/*#__PURE__*/g.styled.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 }")),Ew=/*#__PURE__*/g.styled(ct.default).withConfig({displayName:"StyledClipboardIcon",componentId:"sc-92716bea-11"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),Aw=/*#__PURE__*/g.styled(et.default).withConfig({displayName:"StyledClipboardCheckIcon",componentId:"sc-92716bea-12"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),Tw=({clicked:t})=>t?/*#__PURE__*/e.jsx(Aw,{}):/*#__PURE__*/e.jsx(Ew,{});const jw=/*#__PURE__*/g.styled.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)")),Iw=({instruction:t,fees:r,transactionInfo:n,solPrice:i,rpcEndpoint:a})=>/*#__PURE__*/e.jsxs(og,{children:[n?.action&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Action"}),/*#__PURE__*/e.jsx(dg,{children:n.action})]}),null!=t?.total&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Total"}),/*#__PURE__*/e.jsx(dg,{children:t.total})]}),!t?.total&&null!=t?.amount&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Total"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(as,{quantities:[t.amount,r],tokenPrice:i})})]}),/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"Fees"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(as,{quantities:[r],tokenPrice:i})})]}),t?.to&&/*#__PURE__*/e.jsxs(sg,{children:[/*#__PURE__*/e.jsx(lg,{children:"To"}),/*#__PURE__*/e.jsx(dg,{children:/*#__PURE__*/e.jsx(Bs,{walletAddress:t.to,rpcEndpoint:a,network:"solana"})})]})]}),Sw=({fees:t,onClose:r,receiptHeader:n,receiptDescription:i,transactionInfo:a,solPrice:o,rpcEndpoint:s,signOnly:l,instruction:c})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:r}),/*#__PURE__*/e.jsx(Js,{style:{marginBottom:"16px"},children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx(jw,{color:"var(--privy-color-success-light)"}),/*#__PURE__*/e.jsx(nt.default,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-success)"})]})}),/*#__PURE__*/e.jsx(gc,{title:n??`Transaction ${l?"signed":"complete"}!`,description:i??"You're all set."}),/*#__PURE__*/e.jsx(Iw,{solPrice:o,instruction:c,fees:t,transactionInfo:a,rpcEndpoint:s}),/*#__PURE__*/e.jsx(ya,{}),/*#__PURE__*/e.jsx(Pw,{loading:!1,onClick:r,children:"Close"}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]});let Pw=/*#__PURE__*/g.styled(go).withConfig({displayName:"SubmitButton",componentId:"sc-df6d4eec-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const _w={component:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:n,setModalData:i,navigate:o}=Ui(),{client:l,closePrivyModal:c,walletProxy:d,showFiatPrices:p}=s.usePrivyInternal(),h=Ni(),{user:y}=u.usePrivyContext(),[m,g]=r.useState(t?.sendSolanaTransaction?.transactionRequest),[f,w]=r.useState(),[v,x]=r.useState(),[C,b]=r.useState({value:0n,isLoading:!1}),[k,E]=r.useState(!1),[A,T]=r.useState(),[j,I]=r.useState(),S=t?.sendSolanaTransaction?.connection,P=t?.sendSolanaTransaction?.transactingWallet,_=!!t?.sendSolanaTransaction?.signOnly,N=P?.imported?u.getImportedPrivySolanaWallet(y):u.getPrivyPrimaryWallet(y),M=xi(S?.rpcEndpoint||""),{solPrice:W,isSolPriceLoading:F}=Vs({enabled:p}),U=r.useMemo((()=>{if(!f)return;let e=f.spender,t=zo(f.fee),r=zo(C.value,3,!0),n=f.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))),i=n.at(0);if(!i||n.length>1)return{fee:t,spender:e,balance:r};if("sol-transfer"===i.type)return{fee:t,spender:e,balance:r,total:zo(i.value)};if("spl-transfer"===i.type)return{fee:t,spender:e,balance:r,total:`${a.formatTokenAmount({amount:i.value,decimals:i.token.decimals})} ${i.token.symbol}`};if("raydium-swap-base-input"===i.type&&i.tokenIn&&i.tokenOut){return{fee:t,spender:e,balance:r,swap:`${`${a.formatTokenAmount({amount:i.amountIn,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${a.formatTokenAmount({amount:i.minimumAmountOut,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}}if("raydium-swap-base-output"===i.type&&i.tokenIn&&i.tokenOut){return{fee:t,spender:e,balance:r,swap:`${`${a.formatTokenAmount({amount:i.maxAmountIn,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${a.formatTokenAmount({amount:i.amountOut,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}}if("jupiter-swap-shared-accounts-route"===i.type&&i.tokenIn&&i.tokenOut){return{fee:t,spender:e,balance:r,swap:`${`${a.formatTokenAmount({amount:i.inAmount,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${a.formatTokenAmount({amount:i.quotedOutAmount,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}}if("jupiter-swap-exact-out-route"===i.type&&i.tokenIn&&i.tokenOut){return{fee:t,spender:e,balance:r,swap:`${`${a.formatTokenAmount({amount:i.quotedInAmount,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${a.formatTokenAmount({amount:i.outAmount,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}}return{fee:t,spender:e,balance:r}}),[f,P?.address,C]),R=r.useMemo((()=>{let e;if(!f||!p||!W||F)return;function t(...e){return Ho(e.reduce(((e,t)=>e+t),0n),W??0)}P?.address===f.spender&&(e=t(f.fee));let r=t(C.value),n=f.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)).at(0);return!n||f.instructions.length>1?{fee:e,balance:r}:"sol-transfer"===n.type?{fee:e,balance:r,total:t(n.value,P?.address===f.spender?f.fee:0n)}:"spl-transfer"===n.type?{fee:e,balance:r,total:`${a.formatTokenAmount({amount:n.value,decimals:n.token.decimals})} ${n.token.symbol}`}:{fee:e,balance:r}}),[f,p,W,F,P?.address,C]);if(r.useEffect((()=>{!async function(){if(m&&S&&l)try{x(void 0);let e=await Qo({tx:m,connection:S,client:l,checkFunds:!_});w(e)}catch(e){console.error("Failed to prepare transaction",e),x(e)}}()}),[m,S,l,_]),r.useEffect((()=>{(async function(){if(!P||!S)return;b({value:C.value,isLoading:!0});let e=new a.SolanaClient({name:"mainnet-beta",rpcUrl:S.rpcEndpoint});b({value:await e.getBalance(P.address).catch((()=>0n))??0n,isLoading:!1})})().catch(console.error)}),[f,S]),!(m&&t?.sendSolanaTransaction&&P&&S)){let r=Error("Invalid transaction request");/*#__PURE__*/return e.jsx(_u,{error:r,allowlistConfig:h.allowlistConfig,onRetry:()=>{t?.sendSolanaTransaction?.onFailure(r),c({shouldCallAuthOnSuccess:!1})}})}let O=()=>{if(!k)return A?t?.sendSolanaTransaction?.onSuccess(A):t?.sendSolanaTransaction?.onFailure(j??v??Error("User exited the modal before submitting the transaction")),c({shouldCallAuthOnSuccess:!1})};n.current=O;let L=t.sendSolanaTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/e.jsx("img",{src:t.sendSolanaTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendSolanaTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,D=!!(t.funding&&t.funding.supportedOptions.length>0),B=!f?.hasFunds&&D;if(A){let r=f?.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)),n=1===r?.length?r?.at(0):void 0;/*#__PURE__*/return e.jsx(Sw,{fees:A.fees,onClose:O,transactionInfo:t.sendSolanaTransaction?.uiOptions.transactionInfo,solPrice:W,receiptHeader:t.sendSolanaTransaction?.uiOptions.successHeader,receiptDescription:t.sendSolanaTransaction?.uiOptions.successDescription,rpcEndpoint:S.rpcEndpoint,signOnly:_,instruction:"sol-transfer"===n?.type?{to:n.toAccount,amount:n.value}:{to:n?.toAccount||n?.toAta,total:U?.total}})}return j?/*#__PURE__*/e.jsx(pw,{transactionError:j,connection:S,onClose:O,network:"solana",onRetry:async()=>{I(void 0);let{blockhash:e}=await S.getLatestBlockhash();Ko(m)?m.message.recentBlockhash=e:m.recentBlockhash=e,g(m)}}):/*#__PURE__*/e.jsx(ow,{img:L,title:t.sendSolanaTransaction?.uiOptions?.transactionInfo?.title||"Confirm transaction",subtitle:t.sendSolanaTransaction?.uiOptions?.description||`${h.name} wants your permission to approve the following transaction.`,cta:B?"Add funds":t.sendSolanaTransaction?.uiOptions?.buttonText||"Approve",instructions:f?.instructions??[],network:"mainnet-beta"==M?"Solana":M,blockExplorerUrl:h.solanaClusters[M].blockExplorerUrl,total:p?R?.total:U?.total,fee:p?R?.fee:U?.fee,balance:p?R?.balance:U?.balance,swap:U?.swap,transactingWalletAddress:P.address,disabled:!f?.hasFunds&&!D,isSubmitting:k,isPreparing:!f||C.isLoading,isTokenPriceLoading:p&&F,isMissingFunds:!f?.hasFunds,submitError:j??void 0,parseError:v,onClick:B?async()=>{if(P){if(!D)throw Error("Funding wallet is not enabled");i({...t,funding:{...t.funding,methodScreen:jf}}),o(jf)}}:async()=>{try{if(E(!0),k||!P||!d||!y||!N)return;let e=await t.sendSolanaTransaction.onConfirm();T(e)}catch(e){console.warn({transaction:m,error:e}),I(e)}finally{E(!1)}},onClose:O})}},Nw=({privy:e,appConfig:t,getAccessToken:r,isHeadlessSigning:n,emitPrivyEvent:i,setModalData:s,openModal:l,walletProxy:c,user:d,signWithUserSigner:p,recoverEmbeddedWallet:h,connectedExternalWallet:y},{transaction:m,connection:g,transactionOptions:f,fundWalletConfig:w,uiOptions:v,address:x,signOnly:C})=>new Promise((async(b,k)=>{let{requesterAppId:E}=v||{},A=C?"signSolanaTransaction":"sendSolanaTransaction",T=x?u.getPrivyWalletWithAddress(d,x):u.getPrivySolanaWallet(d);if(!T&&x&&y)try{if(C){let e=await y.signTransaction(m);return i(A,"onSuccess",{signedTransaction:e}),void b(Yo("",e,null))}{let e=await y.sendTransaction(m,g,f),t=await g.getParsedTransaction(e,{maxSupportedTransactionVersion:0}),r=Yo(e,m,t??null);return i(A,"onSuccess",{response:r}),void b(r)}}catch(e){throw i(A,"onError",o.PrivyErrorCode.TRANSACTION_FAILURE),k(e),e}if(!T)return i(A,"onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void k(new o.PrivyClientError("No wallet found for address",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND));if(!d)return i(A,"onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void k(new o.PrivyClientError("User must be authenticated before signing with a Privy wallet",o.PrivyErrorCode.MUST_BE_AUTHENTICATED));let j=u.getIsUnifiedWallet(T);if(!await h({address:T.address}).catch((()=>!1)))throw i(A,"onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),new o.PrivyClientError(`Cannot sendSolanaTransaction before embedded wallet ${T.address} is connected`,o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND);let I=async()=>{let t=await r();if(!t||!c)throw i(A,"onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),k(new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND)),new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND);try{let r,s;if(!await h({address:T.address}))throw i(A,"onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),k(new o.PrivyClientError("Unable to connect to wallet",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR)),new o.PrivyClientError("Unable to connect to wallet",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR);if(n({showWalletUIs:v?.showWalletUIs})&&!C)try{if(!await Zo(m,g))throw i(A,"onError",o.PrivyErrorCode.INSUFFICIENT_BALANCE),k(new o.PrivyClientError("Solana wallet has insufficient funds for this transaction.",o.PrivyErrorCode.INSUFFICIENT_BALANCE)),new o.PrivyClientError("Solana wallet has insufficient funds for this transaction.",o.PrivyErrorCode.INSUFFICIENT_BALANCE)}catch(e){throw console.error(e),i(A,"onError",o.PrivyErrorCode.TRANSACTION_FAILURE),k(new o.PrivyClientError(e instanceof Error?e.message:"Transaction failed.",o.PrivyErrorCode.TRANSACTION_FAILURE)),new o.PrivyClientError(e instanceof Error?e.message:"Transaction failed.",o.PrivyErrorCode.TRANSACTION_FAILURE)}let{entropyId:l,entropyIdVerifier:u}=mn(d);if(j){let t=Ko(m)?Fr(m.message.serialize()):m.serializeMessage(),n=await a.rpc(e,p,{chain_type:"solana",method:"signMessage",params:{message:t.toString("base64"),encoding:"base64"},wallet_id:T.id});if(!n.data||!("signature"in n.data))throw Error("Failed to sign transaction");m.addSignature(Go(m,T.address),Fr(n.data.signature,"base64")),r=m}else r=await zm({accessToken:t,tx:m,walletProxy:c,entropyId:l,entropyIdVerifier:u,transactingWalletAddress:T.address,transactingWalletIndex:T.walletIndex??0});if(C)return s=Yo("",r,null),i("signSolanaTransaction","onSuccess",{signedTransaction:r}),b(s),s;{let{signature:e,receipt:t}=await async function({tx:e,connection:t,transactionOptions:r}){let n;try{let i=e.serialize();n=await t.sendRawTransaction(i,r);let a=await t.confirmTransaction(n);if(a.value.err||a.value.err){let e=a.value.err||a.value.err;if("string"==typeof e)throw Error(e);throw e}return{signature:n,signedTransaction:e,receipt:await t.getParsedTransaction(n,{maxSupportedTransactionVersion:0})}}catch(e){throw e.txSignature=n,e}}({tx:r,connection:g,transactionOptions:f});s=Yo(e,m,t),i("sendSolanaTransaction","onSuccess",{response:s})}return b(s),s}catch(e){throw i(A,"onError",o.PrivyErrorCode.TRANSACTION_FAILURE),k(e),e}};if(n({showWalletUIs:v?.showWalletUIs}))I();else{let{entropyId:e,entropyIdVerifier:r}=mn(d,T),n={recoveryMethod:T.recoveryMethod,connectingWalletAddress:T.address,entropyId:e,entropyIdVerifier:r,isUnifiedWallet:j,onCompleteNavigateTo:_w,onFailure:e=>{i(A,"onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),k(e)}},a=Qm(t)?Wf({address:T.address,appConfig:t,methodScreen:jf,fundWalletConfig:w,comingFromSendTransactionScreen:!0}):void 0;s({connectWallet:n,sendSolanaTransaction:{transactionRequest:m,connection:g,transactionOptions:f,transactingWallet:T,onConfirm:I,onSuccess:e=>{C?i("signSolanaTransaction","onSuccess",{signedTransaction:e.signedTransaction}):i("sendSolanaTransaction","onSuccess",{response:e}),b(e)},onFailure:e=>{i(A,"onError",o.PrivyErrorCode.TRANSACTION_FAILURE),k(e)},uiOptions:v||{},requesterAppId:E,signOnly:C},funding:a}),l(Gf)}}));function Mw(e){let t=Ni(),{user:r}=Ym(),{setModalData:n}=Ui(),{client:i,isHeadlessSigning:a,openModal:o,walletProxy:l,recoverEmbeddedWallet:c,privy:d,solanaWallets:p}=s.usePrivyInternal(),h=pa(),{signWithUserSigner:y}=u.useSignWithUserSigner();return da("sendSolanaTransaction",e),{sendTransaction:async({transaction:e,connection:s,uiOptions:u,transactionOptions:m,fundWalletConfig:g,address:f})=>{let w=f?p.find((e=>e.address===f&&"privy"!==e.walletClientType)):void 0;return await Nw({privy:d,appConfig:t,getAccessToken:()=>i.getAccessToken(),isHeadlessSigning:a,emitPrivyEvent:h,setModalData:n,openModal:o,walletProxy:l,user:r,signWithUserSigner:y,recoverEmbeddedWallet:c,connectedExternalWallet:w},{transaction:e,connection:s,transactionOptions:m,uiOptions:u,fundWalletConfig:g,address:f,signOnly:!1})}}}const Ww=({style:t,color:r,...n})=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:r||"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...n,children:/*#__PURE__*/e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Fw=t=>{let[n,i]=r.useState(!1);/*#__PURE__*/return e.jsxs(Uw,{color:t.color,onClick:()=>{i(!0),navigator.clipboard.writeText(t.text),setTimeout((()=>i(!1)),1500)},$justCopied:n,children:[n?/*#__PURE__*/e.jsx(Ww,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):/*#__PURE__*/e.jsx(Ju,{style:{height:"14px",width:"14px"}}),n?"Copied":"Copy"," ",t.itemName?t.itemName:"to Clipboard"]})};let Uw=/*#__PURE__*/g.styled.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 Rw=/*#__PURE__*/g.styled.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 Ow=({data:t})=>{let r=t=>"object"==typeof t&&null!==t?/*#__PURE__*/e.jsx(Dw,{children:Object.entries(t).map((([t,n])=>/*#__PURE__*/e.jsxs("li",{children:[/*#__PURE__*/e.jsxs("strong",{children:[t,":"]})," ",r(n)]},t)))}):/*#__PURE__*/e.jsx("span",{children:String(t)});/*#__PURE__*/return e.jsx("div",{children:r(t)})};const Lw=/*#__PURE__*/g.styled.div.withConfig({displayName:"Message",componentId:"sc-70ec2a4f-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%;font-size:0.875rem;font-weight:400;color:var(--privy-color-foreground);line-height:1.5;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]);let Dw=/*#__PURE__*/g.styled.ul.withConfig({displayName:"MessageList",componentId:"sc-70ec2a4f-1"})(["margin-left:12px !important;white-space:nowrap;&:first-child{margin-left:0 !important;}strong{font-weight:500 !important;}"]);const Bw=({data:t,className:r})=>/*#__PURE__*/e.jsx(Lw,{className:r,children:/*#__PURE__*/e.jsx(Ow,{data:t})});let zw=e=>{if(!l.isHex(e))return e;try{let t=l.hexToString(e);return t.includes("�")?e:t}catch{return e}},Hw=e=>JSON.stringify(e,null,2),$w=t=>{let{types:r,primaryType:n,...i}=t.typedData;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Yw,{data:i}),/*#__PURE__*/e.jsx(Fw,{text:Hw(t.typedData),itemName:"full payload to clipboard"})," "]})};const qw=({method:t,messageData:r,copy:n,iconUrl:i,isLoading:a,success:o,walletProxyIsLoading:s,errorMessage:l,isCancellable:c,onSign:d,onCancel:u,onClose:p})=>/*#__PURE__*/e.jsx(Xc,{title:n.title,subtitle:n.description,showClose:!0,onClose:p,icon:P.Edit,iconVariant:"subtle",helpText:l?/*#__PURE__*/e.jsx(Gw,{children:l}):void 0,primaryCta:{label:n.buttonText,onClick:d,disabled:a||o||s,loading:a},secondaryCta:c?{label:"Not now",onClick:u,disabled:a||o||s}:void 0,watermark:!0,children:/*#__PURE__*/e.jsxs(gs,{children:[i?/*#__PURE__*/e.jsx(Rw,{style:{alignSelf:"center"},size:"sm",src:i,alt:"app image"}):null,/*#__PURE__*/e.jsxs(Kw,{children:["personal_sign"===t&&/*#__PURE__*/e.jsx(Zw,{children:zw(r)}),"eth_signTypedData_v4"===t&&/*#__PURE__*/e.jsx($w,{typedData:r}),"solana_signMessage"===t&&/*#__PURE__*/e.jsx(Zw,{children:r})]})]})}),Vw={component:()=>{let{authenticated:t}=u.usePrivyContext(),{initializeWalletProxy:n,closePrivyModal:i}=s.usePrivyInternal(),{navigate:o,data:l,onUserCloseViaDialogOrKeybindRef:c}=Ui(),[d,p]=r.useState(!0),[h,y]=r.useState(""),[m,g]=r.useState(),[f,w]=r.useState(null),[v,x]=r.useState(!1);r.useEffect((()=>{t||o(om)}),[t]),r.useEffect((()=>{n(rr).then((e=>{p(!1),e||(y("An error has occurred, please try again."),g(new kn(new bn(h,a.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:C,data:b,confirmAndSign:k,onSuccess:E,onFailure:A,uiOptions:T}=l.signMessage,j={title:T?.title||"Sign message",description:T?.description||"Signing this message will not cost you any fees.",buttonText:T?.buttonText||"Sign and continue"},I=e=>{e?E(e):A(m||new kn(new bn("The user rejected the request.",a.ProviderErrors.E4001_USER_REJECTED_REQUEST.eipCode))),i({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{w(null),y(""),g(void 0)}),200)};c.current=()=>{I(f)};/*#__PURE__*/return e.jsx(qw,{method:C,messageData:b,copy:j,iconUrl:T?.iconUrl&&"string"==typeof T.iconUrl?T.iconUrl:void 0,isLoading:v,success:null!==f,walletProxyIsLoading:d,errorMessage:h,isCancellable:T?.isCancellable,onSign:async()=>{x(!0),y("");try{let e=await k();w(e),x(!1),setTimeout((()=>{I(e)}),Wt)}catch(e){console.error(e),y("An error has occurred, please try again."),g(new kn(new bn(h,a.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),x(!1)}},onCancel:()=>I(null),onClose:()=>I(f)})}};let Kw=/*#__PURE__*/g.styled.div.withConfig({displayName:"MessageContainer",componentId:"sc-21a0e112-0"})(["flex:1;display:flex;flex-direction:column;gap:16px;"]),Gw=/*#__PURE__*/g.styled.p.withConfig({displayName:"ErrorText",componentId:"sc-21a0e112-1"})(["&&{margin:0;width:100%;text-align:center;color:var(--privy-color-error-dark);font-size:14px;line-height:22px;}"]),Yw=/*#__PURE__*/g.styled(Bw).withConfig({displayName:"StyledDisplayJsonTree",componentId:"sc-21a0e112-2"})(["margin-top:0;"]),Zw=/*#__PURE__*/g.styled(Lw).withConfig({displayName:"StyledMessage",componentId:"sc-21a0e112-3"})(["margin-top:0;"]);function Qw(e){let{isHeadlessSigning:t,walletProxy:r,initializeWalletProxy:n,recoverEmbeddedWallet:i,openModal:l,privy:c,solanaWallets:d,client:p}=s.usePrivyInternal(),{user:h}=Ym(),y=pa(),{setModalData:m}=Ui(),{signWithUserSigner:g}=u.useSignWithUserSigner();return da("signSolanaMessage",e),{signMessage:({message:e,options:s})=>new Promise((async(f,w)=>{let v=s?.address?u.getPrivyWalletWithAddress(h,s.address):u.getPrivySolanaWallet(h);if(!v&&s?.address){let t=d.find((e=>e.address===s.address&&"privy"!==e.walletClientType));if(t)try{let r=await t.signMessage(e);y("signSolanaMessage","onSuccess",{signature:r}),f(r)}catch(e){y("signSolanaMessage","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),w(e)}}if(!v)return y("signSolanaMessage","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),void w(Error("No embedded or connected wallet found for address."));if(!h)return y("signSolanaMessage","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void w(Error("User must be authenticated before signing with a Privy wallet"));let{entropyId:x,entropyIdVerifier:C}=mn(h,v),b=u.getIsUnifiedWallet(v),k=Fr(e).toString("base64");if(k.length<1)return y("signMessage","onError",o.PrivyErrorCode.INVALID_MESSAGE),void w(Error("Message must be a non-empty string"));let E=async()=>{let e;if(!h)throw Error("User must be authenticated before signing with a Privy wallet");let t=await p.getAccessToken();if(!t)throw Error("User must be authenticated to use their embedded wallet.");let o=r??await n(15e3);if(!o)throw Error("Failed to initialize embedded wallet proxy.");if(!await i({address:v.address}))throw Error("Unable to connect to wallet");if(b){let t=await a.rpc(c,g,{chain_type:"solana",method:"signMessage",params:{message:k,encoding:"base64"},wallet_id:v.id});if(!t.data||!("signature"in t.data))throw Error("Failed to sign message");e=t.data.signature}else{let{response:r}=await o.rpc({accessToken:t,entropyId:x,entropyIdVerifier:C,chainType:"solana",hdWalletIndex:v.walletIndex??0,request:{method:"signMessage",params:{message:k}}});e=r.data.signature}return e};if(t({showWalletUIs:s?.uiOptions?.showWalletUIs}))try{let e=await E(),t=new Uint8Array(Fr(e,"base64"));y("signSolanaMessage","onSuccess",{signature:t}),f(t)}catch(e){w(e)}else m({signMessage:{method:"solana_signMessage",data:k,confirmAndSign:E,onSuccess:e=>{let t=new Uint8Array(Fr(e,"base64"));y("signSolanaMessage","onSuccess",{signature:t}),f(t)},onFailure:e=>{w(e)},uiOptions:s?.uiOptions},connectWallet:{recoveryMethod:v.recoveryMethod,connectingWalletAddress:v.address,entropyId:x,entropyIdVerifier:C,isUnifiedWallet:b,onCompleteNavigateTo:Vw,onFailure:e=>{y("signSolanaMessage","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),w(e)}}}),l(Gf)}))}}const Xw=()=>{let{client:e,exportSolanaWallet:t,solanaWallets:n,walletProxy:i,recoverEmbeddedWallet:l,privy:c}=s.usePrivyInternal(),{sendTransaction:d}=Mw(),{signMessage:p}=Qw(),{create:h}=Vm(),{signWithUserSigner:y}=u.useSignWithUserSigner(),{user:m}=Ym(),{ready:g}=Ys(),f=r.useMemo((()=>{if(!i)return n;let t=[...u.getPrivySolanaHDWallets(m),u.getImportedPrivySolanaWallet(m)].filter((e=>!!e)).map((t=>({type:"solana",imported:t.imported,address:t.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",walletIndex:t.walletIndex??void 0,meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund(){throw new o.PrivyClientError("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:()=>{throw new o.PrivyClientError("Cannot unlink an embedded Solana wallet")},async getProvider(){return new Bm(i,t.address,this.signMessage)},signMessage:async e=>await p({message:e,options:{address:t.address,uiOptions:{showWalletUIs:!1}}}),async sendTransaction(e,r,n){let{signature:i}=await d({transaction:e,connection:r,transactionOptions:n,address:t.address});return i},async signTransaction(r){let n=await e.getAccessToken();if(!n||!i)throw new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.MUST_BE_AUTHENTICATED);if(!await l({address:t.address}).catch((()=>!1)))throw new o.PrivyClientError("Wallet couldn't be connected",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:s,entropyIdVerifier:d}=mn(m,t);if(u.getIsUnifiedWallet(t)){let e=Ko(r)?Fr(r.message.serialize()):r.serializeMessage(),n=await a.rpc(c,y,{chain_type:"solana",method:"signMessage",params:{message:e.toString("base64"),encoding:"base64"},wallet_id:t.id});if(n.data&&"signature"in n.data)return r.addSignature(Go(r,t.address),Fr(n.data.signature,"base64")),r;throw Error("Failed to sign transaction")}return await zm({tx:r,accessToken:n,walletProxy:i,entropyId:s,entropyIdVerifier:d,transactingWalletAddress:t.address,transactingWalletIndex:t.walletIndex??0})},async signAllTransactions(r){let n=await e.getAccessToken();if(!n||!i)throw new o.PrivyClientError("Must have valid access token and Privy wallet to send transaction",o.PrivyErrorCode.MUST_BE_AUTHENTICATED);if(!await l({address:t.address}).catch((()=>!1)))throw new o.PrivyClientError("Wallet couldn't be connected",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:s,entropyIdVerifier:d}=mn(m,t);if(u.getIsUnifiedWallet(t))return await Promise.all(r.map((async e=>{let r=Ko(e)?Fr(e.message.serialize()):e.serializeMessage(),n=await a.rpc(c,y,{chain_type:"solana",method:"signMessage",params:{message:r.toString("base64"),encoding:"base64"},wallet_id:t.id});if(n.data&&"signature"in n.data)return e.addSignature(Go(e,t.address),Fr(n.data.signature,"base64")),e;throw Error("Failed to sign transaction")})));for(let e of r)await zm({tx:e,accessToken:n,walletProxy:i,entropyId:s,entropyIdVerifier:d,transactingWalletAddress:t.address,transactingWalletIndex:t.walletIndex??0});return r},loginOrLink:async()=>{throw new o.PrivyClientError("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{},isConnected:async()=>!0})));return n.concat(t)}),[m,i,e,n]);return{ready:!(!g||!i),createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:t}=await h({chainType:"solana",options:e});return t},exportWallet:t,wallets:f}},Jw={component:()=>{let{wallets:t}=Ys(),{wallets:n}=Xw(),{data:i,setModalData:o,navigate:c,lastScreen:d}=Ui(),{rpcConfig:u,appId:p,createAnalyticsEvent:h,closePrivyModal:y}=s.usePrivyInternal(),m=Ni(),[g,f]=r.useState(void 0),[w,v]=r.useState(!1),x=Yp(),C=i?.funding,{reloadBalance:b}=Fm({rpcConfig:u,appId:p,address:"ethereum"===C.chainType?C.address:void 0,chain:"ethereum"===C.chainType?C.chain:void 0}),k="solana"===C.chainType,E=k?C.isUSDC?"USDC":"SOL":C.erc20Address?C.erc20ContractInfo?.symbol:C.chain.nativeCurrency.symbol,A=k?n.find((({address:e})=>e===C.address)):t.find((({address:e})=>Vr(e)===Vr(C.address)));if(!C)return o({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:d||jf},funding:i?.funding,sendTransaction:i?.sendTransaction}),c(Nu),/*#__PURE__*/e.jsx(e.Fragment,{});r.useEffect((()=>{let e=k?async function(){if("solana"!==C.chainType)return;let e=x(Lm);e?(C.isUSDC?e.getTokenBalance({address:C.address,cluster:C.cluster,mintAddress:a.SolanaUsdcAddressMap[C.cluster.name]}).then((({amount:e})=>e)):e.getBalance({address:C.address,cluster:C.cluster})).then((e=>{let t=BigInt(e);g&&t>g&&(v(!0),h({eventName:Um,payload:{provider:"manual",status:"success",chainType:"solana",address:A?.address,value:C.isUSDC?l.formatUnits(t-g,6):l.formatUnits(t-g,9),token:C.isUSDC?"USDC":"SOL"}})),f(t)})):console.warn("Unable to load solana plugin, skipping balance")}:async function(){"ethereum"===C.chainType&&(async()=>{if(!C.erc20Address)return await b()??BigInt(0);{let{balance:e}=await Rm({chain:C.chain,address:C.address,erc20Address:C.erc20Address,rpcConfig:u,appId:p});return e}})().then((e=>{g&&e>g&&(v(!0),h({eventName:Um,payload:{provider:"manual",status:"success",chainType:"ethereum",address:A?.address,chainId:C.chain.id,value:l.formatUnits(e-g,C.erc20ContractInfo?.decimals??18),token:C.erc20ContractInfo?.symbol??C.erc20Address??"ETH"}})),f(e)})).catch((()=>f(void 0)))},t=setInterval(e,2e3);return e(),()=>clearInterval(t)}),[g]);let T=r.useMemo((()=>null==g?"":C.isUSDC?a.formatTokenAmount({amount:g,decimals:6}):k?zo(g,3,!0,!0):null!=C.erc20ContractInfo?.decimals?a.formatTokenAmount({amount:g,decimals:C.erc20ContractInfo.decimals}):a.formatWeiAmount({wei:g})),[g,k,C]),j="ethereum"===C.chainType?C.chain.name:tv[C.cluster.name],I=r.useMemo((()=>""===C.uiConfig?.receiveFundsTitle?null:/*#__PURE__*/e.jsx(fm,{children:C.uiConfig?.receiveFundsTitle??`Receive ${C.amount} ${E??""}`.trim()})),[C.uiConfig?.receiveFundsTitle,C.amount,E]),S=r.useMemo((()=>""===C.uiConfig?.receiveFundsSubtitle?null:/*#__PURE__*/e.jsx(gm,{children:C.uiConfig?.receiveFundsSubtitle??`Scan this code or copy your wallet address to receive funds on ${j}.`})),[C.uiConfig?.receiveFundsSubtitle,j]),P="solana"===C.chainType&&C.isUSDC&&a.SolanaUsdcAddressMap[C.cluster.name]?`?spl-token=${a.SolanaUsdcAddressMap[C.cluster.name]}`:"";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),I,S,/*#__PURE__*/e.jsxs(ms,{style:{gap:"1rem",margin:I||S?"1rem 0":"0"},children:[/*#__PURE__*/e.jsx(hp,{url:`${C.chainType}:${C.address}${P}`,size:200,squareLogoElement:ev}),/*#__PURE__*/e.jsxs(bm,{theme:m.appearance.palette.colorScheme,children:["Make sure to send funds on ",j,"."]}),/*#__PURE__*/e.jsx(Wm,{title:"Your wallet",errMsg:void 0,showCopyButton:!0,balance:`${T} ${E}`,address:C.address}),w&&/*#__PURE__*/e.jsx(go,{onClick:()=>y({shouldCallAuthOnSuccess:!1,isSuccess:!0}),children:"Continue"})]}),/*#__PURE__*/e.jsx(Ia,{})]})}};let ev=({...t})=>/*#__PURE__*/e.jsx(Rn,{color:"black",...t}),tv={devnet:"Devnet","mainnet-beta":"Solana",testnet:"Testnet"};let rv=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],nv=/*#__PURE__*/g.styled.div.withConfig({displayName:"Container",componentId:"sc-b3a607dd-0"})(["display:flex;flex-direction:column;min-height:72px;"]);var iv=({onBack:t,details:r})=>/*#__PURE__*/e.jsxs(nv,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:t}),/*#__PURE__*/e.jsx(Bw,{data:r}),/*#__PURE__*/e.jsx(Ia,{})]});let av=({gasUsed:e,effectiveGasPrice:t})=>{if(e&&t)try{return l.toHex(e*t)}catch(e){return}};const ov=({txn:t,receipt:r,transactionInfo:n,onClose:i,tokenPrice:a,tokenSymbol:o,receiptHeader:s,receiptDescription:l})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:i}),/*#__PURE__*/e.jsx(mc,{title:s??"Transaction complete!",description:l??"You're all set."}),/*#__PURE__*/e.jsx(Hs,{tokenPrice:a,from:r.from,to:r.to,gas:av(r),txn:t,transactionInfo:n,tokenSymbol:o}),/*#__PURE__*/e.jsx(ya,{}),/*#__PURE__*/e.jsx(sv,{loading:!1,onClick:i,children:"All Done"}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]});let sv=/*#__PURE__*/g.styled(go).withConfig({displayName:"SubmitButton",componentId:"sc-f70d0f7a-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const lv=[{constant:!1,inputs:[{name:"_salt",type:"bytes32"},{name:"_initializer",type:"bytes"}],name:"deployAccount",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],cv=[{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"}]}],dv=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],uv=[{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"}],pv=[{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"}],hv=[{constant:!1,inputs:[{name:"_operator",type:"address"},{name:"_approved",type:"bool"}],name:"setApprovalForAll",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],yv=[{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"}],mv=[{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"}],gv=[{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"}],fv=(e,t)=>{let r=wv(dv,e);if(r)return{action:"approve",functionName:"approve",isErc20Ish:!0,isNFTIsh:!1,spender:r.args[0],amount:r.args[1]};let n=wv(fg,e);if(n)return{action:"transfer",functionName:"transfer",isErc20Ish:!0,isNFTIsh:!1,transferTo:n.args[0],amount:n.args[1]};if(!t)return{action:"transaction",functionName:"",isErc20Ish:!1,isNFTIsh:!1};let i=wv(lv,e);if(i&&"string"==typeof i.args[1]){let e=vv(i.args[1]);if(e&&e[4].encodedInitData)return fv(e[4].encodedInitData,t)}let a=wv(hv,e);if(a)return{action:"approve",functionName:"setApprovalForAll",isNFTIsh:!0,isErc20Ish:!1,operator:a.args[0],approved:a.args[1]};let o=wv(yv,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=wv(pv,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=wv(gv,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=wv(mv,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=wv(uv,e);return d?{action:"mint",functionName:d.functionName,isNFTIsh:!0,isErc20Ish:!1,args:d.args}:{action:"transaction",isErc20Ish:!1,isNFTIsh:!1}};let wv=(e,t)=>{try{let r=l.decodeFunctionData({abi:e,data:t});return{functionName:r.functionName,args:r.args||[]}}catch(e){return null}},vv=e=>{try{if("string"==typeof e)return l.decodeAbiParameters(cv,`0x${e.slice(10)}`)}catch(e){return null}},xv=e=>`${parseFloat(e).toFixed(2)}`;const Cv=(e,t,n,i)=>{let[a,o]=r.useState(null),{walletProxy:l}=s.usePrivyInternal();return r.useEffect((()=>{a&&o(null),(async()=>{if(!l||!t)return null;let r=[],a=!0,o=await Zs(e,n,t,i).catch((t=>(t.message&&t.message.includes("Insufficient balance for transaction")||t.details&&t.details.includes("insufficient funds")?a=!1:r.push(t),e)));return{tx:o,totalGasEstimate:o.gas,hasFunds:a,errors:r}})().then(o)}),[e]),a};let bv=new kn(new bn("There was an issue preparing your transaction",a.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),kv=(e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0;const Ev={component:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:n,setModalData:i,navigate:o}=Ui(),{client:c,rpcConfig:d,chains:p,closePrivyModal:h,walletProxy:y,showFiatPrices:m}=s.usePrivyInternal(),{user:g}=u.usePrivyContext(),f=Ni(),[w,v]=r.useState(0),[x,C]=r.useState(0),[b,k]=r.useState(kv(t,w)),[E,A]=r.useState(null),[T,j]=r.useState(),[I,S]=r.useState(!1),[P,_]=r.useState(null),[N,M]=r.useState(null),[W,F]=r.useState(null),[U,R]=r.useState(void 0),[O,L]=r.useState(void 0),[D,B]=r.useState(!1),[z,H]=r.useState(!1),[$,q]=r.useState([]),[V,K]=r.useState([]),[G,Y]=r.useState("uninitiated"),[Z,Q]=r.useState(void 0);if(!b||!t?.sendTransaction||!t?.sendTransaction)/*#__PURE__*/return e.jsx(_u,{error:Error("Invalid transaction request"),allowlistConfig:f.allowlistConfig,onRetry:()=>{t?.sendTransaction?.onFailure(bv),h({shouldCallAuthOnSuccess:!1})}});let{transactingWalletAddress:X}=t.sendTransaction,J=r.useMemo((()=>p.find((e=>Number(e.id)===Number(b.chainId)))),[b.chainId]),ee=J?.nativeCurrency.symbol??"ETH",te=r.useMemo((()=>fv(b.data,!!f.embeddedWallets.extendedCalldataDecoding)),[b.data]),{action:re,isErc20Ish:ne,isNFTIsh:ie,functionName:ae}=te,{toAddress:oe,tokenAddress:se}=r.useMemo((()=>({toAddress:te.isErc20Ish?te.transferTo:b.to??void 0,tokenAddress:te.isErc20Ish?b.to:void 0})),[te]);r.useEffect((()=>{b.to&&J&&ne&&ig({address:b.to,chain:J,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(A).catch(console.error)}),[b.to,J]);let{tokenPrice:le,isTokenPriceLoading:ce}=Ks(b.chainId),{balance:de}=Fm({rpcConfig:f.rpcConfig,appId:f.id,address:X,chain:J}),ue=function({rpcConfig:e,appId:t,address:n,chain:i,tokenInfo:o}){let{chains:c}=s.usePrivyInternal(),[d,u]=r.useState(null),[p,h]=r.useState(!1),y=r.useMemo((()=>{let r=i||c[0];if(r)return l.createPublicClient({chain:i,transport:l.http(a.getJsonRpcEndpointFromChain(r,e,t))})}),[i,e,t]),m=r.useCallback((async()=>{if(n&&y&&o.address)try{return h(!0),await y.readContract({address:o.address,abi:rv,functionName:"balanceOf",args:[n]})}catch(e){console.error(e)}finally{h(!1)}}),[y,n,o?.address,i]);return r.useEffect((()=>{m().then((e=>null!=e&&u(e)))}),[m]),{balance:d,isLoading:p&&null==d,formattedBalance:a.formatTokenAmount({amount:d??BigInt(0),decimals:o.decimals})}}({rpcConfig:f.rpcConfig,appId:f.id,address:X,tokenInfo:{address:se||"",decimals:E?.decimals??18},chain:J}),pe=r.useMemo((()=>Hr(Number(b.chainId),p,d,{appId:f.id})),[b.chainId,d]),he=Cv(b,X,pe,t?.sendTransaction?.prepareTransactionRequest);r.useEffect((()=>{k(kv(t,w))}),[w]),r.useEffect((()=>{t.sendTransaction?.getIsSponsored?t.sendTransaction.getIsSponsored().then(j).catch(console.error):j(!1)}),[t.sendTransaction.getIsSponsored]);let ye=()=>{if(!I)return P?t?.sendTransaction?.onSuccess({hash:P}):W||he?.errors[0]?t?.sendTransaction?.onFailure(W??he?.errors[0]??bv):t?.sendTransaction?.onFailure(new kn(new bn("The user rejected the request",a.ProviderErrors.E4001_USER_REJECTED_REQUEST.eipCode))),h({shouldCallAuthOnSuccess:!1})};n.current=ye;let me=!!(t.funding&&t.funding.supportedOptions.length>0),ge=Mo(BigInt(he?.totalGasEstimate??0n),ee),fe=m&&le?No(BigInt(he?.totalGasEstimate??0n),le):void 0,we=Mo(de??0n,ee,void 0,!0),ve=m&&le?No(de??0n,le):void 0,xe=E&&!ue.isLoading&&ne&&"approve"!==re?`${ue.formattedBalance} ${E.symbol}`:void 0,Ce=t.sendTransaction?.uiOptions?.transactionInfo?.title;Ce||(Ce="approve"===re?ne?"Confirm address":"Confirm action":`Approve ${re}`);let be=r.useMemo((()=>{if(t.sendTransaction?.uiOptions?.description)return t.sendTransaction?.uiOptions?.description;if("approve"===re&&"setApprovalForAll"===ae&&te.approved){let t=/*#__PURE__*/e.jsx(Dl,{address:te.operator||"",url:J?.blockExplorers?.default?.url});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[f.name," would like your permission for ",t," to transfer tokens on your behalf."]})}if("approve"===re&&"setApprovalForAll"===ae&&!te.approved){let t=/*#__PURE__*/e.jsx(Dl,{address:te.operator||"",url:J?.blockExplorers?.default?.url});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[f.name," would like your permission to revoke permissions of ",t," from transferring tokens on your behalf."]})}return ne&&"approve"===re||ne&&"approve"===re?`${f.name} would like your permission for ${Vr(te.spender)} to spend tokens on your behalf.`:`${f.name} wants your permission to approve the following transaction.`}),[f.name,ne,te,t.sendSolanaTransaction?.uiOptions.description,ae]),ke=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,Ee=!(!he||he.errors[0]||he.hasFunds||!1!==T),Ae=Ee&&me,Te=Ae?"Add funds":t.sendTransaction?.uiOptions?.buttonText||(w<x?"Continue":"Approve"),je=e=>{if(!e)throw Error("Transaction scan failed");if("Success"===e.validation.status&&("Benign"===e.validation.result_type?L("safe"):"Warning"===e.validation.result_type?L("warn"):"Malicious"===e.validation.result_type&&(L("error"),H(!0))),"Success"!==e.simulation.status)throw Error("Simulation failed");{R(e.simulation.params);let{assetsIn:t,assetsOut:r}=function(e,t){let r=[],n=new Map;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?{id:`nft:${t.asset.name}`,nftName:t.asset.name,nftCount:t.in.length}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.in[0].value,symbol:t.asset.symbol,usdValue:t.in[0].usd_price?xv(t.in[0].usd_price):void 0,decimals:t.asset.decimals},r.push(e)}else if(t.out[0]?.value){let e;e="ERC721"===t.asset.type||"approve_for_all"===t.out[0].value?{id:`nft:${t.asset.name}`,nftName:t.asset.name}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.out[0].value,symbol:t.asset.symbol,usdValue:t.out[0].usd_price?xv(t.out[0].usd_price):void 0,decimals:t.asset.decimals},n.has(e.id)||n.set(e.id,e)}for(let e of t)for(let t of Object.keys(e.spenders)){let r;r="ERC721"===e.asset.type||"approve_for_all"===e.spenders[t]?.value?{id:`nft:${e.asset.name}`,nftName:e.asset.name}:{id:`token:${e.asset.type}:${e.asset.symbol}:${e.asset.name}`,iconUrl:e.asset.logo_url,value:e.spenders[t]?.value,symbol:e.asset.symbol,usdValue:e.spenders[t]?.usd_price?xv(e.spenders[t]?.usd_price):void 0,decimals:e.asset.decimals},n.has(r.id)||n.set(r.id,r)}return{assetsIn:r,assetsOut:Array.from(n.values())}}(e.simulation.assets_diffs,e.simulation.exposures);if(0===r.length&&0===t.length)throw Error("No tokens found");q(r),K(t)}};if(r.useEffect((()=>{t.sendTransaction?.scanTransaction&&f.embeddedWallets.transactionScanning.enabled&&"uninitiated"===G&&(Y("in progress"),t.sendTransaction.scanTransaction().then((e=>{je(e),Y("completed")})).catch((()=>Y("failed"))))}),[!!t.sendTransaction?.scanTransaction]),r.useEffect((()=>{t.sendTransaction?.scanTransaction&&"failed"!==G||((e,r,n)=>{if(C((e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(t)),r.isErc20Ish&&r.amount&&n){let e=vg({amount:r.amount,decimals:n.decimals});Q(e),q([{value:e,symbol:n?.symbol,decimals:n?.decimals}])}else if(e.value){let t=BigInt(e.value),r=le?No(t,le):void 0;q(m&&r?[{value:r}]:[{value:Wo(t),symbol:ee,decimals:18,usdValue:r}])}else q(m?[{value:"$0"}]:[{value:"0",symbol:ee,decimals:18}])})(he?.tx??b,te,E)}),[b,he?.tx,te,E,G]),N/*#__PURE__*/)return e.jsx(ov,{txn:he?.tx??b,onClose:ye,receipt:N,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,tokenPrice:le,tokenSymbol:ee,receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription});if(W)/*#__PURE__*/return e.jsx(pw,{transactionError:W,transactionHash:P??void 0,network:"ethereum",chainId:he?.tx.chainId??b.chainId,onClose:ye,onRetry:({resetNonce:e})=>{F(null);let t={...he?.tx??b};e&&(t.nonce=void 0),k(t)}});let Ie=0!==x&&"number"==typeof w&&0!==w?()=>{v(w-1)}:void 0;return D&&U?/*#__PURE__*/e.jsx(iv,{details:U,onBack:()=>B(!1)}):/*#__PURE__*/e.jsx(aw,{transactionIndex:w,onBack:Ie,maxIndex:x,disabled:Ee&&!me||z,isSubmitting:I,submitError:W,isPreparing:!he,isTokenPriceLoading:ce,isTokenContractInfoLoading:!ie&&!E,prepareError:he?.errors[0],symbol:E?.symbol,chain:J,img:ke,title:Ce,subtitle:be,txValue:b.value,fee:fe??ge,isSponsored:T,from:X??"",to:oe,tokenAddress:se??void 0,network:f.chains.find((e=>e.id===b.chainId))?.name??"",transactionDetails:{...te,formattedAmount:Z},cta:Te,missingFunds:Ee,action:re,balance:xe??ve??we,onClose:ye,onClick:Ae?async()=>{if(X){if(!me)throw Error("Funding wallet is not enabled");i({...t,funding:{...t.funding,methodScreen:jf,chainType:"ethereum",amount:l.formatEther(BigInt(he?.tx.value??0)+BigInt(he?.totalGasEstimate?.toString()??0)),chain:J}}),o(jf)}}:async()=>{if(w<x)v(w+1);else{S(!0);try{let e=await c.getAccessToken();if(I||!e||!y||!g)return;let r=await t.sendTransaction.onConfirm({transactionRequest:he?.tx??b});if(_(r),t.sendTransaction?.signOnly)return await new Promise((e=>setTimeout(e,Wt))),t?.sendTransaction?.onSuccess({hash:r}),h({shouldCallAuthOnSuccess:!1});let n=await pe.waitForTransactionReceipt({hash:r});if("reverted"===n.status)throw Error("Transaction failed");M(n)}catch(e){console.warn({transaction:he?.tx??b,error:e}),F(e)}finally{S(!1)}}},validation:O,hasScanDetails:!!U,setIsScanDetailsOpen:B,preventMaliciousTransaction:z,setPreventMaliciousTransaction:H,tokensSent:$,tokensReceived:V,isScanning:"in progress"===G,isCancellable:t.sendTransaction?.uiOptions?.isCancellable??!1,functionName:ae})}};function Av({title:t}){let{currentScreen:r,navigateBack:n,navigate:i,data:a,setModalData:o}=Ui();/*#__PURE__*/return e.jsx(Wa,{title:t,backFn:r===Jw?n:r===a?.funding?.methodScreen?a.funding.comingFromSendTransactionScreen?()=>i(Ev):void 0:a?.funding?.methodScreen?()=>{let e=a.funding;e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),o({funding:e}),i(e.methodScreen)}:void 0})}const Tv={component:()=>{let{rpcConfig:t,appId:n,closePrivyModal:i,createAnalyticsEvent:c}=s.usePrivyInternal(),{navigate:d,setModalData:u,app:p,data:h}=Ui(),{wallets:y}=Ys(),m=Yp(),[g,f]=r.useState(null),[w,v]=r.useState(null),[x,C]=r.useState([]),[b,k]=r.useState(0),[E,A]=r.useState(!1),[T,j]=r.useState(!1),[I,S]=r.useState(!1),[P,_]=r.useState(!1),[N,M]=r.useState(),[W,F]=r.useState();if(!h?.funding||"solana"!==h.funding.chainType)throw Error("Invalid funding data");let{address:U,cluster:R,connectedWalletAddress:O}=h.funding,[L,D]=r.useState(h.funding.amount),B=O?y.find((({address:e})=>e===O)):y[0],z=ui(B?.walletClientType||"unknown"),H=z?.name||"wallet",[$,q]=r.useState(null);r.useEffect((()=>{(async()=>{if(!B)return;let e=await B.getEthereumProvider();q(l.createWalletClient({account:B.address,transport:l.custom(e)}).extend(l.publicActions))})().catch(console.error)}),[B]);let[V,K]=r.useState(0n),G=zo(V);r.useEffect((()=>{let e=m(Lm);e?e.getBalance({address:U,cluster:R}).then((e=>K(BigInt(e)))):console.warn("Unable to load solana plugin, skipping balance")}),[]);let[Y,Z]=r.useState(),{tokenPrice:Q}=Ks("solana"),{fundingAmountInBaseUnit:X,fundingAmountInUsd:J}=$o({amount:L,fee:0n,tokenPrice:Q,isUsdc:h.funding.isUSDC});if(r.useEffect((()=>{(async()=>{if(!$||!B)return;let e=["testnet","devnet"].includes(R.name);e&&console.warn("Solana testnets are not supported for bridging");let r=a.addToDefaultChains(p.chains).filter((({testnet:t})=>!!t===e)),i=(await xg({chains:r,address:B.address,appId:n,rpcConfig:t})).filter((e=>e.balance>0n));if(i.length<1)return void f(new o.PrivyClientError(`Wallet ${Vr(B.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE));i.sort(((e,t)=>Number(t.balance-e.balance)));let s=(await Promise.allSettled(i.map((async e=>({...e,quote:await ju({isTestnet:!1,input:Eu({amount:X.toString(),user:B.address,recipient:U,destinationChainId:wi,destinationCurrency:vi,originChainId:e.chain.id})})}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(s.length<1)return void f(new o.PrivyClientError(`Unable to fetch quotes for bridging. Wallet ${Vr(B.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE));let l=s.map((({quote:e,balance:t,chain:r})=>({bridgeTx:Iu(e),balance:t,chain:r,isErc20Quote:!1}))).filter((({bridgeTx:e})=>!!e));if(l.length>1)return void C(l);let c=l.at(0);c?(j(!0),Z({data:c.bridgeTx.data,to:c.bridgeTx.to,value:c.bridgeTx.value,chain:c.chain})):f(new o.PrivyClientError(`Unable to select bridge option from quotes. Wallet ${Vr(B.address)} does not have enough funds.`,void 0,o.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[$]),r.useEffect((()=>{(async()=>{let e,r;if(!$||!B||E||I||!Y)return;A(!0);let i=l.createPublicClient({chain:Y.chain,transport:l.http($r(Y.chain,t,n))});try{e=await i.prepareTransactionRequest({account:B.address,to:Y.to,chain:Y.chain,data:Y.data,value:BigInt(Y.value??0)})}catch(e){console.error(e),x.length>1&&v(e.shortMessage??"Something went wrong")}if(e){A(!1),S(!0);try{await $.switchChain({id:Y.chain.id})}catch(e){await $.addChain({chain:Y.chain}),await $.switchChain({id:Y.chain.id})}try{r=await $.sendTransaction(e)}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(x.length<1?f(new o.PrivyClientError(e.shortMessage,void 0,o.PrivyErrorCode.TRANSACTION_FAILURE)):v(e.shortMessage??"Something went wrong"))}if(r)return await $.waitForTransactionReceipt({hash:r}),T?(F("pending"),void M(r)):(S(!1),_(!0),void c({eventName:Um,payload:{provider:"external",status:"success",txHash:r,address:B.address,chainId:Y.chain.id,chainType:"ethereum",value:Y.value?l.formatUnits(BigInt(Y.value),18):void 0,token:"ETH",destination:U,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:l.formatUnits(X,9),destinationToken:"SOL"}}));S(!1)}else A(!1)})().catch(console.error)}),[$,Y]),Su({transactionHash:N,wallet:B,isTestnet:!1,bridgingStatus:W,setBridgingStatus:F,onSuccess({transactionHash:e,wallet:t}){j(!1),_(!0),c({eventName:Um,payload:{provider:"external",status:"success",txHash:e,address:t.address,chainId:Y?.chain.id,chainType:"ethereum",value:Y?.value?l.formatUnits(BigInt(Y.value),18):void 0,token:"ETH",destination:U,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:l.formatUnits(X,9),destinationToken:"SOL"}})},onFailure({error:e}){j(!1),f(e)}}),r.useEffect((()=>{g&&(u({funding:h?.funding,sendTransaction:h?.sendTransaction,errorModalData:{error:g,previousScreen:lf}}),d(Nu,!1))}),[g]),r.useEffect((()=>{if(!P)return;let e=setTimeout(i,Ut);return()=>clearTimeout(e)}),[P]),P/*#__PURE__*/)return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(ws,{}),/*#__PURE__*/e.jsxs(ys,{children:[/*#__PURE__*/e.jsx(nt.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(gc,{title:"Success!",description:`You’ve successfully added ${L} SOL to your ${p.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(vs,{}),/*#__PURE__*/e.jsx(Ia,{})]});let ee=x[b];return x.length>1&&ee?/*#__PURE__*/e.jsx(nf,{displayName:H,configuredFundingChain:R,formattedBalance:G,fundingAmount:L,fundingCurrency:"SOL",fundingAmountInUsd:J,options:x,selectedOption:ee,isPreparing:E,isSubmitting:I,addressToFund:U,fundingWalletAddress:B?.address||"",errorMessage:w,onSubmit:()=>{h.funding?.amount!==L?async function(){if(B&&ee)try{let e=await ju({isTestnet:!1,input:Eu({amount:X.toString(),user:B.address,recipient:U,destinationChainId:wi,destinationCurrency:vi,originChainId:ee.chain.id})}),t=Iu(e);if(!t)throw Error("Invalid transaction request");j(!0),Z({data:t.data,to:t.to,value:t.value,chain:ee.chain})}catch(e){console.error(e),f(new o.PrivyClientError("Unable to fetch quotes for bridging",e,o.PrivyErrorCode.INSUFFICIENT_BALANCE))}}().catch(console.error):Z({to:ee.bridgeTx.to,data:ee.bridgeTx.data,value:ee.bridgeTx.value,chain:ee.chain})},onSelect:e=>{e!==b&&(v(null),k(e))},onAmountChange:D}):I&&B?/*#__PURE__*/e.jsx(yg,{wallet:B,displayName:H,addressToFund:U,isBridging:T,isErc20Flow:!1,chainId:"solana",chainName:R.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
|
|
31
|
+
/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Av,{}),/*#__PURE__*/e.jsx(jc,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(Ia,{})]})}},jv=new Map([[jf,null],[lf,"external"],[af,"external"],[gg,"external"],[Tv,"external"],[of,"external"],[Jw,"manual"],[wf,"moonpay"]]),Iv=()=>{let e=Ni(),{user:t}=u.usePrivyContext(),{client:n,refreshSessionAndUser:i,walletProxy:a}=s.usePrivyInternal();return{migrate:r.useCallback((async()=>{if("legacy-embedded-wallets-only"===e.embeddedWallets.mode)return{success:!0};if(!t)throw new o.PrivyClientError("User must be authenticated before migrating wallets",o.PrivyErrorCode.MUST_BE_AUTHENTICATED);let r=u.getPrivyPrimaryWallet(t);if(!r||u.getIsUnifiedWallet(r)||!ec(r))return{success:!0};if(!a)throw new o.PrivyClientError("Cannot connect to wallet proxy");let s=await n.getAccessToken();if(!s)throw new o.PrivyClientError("User must be authenticated before migrating wallets",o.PrivyErrorCode.MUST_BE_AUTHENTICATED);let l=r.imported?[r]:t.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported)).filter(ec),{entropyId:c,entropyIdVerifier:d}=mn(t,r);try{await a.connect({accessToken:s,entropyId:c,entropyIdVerifier:d})}catch(e){if(!yl(e)||"privy"!==r.recoveryMethod)throw e;await a.recover({accessToken:s,entropyId:c,entropyIdVerifier:d})}return await a.createDelegatedAction({accessToken:s,rootWallet:{address:r.address,chainType:r.chainType,imported:r.imported},delegatedWallets:l}),await i(),{success:!0}}),[e.embeddedWallets.mode,t,a,n,i])}},Sv=({disabled:e})=>{let{migrate:t}=Iv(),{user:n}=u.usePrivyContext(),{walletProxy:i}=s.usePrivyInternal();return r.useEffect((()=>{!e&&n&&i&&t().catch((e=>{console.debug("Unable to migrate wallets: ",e)}))}),[n,i,e,t]),null},Pv=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});function _v(e){let{logout:t}=r.useContext(u.PrivyContext);return da("logout",e),{logout:t}}const Nv=({providerApp:t,success:n,error:i,onClose:a})=>{let{title:o,subtitle:s}=r.useMemo((()=>n?{title:`Successfully connected with ${t.name}`,subtitle:"You're good to go!"}:i?{title:"Authentication failed",subtitle:i.message}:{title:`Connecting to ${t.name}`,subtitle:`Please check the pop-up from ${t.name} to continue`}),[n,i,t.name]);/*#__PURE__*/return e.jsx(Xc,{title:o,subtitle:s,icon:t.logoUrl,iconVariant:"loading",iconLoadingStatus:{success:n,fail:!!i},onBack:a,watermark:!0})},Mv={component:()=>{let t=Ni(),{data:n,navigate:i,setModalData:a,onUserCloseViaDialogOrKeybindRef:l}=Ui(),{crossAppAuthFlow:c,updateWallets:d,closePrivyModal:u,createAnalyticsEvent:p}=s.usePrivyInternal(),{logout:h}=_v(),[y,m]=r.useState({}),g=n?.crossAppAuth,f={id:g.appId,name:g.name,logoUrl:g.logoUrl},w=new o.PrivyClientError(`There was an issue connecting your ${f.name} account. Please try again.`),v=new _t((async e=>{if(g.popup)try{let t=await c({appId:e,popup:g.popup,action:g.action});m({data:t})}catch(e){if(e instanceof o.PrivyClientError)m({error:e});else if(e instanceof o.PrivyApiError){if(e.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return a({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:`privy:${f.id}`,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void i(qu);g.popup&&g.popup.close(),m({error:w})}else m({error:w})}else m({error:w})})),x=()=>{y.data&&(d(),g.onSuccess(y.data),u({shouldCallAuthOnSuccess:!0,isSuccess:!0})),g.onError(y.error??new o.PrivyClientError("User canceled flow")),u({shouldCallAuthOnSuccess:!1,isSuccess:!1})};return l.current=x,r.useEffect((()=>{f.id.length&&v.execute(f.id)}),[f.id]),r.useEffect((()=>{if(!y.data)return;let e=y.data;if(t.legal.requireUsersAcceptTerms&&!e.hasAcceptedTerms){let e=setTimeout((()=>{i(Zu)}),Wt);return()=>clearTimeout(e)}if(wu(e,t.embeddedWallets)){let e=setTimeout((()=>{a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),p({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${f.id}`,screen:"CrossAppAuthScreen"}}),h()},callAuthOnSuccessOnClose:!0}}),i(Yu)}),Wt);return()=>clearTimeout(e)}let r=setTimeout(x,Wt);return()=>clearTimeout(r)}),[y.data]),/*#__PURE__*/e.jsx(Nv,{providerApp:f,success:!!y.data,error:y.error,onClose:x})}},Wv=({appName:t,address:r,success:n,error:i,onAccept:a,onDecline:o,onClose:s})=>n||i?/*#__PURE__*/e.jsx(Xc,{title:i?"Something went wrong":"Success!",subtitle:i?"Please try again.":`You've successfully granted delegated action permissions to ${t}.`,icon:i?P.AlertCircle:P.CheckCircle,iconVariant:i?"error":"success",onBack:s,watermark:!0}):/*#__PURE__*/e.jsx(Xc,{title:"Enable offline access",subtitle:`By confirming, ${t} will be able to use your wallet for you even when you're not around. You can revoke this later.`,icon:P.CloudUpload,primaryCta:{label:"Accept",onClick:a},secondaryCta:{label:"Not now",onClick:o},onBack:s,watermark:!0,children:/*#__PURE__*/e.jsx(Wm,{address:r,title:"Wallet"})}),Fv={component:()=>{let{app:t,data:n}=Ui(),{closePrivyModal:i}=s.usePrivyInternal(),[a,l]=r.useState(!1),[c,d]=r.useState(),{address:u,onDelegate:p,onSuccess:h,onError:y}=n.delegatedActions.consent,m=async()=>{a?h():y(c??new o.PrivyClientError("User declined delegating actions.")),i({shouldCallAuthOnSuccess:!1})};return r.useEffect((()=>{if(!a&&!c)return;let e=setTimeout(m,Ft);return()=>clearTimeout(e)}),[a,c]),/*#__PURE__*/e.jsx(Wv,{appName:t.name,address:u,success:a,error:c,onAccept:async()=>{try{await p(),l(!0)}catch(e){d(e)}},onDecline:()=>{m()},onClose:m})}},Uv=({appName:t,success:r,error:n,onRevoke:i,onDeny:a,onClose:o})=>r||n?/*#__PURE__*/e.jsx(Xc,{title:n?"Something went wrong":"Success!",subtitle:n?"Please try again.":"You've successfully revoked permissions.",icon:n?P.AlertCircle:P.CheckCircle,iconVariant:n?"error":"success",onBack:o,watermark:!0}):/*#__PURE__*/e.jsx(Xc,{title:"Revoke offline access to wallet",subtitle:`By confirming, ${t} will no longer be able to use this wallet on your behalf when you are not online.`,icon:P.Ban,primaryCta:{label:"Confirm",onClick:i},secondaryCta:{label:"Deny",onClick:a},onBack:o,watermark:!0}),Rv={component:()=>{let{app:t,data:n}=Ui(),{closePrivyModal:i}=s.usePrivyInternal(),[a,l]=r.useState(!1),[c,d]=r.useState(),{onRevoke:u,onSuccess:p,onError:h}=n.delegatedActions.revoke,y=async()=>{a?p():h(c??new o.PrivyClientError("User declined revoking access to their delegated wallet.")),i({shouldCallAuthOnSuccess:!1})};return r.useEffect((()=>{if(!a&&!c)return;let e=setTimeout(y,Ft);return()=>clearTimeout(e)}),[a,c]),/*#__PURE__*/e.jsx(Uv,{appName:t.name,success:a,error:c,onRevoke:async()=>{try{await u(),l(!0)}catch(e){d(e)}},onDeny:()=>{y()},onClose:y})}};let Ov="#8a63d2";const Lv=({appName:t,loading:r,success:i,errorMessage:a,connectUri:o,onBack:s,onClose:l,onOpenFarcaster:c})=>n.isMobile||r?n.isIOS?/*#__PURE__*/e.jsx(Xc,{title:a?a.message:"Add a signer to Farcaster",subtitle:a?a.detail:`This will allow ${t} to add casts, likes, follows, and more on your behalf.`,icon:xh,iconVariant:"loading",iconLoadingStatus:{success:i,fail:!!a},primaryCta:o&&c?{label:"Open Farcaster app",onClick:c}:void 0,onBack:s,onClose:l,watermark:!0}):/*#__PURE__*/e.jsx(Xc,{title:a?a.message:"Requesting signer from Farcaster",subtitle:a?a.detail:"This should only take a moment",icon:xh,iconVariant:"loading",iconLoadingStatus:{success:i,fail:!!a},onBack:s,onClose:l,watermark:!0,children:o&&n.isMobile&&/*#__PURE__*/e.jsx(Dv,{children:/*#__PURE__*/e.jsx(Ch,{text:"Take me to Farcaster",url:o,color:Ov})})}):
|
|
32
|
+
/*#__PURE__*/e.jsx(Xc,{title:"Add a signer to Farcaster",subtitle:`This will allow ${t} to add casts, likes, follows, and more on your behalf.`,onBack:s,onClose:l,watermark:!0,children:/*#__PURE__*/e.jsxs(Bv,{children:[/*#__PURE__*/e.jsx(zv,{children:o?/*#__PURE__*/e.jsx(hp,{url:o,size:275,squareLogoElement:xh}):/*#__PURE__*/e.jsx(qv,{children:/*#__PURE__*/e.jsx(co,{})})}),/*#__PURE__*/e.jsxs(Hv,{children:[/*#__PURE__*/e.jsx($v,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),o&&/*#__PURE__*/e.jsx(Fw,{text:o,itemName:"link",color:Ov})]})]})});let Dv=/*#__PURE__*/g.styled.div.withConfig({displayName:"MobileLinkContainer",componentId:"sc-da518e1f-0"})(["margin-top:24px;"]),Bv=/*#__PURE__*/g.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-da518e1f-1"})(["display:flex;flex-direction:column;align-items:center;gap:24px;"]),zv=/*#__PURE__*/g.styled.div.withConfig({displayName:"QrContainer",componentId:"sc-da518e1f-2"})(["padding:24px;position:relative;display:flex;align-items:center;justify-content:center;min-height:275px;"]),Hv=/*#__PURE__*/g.styled.div.withConfig({displayName:"InstructionsContainer",componentId:"sc-da518e1f-3"})(["display:flex;flex-direction:column;align-items:center;gap:16px;"]),$v=/*#__PURE__*/g.styled.div.withConfig({displayName:"InstructionText",componentId:"sc-da518e1f-4"})(["font-size:0.875rem;text-align:center;color:var(--privy-color-foreground-2);"]),qv=/*#__PURE__*/g.styled.div.withConfig({displayName:"LoaderWrapper",componentId:"sc-da518e1f-5"})(["position:relative;width:82px;height:82px;"]);const Vv={component:()=>{let{lastScreen:t,navigateBack:n,data:i,app:a}=Ui(),{requestFarcasterSignerStatus:o,closePrivyModal:l}=s.usePrivyInternal(),[c,d]=r.useState(void 0),[u,p]=r.useState(!1),[h,y]=r.useState(!1),m=r.useRef([]),g=i?.farcasterSigner;r.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{if(!g?.public_key)return clearInterval(t),void d({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===g.status&&(clearInterval(t),p(!1),y(!0),m.current.push(setTimeout((()=>l({shouldCallAuthOnSuccess:!1,isSuccess:!0})),Wt)));let r=await o(g?.public_key),n=Date.now()-e;"approved"===r.status?(clearInterval(t),p(!1),y(!0),m.current.push(setTimeout((()=>l({shouldCallAuthOnSuccess:!1,isSuccess:!0})),Wt))):n>3e5?(clearInterval(t),d({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):"revoked"===r.status&&(clearInterval(t),d({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))}),2e3);return()=>{clearInterval(t),m.current.forEach((e=>clearTimeout(e)))}}),[]);let f="pending_approval"===g?.status?g.signer_approval_url:void 0;/*#__PURE__*/return e.jsx(Lv,{appName:a.name,loading:u,success:h,errorMessage:c,connectUri:f,onBack:t?n:void 0,onClose:l,onOpenFarcaster:()=>{f&&(window.location.href=f)}})}},Kv=({onClose:t})=>/*#__PURE__*/e.jsx(Xc,{title:"Could not log in with provider",subtitle:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",icon:P.ExternalLink,primaryCta:{label:"Close",onClick:t},watermark:!0}),Gv={component:()=>{let{closePrivyModal:t}=s.usePrivyInternal();/*#__PURE__*/return e.jsx(Kv,{onClose:()=>t()})}},Yv=({title:t="Connect your email",subtitle:r="Add your email to your account"})=>/*#__PURE__*/e.jsx(Xc,{title:t,subtitle:r,icon:De.default,watermark:!0,children:/*#__PURE__*/e.jsx(ds,{children:/*#__PURE__*/e.jsx(_y,{stacked:!0})})}),Zv={component:()=>{let{app:t}=Ui();/*#__PURE__*/return e.jsx(Yv,{subtitle:`Add your email to your ${t?.name} account`})}},Qv=({title:t="Connect your phone",subtitle:n="Add your number to your account",onSubmit:i,isSubmitting:a=!1})=>{let[o,s]=r.useState(null),l=async()=>{o?.qualifiedPhoneNumber&&await i(o)};/*#__PURE__*/return e.jsx(Xc,{title:t,subtitle:n,icon:Ie.default,primaryCta:{label:a?"Submitting":"Submit",onClick:l,disabled:!o?.isValid||a},watermark:!0,children:/*#__PURE__*/e.jsx(Yh,{onChange:e=>{s(e)},onSubmit:l,noIncludeSubmitButton:!0,hideRecent:!0})})},Xv={component:()=>{let{app:t,currentScreen:n,data:i,navigate:a,setModalData:o}=Ui(),{initLoginWithSms:l}=s.usePrivyInternal(),[c,d]=r.useState(!1);/*#__PURE__*/return e.jsx(Qv,{subtitle:`Add your number to your ${t?.name} account`,onSubmit:async e=>{d(!0);try{await l({phoneNumber:e.qualifiedPhoneNumber,withPrivyUi:!0}),a(Ey)}catch(e){o({errorModalData:{error:e,previousScreen:i?.errorModalData?.previousScreen||n||Xv}}),a(Nu)}finally{d(!1)}},isSubmitting:c})}},Jv=({title:t="Could not connect with wallet",subtitle:r="Please check that Phantom multichain is enabled and try again.",primaryCtaText:n="Try again",secondaryCtaText:i="Cancel",onTryAgain:a,onCancel:o})=>/*#__PURE__*/e.jsx(Xc,{title:t,subtitle:r,icon:P.XCircle,iconVariant:"error",primaryCta:{label:n,onClick:a},secondaryCta:{label:i,onClick:o},watermark:!0}),ex={component:()=>{let{closePrivyModal:t}=s.usePrivyInternal(),{navigate:r}=Ui();/*#__PURE__*/return e.jsx(Jv,{onTryAgain:()=>{r(om)},onCancel:async()=>{await t()}})}};function tx(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:i,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:o,unenroll:s,enrollInMfa:l}=r.useContext(u.PrivyContext);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:n,submitEnrollmentWithSms:i,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:o,unenrollWithSms:()=>s("sms"),unenrollWithTotp:()=>s("totp"),unenrollWithPasskey:e=>s("passkey",e),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}const rx=t=>/*#__PURE__*/e.jsxs(nx,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...t,children:[/*#__PURE__*/e.jsx("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),/*#__PURE__*/e.jsx("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 nx=/*#__PURE__*/g.styled.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 ix=({showIntro:t,userMfaMethods:r,appMfaMethods:n,userHasAuthSms:i,isTotpLoading:a,isPasskeyLoading:o,error:s,onClose:l,onBackToIntro:c,handleSelectMethod:d,setRemovingMfaMethod:u})=>{let p=r.reduce(((e,t)=>({...e,[t]:!0})),{}),h=n.reduce(((e,t)=>({...e,[t]:!0})),{});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:t?c:void 0,onClose:l},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(Se.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Choose a verification method"}),r.length>0?/*#__PURE__*/e.jsx(Ha,{children:"To add or delete verification methods, verification is required."}):/*#__PURE__*/e.jsx(Ha,{children:"How would you like to verify your identity?"}),s&&/*#__PURE__*/e.jsx(io,{style:{marginTop:"1.25rem"},children:s.message}),/*#__PURE__*/e.jsxs(Ya,{children:[(h.passkey||p.passkey)&&/*#__PURE__*/e.jsxs(Za,{children:[/*#__PURE__*/e.jsx(xa,{style:{justifyContent:"center"},onClick:()=>d("passkey"),disabled:p.passkey||o,children:o?/*#__PURE__*/e.jsx(co,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):/*#__PURE__*/e.jsxs(eo,{children:[/*#__PURE__*/e.jsxs(Xa,{children:[/*#__PURE__*/e.jsx(je.default,{}),"Passkey"]}),p.passkey?/*#__PURE__*/e.jsx(ax,{color:"green",children:"Enabled"}):/*#__PURE__*/e.jsx(Ja,{$isAccent:!0,children:/*#__PURE__*/e.jsx(pt.default,{})})]})}),p.passkey&&/*#__PURE__*/e.jsx(Qa,{style:{position:"absolute",right:0},onClick:()=>u("passkey"),children:/*#__PURE__*/e.jsx(ht.default,{})})]},"passkey"),(h.totp||p.totp)&&/*#__PURE__*/e.jsxs(Za,{children:[/*#__PURE__*/e.jsx(xa,{style:{justifyContent:"center"},disabled:p.totp||a,onClick:()=>d("totp"),children:a?/*#__PURE__*/e.jsx(co,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):/*#__PURE__*/e.jsxs(eo,{children:[/*#__PURE__*/e.jsxs(Xa,{children:[/*#__PURE__*/e.jsx(Te.default,{}),"Authenticator app"]}),p.totp&&/*#__PURE__*/e.jsx(ax,{color:"green",children:"Enabled"})]})}),p.totp&&/*#__PURE__*/e.jsx(Qa,{style:{position:"absolute",right:0},onClick:()=>u("totp"),children:/*#__PURE__*/e.jsx(ht.default,{})})]},"totp"),(h.sms||p.sms)&&/*#__PURE__*/e.jsxs(Za,{children:[/*#__PURE__*/e.jsx(xa,{disabled:p.sms||i,onClick:()=>d("sms"),children:/*#__PURE__*/e.jsxs(eo,{children:[/*#__PURE__*/e.jsxs(Xa,{children:[/*#__PURE__*/e.jsx(Ie.default,{}),"SMS"]}),p.sms&&/*#__PURE__*/e.jsx(ax,{color:"green",children:"Enabled"}),i&&/*#__PURE__*/e.jsx(Ja,{children:"Disabled"})]})}),p.sms&&/*#__PURE__*/e.jsx(Qa,{style:{position:"absolute",right:0},onClick:()=>u("sms"),children:/*#__PURE__*/e.jsx(ht.default,{})})]},"sms")]}),/*#__PURE__*/e.jsx(ox,{children:"You can always change your selection later"}),/*#__PURE__*/e.jsx(Pa,{})]})};let ax=/*#__PURE__*/g.styled(wh).withConfig({displayName:"StyledChip",componentId:"sc-24f8b314-0"})(["margin-right:1.5rem;"]),ox=/*#__PURE__*/g.styled(to).withConfig({displayName:"StyledTerms",componentId:"sc-24f8b314-1"})(["&&{margin-top:1rem;}text-align:center;"]);const sx=({style:t,...r})=>/*#__PURE__*/e.jsxs("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...t},xmlns:"http://www.w3.org/2000/svg",...r,children:[/*#__PURE__*/e.jsxs("g",{clipPath:"url(#clip0_113_33841)",children:[/*#__PURE__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("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__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_113_33841",children:/*#__PURE__*/e.jsx("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]}),lx=({onClose:t,onReset:n,submitEnrollmentWithPasskey:i})=>{let{user:a}=u.usePrivyContext(),{initLinkWithPasskey:o,linkWithPasskey:l}=s.usePrivyInternal(),{app:c}=Ui(),[d,p]=r.useState(!1),[h,y]=r.useState(!1),[m,g]=r.useState(null),f=r.useMemo((()=>a?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[a]),w=async e=>{p(!0);try{await i(e)}catch(e){g(e)}finally{p(!1)}},v=async()=>{y(!0),g(null);try{await o();let e=await l(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await w(t)}catch(e){g(e)}finally{y(!1)}};return 0===f.length||h?/*#__PURE__*/e.jsx(cx,{onReset:n,onClose:t,onClick:v,isCreating:h}):m?/*#__PURE__*/e.jsx(_u,{allowlistConfig:c.allowlistConfig,error:m,onBack:()=>g(null),onRetry:()=>g(null)}):/*#__PURE__*/e.jsx(dx,{passkeys:f,isSubmitting:d,isCreating:h,onReset:n,onClose:t,onSubmitEnrollment:()=>w(f.map((e=>e.credentialId))),onAddPasskey:v})};let cx=({onReset:t,onClose:r,onClick:n,isCreating:i})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:t,onClose:r},"header"),/*#__PURE__*/e.jsx(Ba,{children:/*#__PURE__*/e.jsxs(Rg,{children:[/*#__PURE__*/e.jsx(el,{}),/*#__PURE__*/e.jsx(sx,{})]})}),/*#__PURE__*/e.jsx(za,{children:"Set up passkey verification"}),/*#__PURE__*/e.jsxs(qa,{children:[/*#__PURE__*/e.jsxs(Ka,{children:[/*#__PURE__*/e.jsx(Va,{children:/*#__PURE__*/e.jsx(Se.default,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),/*#__PURE__*/e.jsxs(Ka,{children:[/*#__PURE__*/e.jsx(Va,{children:/*#__PURE__*/e.jsx(mt.default,{})}),"Takes seconds to set up and use"]}),/*#__PURE__*/e.jsxs(Ka,{children:[/*#__PURE__*/e.jsx(Va,{children:/*#__PURE__*/e.jsx(yt.default,{})}),"Use your passkey to verify transactions and login to your account"]})]}),/*#__PURE__*/e.jsx(go,{style:{marginTop:"2.25rem"},onClick:n,loading:i,children:"Add a new passkey"}),/*#__PURE__*/e.jsx(Pa,{})]}),dx=({onReset:t,onClose:n,onAddPasskey:i,onSubmitEnrollment:a,passkeys:o,isSubmitting:s,isCreating:l})=>{let[c,d]=r.useState(!1),u=c?o.length:o.length>3?2:3;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:c?()=>d(!1):t,onClose:n},"header"),!c&&/*#__PURE__*/e.jsx(Ba,{children:/*#__PURE__*/e.jsxs(Rg,{children:[/*#__PURE__*/e.jsx(el,{}),/*#__PURE__*/e.jsx(sx,{})]})}),/*#__PURE__*/e.jsx(za,{children:"Enable your passkeys for verification"}),/*#__PURE__*/e.jsxs(qa,{children:[o.slice(0,u).map((t=>/*#__PURE__*/e.jsxs(ux,{children:[/*#__PURE__*/e.jsx(px,{children:yx(t)}),/*#__PURE__*/e.jsxs(hx,{children:["Last used: ",t.latestVerifiedAt?.toLocaleString()]})]},t.credentialId))),!c&&o.length>3&&/*#__PURE__*/e.jsx(mx,{onClick:()=>d(!0),children:"View All"})]}),/*#__PURE__*/e.jsx(go,{style:{marginTop:"1.5rem"},onClick:a,loading:s,children:"Enable passkeys"}),o.length<5&&/*#__PURE__*/e.jsx(mx,{style:{marginTop:"0.5rem"},onClick:i,disabled:l,children:l?/*#__PURE__*/e.jsx(co,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),/*#__PURE__*/e.jsx(Pa,{})]})},ux=/*#__PURE__*/g.styled.div.withConfig({displayName:"PasskeyItem",componentId:"sc-9b5fbdd5-0"})(["&&{padding:0.75rem 1rem;text-align:left;border-radius:0.5rem;border:1px solid var(--privy-color-foreground-4);width:100%;}"]),px=/*#__PURE__*/g.styled.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-9b5fbdd5-1"})(["font-size:0.875rem;line-height:1.375rem;font-weight:500;color:var(--privy-color-foreground-1);"]),hx=/*#__PURE__*/g.styled.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-9b5fbdd5-2"})(["font-size:0.75rem;font-weight:400;line-height:1.125rem;color:var(--privy-color-foreground-2);"]),yx=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 mx=/*#__PURE__*/g.styled.button.withConfig({displayName:"StyledLink",componentId:"sc-9b5fbdd5-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;}}"]),gx=({appName:t,onComplete:n,onReset:i,onClose:o})=>{let[s,l]=r.useState(""),[c,d]=r.useState(!1),[u,p]=r.useState(null),[h,y]=r.useState("enroll"),{initEnrollmentWithSms:m,submitEnrollmentWithSms:g}=tx(),{app:f,data:w}=Ui();function v(){w?.mfaEnrollmentFlow?.onSuccess(),n()}return u?/*#__PURE__*/e.jsx(_u,{allowlistConfig:f.allowlistConfig,error:u,onBack:()=>p(null),onRetry:()=>p(null)}):"enroll"===h?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:i,onClose:o},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(Ie.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Set up SMS verification"}),/*#__PURE__*/e.jsxs(Ha,{children:["We'll text a verification code to this mobile device whenever you use your ",t," ","wallet."]}),/*#__PURE__*/e.jsxs($a,{children:[/*#__PURE__*/e.jsx(Yh,{onSubmit:async function({qualifiedPhoneNumber:e}){try{await m({phoneNumber:e}),l(e),y("verify")}catch(e){p(e)}},hideRecent:!0}),/*#__PURE__*/e.jsxs(to,{children:["By providing your mobile number, you agree to receive text messages from ",f?.name,". Some carrier charges may apply"]})]}),/*#__PURE__*/e.jsx(Pa,{})]}):c?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:v},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(nt.default,{})}),/*#__PURE__*/e.jsx(za,{children:"SMS verification added"}),/*#__PURE__*/e.jsxs(Ha,{children:["From now on, you'll enter the verification code sent to your mobile device whenever you use your ",t," wallet."]}),/*#__PURE__*/e.jsx(Ga,{children:/*#__PURE__*/e.jsx(go,{onClick:v,children:"Done"})}),/*#__PURE__*/e.jsx(Pa,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:function(){"verify"===h?y("enroll"):i()},onClose:o},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(Ie.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Enter enrollment code"}),/*#__PURE__*/e.jsxs($a,{children:[/*#__PURE__*/e.jsx(sl,{onChange:async function(e){try{if(!e)return;await g({phoneNumber:s,mfaCode:e}),d(!0)}catch(e){if(wl(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(gl(e))throw Error("The code you entered is not valid");if(ml(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw vl(e)?Error("Verification canceled"):Error("Unknown error")}}}),/*#__PURE__*/e.jsxs(Ha,{children:["To continue, enter the 6-digit code sent to ",/*#__PURE__*/e.jsx("strong",{children:a.lastFourDigits(s)})]})]}),/*#__PURE__*/e.jsx(Pa,{})]})},fx=/*#__PURE__*/g.styled.div.withConfig({displayName:"Column",componentId:"sc-cfc52180-0"})(["display:flex;flex-direction:column;"]),wx=({size:t,authUrl:r})=>/*#__PURE__*/e.jsx(hp,{url:r,squareLogoElement:gt.default,size:t,fgColor:"#1F1F1F"}),vx=({onClose:t,onReset:n,totpInfo:i,submitEnrollmentWithTotp:a,error:o})=>{let[s,l]=r.useState("enroll");return"enroll"===s?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:n,onClose:t},"header"),/*#__PURE__*/e.jsx(fm,{children:"Scan QR code"}),/*#__PURE__*/e.jsx(gm,{children:"Open your authenticator app and scan this code to continue"}),/*#__PURE__*/e.jsx(hs,{children:/*#__PURE__*/e.jsx(wx,{authUrl:i.authUrl,size:240})}),/*#__PURE__*/e.jsx(kh,{style:{textAlign:"left"},children:"Setup key"}),/*#__PURE__*/e.jsxs(Tm,{style:{marginTop:"0.25rem"},children:[/*#__PURE__*/e.jsx(fx,{children:"•".repeat(16)}),/*#__PURE__*/e.jsx(Fw,{itemName:" ",text:i.secret})]}),/*#__PURE__*/e.jsx(go,{style:{marginTop:"1rem"},onClick:function(){l("verify")},children:"Continue"}),/*#__PURE__*/e.jsx(Pa,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:function(){"verify"===s?l("enroll"):n()},onClose:t},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(Te.default,{})}),/*#__PURE__*/e.jsx(fm,{children:"Enter enrollment code"}),/*#__PURE__*/e.jsx(gm,{children:"To continue, enter the 6-digit code generated from your authenticator app"}),/*#__PURE__*/e.jsx($a,{children:/*#__PURE__*/e.jsx(sl,{onChange:async function(e){try{if(!e)return;await a({mfaCode:e})}catch(e){if(wl(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(gl(e))throw Error("The code you entered is not valid");if(ml(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw vl(e)?Error("Verification canceled"):Error("Unknown error")}},errorReasonOverride:o?.message})}),/*#__PURE__*/e.jsx(Pa,{})]})},xx={component:()=>{let{user:t,enrollInMfa:n,ready:i}=u.usePrivyContext(),[a,o]=r.useState(null),{unenrollWithSms:l,unenrollWithTotp:c,unenrollWithPasskey:d,submitEnrollmentWithTotp:p,initEnrollmentWithPasskey:h,submitEnrollmentWithPasskey:y,initEnrollmentWithTotp:m}=tx(),{app:g,data:f,onUserCloseViaDialogOrKeybindRef:w}=Ui(),{closePrivyModal:v}=s.usePrivyInternal(),{promptMfa:x}=bl(),[C,b]=r.useState(!1),[k,E]=r.useState(null),[A,T]=r.useState(null),j=()=>{v({shouldCallAuthOnSuccess:!0}),n(!1),setTimeout((()=>{o(null),E(null)}),500)},[I,S]=r.useState(!1),[P,_]=r.useState();w.current=j;let N=t?.mfaMethods.includes("sms"),M=!!t?.phone,W=t?.mfaMethods.includes("totp"),F=t?.mfaMethods.includes("passkey"),U=N||W||F,R=t?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function O(){o(null),E(null)}async function L(e=R){S(!0);try{return await h(),await y({credentialIds:e},{removeForLogin:f?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa}),f?.mfaEnrollmentFlow?.onSuccess(),j()}catch(e){_(e)}finally{S(!1)}}if(r.useEffect((()=>{U&&b(!0)}),[U]),!i||!t||!g/*#__PURE__*/)return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:j},"header"),/*#__PURE__*/e.jsx(Ba,{children:/*#__PURE__*/e.jsx(rx,{})}),/*#__PURE__*/e.jsx($a,{children:/*#__PURE__*/e.jsx(co,{})}),/*#__PURE__*/e.jsx(Pa,{})]});if("sms"===a)/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:O,onClose:j},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(_e.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Remove SMS verification?"}),/*#__PURE__*/e.jsxs(Ha,{children:["MFA adds an extra layer of security to your ",g?.name," account. Make sure you have other methods to secure your account."]}),/*#__PURE__*/e.jsx(Ga,{children:/*#__PURE__*/e.jsx(go,{$warn:!0,onClick:async function(){o(null);try{await l()}catch(e){o(null)}},children:"Remove"})}),/*#__PURE__*/e.jsx(Pa,{})]});if("totp"===a)/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:O,onClose:j},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(_e.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Remove authenticator app verification?"}),/*#__PURE__*/e.jsxs(Ha,{children:["MFA adds an extra layer of security to your ",g?.name," account. Make sure you have other methods to secure your account."]}),/*#__PURE__*/e.jsx(Ga,{children:/*#__PURE__*/e.jsx(go,{$warn:!0,onClick:async function(){o(null);try{await c()}catch(e){o(null)}},children:"Remove"})}),/*#__PURE__*/e.jsx(Pa,{})]});if("passkey"===a){let t=f?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa??!0;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{backFn:O,onClose:j},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(_e.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Are you sure you want to remove this passkey?"}),/*#__PURE__*/e.jsx(Ha,{children:t?"Removing your passkey will remove as both a verification method and a login method.":"Removing your passkey will remove as a verification method."}),/*#__PURE__*/e.jsx(Ga,{children:/*#__PURE__*/e.jsx(go,{$warn:!0,onClick:async function(){o(null);try{await d({removeForLogin:f?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa})}catch(e){o(null)}},children:"Remove"})}),/*#__PURE__*/e.jsx(Pa,{})]})}if(0===f.mfaEnrollmentFlow.mfaMethods.length&&!U)/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:j},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(Se.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Add more security"}),/*#__PURE__*/e.jsxs(Ha,{children:[g?.name," does not have any verification methods enabled."]}),/*#__PURE__*/e.jsx(Ga,{children:/*#__PURE__*/e.jsx(go,{onClick:j,children:"Close"})}),/*#__PURE__*/e.jsx(Pa,{})]});let D=!U&&!C;return D?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Wa,{onClose:j},"header"),/*#__PURE__*/e.jsx(no,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/e.jsx(Se.default,{})}),/*#__PURE__*/e.jsx(za,{children:"Transaction Protection"}),/*#__PURE__*/e.jsx(Ha,{children:"Set up transaction protection to add an extra layer of security to your account"}),/*#__PURE__*/e.jsxs(qa,{children:[/*#__PURE__*/e.jsxs(Ka,{children:[/*#__PURE__*/e.jsx(Va,{children:/*#__PURE__*/e.jsx(dt.default,{})}),"Enable 2-Step verification for your ",g?.name," wallet."]}),/*#__PURE__*/e.jsxs(Ka,{children:[/*#__PURE__*/e.jsx(Va,{children:/*#__PURE__*/e.jsx(ut.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),/*#__PURE__*/e.jsxs(Ga,{children:[/*#__PURE__*/e.jsx(go,{onClick:()=>b(!0),children:"Continue"}),/*#__PURE__*/e.jsx(xo,{onClick:j,children:"Not now"})]}),/*#__PURE__*/e.jsx(Pa,{})]}):"sms"===k?/*#__PURE__*/e.jsx(gx,{appName:g?.name||"Privy",onComplete:j,onReset:O,onClose:j}):"totp"===k&&A?/*#__PURE__*/e.jsx(vx,{onClose:j,onReset:O,submitEnrollmentWithTotp:({mfaCode:e})=>async function(e){try{return _(void 0),await p({mfaCode:e}),f?.mfaEnrollmentFlow?.onSuccess(),j()}catch(e){_(e)}finally{o(null)}}(e),totpInfo:{...A,appName:g?.name||"Privy"}}):"passkey"===k?/*#__PURE__*/e.jsx(lx,{onReset:O,onClose:j,submitEnrollmentWithPasskey:L}):/*#__PURE__*/e.jsx(ix,{showIntro:D,userMfaMethods:t.mfaMethods,appMfaMethods:g.mfa.methods,userHasAuthSms:M,onBackToIntro:function(){b(!1)},handleSelectMethod:async function(e){try{await x()}catch(e){return void _(e)}return"totp"===e?(E(e),T(null),void m().then((e=>{T(e)})).catch((()=>{T(null),O()}))):"passkey"===e&&1===R.length?await L():void E(e)},isTotpLoading:"totp"===k&&!A,isPasskeyLoading:I,error:P,onClose:j,setRemovingMfaMethod:async e=>{try{await x()}catch(e){return void _(e)}o(e)}})}},Cx=({providerName:t,ProviderLogo:r,success:n,errorMessage:i,onRetry:a})=>{let o=n?`Successfully connected with ${t}`:i?i.message:`Verifying connection to ${t}`;/*#__PURE__*/return e.jsx(Xc,{title:o,subtitle:n?"You're good to go!":i?i.detail:"Just a few moments more",icon:r,iconVariant:"loading",iconLoadingStatus:{success:n,fail:!!i},secondaryCta:i?.retryable&&a?{label:"Retry",onClick:a}:void 0,watermark:!0})},bx={component:()=>{let{authenticated:t,logout:n,ready:i,user:a}=u.usePrivyContext(),{app:l,setModalData:c,navigate:d,resetNavigation:p}=Ui(),{getAuthMeta:h,initLoginWithOAuth:y,loginWithOAuth:m,updateWallets:g,setReadyToTrue:f,closePrivyModal:w,createAnalyticsEvent:v}=s.usePrivyInternal(),[x,C]=r.useState(!1),[b,k]=r.useState(void 0),E=h()?.provider||"google",{name:A,component:T}=Sr(E);return r.useEffect((()=>{m(E).then((()=>{C(!0),f(!0)})).catch((e=>{if(f(!1),e?.privyErrorCode===o.PrivyErrorCode.ALLOWLIST_REJECTED)return k(void 0),p(),void d(Xp);if(e?.privyErrorCode===o.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new o.PrivyUserLimitReachedError(e).toString()),k(void 0),p(),void d(lh);if(e?.privyErrorCode===o.PrivyErrorCode.USER_DOES_NOT_EXIST)return k(void 0),p(),void d(xu);if(e?.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return k(void 0),p(),c({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:h()?.provider,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void d(qu);let{retryable:t,detail:r}=function(e,t){let r={detail:"",retryable:!1},n=gr(t);if(e?.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode===o.PrivyErrorCode.INVALID_CREDENTIALS&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode===o.PrivyErrorCode.OAUTH_USER_DENIED&&(r.detail=`Retry and check ${n} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===o.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let e=Sr(t).name;r.detail=`Request limit reached for ${e}. Please wait a moment and try again.`}if(e?.privyErrorCode===o.PrivyErrorCode.OAUTH_ACCOUNT_SUSPENDED){let e=Sr(t).name;r.detail=`Your ${e} account is suspended. Please try another login method.`}return e?.privyErrorCode===o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode===o.PrivyErrorCode.OAUTH_UNEXPECTED&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}(e,E);k({retryable:t,detail:r,message:"Authentication failed"})})).finally((()=>{_r()}))}),[A,E]),r.useEffect((()=>{if(i&&t&&x&&a){if(l?.legal.requireUsersAcceptTerms&&!a.hasAcceptedTerms){let e=setTimeout((()=>{d(Zu)}),Wt);return()=>clearTimeout(e)}if(wu(a,l.embeddedWallets)){let e=setTimeout((()=>{c({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:E,screen:"OAuthStatusScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),d(Yu)}),Wt);return()=>clearTimeout(e)}{let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Wt);return g(),()=>clearTimeout(e)}}}),[i,t,x,a]),/*#__PURE__*/e.jsx(Cx,{providerName:A,ProviderLogo:T,success:x,errorMessage:b,onRetry:b?.retryable?()=>{_r(),y(E),k(void 0)}:void 0})}},kx=/*#__PURE__*/r.forwardRef(((t,n)=>{let[i,a]=r.useState(""),[o,l]=r.useState(""),[c,d]=r.useState(!1),{authenticated:p,user:h}=u.usePrivyContext(),{initUpdateEmail:y}=s.usePrivyInternal(),{navigate:m,setModalData:g,currentScreen:f}=Ui(),{enabled:w,token:v}=sn(),x=Ni(),C=qr(i)&&(x.disablePlusEmails&&i.includes("+")?(o||l("Please enter a valid email address without a '+'."),!1):(o&&l(""),!0)),b=c||!C,k=()=>{!w||v||p?(async e=>{if(!h?.email)throw Error("User is required to have an email address to update it.");d(!0);try{await y({oldAddress:h.email.address,newAddress:i,captchaToken:e}),m(Ey)}catch(e){g({errorModalData:{error:e,previousScreen:f||om}})}d(!1)})(v):(g({captchaModalData:{callback:e=>{if(!h?.email)throw Error("User is required to have an email address to update it.");return y({oldAddress:h.email.address,newAddress:i,captchaToken:e})},userIntentRequired:!1,onSuccessNavigateTo:Ey,onErrorNavigateTo:Nu}}),m(eh))};/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Ex,{children:[o&&/*#__PURE__*/e.jsx(yp,{style:{marginTop:"0.25rem",textAlign:"left"},children:o}),/*#__PURE__*/e.jsxs(Ax,{$error:!!o,children:[/*#__PURE__*/e.jsx(De.default,{}),/*#__PURE__*/e.jsx("input",{ref:n,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>a(e.target.value),onKeyUp:e=>{"Enter"===e.key&&k()},value:i,autoComplete:"email"}),t.stacked?null:/*#__PURE__*/e.jsx(Eo,{isSubmitting:c,onClick:k,disabled:b,children:"Submit"})]})]}),t.stacked?/*#__PURE__*/e.jsx(go,{loadingText:null,loading:c,disabled:b,onClick:k,style:{width:"100%"},children:"Submit"}):null]})}));let Ex=wp,Ax=gp;const Tx=({title:t="Update your email",subtitle:r="Add the email address you'd like to use going forward. We'll send you a confirmation code"})=>/*#__PURE__*/e.jsx(Xc,{title:t,subtitle:r,icon:De.default,watermark:!0,children:/*#__PURE__*/e.jsx(ds,{children:/*#__PURE__*/e.jsx(kx,{stacked:!0})})}),jx={component:()=>/*#__PURE__*/e.jsx(Tx,{})},Ix=({title:t="Update your phone number",subtitle:n="Add the phone number you'd like to use going forward. We'll send you a confirmation code",onSubmit:i,isSubmitting:a=!1})=>{let[o,s]=r.useState(null);/*#__PURE__*/return e.jsx(Xc,{title:t,subtitle:n,icon:Ie.default,primaryCta:{label:a?"Submitting":"Update",onClick:async()=>{o?.qualifiedPhoneNumber&&await i(o)},disabled:!o?.isValid||a},watermark:!0,children:/*#__PURE__*/e.jsx(Yh,{onChange:e=>{s(e)},onSubmit:async()=>{},noIncludeSubmitButton:!0,hideRecent:!0})})},Sx={component:()=>{let{currentScreen:t,data:n,navigate:i,setModalData:a}=Ui(),{user:o}=u.usePrivyContext(),{initUpdatePhone:l}=s.usePrivyInternal(),[c,d]=r.useState(!1);/*#__PURE__*/return e.jsx(Ix,{onSubmit:async e=>{d(!0);try{if(!o?.phone?.number)throw Error("User is required to have an phone number to update it.");await l(o?.phone?.number,e.qualifiedPhoneNumber),i(Ey)}catch(e){a({errorModalData:{error:e,previousScreen:n?.errorModalData?.previousScreen||t||Xv}}),i(Nu)}finally{d(!1)}},isSubmitting:c})}};function Px({subscribe:e,getExternalJwt:t,enabled:n=!0,onAuthenticated:i,onUnauthenticated:a,onError:l}){let{client:c,onCustomAuthAuthenticated:d}=s.usePrivyInternal(),{logout:u,authenticated:p,ready:h}=Ym();if(!c)throw new o.PrivyClientError("`useSyncJwtBasedAuthState` must be used within a `PrivyProvider`");let[y,m]=r.useState({status:"initial"}),g=r.useRef(),f=r.useRef(!1),w=r.useRef(t);r.useEffect((()=>{w.current=t}),[t]);let v=r.useRef(i);r.useEffect((()=>{v.current=i}),[i]);let x=r.useRef(a);r.useEffect((()=>{x.current=a}),[a]);let C=r.useRef(l);return r.useEffect((()=>{C.current=l}),[l]),r.useEffect((()=>{if(!n||!h)return;let t=async()=>{if(!f.current){f.current=!0;try{m({status:"loading"});let e=await w.current();if(void 0!==g.current&&g.current===e)return void m({status:"done"});if(!e)return p&&(await u(),x.current?.()),g.current=e,void m({status:"done"});c.startAuthFlow(new Ki(e));let{user:t,isNewUser:r=!1}=await c.authenticate();if(!t)throw new o.PrivyClientError("Failed to sync with custom auth provider");v.current?.({user:t,isNewUser:r}),d(t,r),g.current=e,m({status:"done"})}catch(e){if(console.warn(e),await u().catch((()=>{})),x.current?.(),e instanceof o.PrivyApiError&&e.privyErrorCode===o.PrivyErrorCode.LINKED_TO_ANOTHER_USER)return m({status:"initial"}),void setTimeout((()=>{t()}),0);C.current?.(e),m({status:"error",error:e})}finally{f.current=!1}}};return t(),e(t)}),[e,c,d,p,u,n,h]),n?{state:y}:{state:{status:"not-enabled"}}}let _x=I.create((()=>({jwtAuthFlowState:{status:"not-enabled"}})));function Nx({customAuth:e}){let{jwtAuthFlowState:t}=function({customAuth:e}){let t=pa(),n=r.useRef(),i=r.useCallback((e=>(n.current=e,()=>{n.current=void 0})),[]),a=e?.getCustomAccessToken??(()=>Promise.resolve(void 0)),{state:s}=Px({enabled:!0===e?.enabled,subscribe:i,getExternalJwt:a,onAuthenticated:({user:e,isNewUser:r})=>{t("login","onComplete",{user:e,isNewUser:r,wasAlreadyAuthenticated:!1,loginMethod:"custom",loginAccount:null}),t("customAuth","onAuthenticated",{user:e})},onUnauthenticated:()=>{t("customAuth","onUnauthenticated")},onError:e=>{t("login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}});return r.useEffect((()=>{(async()=>{e&&!e.isLoading&&n.current?.()})()}),[e?.enabled,e?.getCustomAccessToken,e?.isLoading]),{jwtAuthFlowState:s}}({customAuth:e});return r.useEffect((()=>{_x.setState({jwtAuthFlowState:t})}),[t]),null}const Mx=/*#__PURE__*/r.createContext(!1);let Wx,Fx,Ux,Rx,Ox,Lx,Dx;async function Bx(){return Wx?Wx.getAccessToken():Promise.resolve(kt.get(Bt)||kt.get(Ot)||null)}const zx=(e,t)=>Fx(e,t),Hx=(e,t)=>Ux(e,t),$x=(e,t)=>Rx(e,t),qx=(e,t)=>Ox(e,t),Vx=e=>Lx(e),Kx=e=>Dx(e);let Gx=l=>{let c=l.client,d=l.privy,p=Yp();ic();let[h,y]=r.useState(!1),[m,g]=r.useState(!1),[f,w]=r.useState(!1),[v,x]=r.useState(null),[C,b]=r.useState([]),[k,E]=r.useState([]),[A,T]=r.useState(void 0),[j,I]=r.useState(!1),[S,P]=r.useState(null),[_,N]=r.useState(!1),[M,W]=r.useState({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:s.notImplemented}),[F,U]=r.useState({status:"initial"}),[R,O]=r.useState({status:"initial"}),[L,D]=r.useState({status:"initial"}),[B,z]=r.useState({status:"initial"}),[H,$]=r.useState({status:"initial"}),[q,V]=r.useState({status:"initial"}),[K,G]=r.useState(null),Y=Ni(),Z=Mi(),[Q,X]=r.useState({}),[J,ee]=r.useState(null),te=r.useRef(null),[re,ne]=r.useState(!1),[ie,ae]=r.useState(!1),oe=r.useRef(null),se=r.useRef(null),le=r.useRef(sa),[ce,de]=r.useState(!1);c.onStoreCustomerAccessToken=e=>{e&&ua(le,"accessToken","onAccessTokenGranted",{accessToken:e})},c.onDeleteCustomerAccessToken=()=>{x(null),w(!1),ua(le,"accessToken","onAccessTokenRemoved")};let ue=r.useRef(null),pe=r.useRef(null),he=r.useRef(!1),ye=({showWalletUIs:e})=>he.current?he.current:void 0!==e?!e:!Y.embeddedWallets.showWalletUIs,me=e=>{P(e),setTimeout((()=>{y(!0)}),15)};r.useEffect((()=>{if(!v)return void c.connectors?.removeEmbeddedWalletConnectors();let e=u.getPrivyEthereumWallet(v),t=u.getPrivyEthereumHDWallets(v),r=u.getImportedPrivyEthereumWallet(v);e&&t.length||c.connectors?.removeEmbeddedWalletConnectors(),r||c.connectors?.removeImportedWalletConnector(),c.connectors?K?(e&&c.connectors.addEmbeddedWalletConnectors({walletProxy:K,user:v,embeddedWallets:t,defaultChain:Y.defaultChain,appId:l.appId,privyClient:d}),r&&c.connectors.addImportedWalletConnector(K,r.address,Y.defaultChain,l.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")}),[K,v]),r.useEffect((()=>{K&&te.current?.(K)}),[K]);let ge=r.useCallback(((e,t)=>{x(e),I(t),w(!0),ae(!0)}),[]);r.useEffect((()=>{ie&&K&&v&&(async()=>{let e=yu(v,Y.embeddedWallets.ethereum.createOnLogin),t=gu(v,Y.embeddedWallets.solana.createOnLogin),r=await Bx();if(r){if(e&&t){let e=await K.create({accessToken:r});return await K.createSolana({accessToken:r,ethereumAddress:e?.address}),void ae(!1)}if(t)return await K.createSolana({accessToken:r,ethereumAddress:u.getPrivyEthereumWallet(v)?.address}),await Fe.refreshSessionAndUser(),void ae(!1);if(e)return await K.create({accessToken:r}),void ae(!1)}})().catch(console.error)}),[ie&&K&&v]),r.useEffect((()=>{if(Y.externalWallets.solana.connectors)return Y.externalWallets.solana.connectors.onMount(),()=>Y.externalWallets.solana.connectors?.onUnmount()}),[Y.externalWallets.solana.connectors]),r.useEffect((()=>{!m&&Z&&async function(){let e,r=fe(),n=we(),i=t.createStore();c.initializeConnectorManager({walletConnectCloudProjectId:Y.walletConnectCloudProjectId,rpcConfig:Y.rpcConfig,chains:Y.chains,defaultChain:Y.defaultChain,store:i,walletList:Y.appearance.walletList,shouldEnforceDefaultChainOnConnect:Y.shouldEnforceDefaultChainOnConnect,externalWalletConfig:Y.externalWallets,appName:Y.name??"Privy",walletChainType:Y.appearance.walletChainType,appKit:Y.externalWallets.walletConnect.appKit,setBaseAccountSdk:T}),c.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=c.connectors.walletConnectors.length,r=c.connectors.walletConnectors.reduce(((e,t)=>e+(t.initialized?1:0)),0);r===t?de(!0):e=setTimeout((()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:r,expected:t}),de(!0)}),1500)})),c.connectors?.initialize().then((()=>{ke()}));let a=await c.getAuthenticatedUser(),o=!!a;Y.legal.requireUsersAcceptTerms&&a&&!a.hasAcceptedTerms?(await c.logout(),Fe.setReadyToTrue(!0),ua(le,"logout","onSuccess")):(Y.customAuth?.enabled||(w(!!a),a&&ua(le,"login","onComplete",{user:a,isNewUser:!1,wasAlreadyAuthenticated:!0,loginMethod:null,loginAccount:null}),x(a)),r?pe.current=o?"link":"login":n&&!o?(pe.current="login",X({telegramAuthModalData:{seamlessAuth:!0}}),me(iy)):Fe.setReadyToTrue(!!a))}()}),[c,J,m,Z]),r.useEffect((()=>{if(m){if(!v||!v.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void ne(!!K);if([...C].some((e=>"privy"===e.walletClientType)))return void ne(!0);ne(!!K)}}),[m,v,C,K]),r.useEffect((()=>{c.connectors?.setWalletList(Y.appearance.walletList)}),[Y.appearance.walletList.join()]);let fe=()=>{let e=Pr();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(oc).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!!e.withPrivyUi&&(c.startAuthFlow(new mr(e)),me(bx),!0))},we=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),n=Number(e.get("auth_date")||""),i=e.get("first_name");if(t&&i&&n&&r)return Object.fromEntries(e.entries())}())?(un(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=dn(e.replace("#tgWebAppData=","")),{user:r,auth_date:n,hash:i}=t;return r&&n&&i?t:void 0}())?(un(),{flowType:"web-app",authData:e}):void 0}();if(!e||!Y.loginMethods.telegram||!Y.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new ln;return c.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},ve=async(e,t,r,n)=>{if("solana_adapter"!==e)xe(await(c.connectors?.createEthereumWalletConnector({connectorType:e,walletClientType:t}))||null,t,r,n);else{let e=c.connectors?.findSolanaWalletConnector(t);if(!e)return;xe(e,t,r,n)}};async function xe(e,t,r,n){if(!e)return W({status:"disconnected",connectedWallet:null,connectError:new o.PrivyConnectorError("Unable to connect to wallet."),connector:null,connectRetry:s.notImplemented}),n?.(null,r);W({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:s.notImplemented}),e instanceof Li&&t&&await e.resetConnection(t),W({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>xe(e,t,r,n)});try{let t=await e.connect({showPrompt:!0});if((!t||An(t))&&Y.shouldEnforceDefaultChainOnConnect&&!Y.chains.find((e=>e.id===Number(t?.chainId.replace("eip155:",""))))&&("wallet_connect_v2"!==t?.connectorType||"metamask"!==t?.walletClientType)){W((t=>({...t,connector:e,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:s.notImplemented})));try{await(t?.switchChain(Y.defaultChain.id)),t&&(t.chainId=en(i.toHex(Y.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${Y.defaultChain.id}`)}}return W((e=>({...e,status:"connected",connectedWallet:t,connectError:null,connectRetry:s.notImplemented}))),t&&ua(le,"connectWallet","onSuccess",{wallet:t}),n?.(t,r)}catch(e){return e instanceof o.PrivyError?(console.warn(e.cause?e.cause:e.message),ua(le,"connectWallet","onError",e.privyErrorCode||o.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),ua(le,"connectWallet","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR)),W((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),n?.(null,r)}}let Ce=async(e,t,r)=>{if(null===e||!An(e))return;let n=new Wr(c,e,t,r);c.startAuthFlow(n)},be=async(e,t,r,n="plain")=>{let i=p(Zp);if("transaction"===n&&!i)throw new o.PrivyClientError("useSolanaLedger plugin hook must be mounted");if(null===e||!ai(e))return;let a=new Rr(e,c,t,r,n,i?{deserializeTransactionFromB64String:i.deserializeTransactionFromB64String,prepareSiwsTransactionWithMemo:i.prepareSiwsTransactionWithMemo}:void 0);c.startAuthFlow(a)},ke=()=>{let e=new URLSearchParams(window.location.search),t=e.get("privy_connector"),r=e.get("privy_wallet_client"),n="true"===e.get("privy_connect_only");if(!t||!r)return;let i=ei({connectorType:t,walletClientType:r});if(!i||!i.isInstalled)return me(ex);if(!c.connectors)throw new o.PrivyClientError("Connector not initialized");me(n?Ly:uh);let a=new URL(window.location.href);a.searchParams.delete("privy_connector"),a.searchParams.delete("privy_wallet_client"),a.searchParams.delete("privy_connect_only"),window.history.pushState({},"",a),ve(t,r,void 0,n?void 0:"solana_adapter"===t?be:Ce)};r.useEffect((()=>{m&&f&&null===v&&c.getAuthenticatedUser().then(x)}),[m,f,v,c]);let Ee=e=>{if(!f)throw ua(le,"linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:e}),new o.PrivyClientError("User must be authenticated before linking an account.")},Ae=e=>{if(!f||!v)return!1;if("privy"===e.walletClientType)return!0;for(let t of v.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},Te=async e=>{let t;if(!c.connectors)throw new o.PrivyClientError("Connector not initialized");t="ethereum"===e.type?c.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:c.connectors.findSolanaWalletConnector(e.walletClientType)||null,W((r=>({...r,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:s.notImplemented}))),Y.captchaEnabled&&!f?(X({captchaModalData:{callback:t=>An(e)?Ce(e,t):be(e,t),userIntentRequired:!1,onSuccessNavigateTo:uh,onErrorNavigateTo:Nu}}),me(eh)):(An(e)?await Ce(e):await be(e),me(uh))},je=()=>{b((e=>{let t=c.connectors?.wallets.filter(An).map((e=>({...e,linked:Ae(e),loginOrLink:async()=>{if(!await e.isConnected())throw new o.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot link or login with embedded wallet");Te(e)},fund:async t=>{await Fe.fundWallet(e.address,t)},unlink:async()=>{if(!f)throw new o.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot unlink an embedded wallet");x(await c.unlinkEthereumWallet(e.address))}})))||[];return Tn(e,t)?e:t})),E((e=>{let t=(c.connectors?.wallets??[]).filter(ai).map((e=>({...e,linked:Ae(e),loginOrLink:async()=>{if(!await e.isConnected())throw new o.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot link or login with embedded wallet");Te(e)},fund:async()=>{throw new o.PrivyClientError("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:async()=>{if(!f)throw new o.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new o.PrivyClientError("Cannot unlink an embedded wallet");x(await c.unlinkSolanaWallet(e.address))}})));return Tn(e,t)?e:t}))};r.useEffect((()=>{je()}),[v?.linkedAccounts,f,m]),r.useEffect((()=>{if(m){if(!c.connectors)throw new o.PrivyClientError("Connector not initialized");je(),c.connectors.on("walletsUpdated",je)}}),[m]),r.useEffect((()=>{[...Y.loginMethodsAndOrder?.primary??[],...Y.loginMethodsAndOrder?.overflow??[]].filter((e=>e.startsWith("privy:"))).forEach((e=>c.getCrossAppProviderDetails(e.replace("privy:",""))))}),[!!c]);let Ie=({transaction:e,uiOptions:t,fundWalletConfig:r,address:n,signOnly:s})=>new Promise((async(p,h)=>{let{requesterAppId:y}=t||{},m=s?"signTransaction":"sendTransaction",g=n?u.getPrivyWalletWithAddress(v,n):u.getPrivyEthereumWallet(v);if(!g&&n){let t=u.getConnectedWalletWithAddress(C,n);if(t)try{let r=await t.getEthereumProvider(),a={...e,from:n,chainId:e.chainId||Number(t.chainId.replace("eip155:","")),value:void 0!==e.value?i.toHex(e.value):void 0},o=await r.request({method:"sendTransaction"===m?"eth_sendTransaction":"eth_signTransaction",params:[a]});return ua(le,m,"onSuccess",{hash:o}),void p({hash:o})}catch(e){return ua(le,m,"onError",o.PrivyErrorCode.TRANSACTION_FAILURE),void h(e??new kn("Unable to "+m+e))}}if(!g)return ua(le,m,"onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void h(new o.PrivyClientError("No embedded or connected wallet found for address."));if(!f||!v)return ua(le,m,"onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void h(Error("User must be authenticated before signing with a Privy wallet"));let w=g.address,x=g.walletIndex??0,{entropyId:b,entropyIdVerifier:k}=mn(v,g),E=Ue.wallets.find((e=>"privy"===e.walletClientType&&i.getAddress(e.address)===i.getAddress(w)));if(!E)return ua(le,m,"onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void h(Error("Must have a Privy wallet before signing"));let A=await E.getEthereumProvider(),T=await A.request({method:"eth_chainId"}),j=e.chainId?Number(e.chainId):ac(T);(e=>{if(!Y.chains.map((e=>e.id)).includes(e))throw new o.PrivyConnectorError(`Chain ID ${e} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,o.PrivyErrorCode.UNSUPPORTED_CHAIN_ID)})(j);let I={...e,from:e.from??w,chainId:j},S=await Bx();if(!S||!K)return ua(le,m,"onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void h(Error("Must have valid access token and Privy wallet to send transaction"));let P=Hr(I.chainId,Y.chains,Y.rpcConfig,{appId:l.appId}),_=u.getIsUnifiedWallet(g),N=async({transactionRequest:e})=>{try{let t;if(!await Fe.recoverEmbeddedWallet({address:w}))throw ua(le,m,"onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),h(Error("Unable to connect to wallet")),Error("Unable to connect to wallet");if(_){let r=e=>null==e?void 0:i.toHex(e),n=await a.rpc(d,(async({message:e})=>await K.signWithUserSigner({accessToken:S,requesterAppId:y,message:e})),{chain_type:"ethereum",method:"eth_signTransaction",params:{transaction:{from:e.from,to:e.to,nonce:r(e.nonce),chain_id:r(e.chainId),data:i.isHex(e.data)?e.data?e.data:i.toHex(Uint8Array.from(e.data)):void 0,value:r(e.value),type:e.type,gas_limit:r(e.gasLimit??e.gas),gas_price:r(e.gasPrice??e.gas),max_fee_per_gas:r(e.maxFeePerGas),max_priority_fee_per_gas:r(e.maxPriorityFeePerGas)}},wallet_id:g.id});if(!n.data||!("signed_transaction"in n.data))throw new kn("Unable to sign transaction");t=n.data.signed_transaction}else t=await async function({accessToken:e,entropyId:t,entropyIdVerifier:r,transactingWalletIndex:n,walletProxy:i,transactionRequest:a,requesterAppId:o}){return(await i.rpc({entropyId:t,entropyIdVerifier:r,hdWalletIndex:n??0,chainType:"ethereum",accessToken:e,requesterAppId:o,request:{method:"eth_signTransaction",params:[a]}})).response.data}({accessToken:S,entropyId:b,entropyIdVerifier:k,transactingWalletIndex:x,walletProxy:K,transactionRequest:e,requesterAppId:y});if(s)return ua(le,"signTransaction","onSuccess",{signature:t}),t;{let e=await P.sendRawTransaction({serializedTransaction:t});return ua(le,"sendTransaction","onSuccess",{hash:e}),e}}catch(e){throw ua(le,m,"onError",o.PrivyErrorCode.TRANSACTION_FAILURE),e}};if(ye({showWalletUIs:t?.showWalletUIs}))N({transactionRequest:s?I:await Zs(I,P,I.from)}).then((e=>{s?ua(le,"signTransaction","onSuccess",{signature:e}):ua(le,"sendTransaction","onSuccess",{hash:e}),p({hash:e})})).catch((e=>{ua(le,m,"onError",o.PrivyErrorCode.TRANSACTION_FAILURE),h(e)}));else{let e={connectingWalletAddress:w,recoveryMethod:g.recoveryMethod,entropyId:b,entropyIdVerifier:k,onCompleteNavigateTo:Ev,isUnifiedWallet:_,onFailure:e=>{ua(le,m,"onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),h(e)}},n=Qm(Y)?Mf({address:w,appConfig:Y,fundWalletConfig:r,methodScreen:jf,chainIdOverride:I.chainId,comingFromSendTransactionScreen:!0}):void 0;X({connectWallet:e,sendTransaction:{transactionRequest:I,transactingWalletIndex:x,transactingWalletAddress:w,entropyId:b,entropyIdVerifier:k,signOnly:s,scanTransaction:async()=>{let e=await Zs(I,P,I.from);return await c.scanTransaction({metadata:{domain:Y.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:({transactionRequest:e})=>N({transactionRequest:e}),onSuccess:e=>{s?ua(le,"signTransaction","onSuccess",{signature:e.hash}):ua(le,"sendTransaction","onSuccess",{hash:e.hash}),p(e)},onFailure:e=>{ua(le,m,"onError",o.PrivyErrorCode.TRANSACTION_FAILURE),h(e)},uiOptions:t||{},fundWalletConfig:r,requesterAppId:y},funding:n}),me(Gf)}}));function Se(){return new Promise((async(e,t)=>{let r=await Bx();if(!r||!K)throw Error("Must have valid access token to enroll in MFA");try{await K.verifyMfa({accessToken:r}),e()}catch(e){t(e)}}))}let Pe=e=>e?.linkedAccounts.filter((e=>null!==e.latestVerifiedAt&&!("wallet"===e.type&&"privy"===e.walletClientType))).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0],_e=e=>{let t=v?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:r,loginMethod:n}=eu(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw ua(le,"linkAccount","onError",o.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:n}),new o.PrivyClientError(`User already has an account of type ${r} linked.`)};async function Ne({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){P(null);let r=t?"setWalletPassword":"setWalletRecovery";if(!f||!v)throw ua(le,r,"onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let n=u.getPrivyPrimaryWallet(v);if(!n||!K)throw ua(le,r,"onError",o.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");let i=u.getIsUnifiedWallet(n);if(i)throw ua(le,r,"onError",o.PrivyErrorCode.UNSUPPORTED_WALLET_TYPE),new o.PrivyClientError("User owned wallet recovery is only supported for on-device execution and this app uses TEE execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");try{await Se()}catch(e){throw ua(le,r,"onError",o.PrivyErrorCode.MISSING_MFA_CREDENTIALS),e}return new Promise(((a,s)=>{let l="user-passcode"===n.recoveryMethod,c=xm({walletAction:"update",availableRecoveryMethods:Y.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:l,showAutomaticRecovery:e}),{entropyId:d,entropyIdVerifier:u}=mn(v),p={recoveryMethod:n.recoveryMethod,connectingWalletAddress:n.address,onCompleteNavigateTo:c,shouldForceMFA:!1,entropyId:d,isUnifiedWallet:i,entropyIdVerifier:u,onFailure:e=>{ua(le,r,"onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),s(e)}};X({setWalletPassword:{onSuccess:e=>{ua(le,r,"onSuccess",{method:"user-passcode",wallet:e}),a(e)},onFailure:e=>{ua(le,r,"onError",o.PrivyErrorCode.USER_EXITED_SET_PASSWORD_FLOW),s(e)},callAuthOnSuccessOnClose:!1},recoverWallet:{entropyId:d,entropyIdVerifier:u,onFailure:s},connectWallet:p,recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:l,shouldCreateEth:!1,shouldCreateSol:!1}}),me(Gf)}))}async function Me({appId:e,action:t}){let r=await Bx();if("link"===t&&!r)throw ua(le,"linkAccount","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new o.PrivyClientError("User must be authenticated before linking an account.");if("login"===t&&r)throw ua(le,"login","onError",o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),new o.PrivyClientError("Attempted to log in, but user is already logged in. Use a `link` helper instead.");ue.current=`privy:${e}`,pe.current=t;let n=dc();return c.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(r,i)=>{let{name:a,logoUrl:o}=await cc({api:c.api,providerAppId:e,requesterAppId:Y.id});X({crossAppAuth:{appId:e,name:a,logoUrl:o,action:t,popup:n,onSuccess:r,onError:i}}),me(Mv)}))}let We={ready:m,authenticated:f,user:v,walletConnectors:c.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),X({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress,walletChainType:e?.walletChainType,description:e?.description}}),me(yh)},linkWallet:t=>{t&&"target"in t&&t&&(t=void 0),Ee("siwe"),ue.current="siwe",pe.current="link",X({...Q,externalConnectWallet:{...Q.externalConnectWallet,suggestedAddress:t?.suggestedAddress,walletList:t?.walletList,walletChainType:t?.walletChainType,description:t?.suggestedAddress?/*#__PURE__*/e.jsxs("span",{children:["Link the wallet with address"," ",/*#__PURE__*/e.jsx(Dl,{showCopyIcon:!1,address:t?.suggestedAddress})," ",Y?.name?`to ${Y.name}.`:"."]}):`Link a wallet to your ${Y?.name} account`}}),me(hh)},startCrossAppAuthFlow:Me,linkEmail:()=>{Ee("email"),_e("email"),ue.current="email",pe.current="link",me(Zv)},linkPhone:()=>{Ee("sms"),_e("phone"),ue.current="sms",pe.current="link",me(Xv)},linkGoogle:async()=>{Ee("google"),_e("google_oauth"),pe.current="link",await Fe.initLoginWithOAuth("google")},linkTwitter:async()=>{Ee("twitter"),_e("twitter_oauth"),pe.current="link",await Fe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Ee("discord"),_e("discord_oauth"),pe.current="link",await Fe.initLoginWithOAuth("discord")},linkGithub:async()=>{Ee("github"),_e("github_oauth"),pe.current="link",await Fe.initLoginWithOAuth("github")},linkSpotify:async()=>{Ee("spotify"),_e("spotify_oauth"),pe.current="link",await Fe.initLoginWithOAuth("spotify")},linkInstagram:async()=>{Ee("instagram"),_e("instagram_oauth"),pe.current="link",await Fe.initLoginWithOAuth("instagram")},linkTiktok:async()=>{Ee("tiktok"),_e("tiktok_oauth"),pe.current="link",await Fe.initLoginWithOAuth("tiktok")},linkLine:async()=>{Ee("line"),_e("line_oauth"),pe.current="link",await Fe.initLoginWithOAuth("line")},linkLinkedIn:async()=>{Ee("linkedin"),_e("linkedin_oauth"),pe.current="link",await Fe.initLoginWithOAuth("linkedin")},linkApple:async()=>{Ee("apple"),_e("apple_oauth"),pe.current="link",await Fe.initLoginWithOAuth("apple")},linkPasskey:async()=>{Ee("passkey"),_e("passkey"),await Fe.initLinkWithPasskey(),me(Ug)},linkTelegram:async e=>{if(Ee("telegram"),_e("telegram"),pe.current="link",ue.current="telegram",e?.launchParams)if(e.launchParams.initDataRaw){let t=new ln;c.startAuthFlow(t),t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData=dn(e.launchParams.initDataRaw),X({telegramAuthModalData:{seamlessAuth:!0}}),me(iy)}else ua(le,"linkAccount","onError",o.PrivyErrorCode.INVALID_DATA,{linkMethod:"telegram"});else await Fe.initLoginWithTelegram();me(iy)},linkFarcaster:async()=>{Ee("farcaster"),_e("farcaster"),await Fe.initLoginWithFarcaster(),pe.current="link",ue.current="farcaster",me(Mh)},updateEmail:()=>{if(Ee("email"),!v?.email)throw new o.PrivyClientError("User does not have an email linked to their account.");pe.current="update",ue.current="email",me(jx)},updatePhone:()=>{if(Ee("sms"),!v?.phone)throw new o.PrivyClientError("User does not have a phone number linked to their account.");pe.current="update",ue.current="sms",me(Sx)},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=>{ee((t=>e.bind(t)))}));if(ee(null),e)return void console.warn(t)}!v||v.isGuest?(pe.current="login",X({login:e}),me(om)):console.warn(t)},connectOrCreateWallet:async()=>{m||(await new Promise((e=>{ee((()=>e))})),ee(null)),f?console.warn("User must be unauthenticated to `connectOrCreateWallet`"):(pe.current="connect-or-create",me(gy))},logout:async()=>{if(pe.current=null,ue.current=null,v&&c.clearProviderAcccessTokens(v),P(null),await c.logout(),v&&K)try{await K.clearMfa({userId:v.id})}catch(e){}x(null),w(!1),ua(le,"logout","onSuccess"),y(!1),kt.del(qt),kt.del(Vt(Y.id))},getAccessToken:r.useCallback((()=>c.getCustomerAccessToken()),[c]),unlinkWallet:async e=>{let t;return x(t=e.startsWith("0x")?await c.unlinkEthereumWallet(e):await c.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await c.unlinkEmail(e);return x(t),t},unlinkPhone:async e=>{let t=await c.unlinkPhone(e);return x(t),t},unlinkGoogle:async e=>{let t=await c.unlinkOAuth("google",e);return x(t),t},unlinkTwitter:async e=>{let t=await c.unlinkOAuth("twitter",e);return x(t),t},unlinkDiscord:async e=>{let t=await c.unlinkOAuth("discord",e);return x(t),t},unlinkGithub:async e=>{let t=await c.unlinkOAuth("github",e);return x(t),t},unlinkSpotify:async e=>{let t=await c.unlinkOAuth("spotify",e);return x(t),t},unlinkInstagram:async e=>{let t=await c.unlinkOAuth("instagram",e);return x(t),t},unlinkTiktok:async e=>{let t=await c.unlinkOAuth("tiktok",e);return x(t),t},unlinkLine:async e=>{let t=await c.unlinkOAuth("line",e);return x(t),t},unlinkLinkedIn:async e=>{let t=await c.unlinkOAuth("linkedin",e);return x(t),t},unlinkApple:async e=>{let t=await c.unlinkOAuth("apple",e);return x(t),t},unlinkFarcaster:async e=>{let t=await c.unlinkFarcaster(e);return x(t),t},unlinkTelegram:async e=>{let t=await c.unlinkTelegram(e);return x(t),t},unlinkPasskey:async e=>{let t=await Bx();if(!t)throw Error("Must have valid access token to enroll in MFA");if(!K)throw Error("Wallet proxy not initialized.");let r=Y.passkeys.shouldUnenrollMfaOnUnlink;await K.unlinkPasskeyAccount({credentialId:e,accessToken:t,removeAsMfa:r});let n=await c.getAuthenticatedUser();return x(n),n},unlinkCrossAppAccount:async({subject:e})=>{let t=v?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new o.PrivyClientError("Invalid subject");c.storeProviderAccessToken(t.id,null);let r=await c.unlinkOAuth(`privy:${t.id}`,e);return x(r),r},setWalletRecovery:async e=>Ne({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>Ne({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t)=>new Promise((async(r,n)=>{let{requesterAppId:s}=t?.uiOptions||{},l=e.message,p=t?.address?u.getPrivyWalletWithAddress(v,t.address):u.getPrivyEthereumWallet(v);if(!p&&void 0!==t?.address){let e=u.getConnectedWalletWithAddress(C,t.address);if(e)try{let t=await e.getEthereumProvider(),n=await t.request({method:"personal_sign",params:[l,e.address]});return ua(le,"signMessage","onSuccess",{signature:n}),void r({signature:n})}catch(e){return ua(le,"signMessage","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),void n(e??new kn("Unable to sign message"))}}if(!p)throw new o.PrivyClientError("No embedded or connected wallet found for address.");if(!f||!v)return ua(le,"signMessage","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void n(Error("User must be authenticated before signing with a Privy wallet"));let h=p.address,y=p.walletIndex??0,{entropyId:m,entropyIdVerifier:g}=mn(v,p),w=u.getIsUnifiedWallet(p);if("string"!=typeof l||l.length<1)return ua(le,"signMessage","onError",o.PrivyErrorCode.INVALID_MESSAGE),void n(Error("Message must be a non-empty string"));let x=async()=>{let t;if(!f)throw Error("User must be authenticated before signing with a Privy wallet");let r=await Bx();if(!K||!r||!await Fe.recoverEmbeddedWallet({address:h}))throw Error("Unable to connect to wallet");if(c.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:h,requesterAppId:s}}),w){let n=i.isHex(e.message,{strict:!0}),o=await a.rpc(d,(async({message:e})=>await K.signWithUserSigner({accessToken:r,requesterAppId:s,message:e})),{chain_type:"ethereum",method:"personal_sign",params:n?{message:l.slice(2),encoding:"hex"}:{message:l,encoding:"utf-8"},wallet_id:p.id});if(!o.data||!("signature"in o.data))throw new kn("Unable to sign message");t=o.data.signature}else{let{response:e}=await K.rpc({accessToken:r,entropyId:m,entropyIdVerifier:g,chainType:"ethereum",hdWalletIndex:y,requesterAppId:s,request:{method:"personal_sign",params:[l,h]}});t=e.data}return c.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:h,requesterAppId:s}}),t};if(ye({showWalletUIs:t?.uiOptions?.showWalletUIs}))try{let e=await x();ua(le,"signMessage","onSuccess",{signature:e}),r({signature:e})}catch(e){ua(le,"signMessage","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),n(e??new kn("Unable to sign message"))}else X({signMessage:{method:"personal_sign",data:l,confirmAndSign:x,onSuccess:e=>{ua(le,"signMessage","onSuccess",{signature:e}),r({signature:e})},onFailure:e=>{ua(le,"signMessage","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),n(e)},uiOptions:t?.uiOptions||{}},connectWallet:{recoveryMethod:p.recoveryMethod,connectingWalletAddress:h,entropyId:m,entropyIdVerifier:g,onCompleteNavigateTo:Vw,isUnifiedWallet:w,onFailure:e=>{ua(le,"signMessage","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),n(e)}}}),me(Gf)})),signTypedData:(e,t)=>new Promise((async(r,n)=>{let{requesterAppId:i}=t?.uiOptions||{},s=t?.address?u.getPrivyWalletWithAddress(v,t.address):u.getPrivyEthereumWallet(v);if(!s&&t?.address){let i=u.getConnectedWalletWithAddress(C,t.address);if(i)try{let t=await i.getEthereumProvider(),n=rn(e),a=await t.request({method:"eth_signTypedData_v4",params:[i.address,n]});return ua(le,"signTypedData","onSuccess",{signature:a}),void r({signature:a})}catch(e){return ua(le,"signTypedData","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),void n(e??new kn("Unable to sign typed data "+e))}}if(!s)throw new o.PrivyClientError("No embedded or connected wallet found for address.");if(!f||!v)return ua(le,"signTypedData","onError",o.PrivyErrorCode.MUST_BE_AUTHENTICATED),void n(Error("User must be authenticated before signing with a Privy wallet"));let l=s.address,p=s.walletIndex??0,{entropyId:h,entropyIdVerifier:y}=mn(v,s),m=u.getIsUnifiedWallet(s),g=rn(e),w=async()=>{let e;if(!f)throw Error("User must be authenticated before signing with a Privy wallet");let t=await Bx();if(!K||!t||!await Fe.recoverEmbeddedWallet({address:l}))throw Error("Unable to connect to wallet");if(c.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:l,requesterAppId:i}}),m){let{domain:r,types:n,primaryType:o,message:l}=g,c=await a.rpc(d,(async({message:e})=>await K.signWithUserSigner({accessToken:t,requesterAppId:i,message:e})),{chain_type:"ethereum",method:"eth_signTypedData_v4",params:{typed_data:{domain:r,types:n,primary_type:o,message:l}},wallet_id:s.id});if(!c.data||!("signature"in c.data))throw new kn("Unable to sign message");e=c.data.signature}else{let{response:r}=await K.rpc({accessToken:t,entropyId:h,entropyIdVerifier:y,chainType:"ethereum",hdWalletIndex:p,requesterAppId:i,request:{method:"eth_signTypedData_v4",params:[l,g]}});e=r.data}return c.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:l,requesterAppId:i}}),e};if(ye({showWalletUIs:t?.uiOptions?.showWalletUIs}))try{let e=await w();ua(le,"signTypedData","onSuccess",{signature:e}),r({signature:e})}catch(e){ua(le,"signTypedData","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),n(e??new kn("Unable to sign message"))}else X({signMessage:{method:"eth_signTypedData_v4",data:g,confirmAndSign:w,onSuccess:e=>{ua(le,"signTypedData","onSuccess",{signature:e}),r({signature:e})},onFailure:e=>{ua(le,"signTypedData","onError",o.PrivyErrorCode.UNABLE_TO_SIGN),n(e)},uiOptions:t?.uiOptions||{}},connectWallet:{recoveryMethod:s.recoveryMethod,connectingWalletAddress:s.address,entropyId:h,isUnifiedWallet:m,entropyIdVerifier:y,onCompleteNavigateTo:Vw,onFailure:e=>{ua(le,"signMessage","onError",o.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),n(e)}}}),me(Gf)})),sendTransaction:async(e,t)=>await Ie({transaction:e,uiOptions:t?.uiOptions,fundWalletConfig:t?.fundWalletConfig,address:t?.address,signOnly:!1}),signTransaction:async(e,t)=>({signature:(await Ie({transaction:e,uiOptions:t?.uiOptions,address:t?.address,signOnly:!0})).hash}),exportWallet:e=>new Promise((async(t,r)=>{if(!f||!v)return void r(Error("User must be authenticated before exporting their Privy wallet"));e&&"target"in e&&e&&(e=void 0);let n=e?.address?u.getPrivyWalletWithAddress(v,e.address):u.getPrivyEthereumWallet(v);if(!n)return void r(new o.PrivyClientError("User must have an embedded wallet."));let a=n.address,{entropyId:s,entropyIdVerifier:d}=mn(v,n),p=u.getIsUnifiedWallet(n);if(!a)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(!i.isAddress(a))return void r(Error("Must provide a valid Ethereum address."));let h={recoveryMethod:n.recoveryMethod,connectingWalletAddress:n.address,isUnifiedWallet:p,entropyId:s,entropyIdVerifier:d,onCompleteNavigateTo:$f,onFailure:r,shouldForceMFA:!0};X(Q),await Bx()&&K?K?ec(n)?(X({keyExport:{appId:l.appId,appClientId:l.clientId,origin:c.apiUrl,address:n.address,entropyId:s,entropyIdVerifier:d,hdWalletIndex:n.walletIndex,chainType:n.chainType,walletId:n.id,isUnifiedWallet:p,imported:n.imported,onSuccess:t,onFailure:r},connectWallet:h}),me(Gf)):r(Error(`Export is not supported for ${n.chainType} wallets`)):r(Error("Must have a Privy wallet before exporting")):r(Error("Must have valid access token to enroll in MFA"))})),promptMfa:Se,async init(e){switch(e){case"sms":return void await c.initMfaSmsVerification();case"passkey":return await c.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 o.PrivyClientError("Invalid MFA code");oe.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{se.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new o.PrivyClientError("Invalid authenticator response");let r=await import("@simplewebauthn/browser"),n=Pv(await r.startAuthentication(t));oe.current?.resolve({mfaMethod:e,mfaCode:n,relyingParty:window.origin}),await new Promise(((e,t)=>{se.current={resolve:e,reject:t}}));break;default:throw oe.current?.reject(new o.PrivyClientError("Unsupported MFA method")),new o.PrivyClientError(`Unsupported MFA method: ${e}`)}},cancel(){oe.current?.reject(new o.PrivyClientError("MFA canceled"))},async initEnrollmentWithSms(e){let t=await Bx();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.initEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber})},enrollInMfa:e=>new Promise(((t,r)=>{if(!e)return Fe.closePrivyModal(),void t();Y.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."),X({mfaEnrollmentFlow:{mfaMethods:Y.mfa.methods,shouldUnlinkOnUnenrollMfa:Y.passkeys.shouldUnlinkOnUnenrollMfa,onSuccess:t,onFailure:r}}),me(xx)})),async initEnrollmentWithTotp(){let e=await Bx();if(!e||!K)throw Error("Must have valid access token to enroll in MFA");let t=await K.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await Bx();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),x(await c.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await Bx();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),x(await c.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e},t={}){let r=await Bx();if(!r||!K)throw Error("Must have valid access token to enroll in MFA");await K.submitEnrollMfa({method:"passkey",accessToken:r,credentialIds:e,removeForLogin:t.removeForLogin}),x(await c.getAuthenticatedUser())},async unenroll(e,t={}){let r=await Bx();if(!r||!K)throw Error("Must have valid access token to remove MFA");"passkey"===e?await K.submitEnrollMfa({method:"passkey",accessToken:r,credentialIds:[],removeForLogin:t.removeForLogin}):await K.unenrollMfa({method:e,accessToken:r}),x(await c.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await Bx(),t=v?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!K||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(u.getIsUnifiedWallet(t))throw new o.PrivyClientError("Farcaster signers are only supported for on-device execution and this app uses TEE execution. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");if(!v?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Fe.recoverEmbeddedWallet({address:t.address}))throw Error("Unable to connect to wallet");let r=await K.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===r.status&&x(await c.getAuthenticatedUser()||v||null),X({farcasterSigner:r}),me(Vv)},getFarcasterSignerPublicKey:async()=>{let e,t=await Bx(),r=v?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!K||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(u.getIsUnifiedWallet(r))throw new o.PrivyClientError("Farcaster signers are only supported for on-device execution and this app uses TEE execution. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");if(!v?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Fe.recoverEmbeddedWallet({address:r.address}))throw Error("Unable to connect to wallet");if(!v.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=v.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await Bx(),r=v?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!K||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(u.getIsUnifiedWallet(r))throw new o.PrivyClientError("Farcaster signers are only supported for on-device execution and this app uses TEE execution. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");if(!v?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Fe.recoverEmbeddedWallet({address:r.address}))throw Error("Unable to connect to wallet");if(!v.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let n=await import("@simplewebauthn/browser"),i=await K.signFarcasterMessage({address:r.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:n.bufferToBase64URLString(e)},fid:BigInt(v.farcaster.fid),relyingParty:window.origin});return new Uint8Array(n.base64URLStringToBuffer(i.signature))},signMessageWithCrossAppWallet(e,{address:t,chainId:r}){let n=v?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return pc({user:v,client:c,address:t,requesterAppId:Y.id,request:{method:n?"privy_signSmartWalletMessage":"personal_sign",params:[e,t],chainId:r},reconnect:Me})},signTypedDataWithCrossAppWallet(e,{address:t,chainId:r}){let n=v?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t)))),i=rn(e);return pc({user:v,client:c,address:t,requesterAppId:Y.id,request:{method:n?"privy_signSmartWalletTypedData":"eth_signTypedData_v4",params:[t,i],chainId:r},reconnect:Me})},sendTransactionWithCrossAppWallet(e,{address:t}){let r=v?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return pc({user:v,client:c,address:t,requesterAppId:Y.id,request:{method:r?"privy_sendSmartWalletTx":"eth_sendTransaction",params:[e],chainId:e.chainId},reconnect:Me})},signTransactionWithCrossAppWallet(e,{address:t}){let r=v?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return pc({user:v,client:c,address:t,requesterAppId:Y.id,request:{method:r?"privy_signSmartWalletTx":"eth_signTransaction",params:[e],chainId:e.chainId},reconnect:Me})},isModalOpen:h,mfaMethods:Y.mfa.methods};Fx=We.signMessage,Ux=We.signTypedData,Ox=async(e,t)=>await Ie({transaction:e,...t,signOnly:!1}),Rx=async(e,t)=>({signature:(await Ie({transaction:e,...t,signOnly:!0})).hash});let Fe={privy:d,setAuthenticated:w,setUser:x,setIsNewUser:I,isNewUserThisSession:j,pendingTransaction:null,walletConnectionStatus:M,setWalletConnectionStatus:W,connectors:c.connectors?.walletConnectors??[],solanaWallets:k,rpcConfig:Y.rpcConfig,chains:Y.chains,appId:l.appId,showFiatPrices:"native-token"!==Y.embeddedWallets.priceDisplay.primary,clientAnalyticsId:c.clientAnalyticsId,onCustomAuthAuthenticated:ge,hideWalletUIs:he,isHeadlessSigning:r.useCallback(ye,[Y.embeddedWallets.showWalletUIs]),emailOtpState:R,setEmailOtpState:O,smsOtpState:L,setSmsOtpState:D,oAuthState:H,setOAuthState:$,telegramAuthState:q,setTelegramAuthState:V,siweState:B,setSiweState:z,isHeadlessOAuthLoading:_,baseAccountSdk:A,setBaseAccountSdk:T,nativeTokenSymbolForChainId:e=>Y.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(K)return K;let t=new Promise((e=>{te.current=e})),r=new Promise((t=>setTimeout((()=>t(null)),e))),n=await Promise.race([t,r]);return te.current=null,n},getAuthFlow:()=>c.authFlow,getAuthMeta:()=>c.authFlow?.meta,client:c,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,r=m&&f&&v;r&&ue.current&&(t=Pe(v)),"login"===pe.current?e.shouldCallAuthOnSuccess&&r&&ue.current?ua(le,"login","onComplete",{user:v,isNewUser:j,wasAlreadyAuthenticated:!1,loginMethod:ue.current,loginAccount:t??null}):ua(le,"login","onError",o.PrivyErrorCode.USER_EXITED_AUTH_FLOW):"link"===pe.current&&t?e.isSuccess&&r&&ue.current?ua(le,"linkAccount","onSuccess",{user:v,linkMethod:ue.current,linkedAccount:t}):ue.current&&ua(le,"linkAccount","onError",o.PrivyErrorCode.USER_EXITED_LINK_FLOW,{linkMethod:ue.current}):"update"===pe.current&&t?e.isSuccess&&r&&ue.current?ua(le,"update","onSuccess",{user:v,updateMethod:ue.current,updatedAccount:t}):ue.current&&ua(le,"update","onError",o.PrivyErrorCode.USER_EXITED_UPDATE_FLOW,{linkMethod:ue.current}):"connect-or-create"===pe.current&&(C[0]?ua(le,"connectOrCreateWallet","onSuccess",{wallet:C[0]}):ua(le,"connectOrCreateWallet","onError",o.PrivyErrorCode.USER_EXITED_AUTH_FLOW));let n=S&&jv.has(S),i=S===Nu&&Q.errorModalData&&jv.has(Q.errorModalData.previousScreen);if((n||i)&&Q.funding){let e,t=jv.get(S)??null;if("solana"===Q.funding.chainType){let r=p(Lm);if(r)try{e=BigInt(await r.getBalance({address:Q.funding.address,cluster:Q.funding.cluster}))}catch{console.error("Unable to pull wallet balance")}else console.warn("Unable to load solana plugin, skipping balance");ua(le,"fundSolanaWallet","onUserExited",{address:Q.funding.address,cluster:Q.funding.cluster,fundingMethod:t,balance:e})}else{let r=Hr(Q.funding.chain.id,Y.chains,Y.rpcConfig,{appId:l.appId});try{e=await r.getBalance({address:Q.funding.address})}catch{console.error("Unable to pull wallet balance")}ua(le,"fundWallet","onUserExited",{address:Q.funding.address,chain:Q.funding.chain,fundingMethod:t,balance:e})}}X((e=>({...e,externalConnectWallet:{suggestedAddress:void 0}}))),pe.current=null,ue.current=null,I(!1),y(!1),setTimeout((()=>{c.authFlow=void 0}),200)},openPrivyModal:me,connectWallet:xe,initLoginWithWallet:async(e,t,r,n)=>{An(e)?(ue.current="siwe",Ce(e,t,r)):(ue.current="siws",be(e,t,r,n))},loginWithWallet:async()=>{let e,t,r;if(!m)throw new o.PrivyNotReadyError;if(c.authFlow instanceof Wr?e="siwe":c.authFlow instanceof Rr&&(e="siws"),!e)throw new o.PrivyClientError("Must initialize SIWE/SIWS flow first.");if(null!==await c.getAccessToken())try{({user:t}=await c.link()),ue.current=e}catch(t){throw ua(le,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:r}=await c.authenticate()),ue.current=e}catch(e){throw ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR),e}x(t||v||null),I(r||!1),w(!0)},delegateWallet:async({address:e,chainType:t,showDelegationUIs:r})=>new Promise((async(n,i)=>{let a=await Bx();if(!f||!v||!a)throw new o.PrivyClientError("User must be authenticated and have an embedded wallet to delegate actions.");if("solana"!==t&&"ethereum"!==t)throw new o.PrivyClientError("Only Solana and Ethereum embedded wallets are supported for delegation and revocation.");let s=Fe.walletProxy??await Fe.initializeWalletProxy(15e3);if(!s)throw new o.PrivyClientError("Wallet proxy not initialized.");if((({address:e,user:t})=>!!nc(t).find((t=>t.address===e)))({address:e,user:v}))return n();let l=u.getPrivyWalletWithAddress(v,e);if(!l)throw new o.PrivyClientError("Address to delegate is not associated with current user.");if(u.getIsUnifiedWallet(l))throw new o.PrivyClientError("useDelegatedActions is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to provision server side access on behalf of your users. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");let c=tc({address:e,user:v}),d=rc({address:e,user:v}),p=async()=>{await s.createDelegatedAction({accessToken:a,rootWallet:d,delegatedWallets:[c]}),await Fe.refreshSessionAndUser()};if(await Fe.recoverEmbeddedWallet({address:e}),r)X({delegatedActions:{consent:{address:e,onDelegate:p,onSuccess:async()=>{n()},onError:async e=>{i(e)}}}}),me(Fv);else try{await p(),n()}catch(e){i(e)}})),revokeDelegatedWallets:async({showDelegationUIs:e})=>new Promise((async(t,r)=>{if(!f||!v)throw new o.PrivyClientError("User must be authenticated and have an embedded wallet to revoke a delegated wallet.");let n=nc(v);if(0===n.length)throw new o.PrivyClientError("User has no delegated wallets to revoke.");if(n.some(u.getIsUnifiedWallet))throw new o.PrivyClientError("useDelegatedActions is only supported for on-device execution and this app uses TEE execution. Use the useSessionSigners hook to provision server side access on behalf of your users. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide");let i=async()=>{await c.revokeDelegatedWallet(),await Fe.refreshSessionAndUser()};if(e)X({delegatedActions:{revoke:{onRevoke:i,onSuccess:async()=>{t()},onError:async e=>{r(e)}}}}),me(Rv);else try{await i(),t()}catch(e){r(e)}})),initLoginWithFarcaster:async(e,t)=>{let r=new Nt(e,t);c.startAuthFlow(r);try{ue.current="farcaster",await r.initializeFarcasterConnect()}catch(e){throw"login"===pe.current?ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===pe.current&&ua(le,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!m)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof Nt))throw new o.PrivyClientError("Must initialize Farcaster flow first.");if(null!==await c.getAccessToken())try{({user:e}=await c.link()),ue.current="farcaster"}catch(e){throw ua(le,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await c.authenticate()),ue.current="farcaster"}catch(e){throw ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}x(e||null),I(t||!1),w(!0)},async crossAppAuthFlow({appId:e,popup:t,action:r}){let n=`privy:${e}`;ue.current=n;let{url:i,stateCode:a,codeVerifier:s}=await async function({api:e,appId:t}){let r=pr(),n=hr(),i=await yr(r);try{let{url:a}=await e.post(o.oAuthInitPath,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:i,state_code:n});return{url:a,stateCode:n,codeVerifier:r}}catch(e){throw o.formatApiError(e)}}({api:c.api,appId:e});if(!i)throw c.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new o.PrivyClientError("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,r)=>{let n,i=setTimeout((()=>{r(new o.PrivyClientError("Authorization request timed out after 2 minutes.")),a()}),12e4);function a(){t?.close(),window.removeEventListener("message",l)}let s=setInterval((()=>{t?.closed&&!n&&(a(),clearInterval(s),clearTimeout(i),r(new o.PrivyClientError("User rejected request")))}),300);function l(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(i),e(t.data),a()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(i),r(new o.PrivyClientError(t.data.error)),a()),t.data.type===sc&&((n=new BroadcastChannel(oc)).onmessage=l))}window.addEventListener("message",l)}))}({url:i,popup:t,provider:n}),d=l.stateCode,u=l.authorizationCode;if(d!==a)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:n,storedStateCode:a??"",returnedStateCode:d??""}}),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED);let p=await async function({appId:e,stateCode:t,codeVerifier:r,authorizationCode:n,action:i,client:a}){if(!n||!t)throw new o.PrivyClientError("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===n)throw new o.PrivyClientError("User denied confirmation during cross-app auth flow");try{let o=new lc({authorizationCode:n,stateCode:t,codeVerifier:r,provider:`privy:${e}`});a.startAuthFlow(o);let s="link"===i?await a.link():await a.authenticate(),l=s.oAuthTokens?.accessToken;return console.debug(),l}catch(e){let t=o.formatApiError(e);if(t.privyErrorCode===o.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED)throw t;if(t.privyErrorCode)throw new o.PrivyClientError(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 o.PrivyClientError("Invalid code during cross-app auth flow.",void 0,o.PrivyErrorCode.OAUTH_USER_DENIED);throw new o.PrivyClientError("Invalid code during cross-app auth flow.",void 0,o.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:s,stateCode:d,authorizationCode:u,action:r,client:c});p&&c.storeProviderAccessToken(e,p);let h=await Fe.refreshSessionAndUser();if(!h)throw new o.PrivyClientError("Unable to update user");return c.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),h}catch(e){throw c.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:n}}),e}},async initLoginWithOAuth(e,t,r){if(ue.current=e,!bt())return void me(Gv);if("google"===e&&Ry(window.navigator.userAgent))return void me(Gv);"twitter"===e&&window.opener&&window.opener.postMessage({type:sc},"*"),kt.del(Zt),kt.del(Qt);let i=new mr({provider:e,disableSignup:!!r,withPrivyUi:!0});t&&i.addCaptchaToken(t),c.startAuthFlow(i);let a=await c.authFlow.getAuthorizationUrl();if(a&&a.url)if("twitter"===e&&n.isAndroid&&(a.url=a.url.replace("x.com","twitter.com")),"chrome-extension:"===window.location.protocol&&cr())try{let{privyOAuthCode:e,privyOAuthState:t}=await dr(a.url);me(bx),i.meta.stateCode=t,i.meta.authorizationCode=e}catch(e){throw console.error("OAuth in chrome extension flow failed:",e),e}else window.location.assign(a.url)},async initLoginWithTelegram(e,t){if(!m)throw new o.PrivyNotReadyError;ue.current="telegram";let r=new ln(e,t);c.startAuthFlow(r),V({status:"loading"}),r.meta.telegramWebAppData=void 0,r.meta.telegramAuthResult=await new Promise(((e,t)=>Y.loginConfig.telegramAuthConfiguration?window.Telegram?void window.Telegram.Login.auth({bot_id:Y.loginConfig.telegramAuthConfiguration.botId,request_access:!0},(r=>r?e(r):t(new o.PrivyClientError("Telegram auth failed or was canceled by the client")))):t(new o.PrivyClientError("Telegram was not initialized")):t(new o.PrivyClientError("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(e){let t,r;if(!(c.authFlow instanceof ln))throw new o.PrivyClientError("Must initialize Telegram flow before calling loginWithTelegram");c.authFlow.meta.captchaToken||=e?.captchaToken;let n=await Bx(),i=e?.intent||pe.current;if("login"===i)try{let e=await c.authenticate();t=e.user,r=e.isNewUser,ue.current="telegram"}catch(e){throw ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}else{if("link"!==i)throw new o.PrivyClientError("Unknown auth intent");try{t=(await c.link()).user,ue.current="telegram"}catch(e){throw ua(le,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}x(t),I(r||!1),w(!0),V({status:"done"});let a=t?.linkedAccounts.find((({type:e})=>"telegram"===e))||null;return{user:t,isNewUser:r||!1,wasAlreadyAuthenticated:!!n,loginAccount:a}},async loginWithOAuth(e){let t,r,n;if(!(c.authFlow instanceof mr))throw new o.PrivyClientError("Must initialize OAuth flow before calling loginWithOAuth");let i=kt.get(Gt),a=c.authFlow.meta.stateCode;if(i!==a)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:a??""}}),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await c.getAccessToken())try{let r=await c.link();t=r.user,n=r.oAuthTokens,ue.current=e}catch(t){throw ua(le,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await c.authenticate();t=i.user,r=i.isNewUser,n=i.oAuthTokens,ue.current=e}catch(t){throw"login"===pe.current?ua(le,"login","onError",t.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===pe.current&&ua(le,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return x(t),I(r||!1),w(!0),n&&t&&ua(le,"oAuthAuthorization","onOAuthTokenGrant",{oAuthTokens:n,user:t}),n},passkeyAuthState:F,setPasskeyAuthState:U,async initSignupWithPasskey({captchaToken:e,withPrivyUi:t}){let r=new Nr({captchaToken:e,setPasskeyAuthState:U});c.startAuthFlow(r),pe.current="login";try{ue.current="passkey",U({status:"generating-challenge"}),await r.initRegisterFlow(t),U({status:"awaiting-passkey"})}catch(e){throw U({status:"error",error:e}),ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async signupWithPasskey(){let e,t;if(!m)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof Nr))throw new o.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==ue.current){let e=new o.PrivyClientError("Must init login with Passkey flow first.");throw U({status:"error",error:e}),e}let r=await Bx();try{ue.current="passkey",U({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await c.authenticate())}catch(e){throw U({status:"error",error:e}),ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}x(e),I(t||!1),w(!0),U({status:"done"});let n=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!r,loginAccount:n}},async initLoginWithPasskey({captchaToken:e,withPrivyUi:t}){let r=new Nr({captchaToken:e,setPasskeyAuthState:U});c.startAuthFlow(r),pe.current="login";try{ue.current="passkey",U({status:"generating-challenge"}),await r.initAuthenticationFlow(t),U({status:"awaiting-passkey"})}catch(e){throw U({status:"error",error:e}),ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(e){let t,r;if(!m)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof Nr))throw new o.PrivyClientError("Must initialize Passkey flow first.");if(e?.credentialIds&&(c.authFlow.meta.allowedCredentialsIds=e.credentialIds),"passkey"!==ue.current){let e=new o.PrivyClientError("Must init login with Passkey flow first.");throw U({status:"error",error:e}),e}let n=await Bx();try{ue.current="passkey",U({status:"awaiting-passkey"}),({user:t,isNewUser:r}=await c.authenticate())}catch(e){throw U({status:"error",error:e}),ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}x(t),I(r||!1),w(!0),U({status:"done"});let i=t?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:t,isNewUser:r||!1,wasAlreadyAuthenticated:!!n,loginAccount:i}},async initLinkWithPasskey(e){let t=new Nr({captchaToken:e});c.startAuthFlow(t),pe.current="link",ue.current="passkey",U({status:"generating-challenge"});try{await t.initLinkFlow(),U({status:"awaiting-passkey"})}catch(e){throw ua(le,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),U({status:"error",error:e}),e}},async linkWithPasskey(){let e;if(!m)throw new o.PrivyNotReadyError;if(!(c.authFlow instanceof Nr))throw new o.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==ue.current)throw new o.PrivyClientError("Must init login with Passkey flow first.");try{ue.current="passkey",({user:e}=await c.link())}catch(e){throw ua(le,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return x(e||v||null),U({status:"done"}),e},async initLoginWithHeadlessOAuth(e,t,r){if(!bt())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&&Ry(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 n=new mr({provider:e,withPrivyUi:!1,disableSignup:r??!1});t&&n.addCaptchaToken(t),$({status:"loading"});let i=await c.startAuthFlow(n).getAuthorizationUrl();if(i?.url)if("chrome-extension:"===window.location.protocol&&cr())try{let{privyOAuthCode:e,privyOAuthState:t}=await dr(i.url);n.meta.stateCode=t,n.meta.authorizationCode=e,await this.loginWithHeadlessOAuth(n.meta)}catch(e){throw $({status:"error",error:e}),e}else window.location.assign(i.url)},async loginWithHeadlessOAuth(e){let t,r,n;N(!0),$({status:"loading"}),c.startAuthFlow(new mr(e));let i=kt.get(Gt),a=e.stateCode;if(i!==a)throw c.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:a??""}}),N(!1),new o.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,o.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await c.getAccessToken())try{({user:t,oAuthTokens:n}=await c.link()),ue.current=e.provider;let r=Pe(t);t&&r&&ua(le,"linkAccount","onSuccess",{user:t,linkMethod:ue.current,linkedAccount:r})}catch(t){throw N(!1),ua(le,"linkAccount","onError",t.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:r,oAuthTokens:n}=await c.authenticate()),ue.current=e.provider;let i=Pe(t);t&&i&&void 0!==r&&ua(le,"login","onComplete",{user:t,isNewUser:r,wasAlreadyAuthenticated:!1,loginMethod:ue.current,loginAccount:i})}catch(e){throw N(!1),$({status:"error",error:e}),ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}return x(t),I(r||!1),w(!0),N(!1),$({status:"done"}),n&&t&&ua(le,"oAuthAuthorization","onOAuthTokenGrant",{oAuthTokens:n,user:t}),t??void 0},initLoginWithEmail:async({email:e,captchaToken:t,disableSignup:r,withPrivyUi:n})=>{let i=new vt({email:e,captchaToken:t,disableSignup:r});c.startAuthFlow(i);try{ue.current="email",O({status:"sending-code"}),await i.sendCodeEmail({withPrivyUi:n}),O({status:"awaiting-code-input"})}catch(e){throw O({status:"error",error:e}),"login"===pe.current?ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===pe.current&&ua(le,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async({oldAddress:e,newAddress:t,captchaToken:r})=>{let n=new xt(e,t,r);c.startAuthFlow(n);try{await n.sendCodeEmail({withPrivyUi:!0})}catch(e){ua(le,"update","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:ue.current})}},initUpdatePhone:async(e,t,r)=>{let n=new Lr(e,t,r);c.startAuthFlow(n);try{await n.sendSmsCode({withPrivyUi:!0})}catch(e){ua(le,"update","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:ue.current})}},initLoginWithSms:async({phoneNumber:e,captchaToken:t,disableSignup:r,withPrivyUi:n})=>{D({status:"sending-code"});let i=new Or({phoneNumber:e,captchaToken:t,disableSignup:r});c.startAuthFlow(i);try{ue.current="sms",await i.sendSmsCode({withPrivyUi:n}),D({status:"awaiting-code-input"})}catch(e){throw D({status:"error",error:e}),"login"===pe.current?ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===pe.current&&ua(le,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(c.authFlow?.sendCodeEmail({withPrivyUi:!0}))},resendSmsCode:async()=>{await(c.authFlow?.sendSmsCode({withPrivyUi:!0}))},loginWithCode:async e=>{let t,r;function n(e){c.authFlow instanceof vt?O(e):c.authFlow instanceof Or&&D(e)}if(n({status:"submitting-code"}),!m){let e=new o.PrivyNotReadyError;throw n({status:"error",error:e}),e}if(c.authFlow instanceof vt)c.authFlow.meta.emailCode=e.trim();else{if(!(c.authFlow instanceof Or)){let e=new o.PrivyClientError("Must initialize a passwordless code flow first");throw n({status:"error",error:e}),e}c.authFlow.meta.smsCode=e.trim()}let i=await Bx();if("link"===pe.current)try{({user:t}=await c.link())}catch(e){throw n({status:"error",error:e}),ua(le,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:ue.current}),e}else if("update"===pe.current)try{({user:t}=await c.link())}catch(e){throw n({status:"error",error:e}),ua(le,"update","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_UPDATE_ACCOUNT,{linkMethod:ue.current}),e}else try{({user:t,isNewUser:r}=await c.authenticate())}catch(e){throw n({status:"error",error:e}),ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}let a=t||v;x(a||null),I(r||!1),w(!0),n({status:"done"});let s=null;return c.authFlow instanceof vt?s=a?.linkedAccounts.find((({type:e})=>"email"===e))||null:c.authFlow instanceof Or&&(s=a?.linkedAccounts.find((({type:e})=>"phone"===e))||null),{user:a,isNewUser:r||!1,wasAlreadyAuthenticated:!!i,linkedAccount:s}},generateSiweMessage:async({address:e,chainId:t,captchaToken:r})=>{pe.current=f?"link":"login",ue.current="siwe",z({status:"generating-message"});let n=await c.generateSiweNonce({address:e,captchaToken:r});return z({status:"awaiting-signature"}),Mr({address:e,chainId:t.replace("eip155:",""),nonce:n})},generateSiweMessageForSmartWallet:async({address:e,chainId:t})=>{let r=await c.generateSiweNonce({address:e});return Mr({address:e,chainId:t.replace("eip155:",""),nonce:r})},linkSmartWallet:async({message:e,signature:t,smartWalletType:r,smartWalletVersion:n})=>{let i;i=await c.linkSmartWallet({message:e,signature:t,smartWalletType:r,smartWalletVersion:n}),x((i=await Fe.refreshSessionAndUser()??i)||v||null)},loginWithSiwe:async({message:e,signature:t,captchaToken:r,disableSignup:n})=>{let i,a=null;try{if(v)throw Error("User already authenticated");let o=new Wr(c,void 0,r,n,{message:e,signature:t});c.startAuthFlow(o),ue.current="siwe",pe.current="login",z({status:"submitting-signature"});let s=await c.authenticate();if(({user:a,isNewUser:i}=s),!a)throw Error("Authentication failed - no user returned")}catch(e){throw ua(le,"login","onError",e.privyErrorCode||o.PrivyErrorCode.UNKNOWN_AUTH_ERROR),z({status:"error",error:e}),e}return x(a),I(i||!1),w(!0),z({status:"done"}),pe.current=null,ue.current=null,a},linkWithSiwe:async({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})=>{let a;Ee("siwe");let s=null;try{z({status:"submitting-signature"}),a=await c.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}),a=await Fe.refreshSessionAndUser()??a,z({status:"done"}),(s=Pe(a)||null)&&ua(le,"linkAccount","onSuccess",{user:a,linkMethod:"siwe",linkedAccount:s})}catch(e){throw ua(le,"linkAccount","onError",e.privyErrorCode||o.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"siwe"}),pe.current=null,ue.current=null,z({status:"error",error:e}),e}let l=a||v;return x(l||null),pe.current=null,ue.current=null,{user:l,linkedAccount:s}},refreshSessionAndUser:async()=>{let e=await c.getAuthenticatedUser();return w(!!e),x(e),e},walletProxy:K,createAnalyticsEvent:({eventName:e,payload:t,timestamp:r})=>c.createAnalyticsEvent({eventName:e,payload:t,timestamp:r}),acceptTerms:async()=>{let e=await c.acceptTerms();return x(e),e},getUsdTokenPrice:e=>c.getUsdTokenPrice(e),getUsdPriceForSol:()=>c.getUsdPriceForSol(),getSplTokenMetadata:e=>c.getSplTokenMetadata(e),recoverEmbeddedWallet:async e=>new Promise((async(t,r)=>{if(!v)return void t(!0);let n=e?.address?u.getPrivyWalletWithAddress(v,e.address):u.getPrivyPrimaryWallet(v)||u.getImportedPrivyEthereumWallet(v)||u.getImportedPrivySolanaWallet(v);if(!n||u.getIsUnifiedWallet(n))return void t(!0);let i=await Bx();if(!i||!K||!n)return void r(Error("Must have valid access token and Privy wallet to recover wallet"));let{entropyId:a,entropyIdVerifier:o}=mn(v,n);try{await K.connect({accessToken:i,entropyId:a,entropyIdVerifier:o}),t(!0)}catch(e){if(yl(e)&&"privy"===n.recoveryMethod){let e;c.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:n.address}});try{e=await K.recover({entropyId:a,entropyIdVerifier:o,accessToken:i})}catch(e){return void r(e)}e.entropyId||r(Error("Unable to recover wallet")),c.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n.address}}),t(!0)}else yl(e)&&"privy"!==n.recoveryMethod&&"privy-v2"!==n.recoveryMethod?(X({recoverWallet:{entropyId:a,entropyIdVerifier:o,onFailure:r,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:n.recoveryMethod,action:"recover",shouldCreateEth:!1,shouldCreateSol:!1}}),me(Cm(n.recoveryMethod))):r(e)}})),exportSolanaWallet:e=>new Promise((async(t,r)=>{if(!f||!v)return void r(Error("User must be authenticated before exporting their Privy wallet"));let n=e?.address?u.getPrivyWalletWithAddress(v,e.address):u.getPrivySolanaWallet(v);if(!n)return void r(new o.PrivyClientError("User must have an embedded wallet."));let{entropyId:i,entropyIdVerifier:a}=mn(v,n),s=u.getIsUnifiedWallet(n);if(!await Bx()||!K)return void r(Error("Must have valid access token to enroll in MFA"));if(!K)return void r(Error("Must have a Privy wallet before exporting"));let d={recoveryMethod:n.recoveryMethod,connectingWalletAddress:n.address,isUnifiedWallet:s,entropyId:i,entropyIdVerifier:a,onCompleteNavigateTo:$f,onFailure:r,shouldForceMFA:!0};ec(n)?(X({connectWallet:d,keyExport:{appId:l.appId,appClientId:l.clientId,origin:c.apiUrl,address:n.address,entropyId:i,entropyIdVerifier:a,hdWalletIndex:n.walletIndex,chainType:n.chainType,walletId:n.id,isUnifiedWallet:s,imported:n.imported,onSuccess:t,onFailure:r}}),me(Gf)):r(Error(`Export is not supported for ${n.chainType} wallets`))})),setReadyToTrue:e=>{g(!0),J?.(e)},updateWallets:()=>je(),fundWallet:async(e,t)=>{X({funding:Mf({address:e,appConfig:Y,fundWalletConfig:t,methodScreen:jf})}),me(jf)},openModal:me,requestFarcasterSignerStatus:async e=>{let t=await Bx(),r=v?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!K||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!v?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let n=await c.requestFarcasterSignerStatus(e);return"approved"===n.status&&x(await c.getAuthenticatedUser()||v||null),n},connectCoinbaseSmartWallet:async()=>{Y.externalWallets.coinbaseWallet.config.preference={...Y.externalWallets.coinbaseWallet.config.preference,options:"smartWalletOnly"};let e=c.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||c.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),xe(e);await ve("coinbase_wallet","coinbase_smart_wallet")},connectBaseAccount:async()=>{let e=c.connectors?.findWalletConnector("base_account","base_account");if(e)return xe(e);await ve("base_account","base_account")},initiateAccountTransfer:async({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,telegramWebAppData:a,farcasterEmbeddedAddress:o,oAuthUserInfo:s})=>{let l=await c.sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,telegramWebAppData:a,farcasterEmbeddedAddress:o,oAuthUserInfo:s});return x(l),l},inProgressAuthFlowRef:pe,inProgressLoginOrLinkMethodRef:ue};Lx=Fe.recoverEmbeddedWallet,Dx=Fe.recoverEmbeddedWallet;let Ue=r.useMemo((()=>({wallets:C,ready:re&&ce})),[C,re,ce]),Re=c.authFlow instanceof ln,Oe=!Y.headless&&Y.captchaEnabled&&!f&&(m||Re);/*#__PURE__*/return e.jsx(Mx.Provider,{value:!0,children:/*#__PURE__*/e.jsx(u.PrivyContext.Provider,{value:We,children:/*#__PURE__*/e.jsx(la.Provider,{value:le,children:/*#__PURE__*/e.jsx(Gs.Provider,{value:Ue,children:/*#__PURE__*/e.jsx(on,{...Y,children:/*#__PURE__*/e.jsxs(s.InternalPrivyContext.Provider,{value:Fe,children:[/*#__PURE__*/e.jsx(ru,{children:/*#__PURE__*/e.jsxs(Fi,{data:Q,setModalData:X,setInitialScreen:P,initialScreen:S,authenticated:f,open:h,children:[l.children,/*#__PURE__*/e.jsx(Nx,{customAuth:Y.customAuth}),Oe&&/*#__PURE__*/e.jsx(aa,{delayedExecution:!1}),/*#__PURE__*/e.jsx($l,{}),/*#__PURE__*/e.jsx(Sv,{disabled:Y.embeddedWallets.disableAutomaticMigration}),/*#__PURE__*/e.jsx(Al,{palette:Y.appearance.palette||{}}),!Y.render.standalone&&/*#__PURE__*/e.jsx(Ul,{open:h})]})}),/*#__PURE__*/e.jsx(Jl,{appId:l.appId,appClientId:l.clientId,clientAnalyticsId:c.clientAnalyticsId,origin:c.apiUrl,mfaMethods:v?.mfaMethods,mfaPromise:oe,mfaSubmitPromise:se,onLoad:G,onLoadFailed:()=>null}),Y.loginConfig.telegramAuthConfiguration&&
|
|
33
|
+
/*#__PURE__*/e.jsx(ba,{$if:!0,children:/*#__PURE__*/e.jsx(Ll,{scriptHost:l.apiUrl||Mt,botUsername:Y.loginConfig.telegramAuthConfiguration.botName})})]})})})})})})};exports.Address=Dl,exports.AppLogoContainer=Ba,exports.BlobbyFooter=Ia,exports.BottomSection=Ga,exports.ButtonLoader=po,exports.Captcha=aa,exports.CaptchaError=an,exports.Chip=Ip,exports.CloseButton=Ap,exports.Column=fx,exports.ConnectorManager=Di,exports.Container=$a,exports.CopyableText=ip,exports.CustomJwtAccountFlow=Ki,exports.EmbeddedWalletConnectingScreen=Gf,exports.EnrollLandingScreen=ix,exports.EnrollPasskey=lx,exports.EnrollTotp=vx,exports.EthereumWalletConnector=Nn,exports.FundingMethodSelectionScreen=jf,exports.GuestFlow=Gi,exports.Header=Ep,exports.IconWrapper=no,exports.Line=kr,exports.Loader=co,exports.LoginModal=Ul,exports.MfaAuthVerifyFlowScreen=Cl,exports.MfaShieldIcon=rx,exports.ModalFooter=Pa,exports.ModalHeader=Wa,exports.NetworkIcon=hg,exports.PrimaryButton=go,exports.PrivyClient=na,exports.PrivyProvider=({config:t,...n})=>{var i;if((()=>{if(r.useContext(Mx))throw new o.PrivyClientError("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&&"chrome-extension:"!==window.location.protocol)throw new o.PrivyClientError("Embedded wallet is only available over HTTPS");if("string"!=typeof(i=n.appId)||25!==i.length)throw new o.PrivyClientError("Cannot initialize the Privy provider with an invalid Privy app ID");Wx||(Wx=new na({appId:n.appId,appClientId:n.clientId,apiUrl:n.apiUrl}));let a=Object.assign({},t),s=r.useMemo((()=>new be.default({appId:n.appId,clientId:n.clientId,storage:kt,baseUrl:n.apiUrl,sdkVersion:"react-auth:2.22.0"})),[]);/*#__PURE__*/
|
|
34
|
+
return e.jsx(_i,{client:s,legacyClient:Wx,clientConfig:a,children:/*#__PURE__*/e.jsx(Gp,{children:/*#__PURE__*/e.jsx(Gx,{...n,client:Wx,privy:s})})})},exports.Row=sg,exports.Rows=og,exports.SOLANA_FUNDING_PLUGIN_ID=Lm,exports.SOLANA_LEDGER_PLUGIN_ID=Zp,exports.ScrollContainer=Sp,exports.SendTransactionScreen=Ev,exports.SignRequestScreen=Vw,exports.SolanaWalletConnector=oi,exports.SubTitle=Ha,exports.Subtitle=gm,exports.Title=za,exports.Title$1=fm,exports.UpdateEmailFlow=xt,exports.VERSION=Rt,exports.WALLET_PROXY_TIMEOUT=rr,exports.WalletCards=vp,exports.WalletConnector=jn,exports.WalletIcon=jp,exports.WalletInfoCard=Wm,exports.bufferFrom=Fr,exports.close=()=>{let e=Pp.getState().resolvers;e||console.warn("useActiveWalletStore: Called close while modal was not open"),Pp.setState({isModalOpen:!1}),e?.resolve({wallet:Pp.getState().wallet})},exports.detectCompletingOAuthFlow=Pr,exports.errorIndicatesMaxMfaRetries=fl,exports.errorIndicatesMfaTimeout=ml,exports.errorIndicatesMfaVerificationFailed=gl,exports.extractChainIdFromCAIP2=ac,exports.formatErc20TokenAmount=vg,exports.formatWalletAddress=Vr,exports.getAccessToken=Bx,exports.getCustomerAccessToken=function(){return Wx?Wx.getCustomerAccessToken():Promise.resolve(kt.get(Ot)||null)},exports.getDelegatedWalletsData=tc,exports.getEntropyDetailsForUser=mn,exports.getErc20Balance=Rm,exports.getErc20TokenInfo=ig,exports.getJsonRpcEndpointFromChain=$r,exports.getNativeCurrencyFromWei=Mo,exports.getRootWalletDataForDelegation=rc,exports.importWallet=Dm,exports.isBaseConnectedEthereumWallet=An,exports.isBaseConnectedSolanaWallet=ai,exports.isVersionedTransaction=Ko,exports.l=Rp,exports.open=async()=>{let e,t,r=new Promise(((r,n)=>{e=r,t=n}));return _p.setState({}),Pp.setState({isModalOpen:!0,resolvers:{resolve:e,reject:t}}),await r},exports.parseAdditionalSigners=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds}))),exports.prepareSiwsMessageWithNonce=Ur,exports.prepareSolanaFundingModalData=Wf,exports.s=kt,exports.setActiveWallet=Np,exports.shouldCreateEmbeddedEthWallet=yu,exports.shouldCreateEmbeddedSolWallet=gu,exports.signOrSendSolanaTransactionInternal=Nw,exports.stripUrlOAuthParamsAndRemoveStateCode=_r,exports.toActiveWalletKey=Mp,exports.transformOptionsToCamelCase=Vi,exports.transformResponseToSnakeCase=Pv,exports.updateBalance=(e,t,r)=>{_p.setState((n=>({[e]:{...n[e],[t]:r}})))},exports.useActiveWalletStore=Pp,exports.useAppConfig=Ni,exports.useBalance=(e,t)=>_p((r=>r[e]?.[t])),exports.useCaptcha=sn,exports.useCorePrivyStateStore=El,exports.useCreateWallet=Km,exports.useCreateWalletInternal=Vm,exports.useElementHeight=oa,exports.useEmitPrivyEvent=pa,exports.useIdentityToken=function(){let{identityToken:e}=Zi();return{identityToken:e}},exports.useImportWallet=Gm,exports.useIsModalOpen=()=>Pp((e=>e.isModalOpen)),exports.useIsServerConfigLoaded=Mi,exports.useJwtAuthFlowState=()=>_x((e=>e.jwtAuthFlowState)),exports.useLogout=_v,exports.useMfa=bl,exports.useMfaEnrollment=tx,exports.useMigrateWallets=Iv,exports.usePrivy=Ym,exports.usePrivyEventSubscription=da,exports.usePrivyModal=Ui,exports.useRecentlyUsedLogin=ou,exports.useRegisterMfaListener=ha,exports.useRegisterPlugin=(...e)=>{let{plugins:t}=r.useContext(Kp);r.useEffect((()=>{for(let r of e)t.current[r.id]=r;return()=>{for(let r of e)delete t.current[r.id]}}),[t])},exports.useSendTransaction=Mw,exports.useSignMessage=Qw,exports.useSolanaWallets=Xw,exports.useSyncJwtBasedAuthState=Px,exports.useWalletBalance=Fm,exports.useWallets=Ys;
|