@privy-io/expo 0.27.1 → 0.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-K6EKFGTE.js +1 -0
- package/dist/esm/chunk-K6EKFGTE.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/passkey.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/passkey.js +1 -1
- package/package.json +7 -2
- package/dist/chunk-FL4SBVAC.js +0 -1
- package/dist/esm/chunk-FL4SBVAC.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var bt=Object.defineProperty,ft=Object.defineProperties;var wt=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Ae=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var ke=(e,t,o)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,k= exports.a =(e,t)=>{for(var o in t||(t={}))Ae.call(t,o)&&ke(e,o,t[o]);if(oe)for(var o of oe(t))Re.call(t,o)&&ke(e,o,t[o]);return e},z= exports.b =(e,t)=>ft(e,wt(t));var pr=(e,t)=>{var o={};for(var r in e)Ae.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Re.call(e,r)&&(o[r]=e[r]);return o};var v=(e,t,o)=>new Promise((r,l)=>{var a=d=>{try{s(o.next(d))}catch(n){l(n)}},c=d=>{try{s(o.throw(d))}catch(n){l(n)}},s=d=>d.done?r(d.value):Promise.resolve(d.value).then(a,c);s((o=o.apply(e,t)).next())});var _expoappleauthentication = require('expo-apple-authentication'); var dt = _interopRequireWildcard(_expoappleauthentication);var _expoapplication = require('expo-application');var _expolinking = require('expo-linking'); var q = _interopRequireWildcard(_expolinking); var de = _interopRequireWildcard(_expolinking); var H = _interopRequireWildcard(_expolinking); var B = _interopRequireWildcard(_expolinking);var _exposecurestore = require('expo-secure-store'); var O = _interopRequireWildcard(_exposecurestore);var _expowebbrowser = require('expo-web-browser'); var re = _interopRequireWildcard(_expowebbrowser); var Ve = _interopRequireWildcard(_expowebbrowser);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _reactnative = require('react-native');var _jssdkcore = require('@privy-io/js-sdk-core'); var _jssdkcore2 = _interopRequireDefault(_jssdkcore);var _expocrypto = require('expo-crypto');var xe={name:"@privy-io/expo",version:"0.27.2",description:"Expo client for the Privy Auth API",keywords:["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],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"}},main:"./dist/esm/index.js",source:"./src/index.ts",types:"./dist/index.d.ts",files:["dist/**/*","LICENSE","README.md"],scripts:{build:"npx tsup --clean --minify",clean:"rm -rf dist .turbo",dev:"npx tsup --watch",format:'eslint "src/**/*.{ts,tsx,js,jsx}" --fix',"generate-types":"npx tsup --dts-only",lint:'eslint "src/**/*.{ts,tsx,js,jsx}" && npx tsc --noEmit',test:'jest --testMatch "**/test/**/*.test.ts"',"test:ci":"npm run test"},browserslist:["defaults","node >= 18","not op_mini all"],dependencies:{"@privy-io/js-sdk-core":"0.29.2","react-fast-compare":"^3.2.2",zustand:"^4.4.1"},devDependencies:{"@privy-io/eslint-config-custom":"*","@privy-io/tsconfig":"*","@simplewebauthn/types":"9.0.1","@svgr/core":"^8.1.0","@svgr/plugin-jsx":"^8.1.0","@svgr/plugin-svgo":"^8.1.0","@tsconfig/node16-strictest-esm":"^1.0.3","eslint-plugin-react-hooks":"^5.0.0-canary-7118f5dd7-20230705",tsup:"^6.2.3",typescript:"~5.5.3"},peerDependencies:{"@expo-google-fonts/inter":"*","@privy-io/expo-native-extensions":"0.0.3","expo-apple-authentication":"*","expo-application":"*","expo-constants":"*","expo-crypto":"*","expo-font":"*","expo-linking":"*","expo-secure-store":"*","expo-web-browser":"*",react:"*","react-native":"*","react-native-passkeys":"^0.3.0","react-native-safe-area-context":"*","react-native-svg":"*","react-native-webview":"*"},peerDependenciesMeta:{"@expo-google-fonts/inter":{optional:!0},"expo-font":{optional:!0}},publishConfig:{access:"public"}};var _reactnativewebview = require('react-native-webview'); var _reactnativewebview2 = _interopRequireDefault(_reactnativewebview);var Pe=({client:e,isClientReady:t,setWebViewState:o,webViewState:r,logLevel:l})=>{let a=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{a.current&&r==="loaded"&&e.setMessagePoster(a.current)},[e,a.current,r==="loaded"]),_react.useEffect.call(void 0, ()=>_reactnative.AppState.addEventListener("change",d=>v(void 0,null,function*(){a.current&&d==="active"&&((yield e.embeddedWallet.ping(500))||(a.current.reload(),o("reloading")))})).remove,[]);let c=_react.useCallback.call(void 0, s=>v(void 0,null,function*(){let{data:d}=s.nativeEvent;e.embeddedWallet.onMessage(JSON.parse(d))}),[e]);return t?_react2.default.createElement(_reactnativewebview2.default,{style:{flex:1},ref:a,cacheEnabled:!1,cacheMode:"LOAD_NO_CACHE",source:{uri:e.embeddedWallet.getURL()},webviewDebuggingEnabled:l==="DEBUG",onLoad:()=>o("loaded"),onError:console.error,onMessage:c}):null};function Le(a){return v(this,arguments,function*({client:e,setSolanaWallet:t,createSolanaWalletCallbacks:o,setSolanaRecoveryFlowState:r,opts:l}){var c,s,d;t({status:"creating"});try{let{user:n}=yield e.user.get(),i=_jssdkcore.getAllUserEmbeddedSolanaWallets.call(void 0, n),u=i[0];if(l!=null&&l.recoveryMethod&&l.recoveryMethod!=="privy")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:"Unsupported recovery method for solana wallet."});if(!(l!=null&&l.createAdditional)&&u)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:"Solana wallet already exists for this user. Set `createAdditional` to `true` to create another wallet"});let y,b;if(u){let S=Math.max(...i.map(w=>w.wallet_index),0)+1,p=yield e.embeddedWallet.createAdditionalSolana({primaryPublicKey:u.address,hdWalletIndex:S});y=p.provider,b=p.user}else{let S=(c=_jssdkcore.getUserEmbeddedWallet.call(void 0, n))!=null?c:void 0;if(S&&S.recovery_method!=="privy")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:"Existing wallet uses unsupported recovery method for solana wallet."});let p=yield e.embeddedWallet.createSolana({ethereumAccount:S});y=p.provider,b=p.user}let m=_jssdkcore.getAllUserEmbeddedSolanaWallets.call(void 0, b)[0];if(!m)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:"Unknown error creating solana wallet"});return(d=(s=o.current)==null?void 0:s.onSuccess)==null||d.call(s,y),t({status:"connected",publicKey:m.public_key}),r({status:"initial"}),y}catch(n){let i=n instanceof Error?n.message:"Error creating embedded wallet";throw t({status:"error",error:i}),r({status:"initial"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:i})}})}function ae(n){return v(this,arguments,function*({client:e,account:t,setWallet:o,recoverWalletCallbacks:r,recoveryMethod:l,setRecoveryFlowState:a,password:c,recoveryToken:s,recoverySecretOverride:d}){var i,u,y,b;if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});switch(l){case"user-passcode":if(!c)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!s)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!d)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Record name is required for icloud recovery method"});break}o({status:"connecting",account:t});try{let m=yield e.embeddedWallet.getProvider(t,c,s,d);return o({status:"connected",provider:m,account:t}),a({status:"initial"}),(u=(i=r.current)==null?void 0:i.onSuccess)==null||u.call(i,m),m}catch(m){o({status:"needs-recovery",account:t}),a({status:"initial"});let S=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:m instanceof Error?m.message:"Error recovering embedded wallet"});throw(b=(y=r.current)==null?void 0:y.onError)==null||b.call(y,S),S}})}function Ie(a){return v(this,arguments,function*({client:e,primaryAcount:t,setSolanaWallet:o,recoverSolanaWalletCallbacks:r,setSolanaRecoveryFlowState:l}){var c,s,d,n;if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});o({status:"connecting"});try{let i=yield e.embeddedWallet.getSolanaProvider(t);return o({status:"connected",publicKey:i._publicKey}),l({status:"initial"}),(s=(c=r.current)==null?void 0:c.onSuccess)==null||s.call(c,i),i}catch(i){o({status:"needs-recovery"}),l({status:"initial"});let u=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:i instanceof Error?i.message:"Error recovering embedded wallet"});throw(n=(d=r.current)==null?void 0:d.onError)==null||n.call(d,u),u}})}var Fe=({client:e,user:t,solanaWallet:o,setSolanaWallet:r,setSolanaRecoveryFlowState:l,webViewState:a,createSolanaWalletCallbacks:c,recoverSolanaWalletCallbacks:s})=>{let d=_react.useMemo.call(void 0, ()=>_jssdkcore.getAllUserEmbeddedSolanaWallets.call(void 0, t),[t]),n=_react.useMemo.call(void 0, ()=>d[0],[d]),i=_react.useMemo.call(void 0, ()=>d.map(m=>({address:m.address,publicKey:m.address,walletIndex:m.wallet_index,getProvider:()=>e.embeddedWallet.getSolanaProvider(m,n==null?void 0:n.public_key)})),[d,n,e]),u=_react.useCallback.call(void 0, m=>v(void 0,null,function*(){return yield Le({client:e,setSolanaWallet:r,createSolanaWalletCallbacks:c,setSolanaRecoveryFlowState:l,opts:m})}),[e,c]),y=_react.useCallback.call(void 0, ()=>v(void 0,null,function*(){if(!n)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});return Ie({client:e,primaryAcount:n,setSolanaWallet:r,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:l})}),[e,n]),b=_react.useCallback.call(void 0, ()=>v(void 0,null,function*(){if(!n)throw r({status:"not-created"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});r(m=>m.status==="connected"?{status:"reconnecting"}:{status:"connecting"});try{let m=yield e.embeddedWallet.getSolanaProvider(n);return r({status:"connected",publicKey:n.public_key}),m}catch(m){throw _jssdkcore.errorIndicatesRecoveryIsNeeded.call(void 0, m)?(r({status:"needs-recovery"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):m instanceof Error?(r({status:"error",error:m.message}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:m.message})):(r({status:"error",error:"Error loading embedded wallet"}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,n]);return _react.useEffect.call(void 0, ()=>{if(!t&&o.status!=="disconnected")return r({status:"disconnected"});a==="loaded"&&b().catch(()=>{})},[a,t,n]),_react.useEffect.call(void 0, ()=>{o.status==="error"&&o.error.includes("User must be logged in")&&b()},[o.status]),{create:u,recover:y,getProvider:b,wallets:i}};function ie(i){return v(this,arguments,function*({client:e,setWallet:t,createWalletCallbacks:o,recoveryMethod:r,setRecoveryFlowState:l,password:a,recoveryToken:c,recoverySecretOverride:s,iCloudRecordNameOverride:d,solanaAccount:n}){var y,b;switch(r){case"user-passcode":if(!a)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!c)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!s||!d)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery failed due to inability to store credentials"});break}t({status:"creating",account:null});let u=r==="icloud"?"icloud-native":r;try{let{provider:m,user:S}=yield e.embeddedWallet.create(a,u,c,s,d,n),p=_jssdkcore.getUserEmbeddedWallet.call(void 0, S);return(b=(y=o.current)==null?void 0:y.onSuccess)==null||b.call(y,m),t({status:"connected",provider:m,account:p}),l({status:"initial"}),m}catch(m){let S=m instanceof Error?m.message:"Error creating embedded wallet";throw t({status:"error",error:S,account:null}),l({status:"initial"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:S})}})}function De(){return v(this,null,function*(){try{return yield Promise.resolve().then(() => _interopRequireWildcard(require("@privy-io/expo-native-extensions")))}catch(e){throw new Error("@privy-io/expo-native-extensions not found. Ensure that you're explicitly including as a dependency, and running an Expo development build")}})}function be(r){return v(this,arguments,function*({user:e,appId:t,client:o}){var s;if(_reactnative.Platform.OS==="android")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let l=yield De(),a=yield o.recovery.icloudAuth.getICloudConfiguration("expo-ios");if(!(a==null?void 0:a.container_identifier))throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:d,iCloudRecordName:n}=yield l.writeRecoverySecretToICloud({containerId:a.container_identifier,appId:t,userId:e.id});return{recoverySecret:d,iCloudRecordName:n}}catch(d){if(d instanceof Error){let n=(s=d.message.split("Caused by: ")[1])!=null?s:"Error writing to iCloud";throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:n})}throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}function je(o){return v(this,arguments,function*({walletAddress:e,client:t}){var d;if(_reactnative.Platform.OS==="android")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let r=yield De(),a=(yield t.recovery.getRecoveryKeyMaterial(e)).icloud_record_name;if(!a)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery not properly backed up."});let c=yield t.recovery.icloudAuth.getICloudConfiguration("expo-ios"),s=c==null?void 0:c.container_identifier;if(!s)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:n}=yield r.readRecoverySecretFromICloud({containerId:s,recordName:a});return{recoverySecret:n}}catch(n){if(n instanceof Error){let i=(d=n.message.split("Caused by: ")[1])!=null?d:"Error writing to iCloud";throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:i})}throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}var _reactfastcompare = require('react-fast-compare'); var _reactfastcompare2 = _interopRequireDefault(_reactfastcompare);var Ne=e=>t=>e(o=>_reactfastcompare2.default.call(void 0, o,t)?o:t);function R(e){return e instanceof Error||e instanceof _jssdkcore.PrivyApiError||e instanceof _jssdkcore.PrivyClientError?e:typeof e=="string"?new Error(e):new Error("Unknown error")}var Kr=e=>new Promise(t=>setTimeout(t,e));function $r(){let e=_react.useRef.call(void 0, _reactnative.AppState.currentState);_react.useEffect.call(void 0, ()=>_reactnative.AppState.addEventListener("change",r=>{e.current=r}).remove,[]);function t(){return _reactnative.AppState.currentState}return{appState:e,getCurrentAppState:t}}function se(l){return v(this,arguments,function*({provider:e,redirectUri:t,client:o,onError:r}){try{let a;switch(e){case"google-drive":{let{url:n}=yield o.recovery.auth.generateURL(de.createURL(t||"/"));a=n;break}default:throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid provider",code:"embedded_wallet_recovery_error"})}let c=yield Ve.openAuthSessionAsync(a);if(_reactnative.Platform.OS==="android")return;if(c.type!=="success")throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth session failed",code:"embedded_wallet_recovery_error"});let{queryParams:s}=de.parse(c.url),d;switch(e){case"google-drive":{let{privy_oauth_state:n,privy_oauth_code:i}=s;if(!i||!n)throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth invalid credentials",code:"embedded_wallet_recovery_error"});d=yield we({oAuthCode:i,oAuthState:n,client:o});break}default:throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth invalid provider",code:"embedded_wallet_recovery_error"})}return d}catch(a){throw r==null||r(R(a)),a}})}function we(r){return v(this,arguments,function*({oAuthCode:e,oAuthState:t,client:o}){let{access_token:l}=yield o.recovery.auth.authorize(e,t);if(!l)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:"login_with_oauth_returned_with_invalid_credentials"});return l})}function le(a){return v(this,arguments,function*({client:e,recoveryInput:t,setWalletRecoveryCallbacks:o,setRecoveryFlowState:r,setWallet:l}){var c,s,d,n;try{let{provider:i,user:u}=yield e.embeddedWallet.setRecovery(t),y=_jssdkcore.getUserEmbeddedWallet.call(void 0, u);return l({status:"connected",provider:i,account:y}),(s=(c=o.current)==null?void 0:c.onSuccess)==null||s.call(c,i),r({status:"initial"}),i}catch(i){let u=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_set_recovery_error",error:i instanceof Error?i.message:"Error setting password on embedded wallet"});throw(n=(d=o.current)==null?void 0:d.onError)==null||n.call(d,u),r({status:"initial"}),u}})}function Be(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}:{recoveryMethod:e.recoveryMethod}}var qe=({client:e,user:t,appId:o,wallet:r,setWallet:l,setRecoveryFlowState:a,webViewState:c,createWalletCallbacks:s,recoverWalletCallbacks:d,setWalletRecoveryCallbacks:n})=>{let i=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedWallet.call(void 0, t),[t]),u=_react.useCallback.call(void 0, p=>v(void 0,null,function*(){var A,V;if(i)throw new (0, _jssdkcore.PrivyClientError)({error:"This user already has an embedded wallet",code:"embedded_wallet_already_exists"});let{user:w}=yield e.user.get(),{password:g,recoveryMethod:f}=Be(p),h,E,U;if(f==="google-drive"&&(h=yield se({provider:f,client:e,onError:(A=s.current)==null?void 0:A.onError}),a({status:"creating-wallet"}),!h))return null;if(f==="icloud"){if(!w)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before creating a wallet with iCloud."});let{recoverySecret:I,iCloudRecordName:M}=yield be({user:w,appId:o,client:e});E=I,U=M}return yield ie({client:e,setWallet:l,createWalletCallbacks:s,recoveryMethod:f,setRecoveryFlowState:a,password:g,recoverySecretOverride:E,iCloudRecordNameOverride:U,solanaAccount:(V=_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, w))!=null?V:void 0})}),[e,i,t]),y=_react.useCallback.call(void 0, p=>v(void 0,null,function*(){var f;if(r.status!=="connected")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"});if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t))throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_set_recovery_error",error:"Cannot set user-controlled recovery for a user with an embedded Solana wallet."});_jssdkcore.throwIfInvalidRecoveryUpgradePath.call(void 0, {currentRecoveryMethod:i.recovery_method,upgradeToRecoveryMethod:p.recoveryMethod});let w,g;switch(p.recoveryMethod){case"privy":g=z(k({},p),{wallet:i});break;case"user-passcode":g=z(k({},p),{wallet:i,password:p.password});break;case"google-drive":if(w=yield se({provider:p.recoveryMethod,client:e,onError:(f=n.current)==null?void 0:f.onError}),a({status:"upgrading-recovery"}),!w)return null;g={recoveryMethod:"google-drive",wallet:i,recoveryAccessToken:w};break;case"icloud":if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before backing up to iCloud."});let{recoverySecret:h,iCloudRecordName:E}=yield be({user:t,appId:o,client:e});g={recoveryMethod:"icloud-native",recoverySecretOverride:h,iCloudRecordNameOverride:E,wallet:i};break;default:throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}return le({client:e,recoveryInput:g,setWalletRecoveryCallbacks:n,setRecoveryFlowState:a,setWallet:l})}),[e,i,r.status,t]),b=_react.useCallback.call(void 0, p=>v(void 0,null,function*(){return y({recoveryMethod:"user-passcode",password:p})}),[e,i,r.status]),m=_react.useCallback.call(void 0, p=>v(void 0,null,function*(){var E;if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{password:w,recoveryMethod:g}=Be(p),f,h;if(g==="google-drive"&&(f=yield se({provider:g,client:e,onError:(E=d.current)==null?void 0:E.onError}),a({status:"recovering"}),!f))return null;if(g==="icloud"){if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before recovering via iCloud."});let{recoverySecret:U}=yield je({client:e,walletAddress:i.address});h=U}return ae({client:e,account:i,setWallet:l,recoverWalletCallbacks:d,recoveryMethod:g,setRecoveryFlowState:a,password:w,recoveryToken:f,recoverySecretOverride:h})}),[e,i]),S=_react.useCallback.call(void 0, ()=>v(void 0,null,function*(){if(!i)throw l({status:"not-created",account:null}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});l(p=>p.status==="connected"?{status:"reconnecting",account:i}:{status:"connecting",account:i});try{let p=yield e.embeddedWallet.getProvider(i);return l({status:"connected",provider:p,account:i}),p}catch(p){throw _jssdkcore.errorIndicatesRecoveryIsNeeded.call(void 0, p)?(l({status:"needs-recovery",account:i}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):p instanceof Error?(l({status:"error",error:p.message,account:i}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:p.message})):(l({status:"error",error:"Error loading embedded wallet",account:i}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,i]);return _react.useEffect.call(void 0, ()=>{if(!t&&r.status!=="disconnected")return l({status:"disconnected",account:null});c==="loaded"&&S().catch(()=>{})},[c,t,i]),_react.useEffect.call(void 0, ()=>{r.status==="error"&&r.error.includes("User must be logged in")&&S()},[r.status]),{create:u,recover:m,setPassword:b,setRecovery:y,getProvider:S}};var Ge=({client:e,user:t,isReady:o,customAuth:r})=>{let[l,a]=_react.useState.call(void 0, {status:"initial"});return _react.useEffect.call(void 0, ()=>{(()=>v(void 0,null,function*(){if(!(r!=null&&r.enabled)){a({status:"not-enabled"});return}a({status:"loading"});let{getCustomAccessToken:s,isLoading:d}=r;if(!(!o||d))try{let n=yield s();if(!n&&t){yield e.auth.logout(),a({status:"done"});return}if(!n){a({status:"done"});return}if(t){a({status:"done"});return}if(!(yield e.auth.customProvider.syncWithToken(n))){yield e.auth.logout(),a({status:"error",error:new (0, _jssdkcore.PrivyClientError)({error:"Failed to sync with custom auth provider",code:"third_party_auth_error"})});return}a({status:"done"})}catch(n){if(console.log("Error syncing with custom auth provider",n),a({status:"error",error:n}),t)throw yield e.auth.logout(),new (0, _jssdkcore.PrivyClientError)({error:"Third-party auth failed",code:"third_party_auth_error"})}}))()},[e,t,o,r==null?void 0:r.enabled,r==null?void 0:r.getCustomAccessToken,r==null?void 0:r.isLoading]),{customAuthState:l,customAuthStateIsSettled:l.status!=="loading"&&l.status!=="initial"}};var Ye=({client:e,user:t,isUserInitialized:o,oAuthState:r,oAuthCallbacks:l,setOAuthState:a,recoveryFlowState:c,oAuthStateRef:s})=>{let d=H.useURL(),n=_react.useCallback.call(void 0, i=>{var y,b;let u=R(i);a({status:"error",error:u}),(b=(y=l.current).onError)==null||b.call(y,u)},[a]);return _react.useEffect.call(void 0, ()=>{function i(){return v(this,null,function*(){var m,S;if(!d||r.status!=="loading"||c.status!=="initial")return;let{queryParams:u}=H.parse(d),{privy_oauth_state:y,privy_oauth_code:b}=u;if(!b||!y){a({status:"done"});return}try{let p,w;if(t)p=yield e.auth.oauth.linkWithCode(b,y);else{let g=yield e.auth.oauth.loginWithCode(b,y,void 0,void 0,s.current.disableSignup?"no-signup":"login-or-sign-up");p=g.user,w=!!g.is_new_user}return(S=(m=l.current).onSuccess)==null||S.call(m,p,w),s.current={},a({status:"done"}),yield H.openURL(d.split("?")[0])}catch(p){s.current={},n(p)}})}_reactnative.Platform.OS==="android"&&o&&i()},[d,o])};var Xe=({client:e,user:t,createWalletCallbacks:o,recoverWalletCallbacks:r,setWalletRecoveryCallbacks:l,recoveryFlowState:a,oAuthState:c,setRecoveryFlowState:s,setWallet:d,appStateVisible:n,webViewLoaded:i})=>{let u=B.useURL(),y=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedWallet.call(void 0, t),[t]),b=_react.useCallback.call(void 0, m=>{var p,w,g,f;let S=R(m);a.status==="creating-wallet"?(w=(p=o.current).onError)==null||w.call(p,R(S)):(f=(g=r.current).onError)==null||f.call(g,R(S)),s({status:"initial"})},[a]);return _react.useEffect.call(void 0, ()=>{function m(){return v(this,null,function*(){var g;if(!u&&a.status!=="initial"&&n&&b(new Error("Recovery OAuth session failed")),!u||a.status==="initial"||c.status!=="initial"||!n||!i)return;let{queryParams:S}=B.parse(u),{privy_oauth_state:p,privy_oauth_code:w}=S;if(!(!w||!p)){yield B.openURL(u.split("?")[0]);try{let f=yield we({oAuthCode:w,oAuthState:p,client:e});if(a.status==="creating-wallet"){let h=(g=_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t))!=null?g:void 0;yield ie({client:e,setWallet:d,createWalletCallbacks:o,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:f,solanaAccount:h})}else if(a.status==="upgrading-recovery"){if(!y)throw new Error("Embedded wallet not found");yield le({client:e,recoveryInput:{recoveryMethod:"google-drive",wallet:y,recoveryAccessToken:f},setWalletRecoveryCallbacks:l,setRecoveryFlowState:s,setWallet:d})}else yield ae({client:e,account:y,setWallet:d,recoverWalletCallbacks:r,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:f})}catch(f){b(f)}}})}_reactnative.Platform.OS==="android"&&m()},[u,a.status,n,i])};var Je=({client:e,isUserInitialized:t,setIsUserInitialized:o})=>{_react.useEffect.call(void 0, ()=>{t||(()=>v(void 0,null,function*(){try{yield e.user.get()}catch(l){}finally{o(!0)}}))()},[t])};var _zustand = require('zustand');var x=class extends Error{constructor(o,r){super(r);this.code=o,this.error=r}};var ge={success:e=>({value:e}),error:e=>({error:e})};var $e=e=>{let t=Array.from(new Set(e));return t.length===0?ge.error(new x("no_login_methods_available","No login methods available")):ge.success(t)},Qe=e=>e.length<=2?e[0]:null,Jo= exports.p =(e,t)=>{if(e.length!==2)return null;let[o,r]=e;return t===o?r:o},$o= exports.q ={email:"email",sms:"phone"};var tr=1e3*60*5,L=_zustand.create.call(void 0, )((e,t)=>({privyElementsConfig:null,loginPromiseExecutor:null,isUIMounted:!1,activeLoginMethod:null,updateUIMounted:o=>e({isUIMounted:o}),openLoginFlow:(o,r,l)=>new Promise((a,c)=>{if(r!==null)return c(new x("user_already_logged_in","User is already logged in"));if(!t().isUIMounted)return c(new x("privy_elements_not_ready","Privy Elements is not mounted"));if(t().loginPromiseExecutor!==null)return c(new x("existing_login_flow_in_progress","A login flow is already in progress"));let s=$e(o.loginMethods);if(s.error)return c(s.error);let d={loginMethods:s.value},n=setTimeout(()=>{c(new x("login_flow_timeout","The login flow timed out")),t().closeLoginFlow()},tr);l(),e({loginPromiseExecutor:{resolve(u){clearTimeout(n),a(u)},reject(u){clearTimeout(n),c(u)}},privyElementsConfig:d,activeLoginMethod:Qe(d.loginMethods)})}),closeLoginFlow:()=>{var o;return(o=t().loginPromiseExecutor)==null||o.reject(new x("login_flow_closed","The login flow was closed")),e({privyElementsConfig:null,loginPromiseExecutor:null})},goBack:()=>{var s;let{activeLoginMethod:o,privyElementsConfig:r,updateActiveLoginMethod:l,closeLoginFlow:a}=t(),c=(s=r==null?void 0:r.loginMethods.length)!=null?s:0;o===null||c<3?a():l(null)},updateActiveLoginMethod:o=>e({activeLoginMethod:o})})),oa= exports.r =()=>L(e=>e.privyElementsConfig),aa= exports.s =()=>L(e=>e.openLoginFlow),na= exports.t =()=>L(e=>e.closeLoginFlow),ia= exports.u =()=>L(e=>e.goBack),da= exports.v =()=>L(e=>[e.activeLoginMethod,e.updateActiveLoginMethod]),rr=e=>{let{loginPromiseExecutor:t}=L.getState();t==null||t.resolve(e)},Ze=()=>rr,sa= exports.w =()=>{let e=L(t=>t.updateUIMounted);_react.useEffect.call(void 0, ()=>(e(!0),()=>{e(!1)}),[e])},la= exports.x =()=>L(e=>e.privyElementsConfig!==null);var Se=_react.createContext.call(void 0, {}),j;function ka(e){return j?j.getAccessToken():e!=null&&e.strict?Promise.reject(new (0, _jssdkcore.PrivyClientError)({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 Aa=e=>{var Ce;let[t,o]=_react.useState.call(void 0, _reactnative.AppState.currentState==="active");_react.useEffect.call(void 0, ()=>{let F=_reactnative.AppState.addEventListener("change",vt=>{o(vt==="active")});return()=>{F.remove()}},[]);let[r,l]=_react.useState.call(void 0, !1),[a,c]=_react.useState.call(void 0, "loading"),[s,d]=_react.useState.call(void 0, !1),[n,i]=_react.useState.call(void 0, null),[u,y]=_react.useState.call(void 0, {status:"disconnected",account:null}),[b,m]=_react.useState.call(void 0, {status:"disconnected"}),[S,p]=_react.useState.call(void 0, {status:"initial"}),[w,g]=_react.useState.call(void 0, {status:"initial"}),f=_react.useRef.call(void 0, {}),[h,E]=_react.useState.call(void 0, {status:"initial"}),[U,A]=_react.useState.call(void 0, {status:"initial"}),[V,I]=_react.useState.call(void 0, {status:"initial"}),[M,K]=_react.useState.call(void 0, {status:"initial"}),[G,Y]=_react.useState.call(void 0, {status:"initial"}),X=_react.useRef.call(void 0, {}),ue=_react.useRef.call(void 0, {}),pe=_react.useRef.call(void 0, {}),me=_react.useRef.call(void 0, {}),_e=_react.useRef.call(void 0, {}),We=_react.useRef.call(void 0, {}),st=Ze(),J=_react.useCallback.call(void 0, F=>{if(F){st(F),Ne(i)(F);return}i(null),p({status:"initial"}),g({status:"initial"}),y({status:"disconnected",account:null})},[]),_=_react.useMemo.call(void 0, ()=>{let F=e.storage||at;return e.client?(j=e.client,j.setCallbacks({setUser:J,setIsReady:d}),j):(j=new (0, _jssdkcore2.default)({storage:ot(F),appId:e.appId,clientId:e.clientId,supportedChains:e.supportedChains,nativeAppIdentifier:rt(),baseUrl:e.baseUrl,sdkVersion:`expo:${xe.version}`,callbacks:{setUser:J,setIsReady:d},logLevel:e.logLevel,crypto:{digest:_expocrypto.digest}}),j)},[e.client,e.storage,e.appId,e.clientId,e.baseUrl,e.supportedChains,e.logLevel,J]),lt=_react.useCallback.call(void 0, ()=>(J(null),_.auth.logout()),[J,_]),ct=_react.useCallback.call(void 0, ()=>_.getAccessToken(),[_]),ut=_react.useCallback.call(void 0, ()=>_.getIdentityToken(),[_]);Je({client:_,isUserInitialized:r,setIsUserInitialized:l});let pt=qe({client:_,user:n,appId:e.appId,webViewState:a,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,setRecoveryFlowState:E,wallet:u,setWallet:y}),mt=Fe({client:_,user:n,webViewState:a,createSolanaWalletCallbacks:_e,recoverSolanaWalletCallbacks:We,setSolanaRecoveryFlowState:A,solanaWallet:b,setSolanaWallet:m});Ye({client:_,isUserInitialized:r,user:n,oAuthState:w,setOAuthState:g,oAuthCallbacks:X,recoveryFlowState:h,oAuthStateRef:f}),Xe({client:_,user:n,webViewLoaded:a==="loaded",createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,recoveryFlowState:h,oAuthState:w,setRecoveryFlowState:E,setWallet:y,appStateVisible:t});let{customAuthStateIsSettled:yt}=Ge({client:_,user:n,isReady:r,customAuth:(Ce=e.config)==null?void 0:Ce.customAuth});return _react2.default.createElement(_react2.default.Fragment,null,_react2.default.createElement(Se.Provider,{value:{client:_,user:n,isReady:a!=="loading"&&r&&tt(w)&&yt,logout:lt,getAccessToken:ct,getIdentityToken:ut,wallet:k(k({},u),pt),solanaWallet:k(k({},b),mt),oAuthState:w,oAuthCallbacks:X,recoveryFlowState:h,setRecoveryFlowState:E,solanaRecoveryFlowState:U,setSolanaRecoveryFlowState:A,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,createSolanaWalletCallbacks:_e,recoverSolanaWalletCallbacks:We,setOAuthState:g,siweState:V,setSiweState:I,otpState:S,setOtpState:p,passkeyState:M,setPasskeyState:K,farcasterState:G,setFarcasterState:Y,oAuthStateRef:f}},e.children),_react2.default.createElement(_reactnative.View,{style:{width:0,height:0,overflow:"hidden"}},_react2.default.createElement(Pe,{logLevel:e.logLevel,client:_,isClientReady:s,setWebViewState:c,webViewState:a})))};var tt=e=>e.status!=="loading",Ee=(e={})=>{let{user:t,oAuthState:o,setOAuthState:r,oAuthCallbacks:l,client:a,oAuthStateRef:c}=_react.useContext.call(void 0, Se),s=e.action?e.action==="login":!t;_react.useEffect.call(void 0, ()=>{l.current={onSuccess:e.onSuccess,onError:e.onError}},[e.onSuccess,e.onError]);let d=_react.useCallback.call(void 0, i=>{var y;let u=R(i);return r({status:"error",error:u}),(y=e==null?void 0:e.onError)==null||y.call(e,u),u},[e==null?void 0:e.onError]);return{start:_react.useCallback.call(void 0, function(S){return v(this,arguments,function*({provider:u,redirectUri:y,isLegacyAppleIosBehaviorEnabled:b=!1,disableSignup:m}){var p,w,g;r({status:"loading"}),c.current={disableSignup:m};try{if(t&&e.action==="login")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!t&&e.action==="link")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});let{url:f}=yield a.auth.oauth.generateURL(u,q.createURL(y||"/")),h,E;if(_reactnative.Platform.OS==="ios"&&u==="apple"&&!b){let G=(p=new URL(f).searchParams.get("state"))!=null?p:"",Y=yield dt.signInAsync({state:G});if(!Y.authorizationCode)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let X=yield a.auth.oauth.loginWithCode(Y.authorizationCode,G,u,"raw",m?"no-signup":"login-or-sign-up");h=X.user,E=X.is_new_user}else h=yield a.auth.oauth.linkWithCode(Y.authorizationCode,G,u,"raw");return(w=e==null?void 0:e.onSuccess)==null||w.call(e,h,E),r({status:"done"}),h!=null?h:void 0}let U=_reactnative.Platform.OS==="android"?f.replace("x.com","twitter.com"):f,A=yield re.openAuthSessionAsync(U);if(_reactnative.Platform.OS==="android")return;if(A.type!=="success")throw[re.WebBrowserResultType.CANCEL,re.WebBrowserResultType.DISMISS].includes(A.type)?new (0, _jssdkcore.PrivyClientError)({error:"OAuth was cancelled",code:s?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):new (0, _jssdkcore.PrivyClientError)({error:"OAuth session failed",code:s?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let{queryParams:V}=q.parse(A.url),{privy_oauth_state:I,privy_oauth_code:M}=V;if(!M||!I)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let K=yield a.auth.oauth.loginWithCode(M,I,u,void 0,m?"no-signup":"login-or-sign-up");h=K.user,E=K.is_new_user}else h=yield a.auth.oauth.linkWithCode(M,I,u);return(g=e==null?void 0:e.onSuccess)==null||g.call(e,h,E),yield q.openURL(A.url.split("?")[0]),r({status:"done"}),h!=null?h:void 0}catch(f){d(f)}})},[t,a,r,d]),state:o}};function Fa(e){let{state:t,start:o}=Ee(z(k({},e),{action:"login"}));return{state:t,login:o}}function Ta(e){let{state:t,start:o}=Ee(z(k({},e),{action:"link"}));return{state:t,link:o}}function Da(e){return Ee(e)}var rt=()=>{if(typeof _expoapplication.applicationId!="string")throw new (0, _jssdkcore.PrivyClientError)({error:"Cannot determine native application ID. Please make sure `expo-application` is installed as a dependency and that `ios.bundleId` or `android.package` is set.",code:"invalid_native_app_id"});return _expoapplication.applicationId};function ot(e){return{get(t){return e.get(t.replaceAll(":","-"))},put(t,o){return e.put(t.replaceAll(":","-"),o)},del(t){return e.del(t.replaceAll(":","-"))},getKeys:()=>v(this,null,function*(){return[]})}}var at={get(e){return O.getItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},put(e,t){return O.setItemAsync(e,t,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},del(e){return O.deleteItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},getKeys:()=>v(void 0,null,function*(){return[]})};function Va(e){return e.status==="connected"}function za(e){return e.status==="reconnecting"}function Ha(e){return e.status==="connecting"}function Ba(e){return e.status==="disconnected"}function qa(e){return e.status==="not-created"}function Ka(e){return e.status==="creating"}function Ga(e){return e.status==="error"}function Ya(e){return e.status==="needs-recovery"}exports.a = k; exports.b = z; exports.c = pr; exports.d = v; exports.e = xe; exports.f = R; exports.g = Kr; exports.h = $r; exports.i = Fa; exports.j = Ta; exports.k = Da; exports.l = rt; exports.m = ot; exports.n = at; exports.o = x; exports.p = Jo; exports.q = $o; exports.r = oa; exports.s = aa; exports.t = na; exports.u = ia; exports.v = da; exports.w = sa; exports.x = la; exports.y = Se; exports.z = ka; exports.A = Aa; exports.B = Va; exports.C = za; exports.D = Ha; exports.E = Ba; exports.F = qa; exports.G = Ka; exports.H = Ga; exports.I = Ya;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var bt=Object.defineProperty,ft=Object.defineProperties;var wt=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Ae=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var ke=(e,t,o)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,k=(e,t)=>{for(var o in t||(t={}))Ae.call(t,o)&&ke(e,o,t[o]);if(oe)for(var o of oe(t))Re.call(t,o)&&ke(e,o,t[o]);return e},z=(e,t)=>ft(e,wt(t));var pr=(e,t)=>{var o={};for(var r in e)Ae.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Re.call(e,r)&&(o[r]=e[r]);return o};var v=(e,t,o)=>new Promise((r,l)=>{var a=d=>{try{s(o.next(d))}catch(n){l(n)}},c=d=>{try{s(o.throw(d))}catch(n){l(n)}},s=d=>d.done?r(d.value):Promise.resolve(d.value).then(a,c);s((o=o.apply(e,t)).next())});import*as dt from"expo-apple-authentication";import{applicationId as nt}from"expo-application";import*as q from"expo-linking";import*as O from"expo-secure-store";import*as re from"expo-web-browser";import{useCallback as it,useContext as cr,useEffect as ur}from"react";import{Platform as he}from"react-native";import{PrivyClientError as N}from"@privy-io/js-sdk-core";import{digest as or}from"expo-crypto";import te,{useState as W,useMemo as ar,createContext as nr,useCallback as ce,useRef as D,useEffect as ir}from"react";import{AppState as et,View as dr}from"react-native";import sr,{PrivyClientError as lr}from"@privy-io/js-sdk-core";var xe={name:"@privy-io/expo",version:"0.27.2",description:"Expo client for the Privy Auth API",keywords:["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],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"}},main:"./dist/esm/index.js",source:"./src/index.ts",types:"./dist/index.d.ts",files:["dist/**/*","LICENSE","README.md"],scripts:{build:"npx tsup --clean --minify",clean:"rm -rf dist .turbo",dev:"npx tsup --watch",format:'eslint "src/**/*.{ts,tsx,js,jsx}" --fix',"generate-types":"npx tsup --dts-only",lint:'eslint "src/**/*.{ts,tsx,js,jsx}" && npx tsc --noEmit',test:'jest --testMatch "**/test/**/*.test.ts"',"test:ci":"npm run test"},browserslist:["defaults","node >= 18","not op_mini all"],dependencies:{"@privy-io/js-sdk-core":"0.29.2","react-fast-compare":"^3.2.2",zustand:"^4.4.1"},devDependencies:{"@privy-io/eslint-config-custom":"*","@privy-io/tsconfig":"*","@simplewebauthn/types":"9.0.1","@svgr/core":"^8.1.0","@svgr/plugin-jsx":"^8.1.0","@svgr/plugin-svgo":"^8.1.0","@tsconfig/node16-strictest-esm":"^1.0.3","eslint-plugin-react-hooks":"^5.0.0-canary-7118f5dd7-20230705",tsup:"^6.2.3",typescript:"~5.5.3"},peerDependencies:{"@expo-google-fonts/inter":"*","@privy-io/expo-native-extensions":"0.0.3","expo-apple-authentication":"*","expo-application":"*","expo-constants":"*","expo-crypto":"*","expo-font":"*","expo-linking":"*","expo-secure-store":"*","expo-web-browser":"*",react:"*","react-native":"*","react-native-passkeys":"^0.3.0","react-native-safe-area-context":"*","react-native-svg":"*","react-native-webview":"*"},peerDependenciesMeta:{"@expo-google-fonts/inter":{optional:!0},"expo-font":{optional:!0}},publishConfig:{access:"public"}};import St from"react";import{useCallback as ht,useEffect as Oe,useRef as Et}from"react";import{AppState as _t}from"react-native";import Wt from"react-native-webview";var Pe=({client:e,isClientReady:t,setWebViewState:o,webViewState:r,logLevel:l})=>{let a=Et(null);Oe(()=>{a.current&&r==="loaded"&&e.setMessagePoster(a.current)},[e,a.current,r==="loaded"]),Oe(()=>_t.addEventListener("change",d=>v(void 0,null,function*(){a.current&&d==="active"&&((yield e.embeddedWallet.ping(500))||(a.current.reload(),o("reloading")))})).remove,[]);let c=ht(s=>v(void 0,null,function*(){let{data:d}=s.nativeEvent;e.embeddedWallet.onMessage(JSON.parse(d))}),[e]);return t?St.createElement(Wt,{style:{flex:1},ref:a,cacheEnabled:!1,cacheMode:"LOAD_NO_CACHE",source:{uri:e.embeddedWallet.getURL()},webviewDebuggingEnabled:l==="DEBUG",onLoad:()=>o("loaded"),onError:console.error,onMessage:c}):null};import{useCallback as ye,useEffect as Me,useMemo as ve}from"react";import{errorIndicatesRecoveryIsNeeded as kt,getAllUserEmbeddedSolanaWallets as At,PrivyClientError as Q}from"@privy-io/js-sdk-core";import{getAllUserEmbeddedSolanaWallets as Ue,getUserEmbeddedWallet as Ct}from"@privy-io/js-sdk-core";import{PrivyClientError as $}from"@privy-io/js-sdk-core";function Le(a){return v(this,arguments,function*({client:e,setSolanaWallet:t,createSolanaWalletCallbacks:o,setSolanaRecoveryFlowState:r,opts:l}){var c,s,d;t({status:"creating"});try{let{user:n}=yield e.user.get(),i=Ue(n),u=i[0];if(l!=null&&l.recoveryMethod&&l.recoveryMethod!=="privy")throw new $({code:"embedded_wallet_creation_error",error:"Unsupported recovery method for solana wallet."});if(!(l!=null&&l.createAdditional)&&u)throw new $({code:"embedded_wallet_creation_error",error:"Solana wallet already exists for this user. Set `createAdditional` to `true` to create another wallet"});let y,b;if(u){let S=Math.max(...i.map(w=>w.wallet_index),0)+1,p=yield e.embeddedWallet.createAdditionalSolana({primaryPublicKey:u.address,hdWalletIndex:S});y=p.provider,b=p.user}else{let S=(c=Ct(n))!=null?c:void 0;if(S&&S.recovery_method!=="privy")throw new $({code:"embedded_wallet_creation_error",error:"Existing wallet uses unsupported recovery method for solana wallet."});let p=yield e.embeddedWallet.createSolana({ethereumAccount:S});y=p.provider,b=p.user}let m=Ue(b)[0];if(!m)throw new $({code:"embedded_wallet_creation_error",error:"Unknown error creating solana wallet"});return(d=(s=o.current)==null?void 0:s.onSuccess)==null||d.call(s,y),t({status:"connected",publicKey:m.public_key}),r({status:"initial"}),y}catch(n){let i=n instanceof Error?n.message:"Error creating embedded wallet";throw t({status:"error",error:i}),r({status:"initial"}),new $({code:"embedded_wallet_creation_error",error:i})}})}import{PrivyClientError as T}from"@privy-io/js-sdk-core";function ae(n){return v(this,arguments,function*({client:e,account:t,setWallet:o,recoverWalletCallbacks:r,recoveryMethod:l,setRecoveryFlowState:a,password:c,recoveryToken:s,recoverySecretOverride:d}){var i,u,y,b;if(!t)throw new T({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});switch(l){case"user-passcode":if(!c)throw new T({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!s)throw new T({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!d)throw new T({code:"embedded_wallet_recovery_error",error:"Record name is required for icloud recovery method"});break}o({status:"connecting",account:t});try{let m=yield e.embeddedWallet.getProvider(t,c,s,d);return o({status:"connected",provider:m,account:t}),a({status:"initial"}),(u=(i=r.current)==null?void 0:i.onSuccess)==null||u.call(i,m),m}catch(m){o({status:"needs-recovery",account:t}),a({status:"initial"});let S=new T({code:"embedded_wallet_recovery_error",error:m instanceof Error?m.message:"Error recovering embedded wallet"});throw(b=(y=r.current)==null?void 0:y.onError)==null||b.call(y,S),S}})}function Ie(a){return v(this,arguments,function*({client:e,primaryAcount:t,setSolanaWallet:o,recoverSolanaWalletCallbacks:r,setSolanaRecoveryFlowState:l}){var c,s,d,n;if(!t)throw new T({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});o({status:"connecting"});try{let i=yield e.embeddedWallet.getSolanaProvider(t);return o({status:"connected",publicKey:i._publicKey}),l({status:"initial"}),(s=(c=r.current)==null?void 0:c.onSuccess)==null||s.call(c,i),i}catch(i){o({status:"needs-recovery"}),l({status:"initial"});let u=new T({code:"embedded_wallet_recovery_error",error:i instanceof Error?i.message:"Error recovering embedded wallet"});throw(n=(d=r.current)==null?void 0:d.onError)==null||n.call(d,u),u}})}var Fe=({client:e,user:t,solanaWallet:o,setSolanaWallet:r,setSolanaRecoveryFlowState:l,webViewState:a,createSolanaWalletCallbacks:c,recoverSolanaWalletCallbacks:s})=>{let d=ve(()=>At(t),[t]),n=ve(()=>d[0],[d]),i=ve(()=>d.map(m=>({address:m.address,publicKey:m.address,walletIndex:m.wallet_index,getProvider:()=>e.embeddedWallet.getSolanaProvider(m,n==null?void 0:n.public_key)})),[d,n,e]),u=ye(m=>v(void 0,null,function*(){return yield Le({client:e,setSolanaWallet:r,createSolanaWalletCallbacks:c,setSolanaRecoveryFlowState:l,opts:m})}),[e,c]),y=ye(()=>v(void 0,null,function*(){if(!n)throw new Q({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});return Ie({client:e,primaryAcount:n,setSolanaWallet:r,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:l})}),[e,n]),b=ye(()=>v(void 0,null,function*(){if(!n)throw r({status:"not-created"}),new Q({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});r(m=>m.status==="connected"?{status:"reconnecting"}:{status:"connecting"});try{let m=yield e.embeddedWallet.getSolanaProvider(n);return r({status:"connected",publicKey:n.public_key}),m}catch(m){throw kt(m)?(r({status:"needs-recovery"}),new Q({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):m instanceof Error?(r({status:"error",error:m.message}),new Q({code:"unknown_embedded_wallet_error",error:m.message})):(r({status:"error",error:"Error loading embedded wallet"}),new Q({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,n]);return Me(()=>{if(!t&&o.status!=="disconnected")return r({status:"disconnected"});a==="loaded"&&b().catch(()=>{})},[a,t,n]),Me(()=>{o.status==="error"&&o.error.includes("User must be logged in")&&b()},[o.status]),{create:u,recover:y,getProvider:b,wallets:i}};import{useCallback as ee,useEffect as ze,useMemo as Tt}from"react";import{getUserEmbeddedSolanaWallet as He,throwIfInvalidRecoveryUpgradePath as Dt}from"@privy-io/js-sdk-core";import{errorIndicatesRecoveryIsNeeded as jt,getUserEmbeddedWallet as Nt,PrivyClientError as C}from"@privy-io/js-sdk-core";import{getUserEmbeddedWallet as Rt}from"@privy-io/js-sdk-core";import{PrivyClientError as ne}from"@privy-io/js-sdk-core";function ie(i){return v(this,arguments,function*({client:e,setWallet:t,createWalletCallbacks:o,recoveryMethod:r,setRecoveryFlowState:l,password:a,recoveryToken:c,recoverySecretOverride:s,iCloudRecordNameOverride:d,solanaAccount:n}){var y,b;switch(r){case"user-passcode":if(!a)throw new ne({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!c)throw new ne({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!s||!d)throw new ne({code:"embedded_wallet_recovery_error",error:"iCloud recovery failed due to inability to store credentials"});break}t({status:"creating",account:null});let u=r==="icloud"?"icloud-native":r;try{let{provider:m,user:S}=yield e.embeddedWallet.create(a,u,c,s,d,n),p=Rt(S);return(b=(y=o.current)==null?void 0:y.onSuccess)==null||b.call(y,m),t({status:"connected",provider:m,account:p}),l({status:"initial"}),m}catch(m){let S=m instanceof Error?m.message:"Error creating embedded wallet";throw t({status:"error",error:S,account:null}),l({status:"initial"}),new ne({code:"embedded_wallet_creation_error",error:S})}})}import{Platform as Te}from"react-native";import{PrivyClientError as P}from"@privy-io/js-sdk-core";function De(){return v(this,null,function*(){try{return yield import("@privy-io/expo-native-extensions")}catch(e){throw new Error("@privy-io/expo-native-extensions not found. Ensure that you're explicitly including as a dependency, and running an Expo development build")}})}function be(r){return v(this,arguments,function*({user:e,appId:t,client:o}){var s;if(Te.OS==="android")throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let l=yield De(),a=yield o.recovery.icloudAuth.getICloudConfiguration("expo-ios");if(!(a==null?void 0:a.container_identifier))throw new P({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:d,iCloudRecordName:n}=yield l.writeRecoverySecretToICloud({containerId:a.container_identifier,appId:t,userId:e.id});return{recoverySecret:d,iCloudRecordName:n}}catch(d){if(d instanceof Error){let n=(s=d.message.split("Caused by: ")[1])!=null?s:"Error writing to iCloud";throw new P({code:"embedded_wallet_recovery_error",error:n})}throw new P({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}function je(o){return v(this,arguments,function*({walletAddress:e,client:t}){var d;if(Te.OS==="android")throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let r=yield De(),a=(yield t.recovery.getRecoveryKeyMaterial(e)).icloud_record_name;if(!a)throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery not properly backed up."});let c=yield t.recovery.icloudAuth.getICloudConfiguration("expo-ios"),s=c==null?void 0:c.container_identifier;if(!s)throw new P({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:n}=yield r.readRecoverySecretFromICloud({containerId:s,recordName:a});return{recoverySecret:n}}catch(n){if(n instanceof Error){let i=(d=n.message.split("Caused by: ")[1])!=null?d:"Error writing to iCloud";throw new P({code:"embedded_wallet_recovery_error",error:i})}throw new P({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}import*as de from"expo-linking";import*as Ve from"expo-web-browser";import{Platform as It}from"react-native";import{PrivyClientError as Z}from"@privy-io/js-sdk-core";import xt from"react-fast-compare";var Ne=e=>t=>e(o=>xt(o,t)?o:t);import{PrivyApiError as Ot,PrivyClientError as Pt}from"@privy-io/js-sdk-core";function R(e){return e instanceof Error||e instanceof Ot||e instanceof Pt?e:typeof e=="string"?new Error(e):new Error("Unknown error")}var Kr=e=>new Promise(t=>setTimeout(t,e));import{useEffect as Ut,useRef as Lt}from"react";import{AppState as fe}from"react-native";function $r(){let e=Lt(fe.currentState);Ut(()=>fe.addEventListener("change",r=>{e.current=r}).remove,[]);function t(){return fe.currentState}return{appState:e,getCurrentAppState:t}}function se(l){return v(this,arguments,function*({provider:e,redirectUri:t,client:o,onError:r}){try{let a;switch(e){case"google-drive":{let{url:n}=yield o.recovery.auth.generateURL(de.createURL(t||"/"));a=n;break}default:throw new Z({error:"OAuth invalid provider",code:"embedded_wallet_recovery_error"})}let c=yield Ve.openAuthSessionAsync(a);if(It.OS==="android")return;if(c.type!=="success")throw new Z({error:"Recovery OAuth session failed",code:"embedded_wallet_recovery_error"});let{queryParams:s}=de.parse(c.url),d;switch(e){case"google-drive":{let{privy_oauth_state:n,privy_oauth_code:i}=s;if(!i||!n)throw new Z({error:"Recovery OAuth invalid credentials",code:"embedded_wallet_recovery_error"});d=yield we({oAuthCode:i,oAuthState:n,client:o});break}default:throw new Z({error:"Recovery OAuth invalid provider",code:"embedded_wallet_recovery_error"})}return d}catch(a){throw r==null||r(R(a)),a}})}function we(r){return v(this,arguments,function*({oAuthCode:e,oAuthState:t,client:o}){let{access_token:l}=yield o.recovery.auth.authorize(e,t);if(!l)throw new Z({error:"OAuth invalid credentials",code:"login_with_oauth_returned_with_invalid_credentials"});return l})}import{getUserEmbeddedWallet as Mt,PrivyClientError as Ft}from"@privy-io/js-sdk-core";function le(a){return v(this,arguments,function*({client:e,recoveryInput:t,setWalletRecoveryCallbacks:o,setRecoveryFlowState:r,setWallet:l}){var c,s,d,n;try{let{provider:i,user:u}=yield e.embeddedWallet.setRecovery(t),y=Mt(u);return l({status:"connected",provider:i,account:y}),(s=(c=o.current)==null?void 0:c.onSuccess)==null||s.call(c,i),r({status:"initial"}),i}catch(i){let u=new Ft({code:"embedded_wallet_set_recovery_error",error:i instanceof Error?i.message:"Error setting password on embedded wallet"});throw(n=(d=o.current)==null?void 0:d.onError)==null||n.call(d,u),r({status:"initial"}),u}})}function Be(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}:{recoveryMethod:e.recoveryMethod}}var qe=({client:e,user:t,appId:o,wallet:r,setWallet:l,setRecoveryFlowState:a,webViewState:c,createWalletCallbacks:s,recoverWalletCallbacks:d,setWalletRecoveryCallbacks:n})=>{let i=Tt(()=>Nt(t),[t]),u=ee(p=>v(void 0,null,function*(){var A,V;if(i)throw new C({error:"This user already has an embedded wallet",code:"embedded_wallet_already_exists"});let{user:w}=yield e.user.get(),{password:g,recoveryMethod:f}=Be(p),h,E,U;if(f==="google-drive"&&(h=yield se({provider:f,client:e,onError:(A=s.current)==null?void 0:A.onError}),a({status:"creating-wallet"}),!h))return null;if(f==="icloud"){if(!w)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before creating a wallet with iCloud."});let{recoverySecret:I,iCloudRecordName:M}=yield be({user:w,appId:o,client:e});E=I,U=M}return yield ie({client:e,setWallet:l,createWalletCallbacks:s,recoveryMethod:f,setRecoveryFlowState:a,password:g,recoverySecretOverride:E,iCloudRecordNameOverride:U,solanaAccount:(V=He(w))!=null?V:void 0})}),[e,i,t]),y=ee(p=>v(void 0,null,function*(){var f;if(r.status!=="connected")throw new C({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"});if(!i)throw new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(He(t))throw new C({code:"embedded_wallet_set_recovery_error",error:"Cannot set user-controlled recovery for a user with an embedded Solana wallet."});Dt({currentRecoveryMethod:i.recovery_method,upgradeToRecoveryMethod:p.recoveryMethod});let w,g;switch(p.recoveryMethod){case"privy":g=z(k({},p),{wallet:i});break;case"user-passcode":g=z(k({},p),{wallet:i,password:p.password});break;case"google-drive":if(w=yield se({provider:p.recoveryMethod,client:e,onError:(f=n.current)==null?void 0:f.onError}),a({status:"upgrading-recovery"}),!w)return null;g={recoveryMethod:"google-drive",wallet:i,recoveryAccessToken:w};break;case"icloud":if(!t)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before backing up to iCloud."});let{recoverySecret:h,iCloudRecordName:E}=yield be({user:t,appId:o,client:e});g={recoveryMethod:"icloud-native",recoverySecretOverride:h,iCloudRecordNameOverride:E,wallet:i};break;default:throw new C({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}return le({client:e,recoveryInput:g,setWalletRecoveryCallbacks:n,setRecoveryFlowState:a,setWallet:l})}),[e,i,r.status,t]),b=ee(p=>v(void 0,null,function*(){return y({recoveryMethod:"user-passcode",password:p})}),[e,i,r.status]),m=ee(p=>v(void 0,null,function*(){var E;if(!i)throw new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{password:w,recoveryMethod:g}=Be(p),f,h;if(g==="google-drive"&&(f=yield se({provider:g,client:e,onError:(E=d.current)==null?void 0:E.onError}),a({status:"recovering"}),!f))return null;if(g==="icloud"){if(!t)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before recovering via iCloud."});let{recoverySecret:U}=yield je({client:e,walletAddress:i.address});h=U}return ae({client:e,account:i,setWallet:l,recoverWalletCallbacks:d,recoveryMethod:g,setRecoveryFlowState:a,password:w,recoveryToken:f,recoverySecretOverride:h})}),[e,i]),S=ee(()=>v(void 0,null,function*(){if(!i)throw l({status:"not-created",account:null}),new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});l(p=>p.status==="connected"?{status:"reconnecting",account:i}:{status:"connecting",account:i});try{let p=yield e.embeddedWallet.getProvider(i);return l({status:"connected",provider:p,account:i}),p}catch(p){throw jt(p)?(l({status:"needs-recovery",account:i}),new C({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):p instanceof Error?(l({status:"error",error:p.message,account:i}),new C({code:"unknown_embedded_wallet_error",error:p.message})):(l({status:"error",error:"Error loading embedded wallet",account:i}),new C({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,i]);return ze(()=>{if(!t&&r.status!=="disconnected")return l({status:"disconnected",account:null});c==="loaded"&&S().catch(()=>{})},[c,t,i]),ze(()=>{r.status==="error"&&r.error.includes("User must be logged in")&&S()},[r.status]),{create:u,recover:m,setPassword:b,setRecovery:y,getProvider:S}};import{useEffect as Vt,useState as zt}from"react";import{PrivyClientError as Ke}from"@privy-io/js-sdk-core";var Ge=({client:e,user:t,isReady:o,customAuth:r})=>{let[l,a]=zt({status:"initial"});return Vt(()=>{(()=>v(void 0,null,function*(){if(!(r!=null&&r.enabled)){a({status:"not-enabled"});return}a({status:"loading"});let{getCustomAccessToken:s,isLoading:d}=r;if(!(!o||d))try{let n=yield s();if(!n&&t){yield e.auth.logout(),a({status:"done"});return}if(!n){a({status:"done"});return}if(t){a({status:"done"});return}if(!(yield e.auth.customProvider.syncWithToken(n))){yield e.auth.logout(),a({status:"error",error:new Ke({error:"Failed to sync with custom auth provider",code:"third_party_auth_error"})});return}a({status:"done"})}catch(n){if(console.log("Error syncing with custom auth provider",n),a({status:"error",error:n}),t)throw yield e.auth.logout(),new Ke({error:"Third-party auth failed",code:"third_party_auth_error"})}}))()},[e,t,o,r==null?void 0:r.enabled,r==null?void 0:r.getCustomAccessToken,r==null?void 0:r.isLoading]),{customAuthState:l,customAuthStateIsSettled:l.status!=="loading"&&l.status!=="initial"}};import*as H from"expo-linking";import{useCallback as Ht,useEffect as Bt}from"react";import{Platform as qt}from"react-native";var Ye=({client:e,user:t,isUserInitialized:o,oAuthState:r,oAuthCallbacks:l,setOAuthState:a,recoveryFlowState:c,oAuthStateRef:s})=>{let d=H.useURL(),n=Ht(i=>{var y,b;let u=R(i);a({status:"error",error:u}),(b=(y=l.current).onError)==null||b.call(y,u)},[a]);return Bt(()=>{function i(){return v(this,null,function*(){var m,S;if(!d||r.status!=="loading"||c.status!=="initial")return;let{queryParams:u}=H.parse(d),{privy_oauth_state:y,privy_oauth_code:b}=u;if(!b||!y){a({status:"done"});return}try{let p,w;if(t)p=yield e.auth.oauth.linkWithCode(b,y);else{let g=yield e.auth.oauth.loginWithCode(b,y,void 0,void 0,s.current.disableSignup?"no-signup":"login-or-sign-up");p=g.user,w=!!g.is_new_user}return(S=(m=l.current).onSuccess)==null||S.call(m,p,w),s.current={},a({status:"done"}),yield H.openURL(d.split("?")[0])}catch(p){s.current={},n(p)}})}qt.OS==="android"&&o&&i()},[d,o])};import*as B from"expo-linking";import{useCallback as Kt,useEffect as Gt,useMemo as Yt}from"react";import{Platform as Xt}from"react-native";import{getUserEmbeddedSolanaWallet as Jt,getUserEmbeddedWallet as $t}from"@privy-io/js-sdk-core";var Xe=({client:e,user:t,createWalletCallbacks:o,recoverWalletCallbacks:r,setWalletRecoveryCallbacks:l,recoveryFlowState:a,oAuthState:c,setRecoveryFlowState:s,setWallet:d,appStateVisible:n,webViewLoaded:i})=>{let u=B.useURL(),y=Yt(()=>$t(t),[t]),b=Kt(m=>{var p,w,g,f;let S=R(m);a.status==="creating-wallet"?(w=(p=o.current).onError)==null||w.call(p,R(S)):(f=(g=r.current).onError)==null||f.call(g,R(S)),s({status:"initial"})},[a]);return Gt(()=>{function m(){return v(this,null,function*(){var g;if(!u&&a.status!=="initial"&&n&&b(new Error("Recovery OAuth session failed")),!u||a.status==="initial"||c.status!=="initial"||!n||!i)return;let{queryParams:S}=B.parse(u),{privy_oauth_state:p,privy_oauth_code:w}=S;if(!(!w||!p)){yield B.openURL(u.split("?")[0]);try{let f=yield we({oAuthCode:w,oAuthState:p,client:e});if(a.status==="creating-wallet"){let h=(g=Jt(t))!=null?g:void 0;yield ie({client:e,setWallet:d,createWalletCallbacks:o,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:f,solanaAccount:h})}else if(a.status==="upgrading-recovery"){if(!y)throw new Error("Embedded wallet not found");yield le({client:e,recoveryInput:{recoveryMethod:"google-drive",wallet:y,recoveryAccessToken:f},setWalletRecoveryCallbacks:l,setRecoveryFlowState:s,setWallet:d})}else yield ae({client:e,account:y,setWallet:d,recoverWalletCallbacks:r,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:f})}catch(f){b(f)}}})}Xt.OS==="android"&&m()},[u,a.status,n,i])};import{useEffect as Qt}from"react";var Je=({client:e,isUserInitialized:t,setIsUserInitialized:o})=>{Qt(()=>{t||(()=>v(void 0,null,function*(){try{yield e.user.get()}catch(l){}finally{o(!0)}}))()},[t])};import{useEffect as Zt}from"react";import{create as er}from"zustand";var x=class extends Error{constructor(o,r){super(r);this.code=o,this.error=r}};var ge={success:e=>({value:e}),error:e=>({error:e})};var $e=e=>{let t=Array.from(new Set(e));return t.length===0?ge.error(new x("no_login_methods_available","No login methods available")):ge.success(t)},Qe=e=>e.length<=2?e[0]:null,Jo=(e,t)=>{if(e.length!==2)return null;let[o,r]=e;return t===o?r:o},$o={email:"email",sms:"phone"};var tr=1e3*60*5,L=er()((e,t)=>({privyElementsConfig:null,loginPromiseExecutor:null,isUIMounted:!1,activeLoginMethod:null,updateUIMounted:o=>e({isUIMounted:o}),openLoginFlow:(o,r,l)=>new Promise((a,c)=>{if(r!==null)return c(new x("user_already_logged_in","User is already logged in"));if(!t().isUIMounted)return c(new x("privy_elements_not_ready","Privy Elements is not mounted"));if(t().loginPromiseExecutor!==null)return c(new x("existing_login_flow_in_progress","A login flow is already in progress"));let s=$e(o.loginMethods);if(s.error)return c(s.error);let d={loginMethods:s.value},n=setTimeout(()=>{c(new x("login_flow_timeout","The login flow timed out")),t().closeLoginFlow()},tr);l(),e({loginPromiseExecutor:{resolve(u){clearTimeout(n),a(u)},reject(u){clearTimeout(n),c(u)}},privyElementsConfig:d,activeLoginMethod:Qe(d.loginMethods)})}),closeLoginFlow:()=>{var o;return(o=t().loginPromiseExecutor)==null||o.reject(new x("login_flow_closed","The login flow was closed")),e({privyElementsConfig:null,loginPromiseExecutor:null})},goBack:()=>{var s;let{activeLoginMethod:o,privyElementsConfig:r,updateActiveLoginMethod:l,closeLoginFlow:a}=t(),c=(s=r==null?void 0:r.loginMethods.length)!=null?s:0;o===null||c<3?a():l(null)},updateActiveLoginMethod:o=>e({activeLoginMethod:o})})),oa=()=>L(e=>e.privyElementsConfig),aa=()=>L(e=>e.openLoginFlow),na=()=>L(e=>e.closeLoginFlow),ia=()=>L(e=>e.goBack),da=()=>L(e=>[e.activeLoginMethod,e.updateActiveLoginMethod]),rr=e=>{let{loginPromiseExecutor:t}=L.getState();t==null||t.resolve(e)},Ze=()=>rr,sa=()=>{let e=L(t=>t.updateUIMounted);Zt(()=>(e(!0),()=>{e(!1)}),[e])},la=()=>L(e=>e.privyElementsConfig!==null);var Se=nr({}),j;function ka(e){return j?j.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 Aa=e=>{var Ce;let[t,o]=W(et.currentState==="active");ir(()=>{let F=et.addEventListener("change",vt=>{o(vt==="active")});return()=>{F.remove()}},[]);let[r,l]=W(!1),[a,c]=W("loading"),[s,d]=W(!1),[n,i]=W(null),[u,y]=W({status:"disconnected",account:null}),[b,m]=W({status:"disconnected"}),[S,p]=W({status:"initial"}),[w,g]=W({status:"initial"}),f=D({}),[h,E]=W({status:"initial"}),[U,A]=W({status:"initial"}),[V,I]=W({status:"initial"}),[M,K]=W({status:"initial"}),[G,Y]=W({status:"initial"}),X=D({}),ue=D({}),pe=D({}),me=D({}),_e=D({}),We=D({}),st=Ze(),J=ce(F=>{if(F){st(F),Ne(i)(F);return}i(null),p({status:"initial"}),g({status:"initial"}),y({status:"disconnected",account:null})},[]),_=ar(()=>{let F=e.storage||at;return e.client?(j=e.client,j.setCallbacks({setUser:J,setIsReady:d}),j):(j=new sr({storage:ot(F),appId:e.appId,clientId:e.clientId,supportedChains:e.supportedChains,nativeAppIdentifier:rt(),baseUrl:e.baseUrl,sdkVersion:`expo:${xe.version}`,callbacks:{setUser:J,setIsReady:d},logLevel:e.logLevel,crypto:{digest:or}}),j)},[e.client,e.storage,e.appId,e.clientId,e.baseUrl,e.supportedChains,e.logLevel,J]),lt=ce(()=>(J(null),_.auth.logout()),[J,_]),ct=ce(()=>_.getAccessToken(),[_]),ut=ce(()=>_.getIdentityToken(),[_]);Je({client:_,isUserInitialized:r,setIsUserInitialized:l});let pt=qe({client:_,user:n,appId:e.appId,webViewState:a,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,setRecoveryFlowState:E,wallet:u,setWallet:y}),mt=Fe({client:_,user:n,webViewState:a,createSolanaWalletCallbacks:_e,recoverSolanaWalletCallbacks:We,setSolanaRecoveryFlowState:A,solanaWallet:b,setSolanaWallet:m});Ye({client:_,isUserInitialized:r,user:n,oAuthState:w,setOAuthState:g,oAuthCallbacks:X,recoveryFlowState:h,oAuthStateRef:f}),Xe({client:_,user:n,webViewLoaded:a==="loaded",createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,recoveryFlowState:h,oAuthState:w,setRecoveryFlowState:E,setWallet:y,appStateVisible:t});let{customAuthStateIsSettled:yt}=Ge({client:_,user:n,isReady:r,customAuth:(Ce=e.config)==null?void 0:Ce.customAuth});return te.createElement(te.Fragment,null,te.createElement(Se.Provider,{value:{client:_,user:n,isReady:a!=="loading"&&r&&tt(w)&&yt,logout:lt,getAccessToken:ct,getIdentityToken:ut,wallet:k(k({},u),pt),solanaWallet:k(k({},b),mt),oAuthState:w,oAuthCallbacks:X,recoveryFlowState:h,setRecoveryFlowState:E,solanaRecoveryFlowState:U,setSolanaRecoveryFlowState:A,createWalletCallbacks:ue,recoverWalletCallbacks:pe,setWalletRecoveryCallbacks:me,createSolanaWalletCallbacks:_e,recoverSolanaWalletCallbacks:We,setOAuthState:g,siweState:V,setSiweState:I,otpState:S,setOtpState:p,passkeyState:M,setPasskeyState:K,farcasterState:G,setFarcasterState:Y,oAuthStateRef:f}},e.children),te.createElement(dr,{style:{width:0,height:0,overflow:"hidden"}},te.createElement(Pe,{logLevel:e.logLevel,client:_,isClientReady:s,setWebViewState:c,webViewState:a})))};var tt=e=>e.status!=="loading",Ee=(e={})=>{let{user:t,oAuthState:o,setOAuthState:r,oAuthCallbacks:l,client:a,oAuthStateRef:c}=cr(Se),s=e.action?e.action==="login":!t;ur(()=>{l.current={onSuccess:e.onSuccess,onError:e.onError}},[e.onSuccess,e.onError]);let d=it(i=>{var y;let u=R(i);return r({status:"error",error:u}),(y=e==null?void 0:e.onError)==null||y.call(e,u),u},[e==null?void 0:e.onError]);return{start:it(function(S){return v(this,arguments,function*({provider:u,redirectUri:y,isLegacyAppleIosBehaviorEnabled:b=!1,disableSignup:m}){var p,w,g;r({status:"loading"}),c.current={disableSignup:m};try{if(t&&e.action==="login")throw new N({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!t&&e.action==="link")throw new N({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});let{url:f}=yield a.auth.oauth.generateURL(u,q.createURL(y||"/")),h,E;if(he.OS==="ios"&&u==="apple"&&!b){let G=(p=new URL(f).searchParams.get("state"))!=null?p:"",Y=yield dt.signInAsync({state:G});if(!Y.authorizationCode)throw new N({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let X=yield a.auth.oauth.loginWithCode(Y.authorizationCode,G,u,"raw",m?"no-signup":"login-or-sign-up");h=X.user,E=X.is_new_user}else h=yield a.auth.oauth.linkWithCode(Y.authorizationCode,G,u,"raw");return(w=e==null?void 0:e.onSuccess)==null||w.call(e,h,E),r({status:"done"}),h!=null?h:void 0}let U=he.OS==="android"?f.replace("x.com","twitter.com"):f,A=yield re.openAuthSessionAsync(U);if(he.OS==="android")return;if(A.type!=="success")throw[re.WebBrowserResultType.CANCEL,re.WebBrowserResultType.DISMISS].includes(A.type)?new N({error:"OAuth was cancelled",code:s?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):new N({error:"OAuth session failed",code:s?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let{queryParams:V}=q.parse(A.url),{privy_oauth_state:I,privy_oauth_code:M}=V;if(!M||!I)throw new N({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let K=yield a.auth.oauth.loginWithCode(M,I,u,void 0,m?"no-signup":"login-or-sign-up");h=K.user,E=K.is_new_user}else h=yield a.auth.oauth.linkWithCode(M,I,u);return(g=e==null?void 0:e.onSuccess)==null||g.call(e,h,E),yield q.openURL(A.url.split("?")[0]),r({status:"done"}),h!=null?h:void 0}catch(f){d(f)}})},[t,a,r,d]),state:o}};function Fa(e){let{state:t,start:o}=Ee(z(k({},e),{action:"login"}));return{state:t,login:o}}function Ta(e){let{state:t,start:o}=Ee(z(k({},e),{action:"link"}));return{state:t,link:o}}function Da(e){return Ee(e)}var rt=()=>{if(typeof nt!="string")throw new N({error:"Cannot determine native application ID. Please make sure `expo-application` is installed as a dependency and that `ios.bundleId` or `android.package` is set.",code:"invalid_native_app_id"});return nt};function ot(e){return{get(t){return e.get(t.replaceAll(":","-"))},put(t,o){return e.put(t.replaceAll(":","-"),o)},del(t){return e.del(t.replaceAll(":","-"))},getKeys:()=>v(this,null,function*(){return[]})}}var at={get(e){return O.getItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},put(e,t){return O.setItemAsync(e,t,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},del(e){return O.deleteItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},getKeys:()=>v(void 0,null,function*(){return[]})};function Va(e){return e.status==="connected"}function za(e){return e.status==="reconnecting"}function Ha(e){return e.status==="connecting"}function Ba(e){return e.status==="disconnected"}function qa(e){return e.status==="not-created"}function Ka(e){return e.status==="creating"}function Ga(e){return e.status==="error"}function Ya(e){return e.status==="needs-recovery"}export{k as a,z as b,pr as c,v as d,xe as e,R as f,Kr as g,$r as h,Fa as i,Ta as j,Da as k,rt as l,ot as m,at as n,x as o,Jo as p,$o as q,oa as r,aa as s,na as t,ia as u,da as v,sa as w,la as x,Se as y,ka as z,Aa as A,Va as B,za as C,Ha as D,Ba as E,qa as F,Ka as G,Ga as H,Ya as I};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as Zn,B as jn,C as qn,D as Jn,E as Yn,F as Qn,G as $n,H as Xn,a as k,c as Z,d as S,e as Ge,f as w,g as I,h as j,i as Jr,j as Yr,k as Qr,l as Ne,m as De,n as ce,o as ue,p as Re,q as Ke,r as ze,s as Ze,t as je,u as U,v as qe,w as Je,x as h,y as Kn,z as zn}from"./chunk-FL4SBVAC.js";export*from"@privy-io/js-sdk-core";import{useCallback as me,useContext as $r}from"react";import{PrivyClientError as Xr}from"@privy-io/js-sdk-core";var ni=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=$r(h),s=me(d=>{var u;let f=w(d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=me(g=>S(void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]),i=me(u=>S(void 0,[u],function*({signature:d,messageOverride:f}){var g;try{if(!r)throw new Xr({code:"attempted_link_siwe_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiwe` to login with a wallet"});o({status:"submitting-signature"});let l=yield t.auth.siwe.linkWithSiwe(d,void 0,f);return o({status:"done"}),(g=e==null?void 0:e.onSuccess)==null||g.call(e,l),l}catch(l){throw s(l)}}),[r,t,s,e==null?void 0:e.onSuccess]);return{generateSiweMessage:n,linkWithSiwe:i,state:a}};import{useCallback as de,useContext as et}from"react";import{PrivyClientError as rt}from"@privy-io/js-sdk-core";var mi=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=et(h),s=de(d=>{var u;let f=w(d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=de(g=>S(void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]);return{loginWithSiwe:de(g=>S(void 0,[g],function*({signature:d,messageOverride:f,disableSignup:u}){var l;try{if(r)throw new rt({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"});o({status:"submitting-signature"});let c=yield t.auth.siwe.loginWithSiwe(d,void 0,f,u?"no-signup":"login-or-sign-up");return o({status:"done"}),(l=e==null?void 0:e.onSuccess)==null||l.call(e,c.user,c.is_new_user),c.user}catch(c){throw s(c)}}),[r,t,s,e==null?void 0:e.onSuccess]),generateSiweMessage:n,state:a}};import{useCallback as Ye,useContext as tt}from"react";import{PrivyClientError as ot}from"@privy-io/js-sdk-core";var Si=e=>{let{user:r,client:t}=tt(h),o=Ye(s=>{var i;let n=w(s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{unlinkWallet:Ye(n=>S(void 0,[n],function*({address:s}){var i;try{if(!r)throw new ot({code:"attempted_unlink_siwe_before_logged_in",error:"Must be logged in to unlink a wallet, Use `useLoginWithSiwe` to login with a wallet"});let d=yield t.auth.siwe.unlinkWallet(s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw o(d)}}),[r,t,o,e==null?void 0:e.onSuccess])}};import{useCallback as ge,useContext as nt,useState as it}from"react";import{PrivyClientError as Qe}from"@privy-io/js-sdk-core";var Ei=e=>{let[r,t]=it(""),{user:o,client:a,otpState:s,setOtpState:n}=nt(h),i=ge(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=ge(g=>S(void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=ge(l=>S(void 0,[l],function*({code:u,email:g}){var c;try{if(!o)throw new Qe({code:"attempted_link_email_before_logged_in",error:"Must be logged in to link an email, Use `useLoginWithEmail` to login with email"});let y=g||r;if(!y)throw new Qe({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.email.linkWithCode(y,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};import{useCallback as fe,useContext as at,useState as st}from"react";import{PrivyClientError as $e}from"@privy-io/js-sdk-core";var Xe=e=>{let[r,t]=st(""),{user:o,client:a,otpState:s,setOtpState:n}=at(h),i=fe(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=fe(g=>S(void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=fe(c=>S(void 0,[c],function*({code:u,email:g,disableSignup:l}){var y;try{if(o)throw new $e({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 C=g||r;if(!C)throw new $e({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.email.loginWithCode(C,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};import{useCallback as he,useContext as lt,useState as ct}from"react";import{PrivyClientError as er}from"@privy-io/js-sdk-core";var Vi=e=>{let[r,t]=ct(""),{user:o,client:a,otpState:s,setOtpState:n}=lt(h),i=he(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=he(g=>S(void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=he(l=>S(void 0,[l],function*({code:u,phone:g}){var c;try{if(!o)throw new er({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(!(g||r))throw new er({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.phone.linkWithCode(g||r,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};import{useCallback as pe,useContext as ut,useState as mt}from"react";import{PrivyClientError as rr}from"@privy-io/js-sdk-core";var tr=e=>{let[r,t]=mt(""),{user:o,client:a,otpState:s,setOtpState:n}=ut(h),i=pe(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=pe(g=>S(void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=pe(c=>S(void 0,[c],function*({code:u,phone:g,disableSignup:l}){var y;try{if(o)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(!(g||r))throw new rr({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.phone.loginWithCode(g||r,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};import*as q from"expo-linking";import{useCallback as ye,useContext as dt,useRef as gt}from"react";import{PrivyClientError as G}from"@privy-io/js-sdk-core";var Qi=e=>{let{appState:r,getCurrentAppState:t}=j(),{client:o,user:a,farcasterState:s,setFarcasterState:n}=dt(h),i=gt(!1),d=ye(g=>{var c;let l=w(g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=ye(()=>{i.current=!0},[]);return{linkWithFarcaster:ye((y,...C)=>S(void 0,[y,...C],function*({relyingParty:g,redirectUrl:l},c={pollAttempts:10,pollIntervalMs:1e3}){var p;try{if(i.current=!1,!a)throw new G({code:"attempted_link_farcaster_before_logged_in",error:"Must be logged in to link a Farcaster account."});n({status:"generating-uri"});let{connect_uri:E,channel_token:L}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:q.createURL(l!=null?l:"/")});if(!E)throw new G({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!L)throw new G({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield q.openURL(E),n({status:"polling-status"});let _=0;for(;_<c.pollAttempts;){if(i.current)throw new G({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield I(c.pollIntervalMs);continue}let V=yield o.auth.farcaster.getFarcasterStatus({channel_token:L});if(V.state==="completed"){n({status:"submitting-token"});let H=yield o.auth.farcaster.link(k({channel_token:L},V));return n({status:"done"}),(p=e==null?void 0:e.onSuccess)==null||p.call(e,H),H}_++,yield I(c.pollIntervalMs)}throw new G({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(E){throw d(E)}}),[o,e==null?void 0:e.onSuccess,d,n,a]),state:s,cancel:f}};import{useCallback as or,useContext as ft}from"react";var oa=e=>{let{client:r}=ft(h),t=or(a=>{var n;let s=w(a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkFarcaster:or(s=>S(void 0,[s],function*({fid:a}){var n;try{let i=yield r.auth.farcaster.unlink({fid:a});return(n=e==null?void 0:e.onSuccess)==null||n.call(e,i),i}catch(i){throw t(i)}}),[r,e==null?void 0:e.onSuccess,t])}};import*as J from"expo-linking";import{useCallback as we,useContext as ht,useRef as pt}from"react";import{PrivyClientError as N}from"@privy-io/js-sdk-core";var ua=e=>{let{appState:r,getCurrentAppState:t}=j(),{client:o,user:a,farcasterState:s,setFarcasterState:n}=ht(h),i=pt(!1),d=we(g=>{var c;let l=w(g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=we(()=>{i.current=!0},[]);return{loginWithFarcaster:we((C,...p)=>S(void 0,[C,...p],function*({relyingParty:g,redirectUrl:l,disableSignup:c},y={pollAttempts:10,pollIntervalMs:1e3}){var E;try{if(i.current=!1,a)throw new N({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"});n({status:"generating-uri"});let{connect_uri:L,channel_token:_}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:J.createURL(l!=null?l:"/")});if(!L)throw new N({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!_)throw new N({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield J.openURL(L),n({status:"polling-status"});let V=0;for(;V<y.pollAttempts;){if(i.current)throw new N({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield I(y.pollIntervalMs);continue}let H=yield o.auth.farcaster.getFarcasterStatus({channel_token:_});if(H.state==="completed"){n({status:"submitting-token"});let le=yield o.auth.farcaster.authenticate(k({channel_token:_,mode:c?"no-signup":"login-or-sign-up"},H));return n({status:"done"}),(E=e==null?void 0:e.onSuccess)==null||E.call(e,le.user,le.is_new_user),le.user}V++,yield I(y.pollIntervalMs)}throw new N({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(L){throw d(L)}}),[o,d,e==null?void 0:e.onSuccess,n,a,r]),state:s,cancel:f}};import{useCallback as nr,useContext as yt}from"react";var pa=e=>{let{client:r}=yt(h),t=nr(a=>{var n;let s=w(a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkOAuth:nr(n=>S(void 0,[n],function*({provider:a,subject:s}){var i;try{let d=yield r.auth.oauth.unlink(a,s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw t(d)}}),[r,e==null?void 0:e.onSuccess,t])}};import{useContext as St,useEffect as Ct,useRef as wt}from"react";var ka=e=>{let{client:r}=St(h),t=wt(e.onOAuthTokenGrant);t.current=e.onOAuthTokenGrant,Ct(()=>{let{unsubscribe:o}=r.addOAuthTokensListener(a=>{t.current(a)});return o},[r])};import{useEffect as bt}from"react";import{useContext as kt,useEffect as ke}from"react";var be=(e={})=>{let{wallet:r,createWalletCallbacks:t,recoverWalletCallbacks:o,setWalletRecoveryCallbacks:a}=kt(h),{onCreateWalletSuccess:s,onCreateWalletError:n,onRecoverWalletError:i,onRecoverWalletSuccess:d,onSetWalletRecoverySuccess:f,onSetWalletRecoveryError:u}=e;return ke(()=>{t.current={onSuccess:s,onError:n}},[s,n]),ke(()=>{o.current={onSuccess:d,onError:i}},[d,i]),ke(()=>{a.current={onSuccess:f,onError:u}},[d,i]),r};var Fa=({onStateChange:e})=>{let r=be();return bt(()=>{e(r)},[r])};import{useContext as vt}from"react";var Aa=()=>{let{getIdentityToken:e}=vt(h);return{getIdentityToken:e}};import{useCallback as ir,useContext as xt}from"react";import{PrivyClientError as Et}from"@privy-io/js-sdk-core";var Va=e=>{let{user:r,client:t}=xt(h),o=ir(s=>{var i;let n=w(s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{create:ir(()=>S(void 0,null,function*(){var s;try{if(r)throw new Et({code:"attempted_to_create_guest_account_for_logged_in_user",error:"Already logged in, you cannot create a guest account"});let n=yield t.auth.guest.create();return(s=e==null?void 0:e.onSuccess)==null||s.call(e,n.user,n.is_new_user),n.user}catch(n){throw o(n)}}),[t,o,r,e==null?void 0:e.onSuccess])}};import{useContext as Lt,useEffect as ar}from"react";var Pt=(e={})=>{let{solanaWallet:r,createSolanaWalletCallbacks:t,recoverSolanaWalletCallbacks:o}=Lt(h),{onCreateWalletSuccess:a,onCreateWalletError:s,onRecoverWalletError:n,onRecoverWalletSuccess:i}=e;return ar(()=>{t.current={onSuccess:a,onError:s}},[a,s]),ar(()=>{o.current={onSuccess:i,onError:n}},[i,n]),r};import{useContext as Ft}from"react";var Mt=()=>{let{client:e}=Ft(h);return e};import{useContext as Tt}from"react";var Wt=()=>{let{user:e,isReady:r,logout:t,getAccessToken:o}=Tt(h);return{user:e,isReady:r,logout:t,getAccessToken:o}};import z,{useRef as _n,useState as In}from"react";import Ae,{useContext as Ao,useEffect as br,useMemo as _o,useState as vr}from"react";import M,{useCallback as to,useEffect as oo,useState as pr}from"react";import{View as Fe,StyleSheet as no,KeyboardAvoidingView as io,Platform as ao}from"react-native";import{createErrorFormatter as so}from"@privy-io/js-sdk-core";import Y from"react";import{View as Bt,Text as Vt,Pressable as Ht,StyleSheet as Gt}from"react-native";import ve,{useEffect as At}from"react";import{Animated as xe,Easing as _t,useAnimatedValue as It}from"react-native";import Ut,{Path as Ot}from"react-native-svg";var sr=()=>{let e=It(0);At(()=>{e.setValue(0);let t=xe.loop(xe.timing(e,{toValue:1,duration:1200,useNativeDriver:!0,easing:_t.linear}));return t.start(),()=>t.stop()},[]);let r=e.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return ve.createElement(xe.View,{style:{transform:[{rotate:r}]}},ve.createElement(Ut,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},ve.createElement(Ot,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:"#fff",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var m={interactive:"#5B4FFF",white:"#FFFFFF",black:"#000000",brand:"#010110",placeholder:"#9498B8",success:"#22C55E",successDark:"#15803D",inputBackground:"#F3F3F3",text:"#040217",icon:"#110F2A",border:"#E2E3F0",error:"#EF4444",errorDark:"#B91C1C",textMuted:"#64668B",textTitle:"#1A1C29"};var v=a=>{var s=a,{variant:e="primary",title:r,loading:t=!1}=s,o=Z(s,["variant","title","loading"]);return Y.createElement(Ht,k({},o),Y.createElement(Bt,{style:[O.buttonBox,e==="secondary"&&O.buttonBoxSecondary,e==="tertiary"&&O.buttonBoxTertiary]},t?Y.createElement(sr,null):Y.createElement(Vt,{style:[O.buttonLabel,e==="secondary"&&O.buttonLabelSecondary,e==="tertiary"&&O.buttonLabelTertiary]},r)))},O=Gt.create({buttonBox:{height:54,justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,backgroundColor:m.interactive},buttonBoxSecondary:{backgroundColor:m.white,alignItems:"flex-start",borderColor:m.border,borderWidth:1,borderRadius:12},buttonBoxTertiary:{backgroundColor:m.white},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24,color:m.white},buttonLabelSecondary:{fontFamily:"Inter_400Regular",color:m.text},buttonLabelTertiary:{fontFamily:"Inter_500Medium",color:m.interactive}});import P,{useState as Kt,useRef as zt}from"react";import{View as ur,TextInput as Zt,Pressable as jt,Text as dr,StyleSheet as qt}from"react-native";import lr from"react";import{View as Nt,Text as Dt,StyleSheet as Rt}from"react-native";var cr=({value:e,isFocused:r,isSuccess:t,isError:o})=>lr.createElement(Nt,{style:[D.box,r&&D.focusedBox,t&&D.successBox,o&&D.errorBox]},lr.createElement(Dt,{style:D.text},e)),D=Rt.create({box:{borderWidth:1,borderColor:m.border,borderRadius:12,height:64,width:48,justifyContent:"center",alignItems:"center"},focusedBox:{borderWidth:2,borderColor:m.interactive},successBox:{borderColor:m.success},errorBox:{borderColor:m.error},text:{fontFamily:"Inter_500Medium",fontSize:16,lineHeight:20,color:m.text}});var mr=6,Jt=[0,1,2,"-",3,4,5];function Ee({value:e="",status:r=" ",onChangeText:t=()=>{},editable:o=!0,success:a=!1,error:s=!1,autoFocus:n=!1}){let i=zt(null),[d,f]=Kt(!1),u=()=>{var c;(c=i==null?void 0:i.current)==null||c.focus()},g=c=>{let y=c.replace(/\D/g,"");t(y)},l=d?Math.min(e.length,mr-1):void 0;return P.createElement(ur,{style:W.container},P.createElement(Zt,{autoFocus:n,style:W.invisibleTextInput,value:e,onChangeText:g,maxLength:mr,ref:i,editable:o,onFocus:()=>f(!0),onBlur:()=>f(!1),keyboardType:"numeric"}),P.createElement(jt,{onPress:u,disabled:!o},P.createElement(ur,{style:W.codeContainer},Jt.map((c,y)=>c==="-"?P.createElement(Yt,{key:y}):P.createElement(cr,{key:y,isFocused:l===c,value:e[c]||"",isSuccess:a,isError:s})))),P.createElement(dr,{style:[W.statusText,a&&W.statusSuccess,s&&W.statusError]},r))}var Yt=()=>P.createElement(dr,{style:W.separator},"-"),W=qt.create({container:{justifyContent:"center",paddingHorizontal:0,gap:6},invisibleTextInput:{position:"absolute",opacity:0},codeContainer:{flexDirection:"row",alignItems:"center",gap:10,justifyContent:"space-between"},separator:{fontFamily:"Inter_600SemiBold",fontSize:18,lineHeight:24,color:m.black},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark},statusSuccess:{color:m.successDark}});import Le from"react";import{StyleSheet as Qt,View as $t,Text as gr}from"react-native";var F=({title:e,subtitle:r})=>Le.createElement($t,{style:Pe.titleContainer},Le.createElement(gr,{style:Pe.title},e),r&&Le.createElement(gr,{style:Pe.subtitle},r)),Pe=Qt.create({titleContainer:{alignItems:"center",gap:16},title:{fontFamily:"Inter_600SemiBold",fontSize:20,lineHeight:32,color:m.textTitle},subtitle:{fontFamily:"Inter_400Regular",fontSize:16,lineHeight:24,color:m.textMuted,textAlign:"center"}});import Q from"react";import{Pressable as Xt,StyleSheet as eo,Text as fr,View as ro}from"react-native";var hr=({hint:e,link:r,onPress:t,disabled:o})=>Q.createElement(ro,{style:$.container},Q.createElement(fr,{style:$.hintText},e),r&&Q.createElement(Xt,{onPress:t,disabled:o},Q.createElement(fr,{style:[$.linkText,o&&$.disabledLink]}," ",r))),$=eo.create({container:{display:"flex",flexDirection:"row",gap:2},hintText:{fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22,color:m.textMuted},linkText:{fontFamily:"Inter_500Medium",fontSize:14,lineHeight:22,color:m.interactive},disabledLink:{color:m.textMuted}});var lo=3e4,co=()=>{let[e,r]=pr(!1),t=to(()=>{r(!1),setTimeout(()=>{r(!0)},lo)},[]);return oo(()=>{t()},[]),[e,t]},X=({loginWithCode:e,requestNewCode:r,subtitle:t,isLoading:o,error:a,isDone:s})=>{let[n,i]=pr(""),d=l=>{i(l),l.length===6&&e(l)},[f,u]=co(),g=()=>{r(),u()};return M.createElement(io,{behavior:ao.OS==="ios"?"padding":void 0,style:Me.innerContainer},M.createElement(Fe,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},M.createElement(Fe,{style:Me.content},M.createElement(Fe,{style:Me.formContainer},M.createElement(F,{title:"Enter confirmation code",subtitle:t}),M.createElement(Ee,{value:n,editable:!o,onChangeText:d,success:s,error:!!a,status:s?"Success.":a?uo(a):" ",autoFocus:!0}),M.createElement(hr,{hint:"Didn\u2019t get an email?",link:"Resend code",onPress:g,disabled:!f}))),M.createElement(v,{title:"Continue",loading:o,onPress:()=>e(n)})))},uo=so({invalid_credentials:"Invalid code.",invalid_data:"The code has expired.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),Me=no.create({modalContent:{backgroundColor:"#ffffff"},innerContainer:{flex:1},content:{gap:16},formContainer:{rowGap:24}});import x,{useState as Eo}from"react";import{View as te,StyleSheet as Lo,KeyboardAvoidingView as Po,Platform as Fo}from"react-native";import{createErrorFormatter as Mo}from"@privy-io/js-sdk-core";import Sr from"react";import{StyleSheet as ho,View as po}from"react-native";import*as Te from"react";import mo,{Path as go}from"react-native-svg";var fo=e=>Te.createElement(mo,k({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40"},e),Te.createElement(go,{fill:e.color,d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02m176.8 1.71v5.72h-.27l-.09-.14a16 16 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a9 9 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.1 8.1 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.1 6.1 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73q.12-2.34.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02m27.66 4.14.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.8 6.8 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13 13 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13 13 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.5 7.5 0 0 0-2.8.5A7.1 7.1 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6 6 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.5 5.5 0 0 1 2.3-.63 10 10 0 0 1 1.13.02M69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.7 8.7 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49Zm64.29 0V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a5 5 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.6 2.6 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49Zm160.07.19a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.5 14.5 0 0 0-8.74-2.35m57.39 0a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.5 10.5 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.8 9.8 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.4 7.4 0 0 1-1.26-2.32 14.1 14.1 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03m13.77-5.31-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a912 912 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4v-6.9h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46v-4.4h-5.6c-4.46 0-5.6 0-5.6.02Zm27.17 13.85V30.8h3.87l3.86-.01V3.09h-7.73Zm9.8-13.85-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4v-.8h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01Zm30.38 0c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88zM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.9 4.9 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a12 12 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07m14.51.05c-2.33.12-4.3.84-5.95 2.16a9.9 9.9 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18 18 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.8 9.8 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04m1.42 3.78c.88.1 1.62.34 2.28.75a6.1 6.1 0 0 1 1.99 2.15 10.3 10.3 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03M92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.6 7.6 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.4 8.4 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18 18 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.3 5.3 0 0 1 2.9-.95c.2-.01.97 0 1.17.03Zm23.44-3.74c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.4 9.4 0 0 0 3.6 1.8 12 12 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.5 5.5 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.3 5.3 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 11 11 0 0 0-4.88-.74m39.41 0a9.87 9.87 0 0 0-6 2.29 11 11 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02m75.93-3.33 8.37 23.22a49 49 0 0 1-.67 1.9 5.4 5.4 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8 8 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3h-4.82Zm59.47 27.98c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a49 49 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41 41 0 0 0-5.8-.24m0 0"})),yr=fo;var ee=()=>Sr.createElement(po,{style:yo.legalFooterContainer},Sr.createElement(yr,{color:m.brand,width:"100%",height:11})),yo=ho.create({legalFooterContainer:{flexDirection:"row",alignItems:"center",marginVertical:16,justifyContent:"center",gap:2}});import re,{useState as So}from"react";import{View as Cr,TextInput as Co,StyleSheet as wo,Text as ko}from"react-native";var B=a=>{var s=a,{error:e,status:r,LeftIcon:t}=s,o=Z(s,["error","status","LeftIcon"]);let[n,i]=So(!1);return re.createElement(Cr,{style:A.container},re.createElement(Cr,{style:[A.inputBox,n&&A.inputBoxFocused,e&&A.inputBoxError]},t,re.createElement(Co,k({cursorColor:m.interactive,placeholderTextColor:m.placeholder,onFocus:()=>i(!0),onBlur:()=>i(!1),autoCapitalize:"none",returnKeyType:"next",multiline:!1,numberOfLines:1,style:A.input},o))),r&&re.createElement(ko,{style:[A.statusText,e&&A.statusError]},r))},A=wo.create({container:{gap:6},input:{flex:1,fontFamily:"Inter_400Regular",fontSize:18,height:30,color:m.text},inputBox:{flexDirection:"row",paddingHorizontal:16,height:64,backgroundColor:m.inputBackground,borderRadius:14,alignItems:"center",columnGap:10,borderWidth:2,borderColor:m.border},inputBoxFocused:{borderColor:m.interactive},inputBoxError:{borderColor:m.error},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark}});import*as We from"react";import bo,{Path as vo}from"react-native-svg";var xo=e=>We.createElement(bo,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),We.createElement(vo,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7m2-3h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"})),wr=xo;var kr=({sendCode:e,isLoading:r,error:t,initialEmail:o,FooterComponent:a})=>{let[s,n]=Eo(o!=null?o:"");return x.createElement(Po,{behavior:Fo.OS==="ios"?"padding":void 0,style:oe.innerContainer},x.createElement(te,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},x.createElement(te,{style:oe.content},x.createElement(te,{style:oe.content},x.createElement(te,{style:oe.formContainer},x.createElement(F,{title:"Enter your email"}),x.createElement(B,{LeftIcon:x.createElement(wr,{color:m.icon}),value:s,onChangeText:n,error:!!t,status:t?To(t):" ",placeholder:"your@email.com",autoComplete:"email",keyboardType:"email-address",autoFocus:!0})),a),x.createElement(ee,null)),x.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},To=Mo({invalid_data:"Invalid email address.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),oe=Lo.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});import Wo from"react";var ne=({onLoginMethodChange:e,otherLoginMethod:r})=>r?Wo.createElement(v,{variant:"tertiary",title:`Use ${ze[r]} instead`,onPress:()=>e(r)}):null;var Io=600,xr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=Ao(h),a=U(),[s,n]=vr(""),{state:i,loginWithCode:d,sendCode:f}=Xe(),[u,g]=vr("email"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_o(()=>{var p;switch(i.status){case"initial":return{step:{type:"email"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),br(()=>{if(!C)return;let p=setTimeout(()=>{a()},Io);return()=>clearTimeout(p)},[C,a]),br(()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o]),l.type){case"code":return Ae.createElement(X,{loginWithCode:p=>d({code:p,email:s}),requestNewCode:()=>f({email:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C});case"email":return Ae.createElement(kr,{initialEmail:s,sendCode:p=>{n(p),f({email:p})},isLoading:y,error:c,FooterComponent:Ae.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})})}};import Ve,{useContext as Cn,useEffect as Vr,useMemo as wn,useState as Hr}from"react";import b,{useState as Be}from"react";import{View as ae,StyleSheet as dn,KeyboardAvoidingView as gn,Platform as fn}from"react-native";import{getPlaceholderPhoneNumber as hn,phoneNumberTypingFormatter as pn,createErrorFormatter as yn}from"@privy-io/js-sdk-core";import T,{useMemo as Jo,useState as Yo}from"react";import{View as Qo,StyleSheet as $o,KeyboardAvoidingView as Xo,Platform as en,FlatList as rn}from"react-native";import{useState as Uo,useEffect as Oo}from"react";function Er(e,r){let[t,o]=Uo(e);return Oo(()=>{let a=setTimeout(()=>{o(e)},r);return()=>{clearTimeout(a)}},[e,r]),t}import{getCountryCallingCode as Vo}from"@privy-io/js-sdk-core";var Lr=[["Afghanistan","AF","\u{1F1E6}\u{1F1EB}"],["Albania","AL","\u{1F1E6}\u{1F1F1}"],["Algeria","DZ","\u{1F1E9}\u{1F1FF}"],["American Samoa","AS","\u{1F1E6}\u{1F1F8}"],["Andorra","AD","\u{1F1E6}\u{1F1E9}"],["Angola","AO","\u{1F1E6}\u{1F1F4}"],["Anguilla","AI","\u{1F1E6}\u{1F1EE}"],["Antigua & Barbuda","AG","\u{1F1E6}\u{1F1EC}"],["Argentina","AR","\u{1F1E6}\u{1F1F7}"],["Armenia","AM","\u{1F1E6}\u{1F1F2}"],["Aruba","AW","\u{1F1E6}\u{1F1FC}"],["Ascension Island","AC","\u{1F1E6}\u{1F1E8}"],["Australia","AU","\u{1F1E6}\u{1F1FA}"],["Austria","AT","\u{1F1E6}\u{1F1F9}"],["Azerbaijan","AZ","\u{1F1E6}\u{1F1FF}"],["Bahamas","BS","\u{1F1E7}\u{1F1F8}"],["Bahrain","BH","\u{1F1E7}\u{1F1ED}"],["Bangladesh","BD","\u{1F1E7}\u{1F1E9}"],["Barbados","BB","\u{1F1E7}\u{1F1E7}"],["Belarus","BY","\u{1F1E7}\u{1F1FE}"],["Belgium","BE","\u{1F1E7}\u{1F1EA}"],["Belize","BZ","\u{1F1E7}\u{1F1FF}"],["Benin","BJ","\u{1F1E7}\u{1F1EF}"],["Bermuda","BM","\u{1F1E7}\u{1F1F2}"],["Bhutan","BT","\u{1F1E7}\u{1F1F9}"],["Bolivia","BO","\u{1F1E7}\u{1F1F4}"],["Bosnia & Herzegovina","BA","\u{1F1E7}\u{1F1E6}"],["Botswana","BW","\u{1F1E7}\u{1F1FC}"],["Brazil","BR","\u{1F1E7}\u{1F1F7}"],["British Indian Ocean Territory","IO","\u{1F1EE}\u{1F1F4}"],["British Virgin Islands","VG","\u{1F1FB}\u{1F1EC}"],["Brunei","BN","\u{1F1E7}\u{1F1F3}"],["Bulgaria","BG","\u{1F1E7}\u{1F1EC}"],["Burkina Faso","BF","\u{1F1E7}\u{1F1EB}"],["Burundi","BI","\u{1F1E7}\u{1F1EE}"],["Cambodia","KH","\u{1F1F0}\u{1F1ED}"],["Cameroon","CM","\u{1F1E8}\u{1F1F2}"],["Canada","CA","\u{1F1E8}\u{1F1E6}"],["Cape Verde","CV","\u{1F1E8}\u{1F1FB}"],["Caribbean Netherlands","BQ","\u{1F1E7}\u{1F1F6}"],["Cayman Islands","KY","\u{1F1F0}\u{1F1FE}"],["Central African Republic","CF","\u{1F1E8}\u{1F1EB}"],["Chad","TD","\u{1F1F9}\u{1F1E9}"],["Chile","CL","\u{1F1E8}\u{1F1F1}"],["China","CN","\u{1F1E8}\u{1F1F3}"],["Christmas Island","CX","\u{1F1E8}\u{1F1FD}"],["Cocos (Keeling) Islands","CC","\u{1F1E8}\u{1F1E8}"],["Colombia","CO","\u{1F1E8}\u{1F1F4}"],["Comoros","KM","\u{1F1F0}\u{1F1F2}"],["Congo - Brazzaville","CG","\u{1F1E8}\u{1F1EC}"],["Congo - Kinshasa","CD","\u{1F1E8}\u{1F1E9}"],["Cook Islands","CK","\u{1F1E8}\u{1F1F0}"],["Costa Rica","CR","\u{1F1E8}\u{1F1F7}"],["Croatia","HR","\u{1F1ED}\u{1F1F7}"],["Cuba","CU","\u{1F1E8}\u{1F1FA}"],["Cura\xE7ao","CW","\u{1F1E8}\u{1F1FC}"],["Cyprus","CY","\u{1F1E8}\u{1F1FE}"],["Czechia","CZ","\u{1F1E8}\u{1F1FF}"],["C\xF4te d\u2019Ivoire","CI","\u{1F1E8}\u{1F1EE}"],["Denmark","DK","\u{1F1E9}\u{1F1F0}"],["Djibouti","DJ","\u{1F1E9}\u{1F1EF}"],["Dominica","DM","\u{1F1E9}\u{1F1F2}"],["Dominican Republic","DO","\u{1F1E9}\u{1F1F4}"],["Ecuador","EC","\u{1F1EA}\u{1F1E8}"],["Egypt","EG","\u{1F1EA}\u{1F1EC}"],["El Salvador","SV","\u{1F1F8}\u{1F1FB}"],["Equatorial Guinea","GQ","\u{1F1EC}\u{1F1F6}"],["Eritrea","ER","\u{1F1EA}\u{1F1F7}"],["Estonia","EE","\u{1F1EA}\u{1F1EA}"],["Eswatini","SZ","\u{1F1F8}\u{1F1FF}"],["Ethiopia","ET","\u{1F1EA}\u{1F1F9}"],["Falkland Islands","FK","\u{1F1EB}\u{1F1F0}"],["Faroe Islands","FO","\u{1F1EB}\u{1F1F4}"],["Fiji","FJ","\u{1F1EB}\u{1F1EF}"],["Finland","FI","\u{1F1EB}\u{1F1EE}"],["France","FR","\u{1F1EB}\u{1F1F7}"],["French Guiana","GF","\u{1F1EC}\u{1F1EB}"],["French Polynesia","PF","\u{1F1F5}\u{1F1EB}"],["Gabon","GA","\u{1F1EC}\u{1F1E6}"],["Gambia","GM","\u{1F1EC}\u{1F1F2}"],["Georgia","GE","\u{1F1EC}\u{1F1EA}"],["Germany","DE","\u{1F1E9}\u{1F1EA}"],["Ghana","GH","\u{1F1EC}\u{1F1ED}"],["Gibraltar","GI","\u{1F1EC}\u{1F1EE}"],["Greece","GR","\u{1F1EC}\u{1F1F7}"],["Greenland","GL","\u{1F1EC}\u{1F1F1}"],["Grenada","GD","\u{1F1EC}\u{1F1E9}"],["Guadeloupe","GP","\u{1F1EC}\u{1F1F5}"],["Guam","GU","\u{1F1EC}\u{1F1FA}"],["Guatemala","GT","\u{1F1EC}\u{1F1F9}"],["Guernsey","GG","\u{1F1EC}\u{1F1EC}"],["Guinea","GN","\u{1F1EC}\u{1F1F3}"],["Guinea-Bissau","GW","\u{1F1EC}\u{1F1FC}"],["Guyana","GY","\u{1F1EC}\u{1F1FE}"],["Haiti","HT","\u{1F1ED}\u{1F1F9}"],["Honduras","HN","\u{1F1ED}\u{1F1F3}"],["Hong Kong SAR China","HK","\u{1F1ED}\u{1F1F0}"],["Hungary","HU","\u{1F1ED}\u{1F1FA}"],["Iceland","IS","\u{1F1EE}\u{1F1F8}"],["India","IN","\u{1F1EE}\u{1F1F3}"],["Indonesia","ID","\u{1F1EE}\u{1F1E9}"],["Iran","IR","\u{1F1EE}\u{1F1F7}"],["Iraq","IQ","\u{1F1EE}\u{1F1F6}"],["Ireland","IE","\u{1F1EE}\u{1F1EA}"],["Isle of Man","IM","\u{1F1EE}\u{1F1F2}"],["Israel","IL","\u{1F1EE}\u{1F1F1}"],["Italy","IT","\u{1F1EE}\u{1F1F9}"],["Jamaica","JM","\u{1F1EF}\u{1F1F2}"],["Japan","JP","\u{1F1EF}\u{1F1F5}"],["Jersey","JE","\u{1F1EF}\u{1F1EA}"],["Jordan","JO","\u{1F1EF}\u{1F1F4}"],["Kazakhstan","KZ","\u{1F1F0}\u{1F1FF}"],["Kenya","KE","\u{1F1F0}\u{1F1EA}"],["Kiribati","KI","\u{1F1F0}\u{1F1EE}"],["Kosovo","XK","\u{1F1FD}\u{1F1F0}"],["Kuwait","KW","\u{1F1F0}\u{1F1FC}"],["Kyrgyzstan","KG","\u{1F1F0}\u{1F1EC}"],["Laos","LA","\u{1F1F1}\u{1F1E6}"],["Latvia","LV","\u{1F1F1}\u{1F1FB}"],["Lebanon","LB","\u{1F1F1}\u{1F1E7}"],["Lesotho","LS","\u{1F1F1}\u{1F1F8}"],["Liberia","LR","\u{1F1F1}\u{1F1F7}"],["Libya","LY","\u{1F1F1}\u{1F1FE}"],["Liechtenstein","LI","\u{1F1F1}\u{1F1EE}"],["Lithuania","LT","\u{1F1F1}\u{1F1F9}"],["Luxembourg","LU","\u{1F1F1}\u{1F1FA}"],["Macao SAR China","MO","\u{1F1F2}\u{1F1F4}"],["Madagascar","MG","\u{1F1F2}\u{1F1EC}"],["Malawi","MW","\u{1F1F2}\u{1F1FC}"],["Malaysia","MY","\u{1F1F2}\u{1F1FE}"],["Maldives","MV","\u{1F1F2}\u{1F1FB}"],["Mali","ML","\u{1F1F2}\u{1F1F1}"],["Malta","MT","\u{1F1F2}\u{1F1F9}"],["Marshall Islands","MH","\u{1F1F2}\u{1F1ED}"],["Martinique","MQ","\u{1F1F2}\u{1F1F6}"],["Mauritania","MR","\u{1F1F2}\u{1F1F7}"],["Mauritius","MU","\u{1F1F2}\u{1F1FA}"],["Mayotte","YT","\u{1F1FE}\u{1F1F9}"],["Mexico","MX","\u{1F1F2}\u{1F1FD}"],["Micronesia","FM","\u{1F1EB}\u{1F1F2}"],["Moldova","MD","\u{1F1F2}\u{1F1E9}"],["Monaco","MC","\u{1F1F2}\u{1F1E8}"],["Mongolia","MN","\u{1F1F2}\u{1F1F3}"],["Montenegro","ME","\u{1F1F2}\u{1F1EA}"],["Montserrat","MS","\u{1F1F2}\u{1F1F8}"],["Morocco","MA","\u{1F1F2}\u{1F1E6}"],["Mozambique","MZ","\u{1F1F2}\u{1F1FF}"],["Myanmar (Burma)","MM","\u{1F1F2}\u{1F1F2}"],["Namibia","NA","\u{1F1F3}\u{1F1E6}"],["Nauru","NR","\u{1F1F3}\u{1F1F7}"],["Nepal","NP","\u{1F1F3}\u{1F1F5}"],["Netherlands","NL","\u{1F1F3}\u{1F1F1}"],["New Caledonia","NC","\u{1F1F3}\u{1F1E8}"],["New Zealand","NZ","\u{1F1F3}\u{1F1FF}"],["Nicaragua","NI","\u{1F1F3}\u{1F1EE}"],["Niger","NE","\u{1F1F3}\u{1F1EA}"],["Nigeria","NG","\u{1F1F3}\u{1F1EC}"],["Niue","NU","\u{1F1F3}\u{1F1FA}"],["Norfolk Island","NF","\u{1F1F3}\u{1F1EB}"],["North Korea","KP","\u{1F1F0}\u{1F1F5}"],["North Macedonia","MK","\u{1F1F2}\u{1F1F0}"],["Northern Mariana Islands","MP","\u{1F1F2}\u{1F1F5}"],["Norway","NO","\u{1F1F3}\u{1F1F4}"],["Oman","OM","\u{1F1F4}\u{1F1F2}"],["Pakistan","PK","\u{1F1F5}\u{1F1F0}"],["Palau","PW","\u{1F1F5}\u{1F1FC}"],["Palestinian Territories","PS","\u{1F1F5}\u{1F1F8}"],["Panama","PA","\u{1F1F5}\u{1F1E6}"],["Papua New Guinea","PG","\u{1F1F5}\u{1F1EC}"],["Paraguay","PY","\u{1F1F5}\u{1F1FE}"],["Peru","PE","\u{1F1F5}\u{1F1EA}"],["Philippines","PH","\u{1F1F5}\u{1F1ED}"],["Poland","PL","\u{1F1F5}\u{1F1F1}"],["Portugal","PT","\u{1F1F5}\u{1F1F9}"],["Puerto Rico","PR","\u{1F1F5}\u{1F1F7}"],["Qatar","QA","\u{1F1F6}\u{1F1E6}"],["Romania","RO","\u{1F1F7}\u{1F1F4}"],["Russia","RU","\u{1F1F7}\u{1F1FA}"],["Rwanda","RW","\u{1F1F7}\u{1F1FC}"],["R\xE9union","RE","\u{1F1F7}\u{1F1EA}"],["Samoa","WS","\u{1F1FC}\u{1F1F8}"],["San Marino","SM","\u{1F1F8}\u{1F1F2}"],["Saudi Arabia","SA","\u{1F1F8}\u{1F1E6}"],["Senegal","SN","\u{1F1F8}\u{1F1F3}"],["Serbia","RS","\u{1F1F7}\u{1F1F8}"],["Seychelles","SC","\u{1F1F8}\u{1F1E8}"],["Sierra Leone","SL","\u{1F1F8}\u{1F1F1}"],["Singapore","SG","\u{1F1F8}\u{1F1EC}"],["Sint Maarten","SX","\u{1F1F8}\u{1F1FD}"],["Slovakia","SK","\u{1F1F8}\u{1F1F0}"],["Slovenia","SI","\u{1F1F8}\u{1F1EE}"],["Solomon Islands","SB","\u{1F1F8}\u{1F1E7}"],["Somalia","SO","\u{1F1F8}\u{1F1F4}"],["South Africa","ZA","\u{1F1FF}\u{1F1E6}"],["South Korea","KR","\u{1F1F0}\u{1F1F7}"],["South Sudan","SS","\u{1F1F8}\u{1F1F8}"],["Spain","ES","\u{1F1EA}\u{1F1F8}"],["Sri Lanka","LK","\u{1F1F1}\u{1F1F0}"],["St. Barth\xE9lemy","BL","\u{1F1E7}\u{1F1F1}"],["St. Helena","SH","\u{1F1F8}\u{1F1ED}"],["St. Kitts & Nevis","KN","\u{1F1F0}\u{1F1F3}"],["St. Lucia","LC","\u{1F1F1}\u{1F1E8}"],["St. Martin","MF","\u{1F1F2}\u{1F1EB}"],["St. Pierre & Miquelon","PM","\u{1F1F5}\u{1F1F2}"],["St. Vincent & Grenadines","VC","\u{1F1FB}\u{1F1E8}"],["Sudan","SD","\u{1F1F8}\u{1F1E9}"],["Suriname","SR","\u{1F1F8}\u{1F1F7}"],["Svalbard & Jan Mayen","SJ","\u{1F1F8}\u{1F1EF}"],["Sweden","SE","\u{1F1F8}\u{1F1EA}"],["Switzerland","CH","\u{1F1E8}\u{1F1ED}"],["Syria","SY","\u{1F1F8}\u{1F1FE}"],["S\xE3o Tom\xE9 & Pr\xEDncipe","ST","\u{1F1F8}\u{1F1F9}"],["Taiwan","TW","\u{1F1F9}\u{1F1FC}"],["Tajikistan","TJ","\u{1F1F9}\u{1F1EF}"],["Tanzania","TZ","\u{1F1F9}\u{1F1FF}"],["Thailand","TH","\u{1F1F9}\u{1F1ED}"],["Timor-Leste","TL","\u{1F1F9}\u{1F1F1}"],["Togo","TG","\u{1F1F9}\u{1F1EC}"],["Tokelau","TK","\u{1F1F9}\u{1F1F0}"],["Tonga","TO","\u{1F1F9}\u{1F1F4}"],["Trinidad & Tobago","TT","\u{1F1F9}\u{1F1F9}"],["Tristan da Cunha","TA","\u{1F1F9}\u{1F1E6}"],["Tunisia","TN","\u{1F1F9}\u{1F1F3}"],["Turkey","TR","\u{1F1F9}\u{1F1F7}"],["Turkmenistan","TM","\u{1F1F9}\u{1F1F2}"],["Turks & Caicos Islands","TC","\u{1F1F9}\u{1F1E8}"],["Tuvalu","TV","\u{1F1F9}\u{1F1FB}"],["U.S. Virgin Islands","VI","\u{1F1FB}\u{1F1EE}"],["Uganda","UG","\u{1F1FA}\u{1F1EC}"],["Ukraine","UA","\u{1F1FA}\u{1F1E6}"],["United Arab Emirates","AE","\u{1F1E6}\u{1F1EA}"],["United Kingdom","GB","\u{1F1EC}\u{1F1E7}"],["United States","US","\u{1F1FA}\u{1F1F8}"],["Uruguay","UY","\u{1F1FA}\u{1F1FE}"],["Uzbekistan","UZ","\u{1F1FA}\u{1F1FF}"],["Vanuatu","VU","\u{1F1FB}\u{1F1FA}"],["Vatican City","VA","\u{1F1FB}\u{1F1E6}"],["Venezuela","VE","\u{1F1FB}\u{1F1EA}"],["Vietnam","VN","\u{1F1FB}\u{1F1F3}"],["Wallis & Futuna","WF","\u{1F1FC}\u{1F1EB}"],["Western Sahara","EH","\u{1F1EA}\u{1F1ED}"],["Yemen","YE","\u{1F1FE}\u{1F1EA}"],["Zambia","ZM","\u{1F1FF}\u{1F1F2}"],["Zimbabwe","ZW","\u{1F1FF}\u{1F1FC}"],["\xC5land Islands","AX","\u{1F1E6}\u{1F1FD}"]];var Ho=Lr,Pr=Ho.map(([e,r,t])=>({name:e,code:r,callCode:Vo(r),flag:t}));import R from"react";import{View as Ro,Text as Mr,Pressable as Ko,StyleSheet as zo}from"react-native";import*as _e from"react";import Go,{Path as No}from"react-native-svg";var Do=e=>_e.createElement(Go,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_e.createElement(No,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})),Fr=Do;var Tr=({country:e,onPress:r,selected:t})=>R.createElement(Ko,{onPress:r},R.createElement(Ro,{style:Ie.row},R.createElement(Mr,{style:Ie.rowFlag},e.flag),R.createElement(Mr,{style:Ie.rowLabel},e.name," (+",e.callCode,")"),t&&R.createElement(Fr,{color:m.interactive}))),Ie=zo.create({row:{flexDirection:"row",alignItems:"center",gap:10,height:56},rowFlag:{fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22},rowLabel:{flex:1,fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22,color:m.black}});import*as Ue from"react";import Zo,{Path as jo}from"react-native-svg";var qo=e=>Ue.createElement(Zo,k({xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),Ue.createElement(jo,{fill:e.color,fillRule:"evenodd",d:"M7.01 12.01a5.5 5.5 0 1 1 4.304-2.075.7.7 0 0 1 .156.115l3.818 3.819a.65.65 0 0 1-.92.92l-3.818-3.82a.7.7 0 0 1-.115-.155A5.48 5.48 0 0 1 7.01 12.01m4.5-5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0",clipRule:"evenodd"})),Wr=qo;var tn=600,_r=({countryCode:e,onChangeCountryCode:r,onComplete:t})=>{let[o,a]=Yo(""),s=Er(o,tn),n=Jo(()=>Pr.filter(i=>i.name.toLowerCase().includes(s.toLowerCase())),[s]);return T.createElement(Xo,{behavior:en.OS==="ios"?"padding":void 0,style:Ar.innerContainer},T.createElement(Qo,{style:Ar.header},T.createElement(F,{title:"Select country code"}),T.createElement(B,{LeftIcon:T.createElement(Wr,{color:m.placeholder}),value:o,onChangeText:a,placeholder:"Search country"})),T.createElement(rn,{style:{flex:1},data:n,keyExtractor:i=>`country-option-${i.code}`,renderItem:({item:i})=>T.createElement(Tr,{country:i,selected:i.code===e,onPress:()=>{r(i.code),t()}})}),T.createElement(v,{title:"Continue",onPress:t}))},Ar=$o.create({innerContainer:{flex:1,paddingHorizontal:16},header:{gap:20}});import ie from"react";import{View as sn,Text as ln,Pressable as cn,StyleSheet as un}from"react-native";import{getCountryCallingCode as mn}from"@privy-io/js-sdk-core";import*as Oe from"react";import on,{Path as nn}from"react-native-svg";var an=e=>Oe.createElement(on,k({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),Oe.createElement(nn,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m4 6 4 4 4-4"})),Ir=an;var Or=({countryCode:e,onPress:r})=>ie.createElement(cn,{onPress:r},ie.createElement(sn,{style:Ur.cell},ie.createElement(ln,{style:Ur.text},e," +",mn(e)),ie.createElement(Ir,{color:m.icon}))),Ur=un.create({cell:{flexDirection:"row",alignItems:"center",gap:6},text:{fontFamily:"Inter_400Regular",fontSize:18,lineHeight:30,color:m.text}});var Br=({sendCode:e,isLoading:r,error:t,initialPhone:o,FooterComponent:a})=>{let[s,n]=Be(o!=null?o:""),[i,d]=Be("US"),[f,u]=Be(!1),g=pn(i),l=hn(i),c=y=>{try{let C=y.replace(/\D/g,""),p=s.replace(/\D/g,""),E=C===p?y:g.input(y);n(E)}catch(C){console.error("Error processing phone number:",C),n("")}};return f?b.createElement(_r,{countryCode:i,onChangeCountryCode:d,onComplete:()=>u(!1)}):b.createElement(gn,{behavior:fn.OS==="ios"?"padding":void 0,style:se.innerContainer},b.createElement(ae,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},b.createElement(ae,{style:se.content},b.createElement(ae,{style:se.content},b.createElement(ae,{style:se.formContainer},b.createElement(F,{title:"Enter your phone"}),b.createElement(B,{LeftIcon:b.createElement(Or,{countryCode:i,onPress:()=>u(!0)}),value:s,onChangeText:c,error:!!t,status:t?Sn(t):" ",placeholder:l,autoComplete:"tel",keyboardType:"phone-pad",autoFocus:!0})),a),b.createElement(ee,null)),b.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},Sn=yn({invalid_data:"Phone is incorrect.",not_supported:"Region or carrier not yet supported.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),se=dn.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var kn=600,Gr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=Cn(h),a=U(),[s,n]=Hr(""),{state:i,loginWithCode:d,sendCode:f}=tr(),[u,g]=Hr("phone"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=wn(()=>{var p;switch(i.status){case"initial":return{step:{type:"phone"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),Vr(()=>{if(!C)return;let p=setTimeout(()=>{a()},kn);return()=>clearTimeout(p)},[C,a]),Vr(()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o,a]),l.type){case"phone":return Ve.createElement(Br,{initialPhone:s,sendCode:p=>{n(p),f({phone:p})},isLoading:y,error:c,FooterComponent:Ve.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})});case"code":return Ve.createElement(X,{loginWithCode:p=>d({code:p,phone:s}),requestNewCode:()=>f({phone:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C})}};import K from"react";import{Pressable as En,StyleSheet as Ln,View as Dr}from"react-native";import*as He from"react";import bn,{Path as vn}from"react-native-svg";var xn=e=>He.createElement(bn,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),He.createElement(vn,{fill:e.color,d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),Nr=xn;var Rr=({goBack:e})=>K.createElement(Dr,{style:Kr.navigationBar},K.createElement(Pn,{onPress:e})),Pn=e=>K.createElement(En,k({},e),K.createElement(Dr,{style:Kr.backButton},K.createElement(Nr,{color:m.icon}))),Kr=Ln.create({navigationBar:{height:48},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});import zr from"react";import{Modal as Fn,View as Mn,StyleSheet as Zr}from"react-native";import{useSafeAreaInsets as Tn}from"react-native-safe-area-context";var Wn=()=>{let e=Tn();return{paddingTop:e.top,paddingBottom:e.bottom,paddingLeft:e.left,paddingRight:e.right}},jr=({children:e,visible:r})=>{let t=Wn();return zr.createElement(Fn,{animationType:"slide",transparent:!0,visible:r},zr.createElement(Mn,{style:[Zr.absoluteFill,An.modalContent,t]},e))},An=Zr.create({modalContent:{backgroundColor:m.white}});var Un=({config:e,goBackRef:r})=>{let[t,o]=In(()=>Re(e.loginMethods)),a=t&&Ke(e.loginMethods,t);switch(t){case"email":return z.createElement(xr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case"sms":return z.createElement(Gr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});default:throw new ue("unsupported_login_method",`Unsupported login method: ${t}`)}},On=()=>{let e=U(),r=Ze(),t=Je();qe();let o=_n(null);return z.createElement(jr,{visible:t},z.createElement(Rr,{goBack:()=>{var a;return((a=o.current)!=null?a:e)()}}),r&&z.createElement(Un,{config:r,goBackRef:o}))};import{useCallback as qr,useContext as Bn,useEffect as Vn,useRef as Hn}from"react";var Gn=()=>{let e=je(),{setOtpState:r,user:t}=Bn(h),o=qr(()=>r({status:"initial"}),[]),a=Hn(t);return Vn(()=>{a.current=t}),{login:qr(n=>S(void 0,null,function*(){return{user:yield e(n,a.current,o)}}),[e,o])}};import{digest as Nn}from"expo-crypto";import Dn from"@privy-io/js-sdk-core";var Rn=({appId:e,clientId:r,storage:t=ce,supportedChains:o,baseUrl:a,logLevel:s})=>new Dn({appId:e,clientId:r,supportedChains:o,storage:De(t),sdkVersion:`expo:${Ge.version}`,nativeAppIdentifier:Ne(),crypto:{digest:Nn},baseUrl:a,logLevel:s});export{h as PrivyContext,On as PrivyElements,zn as PrivyProvider,ue as PrivyUIError,ce as SecureStorageAdapter,Rn as createPrivyClient,Kn as getAccessToken,$n as hasError,Zn as isConnected,qn as isConnecting,Qn as isCreating,Jn as isDisconnected,Yn as isNotCreated,jn as isReconnecting,Xn as needsRecovery,Va as useCreateGuestAccount,Pt as useEmbeddedSolanaWallet,be as useEmbeddedWallet,Fa as useEmbeddedWalletStateChange,Aa as useIdentityToken,Ei as useLinkEmail,Vi as useLinkSMS,Qi as useLinkWithFarcaster,Yr as useLinkWithOAuth,ni as useLinkWithSiwe,Gn as useLogin,Xe as useLoginWithEmail,ua as useLoginWithFarcaster,Jr as useLoginWithOAuth,tr as useLoginWithSMS,mi as useLoginWithSiwe,Qr as useOAuthFlow,ka as useOAuthTokens,Wt as usePrivy,Mt as usePrivyClient,oa as useUnlinkFarcaster,pa as useUnlinkOAuth,Si as useUnlinkWallet};
|
|
1
|
+
import{A as $n,B as Xn,C as ei,D as ri,E as ti,F as oi,G as ni,H as ii,I as ai,a as k,c as j,d as S,e as Re,f as w,g as U,h as q,i as et,j as rt,k as tt,l as Ke,m as ze,n as me,o as de,p as Ze,q as je,r as qe,s as Je,t as J,u as Ye,v as Qe,w as $e,x as Xe,y as f,z as Qn}from"./chunk-K6EKFGTE.js";export*from"@privy-io/js-sdk-core";import{useCallback as ge,useContext as ot}from"react";import{PrivyClientError as nt}from"@privy-io/js-sdk-core";var mi=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=ot(f),s=ge(d=>{var u;let h=w(d);return o({status:"error",error:h}),(u=e==null?void 0:e.onError)==null||u.call(e,h),h},[e==null?void 0:e.onError]),n=ge(g=>S(void 0,[g],function*({wallet:d,from:{domain:h,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,h,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]),i=ge(u=>S(void 0,[u],function*({signature:d,messageOverride:h}){var g;try{if(!r)throw new nt({code:"attempted_link_siwe_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiwe` to login with a wallet"});o({status:"submitting-signature"});let l=yield t.auth.siwe.linkWithSiwe(d,void 0,h);return o({status:"done"}),(g=e==null?void 0:e.onSuccess)==null||g.call(e,l),l}catch(l){throw s(l)}}),[r,t,s,e==null?void 0:e.onSuccess]);return{generateSiweMessage:n,linkWithSiwe:i,state:a}};import{useCallback as he,useContext as it}from"react";import{PrivyClientError as at}from"@privy-io/js-sdk-core";var Si=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=it(f),s=he(d=>{var u;let h=w(d);return o({status:"error",error:h}),(u=e==null?void 0:e.onError)==null||u.call(e,h),h},[e==null?void 0:e.onError]),n=he(g=>S(void 0,[g],function*({wallet:d,from:{domain:h,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,h,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]);return{loginWithSiwe:he(g=>S(void 0,[g],function*({signature:d,messageOverride:h,disableSignup:u}){var l;try{if(r)throw new at({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"});o({status:"submitting-signature"});let c=yield t.auth.siwe.loginWithSiwe(d,void 0,h,u?"no-signup":"login-or-sign-up");return o({status:"done"}),(l=e==null?void 0:e.onSuccess)==null||l.call(e,c.user,c.is_new_user),c.user}catch(c){throw s(c)}}),[r,t,s,e==null?void 0:e.onSuccess]),generateSiweMessage:n,state:a}};import{useCallback as er,useContext as st}from"react";import{PrivyClientError as lt}from"@privy-io/js-sdk-core";var Li=e=>{let{user:r,client:t}=st(f),o=er(s=>{var i;let n=w(s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{unlinkWallet:er(n=>S(void 0,[n],function*({address:s}){var i;try{if(!r)throw new lt({code:"attempted_unlink_siwe_before_logged_in",error:"Must be logged in to unlink a wallet, Use `useLoginWithSiwe` to login with a wallet"});let d=yield t.auth.siwe.unlinkWallet(s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw o(d)}}),[r,t,o,e==null?void 0:e.onSuccess])}};import{useCallback as fe,useContext as ct,useState as ut}from"react";import{PrivyClientError as rr}from"@privy-io/js-sdk-core";var Ai=e=>{let[r,t]=ut(""),{user:o,client:a,otpState:s,setOtpState:n}=ct(f),i=fe(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=fe(g=>S(void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),h=fe(l=>S(void 0,[l],function*({code:u,email:g}){var c;try{if(!o)throw new rr({code:"attempted_link_email_before_logged_in",error:"Must be logged in to link an email, Use `useLoginWithEmail` to login with email"});let y=g||r;if(!y)throw new rr({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.email.linkWithCode(y,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:h,state:s}};import{useCallback as pe,useContext as mt,useState as dt}from"react";import{PrivyClientError as tr}from"@privy-io/js-sdk-core";var or=e=>{let[r,t]=dt(""),{user:o,client:a,otpState:s,setOtpState:n}=mt(f),i=pe(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=pe(g=>S(void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),h=pe(c=>S(void 0,[c],function*({code:u,email:g,disableSignup:l}){var y;try{if(o)throw new tr({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 C=g||r;if(!C)throw new tr({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.email.loginWithCode(C,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:h,state:s}};import{useCallback as ye,useContext as gt,useState as ht}from"react";import{PrivyClientError as nr}from"@privy-io/js-sdk-core";var zi=e=>{let[r,t]=ht(""),{user:o,client:a,otpState:s,setOtpState:n}=gt(f),i=ye(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=ye(g=>S(void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),h=ye(l=>S(void 0,[l],function*({code:u,phone:g}){var c;try{if(!o)throw new nr({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(!(g||r))throw new nr({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.phone.linkWithCode(g||r,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:h,state:s}};import{useCallback as Se,useContext as ft,useState as pt}from"react";import{PrivyClientError as ir}from"@privy-io/js-sdk-core";var ar=e=>{let[r,t]=pt(""),{user:o,client:a,otpState:s,setOtpState:n}=ft(f),i=Se(u=>{var l;let g=w(u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=Se(g=>S(void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),h=Se(c=>S(void 0,[c],function*({code:u,phone:g,disableSignup:l}){var y;try{if(o)throw new ir({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(!(g||r))throw new ir({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.phone.loginWithCode(g||r,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:h,state:s}};import*as Y from"expo-linking";import{useCallback as Ce,useContext as yt,useRef as St}from"react";import{PrivyClientError as D}from"@privy-io/js-sdk-core";var na=e=>{let{appState:r,getCurrentAppState:t}=q(),{client:o,user:a,farcasterState:s,setFarcasterState:n}=yt(f),i=St(!1),d=Ce(g=>{var c;let l=w(g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),h=Ce(()=>{i.current=!0},[]);return{linkWithFarcaster:Ce((y,...C)=>S(void 0,[y,...C],function*({relyingParty:g,redirectUrl:l},c={pollAttempts:10,pollIntervalMs:1e3}){var p;try{if(i.current=!1,!a)throw new D({code:"attempted_link_farcaster_before_logged_in",error:"Must be logged in to link a Farcaster account."});n({status:"generating-uri"});let{connect_uri:E,channel_token:P}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:Y.createURL(l!=null?l:"/")});if(!E)throw new D({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!P)throw new D({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield Y.openURL(E),n({status:"polling-status"});let I=0;for(;I<c.pollAttempts;){if(i.current)throw new D({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield U(c.pollIntervalMs);continue}let G=yield o.auth.farcaster.getFarcasterStatus({channel_token:P});if(G.state==="completed"){n({status:"submitting-token"});let N=yield o.auth.farcaster.link(k({channel_token:P},G));return n({status:"done"}),(p=e==null?void 0:e.onSuccess)==null||p.call(e,N),N}I++,yield U(c.pollIntervalMs)}throw new D({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(E){throw d(E)}}),[o,e==null?void 0:e.onSuccess,d,n,a]),state:s,cancel:h}};import{useCallback as sr,useContext as Ct}from"react";var ua=e=>{let{client:r}=Ct(f),t=sr(a=>{var n;let s=w(a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkFarcaster:sr(s=>S(void 0,[s],function*({fid:a}){var n;try{let i=yield r.auth.farcaster.unlink({fid:a});return(n=e==null?void 0:e.onSuccess)==null||n.call(e,i),i}catch(i){throw t(i)}}),[r,e==null?void 0:e.onSuccess,t])}};import*as Q from"expo-linking";import{useCallback as be,useContext as wt,useRef as kt}from"react";import{PrivyClientError as R}from"@privy-io/js-sdk-core";var ya=e=>{let{appState:r,getCurrentAppState:t}=q(),{client:o,user:a,farcasterState:s,setFarcasterState:n}=wt(f),i=kt(!1),d=be(g=>{var c;let l=w(g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),h=be(()=>{i.current=!0},[]);return{loginWithFarcaster:be((C,...p)=>S(void 0,[C,...p],function*({relyingParty:g,redirectUrl:l,disableSignup:c},y={pollAttempts:10,pollIntervalMs:1e3}){var E;try{if(i.current=!1,a)throw new R({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"});n({status:"generating-uri"});let{connect_uri:P,channel_token:I}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:Q.createURL(l!=null?l:"/")});if(!P)throw new R({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!I)throw new R({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield Q.openURL(P),n({status:"polling-status"});let G=0;for(;G<y.pollAttempts;){if(i.current)throw new R({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield U(y.pollIntervalMs);continue}let N=yield o.auth.farcaster.getFarcasterStatus({channel_token:I});if(N.state==="completed"){n({status:"submitting-token"});let ue=yield o.auth.farcaster.authenticate(k({channel_token:I,mode:c?"no-signup":"login-or-sign-up"},N));return n({status:"done"}),(E=e==null?void 0:e.onSuccess)==null||E.call(e,ue.user,ue.is_new_user),ue.user}G++,yield U(y.pollIntervalMs)}throw new R({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(P){throw d(P)}}),[o,d,e==null?void 0:e.onSuccess,n,a,r]),state:s,cancel:h}};import{useCallback as lr,useContext as bt}from"react";var va=e=>{let{client:r}=bt(f),t=lr(a=>{var n;let s=w(a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkOAuth:lr(n=>S(void 0,[n],function*({provider:a,subject:s}){var i;try{let d=yield r.auth.oauth.unlink(a,s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw t(d)}}),[r,e==null?void 0:e.onSuccess,t])}};import{useContext as vt,useEffect as xt,useRef as Lt}from"react";var Ma=e=>{let{client:r}=vt(f),t=Lt(e.onOAuthTokenGrant);t.current=e.onOAuthTokenGrant,xt(()=>{let{unsubscribe:o}=r.addOAuthTokensListener(a=>{t.current(a)});return o},[r])};import{useEffect as Pt}from"react";import{useContext as Et,useEffect as ve}from"react";var xe=(e={})=>{let{wallet:r,createWalletCallbacks:t,recoverWalletCallbacks:o,setWalletRecoveryCallbacks:a}=Et(f),{onCreateWalletSuccess:s,onCreateWalletError:n,onRecoverWalletError:i,onRecoverWalletSuccess:d,onSetWalletRecoverySuccess:h,onSetWalletRecoveryError:u}=e;return ve(()=>{t.current={onSuccess:s,onError:n}},[s,n]),ve(()=>{o.current={onSuccess:d,onError:i}},[d,i]),ve(()=>{a.current={onSuccess:h,onError:u}},[d,i]),r};var Ua=({onStateChange:e})=>{let r=xe();return Pt(()=>{e(r)},[r])};import{useContext as Mt}from"react";var Ha=()=>{let{getIdentityToken:e}=Mt(f);return{getIdentityToken:e}};import{useCallback as cr,useContext as Ft}from"react";import{PrivyClientError as Tt}from"@privy-io/js-sdk-core";var za=e=>{let{user:r,client:t}=Ft(f),o=cr(s=>{var i;let n=w(s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{create:cr(()=>S(void 0,null,function*(){var s;try{if(r)throw new Tt({code:"attempted_to_create_guest_account_for_logged_in_user",error:"Already logged in, you cannot create a guest account"});let n=yield t.auth.guest.create();return(s=e==null?void 0:e.onSuccess)==null||s.call(e,n.user,n.is_new_user),n.user}catch(n){throw o(n)}}),[t,o,r,e==null?void 0:e.onSuccess])}};import{useContext as Wt,useEffect as ur}from"react";var At=(e={})=>{let{solanaWallet:r,createSolanaWalletCallbacks:t,recoverSolanaWalletCallbacks:o}=Wt(f),{onCreateWalletSuccess:a,onCreateWalletError:s,onRecoverWalletError:n,onRecoverWalletSuccess:i}=e;return ur(()=>{t.current={onSuccess:a,onError:s}},[a,s]),ur(()=>{o.current={onSuccess:i,onError:n}},[i,n]),r};import{useContext as _t}from"react";var It=()=>{let{client:e}=_t(f);return e};import{useContext as Ut}from"react";var Ot=()=>{let{user:e,isReady:r,logout:t,getAccessToken:o}=Ut(f);return{user:e,isReady:r,logout:t,getAccessToken:o}};import H,{useRef as Nn}from"react";import Ie,{useContext as Bo,useEffect as Er,useMemo as Vo,useState as Pr}from"react";import F,{useCallback as so,useEffect as lo,useState as wr}from"react";import{View as Te,StyleSheet as co,KeyboardAvoidingView as uo,Platform as mo}from"react-native";import{createErrorFormatter as go}from"@privy-io/js-sdk-core";import $ from"react";import{View as Dt,Text as Rt,Pressable as Kt,StyleSheet as zt}from"react-native";import Le,{useEffect as Bt}from"react";import{Animated as Ee,Easing as Vt,useAnimatedValue as Ht}from"react-native";import Gt,{Path as Nt}from"react-native-svg";var mr=()=>{let e=Ht(0);Bt(()=>{e.setValue(0);let t=Ee.loop(Ee.timing(e,{toValue:1,duration:1200,useNativeDriver:!0,easing:Vt.linear}));return t.start(),()=>t.stop()},[]);let r=e.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return Le.createElement(Ee.View,{style:{transform:[{rotate:r}]}},Le.createElement(Gt,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},Le.createElement(Nt,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:"#fff",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var m={interactive:"#5B4FFF",white:"#FFFFFF",black:"#000000",brand:"#010110",placeholder:"#9498B8",success:"#22C55E",successDark:"#15803D",inputBackground:"#F3F3F3",text:"#040217",icon:"#110F2A",border:"#E2E3F0",error:"#EF4444",errorDark:"#B91C1C",textMuted:"#64668B",textTitle:"#1A1C29"};var b=a=>{var s=a,{variant:e="primary",title:r,loading:t=!1}=s,o=j(s,["variant","title","loading"]);return $.createElement(Kt,k({},o),$.createElement(Dt,{style:[O.buttonBox,e==="secondary"&&O.buttonBoxSecondary,e==="tertiary"&&O.buttonBoxTertiary]},t?$.createElement(mr,null):$.createElement(Rt,{style:[O.buttonLabel,e==="secondary"&&O.buttonLabelSecondary,e==="tertiary"&&O.buttonLabelTertiary]},r)))},O=zt.create({buttonBox:{height:54,justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,backgroundColor:m.interactive},buttonBoxSecondary:{backgroundColor:m.white,alignItems:"flex-start",borderColor:m.border,borderWidth:1,borderRadius:12},buttonBoxTertiary:{backgroundColor:m.white},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24,color:m.white},buttonLabelSecondary:{fontFamily:"Inter_400Regular",color:m.text},buttonLabelTertiary:{fontFamily:"Inter_500Medium",color:m.interactive}});import M,{useState as Jt,useRef as Yt}from"react";import{View as hr,TextInput as Qt,Pressable as $t,Text as pr,StyleSheet as Xt}from"react-native";import dr from"react";import{View as Zt,Text as jt,StyleSheet as qt}from"react-native";var gr=({value:e,isFocused:r,isSuccess:t,isError:o})=>dr.createElement(Zt,{style:[K.box,r&&K.focusedBox,t&&K.successBox,o&&K.errorBox]},dr.createElement(jt,{style:K.text},e)),K=qt.create({box:{borderWidth:1,borderColor:m.border,borderRadius:12,height:64,width:48,justifyContent:"center",alignItems:"center"},focusedBox:{borderWidth:2,borderColor:m.interactive},successBox:{borderColor:m.success},errorBox:{borderColor:m.error},text:{fontFamily:"Inter_500Medium",fontSize:16,lineHeight:20,color:m.text}});var fr=6,eo=[0,1,2,"-",3,4,5];function Pe({value:e="",status:r=" ",onChangeText:t=()=>{},editable:o=!0,success:a=!1,error:s=!1,autoFocus:n=!1}){let i=Yt(null),[d,h]=Jt(!1),u=()=>{var c;(c=i==null?void 0:i.current)==null||c.focus()},g=c=>{let y=c.replace(/\D/g,"");t(y)},l=d?Math.min(e.length,fr-1):void 0;return M.createElement(hr,{style:A.container},M.createElement(Qt,{autoFocus:n,style:A.invisibleTextInput,value:e,onChangeText:g,maxLength:fr,ref:i,editable:o,onFocus:()=>h(!0),onBlur:()=>h(!1),keyboardType:"numeric"}),M.createElement($t,{onPress:u,disabled:!o},M.createElement(hr,{style:A.codeContainer},eo.map((c,y)=>c==="-"?M.createElement(ro,{key:y}):M.createElement(gr,{key:y,isFocused:l===c,value:e[c]||"",isSuccess:a,isError:s})))),M.createElement(pr,{style:[A.statusText,a&&A.statusSuccess,s&&A.statusError]},r))}var ro=()=>M.createElement(pr,{style:A.separator},"-"),A=Xt.create({container:{justifyContent:"center",paddingHorizontal:0,gap:6},invisibleTextInput:{position:"absolute",opacity:0},codeContainer:{flexDirection:"row",alignItems:"center",gap:10,justifyContent:"space-between"},separator:{fontFamily:"Inter_600SemiBold",fontSize:18,lineHeight:24,color:m.black},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark},statusSuccess:{color:m.successDark}});import Me from"react";import{StyleSheet as to,View as oo,Text as yr}from"react-native";var x=({title:e,subtitle:r})=>Me.createElement(oo,{style:Fe.titleContainer},Me.createElement(yr,{style:Fe.title},e),r&&Me.createElement(yr,{style:Fe.subtitle},r)),Fe=to.create({titleContainer:{alignItems:"center",gap:16},title:{fontFamily:"Inter_600SemiBold",fontSize:20,lineHeight:32,color:m.textTitle},subtitle:{fontFamily:"Inter_400Regular",fontSize:16,lineHeight:24,color:m.textMuted,textAlign:"center"}});import X from"react";import{Pressable as no,StyleSheet as io,Text as Sr,View as ao}from"react-native";var Cr=({hint:e,link:r,onPress:t,disabled:o})=>X.createElement(ao,{style:ee.container},X.createElement(Sr,{style:ee.hintText},e),r&&X.createElement(no,{onPress:t,disabled:o},X.createElement(Sr,{style:[ee.linkText,o&&ee.disabledLink]}," ",r))),ee=io.create({container:{display:"flex",flexDirection:"row",gap:2},hintText:{fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22,color:m.textMuted},linkText:{fontFamily:"Inter_500Medium",fontSize:14,lineHeight:22,color:m.interactive},disabledLink:{color:m.textMuted}});var ho=3e4,fo=()=>{let[e,r]=wr(!1),t=so(()=>{r(!1),setTimeout(()=>{r(!0)},ho)},[]);return lo(()=>{t()},[]),[e,t]},re=({loginWithCode:e,requestNewCode:r,subtitle:t,isLoading:o,error:a,isDone:s})=>{let[n,i]=wr(""),d=l=>{i(l),l.length===6&&e(l)},[h,u]=fo(),g=()=>{r(),u()};return F.createElement(uo,{behavior:mo.OS==="ios"?"padding":void 0,style:We.innerContainer},F.createElement(Te,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},F.createElement(Te,{style:We.content},F.createElement(Te,{style:We.formContainer},F.createElement(x,{title:"Enter confirmation code",subtitle:t}),F.createElement(Pe,{value:n,editable:!o,onChangeText:d,success:s,error:!!a,status:s?"Success.":a?po(a):" ",autoFocus:!0}),F.createElement(Cr,{hint:"Didn\u2019t get an email?",link:"Resend code",onPress:g,disabled:!h}))),F.createElement(b,{title:"Continue",loading:o,onPress:()=>e(n)})))},po=go({invalid_credentials:"Invalid code.",invalid_data:"The code has expired.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),We=co.create({modalContent:{backgroundColor:"#ffffff"},innerContainer:{flex:1},content:{gap:16},formContainer:{rowGap:24}});import L,{useState as To}from"react";import{View as oe,StyleSheet as Wo,KeyboardAvoidingView as Ao,Platform as _o}from"react-native";import{createErrorFormatter as Io}from"@privy-io/js-sdk-core";import br from"react";import{StyleSheet as wo,View as ko}from"react-native";import*as Ae from"react";import yo,{Path as So}from"react-native-svg";var Co=e=>Ae.createElement(yo,k({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40"},e),Ae.createElement(So,{fill:e.color,d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02m176.8 1.71v5.72h-.27l-.09-.14a16 16 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a9 9 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.1 8.1 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.1 6.1 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73q.12-2.34.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02m27.66 4.14.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.8 6.8 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13 13 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13 13 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.5 7.5 0 0 0-2.8.5A7.1 7.1 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6 6 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.5 5.5 0 0 1 2.3-.63 10 10 0 0 1 1.13.02M69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.7 8.7 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49Zm64.29 0V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a5 5 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.6 2.6 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49Zm160.07.19a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.5 14.5 0 0 0-8.74-2.35m57.39 0a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.5 10.5 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.8 9.8 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.4 7.4 0 0 1-1.26-2.32 14.1 14.1 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03m13.77-5.31-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a912 912 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4v-6.9h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46v-4.4h-5.6c-4.46 0-5.6 0-5.6.02Zm27.17 13.85V30.8h3.87l3.86-.01V3.09h-7.73Zm9.8-13.85-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4v-.8h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01Zm30.38 0c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88zM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.9 4.9 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a12 12 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07m14.51.05c-2.33.12-4.3.84-5.95 2.16a9.9 9.9 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18 18 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.8 9.8 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04m1.42 3.78c.88.1 1.62.34 2.28.75a6.1 6.1 0 0 1 1.99 2.15 10.3 10.3 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03M92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.6 7.6 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.4 8.4 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18 18 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.3 5.3 0 0 1 2.9-.95c.2-.01.97 0 1.17.03Zm23.44-3.74c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.4 9.4 0 0 0 3.6 1.8 12 12 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.5 5.5 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.3 5.3 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 11 11 0 0 0-4.88-.74m39.41 0a9.87 9.87 0 0 0-6 2.29 11 11 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02m75.93-3.33 8.37 23.22a49 49 0 0 1-.67 1.9 5.4 5.4 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8 8 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3h-4.82Zm59.47 27.98c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a49 49 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41 41 0 0 0-5.8-.24m0 0"})),kr=Co;var B=()=>br.createElement(ko,{style:bo.legalFooterContainer},br.createElement(kr,{color:m.brand,width:"100%",height:11})),bo=wo.create({legalFooterContainer:{flexDirection:"row",alignItems:"center",marginVertical:16,justifyContent:"center",gap:2}});import te,{useState as vo}from"react";import{View as vr,TextInput as xo,StyleSheet as Lo,Text as Eo}from"react-native";var V=a=>{var s=a,{error:e,status:r,LeftIcon:t}=s,o=j(s,["error","status","LeftIcon"]);let[n,i]=vo(!1);return te.createElement(vr,{style:_.container},te.createElement(vr,{style:[_.inputBox,n&&_.inputBoxFocused,e&&_.inputBoxError]},t,te.createElement(xo,k({cursorColor:m.interactive,placeholderTextColor:m.placeholder,onFocus:()=>i(!0),onBlur:()=>i(!1),autoCapitalize:"none",returnKeyType:"next",multiline:!1,numberOfLines:1,style:_.input},o))),r&&te.createElement(Eo,{style:[_.statusText,e&&_.statusError]},r))},_=Lo.create({container:{gap:6},input:{flex:1,fontFamily:"Inter_400Regular",fontSize:18,height:30,color:m.text},inputBox:{flexDirection:"row",paddingHorizontal:16,height:64,backgroundColor:m.inputBackground,borderRadius:14,alignItems:"center",columnGap:10,borderWidth:2,borderColor:m.border},inputBoxFocused:{borderColor:m.interactive},inputBoxError:{borderColor:m.error},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark}});import*as _e from"react";import Po,{Path as Mo}from"react-native-svg";var Fo=e=>_e.createElement(Po,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_e.createElement(Mo,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7m2-3h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"})),xr=Fo;var Lr=({sendCode:e,isLoading:r,error:t,initialEmail:o,FooterComponent:a})=>{let[s,n]=To(o!=null?o:"");return L.createElement(Ao,{behavior:_o.OS==="ios"?"padding":void 0,style:ne.innerContainer},L.createElement(oe,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},L.createElement(oe,{style:ne.content},L.createElement(oe,{style:ne.content},L.createElement(oe,{style:ne.formContainer},L.createElement(x,{title:"Enter your email"}),L.createElement(V,{LeftIcon:L.createElement(xr,{color:m.icon}),value:s,onChangeText:n,error:!!t,status:t?Uo(t):" ",placeholder:"your@email.com",autoComplete:"email",keyboardType:"email-address",autoFocus:!0})),a),L.createElement(B,null)),L.createElement(b,{title:"Continue",loading:r,onPress:()=>e(s)})))},Uo=Io({invalid_data:"Invalid email address.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),ne=Wo.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});import Oo from"react";var ie=({onLoginMethodChange:e,otherLoginMethod:r})=>r?Oo.createElement(b,{variant:"tertiary",title:`Use ${je[r]} instead`,onPress:()=>e(r)}):null;var Ho=600,Mr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=Bo(f),a=J(),[s,n]=Pr(""),{state:i,loginWithCode:d,sendCode:h}=or(),[u,g]=Pr("email"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=Vo(()=>{var p;switch(i.status){case"initial":return{step:{type:"email"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),Er(()=>{if(!C)return;let p=setTimeout(()=>{a()},Ho);return()=>clearTimeout(p)},[C,a]),Er(()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o]),l.type){case"code":return Ie.createElement(re,{loginWithCode:p=>d({code:p,email:s}),requestNewCode:()=>h({email:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C});case"email":return Ie.createElement(Lr,{initialEmail:s,sendCode:p=>{n(p),h({email:p})},isLoading:y,error:c,FooterComponent:Ie.createElement(ie,{onLoginMethodChange:r,otherLoginMethod:t})})}};import Ge,{useContext as xn,useEffect as Dr,useMemo as Ln,useState as Rr}from"react";import v,{useState as He}from"react";import{View as se,StyleSheet as yn,KeyboardAvoidingView as Sn,Platform as Cn}from"react-native";import{getPlaceholderPhoneNumber as wn,phoneNumberTypingFormatter as kn,createErrorFormatter as bn}from"@privy-io/js-sdk-core";import T,{useMemo as en,useState as rn}from"react";import{View as tn,StyleSheet as on,KeyboardAvoidingView as nn,Platform as an,FlatList as sn}from"react-native";import{useState as Go,useEffect as No}from"react";function Fr(e,r){let[t,o]=Go(e);return No(()=>{let a=setTimeout(()=>{o(e)},r);return()=>{clearTimeout(a)}},[e,r]),t}import{getCountryCallingCode as Ro}from"@privy-io/js-sdk-core";var Tr=[["Afghanistan","AF","\u{1F1E6}\u{1F1EB}"],["Albania","AL","\u{1F1E6}\u{1F1F1}"],["Algeria","DZ","\u{1F1E9}\u{1F1FF}"],["American Samoa","AS","\u{1F1E6}\u{1F1F8}"],["Andorra","AD","\u{1F1E6}\u{1F1E9}"],["Angola","AO","\u{1F1E6}\u{1F1F4}"],["Anguilla","AI","\u{1F1E6}\u{1F1EE}"],["Antigua & Barbuda","AG","\u{1F1E6}\u{1F1EC}"],["Argentina","AR","\u{1F1E6}\u{1F1F7}"],["Armenia","AM","\u{1F1E6}\u{1F1F2}"],["Aruba","AW","\u{1F1E6}\u{1F1FC}"],["Ascension Island","AC","\u{1F1E6}\u{1F1E8}"],["Australia","AU","\u{1F1E6}\u{1F1FA}"],["Austria","AT","\u{1F1E6}\u{1F1F9}"],["Azerbaijan","AZ","\u{1F1E6}\u{1F1FF}"],["Bahamas","BS","\u{1F1E7}\u{1F1F8}"],["Bahrain","BH","\u{1F1E7}\u{1F1ED}"],["Bangladesh","BD","\u{1F1E7}\u{1F1E9}"],["Barbados","BB","\u{1F1E7}\u{1F1E7}"],["Belarus","BY","\u{1F1E7}\u{1F1FE}"],["Belgium","BE","\u{1F1E7}\u{1F1EA}"],["Belize","BZ","\u{1F1E7}\u{1F1FF}"],["Benin","BJ","\u{1F1E7}\u{1F1EF}"],["Bermuda","BM","\u{1F1E7}\u{1F1F2}"],["Bhutan","BT","\u{1F1E7}\u{1F1F9}"],["Bolivia","BO","\u{1F1E7}\u{1F1F4}"],["Bosnia & Herzegovina","BA","\u{1F1E7}\u{1F1E6}"],["Botswana","BW","\u{1F1E7}\u{1F1FC}"],["Brazil","BR","\u{1F1E7}\u{1F1F7}"],["British Indian Ocean Territory","IO","\u{1F1EE}\u{1F1F4}"],["British Virgin Islands","VG","\u{1F1FB}\u{1F1EC}"],["Brunei","BN","\u{1F1E7}\u{1F1F3}"],["Bulgaria","BG","\u{1F1E7}\u{1F1EC}"],["Burkina Faso","BF","\u{1F1E7}\u{1F1EB}"],["Burundi","BI","\u{1F1E7}\u{1F1EE}"],["Cambodia","KH","\u{1F1F0}\u{1F1ED}"],["Cameroon","CM","\u{1F1E8}\u{1F1F2}"],["Canada","CA","\u{1F1E8}\u{1F1E6}"],["Cape Verde","CV","\u{1F1E8}\u{1F1FB}"],["Caribbean Netherlands","BQ","\u{1F1E7}\u{1F1F6}"],["Cayman Islands","KY","\u{1F1F0}\u{1F1FE}"],["Central African Republic","CF","\u{1F1E8}\u{1F1EB}"],["Chad","TD","\u{1F1F9}\u{1F1E9}"],["Chile","CL","\u{1F1E8}\u{1F1F1}"],["China","CN","\u{1F1E8}\u{1F1F3}"],["Christmas Island","CX","\u{1F1E8}\u{1F1FD}"],["Cocos (Keeling) Islands","CC","\u{1F1E8}\u{1F1E8}"],["Colombia","CO","\u{1F1E8}\u{1F1F4}"],["Comoros","KM","\u{1F1F0}\u{1F1F2}"],["Congo - Brazzaville","CG","\u{1F1E8}\u{1F1EC}"],["Congo - Kinshasa","CD","\u{1F1E8}\u{1F1E9}"],["Cook Islands","CK","\u{1F1E8}\u{1F1F0}"],["Costa Rica","CR","\u{1F1E8}\u{1F1F7}"],["Croatia","HR","\u{1F1ED}\u{1F1F7}"],["Cuba","CU","\u{1F1E8}\u{1F1FA}"],["Cura\xE7ao","CW","\u{1F1E8}\u{1F1FC}"],["Cyprus","CY","\u{1F1E8}\u{1F1FE}"],["Czechia","CZ","\u{1F1E8}\u{1F1FF}"],["C\xF4te d\u2019Ivoire","CI","\u{1F1E8}\u{1F1EE}"],["Denmark","DK","\u{1F1E9}\u{1F1F0}"],["Djibouti","DJ","\u{1F1E9}\u{1F1EF}"],["Dominica","DM","\u{1F1E9}\u{1F1F2}"],["Dominican Republic","DO","\u{1F1E9}\u{1F1F4}"],["Ecuador","EC","\u{1F1EA}\u{1F1E8}"],["Egypt","EG","\u{1F1EA}\u{1F1EC}"],["El Salvador","SV","\u{1F1F8}\u{1F1FB}"],["Equatorial Guinea","GQ","\u{1F1EC}\u{1F1F6}"],["Eritrea","ER","\u{1F1EA}\u{1F1F7}"],["Estonia","EE","\u{1F1EA}\u{1F1EA}"],["Eswatini","SZ","\u{1F1F8}\u{1F1FF}"],["Ethiopia","ET","\u{1F1EA}\u{1F1F9}"],["Falkland Islands","FK","\u{1F1EB}\u{1F1F0}"],["Faroe Islands","FO","\u{1F1EB}\u{1F1F4}"],["Fiji","FJ","\u{1F1EB}\u{1F1EF}"],["Finland","FI","\u{1F1EB}\u{1F1EE}"],["France","FR","\u{1F1EB}\u{1F1F7}"],["French Guiana","GF","\u{1F1EC}\u{1F1EB}"],["French Polynesia","PF","\u{1F1F5}\u{1F1EB}"],["Gabon","GA","\u{1F1EC}\u{1F1E6}"],["Gambia","GM","\u{1F1EC}\u{1F1F2}"],["Georgia","GE","\u{1F1EC}\u{1F1EA}"],["Germany","DE","\u{1F1E9}\u{1F1EA}"],["Ghana","GH","\u{1F1EC}\u{1F1ED}"],["Gibraltar","GI","\u{1F1EC}\u{1F1EE}"],["Greece","GR","\u{1F1EC}\u{1F1F7}"],["Greenland","GL","\u{1F1EC}\u{1F1F1}"],["Grenada","GD","\u{1F1EC}\u{1F1E9}"],["Guadeloupe","GP","\u{1F1EC}\u{1F1F5}"],["Guam","GU","\u{1F1EC}\u{1F1FA}"],["Guatemala","GT","\u{1F1EC}\u{1F1F9}"],["Guernsey","GG","\u{1F1EC}\u{1F1EC}"],["Guinea","GN","\u{1F1EC}\u{1F1F3}"],["Guinea-Bissau","GW","\u{1F1EC}\u{1F1FC}"],["Guyana","GY","\u{1F1EC}\u{1F1FE}"],["Haiti","HT","\u{1F1ED}\u{1F1F9}"],["Honduras","HN","\u{1F1ED}\u{1F1F3}"],["Hong Kong SAR China","HK","\u{1F1ED}\u{1F1F0}"],["Hungary","HU","\u{1F1ED}\u{1F1FA}"],["Iceland","IS","\u{1F1EE}\u{1F1F8}"],["India","IN","\u{1F1EE}\u{1F1F3}"],["Indonesia","ID","\u{1F1EE}\u{1F1E9}"],["Iran","IR","\u{1F1EE}\u{1F1F7}"],["Iraq","IQ","\u{1F1EE}\u{1F1F6}"],["Ireland","IE","\u{1F1EE}\u{1F1EA}"],["Isle of Man","IM","\u{1F1EE}\u{1F1F2}"],["Israel","IL","\u{1F1EE}\u{1F1F1}"],["Italy","IT","\u{1F1EE}\u{1F1F9}"],["Jamaica","JM","\u{1F1EF}\u{1F1F2}"],["Japan","JP","\u{1F1EF}\u{1F1F5}"],["Jersey","JE","\u{1F1EF}\u{1F1EA}"],["Jordan","JO","\u{1F1EF}\u{1F1F4}"],["Kazakhstan","KZ","\u{1F1F0}\u{1F1FF}"],["Kenya","KE","\u{1F1F0}\u{1F1EA}"],["Kiribati","KI","\u{1F1F0}\u{1F1EE}"],["Kosovo","XK","\u{1F1FD}\u{1F1F0}"],["Kuwait","KW","\u{1F1F0}\u{1F1FC}"],["Kyrgyzstan","KG","\u{1F1F0}\u{1F1EC}"],["Laos","LA","\u{1F1F1}\u{1F1E6}"],["Latvia","LV","\u{1F1F1}\u{1F1FB}"],["Lebanon","LB","\u{1F1F1}\u{1F1E7}"],["Lesotho","LS","\u{1F1F1}\u{1F1F8}"],["Liberia","LR","\u{1F1F1}\u{1F1F7}"],["Libya","LY","\u{1F1F1}\u{1F1FE}"],["Liechtenstein","LI","\u{1F1F1}\u{1F1EE}"],["Lithuania","LT","\u{1F1F1}\u{1F1F9}"],["Luxembourg","LU","\u{1F1F1}\u{1F1FA}"],["Macao SAR China","MO","\u{1F1F2}\u{1F1F4}"],["Madagascar","MG","\u{1F1F2}\u{1F1EC}"],["Malawi","MW","\u{1F1F2}\u{1F1FC}"],["Malaysia","MY","\u{1F1F2}\u{1F1FE}"],["Maldives","MV","\u{1F1F2}\u{1F1FB}"],["Mali","ML","\u{1F1F2}\u{1F1F1}"],["Malta","MT","\u{1F1F2}\u{1F1F9}"],["Marshall Islands","MH","\u{1F1F2}\u{1F1ED}"],["Martinique","MQ","\u{1F1F2}\u{1F1F6}"],["Mauritania","MR","\u{1F1F2}\u{1F1F7}"],["Mauritius","MU","\u{1F1F2}\u{1F1FA}"],["Mayotte","YT","\u{1F1FE}\u{1F1F9}"],["Mexico","MX","\u{1F1F2}\u{1F1FD}"],["Micronesia","FM","\u{1F1EB}\u{1F1F2}"],["Moldova","MD","\u{1F1F2}\u{1F1E9}"],["Monaco","MC","\u{1F1F2}\u{1F1E8}"],["Mongolia","MN","\u{1F1F2}\u{1F1F3}"],["Montenegro","ME","\u{1F1F2}\u{1F1EA}"],["Montserrat","MS","\u{1F1F2}\u{1F1F8}"],["Morocco","MA","\u{1F1F2}\u{1F1E6}"],["Mozambique","MZ","\u{1F1F2}\u{1F1FF}"],["Myanmar (Burma)","MM","\u{1F1F2}\u{1F1F2}"],["Namibia","NA","\u{1F1F3}\u{1F1E6}"],["Nauru","NR","\u{1F1F3}\u{1F1F7}"],["Nepal","NP","\u{1F1F3}\u{1F1F5}"],["Netherlands","NL","\u{1F1F3}\u{1F1F1}"],["New Caledonia","NC","\u{1F1F3}\u{1F1E8}"],["New Zealand","NZ","\u{1F1F3}\u{1F1FF}"],["Nicaragua","NI","\u{1F1F3}\u{1F1EE}"],["Niger","NE","\u{1F1F3}\u{1F1EA}"],["Nigeria","NG","\u{1F1F3}\u{1F1EC}"],["Niue","NU","\u{1F1F3}\u{1F1FA}"],["Norfolk Island","NF","\u{1F1F3}\u{1F1EB}"],["North Korea","KP","\u{1F1F0}\u{1F1F5}"],["North Macedonia","MK","\u{1F1F2}\u{1F1F0}"],["Northern Mariana Islands","MP","\u{1F1F2}\u{1F1F5}"],["Norway","NO","\u{1F1F3}\u{1F1F4}"],["Oman","OM","\u{1F1F4}\u{1F1F2}"],["Pakistan","PK","\u{1F1F5}\u{1F1F0}"],["Palau","PW","\u{1F1F5}\u{1F1FC}"],["Palestinian Territories","PS","\u{1F1F5}\u{1F1F8}"],["Panama","PA","\u{1F1F5}\u{1F1E6}"],["Papua New Guinea","PG","\u{1F1F5}\u{1F1EC}"],["Paraguay","PY","\u{1F1F5}\u{1F1FE}"],["Peru","PE","\u{1F1F5}\u{1F1EA}"],["Philippines","PH","\u{1F1F5}\u{1F1ED}"],["Poland","PL","\u{1F1F5}\u{1F1F1}"],["Portugal","PT","\u{1F1F5}\u{1F1F9}"],["Puerto Rico","PR","\u{1F1F5}\u{1F1F7}"],["Qatar","QA","\u{1F1F6}\u{1F1E6}"],["Romania","RO","\u{1F1F7}\u{1F1F4}"],["Russia","RU","\u{1F1F7}\u{1F1FA}"],["Rwanda","RW","\u{1F1F7}\u{1F1FC}"],["R\xE9union","RE","\u{1F1F7}\u{1F1EA}"],["Samoa","WS","\u{1F1FC}\u{1F1F8}"],["San Marino","SM","\u{1F1F8}\u{1F1F2}"],["Saudi Arabia","SA","\u{1F1F8}\u{1F1E6}"],["Senegal","SN","\u{1F1F8}\u{1F1F3}"],["Serbia","RS","\u{1F1F7}\u{1F1F8}"],["Seychelles","SC","\u{1F1F8}\u{1F1E8}"],["Sierra Leone","SL","\u{1F1F8}\u{1F1F1}"],["Singapore","SG","\u{1F1F8}\u{1F1EC}"],["Sint Maarten","SX","\u{1F1F8}\u{1F1FD}"],["Slovakia","SK","\u{1F1F8}\u{1F1F0}"],["Slovenia","SI","\u{1F1F8}\u{1F1EE}"],["Solomon Islands","SB","\u{1F1F8}\u{1F1E7}"],["Somalia","SO","\u{1F1F8}\u{1F1F4}"],["South Africa","ZA","\u{1F1FF}\u{1F1E6}"],["South Korea","KR","\u{1F1F0}\u{1F1F7}"],["South Sudan","SS","\u{1F1F8}\u{1F1F8}"],["Spain","ES","\u{1F1EA}\u{1F1F8}"],["Sri Lanka","LK","\u{1F1F1}\u{1F1F0}"],["St. Barth\xE9lemy","BL","\u{1F1E7}\u{1F1F1}"],["St. Helena","SH","\u{1F1F8}\u{1F1ED}"],["St. Kitts & Nevis","KN","\u{1F1F0}\u{1F1F3}"],["St. Lucia","LC","\u{1F1F1}\u{1F1E8}"],["St. Martin","MF","\u{1F1F2}\u{1F1EB}"],["St. Pierre & Miquelon","PM","\u{1F1F5}\u{1F1F2}"],["St. Vincent & Grenadines","VC","\u{1F1FB}\u{1F1E8}"],["Sudan","SD","\u{1F1F8}\u{1F1E9}"],["Suriname","SR","\u{1F1F8}\u{1F1F7}"],["Svalbard & Jan Mayen","SJ","\u{1F1F8}\u{1F1EF}"],["Sweden","SE","\u{1F1F8}\u{1F1EA}"],["Switzerland","CH","\u{1F1E8}\u{1F1ED}"],["Syria","SY","\u{1F1F8}\u{1F1FE}"],["S\xE3o Tom\xE9 & Pr\xEDncipe","ST","\u{1F1F8}\u{1F1F9}"],["Taiwan","TW","\u{1F1F9}\u{1F1FC}"],["Tajikistan","TJ","\u{1F1F9}\u{1F1EF}"],["Tanzania","TZ","\u{1F1F9}\u{1F1FF}"],["Thailand","TH","\u{1F1F9}\u{1F1ED}"],["Timor-Leste","TL","\u{1F1F9}\u{1F1F1}"],["Togo","TG","\u{1F1F9}\u{1F1EC}"],["Tokelau","TK","\u{1F1F9}\u{1F1F0}"],["Tonga","TO","\u{1F1F9}\u{1F1F4}"],["Trinidad & Tobago","TT","\u{1F1F9}\u{1F1F9}"],["Tristan da Cunha","TA","\u{1F1F9}\u{1F1E6}"],["Tunisia","TN","\u{1F1F9}\u{1F1F3}"],["Turkey","TR","\u{1F1F9}\u{1F1F7}"],["Turkmenistan","TM","\u{1F1F9}\u{1F1F2}"],["Turks & Caicos Islands","TC","\u{1F1F9}\u{1F1E8}"],["Tuvalu","TV","\u{1F1F9}\u{1F1FB}"],["U.S. Virgin Islands","VI","\u{1F1FB}\u{1F1EE}"],["Uganda","UG","\u{1F1FA}\u{1F1EC}"],["Ukraine","UA","\u{1F1FA}\u{1F1E6}"],["United Arab Emirates","AE","\u{1F1E6}\u{1F1EA}"],["United Kingdom","GB","\u{1F1EC}\u{1F1E7}"],["United States","US","\u{1F1FA}\u{1F1F8}"],["Uruguay","UY","\u{1F1FA}\u{1F1FE}"],["Uzbekistan","UZ","\u{1F1FA}\u{1F1FF}"],["Vanuatu","VU","\u{1F1FB}\u{1F1FA}"],["Vatican City","VA","\u{1F1FB}\u{1F1E6}"],["Venezuela","VE","\u{1F1FB}\u{1F1EA}"],["Vietnam","VN","\u{1F1FB}\u{1F1F3}"],["Wallis & Futuna","WF","\u{1F1FC}\u{1F1EB}"],["Western Sahara","EH","\u{1F1EA}\u{1F1ED}"],["Yemen","YE","\u{1F1FE}\u{1F1EA}"],["Zambia","ZM","\u{1F1FF}\u{1F1F2}"],["Zimbabwe","ZW","\u{1F1FF}\u{1F1FC}"],["\xC5land Islands","AX","\u{1F1E6}\u{1F1FD}"]];var Ko=Tr,Wr=Ko.map(([e,r,t])=>({name:e,code:r,callCode:Ro(r),flag:t}));import z from"react";import{View as qo,Text as _r,Pressable as Jo,StyleSheet as Yo}from"react-native";import*as Ue from"react";import zo,{Path as Zo}from"react-native-svg";var jo=e=>Ue.createElement(zo,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),Ue.createElement(Zo,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})),Ar=jo;var Ir=({country:e,onPress:r,selected:t})=>z.createElement(Jo,{onPress:r},z.createElement(qo,{style:Oe.row},z.createElement(_r,{style:Oe.rowFlag},e.flag),z.createElement(_r,{style:Oe.rowLabel},e.name," (+",e.callCode,")"),t&&z.createElement(Ar,{color:m.interactive}))),Oe=Yo.create({row:{flexDirection:"row",alignItems:"center",gap:10,height:56},rowFlag:{fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22},rowLabel:{flex:1,fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22,color:m.black}});import*as Be from"react";import Qo,{Path as $o}from"react-native-svg";var Xo=e=>Be.createElement(Qo,k({xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),Be.createElement($o,{fill:e.color,fillRule:"evenodd",d:"M7.01 12.01a5.5 5.5 0 1 1 4.304-2.075.7.7 0 0 1 .156.115l3.818 3.819a.65.65 0 0 1-.92.92l-3.818-3.82a.7.7 0 0 1-.115-.155A5.48 5.48 0 0 1 7.01 12.01m4.5-5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0",clipRule:"evenodd"})),Ur=Xo;var ln=600,Br=({countryCode:e,onChangeCountryCode:r,onComplete:t})=>{let[o,a]=rn(""),s=Fr(o,ln),n=en(()=>Wr.filter(i=>i.name.toLowerCase().includes(s.toLowerCase())),[s]);return T.createElement(nn,{behavior:an.OS==="ios"?"padding":void 0,style:Or.innerContainer},T.createElement(tn,{style:Or.header},T.createElement(x,{title:"Select country code"}),T.createElement(V,{LeftIcon:T.createElement(Ur,{color:m.placeholder}),value:o,onChangeText:a,placeholder:"Search country"})),T.createElement(sn,{style:{flex:1},data:n,keyExtractor:i=>`country-option-${i.code}`,renderItem:({item:i})=>T.createElement(Ir,{country:i,selected:i.code===e,onPress:()=>{r(i.code),t()}})}),T.createElement(b,{title:"Continue",onPress:t}))},Or=on.create({innerContainer:{flex:1,paddingHorizontal:16},header:{gap:20}});import ae from"react";import{View as dn,Text as gn,Pressable as hn,StyleSheet as fn}from"react-native";import{getCountryCallingCode as pn}from"@privy-io/js-sdk-core";import*as Ve from"react";import cn,{Path as un}from"react-native-svg";var mn=e=>Ve.createElement(cn,k({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),Ve.createElement(un,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m4 6 4 4 4-4"})),Vr=mn;var Gr=({countryCode:e,onPress:r})=>ae.createElement(hn,{onPress:r},ae.createElement(dn,{style:Hr.cell},ae.createElement(gn,{style:Hr.text},e," +",pn(e)),ae.createElement(Vr,{color:m.icon}))),Hr=fn.create({cell:{flexDirection:"row",alignItems:"center",gap:6},text:{fontFamily:"Inter_400Regular",fontSize:18,lineHeight:30,color:m.text}});var Nr=({sendCode:e,isLoading:r,error:t,initialPhone:o,FooterComponent:a})=>{let[s,n]=He(o!=null?o:""),[i,d]=He("US"),[h,u]=He(!1),g=kn(i),l=wn(i),c=y=>{try{let C=y.replace(/\D/g,""),p=s.replace(/\D/g,""),E=C===p?y:g.input(y);n(E)}catch(C){console.error("Error processing phone number:",C),n("")}};return h?v.createElement(Br,{countryCode:i,onChangeCountryCode:d,onComplete:()=>u(!1)}):v.createElement(Sn,{behavior:Cn.OS==="ios"?"padding":void 0,style:le.innerContainer},v.createElement(se,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},v.createElement(se,{style:le.content},v.createElement(se,{style:le.content},v.createElement(se,{style:le.formContainer},v.createElement(x,{title:"Enter your phone"}),v.createElement(V,{LeftIcon:v.createElement(Gr,{countryCode:i,onPress:()=>u(!0)}),value:s,onChangeText:c,error:!!t,status:t?vn(t):" ",placeholder:l,autoComplete:"tel",keyboardType:"phone-pad",autoFocus:!0})),a),v.createElement(B,null)),v.createElement(b,{title:"Continue",loading:r,onPress:()=>e(s)})))},vn=bn({invalid_data:"Phone is incorrect.",not_supported:"Region or carrier not yet supported.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),le=yn.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var En=600,Kr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=xn(f),a=J(),[s,n]=Rr(""),{state:i,loginWithCode:d,sendCode:h}=ar(),[u,g]=Rr("phone"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=Ln(()=>{var p;switch(i.status){case"initial":return{step:{type:"phone"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),Dr(()=>{if(!C)return;let p=setTimeout(()=>{a()},En);return()=>clearTimeout(p)},[C,a]),Dr(()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o,a]),l.type){case"phone":return Ge.createElement(Nr,{initialPhone:s,sendCode:p=>{n(p),h({phone:p})},isLoading:y,error:c,FooterComponent:Ge.createElement(ie,{onLoginMethodChange:r,otherLoginMethod:t})});case"code":return Ge.createElement(re,{loginWithCode:p=>d({code:p,phone:s}),requestNewCode:()=>h({phone:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C})}};import W from"react";import{StyleSheet as Pn,View as ce}from"react-native";var Mn=()=>W.createElement(ce,{style:{height:72,width:220,borderRadius:8,backgroundColor:m.border}}),zr=({loginMethods:e,onLoginMethodChange:r})=>W.createElement(ce,{style:Ne.container},W.createElement(ce,{style:Ne.formContainer},W.createElement(Mn,null),W.createElement(x,{title:"Login or sign up"}),W.createElement(ce,{style:Ne.listContainer},e.map((t,o)=>W.createElement(b,{key:`method-option-${t}`,variant:o===0?"primary":"secondary",onPress:()=>r(t),title:Fn[t]})))),W.createElement(B,null)),Fn={email:"Continue with email",sms:"Continue with phone"},Ne=Pn.create({container:{flex:1,justifyContent:"space-between",paddingHorizontal:16},formContainer:{alignItems:"center",gap:32},listContainer:{gap:16,alignSelf:"stretch"}});import Z from"react";import{Pressable as _n,StyleSheet as In,View as jr}from"react-native";import*as De from"react";import Tn,{Path as Wn}from"react-native-svg";var An=e=>De.createElement(Tn,k({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),De.createElement(Wn,{fill:e.color,d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),Zr=An;var qr=({goBack:e})=>Z.createElement(jr,{style:Jr.navigationBar},Z.createElement(Un,{onPress:e})),Un=e=>Z.createElement(_n,k({},e),Z.createElement(jr,{style:Jr.backButton},Z.createElement(Zr,{color:m.icon}))),Jr=In.create({navigationBar:{height:48},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});import Yr from"react";import{Modal as On,View as Bn,StyleSheet as Qr}from"react-native";import{useSafeAreaInsets as Vn}from"react-native-safe-area-context";var Hn=()=>{let e=Vn();return{paddingTop:e.top,paddingBottom:e.bottom,paddingLeft:e.left,paddingRight:e.right}},$r=({children:e,visible:r})=>{let t=Hn();return Yr.createElement(On,{animationType:"slide",transparent:!0,visible:r},Yr.createElement(Bn,{style:[Qr.absoluteFill,Gn.modalContent,t]},e))},Gn=Qr.create({modalContent:{backgroundColor:m.white}});var Dn=({config:e,goBackRef:r})=>{let[t,o]=Qe(),a=t&&Ze(e.loginMethods,t);switch(t){case"email":return H.createElement(Mr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case"sms":return H.createElement(Kr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case null:return H.createElement(zr,{loginMethods:e.loginMethods,onLoginMethodChange:o,goBackRef:r});default:throw new de("unsupported_login_method",`Unsupported login method: ${t}`)}},Rn=()=>{let e=Ye(),r=qe(),t=Xe();$e();let o=Nn(null);return H.createElement($r,{visible:t},H.createElement(qr,{goBack:()=>{var a;return((a=o.current)!=null?a:e)()}}),r&&H.createElement(Dn,{config:r,goBackRef:o}))};import{useCallback as Xr,useContext as Kn,useEffect as zn,useRef as Zn}from"react";var jn=()=>{let e=Je(),{setOtpState:r,user:t}=Kn(f),o=Xr(()=>r({status:"initial"}),[]),a=Zn(t);return zn(()=>{a.current=t}),{login:Xr(n=>S(void 0,null,function*(){return{user:yield e(n,a.current,o)}}),[e,o])}};import{digest as qn}from"expo-crypto";import Jn from"@privy-io/js-sdk-core";var Yn=({appId:e,clientId:r,storage:t=me,supportedChains:o,baseUrl:a,logLevel:s})=>new Jn({appId:e,clientId:r,supportedChains:o,storage:ze(t),sdkVersion:`expo:${Re.version}`,nativeAppIdentifier:Ke(),crypto:{digest:qn},baseUrl:a,logLevel:s});export{f as PrivyContext,Rn as PrivyElements,$n as PrivyProvider,de as PrivyUIError,me as SecureStorageAdapter,Yn as createPrivyClient,Qn as getAccessToken,ii as hasError,Xn as isConnected,ri as isConnecting,ni as isCreating,ti as isDisconnected,oi as isNotCreated,ei as isReconnecting,ai as needsRecovery,za as useCreateGuestAccount,At as useEmbeddedSolanaWallet,xe as useEmbeddedWallet,Ua as useEmbeddedWalletStateChange,Ha as useIdentityToken,Ai as useLinkEmail,zi as useLinkSMS,na as useLinkWithFarcaster,rt as useLinkWithOAuth,mi as useLinkWithSiwe,jn as useLogin,or as useLoginWithEmail,ya as useLoginWithFarcaster,et as useLoginWithOAuth,ar as useLoginWithSMS,Si as useLoginWithSiwe,tt as useOAuthFlow,Ma as useOAuthTokens,Ot as usePrivy,It as usePrivyClient,ua as useUnlinkFarcaster,va as useUnlinkOAuth,Li as useUnlinkWallet};
|
package/dist/esm/passkey.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{B as M,C as I,D as T,E as U,F as V,G as D,H as Y,I as j,a as m,b as k,d as c,f as g,y as f}from"./chunk-K6EKFGTE.js";import{useCallback as E,useContext as W}from"react";import{PrivyClientError as q}from"@privy-io/js-sdk-core";import{PrivyClientError as J}from"@privy-io/js-sdk-core";var w=e=>c(void 0,null,function*(){var a;let r=yield(yield import("react-native-passkeys")).create({rp:e.rp,user:e.user,challenge:e.challenge,pubKeyCredParams:e.pubKeyCredParams,excludeCredentials:e.excludeCredentials,authenticatorSelection:e.authenticatorSelection,timeout:12e4});if(!r)throw new J({code:"failed_to_create_passkey",error:"Could not create passkey"});return k(m({},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});import{PrivyClientError as v}from"@privy-io/js-sdk-core";var C=e=>c(void 0,null,function*(){var a;let r=yield(yield import("react-native-passkeys")).get({rpId:e.rpId,challenge:e.challenge,allowCredentials:e.allowCredentials,timeout:12e4});if(!r)throw new v({code:"no_passkey_found_for_challenge",error:"Could not find a matching passkey to login with"});return k(m({},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});var oe=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=W(f),d=E(o=>{var n;let u=g(o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{linkWithPasskey:E(u=>c(void 0,[u],function*({relyingParty:o}){var n,p,h,P,s,_,y,x,b;try{if(!l)throw new q({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});i({status:"generating-challenege"});let{options:t}=yield r.auth.passkey.generateRegistrationOptions(o);i({status:"awaiting-passkey"});let N=yield w({rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params,extensions:{hmacCreateSecret:(n=t.extensions)==null?void 0:n.hmac_create_secret,credProps:(h=(p=t.extensions)==null?void 0:p.cred_props)==null?void 0:h.rk,appid:(P=t.extensions)==null?void 0:P.app_id},attestation:t.attestation,excludeCredentials:t.exclude_credentials,authenticatorSelection:{authenticatorAttachment:(s=t.authenticator_selection)==null?void 0:s.authenticator_attachment,residentKey:(_=t.authenticator_selection)==null?void 0:_.resident_key,userVerification:(y=t.authenticator_selection)==null?void 0:y.user_verification,requireResidentKey:(x=t.authenticator_selection)==null?void 0:x.require_resident_key}});i({status:"submitting-response"});let O=yield r.auth.passkey.linkWithPasskey(N,o);return i({status:"done"}),(b=e==null?void 0:e.onSuccess)==null||b.call(e,O),O}catch(t){throw d(t)}}),[l,r,d,e==null?void 0:e.onSuccess]),state:a}};import{useCallback as K,useContext as H}from"react";import{PrivyClientError as L}from"@privy-io/js-sdk-core";var de=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=H(f),d=K(o=>{var n;let u=g(o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{loginWithPasskey:K(u=>c(void 0,[u],function*({relyingParty:o}){var n,p,h,P;try{if(l)throw new L({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});i({status:"generating-challenege"});let{options:s}=yield r.auth.passkey.generateAuthenticationOptions(o);i({status:"awaiting-passkey"});let _=yield C({challenge:s.challenge,rpId:s.rp_id,extensions:{appid:(n=s.extensions)==null?void 0:n.app_id,credProps:(p=s.extensions)==null?void 0:p.cred_props,hmacCreateSecret:(h=s.extensions)==null?void 0:h.hmac_create_secret},timeout:s.timeout,allowCredentials:s.allow_credentials,userVerification:s.user_verification});i({status:"submitting-response"});let y=yield r.auth.passkey.loginWithPasskey(k(m({},_),{clientExtensionResults:{}}),s.challenge,o);return i({status:"done"}),(P=e==null?void 0:e.onSuccess)==null||P.call(e,y.user,y.is_new_user),y.user}catch(s){throw d(s)}}),[r,d,e==null?void 0:e.onSuccess]),state:a}};export{Y as hasError,M as isConnected,T as isConnecting,D as isCreating,U as isDisconnected,V as isNotCreated,I as isReconnecting,j as needsRecovery,oe as useLinkWithPasskey,de as useLoginWithPasskey};
|
package/dist/index.d.ts
CHANGED
|
@@ -666,7 +666,7 @@ interface UseLoginInterface {
|
|
|
666
666
|
*/
|
|
667
667
|
declare const useLogin: () => UseLoginInterface;
|
|
668
668
|
|
|
669
|
-
type ClientUIErrorCode = 'user_already_logged_in' | 'no_login_methods_available' | '
|
|
669
|
+
type ClientUIErrorCode = 'user_already_logged_in' | 'no_login_methods_available' | 'login_flow_timeout' | 'login_flow_closed' | 'existing_login_flow_in_progress' | 'privy_elements_not_ready' | 'unsupported_login_method';
|
|
670
670
|
declare class PrivyUIError extends Error {
|
|
671
671
|
error: string;
|
|
672
672
|
code: ClientUIErrorCode;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkFL4SBVACjs = require('./chunk-FL4SBVAC.js');var _jssdkcore = require('@privy-io/js-sdk-core'); var _jssdkcore2 = _interopRequireDefault(_jssdkcore); _createStarExport(_jssdkcore);var _react = require('react'); var Te = _interopRequireWildcard(_react); var We = _interopRequireWildcard(_react); var _e = _interopRequireWildcard(_react); var Ue = _interopRequireWildcard(_react); var Oe = _interopRequireWildcard(_react); var He = _interopRequireWildcard(_react);var ni=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),s=_react.useCallback.call(void 0, d=>{var u;let f=_chunkFL4SBVACjs.f.call(void 0, d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=_react.useCallback.call(void 0, g=>_chunkFL4SBVACjs.d.call(void 0, void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]),i=_react.useCallback.call(void 0, u=>_chunkFL4SBVACjs.d.call(void 0, void 0,[u],function*({signature:d,messageOverride:f}){var g;try{if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_siwe_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiwe` to login with a wallet"});o({status:"submitting-signature"});let l=yield t.auth.siwe.linkWithSiwe(d,void 0,f);return o({status:"done"}),(g=e==null?void 0:e.onSuccess)==null||g.call(e,l),l}catch(l){throw s(l)}}),[r,t,s,e==null?void 0:e.onSuccess]);return{generateSiweMessage:n,linkWithSiwe:i,state:a}};var mi=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),s=_react.useCallback.call(void 0, d=>{var u;let f=_chunkFL4SBVACjs.f.call(void 0, d);return o({status:"error",error:f}),(u=e==null?void 0:e.onError)==null||u.call(e,f),f},[e==null?void 0:e.onError]),n=_react.useCallback.call(void 0, g=>_chunkFL4SBVACjs.d.call(void 0, void 0,[g],function*({wallet:d,from:{domain:f,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,f,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]);return{loginWithSiwe:_react.useCallback.call(void 0, g=>_chunkFL4SBVACjs.d.call(void 0, void 0,[g],function*({signature:d,messageOverride:f,disableSignup:u}){var l;try{if(r)throw new (0, _jssdkcore.PrivyClientError)({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"});o({status:"submitting-signature"});let c=yield t.auth.siwe.loginWithSiwe(d,void 0,f,u?"no-signup":"login-or-sign-up");return o({status:"done"}),(l=e==null?void 0:e.onSuccess)==null||l.call(e,c.user,c.is_new_user),c.user}catch(c){throw s(c)}}),[r,t,s,e==null?void 0:e.onSuccess]),generateSiweMessage:n,state:a}};var Si=e=>{let{user:r,client:t}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),o=_react.useCallback.call(void 0, s=>{var i;let n=_chunkFL4SBVACjs.f.call(void 0, s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{unlinkWallet:_react.useCallback.call(void 0, n=>_chunkFL4SBVACjs.d.call(void 0, void 0,[n],function*({address:s}){var i;try{if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_unlink_siwe_before_logged_in",error:"Must be logged in to unlink a wallet, Use `useLoginWithSiwe` to login with a wallet"});let d=yield t.auth.siwe.unlinkWallet(s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw o(d)}}),[r,t,o,e==null?void 0:e.onSuccess])}};var Ei=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkFL4SBVACjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkFL4SBVACjs.d.call(void 0, void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, l=>_chunkFL4SBVACjs.d.call(void 0, void 0,[l],function*({code:u,email:g}){var c;try{if(!o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_email_before_logged_in",error:"Must be logged in to link an email, Use `useLoginWithEmail` to login with email"});let y=g||r;if(!y)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.email.linkWithCode(y,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};var Xe=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkFL4SBVACjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkFL4SBVACjs.d.call(void 0, void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, c=>_chunkFL4SBVACjs.d.call(void 0, void 0,[c],function*({code:u,email:g,disableSignup:l}){var y;try{if(o)throw new (0, _jssdkcore.PrivyClientError)({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 C=g||r;if(!C)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.email.loginWithCode(C,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};var Vi=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkFL4SBVACjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkFL4SBVACjs.d.call(void 0, void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, l=>_chunkFL4SBVACjs.d.call(void 0, void 0,[l],function*({code:u,phone:g}){var c;try{if(!o)throw new (0, _jssdkcore.PrivyClientError)({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(!(g||r))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.phone.linkWithCode(g||r,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:f,state:s}};var tr=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkFL4SBVACjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkFL4SBVACjs.d.call(void 0, void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),f=_react.useCallback.call(void 0, c=>_chunkFL4SBVACjs.d.call(void 0, void 0,[c],function*({code:u,phone:g,disableSignup:l}){var y;try{if(o)throw new (0, _jssdkcore.PrivyClientError)({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(!(g||r))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.phone.loginWithCode(g||r,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:f,state:s}};var _expolinking = require('expo-linking'); var q = _interopRequireWildcard(_expolinking); var J = _interopRequireWildcard(_expolinking);var Qi=e=>{let{appState:r,getCurrentAppState:t}=_chunkFL4SBVACjs.h.call(void 0, ),{client:o,user:a,farcasterState:s,setFarcasterState:n}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),i=_react.useRef.call(void 0, !1),d=_react.useCallback.call(void 0, g=>{var c;let l=_chunkFL4SBVACjs.f.call(void 0, g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=_react.useCallback.call(void 0, ()=>{i.current=!0},[]);return{linkWithFarcaster:_react.useCallback.call(void 0, (y,...C)=>_chunkFL4SBVACjs.d.call(void 0, void 0,[y,...C],function*({relyingParty:g,redirectUrl:l},c={pollAttempts:10,pollIntervalMs:1e3}){var p;try{if(i.current=!1,!a)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_farcaster_before_logged_in",error:"Must be logged in to link a Farcaster account."});n({status:"generating-uri"});let{connect_uri:E,channel_token:L}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:q.createURL(l!=null?l:"/")});if(!E)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!L)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield q.openURL(E),n({status:"polling-status"});let _=0;for(;_<c.pollAttempts;){if(i.current)throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield _chunkFL4SBVACjs.g.call(void 0, c.pollIntervalMs);continue}let V=yield o.auth.farcaster.getFarcasterStatus({channel_token:L});if(V.state==="completed"){n({status:"submitting-token"});let H=yield o.auth.farcaster.link(_chunkFL4SBVACjs.a.call(void 0, {channel_token:L},V));return n({status:"done"}),(p=e==null?void 0:e.onSuccess)==null||p.call(e,H),H}_++,yield _chunkFL4SBVACjs.g.call(void 0, c.pollIntervalMs)}throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(E){throw d(E)}}),[o,e==null?void 0:e.onSuccess,d,n,a]),state:s,cancel:f}};var oa=e=>{let{client:r}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),t=_react.useCallback.call(void 0, a=>{var n;let s=_chunkFL4SBVACjs.f.call(void 0, a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkFarcaster:_react.useCallback.call(void 0, s=>_chunkFL4SBVACjs.d.call(void 0, void 0,[s],function*({fid:a}){var n;try{let i=yield r.auth.farcaster.unlink({fid:a});return(n=e==null?void 0:e.onSuccess)==null||n.call(e,i),i}catch(i){throw t(i)}}),[r,e==null?void 0:e.onSuccess,t])}};var ua=e=>{let{appState:r,getCurrentAppState:t}=_chunkFL4SBVACjs.h.call(void 0, ),{client:o,user:a,farcasterState:s,setFarcasterState:n}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),i=_react.useRef.call(void 0, !1),d=_react.useCallback.call(void 0, g=>{var c;let l=_chunkFL4SBVACjs.f.call(void 0, g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),f=_react.useCallback.call(void 0, ()=>{i.current=!0},[]);return{loginWithFarcaster:_react.useCallback.call(void 0, (C,...p)=>_chunkFL4SBVACjs.d.call(void 0, void 0,[C,...p],function*({relyingParty:g,redirectUrl:l,disableSignup:c},y={pollAttempts:10,pollIntervalMs:1e3}){var E;try{if(i.current=!1,a)throw new (0, _jssdkcore.PrivyClientError)({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"});n({status:"generating-uri"});let{connect_uri:L,channel_token:_}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:J.createURL(l!=null?l:"/")});if(!L)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!_)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield J.openURL(L),n({status:"polling-status"});let V=0;for(;V<y.pollAttempts;){if(i.current)throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield _chunkFL4SBVACjs.g.call(void 0, y.pollIntervalMs);continue}let H=yield o.auth.farcaster.getFarcasterStatus({channel_token:_});if(H.state==="completed"){n({status:"submitting-token"});let le=yield o.auth.farcaster.authenticate(_chunkFL4SBVACjs.a.call(void 0, {channel_token:_,mode:c?"no-signup":"login-or-sign-up"},H));return n({status:"done"}),(E=e==null?void 0:e.onSuccess)==null||E.call(e,le.user,le.is_new_user),le.user}V++,yield _chunkFL4SBVACjs.g.call(void 0, y.pollIntervalMs)}throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(L){throw d(L)}}),[o,d,e==null?void 0:e.onSuccess,n,a,r]),state:s,cancel:f}};var pa=e=>{let{client:r}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),t=_react.useCallback.call(void 0, a=>{var n;let s=_chunkFL4SBVACjs.f.call(void 0, a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkOAuth:_react.useCallback.call(void 0, n=>_chunkFL4SBVACjs.d.call(void 0, void 0,[n],function*({provider:a,subject:s}){var i;try{let d=yield r.auth.oauth.unlink(a,s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw t(d)}}),[r,e==null?void 0:e.onSuccess,t])}};var ka=e=>{let{client:r}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),t=_react.useRef.call(void 0, e.onOAuthTokenGrant);t.current=e.onOAuthTokenGrant,_react.useEffect.call(void 0, ()=>{let{unsubscribe:o}=r.addOAuthTokensListener(a=>{t.current(a)});return o},[r])};var be=(e={})=>{let{wallet:r,createWalletCallbacks:t,recoverWalletCallbacks:o,setWalletRecoveryCallbacks:a}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),{onCreateWalletSuccess:s,onCreateWalletError:n,onRecoverWalletError:i,onRecoverWalletSuccess:d,onSetWalletRecoverySuccess:f,onSetWalletRecoveryError:u}=e;return _react.useEffect.call(void 0, ()=>{t.current={onSuccess:s,onError:n}},[s,n]),_react.useEffect.call(void 0, ()=>{o.current={onSuccess:d,onError:i}},[d,i]),_react.useEffect.call(void 0, ()=>{a.current={onSuccess:f,onError:u}},[d,i]),r};var Fa=({onStateChange:e})=>{let r=be();return _react.useEffect.call(void 0, ()=>{e(r)},[r])};var Aa=()=>{let{getIdentityToken:e}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x);return{getIdentityToken:e}};var Va=e=>{let{user:r,client:t}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),o=_react.useCallback.call(void 0, s=>{var i;let n=_chunkFL4SBVACjs.f.call(void 0, s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{create:_react.useCallback.call(void 0, ()=>_chunkFL4SBVACjs.d.call(void 0, void 0,null,function*(){var s;try{if(r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_create_guest_account_for_logged_in_user",error:"Already logged in, you cannot create a guest account"});let n=yield t.auth.guest.create();return(s=e==null?void 0:e.onSuccess)==null||s.call(e,n.user,n.is_new_user),n.user}catch(n){throw o(n)}}),[t,o,r,e==null?void 0:e.onSuccess])}};var Pt=(e={})=>{let{solanaWallet:r,createSolanaWalletCallbacks:t,recoverSolanaWalletCallbacks:o}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),{onCreateWalletSuccess:a,onCreateWalletError:s,onRecoverWalletError:n,onRecoverWalletSuccess:i}=e;return _react.useEffect.call(void 0, ()=>{t.current={onSuccess:a,onError:s}},[a,s]),_react.useEffect.call(void 0, ()=>{o.current={onSuccess:i,onError:n}},[i,n]),r};var Mt=()=>{let{client:e}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x);return e};var Wt=()=>{let{user:e,isReady:r,logout:t,getAccessToken:o}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x);return{user:e,isReady:r,logout:t,getAccessToken:o}};var _reactnative = require('react-native');var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);var sr=()=>{let e=_reactnative.useAnimatedValue.call(void 0, 0);_react.useEffect.call(void 0, ()=>{e.setValue(0);let t=_reactnative.Animated.loop(_reactnative.Animated.timing(e,{toValue:1,duration:1200,useNativeDriver:!0,easing:_reactnative.Easing.linear}));return t.start(),()=>t.stop()},[]);let r=e.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return Te.default.createElement(_reactnative.Animated.View,{style:{transform:[{rotate:r}]}},Te.default.createElement(_reactnativesvg2.default,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},Te.default.createElement(_reactnativesvg.Path,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:"#fff",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var m={interactive:"#5B4FFF",white:"#FFFFFF",black:"#000000",brand:"#010110",placeholder:"#9498B8",success:"#22C55E",successDark:"#15803D",inputBackground:"#F3F3F3",text:"#040217",icon:"#110F2A",border:"#E2E3F0",error:"#EF4444",errorDark:"#B91C1C",textMuted:"#64668B",textTitle:"#1A1C29"};var v=a=>{var s=a,{variant:e="primary",title:r,loading:t=!1}=s,o=_chunkFL4SBVACjs.c.call(void 0, s,["variant","title","loading"]);return Te.default.createElement(_reactnative.Pressable,_chunkFL4SBVACjs.a.call(void 0, {},o),Te.default.createElement(_reactnative.View,{style:[O.buttonBox,e==="secondary"&&O.buttonBoxSecondary,e==="tertiary"&&O.buttonBoxTertiary]},t?Te.default.createElement(sr,null):Te.default.createElement(_reactnative.Text,{style:[O.buttonLabel,e==="secondary"&&O.buttonLabelSecondary,e==="tertiary"&&O.buttonLabelTertiary]},r)))},O=_reactnative.StyleSheet.create({buttonBox:{height:54,justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,backgroundColor:m.interactive},buttonBoxSecondary:{backgroundColor:m.white,alignItems:"flex-start",borderColor:m.border,borderWidth:1,borderRadius:12},buttonBoxTertiary:{backgroundColor:m.white},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24,color:m.white},buttonLabelSecondary:{fontFamily:"Inter_400Regular",color:m.text},buttonLabelTertiary:{fontFamily:"Inter_500Medium",color:m.interactive}});var cr=({value:e,isFocused:r,isSuccess:t,isError:o})=>Te.default.createElement(_reactnative.View,{style:[D.box,r&&D.focusedBox,t&&D.successBox,o&&D.errorBox]},Te.default.createElement(_reactnative.Text,{style:D.text},e)),D=_reactnative.StyleSheet.create({box:{borderWidth:1,borderColor:m.border,borderRadius:12,height:64,width:48,justifyContent:"center",alignItems:"center"},focusedBox:{borderWidth:2,borderColor:m.interactive},successBox:{borderColor:m.success},errorBox:{borderColor:m.error},text:{fontFamily:"Inter_500Medium",fontSize:16,lineHeight:20,color:m.text}});var mr=6,Jt=[0,1,2,"-",3,4,5];function Ee({value:e="",status:r=" ",onChangeText:t=()=>{},editable:o=!0,success:a=!1,error:s=!1,autoFocus:n=!1}){let i=_react.useRef.call(void 0, null),[d,f]=_react.useState.call(void 0, !1),u=()=>{var c;(c=i==null?void 0:i.current)==null||c.focus()},g=c=>{let y=c.replace(/\D/g,"");t(y)},l=d?Math.min(e.length,mr-1):void 0;return Te.default.createElement(_reactnative.View,{style:W.container},Te.default.createElement(_reactnative.TextInput,{autoFocus:n,style:W.invisibleTextInput,value:e,onChangeText:g,maxLength:mr,ref:i,editable:o,onFocus:()=>f(!0),onBlur:()=>f(!1),keyboardType:"numeric"}),Te.default.createElement(_reactnative.Pressable,{onPress:u,disabled:!o},Te.default.createElement(_reactnative.View,{style:W.codeContainer},Jt.map((c,y)=>c==="-"?Te.default.createElement(Yt,{key:y}):Te.default.createElement(cr,{key:y,isFocused:l===c,value:e[c]||"",isSuccess:a,isError:s})))),Te.default.createElement(_reactnative.Text,{style:[W.statusText,a&&W.statusSuccess,s&&W.statusError]},r))}var Yt=()=>Te.default.createElement(_reactnative.Text,{style:W.separator},"-"),W=_reactnative.StyleSheet.create({container:{justifyContent:"center",paddingHorizontal:0,gap:6},invisibleTextInput:{position:"absolute",opacity:0},codeContainer:{flexDirection:"row",alignItems:"center",gap:10,justifyContent:"space-between"},separator:{fontFamily:"Inter_600SemiBold",fontSize:18,lineHeight:24,color:m.black},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark},statusSuccess:{color:m.successDark}});var F=({title:e,subtitle:r})=>Te.default.createElement(_reactnative.View,{style:Pe.titleContainer},Te.default.createElement(_reactnative.Text,{style:Pe.title},e),r&&Te.default.createElement(_reactnative.Text,{style:Pe.subtitle},r)),Pe=_reactnative.StyleSheet.create({titleContainer:{alignItems:"center",gap:16},title:{fontFamily:"Inter_600SemiBold",fontSize:20,lineHeight:32,color:m.textTitle},subtitle:{fontFamily:"Inter_400Regular",fontSize:16,lineHeight:24,color:m.textMuted,textAlign:"center"}});var hr=({hint:e,link:r,onPress:t,disabled:o})=>Te.default.createElement(_reactnative.View,{style:$.container},Te.default.createElement(_reactnative.Text,{style:$.hintText},e),r&&Te.default.createElement(_reactnative.Pressable,{onPress:t,disabled:o},Te.default.createElement(_reactnative.Text,{style:[$.linkText,o&&$.disabledLink]}," ",r))),$=_reactnative.StyleSheet.create({container:{display:"flex",flexDirection:"row",gap:2},hintText:{fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22,color:m.textMuted},linkText:{fontFamily:"Inter_500Medium",fontSize:14,lineHeight:22,color:m.interactive},disabledLink:{color:m.textMuted}});var lo=3e4,co=()=>{let[e,r]=_react.useState.call(void 0, !1),t=_react.useCallback.call(void 0, ()=>{r(!1),setTimeout(()=>{r(!0)},lo)},[]);return _react.useEffect.call(void 0, ()=>{t()},[]),[e,t]},X=({loginWithCode:e,requestNewCode:r,subtitle:t,isLoading:o,error:a,isDone:s})=>{let[n,i]=_react.useState.call(void 0, ""),d=l=>{i(l),l.length===6&&e(l)},[f,u]=co(),g=()=>{r(),u()};return Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:Me.innerContainer},Te.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Te.default.createElement(_reactnative.View,{style:Me.content},Te.default.createElement(_reactnative.View,{style:Me.formContainer},Te.default.createElement(F,{title:"Enter confirmation code",subtitle:t}),Te.default.createElement(Ee,{value:n,editable:!o,onChangeText:d,success:s,error:!!a,status:s?"Success.":a?uo(a):" ",autoFocus:!0}),Te.default.createElement(hr,{hint:"Didn\u2019t get an email?",link:"Resend code",onPress:g,disabled:!f}))),Te.default.createElement(v,{title:"Continue",loading:o,onPress:()=>e(n)})))},uo=_jssdkcore.createErrorFormatter.call(void 0, {invalid_credentials:"Invalid code.",invalid_data:"The code has expired.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),Me=_reactnative.StyleSheet.create({modalContent:{backgroundColor:"#ffffff"},innerContainer:{flex:1},content:{gap:16},formContainer:{rowGap:24}});var fo=e=>Te.createElement(_reactnativesvg2.default,_chunkFL4SBVACjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40"},e),Te.createElement(_reactnativesvg.Path,{fill:e.color,d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02m176.8 1.71v5.72h-.27l-.09-.14a16 16 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a9 9 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.1 8.1 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.1 6.1 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73q.12-2.34.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02m27.66 4.14.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.8 6.8 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13 13 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13 13 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.5 7.5 0 0 0-2.8.5A7.1 7.1 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6 6 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.5 5.5 0 0 1 2.3-.63 10 10 0 0 1 1.13.02M69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.7 8.7 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49Zm64.29 0V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a5 5 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.6 2.6 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49Zm160.07.19a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.5 14.5 0 0 0-8.74-2.35m57.39 0a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.5 10.5 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.8 9.8 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.4 7.4 0 0 1-1.26-2.32 14.1 14.1 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03m13.77-5.31-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a912 912 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4v-6.9h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46v-4.4h-5.6c-4.46 0-5.6 0-5.6.02Zm27.17 13.85V30.8h3.87l3.86-.01V3.09h-7.73Zm9.8-13.85-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4v-.8h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01Zm30.38 0c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88zM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.9 4.9 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a12 12 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07m14.51.05c-2.33.12-4.3.84-5.95 2.16a9.9 9.9 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18 18 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.8 9.8 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04m1.42 3.78c.88.1 1.62.34 2.28.75a6.1 6.1 0 0 1 1.99 2.15 10.3 10.3 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03M92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.6 7.6 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.4 8.4 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18 18 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.3 5.3 0 0 1 2.9-.95c.2-.01.97 0 1.17.03Zm23.44-3.74c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.4 9.4 0 0 0 3.6 1.8 12 12 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.5 5.5 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.3 5.3 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 11 11 0 0 0-4.88-.74m39.41 0a9.87 9.87 0 0 0-6 2.29 11 11 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02m75.93-3.33 8.37 23.22a49 49 0 0 1-.67 1.9 5.4 5.4 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8 8 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3h-4.82Zm59.47 27.98c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a49 49 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41 41 0 0 0-5.8-.24m0 0"})),yr=fo;var ee=()=>Te.default.createElement(_reactnative.View,{style:yo.legalFooterContainer},Te.default.createElement(yr,{color:m.brand,width:"100%",height:11})),yo=_reactnative.StyleSheet.create({legalFooterContainer:{flexDirection:"row",alignItems:"center",marginVertical:16,justifyContent:"center",gap:2}});var B=a=>{var s=a,{error:e,status:r,LeftIcon:t}=s,o=_chunkFL4SBVACjs.c.call(void 0, s,["error","status","LeftIcon"]);let[n,i]=_react.useState.call(void 0, !1);return Te.default.createElement(_reactnative.View,{style:A.container},Te.default.createElement(_reactnative.View,{style:[A.inputBox,n&&A.inputBoxFocused,e&&A.inputBoxError]},t,Te.default.createElement(_reactnative.TextInput,_chunkFL4SBVACjs.a.call(void 0, {cursorColor:m.interactive,placeholderTextColor:m.placeholder,onFocus:()=>i(!0),onBlur:()=>i(!1),autoCapitalize:"none",returnKeyType:"next",multiline:!1,numberOfLines:1,style:A.input},o))),r&&Te.default.createElement(_reactnative.Text,{style:[A.statusText,e&&A.statusError]},r))},A=_reactnative.StyleSheet.create({container:{gap:6},input:{flex:1,fontFamily:"Inter_400Regular",fontSize:18,height:30,color:m.text},inputBox:{flexDirection:"row",paddingHorizontal:16,height:64,backgroundColor:m.inputBackground,borderRadius:14,alignItems:"center",columnGap:10,borderWidth:2,borderColor:m.border},inputBoxFocused:{borderColor:m.interactive},inputBoxError:{borderColor:m.error},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark}});var xo=e=>We.createElement(_reactnativesvg2.default,_chunkFL4SBVACjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),We.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7m2-3h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"})),wr=xo;var kr=({sendCode:e,isLoading:r,error:t,initialEmail:o,FooterComponent:a})=>{let[s,n]=_react.useState.call(void 0, o!=null?o:"");return Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:oe.innerContainer},Te.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Te.default.createElement(_reactnative.View,{style:oe.content},Te.default.createElement(_reactnative.View,{style:oe.content},Te.default.createElement(_reactnative.View,{style:oe.formContainer},Te.default.createElement(F,{title:"Enter your email"}),Te.default.createElement(B,{LeftIcon:Te.default.createElement(wr,{color:m.icon}),value:s,onChangeText:n,error:!!t,status:t?To(t):" ",placeholder:"your@email.com",autoComplete:"email",keyboardType:"email-address",autoFocus:!0})),a),Te.default.createElement(ee,null)),Te.default.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},To=_jssdkcore.createErrorFormatter.call(void 0, {invalid_data:"Invalid email address.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),oe=_reactnative.StyleSheet.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var ne=({onLoginMethodChange:e,otherLoginMethod:r})=>r?Te.default.createElement(v,{variant:"tertiary",title:`Use ${_chunkFL4SBVACjs.r[r]} instead`,onPress:()=>e(r)}):null;var Io=600,xr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),a=_chunkFL4SBVACjs.u.call(void 0, ),[s,n]=_react.useState.call(void 0, ""),{state:i,loginWithCode:d,sendCode:f}=Xe(),[u,g]=_react.useState.call(void 0, "email"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_react.useMemo.call(void 0, ()=>{var p;switch(i.status){case"initial":return{step:{type:"email"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),_react.useEffect.call(void 0, ()=>{if(!C)return;let p=setTimeout(()=>{a()},Io);return()=>clearTimeout(p)},[C,a]),_react.useEffect.call(void 0, ()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o]),l.type){case"code":return Te.default.createElement(X,{loginWithCode:p=>d({code:p,email:s}),requestNewCode:()=>f({email:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C});case"email":return Te.default.createElement(kr,{initialEmail:s,sendCode:p=>{n(p),f({email:p})},isLoading:y,error:c,FooterComponent:Te.default.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})})}};function Er(e,r){let[t,o]=_react.useState.call(void 0, e);return _react.useEffect.call(void 0, ()=>{let a=setTimeout(()=>{o(e)},r);return()=>{clearTimeout(a)}},[e,r]),t}var Lr=[["Afghanistan","AF","\u{1F1E6}\u{1F1EB}"],["Albania","AL","\u{1F1E6}\u{1F1F1}"],["Algeria","DZ","\u{1F1E9}\u{1F1FF}"],["American Samoa","AS","\u{1F1E6}\u{1F1F8}"],["Andorra","AD","\u{1F1E6}\u{1F1E9}"],["Angola","AO","\u{1F1E6}\u{1F1F4}"],["Anguilla","AI","\u{1F1E6}\u{1F1EE}"],["Antigua & Barbuda","AG","\u{1F1E6}\u{1F1EC}"],["Argentina","AR","\u{1F1E6}\u{1F1F7}"],["Armenia","AM","\u{1F1E6}\u{1F1F2}"],["Aruba","AW","\u{1F1E6}\u{1F1FC}"],["Ascension Island","AC","\u{1F1E6}\u{1F1E8}"],["Australia","AU","\u{1F1E6}\u{1F1FA}"],["Austria","AT","\u{1F1E6}\u{1F1F9}"],["Azerbaijan","AZ","\u{1F1E6}\u{1F1FF}"],["Bahamas","BS","\u{1F1E7}\u{1F1F8}"],["Bahrain","BH","\u{1F1E7}\u{1F1ED}"],["Bangladesh","BD","\u{1F1E7}\u{1F1E9}"],["Barbados","BB","\u{1F1E7}\u{1F1E7}"],["Belarus","BY","\u{1F1E7}\u{1F1FE}"],["Belgium","BE","\u{1F1E7}\u{1F1EA}"],["Belize","BZ","\u{1F1E7}\u{1F1FF}"],["Benin","BJ","\u{1F1E7}\u{1F1EF}"],["Bermuda","BM","\u{1F1E7}\u{1F1F2}"],["Bhutan","BT","\u{1F1E7}\u{1F1F9}"],["Bolivia","BO","\u{1F1E7}\u{1F1F4}"],["Bosnia & Herzegovina","BA","\u{1F1E7}\u{1F1E6}"],["Botswana","BW","\u{1F1E7}\u{1F1FC}"],["Brazil","BR","\u{1F1E7}\u{1F1F7}"],["British Indian Ocean Territory","IO","\u{1F1EE}\u{1F1F4}"],["British Virgin Islands","VG","\u{1F1FB}\u{1F1EC}"],["Brunei","BN","\u{1F1E7}\u{1F1F3}"],["Bulgaria","BG","\u{1F1E7}\u{1F1EC}"],["Burkina Faso","BF","\u{1F1E7}\u{1F1EB}"],["Burundi","BI","\u{1F1E7}\u{1F1EE}"],["Cambodia","KH","\u{1F1F0}\u{1F1ED}"],["Cameroon","CM","\u{1F1E8}\u{1F1F2}"],["Canada","CA","\u{1F1E8}\u{1F1E6}"],["Cape Verde","CV","\u{1F1E8}\u{1F1FB}"],["Caribbean Netherlands","BQ","\u{1F1E7}\u{1F1F6}"],["Cayman Islands","KY","\u{1F1F0}\u{1F1FE}"],["Central African Republic","CF","\u{1F1E8}\u{1F1EB}"],["Chad","TD","\u{1F1F9}\u{1F1E9}"],["Chile","CL","\u{1F1E8}\u{1F1F1}"],["China","CN","\u{1F1E8}\u{1F1F3}"],["Christmas Island","CX","\u{1F1E8}\u{1F1FD}"],["Cocos (Keeling) Islands","CC","\u{1F1E8}\u{1F1E8}"],["Colombia","CO","\u{1F1E8}\u{1F1F4}"],["Comoros","KM","\u{1F1F0}\u{1F1F2}"],["Congo - Brazzaville","CG","\u{1F1E8}\u{1F1EC}"],["Congo - Kinshasa","CD","\u{1F1E8}\u{1F1E9}"],["Cook Islands","CK","\u{1F1E8}\u{1F1F0}"],["Costa Rica","CR","\u{1F1E8}\u{1F1F7}"],["Croatia","HR","\u{1F1ED}\u{1F1F7}"],["Cuba","CU","\u{1F1E8}\u{1F1FA}"],["Cura\xE7ao","CW","\u{1F1E8}\u{1F1FC}"],["Cyprus","CY","\u{1F1E8}\u{1F1FE}"],["Czechia","CZ","\u{1F1E8}\u{1F1FF}"],["C\xF4te d\u2019Ivoire","CI","\u{1F1E8}\u{1F1EE}"],["Denmark","DK","\u{1F1E9}\u{1F1F0}"],["Djibouti","DJ","\u{1F1E9}\u{1F1EF}"],["Dominica","DM","\u{1F1E9}\u{1F1F2}"],["Dominican Republic","DO","\u{1F1E9}\u{1F1F4}"],["Ecuador","EC","\u{1F1EA}\u{1F1E8}"],["Egypt","EG","\u{1F1EA}\u{1F1EC}"],["El Salvador","SV","\u{1F1F8}\u{1F1FB}"],["Equatorial Guinea","GQ","\u{1F1EC}\u{1F1F6}"],["Eritrea","ER","\u{1F1EA}\u{1F1F7}"],["Estonia","EE","\u{1F1EA}\u{1F1EA}"],["Eswatini","SZ","\u{1F1F8}\u{1F1FF}"],["Ethiopia","ET","\u{1F1EA}\u{1F1F9}"],["Falkland Islands","FK","\u{1F1EB}\u{1F1F0}"],["Faroe Islands","FO","\u{1F1EB}\u{1F1F4}"],["Fiji","FJ","\u{1F1EB}\u{1F1EF}"],["Finland","FI","\u{1F1EB}\u{1F1EE}"],["France","FR","\u{1F1EB}\u{1F1F7}"],["French Guiana","GF","\u{1F1EC}\u{1F1EB}"],["French Polynesia","PF","\u{1F1F5}\u{1F1EB}"],["Gabon","GA","\u{1F1EC}\u{1F1E6}"],["Gambia","GM","\u{1F1EC}\u{1F1F2}"],["Georgia","GE","\u{1F1EC}\u{1F1EA}"],["Germany","DE","\u{1F1E9}\u{1F1EA}"],["Ghana","GH","\u{1F1EC}\u{1F1ED}"],["Gibraltar","GI","\u{1F1EC}\u{1F1EE}"],["Greece","GR","\u{1F1EC}\u{1F1F7}"],["Greenland","GL","\u{1F1EC}\u{1F1F1}"],["Grenada","GD","\u{1F1EC}\u{1F1E9}"],["Guadeloupe","GP","\u{1F1EC}\u{1F1F5}"],["Guam","GU","\u{1F1EC}\u{1F1FA}"],["Guatemala","GT","\u{1F1EC}\u{1F1F9}"],["Guernsey","GG","\u{1F1EC}\u{1F1EC}"],["Guinea","GN","\u{1F1EC}\u{1F1F3}"],["Guinea-Bissau","GW","\u{1F1EC}\u{1F1FC}"],["Guyana","GY","\u{1F1EC}\u{1F1FE}"],["Haiti","HT","\u{1F1ED}\u{1F1F9}"],["Honduras","HN","\u{1F1ED}\u{1F1F3}"],["Hong Kong SAR China","HK","\u{1F1ED}\u{1F1F0}"],["Hungary","HU","\u{1F1ED}\u{1F1FA}"],["Iceland","IS","\u{1F1EE}\u{1F1F8}"],["India","IN","\u{1F1EE}\u{1F1F3}"],["Indonesia","ID","\u{1F1EE}\u{1F1E9}"],["Iran","IR","\u{1F1EE}\u{1F1F7}"],["Iraq","IQ","\u{1F1EE}\u{1F1F6}"],["Ireland","IE","\u{1F1EE}\u{1F1EA}"],["Isle of Man","IM","\u{1F1EE}\u{1F1F2}"],["Israel","IL","\u{1F1EE}\u{1F1F1}"],["Italy","IT","\u{1F1EE}\u{1F1F9}"],["Jamaica","JM","\u{1F1EF}\u{1F1F2}"],["Japan","JP","\u{1F1EF}\u{1F1F5}"],["Jersey","JE","\u{1F1EF}\u{1F1EA}"],["Jordan","JO","\u{1F1EF}\u{1F1F4}"],["Kazakhstan","KZ","\u{1F1F0}\u{1F1FF}"],["Kenya","KE","\u{1F1F0}\u{1F1EA}"],["Kiribati","KI","\u{1F1F0}\u{1F1EE}"],["Kosovo","XK","\u{1F1FD}\u{1F1F0}"],["Kuwait","KW","\u{1F1F0}\u{1F1FC}"],["Kyrgyzstan","KG","\u{1F1F0}\u{1F1EC}"],["Laos","LA","\u{1F1F1}\u{1F1E6}"],["Latvia","LV","\u{1F1F1}\u{1F1FB}"],["Lebanon","LB","\u{1F1F1}\u{1F1E7}"],["Lesotho","LS","\u{1F1F1}\u{1F1F8}"],["Liberia","LR","\u{1F1F1}\u{1F1F7}"],["Libya","LY","\u{1F1F1}\u{1F1FE}"],["Liechtenstein","LI","\u{1F1F1}\u{1F1EE}"],["Lithuania","LT","\u{1F1F1}\u{1F1F9}"],["Luxembourg","LU","\u{1F1F1}\u{1F1FA}"],["Macao SAR China","MO","\u{1F1F2}\u{1F1F4}"],["Madagascar","MG","\u{1F1F2}\u{1F1EC}"],["Malawi","MW","\u{1F1F2}\u{1F1FC}"],["Malaysia","MY","\u{1F1F2}\u{1F1FE}"],["Maldives","MV","\u{1F1F2}\u{1F1FB}"],["Mali","ML","\u{1F1F2}\u{1F1F1}"],["Malta","MT","\u{1F1F2}\u{1F1F9}"],["Marshall Islands","MH","\u{1F1F2}\u{1F1ED}"],["Martinique","MQ","\u{1F1F2}\u{1F1F6}"],["Mauritania","MR","\u{1F1F2}\u{1F1F7}"],["Mauritius","MU","\u{1F1F2}\u{1F1FA}"],["Mayotte","YT","\u{1F1FE}\u{1F1F9}"],["Mexico","MX","\u{1F1F2}\u{1F1FD}"],["Micronesia","FM","\u{1F1EB}\u{1F1F2}"],["Moldova","MD","\u{1F1F2}\u{1F1E9}"],["Monaco","MC","\u{1F1F2}\u{1F1E8}"],["Mongolia","MN","\u{1F1F2}\u{1F1F3}"],["Montenegro","ME","\u{1F1F2}\u{1F1EA}"],["Montserrat","MS","\u{1F1F2}\u{1F1F8}"],["Morocco","MA","\u{1F1F2}\u{1F1E6}"],["Mozambique","MZ","\u{1F1F2}\u{1F1FF}"],["Myanmar (Burma)","MM","\u{1F1F2}\u{1F1F2}"],["Namibia","NA","\u{1F1F3}\u{1F1E6}"],["Nauru","NR","\u{1F1F3}\u{1F1F7}"],["Nepal","NP","\u{1F1F3}\u{1F1F5}"],["Netherlands","NL","\u{1F1F3}\u{1F1F1}"],["New Caledonia","NC","\u{1F1F3}\u{1F1E8}"],["New Zealand","NZ","\u{1F1F3}\u{1F1FF}"],["Nicaragua","NI","\u{1F1F3}\u{1F1EE}"],["Niger","NE","\u{1F1F3}\u{1F1EA}"],["Nigeria","NG","\u{1F1F3}\u{1F1EC}"],["Niue","NU","\u{1F1F3}\u{1F1FA}"],["Norfolk Island","NF","\u{1F1F3}\u{1F1EB}"],["North Korea","KP","\u{1F1F0}\u{1F1F5}"],["North Macedonia","MK","\u{1F1F2}\u{1F1F0}"],["Northern Mariana Islands","MP","\u{1F1F2}\u{1F1F5}"],["Norway","NO","\u{1F1F3}\u{1F1F4}"],["Oman","OM","\u{1F1F4}\u{1F1F2}"],["Pakistan","PK","\u{1F1F5}\u{1F1F0}"],["Palau","PW","\u{1F1F5}\u{1F1FC}"],["Palestinian Territories","PS","\u{1F1F5}\u{1F1F8}"],["Panama","PA","\u{1F1F5}\u{1F1E6}"],["Papua New Guinea","PG","\u{1F1F5}\u{1F1EC}"],["Paraguay","PY","\u{1F1F5}\u{1F1FE}"],["Peru","PE","\u{1F1F5}\u{1F1EA}"],["Philippines","PH","\u{1F1F5}\u{1F1ED}"],["Poland","PL","\u{1F1F5}\u{1F1F1}"],["Portugal","PT","\u{1F1F5}\u{1F1F9}"],["Puerto Rico","PR","\u{1F1F5}\u{1F1F7}"],["Qatar","QA","\u{1F1F6}\u{1F1E6}"],["Romania","RO","\u{1F1F7}\u{1F1F4}"],["Russia","RU","\u{1F1F7}\u{1F1FA}"],["Rwanda","RW","\u{1F1F7}\u{1F1FC}"],["R\xE9union","RE","\u{1F1F7}\u{1F1EA}"],["Samoa","WS","\u{1F1FC}\u{1F1F8}"],["San Marino","SM","\u{1F1F8}\u{1F1F2}"],["Saudi Arabia","SA","\u{1F1F8}\u{1F1E6}"],["Senegal","SN","\u{1F1F8}\u{1F1F3}"],["Serbia","RS","\u{1F1F7}\u{1F1F8}"],["Seychelles","SC","\u{1F1F8}\u{1F1E8}"],["Sierra Leone","SL","\u{1F1F8}\u{1F1F1}"],["Singapore","SG","\u{1F1F8}\u{1F1EC}"],["Sint Maarten","SX","\u{1F1F8}\u{1F1FD}"],["Slovakia","SK","\u{1F1F8}\u{1F1F0}"],["Slovenia","SI","\u{1F1F8}\u{1F1EE}"],["Solomon Islands","SB","\u{1F1F8}\u{1F1E7}"],["Somalia","SO","\u{1F1F8}\u{1F1F4}"],["South Africa","ZA","\u{1F1FF}\u{1F1E6}"],["South Korea","KR","\u{1F1F0}\u{1F1F7}"],["South Sudan","SS","\u{1F1F8}\u{1F1F8}"],["Spain","ES","\u{1F1EA}\u{1F1F8}"],["Sri Lanka","LK","\u{1F1F1}\u{1F1F0}"],["St. Barth\xE9lemy","BL","\u{1F1E7}\u{1F1F1}"],["St. Helena","SH","\u{1F1F8}\u{1F1ED}"],["St. Kitts & Nevis","KN","\u{1F1F0}\u{1F1F3}"],["St. Lucia","LC","\u{1F1F1}\u{1F1E8}"],["St. Martin","MF","\u{1F1F2}\u{1F1EB}"],["St. Pierre & Miquelon","PM","\u{1F1F5}\u{1F1F2}"],["St. Vincent & Grenadines","VC","\u{1F1FB}\u{1F1E8}"],["Sudan","SD","\u{1F1F8}\u{1F1E9}"],["Suriname","SR","\u{1F1F8}\u{1F1F7}"],["Svalbard & Jan Mayen","SJ","\u{1F1F8}\u{1F1EF}"],["Sweden","SE","\u{1F1F8}\u{1F1EA}"],["Switzerland","CH","\u{1F1E8}\u{1F1ED}"],["Syria","SY","\u{1F1F8}\u{1F1FE}"],["S\xE3o Tom\xE9 & Pr\xEDncipe","ST","\u{1F1F8}\u{1F1F9}"],["Taiwan","TW","\u{1F1F9}\u{1F1FC}"],["Tajikistan","TJ","\u{1F1F9}\u{1F1EF}"],["Tanzania","TZ","\u{1F1F9}\u{1F1FF}"],["Thailand","TH","\u{1F1F9}\u{1F1ED}"],["Timor-Leste","TL","\u{1F1F9}\u{1F1F1}"],["Togo","TG","\u{1F1F9}\u{1F1EC}"],["Tokelau","TK","\u{1F1F9}\u{1F1F0}"],["Tonga","TO","\u{1F1F9}\u{1F1F4}"],["Trinidad & Tobago","TT","\u{1F1F9}\u{1F1F9}"],["Tristan da Cunha","TA","\u{1F1F9}\u{1F1E6}"],["Tunisia","TN","\u{1F1F9}\u{1F1F3}"],["Turkey","TR","\u{1F1F9}\u{1F1F7}"],["Turkmenistan","TM","\u{1F1F9}\u{1F1F2}"],["Turks & Caicos Islands","TC","\u{1F1F9}\u{1F1E8}"],["Tuvalu","TV","\u{1F1F9}\u{1F1FB}"],["U.S. Virgin Islands","VI","\u{1F1FB}\u{1F1EE}"],["Uganda","UG","\u{1F1FA}\u{1F1EC}"],["Ukraine","UA","\u{1F1FA}\u{1F1E6}"],["United Arab Emirates","AE","\u{1F1E6}\u{1F1EA}"],["United Kingdom","GB","\u{1F1EC}\u{1F1E7}"],["United States","US","\u{1F1FA}\u{1F1F8}"],["Uruguay","UY","\u{1F1FA}\u{1F1FE}"],["Uzbekistan","UZ","\u{1F1FA}\u{1F1FF}"],["Vanuatu","VU","\u{1F1FB}\u{1F1FA}"],["Vatican City","VA","\u{1F1FB}\u{1F1E6}"],["Venezuela","VE","\u{1F1FB}\u{1F1EA}"],["Vietnam","VN","\u{1F1FB}\u{1F1F3}"],["Wallis & Futuna","WF","\u{1F1FC}\u{1F1EB}"],["Western Sahara","EH","\u{1F1EA}\u{1F1ED}"],["Yemen","YE","\u{1F1FE}\u{1F1EA}"],["Zambia","ZM","\u{1F1FF}\u{1F1F2}"],["Zimbabwe","ZW","\u{1F1FF}\u{1F1FC}"],["\xC5land Islands","AX","\u{1F1E6}\u{1F1FD}"]];var Ho=Lr,Pr=Ho.map(([e,r,t])=>({name:e,code:r,callCode:_jssdkcore.getCountryCallingCode.call(void 0, r),flag:t}));var Do=e=>_e.createElement(_reactnativesvg2.default,_chunkFL4SBVACjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_e.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})),Fr=Do;var Tr=({country:e,onPress:r,selected:t})=>Te.default.createElement(_reactnative.Pressable,{onPress:r},Te.default.createElement(_reactnative.View,{style:Ie.row},Te.default.createElement(_reactnative.Text,{style:Ie.rowFlag},e.flag),Te.default.createElement(_reactnative.Text,{style:Ie.rowLabel},e.name," (+",e.callCode,")"),t&&Te.default.createElement(Fr,{color:m.interactive}))),Ie=_reactnative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,height:56},rowFlag:{fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22},rowLabel:{flex:1,fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22,color:m.black}});var qo=e=>Ue.createElement(_reactnativesvg2.default,_chunkFL4SBVACjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),Ue.createElement(_reactnativesvg.Path,{fill:e.color,fillRule:"evenodd",d:"M7.01 12.01a5.5 5.5 0 1 1 4.304-2.075.7.7 0 0 1 .156.115l3.818 3.819a.65.65 0 0 1-.92.92l-3.818-3.82a.7.7 0 0 1-.115-.155A5.48 5.48 0 0 1 7.01 12.01m4.5-5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0",clipRule:"evenodd"})),Wr=qo;var tn=600,_r=({countryCode:e,onChangeCountryCode:r,onComplete:t})=>{let[o,a]=_react.useState.call(void 0, ""),s=Er(o,tn),n=_react.useMemo.call(void 0, ()=>Pr.filter(i=>i.name.toLowerCase().includes(s.toLowerCase())),[s]);return Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:Ar.innerContainer},Te.default.createElement(_reactnative.View,{style:Ar.header},Te.default.createElement(F,{title:"Select country code"}),Te.default.createElement(B,{LeftIcon:Te.default.createElement(Wr,{color:m.placeholder}),value:o,onChangeText:a,placeholder:"Search country"})),Te.default.createElement(_reactnative.FlatList,{style:{flex:1},data:n,keyExtractor:i=>`country-option-${i.code}`,renderItem:({item:i})=>Te.default.createElement(Tr,{country:i,selected:i.code===e,onPress:()=>{r(i.code),t()}})}),Te.default.createElement(v,{title:"Continue",onPress:t}))},Ar=_reactnative.StyleSheet.create({innerContainer:{flex:1,paddingHorizontal:16},header:{gap:20}});var an=e=>Oe.createElement(_reactnativesvg2.default,_chunkFL4SBVACjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),Oe.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m4 6 4 4 4-4"})),Ir=an;var Or=({countryCode:e,onPress:r})=>Te.default.createElement(_reactnative.Pressable,{onPress:r},Te.default.createElement(_reactnative.View,{style:Ur.cell},Te.default.createElement(_reactnative.Text,{style:Ur.text},e," +",_jssdkcore.getCountryCallingCode.call(void 0, e)),Te.default.createElement(Ir,{color:m.icon}))),Ur=_reactnative.StyleSheet.create({cell:{flexDirection:"row",alignItems:"center",gap:6},text:{fontFamily:"Inter_400Regular",fontSize:18,lineHeight:30,color:m.text}});var Br=({sendCode:e,isLoading:r,error:t,initialPhone:o,FooterComponent:a})=>{let[s,n]=_react.useState.call(void 0, o!=null?o:""),[i,d]=_react.useState.call(void 0, "US"),[f,u]=_react.useState.call(void 0, !1),g=_jssdkcore.phoneNumberTypingFormatter.call(void 0, i),l=_jssdkcore.getPlaceholderPhoneNumber.call(void 0, i),c=y=>{try{let C=y.replace(/\D/g,""),p=s.replace(/\D/g,""),E=C===p?y:g.input(y);n(E)}catch(C){console.error("Error processing phone number:",C),n("")}};return f?Te.default.createElement(_r,{countryCode:i,onChangeCountryCode:d,onComplete:()=>u(!1)}):Te.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:se.innerContainer},Te.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Te.default.createElement(_reactnative.View,{style:se.content},Te.default.createElement(_reactnative.View,{style:se.content},Te.default.createElement(_reactnative.View,{style:se.formContainer},Te.default.createElement(F,{title:"Enter your phone"}),Te.default.createElement(B,{LeftIcon:Te.default.createElement(Or,{countryCode:i,onPress:()=>u(!0)}),value:s,onChangeText:c,error:!!t,status:t?Sn(t):" ",placeholder:l,autoComplete:"tel",keyboardType:"phone-pad",autoFocus:!0})),a),Te.default.createElement(ee,null)),Te.default.createElement(v,{title:"Continue",loading:r,onPress:()=>e(s)})))},Sn=_jssdkcore.createErrorFormatter.call(void 0, {invalid_data:"Phone is incorrect.",not_supported:"Region or carrier not yet supported.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),se=_reactnative.StyleSheet.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var kn=600,Gr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),a=_chunkFL4SBVACjs.u.call(void 0, ),[s,n]=_react.useState.call(void 0, ""),{state:i,loginWithCode:d,sendCode:f}=tr(),[u,g]=_react.useState.call(void 0, "phone"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_react.useMemo.call(void 0, ()=>{var p;switch(i.status){case"initial":return{step:{type:"phone"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),_react.useEffect.call(void 0, ()=>{if(!C)return;let p=setTimeout(()=>{a()},kn);return()=>clearTimeout(p)},[C,a]),_react.useEffect.call(void 0, ()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o,a]),l.type){case"phone":return Te.default.createElement(Br,{initialPhone:s,sendCode:p=>{n(p),f({phone:p})},isLoading:y,error:c,FooterComponent:Te.default.createElement(ne,{onLoginMethodChange:r,otherLoginMethod:t})});case"code":return Te.default.createElement(X,{loginWithCode:p=>d({code:p,phone:s}),requestNewCode:()=>f({phone:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C})}};var xn=e=>He.createElement(_reactnativesvg2.default,_chunkFL4SBVACjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),He.createElement(_reactnativesvg.Path,{fill:e.color,d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),Nr=xn;var Rr=({goBack:e})=>Te.default.createElement(_reactnative.View,{style:Kr.navigationBar},Te.default.createElement(Pn,{onPress:e})),Pn=e=>Te.default.createElement(_reactnative.Pressable,_chunkFL4SBVACjs.a.call(void 0, {},e),Te.default.createElement(_reactnative.View,{style:Kr.backButton},Te.default.createElement(Nr,{color:m.icon}))),Kr=_reactnative.StyleSheet.create({navigationBar:{height:48},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});var _reactnativesafeareacontext = require('react-native-safe-area-context');var Wn=()=>{let e=_reactnativesafeareacontext.useSafeAreaInsets.call(void 0, );return{paddingTop:e.top,paddingBottom:e.bottom,paddingLeft:e.left,paddingRight:e.right}},jr=({children:e,visible:r})=>{let t=Wn();return Te.default.createElement(_reactnative.Modal,{animationType:"slide",transparent:!0,visible:r},Te.default.createElement(_reactnative.View,{style:[_reactnative.StyleSheet.absoluteFill,An.modalContent,t]},e))},An=_reactnative.StyleSheet.create({modalContent:{backgroundColor:m.white}});var Un=({config:e,goBackRef:r})=>{let[t,o]=_react.useState.call(void 0, ()=>_chunkFL4SBVACjs.p.call(void 0, e.loginMethods)),a=t&&_chunkFL4SBVACjs.q.call(void 0, e.loginMethods,t);switch(t){case"email":return Te.default.createElement(xr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case"sms":return Te.default.createElement(Gr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});default:throw new (0, _chunkFL4SBVACjs.o)("unsupported_login_method",`Unsupported login method: ${t}`)}},On= exports.PrivyElements =()=>{let e=_chunkFL4SBVACjs.u.call(void 0, ),r=_chunkFL4SBVACjs.s.call(void 0, ),t=_chunkFL4SBVACjs.w.call(void 0, );_chunkFL4SBVACjs.v.call(void 0, );let o=_react.useRef.call(void 0, null);return Te.default.createElement(jr,{visible:t},Te.default.createElement(Rr,{goBack:()=>{var a;return((a=o.current)!=null?a:e)()}}),r&&Te.default.createElement(Un,{config:r,goBackRef:o}))};var Gn=()=>{let e=_chunkFL4SBVACjs.t.call(void 0, ),{setOtpState:r,user:t}=_react.useContext.call(void 0, _chunkFL4SBVACjs.x),o=_react.useCallback.call(void 0, ()=>r({status:"initial"}),[]),a=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{a.current=t}),{login:_react.useCallback.call(void 0, n=>_chunkFL4SBVACjs.d.call(void 0, void 0,null,function*(){return{user:yield e(n,a.current,o)}}),[e,o])}};var _expocrypto = require('expo-crypto');var Rn=({appId:e,clientId:r,storage:t=_chunkFL4SBVACjs.n,supportedChains:o,baseUrl:a,logLevel:s})=>new (0, _jssdkcore2.default)({appId:e,clientId:r,supportedChains:o,storage:_chunkFL4SBVACjs.m.call(void 0, t),sdkVersion:`expo:${_chunkFL4SBVACjs.e.version}`,nativeAppIdentifier:_chunkFL4SBVACjs.l.call(void 0, ),crypto:{digest:_expocrypto.digest},baseUrl:a,logLevel:s});exports.PrivyContext = _chunkFL4SBVACjs.x; exports.PrivyElements = On; exports.PrivyProvider = _chunkFL4SBVACjs.z; exports.PrivyUIError = _chunkFL4SBVACjs.o; exports.SecureStorageAdapter = _chunkFL4SBVACjs.n; exports.createPrivyClient = Rn; exports.getAccessToken = _chunkFL4SBVACjs.y; exports.hasError = _chunkFL4SBVACjs.G; exports.isConnected = _chunkFL4SBVACjs.A; exports.isConnecting = _chunkFL4SBVACjs.C; exports.isCreating = _chunkFL4SBVACjs.F; exports.isDisconnected = _chunkFL4SBVACjs.D; exports.isNotCreated = _chunkFL4SBVACjs.E; exports.isReconnecting = _chunkFL4SBVACjs.B; exports.needsRecovery = _chunkFL4SBVACjs.H; exports.useCreateGuestAccount = Va; exports.useEmbeddedSolanaWallet = Pt; exports.useEmbeddedWallet = be; exports.useEmbeddedWalletStateChange = Fa; exports.useIdentityToken = Aa; exports.useLinkEmail = Ei; exports.useLinkSMS = Vi; exports.useLinkWithFarcaster = Qi; exports.useLinkWithOAuth = _chunkFL4SBVACjs.j; exports.useLinkWithSiwe = ni; exports.useLogin = Gn; exports.useLoginWithEmail = Xe; exports.useLoginWithFarcaster = ua; exports.useLoginWithOAuth = _chunkFL4SBVACjs.i; exports.useLoginWithSMS = tr; exports.useLoginWithSiwe = mi; exports.useOAuthFlow = _chunkFL4SBVACjs.k; exports.useOAuthTokens = ka; exports.usePrivy = Wt; exports.usePrivyClient = Mt; exports.useUnlinkFarcaster = oa; exports.useUnlinkOAuth = pa; exports.useUnlinkWallet = Si;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkK6EKFGTEjs = require('./chunk-K6EKFGTE.js');var _jssdkcore = require('@privy-io/js-sdk-core'); var _jssdkcore2 = _interopRequireDefault(_jssdkcore); _createStarExport(_jssdkcore);var _react = require('react'); var Ae = _interopRequireWildcard(_react); var _e = _interopRequireWildcard(_react); var Ue = _interopRequireWildcard(_react); var Be = _interopRequireWildcard(_react); var Ve = _interopRequireWildcard(_react); var De = _interopRequireWildcard(_react);var mi=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),s=_react.useCallback.call(void 0, d=>{var u;let h=_chunkK6EKFGTEjs.f.call(void 0, d);return o({status:"error",error:h}),(u=e==null?void 0:e.onError)==null||u.call(e,h),h},[e==null?void 0:e.onError]),n=_react.useCallback.call(void 0, g=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[g],function*({wallet:d,from:{domain:h,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,h,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]),i=_react.useCallback.call(void 0, u=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[u],function*({signature:d,messageOverride:h}){var g;try{if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_siwe_before_logged_in",error:"Must be logged in to link a wallet, Use `useLoginWithSiwe` to login with a wallet"});o({status:"submitting-signature"});let l=yield t.auth.siwe.linkWithSiwe(d,void 0,h);return o({status:"done"}),(g=e==null?void 0:e.onSuccess)==null||g.call(e,l),l}catch(l){throw s(l)}}),[r,t,s,e==null?void 0:e.onSuccess]);return{generateSiweMessage:n,linkWithSiwe:i,state:a}};var Si=e=>{let{user:r,client:t,setSiweState:o,siweState:a}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),s=_react.useCallback.call(void 0, d=>{var u;let h=_chunkK6EKFGTEjs.f.call(void 0, d);return o({status:"error",error:h}),(u=e==null?void 0:e.onError)==null||u.call(e,h),h},[e==null?void 0:e.onError]),n=_react.useCallback.call(void 0, g=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[g],function*({wallet:d,from:{domain:h,uri:u}}){var l;try{o({status:"generating-message"});let c=yield t.auth.siwe.init(d,h,u);return o({status:"awaiting-signature"}),(l=e==null?void 0:e.onGenerateMessage)==null||l.call(e,c.message),c.message}catch(c){throw s(c)}}),[t,s,e==null?void 0:e.onGenerateMessage]);return{loginWithSiwe:_react.useCallback.call(void 0, g=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[g],function*({signature:d,messageOverride:h,disableSignup:u}){var l;try{if(r)throw new (0, _jssdkcore.PrivyClientError)({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"});o({status:"submitting-signature"});let c=yield t.auth.siwe.loginWithSiwe(d,void 0,h,u?"no-signup":"login-or-sign-up");return o({status:"done"}),(l=e==null?void 0:e.onSuccess)==null||l.call(e,c.user,c.is_new_user),c.user}catch(c){throw s(c)}}),[r,t,s,e==null?void 0:e.onSuccess]),generateSiweMessage:n,state:a}};var Li=e=>{let{user:r,client:t}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),o=_react.useCallback.call(void 0, s=>{var i;let n=_chunkK6EKFGTEjs.f.call(void 0, s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{unlinkWallet:_react.useCallback.call(void 0, n=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[n],function*({address:s}){var i;try{if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_unlink_siwe_before_logged_in",error:"Must be logged in to unlink a wallet, Use `useLoginWithSiwe` to login with a wallet"});let d=yield t.auth.siwe.unlinkWallet(s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw o(d)}}),[r,t,o,e==null?void 0:e.onSuccess])}};var Ai=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkK6EKFGTEjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),h=_react.useCallback.call(void 0, l=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[l],function*({code:u,email:g}){var c;try{if(!o)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_email_before_logged_in",error:"Must be logged in to link an email, Use `useLoginWithEmail` to login with email"});let y=g||r;if(!y)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.email.linkWithCode(y,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:h,state:s}};var or=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkK6EKFGTEjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[g],function*({email:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.email.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{email:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),h=_react.useCallback.call(void 0, c=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[c],function*({code:u,email:g,disableSignup:l}){var y;try{if(o)throw new (0, _jssdkcore.PrivyClientError)({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 C=g||r;if(!C)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid email before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.email.loginWithCode(C,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:h,state:s}};var zi=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkK6EKFGTEjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),h=_react.useCallback.call(void 0, l=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[l],function*({code:u,phone:g}){var c;try{if(!o)throw new (0, _jssdkcore.PrivyClientError)({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(!(g||r))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `linkWithCode`"});n({status:"submitting-code"});let C=yield a.auth.phone.linkWithCode(g||r,u);return n({status:"done"}),(c=e==null?void 0:e.onLinkSuccess)==null||c.call(e,C),C}catch(y){i(y)}}),[o,a,r,i,e==null?void 0:e.onLinkSuccess]);return{sendCode:d,linkWithCode:h,state:s}};var ar=e=>{let[r,t]=_react.useState.call(void 0, ""),{user:o,client:a,otpState:s,setOtpState:n}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),i=_react.useCallback.call(void 0, u=>{var l;let g=_chunkK6EKFGTEjs.f.call(void 0, u);return n({status:"error",error:g}),(l=e==null?void 0:e.onError)==null||l.call(e,g),g},[e==null?void 0:e.onError]),d=_react.useCallback.call(void 0, g=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[g],function*({phone:u}){var l;t(u);try{n({status:"sending-code"});let c=yield a.auth.phone.sendCode(u);return n({status:"awaiting-code-input"}),(l=e==null?void 0:e.onSendCodeSuccess)==null||l.call(e,{phone:u}),c}catch(c){return i(c),{success:!1}}}),[a,i,e==null?void 0:e.onSendCodeSuccess]),h=_react.useCallback.call(void 0, c=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[c],function*({code:u,phone:g,disableSignup:l}){var y;try{if(o)throw new (0, _jssdkcore.PrivyClientError)({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(!(g||r))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_submit_otp_before_sending",error:"Must `sendCode` with a valid phone number before calling `loginWithCode`"});n({status:"submitting-code"});let p=yield a.auth.phone.loginWithCode(g||r,u,l?"no-signup":"login-or-sign-up");return n({status:"done"}),(y=e==null?void 0:e.onLoginSuccess)==null||y.call(e,p.user,p.is_new_user),p==null?void 0:p.user}catch(C){i(C)}}),[o,a,r,i,e==null?void 0:e.onLoginSuccess]);return{sendCode:d,loginWithCode:h,state:s}};var _expolinking = require('expo-linking'); var Y = _interopRequireWildcard(_expolinking); var Q = _interopRequireWildcard(_expolinking);var na=e=>{let{appState:r,getCurrentAppState:t}=_chunkK6EKFGTEjs.h.call(void 0, ),{client:o,user:a,farcasterState:s,setFarcasterState:n}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),i=_react.useRef.call(void 0, !1),d=_react.useCallback.call(void 0, g=>{var c;let l=_chunkK6EKFGTEjs.f.call(void 0, g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),h=_react.useCallback.call(void 0, ()=>{i.current=!0},[]);return{linkWithFarcaster:_react.useCallback.call(void 0, (y,...C)=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[y,...C],function*({relyingParty:g,redirectUrl:l},c={pollAttempts:10,pollIntervalMs:1e3}){var p;try{if(i.current=!1,!a)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_farcaster_before_logged_in",error:"Must be logged in to link a Farcaster account."});n({status:"generating-uri"});let{connect_uri:E,channel_token:P}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:Y.createURL(l!=null?l:"/")});if(!E)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!P)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield Y.openURL(E),n({status:"polling-status"});let I=0;for(;I<c.pollAttempts;){if(i.current)throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield _chunkK6EKFGTEjs.g.call(void 0, c.pollIntervalMs);continue}let G=yield o.auth.farcaster.getFarcasterStatus({channel_token:P});if(G.state==="completed"){n({status:"submitting-token"});let N=yield o.auth.farcaster.link(_chunkK6EKFGTEjs.a.call(void 0, {channel_token:P},G));return n({status:"done"}),(p=e==null?void 0:e.onSuccess)==null||p.call(e,N),N}I++,yield _chunkK6EKFGTEjs.g.call(void 0, c.pollIntervalMs)}throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(E){throw d(E)}}),[o,e==null?void 0:e.onSuccess,d,n,a]),state:s,cancel:h}};var ua=e=>{let{client:r}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),t=_react.useCallback.call(void 0, a=>{var n;let s=_chunkK6EKFGTEjs.f.call(void 0, a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkFarcaster:_react.useCallback.call(void 0, s=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[s],function*({fid:a}){var n;try{let i=yield r.auth.farcaster.unlink({fid:a});return(n=e==null?void 0:e.onSuccess)==null||n.call(e,i),i}catch(i){throw t(i)}}),[r,e==null?void 0:e.onSuccess,t])}};var ya=e=>{let{appState:r,getCurrentAppState:t}=_chunkK6EKFGTEjs.h.call(void 0, ),{client:o,user:a,farcasterState:s,setFarcasterState:n}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),i=_react.useRef.call(void 0, !1),d=_react.useCallback.call(void 0, g=>{var c;let l=_chunkK6EKFGTEjs.f.call(void 0, g);return n({status:"error",error:l}),(c=e==null?void 0:e.onError)==null||c.call(e,l),l},[e==null?void 0:e.onError,n]),h=_react.useCallback.call(void 0, ()=>{i.current=!0},[]);return{loginWithFarcaster:_react.useCallback.call(void 0, (C,...p)=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[C,...p],function*({relyingParty:g,redirectUrl:l,disableSignup:c},y={pollAttempts:10,pollIntervalMs:1e3}){var E;try{if(i.current=!1,a)throw new (0, _jssdkcore.PrivyClientError)({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"});n({status:"generating-uri"});let{connect_uri:P,channel_token:I}=yield o.auth.farcaster.initializeAuth({relyingParty:g,redirectUrl:Q.createURL(l!=null?l:"/")});if(!P)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_uri",error:"Failed to generate farcaster uri"});if(!I)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_generate_farcaster_channel_token",error:"Failed to generate farcaster channel token"});yield Q.openURL(P),n({status:"polling-status"});let G=0;for(;G<y.pollAttempts;){if(i.current)throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_canceled",error:"Farcaster polling canceled"});if(r.current!=="active"&&t()!=="active"){yield _chunkK6EKFGTEjs.g.call(void 0, y.pollIntervalMs);continue}let N=yield o.auth.farcaster.getFarcasterStatus({channel_token:I});if(N.state==="completed"){n({status:"submitting-token"});let ue=yield o.auth.farcaster.authenticate(_chunkK6EKFGTEjs.a.call(void 0, {channel_token:I,mode:c?"no-signup":"login-or-sign-up"},N));return n({status:"done"}),(E=e==null?void 0:e.onSuccess)==null||E.call(e,ue.user,ue.is_new_user),ue.user}G++,yield _chunkK6EKFGTEjs.g.call(void 0, y.pollIntervalMs)}throw new (0, _jssdkcore.PrivyClientError)({code:"farcaster_polling_timeout",error:"Farcasting polling timed out"})}catch(P){throw d(P)}}),[o,d,e==null?void 0:e.onSuccess,n,a,r]),state:s,cancel:h}};var va=e=>{let{client:r}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),t=_react.useCallback.call(void 0, a=>{var n;let s=_chunkK6EKFGTEjs.f.call(void 0, a);return(n=e==null?void 0:e.onError)==null||n.call(e,s),s},[e==null?void 0:e.onError]);return{unlinkOAuth:_react.useCallback.call(void 0, n=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[n],function*({provider:a,subject:s}){var i;try{let d=yield r.auth.oauth.unlink(a,s);return(i=e==null?void 0:e.onSuccess)==null||i.call(e,d),d}catch(d){throw t(d)}}),[r,e==null?void 0:e.onSuccess,t])}};var Ma=e=>{let{client:r}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),t=_react.useRef.call(void 0, e.onOAuthTokenGrant);t.current=e.onOAuthTokenGrant,_react.useEffect.call(void 0, ()=>{let{unsubscribe:o}=r.addOAuthTokensListener(a=>{t.current(a)});return o},[r])};var xe=(e={})=>{let{wallet:r,createWalletCallbacks:t,recoverWalletCallbacks:o,setWalletRecoveryCallbacks:a}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),{onCreateWalletSuccess:s,onCreateWalletError:n,onRecoverWalletError:i,onRecoverWalletSuccess:d,onSetWalletRecoverySuccess:h,onSetWalletRecoveryError:u}=e;return _react.useEffect.call(void 0, ()=>{t.current={onSuccess:s,onError:n}},[s,n]),_react.useEffect.call(void 0, ()=>{o.current={onSuccess:d,onError:i}},[d,i]),_react.useEffect.call(void 0, ()=>{a.current={onSuccess:h,onError:u}},[d,i]),r};var Ua=({onStateChange:e})=>{let r=xe();return _react.useEffect.call(void 0, ()=>{e(r)},[r])};var Ha=()=>{let{getIdentityToken:e}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y);return{getIdentityToken:e}};var za=e=>{let{user:r,client:t}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),o=_react.useCallback.call(void 0, s=>{var i;let n=_chunkK6EKFGTEjs.f.call(void 0, s);return(i=e==null?void 0:e.onError)==null||i.call(e,n),n},[e==null?void 0:e.onError]);return{create:_react.useCallback.call(void 0, ()=>_chunkK6EKFGTEjs.d.call(void 0, void 0,null,function*(){var s;try{if(r)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_create_guest_account_for_logged_in_user",error:"Already logged in, you cannot create a guest account"});let n=yield t.auth.guest.create();return(s=e==null?void 0:e.onSuccess)==null||s.call(e,n.user,n.is_new_user),n.user}catch(n){throw o(n)}}),[t,o,r,e==null?void 0:e.onSuccess])}};var At=(e={})=>{let{solanaWallet:r,createSolanaWalletCallbacks:t,recoverSolanaWalletCallbacks:o}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),{onCreateWalletSuccess:a,onCreateWalletError:s,onRecoverWalletError:n,onRecoverWalletSuccess:i}=e;return _react.useEffect.call(void 0, ()=>{t.current={onSuccess:a,onError:s}},[a,s]),_react.useEffect.call(void 0, ()=>{o.current={onSuccess:i,onError:n}},[i,n]),r};var It=()=>{let{client:e}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y);return e};var Ot=()=>{let{user:e,isReady:r,logout:t,getAccessToken:o}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y);return{user:e,isReady:r,logout:t,getAccessToken:o}};var _reactnative = require('react-native');var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);var mr=()=>{let e=_reactnative.useAnimatedValue.call(void 0, 0);_react.useEffect.call(void 0, ()=>{e.setValue(0);let t=_reactnative.Animated.loop(_reactnative.Animated.timing(e,{toValue:1,duration:1200,useNativeDriver:!0,easing:_reactnative.Easing.linear}));return t.start(),()=>t.stop()},[]);let r=e.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return Ae.default.createElement(_reactnative.Animated.View,{style:{transform:[{rotate:r}]}},Ae.default.createElement(_reactnativesvg2.default,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},Ae.default.createElement(_reactnativesvg.Path,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:"#fff",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var m={interactive:"#5B4FFF",white:"#FFFFFF",black:"#000000",brand:"#010110",placeholder:"#9498B8",success:"#22C55E",successDark:"#15803D",inputBackground:"#F3F3F3",text:"#040217",icon:"#110F2A",border:"#E2E3F0",error:"#EF4444",errorDark:"#B91C1C",textMuted:"#64668B",textTitle:"#1A1C29"};var b=a=>{var s=a,{variant:e="primary",title:r,loading:t=!1}=s,o=_chunkK6EKFGTEjs.c.call(void 0, s,["variant","title","loading"]);return Ae.default.createElement(_reactnative.Pressable,_chunkK6EKFGTEjs.a.call(void 0, {},o),Ae.default.createElement(_reactnative.View,{style:[O.buttonBox,e==="secondary"&&O.buttonBoxSecondary,e==="tertiary"&&O.buttonBoxTertiary]},t?Ae.default.createElement(mr,null):Ae.default.createElement(_reactnative.Text,{style:[O.buttonLabel,e==="secondary"&&O.buttonLabelSecondary,e==="tertiary"&&O.buttonLabelTertiary]},r)))},O=_reactnative.StyleSheet.create({buttonBox:{height:54,justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,backgroundColor:m.interactive},buttonBoxSecondary:{backgroundColor:m.white,alignItems:"flex-start",borderColor:m.border,borderWidth:1,borderRadius:12},buttonBoxTertiary:{backgroundColor:m.white},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24,color:m.white},buttonLabelSecondary:{fontFamily:"Inter_400Regular",color:m.text},buttonLabelTertiary:{fontFamily:"Inter_500Medium",color:m.interactive}});var gr=({value:e,isFocused:r,isSuccess:t,isError:o})=>Ae.default.createElement(_reactnative.View,{style:[K.box,r&&K.focusedBox,t&&K.successBox,o&&K.errorBox]},Ae.default.createElement(_reactnative.Text,{style:K.text},e)),K=_reactnative.StyleSheet.create({box:{borderWidth:1,borderColor:m.border,borderRadius:12,height:64,width:48,justifyContent:"center",alignItems:"center"},focusedBox:{borderWidth:2,borderColor:m.interactive},successBox:{borderColor:m.success},errorBox:{borderColor:m.error},text:{fontFamily:"Inter_500Medium",fontSize:16,lineHeight:20,color:m.text}});var fr=6,eo=[0,1,2,"-",3,4,5];function Pe({value:e="",status:r=" ",onChangeText:t=()=>{},editable:o=!0,success:a=!1,error:s=!1,autoFocus:n=!1}){let i=_react.useRef.call(void 0, null),[d,h]=_react.useState.call(void 0, !1),u=()=>{var c;(c=i==null?void 0:i.current)==null||c.focus()},g=c=>{let y=c.replace(/\D/g,"");t(y)},l=d?Math.min(e.length,fr-1):void 0;return Ae.default.createElement(_reactnative.View,{style:A.container},Ae.default.createElement(_reactnative.TextInput,{autoFocus:n,style:A.invisibleTextInput,value:e,onChangeText:g,maxLength:fr,ref:i,editable:o,onFocus:()=>h(!0),onBlur:()=>h(!1),keyboardType:"numeric"}),Ae.default.createElement(_reactnative.Pressable,{onPress:u,disabled:!o},Ae.default.createElement(_reactnative.View,{style:A.codeContainer},eo.map((c,y)=>c==="-"?Ae.default.createElement(ro,{key:y}):Ae.default.createElement(gr,{key:y,isFocused:l===c,value:e[c]||"",isSuccess:a,isError:s})))),Ae.default.createElement(_reactnative.Text,{style:[A.statusText,a&&A.statusSuccess,s&&A.statusError]},r))}var ro=()=>Ae.default.createElement(_reactnative.Text,{style:A.separator},"-"),A=_reactnative.StyleSheet.create({container:{justifyContent:"center",paddingHorizontal:0,gap:6},invisibleTextInput:{position:"absolute",opacity:0},codeContainer:{flexDirection:"row",alignItems:"center",gap:10,justifyContent:"space-between"},separator:{fontFamily:"Inter_600SemiBold",fontSize:18,lineHeight:24,color:m.black},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark},statusSuccess:{color:m.successDark}});var x=({title:e,subtitle:r})=>Ae.default.createElement(_reactnative.View,{style:Fe.titleContainer},Ae.default.createElement(_reactnative.Text,{style:Fe.title},e),r&&Ae.default.createElement(_reactnative.Text,{style:Fe.subtitle},r)),Fe=_reactnative.StyleSheet.create({titleContainer:{alignItems:"center",gap:16},title:{fontFamily:"Inter_600SemiBold",fontSize:20,lineHeight:32,color:m.textTitle},subtitle:{fontFamily:"Inter_400Regular",fontSize:16,lineHeight:24,color:m.textMuted,textAlign:"center"}});var Cr=({hint:e,link:r,onPress:t,disabled:o})=>Ae.default.createElement(_reactnative.View,{style:ee.container},Ae.default.createElement(_reactnative.Text,{style:ee.hintText},e),r&&Ae.default.createElement(_reactnative.Pressable,{onPress:t,disabled:o},Ae.default.createElement(_reactnative.Text,{style:[ee.linkText,o&&ee.disabledLink]}," ",r))),ee=_reactnative.StyleSheet.create({container:{display:"flex",flexDirection:"row",gap:2},hintText:{fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22,color:m.textMuted},linkText:{fontFamily:"Inter_500Medium",fontSize:14,lineHeight:22,color:m.interactive},disabledLink:{color:m.textMuted}});var ho=3e4,fo=()=>{let[e,r]=_react.useState.call(void 0, !1),t=_react.useCallback.call(void 0, ()=>{r(!1),setTimeout(()=>{r(!0)},ho)},[]);return _react.useEffect.call(void 0, ()=>{t()},[]),[e,t]},re=({loginWithCode:e,requestNewCode:r,subtitle:t,isLoading:o,error:a,isDone:s})=>{let[n,i]=_react.useState.call(void 0, ""),d=l=>{i(l),l.length===6&&e(l)},[h,u]=fo(),g=()=>{r(),u()};return Ae.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:We.innerContainer},Ae.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Ae.default.createElement(_reactnative.View,{style:We.content},Ae.default.createElement(_reactnative.View,{style:We.formContainer},Ae.default.createElement(x,{title:"Enter confirmation code",subtitle:t}),Ae.default.createElement(Pe,{value:n,editable:!o,onChangeText:d,success:s,error:!!a,status:s?"Success.":a?po(a):" ",autoFocus:!0}),Ae.default.createElement(Cr,{hint:"Didn\u2019t get an email?",link:"Resend code",onPress:g,disabled:!h}))),Ae.default.createElement(b,{title:"Continue",loading:o,onPress:()=>e(n)})))},po=_jssdkcore.createErrorFormatter.call(void 0, {invalid_credentials:"Invalid code.",invalid_data:"The code has expired.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),We=_reactnative.StyleSheet.create({modalContent:{backgroundColor:"#ffffff"},innerContainer:{flex:1},content:{gap:16},formContainer:{rowGap:24}});var Co=e=>Ae.createElement(_reactnativesvg2.default,_chunkK6EKFGTEjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40"},e),Ae.createElement(_reactnativesvg.Path,{fill:e.color,d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02m176.8 1.71v5.72h-.27l-.09-.14a16 16 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a9 9 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.1 8.1 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.1 6.1 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73q.12-2.34.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02m27.66 4.14.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.8 6.8 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13 13 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13 13 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.5 7.5 0 0 0-2.8.5A7.1 7.1 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6 6 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.5 5.5 0 0 1 2.3-.63 10 10 0 0 1 1.13.02M69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.7 8.7 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49Zm64.29 0V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a5 5 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.6 2.6 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49Zm160.07.19a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.5 14.5 0 0 0-8.74-2.35m57.39 0a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.5 10.5 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.8 9.8 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.4 7.4 0 0 1-1.26-2.32 14.1 14.1 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03m13.77-5.31-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a912 912 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4v-6.9h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46v-4.4h-5.6c-4.46 0-5.6 0-5.6.02Zm27.17 13.85V30.8h3.87l3.86-.01V3.09h-7.73Zm9.8-13.85-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4v-.8h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01Zm30.38 0c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88zM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.9 4.9 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a12 12 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07m14.51.05c-2.33.12-4.3.84-5.95 2.16a9.9 9.9 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18 18 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.8 9.8 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04m1.42 3.78c.88.1 1.62.34 2.28.75a6.1 6.1 0 0 1 1.99 2.15 10.3 10.3 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03M92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.6 7.6 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.4 8.4 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18 18 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.3 5.3 0 0 1 2.9-.95c.2-.01.97 0 1.17.03Zm23.44-3.74c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.4 9.4 0 0 0 3.6 1.8 12 12 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.5 5.5 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.3 5.3 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 11 11 0 0 0-4.88-.74m39.41 0a9.87 9.87 0 0 0-6 2.29 11 11 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02m75.93-3.33 8.37 23.22a49 49 0 0 1-.67 1.9 5.4 5.4 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8 8 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3h-4.82Zm59.47 27.98c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a49 49 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41 41 0 0 0-5.8-.24m0 0"})),kr=Co;var B=()=>Ae.default.createElement(_reactnative.View,{style:bo.legalFooterContainer},Ae.default.createElement(kr,{color:m.brand,width:"100%",height:11})),bo=_reactnative.StyleSheet.create({legalFooterContainer:{flexDirection:"row",alignItems:"center",marginVertical:16,justifyContent:"center",gap:2}});var V=a=>{var s=a,{error:e,status:r,LeftIcon:t}=s,o=_chunkK6EKFGTEjs.c.call(void 0, s,["error","status","LeftIcon"]);let[n,i]=_react.useState.call(void 0, !1);return Ae.default.createElement(_reactnative.View,{style:_.container},Ae.default.createElement(_reactnative.View,{style:[_.inputBox,n&&_.inputBoxFocused,e&&_.inputBoxError]},t,Ae.default.createElement(_reactnative.TextInput,_chunkK6EKFGTEjs.a.call(void 0, {cursorColor:m.interactive,placeholderTextColor:m.placeholder,onFocus:()=>i(!0),onBlur:()=>i(!1),autoCapitalize:"none",returnKeyType:"next",multiline:!1,numberOfLines:1,style:_.input},o))),r&&Ae.default.createElement(_reactnative.Text,{style:[_.statusText,e&&_.statusError]},r))},_=_reactnative.StyleSheet.create({container:{gap:6},input:{flex:1,fontFamily:"Inter_400Regular",fontSize:18,height:30,color:m.text},inputBox:{flexDirection:"row",paddingHorizontal:16,height:64,backgroundColor:m.inputBackground,borderRadius:14,alignItems:"center",columnGap:10,borderWidth:2,borderColor:m.border},inputBoxFocused:{borderColor:m.interactive},inputBoxError:{borderColor:m.error},statusText:{textAlign:"left",color:m.textMuted,fontFamily:"Inter_400Regular",fontSize:14,lineHeight:22},statusError:{color:m.errorDark}});var Fo=e=>_e.createElement(_reactnativesvg2.default,_chunkK6EKFGTEjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_e.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7m2-3h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"})),xr=Fo;var Lr=({sendCode:e,isLoading:r,error:t,initialEmail:o,FooterComponent:a})=>{let[s,n]=_react.useState.call(void 0, o!=null?o:"");return Ae.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:ne.innerContainer},Ae.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Ae.default.createElement(_reactnative.View,{style:ne.content},Ae.default.createElement(_reactnative.View,{style:ne.content},Ae.default.createElement(_reactnative.View,{style:ne.formContainer},Ae.default.createElement(x,{title:"Enter your email"}),Ae.default.createElement(V,{LeftIcon:Ae.default.createElement(xr,{color:m.icon}),value:s,onChangeText:n,error:!!t,status:t?Uo(t):" ",placeholder:"your@email.com",autoComplete:"email",keyboardType:"email-address",autoFocus:!0})),a),Ae.default.createElement(B,null)),Ae.default.createElement(b,{title:"Continue",loading:r,onPress:()=>e(s)})))},Uo=_jssdkcore.createErrorFormatter.call(void 0, {invalid_data:"Invalid email address.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),ne=_reactnative.StyleSheet.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var ie=({onLoginMethodChange:e,otherLoginMethod:r})=>r?Ae.default.createElement(b,{variant:"tertiary",title:`Use ${_chunkK6EKFGTEjs.q[r]} instead`,onPress:()=>e(r)}):null;var Ho=600,Mr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),a=_chunkK6EKFGTEjs.t.call(void 0, ),[s,n]=_react.useState.call(void 0, ""),{state:i,loginWithCode:d,sendCode:h}=or(),[u,g]=_react.useState.call(void 0, "email"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_react.useMemo.call(void 0, ()=>{var p;switch(i.status){case"initial":return{step:{type:"email"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),_react.useEffect.call(void 0, ()=>{if(!C)return;let p=setTimeout(()=>{a()},Ho);return()=>clearTimeout(p)},[C,a]),_react.useEffect.call(void 0, ()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o]),l.type){case"code":return Ae.default.createElement(re,{loginWithCode:p=>d({code:p,email:s}),requestNewCode:()=>h({email:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C});case"email":return Ae.default.createElement(Lr,{initialEmail:s,sendCode:p=>{n(p),h({email:p})},isLoading:y,error:c,FooterComponent:Ae.default.createElement(ie,{onLoginMethodChange:r,otherLoginMethod:t})})}};function Fr(e,r){let[t,o]=_react.useState.call(void 0, e);return _react.useEffect.call(void 0, ()=>{let a=setTimeout(()=>{o(e)},r);return()=>{clearTimeout(a)}},[e,r]),t}var Tr=[["Afghanistan","AF","\u{1F1E6}\u{1F1EB}"],["Albania","AL","\u{1F1E6}\u{1F1F1}"],["Algeria","DZ","\u{1F1E9}\u{1F1FF}"],["American Samoa","AS","\u{1F1E6}\u{1F1F8}"],["Andorra","AD","\u{1F1E6}\u{1F1E9}"],["Angola","AO","\u{1F1E6}\u{1F1F4}"],["Anguilla","AI","\u{1F1E6}\u{1F1EE}"],["Antigua & Barbuda","AG","\u{1F1E6}\u{1F1EC}"],["Argentina","AR","\u{1F1E6}\u{1F1F7}"],["Armenia","AM","\u{1F1E6}\u{1F1F2}"],["Aruba","AW","\u{1F1E6}\u{1F1FC}"],["Ascension Island","AC","\u{1F1E6}\u{1F1E8}"],["Australia","AU","\u{1F1E6}\u{1F1FA}"],["Austria","AT","\u{1F1E6}\u{1F1F9}"],["Azerbaijan","AZ","\u{1F1E6}\u{1F1FF}"],["Bahamas","BS","\u{1F1E7}\u{1F1F8}"],["Bahrain","BH","\u{1F1E7}\u{1F1ED}"],["Bangladesh","BD","\u{1F1E7}\u{1F1E9}"],["Barbados","BB","\u{1F1E7}\u{1F1E7}"],["Belarus","BY","\u{1F1E7}\u{1F1FE}"],["Belgium","BE","\u{1F1E7}\u{1F1EA}"],["Belize","BZ","\u{1F1E7}\u{1F1FF}"],["Benin","BJ","\u{1F1E7}\u{1F1EF}"],["Bermuda","BM","\u{1F1E7}\u{1F1F2}"],["Bhutan","BT","\u{1F1E7}\u{1F1F9}"],["Bolivia","BO","\u{1F1E7}\u{1F1F4}"],["Bosnia & Herzegovina","BA","\u{1F1E7}\u{1F1E6}"],["Botswana","BW","\u{1F1E7}\u{1F1FC}"],["Brazil","BR","\u{1F1E7}\u{1F1F7}"],["British Indian Ocean Territory","IO","\u{1F1EE}\u{1F1F4}"],["British Virgin Islands","VG","\u{1F1FB}\u{1F1EC}"],["Brunei","BN","\u{1F1E7}\u{1F1F3}"],["Bulgaria","BG","\u{1F1E7}\u{1F1EC}"],["Burkina Faso","BF","\u{1F1E7}\u{1F1EB}"],["Burundi","BI","\u{1F1E7}\u{1F1EE}"],["Cambodia","KH","\u{1F1F0}\u{1F1ED}"],["Cameroon","CM","\u{1F1E8}\u{1F1F2}"],["Canada","CA","\u{1F1E8}\u{1F1E6}"],["Cape Verde","CV","\u{1F1E8}\u{1F1FB}"],["Caribbean Netherlands","BQ","\u{1F1E7}\u{1F1F6}"],["Cayman Islands","KY","\u{1F1F0}\u{1F1FE}"],["Central African Republic","CF","\u{1F1E8}\u{1F1EB}"],["Chad","TD","\u{1F1F9}\u{1F1E9}"],["Chile","CL","\u{1F1E8}\u{1F1F1}"],["China","CN","\u{1F1E8}\u{1F1F3}"],["Christmas Island","CX","\u{1F1E8}\u{1F1FD}"],["Cocos (Keeling) Islands","CC","\u{1F1E8}\u{1F1E8}"],["Colombia","CO","\u{1F1E8}\u{1F1F4}"],["Comoros","KM","\u{1F1F0}\u{1F1F2}"],["Congo - Brazzaville","CG","\u{1F1E8}\u{1F1EC}"],["Congo - Kinshasa","CD","\u{1F1E8}\u{1F1E9}"],["Cook Islands","CK","\u{1F1E8}\u{1F1F0}"],["Costa Rica","CR","\u{1F1E8}\u{1F1F7}"],["Croatia","HR","\u{1F1ED}\u{1F1F7}"],["Cuba","CU","\u{1F1E8}\u{1F1FA}"],["Cura\xE7ao","CW","\u{1F1E8}\u{1F1FC}"],["Cyprus","CY","\u{1F1E8}\u{1F1FE}"],["Czechia","CZ","\u{1F1E8}\u{1F1FF}"],["C\xF4te d\u2019Ivoire","CI","\u{1F1E8}\u{1F1EE}"],["Denmark","DK","\u{1F1E9}\u{1F1F0}"],["Djibouti","DJ","\u{1F1E9}\u{1F1EF}"],["Dominica","DM","\u{1F1E9}\u{1F1F2}"],["Dominican Republic","DO","\u{1F1E9}\u{1F1F4}"],["Ecuador","EC","\u{1F1EA}\u{1F1E8}"],["Egypt","EG","\u{1F1EA}\u{1F1EC}"],["El Salvador","SV","\u{1F1F8}\u{1F1FB}"],["Equatorial Guinea","GQ","\u{1F1EC}\u{1F1F6}"],["Eritrea","ER","\u{1F1EA}\u{1F1F7}"],["Estonia","EE","\u{1F1EA}\u{1F1EA}"],["Eswatini","SZ","\u{1F1F8}\u{1F1FF}"],["Ethiopia","ET","\u{1F1EA}\u{1F1F9}"],["Falkland Islands","FK","\u{1F1EB}\u{1F1F0}"],["Faroe Islands","FO","\u{1F1EB}\u{1F1F4}"],["Fiji","FJ","\u{1F1EB}\u{1F1EF}"],["Finland","FI","\u{1F1EB}\u{1F1EE}"],["France","FR","\u{1F1EB}\u{1F1F7}"],["French Guiana","GF","\u{1F1EC}\u{1F1EB}"],["French Polynesia","PF","\u{1F1F5}\u{1F1EB}"],["Gabon","GA","\u{1F1EC}\u{1F1E6}"],["Gambia","GM","\u{1F1EC}\u{1F1F2}"],["Georgia","GE","\u{1F1EC}\u{1F1EA}"],["Germany","DE","\u{1F1E9}\u{1F1EA}"],["Ghana","GH","\u{1F1EC}\u{1F1ED}"],["Gibraltar","GI","\u{1F1EC}\u{1F1EE}"],["Greece","GR","\u{1F1EC}\u{1F1F7}"],["Greenland","GL","\u{1F1EC}\u{1F1F1}"],["Grenada","GD","\u{1F1EC}\u{1F1E9}"],["Guadeloupe","GP","\u{1F1EC}\u{1F1F5}"],["Guam","GU","\u{1F1EC}\u{1F1FA}"],["Guatemala","GT","\u{1F1EC}\u{1F1F9}"],["Guernsey","GG","\u{1F1EC}\u{1F1EC}"],["Guinea","GN","\u{1F1EC}\u{1F1F3}"],["Guinea-Bissau","GW","\u{1F1EC}\u{1F1FC}"],["Guyana","GY","\u{1F1EC}\u{1F1FE}"],["Haiti","HT","\u{1F1ED}\u{1F1F9}"],["Honduras","HN","\u{1F1ED}\u{1F1F3}"],["Hong Kong SAR China","HK","\u{1F1ED}\u{1F1F0}"],["Hungary","HU","\u{1F1ED}\u{1F1FA}"],["Iceland","IS","\u{1F1EE}\u{1F1F8}"],["India","IN","\u{1F1EE}\u{1F1F3}"],["Indonesia","ID","\u{1F1EE}\u{1F1E9}"],["Iran","IR","\u{1F1EE}\u{1F1F7}"],["Iraq","IQ","\u{1F1EE}\u{1F1F6}"],["Ireland","IE","\u{1F1EE}\u{1F1EA}"],["Isle of Man","IM","\u{1F1EE}\u{1F1F2}"],["Israel","IL","\u{1F1EE}\u{1F1F1}"],["Italy","IT","\u{1F1EE}\u{1F1F9}"],["Jamaica","JM","\u{1F1EF}\u{1F1F2}"],["Japan","JP","\u{1F1EF}\u{1F1F5}"],["Jersey","JE","\u{1F1EF}\u{1F1EA}"],["Jordan","JO","\u{1F1EF}\u{1F1F4}"],["Kazakhstan","KZ","\u{1F1F0}\u{1F1FF}"],["Kenya","KE","\u{1F1F0}\u{1F1EA}"],["Kiribati","KI","\u{1F1F0}\u{1F1EE}"],["Kosovo","XK","\u{1F1FD}\u{1F1F0}"],["Kuwait","KW","\u{1F1F0}\u{1F1FC}"],["Kyrgyzstan","KG","\u{1F1F0}\u{1F1EC}"],["Laos","LA","\u{1F1F1}\u{1F1E6}"],["Latvia","LV","\u{1F1F1}\u{1F1FB}"],["Lebanon","LB","\u{1F1F1}\u{1F1E7}"],["Lesotho","LS","\u{1F1F1}\u{1F1F8}"],["Liberia","LR","\u{1F1F1}\u{1F1F7}"],["Libya","LY","\u{1F1F1}\u{1F1FE}"],["Liechtenstein","LI","\u{1F1F1}\u{1F1EE}"],["Lithuania","LT","\u{1F1F1}\u{1F1F9}"],["Luxembourg","LU","\u{1F1F1}\u{1F1FA}"],["Macao SAR China","MO","\u{1F1F2}\u{1F1F4}"],["Madagascar","MG","\u{1F1F2}\u{1F1EC}"],["Malawi","MW","\u{1F1F2}\u{1F1FC}"],["Malaysia","MY","\u{1F1F2}\u{1F1FE}"],["Maldives","MV","\u{1F1F2}\u{1F1FB}"],["Mali","ML","\u{1F1F2}\u{1F1F1}"],["Malta","MT","\u{1F1F2}\u{1F1F9}"],["Marshall Islands","MH","\u{1F1F2}\u{1F1ED}"],["Martinique","MQ","\u{1F1F2}\u{1F1F6}"],["Mauritania","MR","\u{1F1F2}\u{1F1F7}"],["Mauritius","MU","\u{1F1F2}\u{1F1FA}"],["Mayotte","YT","\u{1F1FE}\u{1F1F9}"],["Mexico","MX","\u{1F1F2}\u{1F1FD}"],["Micronesia","FM","\u{1F1EB}\u{1F1F2}"],["Moldova","MD","\u{1F1F2}\u{1F1E9}"],["Monaco","MC","\u{1F1F2}\u{1F1E8}"],["Mongolia","MN","\u{1F1F2}\u{1F1F3}"],["Montenegro","ME","\u{1F1F2}\u{1F1EA}"],["Montserrat","MS","\u{1F1F2}\u{1F1F8}"],["Morocco","MA","\u{1F1F2}\u{1F1E6}"],["Mozambique","MZ","\u{1F1F2}\u{1F1FF}"],["Myanmar (Burma)","MM","\u{1F1F2}\u{1F1F2}"],["Namibia","NA","\u{1F1F3}\u{1F1E6}"],["Nauru","NR","\u{1F1F3}\u{1F1F7}"],["Nepal","NP","\u{1F1F3}\u{1F1F5}"],["Netherlands","NL","\u{1F1F3}\u{1F1F1}"],["New Caledonia","NC","\u{1F1F3}\u{1F1E8}"],["New Zealand","NZ","\u{1F1F3}\u{1F1FF}"],["Nicaragua","NI","\u{1F1F3}\u{1F1EE}"],["Niger","NE","\u{1F1F3}\u{1F1EA}"],["Nigeria","NG","\u{1F1F3}\u{1F1EC}"],["Niue","NU","\u{1F1F3}\u{1F1FA}"],["Norfolk Island","NF","\u{1F1F3}\u{1F1EB}"],["North Korea","KP","\u{1F1F0}\u{1F1F5}"],["North Macedonia","MK","\u{1F1F2}\u{1F1F0}"],["Northern Mariana Islands","MP","\u{1F1F2}\u{1F1F5}"],["Norway","NO","\u{1F1F3}\u{1F1F4}"],["Oman","OM","\u{1F1F4}\u{1F1F2}"],["Pakistan","PK","\u{1F1F5}\u{1F1F0}"],["Palau","PW","\u{1F1F5}\u{1F1FC}"],["Palestinian Territories","PS","\u{1F1F5}\u{1F1F8}"],["Panama","PA","\u{1F1F5}\u{1F1E6}"],["Papua New Guinea","PG","\u{1F1F5}\u{1F1EC}"],["Paraguay","PY","\u{1F1F5}\u{1F1FE}"],["Peru","PE","\u{1F1F5}\u{1F1EA}"],["Philippines","PH","\u{1F1F5}\u{1F1ED}"],["Poland","PL","\u{1F1F5}\u{1F1F1}"],["Portugal","PT","\u{1F1F5}\u{1F1F9}"],["Puerto Rico","PR","\u{1F1F5}\u{1F1F7}"],["Qatar","QA","\u{1F1F6}\u{1F1E6}"],["Romania","RO","\u{1F1F7}\u{1F1F4}"],["Russia","RU","\u{1F1F7}\u{1F1FA}"],["Rwanda","RW","\u{1F1F7}\u{1F1FC}"],["R\xE9union","RE","\u{1F1F7}\u{1F1EA}"],["Samoa","WS","\u{1F1FC}\u{1F1F8}"],["San Marino","SM","\u{1F1F8}\u{1F1F2}"],["Saudi Arabia","SA","\u{1F1F8}\u{1F1E6}"],["Senegal","SN","\u{1F1F8}\u{1F1F3}"],["Serbia","RS","\u{1F1F7}\u{1F1F8}"],["Seychelles","SC","\u{1F1F8}\u{1F1E8}"],["Sierra Leone","SL","\u{1F1F8}\u{1F1F1}"],["Singapore","SG","\u{1F1F8}\u{1F1EC}"],["Sint Maarten","SX","\u{1F1F8}\u{1F1FD}"],["Slovakia","SK","\u{1F1F8}\u{1F1F0}"],["Slovenia","SI","\u{1F1F8}\u{1F1EE}"],["Solomon Islands","SB","\u{1F1F8}\u{1F1E7}"],["Somalia","SO","\u{1F1F8}\u{1F1F4}"],["South Africa","ZA","\u{1F1FF}\u{1F1E6}"],["South Korea","KR","\u{1F1F0}\u{1F1F7}"],["South Sudan","SS","\u{1F1F8}\u{1F1F8}"],["Spain","ES","\u{1F1EA}\u{1F1F8}"],["Sri Lanka","LK","\u{1F1F1}\u{1F1F0}"],["St. Barth\xE9lemy","BL","\u{1F1E7}\u{1F1F1}"],["St. Helena","SH","\u{1F1F8}\u{1F1ED}"],["St. Kitts & Nevis","KN","\u{1F1F0}\u{1F1F3}"],["St. Lucia","LC","\u{1F1F1}\u{1F1E8}"],["St. Martin","MF","\u{1F1F2}\u{1F1EB}"],["St. Pierre & Miquelon","PM","\u{1F1F5}\u{1F1F2}"],["St. Vincent & Grenadines","VC","\u{1F1FB}\u{1F1E8}"],["Sudan","SD","\u{1F1F8}\u{1F1E9}"],["Suriname","SR","\u{1F1F8}\u{1F1F7}"],["Svalbard & Jan Mayen","SJ","\u{1F1F8}\u{1F1EF}"],["Sweden","SE","\u{1F1F8}\u{1F1EA}"],["Switzerland","CH","\u{1F1E8}\u{1F1ED}"],["Syria","SY","\u{1F1F8}\u{1F1FE}"],["S\xE3o Tom\xE9 & Pr\xEDncipe","ST","\u{1F1F8}\u{1F1F9}"],["Taiwan","TW","\u{1F1F9}\u{1F1FC}"],["Tajikistan","TJ","\u{1F1F9}\u{1F1EF}"],["Tanzania","TZ","\u{1F1F9}\u{1F1FF}"],["Thailand","TH","\u{1F1F9}\u{1F1ED}"],["Timor-Leste","TL","\u{1F1F9}\u{1F1F1}"],["Togo","TG","\u{1F1F9}\u{1F1EC}"],["Tokelau","TK","\u{1F1F9}\u{1F1F0}"],["Tonga","TO","\u{1F1F9}\u{1F1F4}"],["Trinidad & Tobago","TT","\u{1F1F9}\u{1F1F9}"],["Tristan da Cunha","TA","\u{1F1F9}\u{1F1E6}"],["Tunisia","TN","\u{1F1F9}\u{1F1F3}"],["Turkey","TR","\u{1F1F9}\u{1F1F7}"],["Turkmenistan","TM","\u{1F1F9}\u{1F1F2}"],["Turks & Caicos Islands","TC","\u{1F1F9}\u{1F1E8}"],["Tuvalu","TV","\u{1F1F9}\u{1F1FB}"],["U.S. Virgin Islands","VI","\u{1F1FB}\u{1F1EE}"],["Uganda","UG","\u{1F1FA}\u{1F1EC}"],["Ukraine","UA","\u{1F1FA}\u{1F1E6}"],["United Arab Emirates","AE","\u{1F1E6}\u{1F1EA}"],["United Kingdom","GB","\u{1F1EC}\u{1F1E7}"],["United States","US","\u{1F1FA}\u{1F1F8}"],["Uruguay","UY","\u{1F1FA}\u{1F1FE}"],["Uzbekistan","UZ","\u{1F1FA}\u{1F1FF}"],["Vanuatu","VU","\u{1F1FB}\u{1F1FA}"],["Vatican City","VA","\u{1F1FB}\u{1F1E6}"],["Venezuela","VE","\u{1F1FB}\u{1F1EA}"],["Vietnam","VN","\u{1F1FB}\u{1F1F3}"],["Wallis & Futuna","WF","\u{1F1FC}\u{1F1EB}"],["Western Sahara","EH","\u{1F1EA}\u{1F1ED}"],["Yemen","YE","\u{1F1FE}\u{1F1EA}"],["Zambia","ZM","\u{1F1FF}\u{1F1F2}"],["Zimbabwe","ZW","\u{1F1FF}\u{1F1FC}"],["\xC5land Islands","AX","\u{1F1E6}\u{1F1FD}"]];var Ko=Tr,Wr=Ko.map(([e,r,t])=>({name:e,code:r,callCode:_jssdkcore.getCountryCallingCode.call(void 0, r),flag:t}));var jo=e=>Ue.createElement(_reactnativesvg2.default,_chunkK6EKFGTEjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),Ue.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})),Ar=jo;var Ir=({country:e,onPress:r,selected:t})=>Ae.default.createElement(_reactnative.Pressable,{onPress:r},Ae.default.createElement(_reactnative.View,{style:Oe.row},Ae.default.createElement(_reactnative.Text,{style:Oe.rowFlag},e.flag),Ae.default.createElement(_reactnative.Text,{style:Oe.rowLabel},e.name," (+",e.callCode,")"),t&&Ae.default.createElement(Ar,{color:m.interactive}))),Oe=_reactnative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",gap:10,height:56},rowFlag:{fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22},rowLabel:{flex:1,fontFamily:"Inter_400Regular",fontSize:17,lineHeight:22,color:m.black}});var Xo=e=>Be.createElement(_reactnativesvg2.default,_chunkK6EKFGTEjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:17,height:16,fill:"none",viewBox:"0 0 17 16"},e),Be.createElement(_reactnativesvg.Path,{fill:e.color,fillRule:"evenodd",d:"M7.01 12.01a5.5 5.5 0 1 1 4.304-2.075.7.7 0 0 1 .156.115l3.818 3.819a.65.65 0 0 1-.92.92l-3.818-3.82a.7.7 0 0 1-.115-.155A5.48 5.48 0 0 1 7.01 12.01m4.5-5.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0",clipRule:"evenodd"})),Ur=Xo;var ln=600,Br=({countryCode:e,onChangeCountryCode:r,onComplete:t})=>{let[o,a]=_react.useState.call(void 0, ""),s=Fr(o,ln),n=_react.useMemo.call(void 0, ()=>Wr.filter(i=>i.name.toLowerCase().includes(s.toLowerCase())),[s]);return Ae.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:Or.innerContainer},Ae.default.createElement(_reactnative.View,{style:Or.header},Ae.default.createElement(x,{title:"Select country code"}),Ae.default.createElement(V,{LeftIcon:Ae.default.createElement(Ur,{color:m.placeholder}),value:o,onChangeText:a,placeholder:"Search country"})),Ae.default.createElement(_reactnative.FlatList,{style:{flex:1},data:n,keyExtractor:i=>`country-option-${i.code}`,renderItem:({item:i})=>Ae.default.createElement(Ir,{country:i,selected:i.code===e,onPress:()=>{r(i.code),t()}})}),Ae.default.createElement(b,{title:"Continue",onPress:t}))},Or=_reactnative.StyleSheet.create({innerContainer:{flex:1,paddingHorizontal:16},header:{gap:20}});var mn=e=>Ve.createElement(_reactnativesvg2.default,_chunkK6EKFGTEjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),Ve.createElement(_reactnativesvg.Path,{stroke:e.color,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m4 6 4 4 4-4"})),Vr=mn;var Gr=({countryCode:e,onPress:r})=>Ae.default.createElement(_reactnative.Pressable,{onPress:r},Ae.default.createElement(_reactnative.View,{style:Hr.cell},Ae.default.createElement(_reactnative.Text,{style:Hr.text},e," +",_jssdkcore.getCountryCallingCode.call(void 0, e)),Ae.default.createElement(Vr,{color:m.icon}))),Hr=_reactnative.StyleSheet.create({cell:{flexDirection:"row",alignItems:"center",gap:6},text:{fontFamily:"Inter_400Regular",fontSize:18,lineHeight:30,color:m.text}});var Nr=({sendCode:e,isLoading:r,error:t,initialPhone:o,FooterComponent:a})=>{let[s,n]=_react.useState.call(void 0, o!=null?o:""),[i,d]=_react.useState.call(void 0, "US"),[h,u]=_react.useState.call(void 0, !1),g=_jssdkcore.phoneNumberTypingFormatter.call(void 0, i),l=_jssdkcore.getPlaceholderPhoneNumber.call(void 0, i),c=y=>{try{let C=y.replace(/\D/g,""),p=s.replace(/\D/g,""),E=C===p?y:g.input(y);n(E)}catch(C){console.error("Error processing phone number:",C),n("")}};return h?Ae.default.createElement(Br,{countryCode:i,onChangeCountryCode:d,onComplete:()=>u(!1)}):Ae.default.createElement(_reactnative.KeyboardAvoidingView,{behavior:_reactnative.Platform.OS==="ios"?"padding":void 0,style:le.innerContainer},Ae.default.createElement(_reactnative.View,{style:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16}},Ae.default.createElement(_reactnative.View,{style:le.content},Ae.default.createElement(_reactnative.View,{style:le.content},Ae.default.createElement(_reactnative.View,{style:le.formContainer},Ae.default.createElement(x,{title:"Enter your phone"}),Ae.default.createElement(V,{LeftIcon:Ae.default.createElement(Gr,{countryCode:i,onPress:()=>u(!0)}),value:s,onChangeText:c,error:!!t,status:t?vn(t):" ",placeholder:l,autoComplete:"tel",keyboardType:"phone-pad",autoFocus:!0})),a),Ae.default.createElement(B,null)),Ae.default.createElement(b,{title:"Continue",loading:r,onPress:()=>e(s)})))},vn=_jssdkcore.createErrorFormatter.call(void 0, {invalid_data:"Phone is incorrect.",not_supported:"Region or carrier not yet supported.",too_many_requests:"Too many requests. Please try again later.",default:"Something went wrong. Please try again."}),le=_reactnative.StyleSheet.create({innerContainer:{flex:1},content:{gap:4},formContainer:{rowGap:24}});var En=600,Kr=({goBackRef:e,onLoginMethodChange:r,otherLoginMethod:t})=>{let{setOtpState:o}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),a=_chunkK6EKFGTEjs.t.call(void 0, ),[s,n]=_react.useState.call(void 0, ""),{state:i,loginWithCode:d,sendCode:h}=ar(),[u,g]=_react.useState.call(void 0, "phone"),{step:l,error:c=null,isLoading:y=!1,isDone:C=!1}=_react.useMemo.call(void 0, ()=>{var p;switch(i.status){case"initial":return{step:{type:"phone"}};case"sending-code":return{step:{type:u},isLoading:!0};case"awaiting-code-input":return{step:{type:"code"}};case"submitting-code":return{step:{type:"code"},isLoading:!0};case"done":return{step:{type:"code"},isDone:!0};case"error":return{step:{type:u},error:(p=i.error)!=null?p:new Error("Unknown error")}}},[u,i.status]);switch(u!==l.type&&g(l.type),_react.useEffect.call(void 0, ()=>{if(!C)return;let p=setTimeout(()=>{a()},En);return()=>clearTimeout(p)},[C,a]),_react.useEffect.call(void 0, ()=>{if(l.type==="code")return e.current=()=>{o({status:"initial"})},()=>{e.current=null}},[l.type,o,a]),l.type){case"phone":return Ae.default.createElement(Nr,{initialPhone:s,sendCode:p=>{n(p),h({phone:p})},isLoading:y,error:c,FooterComponent:Ae.default.createElement(ie,{onLoginMethodChange:r,otherLoginMethod:t})});case"code":return Ae.default.createElement(re,{loginWithCode:p=>d({code:p,phone:s}),requestNewCode:()=>h({phone:s}),subtitle:`Please check ${s} for a message with your login code.`,isLoading:y,error:c,isDone:C})}};var Mn=()=>Ae.default.createElement(_reactnative.View,{style:{height:72,width:220,borderRadius:8,backgroundColor:m.border}}),zr=({loginMethods:e,onLoginMethodChange:r})=>Ae.default.createElement(_reactnative.View,{style:Ne.container},Ae.default.createElement(_reactnative.View,{style:Ne.formContainer},Ae.default.createElement(Mn,null),Ae.default.createElement(x,{title:"Login or sign up"}),Ae.default.createElement(_reactnative.View,{style:Ne.listContainer},e.map((t,o)=>Ae.default.createElement(b,{key:`method-option-${t}`,variant:o===0?"primary":"secondary",onPress:()=>r(t),title:Fn[t]})))),Ae.default.createElement(B,null)),Fn={email:"Continue with email",sms:"Continue with phone"},Ne=_reactnative.StyleSheet.create({container:{flex:1,justifyContent:"space-between",paddingHorizontal:16},formContainer:{alignItems:"center",gap:32},listContainer:{gap:16,alignSelf:"stretch"}});var An=e=>De.createElement(_reactnativesvg2.default,_chunkK6EKFGTEjs.a.call(void 0, {xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),De.createElement(_reactnativesvg.Path,{fill:e.color,d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),Zr=An;var qr=({goBack:e})=>Ae.default.createElement(_reactnative.View,{style:Jr.navigationBar},Ae.default.createElement(Un,{onPress:e})),Un=e=>Ae.default.createElement(_reactnative.Pressable,_chunkK6EKFGTEjs.a.call(void 0, {},e),Ae.default.createElement(_reactnative.View,{style:Jr.backButton},Ae.default.createElement(Zr,{color:m.icon}))),Jr=_reactnative.StyleSheet.create({navigationBar:{height:48},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});var _reactnativesafeareacontext = require('react-native-safe-area-context');var Hn=()=>{let e=_reactnativesafeareacontext.useSafeAreaInsets.call(void 0, );return{paddingTop:e.top,paddingBottom:e.bottom,paddingLeft:e.left,paddingRight:e.right}},$r=({children:e,visible:r})=>{let t=Hn();return Ae.default.createElement(_reactnative.Modal,{animationType:"slide",transparent:!0,visible:r},Ae.default.createElement(_reactnative.View,{style:[_reactnative.StyleSheet.absoluteFill,Gn.modalContent,t]},e))},Gn=_reactnative.StyleSheet.create({modalContent:{backgroundColor:m.white}});var Dn=({config:e,goBackRef:r})=>{let[t,o]=_chunkK6EKFGTEjs.v.call(void 0, ),a=t&&_chunkK6EKFGTEjs.p.call(void 0, e.loginMethods,t);switch(t){case"email":return Ae.default.createElement(Mr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case"sms":return Ae.default.createElement(Kr,{goBackRef:r,otherLoginMethod:a,onLoginMethodChange:o});case null:return Ae.default.createElement(zr,{loginMethods:e.loginMethods,onLoginMethodChange:o,goBackRef:r});default:throw new (0, _chunkK6EKFGTEjs.o)("unsupported_login_method",`Unsupported login method: ${t}`)}},Rn= exports.PrivyElements =()=>{let e=_chunkK6EKFGTEjs.u.call(void 0, ),r=_chunkK6EKFGTEjs.r.call(void 0, ),t=_chunkK6EKFGTEjs.x.call(void 0, );_chunkK6EKFGTEjs.w.call(void 0, );let o=_react.useRef.call(void 0, null);return Ae.default.createElement($r,{visible:t},Ae.default.createElement(qr,{goBack:()=>{var a;return((a=o.current)!=null?a:e)()}}),r&&Ae.default.createElement(Dn,{config:r,goBackRef:o}))};var jn=()=>{let e=_chunkK6EKFGTEjs.s.call(void 0, ),{setOtpState:r,user:t}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),o=_react.useCallback.call(void 0, ()=>r({status:"initial"}),[]),a=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{a.current=t}),{login:_react.useCallback.call(void 0, n=>_chunkK6EKFGTEjs.d.call(void 0, void 0,null,function*(){return{user:yield e(n,a.current,o)}}),[e,o])}};var _expocrypto = require('expo-crypto');var Yn=({appId:e,clientId:r,storage:t=_chunkK6EKFGTEjs.n,supportedChains:o,baseUrl:a,logLevel:s})=>new (0, _jssdkcore2.default)({appId:e,clientId:r,supportedChains:o,storage:_chunkK6EKFGTEjs.m.call(void 0, t),sdkVersion:`expo:${_chunkK6EKFGTEjs.e.version}`,nativeAppIdentifier:_chunkK6EKFGTEjs.l.call(void 0, ),crypto:{digest:_expocrypto.digest},baseUrl:a,logLevel:s});exports.PrivyContext = _chunkK6EKFGTEjs.y; exports.PrivyElements = Rn; exports.PrivyProvider = _chunkK6EKFGTEjs.A; exports.PrivyUIError = _chunkK6EKFGTEjs.o; exports.SecureStorageAdapter = _chunkK6EKFGTEjs.n; exports.createPrivyClient = Yn; exports.getAccessToken = _chunkK6EKFGTEjs.z; exports.hasError = _chunkK6EKFGTEjs.H; exports.isConnected = _chunkK6EKFGTEjs.B; exports.isConnecting = _chunkK6EKFGTEjs.D; exports.isCreating = _chunkK6EKFGTEjs.G; exports.isDisconnected = _chunkK6EKFGTEjs.E; exports.isNotCreated = _chunkK6EKFGTEjs.F; exports.isReconnecting = _chunkK6EKFGTEjs.C; exports.needsRecovery = _chunkK6EKFGTEjs.I; exports.useCreateGuestAccount = za; exports.useEmbeddedSolanaWallet = At; exports.useEmbeddedWallet = xe; exports.useEmbeddedWalletStateChange = Ua; exports.useIdentityToken = Ha; exports.useLinkEmail = Ai; exports.useLinkSMS = zi; exports.useLinkWithFarcaster = na; exports.useLinkWithOAuth = _chunkK6EKFGTEjs.j; exports.useLinkWithSiwe = mi; exports.useLogin = jn; exports.useLoginWithEmail = or; exports.useLoginWithFarcaster = ya; exports.useLoginWithOAuth = _chunkK6EKFGTEjs.i; exports.useLoginWithSMS = ar; exports.useLoginWithSiwe = Si; exports.useOAuthFlow = _chunkK6EKFGTEjs.k; exports.useOAuthTokens = Ma; exports.usePrivy = Ot; exports.usePrivyClient = It; exports.useUnlinkFarcaster = ua; exports.useUnlinkOAuth = va; exports.useUnlinkWallet = Li;
|
package/dist/passkey.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkK6EKFGTEjs = require('./chunk-K6EKFGTE.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var w=e=>_chunkK6EKFGTEjs.d.call(void 0, void 0,null,function*(){var a;let r=yield(yield Promise.resolve().then(() => _interopRequireWildcard(require("react-native-passkeys")))).create({rp:e.rp,user:e.user,challenge:e.challenge,pubKeyCredParams:e.pubKeyCredParams,excludeCredentials:e.excludeCredentials,authenticatorSelection:e.authenticatorSelection,timeout:12e4});if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"failed_to_create_passkey",error:"Could not create passkey"});return _chunkK6EKFGTEjs.b.call(void 0, _chunkK6EKFGTEjs.a.call(void 0, {},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});var C=e=>_chunkK6EKFGTEjs.d.call(void 0, void 0,null,function*(){var a;let r=yield(yield Promise.resolve().then(() => _interopRequireWildcard(require("react-native-passkeys")))).get({rpId:e.rpId,challenge:e.challenge,allowCredentials:e.allowCredentials,timeout:12e4});if(!r)throw new (0, _jssdkcore.PrivyClientError)({code:"no_passkey_found_for_challenge",error:"Could not find a matching passkey to login with"});return _chunkK6EKFGTEjs.b.call(void 0, _chunkK6EKFGTEjs.a.call(void 0, {},r),{type:(a=r.type)!=null?a:"public-key",clientExtensionResults:{}})});var oe=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),d=_react.useCallback.call(void 0, o=>{var n;let u=_chunkK6EKFGTEjs.f.call(void 0, o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, u=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[u],function*({relyingParty:o}){var n,p,h,P,s,_,y,x,b;try{if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});i({status:"generating-challenege"});let{options:t}=yield r.auth.passkey.generateRegistrationOptions(o);i({status:"awaiting-passkey"});let N=yield w({rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params,extensions:{hmacCreateSecret:(n=t.extensions)==null?void 0:n.hmac_create_secret,credProps:(h=(p=t.extensions)==null?void 0:p.cred_props)==null?void 0:h.rk,appid:(P=t.extensions)==null?void 0:P.app_id},attestation:t.attestation,excludeCredentials:t.exclude_credentials,authenticatorSelection:{authenticatorAttachment:(s=t.authenticator_selection)==null?void 0:s.authenticator_attachment,residentKey:(_=t.authenticator_selection)==null?void 0:_.resident_key,userVerification:(y=t.authenticator_selection)==null?void 0:y.user_verification,requireResidentKey:(x=t.authenticator_selection)==null?void 0:x.require_resident_key}});i({status:"submitting-response"});let O=yield r.auth.passkey.linkWithPasskey(N,o);return i({status:"done"}),(b=e==null?void 0:e.onSuccess)==null||b.call(e,O),O}catch(t){throw d(t)}}),[l,r,d,e==null?void 0:e.onSuccess]),state:a}};var de=e=>{let{user:l,client:r,passkeyState:a,setPasskeyState:i}=_react.useContext.call(void 0, _chunkK6EKFGTEjs.y),d=_react.useCallback.call(void 0, o=>{var n;let u=_chunkK6EKFGTEjs.f.call(void 0, o);return i({status:"error",error:u}),(n=e==null?void 0:e.onError)==null||n.call(e,u),u},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, u=>_chunkK6EKFGTEjs.d.call(void 0, void 0,[u],function*({relyingParty:o}){var n,p,h,P;try{if(l)throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});i({status:"generating-challenege"});let{options:s}=yield r.auth.passkey.generateAuthenticationOptions(o);i({status:"awaiting-passkey"});let _=yield C({challenge:s.challenge,rpId:s.rp_id,extensions:{appid:(n=s.extensions)==null?void 0:n.app_id,credProps:(p=s.extensions)==null?void 0:p.cred_props,hmacCreateSecret:(h=s.extensions)==null?void 0:h.hmac_create_secret},timeout:s.timeout,allowCredentials:s.allow_credentials,userVerification:s.user_verification});i({status:"submitting-response"});let y=yield r.auth.passkey.loginWithPasskey(_chunkK6EKFGTEjs.b.call(void 0, _chunkK6EKFGTEjs.a.call(void 0, {},_),{clientExtensionResults:{}}),s.challenge,o);return i({status:"done"}),(P=e==null?void 0:e.onSuccess)==null||P.call(e,y.user,y.is_new_user),y.user}catch(s){throw d(s)}}),[r,d,e==null?void 0:e.onSuccess]),state:a}};exports.hasError = _chunkK6EKFGTEjs.H; exports.isConnected = _chunkK6EKFGTEjs.B; exports.isConnecting = _chunkK6EKFGTEjs.D; exports.isCreating = _chunkK6EKFGTEjs.G; exports.isDisconnected = _chunkK6EKFGTEjs.E; exports.isNotCreated = _chunkK6EKFGTEjs.F; exports.isReconnecting = _chunkK6EKFGTEjs.C; exports.needsRecovery = _chunkK6EKFGTEjs.I; exports.useLinkWithPasskey = oe; exports.useLoginWithPasskey = de;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privy-io/expo",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.2",
|
|
4
4
|
"description": "Expo client for the Privy Auth API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -45,8 +45,13 @@
|
|
|
45
45
|
"test": "jest --testMatch \"**/test/**/*.test.ts\"",
|
|
46
46
|
"test:ci": "npm run test"
|
|
47
47
|
},
|
|
48
|
+
"browserslist": [
|
|
49
|
+
"defaults",
|
|
50
|
+
"node >= 18",
|
|
51
|
+
"not op_mini all"
|
|
52
|
+
],
|
|
48
53
|
"dependencies": {
|
|
49
|
-
"@privy-io/js-sdk-core": "0.29.
|
|
54
|
+
"@privy-io/js-sdk-core": "0.29.2",
|
|
50
55
|
"react-fast-compare": "^3.2.2",
|
|
51
56
|
"zustand": "^4.4.1"
|
|
52
57
|
},
|
package/dist/chunk-FL4SBVAC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var vt=Object.defineProperty,bt=Object.defineProperties;var ft=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Ae=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var ke=(e,t,o)=>t in e?vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,k= exports.a =(e,t)=>{for(var o in t||(t={}))Ae.call(t,o)&&ke(e,o,t[o]);if(oe)for(var o of oe(t))Re.call(t,o)&&ke(e,o,t[o]);return e},V= exports.b =(e,t)=>bt(e,ft(t));var ur=(e,t)=>{var o={};for(var r in e)Ae.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Re.call(e,r)&&(o[r]=e[r]);return o};var v=(e,t,o)=>new Promise((r,l)=>{var a=d=>{try{s(o.next(d))}catch(n){l(n)}},c=d=>{try{s(o.throw(d))}catch(n){l(n)}},s=d=>d.done?r(d.value):Promise.resolve(d.value).then(a,c);s((o=o.apply(e,t)).next())});var _expoappleauthentication = require('expo-apple-authentication'); var it = _interopRequireWildcard(_expoappleauthentication);var _expoapplication = require('expo-application');var _expolinking = require('expo-linking'); var B = _interopRequireWildcard(_expolinking); var de = _interopRequireWildcard(_expolinking); var z = _interopRequireWildcard(_expolinking); var H = _interopRequireWildcard(_expolinking);var _exposecurestore = require('expo-secure-store'); var O = _interopRequireWildcard(_exposecurestore);var _expowebbrowser = require('expo-web-browser'); var re = _interopRequireWildcard(_expowebbrowser); var Ve = _interopRequireWildcard(_expowebbrowser);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _reactnative = require('react-native');var _jssdkcore = require('@privy-io/js-sdk-core'); var _jssdkcore2 = _interopRequireDefault(_jssdkcore);var _expocrypto = require('expo-crypto');var xe={name:"@privy-io/expo",version:"0.27.1",description:"Expo client for the Privy Auth API",keywords:["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],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"}},main:"./dist/esm/index.js",source:"./src/index.ts",types:"./dist/index.d.ts",files:["dist/**/*","LICENSE","README.md"],scripts:{build:"npx tsup --clean --minify",clean:"rm -rf dist .turbo",dev:"npx tsup --watch",format:'eslint "src/**/*.{ts,tsx,js,jsx}" --fix',"generate-types":"npx tsup --dts-only",lint:'eslint "src/**/*.{ts,tsx,js,jsx}" && npx tsc --noEmit',test:'jest --testMatch "**/test/**/*.test.ts"',"test:ci":"npm run test"},dependencies:{"@privy-io/js-sdk-core":"0.29.1","react-fast-compare":"^3.2.2",zustand:"^4.4.1"},devDependencies:{"@privy-io/eslint-config-custom":"*","@privy-io/tsconfig":"*","@simplewebauthn/types":"9.0.1","@svgr/core":"^8.1.0","@svgr/plugin-jsx":"^8.1.0","@svgr/plugin-svgo":"^8.1.0","@tsconfig/node16-strictest-esm":"^1.0.3","eslint-plugin-react-hooks":"^5.0.0-canary-7118f5dd7-20230705",tsup:"^6.2.3",typescript:"~5.5.3"},peerDependencies:{"@expo-google-fonts/inter":"*","@privy-io/expo-native-extensions":"0.0.3","expo-apple-authentication":"*","expo-application":"*","expo-constants":"*","expo-crypto":"*","expo-font":"*","expo-linking":"*","expo-secure-store":"*","expo-web-browser":"*",react:"*","react-native":"*","react-native-passkeys":"^0.3.0","react-native-safe-area-context":"*","react-native-svg":"*","react-native-webview":"*"},peerDependenciesMeta:{"@expo-google-fonts/inter":{optional:!0},"expo-font":{optional:!0}},publishConfig:{access:"public"}};var _reactnativewebview = require('react-native-webview'); var _reactnativewebview2 = _interopRequireDefault(_reactnativewebview);var Pe=({client:e,isClientReady:t,setWebViewState:o,webViewState:r,logLevel:l})=>{let a=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{a.current&&r==="loaded"&&e.setMessagePoster(a.current)},[e,a.current,r==="loaded"]),_react.useEffect.call(void 0, ()=>_reactnative.AppState.addEventListener("change",d=>v(void 0,null,function*(){a.current&&d==="active"&&((yield e.embeddedWallet.ping(500))||(a.current.reload(),o("reloading")))})).remove,[]);let c=_react.useCallback.call(void 0, s=>v(void 0,null,function*(){let{data:d}=s.nativeEvent;e.embeddedWallet.onMessage(JSON.parse(d))}),[e]);return t?_react2.default.createElement(_reactnativewebview2.default,{style:{flex:1},ref:a,cacheEnabled:!1,cacheMode:"LOAD_NO_CACHE",source:{uri:e.embeddedWallet.getURL()},webviewDebuggingEnabled:l==="DEBUG",onLoad:()=>o("loaded"),onError:console.error,onMessage:c}):null};function Ie(a){return v(this,arguments,function*({client:e,setSolanaWallet:t,createSolanaWalletCallbacks:o,setSolanaRecoveryFlowState:r,opts:l}){var c,s,d;t({status:"creating"});try{let{user:n}=yield e.user.get(),i=_jssdkcore.getAllUserEmbeddedSolanaWallets.call(void 0, n),u=i[0];if(l!=null&&l.recoveryMethod&&l.recoveryMethod!=="privy")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:"Unsupported recovery method for solana wallet."});if(!(l!=null&&l.createAdditional)&&u)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:"Solana wallet already exists for this user. Set `createAdditional` to `true` to create another wallet"});let y,b;if(u){let g=Math.max(...i.map(w=>w.wallet_index),0)+1,p=yield e.embeddedWallet.createAdditionalSolana({primaryPublicKey:u.address,hdWalletIndex:g});y=p.provider,b=p.user}else{let g=(c=_jssdkcore.getUserEmbeddedWallet.call(void 0, n))!=null?c:void 0;if(g&&g.recovery_method!=="privy")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:"Existing wallet uses unsupported recovery method for solana wallet."});let p=yield e.embeddedWallet.createSolana({ethereumAccount:g});y=p.provider,b=p.user}let m=_jssdkcore.getAllUserEmbeddedSolanaWallets.call(void 0, b)[0];if(!m)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:"Unknown error creating solana wallet"});return(d=(s=o.current)==null?void 0:s.onSuccess)==null||d.call(s,y),t({status:"connected",publicKey:m.public_key}),r({status:"initial"}),y}catch(n){let i=n instanceof Error?n.message:"Error creating embedded wallet";throw t({status:"error",error:i}),r({status:"initial"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:i})}})}function ae(n){return v(this,arguments,function*({client:e,account:t,setWallet:o,recoverWalletCallbacks:r,recoveryMethod:l,setRecoveryFlowState:a,password:c,recoveryToken:s,recoverySecretOverride:d}){var i,u,y,b;if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});switch(l){case"user-passcode":if(!c)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!s)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!d)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Record name is required for icloud recovery method"});break}o({status:"connecting",account:t});try{let m=yield e.embeddedWallet.getProvider(t,c,s,d);return o({status:"connected",provider:m,account:t}),a({status:"initial"}),(u=(i=r.current)==null?void 0:i.onSuccess)==null||u.call(i,m),m}catch(m){o({status:"needs-recovery",account:t}),a({status:"initial"});let g=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:m instanceof Error?m.message:"Error recovering embedded wallet"});throw(b=(y=r.current)==null?void 0:y.onError)==null||b.call(y,g),g}})}function Le(a){return v(this,arguments,function*({client:e,primaryAcount:t,setSolanaWallet:o,recoverSolanaWalletCallbacks:r,setSolanaRecoveryFlowState:l}){var c,s,d,n;if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});o({status:"connecting"});try{let i=yield e.embeddedWallet.getSolanaProvider(t);return o({status:"connected",publicKey:i._publicKey}),l({status:"initial"}),(s=(c=r.current)==null?void 0:c.onSuccess)==null||s.call(c,i),i}catch(i){o({status:"needs-recovery"}),l({status:"initial"});let u=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:i instanceof Error?i.message:"Error recovering embedded wallet"});throw(n=(d=r.current)==null?void 0:d.onError)==null||n.call(d,u),u}})}var Fe=({client:e,user:t,solanaWallet:o,setSolanaWallet:r,setSolanaRecoveryFlowState:l,webViewState:a,createSolanaWalletCallbacks:c,recoverSolanaWalletCallbacks:s})=>{let d=_react.useMemo.call(void 0, ()=>_jssdkcore.getAllUserEmbeddedSolanaWallets.call(void 0, t),[t]),n=_react.useMemo.call(void 0, ()=>d[0],[d]),i=_react.useMemo.call(void 0, ()=>d.map(m=>({address:m.address,publicKey:m.address,walletIndex:m.wallet_index,getProvider:()=>e.embeddedWallet.getSolanaProvider(m,n==null?void 0:n.public_key)})),[d,n,e]),u=_react.useCallback.call(void 0, m=>v(void 0,null,function*(){return yield Ie({client:e,setSolanaWallet:r,createSolanaWalletCallbacks:c,setSolanaRecoveryFlowState:l,opts:m})}),[e,c]),y=_react.useCallback.call(void 0, ()=>v(void 0,null,function*(){if(!n)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});return Le({client:e,primaryAcount:n,setSolanaWallet:r,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:l})}),[e,n]),b=_react.useCallback.call(void 0, ()=>v(void 0,null,function*(){if(!n)throw r({status:"not-created"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});r(m=>m.status==="connected"?{status:"reconnecting"}:{status:"connecting"});try{let m=yield e.embeddedWallet.getSolanaProvider(n);return r({status:"connected",publicKey:n.public_key}),m}catch(m){throw _jssdkcore.errorIndicatesRecoveryIsNeeded.call(void 0, m)?(r({status:"needs-recovery"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):m instanceof Error?(r({status:"error",error:m.message}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:m.message})):(r({status:"error",error:"Error loading embedded wallet"}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,n]);return _react.useEffect.call(void 0, ()=>{if(!t&&o.status!=="disconnected")return r({status:"disconnected"});a==="loaded"&&b().catch(()=>{})},[a,t,n]),_react.useEffect.call(void 0, ()=>{o.status==="error"&&o.error.includes("User must be logged in")&&b()},[o.status]),{create:u,recover:y,getProvider:b,wallets:i}};function ie(i){return v(this,arguments,function*({client:e,setWallet:t,createWalletCallbacks:o,recoveryMethod:r,setRecoveryFlowState:l,password:a,recoveryToken:c,recoverySecretOverride:s,iCloudRecordNameOverride:d,solanaAccount:n}){var y,b;switch(r){case"user-passcode":if(!a)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!c)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!s||!d)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery failed due to inability to store credentials"});break}t({status:"creating",account:null});let u=r==="icloud"?"icloud-native":r;try{let{provider:m,user:g}=yield e.embeddedWallet.create(a,u,c,s,d,n),p=_jssdkcore.getUserEmbeddedWallet.call(void 0, g);return(b=(y=o.current)==null?void 0:y.onSuccess)==null||b.call(y,m),t({status:"connected",provider:m,account:p}),l({status:"initial"}),m}catch(m){let g=m instanceof Error?m.message:"Error creating embedded wallet";throw t({status:"error",error:g,account:null}),l({status:"initial"}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_creation_error",error:g})}})}function De(){return v(this,null,function*(){try{return yield Promise.resolve().then(() => _interopRequireWildcard(require("@privy-io/expo-native-extensions")))}catch(e){throw new Error("@privy-io/expo-native-extensions not found. Ensure that you're explicitly including as a dependency, and running an Expo development build")}})}function fe(r){return v(this,arguments,function*({user:e,appId:t,client:o}){var s;if(_reactnative.Platform.OS==="android")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let l=yield De(),a=yield o.recovery.icloudAuth.getICloudConfiguration("expo-ios");if(!(a==null?void 0:a.container_identifier))throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:d,iCloudRecordName:n}=yield l.writeRecoverySecretToICloud({containerId:a.container_identifier,appId:t,userId:e.id});return{recoverySecret:d,iCloudRecordName:n}}catch(d){if(d instanceof Error){let n=(s=d.message.split("Caused by: ")[1])!=null?s:"Error writing to iCloud";throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:n})}throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}function je(o){return v(this,arguments,function*({walletAddress:e,client:t}){var d;if(_reactnative.Platform.OS==="android")throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let r=yield De(),a=(yield t.recovery.getRecoveryKeyMaterial(e)).icloud_record_name;if(!a)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"iCloud recovery not properly backed up."});let c=yield t.recovery.icloudAuth.getICloudConfiguration("expo-ios"),s=c==null?void 0:c.container_identifier;if(!s)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:n}=yield r.readRecoverySecretFromICloud({containerId:s,recordName:a});return{recoverySecret:n}}catch(n){if(n instanceof Error){let i=(d=n.message.split("Caused by: ")[1])!=null?d:"Error writing to iCloud";throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:i})}throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}var _reactfastcompare = require('react-fast-compare'); var _reactfastcompare2 = _interopRequireDefault(_reactfastcompare);var Ne=e=>t=>e(o=>_reactfastcompare2.default.call(void 0, o,t)?o:t);function x(e){return e instanceof Error||e instanceof _jssdkcore.PrivyApiError||e instanceof _jssdkcore.PrivyClientError?e:typeof e=="string"?new Error(e):new Error("Unknown error")}var Br=e=>new Promise(t=>setTimeout(t,e));function $r(){let e=_react.useRef.call(void 0, _reactnative.AppState.currentState);_react.useEffect.call(void 0, ()=>_reactnative.AppState.addEventListener("change",r=>{e.current=r}).remove,[]);function t(){return _reactnative.AppState.currentState}return{appState:e,getCurrentAppState:t}}function se(l){return v(this,arguments,function*({provider:e,redirectUri:t,client:o,onError:r}){try{let a;switch(e){case"google-drive":{let{url:n}=yield o.recovery.auth.generateURL(de.createURL(t||"/"));a=n;break}default:throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid provider",code:"embedded_wallet_recovery_error"})}let c=yield Ve.openAuthSessionAsync(a);if(_reactnative.Platform.OS==="android")return;if(c.type!=="success")throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth session failed",code:"embedded_wallet_recovery_error"});let{queryParams:s}=de.parse(c.url),d;switch(e){case"google-drive":{let{privy_oauth_state:n,privy_oauth_code:i}=s;if(!i||!n)throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth invalid credentials",code:"embedded_wallet_recovery_error"});d=yield Se({oAuthCode:i,oAuthState:n,client:o});break}default:throw new (0, _jssdkcore.PrivyClientError)({error:"Recovery OAuth invalid provider",code:"embedded_wallet_recovery_error"})}return d}catch(a){throw r==null||r(x(a)),a}})}function Se(r){return v(this,arguments,function*({oAuthCode:e,oAuthState:t,client:o}){let{access_token:l}=yield o.recovery.auth.authorize(e,t);if(!l)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:"login_with_oauth_returned_with_invalid_credentials"});return l})}function le(a){return v(this,arguments,function*({client:e,recoveryInput:t,setWalletRecoveryCallbacks:o,setRecoveryFlowState:r,setWallet:l}){var c,s,d,n;try{let{provider:i,user:u}=yield e.embeddedWallet.setRecovery(t),y=_jssdkcore.getUserEmbeddedWallet.call(void 0, u);return l({status:"connected",provider:i,account:y}),(s=(c=o.current)==null?void 0:c.onSuccess)==null||s.call(c,i),r({status:"initial"}),i}catch(i){let u=new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_set_recovery_error",error:i instanceof Error?i.message:"Error setting password on embedded wallet"});throw(n=(d=o.current)==null?void 0:d.onError)==null||n.call(d,u),r({status:"initial"}),u}})}function qe(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}:{recoveryMethod:e.recoveryMethod}}var Be=({client:e,user:t,appId:o,wallet:r,setWallet:l,setRecoveryFlowState:a,webViewState:c,createWalletCallbacks:s,recoverWalletCallbacks:d,setWalletRecoveryCallbacks:n})=>{let i=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedWallet.call(void 0, t),[t]),u=_react.useCallback.call(void 0, p=>v(void 0,null,function*(){var R,N;if(i)throw new (0, _jssdkcore.PrivyClientError)({error:"This user already has an embedded wallet",code:"embedded_wallet_already_exists"});let{user:w}=yield e.user.get(),{password:S,recoveryMethod:f}=qe(p),h,E,U;if(f==="google-drive"&&(h=yield se({provider:f,client:e,onError:(R=s.current)==null?void 0:R.onError}),a({status:"creating-wallet"}),!h))return null;if(f==="icloud"){if(!w)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before creating a wallet with iCloud."});let{recoverySecret:I,iCloudRecordName:L}=yield fe({user:w,appId:o,client:e});E=I,U=L}return yield ie({client:e,setWallet:l,createWalletCallbacks:s,recoveryMethod:f,setRecoveryFlowState:a,password:S,recoverySecretOverride:E,iCloudRecordNameOverride:U,solanaAccount:(N=_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, w))!=null?N:void 0})}),[e,i,t]),y=_react.useCallback.call(void 0, p=>v(void 0,null,function*(){var f;if(r.status!=="connected")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"});if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t))throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_set_recovery_error",error:"Cannot set user-controlled recovery for a user with an embedded Solana wallet."});_jssdkcore.throwIfInvalidRecoveryUpgradePath.call(void 0, {currentRecoveryMethod:i.recovery_method,upgradeToRecoveryMethod:p.recoveryMethod});let w,S;switch(p.recoveryMethod){case"privy":S=V(k({},p),{wallet:i});break;case"user-passcode":S=V(k({},p),{wallet:i,password:p.password});break;case"google-drive":if(w=yield se({provider:p.recoveryMethod,client:e,onError:(f=n.current)==null?void 0:f.onError}),a({status:"upgrading-recovery"}),!w)return null;S={recoveryMethod:"google-drive",wallet:i,recoveryAccessToken:w};break;case"icloud":if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before backing up to iCloud."});let{recoverySecret:h,iCloudRecordName:E}=yield fe({user:t,appId:o,client:e});S={recoveryMethod:"icloud-native",recoverySecretOverride:h,iCloudRecordNameOverride:E,wallet:i};break;default:throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}return le({client:e,recoveryInput:S,setWalletRecoveryCallbacks:n,setRecoveryFlowState:a,setWallet:l})}),[e,i,r.status,t]),b=_react.useCallback.call(void 0, p=>v(void 0,null,function*(){return y({recoveryMethod:"user-passcode",password:p})}),[e,i,r.status]),m=_react.useCallback.call(void 0, p=>v(void 0,null,function*(){var E;if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{password:w,recoveryMethod:S}=qe(p),f,h;if(S==="google-drive"&&(f=yield se({provider:S,client:e,onError:(E=d.current)==null?void 0:E.onError}),a({status:"recovering"}),!f))return null;if(S==="icloud"){if(!t)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_recovery_error",error:"User must be loaded before recovering via iCloud."});let{recoverySecret:U}=yield je({client:e,walletAddress:i.address});h=U}return ae({client:e,account:i,setWallet:l,recoverWalletCallbacks:d,recoveryMethod:S,setRecoveryFlowState:a,password:w,recoveryToken:f,recoverySecretOverride:h})}),[e,i]),g=_react.useCallback.call(void 0, ()=>v(void 0,null,function*(){if(!i)throw l({status:"not-created",account:null}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});l(p=>p.status==="connected"?{status:"reconnecting",account:i}:{status:"connecting",account:i});try{let p=yield e.embeddedWallet.getProvider(i);return l({status:"connected",provider:p,account:i}),p}catch(p){throw _jssdkcore.errorIndicatesRecoveryIsNeeded.call(void 0, p)?(l({status:"needs-recovery",account:i}),new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):p instanceof Error?(l({status:"error",error:p.message,account:i}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:p.message})):(l({status:"error",error:"Error loading embedded wallet",account:i}),new (0, _jssdkcore.PrivyClientError)({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,i]);return _react.useEffect.call(void 0, ()=>{if(!t&&r.status!=="disconnected")return l({status:"disconnected",account:null});c==="loaded"&&g().catch(()=>{})},[c,t,i]),_react.useEffect.call(void 0, ()=>{r.status==="error"&&r.error.includes("User must be logged in")&&g()},[r.status]),{create:u,recover:m,setPassword:b,setRecovery:y,getProvider:g}};var Ge=({client:e,user:t,isReady:o,customAuth:r})=>{let[l,a]=_react.useState.call(void 0, {status:"initial"});return _react.useEffect.call(void 0, ()=>{(()=>v(void 0,null,function*(){if(!(r!=null&&r.enabled)){a({status:"not-enabled"});return}a({status:"loading"});let{getCustomAccessToken:s,isLoading:d}=r;if(!(!o||d))try{let n=yield s();if(!n&&t){yield e.auth.logout(),a({status:"done"});return}if(!n){a({status:"done"});return}if(t){a({status:"done"});return}if(!(yield e.auth.customProvider.syncWithToken(n))){yield e.auth.logout(),a({status:"error",error:new (0, _jssdkcore.PrivyClientError)({error:"Failed to sync with custom auth provider",code:"third_party_auth_error"})});return}a({status:"done"})}catch(n){if(console.log("Error syncing with custom auth provider",n),a({status:"error",error:n}),t)throw yield e.auth.logout(),new (0, _jssdkcore.PrivyClientError)({error:"Third-party auth failed",code:"third_party_auth_error"})}}))()},[e,t,o,r==null?void 0:r.enabled,r==null?void 0:r.getCustomAccessToken,r==null?void 0:r.isLoading]),{customAuthState:l,customAuthStateIsSettled:l.status!=="loading"&&l.status!=="initial"}};var Ye=({client:e,user:t,isUserInitialized:o,oAuthState:r,oAuthCallbacks:l,setOAuthState:a,recoveryFlowState:c,oAuthStateRef:s})=>{let d=z.useURL(),n=_react.useCallback.call(void 0, i=>{var y,b;let u=x(i);a({status:"error",error:u}),(b=(y=l.current).onError)==null||b.call(y,u)},[a]);return _react.useEffect.call(void 0, ()=>{function i(){return v(this,null,function*(){var m,g;if(!d||r.status!=="loading"||c.status!=="initial")return;let{queryParams:u}=z.parse(d),{privy_oauth_state:y,privy_oauth_code:b}=u;if(!b||!y){a({status:"done"});return}try{let p,w;if(t)p=yield e.auth.oauth.linkWithCode(b,y);else{let S=yield e.auth.oauth.loginWithCode(b,y,void 0,void 0,s.current.disableSignup?"no-signup":"login-or-sign-up");p=S.user,w=!!S.is_new_user}return(g=(m=l.current).onSuccess)==null||g.call(m,p,w),s.current={},a({status:"done"}),yield z.openURL(d.split("?")[0])}catch(p){s.current={},n(p)}})}_reactnative.Platform.OS==="android"&&o&&i()},[d,o])};var Xe=({client:e,user:t,createWalletCallbacks:o,recoverWalletCallbacks:r,setWalletRecoveryCallbacks:l,recoveryFlowState:a,oAuthState:c,setRecoveryFlowState:s,setWallet:d,appStateVisible:n,webViewLoaded:i})=>{let u=H.useURL(),y=_react.useMemo.call(void 0, ()=>_jssdkcore.getUserEmbeddedWallet.call(void 0, t),[t]),b=_react.useCallback.call(void 0, m=>{var p,w,S,f;let g=x(m);a.status==="creating-wallet"?(w=(p=o.current).onError)==null||w.call(p,x(g)):(f=(S=r.current).onError)==null||f.call(S,x(g)),s({status:"initial"})},[a]);return _react.useEffect.call(void 0, ()=>{function m(){return v(this,null,function*(){var S;if(!u&&a.status!=="initial"&&n&&b(new Error("Recovery OAuth session failed")),!u||a.status==="initial"||c.status!=="initial"||!n||!i)return;let{queryParams:g}=H.parse(u),{privy_oauth_state:p,privy_oauth_code:w}=g;if(!(!w||!p)){yield H.openURL(u.split("?")[0]);try{let f=yield Se({oAuthCode:w,oAuthState:p,client:e});if(a.status==="creating-wallet"){let h=(S=_jssdkcore.getUserEmbeddedSolanaWallet.call(void 0, t))!=null?S:void 0;yield ie({client:e,setWallet:d,createWalletCallbacks:o,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:f,solanaAccount:h})}else if(a.status==="upgrading-recovery"){if(!y)throw new Error("Embedded wallet not found");yield le({client:e,recoveryInput:{recoveryMethod:"google-drive",wallet:y,recoveryAccessToken:f},setWalletRecoveryCallbacks:l,setRecoveryFlowState:s,setWallet:d})}else yield ae({client:e,account:y,setWallet:d,recoverWalletCallbacks:r,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:f})}catch(f){b(f)}}})}_reactnative.Platform.OS==="android"&&m()},[u,a.status,n,i])};var $e=({client:e,isUserInitialized:t,setIsUserInitialized:o})=>{_react.useEffect.call(void 0, ()=>{t||(()=>v(void 0,null,function*(){try{yield e.user.get()}catch(l){}finally{o(!0)}}))()},[t])};var _zustand = require('zustand');var A=class extends Error{constructor(o,r){super(r);this.code=o,this.error=r}};var ce={success:e=>({value:e}),error:e=>({error:e})};var Je=e=>{let t=Array.from(new Set(e)),o=t.length;return o===0?ce.error(new A("no_login_methods_available","No login methods available")):o>2?ce.error(new A("too_many_login_methods",`More than two (${o}) login methods were provided`)):ce.success(t)},Xo= exports.p =e=>e[0],$o= exports.q =(e,t)=>{if(e.length!==2)return null;let[o,r]=e;return t===o?r:o},Jo= exports.r ={email:"email",sms:"phone"};var er=1e3*60*5,q=_zustand.create.call(void 0, )((e,t)=>({privyElementsConfig:null,loginPromiseExecutor:null,isUIMounted:!1,updateUIMounted:o=>e({isUIMounted:o}),openLoginFlow:(o,r,l)=>new Promise((a,c)=>{if(r!==null)return c(new A("user_already_logged_in","User is already logged in"));if(!t().isUIMounted)return c(new A("privy_elements_not_ready","Privy Elements is not mounted"));if(t().loginPromiseExecutor!==null)return c(new A("existing_login_flow_in_progress","A login flow is already in progress"));let s=Je(o.loginMethods);if(s.error)return c(s.error);let d={loginMethods:s.value},n=setTimeout(()=>{c(new A("login_flow_timeout","The login flow timed out")),t().closeLoginFlow()},er);l(),e({loginPromiseExecutor:{resolve(u){clearTimeout(n),a(u)},reject(u){clearTimeout(n),c(u)}},privyElementsConfig:d})}),closeLoginFlow:()=>{var o;return(o=t().loginPromiseExecutor)==null||o.reject(new A("login_flow_closed","The login flow was closed")),e({privyElementsConfig:null,loginPromiseExecutor:null})}})),oa= exports.s =()=>q(e=>e.privyElementsConfig),aa= exports.t =()=>q(e=>e.openLoginFlow),na= exports.u =()=>q(e=>e.closeLoginFlow),tr=e=>{let{loginPromiseExecutor:t}=q.getState();t==null||t.resolve(e)},Qe=()=>tr,ia= exports.v =()=>{let e=q(t=>t.updateUIMounted);_react.useEffect.call(void 0, ()=>(e(!0),()=>{e(!1)}),[e])},da= exports.w =()=>q(e=>e.privyElementsConfig!==null);var ge=_react.createContext.call(void 0, {}),D;function Wa(e){return D?D.getAccessToken():e!=null&&e.strict?Promise.reject(new (0, _jssdkcore.PrivyClientError)({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 Ca=e=>{var Ce;let[t,o]=_react.useState.call(void 0, _reactnative.AppState.currentState==="active");_react.useEffect.call(void 0, ()=>{let M=_reactnative.AppState.addEventListener("change",yt=>{o(yt==="active")});return()=>{M.remove()}},[]);let[r,l]=_react.useState.call(void 0, !1),[a,c]=_react.useState.call(void 0, "loading"),[s,d]=_react.useState.call(void 0, !1),[n,i]=_react.useState.call(void 0, null),[u,y]=_react.useState.call(void 0, {status:"disconnected",account:null}),[b,m]=_react.useState.call(void 0, {status:"disconnected"}),[g,p]=_react.useState.call(void 0, {status:"initial"}),[w,S]=_react.useState.call(void 0, {status:"initial"}),f=_react.useRef.call(void 0, {}),[h,E]=_react.useState.call(void 0, {status:"initial"}),[U,R]=_react.useState.call(void 0, {status:"initial"}),[N,I]=_react.useState.call(void 0, {status:"initial"}),[L,K]=_react.useState.call(void 0, {status:"initial"}),[G,Y]=_react.useState.call(void 0, {status:"initial"}),X=_react.useRef.call(void 0, {}),pe=_react.useRef.call(void 0, {}),me=_react.useRef.call(void 0, {}),ye=_react.useRef.call(void 0, {}),_e=_react.useRef.call(void 0, {}),We=_react.useRef.call(void 0, {}),dt=Qe(),$=_react.useCallback.call(void 0, M=>{if(M){dt(M),Ne(i)(M);return}i(null),p({status:"initial"}),S({status:"initial"}),y({status:"disconnected",account:null})},[]),_=_react.useMemo.call(void 0, ()=>{let M=e.storage||ot;return e.client?(D=e.client,D.setCallbacks({setUser:$,setIsReady:d}),D):(D=new (0, _jssdkcore2.default)({storage:rt(M),appId:e.appId,clientId:e.clientId,supportedChains:e.supportedChains,nativeAppIdentifier:tt(),baseUrl:e.baseUrl,sdkVersion:`expo:${xe.version}`,callbacks:{setUser:$,setIsReady:d},logLevel:e.logLevel,crypto:{digest:_expocrypto.digest}}),D)},[e.client,e.storage,e.appId,e.clientId,e.baseUrl,e.supportedChains,e.logLevel,$]),st=_react.useCallback.call(void 0, ()=>($(null),_.auth.logout()),[$,_]),lt=_react.useCallback.call(void 0, ()=>_.getAccessToken(),[_]),ct=_react.useCallback.call(void 0, ()=>_.getIdentityToken(),[_]);$e({client:_,isUserInitialized:r,setIsUserInitialized:l});let ut=Be({client:_,user:n,appId:e.appId,webViewState:a,createWalletCallbacks:pe,recoverWalletCallbacks:me,setWalletRecoveryCallbacks:ye,setRecoveryFlowState:E,wallet:u,setWallet:y}),pt=Fe({client:_,user:n,webViewState:a,createSolanaWalletCallbacks:_e,recoverSolanaWalletCallbacks:We,setSolanaRecoveryFlowState:R,solanaWallet:b,setSolanaWallet:m});Ye({client:_,isUserInitialized:r,user:n,oAuthState:w,setOAuthState:S,oAuthCallbacks:X,recoveryFlowState:h,oAuthStateRef:f}),Xe({client:_,user:n,webViewLoaded:a==="loaded",createWalletCallbacks:pe,recoverWalletCallbacks:me,setWalletRecoveryCallbacks:ye,recoveryFlowState:h,oAuthState:w,setRecoveryFlowState:E,setWallet:y,appStateVisible:t});let{customAuthStateIsSettled:mt}=Ge({client:_,user:n,isReady:r,customAuth:(Ce=e.config)==null?void 0:Ce.customAuth});return _react2.default.createElement(_react2.default.Fragment,null,_react2.default.createElement(ge.Provider,{value:{client:_,user:n,isReady:a!=="loading"&&r&&et(w)&&mt,logout:st,getAccessToken:lt,getIdentityToken:ct,wallet:k(k({},u),ut),solanaWallet:k(k({},b),pt),oAuthState:w,oAuthCallbacks:X,recoveryFlowState:h,setRecoveryFlowState:E,solanaRecoveryFlowState:U,setSolanaRecoveryFlowState:R,createWalletCallbacks:pe,recoverWalletCallbacks:me,setWalletRecoveryCallbacks:ye,createSolanaWalletCallbacks:_e,recoverSolanaWalletCallbacks:We,setOAuthState:S,siweState:N,setSiweState:I,otpState:g,setOtpState:p,passkeyState:L,setPasskeyState:K,farcasterState:G,setFarcasterState:Y,oAuthStateRef:f}},e.children),_react2.default.createElement(_reactnative.View,{style:{width:0,height:0,overflow:"hidden"}},_react2.default.createElement(Pe,{logLevel:e.logLevel,client:_,isClientReady:s,setWebViewState:c,webViewState:a})))};var et=e=>e.status!=="loading",Ee=(e={})=>{let{user:t,oAuthState:o,setOAuthState:r,oAuthCallbacks:l,client:a,oAuthStateRef:c}=_react.useContext.call(void 0, ge),s=e.action?e.action==="login":!t;_react.useEffect.call(void 0, ()=>{l.current={onSuccess:e.onSuccess,onError:e.onError}},[e.onSuccess,e.onError]);let d=_react.useCallback.call(void 0, i=>{var y;let u=x(i);return r({status:"error",error:u}),(y=e==null?void 0:e.onError)==null||y.call(e,u),u},[e==null?void 0:e.onError]);return{start:_react.useCallback.call(void 0, function(g){return v(this,arguments,function*({provider:u,redirectUri:y,isLegacyAppleIosBehaviorEnabled:b=!1,disableSignup:m}){var p,w,S;r({status:"loading"}),c.current={disableSignup:m};try{if(t&&e.action==="login")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!t&&e.action==="link")throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});let{url:f}=yield a.auth.oauth.generateURL(u,B.createURL(y||"/")),h,E;if(_reactnative.Platform.OS==="ios"&&u==="apple"&&!b){let G=(p=new URL(f).searchParams.get("state"))!=null?p:"",Y=yield it.signInAsync({state:G});if(!Y.authorizationCode)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let X=yield a.auth.oauth.loginWithCode(Y.authorizationCode,G,u,"raw",m?"no-signup":"login-or-sign-up");h=X.user,E=X.is_new_user}else h=yield a.auth.oauth.linkWithCode(Y.authorizationCode,G,u,"raw");return(w=e==null?void 0:e.onSuccess)==null||w.call(e,h,E),r({status:"done"}),h!=null?h:void 0}let U=_reactnative.Platform.OS==="android"?f.replace("x.com","twitter.com"):f,R=yield re.openAuthSessionAsync(U);if(_reactnative.Platform.OS==="android")return;if(R.type!=="success")throw[re.WebBrowserResultType.CANCEL,re.WebBrowserResultType.DISMISS].includes(R.type)?new (0, _jssdkcore.PrivyClientError)({error:"OAuth was cancelled",code:s?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):new (0, _jssdkcore.PrivyClientError)({error:"OAuth session failed",code:s?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let{queryParams:N}=B.parse(R.url),{privy_oauth_state:I,privy_oauth_code:L}=N;if(!L||!I)throw new (0, _jssdkcore.PrivyClientError)({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let K=yield a.auth.oauth.loginWithCode(L,I,u,void 0,m?"no-signup":"login-or-sign-up");h=K.user,E=K.is_new_user}else h=yield a.auth.oauth.linkWithCode(L,I,u);return(S=e==null?void 0:e.onSuccess)==null||S.call(e,h,E),yield B.openURL(R.url.split("?")[0]),r({status:"done"}),h!=null?h:void 0}catch(f){d(f)}})},[t,a,r,d]),state:o}};function La(e){let{state:t,start:o}=Ee(V(k({},e),{action:"login"}));return{state:t,login:o}}function Ma(e){let{state:t,start:o}=Ee(V(k({},e),{action:"link"}));return{state:t,link:o}}function Fa(e){return Ee(e)}var tt=()=>{if(typeof _expoapplication.applicationId!="string")throw new (0, _jssdkcore.PrivyClientError)({error:"Cannot determine native application ID. Please make sure `expo-application` is installed as a dependency and that `ios.bundleId` or `android.package` is set.",code:"invalid_native_app_id"});return _expoapplication.applicationId};function rt(e){return{get(t){return e.get(t.replaceAll(":","-"))},put(t,o){return e.put(t.replaceAll(":","-"),o)},del(t){return e.del(t.replaceAll(":","-"))},getKeys:()=>v(this,null,function*(){return[]})}}var ot={get(e){return O.getItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},put(e,t){return O.setItemAsync(e,t,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},del(e){return O.deleteItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},getKeys:()=>v(void 0,null,function*(){return[]})};function ja(e){return e.status==="connected"}function Na(e){return e.status==="reconnecting"}function Va(e){return e.status==="connecting"}function za(e){return e.status==="disconnected"}function Ha(e){return e.status==="not-created"}function qa(e){return e.status==="creating"}function Ba(e){return e.status==="error"}function Ka(e){return e.status==="needs-recovery"}exports.a = k; exports.b = V; exports.c = ur; exports.d = v; exports.e = xe; exports.f = x; exports.g = Br; exports.h = $r; exports.i = La; exports.j = Ma; exports.k = Fa; exports.l = tt; exports.m = rt; exports.n = ot; exports.o = A; exports.p = Xo; exports.q = $o; exports.r = Jo; exports.s = oa; exports.t = aa; exports.u = na; exports.v = ia; exports.w = da; exports.x = ge; exports.y = Wa; exports.z = Ca; exports.A = ja; exports.B = Na; exports.C = Va; exports.D = za; exports.E = Ha; exports.F = qa; exports.G = Ba; exports.H = Ka;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var vt=Object.defineProperty,bt=Object.defineProperties;var ft=Object.getOwnPropertyDescriptors;var oe=Object.getOwnPropertySymbols;var Ae=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var ke=(e,t,o)=>t in e?vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,k=(e,t)=>{for(var o in t||(t={}))Ae.call(t,o)&&ke(e,o,t[o]);if(oe)for(var o of oe(t))Re.call(t,o)&&ke(e,o,t[o]);return e},V=(e,t)=>bt(e,ft(t));var ur=(e,t)=>{var o={};for(var r in e)Ae.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Re.call(e,r)&&(o[r]=e[r]);return o};var v=(e,t,o)=>new Promise((r,l)=>{var a=d=>{try{s(o.next(d))}catch(n){l(n)}},c=d=>{try{s(o.throw(d))}catch(n){l(n)}},s=d=>d.done?r(d.value):Promise.resolve(d.value).then(a,c);s((o=o.apply(e,t)).next())});import*as it from"expo-apple-authentication";import{applicationId as at}from"expo-application";import*as B from"expo-linking";import*as O from"expo-secure-store";import*as re from"expo-web-browser";import{useCallback as nt,useContext as lr,useEffect as cr}from"react";import{Platform as he}from"react-native";import{PrivyClientError as j}from"@privy-io/js-sdk-core";import{digest as rr}from"expo-crypto";import te,{useState as W,useMemo as or,createContext as ar,useCallback as ue,useRef as T,useEffect as nr}from"react";import{AppState as Ze,View as ir}from"react-native";import dr,{PrivyClientError as sr}from"@privy-io/js-sdk-core";var xe={name:"@privy-io/expo",version:"0.27.1",description:"Expo client for the Privy Auth API",keywords:["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],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"}},main:"./dist/esm/index.js",source:"./src/index.ts",types:"./dist/index.d.ts",files:["dist/**/*","LICENSE","README.md"],scripts:{build:"npx tsup --clean --minify",clean:"rm -rf dist .turbo",dev:"npx tsup --watch",format:'eslint "src/**/*.{ts,tsx,js,jsx}" --fix',"generate-types":"npx tsup --dts-only",lint:'eslint "src/**/*.{ts,tsx,js,jsx}" && npx tsc --noEmit',test:'jest --testMatch "**/test/**/*.test.ts"',"test:ci":"npm run test"},dependencies:{"@privy-io/js-sdk-core":"0.29.1","react-fast-compare":"^3.2.2",zustand:"^4.4.1"},devDependencies:{"@privy-io/eslint-config-custom":"*","@privy-io/tsconfig":"*","@simplewebauthn/types":"9.0.1","@svgr/core":"^8.1.0","@svgr/plugin-jsx":"^8.1.0","@svgr/plugin-svgo":"^8.1.0","@tsconfig/node16-strictest-esm":"^1.0.3","eslint-plugin-react-hooks":"^5.0.0-canary-7118f5dd7-20230705",tsup:"^6.2.3",typescript:"~5.5.3"},peerDependencies:{"@expo-google-fonts/inter":"*","@privy-io/expo-native-extensions":"0.0.3","expo-apple-authentication":"*","expo-application":"*","expo-constants":"*","expo-crypto":"*","expo-font":"*","expo-linking":"*","expo-secure-store":"*","expo-web-browser":"*",react:"*","react-native":"*","react-native-passkeys":"^0.3.0","react-native-safe-area-context":"*","react-native-svg":"*","react-native-webview":"*"},peerDependenciesMeta:{"@expo-google-fonts/inter":{optional:!0},"expo-font":{optional:!0}},publishConfig:{access:"public"}};import St from"react";import{useCallback as gt,useEffect as Oe,useRef as ht}from"react";import{AppState as Et}from"react-native";import _t from"react-native-webview";var Pe=({client:e,isClientReady:t,setWebViewState:o,webViewState:r,logLevel:l})=>{let a=ht(null);Oe(()=>{a.current&&r==="loaded"&&e.setMessagePoster(a.current)},[e,a.current,r==="loaded"]),Oe(()=>Et.addEventListener("change",d=>v(void 0,null,function*(){a.current&&d==="active"&&((yield e.embeddedWallet.ping(500))||(a.current.reload(),o("reloading")))})).remove,[]);let c=gt(s=>v(void 0,null,function*(){let{data:d}=s.nativeEvent;e.embeddedWallet.onMessage(JSON.parse(d))}),[e]);return t?St.createElement(_t,{style:{flex:1},ref:a,cacheEnabled:!1,cacheMode:"LOAD_NO_CACHE",source:{uri:e.embeddedWallet.getURL()},webviewDebuggingEnabled:l==="DEBUG",onLoad:()=>o("loaded"),onError:console.error,onMessage:c}):null};import{useCallback as ve,useEffect as Me,useMemo as be}from"react";import{errorIndicatesRecoveryIsNeeded as Ct,getAllUserEmbeddedSolanaWallets as kt,PrivyClientError as Q}from"@privy-io/js-sdk-core";import{getAllUserEmbeddedSolanaWallets as Ue,getUserEmbeddedWallet as Wt}from"@privy-io/js-sdk-core";import{PrivyClientError as J}from"@privy-io/js-sdk-core";function Ie(a){return v(this,arguments,function*({client:e,setSolanaWallet:t,createSolanaWalletCallbacks:o,setSolanaRecoveryFlowState:r,opts:l}){var c,s,d;t({status:"creating"});try{let{user:n}=yield e.user.get(),i=Ue(n),u=i[0];if(l!=null&&l.recoveryMethod&&l.recoveryMethod!=="privy")throw new J({code:"embedded_wallet_creation_error",error:"Unsupported recovery method for solana wallet."});if(!(l!=null&&l.createAdditional)&&u)throw new J({code:"embedded_wallet_creation_error",error:"Solana wallet already exists for this user. Set `createAdditional` to `true` to create another wallet"});let y,b;if(u){let g=Math.max(...i.map(w=>w.wallet_index),0)+1,p=yield e.embeddedWallet.createAdditionalSolana({primaryPublicKey:u.address,hdWalletIndex:g});y=p.provider,b=p.user}else{let g=(c=Wt(n))!=null?c:void 0;if(g&&g.recovery_method!=="privy")throw new J({code:"embedded_wallet_creation_error",error:"Existing wallet uses unsupported recovery method for solana wallet."});let p=yield e.embeddedWallet.createSolana({ethereumAccount:g});y=p.provider,b=p.user}let m=Ue(b)[0];if(!m)throw new J({code:"embedded_wallet_creation_error",error:"Unknown error creating solana wallet"});return(d=(s=o.current)==null?void 0:s.onSuccess)==null||d.call(s,y),t({status:"connected",publicKey:m.public_key}),r({status:"initial"}),y}catch(n){let i=n instanceof Error?n.message:"Error creating embedded wallet";throw t({status:"error",error:i}),r({status:"initial"}),new J({code:"embedded_wallet_creation_error",error:i})}})}import{PrivyClientError as F}from"@privy-io/js-sdk-core";function ae(n){return v(this,arguments,function*({client:e,account:t,setWallet:o,recoverWalletCallbacks:r,recoveryMethod:l,setRecoveryFlowState:a,password:c,recoveryToken:s,recoverySecretOverride:d}){var i,u,y,b;if(!t)throw new F({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});switch(l){case"user-passcode":if(!c)throw new F({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!s)throw new F({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!d)throw new F({code:"embedded_wallet_recovery_error",error:"Record name is required for icloud recovery method"});break}o({status:"connecting",account:t});try{let m=yield e.embeddedWallet.getProvider(t,c,s,d);return o({status:"connected",provider:m,account:t}),a({status:"initial"}),(u=(i=r.current)==null?void 0:i.onSuccess)==null||u.call(i,m),m}catch(m){o({status:"needs-recovery",account:t}),a({status:"initial"});let g=new F({code:"embedded_wallet_recovery_error",error:m instanceof Error?m.message:"Error recovering embedded wallet"});throw(b=(y=r.current)==null?void 0:y.onError)==null||b.call(y,g),g}})}function Le(a){return v(this,arguments,function*({client:e,primaryAcount:t,setSolanaWallet:o,recoverSolanaWalletCallbacks:r,setSolanaRecoveryFlowState:l}){var c,s,d,n;if(!t)throw new F({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});o({status:"connecting"});try{let i=yield e.embeddedWallet.getSolanaProvider(t);return o({status:"connected",publicKey:i._publicKey}),l({status:"initial"}),(s=(c=r.current)==null?void 0:c.onSuccess)==null||s.call(c,i),i}catch(i){o({status:"needs-recovery"}),l({status:"initial"});let u=new F({code:"embedded_wallet_recovery_error",error:i instanceof Error?i.message:"Error recovering embedded wallet"});throw(n=(d=r.current)==null?void 0:d.onError)==null||n.call(d,u),u}})}var Fe=({client:e,user:t,solanaWallet:o,setSolanaWallet:r,setSolanaRecoveryFlowState:l,webViewState:a,createSolanaWalletCallbacks:c,recoverSolanaWalletCallbacks:s})=>{let d=be(()=>kt(t),[t]),n=be(()=>d[0],[d]),i=be(()=>d.map(m=>({address:m.address,publicKey:m.address,walletIndex:m.wallet_index,getProvider:()=>e.embeddedWallet.getSolanaProvider(m,n==null?void 0:n.public_key)})),[d,n,e]),u=ve(m=>v(void 0,null,function*(){return yield Ie({client:e,setSolanaWallet:r,createSolanaWalletCallbacks:c,setSolanaRecoveryFlowState:l,opts:m})}),[e,c]),y=ve(()=>v(void 0,null,function*(){if(!n)throw new Q({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});return Le({client:e,primaryAcount:n,setSolanaWallet:r,recoverSolanaWalletCallbacks:s,setSolanaRecoveryFlowState:l})}),[e,n]),b=ve(()=>v(void 0,null,function*(){if(!n)throw r({status:"not-created"}),new Q({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});r(m=>m.status==="connected"?{status:"reconnecting"}:{status:"connecting"});try{let m=yield e.embeddedWallet.getSolanaProvider(n);return r({status:"connected",publicKey:n.public_key}),m}catch(m){throw Ct(m)?(r({status:"needs-recovery"}),new Q({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):m instanceof Error?(r({status:"error",error:m.message}),new Q({code:"unknown_embedded_wallet_error",error:m.message})):(r({status:"error",error:"Error loading embedded wallet"}),new Q({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,n]);return Me(()=>{if(!t&&o.status!=="disconnected")return r({status:"disconnected"});a==="loaded"&&b().catch(()=>{})},[a,t,n]),Me(()=>{o.status==="error"&&o.error.includes("User must be logged in")&&b()},[o.status]),{create:u,recover:y,getProvider:b,wallets:i}};import{useCallback as ee,useEffect as ze,useMemo as Ft}from"react";import{getUserEmbeddedSolanaWallet as He,throwIfInvalidRecoveryUpgradePath as Tt}from"@privy-io/js-sdk-core";import{errorIndicatesRecoveryIsNeeded as Dt,getUserEmbeddedWallet as jt,PrivyClientError as C}from"@privy-io/js-sdk-core";import{getUserEmbeddedWallet as At}from"@privy-io/js-sdk-core";import{PrivyClientError as ne}from"@privy-io/js-sdk-core";function ie(i){return v(this,arguments,function*({client:e,setWallet:t,createWalletCallbacks:o,recoveryMethod:r,setRecoveryFlowState:l,password:a,recoveryToken:c,recoverySecretOverride:s,iCloudRecordNameOverride:d,solanaAccount:n}){var y,b;switch(r){case"user-passcode":if(!a)throw new ne({code:"embedded_wallet_recovery_error",error:"password is required for user-passcode recovery method"});break;case"google-drive":if(!c)throw new ne({code:"embedded_wallet_recovery_error",error:"Recovery token is required for google-drive recovery method"});break;case"icloud":if(!s||!d)throw new ne({code:"embedded_wallet_recovery_error",error:"iCloud recovery failed due to inability to store credentials"});break}t({status:"creating",account:null});let u=r==="icloud"?"icloud-native":r;try{let{provider:m,user:g}=yield e.embeddedWallet.create(a,u,c,s,d,n),p=At(g);return(b=(y=o.current)==null?void 0:y.onSuccess)==null||b.call(y,m),t({status:"connected",provider:m,account:p}),l({status:"initial"}),m}catch(m){let g=m instanceof Error?m.message:"Error creating embedded wallet";throw t({status:"error",error:g,account:null}),l({status:"initial"}),new ne({code:"embedded_wallet_creation_error",error:g})}})}import{Platform as Te}from"react-native";import{PrivyClientError as P}from"@privy-io/js-sdk-core";function De(){return v(this,null,function*(){try{return yield import("@privy-io/expo-native-extensions")}catch(e){throw new Error("@privy-io/expo-native-extensions not found. Ensure that you're explicitly including as a dependency, and running an Expo development build")}})}function fe(r){return v(this,arguments,function*({user:e,appId:t,client:o}){var s;if(Te.OS==="android")throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let l=yield De(),a=yield o.recovery.icloudAuth.getICloudConfiguration("expo-ios");if(!(a==null?void 0:a.container_identifier))throw new P({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:d,iCloudRecordName:n}=yield l.writeRecoverySecretToICloud({containerId:a.container_identifier,appId:t,userId:e.id});return{recoverySecret:d,iCloudRecordName:n}}catch(d){if(d instanceof Error){let n=(s=d.message.split("Caused by: ")[1])!=null?s:"Error writing to iCloud";throw new P({code:"embedded_wallet_recovery_error",error:n})}throw new P({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}function je(o){return v(this,arguments,function*({walletAddress:e,client:t}){var d;if(Te.OS==="android")throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery is not supported on Android"});let r=yield De(),a=(yield t.recovery.getRecoveryKeyMaterial(e)).icloud_record_name;if(!a)throw new P({code:"embedded_wallet_recovery_error",error:"iCloud recovery not properly backed up."});let c=yield t.recovery.icloudAuth.getICloudConfiguration("expo-ios"),s=c==null?void 0:c.container_identifier;if(!s)throw new P({code:"embedded_wallet_recovery_error",error:"An iCloud Container ID must be specified in the Privy Dashboard."});try{let{recoverySecret:n}=yield r.readRecoverySecretFromICloud({containerId:s,recordName:a});return{recoverySecret:n}}catch(n){if(n instanceof Error){let i=(d=n.message.split("Caused by: ")[1])!=null?d:"Error writing to iCloud";throw new P({code:"embedded_wallet_recovery_error",error:i})}throw new P({code:"embedded_wallet_recovery_error",error:"Error writing to iCloud"})}})}import*as de from"expo-linking";import*as Ve from"expo-web-browser";import{Platform as It}from"react-native";import{PrivyClientError as Z}from"@privy-io/js-sdk-core";import Rt from"react-fast-compare";var Ne=e=>t=>e(o=>Rt(o,t)?o:t);import{PrivyApiError as xt,PrivyClientError as Ot}from"@privy-io/js-sdk-core";function x(e){return e instanceof Error||e instanceof xt||e instanceof Ot?e:typeof e=="string"?new Error(e):new Error("Unknown error")}var Br=e=>new Promise(t=>setTimeout(t,e));import{useEffect as Pt,useRef as Ut}from"react";import{AppState as we}from"react-native";function $r(){let e=Ut(we.currentState);Pt(()=>we.addEventListener("change",r=>{e.current=r}).remove,[]);function t(){return we.currentState}return{appState:e,getCurrentAppState:t}}function se(l){return v(this,arguments,function*({provider:e,redirectUri:t,client:o,onError:r}){try{let a;switch(e){case"google-drive":{let{url:n}=yield o.recovery.auth.generateURL(de.createURL(t||"/"));a=n;break}default:throw new Z({error:"OAuth invalid provider",code:"embedded_wallet_recovery_error"})}let c=yield Ve.openAuthSessionAsync(a);if(It.OS==="android")return;if(c.type!=="success")throw new Z({error:"Recovery OAuth session failed",code:"embedded_wallet_recovery_error"});let{queryParams:s}=de.parse(c.url),d;switch(e){case"google-drive":{let{privy_oauth_state:n,privy_oauth_code:i}=s;if(!i||!n)throw new Z({error:"Recovery OAuth invalid credentials",code:"embedded_wallet_recovery_error"});d=yield Se({oAuthCode:i,oAuthState:n,client:o});break}default:throw new Z({error:"Recovery OAuth invalid provider",code:"embedded_wallet_recovery_error"})}return d}catch(a){throw r==null||r(x(a)),a}})}function Se(r){return v(this,arguments,function*({oAuthCode:e,oAuthState:t,client:o}){let{access_token:l}=yield o.recovery.auth.authorize(e,t);if(!l)throw new Z({error:"OAuth invalid credentials",code:"login_with_oauth_returned_with_invalid_credentials"});return l})}import{getUserEmbeddedWallet as Lt,PrivyClientError as Mt}from"@privy-io/js-sdk-core";function le(a){return v(this,arguments,function*({client:e,recoveryInput:t,setWalletRecoveryCallbacks:o,setRecoveryFlowState:r,setWallet:l}){var c,s,d,n;try{let{provider:i,user:u}=yield e.embeddedWallet.setRecovery(t),y=Lt(u);return l({status:"connected",provider:i,account:y}),(s=(c=o.current)==null?void 0:c.onSuccess)==null||s.call(c,i),r({status:"initial"}),i}catch(i){let u=new Mt({code:"embedded_wallet_set_recovery_error",error:i instanceof Error?i.message:"Error setting password on embedded wallet"});throw(n=(d=o.current)==null?void 0:d.onError)==null||n.call(d,u),r({status:"initial"}),u}})}function qe(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}:{recoveryMethod:e.recoveryMethod}}var Be=({client:e,user:t,appId:o,wallet:r,setWallet:l,setRecoveryFlowState:a,webViewState:c,createWalletCallbacks:s,recoverWalletCallbacks:d,setWalletRecoveryCallbacks:n})=>{let i=Ft(()=>jt(t),[t]),u=ee(p=>v(void 0,null,function*(){var R,N;if(i)throw new C({error:"This user already has an embedded wallet",code:"embedded_wallet_already_exists"});let{user:w}=yield e.user.get(),{password:S,recoveryMethod:f}=qe(p),h,E,U;if(f==="google-drive"&&(h=yield se({provider:f,client:e,onError:(R=s.current)==null?void 0:R.onError}),a({status:"creating-wallet"}),!h))return null;if(f==="icloud"){if(!w)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before creating a wallet with iCloud."});let{recoverySecret:I,iCloudRecordName:L}=yield fe({user:w,appId:o,client:e});E=I,U=L}return yield ie({client:e,setWallet:l,createWalletCallbacks:s,recoveryMethod:f,setRecoveryFlowState:a,password:S,recoverySecretOverride:E,iCloudRecordNameOverride:U,solanaAccount:(N=He(w))!=null?N:void 0})}),[e,i,t]),y=ee(p=>v(void 0,null,function*(){var f;if(r.status!=="connected")throw new C({code:"attempted_to_set_password_before_connected",error:"Embedded wallet must be connected before setting password"});if(!i)throw new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});if(He(t))throw new C({code:"embedded_wallet_set_recovery_error",error:"Cannot set user-controlled recovery for a user with an embedded Solana wallet."});Tt({currentRecoveryMethod:i.recovery_method,upgradeToRecoveryMethod:p.recoveryMethod});let w,S;switch(p.recoveryMethod){case"privy":S=V(k({},p),{wallet:i});break;case"user-passcode":S=V(k({},p),{wallet:i,password:p.password});break;case"google-drive":if(w=yield se({provider:p.recoveryMethod,client:e,onError:(f=n.current)==null?void 0:f.onError}),a({status:"upgrading-recovery"}),!w)return null;S={recoveryMethod:"google-drive",wallet:i,recoveryAccessToken:w};break;case"icloud":if(!t)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before backing up to iCloud."});let{recoverySecret:h,iCloudRecordName:E}=yield fe({user:t,appId:o,client:e});S={recoveryMethod:"icloud-native",recoverySecretOverride:h,iCloudRecordNameOverride:E,wallet:i};break;default:throw new C({code:"embedded_wallet_recovery_error",error:"Unrecognized recovery method"})}return le({client:e,recoveryInput:S,setWalletRecoveryCallbacks:n,setRecoveryFlowState:a,setWallet:l})}),[e,i,r.status,t]),b=ee(p=>v(void 0,null,function*(){return y({recoveryMethod:"user-passcode",password:p})}),[e,i,r.status]),m=ee(p=>v(void 0,null,function*(){var E;if(!i)throw new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});let{password:w,recoveryMethod:S}=qe(p),f,h;if(S==="google-drive"&&(f=yield se({provider:S,client:e,onError:(E=d.current)==null?void 0:E.onError}),a({status:"recovering"}),!f))return null;if(S==="icloud"){if(!t)throw new C({code:"embedded_wallet_recovery_error",error:"User must be loaded before recovering via iCloud."});let{recoverySecret:U}=yield je({client:e,walletAddress:i.address});h=U}return ae({client:e,account:i,setWallet:l,recoverWalletCallbacks:d,recoveryMethod:S,setRecoveryFlowState:a,password:w,recoveryToken:f,recoverySecretOverride:h})}),[e,i]),g=ee(()=>v(void 0,null,function*(){if(!i)throw l({status:"not-created",account:null}),new C({code:"embedded_wallet_does_not_exist",error:"Embedded wallet does not exist"});l(p=>p.status==="connected"?{status:"reconnecting",account:i}:{status:"connecting",account:i});try{let p=yield e.embeddedWallet.getProvider(i);return l({status:"connected",provider:p,account:i}),p}catch(p){throw Dt(p)?(l({status:"needs-recovery",account:i}),new C({code:"embedded_wallet_needs_recovery",error:"Embedded wallet not loaded on device"})):p instanceof Error?(l({status:"error",error:p.message,account:i}),new C({code:"unknown_embedded_wallet_error",error:p.message})):(l({status:"error",error:"Error loading embedded wallet",account:i}),new C({code:"unknown_embedded_wallet_error",error:"Error loading embedded wallet"}))}}),[e,i]);return ze(()=>{if(!t&&r.status!=="disconnected")return l({status:"disconnected",account:null});c==="loaded"&&g().catch(()=>{})},[c,t,i]),ze(()=>{r.status==="error"&&r.error.includes("User must be logged in")&&g()},[r.status]),{create:u,recover:m,setPassword:b,setRecovery:y,getProvider:g}};import{useEffect as Nt,useState as Vt}from"react";import{PrivyClientError as Ke}from"@privy-io/js-sdk-core";var Ge=({client:e,user:t,isReady:o,customAuth:r})=>{let[l,a]=Vt({status:"initial"});return Nt(()=>{(()=>v(void 0,null,function*(){if(!(r!=null&&r.enabled)){a({status:"not-enabled"});return}a({status:"loading"});let{getCustomAccessToken:s,isLoading:d}=r;if(!(!o||d))try{let n=yield s();if(!n&&t){yield e.auth.logout(),a({status:"done"});return}if(!n){a({status:"done"});return}if(t){a({status:"done"});return}if(!(yield e.auth.customProvider.syncWithToken(n))){yield e.auth.logout(),a({status:"error",error:new Ke({error:"Failed to sync with custom auth provider",code:"third_party_auth_error"})});return}a({status:"done"})}catch(n){if(console.log("Error syncing with custom auth provider",n),a({status:"error",error:n}),t)throw yield e.auth.logout(),new Ke({error:"Third-party auth failed",code:"third_party_auth_error"})}}))()},[e,t,o,r==null?void 0:r.enabled,r==null?void 0:r.getCustomAccessToken,r==null?void 0:r.isLoading]),{customAuthState:l,customAuthStateIsSettled:l.status!=="loading"&&l.status!=="initial"}};import*as z from"expo-linking";import{useCallback as zt,useEffect as Ht}from"react";import{Platform as qt}from"react-native";var Ye=({client:e,user:t,isUserInitialized:o,oAuthState:r,oAuthCallbacks:l,setOAuthState:a,recoveryFlowState:c,oAuthStateRef:s})=>{let d=z.useURL(),n=zt(i=>{var y,b;let u=x(i);a({status:"error",error:u}),(b=(y=l.current).onError)==null||b.call(y,u)},[a]);return Ht(()=>{function i(){return v(this,null,function*(){var m,g;if(!d||r.status!=="loading"||c.status!=="initial")return;let{queryParams:u}=z.parse(d),{privy_oauth_state:y,privy_oauth_code:b}=u;if(!b||!y){a({status:"done"});return}try{let p,w;if(t)p=yield e.auth.oauth.linkWithCode(b,y);else{let S=yield e.auth.oauth.loginWithCode(b,y,void 0,void 0,s.current.disableSignup?"no-signup":"login-or-sign-up");p=S.user,w=!!S.is_new_user}return(g=(m=l.current).onSuccess)==null||g.call(m,p,w),s.current={},a({status:"done"}),yield z.openURL(d.split("?")[0])}catch(p){s.current={},n(p)}})}qt.OS==="android"&&o&&i()},[d,o])};import*as H from"expo-linking";import{useCallback as Bt,useEffect as Kt,useMemo as Gt}from"react";import{Platform as Yt}from"react-native";import{getUserEmbeddedSolanaWallet as Xt,getUserEmbeddedWallet as $t}from"@privy-io/js-sdk-core";var Xe=({client:e,user:t,createWalletCallbacks:o,recoverWalletCallbacks:r,setWalletRecoveryCallbacks:l,recoveryFlowState:a,oAuthState:c,setRecoveryFlowState:s,setWallet:d,appStateVisible:n,webViewLoaded:i})=>{let u=H.useURL(),y=Gt(()=>$t(t),[t]),b=Bt(m=>{var p,w,S,f;let g=x(m);a.status==="creating-wallet"?(w=(p=o.current).onError)==null||w.call(p,x(g)):(f=(S=r.current).onError)==null||f.call(S,x(g)),s({status:"initial"})},[a]);return Kt(()=>{function m(){return v(this,null,function*(){var S;if(!u&&a.status!=="initial"&&n&&b(new Error("Recovery OAuth session failed")),!u||a.status==="initial"||c.status!=="initial"||!n||!i)return;let{queryParams:g}=H.parse(u),{privy_oauth_state:p,privy_oauth_code:w}=g;if(!(!w||!p)){yield H.openURL(u.split("?")[0]);try{let f=yield Se({oAuthCode:w,oAuthState:p,client:e});if(a.status==="creating-wallet"){let h=(S=Xt(t))!=null?S:void 0;yield ie({client:e,setWallet:d,createWalletCallbacks:o,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:f,solanaAccount:h})}else if(a.status==="upgrading-recovery"){if(!y)throw new Error("Embedded wallet not found");yield le({client:e,recoveryInput:{recoveryMethod:"google-drive",wallet:y,recoveryAccessToken:f},setWalletRecoveryCallbacks:l,setRecoveryFlowState:s,setWallet:d})}else yield ae({client:e,account:y,setWallet:d,recoverWalletCallbacks:r,recoveryMethod:"google-drive",setRecoveryFlowState:s,recoveryToken:f})}catch(f){b(f)}}})}Yt.OS==="android"&&m()},[u,a.status,n,i])};import{useEffect as Jt}from"react";var $e=({client:e,isUserInitialized:t,setIsUserInitialized:o})=>{Jt(()=>{t||(()=>v(void 0,null,function*(){try{yield e.user.get()}catch(l){}finally{o(!0)}}))()},[t])};import{useEffect as Qt}from"react";import{create as Zt}from"zustand";var A=class extends Error{constructor(o,r){super(r);this.code=o,this.error=r}};var ce={success:e=>({value:e}),error:e=>({error:e})};var Je=e=>{let t=Array.from(new Set(e)),o=t.length;return o===0?ce.error(new A("no_login_methods_available","No login methods available")):o>2?ce.error(new A("too_many_login_methods",`More than two (${o}) login methods were provided`)):ce.success(t)},Xo=e=>e[0],$o=(e,t)=>{if(e.length!==2)return null;let[o,r]=e;return t===o?r:o},Jo={email:"email",sms:"phone"};var er=1e3*60*5,q=Zt()((e,t)=>({privyElementsConfig:null,loginPromiseExecutor:null,isUIMounted:!1,updateUIMounted:o=>e({isUIMounted:o}),openLoginFlow:(o,r,l)=>new Promise((a,c)=>{if(r!==null)return c(new A("user_already_logged_in","User is already logged in"));if(!t().isUIMounted)return c(new A("privy_elements_not_ready","Privy Elements is not mounted"));if(t().loginPromiseExecutor!==null)return c(new A("existing_login_flow_in_progress","A login flow is already in progress"));let s=Je(o.loginMethods);if(s.error)return c(s.error);let d={loginMethods:s.value},n=setTimeout(()=>{c(new A("login_flow_timeout","The login flow timed out")),t().closeLoginFlow()},er);l(),e({loginPromiseExecutor:{resolve(u){clearTimeout(n),a(u)},reject(u){clearTimeout(n),c(u)}},privyElementsConfig:d})}),closeLoginFlow:()=>{var o;return(o=t().loginPromiseExecutor)==null||o.reject(new A("login_flow_closed","The login flow was closed")),e({privyElementsConfig:null,loginPromiseExecutor:null})}})),oa=()=>q(e=>e.privyElementsConfig),aa=()=>q(e=>e.openLoginFlow),na=()=>q(e=>e.closeLoginFlow),tr=e=>{let{loginPromiseExecutor:t}=q.getState();t==null||t.resolve(e)},Qe=()=>tr,ia=()=>{let e=q(t=>t.updateUIMounted);Qt(()=>(e(!0),()=>{e(!1)}),[e])},da=()=>q(e=>e.privyElementsConfig!==null);var ge=ar({}),D;function Wa(e){return D?D.getAccessToken():e!=null&&e.strict?Promise.reject(new sr({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 Ca=e=>{var Ce;let[t,o]=W(Ze.currentState==="active");nr(()=>{let M=Ze.addEventListener("change",yt=>{o(yt==="active")});return()=>{M.remove()}},[]);let[r,l]=W(!1),[a,c]=W("loading"),[s,d]=W(!1),[n,i]=W(null),[u,y]=W({status:"disconnected",account:null}),[b,m]=W({status:"disconnected"}),[g,p]=W({status:"initial"}),[w,S]=W({status:"initial"}),f=T({}),[h,E]=W({status:"initial"}),[U,R]=W({status:"initial"}),[N,I]=W({status:"initial"}),[L,K]=W({status:"initial"}),[G,Y]=W({status:"initial"}),X=T({}),pe=T({}),me=T({}),ye=T({}),_e=T({}),We=T({}),dt=Qe(),$=ue(M=>{if(M){dt(M),Ne(i)(M);return}i(null),p({status:"initial"}),S({status:"initial"}),y({status:"disconnected",account:null})},[]),_=or(()=>{let M=e.storage||ot;return e.client?(D=e.client,D.setCallbacks({setUser:$,setIsReady:d}),D):(D=new dr({storage:rt(M),appId:e.appId,clientId:e.clientId,supportedChains:e.supportedChains,nativeAppIdentifier:tt(),baseUrl:e.baseUrl,sdkVersion:`expo:${xe.version}`,callbacks:{setUser:$,setIsReady:d},logLevel:e.logLevel,crypto:{digest:rr}}),D)},[e.client,e.storage,e.appId,e.clientId,e.baseUrl,e.supportedChains,e.logLevel,$]),st=ue(()=>($(null),_.auth.logout()),[$,_]),lt=ue(()=>_.getAccessToken(),[_]),ct=ue(()=>_.getIdentityToken(),[_]);$e({client:_,isUserInitialized:r,setIsUserInitialized:l});let ut=Be({client:_,user:n,appId:e.appId,webViewState:a,createWalletCallbacks:pe,recoverWalletCallbacks:me,setWalletRecoveryCallbacks:ye,setRecoveryFlowState:E,wallet:u,setWallet:y}),pt=Fe({client:_,user:n,webViewState:a,createSolanaWalletCallbacks:_e,recoverSolanaWalletCallbacks:We,setSolanaRecoveryFlowState:R,solanaWallet:b,setSolanaWallet:m});Ye({client:_,isUserInitialized:r,user:n,oAuthState:w,setOAuthState:S,oAuthCallbacks:X,recoveryFlowState:h,oAuthStateRef:f}),Xe({client:_,user:n,webViewLoaded:a==="loaded",createWalletCallbacks:pe,recoverWalletCallbacks:me,setWalletRecoveryCallbacks:ye,recoveryFlowState:h,oAuthState:w,setRecoveryFlowState:E,setWallet:y,appStateVisible:t});let{customAuthStateIsSettled:mt}=Ge({client:_,user:n,isReady:r,customAuth:(Ce=e.config)==null?void 0:Ce.customAuth});return te.createElement(te.Fragment,null,te.createElement(ge.Provider,{value:{client:_,user:n,isReady:a!=="loading"&&r&&et(w)&&mt,logout:st,getAccessToken:lt,getIdentityToken:ct,wallet:k(k({},u),ut),solanaWallet:k(k({},b),pt),oAuthState:w,oAuthCallbacks:X,recoveryFlowState:h,setRecoveryFlowState:E,solanaRecoveryFlowState:U,setSolanaRecoveryFlowState:R,createWalletCallbacks:pe,recoverWalletCallbacks:me,setWalletRecoveryCallbacks:ye,createSolanaWalletCallbacks:_e,recoverSolanaWalletCallbacks:We,setOAuthState:S,siweState:N,setSiweState:I,otpState:g,setOtpState:p,passkeyState:L,setPasskeyState:K,farcasterState:G,setFarcasterState:Y,oAuthStateRef:f}},e.children),te.createElement(ir,{style:{width:0,height:0,overflow:"hidden"}},te.createElement(Pe,{logLevel:e.logLevel,client:_,isClientReady:s,setWebViewState:c,webViewState:a})))};var et=e=>e.status!=="loading",Ee=(e={})=>{let{user:t,oAuthState:o,setOAuthState:r,oAuthCallbacks:l,client:a,oAuthStateRef:c}=lr(ge),s=e.action?e.action==="login":!t;cr(()=>{l.current={onSuccess:e.onSuccess,onError:e.onError}},[e.onSuccess,e.onError]);let d=nt(i=>{var y;let u=x(i);return r({status:"error",error:u}),(y=e==null?void 0:e.onError)==null||y.call(e,u),u},[e==null?void 0:e.onError]);return{start:nt(function(g){return v(this,arguments,function*({provider:u,redirectUri:y,isLegacyAppleIosBehaviorEnabled:b=!1,disableSignup:m}){var p,w,S;r({status:"loading"}),c.current={disableSignup:m};try{if(t&&e.action==="login")throw new j({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!t&&e.action==="link")throw new j({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});let{url:f}=yield a.auth.oauth.generateURL(u,B.createURL(y||"/")),h,E;if(he.OS==="ios"&&u==="apple"&&!b){let G=(p=new URL(f).searchParams.get("state"))!=null?p:"",Y=yield it.signInAsync({state:G});if(!Y.authorizationCode)throw new j({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let X=yield a.auth.oauth.loginWithCode(Y.authorizationCode,G,u,"raw",m?"no-signup":"login-or-sign-up");h=X.user,E=X.is_new_user}else h=yield a.auth.oauth.linkWithCode(Y.authorizationCode,G,u,"raw");return(w=e==null?void 0:e.onSuccess)==null||w.call(e,h,E),r({status:"done"}),h!=null?h:void 0}let U=he.OS==="android"?f.replace("x.com","twitter.com"):f,R=yield re.openAuthSessionAsync(U);if(he.OS==="android")return;if(R.type!=="success")throw[re.WebBrowserResultType.CANCEL,re.WebBrowserResultType.DISMISS].includes(R.type)?new j({error:"OAuth was cancelled",code:s?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):new j({error:"OAuth session failed",code:s?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let{queryParams:N}=B.parse(R.url),{privy_oauth_state:I,privy_oauth_code:L}=N;if(!L||!I)throw new j({error:"OAuth invalid credentials",code:s?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(s){let K=yield a.auth.oauth.loginWithCode(L,I,u,void 0,m?"no-signup":"login-or-sign-up");h=K.user,E=K.is_new_user}else h=yield a.auth.oauth.linkWithCode(L,I,u);return(S=e==null?void 0:e.onSuccess)==null||S.call(e,h,E),yield B.openURL(R.url.split("?")[0]),r({status:"done"}),h!=null?h:void 0}catch(f){d(f)}})},[t,a,r,d]),state:o}};function La(e){let{state:t,start:o}=Ee(V(k({},e),{action:"login"}));return{state:t,login:o}}function Ma(e){let{state:t,start:o}=Ee(V(k({},e),{action:"link"}));return{state:t,link:o}}function Fa(e){return Ee(e)}var tt=()=>{if(typeof at!="string")throw new j({error:"Cannot determine native application ID. Please make sure `expo-application` is installed as a dependency and that `ios.bundleId` or `android.package` is set.",code:"invalid_native_app_id"});return at};function rt(e){return{get(t){return e.get(t.replaceAll(":","-"))},put(t,o){return e.put(t.replaceAll(":","-"),o)},del(t){return e.del(t.replaceAll(":","-"))},getKeys:()=>v(this,null,function*(){return[]})}}var ot={get(e){return O.getItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},put(e,t){return O.setItemAsync(e,t,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},del(e){return O.deleteItemAsync(e,{keychainAccessible:O.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},getKeys:()=>v(void 0,null,function*(){return[]})};function ja(e){return e.status==="connected"}function Na(e){return e.status==="reconnecting"}function Va(e){return e.status==="connecting"}function za(e){return e.status==="disconnected"}function Ha(e){return e.status==="not-created"}function qa(e){return e.status==="creating"}function Ba(e){return e.status==="error"}function Ka(e){return e.status==="needs-recovery"}export{k as a,V as b,ur as c,v as d,xe as e,x as f,Br as g,$r as h,La as i,Ma as j,Fa as k,tt as l,rt as m,ot as n,A as o,Xo as p,$o as q,Jo as r,oa as s,aa as t,na as u,ia as v,da as w,ge as x,Wa as y,Ca as z,ja as A,Na as B,Va as C,za as D,Ha as E,qa as F,Ba as G,Ka as H};
|