@privy-io/expo 0.76.2 → 0.76.4

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.
@@ -0,0 +1,12 @@
1
+ import{b as _,c as M,e as l,f as wt,g as vt,h as ge}from"./chunk-K5SPDXVF.js";import{useEffect as Gr}from"react";import{create as Kr}from"zustand";var bt=Kr(()=>({status:"disconnected"})),he=()=>bt.getState().onNeedsRecovery,qr=e=>{Gr(()=>{bt.setState({onNeedsRecovery:e==null?void 0:e.onNeedsRecovery})},[e==null?void 0:e.onNeedsRecovery])};import{digest as Hr,randomUUID as Jr}from"expo-crypto";import $r from"@privy-io/js-sdk-core";var St={name:"@privy-io/expo",version:"0.76.4",description:"Expo client for the Privy Auth API",keywords:["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],homepage:"https://docs.privy.io",bugs:{url:"https://privy.io/slack"},license:"Apache-2.0",author:"privy.io",exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"},"./passkey":{require:"./dist/passkey.js",import:"./dist/esm/passkey.js",types:"./dist/passkey.d.ts"},"./smart-wallets":{require:"./dist/smart-wallets.js",import:"./dist/esm/smart-wallets.js",types:"./dist/smart-wallets.d.ts"},"./extended-chains":{require:"./dist/extended-chains.js",import:"./dist/esm/extended-chains.js",types:"./dist/extended-chains.d.ts"},"./ui":{require:"./dist/ui.js",import:"./dist/esm/ui.js",types:"./dist/ui.d.ts"},"./cards":{require:"./dist/cards.js",import:"./dist/esm/cards.js",types:"./dist/cards.d.ts"},"./connectors":{require:"./dist/connectors.js",import:"./dist/esm/connectors.js",types:"./dist/connectors.d.ts"}},main:"./dist/esm/index.js",source:"./src/index.ts",types:"./dist/index.d.ts",files:["dist/**/*","LICENSE","README.md"],scripts:{build:"tsup --clean --minify","check-types":"tsc --noEmit",clean:"rm -rf dist .turbo *.tsbuildinfo","clean:reset":"rm -rf dist .turbo node_modules *.tsbuildinfo",dev:"tsup --watch",format:"oxlint src --fix","generate-types":"tsup --dts-only",lint:"oxlint src",test:"jest"},browserslist:["defaults","node >= 18","not op_mini all"],dependencies:{"@privy-io/api-types":"catalog:","@privy-io/are-addresses-equal":"workspace:*","@privy-io/encoding":"workspace:*","@privy-io/js-sdk-core":"workspace:*","@privy-io/routes":"workspace:*","@scure/base":"^1.2.4","react-fast-compare":"^3.2.2",tweetnacl:"catalog:",zustand:"catalog:"},devDependencies:{oxlint:"catalog:package-new","oxlint-tsgolint":"catalog:package-new","@faker-js/faker":"catalog:","@privy-io/eslint-plugin-privy-rules":"workspace:*","@privy-io/tsconfig":"workspace:*","@simplewebauthn/types":"9.0.1","@solana/web3.js":"catalog:","@svgr/core":"^8.1.0","@svgr/plugin-jsx":"^8.1.0","@svgr/plugin-svgo":"^8.1.0","@testing-library/react-native":"^13.1.0","@tsconfig/node16-strictest-esm":"catalog:","@types/jest":"catalog:","@types/react":"catalog:",expo:"56.0.9","expo-apple-authentication":"56.0.4","expo-application":"56.0.3","expo-clipboard":"56.0.3","expo-crypto":"56.0.4","expo-linking":"56.0.13","expo-secure-store":"56.0.4","expo-web-browser":"56.0.5",jest:"catalog:","jest-expo":"56.0.4","lucide-react-native":"^0.474.0",react:"catalog:","react-native":"0.85.3","react-native-webview":"13.16.1","react-test-renderer":"19.2.3",tsup:"^6.2.3",typescript:"catalog:"},peerDependencies:{"@privy-io/expo-native-extensions":"workspace:*","expo-apple-authentication":"*","expo-application":"*","expo-clipboard":"*","expo-crypto":"*","expo-linking":"*","expo-secure-store":"*","expo-web-browser":"*",permissionless:"^0.2.47",react:"*","react-native":"*","react-native-passkeys":"catalog:","react-native-qrcode-styled":"0.3.3","react-native-safe-area-context":"*","react-native-svg":"*","react-native-webview":"*",viem:"catalog:"},peerDependenciesMeta:{permissionless:{optional:!0},viem:{optional:!0},"react-native-svg":{optional:!0},"expo-apple-authentication":{optional:!0},"expo-clipboard":{optional:!0},"expo-linking":{optional:!0},"expo-secure-store":{optional:!0},"expo-web-browser":{optional:!0},"react-native-qrcode-styled":{optional:!0},"react-native-safe-area-context":{optional:!0}},publishConfig:{access:"public"}};var Ct=({appId:e,clientId:t,storage:n=ge,supportedChains:r,baseUrl:i,logLevel:s,logger:o,sessions:a,plugins:d})=>{let c=a!=null&&a.mode?{mode:a.mode}:void 0;return new $r({appId:e,clientId:t,plugins:d,supportedChains:r,storage:vt(n),sdkVersion:`expo:${St.version}`,nativeAppIdentifier:wt(),crypto:{digest:Hr,randomUUID:Jr},baseUrl:i,logLevel:s,logger:o,sessions:c})};import{useCallback as pt,useContext as xs}from"react";import{PrivyClientError as Ps}from"@privy-io/js-sdk-core";import Z,{useState as L,useMemo as Es,createContext as _s,useCallback as Te,useRef as pe,useEffect as Ir,useContext as ks}from"react";import{AppState as Or,View as Ws}from"react-native";import{PrivyClientError as Lr}from"@privy-io/js-sdk-core";import Qr from"react-fast-compare";import{create as Yr}from"zustand";var we=Yr(()=>{}),Et=e=>we.setState(t=>Qr(t,e)?t:e),x=we.getState;import eo from"react";import{useCallback as Se,useEffect as to,useRef as ro,useState as oo}from"react";import{AppState as no}from"react-native";import io from"react-native-webview";import*as T from"expo-secure-store";function _t(e){return typeof e!="object"||e===null||!("event"in e&&typeof e.event=="string")||!("id"in e&&typeof e.id=="string")||!("data"in e&&typeof e.data=="object")||e.data===null?!1:e.event.startsWith("app:secure-storage:")}function kt(e){return l(this,null,function*(){switch(e.event){case"app:secure-storage:get":{let{key:t}=e.data,n=yield T.getItemAsync(ze(t),{keychainAccessible:T.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY}).catch(r=>(console.warn("Failed to get the value from secure store",r),null));return{event:e.event,id:e.id,data:{value:n}}}case"app:secure-storage:remove":{let{key:t}=e.data,n=yield T.deleteItemAsync(ze(t),{keychainAccessible:T.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY}).then(()=>!0).catch(r=>(console.warn("Failed to remove the value from secure store",r),!1));return{event:e.event,id:e.id,data:{success:n}}}case"app:secure-storage:set":{let{key:t,value:n}=e.data,r=yield T.setItemAsync(ze(t),n,{keychainAccessible:T.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY}).then(()=>!0).catch(i=>(console.warn("Failed to write the value to secure store",i),!1));return{event:e.event,id:e.id,data:{success:r}}}}})}var ze=e=>e.replaceAll(":","-");import Xr from"react-fast-compare";import{createStore as Zr,useStore as ve}from"zustand";var D=Zr()(()=>({user:null,storedUsers:[],proxyStatus:"loading"}));function b(){return D.getState().user}var Bs=D.subscribe.bind(D);function Ve(e){D.setState(({user:t})=>Xr(t,e)?{}:{user:e})}var Wt=e=>D.setState({storedUsers:e.users}),be=e=>D.setState({proxyStatus:e});function U(){return ve(D,e=>e.user)}function Hs(){return ve(D,e=>!!e.user)}function At(){return ve(D,e=>e.storedUsers)}function z(){return ve(D,e=>e.proxyStatus!=="loading")}var so={shouldUseAppBackedStorage:!0},ao=";",co=500,xt=({client:e,isClientReady:t})=>{let n=ro(null),[r,i]=oo(0);to(()=>{let c=no.addEventListener("change",u=>l(void 0,null,function*(){u==="background"?e.embeddedWallet.onBackground():u==="active"&&((yield e.embeddedWallet.ping(co))||(be("reloading"),e.embeddedWallet.reload()))}));return()=>c.remove()},[e]);let s=Se(c=>l(void 0,null,function*(){var m;let{data:u}=c.nativeEvent,p=JSON.parse(u);if(_t(p)){let g=yield kt(p);(m=n.current)==null||m.postMessage(JSON.stringify(g));return}e.embeddedWallet.onMessage(p)}),[e]),o=Se(c=>{e.logger.info(`[privy:webview] process error, ${c}`),be("reloading"),e.embeddedWallet.reload(),i(u=>u+1)},[e]),a=Se(()=>{o("content process terminated")},[o]),d=Se(()=>{o("render process gone")},[o]);return t?eo.createElement(io,{key:r,style:{flex:1},ref:c=>{c&&(e.setMessagePoster(c),n.current=c)},cacheEnabled:!1,cacheMode:"LOAD_NO_CACHE",injectedJavaScriptObject:so,injectedJavaScriptBeforeContentLoaded:ao,source:{uri:e.embeddedWallet.getURL()},webviewDebuggingEnabled:e.logger.level==="DEBUG",onLoad:()=>be("loaded"),onError:console.error,onMessage:s,onContentProcessDidTerminate:a,onRenderProcessGone:d}):null};import{useCallback as Ge,useEffect as It,useMemo as Ke}from"react";import{errorIndicatesRecoveryIsNeeded as uo,getAllUserEmbeddedSolanaWallets as po,getEntropyDetailsFromUser as Ot,PrivyClientError as re}from"@privy-io/js-sdk-core";import{getAllUserEmbeddedSolanaWallets as Ce,getEntropyDetailsFromAccount as Pt,getUserEmbeddedEthereumWallet as lo,PrivyClientError as q}from"@privy-io/js-sdk-core";function Ut(s){return l(this,arguments,function*({client:e,setSolanaWallet:t,createSolanaWalletCallbacks:n,setSolanaRecoveryFlowState:r,opts:i}){var o,a,d;t({status:"creating"});try{let{user:c}=yield e.user.get(),u=Ce(c),p=u[0],m=(o=lo(c))!=null?o:void 0;if(i!=null&&i.recoveryMethod&&i.recoveryMethod!=="privy")throw new q({code:"embedded_wallet_creation_error",error:"Unsupported recovery method for solana wallet."});if(!(i!=null&&i.createAdditional)&&p)throw new q({code:"embedded_wallet_creation_error",error:"Solana wallet already exists for this user. Set `createAdditional` to `true` to create another wallet"});let g,h;if(p){let f=m!=null?m:p,{entropyId:w,entropyIdVerifier:S}=Pt(f),E=Math.max(...u.map(P=>P.wallet_index),0)+1,k=yield e.embeddedWallet.add({chainType:"solana",entropyId:w,entropyIdVerifier:S,hdWalletIndex:E}),A=Ce(k.user).find(P=>P.wallet_index===E);if(!A)throw new q({error:"Embedded wallet account not created",code:"embedded_wallet_creation_error"});g=yield e.embeddedWallet.getSolanaProvider(A,w,S),h=k.user}else{let f=yield e.embeddedWallet.createSolana({ethereumAccount:m}),w=Ce(f.user).find(A=>A.wallet_index===0);if(!w)throw new q({error:"Embedded wallet account not created",code:"embedded_wallet_creation_error"});let S=m!=null?m:w,{entropyId:E,entropyIdVerifier:k}=Pt(S);g=yield e.embeddedWallet.getSolanaProvider(w,E,k),h=f.user}let v=Ce(h)[0];if(!v)throw new q({code:"embedded_wallet_creation_error",error:"Unknown error creating solana wallet"});return(d=(a=n.current)==null?void 0:a.onSuccess)==null||d.call(a,g),t({status:"connected",publicKey:v.public_key}),r({status:"initial"}),g}catch(c){let u=c instanceof Error?c.message:"Error creating embedded wallet";throw t({status:"error",error:u}),r({status:"initial"}),new q({code:"embedded_wallet_creation_error",error:u})}})}import{PrivyClientError as G}from"@privy-io/js-sdk-core";function Ee(u){return l(this,arguments,function*({client:e,account:t,setWallet:n,recoverWalletCallbacks:r,recoveryMethod:i,setRecoveryFlowState:s,password:o,recoveryKey:a,recoveryToken:d,recoverySecretOverride:c}){var p,m,g,h;if(!t)throw new G({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});switch(i){case"user-passcode":if(!o)throw new G({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!d)throw new G({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!c)throw new G({code:"embedded_wallet_recovery_error",error:"Record name is required for icloud recovery method"});break;case"recovery-encryption-key":if(!a)throw new G({code:"embedded_wallet_recovery_error",error:"recoveryKey is required for recovery-encryption-key recovery method"});break}n({status:"connecting",account:t});try{let v=yield e.embeddedWallet.getProvider(t,o,d,c,a);return n({status:"connected",provider:v,account:t}),s({status:"initial"}),(m=(p=r.current)==null?void 0:p.onSuccess)==null||m.call(p,v),v}catch(v){n({status:"needs-recovery",account:t}),s({status:"initial"});let f=new G({code:"embedded_wallet_recovery_error",error:v instanceof Error?v.message:"Error recovering embedded wallet"});throw(h=(g=r.current)==null?void 0:g.onError)==null||h.call(g,f),f}})}function Rt(a){return l(this,arguments,function*({client:e,account:t,entropyId:n,entropyIdVerifier:r,setSolanaWallet:i,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:o}){var d,c,u,p;i({status:"connecting"});try{let m=yield e.embeddedWallet.getSolanaProvider(t,n,r);return i({status:"connected",publicKey:m._publicKey}),o({status:"initial"}),(c=(d=s.current)==null?void 0:d.onSuccess)==null||c.call(d,m),m}catch(m){i({status:"needs-recovery"}),o({status:"initial"});let g=new G({code:"embedded_wallet_recovery_error",error:m instanceof Error?m.message:"Error recovering embedded wallet"});throw(p=(u=s.current)==null?void 0:u.onError)==null||p.call(u,g),g}})}var Lt=({client:e,solanaWallet:t,setSolanaWallet:n,setSolanaRecoveryFlowState:r,createSolanaWalletCallbacks:i,recoverSolanaWalletCallbacks:s})=>{let o=U(),a=Ke(()=>po(o),[o]),d=z(),c=Ke(()=>a.length===0?null:Ot(o,a[0]),[o,a]),u=Ke(()=>{let h=a.map(S=>{let E=Ot(o,S);return E?{account:S,entropy:E}:null});if(h.some(S=>S===null))return[];let v=void 0,f=void 0,w=void 0;return h.filter(S=>S!==null).map(({account:S,entropy:{entropyId:E,entropyIdVerifier:k}})=>({address:S.address,publicKey:S.address,walletIndex:S.wallet_index,getProvider:()=>e.embeddedWallet.getSolanaProvider(S,E,k,v,f,w,A=>l(void 0,null,function*(){var P;yield(P=he())==null?void 0:P(A)}))}))},[a,o,e]),p=Ge(h=>l(void 0,null,function*(){return yield Ut({client:e,setSolanaWallet:n,createSolanaWalletCallbacks:i,setSolanaRecoveryFlowState:r,opts:h})}),[e,i]),m=Ge(()=>l(void 0,null,function*(){if(!c)throw new re({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{entropyId:h,entropyIdVerifier:v}=c;return Rt({client:e,account:a[0],entropyId:h,entropyIdVerifier:v,setSolanaWallet:n,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:r})}),[e,c,a,s,r,n]),g=Ge(()=>l(void 0,null,function*(){if(!c)throw n({status:"not-created"}),new re({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});n(h=>h.status==="connected"?{status:"reconnecting"}:{status:"connecting"});try{let{entropyId:h,entropyIdVerifier:v}=c,f=yield e.embeddedWallet.getSolanaProvider(a[0],h,v);return n({status:"connected",publicKey:a[0].public_key}),f}catch(h){throw uo(h)?(n({status:"needs-recovery"}),new re({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):h instanceof Error?(n({status:"error",error:h.message}),new re({code:"unknown_embedded_wallet_error",error:h.message})):(n({status:"error",error:"Error loading embedded wallet"}),new re({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[a,e,c,n]);return It(()=>{if(!o&&t.status!=="disconnected")return n({status:"disconnected"});d&&g().catch(()=>{})},[d,o]),It(()=>{t.status==="error"&&t.error.includes("User must be logged in")&&g()},[t.status]),{create:p,recover:m,getProvider:g,wallets:u}};import{useCallback as ie,useEffect as jt,useMemo as Eo}from"react";import{getUserEmbeddedEthereumWallet as _o,getUserEmbeddedSolanaWallet as zt,isUnifiedWallet as ko,throwIfInvalidRecoveryUpgradePath as Wo}from"@privy-io/js-sdk-core";import{errorIndicatesRecoveryIsNeeded as Ao,PrivyClientError as R}from"@privy-io/js-sdk-core";import{getUserEmbeddedEthereumWallet as mo}from"@privy-io/js-sdk-core";import{PrivyClientError as B}from"@privy-io/js-sdk-core";function _e(p){return l(this,arguments,function*({client:e,setWallet:t,createWalletCallbacks:n,recoveryMethod:r,setRecoveryFlowState:i,password:s,recoveryKey:o,recoveryToken:a,recoverySecretOverride:d,iCloudRecordNameOverride:c,solanaAccount:u}){var g,h;switch(r){case"user-passcode":if(!s)throw new B({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"recovery-encryption-key":if(!o)throw new B({code:"embedded_wallet_recovery_error",error:"key is required for recovery-encryption-key recovery method"});break;case"google-drive":if(!a)throw new B({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!d||!c)throw new B({code:"embedded_wallet_recovery_error",error:"iCloud recovery failed due to inability to store credentials"});break}t({status:"creating",account:null});let m=r==="icloud"?"icloud-native":r;try{let{user:v}=yield e.embeddedWallet.create({password:s,recoveryMethod:m,recoveryKey:o,recoveryToken:a,recoverySecretOverride:d,iCloudRecordNameOverride:c,solanaAccount:u}),f=mo(v);if(!f)throw new B({error:"Embedded wallet account not created",code:"embedded_wallet_creation_error"});let w=yield e.embeddedWallet.getProvider(f);return(h=(g=n.current)==null?void 0:g.onSuccess)==null||h.call(g,w),t({status:"connected",provider:w,account:f}),i({status:"initial"}),w}catch(v){let f=v instanceof Error?v.message:"Error creating embedded wallet";throw t({status:"error",error:f,account:null}),i({status:"initial"}),new B({code:"embedded_wallet_creation_error",error:f})}})}import{Platform as Ft}from"react-native";import{PrivyClientError as N}from"@privy-io/js-sdk-core";import{Platform as yo}from"react-native";var Mt=new Set;function ke(e,{isDevelopment:t=__DEV__,reactNativeVersion:n=yo.constants.reactNativeVersion,warn:r=i=>console.warn(i)}={}){if(!t||Mt.has(e))return;let{major:i,minor:s,patch:o}=n;if(i>0||i===0&&s>=81)return;let d=`[Privy] Upcoming optional dependency change
2
+
3
+ This app uses React Native ${`${i}.${s}.${o}`}. A future @privy-io/expo release will make ${e} optional.
4
+
5
+ `,c=i===0&&s>=79?d+`Upgrade to Expo SDK 54 or React Native 0.81 when possible. If remaining on Expo SDK 53 or React Native 0.79\u20130.80, ensure metro, metro-config, and metro-runtime resolve to version 0.82.5 or newer and transformer.allowOptionalDependencies is enabled.
6
+
7
+ Check Metro with:
8
+ pnpm why metro metro-config metro-runtime
9
+ npm ls metro metro-config metro-runtime
10
+ yarn why metro
11
+
12
+ If these requirements cannot be met, keep ${e} installed.`:d+`Expo SDK 52 and React Native 0.78 or earlier cannot safely omit ${e}. Upgrade to Expo SDK 54 or React Native 0.81, or keep ${e} installed.`;Mt.add(e),r(c)}function Tt(){return l(this,null,function*(){ke("@privy-io/expo-native-extensions");try{return yield import("@privy-io/expo-native-extensions")}catch(e){throw new N({code:"configuration_error",error:"`@privy-io/expo-native-extensions` is not installed. Install it and rebuild the native app."})}})}function oe(r){return l(this,arguments,function*({user:e,appId:t,client:n}){var a;if(Ft.OS==="android")throw new N({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let i=yield Tt(),s=yield n.recovery.icloudAuth.getICloudConfiguration("expo-ios");if(!(s==null?void 0:s.container_identifier))throw new N({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:d,iCloudRecordName:c}=yield i.writeRecoverySecretToICloud({containerId:s.container_identifier,appId:t,userId:e.id});return{recoverySecret:d,iCloudRecordName:c}}catch(d){if(d instanceof Error){let c=(a=d.message.split("Caused by: ")[1])!=null?a:"Error writing to iCloud";throw new N({code:"embedded_wallet_recovery_error",error:c})}throw new N({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}function We(r){return l(this,arguments,function*({walletAddress:e,client:t,chainType:n}){var c;if(Ft.OS==="android")throw new N({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let i=yield Tt(),o=(yield t.recovery.getRecoveryKeyMaterial(e,n)).icloud_record_name;if(!o)throw new N({code:"embedded_wallet_recovery_error",error:"iCloud recovery not properly backed up."});let a=yield t.recovery.icloudAuth.getICloudConfiguration("expo-ios"),d=a==null?void 0:a.container_identifier;if(!d)throw new N({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:u}=yield i.readRecoverySecretFromICloud({containerId:d,recordName:o});return{recoverySecret:u}}catch(u){if(u instanceof Error){let p=(c=u.message.split("Caused by: ")[1])!=null?c:"Error writing to iCloud";throw new N({code:"embedded_wallet_recovery_error",error:p})}throw new N({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}import*as K from"expo-linking";import*as Dt from"expo-web-browser";import{Platform as Nt}from"react-native";import{PrivyClientError as J}from"@privy-io/js-sdk-core";import Pa from"react-fast-compare";import{PrivyApiError as fo,PrivyClientError as go}from"@privy-io/js-sdk-core";function C(e){return e instanceof Error||e instanceof fo||e instanceof go?e:typeof e=="string"?new Error(e):new Error("Unknown error")}var H=e=>new Promise(t=>setTimeout(t,e));import{useEffect as ho,useRef as wo}from"react";import{AppState as qe}from"react-native";function Ae(){let e=wo(qe.currentState);ho(()=>qe.addEventListener("change",r=>{e.current=r}).remove,[]);function t(){return qe.currentState}return{appState:e,getCurrentAppState:t}}function ne(i){return l(this,arguments,function*({provider:e,redirectUri:t,client:n,onError:r}){try{let s;switch(e){case"google-drive":{let{url:c}=yield n.recovery.auth.generateURL(K.createURL(t||"/"));s=c;break}default:throw new J({error:"OAuth invalid provider",code:"embedded_wallet_recovery_error"})}let o=yield Dt.openAuthSessionAsync(s);if(Nt.OS==="android")return;if(o.type!=="success")throw new J({error:"Recovery OAuth session failed",code:"embedded_wallet_recovery_error"});let{queryParams:a}=K.parse(o.url),d;switch(e){case"google-drive":{let{privy_oauth_state:c,privy_oauth_code:u}=a;if(!u||!c)throw new J({error:"Recovery OAuth invalid credentials",code:"embedded_wallet_recovery_error"});d=yield xe({oAuthCode:u,oAuthState:c,client:n});break}default:throw new J({error:"Recovery OAuth invalid provider",code:"embedded_wallet_recovery_error"})}return d}catch(s){throw r==null||r(C(s)),s}})}function xe(r){return l(this,arguments,function*({oAuthCode:e,oAuthState:t,client:n}){let{access_token:i}=yield n.recovery.auth.authorize(e,t);if(!i)throw new J({error:"OAuth invalid credentials",code:"login_with_oauth_returned_with_invalid_credentials"});return i})}var vo=2*60*1e3;function bo(e){let t;return new Promise((n,r)=>{t=K.addEventListener("url",s=>l(this,[s],function*({url:i}){if(!i)return;let{queryParams:o}=K.parse(i),{privy_oauth_state:a,privy_oauth_code:d}=o!=null?o:{};if(typeof d!="string"||typeof a!="string")return;let c=yield xe({client:e,oAuthCode:d,oAuthState:a});n(c)})),setTimeout(()=>{r(new J({code:"embedded_wallet_set_recovery_error",error:"Failed to complete Google Drive recovery flow"}))},vo)}).finally(()=>{t==null||t.remove()})}function Pe(e){return l(this,null,function*(){let t;Nt.OS==="android"&&(t=bo(e));let n=yield ne({provider:"google-drive",client:e});return n!=null?n:yield t})}import{getUserEmbeddedWallet as So,PrivyClientError as Co}from"@privy-io/js-sdk-core";function Ue(s){return l(this,arguments,function*({client:e,recoveryInput:t,setWalletRecoveryCallbacks:n,setRecoveryFlowState:r,setWallet:i}){var o,a,d,c;try{let{provider:u,user:p}=yield e.embeddedWallet.setRecovery(t),m=u,g=So(p);return i({status:"connected",provider:m,account:g}),(a=(o=n.current)==null?void 0:o.onSuccess)==null||a.call(o,m),r({status:"initial"}),m}catch(u){let p=new Co({code:"embedded_wallet_set_recovery_error",error:u instanceof Error?u.message:"Error setting password on embedded wallet"});throw(c=(d=n.current)==null?void 0:d.onError)==null||c.call(d,p),r({status:"initial"}),p}})}function Vt(e){return e===void 0?{recoveryMethod:"privy"}:typeof e=="string"?{recoveryMethod:"user-passcode",password:e}:e.recoveryMethod==="user-passcode"?{recoveryMethod:"user-passcode",password:e.password}:e.recoveryMethod==="recovery-encryption-key"?{recoveryMethod:"recovery-encryption-key",recoveryKey:e.recoveryKey}:{recoveryMethod:e.recoveryMethod}}var Gt=({client:e,appId:t,wallet:n,setWallet:r,setRecoveryFlowState:i,createWalletCallbacks:s,recoverWalletCallbacks:o,setWalletRecoveryCallbacks:a})=>{let d=U(),c=Eo(()=>_o(d),[d]),u=z(),p=ie(f=>l(void 0,null,function*(){var me,ye;if(c)throw new R({error:"This user already has an embedded wallet",code:"embedded_wallet_already_exists"});let{user:w}=yield e.user.get(),{password:S,recoveryMethod:E,recoveryKey:k}=Vt(f),A,P,F;if(E==="google-drive"&&(A=yield ne({provider:E,client:e,onError:(me=s.current)==null?void 0:me.onError}),i({status:"creating-wallet"}),!A))return null;if(E==="icloud"){if(!w)throw new R({code:"embedded_wallet_recovery_error",error:"User must be loaded before creating a wallet with iCloud."});let{recoverySecret:De,iCloudRecordName:te}=yield oe({user:w,appId:t,client:e});P=De,F=te}return yield _e({client:e,setWallet:r,createWalletCallbacks:s,recoveryMethod:E,recoveryKey:k,setRecoveryFlowState:i,password:S,recoverySecretOverride:P,iCloudRecordNameOverride:F,solanaAccount:(ye=zt(w))!=null?ye:void 0})}),[e,c,d]),m=ie(f=>l(void 0,null,function*(){var E;if(n.status!=="connected")throw new R({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"});if(!c)throw new R({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(zt(d))throw new R({code:"embedded_wallet_set_recovery_error",error:"Cannot set user-controlled recovery for a user with an embedded Solana wallet."});if(ko(c))throw new R({code:"unsupported_wallet_type",error:"Embedded 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"});Wo({currentRecoveryMethod:c.recovery_method,upgradeToRecoveryMethod:f.recoveryMethod});let w,S;switch(f.recoveryMethod){case"privy":S=M(_({},f),{wallet:c});break;case"user-passcode":S=M(_({},f),{wallet:c,password:f.password});break;case"google-drive":if(w=yield ne({provider:f.recoveryMethod,client:e,onError:(E=a.current)==null?void 0:E.onError}),i({status:"upgrading-recovery"}),!w)return null;S={recoveryMethod:"google-drive",wallet:c,recoveryAccessToken:w};break;case"icloud":if(!d)throw new R({code:"embedded_wallet_recovery_error",error:"User must be loaded before backing up to iCloud."});let{recoverySecret:k,iCloudRecordName:A}=yield oe({user:d,appId:t,client:e});S={recoveryMethod:"icloud-native",recoverySecretOverride:k,iCloudRecordNameOverride:A,wallet:c};break;default:throw new R({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}return Ue({client:e,recoveryInput:S,setWalletRecoveryCallbacks:a,setRecoveryFlowState:i,setWallet:r})}),[e,c,n.status,d]),g=ie(f=>l(void 0,null,function*(){return m({recoveryMethod:"user-passcode",password:f})}),[e,c,n.status]),h=ie(f=>l(void 0,null,function*(){var P;if(!c)throw new R({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{password:w,recoveryMethod:S,recoveryKey:E}=Vt(f),k,A;if(S==="google-drive"&&(k=yield ne({provider:S,client:e,onError:(P=o.current)==null?void 0:P.onError}),i({status:"recovering"}),!k))return null;if(S==="icloud"){if(!d)throw new R({code:"embedded_wallet_recovery_error",error:"User must be loaded before recovering via iCloud."});let{recoverySecret:F}=yield We({client:e,walletAddress:c.address});A=F}return Ee({client:e,account:c,setWallet:r,recoverWalletCallbacks:o,recoveryMethod:S,setRecoveryFlowState:i,recoveryKey:E,password:w,recoveryToken:k,recoverySecretOverride:A})}),[e,c]),v=ie(()=>l(void 0,null,function*(){if(!c)throw r({status:"not-created",account:null}),new R({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});r(f=>f.status==="connected"?{status:"reconnecting",account:c}:{status:"connecting",account:c});try{let f=yield e.embeddedWallet.getProvider(c);return r({status:"connected",provider:f,account:c}),f}catch(f){throw Ao(f)?(r({status:"needs-recovery",account:c}),new R({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):f instanceof Error?(r({status:"error",error:f.message,account:c}),new R({code:"unknown_embedded_wallet_error",error:f.message})):(r({status:"error",error:"Error loading embedded wallet",account:c}),new R({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,c]);return jt(()=>{if(!d&&n.status!=="disconnected")return r({status:"disconnected",account:null});u&&v().catch(()=>{})},[u,d,c]),jt(()=>{n.status==="error"&&n.error.includes("User must be logged in")&&v()},[n.status]),{create:p,recover:h,setPassword:g,setRecovery:m,getProvider:v}};import{useEffect as xo,useState as Po}from"react";import{PrivyClientError as Kt}from"@privy-io/js-sdk-core";var qt=({client:e,isReady:t})=>{let n=U(),r=we(o=>o==null?void 0:o.customAuth),[i,s]=Po({status:"initial"});return xo(()=>{(()=>l(void 0,null,function*(){if(!(r!=null&&r.enabled)){s({status:"not-enabled"});return}s({status:"loading"});let{getCustomAccessToken:a,isLoading:d}=r;if(!(!t||d))try{let c=yield a();if(!c&&n){yield e.auth.logout(),s({status:"done"});return}if(!c){s({status:"done"});return}if(n){s({status:"done"});return}let u=x();if(!(yield e.auth.customProvider.syncWithToken(c,{embedded:u==null?void 0:u.embedded}))){yield e.auth.logout(),s({status:"error",error:new Kt({error:"Failed to sync with custom auth provider",code:"third_party_auth_error"})});return}s({status:"done"})}catch(c){if(s({status:"error",error:c}),n)throw yield e.auth.logout(),new Kt({error:"Third-party auth failed",code:"third_party_auth_error"})}}))()},[e,n,t,r==null?void 0:r.enabled,r==null?void 0:r.getCustomAccessToken,r==null?void 0:r.isLoading]),{customAuthState:i,customAuthStateIsSettled:i.status!=="loading"&&i.status!=="initial"}};import*as $ from"expo-linking";import{useCallback as Uo,useEffect as Ro,useMemo as Io}from"react";import{Platform as Oo}from"react-native";import{getUserEmbeddedSolanaWallet as Lo,getUserEmbeddedWallet as Mo}from"@privy-io/js-sdk-core";var Bt=({client:e,createWalletCallbacks:t,recoverWalletCallbacks:n,setWalletRecoveryCallbacks:r,recoveryFlowState:i,oAuthState:s,setRecoveryFlowState:o,setWallet:a,appStateVisible:d})=>{let c=$.useURL(),u=U(),p=Io(()=>Mo(u),[u]),m=z(),g=Uo(h=>{var f,w,S,E;let v=C(h);i.status==="creating-wallet"?(w=(f=t.current).onError)==null||w.call(f,C(v)):(E=(S=n.current).onError)==null||E.call(S,C(v)),o({status:"initial"})},[i]);return Ro(()=>{function h(){return l(this,null,function*(){var S;if(!c&&i.status!=="initial"&&d&&g(new Error("Recovery OAuth session failed")),!c||i.status==="initial"||s.status!=="initial"||!d||!m)return;let{queryParams:v}=$.parse(c),{privy_oauth_state:f,privy_oauth_code:w}=v;if(!(!w||!f)){yield $.openURL(c.split("?")[0]);try{let E=yield xe({oAuthCode:w,oAuthState:f,client:e});if(i.status==="creating-wallet"){let k=(S=Lo(u))!=null?S:void 0;yield _e({client:e,setWallet:a,createWalletCallbacks:t,recoveryMethod:"google-drive",setRecoveryFlowState:o,recoveryToken:E,solanaAccount:k})}else if(i.status==="upgrading-recovery"){if(!p)throw new Error("Embedded wallet not found");yield Ue({client:e,recoveryInput:{recoveryMethod:"google-drive",wallet:p,recoveryAccessToken:E},setWalletRecoveryCallbacks:r,setRecoveryFlowState:o,setWallet:a})}else yield Ee({client:e,account:p,setWallet:a,recoverWalletCallbacks:n,recoveryMethod:"google-drive",setRecoveryFlowState:o,recoveryToken:E})}catch(E){g(E)}}})}Oo.OS==="android"&&h()},[c,i.status,d,m])};import{useEffect as To}from"react";import{Platform as Be}from"react-native";var Fo="sdk_initialize";function Ht(){let{major:e,minor:t,patch:n,prerelease:r}=Be.constants.reactNativeVersion;return{name:Fo,properties:{reactNativeVersion:`${e}.${t}.${n}${r!=null?`-${r}`:""}`,operatingSystem:`${Be.OS}:${Be.Version}`}}}var Jt=({client:e,isUserInitialized:t,setIsUserInitialized:n,setError:r})=>{To(()=>{t||(()=>l(void 0,null,function*(){try{yield e.initialize(),e.track(Ht())}catch(s){r(s instanceof Error?s:new Error(String(s)))}try{yield e.user.get()}catch(s){}finally{n(!0)}}))()},[e,t,r,n])};import{useEffect as Ss,useRef as Cs}from"react";import{useCallback as He,useContext as Do}from"react";import{PrivyClientError as No}from"@privy-io/js-sdk-core";var Dc=e=>{let{client:t,setSiweState:n,siweState:r}=Do(y),i=He(a=>{var c;let d=C(a);return n({status:"error",error:d}),(c=e==null?void 0:e.onError)==null||c.call(e,d),d},[e==null?void 0:e.onError]),s=He(u=>l(void 0,[u],function*({wallet:a,from:{domain:d,uri:c}}){var p;try{n({status:"generating-message"});let m=yield t.auth.siwe.init(a,d,c);return n({status:"awaiting-signature"}),(p=e==null?void 0:e.onGenerateMessage)==null||p.call(e,m.message),m.message}catch(m){throw i(m)}}),[t,i,e==null?void 0:e.onGenerateMessage]);return{loginWithSiwe:He(u=>l(void 0,[u],function*({signature:a,messageOverride:d,disableSignup:c}){var p;try{if(b())throw new No({code:"attempted_login_with_siwe_while_already_logged_in",error:"Already logged in, use `useLinkWithSiwe` if you are trying to link a wallet to an existing account"});n({status:"submitting-signature"});let g=x(),h=yield t.auth.siwe.loginWithSiwe(a,void 0,d,c?"no-signup":"login-or-sign-up",{embedded:g==null?void 0:g.embedded});return n({status:"done"}),(p=e==null?void 0:e.onSuccess)==null||p.call(e,h.user,h.is_new_user),h.user}catch(m){throw i(m)}}),[t,i,e==null?void 0:e.onSuccess]),generateSiweMessage:s,state:r}};import{useCallback as $t}from"react";import{createSiwsMessage as zo,PrivyClientError as Vo}from"@privy-io/js-sdk-core";import{useContext as jo}from"react";var W=()=>{let{client:e}=jo(y);return e};var $c=()=>{let e=W(),t=$t(o=>l(void 0,[o],function*({wallet:{address:r},from:{domain:i,uri:s}}){try{let{nonce:a}=yield e.auth.siws.fetchNonce({address:r});return{message:zo({address:r,domain:i,uri:s,nonce:a})}}catch(a){throw C(a)}}),[e]),n=$t(a=>l(void 0,[a],function*({signature:r,message:i,wallet:{walletClientType:s,connectorType:o}={}}){try{if(!b())throw new Vo({code:"attempted_link_siws_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiws` to login with a wallet"});let{user:c}=yield e.auth.siws.link({signature:r,message:i,walletClientType:s,connectorType:o});return c}catch(d){throw C(d)}}),[e]);return{generateMessage:t,link:n}};import{useCallback as Qt}from"react";import{createSiwsMessage as Go,PrivyClientError as Ko}from"@privy-io/js-sdk-core";var nd=()=>{let e=W(),t=Qt(o=>l(void 0,[o],function*({wallet:{address:r},from:{domain:i,uri:s}}){try{let{nonce:a}=yield e.auth.siws.fetchNonce({address:r});return{message:Go({address:r,domain:i,uri:s,nonce:a})}}catch(a){throw C(a)}}),[e]),n=Qt(d=>l(void 0,[d],function*({signature:r,message:i,wallet:{walletClientType:s,connectorType:o}={},disableSignup:a}){try{if(b())throw new Ko({code:"attempted_login_with_siws_while_already_logged_in",error:"Already logged in, use `useLinkWithSiws` if you are trying to link a wallet to an existing account"});let u=x();return(yield e.auth.siws.login({signature:r,message:i,walletClientType:s,connectorType:o,mode:a?"no-signup":"login-or-sign-up",opts:{embedded:u==null?void 0:u.embedded}})).user}catch(c){throw C(c)}}),[e]);return{generateMessage:t,login:n}};import{useCallback as Yt,useContext as qo}from"react";import{PrivyClientError as Bo}from"@privy-io/js-sdk-core";var pd=e=>{let{client:t}=qo(y),n=Yt(i=>{var o;let s=C(i);return(o=e==null?void 0:e.onError)==null||o.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkWallet:Yt(s=>l(void 0,[s],function*({address:i}){var o;try{if(!b())throw new Bo({code:"attempted_unlink_siwe_before_logged_in",error:"Must be logged in to unlink a wallet, Use `useLoginWithSiwe` to login with a wallet"});let{user:d}=yield t.auth.siwe.unlinkWallet(i);return(o=e==null?void 0:e.onSuccess)==null||o.call(e,d),d}catch(a){throw n(a)}}),[t,n,e==null?void 0:e.onSuccess])}};import{useCallback as Je,useContext as Ho,useState as Jo}from"react";import{PrivyClientError as Xt}from"@privy-io/js-sdk-core";var bd=e=>{let[t,n]=Jo(""),{client:r,otpState:i,setOtpState:s}=Ho(y),o=Je(c=>{var p;let u=C(c);return s({status:"error",error:u}),(p=e==null?void 0:e.onError)==null||p.call(e,u),u},[e,s]),a=Je(u=>l(void 0,[u],function*({email:c}){var p;n(c);try{s({status:"sending-code"});let m=yield r.auth.email.sendCode(c);return s({status:"awaiting-code-input"}),(p=e==null?void 0:e.onSendCodeSuccess)==null||p.call(e,{email:c}),m}catch(m){throw o(m)}}),[r,o,e,s]),d=Je(p=>l(void 0,[p],function*({code:c,email:u}){var m;try{if(!b())throw new Xt({code:"attempted_link_email_before_logged_in",error:"Must be logged in to link an email, Use `useLoginWithEmail` to login with email"});let h=u||t;if(!h)throw new Xt({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `linkWithCode`"});s({status:"submitting-code"});let{user:v}=yield r.auth.email.linkWithCode(h,c);return s({status:"done"}),(m=e==null?void 0:e.onLinkSuccess)==null||m.call(e,v),v}catch(g){throw o(g)}}),[t,s,r,e,o]);return{sendCode:a,linkWithCode:d,state:i}};import{useCallback as Zt,useContext as $o}from"react";var Wd=e=>{let{client:t}=$o(y),n=Zt(i=>{var o;let s=C(i);return(o=e==null?void 0:e.onError)==null||o.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkEmail:Zt(s=>l(void 0,[s],function*({email:i}){var o;try{let{user:a}=yield t.auth.email.unlink(i);return(o=e==null?void 0:e.onSuccess)==null||o.call(e,a),a}catch(a){throw n(a)}}),[t,e==null?void 0:e.onSuccess,n])}};import{useCallback as $e,useContext as Qo,useState as Yo}from"react";import{PrivyClientError as er}from"@privy-io/js-sdk-core";var Md=e=>{let[t,n]=Yo(""),{client:r,otpState:i,setOtpState:s}=Qo(y),o=$e(c=>{var p;let u=C(c);return s({status:"error",error:u}),(p=e==null?void 0:e.onError)==null||p.call(e,u),u},[e,s]),a=$e(u=>l(void 0,[u],function*({email:c}){var p;n(c);try{s({status:"sending-code"});let m=yield r.auth.email.sendCode(c);return s({status:"awaiting-code-input"}),(p=e==null?void 0:e.onSendCodeSuccess)==null||p.call(e,{email:c}),m}catch(m){throw o(m)}}),[r,o,e,s]),d=$e(m=>l(void 0,[m],function*({code:c,email:u,disableSignup:p}){var g;try{if(b()&&!r.isMultiUserModeEnabled)throw new er({code:"attempted_login_with_email_while_already_logged_in",error:"Already logged in, use `useLinkWithEmail` if you are trying to link an email to an existing account"});let v=u||t;if(!v)throw new er({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `loginWithCode`"});s({status:"submitting-code"});let f=x(),w=yield r.auth.email.loginWithCode(v,c,p?"no-signup":"login-or-sign-up",{embedded:f==null?void 0:f.embedded});return s({status:"done"}),(g=e==null?void 0:e.onLoginSuccess)==null||g.call(e,w.user,w.is_new_user),w==null?void 0:w.user}catch(h){throw o(h)}}),[t,s,r,e,o]);return{sendCode:a,loginWithCode:d,state:i}};import{useCallback as Qe,useContext as Xo,useState as Zo}from"react";import{PrivyClientError as tr}from"@privy-io/js-sdk-core";var Gd=e=>{let[t,n]=Zo(""),{client:r,otpState:i,setOtpState:s}=Xo(y),o=Qe(c=>{var p;let u=C(c);return s({status:"error",error:u}),(p=e==null?void 0:e.onError)==null||p.call(e,u),u},[e,s]),a=Qe(u=>l(void 0,[u],function*({phone:c}){var p;n(c);try{s({status:"sending-code"});let m=yield r.auth.phone.sendCode(c);return s({status:"awaiting-code-input"}),(p=e==null?void 0:e.onSendCodeSuccess)==null||p.call(e,{phone:c}),m}catch(m){throw o(m)}}),[r,o,e,s]),d=Qe(p=>l(void 0,[p],function*({code:c,phone:u}){var m;try{if(!b())throw new tr({code:"attempted_link_sms_before_logged_in",error:"Must be logged in to link a phone number, Use `useLoginWithSMS` to login with a phone number"});if(!(u||t))throw new tr({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `linkWithCode`"});s({status:"submitting-code"});let{user:v}=yield r.auth.phone.linkWithCode(u||t,c);return s({status:"done"}),(m=e==null?void 0:e.onLinkSuccess)==null||m.call(e,v),v}catch(g){throw o(g)}}),[t,s,r,e,o]);return{sendCode:a,linkWithCode:d,state:i}};import{useCallback as Ye,useContext as en,useState as tn}from"react";import{PrivyClientError as rr}from"@privy-io/js-sdk-core";var Xd=e=>{let[t,n]=tn(""),{client:r,otpState:i,setOtpState:s}=en(y),o=Ye(c=>{var p;let u=C(c);return s({status:"error",error:u}),(p=e==null?void 0:e.onError)==null||p.call(e,u),u},[e,s]),a=Ye(u=>l(void 0,[u],function*({phone:c}){var p;n(c);try{s({status:"sending-code"});let m=yield r.auth.phone.sendCode(c);return s({status:"awaiting-code-input"}),(p=e==null?void 0:e.onSendCodeSuccess)==null||p.call(e,{phone:c}),m}catch(m){throw o(m)}}),[r,o,e,s]),d=Ye(m=>l(void 0,[m],function*({code:c,phone:u,disableSignup:p}){var g;try{if(b())throw new rr({code:"attempted_login_with_sms_while_already_logged_in",error:"Already logged in, use `useLinkWithSMS` if you are trying to link a phone number to an existing account"});if(!(u||t))throw new rr({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `loginWithCode`"});s({status:"submitting-code"});let f=x(),w=yield r.auth.phone.loginWithCode(u||t,c,p?"no-signup":"login-or-sign-up",{embedded:f==null?void 0:f.embedded});return s({status:"done"}),(g=e==null?void 0:e.onLoginSuccess)==null||g.call(e,w.user,w.is_new_user),w==null?void 0:w.user}catch(h){throw o(h)}}),[t,s,r,e,o]);return{sendCode:a,loginWithCode:d,state:i}};import*as Re from"expo-linking";import{useCallback as Xe,useContext as rn,useRef as on}from"react";import{PrivyClientError as se}from"@privy-io/js-sdk-core";var sl=e=>{let{appState:t,getCurrentAppState:n}=Ae(),{client:r,farcasterState:i,setFarcasterState:s}=rn(y),o=on(!1),a=Xe(u=>{var m;let p=C(u);return s({status:"error",error:p}),(m=e==null?void 0:e.onError)==null||m.call(e,p),p},[e==null?void 0:e.onError,s]),d=Xe(()=>{o.current=!0},[]);return{linkWithFarcaster:Xe((g,...h)=>l(void 0,[g,...h],function*({relyingParty:u,redirectUrl:p},m={pollAttempts:10,pollIntervalMs:1e3}){var v;try{let f=b();if(o.current=!1,!f)throw new se({code:"attempted_link_farcaster_before_logged_in",error:"Must be logged in to link a Farcaster account."});s({status:"generating-uri"});let{connect_uri:w,channel_token:S}=yield r.auth.farcaster.initializeAuth({relyingParty:u,redirectUrl:Re.createURL(p!=null?p:"/")});if(!w)throw new se({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!S)throw new se({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield Re.openURL(w),s({status:"polling-status"});let E=0;for(;E<m.pollAttempts;){if(o.current)throw new se({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(t.current!=="active"&&n()!=="active"){yield H(m.pollIntervalMs);continue}let k=yield r.auth.farcaster.getFarcasterStatus({channel_token:S});if(k.state==="completed"){s({status:"submitting-token"});let{user:A}=yield r.auth.farcaster.link(_({channel_token:S},k));return s({status:"done"}),(v=e==null?void 0:e.onSuccess)==null||v.call(e,A),A}E++,yield H(m.pollIntervalMs)}throw new se({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(f){throw a(f)}}),[r,e==null?void 0:e.onSuccess,a,s]),state:i,cancel:d}};import{useCallback as or,useContext as nn}from"react";var pl=e=>{let{client:t}=nn(y),n=or(i=>{var o;let s=C(i);return(o=e==null?void 0:e.onError)==null||o.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkFarcaster:or(s=>l(void 0,[s],function*({fid:i}){var o;try{let{user:a}=yield t.auth.farcaster.unlink({fid:i});return(o=e==null?void 0:e.onSuccess)==null||o.call(e,a),a}catch(a){throw n(a)}}),[t,e==null?void 0:e.onSuccess,n])}};import*as Ie from"expo-linking";import{useCallback as tt,useContext as sn,useRef as an}from"react";import{PrivyClientError as ae}from"@privy-io/js-sdk-core";var Sl=e=>{let{appState:t,getCurrentAppState:n}=Ae(),{client:r,farcasterState:i,setFarcasterState:s}=sn(y),o=an(!1),a=tt(u=>{var m;let p=C(u);return s({status:"error",error:p}),(m=e==null?void 0:e.onError)==null||m.call(e,p),p},[e==null?void 0:e.onError,s]),d=tt(()=>{o.current=!0},[]);return{loginWithFarcaster:tt((h,...v)=>l(void 0,[h,...v],function*({relyingParty:u,redirectUrl:p,disableSignup:m},g={pollAttempts:10,pollIntervalMs:1e3}){var f;try{if(o.current=!1,b())throw new ae({code:"attempted_login_with_farcaster_while_already_logged_in",error:"Already logged in, use `useLinkWithFarcaster` if you are trying to link farcaster to an existing account"});s({status:"generating-uri"});let{connect_uri:S,channel_token:E}=yield r.auth.farcaster.initializeAuth({relyingParty:u,redirectUrl:Ie.createURL(p!=null?p:"/")});if(!S)throw new ae({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!E)throw new ae({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield Ie.openURL(S),s({status:"polling-status"});let k=0;for(;k<g.pollAttempts;){if(o.current)throw new ae({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(t.current!=="active"&&n()!=="active"){yield H(g.pollIntervalMs);continue}let A=yield r.auth.farcaster.getFarcasterStatus({channel_token:E});if(A.state==="completed"){s({status:"submitting-token"});let P=x(),F=yield r.auth.farcaster.authenticate(_({channel_token:E,mode:m?"no-signup":"login-or-sign-up"},A),{embedded:P==null?void 0:P.embedded});return s({status:"done"}),(f=e==null?void 0:e.onSuccess)==null||f.call(e,F.user,F.is_new_user),F.user}k++,yield H(g.pollIntervalMs)}throw new ae({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(w){throw a(w)}}),[r,a,e==null?void 0:e.onSuccess,s,t]),state:i,cancel:d}};import{useCallback as nr,useContext as cn}from"react";import{create as dn}from"zustand";import{PrivyClientError as ln}from"@privy-io/js-sdk-core";var rt=dn(()=>({status:"initial"})),V=e=>rt.setState(e,!0),un=rt.getState,Rl=()=>{let{client:e}=cn(y),t=rt(),n=nr(()=>l(void 0,null,function*(){try{V({status:"fetching-nonce"});let i=yield e.auth.farcasterV2.initializeAuth();return V({status:"awaiting-signature"}),i}catch(i){let s=C(i);throw V({status:"initial",error:s}),s}}),[e]),r=nr(i=>l(void 0,null,function*(){let s=un().status;try{if(b()){let c=new ln({code:"attempted_login_with_farcaster_while_already_logged_in",error:"Already logged in, use a link helper if you are trying to link farcaster to an existing account"});throw V({status:s,error:c}),c}V({status:"submitting-signature"});let a=x(),d=yield e.auth.farcasterV2.authenticate(i,{embedded:a==null?void 0:a.embedded});return V({status:"done"}),setTimeout(()=>V({status:"initial"}),1500),{user:d.user}}catch(o){let a=C(o);throw V({status:s,error:a}),a}}),[e]);return{init:n,login:r,state:t}};import{useContext as pn,useMemo as mn}from"react";import{delegatedActions as ir}from"@privy-io/js-sdk-core";var Tl=()=>{let{client:e}=pn(y);return mn(()=>({delegateWallet:ir.delegateWallet(e),revokeWallets:ir.revokeWallets(e)}),[e])};import{useContext as yn,useMemo as fn}from"react";import{depositAddress as ce}from"@privy-io/js-sdk-core";var Vl=()=>{let{client:e}=yn(y);return fn(()=>({getConfig:()=>ce.getConfig(e),generateDepositAddress:t=>ce.generateDepositAddress(_({privy:e},t)),getDeposit:t=>ce.getDeposit(_({privy:e},t)),waitForDeposit:t=>ce.waitForDeposit(_({privy:e},t)),waitForCompletion:t=>ce.waitForCompletion(_({privy:e},t))}),[e])};import{useContext as gn,useMemo as hn}from"react";import{cryptoDepositAccount as Oe}from"@privy-io/js-sdk-core";var Jl=()=>{let{client:e}=gn(y);return hn(()=>({createCryptoDepositAccount:t=>Oe.createCryptoDepositAccount(e,(...n)=>e.embeddedWallet.signWithUserSigner(...n),t),getQuote:t=>Oe.getCryptoDepositAccountQuote(e,t),getOrder:t=>Oe.getCryptoDepositAccountOrder(e,t),getNextOrder:t=>Oe.getCryptoDepositAccountNextOrder(e,t)}),[e])};import{useContext as bn,useMemo as Sn}from"react";import{addSessionSigners as Cn,removeSessionSigners as En}from"@privy-io/js-sdk-core";import{isEmbeddedWalletAccount as wn}from"@privy-io/js-sdk-core";function vn(e,t){return e.linked_accounts.filter(wn).find(n=>n.address===t)}function Q(e){let t=b();if(!t)throw new Error("User must be authenticated to perform this operation");let n=vn(t,e);if(!n)throw new Error(`No wallet found with address ${e}`);return n}var ou=()=>{let{client:e}=bn(y);return Sn(()=>({addSessionSigners:({address:t,signers:n})=>Cn({client:e,wallet:Q(t),signers:n.map(r=>({signer_id:r.signerId,override_policy_ids:r.policyIds}))}),removeSessionSigners:({address:t})=>En({client:e,wallet:Q(t)})}),[e])};import{useContext as _n,useMemo as kn}from"react";import{addSessionSigners as Wn,removeSessionSigners as An}from"@privy-io/js-sdk-core";var du=()=>{let{client:e}=_n(y);return kn(()=>({addSigners:({address:t,signers:n})=>Wn({client:e,wallet:Q(t),signers:n.map(r=>({signer_id:r.signerId,override_policy_ids:r.policyIds}))}),removeSigners:({address:t})=>An({client:e,wallet:Q(t)})}),[e])};import{useContext as xn,useMemo as Pn}from"react";import{PrivyClientError as ar}from"@privy-io/js-sdk-core";var fu=()=>{let{client:e}=xn(y);return Pn(()=>({sendCode(r){return l(this,arguments,function*({newEmailAddress:n}){sr(),yield e.auth.email.sendCode(n)})},updateEmail(i){return l(this,arguments,function*({newEmailAddress:n,code:r}){let{address:s}=sr(),{user:o}=yield e.auth.email.updateEmail({oldEmailAddress:s,newEmailAddress:n,code:r});return o})}}),[e])};function sr(){let t=Un().linked_accounts.find(n=>n.type==="email");if(!t)throw new ar({code:"attempted_update_email_without_a_linked_email",error:"Must have a linked email account already to update an email address. Use `useLinkEmail` to link an email account."});return t}function Un(){let e=b();if(!e)throw new ar({code:"attempted_update_before_logged_in",error:"Must be logged in to update a user profile."});return e}import{useContext as Rn,useMemo as In}from"react";import{PrivyClientError as dr}from"@privy-io/js-sdk-core";var Cu=()=>{let{client:e}=Rn(y);return In(()=>({sendCode(r){return l(this,arguments,function*({newPhoneNumber:n}){cr(),yield e.auth.phone.sendCode(n)})},updatePhone(i){return l(this,arguments,function*({newPhoneNumber:n,code:r}){let{phoneNumber:s}=cr(),{user:o}=yield e.auth.phone.updatePhone({oldPhoneNumber:s,newPhoneNumber:n,code:r});return o})}}),[e])};function cr(){let t=On().linked_accounts.find(n=>n.type==="phone");if(!t)throw new dr({code:"attempted_update_phone_without_a_linked_phone",error:"Must have a linked phone account already to update a phone number. Use `useLinkSMS` to link a phone number."});return t}function On(){let e=b();if(!e)throw new dr({code:"attempted_update_before_logged_in",error:"Must be logged in to update a user profile."});return e}import*as pr from"expo-linking";import{useCallback as Mn,useContext as Fn,useMemo as Tn}from"react";import{crossApp as Dn,PrivyClientError as Nn}from"@privy-io/js-sdk-core";import*as ur from"expo-linking";import*as de from"expo-web-browser";import{PrivyClientError as lr}from"@privy-io/js-sdk-core";var j=(e,t)=>l(void 0,null,function*(){let n=yield de.openAuthSessionAsync(e,t,{createTask:!1});if(n.type!=="success")throw n.type===de.WebBrowserResultType.CANCEL||n.type===de.WebBrowserResultType.DISMISS?new lr({error:"OAuth session was cancelled",code:"oauth_session_failed"}):new lr({error:"OAuth session failed",code:"oauth_session_failed"});return Ln(n.url)});function Ln(e){let{queryParams:t}=ur.parse(e);return t}var Lu=()=>{let{client:e}=Fn(y),t=Tn(()=>Dn.loginWithCrossAppAuth({client:e,openAuthSession:j}),[e]);return{loginWithCrossApp:Mn(s=>l(void 0,[s],function*({appId:r,redirectUri:i}){if(b())throw new Nn({code:"attempted_login_with_cross_app_while_already_logged_in",error:"Already logged in, use `linkCrossAppAccount` if you are trying to link a cross app account to an existing account"});let a=x(),{user:d}=yield t({providerAppId:r,redirectUrl:pr.createURL(i||"/"),loginOptions:{embedded:a==null?void 0:a.embedded}});return{user:d}}),[t])}};import*as mr from"expo-linking";import{useCallback as jn,useContext as zn,useMemo as Vn}from"react";import{crossApp as Gn,PrivyClientError as Kn}from"@privy-io/js-sdk-core";var Vu=()=>{let{client:e}=zn(y),t=Vn(()=>Gn.linkWithCrossAppAuth({client:e,openAuthSession:j}),[e]);return{linkWithCrossApp:jn(s=>l(void 0,[s],function*({appId:r,redirectUri:i}){if(!b())throw new Kn({code:"attempted_link_cross_app_before_logged_in",error:"Must be logged in to link a cross app account, Use `loginWithCrossAppAccount` to login with cross app"});return{user:yield t({providerAppId:r,redirectUrl:mr.createURL(i||"/")})}}),[t])}};import*as fr from"expo-linking";import{useContext as qn,useMemo as yr}from"react";import{crossApp as Bn}from"@privy-io/js-sdk-core";var Qu=()=>{let{client:e}=qn(y),t=yr(()=>Bn.wallet.signMessage({client:e,openAuthSession:j}),[e]);return yr(()=>({signMessage:({address:n,message:r,redirectUri:i="/"})=>t({user:b(),address:n,message:r,redirectUrl:fr.createURL(i)})}),[t])};import*as hr from"expo-linking";import{useContext as Hn,useMemo as gr}from"react";import{crossApp as Jn}from"@privy-io/js-sdk-core";var op=()=>{let{client:e}=Hn(y),t=gr(()=>Jn.wallet.signTypedData({client:e,openAuthSession:j}),[e]);return gr(()=>({signTypedData:({address:n,typedData:r,redirectUri:i="/"})=>t({user:b(),address:n,typedData:r,redirectUrl:hr.createURL(i)})}),[t])};import*as vr from"expo-linking";import{useContext as $n,useMemo as wr}from"react";import{crossApp as Qn}from"@privy-io/js-sdk-core";var lp=()=>{let{client:e}=$n(y),t=wr(()=>Qn.wallet.sendTransaction({client:e,openAuthSession:j}),[e]);return wr(()=>({sendTransaction:({address:n,transaction:r,redirectUri:i="/"})=>t({user:b(),address:n,transaction:r,redirectUrl:vr.createURL(i)})}),[t])};import{useCallback as Yn,useContext as Xn}from"react";import{getUserEmbeddedEthereumWallet as Zn,getUserEmbeddedSolanaWallet as ei,isUnifiedWallet as ti,PrivyClientError as Y,throwIfInvalidRecoveryUpgradePath as ri}from"@privy-io/js-sdk-core";var wp=()=>{let{client:e}=Xn(y);return{setRecovery:Yn(n=>l(void 0,null,function*(){var a;let r=b(),i=e.app.appId;if(!r)throw new Y({code:"embedded_wallet_recovery_error",error:"User must be loaded before attempting to modify the recovery method."});let s=(a=Zn(r))!=null?a:ei(r);if(!s)throw new Y({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(ti(s))throw new Y({code:"unsupported_wallet_type",error:"Embedded 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{s.chain_type==="ethereum"?yield e.embeddedWallet.getProvider(s):s.chain_type==="solana"&&(yield e.embeddedWallet.getSolanaProvider(s,s.address,"solana-address-verifier"))}catch(d){throw new Y({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"})}ri({currentRecoveryMethod:s.recovery_method,upgradeToRecoveryMethod:n.recoveryMethod});let o=yield oi({appId:i,client:e,user:r,primaryAccount:s,recoveryParams:n});try{let{user:d}=yield e.embeddedWallet.setRecovery(o);return{user:d}}catch(d){throw new Y({code:"embedded_wallet_set_recovery_error",error:d instanceof Error?d.message:"Error setting password on embedded wallet"})}}),[e])}},oi=s=>l(void 0,[s],function*({appId:e,client:t,user:n,primaryAccount:r,recoveryParams:i}){switch(i.recoveryMethod){case"privy":return{recoveryMethod:"privy",wallet:r};case"user-passcode":return M(_({},i),{wallet:r});case"google-drive":{let o=yield Pe(t);return{recoveryMethod:"google-drive",wallet:r,recoveryAccessToken:o}}case"icloud":{let{recoverySecret:o,iCloudRecordName:a}=yield oe({appId:e,client:t,user:n});return{recoveryMethod:"icloud-native",recoverySecretOverride:o,iCloudRecordNameOverride:a,wallet:r}}case"recovery-encryption-key":return{recoveryMethod:"recovery-encryption-key",wallet:r,recoveryKey:i.recoveryKey};default:throw new Y({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}});import{useCallback as ni,useContext as ii}from"react";import{getUserEmbeddedEthereumWallet as si,getUserEmbeddedSolanaWallet as ai,PrivyClientError as le,isUnifiedWallet as ci}from"@privy-io/js-sdk-core";var Ap=()=>{let{client:e}=ii(y);return{recover:ni(n=>l(void 0,null,function*(){var c;let r=b();if(!r)throw new le({code:"embedded_wallet_recovery_error",error:"User must be loaded before attempting to modify the recovery method."});let i=(c=si(r))!=null?c:ai(r);if(!i)throw new le({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(ci(i))throw new le({code:"unsupported_wallet_type",error:"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"});let s,o,a,d;switch(n.recoveryMethod){case"user-passcode":o=n.password;break;case"google-drive":a=yield Pe(e);break;case"icloud":let{recoverySecret:u}=yield We({client:e,walletAddress:i.address,chainType:i.chain_type});d=u;break;case"recovery-encryption-key":s=n.recoveryKey;break;case"privy":break;default:throw new le({code:"unsupported_recovery_method",error:`Unsupported recovery options ${n}`})}try{i.chain_type==="ethereum"?yield e.embeddedWallet.getProvider(i,o,a,d,s):i.chain_type==="solana"&&(yield e.embeddedWallet.getSolanaProvider(i,i.address,"solana-address-verifier",o,a,d))}catch(u){throw new le({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"})}}),[e])}};import{useEffect as li}from"react";import{useContext as di,useEffect as ot}from"react";var nt=(e={})=>{let{wallet:t,createWalletCallbacks:n,recoverWalletCallbacks:r,setWalletRecoveryCallbacks:i}=di(y),{onCreateWalletSuccess:s,onCreateWalletError:o,onRecoverWalletError:a,onRecoverWalletSuccess:d,onSetWalletRecoverySuccess:c,onSetWalletRecoveryError:u}=e;return ot(()=>{n.current={onSuccess:s,onError:o}},[s,o]),ot(()=>{r.current={onSuccess:d,onError:a}},[d,a]),ot(()=>{i.current={onSuccess:c,onError:u}},[d,a]),t};var Mp=({onStateChange:e})=>{let t=nt();return li(()=>{e(t)},[t])};import{useContext as ui}from"react";var Np=()=>{let{getIdentityToken:e}=ui(y);return{getIdentityToken:e}};import{useCallback as br,useContext as pi}from"react";import{PrivyClientError as mi}from"@privy-io/js-sdk-core";var Hp=e=>{let{client:t}=pi(y),n=br(i=>{var o;let s=C(i);return(o=e==null?void 0:e.onError)==null||o.call(e,s),s},[e==null?void 0:e.onError]);return{create:br(()=>l(void 0,null,function*(){var i;try{if(b())throw new mi({code:"attempted_to_create_guest_account_for_logged_in_user",error:"Already logged in, you cannot create a guest account"});let o=x(),a=yield t.auth.guest.create({embedded:o==null?void 0:o.embedded});return(i=e==null?void 0:e.onSuccess)==null||i.call(e,a.user,a.is_new_user),a.user}catch(s){throw n(s)}}),[t,n,e==null?void 0:e.onSuccess])}};import{useContext as yi,useEffect as fi}from"react";function Zp({onMfaRequired:e}){let{client:t}=yi(y);fi(()=>{function n(){return l(this,null,function*(){var i;let r=b();yield e((i=r==null?void 0:r.mfa_methods.map(({type:s})=>s).filter(s=>s!=="email"))!=null?i:[])})}return t.mfaPromises.on("mfaRequired",n),()=>{t.mfaPromises.off("mfaRequired",n)}},[t,e])}import{useCallback as ue,useContext as Ci}from"react";import{PrivyClientError as Me}from"@privy-io/js-sdk-core";import{PrivyClientError as gi}from"@privy-io/js-sdk-core";function Le(){return l(this,null,function*(){ke("react-native-passkeys");try{return yield import("react-native-passkeys")}catch(e){return Promise.reject(e)}})}var hi=(e,t)=>l(void 0,null,function*(){var i;let r=yield(yield Le()).create(wi(e,t));if(!r)throw new gi({code:"failed_to_create_passkey",error:"Could not create passkey"});return M(_({},r),{type:(i=r.type)!=null?i:"public-key",clientExtensionResults:{}})});function wi(e,t){return M(_({},t),{rp:e.rp,user:e.user,challenge:e.challenge,pubKeyCredParams:e.pubKeyCredParams,excludeCredentials:e.excludeCredentials,authenticatorSelection:e.authenticatorSelection,timeout:12e4,attestation:void 0})}import{PrivyClientError as vi}from"@privy-io/js-sdk-core";var st=(e,t)=>l(void 0,null,function*(){var i;let r=yield(yield Le()).get(bi(e,t));if(!r)throw new vi({code:"no_passkey_found_for_challenge",error:"Could not find a matching passkey to login with"});return M(_({},r),{type:(i=r.type)!=null?i:"public-key",clientExtensionResults:{}})});function bi(e,t){return M(_({},t),{rpId:e.rpId,challenge:e.challenge,allowCredentials:e.allowCredentials,userVerification:e.userVerification,timeout:12e4})}function Sr(e){var t;return{id:e.id,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},raw_id:e.rawId,type:e.type,authenticator_attachment:(t=e.authenticatorAttachment)!=null?t:"platform",response:{authenticator_data:e.response.authenticatorData,client_data_json:e.response.clientDataJSON,signature:e.response.signature,user_handle:e.response.userHandle}}}function Cr(e){var t,n,r,i;return{challenge:e.challenge,rpId:e.rp_id,extensions:{appid:(t=e.extensions)==null?void 0:t.app_id,credProps:(n=e.extensions)==null?void 0:n.cred_props,hmacCreateSecret:(r=e.extensions)==null?void 0:r.hmac_create_secret},timeout:e.timeout,allowCredentials:(i=e.allow_credentials)==null?void 0:i.map(({id:s,type:o,transports:a})=>({id:s,type:o,transports:a})),userVerification:e.user_verification}}function wm(e){var t,n,r,i,s,o,a,d;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,extensions:{hmacCreateSecret:(t=e.extensions)==null?void 0:t.hmac_create_secret,credProps:(r=(n=e.extensions)==null?void 0:n.cred_props)==null?void 0:r.rk,appid:(i=e.extensions)==null?void 0:i.app_id},attestation:e.attestation,excludeCredentials:e.exclude_credentials,authenticatorSelection:{authenticatorAttachment:(s=e.authenticator_selection)==null?void 0:s.authenticator_attachment,residentKey:(o=e.authenticator_selection)==null?void 0:o.resident_key,userVerification:(a=e.authenticator_selection)==null?void 0:a.user_verification,requireResidentKey:(d=e.authenticator_selection)==null?void 0:d.require_resident_key}}}function _m(){let{client:e}=Ci(y),t=ue(o=>l(this,null,function*(){var a,d;switch(o.method){case"sms":yield e.mfa.sms.sendCode({action:"verify"});return;case"passkey":let{options:c}=yield e.mfa.passkey.generateAuthenticationOptions({relying_party:o.relyingParty||((d=(a=x())==null?void 0:a.mfa)==null?void 0:d.relyingParty)});return Cr(c);case"totp":return;default:throw new Error(`Unsupported MFA method: ${o.mfaMethod}`)}}),[e]),n=ue(o=>l(this,null,function*(){var a,d,c,u,p,m,g;switch(o.method){case"totp":case"sms":if(typeof o.mfaCode!="string")throw new Me({code:"invalid_mfa_code",error:"Invalid MFA code"});(c=e.mfaPromises.rootPromise.current)==null||c.resolve({mfaMethod:o.method,mfaCode:o.mfaCode,relyingParty:o.relyingParty||((d=(a=x())==null?void 0:a.mfa)==null?void 0:d.relyingParty)||""}),yield new Promise((w,S)=>{e.mfaPromises.submitPromise.current={resolve:w,reject:S}});break;case"passkey":if(typeof o.mfaCode=="string")throw new Me({code:"invalid_passkey_response",error:"Invalid authenticator response"});let h=yield st(o.mfaCode),v=Sr(h);(m=e.mfaPromises.rootPromise.current)==null||m.resolve({mfaMethod:o.method,relyingParty:o.relyingParty||((p=(u=x())==null?void 0:u.mfa)==null?void 0:p.relyingParty)||"",mfaCode:v}),yield new Promise((w,S)=>{e.mfaPromises.submitPromise.current={resolve:w,reject:S}});break;default:let f=new Me({code:"unsupported_mfa_method",error:"Unsupported MFA method"});throw(g=e.mfaPromises.rootPromise.current)==null||g.reject(f),f}}),[e]),r=ue(()=>l(this,null,function*(){let o=b();!o||o.mfa_methods.length===0||(yield e.mfa.verifyMfa())}),[e]),i=ue(()=>{var o;(o=e.mfaPromises.rootPromise.current)==null||o.reject(new Me({code:"mfa_canceled",error:"MFA canceled"}))},[e]),s=ue(()=>l(this,null,function*(){let o=b();o&&(yield e.mfa.clearMfa({userId:o.id}))}),[e]);return{init:t,submit:n,prompt:r,cancel:i,clear:s}}import{useCallback as at,useContext as Ei}from"react";function Pm(){let{client:e}=Ei(y),t=at(i=>l(this,null,function*(){switch(i.method){case"sms":case"totp":return yield e.mfa.initEnrollMfa(i);case"passkey":return;default:throw new Error(`Unsupported MFA method: ${i.method}`)}}),[e]),n=at(i=>l(this,null,function*(){switch(i.method){case"sms":case"totp":case"passkey":yield e.mfa.submitEnrollMfa(i);return;default:throw new Error(`Unsupported MFA method: ${i.method}`)}}),[e]),r=at(i=>l(this,null,function*(){switch(i.method){case"sms":case"totp":yield e.mfa.unenrollMfa(i.method);return;case"passkey":yield e.mfa.submitEnrollMfa({method:"passkey",credentialIds:[],removeForLogin:i.removeForLogin});return;default:throw new Error(`Unsupported MFA method: ${i.method}`)}}),[e]);return{initMfaEnrollment:t,submitMfaEnrollment:n,unenrollMfa:r}}import{useCallback as _i,useContext as ki}from"react";function Lm(){let{client:e}=ki(y);return{unlink:_i(i=>l(this,[i],function*({credentialId:n,removeAsMfa:r}){yield e.mfa.unlinkPasskey({credentialId:n,removeAsMfa:r})}),[e])}}import{useCallback as Wi}from"react";import{areAddressesEqual as Ai}from"@privy-io/are-addresses-equal";import{getAllUserEmbeddedEthereumWallets as xi,getAllUserEmbeddedSolanaWallets as Pi,PrivyClientError as Ui}from"@privy-io/js-sdk-core";var zm=()=>{let e=W();return{importWallet:Wi(s=>l(void 0,[s],function*({privateKey:n,chainType:r,additionalSigners:i}){let{address:o,user:a}=yield e.embeddedWallet.importWallet({privateKey:n,chainType:r,additionalSigners:i}),c=(r==="solana"?Pi(a.user):xi(a.user)).find(u=>Ai(u.address,o));if(!c)throw new Ui({code:"embedded_wallet_creation_error",error:"Failed to import wallet"});return{user:a.user,wallet:c}}),[e])}};import{useCallback as Ri,useMemo as Er}from"react";import{getAllUserEmbeddedEthereumWallets as Fe,getEntropyDetailsFromUser as _r,getUserEmbeddedSolanaWallet as Ii,PrivyClientError as ct}from"@privy-io/js-sdk-core";var dt=()=>{let e=U(),t=W(),n=Er(()=>{let s=Fe(e).map(o=>{let a=_r(e,o);return a?{account:o,entropy:a}:null});return s.some(o=>o===null)?[]:s.filter(o=>o!==null).map(({account:o,entropy:{entropyId:a,entropyIdVerifier:d}})=>({address:o.address,walletIndex:o.wallet_index,chainType:o.chain_type,getProvider:()=>t.embeddedWallet.getEthereumProvider({wallet:o,entropyId:a,entropyIdVerifier:d,onNeedsRecovery:c=>l(void 0,null,function*(){var u;yield(u=he())==null?void 0:u(c)})})}))},[t,e]),r=Ri((...s)=>l(void 0,[...s],function*({createAdditional:i=!1}={}){var p,m,g;let{user:o}=yield t.user.get(),a=Fe(o);if(!i&&a.length>0)throw new ct({code:"embedded_wallet_creation_error",error:"Wallet already exists for this user. Set `createAdditional` to `true` to create another wallet"});if(a.length===0){let h=(p=Ii(o))!=null?p:void 0,v=yield t.embeddedWallet.create(h?{solanaAccount:h}:{});return Oi(v.user),{user:v.user}}let d=_r(o),c=a.map(h=>h.wallet_index).reduce((h,v)=>Math.max(h,v),0)+1,u=yield t.embeddedWallet.add({chainType:"ethereum",hdWalletIndex:c,entropyId:(m=d==null?void 0:d.entropyId)!=null?m:"",entropyIdVerifier:(g=d==null?void 0:d.entropyIdVerifier)!=null?g:"ethereum-address-verifier"});if(Fe(u.user).length<=a.length)throw new ct({code:"embedded_wallet_creation_error",error:"Unknown error creating wallet"});return{user:u.user}}),[t]);return Er(()=>({wallets:n,create:r}),[n,r])};function Oi(e){if(!e||Fe(e).length===0)throw new ct({code:"embedded_wallet_creation_error",error:"Unknown error creating wallet"})}import{useContext as Li,useEffect as kr}from"react";var Mi=(e={})=>{let{solanaWallet:t,createSolanaWalletCallbacks:n,recoverSolanaWalletCallbacks:r}=Li(y),{onCreateWalletSuccess:i,onCreateWalletError:s,onRecoverWalletError:o,onRecoverWalletSuccess:a}=e;return kr(()=>{n.current={onSuccess:i,onError:s}},[i,s]),kr(()=>{r.current={onSuccess:a,onError:o}},[a,o]),t};import{useCallback as Fi,useMemo as Ti}from"react";import{getAllUserEmbeddedBitcoinWallets as lt,getEntropyDetailsFromUser as Wr,isUnifiedWallet as Di,PrivyClientError as X}from"@privy-io/js-sdk-core";var Ni=()=>{let e=U(),t=W(),n=Ti(()=>{let i=Wr(e);if(!i)return[];let s=lt(e),{entropyId:o,entropyIdVerifier:a}=i;return s.map(d=>({address:d.address,walletIndex:d.wallet_index,publicKey:d.public_key,chainType:d.chain_type,getProvider:()=>Di(d)?Promise.reject(new X({code:"unsupported_wallet_type",error:"Bitcoin wallet providers are only supported for on-device execution and this app uses TEE execution. Use the useSignRawHash hook from @privy-io/expo/extended-chains to sign over a hash with this wallet. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide"})):t.embeddedWallet.getBitcoinProvider({wallet:d,entropyId:o,entropyIdVerifier:a})}))},[t,e]),r=Fi(o=>l(void 0,[o],function*({chainType:i,createAdditional:s=!1}){var f;let a=t.app.getConfig();if(((f=a==null?void 0:a.embedded_wallet_config)==null?void 0:f.mode)==="user-controlled-server-wallets-only")throw i==="bitcoin-segwit"?new X({code:"unsupported_wallet_type",error:"This app uses TEE execution. Use the useCreateWallet hook from @privy-io/expo/extended-chains to create the wallet instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide"}):new X({code:"unsupported_wallet_type",error:`Bitcoin (${i}) wallets are only supported for on-device execution and this app uses TEE execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide`});let{user:d}=yield t.user.get(),c=Wr(d);if(!c)throw new X({code:"embedded_wallet_creation_error",error:"No existing wallet for this user, create an Ethereum walet first to add a Bitcoin wallet"});let{entropyId:u,entropyIdVerifier:p}=c,m=lt(d).filter(w=>w.chain_type===i);if(!s&&m.length>0)throw new X({code:"embedded_wallet_creation_error",error:"Wallet already exists for this user. Set `createAdditional` to `true` to create another wallet"});let g=m.length===0?0:Math.max(...m.map(w=>w.wallet_index),0)+1,h=yield t.embeddedWallet.add({chainType:i,hdWalletIndex:g,entropyId:u,entropyIdVerifier:p}),v=lt(h.user).find(w=>w.chain_type===i&&w.wallet_index===g);if(!h.user||!v)throw new X({code:"embedded_wallet_creation_error",error:"Unknown error creating wallet"});return{user:h.user,provider:yield t.embeddedWallet.getBitcoinProvider({wallet:v,entropyId:u,entropyIdVerifier:p})}}),[t]);return{wallets:n,create:r}};import{useContext as ji}from"react";var ut=()=>{let{isReady:e,logout:t,getAccessToken:n,error:r,client:i}=ji(y);return{user:U(),isReady:e,error:r,logout:t,getAccessToken:n,refreshUser:()=>i.user.refreshUser()}};import{useContext as zi}from"react";function Vi(){let{client:e}=zi(y);return{acceptTerms:()=>l(this,null,function*(){return e.user.acceptTerms()})}}import{useMemo as Gi}from"react";import{generateAuthorizationSignature as Ki}from"@privy-io/js-sdk-core";var qi=()=>{let e=W();return Gi(()=>({generateAuthorizationSignature(n){return l(this,null,function*(){let{signature:r}=yield Ki((...i)=>e.embeddedWallet.signWithUserSigner(...i),n);return{signature:r}})}}),[e])};import{useContext as Bi,useMemo as Hi}from"react";import{GetEncryptedAuthorizationKey as Ji}from"@privy-io/routes";var Cy=()=>{let{client:e}=Bi(y);return Hi(()=>({getEncryptedAuthorizationKey:({id:t})=>e.fetchPrivyRoute(Ji,{params:{encrypted_authorization_key_id:t}})}),[e])};import{useCallback as $i}from"react";import{createWalletClient as Qi,getAddress as Ar,http as Yi,parseSignature as Xi,zeroAddress as Zi}from"viem";import{hashAuthorization as es}from"viem/utils";import{getAllUserEmbeddedEthereumWallets as ts,getJsonRpcEndpointFromChain as rs}from"@privy-io/js-sdk-core";var os=()=>{let e=U(),{wallets:t}=dt(),n=W();return{signAuthorization:$i((i,s)=>l(void 0,null,function*(){var p,m,g;if(!e)throw new Error("User must be authenticated before signing with a Privy wallet");let o=(g=(m=s==null?void 0:s.address)!=null?m:(p=ts(e)[0])==null?void 0:p.address)!=null?g:Zi,a=t.find(h=>Ar(h.address)===Ar(o));if(!a)throw new Error("Signing wallet not found.");let d;if(i.chainId===0){if(i.nonce===void 0)throw new Error("nonce is required when chainId is 0 \u2014 chain-agnostic authorizations are replayable across networks");d={chainId:0,address:i.contractAddress,nonce:i.nonce}}else{let v=n.embeddedWallet.chains.find(S=>S.id===i.chainId);if(!v)throw new Error("Error, chain not configured in PrivyProvider config");let f=rs(v,{},n.app.appId);d=yield Qi({account:o,chain:v,transport:Yi(f)}).prepareAuthorization(_({},i))}let u=yield(yield a.getProvider()).request({method:"secp256k1_sign",params:[es(d)]});return _(_({},d),Xi(u))}),[t,e,n])}};import{useMemo as ns}from"react";import{transfer as is}from"@privy-io/js-sdk-core";var ss=()=>{let e=W();return ns(()=>({transfer:(t,n)=>is(e,(...r)=>e.embeddedWallet.signWithUserSigner(...r),_({wallet_id:t},n))}),[e])};import{useMemo as as}from"react";import{getWalletAction as cs,listWalletActions as ds}from"@privy-io/js-sdk-core";var ls=()=>{let e=W();return as(()=>({getAction:(t,n)=>cs(e,{wallet_id:t,action_id:n}),listActions:(t,n)=>ds(e,_({wallet_id:t},n))}),[e])};import{useMemo as us}from"react";var ps=()=>{let e=At();return us(()=>({users:e}),[e])};import{useMemo as ms}from"react";var ys=()=>{let e=W();return ms(()=>({switchUser:n=>l(void 0,[n],function*({userId:t}){return yield e.user.switchActiveUser({userId:t})})}),[e])};import{useCallback as vs}from"react";import{PrivyClientError as bs}from"@privy-io/js-sdk-core";import{getAllUserEmbeddedBitcoinWallets as fs,getUserEmbeddedEthereumWallet as gs,getUserEmbeddedSolanaWallet as hs,isEmbeddedWalletAccount as ws,isUnifiedWallet as xr}from"@privy-io/js-sdk-core";function Pr(e,t){return l(this,null,function*(){var i,s;let n=t.linked_accounts.filter(ws).filter(o=>!o.imported&&!xr(o)).filter(o=>o.chain_type==="ethereum"||o.chain_type==="solana"),r=(i=n.find(o=>o.chain_type==="ethereum"&&o.wallet_index===0))!=null?i:n.find(o=>o.chain_type==="solana"&&o.wallet_index===0);if(!r){let o=(s=gs(t))!=null?s:hs(t);if(o!=null&&o.imported&&!xr(o))throw new Error("Imported wallets cannot be migrated");return{success:!0,migrated:!1}}if(fs(t).length>0)throw new Error("Bitcoin wallets cannot be migrated");return r.chain_type==="ethereum"?yield e.embeddedWallet.getProvider(r):r.chain_type==="solana"&&(yield e.embeddedWallet.getSolanaProvider(r,r.address,"solana-address-verifier")),yield e.embeddedWallet.delegateWallets({rootWallet:{address:r.address,chainType:r.chain_type,imported:r.imported},delegatedWallets:n.map(o=>({address:o.address,chainType:o.chain_type,walletIndex:o.wallet_index}))}),yield e.user.get(),{success:!0,migrated:!0}})}var Ur=()=>{let e=W();return{migrate:vs(()=>l(void 0,null,function*(){var s;let n=b(),r=e.app.getConfig();if(((s=r==null?void 0:r.embedded_wallet_config)==null?void 0:s.mode)!=="user-controlled-server-wallets-only")return{success:!0};if(!n)throw new bs({code:"embedded_wallet_before_logged_in",error:"User must be authenticated before migrating wallets"});return Pr(e,n)}),[e])}};var Rr=({disabled:e})=>{let{migrate:t}=Ur(),{user:n}=ut(),r=Cs(!1);return Ss(()=>{e||n&&(r.current||(r.current=!0,t().then(i=>{i.migrated&&!r.current&&(console.info("Migrated wallets for user"),r.current=!0)}).catch(i=>{console.debug("Unable to migrate wallets: ",i)}).finally(()=>{r.current=!1})))},[t,n,e]),null};var y=_s(null),ee;function Eg(e){return ee?ee.getAccessToken():e!=null&&e.strict?Promise.reject(new Lr({code:"attempted_to_read_storage_before_client_initialized",error:"Called `getAccessToken` before client initialized"})):(console.warn("Called `getAccessToken` before client initialized"),Promise.resolve(null))}var _g=e=>{var ft,gt,ht;As();let[t,n]=L(Or.currentState==="active");Ir(()=>{let O=Or.addEventListener("change",Vr=>{n(Vr==="active")});return()=>{O.remove()}},[]),Ir(()=>Et(e.config),[e.config]);let[r,i]=L(!1),[s,o]=L(null),[a,d]=L(!1),[c,u]=L({status:"disconnected",account:null}),[p,m]=L({status:"disconnected"}),[g,h]=L({status:"initial"}),[v,f]=L({status:"initial"}),[w,S]=L({status:"initial"}),[E,k]=L({status:"initial"}),[A,P]=L({status:"initial"}),[F,me]=L({status:"initial"}),[ye,De]=L({status:"initial"}),te=pe({}),Ne=pe({}),je=pe({}),mt=pe({}),yt=pe({}),fe=Te(O=>{if(O){Ve(O),o(null);return}Ve(null),h({status:"initial"}),f({status:"initial"}),u({status:"disconnected",account:null})},[]),I=Es(()=>{let O=e.storage||ge;return e.client?ee=e.client:ee=Ct({appId:e.appId,clientId:e.clientId,supportedChains:e.supportedChains,storage:O,baseUrl:e.baseUrl,logLevel:e.logLevel}),ee.setCallbacks({setUser:fe,setIsReady:d,setStoredUsers:Wt}),ee},[e.client,e.storage,e.appId,e.clientId,e.baseUrl,e.supportedChains,e.logLevel,fe]),Mr=Te(()=>l(void 0,null,function*(){let O=b();yield I.auth.logout(O?{userId:O==null?void 0:O.id}:void 0),fe(null)}),[fe,I]),Fr=Te(()=>l(void 0,null,function*(){try{return yield I.getAccessToken()}catch(O){return console.debug(O),null}}),[I]),Tr=Te(()=>I.getIdentityToken(),[I]);Jt({client:I,isUserInitialized:r,setIsUserInitialized:i,setError:o});let Dr=Gt({client:I,appId:e.appId,createWalletCallbacks:te,recoverWalletCallbacks:Ne,setWalletRecoveryCallbacks:je,setRecoveryFlowState:S,wallet:c,setWallet:u}),Nr=Lt({client:I,createSolanaWalletCallbacks:mt,recoverSolanaWalletCallbacks:yt,setSolanaRecoveryFlowState:k,solanaWallet:p,setSolanaWallet:m});Bt({client:I,createWalletCallbacks:te,recoverWalletCallbacks:Ne,setWalletRecoveryCallbacks:je,recoveryFlowState:w,oAuthState:v,setRecoveryFlowState:S,setWallet:u,appStateVisible:t});let{customAuthStateIsSettled:jr}=qt({client:I,isReady:r}),zr=z();return Z.createElement(Z.Fragment,null,Z.createElement(y.Provider,{value:{client:I,isReady:zr&&r&&jr,error:s,logout:Mr,getAccessToken:Fr,getIdentityToken:Tr,wallet:_(_({},c),Dr),solanaWallet:_(_({},p),Nr),oAuthState:v,recoveryFlowState:w,setRecoveryFlowState:S,solanaRecoveryFlowState:E,setSolanaRecoveryFlowState:k,createWalletCallbacks:te,recoverWalletCallbacks:Ne,setWalletRecoveryCallbacks:je,createSolanaWalletCallbacks:mt,recoverSolanaWalletCallbacks:yt,setOAuthState:f,siweState:A,setSiweState:P,otpState:g,setOtpState:h,passkeyState:F,setPasskeyState:me,farcasterState:ye,setFarcasterState:De}},e.children,Z.createElement(Rr,{disabled:(ht=(gt=(ft=e.config)==null?void 0:ft.embedded)==null?void 0:gt.disableAutomaticMigration)!=null?ht:!1})),Z.createElement(Ws,{style:{width:0,height:0,overflow:"hidden"}},Z.createElement(xt,{client:I,isClientReady:a})))},As=()=>{if(ks(y))throw new Lr({code:"configuration_error",error:"Found multiple instances of PrivyProvider, ensure there is only one mounted in your application tree."})};var Ig=e=>{let{client:t,setSiweState:n,siweState:r}=xs(y),i=pt(a=>{var c;let d=C(a);return n({status:"error",error:d}),(c=e==null?void 0:e.onError)==null||c.call(e,d),d},[e==null?void 0:e.onError]),s=pt(u=>l(void 0,[u],function*({wallet:a,from:{domain:d,uri:c}}){var p;try{n({status:"generating-message"});let m=yield t.auth.siwe.init(a,d,c);return n({status:"awaiting-signature"}),(p=e==null?void 0:e.onGenerateMessage)==null||p.call(e,m.message),m.message}catch(m){throw i(m)}}),[t,i,e==null?void 0:e.onGenerateMessage]),o=pt(c=>l(void 0,[c],function*({signature:a,messageOverride:d}){var u;try{if(!b())throw new Ps({code:"attempted_link_siwe_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiwe` to login with a wallet"});n({status:"submitting-signature"});let{user:m}=yield t.auth.siwe.linkWithSiwe(a,void 0,d);return n({status:"done"}),(u=e==null?void 0:e.onSuccess)==null||u.call(e,m),m}catch(p){throw i(p)}}),[t,i,e==null?void 0:e.onSuccess]);return{generateSiweMessage:s,linkWithSiwe:o,state:r}};export{x as a,b,Bs as c,U as d,Hs as e,qr as f,ke as g,C as h,H as i,Ct as j,Ig as k,Dc as l,W as m,$c as n,nd as o,pd as p,bd as q,Wd as r,Md as s,Gd as t,Xd as u,sl as v,pl as w,Sl as x,Rl as y,Tl as z,Vl as A,Jl as B,ou as C,du as D,fu as E,Cu as F,Lu as G,Vu as H,Qu as I,op as J,lp as K,wp as L,Ap as M,nt as N,Mp as O,Np as P,Hp as Q,Zp as R,hi as S,st as T,wm as U,_m as V,Pm as W,Lm as X,zm as Y,dt as Z,Mi as _,Ni as $,ut as aa,Vi as ba,qi as ca,Cy as da,os as ea,ss as fa,ls as ga,ps as ha,ys as ia,Ur as ja,y as ka,Eg as la,_g as ma};
@@ -0,0 +1,315 @@
1
+ import{ka as Ce}from"./chunk-23WNYVKL.js";import{b as r,c as U,d as m}from"./chunk-K5SPDXVF.js";var C=class extends Error{constructor(o,u){super(u);this.code=o,this.error=u}},he=class extends C{constructor(o){super("underlying_error",o instanceof Error?o.message:"An underlying error occurred");this.wrappedError=o}};import qe,{useContext as ve}from"react";import{useMemo as Ue}from"react";import{createContext as be}from"react";var O=be(void 0);var ge="#5B4FFF";function Se({colorScheme:a,accentHex:t}){return a==="dark"?{interactive:t,background:"#22222A",backgroundSecondary:"#010110",backgroundInformation:"#1E1B4B",backgroundTertiary:"#010110",backgroundHighlight:"#052E16",text:"#ffffff",textPlaceholder:"#9498B8",textMuted:"#FFFFFF",textHighlight:"#BBF7D0",textTitle:"#FFFFFF",textInteractive:"#FFFFFF",icon:"#FFFFFF",iconInformation:"#818CF8",iconSubtle:"#919191",privyBrand:"#FFFFFF",success:"#4ADE80",successLight:"#C5F7D7",border:"#474869",borderInformation:"#818CF8",error:"#FCA5A5",errorDark:"#EF4444"}:{interactive:t,background:"#FFFFFF",backgroundSecondary:"#F3F3F3",backgroundInformation:"#E0E7FF",backgroundTertiary:"#FFFFFF",backgroundHighlight:"#F1F2F9",text:"#040217",textPlaceholder:"#9498B8",textMuted:"#64668B",textHighlight:"#64668B",textTitle:"#1A1C29",textInteractive:"#FFFFFF",icon:"#110F2A",iconSubtle:"#9498B8",iconInformation:"#4F46E5",privyBrand:"#010110",success:"#16A34A",successLight:"#DCFCE7",border:"#E2E3F0",borderInformation:"#5B4FFF",error:"#EF4444",errorDark:"#B91C1C"}}function ke({colorScheme:a,accentHex:t}){return{colors:Se({colorScheme:a,accentHex:t}),colorScheme:a}}function Oe({children:a,appearance:t={}}){let{colorScheme:o="light",accentColor:u}=t,{isReady:d,client:l}=ve(Ce),f=Ue(()=>{var B,L;let s=d?l.app.getConfig():void 0,i=(B=s==null?void 0:s.accent_color)!=null?B:void 0;return ke({colorScheme:o,accentHex:(L=u!=null?u:i)!=null?L:ge})},[o,u,d,l]);return qe.createElement(O.Provider,{value:f},a)}import{useContext as He}from"react";var n=()=>{let a=He(O);if(a===void 0)throw new Error("Components calling useTheme must be wrapped in an ElementsThemeProvider");return a};import{useEffect as Ee}from"react";import{useStore as Ve}from"zustand";import{createStore as Ge}from"zustand/vanilla";var H=Ge()(a=>({elementsConfig:null,updateUIMounted:t=>a({elementsConfig:t})})),Ra=()=>{let{elementsConfig:a}=H.getState();if(!(a!==null))throw new C("privy_elements_not_ready","Privy Elements is not mounted")},ba=()=>{let{elementsConfig:a}=H.getState();if(a===null)throw new C("privy_elements_not_ready","Privy Elements is not mounted");return a},qa=()=>Ve(H,a=>{var t;return(t=a.elementsConfig)==null?void 0:t.appearance}),va=a=>{Ee(()=>{let{updateUIMounted:t}=H.getState();return t(a),()=>{t(null)}},[a])};var we={regular:"Inter_400Regular",medium:"Inter_500Medium",semibold:"Inter_600SemiBold"};import h from"react";import{View as We,Text as Pe,StyleSheet as ze}from"react-native";var Xe=h.forwardRef((d,u)=>{var l=d,{style:a,variant:t="default"}=l,o=m(l,["style","variant"]);let{colors:f}=n();return h.createElement(We,r({ref:u,style:[E.alert,t==="info"&&{backgroundColor:f.backgroundInformation,borderColor:f.borderInformation},a]},o))});Xe.displayName="Alert";var Ne=h.forwardRef((u,o)=>{var d=u,{style:a}=d,t=m(d,["style"]);let{colors:l}=n();return h.createElement(Pe,r({ref:o,style:[E.title,{color:l.text},a]},t))});Ne.displayName="AlertTitle";var _e=h.forwardRef((u,o)=>{var d=u,{style:a}=d,t=m(d,["style"]);let{colors:l}=n();return h.createElement(Pe,r({ref:o,style:[E.description,{color:l.text},a]},t))});_e.displayName="AlertDescription";var E=ze.create({alert:{borderRadius:8,alignItems:"center",gap:12,paddingHorizontal:12,paddingVertical:8,flexDirection:"row"},title:{marginBottom:4,fontFamily:we.semibold,fontSize:16},description:{fontSize:14,lineHeight:20}});import{forwardRef as Ke,createElement as ye}from"react";import*as V from"react-native-svg";var I={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},Ae={fill:I.fill,stroke:I.stroke,strokeWidth:I.strokeWidth,strokeLinecap:I.strokeLinecap,strokeLinejoin:I.strokeLinejoin};var e=(a,t)=>{let o=Ke((p,L)=>{var M=p,{color:u="currentColor",size:d=24,strokeWidth:l=2,absoluteStrokeWidth:f,children:s,"data-testid":i}=M,B=m(M,["color","size","strokeWidth","absoluteStrokeWidth","children","data-testid"]);let v=r({stroke:u,strokeWidth:f?Number(l)*24/Number(d):l},B);return ye(V.Svg,r(U(r({ref:L},I),{width:d,height:d,"data-testid":i}),v),[...t.map(([D,Te])=>{let Re=D.charAt(0).toUpperCase()+D.slice(1);return ye(V[Re],r(r(r({},Ae),v),Te))}),...(Array.isArray(s)?s:[s])||[]])});return o.displayName=`${a}`,o};var G=e("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);var T=e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var W=e("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);var g=e("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);var z=e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var X=e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var N=e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var S=e("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);var k=e("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var w=e("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var P=e("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var _=e("Clock10",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 10",key:"atfzqc"}]]);var A=e("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);var K=e("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var Z=e("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);var J=e("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var Q=e("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var j=e("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var Y=e("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);var y=e("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);var $=e("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);var ee=e("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);var ae=e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var te=e("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);var oe=e("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);var ue=e("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);var de=e("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);var le=e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var re=e("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);var fe=e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);var se=e("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var ie=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var ce=e("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);var ne=e("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);var pe=e("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);var R=e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);import c from"react";import{Pressable as Fe,StyleSheet as Ze,View as b}from"react-native";var au=({goBack:a,close:t})=>c.createElement(b,{style:me.navigationBar},c.createElement(b,null,a&&c.createElement(Je,{onPress:a})),c.createElement(b,null,t&&c.createElement(Qe,{onPress:t}))),Je=a=>{let{colors:t}=n();return c.createElement(Fe,r({accessibilityRole:"button",accessibilityLabel:"Back"},a),c.createElement(b,{style:me.backButton},c.createElement(T,{size:24,color:t.icon})))},Qe=a=>{let{colors:t}=n();return c.createElement(Fe,r({accessibilityRole:"button",accessibilityLabel:"Close"},a),c.createElement(b,{style:me.backButton},c.createElement(R,{size:24,color:t.icon})))},me=Ze.create({navigationBar:{height:48,flexDirection:"row",justifyContent:"space-between"},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});import{create as je}from"zustand";var Le=je(()=>null),Ye=()=>{var t;let a=(t=Le.getState())==null?void 0:t.controller;return!a||a.signal.aborted?null:a},du=()=>{var a;(a=Ye())==null||a.abort(),Le.setState(null)},lu=a=>{Le.setState(t=>t&&{step:a})};import x from"react";import{View as Me,Text as ua,Pressable as da,StyleSheet as la}from"react-native";import Ie,{useEffect as $e}from"react";import{Animated as xe,Easing as ea,useAnimatedValue as aa}from"react-native";import ta,{Path as oa}from"react-native-svg";var Be=({color:a})=>{let t=aa(0);$e(()=>{t.setValue(0);let u=xe.loop(xe.timing(t,{toValue:1,duration:1200,useNativeDriver:!0,easing:ea.linear}));return u.start(),()=>u.stop()},[t]);let o=t.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return Ie.createElement(xe.View,{style:{transform:[{rotate:o}]}},Ie.createElement(ta,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},Ie.createElement(oa,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:a,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var Iu=B=>{var L=B,{variant:a="primary",title:t,destroy:o=!1,loading:u=!1,LeftIcon:d,RightIcon:l,color:f,style:s}=L,i=m(L,["variant","title","destroy","loading","LeftIcon","RightIcon","color","style"]);let{colors:p}=n(),M=o?p.errorDark:p.interactive,v={primary:M,secondary:p.backgroundTertiary,tertiary:p.background}[a],D={primary:p.textInteractive,secondary:p.text,tertiary:M}[a];return x.createElement(da,U(r({},i),{disabled:i.disabled||u}),x.createElement(Me,{style:[q.buttonBox,{backgroundColor:v},a==="secondary"&&q.buttonBoxSecondary,a==="secondary"&&{borderColor:p.border},s]},u?x.createElement(Be,{color:f!=null?f:D}):x.createElement(x.Fragment,null,d,x.createElement(ua,{style:[q.buttonLabel,{color:f!=null?f:D},a==="secondary"&&q.buttonLabelSecondary,a==="tertiary"&&q.buttonLabelTertiary]},t),!!l&&x.createElement(Me,{style:{marginLeft:"auto"}},l))))},q=la.create({buttonBox:{height:54,flexDirection:"row",justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,gap:12},buttonBoxSecondary:{justifyContent:"flex-start",borderWidth:1,borderRadius:12},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24},buttonLabelSecondary:{fontFamily:"Inter_400Regular"},buttonLabelTertiary:{fontFamily:"Inter_500Medium"}});import*as F from"expo-web-browser";import{AppState as ra,Platform as De}from"react-native";var gu=a=>{if(!a)return null;try{return new URL(a).protocol==="https:"?a:null}catch(t){return null}},Su=a=>{let t=!1,o=!1,u=null;function d(){o=!0,u==null||u.remove()}function l(f){if(t||o)return;t=!0;let s=!1;u=De.OS==="android"?ra.addEventListener("change",i=>{i==="background"&&(s=!0),i==="active"&&s&&d()}):null,F.openBrowserAsync(f,{createTask:!1}).then(i=>{i.type!==F.WebBrowserResultType.OPENED&&d()}).catch(d)}return a&&l(a),{navigate:l,isClosed:()=>o,dismiss:()=>{o||(d(),t&&De.OS==="ios"&&F.dismissBrowser().catch(()=>{}))}}};export{Oe as a,n as b,Iu as c,G as d,W as e,g as f,z as g,X as h,N as i,S as j,k,w as l,P as m,_ as n,A as o,K as p,Z as q,J as r,Q as s,j as t,Y as u,y as v,$ as w,ee as x,ae as y,te as z,oe as A,ue as B,de as C,le as D,re as E,fe as F,se as G,ie as H,ce as I,ne as J,pe as K,C as L,he as M,Ra as N,ba as O,qa as P,va as Q,we as R,Xe as S,_e as T,au as U,gu as V,Su as W,Le as X,Ye as Y,du as Z,lu as _};
2
+ /*! Bundled license information:
3
+
4
+ lucide-react-native/dist/esm/defaultAttributes.js:
5
+ (**
6
+ * @license lucide-react-native v0.474.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ *)
11
+
12
+ lucide-react-native/dist/esm/createLucideIcon.js:
13
+ (**
14
+ * @license lucide-react-native v0.474.0 - ISC
15
+ *
16
+ * This source code is licensed under the ISC license.
17
+ * See the LICENSE file in the root directory of this source tree.
18
+ *)
19
+
20
+ lucide-react-native/dist/esm/icons/arrow-left-right.js:
21
+ (**
22
+ * @license lucide-react-native v0.474.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ *)
27
+
28
+ lucide-react-native/dist/esm/icons/arrow-left.js:
29
+ (**
30
+ * @license lucide-react-native v0.474.0 - ISC
31
+ *
32
+ * This source code is licensed under the ISC license.
33
+ * See the LICENSE file in the root directory of this source tree.
34
+ *)
35
+
36
+ lucide-react-native/dist/esm/icons/ban.js:
37
+ (**
38
+ * @license lucide-react-native v0.474.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ *)
43
+
44
+ lucide-react-native/dist/esm/icons/chart-line.js:
45
+ (**
46
+ * @license lucide-react-native v0.474.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ *)
51
+
52
+ lucide-react-native/dist/esm/icons/check.js:
53
+ (**
54
+ * @license lucide-react-native v0.474.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ *)
59
+
60
+ lucide-react-native/dist/esm/icons/chevron-down.js:
61
+ (**
62
+ * @license lucide-react-native v0.474.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ *)
67
+
68
+ lucide-react-native/dist/esm/icons/chevron-right.js:
69
+ (**
70
+ * @license lucide-react-native v0.474.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ *)
75
+
76
+ lucide-react-native/dist/esm/icons/circle-check-big.js:
77
+ (**
78
+ * @license lucide-react-native v0.474.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ *)
83
+
84
+ lucide-react-native/dist/esm/icons/circle-check.js:
85
+ (**
86
+ * @license lucide-react-native v0.474.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ *)
91
+
92
+ lucide-react-native/dist/esm/icons/circle-help.js:
93
+ (**
94
+ * @license lucide-react-native v0.474.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ *)
99
+
100
+ lucide-react-native/dist/esm/icons/circle-x.js:
101
+ (**
102
+ * @license lucide-react-native v0.474.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ *)
107
+
108
+ lucide-react-native/dist/esm/icons/clock-10.js:
109
+ (**
110
+ * @license lucide-react-native v0.474.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ *)
115
+
116
+ lucide-react-native/dist/esm/icons/cloud-upload.js:
117
+ (**
118
+ * @license lucide-react-native v0.474.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ *)
123
+
124
+ lucide-react-native/dist/esm/icons/copy.js:
125
+ (**
126
+ * @license lucide-react-native v0.474.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ *)
131
+
132
+ lucide-react-native/dist/esm/icons/credit-card.js:
133
+ (**
134
+ * @license lucide-react-native v0.474.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ *)
139
+
140
+ lucide-react-native/dist/esm/icons/external-link.js:
141
+ (**
142
+ * @license lucide-react-native v0.474.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ *)
147
+
148
+ lucide-react-native/dist/esm/icons/eye-off.js:
149
+ (**
150
+ * @license lucide-react-native v0.474.0 - ISC
151
+ *
152
+ * This source code is licensed under the ISC license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ *)
155
+
156
+ lucide-react-native/dist/esm/icons/eye.js:
157
+ (**
158
+ * @license lucide-react-native v0.474.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ *)
163
+
164
+ lucide-react-native/dist/esm/icons/file-check.js:
165
+ (**
166
+ * @license lucide-react-native v0.474.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ *)
171
+
172
+ lucide-react-native/dist/esm/icons/file-pen.js:
173
+ (**
174
+ * @license lucide-react-native v0.474.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ *)
179
+
180
+ lucide-react-native/dist/esm/icons/files.js:
181
+ (**
182
+ * @license lucide-react-native v0.474.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ *)
187
+
188
+ lucide-react-native/dist/esm/icons/fingerprint.js:
189
+ (**
190
+ * @license lucide-react-native v0.474.0 - ISC
191
+ *
192
+ * This source code is licensed under the ISC license.
193
+ * See the LICENSE file in the root directory of this source tree.
194
+ *)
195
+
196
+ lucide-react-native/dist/esm/icons/info.js:
197
+ (**
198
+ * @license lucide-react-native v0.474.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ *)
203
+
204
+ lucide-react-native/dist/esm/icons/log-in.js:
205
+ (**
206
+ * @license lucide-react-native v0.474.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ *)
211
+
212
+ lucide-react-native/dist/esm/icons/mail.js:
213
+ (**
214
+ * @license lucide-react-native v0.474.0 - ISC
215
+ *
216
+ * This source code is licensed under the ISC license.
217
+ * See the LICENSE file in the root directory of this source tree.
218
+ *)
219
+
220
+ lucide-react-native/dist/esm/icons/phone.js:
221
+ (**
222
+ * @license lucide-react-native v0.474.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ *)
227
+
228
+ lucide-react-native/dist/esm/icons/qr-code.js:
229
+ (**
230
+ * @license lucide-react-native v0.474.0 - ISC
231
+ *
232
+ * This source code is licensed under the ISC license.
233
+ * See the LICENSE file in the root directory of this source tree.
234
+ *)
235
+
236
+ lucide-react-native/dist/esm/icons/refresh-cw.js:
237
+ (**
238
+ * @license lucide-react-native v0.474.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ *)
243
+
244
+ lucide-react-native/dist/esm/icons/scan-face.js:
245
+ (**
246
+ * @license lucide-react-native v0.474.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ *)
251
+
252
+ lucide-react-native/dist/esm/icons/search.js:
253
+ (**
254
+ * @license lucide-react-native v0.474.0 - ISC
255
+ *
256
+ * This source code is licensed under the ISC license.
257
+ * See the LICENSE file in the root directory of this source tree.
258
+ *)
259
+
260
+ lucide-react-native/dist/esm/icons/shield-alert.js:
261
+ (**
262
+ * @license lucide-react-native v0.474.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ *)
267
+
268
+ lucide-react-native/dist/esm/icons/shield-check.js:
269
+ (**
270
+ * @license lucide-react-native v0.474.0 - ISC
271
+ *
272
+ * This source code is licensed under the ISC license.
273
+ * See the LICENSE file in the root directory of this source tree.
274
+ *)
275
+
276
+ lucide-react-native/dist/esm/icons/smartphone.js:
277
+ (**
278
+ * @license lucide-react-native v0.474.0 - ISC
279
+ *
280
+ * This source code is licensed under the ISC license.
281
+ * See the LICENSE file in the root directory of this source tree.
282
+ *)
283
+
284
+ lucide-react-native/dist/esm/icons/store.js:
285
+ (**
286
+ * @license lucide-react-native v0.474.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ *)
291
+
292
+ lucide-react-native/dist/esm/icons/user-check.js:
293
+ (**
294
+ * @license lucide-react-native v0.474.0 - ISC
295
+ *
296
+ * This source code is licensed under the ISC license.
297
+ * See the LICENSE file in the root directory of this source tree.
298
+ *)
299
+
300
+ lucide-react-native/dist/esm/icons/x.js:
301
+ (**
302
+ * @license lucide-react-native v0.474.0 - ISC
303
+ *
304
+ * This source code is licensed under the ISC license.
305
+ * See the LICENSE file in the root directory of this source tree.
306
+ *)
307
+
308
+ lucide-react-native/dist/esm/lucide-react-native.js:
309
+ (**
310
+ * @license lucide-react-native v0.474.0 - ISC
311
+ *
312
+ * This source code is licensed under the ISC license.
313
+ * See the LICENSE file in the root directory of this source tree.
314
+ *)
315
+ */
@@ -1 +1 @@
1
- import{a as R,b as N,g as B,h as T,ka as D}from"./chunk-6GY37RNT.js";import{b as E,c as P,d as F,e as l}from"./chunk-K5SPDXVF.js";import*as O from"expo-linking";import{useCallback as q,useContext as tt,useEffect as et,useRef as it}from"react";import{Platform as ot}from"react-native";import{PrivyClientError as W}from"@privy-io/js-sdk-core";import{PrivyClientError as X}from"@privy-io/js-sdk-core";import{PrivyClientError as K}from"@privy-io/js-sdk-core";function M(){return l(this,null,function*(){B("expo-apple-authentication");try{return yield import("expo-apple-authentication")}catch(t){throw new K({code:"configuration_error",error:"`expo-apple-authentication` is not installed. Install it and rebuild the native app."})}})}function H(u){return l(this,arguments,function*({oauthProviderUrl:t,isLogin:i}){try{let o=yield M();return yield o.signInAsync({state:Y(t),requestedScopes:[o.AppleAuthenticationScope.EMAIL,o.AppleAuthenticationScope.FULL_NAME]})}catch(o){throw o instanceof Error&&"code"in o&&o.code==="ERR_REQUEST_CANCELED"?new X({error:"Apple login was cancelled",code:i?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):o}})}function Y(t){var u;return(u=new URL(t).searchParams.get("state"))!=null?u:""}import{Platform as Z}from"react-native";function z(t){return Z.select({android:t.replace("x.com","twitter.com"),default:t})}import*as Q from"expo-linking";import*as m from"expo-web-browser";import{PrivyClientError as j}from"@privy-io/js-sdk-core";function V(o){return l(this,arguments,function*({oauthProviderUrl:t,isLogin:i,returnUrl:u}){var a,p;let n=yield m.openAuthSessionAsync(t,u,{createTask:!1});if(n.type===m.WebBrowserResultType.CANCEL||n.type===m.WebBrowserResultType.DISMISS)throw new j({error:"OAuth was cancelled",code:i?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"});if(n.type!=="success")throw new j({error:"OAuth session failed",code:i?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let r=Q.parse(n.url).queryParams;return{authorizationCode:(a=r==null?void 0:r.privy_oauth_code)!=null?a:null,state:(p=r==null?void 0:r.privy_oauth_state)!=null?p:null,resultUrl:n.url}})}var $=(u={})=>{var o=u,{action:t}=o,i=F(o,["action"]);let{oAuthState:n,setOAuthState:r,client:a}=tt(D),p=it(i);return et(()=>{p.current=i},[i]),{start:q(function(Nt){return l(this,arguments,function*({provider:c,redirectUri:d,isLegacyAppleIosBehaviorEnabled:G=!1,disableSignup:J,onAppleOAuthUserInfo:S}){var C,U,L,v;r({status:"loading"});let y=N(),g=t?t==="login":!!!y;try{if(y&&t==="login"&&!a.isMultiUserModeEnabled)throw new W({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!y&&t==="link")throw new W({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});if(__DEV__&&d!=null&&d.includes("://")){let e=d.split("://")[0];console.warn(`redirectUri includes a scheme prefix (${e}://), it should be a path instead, such as '/authenticated'`)}let w=O.createURL(d||"/"),{url:s}=yield a.auth.oauth.generateURL(c,w);c==="twitter"&&(s=z(s));let h,b,A,f,I,k,_;if(ot.OS==="ios"&&c==="apple"&&!G){let e=yield H({oauthProviderUrl:s,isLogin:g});A=e.authorizationCode,f=e.state,_=e,I="raw"}else{let e=yield V({oauthProviderUrl:s,isLogin:g,returnUrl:w});A=e.authorizationCode,f=e.state,k=e.resultUrl}if(!A||!f)throw new W({error:"OAuth invalid credentials",code:g?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(g){let e=R(),x=yield a.auth.oauth.loginWithCode(A,f,c,I,J?"no-signup":"login-or-sign-up",{embedded:e==null?void 0:e.embedded});h=x.user,b=x.is_new_user}else({user:h}=yield a.auth.oauth.linkWithCode(A,f,c,I));return _&&S&&S({fullName:_.fullName,email:_.email}),(U=(C=p.current).onSuccess)==null||U.call(C,h,b),k&&(yield O.openURL(k.split("?")[0])),r({status:"done",isNewUser:b}),h!=null?h:void 0}catch(w){let s=T(w);throw r({status:"error",error:s}),(v=(L=p.current).onError)==null||v.call(L,s),s}})},[a.auth.oauth,t,r]),state:n}};function Pt(t){let{state:i,start:u}=$(P(E({},t),{action:"login"}));return{state:i,login:u}}export{$ as a,Pt as b};
1
+ import{a as R,b as N,g as B,h as T,ka as D}from"./chunk-23WNYVKL.js";import{b as E,c as P,d as F,e as l}from"./chunk-K5SPDXVF.js";import*as O from"expo-linking";import{useCallback as q,useContext as tt,useEffect as et,useRef as it}from"react";import{Platform as ot}from"react-native";import{PrivyClientError as W}from"@privy-io/js-sdk-core";import{PrivyClientError as X}from"@privy-io/js-sdk-core";import{PrivyClientError as K}from"@privy-io/js-sdk-core";function M(){return l(this,null,function*(){B("expo-apple-authentication");try{return yield import("expo-apple-authentication")}catch(t){throw new K({code:"configuration_error",error:"`expo-apple-authentication` is not installed. Install it and rebuild the native app."})}})}function H(u){return l(this,arguments,function*({oauthProviderUrl:t,isLogin:i}){try{let o=yield M();return yield o.signInAsync({state:Y(t),requestedScopes:[o.AppleAuthenticationScope.EMAIL,o.AppleAuthenticationScope.FULL_NAME]})}catch(o){throw o instanceof Error&&"code"in o&&o.code==="ERR_REQUEST_CANCELED"?new X({error:"Apple login was cancelled",code:i?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):o}})}function Y(t){var u;return(u=new URL(t).searchParams.get("state"))!=null?u:""}import{Platform as Z}from"react-native";function z(t){return Z.select({android:t.replace("x.com","twitter.com"),default:t})}import*as Q from"expo-linking";import*as m from"expo-web-browser";import{PrivyClientError as j}from"@privy-io/js-sdk-core";function V(o){return l(this,arguments,function*({oauthProviderUrl:t,isLogin:i,returnUrl:u}){var a,p;let n=yield m.openAuthSessionAsync(t,u,{createTask:!1});if(n.type===m.WebBrowserResultType.CANCEL||n.type===m.WebBrowserResultType.DISMISS)throw new j({error:"OAuth was cancelled",code:i?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"});if(n.type!=="success")throw new j({error:"OAuth session failed",code:i?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let r=Q.parse(n.url).queryParams;return{authorizationCode:(a=r==null?void 0:r.privy_oauth_code)!=null?a:null,state:(p=r==null?void 0:r.privy_oauth_state)!=null?p:null,resultUrl:n.url}})}var $=(u={})=>{var o=u,{action:t}=o,i=F(o,["action"]);let{oAuthState:n,setOAuthState:r,client:a}=tt(D),p=it(i);return et(()=>{p.current=i},[i]),{start:q(function(Nt){return l(this,arguments,function*({provider:c,redirectUri:d,isLegacyAppleIosBehaviorEnabled:G=!1,disableSignup:J,onAppleOAuthUserInfo:S}){var C,U,L,v;r({status:"loading"});let y=N(),g=t?t==="login":!!!y;try{if(y&&t==="login"&&!a.isMultiUserModeEnabled)throw new W({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!y&&t==="link")throw new W({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});if(__DEV__&&d!=null&&d.includes("://")){let e=d.split("://")[0];console.warn(`redirectUri includes a scheme prefix (${e}://), it should be a path instead, such as '/authenticated'`)}let w=O.createURL(d||"/"),{url:s}=yield a.auth.oauth.generateURL(c,w);c==="twitter"&&(s=z(s));let h,b,A,f,I,k,_;if(ot.OS==="ios"&&c==="apple"&&!G){let e=yield H({oauthProviderUrl:s,isLogin:g});A=e.authorizationCode,f=e.state,_=e,I="raw"}else{let e=yield V({oauthProviderUrl:s,isLogin:g,returnUrl:w});A=e.authorizationCode,f=e.state,k=e.resultUrl}if(!A||!f)throw new W({error:"OAuth invalid credentials",code:g?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(g){let e=R(),x=yield a.auth.oauth.loginWithCode(A,f,c,I,J?"no-signup":"login-or-sign-up",{embedded:e==null?void 0:e.embedded});h=x.user,b=x.is_new_user}else({user:h}=yield a.auth.oauth.linkWithCode(A,f,c,I));return _&&S&&S({fullName:_.fullName,email:_.email}),(U=(C=p.current).onSuccess)==null||U.call(C,h,b),k&&(yield O.openURL(k.split("?")[0])),r({status:"done",isNewUser:b}),h!=null?h:void 0}catch(w){let s=T(w);throw r({status:"error",error:s}),(v=(L=p.current).onError)==null||v.call(L,s),s}})},[a.auth.oauth,t,r]),state:n}};function Pt(t){let{state:i,start:u}=$(P(E({},t),{action:"login"}));return{state:i,login:u}}export{$ as a,Pt as b};
@@ -1 +1 @@
1
- import{b as u,m as i}from"./chunk-6GY37RNT.js";import{e as a}from"./chunk-K5SPDXVF.js";import{useMemo as d}from"react";import{create as g}from"@privy-io/js-sdk-core";var f=()=>{let e=i();return d(()=>({createWallet(n){return a(this,null,function*(){let s=yield g(e,{request:{chain_type:n.chainType}}),{user:o}=yield e.user.get();return{user:o,wallet:s}})}}),[e])};import{useMemo as h}from"react";import{isEmbeddedWalletAccount as m,isUnifiedWallet as w,PrivyClientError as c,rawSign as y}from"@privy-io/js-sdk-core";var C=()=>{let e=i();return h(()=>({signRawHash(k){return a(this,arguments,function*({address:n,chainType:s,hash:o}){let l=u();if(!l)throw new c({code:"embedded_wallet_before_logged_in",error:"User must be authenticated before signing a raw hash"});let p=l.linked_accounts.filter(m).filter(w).filter(t=>t.chain_type===s).find(t=>t.address===n);if(!p)throw new c({code:"embedded_wallet_does_not_exist",error:"No embedded wallet found for the given address and chain type"});let r=yield y(e,(...t)=>e.embeddedWallet.signWithUserSigner(...t),{wallet_id:p.id,params:{hash:o}});if(r.data&&"signature"in r.data&&r.data.encoding==="hex")return{signature:r.data.signature};throw new Error("Failed to sign")})}}),[e])};export{f as useCreateWallet,C as useSignRawHash};
1
+ import{b as u,m as i}from"./chunk-23WNYVKL.js";import{e as a}from"./chunk-K5SPDXVF.js";import{useMemo as d}from"react";import{create as g}from"@privy-io/js-sdk-core";var f=()=>{let e=i();return d(()=>({createWallet(n){return a(this,null,function*(){let s=yield g(e,{request:{chain_type:n.chainType}}),{user:o}=yield e.user.get();return{user:o,wallet:s}})}}),[e])};import{useMemo as h}from"react";import{isEmbeddedWalletAccount as m,isUnifiedWallet as w,PrivyClientError as c,rawSign as y}from"@privy-io/js-sdk-core";var C=()=>{let e=i();return h(()=>({signRawHash(k){return a(this,arguments,function*({address:n,chainType:s,hash:o}){let l=u();if(!l)throw new c({code:"embedded_wallet_before_logged_in",error:"User must be authenticated before signing a raw hash"});let p=l.linked_accounts.filter(m).filter(w).filter(t=>t.chain_type===s).find(t=>t.address===n);if(!p)throw new c({code:"embedded_wallet_does_not_exist",error:"No embedded wallet found for the given address and chain type"});let r=yield y(e,(...t)=>e.embeddedWallet.signWithUserSigner(...t),{wallet_id:p.id,params:{hash:o}});if(r.data&&"signature"in r.data&&r.data.encoding==="hex")return{signature:r.data.signature};throw new Error("Failed to sign")})}}),[e])};export{f as useCreateWallet,C as useSignRawHash};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{a as bt,b as Dt,c as Gt,d as jt,e as Et,f as _t,g as Bt,h as Mt}from"./chunk-QSWCX5XI.js";import{a as f,b as I}from"./chunk-FJGLXYQV.js";import{$ as It,A as et,B as ot,C as rt,D as nt,E as ut,F as it,G as pt,H as st,I as ht,J as at,K as ft,L as At,M as Ot,N as ct,O as mt,P as kt,Q as lt,R as yt,V as xt,W as dt,X as Ut,Y as Pt,Z as vt,_ as wt,aa as d,ba as Tt,ca as gt,da as Ft,e as y,ea as St,f as G,fa as Lt,ga as Wt,h as x,ha as Rt,ia as Ht,j as v,ja as w,k as j,ka as a,l as E,la as Ct,m as _,ma as Nt,n as B,o as M,p as q,q as z,r as J,s as K,t as Q,u as V,v as X,w as Y,x as Z,y as $,z as tt}from"./chunk-6GY37RNT.js";import{b as m,c as k,e as l,h as P}from"./chunk-K5SPDXVF.js";export*from"@privy-io/js-sdk-core";import r from"react";var Kt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=d(),U=y();if(!u)return r.createElement(r.Fragment,null,t);if(p&&e){let n=typeof e=="function"?e(p):e;return r.createElement(r.Fragment,null,n)}return U?r.createElement(r.Fragment,null,i):r.createElement(r.Fragment,null,o)};import{createDataSuffixPlugin as T}from"@privy-io/js-sdk-core";function g(t){return f(t)}function F(t){let{state:e,start:o}=f(k(m({},t),{action:"link"}));return{state:e,link:o}}import{useCallback as S,useContext as L,useEffect as W,useRef as R}from"react";var H=t=>{let{client:e}=L(a),o=R(t);return W(()=>{o.current=t},[t]),{unlinkOAuth:S(U=>l(void 0,[U],function*({provider:u,subject:p}){var n,A,s,O;try{let{user:h}=yield e.auth.oauth.unlink(u,p);return(A=(n=o.current)==null?void 0:n.onSuccess)==null||A.call(n,h),h}catch(h){let c=x(h);throw(O=(s=o.current)==null?void 0:s.onError)==null||O.call(s,c),c}}),[e.auth.oauth])}};import{useContext as C,useEffect as N,useRef as b}from"react";var D=t=>{let{client:e}=C(a),o=b(t.onOAuthTokenGrant);o.current=t.onOAuthTokenGrant,N(()=>{let{unsubscribe:i}=e.addOAuthTokensListener(u=>{o.current(u)});return i},[e])};export{Kt as AuthBoundary,a as PrivyContext,Nt as PrivyProvider,P as SecureStorageAdapter,v as createPrivyClient,T as dataSuffix,Ct as getAccessToken,Bt as hasError,bt as isConnected,Gt as isConnecting,_t as isCreating,jt as isDisconnected,Et as isNotCreated,Dt as isReconnecting,Mt as needsRecovery,Tt as useAcceptTerms,gt as useAuthorizationSignature,lt as useCreateGuestAccount,et as useDepositAddress,It as useEmbeddedBitcoinWallet,vt as useEmbeddedEthereumWallet,wt as useEmbeddedSolanaWallet,ct as useEmbeddedWallet,mt as useEmbeddedWalletStateChange,Ft as useGetEncryptedAuthorizationKey,ot as useHeadlessCryptoDeposit,tt as useHeadlessDelegatedActions,kt as useIdentityToken,Pt as useImportWallet,z as useLinkEmail,Q as useLinkSMS,st as useLinkWithCrossApp,X as useLinkWithFarcaster,F as useLinkWithOAuth,j as useLinkWithSiwe,B as useLinkWithSiws,pt as useLoginWithCrossApp,K as useLoginWithEmail,Z as useLoginWithFarcaster,$ as useLoginWithFarcasterV2,I as useLoginWithOAuth,V as useLoginWithSMS,E as useLoginWithSiwe,M as useLoginWithSiws,xt as useMfa,dt as useMfaEnrollment,w as useMigrateWallets,g as useOAuthFlow,D as useOAuthTokens,G as useOnNeedsRecovery,d as usePrivy,_ as usePrivyClient,Ot as useRecoverEmbeddedWallet,yt as useRegisterMfaListener,ft as useSendTransactionWithCrossApp,rt as useSessionSigners,At as useSetEmbeddedWalletRecovery,St as useSign7702Authorization,ht as useSignMessageWithCrossApp,at as useSignTypedDataWithCrossApp,nt as useSigners,Rt as useStoredUsers,Ht as useSwitchUser,Lt as useTransfer,J as useUnlinkEmail,Y as useUnlinkFarcaster,H as useUnlinkOAuth,Ut as useUnlinkPasskey,q as useUnlinkWallet,ut as useUpdateEmail,it as useUpdatePhone,Wt as useWalletActions};
1
+ import{a as bt,b as Dt,c as Gt,d as jt,e as Et,f as _t,g as Bt,h as Mt}from"./chunk-QSWCX5XI.js";import{a as f,b as I}from"./chunk-PGQ2JGFS.js";import{$ as It,A as et,B as ot,C as rt,D as nt,E as ut,F as it,G as pt,H as st,I as ht,J as at,K as ft,L as At,M as Ot,N as ct,O as mt,P as kt,Q as lt,R as yt,V as xt,W as dt,X as Ut,Y as Pt,Z as vt,_ as wt,aa as d,ba as Tt,ca as gt,da as Ft,e as y,ea as St,f as G,fa as Lt,ga as Wt,h as x,ha as Rt,ia as Ht,j as v,ja as w,k as j,ka as a,l as E,la as Ct,m as _,ma as Nt,n as B,o as M,p as q,q as z,r as J,s as K,t as Q,u as V,v as X,w as Y,x as Z,y as $,z as tt}from"./chunk-23WNYVKL.js";import{b as m,c as k,e as l,h as P}from"./chunk-K5SPDXVF.js";export*from"@privy-io/js-sdk-core";import r from"react";var Kt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=d(),U=y();if(!u)return r.createElement(r.Fragment,null,t);if(p&&e){let n=typeof e=="function"?e(p):e;return r.createElement(r.Fragment,null,n)}return U?r.createElement(r.Fragment,null,i):r.createElement(r.Fragment,null,o)};import{createDataSuffixPlugin as T}from"@privy-io/js-sdk-core";function g(t){return f(t)}function F(t){let{state:e,start:o}=f(k(m({},t),{action:"link"}));return{state:e,link:o}}import{useCallback as S,useContext as L,useEffect as W,useRef as R}from"react";var H=t=>{let{client:e}=L(a),o=R(t);return W(()=>{o.current=t},[t]),{unlinkOAuth:S(U=>l(void 0,[U],function*({provider:u,subject:p}){var n,A,s,O;try{let{user:h}=yield e.auth.oauth.unlink(u,p);return(A=(n=o.current)==null?void 0:n.onSuccess)==null||A.call(n,h),h}catch(h){let c=x(h);throw(O=(s=o.current)==null?void 0:s.onError)==null||O.call(s,c),c}}),[e.auth.oauth])}};import{useContext as C,useEffect as N,useRef as b}from"react";var D=t=>{let{client:e}=C(a),o=b(t.onOAuthTokenGrant);o.current=t.onOAuthTokenGrant,N(()=>{let{unsubscribe:i}=e.addOAuthTokensListener(u=>{o.current(u)});return i},[e])};export{Kt as AuthBoundary,a as PrivyContext,Nt as PrivyProvider,P as SecureStorageAdapter,v as createPrivyClient,T as dataSuffix,Ct as getAccessToken,Bt as hasError,bt as isConnected,Gt as isConnecting,_t as isCreating,jt as isDisconnected,Et as isNotCreated,Dt as isReconnecting,Mt as needsRecovery,Tt as useAcceptTerms,gt as useAuthorizationSignature,lt as useCreateGuestAccount,et as useDepositAddress,It as useEmbeddedBitcoinWallet,vt as useEmbeddedEthereumWallet,wt as useEmbeddedSolanaWallet,ct as useEmbeddedWallet,mt as useEmbeddedWalletStateChange,Ft as useGetEncryptedAuthorizationKey,ot as useHeadlessCryptoDeposit,tt as useHeadlessDelegatedActions,kt as useIdentityToken,Pt as useImportWallet,z as useLinkEmail,Q as useLinkSMS,st as useLinkWithCrossApp,X as useLinkWithFarcaster,F as useLinkWithOAuth,j as useLinkWithSiwe,B as useLinkWithSiws,pt as useLoginWithCrossApp,K as useLoginWithEmail,Z as useLoginWithFarcaster,$ as useLoginWithFarcasterV2,I as useLoginWithOAuth,V as useLoginWithSMS,E as useLoginWithSiwe,M as useLoginWithSiws,xt as useMfa,dt as useMfaEnrollment,w as useMigrateWallets,g as useOAuthFlow,D as useOAuthTokens,G as useOnNeedsRecovery,d as usePrivy,_ as usePrivyClient,Ot as useRecoverEmbeddedWallet,yt as useRegisterMfaListener,ft as useSendTransactionWithCrossApp,rt as useSessionSigners,At as useSetEmbeddedWalletRecovery,St as useSign7702Authorization,ht as useSignMessageWithCrossApp,at as useSignTypedDataWithCrossApp,nt as useSigners,Rt as useStoredUsers,Ht as useSwitchUser,Lt as useTransfer,J as useUnlinkEmail,Y as useUnlinkFarcaster,H as useUnlinkOAuth,Ut as useUnlinkPasskey,q as useUnlinkWallet,ut as useUpdateEmail,it as useUpdatePhone,Wt as useWalletActions};