@privy-io/react-auth 1.95.0 → 1.95.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddress as n,isAddress as a}from"@ethersproject/address";import{Web3Provider as i}from"@ethersproject/providers";import{createStore as o}from"mipd";import l,{useRef as s,useState as d,useMemo as c,useContext as u,createContext as h,useEffect as p,useCallback as m,useReducer as f,forwardRef as v}from"react";import*as C from"react-device-detect";import{isMobile as b,isIOS as $,isSafari as E,isAndroid as T}from"react-device-detect";import{P as _,f as A,a as k,b as S,n as N,c as I,g as P,d as O,e as R,h as M,i as L,u as D,j as F,s as U,k as W,l as B,m as G,o as H,p as z,q as j,r as V,t as q,v as K,w as Z,x as Y,y as X,z as Q,A as J,B as ee,I as te}from"./privy-context-CrcnzDDK.mjs";import*as re from"jose";import{base64url as ne}from"jose";import{g as ae,C as ie,H as oe,O as le,S as se,p as de,D as ce,f as ue,i as he,a as pe,b as me,c as fe,t as ge,d as ye,e as we,s as ve,h as Ce,j as be,k as $e,l as Ee,m as Te,V as xe,n as _e,P as Ae,R as ke,F as Se,o as Ne,q as Ie,r as Pe,u as Oe,v as Re,I as Me,w as Le,x as De,y as Fe,z as Ue,A as We,B as Be,E as Ge,G as He,J as ze,K as je,L as Ve,W as qe,M as Ke,N as Ze,Q as Ye,T as Xe,U as Qe,X as Je,Y as et,Z as tt,_ as rt,$ as nt,a0 as at,a1 as it,a2 as ot,a3 as lt,a4 as st,a5 as dt,a6 as ct,a7 as ut,a8 as ht,a9 as pt,aa as mt,ab as ft,ac as gt,ad as yt,ae as wt,af as vt,ag as Ct,ah as bt,ai as $t,aj as Et,ak as Tt,al as xt}from"./useWallets-jsxF_Rfe.mjs";export{am as SUPPORTED_CHAINS,ao as addPrivyRpcToChain,an as addRpcUrlOverrideToChain}from"./useWallets-jsxF_Rfe.mjs";import{t as _t,r as At,i as kt,e as St,a as Nt,B as It,A as Pt,b as Ot,C as Rt,M as Mt,u as Lt,c as Dt,T as Ft,d as Ut,W as Wt,f as Bt,L as Gt,g as Ht,h as zt,j as jt,k as Vt,E as qt,l as Kt,s as Zt,m as Yt,n as Xt,o as Qt,p as Jt,q as er,v as tr,R as rr}from"./useFundWallet-6H7b2rIK.mjs";export{x as useConnectWallet,y as useFundWallet,w as useLogin}from"./useFundWallet-6H7b2rIK.mjs";import{v4 as nr}from"uuid";import{isHexString as ar}from"@ethersproject/bytes";import ir from"eventemitter3";import{CoinbaseWalletSDK as or}from"@coinbase/wallet-sdk";import{R as lr,f as sr,W as dr,a as cr,U as ur,i as hr,C as pr,P as mr,u as fr,b as gr,n as yr,c as wr}from"./useSolanaWallets-ByOYtyDO.mjs";import{EthereumProvider as vr,OPTIONAL_EVENTS as Cr,OPTIONAL_METHODS as br}from"@walletconnect/ethereum-provider";import{u as $r,M as Er,a as Tr}from"./getEmbeddedConnectedWallet-DqeO4I_G.mjs";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-DqeO4I_G.mjs";import{ofetch as xr}from"ofetch";import _r from"js-cookie";import{Turnstile as Ar}from"@marsidev/react-turnstile";import{styled as kr,css as Sr,keyframes as Nr,createGlobalStyle as Ir}from"styled-components";import{u as Pr,a as Or,p as Rr,e as Mr,P as Lr}from"./events-context-2ZF4RQWB.mjs";import Dr from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Fr from"@heroicons/react/24/outline/ArrowLeftIcon";import Ur from"@heroicons/react/24/outline/ArrowRightIcon";import Wr from"@heroicons/react/24/outline/XMarkIcon";import Br from"@heroicons/react/24/outline/ExclamationTriangleIcon";import Gr from"@heroicons/react/24/outline/WalletIcon";import Hr from"@heroicons/react/24/outline/ExclamationCircleIcon";import zr from"@heroicons/react/24/outline/Square2StackIcon";import jr from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Vr from"@heroicons/react/24/solid/DocumentCheckIcon";import qr from"@heroicons/react/20/solid/CheckIcon";import Kr from"@heroicons/react/24/outline/EnvelopeIcon";import Zr from"@heroicons/react/24/outline/PhoneIcon";import Yr from"@heroicons/react/24/solid/CheckCircleIcon";import Xr from"@heroicons/react/24/solid/XCircleIcon";import Qr from"@heroicons/react/24/outline/CheckCircleIcon";import Jr from"fast-password-entropy";import*as en from"secure-password-utilities";import{DEFAULT_WORDLIST as tn}from"secure-password-utilities/wordlists";import rn from"@heroicons/react/24/outline/ArrowPathIcon";import nn from"@heroicons/react/24/outline/EyeIcon";import on from"@heroicons/react/24/outline/EyeSlashIcon";import ln from"@heroicons/react/24/outline/KeyIcon";import sn from"@heroicons/react/24/outline/ArrowDownTrayIcon";import dn from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import cn from"@heroicons/react/24/outline/DocumentDuplicateIcon";import un from"@heroicons/react/24/outline/UserCircleIcon";import hn from"@heroicons/react/24/solid/LockClosedIcon";import pn from"qrcode";import{createPublicClient as mn,http as fn,createWalletClient as gn,custom as yn,publicActions as wn,parseEther as vn,encodeFunctionData as Cn,decodeFunctionData as bn,decodeAbiParameters as $n,formatEther as En}from"viem";import Tn from"@heroicons/react/24/outline/GlobeAltIcon";import{Menu as xn,MenuButton as _n,MenuItems as An,MenuItem as kn,Transition as Sn,Dialog as Nn,TransitionChild as In,DialogPanel as Pn}from"@headlessui/react";import On from"@heroicons/react/24/outline/ChevronDownIcon";import Rn from"@heroicons/react/24/outline/ClockIcon";import Mn from"@heroicons/react/24/outline/TrashIcon";import Ln from"@heroicons/react/24/solid/CheckBadgeIcon";import Dn from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import Fn from"@heroicons/react/24/outline/PencilIcon";import Un from"@heroicons/react/24/outline/CreditCardIcon";import Wn from"@heroicons/react/24/outline/QrCodeIcon";import{parseUnits as Bn,formatUnits as Gn}from"@ethersproject/units";import Hn from"@heroicons/react/24/outline/InformationCircleIcon";import zn from"@heroicons/react/24/outline/ChevronRightIcon";import jn from"@heroicons/react/24/outline/ShieldCheckIcon";import Vn from"@heroicons/react/24/solid/IdentificationIcon";import qn from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Kn from"@heroicons/react/24/outline/FingerPrintIcon";import Zn from"@heroicons/react/24/outline/MinusCircleIcon";import Yn from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import Xn from"@heroicons/react/24/solid/ShieldCheckIcon";import{VoidSigner as Qn}from"@ethersproject/abstract-signer";import{BigNumber as Jn}from"@ethersproject/bignumber";import{Contract as ea}from"@ethersproject/contracts";import{serialize as ta}from"@ethersproject/transactions";import ra from"fetch-retry";import na from"@heroicons/react/24/outline/CalendarIcon";import aa from"@heroicons/react/24/outline/LockClosedIcon";import ia from"@heroicons/react/24/outline/PencilSquareIcon";import{ChevronDownIcon as oa}from"@heroicons/react/24/outline";import la from"@heroicons/react/24/outline/ClipboardDocumentIcon";import{ErrorCode as sa}from"@ethersproject/logger";import{toUtf8String as da}from"@ethersproject/strings";import"tinycolor2";let ca={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},ua={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0},ha={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},pa={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},ma={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0},fa={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},ga={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},ya={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0},wa={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},va={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},Ca={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0},ba={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},$a={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},Ea={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},Ta=e=>[ca.id,ua.id,ha.id].includes(e),xa=e=>[56,97].includes(e),_a="0x420000000000000000000000000000000000000F",Aa=["function getL1Fee(bytes memory _data) external view returns (uint256)"],ka=e=>[pa.id,ma.id,fa.id,ga.id,ya.id,wa.id,ba.id,Ea.id,$a.id,81457,168587773].includes(e);let Sa={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},Na=ra(fetch,{retries:3,retryDelay:500}),Ia=e=>[va.id,Ca.id,Sa.id].includes(e),Pa=e=>({maxPriorityFee:Bn(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:Bn(e.maxFee.toFixed(9),"gwei").toHexString()}),Oa=async e=>{let t="";switch(e){case va.id:t="https://gasstation.polygon.technology/v2";break;case Ca.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Sa.id:t="https://gasstation.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}let r=await Na(t),n=await r.json();if(r.status>399)throw n;return{safeLow:Pa(n.safeLow),standard:Pa(n.standard),fast:Pa(n.fast)}};async function Ra(e,t){if(!e.gasLimit)throw new lr("gasLimit was not successfully set for transaction.");let r=kt(e.gasLimit),n=Jn.from(0);if(2==e.type){if(!e.maxFeePerGas)throw new lr("maxFeePerGas was not successfully set for transaction of type 2.");n=kt(e.maxFeePerGas)}else{if(!e.gasPrice)throw new lr("gasPrice was not successfully set for transaction of type 0 or 1.");n=kt(e.gasPrice)}let a=r.mul(n),i=Jn.from(0);if(e.chainId&&ka(e.chainId))try{i=await async function(e,t){if(!e.chainId||e.chainId&&!ka(e.chainId))return Jn.from(0);let r=Jn.from(0);try{let n=new ea(_a,Aa,t),a=At(e),i=ta(a);r=await n.getL1Fee(i)}catch(e){}return r}(e,t),a=a.add(i)}catch(e){}return{totalGasEstimate:a,l1ExecutionFeeEstimate:i}}function Ma(e){return/^-?0x[a-f0-9]+$/i.test(e)}async function La(e,t,r){if(t.chainId=Number(t.chainId),function(e){for(let t of["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"]){let r=e[t];if(void 0!==r&&!function(e){let t="number"==typeof e,r="bigint"==typeof e,n="string"==typeof e&&Ma(e);return t||r||n}(r))throw Error(`Transaction request property '${t}' must be a valid number, bigint, or hex string representing a quantity`)}if("number"!=typeof e.chainId)throw Error("Transaction request property 'chainId' must be a number")}(t),t.from||(t.from=e),!t.nonce){let n=new Qn(e,r);t.nonce=await n.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await async function(e,t){try{return(await t.estimateGas(e)).toHexString()}catch(r){let n;if("message"in r&&r.message.includes("insufficient funds")&&(console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'value'`),n=await async function({txRequest:e,provider:t}){try{let r={...e,value:void 0};return(await t.estimateGas(r)).toHexString()}catch(e){return console.warn(`Gas estimation failed with error: ${e} when omitting the 'value'`),null}}({txRequest:e,provider:t})),n||(console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'from'`),n=await async function({txRequest:e,provider:t}){try{let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}catch(e){return console.warn(`Gas estimation failed with error: ${e} when omitting the 'from' address`),null}}({txRequest:e,provider:t})),!n)throw r;return n}}(t,r)),"string"==typeof t.type&&Ma(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),0===(t=Ia(t.chainId)?await async function(e){if(!Ia(e.chainId))throw Error("Invalid chain ID for Polygon gas estimation.");if(void 0===e.type&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await Oa(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee),e.gasPrice&&(console.warn("`gasPrice` is not supported on this chain and will be ignored. Use `maxPriorityFeePerGas` and/or `maxFeePerGas` instead."),delete e.gasPrice)}catch(e){throw Error(`Failed to set gas prices from Polygon gas station with error: ${e}.`)}return e}(t):Ta(t.chainId)?await(async(e,t)=>{if(!Ta(e.chainId))throw Error("Invalid chain ID for Arbitrum gas estimation.");if(void 0===e.type&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let t=r.mul(Jn.from(120)).div(Jn.from(100));e.maxFeePerGas=_t(t),e.maxPriorityFeePerGas=_t(Jn.from(0))}}catch(e){throw Error(`Failed to set gas price for Arbitrum transaction: ${e}.`)}return e})(t,r):ka(t.chainId)?await(async(e,t)=>{if(!ka(e.chainId))throw Error("Invalid chain ID for OP Stack gas estimation.");if(void 0===e.type&&(e.type=2),e.gasPrice&&(console.warn("`gasPrice` is not supported on this chain and will be ignored. Use `maxPriorityFeePerGas` and/or `maxFeePerGas` instead."),delete e.gasPrice),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw Error("Unable to fetch baseFee for last block.");let n=Jn.from(r).mul(Jn.from(126)).div(Jn.from(100)).add(Jn.from(e.maxPriorityFeePerGas));e.maxFeePerGas=_t(n)}}catch(e){throw Error(`Failed to set gas price for OP stack transaction: ${e}.`)}return e})(t,r):xa(t.chainId)?await(async(e,t)=>{if(!xa(e.chainId))throw Error("Invalid chain ID for BSC gas estimation.");if(void 0===e.type?e.type=0:1!=e.type&&2!=e.type||console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e})(t,r):await(async(e,t)=>{if(void 0===e.type&&(e.type=2),2===e.type){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e})(t,r)).type&&delete t.accessList,2!==t.type&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}var Da={AC:"40123",AD:"312345",AE:"501234567",AF:"701234567",AG:"2684641234",AI:"2642351234",AL:"672123456",AM:"77123456",AO:"923123456",AR:"91123456789",AS:"6847331234",AT:"664123456",AU:"412345678",AW:"5601234",AX:"412345678",AZ:"401234567",BA:"61123456",BB:"2462501234",BD:"1812345678",BE:"470123456",BF:"70123456",BG:"43012345",BH:"36001234",BI:"79561234",BJ:"90011234",BL:"690001234",BM:"4413701234",BN:"7123456",BO:"71234567",BQ:"3181234",BR:"11961234567",BS:"2423591234",BT:"17123456",BW:"71123456",BY:"294911911",BZ:"6221234",CA:"5062345678",CC:"412345678",CD:"991234567",CF:"70012345",CG:"061234567",CH:"781234567",CI:"0123456789",CK:"71234",CL:"221234567",CM:"671234567",CN:"13123456789",CO:"3211234567",CR:"83123456",CU:"51234567",CV:"9911234",CW:"95181234",CX:"412345678",CY:"96123456",CZ:"601123456",DE:"15123456789",DJ:"77831001",DK:"32123456",DM:"7672251234",DO:"8092345678",DZ:"551234567",EC:"991234567",EE:"51234567",EG:"1001234567",EH:"650123456",ER:"7123456",ES:"612345678",ET:"911234567",FI:"412345678",FJ:"7012345",FK:"51234",FM:"3501234",FO:"211234",FR:"612345678",GA:"06031234",GB:"7400123456",GD:"4734031234",GE:"555123456",GF:"694201234",GG:"7781123456",GH:"231234567",GI:"57123456",GL:"221234",GM:"3012345",GN:"601123456",GP:"690001234",GQ:"222123456",GR:"6912345678",GT:"51234567",GU:"6713001234",GW:"955012345",GY:"6091234",HK:"51234567",HN:"91234567",HR:"921234567",HT:"34101234",HU:"201234567",ID:"812345678",IE:"850123456",IL:"502345678",IM:"7924123456",IN:"8123456789",IO:"3801234",IQ:"7912345678",IR:"9123456789",IS:"6111234",IT:"3123456789",JE:"7797712345",JM:"8762101234",JO:"790123456",JP:"9012345678",KE:"712123456",KG:"700123456",KH:"91234567",KI:"72001234",KM:"3212345",KN:"8697652917",KP:"1921234567",KR:"1020000000",KW:"50012345",KY:"3453231234",KZ:"7710009998",LA:"2023123456",LB:"71123456",LC:"7582845678",LI:"660234567",LK:"712345678",LR:"770123456",LS:"50123456",LT:"61234567",LU:"628123456",LV:"21234567",LY:"912345678",MA:"650123456",MC:"612345678",MD:"62112345",ME:"67622901",MF:"690001234",MG:"321234567",MH:"2351234",MK:"72345678",ML:"65012345",MM:"92123456",MN:"88123456",MO:"66123456",MP:"6702345678",MQ:"696201234",MR:"22123456",MS:"6644923456",MT:"96961234",MU:"52512345",MV:"7712345",MW:"991234567",MX:"12221234567",MY:"123456789",MZ:"821234567",NA:"811234567",NC:"751234",NE:"93123456",NF:"381234",NG:"8021234567",NI:"81234567",NL:"612345678",NO:"40612345",NP:"9841234567",NR:"5551234",NU:"8884012",NZ:"211234567",OM:"92123456",PA:"61234567",PE:"912345678",PF:"87123456",PG:"70123456",PH:"9051234567",PK:"3012345678",PL:"512345678",PM:"551234",PR:"7872345678",PS:"599123456",PT:"912345678",PW:"6201234",PY:"961456789",QA:"33123456",RE:"692123456",RO:"712034567",RS:"601234567",RU:"9123456789",RW:"720123456",SA:"512345678",SB:"7421234",SC:"2510123",SD:"911231234",SE:"701234567",SG:"81234567",SH:"51234",SI:"31234567",SJ:"41234567",SK:"912123456",SL:"25123456",SM:"66661212",SN:"701234567",SO:"71123456",SR:"7412345",SS:"977123456",ST:"9812345",SV:"70123456",SX:"7215205678",SY:"944567890",SZ:"76123456",TA:"8999",TC:"6492311234",TD:"63012345",TG:"90112345",TH:"812345678",TJ:"917123456",TK:"7290",TL:"77212345",TM:"66123456",TN:"20123456",TO:"7715123",TR:"5012345678",TT:"8682911234",TV:"901234",TW:"912345678",TZ:"621234567",UA:"501234567",UG:"712345678",US:"2015550123",UY:"94231234",UZ:"912345678",VA:"3123456789",VC:"7844301234",VE:"4121234567",VG:"2843001234",VI:"3406421234",VN:"912345678",VU:"5912345",WF:"821234",WS:"7212345",XK:"43201234",YE:"712345678",YT:"639012345",ZA:"711234567",ZM:"955123456",ZW:"712345678"},Fa={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],BL:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0(4(?:[14]4|56)|[579])?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[0-79])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","[56]94\\d{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([3-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","9008\\d{3}|(?:[2-467]\\d\\d|510|862)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[25]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29[1289]|389)","529(?:1[1-46-9]|2[013-8]|90)|5(?:298|389)[0-46-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5293[01]\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|9[0-289])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[0189]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","596\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","1(?:(?:[27]2|44|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[047]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],NU:["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|80\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-6])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-5]))\\d{4}"],["69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-27]|8[0-8]|9[0-479]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[27]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[2378]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[237-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-8]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[04]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","[1-6]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["6"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|616)","5(?:[0-59]|6161)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["5056(?:[0-35-9]\\d|4[46])\\d{4}|(?:4722|505[2-57-9]|983[29])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[0-2]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","(?:0004|4)\\d{9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[7,8,10,13],[["(\\d{3})(\\d{4})","$1 $2",["405|8|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["4"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","810","200\\d{6}|(?:33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[23]"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|5[0-4]|6\\d|[78]0)\\d{4}"],["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"[0-36-9]\\d{8}",[9],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-36-9]"]]],0,0,0,0,0,0,[0,["[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[013-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function Ua(e,t){var r=Array.prototype.slice.call(t);return r.push(Fa),e.apply(this,r)}function Wa(e){return(Wa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ba(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ga(e){var t="function"==typeof Map?new Map:void 0;return(Ga=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Ha(e,arguments,Va(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ja(r,e)})(e)}function Ha(e,t,r){return(Ha=za()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&ja(a,r.prototype),a}).apply(null,arguments)}function za(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function ja(e,t){return(ja=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Va(e){return(Va=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qa=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ja(e,t)}(n,Ga(Error));var t,r=(t=za(),function(){var e=Va(n);return function(e,t){if(t&&("object"===Wa(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return Ba(e)}(this,t?Reflect.construct(e,arguments,Va(this).constructor):e.apply(this,arguments))});function n(e){var t;return function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,n),Object.setPrototypeOf(Ba(t=r.call(this,e)),n.prototype),t.name=t.constructor.name,t}return Object.defineProperty(n,"prototype",{writable:!1}),n}(),Ka="0-90-9٠-٩۰-۹",Za="".concat("-‐-―−ー-").concat("//").concat("..").concat("  ­​⁠ ").concat("()()[]\\[\\]").concat("~⁓∼~");function Ya(e,t){e=e.split("-"),t=t.split("-");for(var r=e[0].split("."),n=t[0].split("."),a=0;a<3;a++){var i=Number(r[a]),o=Number(n[a]);if(i>o)return 1;if(o>i)return-1;if(!isNaN(i)&&isNaN(o))return 1;if(isNaN(i)&&!isNaN(o))return-1}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}function Xa(e){return(Xa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qa(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function Ja(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var ei=" ext. ",ti=/^\d+$/,ri=function(){function e(t){Qa(this,e),function(e){if(!e)throw Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!si(e)||!si(e.countries))throw Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(si(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+di(e)+": "+e,"."))}(t),this.metadata=t,ui.call(this,t)}return Ja(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(e){return"001"!==e}))}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e)}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&ti.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw Error("Unknown country: ".concat(e));this.numberingPlan=new ni(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw Error("Unknown calling code: ".concat(t));this.numberingPlan=new ni(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var r=this.nonGeographic()[e];if(r)return r}else{var n=this.countryCallingCodes()[e];if(n&&1===n.length&&"001"===n[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),e}(),ni=function(){function e(t,r){Qa(this,e),this.globalMetadataObject=r,this.metadata=t,ui.call(this,r.metadata)}return Ja(e,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this;return(this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[]).map((function(t){return new ai(t,e)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return!(this.types()&&0===this.types().length||!this.types())}},{key:"type",value:function(e){if(this.hasTypes()&&li(this.types(),e))return new oi(li(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?ei:this.metadata[13]||ei}}]),e}(),ai=function(){function e(t,r){Qa(this,e),this._format=t,this.metadata=r}return Ja(e,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||ii.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),ii=/^\(?\$1\)?$/,oi=function(){function e(t,r){Qa(this,e),this.type=t,this.metadata=r}return Ja(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),e}();function li(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}var si=function(e){return"object"===Xa(e)},di=function(e){return Xa(e)};function ci(e,t){if((t=new ri(t)).hasCountry(e))return t.country(e).countryCallingCode();throw Error("Unknown country: ".concat(e))}function ui(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===Ya(t,"1.2.0")?this.v2=!0:-1===Ya(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var hi=function(e){return"([".concat(Ka,"]{1,").concat(e,"})")};function pi(e){var t="[  \\t,]*",r="[:\\..]?[  \\t,-]*",n="[  \\t]*";return";ext="+hi("20")+"|"+t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+r+hi("20")+"#?|"+t+"(?:[xx##~~]|int|int)"+r+hi("9")+"#?|[- ]+"+hi("6")+"#|"+n+"(?:,{2}|;)"+r+hi("15")+"#?|"+n+"(?:,)+"+r+hi("9")+"#?"}var mi=RegExp("^[++]{0,1}(?:["+Za+"]*["+Ka+"]){1,2}$","i"),fi="[++]{0,1}(?:["+Za+"]*["+Ka+"]){3,}["+Za+Ka+"]*(?:"+pi()+")?",gi=RegExp("^["+Ka+"]{2}$|^"+fi+"$","i"),yi=RegExp("(?:"+pi()+")$","i");function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var vi={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function Ci(e){for(var t,r="",n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return wi(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wi(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=n()).done;){var a=vi[t.value];a&&(r+=a)}return r}function bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function $i(e){for(var t,r="",n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return bi(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bi(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=n()).done;)r+=function(e,t){if("+"===e){if(t)return;return"+"}return vi[e]}(t.value,r)||"";return r}function Ei(e,t){return function(e,t,r){var n=r.type(void 0),a=n&&n.possibleLengths()||r.possibleLengths();if(!a)return"IS_POSSIBLE";var i=e.length,o=a[0];return o===i?"IS_POSSIBLE":o>i?"TOO_SHORT":a[a.length-1]<i?"TOO_LONG":a.indexOf(i,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,0,t)}function Ti(e,t){return"IS_POSSIBLE"===Ei(e,t)}function xi(e,t){return e=e||"",RegExp("^(?:"+t+")$").test(e)}function _i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Ai=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function ki(e,t,r){if(t=t||{},e.country){(r=new ri(r)).selectNumberingPlan(e.country,e.countryCallingCode);var n=t.v2?e.nationalNumber:e.phone;if(xi(n,r.nationalNumberPattern())){if(Si(n,"FIXED_LINE",r))return r.type("MOBILE")&&""===r.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":r.type("MOBILE")?Si(n,"MOBILE",r)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var a,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return _i(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _i(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Ai);!(a=i()).done;){var o=a.value;if(Si(n,o,r))return o}}}}function Si(e,t,r){return!(!(t=r.type(t))||!t.pattern())&&!(t.possibleLengths()&&0>t.possibleLengths().indexOf(e.length))&&xi(e,t.pattern())}function Ni(e){return e.replace(RegExp("[".concat(Za,"]+"),"g")," ").trim()}var Ii=/(\$\d)/;function Pi(e,t,r){var n=r.useInternationalFormat,a=r.withNationalPrefix;r.carrierCode,r.metadata;var i=e.replace(new RegExp(t.pattern()),n?t.internationalFormat():a&&t.nationalPrefixFormattingRule()?t.format().replace(Ii,t.nationalPrefixFormattingRule()):t.format());return n?Ni(i):i}var Oi=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Mi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Li(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mi(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Di={formatExtension:function(e,t,r){return"".concat(e).concat(r.ext()).concat(t)}};function Fi(e,t,r,n,a){var i=function(e,t){for(var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Ri(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ri(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(r=n()).done;){var a=r.value;if(a.leadingDigitsPatterns().length>0){var i=a.leadingDigitsPatterns()[a.leadingDigitsPatterns().length-1];if(0!==t.search(i))continue}if(xi(t,a.pattern()))return a}}(n.formats(),e);return i?Pi(e,i,{useInternationalFormat:"INTERNATIONAL"===r,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!a||!1!==a.nationalPrefix,carrierCode:t,metadata:n}):e}function Ui(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Wi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ui(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ui(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Bi=function(){var e;function t(e,r,n){if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),!e)throw TypeError("`country` or `countryCallingCode` not passed");if(!r)throw TypeError("`nationalNumber` not passed");if(!n)throw TypeError("`metadata` not passed");var a,i,o,l=(o=new ri(n),Gi(e)?(a=e,o.selectNumberingPlan(a),i=o.countryCallingCode()):i=e,{country:a,countryCallingCode:i}),s=l.country,d=l.countryCallingCode;this.country=s,this.countryCallingCode=d,this.nationalNumber=r,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return n}}return e=[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){var e,t,r,n;return this.country?[this.country]:(e=this.countryCallingCode,t=this.nationalNumber,(n=new ri(r=this.getMetadata()).getCountryCodesForCallingCode(e))?n.filter((function(e){var n;return(n=new ri(r)).selectNumberingPlan(e),n.numberingPlan.possibleLengths().indexOf(t.length)>=0})):[])}},{key:"isPossible",value:function(){return function(e,t,r){if(void 0===t&&(t={}),r=new ri(r),t.v2){if(!e.countryCallingCode)throw Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!r.hasCountry(e.country))throw Error("Unknown country: ".concat(e.country));r.country(e.country)}else{if(!e.countryCallingCode)throw Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode)}}if(r.possibleLengths())return Ti(e.phone||e.nationalNumber,r);if(e.countryCallingCode&&r.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){var e,t;return e={v2:!0},t=this.getMetadata(),e=e||{},(t=new ri(t)).selectNumberingPlan(this.country,this.countryCallingCode),t.hasTypes()?void 0!==ki(this,e,t.metadata):xi(e.v2?this.nationalNumber:this.phone,t.nationalNumberPattern())}},{key:"isNonGeographic",value:function(){return new ri(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return ki(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return function(e,t,r,n){if(r=r?Li(Li({},Di),r):Di,n=new ri(n),e.country&&"001"!==e.country){if(!n.hasCountry(e.country))throw Error("Unknown country: ".concat(e.country));n.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";n.selectNumberingPlan(e.countryCallingCode)}var a,i,o,l,s,d,c,u,h,p,m,f,g,y=n.countryCallingCode(),w=r.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return w?(a=g=Fi(w,e.carrierCode,"NATIONAL",n,r),i=e.ext,o=n,l=r.formatExtension,i?l(a,i,o):a):"";case"INTERNATIONAL":return w?(g=Fi(w,null,"INTERNATIONAL",n,r),s=g="+".concat(y," ").concat(g),d=e.ext,c=n,u=r.formatExtension,d?u(s,d,c):s):"+".concat(y);case"E.164":return"+".concat(y).concat(w);case"RFC3966":return function(e){var t=e.number,r=e.ext;if(!t)return"";if("+"!==t[0])throw Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(r?";ext="+r:"")}({number:"+".concat(y).concat(w),ext:e.ext});case"IDD":if(!r.fromCountry)return;return h=function(e,t,r,n,a){if(ci(n,a.metadata)===r){var i,o=Fi(e,t,"NATIONAL",a);return"1"===r?r+" "+o:o}var l=(void 0,(i=new ri(a.metadata)).selectNumberingPlan(n,undefined),i.defaultIDDPrefix()?i.defaultIDDPrefix():Oi.test(i.IDDPrefix())?i.IDDPrefix():void 0);if(l)return"".concat(l," ").concat(r," ").concat(Fi(e,null,"INTERNATIONAL",a))}(w,e.carrierCode,y,r.fromCountry,n),p=e.ext,m=n,f=r.formatExtension,p?f(h,p,m):h;default:throw Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}(this,e,t?Wi(Wi({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(),Gi=function(e){return/^[A-Z]{2}$/.test(e)},Hi=RegExp("(["+Ka+"])");function zi(e,t,r,n){if(t){var a=new ri(n);a.selectNumberingPlan(t,r);var i=new RegExp(a.IDDPrefix());if(0===e.search(i)){var o=(e=e.slice(e.match(i)[0].length)).match(Hi);if(!(o&&null!=o[1]&&o[1].length>0&&"0"===o[1]))return e}}}function ji(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var r=RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),n=r.exec(e);if(n){var a,i,o,l=n.length-1,s=l>0&&n[l];if(t.nationalPrefixTransformRule()&&s)a=e.replace(r,t.nationalPrefixTransformRule()),l>1&&(i=n[1]);else{var d=n[0];a=e.slice(d.length),s&&(i=n[1])}if(s){var c=e.indexOf(n[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(o=t.numberingPlan.nationalPrefix())}else o=n[0];return{nationalNumber:a,nationalPrefix:o,carrierCode:i}}}return{nationalNumber:e}}function Vi(e,t){var r=ji(e,t),n=r.carrierCode,a=r.nationalNumber;return a!==e&&(xi(e,t.nationalNumberPattern())&&!xi(a,t.nationalNumberPattern())||t.possibleLengths()&&!function(e,t){switch(Ei(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(a,t))?{nationalNumber:e}:{nationalNumber:a,carrierCode:n}}function qi(e,t,r,n){var a=t?ci(t,n):r;if(0===e.indexOf(a)){(n=new ri(n)).selectNumberingPlan(t,r);var i=e.slice(a.length),o=Vi(i,n).nationalNumber,l=Vi(e,n).nationalNumber;if(!xi(l,n.nationalNumberPattern())&&xi(o,n.nationalNumberPattern())||"TOO_LONG"===Ei(l,n))return{countryCallingCode:a,number:i}}return{number:e}}function Ki(e,t,r,n){if(!e)return{};if("+"!==e[0]){var a,i=zi(e,t,r,n);if(!i||i===e){if(t||r){var o=qi(e,t,r,n),l=o.countryCallingCode,s=o.number;if(l)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:l,number:s}}return{number:e}}a=!0,e="+"+i}if("0"===e[1])return{};n=new ri(n);for(var d=2;d-1<=3&&d<=e.length;){var c=e.slice(1,d);if(n.hasCallingCode(c))return n.selectNumberingPlan(c),{countryCallingCodeSource:a?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(d)};d++}return{}}function Zi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Yi(e,t){var r=t.countries,n=t.defaultCountry,a=t.metadata;a=new ri(a);for(var i,o=[],l=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Zi(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zi(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r);!(i=l()).done;){var s=i.value;if(a.country(s),a.leadingDigits()){if(e&&0===e.search(a.leadingDigits()))return s}else if(ki({phone:e,country:s},void 0,a.metadata)){if(!n||s===n)return s;o.push(s)}}if(o.length>0)return o[0]}function Xi(e,t){var r=t.nationalNumber,n=t.defaultCountry,a=t.metadata,i=a.getCountryCodesForCallingCode(e);if(i)return 1===i.length?i[0]:Yi(r,{countries:i,defaultCountry:n,metadata:a.metadata})}var Qi="(["+Ka+"]|[\\-\\.\\(\\)]?)",Ji=RegExp("^\\+"+Qi+"*["+Ka+"]"+Qi+"*$","g"),eo=RegExp("^(["+Ka+"]+((\\-)*["+Ka+"])*\\.)*[a-zA-Z]+((\\-)*["+Ka+"])*\\.?$","g"),to="tel:",ro=";phone-context=",no=RegExp("[++"+Ka+"]"),io=RegExp("[^"+Ka+"#]+$");function oo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oo(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function so(e){return(so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function co(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function uo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ho(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function po(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ho(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ho(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function mo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mo(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function go(){var e=function(e){var t,r,n,a=function(e){if(Array.isArray(e))return e}(t=Array.prototype.slice.call(e))||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),4!==i.length);o=!0);}catch(e){l=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw a}}return i}}(t)||function(e,t){if(e){if("string"==typeof e)return uo(e,4);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uo(e,4)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=a[0],o=a[1],l=a[2],s=a[3];if("string"!=typeof i)throw TypeError("A text for parsing must be a string.");if(o&&"string"!=typeof o){if("object"!==so(o))throw Error("Invalid second argument: ".concat(o));l?(r=o,n=l):n=o}else s?(r=l,n=s):(r=void 0,n=l),o&&(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?co(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):co(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({defaultCountry:o},r));return{text:i,options:r,metadata:n}}(arguments),t=e.text,r=e.options,n=e.metadata,a=function(e,t,r){var n;t&&t.defaultCountry&&(n=t.defaultCountry,!r.countries.hasOwnProperty(n))&&(t=po(po({},t),{},{defaultCountry:void 0}));try{return function(e,t,r){if(t=t||{},r=new ri(r),t.defaultCountry&&!r.hasCountry(t.defaultCountry)){if(t.v2)throw new qa("INVALID_COUNTRY");throw Error("Unknown country: ".concat(t.defaultCountry))}var n,a=function(e,t,r){var n=function(e,t){var r,n=t.extractFormattedPhoneNumber,a=function(e){var t=e.indexOf(ro);if(t<0)return null;var r=t+15;if(r>=e.length)return"";var n=e.indexOf(";",r);return n>=0?e.substring(r,n):e.substring(r)}(e);if(null!==a&&(0===a.length||!Ji.test(a)&&!eo.test(a)))throw new qa("NOT_A_NUMBER");if(null===a)r=n(e)||"";else{r="","+"===a.charAt(0)&&(r+=a);var i,o=e.indexOf(to);i=o>=0?o+4:0;var l=e.indexOf(ro);r+=e.substring(i,l)}var s=r.indexOf(";isub=");if(s>0&&(r=r.substring(0,s)),""!==r)return r}(e,{extractFormattedPhoneNumber:function(e){return function(e,t,r){if(e){if(e.length>250){if(r)throw new qa("TOO_LONG");return}if(!1===t)return e;var n=e.search(no);if(!(n<0))return e.slice(n).replace(io,"")}}(e,r,t)}});if(!n)return{};if(!(n.length>=2&&gi.test(n)))return mi.test(n)?{error:"TOO_SHORT"}:{};var a=function(e){var t=e.search(yi);if(t<0)return{};for(var r=e.slice(0,t),n=e.match(yi),a=1;a<n.length;){if(n[a])return{number:r,ext:n[a]};a++}}(n);return a.ext?a:{number:n}}(e,t.v2,t.extract),i=a.number,o=a.ext,l=a.error;if(!i){if(t.v2){if("TOO_SHORT"===l)throw new qa("TOO_SHORT");throw new qa("NOT_A_NUMBER")}return{}}var s=function(e,t,r,n){var a,i=Ki($i(e),t,r,n.metadata),o=i.countryCallingCodeSource,l=i.countryCallingCode,s=i.number;if(l)n.selectNumberingPlan(l);else{if(!s||!t&&!r)return{};n.selectNumberingPlan(t,r),t&&(a=t),l=r||ci(t,n.metadata)}if(!s)return{countryCallingCodeSource:o,countryCallingCode:l};var d=Vi($i(s),n),c=d.nationalNumber,u=d.carrierCode,h=Xi(l,{nationalNumber:c,defaultCountry:t,metadata:n});return h&&(a=h,"001"===h||n.country(a)),{country:a,countryCallingCode:l,countryCallingCodeSource:o,nationalNumber:c,carrierCode:u}}(i,t.defaultCountry,t.defaultCallingCode,r),d=s.country,c=s.nationalNumber,u=s.countryCallingCode,h=s.countryCallingCodeSource,p=s.carrierCode;if(!r.hasSelectedNumberingPlan()){if(t.v2)throw new qa("INVALID_COUNTRY");return{}}if(!c||c.length<2){if(t.v2)throw new qa("TOO_SHORT");return{}}if(c.length>17){if(t.v2)throw new qa("TOO_LONG");return{}}if(t.v2){var m=new Bi(u,c,r.metadata);return d&&(m.country=d),p&&(m.carrierCode=p),o&&(m.ext=o),m.__countryCallingCodeSource=h,m}var f=!!(t.extended?r.hasSelectedNumberingPlan():d)&&xi(c,r.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:u,carrierCode:p,valid:f,possible:!!f||!(!0!==t.extended||!r.possibleLengths()||!Ti(c,r)),phone:c,ext:o}:f?(n={country:d,phone:c},o&&(n.ext=o),n):{}}(e,lo(lo({},t),{},{v2:!0}),r)}catch(e){if(!(e instanceof qa))throw e}}(t,r=fo(fo({},r),{},{extract:!1}),n);return a&&a.isPossible()||!1}var yo=function(){var e;function t(e){var r=e.onCountryChange,n=e.onCallingCodeChange;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.onCountryChange=r,this.onCallingCodeChange=n}return e=[{key:"reset",value:function(e){var t=e.country,r=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,r)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(e){for(var t=0,r=Object.keys(e);t<r.length;t++){var n=r[t];this[n]=e[n]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function wo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var vo=/x/;function Co(e,t){if(t<1)return"";for(var r="";t>1;)1&t&&(r+=e),t>>=1,e+=e;return r+e}function bo(e,t){return")"===e[t]&&t++,function(e){for(var t=[],r=0;r<e.length;)"("===e[r]?t.push(r):")"===e[r]&&t.pop(),r++;var n=0,a="";t.push(e.length);for(var i=0;i<t.length;i++){var o=t[i];a+=e.slice(n,o),n=o+1}return a}(e.slice(0,t))}function $o(e,t,r){var n=r.metadata,a=r.useNationalPrefixFormattingRule,i=r.getSeparatorAfterNationalPrefix,o=Pi(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:a,metadata:n});if(a||(e.nationalPrefix?o=e.nationalPrefix+i(t)+o:e.complexPrefixBeforeNationalSignificantNumber&&(o=e.complexPrefixBeforeNationalSignificantNumber+" "+o)),Ci(o)===e.getNationalDigits())return o}var Eo=function(){var e;function t(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t)}return e=[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),1!==this.context.length)throw Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],r=t.branches,n=t.instructions;if(r)return{op:"|",args:r.concat([_o(n)])};if(0===n.length)throw Error("Pattern is required");return 1===n.length?n[0]:n}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw Error("Pattern is required");var t=e.match(xo);if(t){var r=t[1],n=e.slice(0,t.index),a=e.slice(t.index+r.length);switch(r){case"(?:":n&&this.parsePattern(n),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw Error('")" operator must be preceded by "(?:" operator');if(n&&this.parsePattern(n),0===this.getContext().instructions.length)throw Error('No instructions found after "|" operator in an "or" group');var i=this.getContext().branches;i.push(_o(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:i});break;case"|":if(!this.getContext().or)throw Error('"|" operator can only be used inside "or" groups');if(n&&this.parsePattern(n),!this.getContext().branches){if(1!==this.context.length)throw Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(_o(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":n&&this.parsePattern(n),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:function(e){for(var t=[],r=0;r<e.length;){if("-"===e[r]){if(0===r||r===e.length-1)throw Error("Couldn't parse a one-of set pattern: ".concat(e));for(var n=e[r-1].charCodeAt(0)+1,a=e[r+1].charCodeAt(0)-1,i=n;i<=a;)t.push(String.fromCharCode(i)),i++}else t.push(e[r]);r++}return t}(n)});break;default:throw Error("Unknown operator: ".concat(r))}a&&this.parsePattern(a)}else{if(To.test(e))throw Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(),To=/[\(\)\[\]\?\:\|]/,xo=RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function _o(e){return 1===e.length?e[0]:e}function Ao(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ko(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ko(e,void 0)}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ko(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var So=function(){var e;function t(e){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.matchTree=(new Eo).parse(e)}return e=[{key:"match",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!e)throw Error("String is required");var r=function e(t,r,n){if("string"==typeof r){var a=t.join("");return 0===r.indexOf(a)?t.length===r.length?{match:!0,matchedChars:t}:{partialMatch:!0}:0===a.indexOf(r)?n&&t.length>r.length?{overflow:!0}:{match:!0,matchedChars:t.slice(0,r.length)}:void 0}if(Array.isArray(r)){for(var i=t.slice(),o=0;o<r.length;){var l=e(i,r[o],n&&o===r.length-1);if(!l)return;if(l.overflow)return l;if(!l.match){if(l.partialMatch)return{partialMatch:!0};throw Error("Unsupported match result:\n".concat(JSON.stringify(l,null,2)))}if(0===(i=i.slice(l.matchedChars.length)).length)return o===r.length-1?{match:!0,matchedChars:t}:{partialMatch:!0};o++}return n?{overflow:!0}:{match:!0,matchedChars:t.slice(0,t.length-i.length)}}switch(r.op){case"|":for(var s,d,c=Ao(r.args);!(d=c()).done;){var u=e(t,d.value,n);if(u){if(u.overflow)return u;if(u.match)return{match:!0,matchedChars:u.matchedChars};if(!u.partialMatch)throw Error("Unsupported match result:\n".concat(JSON.stringify(u,null,2)));s=!0}}return s?{partialMatch:!0}:void 0;case"[]":for(var h,p=Ao(r.args);!(h=p()).done;){var m=h.value;if(t[0]===m)return 1===t.length?{match:!0,matchedChars:t}:n?{overflow:!0}:{match:!0,matchedChars:[m]}}return;default:throw Error("Unsupported instruction tree: ".concat(r))}}(e.split(""),this.matchTree,!0);if(r&&r.match&&delete r.matchedChars,!r||!r.overflow||t)return r}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function No(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Io(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Io(e,void 0)}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Io(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Po=Co("9",15),Oo=/[- ]/,Ro=RegExp("["+Za+"]*\\$1["+Za+"]*(\\$\\d["+Za+"]*)*$"),Mo=function(){var e;function t(e){e.state;var r=e.metadata;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.metadata=r,this.resetFormat()}return e=[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP="1"===e.callingCode(),this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var r=this;if("IS_POSSIBLE"===Ei(t.nationalSignificantNumber,this.metadata))for(var n,a=No(this.matchingFormats);!(n=a()).done;){var i=n.value,o=function(e,t,r){var n=r.metadata,a=r.shouldTryNationalPrefixFormattingRule,i=r.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,r){var n=r.metadata,a=r.shouldTryNationalPrefixFormattingRule,i=r.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,a(t)){var o=$o(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:i,metadata:n});if(o)return o}return $o(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:i,metadata:n})}(e,t,{metadata:n,shouldTryNationalPrefixFormattingRule:a,getSeparatorAfterNationalPrefix:i})}(t,i,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return r.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return r.getSeparatorAfterNationalPrefix(e)}});if(o)return this.resetFormat(),this.chosenFormat=i,this.setNationalNumberTemplate(o.replace(/\d/g,"x"),t),this.populatedNationalNumberTemplate=o,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf("x"),o}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var r=this.chosenFormat,n=this.chooseFormat(t);if(n)return n===r?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,r=e.nationalSignificantNumber,n=e.nationalPrefix,a=e.international,i=r.length-3;i<0&&(i=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,a,n)&&t.formatMatches(e,r,i)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,r){return!(r&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!t&&!r&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,r){var n=e.leadingDigitsPatterns().length;if(0===n)return!0;r=Math.min(r,n-1);var a=e.leadingDigitsPatterns()[r];if(t.length<3)try{return void 0!==new So(a).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(a,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,r,n=No(this.matchingFormats.slice());!(r=n()).done&&"break"!=(t=r.value,this.chosenFormat===t?"break":Ro.test(this.getFormatFormat(t,e.international))?this.createTemplateForFormat(t,e)?(this.chosenFormat=t,"break"):(this.matchingFormats=this.matchingFormats.filter((function(e){return e!==t})),"continue"):"continue"););return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var r=this.getTemplateForFormat(e,t);return r?(this.setNationalNumberTemplate(r,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&Oo.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var r=e.IDDPrefix,n=e.missingPlus;return r?t&&!1===t.spacing?r:r+" ":n?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,r=0,n=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";r<n.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf("x",t+1),r++;return bo(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,"x")+Co("x",t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var r=t.nationalSignificantNumber,n=t.international,a=t.nationalPrefix,i=t.complexPrefixBeforeNationalSignificantNumber,o=e.pattern();o=o.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var l=Po.match(o)[0];if(!(r.length>l.length)){var s=RegExp("^"+o+"$"),d=r.replace(/\d/g,"9");s.test(d)&&(l=d);var c,u=this.getFormatFormat(e,n);if(this.shouldTryNationalPrefixFormattingRule(e,{international:n,nationalPrefix:a})){var h=u.replace(Ii,e.nationalPrefixFormattingRule());if(Ci(e.nationalPrefixFormattingRule())===(a||"")+Ci("$1")&&(u=h,c=!0,a))for(var p=a.length;p>0;)u=u.replace(/\d/,"x"),p--}var m=l.replace(new RegExp(o),u).replace(/9/g,"x");return c||(i?m=Co("x",i.length)+" "+m:a&&(m=Co("x",a.length)+this.getSeparatorAfterNationalPrefix(e)+m)),n&&(m=Ni(m)),m}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,r){for(var n,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return wo(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wo(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r.split(""));!(n=a()).done;){var i=n.value;if(0>e.slice(t+1).search(vo))return;t=e.search(vo),e=e.replace(vo,i)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],bo(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var r=t.international,n=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var a=e.usesNationalPrefix();if(a&&n||!a&&!r)return!0}}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function Lo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);o=!0);}catch(e){l=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw a}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Do(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Do(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Do(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Fo=RegExp("^["+Za+Ka+"]+$","i"),Uo="(?:[++]["+Za+Ka+"]*|["+Za+Ka+"]+)",Wo=RegExp("[^"+Za+Ka+"]+.*$"),Bo=/[^\d\[\]]/,Go=function(){var e;function t(e){var r=e.defaultCountry,n=e.defaultCallingCode,a=e.metadata,i=e.onNationalSignificantNumberChange;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.defaultCountry=r,this.defaultCallingCode=n,this.metadata=a,this.onNationalSignificantNumberChange=i}return e=[{key:"input",value:function(e,t){var r,n,a,i,o,l=(a=(n=Lo("+"===(r=function(e){var t,r=e.search(Uo);if(!(r<0))return"+"===(e=e.slice(r))[0]&&(t=!0,e=e.slice(1)),e=e.replace(Wo,""),t&&(e="+"+e),e}(e)||"")[0]?[r.slice(1),!0]:[r],2))[0],i=n[1],Fo.test(a)||(a=""),[a,i]),s=Lo(l,2),d=s[0],c=s[1],u=Ci(d);return c&&(t.digits||(t.startInternationalNumber(),u||(o=!0))),u&&this.inputDigits(u,t),{digits:u,justLeadingPlus:o}}},{key:"inputDigits",value:function(e,t){var r=t.digits,n=r.length<3&&r.length+e.length>=3;if(t.appendDigits(e),n&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,r=e.callingCode;return t&&!r}},{key:"extractCountryCallingCode",value:function(e){var t=Ki("+"+e.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),r=t.countryCallingCode,n=t.number;if(r)return e.setCallingCode(r),e.update({nationalSignificantNumber:n}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&Bo.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var r=ji(e,this.metadata),n=r.nationalPrefix,a=r.nationalNumber,i=r.carrierCode;if(a!==e)return this.onExtractedNationalNumber(n,i,a,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,r){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,r);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var n=ji(e,this.metadata),a=n.nationalPrefix,i=n.nationalNumber,o=n.carrierCode;if(i!==t)return this.onExtractedNationalNumber(a,o,i,e,r),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,r,n,a){var i,o,l=n.lastIndexOf(r);if(l>=0&&l===n.length-r.length){o=!0;var s=n.slice(0,l);s!==e&&(i=s)}a({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:r,nationalSignificantNumberMatchesInput:o,complexPrefixBeforeNationalSignificantNumber:i}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){return!!this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,(function(t){return e.update(t)}))||(this.extractIddPrefix(e)||this.fixMissingPlus(e)?(this.extractCallingCodeAndNationalSignificantNumber(e),!0):void 0)}},{key:"extractIddPrefix",value:function(e){var t=e.international,r=e.IDDPrefix,n=e.digits;if(e.nationalSignificantNumber,!t&&!r){var a=zi(n,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==a&&a!==n?(e.update({IDDPrefix:n.slice(0,n.length-a.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=qi(e.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),r=t.countryCallingCode;if(t.number,r)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:r}),!0}}},{key:"startInternationalNumber",value:function(e,t){var r=t.country,n=t.callingCode;e.startInternationalNumber(r,n),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),(function(t){return e.update(t)}))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function Ho(e){return(Ho="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var jo=function(){var e;function t(e,r){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.metadata=new ri(r);var n,a=function(e){if(Array.isArray(e))return e}(n=this.getCountryAndCallingCode(e))||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),2!==i.length);o=!0);}catch(e){l=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw a}}return i}}(n)||function(e,t){if(e){if("string"==typeof e)return zo(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zo(e,2)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=a[0],o=a[1];this.defaultCountry=i,this.defaultCallingCode=o,this.reset()}return e=[{key:"getCountryAndCallingCode",value:function(e){var t,r;return e&&("object"===Ho(e)?(t=e.defaultCountry,r=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,r]}},{key:"input",value:function(e){var t,r=this.parser.input(e,this.state),n=r.digits;if(r.justLeadingPlus)this.formattedOutput="+";else if(n){if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(t=this.formatter.format(n,this.state)),void 0===t&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var a=this.state.getNationalDigits();a&&(t=this.formatter.format(a,this.state))}this.formattedOutput=t?this.getFullNumber(t):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new yo({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,r){e.metadata.selectNumberingPlan(r,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new Mo({state:this.state,metadata:this.metadata}),this.parser=new Go({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(e){if(this.isInternational()){var t,r=this.state.callingCode;return t=r?e?"".concat(r," ").concat(e):r:"".concat(this.state.getDigitsWithoutInternationalPrefix()),this.formatter.getInternationalPrefixBeforeCountryCallingCode(this.state,{spacing:!!t})+t}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.complexPrefixBeforeNationalSignificantNumber,n=e.nationalPrefix,a=t,i=r||n;return i&&(a=i+a),a}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(e?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,"x")}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(Xi(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,r=e.callingCode,n=e.country,a=e.nationalSignificantNumber;if(t)return this.isInternational()?r?"+"+r+a:"+"+t:n||r?"+"+(n?this.metadata.countryCallingCode():r)+a:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.carrierCode,n=e.callingCode,a=this._getCountry();if(t&&(a||n)){if(a&&a===this.defaultCountry){var i=new ri(this.metadata.metadata);i.selectNumberingPlan(a);var o=i.numberingPlan.callingCode(),l=this.metadata.getCountryCodesForCallingCode(o);if(l.length>1){var s=Yi(t,{countries:l,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});s&&(a=s)}}var d=new Bi(a||n,t,this.metadata.metadata);return r&&(d.carrierCode=r),d}}},{key:"isPossible",value:function(){var e=this.getNumber();return!!e&&e.isPossible()}},{key:"isValid",value:function(){var e=this.getNumber();return!!e&&e.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function Vo(e){return new ri(e).getCountries()}function qo(e,t,r){if(t[e])return new Bi(e,t[e],r)}function Ko(e){return jo.call(this,e,Fa)}function Zo(){return Ua(ci,arguments)}Ko.prototype=Object.create(jo.prototype,{}),Ko.prototype.constructor=Ko;let Yo=(e,t)=>function(){return Ua(go,arguments)}(String(e),t),Xo=(e,t)=>`+${Zo(t)} ${e}`,Qo=e=>`*${e.replaceAll("-","").slice(-4)}`,Jo=function(){return Ua(Vo,arguments)}().map((e=>({code:e,callCode:Zo(e)}))),el={buy:"CARD",send:"CRYPTO_ACCOUNT"},tl={USDC:"2b92315d-eab7-5bef-84fa-089a131333f5",ETH:"d85dce9b-5b73-5c3c-8978-522ce1d1c1b4",BTC:"5b71fc48-3dd3-540c-809b-f8c94d0e68b5",SOL:"4f039497-3af8-5bb3-951c-6df9afa9be1c",POL:"026bcc1e-9163-591c-a709-34dd18b2e7a1"};const rl="/api/v1/sessions",nl="/api/v1/sessions/logout",al="/api/v1/sessions/fork/recover",il="/api/v1/oauth/init",ol="/api/v1/oauth/authenticate",ll="/api/v1/oauth/link",sl="/api/v1/analytics_events";class dl{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/custom_jwt_account/authenticate",{token:this.meta.token})}catch(e){throw A(e)}}async link(){throw Error("Unimplemented")}constructor(e){this.meta={token:e}}}function cl(e){return crypto.getRandomValues(new Uint8Array(e))}class ul{getOrCreateGuestCredential(e){let t=ae(e);if(St()){if(Nt.get(t))return Nt.get(t);{let e=ne.encode(cl(32));return Nt.put(t,e),e}}return ne.encode(cl(32))}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/guest/authenticate",{guest_credential:this.meta.guestCredential})}catch(e){throw A(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function hl(){return ne.encode(cl(36))}function pl(){return hl()}async function ml(e,t="S256"){if("S256"!=t)return e;{let t=await async function(e){let t=(new TextEncoder).encode(e);return new Uint8Array(await crypto.subtle.digest("SHA-256",t))}(e);return ne.encode(t)}}class fl{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new _("User denied confirmation during OAuth flow");let e=function(){let e=Nt.get(ie);if(!e)throw new _("Authentication error.");return e}();try{let t=await this.api.post(ol,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Nt.del(ie),Nt.del(oe),Nt.del(le),t}catch(e){let t=A(e);if(t.privyErrorCode)throw new _(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new _("Invalid code during oauth flow.",void 0,k.OAUTH_USER_DENIED);throw new _("Invalid code during OAuth flow.",void 0,k.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new _("User denied confirmation during OAuth flow");let e=Nt.get(ie);if(!e)throw new _("Authentication error.");try{let t=await this.api.post(ll,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Nt.del(ie),t}catch(e){throw A(e)}}async getAuthorizationUrl(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.provider)throw new _("Provider must be set when initializing OAuth authentication.");let e=hl();Nt.put(ie,e);let t=pl();Nt.put(se,t);let r=await ml(e);this.meta.withPrivyUi||Nt.put(oe,!0),this.meta.disableSignup&&Nt.put(le,!0);let n=Ll(this.meta.withPrivyUi);try{return await this.api.post(il,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:r,state_code:t},{headers:{...n}})}catch(e){throw A(e)}}constructor(e){this.meta=e}}function gl(e){return e.charAt(0).toUpperCase()+e.slice(1)}const yl=({style:r,...n})=>e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...r},...n,children:[t("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),t("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]}),wl=({style:r,...n})=>e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...r},...n,children:[t("g",{clipPath:"url(#clip0)",children:t("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),t("defs",{children:t("clipPath",{id:"clip0",children:t("rect",{width:"71",height:"55",fill:"white"})})})]}),vl=({style:e,...r})=>t("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...r,children:t("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})}),Cl=({style:e})=>t(Tn,{style:{color:"var(--privy-color-error)",...e}}),bl=({style:r,...n})=>e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...r},...n,children:[t("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),t("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),t("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),t("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});function $l(r){return e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...r,children:[e("defs",{children:[e("linearGradient",{id:"b",children:[t("stop",{offset:"0",stopColor:"#3771c8"}),t("stop",{stopColor:"#3771c8",offset:".128"}),t("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),e("linearGradient",{id:"a",children:[t("stop",{offset:"0",stopColor:"#fd5"}),t("stop",{offset:".1",stopColor:"#fd5"}),t("stop",{offset:".5",stopColor:"#ff543e"}),t("stop",{offset:"1",stopColor:"#c837ab"})]}),t("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),t("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),t("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),t("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),t("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}function El({style:e,...r}){return t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...r,children:t("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:t("g",{transform:"scale(5.12,5.12)",children:t("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}function Tl(r){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...r,children:[t("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),t("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}function xl(r){return e("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...r,children:[t("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),t("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),t("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}const _l=({style:e,...r})=>t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...r,children:t("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});let Al={google:{name:"Google",component:bl},discord:{name:"Discord",component:wl},github:{name:"Github",component:vl},linkedin:{name:"LinkedIn",component:El},twitter:{name:"Twitter",component:_l},spotify:{name:"Spotify",component:Tl},instagram:{name:"Instagram",component:$l},tiktok:{name:"Tiktok",component:xl},apple:{name:"Apple",component:yl}};const kl=e=>e in Al?Al[e]:{name:"Unknown",component:Cl};function Sl(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),n=e.get("privy_oauth_provider");if(!t||!r||!n)return{inProgress:!1};let a=!1;try{a=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:n,withPrivyUi:!Nt.get(oe),popupFlow:null!==window.opener&&a,disableSignup:!!Nt.get(le)}}function Nl(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),Nt.del(se),window.history.replaceState({},"",e)}class Il{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}const Pl=({address:e,chainId:t,nonce:r})=>`${window.location.host} wants you to sign in with your Ethereum account:\n${e}\n\nBy signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: ${t}\nNonce: ${r}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class Ol{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,chainId:this.wallet.chainId,address:this.wallet.address,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new _("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.client)throw new _("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw A(e)}}async sign(){if(!this.client)throw new _("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new _("Could not prepare SIWE message");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new _("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new _("SiweFlow has no client instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Pl({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Il(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class Rl{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless_sms/authenticate",{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless_sms/link",{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw A(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:r}){if(!this.api)throw new _("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new _("phone nNumber must be set when initialzing authentication.");let n=Ll(r);try{return await this.api.post("/api/v1/passwordless_sms/init",{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw A(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:r}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:r??!1}}}class Ml extends Rl{async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new _("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post("/api/v1/passwordless_sms/update",{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw A(e)}}constructor(e,t,r){super({phoneNumber:t,captchaToken:r}),this.meta={phoneNumber:t,captchaToken:r,oldPhoneNumber:e,disableSignup:!1}}}function Ll(e){return e?{"privy-ui":"t"}:void 0}class Dl{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless/authenticate",{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless/link",{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw A(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:r}){if(!this.api)throw new _("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new _("Email must be set when initialzing authentication.");let n=Ll(r);try{return await this.api.post("/api/v1/passwordless/init",{email:this.meta.email,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw A(e)}}constructor({email:e,captchaToken:t,disableSignup:r}){this.meta={email:e,captchaToken:t,disableSignup:r??!1}}}class Fl extends Dl{async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new _("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post("/api/v1/passwordless/update",{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw A(e)}}constructor(e,t,r){super({email:t,captchaToken:r}),this.meta={email:t,captchaToken:r,oldAddress:e,disableSignup:!1}}}const Ul=e=>{let t;try{t=new URL(e).hostname}catch(e){return}for(let[e,r]of Object.entries(Wl))if(t.includes(r.hostname))return{walletClientType:e,entry:r}},Wl={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}},bybit_wallet:{id:"15c8b91ade1a4e58f3ce4e7a0dd7f42b47db0c8df7e0d84f63eb39bcb96c4e0f",displayName:"Bybit Wallet",hostname:"bybit.com",mobile:{}}};function Bl(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let Gl="WALLETCONNECT_DEEPLINK_CHOICE";function Hl(e){return e.startsWith("http://")||e.startsWith("https://")}function zl(e,t){if(Hl(e))return jl(e,t);let r=e;return r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function jl(e,t){if(!Hl(e))return zl(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function Vl(e,t){window.open(e,t,"noreferrer noopener")}class ql{get meta(){return this._meta}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");try{let e=await this.api.post("/api/v1/farcaster/authenticate",{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});if(!e)throw new _("No response from authentication");return e}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/farcaster/link",{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw A(e)}}async _startChannelOnce(){if(!this.api)throw new _("Auth flow has no API instance");let e=await this.api.post("/api/v1/farcaster/init",{token:this.captchaToken});b&&!$&&e.connect_uri&&Vl(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new _("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");let e=await this.api.get("/api/v1/farcaster/status",{headers:{"farcaster-channel-token":this.meta.channelToken}});return"completed"===e.state&&(this.message=e.message,this.signature=e.signature,this.fid=e.fid,!0)}constructor(e,t=!1){this._meta={disableSignup:!1},this.captchaToken=e,this.startChannelOnce=new Il(this._startChannelOnce.bind(this)),this.pollForReady=new Il(this._pollForReady.bind(this)),this._meta.disableSignup=t}}class Kl{async initAuthenticationFlow(e){if(!this.api)throw new _("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new _("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new _("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new _("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let t=await e.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post("/api/v1/passkeys/authenticate",{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(t)})}catch(e){if("NotAllowedError"===e.name)throw new _("Passkey request timed out or rejected by user.",void 0,k.PASSKEY_NOT_ALLOWED);throw A(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new _("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new _("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,r=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post("/api/v1/passkeys/link",{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new _("Passkey request timed out or rejected by user.",void 0,k.PASSKEY_NOT_ALLOWED);throw A(e)}}async _initAuthenticateOnce(e){if(!this.api)throw new _("Auth flow has no API instance");let t=Ll(e);return await this.api.post("/api/v1/passkeys/authenticate/init",{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new _("Auth flow has no API instance");return await this.api.post("/api/v1/passkeys/link/init",{})}_transformInitLinkOptionsToCamelCase(e){return{rp:e.rp,user:{id:e.user.id,name:e.user.name,displayName:e.user.display_name},challenge:e.challenge,pubKeyCredParams:e.pub_key_cred_params.map((e=>({type:e.type,alg:e.alg}))),timeout:e.timeout,excludeCredentials:e.exclude_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports}))),authenticatorSelection:{authenticatorAttachment:e.authenticator_selection?.authenticator_attachment,requireResidentKey:e.authenticator_selection?.require_resident_key,residentKey:e.authenticator_selection?.resident_key,userVerification:e.authenticator_selection?.user_verification},attestation:e.attestation,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props?.rk,hmacCreateSecret:e.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}_transformInitAuthenticateOptionsToCamelCase(e){return{challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports})))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification}}_transformAuthenticationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}constructor({captchaToken:e,setPasskeyAuthState:t}){this.initAuthenticateOnce=new Il(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Il(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}class Zl{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new _("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.client)throw new _("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw A(e)}}async sign(){if(!this.client)throw new _("SiwsFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new _("Could not prepare SIWS message");if(!this.wallet.signMessage)throw new _("Wallet does not support signMessage");let e=await this.wallet.signMessage(Buffer.from(this.preparedMessage));return{message:this.preparedMessage,signature:Buffer.from(e).toString("base64")}}async _getNonceOnce(){if(!this.client)throw new _("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new _("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=(({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\nYou are proving you own ${e}.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`)({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Il(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}const Yl=h({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:N,setError:N,setExecuting:N,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:N,reset:N,execute:N});class Xl extends S{constructor(e,t,r){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}const Ql=({children:e,id:r,captchaSiteKey:n,captchaEnabled:a})=>{let i=s(null),[o,l]=d(),[u,h]=d(),[p,m]=d(!1),f=c((()=>a?p||o||u?!p||o||u?o&&!u?{status:"success",token:o}:u?{status:"error",error:u}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,o,u,p]);return t(Yl.Provider,{value:{...f,ref:i,enabled:a,siteKey:n,appId:r,setToken:l,setError:h,setExecuting:m,remove(){a&&(i.current?.remove(),m(!1),h(void 0),l(void 0))},reset(){a&&(i.current?.reset(),m(!1),h(void 0),l(void 0))},execute(){a&&(m(!0),i.current?.execute())},async waitForResult(){if(!a)return"";try{return await de((()=>i.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new Xl("Captcha failed",null,k.CAPTCHA_TIMEOUT)}}},children:e})},Jl=()=>u(Yl);class es{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/telegram/authenticate",{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/telegram/link",{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw A(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function ts(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===k.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===k.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===k.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===k.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===k.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===k.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof Xl&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function rs(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),e.hash="",window.history.replaceState({},"",e)}class ns{static parse(e){try{return new ns(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return re.decodeJwt(e),e}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(e=0){return Date.now()>=1e3*(this.expiration-e)}constructor(e){this.value=e,this._decoded=re.decodeJwt(e)}}class as extends ns{static parse(e){try{return new as(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}const is=({style:r,...n})=>e("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...r},...n,children:[t("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});function os(e){return"ethereum"===e.type}function ls(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],a=t[r];if(n?.address!==a?.address||n&&a&&os(n)&&os(a)&&n?.chainId!==a?.chainId||n?.connectorType!==a?.connectorType||n?.connectedAt!==a?.connectedAt||n?.walletClientType!==a?.walletClientType||n?.isConnected!==a?.isConnected||n?.linked!==a?.linked)return!1}return!0}const ss=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||ce;class ds{on(e,t){if(this.walletProvider)return this.walletProvider.on(e,t);this._subscriptions.push({eventName:e,listener:t})}async request(e){if(!this.walletProvider)throw new I(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw sr(e)}))}constructor(e,t){this.removeListener=(e,t)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(e,t)}catch(e){console.warn("Unable to remove wallet provider listener")}},this.walletTimeout=(e=new dr,t=this.rpcTimeoutDuration)=>new Promise(((r,n)=>setTimeout((()=>{n(e)}),t))),this.setWalletProvider=e=>{this.walletProvider&&this._subscriptions.forEach((e=>{this.removeListener(e.eventName,e.listener)})),this.walletProvider=e,this._subscriptions.forEach((e=>{this.walletProvider?.on(e.eventName,e.listener)}))},this.walletProvider=e,this.rpcTimeoutDuration=t||ce,this._subscriptions=[]}}class cs extends ds{constructor(e){super(e,e.rpcTimeoutDuration)}}class us extends ds{sendAsync(e,t){throw Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}constructor(e){super(e,e.rpcTimeoutDuration)}}let hs;function ps(e){return"ethereum"===e.chainType}class ms extends cr{buildConnectedWallet(e,t,r,a){let o=async()=>!!this.wallets.find((t=>n(t.address)===n(e)));return{type:"ethereum",address:n(e),chainId:t,meta:r,imported:a,switchChain:async r=>{let a,i;if(!o)throw new I("Wallet is not currently connected.");let l=this.wallets.find((t=>n(t.address)===n(e)))?.chainId;if(!l)throw new I("Unable to determine current chainId.");if("number"==typeof r?(a=`0x${r.toString(16)}`,i=r):(a=r,i=Number(r)),l===ue(a))return;let s=this.chains.find((e=>e.id===i));if(!s)throw new I(`Unsupported chainId: ${r}`);let d=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:a}]})};try{return await d()}catch(e){if(((e,t)=>"coinbase_wallet"===t?e.message.includes("addEthereumChain"):4902===e.code||e.message?.includes("4902"))(e,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:a,chainName:s.name,nativeCurrency:s.nativeCurrency,rpcUrls:[s.rpcUrls.default?.http[0]??""],blockExplorerUrls:[s.blockExplorers?.default.url??""]}]}),d();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new I(`Rainbow does not support the chainId ${t}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:o,getEthereumProvider:async()=>{if(!await o())throw new I("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await o())throw new I("Wallet is not currently connected.");return new i(new cs(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await o())throw new I("Wallet is not currently connected.");return new us(this.proxyProvider)},sign:async e=>{if(!await o())throw new I("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t,r=e;try{if(void 0===r){let e=await he((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(r=e)}}catch(e){console.debug("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let a=r[0],i=n(a),o=[];if("privy"===this.walletClientType){let e=Nt.get(pe(i));this.chains.find((t=>t.id===Number(e)))||(Nt.del(pe(i)),e=null),t=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${t} on initialization`)}}else try{let e=await he((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)t=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");t=`0x${e.toString(16)}`}}catch(e){console.warn(`Failed to get chainId from provider, defaulting to ${me}`,e),t=me}let l=ue(t);if(!o.find((e=>n(e.address)===i))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};o.push(this.buildConnectedWallet(n(a),l,e,"embedded_imported"===this.connectorType))}ls(o,this.wallets)||(this.wallets=o,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((t=>e.find((e=>n(e)===n(t.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),new i(new cs(this.proxyProvider)).getSigner().signMessage(e)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,r,n){super(e),this.chainType="ethereum",this.onAccountsChanged=e=>{0===e.length?this.onDisconnect():this.syncAccounts(e)},this.onChainChanged=e=>{this.wallets.forEach((t=>{t.chainId=ue(e),"privy"===this.walletClientType&&Nt.put(pe(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=()=>{this.connected=!0,this.syncAccounts()},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=r,this.rpcConfig=n,this.rpcTimeoutDuration=ss(n,e),this.connected=!1,this.initialized=!1}}let fs=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],gs=(e,t)=>e.makeWeb3Provider({options:t});class ys extends ms{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:is,id:"com.coinbase.wallet"}}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new I("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw sr(e)}}updateConnectionPreference(e){this.connectionOptions=e,this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(gs(hs,this.connectionOptions))}constructor(e,t,r,n,a,i){if(super("coinbase_wallet",e,t,r),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new ds(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=n.coinbaseWallet.connectionOptions??"all",this.walletClientType="smartWalletOnly"===this.connectionOptions?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!hs){let r=[t.id].concat(e.map((e=>e.id))),n="eoaOnly"!==this.connectionOptions?r.filter((e=>!fs.includes(e))):[];n.length>0&&!n.every((e=>fe.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${n.join(", ")}`),hs=new or({appName:a,appLogoUrl:i,appChainIds:r})}this.proxyProvider.setWalletProvider(gs(hs,this.connectionOptions))}}const ws=({...e})=>t("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});class vs extends ms{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[ge(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ws,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:r,rpcConfig:n,imported:a,walletIndex:i}){super("privy",t,r,n),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const Cs=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];class bs extends Error{constructor(e,t,r){super(e),this.code=t,this.data=r}}class $s extends ir{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new bs(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await vC()||!this.address)throw new bs("Disconnected",4900);return(await $C(t,void 0,void 0,this.address)).hash}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new bs(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new bs(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.provider=ye(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",t)}async handlePersonalSign(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for personal_sign");let t=e.params[0],r=e.params[1];return await CC(t,void 0,r)}async handleSignedTypedData(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_signTypedData_v4");let t=e.params[0],r="string"==typeof e.params[1]?JSON.parse(e.params[1]):e.params[1];return await bC(we(r),void 0,t)}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");delete e.params[0].gasPrice,delete e.params[0].maxFeePerGas,delete e.params[0].maxPriorityFeePerGas;let t={...e.params[0],chainId:ge(this.chainId)};try{return await this.provider.send("eth_estimateGas",[t])}catch(e){console.warn(`Gas estimation failed with error: ${e}. Retrying gas estimation by omitting the 'from' address`);try{return delete t.from,await this.provider.send("eth_estimateGas",[t])}catch(t){throw console.warn(`Gas estimation failed with error: ${t} when omitting the 'from' address`),e}}}async request(e){switch(console.debug("Embedded1193Provider.request() called with args",e),e.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return ge(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_sendTransaction":return this.handleSendTransaction(e);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"personal_sign":return this.handlePersonalSign(e);case"eth_signTypedData_v4":return this.handleSignedTypedData(e)}if(!(e=>Cs.includes(e))(e.method))return this.provider.send(e.method,e.params);{let t=await vC();if(await EC(),!t||!this.address)throw new bs("Disconnected",4900);try{return(await this.walletProxy.rpc({accessToken:t,entropyId:this.entropyId,entropyIdVerifier:this.entropyIdVerifier,chainType:"ethereum",hdWalletIndex:this.walletIndex,request:{method:e.method,params:e.params}})).response.data}catch(e){throw console.error(e),new bs("Disconnected",4900)}}}constructor({walletProxy:e,address:t,entropyId:r,entropyIdVerifier:n,rpcConfig:a,chains:i,appId:o,chainId:l=1,walletIndex:s}){super(),this.walletProxy=e,this.address=t,this.entropyId=r,this.entropyIdVerifier=n,this.chainId=l,this.rpcConfig=a,this.chains=i,this.provider=ye(l,this.chains,a,{appId:o}),this.rpcTimeoutDuration=ss(a,"privy"),this.appId=o,this.walletIndex=s}}const Es=({style:e,...r})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...r,children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),Ts=({style:r,...n})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...r},...n,children:[t("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),t("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),t("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),t("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),t("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),t("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),t("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),t("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),t("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),t("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),t("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),t("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),t("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]}),xs=({style:r,...n})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...r},...n,children:[t("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});function _s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var As=0;class ks extends ms{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new I("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw sr(e)}}constructor(e,t,r,n,a){super(a||"unknown",e,t,r),this.connectorType="injected",this.proxyProvider=new ds(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=n;let i=n.provider;this.proxyProvider.setWalletProvider(i)}}var Ss="__private_"+As+++"__walletBranding";class Ns extends ms{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return _s(this,Ss)[Ss]??{name:"Browser Extension",icon:Es,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new I("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw sr(e)}}constructor(e,t,r,n,a){super(a??"unknown",e,t,r),Object.defineProperty(this,Ss,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new ds(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(n),"metamask"===a?_s(this,Ss)[Ss]={name:"MetaMask",icon:Ts,id:"io.metamask"}:"phantom"===a&&(_s(this,Ss)[Ss]={name:"Phantom",icon:xs,id:"phantom"})}}class Is extends ks{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{b||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new I("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw sr(e)}}}class Ps extends ms{get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${e}`)}constructor(e,t){super(e,[],t,{}),this.connectorType="null",this.proxyProvider=new ds(void 0,ce),this.connectorType=e}}class Os extends Ps{get walletBranding(){return{name:"Phantom",icon:xs,id:"phantom"}}constructor(e){super("phantom",e)}}const Rs=({style:r,...n})=>{let{app:a}=$r();return e("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...r},...n,children:[t("rect",{width:"28",height:"28",rx:"3",fill:"dark"===a?.appearance.palette.colorScheme?"#3396ff":"#141414"}),t("g",{clipPath:"url(#clip0_1765_9946)",children:t("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),t("defs",{children:t("clipPath",{id:"clip0_1765_9946",children:t("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};class Ms extends ms{async initialize(){let e=await this.createProvider();if(this.provider=e,this.proxyProvider.setWalletProvider(e),this.subscribeListeners(),e.session){if(this.walletProvider?.session?.peer.metadata.url){let e=Ul(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:t}=await import("@walletconnect/modal");this.modal=new t({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal((e=>{e.open||this.walletProvider?.session||!this.onQrModalClosed||this.onQrModalClosed()}))}async connect(e){return e.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return"metamask"===this.walletClientType?{name:"MetaMask",icon:Ts,id:"io.metamask"}:{name:ve(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Rs,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(e){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Wl[e],this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(Gl)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new ur)},(async()=>{let t="",r=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(r?.length&&(t=r[0]),!t||""===t)throw new I("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let e=Ul(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=ss(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(r),e()})().catch((e=>{t(e?sr(e):new I("Unknown error during connection"))})).finally((()=>this.modal?.closeModal()))}))}disconnect(){this.walletProvider?.disconnect().then((()=>this.onDisconnect())).catch((()=>console.warn("Unable to disconnect Wallet Connect provider")))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(e){this.proxyProvider.setWalletProvider(e)}async createProvider(){let e={};for(let t of this.chains){let r=Ce(t.id,this.chains,this.rpcConfig,this.privyAppId);r&&(e[t.id]=r)}let t=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],r=this.chains.map((e=>e.id)),n=await vr.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:r,optionalEvents:Cr,optionalMethods:br,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return n.on("display_uri",(e=>{if(n.signer.abortPairingAttempt(),b&&this.walletEntry){let{redirect:t,href:r}=function(e,t){let r=Bl(t);if(r.deepLink)return zl(r.deepLink,e);if(r.universalLink)return jl(r.universalLink,e);throw new _(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);(function({href:e,name:t}){try{localStorage.setItem(Gl,JSON.stringify({href:e,name:t}))}catch{}})({href:r,name:this.walletEntry.displayName}),this.redirectUri=t;let n=function(e,t){let r=Bl(t);if(r.universalLink)return jl(r.universalLink,e)}(e,this.walletEntry);n?.redirect&&(this.fallbackUniversalRedirectUri=n.redirect),Vl(t,"_self")}else this.modal?.openModal({uri:e,chains:[this.defaultChain.id]})})),n.on("connect",(()=>{if(this.modal?.closeModal(),n.session?.peer.metadata.url){let e=Ul(n.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown"}})),n}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await(this.walletProvider?.enable())}constructor(e,t,r,n,a,i,o,l){super(l||"unknown",r,n,t),this.connectorType="wallet_connect_v2",this.privyAppId=i,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new ds(void 0,this.rpcTimeoutDuration),l&&(this.walletEntry=Wl[l],this.walletClientType=l)}}const Ls=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>ar(e))).map((e=>n(e)));return!!t?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&t.includes(e.address))).length};class Ds extends ir{get wallets(){let e=new Set,t=this.walletConnectors.flatMap((e=>e.wallets)).sort(((e,t)=>e.connectedAt&&t.connectedAt?t.connectedAt-e.connectedAt:0)).filter((t=>{let r=`${t.address}${t.walletClientType}${t.connectorType}`;return!e.has(r)&&(e.add(r),!0)})),r=t.findIndex((e=>e.address===(this.activeWallet?this.activeWallet:"unknown")));return r>=0&&t.unshift(t.splice(r,1)[0]),t}async initialize(){if(this.initialized)return;Nt.get(be)&&(Nt.getKeys().forEach((e=>{e.startsWith("walletconnect")&&Nt.del(e)})),Nt.del(be));let e=$e({store:this.store,walletList:this.walletList,externalWalletConfig:this.externalWalletConfig,walletChainType:this.walletChainType}).then((e=>{e.forEach((({type:e,eip6963InjectedProvider:t,legacyInjectedProvider:r})=>{this.createEthereumWalletConnector("injected",e,{eip6963InjectedProvider:t,legacyInjectedProvider:r})}))}));this.walletList.includes("coinbase_wallet")&&this.createEthereumWalletConnector("coinbase_wallet","coinbase_wallet"),!Ee()&&this.walletList.includes("phantom")&&"solana-only"!==this.walletChainType&&this.createEthereumWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createEthereumWalletConnector("wallet_connect_v2","unknown"),this.externalWalletConfig.solana.connectors?.get().forEach(this.addSolanaWalletConnector),this.externalWalletConfig.solana.connectors?._setOnConnectorsUpdated?.((e=>{e?.forEach(this.addSolanaWalletConnector)})),await e,this.initialized=!0}findWalletConnector(e,t){return"wallet_connect_v2"===e?this.walletConnectors.filter(ps).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(ps).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findSolanaWalletConnector(e,t){return this.walletConnectors.filter(hr).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findEmbeddedWalletConnectors(){return this.walletConnectors.filter((e=>"embedded"===e.connectorType))}onInitialized(e){e.wallets.forEach((e=>{let t=this.storedConnections.find((t=>t.address===e.address&&t.connectorType===e.connectorType&&t.walletClientType===e.walletClientType));t&&(e.connectedAt=t.connectedAt)})),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(e){e.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnectors({walletProxy:e,rootWallet:t,embeddedWallets:r,defaultChain:n,appId:a}){for(let i of r){let r=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===i.walletIndex));if(r&&ps(r))r.proxyProvider.walletProxy=e;else{let{entropyId:r,entropyIdVerifier:o}=P(t),l=new vs({provider:new $s({walletProxy:e,address:i.address,entropyId:r,entropyIdVerifier:o,rpcConfig:this.rpcConfig,chains:this.chains,appId:a,chainId:n.id,walletIndex:i.walletIndex}),chains:this.chains,defaultChain:n,rpcConfig:this.rpcConfig,imported:!1,walletIndex:i.walletIndex});this.addWalletConnector(l)}}}addImportedWalletConnector(e,t,r,n){let a=this.findWalletConnector("embedded_imported","privy");if(a&&ps(a))a.proxyProvider.walletProxy=e;else{let a=new vs({provider:new $s({walletProxy:e,address:t,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:n,chainId:r.id}),chains:this.chains,walletIndex:0,defaultChain:r,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(a)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.saveConnectionHistory(),this.storedConnections=Fs(),this.emit("walletsUpdated")}removeImportedWalletConnector(){let e=this.findWalletConnector("embedded_imported","privy");if(e){let t=this.walletConnectors.indexOf(e);this.walletConnectors.splice(t,1),this.saveConnectionHistory(),this.storedConnections=Fs(),this.emit("walletsUpdated")}}async createEthereumWalletConnector(e,t,r){let n=this.findWalletConnector(e,t);if(n&&ps(n))return n instanceof Ms&&n.resetConnection(t),n;let a=(()=>"injected"!==e?"coinbase_wallet"===e?new ys(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):"phantom"===e?new Os(this.defaultChain):new Ms(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,t):"metamask"===t&&r?.eip6963InjectedProvider?new Is(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,"metamask"):"metamask"===t&&r?.legacyInjectedProvider?new Ns(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"metamask"):"phantom"===t&&r?.legacyInjectedProvider?new Ns(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"phantom"):r?.legacyInjectedProvider&&"unknown_browser_extension"===t?new Ns(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider):r?.eip6963InjectedProvider?new ks(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,t):void 0)();return a&&this.addWalletConnector(a),a||null}addWalletConnector(e){this.walletConnectors.push(e),e.on("initialized",(()=>this.onInitialized(e))),e.on("walletsUpdated",(()=>this.onWalletsUpdated(e))),e.initialize().catch((e=>{console.debug("Failed to initialize connector",e)}))}saveConnectionHistory(){let e=this.wallets.map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt})));Nt.put(Te,e)}async activeWalletSign(e){let t=this.wallets,r=t.length>0?t[0]:null;return r&&os(r)?r.sign(e):null}setActiveWallet(e){this.activeWallet=n(e),this.emit("walletsUpdated")}constructor(e,t,r,n,a,i,o,l,s,d,c,u){super(),this.addSolanaWalletConnector=async e=>{this.findSolanaWalletConnector("solana_adapter",e.walletClientType)||this.addWalletConnector(e)},this.getEthereumProvider=()=>{let e=this.wallets[0],t=this.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new ds},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=r,this.chains=n,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=i,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=l,this.externalWalletConfig=s,this.privyAppName=d,this.privyAppLogo=c,this.walletChainType=u||"ethereum-only",this.storedConnections=Fs()}}const Fs=()=>{let e=Nt.get(Te);return e&&Array.isArray(e)&&e.map((e=>(e=>e&&"string"==typeof e.address&&"string"==typeof e.connectorType&&"string"==typeof e.walletClientType&&"number"==typeof e.connectedAt)(e))).every(Boolean)?e:[]};let Us=[rl,al,nl,sl];class Ws{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw A(e)}}async post(e,t,r){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...r})}catch(e){throw A(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw A(e)}}constructor({appId:e,appClientId:t,client:r,defaults:n}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=xe,this.client=r,this.defaults=n,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=xr.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:e,options:t})=>{let r=new Headers(t.headers);r.set("privy-app-id",this.appId),this.appClientId&&r.set("privy-client-id",this.appClientId),r.set("privy-ca-id",this.clientAnalyticsId||""),r.set("privy-client",`react-auth:${this.sdkVersion}`);let n=Us.includes(e.toString());if(!r.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:n});null!==e&&r.set("authorization",`Bearer ${e}`)}t.headers=r,t.retryDelay&&(t.retryDelay=3*t.retryDelay)},onRequestError:({error:e})=>{if(e instanceof DOMException&&"AbortError"===e.name)throw new O}})}}let Bs=/paymaster\.biconomy\.io\/api/i,Gs={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}};const Hs=(e,t)=>e&&Bs.test(e)?Gs:t&&t.policy_id?{policyId:t.policy_id}:void 0;function zs(){return!(E&&window.location.origin.startsWith("http://localhost"))}var js,Vs;(js=Vs||(Vs={})).PRIVY="privy_access_token",js.CUSTOMER="customer_access_token";class qs{get token(){return this.privyAccessToken||this.customerAccessToken}getToken(e){return"privy_access_token"===e?this.privyAccessToken:this.customerAccessToken}get customerAccessToken(){return this._getToken(_e)}get privyAccessToken(){return this._getToken(Ae)}_getToken(e){try{let t=Nt.get(e);return"string"==typeof t?ns.throwIfNotWellFormedJwt(t):null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=Nt.get(ke);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get forkedToken(){try{let e=Nt.get(Se);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=Nt.get(Ne(e));if("string"!=typeof t)return null;{let r=new ns(t);return r.isExpired()?(Nt.del(Ne(e)),null):r.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=_r.get(Ie);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(e="privy_access_token"){let t="string"==typeof this.getToken(e),r="string"==typeof this.refreshToken&&this.refreshToken!==Pe;return this.mightHaveServerCookies||t&&r}hasRecoveryCredentials(){return"string"==typeof this.forkedToken}hasActiveAccessToken(e){let t=ns.parse(this.getToken(e));return null!==t&&!t.isExpired(30)}authenticate(e){return this.authenticateOnce.execute(e)}link(e){return this.linkOnce.execute(e)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(e,t){"string"==typeof t?Nt.put(Ne(e),t):Nt.del(Ne(e))}async _authenticate(e){try{let t=await e.authenticate(),{user:r,is_new_user:n,oauth_tokens:a}=t;this.handleTokenResponse(t);let i=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0;return this._trackAuthenticateEvents(e,n),{user:R(r),isNewUser:n,oAuthTokens:i}}catch(e){throw console.warn("Error authenticating session"),M(e)}}_trackAuthenticateEvents(e,t){let r=function(e){return e instanceof Dl?"email":e instanceof Rl?"sms":e instanceof Ol?"siwe":e instanceof ul?"guest":e instanceof dl?"custom_auth":e instanceof fl?e.meta.provider:null}(e);r&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:r,isNewUser:t}}),"siwe"===r&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}})}async _link(e){try{let t=await e.link(),r=t.oauth_tokens,n=r?{provider:r.provider,accessToken:r.access_token,accessTokenExpiresInSeconds:r.access_token_expires_in_seconds,refreshToken:r.refresh_token,refreshTokenExpiresInSeconds:r.refresh_token_expires_in_seconds,scopes:r.scopes}:void 0;return{user:R(t),oAuthTokens:n}}catch(e){throw console.warn("Error linking account"),M(e)}}async _refresh(){if(!this.api)throw new _("Session has no API instance");if(!this.client)throw new _("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,t=this.refreshToken,r=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(e&&t||this.mightHaveServerCookies){let a={};e&&(a.authorization=`Bearer ${e}`),n=await this.api.post(rl,t?{refresh_token:t}:{},{headers:a}),r&&this.clearForkedToken()}else{if(!r)return null;n=await this.api.post(al,{refresh_token:r}),this.clearForkedToken()}return this.handleTokenResponse(n),R(n.user)}catch(e){if(e instanceof L&&e.privyErrorCode===k.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw M(e)}}handleTokenResponse(e){e.session_update_action&&"set"!==e.session_update_action?"clear"===e.session_update_action?this.destroyLocalState():"ignore"===e.session_update_action&&e.token&&(this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token),e.identity_token&&this.storeIdentityToken(e.identity_token)):this._storeAllTokens(e)}_storeAllTokens(e){this.storeRefreshToken(e.refresh_token),this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token),e.identity_token&&this.storeIdentityToken(e.identity_token)}async _destroy(){try{await(this.api?.post(nl,{refresh_token:this.refreshToken}))}catch(e){console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new _("Session has no API instance");let e=this.refreshToken;try{let t=await this.api.post("/api/v1/sessions/fork",{refresh_token:e});return this.storeRefreshToken(t.refresh_token),this.storeCustomerAccessToken(t.token),t.new_session_refresh_token}catch(e){throw M(e)}}destroyLocalState(){this.storeRefreshToken(null),this.storeCustomerAccessToken(null),this.storePrivyAccessToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeCustomerAccessToken(e){if("string"==typeof e){let t=Nt.get(_e);if(Nt.put(_e,e),!this.client?.useServerCookies){let t=ns.parse(e)?.expiration;_r.set(Oe,e,{sameSite:"Strict",secure:zs(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreCustomerAccessToken?.(e)}else Nt.del(_e),_r.remove(Oe),this.client?.onDeleteCustomerAccessToken?.()}storeRefreshToken(e){"string"==typeof e?(Nt.put(ke,e),this.client?.useServerCookies||_r.set(Ie,"t",{sameSite:"Strict",secure:zs(),expires:30})):(Nt.del(ke),_r.remove(Re),_r.remove(Ie))}storePrivyAccessToken(e){"string"==typeof e?Nt.put(Ae,e):Nt.del(Ae)}storeIdentityToken(e){if(this.client?.useServerCookies)return;Nt.put(Me,e);let t=ns.parse(e)?.expiration;_r.set(Le,e,{sameSite:"Strict",secure:zs(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){Nt.del(Me),_r.remove(Le)}clearForkedToken(){Nt.del(Se)}constructor(){this.authenticateOnce=new Il((async e=>this._authenticate(e))),this.linkOnce=new Il((async e=>this._link(e))),this.refreshOnce=new Il(this._refresh.bind(this)),this.destroyOnce=new Il(this._destroy.bind(this)),this.forkSessionOnce=new Il(this._forkSession.bind(this))}}let Ks;var Zs=0,Ys="__private_"+Zs+++"__getOrGenerateClientAnalyticsId";class Xs{initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:r,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:l,appName:s,walletChainType:d}){this.connectors||(this.connectors=new Ds(this.appId,e,t,r,n,a,i,o,l,s,void 0,d))}generateApi(){let e=new Ws({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=e,e}updateApiUrl(e){this.apiUrl=e||this.fallbackApiUrl,this.api=this.generateApi(),e&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new _("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new _("No auth flow in progress.");let{oAuthTokens:e}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:e}}storeProviderAccessToken(e,t){this.session.storeProviderAccessToken(e,t)}getProviderAccessToken(e){return this.session.getProviderAccessToken(e)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(e){e.linkedAccounts.filter((e=>"cross_app"===e.type)).forEach((e=>{this.storeProviderAccessToken(e.providerApp.id,null)}))}startAuthFlow(e){return e.api=this.api,this.authFlow=e,this.authFlow}async initMfaSmsVerification(){try{await this.api.post("/api/v1/mfa/passwordless_sms/init",{action:"verify"})}catch(e){throw A(e)}}async initMfaPasskeyVerification(){try{return(e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports})))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification}))((await this.api.post("/api/v1/mfa/passkeys/init",{})).options)}catch(e){throw A(e)}}async getCrossAppProviderDetails(e){try{return this._cachedProviderAppDetails[e]||(this._cachedProviderAppDetails[e]=await this.api.get(`/api/v1/apps/${e}/cross-app/details`)),this._cachedProviderAppDetails[e]}catch(e){console.error("Error fetching cross app provider details",e)}}async acceptTerms(){try{let e=await this.api.post("/api/v1/users/me/accept_terms",{});return R(e)}catch(e){throw M(e)}}async unlinkEmail(e){try{let t=await this.api.post("/api/v1/passwordless/unlink",{address:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkPhone(e){try{let t=await this.api.post("/api/v1/passwordless_sms/unlink",{phoneNumber:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post("/api/v1/siwe/unlink",{address:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post("/api/v1/siws/unlink",{address:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkOAuth(e,t){try{let r=await this.api.post("/api/v1/oauth/unlink",{provider:e,subject:t});return await this.getAuthenticatedUser()??R(r)}catch(e){throw M(e)}}async unlinkFarcaster(e){try{let t=await this.api.post("/api/v1/farcaster/unlink",{fid:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkTelegram(e){try{let t=await this.api.post("/api/v1/telegram/unlink",{telegram_user_id:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkPasskey(e){try{let t=await this.api.post("/api/v1/passkeys/unlink",{credential_id:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async revokeDelegatedWallet(){try{await this.api.post("/api/v1/wallets/revoke",{})}catch(e){throw M(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:r,options:n}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(sl,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:r?r.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch(e){}}async signMoonpayOnRampUrl(e){try{return this.api.post("/api/v1/plugins/moonpay_on_ramp/sign",e)}catch(e){throw M(e)}}async initCoinbaseOnRamp(e){try{return this.api.post("/api/v1/funding/coinbase_on_ramp/init",e)}catch(e){throw M(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`/api/v1/funding/coinbase_on_ramp/status?partnerUserId=${e}`)}catch(e){throw M(e)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(e){return await this.getPrivyAccessToken(e)||await this.getCustomerAccessToken(e)}async getCustomerAccessToken(e){return await this._getToken(Vs.CUSTOMER,e)}async getPrivyAccessToken(e){return await this._getToken(Vs.PRIVY,e)}async _getToken(e,t){return this.session.getToken(e)?this.session.hasActiveAccessToken(e)?this.session.hasRefreshCredentials(e)?as.parse(this.session.getToken(e))?.appId!==this.appId?(await this.logout(),null):this.session.getToken(e):(this.session.destroyLocalState(),null):!t?.disableAutoRefresh&&this.session.hasRefreshCredentials(e)?(await this.session.refresh(),this.session.getToken(e)):null:null}async getSmartWalletsConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let r=await this.api.get(`/api/v1/apps/${this.appId}/smart_wallets`,{baseURL:this.fallbackApiUrl,headers:e});return r.enabled?{enabled:r.enabled,smartWalletType:r.smart_wallet_type,configuredNetworks:r.configured_networks.map((e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url,paymasterContext:Hs(e.paymaster_url,e.paymaster_context)})))}:{enabled:r.enabled}}catch(e){throw M(e)}}async getServerConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let r=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:e}),n=r.telegram_auth_config?{botId:r.telegram_auth_config.bot_id,botName:r.telegram_auth_config.bot_name,linkEnabled:r.telegram_auth_config.link_enabled,seamlessAuthEnabled:r.telegram_auth_config.seamless_auth_enabled}:void 0,a=r.funding_config?{methods:r.funding_config.methods,options:r.funding_config.options,defaultRecommendedAmount:r.funding_config.default_recommended_amount,defaultRecommendedCurrency:r.funding_config.default_recommended_currency,promptFundingOnWalletCreation:r.funding_config.prompt_funding_on_wallet_creation,crossChainBridgingEnabled:r.funding_config.cross_chain_bridging_enabled}:void 0;return{id:r.id,name:r.name,verificationKey:r.verification_key,logoUrl:r.logo_url||void 0,accentColor:r.accent_color||void 0,showWalletLoginFirst:r.show_wallet_login_first,allowlistConfig:{errorTitle:r.allowlist_config.error_title,errorDetail:r.allowlist_config.error_detail,errorCtaText:r.allowlist_config.cta_text,errorCtaLink:r.allowlist_config.cta_link},walletAuth:r.wallet_auth,solanaWalletAuth:r.solana_wallet_auth,emailAuth:r.email_auth,smsAuth:r.sms_auth,googleOAuth:r.google_oauth,twitterOAuth:r.twitter_oauth,discordOAuth:r.discord_oauth,githubOAuth:r.github_oauth,spotifyOAuth:r.spotify_oauth,instagramOAuth:r.instagram_oauth,tiktokOAuth:r.tiktok_oauth,linkedinOAuth:r.linkedin_oauth,appleOAuth:r.apple_oauth,farcasterAuth:r.farcaster_auth,passkeyAuth:r.passkey_auth,telegramAuth:r.telegram_auth,disablePlusEmails:r.disable_plus_emails,termsAndConditionsUrl:r.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:r.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:r.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:r.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:r.privacy_policy_url,requireUsersAcceptTerms:r.require_users_accept_terms,customApiUrl:r.custom_api_url,walletConnectCloudProjectId:r.wallet_connect_cloud_project_id,fiatOnRampEnabled:r.fiat_on_ramp_enabled,captchaEnabled:r.captcha_enabled,captchaSiteKey:r.captcha_site_key,createdAt:new Date(1e3*r.created_at),updatedAt:new Date(1e3*r.updated_at),mfaMethods:r.mfa_methods,enforceWalletUis:r.enforce_wallet_uis,legacyWalletUiConfig:r.legacy_wallet_ui_config,telegramAuthConfiguration:n,fundingConfig:a}}catch(e){throw M(e)}}async getUsdTokenPrice(e){try{return(await this.api.get(`/api/v1/token_price?chainId=${e.id}&tokenSymbol=${e.nativeCurrency.symbol}`)).usd}catch(t){return void console.error(`Unable to fetch token price for chain with id ${e.id}`)}}async getUsdPriceForSol(){try{return(await this.api.get("/api/v1/token_price?chainId=0&tokenSymbol=SOL")).usd}catch(e){return void console.error("Unable to fetch token price for SOL")}}async requestFarcasterSignerStatus(e){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:e})}catch(e){throw console.error("Unable to fetch Farcaster signer status"),e}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:e,captchaToken:t}){try{return(await this.api.post("/api/v1/siwe/init",{address:e,token:t})).nonce}catch(e){throw M(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:a,mode:i}){return await this.api.post("/api/v1/siwe/authenticate",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:a,mode:i})}async linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:a}){return await this.api.post("/api/v1/siwe/link",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:a})}async linkSmartWallet({message:e,signature:t,smartWalletType:r}){try{let n=await this.api.post("/api/v1/siwe/link_smart_wallet",{message:e,signature:t,smart_wallet_type:r});return R(n)}catch(e){throw M(e)}}async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:a}){try{let i=await this.linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:a});return R(i)}catch(e){throw M(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post("/api/v1/siws/init",{address:e,token:t})).nonce}catch(e){throw M(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n,mode:a}){return await this.api.post("/api/v1/siws/authenticate",{message:e,signature:t,walletClientType:r,connectorType:n,mode:a})}async sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:a,farcasterEmbeddedAddress:i,oAuthUserInfo:o}){try{let l,s;switch(r){case"email":l="/api/v1/passwordless/transfer",s={nonce:e,email:t};break;case"sms":l="/api/v1/passwordless_sms/transfer",s={nonce:e,phoneNumber:t};break;case"siwe":if(l="/api/v1/siwe/transfer",!n)throw Error("Wallet parameters must be defined");s={nonce:e,address:t,...n};break;case"farcaster":l="/api/v1/farcaster/transfer",s={nonce:e,farcaster_id:t,farcaster_embedded_address:i};break;case"telegram":l="/api/v1/telegram/transfer",s={nonce:e,telegram_auth_result:a};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:l="/api/v1/oauth/transfer",s={nonce:e,userInfo:o}}let d=await this.api.post(l,s);return await this.getAuthenticatedUser()??R(d)}catch(e){throw M(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n}){return await this.api.post("/api/v1/siws/link",{message:e,signature:t,walletClientType:r,connectorType:n})}async linkWithSiws({message:e,signature:t,walletClientType:r,connectorType:n}){try{let a=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n});return R(a)}catch(e){throw M(e)}}constructor({apiUrl:e=De,appId:t,appClientId:r,timeout:n=Fe}){Object.defineProperty(this,Ys,{value:Qs}),this._cachedProviderAppDetails={},this.apiUrl=e,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=e!==De&&e.startsWith("https://privy."),this.timeout=n,this.appId=t,this.appClientId=r,this.clientAnalyticsId=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}(this,Ys)[Ys](),Ks||(Ks=new qs),this.session=Ks,this.api=this.generateApi(),this.session.client=this}}function Qs(){if("undefined"==typeof window)return null;try{let e=Nt.get(Ue);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=nr();try{return Nt.put(Ue,e),e}catch(t){return e}}const Js=e=>{let{enabled:r,siteKey:n,appId:a,setError:i,setToken:o,setExecuting:l,ref:s}=Jl(),[,d]=c((()=>n?.split("t:")||[]),[n]);if(p((()=>s.current?.remove),[]),!r)return null;if(!d)throw Error("Unsupported captcha site key");return t("div",{className:"hidden h-0 w-0",children:t(Ar,{...e,ref:s,siteKey:d,options:{action:a,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),i("Captcha failed"),l(!1)},onSuccess:t=>{e.onSuccess?.(t),o(t),l(!1)},onExpire:()=>{e.onExpire?.();try{s.current?.reset(),i(void 0),o(void 0)}catch(e){i("expired_and_failed_reset")}}})})};function ed(e){Pr("configureMfa",e)}const td=kr.button`
1
+ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddress as n,isAddress as a}from"@ethersproject/address";import{Web3Provider as i}from"@ethersproject/providers";import{createStore as o}from"mipd";import l,{useRef as s,useState as d,useMemo as c,useContext as u,createContext as h,useEffect as p,useCallback as m,useReducer as f,forwardRef as v}from"react";import*as C from"react-device-detect";import{isMobile as b,isIOS as $,isSafari as E,isAndroid as T}from"react-device-detect";import{P as _,f as A,a as k,b as S,n as N,c as I,g as P,d as O,e as R,h as M,i as L,u as D,j as F,s as U,k as W,l as B,m as G,o as H,p as z,q as j,r as V,t as q,v as K,w as Z,x as Y,y as X,z as Q,A as J,B as ee,I as te}from"./privy-context-CrcnzDDK.mjs";import*as re from"jose";import{base64url as ne}from"jose";import{g as ae,C as ie,H as oe,O as le,S as se,p as de,D as ce,f as ue,i as he,a as pe,b as me,c as fe,t as ge,d as ye,e as we,s as ve,h as Ce,j as be,k as $e,l as Ee,m as Te,V as xe,n as _e,P as Ae,R as ke,F as Se,o as Ne,q as Ie,r as Pe,u as Oe,v as Re,I as Me,w as Le,x as De,y as Fe,z as Ue,A as We,B as Be,E as Ge,G as He,J as ze,K as je,L as Ve,W as qe,M as Ke,N as Ze,Q as Ye,T as Xe,U as Qe,X as Je,Y as et,Z as tt,_ as rt,$ as nt,a0 as at,a1 as it,a2 as ot,a3 as lt,a4 as st,a5 as dt,a6 as ct,a7 as ut,a8 as ht,a9 as pt,aa as mt,ab as ft,ac as gt,ad as yt,ae as wt,af as vt,ag as Ct,ah as bt,ai as $t,aj as Et,ak as Tt,al as xt}from"./useWallets--4nIqKdE.mjs";export{am as SUPPORTED_CHAINS,ao as addPrivyRpcToChain,an as addRpcUrlOverrideToChain}from"./useWallets--4nIqKdE.mjs";import{t as _t,r as At,i as kt,e as St,a as Nt,B as It,A as Pt,b as Ot,C as Rt,M as Mt,u as Lt,c as Dt,T as Ft,d as Ut,W as Wt,f as Bt,L as Gt,g as Ht,h as zt,j as jt,k as Vt,E as qt,l as Kt,s as Zt,m as Yt,n as Xt,o as Qt,p as Jt,q as er,v as tr,R as rr}from"./useFundWallet-ByXRecrX.mjs";export{x as useConnectWallet,y as useFundWallet,w as useLogin}from"./useFundWallet-ByXRecrX.mjs";import{v4 as nr}from"uuid";import{isHexString as ar}from"@ethersproject/bytes";import ir from"eventemitter3";import{CoinbaseWalletSDK as or}from"@coinbase/wallet-sdk";import{R as lr,f as sr,W as dr,a as cr,U as ur,i as hr,C as pr,P as mr,u as fr,b as gr,n as yr,c as wr}from"./useSolanaWallets-ByOYtyDO.mjs";import{EthereumProvider as vr,OPTIONAL_EVENTS as Cr,OPTIONAL_METHODS as br}from"@walletconnect/ethereum-provider";import{u as $r,M as Er,a as Tr}from"./getEmbeddedConnectedWallet-DQ7twXmj.mjs";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-DQ7twXmj.mjs";import{ofetch as xr}from"ofetch";import _r from"js-cookie";import{Turnstile as Ar}from"@marsidev/react-turnstile";import{styled as kr,css as Sr,keyframes as Nr,createGlobalStyle as Ir}from"styled-components";import{u as Pr,a as Or,p as Rr,e as Mr,P as Lr}from"./events-context-2ZF4RQWB.mjs";import Dr from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Fr from"@heroicons/react/24/outline/ArrowLeftIcon";import Ur from"@heroicons/react/24/outline/ArrowRightIcon";import Wr from"@heroicons/react/24/outline/XMarkIcon";import Br from"@heroicons/react/24/outline/ExclamationTriangleIcon";import Gr from"@heroicons/react/24/outline/WalletIcon";import Hr from"@heroicons/react/24/outline/ExclamationCircleIcon";import zr from"@heroicons/react/24/outline/Square2StackIcon";import jr from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Vr from"@heroicons/react/24/solid/DocumentCheckIcon";import qr from"@heroicons/react/20/solid/CheckIcon";import Kr from"@heroicons/react/24/outline/EnvelopeIcon";import Zr from"@heroicons/react/24/outline/PhoneIcon";import Yr from"@heroicons/react/24/solid/CheckCircleIcon";import Xr from"@heroicons/react/24/solid/XCircleIcon";import Qr from"@heroicons/react/24/outline/CheckCircleIcon";import Jr from"fast-password-entropy";import*as en from"secure-password-utilities";import{DEFAULT_WORDLIST as tn}from"secure-password-utilities/wordlists";import rn from"@heroicons/react/24/outline/ArrowPathIcon";import nn from"@heroicons/react/24/outline/EyeIcon";import on from"@heroicons/react/24/outline/EyeSlashIcon";import ln from"@heroicons/react/24/outline/KeyIcon";import sn from"@heroicons/react/24/outline/ArrowDownTrayIcon";import dn from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import cn from"@heroicons/react/24/outline/DocumentDuplicateIcon";import un from"@heroicons/react/24/outline/UserCircleIcon";import hn from"@heroicons/react/24/solid/LockClosedIcon";import pn from"qrcode";import{createPublicClient as mn,http as fn,createWalletClient as gn,custom as yn,publicActions as wn,parseEther as vn,encodeFunctionData as Cn,decodeFunctionData as bn,decodeAbiParameters as $n,formatEther as En}from"viem";import Tn from"@heroicons/react/24/outline/GlobeAltIcon";import{Menu as xn,MenuButton as _n,MenuItems as An,MenuItem as kn,Transition as Sn,Dialog as Nn,TransitionChild as In,DialogPanel as Pn}from"@headlessui/react";import On from"@heroicons/react/24/outline/ChevronDownIcon";import Rn from"@heroicons/react/24/outline/ClockIcon";import Mn from"@heroicons/react/24/outline/TrashIcon";import Ln from"@heroicons/react/24/solid/CheckBadgeIcon";import Dn from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import Fn from"@heroicons/react/24/outline/PencilIcon";import Un from"@heroicons/react/24/outline/CreditCardIcon";import Wn from"@heroicons/react/24/outline/QrCodeIcon";import Bn from"@heroicons/react/24/outline/InformationCircleIcon";import{parseUnits as Gn,formatUnits as Hn}from"@ethersproject/units";import zn from"@heroicons/react/24/outline/ChevronRightIcon";import jn from"@heroicons/react/24/outline/ShieldCheckIcon";import Vn from"@heroicons/react/24/solid/IdentificationIcon";import qn from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Kn from"@heroicons/react/24/outline/FingerPrintIcon";import Zn from"@heroicons/react/24/outline/MinusCircleIcon";import Yn from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import Xn from"@heroicons/react/24/solid/ShieldCheckIcon";import{VoidSigner as Qn}from"@ethersproject/abstract-signer";import{BigNumber as Jn}from"@ethersproject/bignumber";import{Contract as ea}from"@ethersproject/contracts";import{serialize as ta}from"@ethersproject/transactions";import ra from"fetch-retry";import na from"@heroicons/react/24/outline/CalendarIcon";import aa from"@heroicons/react/24/outline/LockClosedIcon";import ia from"@heroicons/react/24/outline/PencilSquareIcon";import{ChevronDownIcon as oa}from"@heroicons/react/24/outline";import la from"@heroicons/react/24/outline/ClipboardDocumentIcon";import{ErrorCode as sa}from"@ethersproject/logger";import{toUtf8String as da}from"@ethersproject/strings";import"tinycolor2";let ca={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},ua={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0},ha={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},pa={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},ma={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0},fa={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},ga={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},ya={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0},wa={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},va={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},Ca={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0},ba={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},$a={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},Ea={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},Ta=e=>[ca.id,ua.id,ha.id].includes(e),xa=e=>[56,97].includes(e),_a="0x420000000000000000000000000000000000000F",Aa=["function getL1Fee(bytes memory _data) external view returns (uint256)"],ka=e=>[pa.id,ma.id,fa.id,ga.id,ya.id,wa.id,ba.id,Ea.id,$a.id,81457,168587773].includes(e);let Sa={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},Na=ra(fetch,{retries:3,retryDelay:500}),Ia=e=>[va.id,Ca.id,Sa.id].includes(e),Pa=e=>({maxPriorityFee:Gn(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:Gn(e.maxFee.toFixed(9),"gwei").toHexString()}),Oa=async e=>{let t="";switch(e){case va.id:t="https://gasstation.polygon.technology/v2";break;case Ca.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Sa.id:t="https://gasstation.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}let r=await Na(t),n=await r.json();if(r.status>399)throw n;return{safeLow:Pa(n.safeLow),standard:Pa(n.standard),fast:Pa(n.fast)}};async function Ra(e,t){if(!e.gasLimit)throw new lr("gasLimit was not successfully set for transaction.");let r=kt(e.gasLimit),n=Jn.from(0);if(2==e.type){if(!e.maxFeePerGas)throw new lr("maxFeePerGas was not successfully set for transaction of type 2.");n=kt(e.maxFeePerGas)}else{if(!e.gasPrice)throw new lr("gasPrice was not successfully set for transaction of type 0 or 1.");n=kt(e.gasPrice)}let a=r.mul(n),i=Jn.from(0);if(e.chainId&&ka(e.chainId))try{i=await async function(e,t){if(!e.chainId||e.chainId&&!ka(e.chainId))return Jn.from(0);let r=Jn.from(0);try{let n=new ea(_a,Aa,t),a=At(e),i=ta(a);r=await n.getL1Fee(i)}catch(e){}return r}(e,t),a=a.add(i)}catch(e){}return{totalGasEstimate:a,l1ExecutionFeeEstimate:i}}function Ma(e){return/^-?0x[a-f0-9]+$/i.test(e)}async function La(e,t,r){if(t.chainId=Number(t.chainId),function(e){for(let t of["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"]){let r=e[t];if(void 0!==r&&!function(e){let t="number"==typeof e,r="bigint"==typeof e,n="string"==typeof e&&Ma(e);return t||r||n}(r))throw Error(`Transaction request property '${t}' must be a valid number, bigint, or hex string representing a quantity`)}if("number"!=typeof e.chainId)throw Error("Transaction request property 'chainId' must be a number")}(t),t.from||(t.from=e),!t.nonce){let n=new Qn(e,r);t.nonce=await n.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await async function(e,t){try{return(await t.estimateGas(e)).toHexString()}catch(r){let n;if("message"in r&&r.message.includes("insufficient funds")&&(console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'value'`),n=await async function({txRequest:e,provider:t}){try{let r={...e,value:void 0};return(await t.estimateGas(r)).toHexString()}catch(e){return console.warn(`Gas estimation failed with error: ${e} when omitting the 'value'`),null}}({txRequest:e,provider:t})),n||(console.warn(`Gas estimation failed with error: ${r}. Retrying gas estimation by omitting the 'from'`),n=await async function({txRequest:e,provider:t}){try{let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}catch(e){return console.warn(`Gas estimation failed with error: ${e} when omitting the 'from' address`),null}}({txRequest:e,provider:t})),!n)throw r;return n}}(t,r)),"string"==typeof t.type&&Ma(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),0===(t=Ia(t.chainId)?await async function(e){if(!Ia(e.chainId))throw Error("Invalid chain ID for Polygon gas estimation.");if(void 0===e.type&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await Oa(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee),e.gasPrice&&(console.warn("`gasPrice` is not supported on this chain and will be ignored. Use `maxPriorityFeePerGas` and/or `maxFeePerGas` instead."),delete e.gasPrice)}catch(e){throw Error(`Failed to set gas prices from Polygon gas station with error: ${e}.`)}return e}(t):Ta(t.chainId)?await(async(e,t)=>{if(!Ta(e.chainId))throw Error("Invalid chain ID for Arbitrum gas estimation.");if(void 0===e.type&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let t=r.mul(Jn.from(120)).div(Jn.from(100));e.maxFeePerGas=_t(t),e.maxPriorityFeePerGas=_t(Jn.from(0))}}catch(e){throw Error(`Failed to set gas price for Arbitrum transaction: ${e}.`)}return e})(t,r):ka(t.chainId)?await(async(e,t)=>{if(!ka(e.chainId))throw Error("Invalid chain ID for OP Stack gas estimation.");if(void 0===e.type&&(e.type=2),e.gasPrice&&(console.warn("`gasPrice` is not supported on this chain and will be ignored. Use `maxPriorityFeePerGas` and/or `maxFeePerGas` instead."),delete e.gasPrice),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw Error("Unable to fetch baseFee for last block.");let n=Jn.from(r).mul(Jn.from(126)).div(Jn.from(100)).add(Jn.from(e.maxPriorityFeePerGas));e.maxFeePerGas=_t(n)}}catch(e){throw Error(`Failed to set gas price for OP stack transaction: ${e}.`)}return e})(t,r):xa(t.chainId)?await(async(e,t)=>{if(!xa(e.chainId))throw Error("Invalid chain ID for BSC gas estimation.");if(void 0===e.type?e.type=0:1!=e.type&&2!=e.type||console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e})(t,r):await(async(e,t)=>{if(void 0===e.type&&(e.type=2),2===e.type){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e})(t,r)).type&&delete t.accessList,2!==t.type&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}var Da={AC:"40123",AD:"312345",AE:"501234567",AF:"701234567",AG:"2684641234",AI:"2642351234",AL:"672123456",AM:"77123456",AO:"923123456",AR:"91123456789",AS:"6847331234",AT:"664123456",AU:"412345678",AW:"5601234",AX:"412345678",AZ:"401234567",BA:"61123456",BB:"2462501234",BD:"1812345678",BE:"470123456",BF:"70123456",BG:"43012345",BH:"36001234",BI:"79561234",BJ:"90011234",BL:"690001234",BM:"4413701234",BN:"7123456",BO:"71234567",BQ:"3181234",BR:"11961234567",BS:"2423591234",BT:"17123456",BW:"71123456",BY:"294911911",BZ:"6221234",CA:"5062345678",CC:"412345678",CD:"991234567",CF:"70012345",CG:"061234567",CH:"781234567",CI:"0123456789",CK:"71234",CL:"221234567",CM:"671234567",CN:"13123456789",CO:"3211234567",CR:"83123456",CU:"51234567",CV:"9911234",CW:"95181234",CX:"412345678",CY:"96123456",CZ:"601123456",DE:"15123456789",DJ:"77831001",DK:"32123456",DM:"7672251234",DO:"8092345678",DZ:"551234567",EC:"991234567",EE:"51234567",EG:"1001234567",EH:"650123456",ER:"7123456",ES:"612345678",ET:"911234567",FI:"412345678",FJ:"7012345",FK:"51234",FM:"3501234",FO:"211234",FR:"612345678",GA:"06031234",GB:"7400123456",GD:"4734031234",GE:"555123456",GF:"694201234",GG:"7781123456",GH:"231234567",GI:"57123456",GL:"221234",GM:"3012345",GN:"601123456",GP:"690001234",GQ:"222123456",GR:"6912345678",GT:"51234567",GU:"6713001234",GW:"955012345",GY:"6091234",HK:"51234567",HN:"91234567",HR:"921234567",HT:"34101234",HU:"201234567",ID:"812345678",IE:"850123456",IL:"502345678",IM:"7924123456",IN:"8123456789",IO:"3801234",IQ:"7912345678",IR:"9123456789",IS:"6111234",IT:"3123456789",JE:"7797712345",JM:"8762101234",JO:"790123456",JP:"9012345678",KE:"712123456",KG:"700123456",KH:"91234567",KI:"72001234",KM:"3212345",KN:"8697652917",KP:"1921234567",KR:"1020000000",KW:"50012345",KY:"3453231234",KZ:"7710009998",LA:"2023123456",LB:"71123456",LC:"7582845678",LI:"660234567",LK:"712345678",LR:"770123456",LS:"50123456",LT:"61234567",LU:"628123456",LV:"21234567",LY:"912345678",MA:"650123456",MC:"612345678",MD:"62112345",ME:"67622901",MF:"690001234",MG:"321234567",MH:"2351234",MK:"72345678",ML:"65012345",MM:"92123456",MN:"88123456",MO:"66123456",MP:"6702345678",MQ:"696201234",MR:"22123456",MS:"6644923456",MT:"96961234",MU:"52512345",MV:"7712345",MW:"991234567",MX:"12221234567",MY:"123456789",MZ:"821234567",NA:"811234567",NC:"751234",NE:"93123456",NF:"381234",NG:"8021234567",NI:"81234567",NL:"612345678",NO:"40612345",NP:"9841234567",NR:"5551234",NU:"8884012",NZ:"211234567",OM:"92123456",PA:"61234567",PE:"912345678",PF:"87123456",PG:"70123456",PH:"9051234567",PK:"3012345678",PL:"512345678",PM:"551234",PR:"7872345678",PS:"599123456",PT:"912345678",PW:"6201234",PY:"961456789",QA:"33123456",RE:"692123456",RO:"712034567",RS:"601234567",RU:"9123456789",RW:"720123456",SA:"512345678",SB:"7421234",SC:"2510123",SD:"911231234",SE:"701234567",SG:"81234567",SH:"51234",SI:"31234567",SJ:"41234567",SK:"912123456",SL:"25123456",SM:"66661212",SN:"701234567",SO:"71123456",SR:"7412345",SS:"977123456",ST:"9812345",SV:"70123456",SX:"7215205678",SY:"944567890",SZ:"76123456",TA:"8999",TC:"6492311234",TD:"63012345",TG:"90112345",TH:"812345678",TJ:"917123456",TK:"7290",TL:"77212345",TM:"66123456",TN:"20123456",TO:"7715123",TR:"5012345678",TT:"8682911234",TV:"901234",TW:"912345678",TZ:"621234567",UA:"501234567",UG:"712345678",US:"2015550123",UY:"94231234",UZ:"912345678",VA:"3123456789",VC:"7844301234",VE:"4121234567",VG:"2843001234",VI:"3406421234",VN:"912345678",VU:"5912345",WF:"821234",WS:"7212345",XK:"43201234",YE:"712345678",YT:"639012345",ZA:"711234567",ZM:"955123456",ZW:"712345678"},Fa={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],BL:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0(4(?:[14]4|56)|[579])?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[0-79])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","[56]94\\d{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([3-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","9008\\d{3}|(?:[2-467]\\d\\d|510|862)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[25]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29[1289]|389)","529(?:1[1-46-9]|2[013-8]|90)|5(?:298|389)[0-46-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5293[01]\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|9[0-289])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[0189]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-5])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","596\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","1(?:(?:[27]2|44|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[047]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],NU:["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|80\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-6])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-5]))\\d{4}"],["69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-27]|8[0-8]|9[0-479]))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-5]|76(?:2[27]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[2378]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[237-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-8]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|77|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[04]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","[1-6]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["6"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|616)","5(?:[0-59]|6161)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["5056(?:[0-35-9]\\d|4[46])\\d{4}|(?:4722|505[2-57-9]|983[29])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[0-2]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","(?:0004|4)\\d{9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[7,8,10,13],[["(\\d{3})(\\d{4})","$1 $2",["405|8|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["4"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","810","200\\d{6}|(?:33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[23]"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|5[0-4]|6\\d|[78]0)\\d{4}"],["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"[0-36-9]\\d{8}",[9],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-36-9]"]]],0,0,0,0,0,0,[0,["[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[013-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function Ua(e,t){var r=Array.prototype.slice.call(t);return r.push(Fa),e.apply(this,r)}function Wa(e){return(Wa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ba(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ga(e){var t="function"==typeof Map?new Map:void 0;return(Ga=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Ha(e,arguments,Va(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ja(r,e)})(e)}function Ha(e,t,r){return(Ha=za()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&ja(a,r.prototype),a}).apply(null,arguments)}function za(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function ja(e,t){return(ja=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Va(e){return(Va=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qa=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ja(e,t)}(n,Ga(Error));var t,r=(t=za(),function(){var e=Va(n);return function(e,t){if(t&&("object"===Wa(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return Ba(e)}(this,t?Reflect.construct(e,arguments,Va(this).constructor):e.apply(this,arguments))});function n(e){var t;return function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,n),Object.setPrototypeOf(Ba(t=r.call(this,e)),n.prototype),t.name=t.constructor.name,t}return Object.defineProperty(n,"prototype",{writable:!1}),n}(),Ka="0-90-9٠-٩۰-۹",Za="".concat("-‐-―−ー-").concat("//").concat("..").concat("  ­​⁠ ").concat("()()[]\\[\\]").concat("~⁓∼~");function Ya(e,t){e=e.split("-"),t=t.split("-");for(var r=e[0].split("."),n=t[0].split("."),a=0;a<3;a++){var i=Number(r[a]),o=Number(n[a]);if(i>o)return 1;if(o>i)return-1;if(!isNaN(i)&&isNaN(o))return 1;if(isNaN(i)&&!isNaN(o))return-1}return e[1]&&t[1]?e[1]>t[1]?1:e[1]<t[1]?-1:0:!e[1]&&t[1]?1:e[1]&&!t[1]?-1:0}function Xa(e){return(Xa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qa(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function Ja(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var ei=" ext. ",ti=/^\d+$/,ri=function(){function e(t){Qa(this,e),function(e){if(!e)throw Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!si(e)||!si(e.countries))throw Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(si(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+di(e)+": "+e,"."))}(t),this.metadata=t,ui.call(this,t)}return Ja(e,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter((function(e){return"001"!==e}))}},{key:"getCountryMetadata",value:function(e){return this.metadata.countries[e]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(e){return void 0!==this.getCountryMetadata(e)}},{key:"hasCallingCode",value:function(e){if(this.getCountryCodesForCallingCode(e))return!0;if(this.nonGeographic()){if(this.nonGeographic()[e])return!0}else{var t=this.countryCallingCodes()[e];if(t&&1===t.length&&"001"===t[0])return!0}}},{key:"isNonGeographicCallingCode",value:function(e){return this.nonGeographic()?!!this.nonGeographic()[e]:!this.getCountryCodesForCallingCode(e)}},{key:"country",value:function(e){return this.selectNumberingPlan(e)}},{key:"selectNumberingPlan",value:function(e,t){if(e&&ti.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw Error("Unknown country: ".concat(e));this.numberingPlan=new ni(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw Error("Unknown calling code: ".concat(t));this.numberingPlan=new ni(this.getNumberingPlanMetadata(t),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(e){var t=this.countryCallingCodes()[e];if(t){if(1===t.length&&3===t[0].length)return;return t}}},{key:"getCountryCodeForCallingCode",value:function(e){var t=this.getCountryCodesForCallingCode(e);if(t)return t[0]}},{key:"getNumberingPlanMetadata",value:function(e){var t=this.getCountryCodeForCallingCode(e);if(t)return this.getCountryMetadata(t);if(this.nonGeographic()){var r=this.nonGeographic()[e];if(r)return r}else{var n=this.countryCallingCodes()[e];if(n&&1===n.length&&"001"===n[0])return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(e){return this.numberingPlan.type(e)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(e){return this.selectNumberingPlan(e)}},{key:"hasSelectedNumberingPlan",value:function(){return void 0!==this.numberingPlan}}]),e}(),ni=function(){function e(t,r){Qa(this,e),this.globalMetadataObject=r,this.metadata=t,ui.call(this,r.metadata)}return Ja(e,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(e){return e[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var e=this;return(this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[]).map((function(t){return new ai(t,e)}))}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(e){return e[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return!(this.types()&&0===this.types().length||!this.types())}},{key:"type",value:function(e){if(this.hasTypes()&&li(this.types(),e))return new oi(li(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?ei:this.metadata[13]||ei}}]),e}(),ai=function(){function e(t,r){Qa(this,e),this._format=t,this.metadata=r}return Ja(e,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!(!this.nationalPrefixFormattingRule()||ii.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),ii=/^\(?\$1\)?$/,oi=function(){function e(t,r){Qa(this,e),this.type=t,this.metadata=r}return Ja(e,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),e}();function li(e,t){switch(t){case"FIXED_LINE":return e[0];case"MOBILE":return e[1];case"TOLL_FREE":return e[2];case"PREMIUM_RATE":return e[3];case"PERSONAL_NUMBER":return e[4];case"VOICEMAIL":return e[5];case"UAN":return e[6];case"PAGER":return e[7];case"VOIP":return e[8];case"SHARED_COST":return e[9]}}var si=function(e){return"object"===Xa(e)},di=function(e){return Xa(e)};function ci(e,t){if((t=new ri(t)).hasCountry(e))return t.country(e).countryCallingCode();throw Error("Unknown country: ".concat(e))}function ui(e){var t=e.version;"number"==typeof t?(this.v1=1===t,this.v2=2===t,this.v3=3===t,this.v4=4===t):t?-1===Ya(t,"1.2.0")?this.v2=!0:-1===Ya(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var hi=function(e){return"([".concat(Ka,"]{1,").concat(e,"})")};function pi(e){var t="[  \\t,]*",r="[:\\..]?[  \\t,-]*",n="[  \\t]*";return";ext="+hi("20")+"|"+t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+r+hi("20")+"#?|"+t+"(?:[xx##~~]|int|int)"+r+hi("9")+"#?|[- ]+"+hi("6")+"#|"+n+"(?:,{2}|;)"+r+hi("15")+"#?|"+n+"(?:,)+"+r+hi("9")+"#?"}var mi=RegExp("^[++]{0,1}(?:["+Za+"]*["+Ka+"]){1,2}$","i"),fi="[++]{0,1}(?:["+Za+"]*["+Ka+"]){3,}["+Za+Ka+"]*(?:"+pi()+")?",gi=RegExp("^["+Ka+"]{2}$|^"+fi+"$","i"),yi=RegExp("(?:"+pi()+")$","i");function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var vi={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function Ci(e){for(var t,r="",n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return wi(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wi(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=n()).done;){var a=vi[t.value];a&&(r+=a)}return r}function bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function $i(e){for(var t,r="",n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return bi(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bi(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.split(""));!(t=n()).done;)r+=function(e,t){if("+"===e){if(t)return;return"+"}return vi[e]}(t.value,r)||"";return r}function Ei(e,t){return function(e,t,r){var n=r.type(void 0),a=n&&n.possibleLengths()||r.possibleLengths();if(!a)return"IS_POSSIBLE";var i=e.length,o=a[0];return o===i?"IS_POSSIBLE":o>i?"TOO_SHORT":a[a.length-1]<i?"TOO_LONG":a.indexOf(i,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,0,t)}function Ti(e,t){return"IS_POSSIBLE"===Ei(e,t)}function xi(e,t){return e=e||"",RegExp("^(?:"+t+")$").test(e)}function _i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Ai=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function ki(e,t,r){if(t=t||{},e.country){(r=new ri(r)).selectNumberingPlan(e.country,e.countryCallingCode);var n=t.v2?e.nationalNumber:e.phone;if(xi(n,r.nationalNumberPattern())){if(Si(n,"FIXED_LINE",r))return r.type("MOBILE")&&""===r.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":r.type("MOBILE")?Si(n,"MOBILE",r)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var a,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return _i(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _i(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Ai);!(a=i()).done;){var o=a.value;if(Si(n,o,r))return o}}}}function Si(e,t,r){return!(!(t=r.type(t))||!t.pattern())&&!(t.possibleLengths()&&0>t.possibleLengths().indexOf(e.length))&&xi(e,t.pattern())}function Ni(e){return e.replace(RegExp("[".concat(Za,"]+"),"g")," ").trim()}var Ii=/(\$\d)/;function Pi(e,t,r){var n=r.useInternationalFormat,a=r.withNationalPrefix;r.carrierCode,r.metadata;var i=e.replace(new RegExp(t.pattern()),n?t.internationalFormat():a&&t.nationalPrefixFormattingRule()?t.format().replace(Ii,t.nationalPrefixFormattingRule()):t.format());return n?Ni(i):i}var Oi=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Mi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Li(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mi(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Di={formatExtension:function(e,t,r){return"".concat(e).concat(r.ext()).concat(t)}};function Fi(e,t,r,n,a){var i=function(e,t){for(var r,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Ri(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ri(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(r=n()).done;){var a=r.value;if(a.leadingDigitsPatterns().length>0){var i=a.leadingDigitsPatterns()[a.leadingDigitsPatterns().length-1];if(0!==t.search(i))continue}if(xi(t,a.pattern()))return a}}(n.formats(),e);return i?Pi(e,i,{useInternationalFormat:"INTERNATIONAL"===r,withNationalPrefix:!i.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!a||!1!==a.nationalPrefix,carrierCode:t,metadata:n}):e}function Ui(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Wi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ui(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ui(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Bi=function(){var e;function t(e,r,n){if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),!e)throw TypeError("`country` or `countryCallingCode` not passed");if(!r)throw TypeError("`nationalNumber` not passed");if(!n)throw TypeError("`metadata` not passed");var a,i,o,l=(o=new ri(n),Gi(e)?(a=e,o.selectNumberingPlan(a),i=o.countryCallingCode()):i=e,{country:a,countryCallingCode:i}),s=l.country,d=l.countryCallingCode;this.country=s,this.countryCallingCode=d,this.nationalNumber=r,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return n}}return e=[{key:"setExt",value:function(e){this.ext=e}},{key:"getPossibleCountries",value:function(){var e,t,r,n;return this.country?[this.country]:(e=this.countryCallingCode,t=this.nationalNumber,(n=new ri(r=this.getMetadata()).getCountryCodesForCallingCode(e))?n.filter((function(e){var n;return(n=new ri(r)).selectNumberingPlan(e),n.numberingPlan.possibleLengths().indexOf(t.length)>=0})):[])}},{key:"isPossible",value:function(){return function(e,t,r){if(void 0===t&&(t={}),r=new ri(r),t.v2){if(!e.countryCallingCode)throw Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode)}else{if(!e.phone)return!1;if(e.country){if(!r.hasCountry(e.country))throw Error("Unknown country: ".concat(e.country));r.country(e.country)}else{if(!e.countryCallingCode)throw Error("Invalid phone number object passed");r.selectNumberingPlan(e.countryCallingCode)}}if(r.possibleLengths())return Ti(e.phone||e.nationalNumber,r);if(e.countryCallingCode&&r.isNonGeographicCallingCode(e.countryCallingCode))return!0;throw Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){var e,t;return e={v2:!0},t=this.getMetadata(),e=e||{},(t=new ri(t)).selectNumberingPlan(this.country,this.countryCallingCode),t.hasTypes()?void 0!==ki(this,e,t.metadata):xi(e.v2?this.nationalNumber:this.phone,t.nationalNumberPattern())}},{key:"isNonGeographic",value:function(){return new ri(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return ki(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return function(e,t,r,n){if(r=r?Li(Li({},Di),r):Di,n=new ri(n),e.country&&"001"!==e.country){if(!n.hasCountry(e.country))throw Error("Unknown country: ".concat(e.country));n.country(e.country)}else{if(!e.countryCallingCode)return e.phone||"";n.selectNumberingPlan(e.countryCallingCode)}var a,i,o,l,s,d,c,u,h,p,m,f,g,y=n.countryCallingCode(),w=r.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return w?(a=g=Fi(w,e.carrierCode,"NATIONAL",n,r),i=e.ext,o=n,l=r.formatExtension,i?l(a,i,o):a):"";case"INTERNATIONAL":return w?(g=Fi(w,null,"INTERNATIONAL",n,r),s=g="+".concat(y," ").concat(g),d=e.ext,c=n,u=r.formatExtension,d?u(s,d,c):s):"+".concat(y);case"E.164":return"+".concat(y).concat(w);case"RFC3966":return function(e){var t=e.number,r=e.ext;if(!t)return"";if("+"!==t[0])throw Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(t).concat(r?";ext="+r:"")}({number:"+".concat(y).concat(w),ext:e.ext});case"IDD":if(!r.fromCountry)return;return h=function(e,t,r,n,a){if(ci(n,a.metadata)===r){var i,o=Fi(e,t,"NATIONAL",a);return"1"===r?r+" "+o:o}var l=(void 0,(i=new ri(a.metadata)).selectNumberingPlan(n,undefined),i.defaultIDDPrefix()?i.defaultIDDPrefix():Oi.test(i.IDDPrefix())?i.IDDPrefix():void 0);if(l)return"".concat(l," ").concat(r," ").concat(Fi(e,null,"INTERNATIONAL",a))}(w,e.carrierCode,y,r.fromCountry,n),p=e.ext,m=n,f=r.formatExtension,p?f(h,p,m):h;default:throw Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}(this,e,t?Wi(Wi({},t),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(e){return this.format("NATIONAL",e)}},{key:"formatInternational",value:function(e){return this.format("INTERNATIONAL",e)}},{key:"getURI",value:function(e){return this.format("RFC3966",e)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(),Gi=function(e){return/^[A-Z]{2}$/.test(e)},Hi=RegExp("(["+Ka+"])");function zi(e,t,r,n){if(t){var a=new ri(n);a.selectNumberingPlan(t,r);var i=new RegExp(a.IDDPrefix());if(0===e.search(i)){var o=(e=e.slice(e.match(i)[0].length)).match(Hi);if(!(o&&null!=o[1]&&o[1].length>0&&"0"===o[1]))return e}}}function ji(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var r=RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),n=r.exec(e);if(n){var a,i,o,l=n.length-1,s=l>0&&n[l];if(t.nationalPrefixTransformRule()&&s)a=e.replace(r,t.nationalPrefixTransformRule()),l>1&&(i=n[1]);else{var d=n[0];a=e.slice(d.length),s&&(i=n[1])}if(s){var c=e.indexOf(n[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(o=t.numberingPlan.nationalPrefix())}else o=n[0];return{nationalNumber:a,nationalPrefix:o,carrierCode:i}}}return{nationalNumber:e}}function Vi(e,t){var r=ji(e,t),n=r.carrierCode,a=r.nationalNumber;return a!==e&&(xi(e,t.nationalNumberPattern())&&!xi(a,t.nationalNumberPattern())||t.possibleLengths()&&!function(e,t){switch(Ei(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(a,t))?{nationalNumber:e}:{nationalNumber:a,carrierCode:n}}function qi(e,t,r,n){var a=t?ci(t,n):r;if(0===e.indexOf(a)){(n=new ri(n)).selectNumberingPlan(t,r);var i=e.slice(a.length),o=Vi(i,n).nationalNumber,l=Vi(e,n).nationalNumber;if(!xi(l,n.nationalNumberPattern())&&xi(o,n.nationalNumberPattern())||"TOO_LONG"===Ei(l,n))return{countryCallingCode:a,number:i}}return{number:e}}function Ki(e,t,r,n){if(!e)return{};if("+"!==e[0]){var a,i=zi(e,t,r,n);if(!i||i===e){if(t||r){var o=qi(e,t,r,n),l=o.countryCallingCode,s=o.number;if(l)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:l,number:s}}return{number:e}}a=!0,e="+"+i}if("0"===e[1])return{};n=new ri(n);for(var d=2;d-1<=3&&d<=e.length;){var c=e.slice(1,d);if(n.hasCallingCode(c))return n.selectNumberingPlan(c),{countryCallingCodeSource:a?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(d)};d++}return{}}function Zi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Yi(e,t){var r=t.countries,n=t.defaultCountry,a=t.metadata;a=new ri(a);for(var i,o=[],l=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Zi(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zi(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r);!(i=l()).done;){var s=i.value;if(a.country(s),a.leadingDigits()){if(e&&0===e.search(a.leadingDigits()))return s}else if(ki({phone:e,country:s},void 0,a.metadata)){if(!n||s===n)return s;o.push(s)}}if(o.length>0)return o[0]}function Xi(e,t){var r=t.nationalNumber,n=t.defaultCountry,a=t.metadata,i=a.getCountryCodesForCallingCode(e);if(i)return 1===i.length?i[0]:Yi(r,{countries:i,defaultCountry:n,metadata:a.metadata})}var Qi="(["+Ka+"]|[\\-\\.\\(\\)]?)",Ji=RegExp("^\\+"+Qi+"*["+Ka+"]"+Qi+"*$","g"),eo=RegExp("^(["+Ka+"]+((\\-)*["+Ka+"])*\\.)*[a-zA-Z]+((\\-)*["+Ka+"])*\\.?$","g"),to="tel:",ro=";phone-context=",no=RegExp("[++"+Ka+"]"),io=RegExp("[^"+Ka+"#]+$");function oo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oo(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function so(e){return(so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function co(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function uo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ho(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function po(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ho(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ho(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function mo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mo(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function go(){var e=function(e){var t,r,n,a=function(e){if(Array.isArray(e))return e}(t=Array.prototype.slice.call(e))||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),4!==i.length);o=!0);}catch(e){l=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw a}}return i}}(t)||function(e,t){if(e){if("string"==typeof e)return uo(e,4);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uo(e,4)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=a[0],o=a[1],l=a[2],s=a[3];if("string"!=typeof i)throw TypeError("A text for parsing must be a string.");if(o&&"string"!=typeof o){if("object"!==so(o))throw Error("Invalid second argument: ".concat(o));l?(r=o,n=l):n=o}else s?(r=l,n=s):(r=void 0,n=l),o&&(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?co(Object(r),!0).forEach((function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):co(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({defaultCountry:o},r));return{text:i,options:r,metadata:n}}(arguments),t=e.text,r=e.options,n=e.metadata,a=function(e,t,r){var n;t&&t.defaultCountry&&(n=t.defaultCountry,!r.countries.hasOwnProperty(n))&&(t=po(po({},t),{},{defaultCountry:void 0}));try{return function(e,t,r){if(t=t||{},r=new ri(r),t.defaultCountry&&!r.hasCountry(t.defaultCountry)){if(t.v2)throw new qa("INVALID_COUNTRY");throw Error("Unknown country: ".concat(t.defaultCountry))}var n,a=function(e,t,r){var n=function(e,t){var r,n=t.extractFormattedPhoneNumber,a=function(e){var t=e.indexOf(ro);if(t<0)return null;var r=t+15;if(r>=e.length)return"";var n=e.indexOf(";",r);return n>=0?e.substring(r,n):e.substring(r)}(e);if(null!==a&&(0===a.length||!Ji.test(a)&&!eo.test(a)))throw new qa("NOT_A_NUMBER");if(null===a)r=n(e)||"";else{r="","+"===a.charAt(0)&&(r+=a);var i,o=e.indexOf(to);i=o>=0?o+4:0;var l=e.indexOf(ro);r+=e.substring(i,l)}var s=r.indexOf(";isub=");if(s>0&&(r=r.substring(0,s)),""!==r)return r}(e,{extractFormattedPhoneNumber:function(e){return function(e,t,r){if(e){if(e.length>250){if(r)throw new qa("TOO_LONG");return}if(!1===t)return e;var n=e.search(no);if(!(n<0))return e.slice(n).replace(io,"")}}(e,r,t)}});if(!n)return{};if(!(n.length>=2&&gi.test(n)))return mi.test(n)?{error:"TOO_SHORT"}:{};var a=function(e){var t=e.search(yi);if(t<0)return{};for(var r=e.slice(0,t),n=e.match(yi),a=1;a<n.length;){if(n[a])return{number:r,ext:n[a]};a++}}(n);return a.ext?a:{number:n}}(e,t.v2,t.extract),i=a.number,o=a.ext,l=a.error;if(!i){if(t.v2){if("TOO_SHORT"===l)throw new qa("TOO_SHORT");throw new qa("NOT_A_NUMBER")}return{}}var s=function(e,t,r,n){var a,i=Ki($i(e),t,r,n.metadata),o=i.countryCallingCodeSource,l=i.countryCallingCode,s=i.number;if(l)n.selectNumberingPlan(l);else{if(!s||!t&&!r)return{};n.selectNumberingPlan(t,r),t&&(a=t),l=r||ci(t,n.metadata)}if(!s)return{countryCallingCodeSource:o,countryCallingCode:l};var d=Vi($i(s),n),c=d.nationalNumber,u=d.carrierCode,h=Xi(l,{nationalNumber:c,defaultCountry:t,metadata:n});return h&&(a=h,"001"===h||n.country(a)),{country:a,countryCallingCode:l,countryCallingCodeSource:o,nationalNumber:c,carrierCode:u}}(i,t.defaultCountry,t.defaultCallingCode,r),d=s.country,c=s.nationalNumber,u=s.countryCallingCode,h=s.countryCallingCodeSource,p=s.carrierCode;if(!r.hasSelectedNumberingPlan()){if(t.v2)throw new qa("INVALID_COUNTRY");return{}}if(!c||c.length<2){if(t.v2)throw new qa("TOO_SHORT");return{}}if(c.length>17){if(t.v2)throw new qa("TOO_LONG");return{}}if(t.v2){var m=new Bi(u,c,r.metadata);return d&&(m.country=d),p&&(m.carrierCode=p),o&&(m.ext=o),m.__countryCallingCodeSource=h,m}var f=!!(t.extended?r.hasSelectedNumberingPlan():d)&&xi(c,r.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:u,carrierCode:p,valid:f,possible:!!f||!(!0!==t.extended||!r.possibleLengths()||!Ti(c,r)),phone:c,ext:o}:f?(n={country:d,phone:c},o&&(n.ext=o),n):{}}(e,lo(lo({},t),{},{v2:!0}),r)}catch(e){if(!(e instanceof qa))throw e}}(t,r=fo(fo({},r),{},{extract:!1}),n);return a&&a.isPossible()||!1}var yo=function(){var e;function t(e){var r=e.onCountryChange,n=e.onCallingCodeChange;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.onCountryChange=r,this.onCallingCodeChange=n}return e=[{key:"reset",value:function(e){var t=e.country,r=e.callingCode;this.international=!1,this.missingPlus=!1,this.IDDPrefix=void 0,this.callingCode=void 0,this.digits="",this.resetNationalSignificantNumber(),this.initCountryAndCallingCode(t,r)}},{key:"resetNationalSignificantNumber",value:function(){this.nationalSignificantNumber=this.getNationalDigits(),this.nationalSignificantNumberMatchesInput=!0,this.nationalPrefix=void 0,this.carrierCode=void 0,this.complexPrefixBeforeNationalSignificantNumber=void 0}},{key:"update",value:function(e){for(var t=0,r=Object.keys(e);t<r.length;t++){var n=r[t];this[n]=e[n]}}},{key:"initCountryAndCallingCode",value:function(e,t){this.setCountry(e),this.setCallingCode(t)}},{key:"setCountry",value:function(e){this.country=e,this.onCountryChange(e)}},{key:"setCallingCode",value:function(e){this.callingCode=e,this.onCallingCodeChange(e,this.country)}},{key:"startInternationalNumber",value:function(e,t){this.international=!0,this.initCountryAndCallingCode(e,t)}},{key:"appendDigits",value:function(e){this.digits+=e}},{key:"appendNationalSignificantNumberDigits",value:function(e){this.nationalSignificantNumber+=e}},{key:"getNationalDigits",value:function(){return this.international?this.digits.slice((this.IDDPrefix?this.IDDPrefix.length:0)+(this.callingCode?this.callingCode.length:0)):this.digits}},{key:"getDigitsWithoutInternationalPrefix",value:function(){return this.international&&this.IDDPrefix?this.digits.slice(this.IDDPrefix.length):this.digits}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function wo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var vo=/x/;function Co(e,t){if(t<1)return"";for(var r="";t>1;)1&t&&(r+=e),t>>=1,e+=e;return r+e}function bo(e,t){return")"===e[t]&&t++,function(e){for(var t=[],r=0;r<e.length;)"("===e[r]?t.push(r):")"===e[r]&&t.pop(),r++;var n=0,a="";t.push(e.length);for(var i=0;i<t.length;i++){var o=t[i];a+=e.slice(n,o),n=o+1}return a}(e.slice(0,t))}function $o(e,t,r){var n=r.metadata,a=r.useNationalPrefixFormattingRule,i=r.getSeparatorAfterNationalPrefix,o=Pi(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:a,metadata:n});if(a||(e.nationalPrefix?o=e.nationalPrefix+i(t)+o:e.complexPrefixBeforeNationalSignificantNumber&&(o=e.complexPrefixBeforeNationalSignificantNumber+" "+o)),Ci(o)===e.getNationalDigits())return o}var Eo=function(){var e;function t(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t)}return e=[{key:"parse",value:function(e){if(this.context=[{or:!0,instructions:[]}],this.parsePattern(e),1!==this.context.length)throw Error("Non-finalized contexts left when pattern parse ended");var t=this.context[0],r=t.branches,n=t.instructions;if(r)return{op:"|",args:r.concat([_o(n)])};if(0===n.length)throw Error("Pattern is required");return 1===n.length?n[0]:n}},{key:"startContext",value:function(e){this.context.push(e)}},{key:"endContext",value:function(){this.context.pop()}},{key:"getContext",value:function(){return this.context[this.context.length-1]}},{key:"parsePattern",value:function(e){if(!e)throw Error("Pattern is required");var t=e.match(xo);if(t){var r=t[1],n=e.slice(0,t.index),a=e.slice(t.index+r.length);switch(r){case"(?:":n&&this.parsePattern(n),this.startContext({or:!0,instructions:[],branches:[]});break;case")":if(!this.getContext().or)throw Error('")" operator must be preceded by "(?:" operator');if(n&&this.parsePattern(n),0===this.getContext().instructions.length)throw Error('No instructions found after "|" operator in an "or" group');var i=this.getContext().branches;i.push(_o(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:i});break;case"|":if(!this.getContext().or)throw Error('"|" operator can only be used inside "or" groups');if(n&&this.parsePattern(n),!this.getContext().branches){if(1!==this.context.length)throw Error('"branches" not found in an "or" group context');this.getContext().branches=[]}this.getContext().branches.push(_o(this.getContext().instructions)),this.getContext().instructions=[];break;case"[":n&&this.parsePattern(n),this.startContext({oneOfSet:!0});break;case"]":if(!this.getContext().oneOfSet)throw Error('"]" operator must be preceded by "[" operator');this.endContext(),this.getContext().instructions.push({op:"[]",args:function(e){for(var t=[],r=0;r<e.length;){if("-"===e[r]){if(0===r||r===e.length-1)throw Error("Couldn't parse a one-of set pattern: ".concat(e));for(var n=e[r-1].charCodeAt(0)+1,a=e[r+1].charCodeAt(0)-1,i=n;i<=a;)t.push(String.fromCharCode(i)),i++}else t.push(e[r]);r++}return t}(n)});break;default:throw Error("Unknown operator: ".concat(r))}a&&this.parsePattern(a)}else{if(To.test(e))throw Error("Illegal characters found in a pattern: ".concat(e));this.getContext().instructions=this.getContext().instructions.concat(e.split(""))}}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(),To=/[\(\)\[\]\?\:\|]/,xo=RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function _o(e){return 1===e.length?e[0]:e}function Ao(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ko(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ko(e,void 0)}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ko(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var So=function(){var e;function t(e){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.matchTree=(new Eo).parse(e)}return e=[{key:"match",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).allowOverflow;if(!e)throw Error("String is required");var r=function e(t,r,n){if("string"==typeof r){var a=t.join("");return 0===r.indexOf(a)?t.length===r.length?{match:!0,matchedChars:t}:{partialMatch:!0}:0===a.indexOf(r)?n&&t.length>r.length?{overflow:!0}:{match:!0,matchedChars:t.slice(0,r.length)}:void 0}if(Array.isArray(r)){for(var i=t.slice(),o=0;o<r.length;){var l=e(i,r[o],n&&o===r.length-1);if(!l)return;if(l.overflow)return l;if(!l.match){if(l.partialMatch)return{partialMatch:!0};throw Error("Unsupported match result:\n".concat(JSON.stringify(l,null,2)))}if(0===(i=i.slice(l.matchedChars.length)).length)return o===r.length-1?{match:!0,matchedChars:t}:{partialMatch:!0};o++}return n?{overflow:!0}:{match:!0,matchedChars:t.slice(0,t.length-i.length)}}switch(r.op){case"|":for(var s,d,c=Ao(r.args);!(d=c()).done;){var u=e(t,d.value,n);if(u){if(u.overflow)return u;if(u.match)return{match:!0,matchedChars:u.matchedChars};if(!u.partialMatch)throw Error("Unsupported match result:\n".concat(JSON.stringify(u,null,2)));s=!0}}return s?{partialMatch:!0}:void 0;case"[]":for(var h,p=Ao(r.args);!(h=p()).done;){var m=h.value;if(t[0]===m)return 1===t.length?{match:!0,matchedChars:t}:n?{overflow:!0}:{match:!0,matchedChars:[m]}}return;default:throw Error("Unsupported instruction tree: ".concat(r))}}(e.split(""),this.matchTree,!0);if(r&&r.match&&delete r.matchedChars,!r||!r.overflow||t)return r}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function No(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Io(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Io(e,void 0)}}(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Io(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Po=Co("9",15),Oo=/[- ]/,Ro=RegExp("["+Za+"]*\\$1["+Za+"]*(\\$\\d["+Za+"]*)*$"),Mo=function(){var e;function t(e){e.state;var r=e.metadata;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.metadata=r,this.resetFormat()}return e=[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(e,t){this.resetFormat(),e?(this.isNANP="1"===e.callingCode(),this.matchingFormats=e.formats(),t.nationalSignificantNumber&&this.narrowDownMatchingFormats(t)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(e,t){var r=this;if("IS_POSSIBLE"===Ei(t.nationalSignificantNumber,this.metadata))for(var n,a=No(this.matchingFormats);!(n=a()).done;){var i=n.value,o=function(e,t,r){var n=r.metadata,a=r.shouldTryNationalPrefixFormattingRule,i=r.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,r){var n=r.metadata,a=r.shouldTryNationalPrefixFormattingRule,i=r.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,a(t)){var o=$o(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:i,metadata:n});if(o)return o}return $o(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:i,metadata:n})}(e,t,{metadata:n,shouldTryNationalPrefixFormattingRule:a,getSeparatorAfterNationalPrefix:i})}(t,i,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(e){return r.shouldTryNationalPrefixFormattingRule(e,{international:t.international,nationalPrefix:t.nationalPrefix})},getSeparatorAfterNationalPrefix:function(e){return r.getSeparatorAfterNationalPrefix(e)}});if(o)return this.resetFormat(),this.chosenFormat=i,this.setNationalNumberTemplate(o.replace(/\d/g,"x"),t),this.populatedNationalNumberTemplate=o,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf("x"),o}return this.formatNationalNumberWithNextDigits(e,t)}},{key:"formatNationalNumberWithNextDigits",value:function(e,t){var r=this.chosenFormat,n=this.chooseFormat(t);if(n)return n===r?this.formatNextNationalNumberDigits(e):this.formatNextNationalNumberDigits(t.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(e){var t=this,r=e.nationalSignificantNumber,n=e.nationalPrefix,a=e.international,i=r.length-3;i<0&&(i=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,a,n)&&t.formatMatches(e,r,i)})),this.chosenFormat&&-1===this.matchingFormats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"formatSuits",value:function(e,t,r){return!(r&&!e.usesNationalPrefix()&&!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!t&&!r&&e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(e,t,r){var n=e.leadingDigitsPatterns().length;if(0===n)return!0;r=Math.min(r,n-1);var a=e.leadingDigitsPatterns()[r];if(t.length<3)try{return void 0!==new So(a).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(a,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,r,n=No(this.matchingFormats.slice());!(r=n()).done&&"break"!=(t=r.value,this.chosenFormat===t?"break":Ro.test(this.getFormatFormat(t,e.international))?this.createTemplateForFormat(t,e)?(this.chosenFormat=t,"break"):(this.matchingFormats=this.matchingFormats.filter((function(e){return e!==t})),"continue"):"continue"););return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(e,t){if(!(e.pattern().indexOf("|")>=0)){var r=this.getTemplateForFormat(e,t);return r?(this.setNationalNumberTemplate(r,t),!0):void 0}}},{key:"getSeparatorAfterNationalPrefix",value:function(e){return this.isNANP||e&&e.nationalPrefixFormattingRule()&&Oo.test(e.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(e,t){var r=e.IDDPrefix,n=e.missingPlus;return r?t&&!1===t.spacing?r:r+" ":n?"":"+"}},{key:"getTemplate",value:function(e){if(this.template){for(var t=-1,r=0,n=e.international?this.getInternationalPrefixBeforeCountryCallingCode(e,{spacing:!1}):"";r<n.length+e.getDigitsWithoutInternationalPrefix().length;)t=this.template.indexOf("x",t+1),r++;return bo(this.template,t+1)}}},{key:"setNationalNumberTemplate",value:function(e,t){this.nationalNumberTemplate=e,this.populatedNationalNumberTemplate=e,this.populatedNationalNumberTemplatePosition=-1,t.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g,"x")+Co("x",t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var r=t.nationalSignificantNumber,n=t.international,a=t.nationalPrefix,i=t.complexPrefixBeforeNationalSignificantNumber,o=e.pattern();o=o.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var l=Po.match(o)[0];if(!(r.length>l.length)){var s=RegExp("^"+o+"$"),d=r.replace(/\d/g,"9");s.test(d)&&(l=d);var c,u=this.getFormatFormat(e,n);if(this.shouldTryNationalPrefixFormattingRule(e,{international:n,nationalPrefix:a})){var h=u.replace(Ii,e.nationalPrefixFormattingRule());if(Ci(e.nationalPrefixFormattingRule())===(a||"")+Ci("$1")&&(u=h,c=!0,a))for(var p=a.length;p>0;)u=u.replace(/\d/,"x"),p--}var m=l.replace(new RegExp(o),u).replace(/9/g,"x");return c||(i?m=Co("x",i.length)+" "+m:a&&(m=Co("x",a.length)+this.getSeparatorAfterNationalPrefix(e)+m)),n&&(m=Ni(m)),m}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,r){for(var n,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return wo(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wo(e,void 0)}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r.split(""));!(n=a()).done;){var i=n.value;if(0>e.slice(t+1).search(vo))return;t=e.search(vo),e=e.replace(vo,i)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],bo(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var r=t.international,n=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var a=e.usesNationalPrefix();if(a&&n||!a&&!r)return!0}}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function Lo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);o=!0);}catch(e){l=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw a}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Do(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Do(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Do(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Fo=RegExp("^["+Za+Ka+"]+$","i"),Uo="(?:[++]["+Za+Ka+"]*|["+Za+Ka+"]+)",Wo=RegExp("[^"+Za+Ka+"]+.*$"),Bo=/[^\d\[\]]/,Go=function(){var e;function t(e){var r=e.defaultCountry,n=e.defaultCallingCode,a=e.metadata,i=e.onNationalSignificantNumberChange;!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.defaultCountry=r,this.defaultCallingCode=n,this.metadata=a,this.onNationalSignificantNumberChange=i}return e=[{key:"input",value:function(e,t){var r,n,a,i,o,l=(a=(n=Lo("+"===(r=function(e){var t,r=e.search(Uo);if(!(r<0))return"+"===(e=e.slice(r))[0]&&(t=!0,e=e.slice(1)),e=e.replace(Wo,""),t&&(e="+"+e),e}(e)||"")[0]?[r.slice(1),!0]:[r],2))[0],i=n[1],Fo.test(a)||(a=""),[a,i]),s=Lo(l,2),d=s[0],c=s[1],u=Ci(d);return c&&(t.digits||(t.startInternationalNumber(),u||(o=!0))),u&&this.inputDigits(u,t),{digits:u,justLeadingPlus:o}}},{key:"inputDigits",value:function(e,t){var r=t.digits,n=r.length<3&&r.length+e.length>=3;if(t.appendDigits(e),n&&this.extractIddPrefix(t),this.isWaitingForCountryCallingCode(t)){if(!this.extractCountryCallingCode(t))return}else t.appendNationalSignificantNumberDigits(e);t.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(t.getNationalDigits(),(function(e){return t.update(e)}))}},{key:"isWaitingForCountryCallingCode",value:function(e){var t=e.international,r=e.callingCode;return t&&!r}},{key:"extractCountryCallingCode",value:function(e){var t=Ki("+"+e.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),r=t.countryCallingCode,n=t.number;if(r)return e.setCallingCode(r),e.update({nationalSignificantNumber:n}),!0}},{key:"reset",value:function(e){if(e){this.hasSelectedNumberingPlan=!0;var t=e._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=t&&Bo.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var r=ji(e,this.metadata),n=r.nationalPrefix,a=r.nationalNumber,i=r.carrierCode;if(a!==e)return this.onExtractedNationalNumber(n,i,a,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,r){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,r);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var n=ji(e,this.metadata),a=n.nationalPrefix,i=n.nationalNumber,o=n.carrierCode;if(i!==t)return this.onExtractedNationalNumber(a,o,i,e,r),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,r,n,a){var i,o,l=n.lastIndexOf(r);if(l>=0&&l===n.length-r.length){o=!0;var s=n.slice(0,l);s!==e&&(i=s)}a({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:r,nationalSignificantNumberMatchesInput:o,complexPrefixBeforeNationalSignificantNumber:i}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(e){return!!this.extractAnotherNationalSignificantNumber(e.getNationalDigits(),e.nationalSignificantNumber,(function(t){return e.update(t)}))||(this.extractIddPrefix(e)||this.fixMissingPlus(e)?(this.extractCallingCodeAndNationalSignificantNumber(e),!0):void 0)}},{key:"extractIddPrefix",value:function(e){var t=e.international,r=e.IDDPrefix,n=e.digits;if(e.nationalSignificantNumber,!t&&!r){var a=zi(n,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==a&&a!==n?(e.update({IDDPrefix:n.slice(0,n.length-a.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=qi(e.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),r=t.countryCallingCode;if(t.number,r)return e.update({missingPlus:!0}),this.startInternationalNumber(e,{country:e.country,callingCode:r}),!0}}},{key:"startInternationalNumber",value:function(e,t){var r=t.country,n=t.callingCode;e.startInternationalNumber(r,n),e.nationalSignificantNumber&&(e.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(e){this.extractCountryCallingCode(e)&&this.extractNationalSignificantNumber(e.getNationalDigits(),(function(t){return e.update(t)}))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function Ho(e){return(Ho="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var jo=function(){var e;function t(e,r){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),this.metadata=new ri(r);var n,a=function(e){if(Array.isArray(e))return e}(n=this.getCountryAndCallingCode(e))||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),2!==i.length);o=!0);}catch(e){l=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw a}}return i}}(n)||function(e,t){if(e){if("string"==typeof e)return zo(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zo(e,2)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=a[0],o=a[1];this.defaultCountry=i,this.defaultCallingCode=o,this.reset()}return e=[{key:"getCountryAndCallingCode",value:function(e){var t,r;return e&&("object"===Ho(e)?(t=e.defaultCountry,r=e.defaultCallingCode):t=e),t&&!this.metadata.hasCountry(t)&&(t=void 0),[t,r]}},{key:"input",value:function(e){var t,r=this.parser.input(e,this.state),n=r.digits;if(r.justLeadingPlus)this.formattedOutput="+";else if(n){if(this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state),this.metadata.hasSelectedNumberingPlan()&&(t=this.formatter.format(n,this.state)),void 0===t&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var a=this.state.getNationalDigits();a&&(t=this.formatter.format(a,this.state))}this.formattedOutput=t?this.getFullNumber(t):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new yo({onCountryChange:function(t){e.country=t},onCallingCodeChange:function(t,r){e.metadata.selectNumberingPlan(r,t),e.formatter.reset(e.metadata.numberingPlan,e.state),e.parser.reset(e.metadata.numberingPlan)}}),this.formatter=new Mo({state:this.state,metadata:this.metadata}),this.parser=new Go({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){e.determineTheCountryIfNeeded(),e.formatter.reset(e.metadata.numberingPlan,e.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){if(this.state.digits)return this._getCountry()}},{key:"_getCountry",value:function(){return this.state.country}},{key:"determineTheCountryIfNeeded",value:function(){this.state.country&&!this.isCountryCallingCodeAmbiguous()||this.determineTheCountry()}},{key:"getFullNumber",value:function(e){if(this.isInternational()){var t,r=this.state.callingCode;return t=r?e?"".concat(r," ").concat(e):r:"".concat(this.state.getDigitsWithoutInternationalPrefix()),this.formatter.getInternationalPrefixBeforeCountryCallingCode(this.state,{spacing:!!t})+t}return e}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.complexPrefixBeforeNationalSignificantNumber,n=e.nationalPrefix,a=t,i=r||n;return i&&(a=i+a),a}},{key:"getNonFormattedNumber",value:function(){var e=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(e?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var e=this.getNonFormattedNumber();if(e)return e.replace(/[\+\d]/g,"x")}},{key:"isCountryCallingCodeAmbiguous",value:function(){var e=this.state.callingCode,t=this.metadata.getCountryCodesForCallingCode(e);return t&&t.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(Xi(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var e=this.state,t=e.digits,r=e.callingCode,n=e.country,a=e.nationalSignificantNumber;if(t)return this.isInternational()?r?"+"+r+a:"+"+t:n||r?"+"+(n?this.metadata.countryCallingCode():r)+a:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.carrierCode,n=e.callingCode,a=this._getCountry();if(t&&(a||n)){if(a&&a===this.defaultCountry){var i=new ri(this.metadata.metadata);i.selectNumberingPlan(a);var o=i.numberingPlan.callingCode(),l=this.metadata.getCountryCodesForCallingCode(o);if(l.length>1){var s=Yi(t,{countries:l,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});s&&(a=s)}}var d=new Bi(a||n,t,this.metadata.metadata);return r&&(d.carrierCode=r),d}}},{key:"isPossible",value:function(){var e=this.getNumber();return!!e&&e.isPossible()}},{key:"isValid",value:function(){var e=this.getNumber();return!!e&&e.isValid()}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function Vo(e){return new ri(e).getCountries()}function qo(e,t,r){if(t[e])return new Bi(e,t[e],r)}function Ko(e){return jo.call(this,e,Fa)}function Zo(){return Ua(ci,arguments)}Ko.prototype=Object.create(jo.prototype,{}),Ko.prototype.constructor=Ko;let Yo=(e,t)=>function(){return Ua(go,arguments)}(String(e),t),Xo=(e,t)=>`+${Zo(t)} ${e}`,Qo=e=>`*${e.replaceAll("-","").slice(-4)}`,Jo=function(){return Ua(Vo,arguments)}().map((e=>({code:e,callCode:Zo(e)}))),el={buy:"CARD",send:"CRYPTO_ACCOUNT"},tl={USDC:"2b92315d-eab7-5bef-84fa-089a131333f5",ETH:"d85dce9b-5b73-5c3c-8978-522ce1d1c1b4",BTC:"5b71fc48-3dd3-540c-809b-f8c94d0e68b5",SOL:"4f039497-3af8-5bb3-951c-6df9afa9be1c",POL:"026bcc1e-9163-591c-a709-34dd18b2e7a1"};const rl="/api/v1/sessions",nl="/api/v1/sessions/logout",al="/api/v1/sessions/fork/recover",il="/api/v1/oauth/init",ol="/api/v1/oauth/authenticate",ll="/api/v1/oauth/link",sl="/api/v1/analytics_events";class dl{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/custom_jwt_account/authenticate",{token:this.meta.token})}catch(e){throw A(e)}}async link(){throw Error("Unimplemented")}constructor(e){this.meta={token:e}}}function cl(e){return crypto.getRandomValues(new Uint8Array(e))}class ul{getOrCreateGuestCredential(e){let t=ae(e);if(St()){if(Nt.get(t))return Nt.get(t);{let e=ne.encode(cl(32));return Nt.put(t,e),e}}return ne.encode(cl(32))}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/guest/authenticate",{guest_credential:this.meta.guestCredential})}catch(e){throw A(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function hl(){return ne.encode(cl(36))}function pl(){return hl()}async function ml(e,t="S256"){if("S256"!=t)return e;{let t=await async function(e){let t=(new TextEncoder).encode(e);return new Uint8Array(await crypto.subtle.digest("SHA-256",t))}(e);return ne.encode(t)}}class fl{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new _("User denied confirmation during OAuth flow");let e=function(){let e=Nt.get(ie);if(!e)throw new _("Authentication error.");return e}();try{let t=await this.api.post(ol,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return Nt.del(ie),Nt.del(oe),Nt.del(le),t}catch(e){let t=A(e);if(t.privyErrorCode)throw new _(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new _("Invalid code during oauth flow.",void 0,k.OAUTH_USER_DENIED);throw new _("Invalid code during OAuth flow.",void 0,k.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new _("User denied confirmation during OAuth flow");let e=Nt.get(ie);if(!e)throw new _("Authentication error.");try{let t=await this.api.post(ll,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return Nt.del(ie),t}catch(e){throw A(e)}}async getAuthorizationUrl(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.provider)throw new _("Provider must be set when initializing OAuth authentication.");let e=hl();Nt.put(ie,e);let t=pl();Nt.put(se,t);let r=await ml(e);this.meta.withPrivyUi||Nt.put(oe,!0),this.meta.disableSignup&&Nt.put(le,!0);let n=Ll(this.meta.withPrivyUi);try{return await this.api.post(il,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:r,state_code:t},{headers:{...n}})}catch(e){throw A(e)}}constructor(e){this.meta=e}}function gl(e){return e.charAt(0).toUpperCase()+e.slice(1)}const yl=({style:r,...n})=>e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...r},...n,children:[t("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),t("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]}),wl=({style:r,...n})=>e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...r},...n,children:[t("g",{clipPath:"url(#clip0)",children:t("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),t("defs",{children:t("clipPath",{id:"clip0",children:t("rect",{width:"71",height:"55",fill:"white"})})})]}),vl=({style:e,...r})=>t("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...r,children:t("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})}),Cl=({style:e})=>t(Tn,{style:{color:"var(--privy-color-error)",...e}}),bl=({style:r,...n})=>e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...r},...n,children:[t("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),t("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),t("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),t("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});function $l(r){return e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...r,children:[e("defs",{children:[e("linearGradient",{id:"b",children:[t("stop",{offset:"0",stopColor:"#3771c8"}),t("stop",{stopColor:"#3771c8",offset:".128"}),t("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),e("linearGradient",{id:"a",children:[t("stop",{offset:"0",stopColor:"#fd5"}),t("stop",{offset:".1",stopColor:"#fd5"}),t("stop",{offset:".5",stopColor:"#ff543e"}),t("stop",{offset:"1",stopColor:"#c837ab"})]}),t("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),t("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),t("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),t("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),t("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}function El({style:e,...r}){return t("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...r,children:t("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:t("g",{transform:"scale(5.12,5.12)",children:t("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}function Tl(r){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...r,children:[t("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),t("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}function xl(r){return e("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...r,children:[t("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),t("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),t("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}const _l=({style:e,...r})=>t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...r,children:t("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"currentColor"})});let Al={google:{name:"Google",component:bl},discord:{name:"Discord",component:wl},github:{name:"Github",component:vl},linkedin:{name:"LinkedIn",component:El},twitter:{name:"Twitter",component:_l},spotify:{name:"Spotify",component:Tl},instagram:{name:"Instagram",component:$l},tiktok:{name:"Tiktok",component:xl},apple:{name:"Apple",component:yl}};const kl=e=>e in Al?Al[e]:{name:"Unknown",component:Cl};function Sl(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),n=e.get("privy_oauth_provider");if(!t||!r||!n)return{inProgress:!1};let a=!1;try{a=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:n,withPrivyUi:!Nt.get(oe),popupFlow:null!==window.opener&&a,disableSignup:!!Nt.get(le)}}function Nl(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),Nt.del(se),window.history.replaceState({},"",e)}class Il{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}const Pl=({address:e,chainId:t,nonce:r})=>`${window.location.host} wants you to sign in with your Ethereum account:\n${e}\n\nBy signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: ${t}\nNonce: ${r}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class Ol{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,chainId:this.wallet.chainId,address:this.wallet.address,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new _("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.client)throw new _("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw A(e)}}async sign(){if(!this.client)throw new _("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new _("Could not prepare SIWE message");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new _("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new _("SiweFlow has no client instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=Pl({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Il(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class Rl{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless_sms/authenticate",{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless_sms/link",{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw A(e)}}async sendSmsCode({phoneNumber:e,captchaToken:t,withPrivyUi:r}){if(!this.api)throw new _("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new _("phone nNumber must be set when initialzing authentication.");let n=Ll(r);try{return await this.api.post("/api/v1/passwordless_sms/init",{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw A(e)}}constructor({phoneNumber:e,captchaToken:t,disableSignup:r}){this.meta={phoneNumber:e,captchaToken:t,disableSignup:r??!1}}}class Ml extends Rl{async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new _("Phone number, sms code, and an old phone number must be set prior to calling update.");try{return await this.api.post("/api/v1/passwordless_sms/update",{old_phone_number:this.meta.oldPhoneNumber,new_phone_number:this.meta.phoneNumber,code:this.meta.smsCode})}catch(e){throw A(e)}}constructor(e,t,r){super({phoneNumber:t,captchaToken:r}),this.meta={phoneNumber:t,captchaToken:r,oldPhoneNumber:e,disableSignup:!1}}}function Ll(e){return e?{"privy-ui":"t"}:void 0}class Dl{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless/authenticate",{email:this.meta.email,code:this.meta.emailCode,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{return await this.api.post("/api/v1/passwordless/link",{email:this.meta.email,code:this.meta.emailCode})}catch(e){throw A(e)}}async sendCodeEmail({email:e,captchaToken:t,withPrivyUi:r}){if(!this.api)throw new _("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new _("Email must be set when initialzing authentication.");let n=Ll(r);try{return await this.api.post("/api/v1/passwordless/init",{email:this.meta.email,token:this.meta.captchaToken},{headers:{...n}})}catch(e){throw A(e)}}constructor({email:e,captchaToken:t,disableSignup:r}){this.meta={email:e,captchaToken:t,disableSignup:r??!1}}}class Fl extends Dl{async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new _("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post("/api/v1/passwordless/update",{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(e){throw A(e)}}constructor(e,t,r){super({email:t,captchaToken:r}),this.meta={email:t,captchaToken:r,oldAddress:e,disableSignup:!1}}}const Ul=e=>{let t;try{t=new URL(e).hostname}catch(e){return}for(let[e,r]of Object.entries(Wl))if(t.includes(r.hostname))return{walletClientType:e,entry:r}},Wl={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}},rabby_wallet:{id:"18388be9ac2d02726dbac9777c96efaac06d744b2f6d580fccdd4127a6d01fd1",displayName:"Rabby Wallet",hostname:"rabby.io",mobile:{}},bybit_wallet:{id:"15c8b91ade1a4e58f3ce4e7a0dd7f42b47db0c8df7e0d84f63eb39bcb96c4e0f",displayName:"Bybit Wallet",hostname:"bybit.com",mobile:{}}};function Bl(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let Gl="WALLETCONNECT_DEEPLINK_CHOICE";function Hl(e){return e.startsWith("http://")||e.startsWith("https://")}function zl(e,t){if(Hl(e))return jl(e,t);let r=e;return r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function jl(e,t){if(!Hl(e))return zl(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function Vl(e,t){window.open(e,t,"noreferrer noopener")}class ql{get meta(){return this._meta}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");try{let e=await this.api.post("/api/v1/farcaster/authenticate",{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});if(!e)throw new _("No response from authentication");return e}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/farcaster/link",{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(e){throw A(e)}}async _startChannelOnce(){if(!this.api)throw new _("Auth flow has no API instance");let e=await this.api.post("/api/v1/farcaster/init",{token:this.captchaToken});b&&!$&&e.connect_uri&&Vl(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new _("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");let e=await this.api.get("/api/v1/farcaster/status",{headers:{"farcaster-channel-token":this.meta.channelToken}});return"completed"===e.state&&(this.message=e.message,this.signature=e.signature,this.fid=e.fid,!0)}constructor(e,t=!1){this._meta={disableSignup:!1},this.captchaToken=e,this.startChannelOnce=new Il(this._startChannelOnce.bind(this)),this.pollForReady=new Il(this._pollForReady.bind(this)),this._meta.disableSignup=t}}class Kl{async initAuthenticationFlow(e){if(!this.api)throw new _("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute(e)}async initLinkFlow(){if(!this.api)throw new _("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new _("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new _("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let t=await e.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post("/api/v1/passkeys/authenticate",{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(t)})}catch(e){if("NotAllowedError"===e.name)throw new _("Passkey request timed out or rejected by user.",void 0,k.PASSKEY_NOT_ALLOWED);throw A(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new _("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new _("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,r=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return this.meta.setPasskeyAuthState?.({status:"submitting-response"}),await this.api.post("/api/v1/passkeys/link",{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(r)})}catch(e){if("NotAllowedError"===e.name)throw new _("Passkey request timed out or rejected by user.",void 0,k.PASSKEY_NOT_ALLOWED);throw A(e)}}async _initAuthenticateOnce(e){if(!this.api)throw new _("Auth flow has no API instance");let t=Ll(e);return await this.api.post("/api/v1/passkeys/authenticate/init",{token:this.meta.captchaToken},{headers:{...t}})}async _initLinkOnce(){if(!this.api)throw new _("Auth flow has no API instance");return await this.api.post("/api/v1/passkeys/link/init",{})}_transformInitLinkOptionsToCamelCase(e){return{rp:e.rp,user:{id:e.user.id,name:e.user.name,displayName:e.user.display_name},challenge:e.challenge,pubKeyCredParams:e.pub_key_cred_params.map((e=>({type:e.type,alg:e.alg}))),timeout:e.timeout,excludeCredentials:e.exclude_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports}))),authenticatorSelection:{authenticatorAttachment:e.authenticator_selection?.authenticator_attachment,requireResidentKey:e.authenticator_selection?.require_resident_key,residentKey:e.authenticator_selection?.resident_key,userVerification:e.authenticator_selection?.user_verification},attestation:e.attestation,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props?.rk,hmacCreateSecret:e.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}_transformInitAuthenticateOptionsToCamelCase(e){return{challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports})))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification}}_transformAuthenticationResponseToSnakeCase(e){return{id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}}constructor({captchaToken:e,setPasskeyAuthState:t}){this.initAuthenticateOnce=new Il(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Il(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}class Zl{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new _("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.client)throw new _("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw A(e)}}async sign(){if(!this.client)throw new _("SiwsFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new _("Could not prepare SIWS message");if(!this.wallet.signMessage)throw new _("Wallet does not support signMessage");let e=await this.wallet.signMessage(Buffer.from(this.preparedMessage));return{message:this.preparedMessage,signature:Buffer.from(e).toString("base64")}}async _getNonceOnce(){if(!this.client)throw new _("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new _("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=(({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\nYou are proving you own ${e}.\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`)({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Il(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}const Yl=h({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:N,setError:N,setExecuting:N,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:N,reset:N,execute:N});class Xl extends S{constructor(e,t,r){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}const Ql=({children:e,id:r,captchaSiteKey:n,captchaEnabled:a})=>{let i=s(null),[o,l]=d(),[u,h]=d(),[p,m]=d(!1),f=c((()=>a?p||o||u?!p||o||u?o&&!u?{status:"success",token:o}:u?{status:"error",error:u}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,o,u,p]);return t(Yl.Provider,{value:{...f,ref:i,enabled:a,siteKey:n,appId:r,setToken:l,setError:h,setExecuting:m,remove(){a&&(i.current?.remove(),m(!1),h(void 0),l(void 0))},reset(){a&&(i.current?.reset(),m(!1),h(void 0),l(void 0))},execute(){a&&(m(!0),i.current?.execute())},async waitForResult(){if(!a)return"";try{return await de((()=>i.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new Xl("Captcha failed",null,k.CAPTCHA_TIMEOUT)}}},children:e})},Jl=()=>u(Yl);class es{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/telegram/authenticate",{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post("/api/v1/telegram/link",{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw A(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function ts(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===k.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===k.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===k.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===k.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===k.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===k.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof Xl&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function rs(){let e=new URL(window.location.href);e.searchParams.delete("id"),e.searchParams.delete("hash"),e.searchParams.delete("auth_date"),e.searchParams.delete("first_name"),e.searchParams.delete("last_name"),e.searchParams.delete("username"),e.searchParams.delete("photo_url"),e.hash="",window.history.replaceState({},"",e)}class ns{static parse(e){try{return new ns(e)}catch(e){return null}}static throwIfNotWellFormedJwt(e){return re.decodeJwt(e),e}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(e=0){return Date.now()>=1e3*(this.expiration-e)}constructor(e){this.value=e,this._decoded=re.decodeJwt(e)}}class as extends ns{static parse(e){try{return new as(e)}catch(e){return null}}get appId(){return this._decoded.aid?this._decoded.aid:this.audience}}const is=({style:r,...n})=>e("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...r},...n,children:[t("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});function os(e){return"ethereum"===e.type}function ls(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],a=t[r];if(n?.address!==a?.address||n&&a&&os(n)&&os(a)&&n?.chainId!==a?.chainId||n?.connectorType!==a?.connectorType||n?.connectedAt!==a?.connectedAt||n?.walletClientType!==a?.walletClientType||n?.isConnected!==a?.isConnected||n?.linked!==a?.linked)return!1}return!0}const ss=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||ce;class ds{on(e,t){if(this.walletProvider)return this.walletProvider.on(e,t);this._subscriptions.push({eventName:e,listener:t})}async request(e){if(!this.walletProvider)throw new I(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw sr(e)}))}constructor(e,t){this.removeListener=(e,t)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(e,t)}catch(e){console.warn("Unable to remove wallet provider listener")}},this.walletTimeout=(e=new dr,t=this.rpcTimeoutDuration)=>new Promise(((r,n)=>setTimeout((()=>{n(e)}),t))),this.setWalletProvider=e=>{this.walletProvider&&this._subscriptions.forEach((e=>{this.removeListener(e.eventName,e.listener)})),this.walletProvider=e,this._subscriptions.forEach((e=>{this.walletProvider?.on(e.eventName,e.listener)}))},this.walletProvider=e,this.rpcTimeoutDuration=t||ce,this._subscriptions=[]}}class cs extends ds{constructor(e){super(e,e.rpcTimeoutDuration)}}class us extends ds{sendAsync(e,t){throw Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}constructor(e){super(e,e.rpcTimeoutDuration)}}let hs;function ps(e){return"ethereum"===e.chainType}class ms extends cr{buildConnectedWallet(e,t,r,a){let o=async()=>!!this.wallets.find((t=>n(t.address)===n(e)));return{type:"ethereum",address:n(e),chainId:t,meta:r,imported:a,switchChain:async r=>{let a,i;if(!o)throw new I("Wallet is not currently connected.");let l=this.wallets.find((t=>n(t.address)===n(e)))?.chainId;if(!l)throw new I("Unable to determine current chainId.");if("number"==typeof r?(a=`0x${r.toString(16)}`,i=r):(a=r,i=Number(r)),l===ue(a))return;let s=this.chains.find((e=>e.id===i));if(!s)throw new I(`Unsupported chainId: ${r}`);let d=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:a}]})};try{return await d()}catch(e){if(((e,t)=>"coinbase_wallet"===t?e.message.includes("addEthereumChain"):4902===e.code||e.message?.includes("4902"))(e,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:a,chainName:s.name,nativeCurrency:s.nativeCurrency,rpcUrls:[s.rpcUrls.default?.http[0]??""],blockExplorerUrls:[s.blockExplorers?.default.url??""]}]}),d();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new I(`Rainbow does not support the chainId ${t}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:o,getEthereumProvider:async()=>{if(!await o())throw new I("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await o())throw new I("Wallet is not currently connected.");return new i(new cs(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await o())throw new I("Wallet is not currently connected.");return new us(this.proxyProvider)},sign:async e=>{if(!await o())throw new I("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t,r=e;try{if(void 0===r){let e=await he((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(r=e)}}catch(e){console.debug("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let a=r[0],i=n(a),o=[];if("privy"===this.walletClientType){let e=Nt.get(pe(i));this.chains.find((t=>t.id===Number(e)))||(Nt.del(pe(i)),e=null),t=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${t} on initialization`)}}else try{let e=await he((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)t=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");t=`0x${e.toString(16)}`}}catch(e){console.warn(`Failed to get chainId from provider, defaulting to ${me}`,e),t=me}let l=ue(t);if(!o.find((e=>n(e.address)===i))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};o.push(this.buildConnectedWallet(n(a),l,e,"embedded_imported"===this.connectorType))}ls(o,this.wallets)||(this.wallets=o,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((t=>e.find((e=>n(e)===n(t.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),new i(new cs(this.proxyProvider)).getSigner().signMessage(e)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,r,n){super(e),this.chainType="ethereum",this.onAccountsChanged=e=>{0===e.length?this.onDisconnect():this.syncAccounts(e)},this.onChainChanged=e=>{this.wallets.forEach((t=>{t.chainId=ue(e),"privy"===this.walletClientType&&Nt.put(pe(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=()=>{this.connected=!0,this.syncAccounts()},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=r,this.rpcConfig=n,this.rpcTimeoutDuration=ss(n,e),this.connected=!1,this.initialized=!1}}let fs=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],gs=(e,t)=>e.makeWeb3Provider({options:t});class ys extends ms{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){this.proxyProvider.walletProvider.disconnect(),this.onDisconnect()}get walletBranding(){return{name:this.displayName,icon:is,id:"com.coinbase.wallet"}}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new I("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw sr(e)}}updateConnectionPreference(e){this.connectionOptions=e,this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(gs(hs,this.connectionOptions))}constructor(e,t,r,n,a,i){if(super("coinbase_wallet",e,t,r),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new ds(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.connectionOptions=n.coinbaseWallet.connectionOptions??"all",this.walletClientType="smartWalletOnly"===this.connectionOptions?"coinbase_smart_wallet":"coinbase_wallet","coinbase_smart_wallet"===this.walletClientType&&(this.displayName="Coinbase Smart Wallet"),!hs){let r=[t.id].concat(e.map((e=>e.id))),n="eoaOnly"!==this.connectionOptions?r.filter((e=>!fs.includes(e))):[];n.length>0&&!n.every((e=>fe.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${n.join(", ")}`),hs=new or({appName:a,appLogoUrl:i,appChainIds:r})}this.proxyProvider.setWalletProvider(gs(hs,this.connectionOptions))}}const ws=({...e})=>t("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});class vs extends ms{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[ge(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ws,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:r,rpcConfig:n,imported:a,walletIndex:i}){super("privy",t,r,n),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=i,a&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const Cs=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"];class bs extends Error{constructor(e,t,r){super(e),this.code=t,this.data=r}}class $s extends ir{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new bs(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await bC()||!this.address)throw new bs("Disconnected",4900);return(await TC(t,void 0,void 0,this.address)).hash}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new bs(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new bs(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.provider=ye(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",t)}async handlePersonalSign(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for personal_sign");let t=e.params[0],r=e.params[1];return await $C(t,void 0,r)}async handleSignedTypedData(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_signTypedData_v4");let t=e.params[0],r="string"==typeof e.params[1]?JSON.parse(e.params[1]):e.params[1];return await EC(we(r),void 0,t)}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");delete e.params[0].gasPrice,delete e.params[0].maxFeePerGas,delete e.params[0].maxPriorityFeePerGas;let t={...e.params[0],chainId:ge(this.chainId)};try{return await this.provider.send("eth_estimateGas",[t])}catch(e){console.warn(`Gas estimation failed with error: ${e}. Retrying gas estimation by omitting the 'from' address`);try{return delete t.from,await this.provider.send("eth_estimateGas",[t])}catch(t){throw console.warn(`Gas estimation failed with error: ${t} when omitting the 'from' address`),e}}}async request(e){switch(console.debug("Embedded1193Provider.request() called with args",e),e.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return ge(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_sendTransaction":return this.handleSendTransaction(e);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"personal_sign":return this.handlePersonalSign(e);case"eth_signTypedData_v4":return this.handleSignedTypedData(e)}if(!(e=>Cs.includes(e))(e.method))return this.provider.send(e.method,e.params);{let t=await bC();if(await xC(),!t||!this.address)throw new bs("Disconnected",4900);try{return(await this.walletProxy.rpc({accessToken:t,entropyId:this.entropyId,entropyIdVerifier:this.entropyIdVerifier,chainType:"ethereum",hdWalletIndex:this.walletIndex,request:{method:e.method,params:e.params}})).response.data}catch(e){throw console.error(e),new bs("Disconnected",4900)}}}constructor({walletProxy:e,address:t,entropyId:r,entropyIdVerifier:n,rpcConfig:a,chains:i,appId:o,chainId:l=1,walletIndex:s}){super(),this.walletProxy=e,this.address=t,this.entropyId=r,this.entropyIdVerifier=n,this.chainId=l,this.rpcConfig=a,this.chains=i,this.provider=ye(l,this.chains,a,{appId:o}),this.rpcTimeoutDuration=ss(a,"privy"),this.appId=o,this.walletIndex=s}}const Es=({style:e,...r})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...r,children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),Ts=({style:r,...n})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...r},...n,children:[t("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),t("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),t("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),t("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),t("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),t("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),t("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),t("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),t("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),t("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),t("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),t("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),t("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]}),xs=({style:r,...n})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...r},...n,children:[t("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});function _s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var As=0;class ks extends ms{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new I("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw sr(e)}}constructor(e,t,r,n,a){super(a||"unknown",e,t,r),this.connectorType="injected",this.proxyProvider=new ds(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=n;let i=n.provider;this.proxyProvider.setWalletProvider(i)}}var Ss="__private_"+As+++"__walletBranding";class Ns extends ms{async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return _s(this,Ss)[Ss]??{name:"Browser Extension",icon:Es,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new I("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw sr(e)}}constructor(e,t,r,n,a){super(a??"unknown",e,t,r),Object.defineProperty(this,Ss,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new ds(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(n),"metamask"===a?_s(this,Ss)[Ss]={name:"MetaMask",icon:Ts,id:"io.metamask"}:"phantom"===a&&(_s(this,Ss)[Ss]={name:"Phantom",icon:xs,id:"phantom"})}}class Is extends ks{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{b||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new I("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw sr(e)}}}class Ps extends ms{get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${e}`)}constructor(e,t){super(e,[],t,{}),this.connectorType="null",this.proxyProvider=new ds(void 0,ce),this.connectorType=e}}class Os extends Ps{get walletBranding(){return{name:"Phantom",icon:xs,id:"phantom"}}constructor(e){super("phantom",e)}}const Rs=({style:r,...n})=>{let{app:a}=$r();return e("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...r},...n,children:[t("rect",{width:"28",height:"28",rx:"3",fill:"dark"===a?.appearance.palette.colorScheme?"#3396ff":"#141414"}),t("g",{clipPath:"url(#clip0_1765_9946)",children:t("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),t("defs",{children:t("clipPath",{id:"clip0_1765_9946",children:t("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};class Ms extends ms{async initialize(){let e=await this.createProvider();if(this.provider=e,this.proxyProvider.setWalletProvider(e),this.subscribeListeners(),e.session){if(this.walletProvider?.session?.peer.metadata.url){let e=Ul(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:t}=await import("@walletconnect/modal");this.modal=new t({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal((e=>{e.open||this.walletProvider?.session||!this.onQrModalClosed||this.onQrModalClosed()}))}async connect(e){return e.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return"metamask"===this.walletClientType?{name:"MetaMask",icon:Ts,id:"io.metamask"}:{name:ve(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Rs,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(e){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Wl[e],this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(Gl)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new ur)},(async()=>{let t="",r=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(r?.length&&(t=r[0]),!t||""===t)throw new I("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let e=Ul(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=ss(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(r),e()})().catch((e=>{t(e?sr(e):new I("Unknown error during connection"))})).finally((()=>this.modal?.closeModal()))}))}disconnect(){this.walletProvider?.disconnect().then((()=>this.onDisconnect())).catch((()=>console.warn("Unable to disconnect Wallet Connect provider")))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(e){this.proxyProvider.setWalletProvider(e)}async createProvider(){let e={};for(let t of this.chains){let r=Ce(t.id,this.chains,this.rpcConfig,this.privyAppId);r&&(e[t.id]=r)}let t=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],r=this.chains.map((e=>e.id)),n=await vr.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:r,optionalEvents:Cr,optionalMethods:br,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.toString(),icons:[]}});return n.on("display_uri",(e=>{if(n.signer.abortPairingAttempt(),b&&this.walletEntry){let{redirect:t,href:r}=function(e,t){let r=Bl(t);if(r.deepLink)return zl(r.deepLink,e);if(r.universalLink)return jl(r.universalLink,e);throw new _(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);(function({href:e,name:t}){try{localStorage.setItem(Gl,JSON.stringify({href:e,name:t}))}catch{}})({href:r,name:this.walletEntry.displayName}),this.redirectUri=t;let n=function(e,t){let r=Bl(t);if(r.universalLink)return jl(r.universalLink,e)}(e,this.walletEntry);n?.redirect&&(this.fallbackUniversalRedirectUri=n.redirect),Vl(t,"_self")}else this.modal?.openModal({uri:e,chains:[this.defaultChain.id]})})),n.on("connect",(()=>{if(this.modal?.closeModal(),n.session?.peer.metadata.url){let e=Ul(n.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown"}})),n}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await(this.walletProvider?.enable())}constructor(e,t,r,n,a,i,o,l){super(l||"unknown",r,n,t),this.connectorType="wallet_connect_v2",this.privyAppId=i,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new ds(void 0,this.rpcTimeoutDuration),l&&(this.walletEntry=Wl[l],this.walletClientType=l)}}const Ls=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>ar(e))).map((e=>n(e)));return!!t?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&t.includes(e.address))).length};class Ds extends ir{get wallets(){let e=new Set,t=this.walletConnectors.flatMap((e=>e.wallets)).sort(((e,t)=>e.connectedAt&&t.connectedAt?t.connectedAt-e.connectedAt:0)).filter((t=>{let r=`${t.address}${t.walletClientType}${t.connectorType}`;return!e.has(r)&&(e.add(r),!0)})),r=t.findIndex((e=>e.address===(this.activeWallet?this.activeWallet:"unknown")));return r>=0&&t.unshift(t.splice(r,1)[0]),t}async initialize(){if(this.initialized)return;Nt.get(be)&&(Nt.getKeys().forEach((e=>{e.startsWith("walletconnect")&&Nt.del(e)})),Nt.del(be));let e=$e({store:this.store,walletList:this.walletList,externalWalletConfig:this.externalWalletConfig,walletChainType:this.walletChainType}).then((e=>{e.forEach((({type:e,eip6963InjectedProvider:t,legacyInjectedProvider:r})=>{this.createEthereumWalletConnector("injected",e,{eip6963InjectedProvider:t,legacyInjectedProvider:r})}))}));this.walletList.includes("coinbase_wallet")&&this.createEthereumWalletConnector("coinbase_wallet","coinbase_wallet"),!Ee()&&this.walletList.includes("phantom")&&"solana-only"!==this.walletChainType&&this.createEthereumWalletConnector("phantom","phantom"),this.externalWalletConfig.walletConnect.enabled&&this.createEthereumWalletConnector("wallet_connect_v2","unknown"),this.externalWalletConfig.solana.connectors?.get().forEach(this.addSolanaWalletConnector),this.externalWalletConfig.solana.connectors?._setOnConnectorsUpdated?.((e=>{e?.forEach(this.addSolanaWalletConnector)})),await e,this.initialized=!0}findWalletConnector(e,t){return"wallet_connect_v2"===e?this.walletConnectors.filter(ps).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(ps).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findSolanaWalletConnector(e,t){return this.walletConnectors.filter(hr).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findEmbeddedWalletConnectors(){return this.walletConnectors.filter((e=>"embedded"===e.connectorType))}onInitialized(e){e.wallets.forEach((e=>{let t=this.storedConnections.find((t=>t.address===e.address&&t.connectorType===e.connectorType&&t.walletClientType===e.walletClientType));t&&(e.connectedAt=t.connectedAt)})),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(e){e.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnectors({walletProxy:e,rootWallet:t,embeddedWallets:r,defaultChain:n,appId:a}){for(let i of r){let r=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===i.walletIndex));if(r&&ps(r))r.proxyProvider.walletProxy=e;else{let{entropyId:r,entropyIdVerifier:o}=P(t),l=new vs({provider:new $s({walletProxy:e,address:i.address,entropyId:r,entropyIdVerifier:o,rpcConfig:this.rpcConfig,chains:this.chains,appId:a,chainId:n.id,walletIndex:i.walletIndex}),chains:this.chains,defaultChain:n,rpcConfig:this.rpcConfig,imported:!1,walletIndex:i.walletIndex});this.addWalletConnector(l)}}}addImportedWalletConnector(e,t,r,n){let a=this.findWalletConnector("embedded_imported","privy");if(a&&ps(a))a.proxyProvider.walletProxy=e;else{let a=new vs({provider:new $s({walletProxy:e,address:t,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:n,chainId:r.id}),chains:this.chains,walletIndex:0,defaultChain:r,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(a)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.saveConnectionHistory(),this.storedConnections=Fs(),this.emit("walletsUpdated")}removeImportedWalletConnector(){let e=this.findWalletConnector("embedded_imported","privy");if(e){let t=this.walletConnectors.indexOf(e);this.walletConnectors.splice(t,1),this.saveConnectionHistory(),this.storedConnections=Fs(),this.emit("walletsUpdated")}}async createEthereumWalletConnector(e,t,r){let n=this.findWalletConnector(e,t);if(n&&ps(n))return n instanceof Ms&&n.resetConnection(t),n;let a=(()=>"injected"!==e?"coinbase_wallet"===e?new ys(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):"phantom"===e?new Os(this.defaultChain):new Ms(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,t):"metamask"===t&&r?.eip6963InjectedProvider?new Is(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,"metamask"):"metamask"===t&&r?.legacyInjectedProvider?new Ns(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"metamask"):"phantom"===t&&r?.legacyInjectedProvider?new Ns(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"phantom"):r?.legacyInjectedProvider&&"unknown_browser_extension"===t?new Ns(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider):r?.eip6963InjectedProvider?new ks(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,t):void 0)();return a&&this.addWalletConnector(a),a||null}addWalletConnector(e){this.walletConnectors.push(e),e.on("initialized",(()=>this.onInitialized(e))),e.on("walletsUpdated",(()=>this.onWalletsUpdated(e))),e.initialize().catch((e=>{console.debug("Failed to initialize connector",e)}))}saveConnectionHistory(){let e=this.wallets.map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt})));Nt.put(Te,e)}async activeWalletSign(e){let t=this.wallets,r=t.length>0?t[0]:null;return r&&os(r)?r.sign(e):null}setActiveWallet(e){this.activeWallet=n(e),this.emit("walletsUpdated")}constructor(e,t,r,n,a,i,o,l,s,d,c,u){super(),this.addSolanaWalletConnector=async e=>{this.findSolanaWalletConnector("solana_adapter",e.walletClientType)||this.addWalletConnector(e)},this.getEthereumProvider=()=>{let e=this.wallets[0],t=this.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new ds},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=r,this.chains=n,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=i,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=l,this.externalWalletConfig=s,this.privyAppName=d,this.privyAppLogo=c,this.walletChainType=u||"ethereum-only",this.storedConnections=Fs()}}const Fs=()=>{let e=Nt.get(Te);return e&&Array.isArray(e)&&e.map((e=>(e=>e&&"string"==typeof e.address&&"string"==typeof e.connectorType&&"string"==typeof e.walletClientType&&"number"==typeof e.connectedAt)(e))).every(Boolean)?e:[]};let Us=[rl,al,nl,sl];class Ws{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw A(e)}}async post(e,t,r){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...r})}catch(e){throw A(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw A(e)}}constructor({appId:e,appClientId:t,client:r,defaults:n}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=xe,this.client=r,this.defaults=n,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=xr.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:e,options:t})=>{let r=new Headers(t.headers);r.set("privy-app-id",this.appId),this.appClientId&&r.set("privy-client-id",this.appClientId),r.set("privy-ca-id",this.clientAnalyticsId||""),r.set("privy-client",`react-auth:${this.sdkVersion}`);let n=Us.includes(e.toString());if(!r.has("authorization")){let e=await this.client.getAccessToken({disableAutoRefresh:n});null!==e&&r.set("authorization",`Bearer ${e}`)}t.headers=r,t.retryDelay&&(t.retryDelay=3*t.retryDelay)},onRequestError:({error:e})=>{if(e instanceof DOMException&&"AbortError"===e.name)throw new O}})}}let Bs=/paymaster\.biconomy\.io\/api/i,Gs={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}};const Hs=(e,t)=>e&&Bs.test(e)?Gs:t&&t.policy_id?{policyId:t.policy_id}:void 0;function zs(){return!(E&&window.location.origin.startsWith("http://localhost"))}var js,Vs;(js=Vs||(Vs={})).PRIVY="privy_access_token",js.CUSTOMER="customer_access_token";class qs{get token(){return this.privyAccessToken||this.customerAccessToken}getToken(e){return"privy_access_token"===e?this.privyAccessToken:this.customerAccessToken}get customerAccessToken(){return this._getToken(_e)}get privyAccessToken(){return this._getToken(Ae)}_getToken(e){try{let t=Nt.get(e);return"string"==typeof t?ns.throwIfNotWellFormedJwt(t):null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=Nt.get(ke);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get forkedToken(){try{let e=Nt.get(Se);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=Nt.get(Ne(e));if("string"!=typeof t)return null;{let r=new ns(t);return r.isExpired()?(Nt.del(Ne(e)),null):r.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=_r.get(Ie);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(e="privy_access_token"){let t="string"==typeof this.getToken(e),r="string"==typeof this.refreshToken&&this.refreshToken!==Pe;return this.mightHaveServerCookies||t&&r}hasRecoveryCredentials(){return"string"==typeof this.forkedToken}hasActiveAccessToken(e){let t=ns.parse(this.getToken(e));return null!==t&&!t.isExpired(30)}authenticate(e){return this.authenticateOnce.execute(e)}link(e){return this.linkOnce.execute(e)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}storeProviderAccessToken(e,t){"string"==typeof t?Nt.put(Ne(e),t):Nt.del(Ne(e))}async _authenticate(e){try{let t=await e.authenticate(),{user:r,is_new_user:n,oauth_tokens:a}=t;this.handleTokenResponse(t);let i=a?{provider:a.provider,accessToken:a.access_token,accessTokenExpiresInSeconds:a.access_token_expires_in_seconds,refreshToken:a.refresh_token,refreshTokenExpiresInSeconds:a.refresh_token_expires_in_seconds,scopes:a.scopes}:void 0;return this._trackAuthenticateEvents(e,n),{user:R(r),isNewUser:n,oAuthTokens:i}}catch(e){throw console.warn("Error authenticating session"),M(e)}}_trackAuthenticateEvents(e,t){let r=function(e){return e instanceof Dl?"email":e instanceof Rl?"sms":e instanceof Ol?"siwe":e instanceof ul?"guest":e instanceof dl?"custom_auth":e instanceof fl?e.meta.provider:null}(e);r&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:r,isNewUser:t}}),"siwe"===r&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}})}async _link(e){try{let t=await e.link(),r=t.oauth_tokens,n=r?{provider:r.provider,accessToken:r.access_token,accessTokenExpiresInSeconds:r.access_token_expires_in_seconds,refreshToken:r.refresh_token,refreshTokenExpiresInSeconds:r.refresh_token_expires_in_seconds,scopes:r.scopes}:void 0;return{user:R(t),oAuthTokens:n}}catch(e){throw console.warn("Error linking account"),M(e)}}async _refresh(){if(!this.api)throw new _("Session has no API instance");if(!this.client)throw new _("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let e=this.token,t=this.refreshToken,r=this.forkedToken;if(this.client.useServerCookies&&!this.mightHaveServerCookies&&this.token&&window.location.origin===this.client.apiUrl)return this.destroyLocalState(),null;try{let n;if(e&&t||this.mightHaveServerCookies){let a={};e&&(a.authorization=`Bearer ${e}`),n=await this.api.post(rl,t?{refresh_token:t}:{},{headers:a}),r&&this.clearForkedToken()}else{if(!r)return null;n=await this.api.post(al,{refresh_token:r}),this.clearForkedToken()}return this.handleTokenResponse(n),R(n.user)}catch(e){if(e instanceof L&&e.privyErrorCode===k.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw M(e)}}handleTokenResponse(e){e.session_update_action&&"set"!==e.session_update_action?"clear"===e.session_update_action?this.destroyLocalState():"ignore"===e.session_update_action&&e.token&&(this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token),e.identity_token&&this.storeIdentityToken(e.identity_token)):this._storeAllTokens(e)}_storeAllTokens(e){this.storeRefreshToken(e.refresh_token),this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token),e.identity_token&&this.storeIdentityToken(e.identity_token)}async _destroy(){try{await(this.api?.post(nl,{refresh_token:this.refreshToken}))}catch(e){console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new _("Session has no API instance");let e=this.refreshToken;try{let t=await this.api.post("/api/v1/sessions/fork",{refresh_token:e});return this.storeRefreshToken(t.refresh_token),this.storeCustomerAccessToken(t.token),t.new_session_refresh_token}catch(e){throw M(e)}}destroyLocalState(){this.storeRefreshToken(null),this.storeCustomerAccessToken(null),this.storePrivyAccessToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeCustomerAccessToken(e){if("string"==typeof e){let t=Nt.get(_e);if(Nt.put(_e,e),!this.client?.useServerCookies){let t=ns.parse(e)?.expiration;_r.set(Oe,e,{sameSite:"Strict",secure:zs(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreCustomerAccessToken?.(e)}else Nt.del(_e),_r.remove(Oe),this.client?.onDeleteCustomerAccessToken?.()}storeRefreshToken(e){"string"==typeof e?(Nt.put(ke,e),this.client?.useServerCookies||_r.set(Ie,"t",{sameSite:"Strict",secure:zs(),expires:30})):(Nt.del(ke),_r.remove(Re),_r.remove(Ie))}storePrivyAccessToken(e){"string"==typeof e?Nt.put(Ae,e):Nt.del(Ae)}storeIdentityToken(e){if(this.client?.useServerCookies)return;Nt.put(Me,e);let t=ns.parse(e)?.expiration;_r.set(Le,e,{sameSite:"Strict",secure:zs(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){Nt.del(Me),_r.remove(Le)}clearForkedToken(){Nt.del(Se)}constructor(){this.authenticateOnce=new Il((async e=>this._authenticate(e))),this.linkOnce=new Il((async e=>this._link(e))),this.refreshOnce=new Il(this._refresh.bind(this)),this.destroyOnce=new Il(this._destroy.bind(this)),this.forkSessionOnce=new Il(this._forkSession.bind(this))}}let Ks;var Zs=0,Ys="__private_"+Zs+++"__getOrGenerateClientAnalyticsId";class Xs{initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:r,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:l,appName:s,walletChainType:d}){this.connectors||(this.connectors=new Ds(this.appId,e,t,r,n,a,i,o,l,s,void 0,d))}generateApi(){let e=new Ws({appId:this.appId,appClientId:this.appClientId,client:this,defaults:{baseURL:this.apiUrl,timeout:this.timeout}});return this.session.api=e,e}updateApiUrl(e){this.apiUrl=e||this.fallbackApiUrl,this.api=this.generateApi(),e&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new _("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new _("No auth flow in progress.");let{oAuthTokens:e}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:e}}storeProviderAccessToken(e,t){this.session.storeProviderAccessToken(e,t)}getProviderAccessToken(e){return this.session.getProviderAccessToken(e)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(e){e.linkedAccounts.filter((e=>"cross_app"===e.type)).forEach((e=>{this.storeProviderAccessToken(e.providerApp.id,null)}))}startAuthFlow(e){return e.api=this.api,this.authFlow=e,this.authFlow}async initMfaSmsVerification(){try{await this.api.post("/api/v1/mfa/passwordless_sms/init",{action:"verify"})}catch(e){throw A(e)}}async initMfaPasskeyVerification(){try{return(e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map((e=>({id:e.id,type:e.type,transports:e.transports})))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification}))((await this.api.post("/api/v1/mfa/passkeys/init",{})).options)}catch(e){throw A(e)}}async getCrossAppProviderDetails(e){try{return this._cachedProviderAppDetails[e]||(this._cachedProviderAppDetails[e]=await this.api.get(`/api/v1/apps/${e}/cross-app/details`)),this._cachedProviderAppDetails[e]}catch(e){console.error("Error fetching cross app provider details",e)}}async acceptTerms(){try{let e=await this.api.post("/api/v1/users/me/accept_terms",{});return R(e)}catch(e){throw M(e)}}async unlinkEmail(e){try{let t=await this.api.post("/api/v1/passwordless/unlink",{address:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkPhone(e){try{let t=await this.api.post("/api/v1/passwordless_sms/unlink",{phoneNumber:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post("/api/v1/siwe/unlink",{address:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post("/api/v1/siws/unlink",{address:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkOAuth(e,t){try{let r=await this.api.post("/api/v1/oauth/unlink",{provider:e,subject:t});return await this.getAuthenticatedUser()??R(r)}catch(e){throw M(e)}}async unlinkFarcaster(e){try{let t=await this.api.post("/api/v1/farcaster/unlink",{fid:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkTelegram(e){try{let t=await this.api.post("/api/v1/telegram/unlink",{telegram_user_id:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async unlinkPasskey(e){try{let t=await this.api.post("/api/v1/passkeys/unlink",{credential_id:e});return await this.getAuthenticatedUser()??R(t)}catch(e){throw M(e)}}async revokeDelegatedWallet(){try{await this.api.post("/api/v1/wallets/revoke",{})}catch(e){throw M(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:r,options:n}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(sl,{event_name:e,client_id:this.clientAnalyticsId,payload:{...t||{},clientTimestamp:r?r.toISOString():(new Date).toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch(e){}}async signMoonpayOnRampUrl(e){try{return this.api.post("/api/v1/plugins/moonpay_on_ramp/sign",e)}catch(e){throw M(e)}}async initCoinbaseOnRamp(e){try{return this.api.post("/api/v1/funding/coinbase_on_ramp/init",e)}catch(e){throw M(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`/api/v1/funding/coinbase_on_ramp/status?partnerUserId=${e}`)}catch(e){throw M(e)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(e){return await this.getPrivyAccessToken(e)||await this.getCustomerAccessToken(e)}async getCustomerAccessToken(e){return await this._getToken(Vs.CUSTOMER,e)}async getPrivyAccessToken(e){return await this._getToken(Vs.PRIVY,e)}async _getToken(e,t){return this.session.getToken(e)?this.session.hasActiveAccessToken(e)?this.session.hasRefreshCredentials(e)?as.parse(this.session.getToken(e))?.appId!==this.appId?(await this.logout(),null):this.session.getToken(e):(this.session.destroyLocalState(),null):!t?.disableAutoRefresh&&this.session.hasRefreshCredentials(e)?(await this.session.refresh(),this.session.getToken(e)):null:null}async getSmartWalletsConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let r=await this.api.get(`/api/v1/apps/${this.appId}/smart_wallets`,{baseURL:this.fallbackApiUrl,headers:e});return r.enabled?{enabled:r.enabled,smartWalletType:r.smart_wallet_type,configuredNetworks:r.configured_networks.map((e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url,paymasterContext:Hs(e.paymaster_url,e.paymaster_context)})))}:{enabled:r.enabled}}catch(e){throw M(e)}}async getServerConfig(){try{let e={},t=this.session.token;t&&(e.authorization=`Bearer ${t}`);let r=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:e}),n=r.telegram_auth_config?{botId:r.telegram_auth_config.bot_id,botName:r.telegram_auth_config.bot_name,linkEnabled:r.telegram_auth_config.link_enabled,seamlessAuthEnabled:r.telegram_auth_config.seamless_auth_enabled}:void 0,a=r.funding_config?{methods:r.funding_config.methods,options:r.funding_config.options,defaultRecommendedAmount:r.funding_config.default_recommended_amount,defaultRecommendedCurrency:r.funding_config.default_recommended_currency,promptFundingOnWalletCreation:r.funding_config.prompt_funding_on_wallet_creation,crossChainBridgingEnabled:r.funding_config.cross_chain_bridging_enabled}:void 0;return{id:r.id,name:r.name,verificationKey:r.verification_key,logoUrl:r.logo_url||void 0,accentColor:r.accent_color||void 0,showWalletLoginFirst:r.show_wallet_login_first,allowlistConfig:{errorTitle:r.allowlist_config.error_title,errorDetail:r.allowlist_config.error_detail,errorCtaText:r.allowlist_config.cta_text,errorCtaLink:r.allowlist_config.cta_link},walletAuth:r.wallet_auth,solanaWalletAuth:r.solana_wallet_auth,emailAuth:r.email_auth,smsAuth:r.sms_auth,googleOAuth:r.google_oauth,twitterOAuth:r.twitter_oauth,discordOAuth:r.discord_oauth,githubOAuth:r.github_oauth,spotifyOAuth:r.spotify_oauth,instagramOAuth:r.instagram_oauth,tiktokOAuth:r.tiktok_oauth,linkedinOAuth:r.linkedin_oauth,appleOAuth:r.apple_oauth,farcasterAuth:r.farcaster_auth,passkeyAuth:r.passkey_auth,telegramAuth:r.telegram_auth,disablePlusEmails:r.disable_plus_emails,termsAndConditionsUrl:r.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:r.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:r.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:r.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:r.privacy_policy_url,requireUsersAcceptTerms:r.require_users_accept_terms,customApiUrl:r.custom_api_url,walletConnectCloudProjectId:r.wallet_connect_cloud_project_id,fiatOnRampEnabled:r.fiat_on_ramp_enabled,captchaEnabled:r.captcha_enabled,captchaSiteKey:r.captcha_site_key,createdAt:new Date(1e3*r.created_at),updatedAt:new Date(1e3*r.updated_at),mfaMethods:r.mfa_methods,enforceWalletUis:r.enforce_wallet_uis,legacyWalletUiConfig:r.legacy_wallet_ui_config,telegramAuthConfiguration:n,fundingConfig:a}}catch(e){throw M(e)}}async getUsdTokenPrice(e){try{return(await this.api.get(`/api/v1/token_price?chainId=${e.id}&tokenSymbol=${e.nativeCurrency.symbol}`)).usd}catch(t){return void console.error(`Unable to fetch token price for chain with id ${e.id}`)}}async getUsdPriceForSol(){try{return(await this.api.get("/api/v1/token_price?chainId=0&tokenSymbol=SOL")).usd}catch(e){return void console.error("Unable to fetch token price for SOL")}}async requestFarcasterSignerStatus(e){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:e})}catch(e){throw console.error("Unable to fetch Farcaster signer status"),e}}async forkSession(){return await this.session.forkSession()}async generateSiweNonce({address:e,captchaToken:t}){try{return(await this.api.post("/api/v1/siwe/init",{address:e,token:t})).nonce}catch(e){throw M(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:a,mode:i}){return await this.api.post("/api/v1/siwe/authenticate",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:a,mode:i})}async linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:a}){return await this.api.post("/api/v1/siwe/link",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:a})}async linkSmartWallet({message:e,signature:t,smartWalletType:r}){try{let n=await this.api.post("/api/v1/siwe/link_smart_wallet",{message:e,signature:t,smart_wallet_type:r});return R(n)}catch(e){throw M(e)}}async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:a}){try{let i=await this.linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:a});return R(i)}catch(e){throw M(e)}}async generateSiwsNonce({address:e,captchaToken:t}){try{return(await this.api.post("/api/v1/siws/init",{address:e,token:t})).nonce}catch(e){throw M(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n,mode:a}){return await this.api.post("/api/v1/siws/authenticate",{message:e,signature:t,walletClientType:r,connectorType:n,mode:a})}async sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:a,farcasterEmbeddedAddress:i,oAuthUserInfo:o}){try{let l,s;switch(r){case"email":l="/api/v1/passwordless/transfer",s={nonce:e,email:t};break;case"sms":l="/api/v1/passwordless_sms/transfer",s={nonce:e,phoneNumber:t};break;case"siwe":if(l="/api/v1/siwe/transfer",!n)throw Error("Wallet parameters must be defined");s={nonce:e,address:t,...n};break;case"farcaster":l="/api/v1/farcaster/transfer",s={nonce:e,farcaster_id:t,farcaster_embedded_address:i};break;case"telegram":l="/api/v1/telegram/transfer",s={nonce:e,telegram_auth_result:a};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:l="/api/v1/oauth/transfer",s={nonce:e,userInfo:o}}let d=await this.api.post(l,s);return await this.getAuthenticatedUser()??R(d)}catch(e){throw M(e)}}async linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n}){return await this.api.post("/api/v1/siws/link",{message:e,signature:t,walletClientType:r,connectorType:n})}async linkWithSiws({message:e,signature:t,walletClientType:r,connectorType:n}){try{let a=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n});return R(a)}catch(e){throw M(e)}}constructor({apiUrl:e=De,appId:t,appClientId:r,timeout:n=Fe}){Object.defineProperty(this,Ys,{value:Qs}),this._cachedProviderAppDetails={},this.apiUrl=e,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=e!==De&&e.startsWith("https://privy."),this.timeout=n,this.appId=t,this.appClientId=r,this.clientAnalyticsId=function(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}(this,Ys)[Ys](),Ks||(Ks=new qs),this.session=Ks,this.api=this.generateApi(),this.session.client=this}}function Qs(){if("undefined"==typeof window)return null;try{let e=Nt.get(Ue);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=nr();try{return Nt.put(Ue,e),e}catch(t){return e}}const Js=e=>{let{enabled:r,siteKey:n,appId:a,setError:i,setToken:o,setExecuting:l,ref:s}=Jl(),[,d]=c((()=>n?.split("t:")||[]),[n]);if(p((()=>s.current?.remove),[]),!r)return null;if(!d)throw Error("Unsupported captcha site key");return t("div",{className:"hidden h-0 w-0",children:t(Ar,{...e,ref:s,siteKey:d,options:{action:a,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),i("Captcha failed"),l(!1)},onSuccess:t=>{e.onSuccess?.(t),o(t),l(!1)},onExpire:()=>{e.onExpire?.();try{s.current?.reset(),i(void 0),o(void 0)}catch(e){i("expired_and_failed_reset")}}})})};function ed(e){Pr("configureMfa",e)}const td=kr.button`
2
2
  display: flex;
3
3
  flex-direction: row;
4
4
  align-items: center;
@@ -1788,19 +1788,25 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
1788
1788
  `;kr(dd)`
1789
1789
  border-radius: var(--privy-border-radius-md) !important;
1790
1790
  animation: ${Mm} 0.3s ease-in-out;
1791
- `;const Lm=({displayName:n,errorMessage:a,configuredFundingChain:i,formattedBalance:o,fundingAmount:l,fundingCurrency:s,fundingAmountInUsd:d,options:c,selectedOption:u,isPreparing:h,isSubmitting:p,onSubmit:m,onSelect:f})=>e(r,{children:[t(mp,{}),t(Ac,{}),t(qu,{children:"Transfer from another network"}),e(Vu,{children:["You need more funds on the ",i.name," network. Bridge from another blockchain network."]}),e(km,{style:{marginTop:"2rem"},children:[e(Sm,{children:[t(Nm,{children:l}),t(Om,{children:s})]}),d&&t(Rm,{children:d})]}),t(zp,{style:{marginTop:"1.5rem"},children:t(jp,{children:"From"})}),t(tm,{selected:{chain:u.chain,balance:Vt(u.balance,u.chain.nativeCurrency.symbol,3,!0)},options:c.map((({chain:e,balance:t})=>({chain:e,balance:Vt(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:f}),t(zp,{children:t(jp,{style:{marginTop:"1.5rem"},children:"To"})}),t(Xp,{chain:i,balance:o}),t(qt,{style:{marginTop:"1rem"},children:a}),e(nd,{style:{marginTop:"1rem"},loading:p||h,disabled:h||p,onClick:m,children:["Confirm with ",n]}),t(kc,{}),t(Ot,{})]}),Dm=({wallet:n,displayName:a,addressToFund:i,chainId:o,chainName:l,isBridging:s,isErc20Flow:d,totalPriceInNativeCurrency:c,totalPriceInUsd:u,gasPriceInNativeCurrency:h,gasPriceInUsd:p})=>e(r,{children:[t(mp,{}),t(fp,{}),t(Cc,{style:{marginTop:"16px"},children:t(Qc,{icon:tu(n.walletClientType,n.connectorType,n.walletClientType),name:n.walletClientType})}),t(Rc,{style:{marginTop:"8px",marginBottom:"12px"},title:`${s?"Bridging":"Confirming"} with ${a}`}),!s&&!d&&e(Hp,{children:[e(zp,{children:[t(jp,{children:"Total"}),t(qp,{children:u||c})]}),e(zp,{children:[t(jp,{children:"To"}),t(qp,{children:t(Pt,{address:i,showCopyIcon:!1})})]}),e(zp,{children:[t(jp,{children:"Network"}),t(qp,{children:e(Fm,{children:[t(Yp,{chainId:o,height:16,width:16})," ",l]})})]}),h&&e(zp,{children:[t(jp,{children:"Estimated fee"}),t(qp,{children:p||h})]})]}),t(Nc,{height:24}),t(Ot,{})]});let Fm=kr.div`
1791
+ `;const Lm=kr.div``,Dm=kr.a`
1792
+ && {
1793
+ color: var(--privy-color-accent);
1794
+ }
1795
+
1796
+ cursor: pointer;
1797
+ `,Fm=({displayName:n,errorMessage:a,configuredFundingChain:i,formattedBalance:o,fundingAmount:l,fundingCurrency:s,fundingAmountInUsd:d,options:c,selectedOption:u,isPreparing:h,isSubmitting:p,onSubmit:m,onSelect:f})=>e(r,{children:[t(mp,{}),t(Ac,{}),t(qu,{children:"Transfer from another network"}),e(Vu,{children:["You need more funds on the ",i.name," network. Bridge from another blockchain network."]}),e(km,{style:{marginTop:"2rem"},children:[e(Sm,{children:[t(Nm,{children:l}),t(Om,{children:s})]}),d&&t(Rm,{children:d})]}),t(zp,{style:{marginTop:"1.5rem"},children:t(jp,{children:"From"})}),t(tm,{selected:{chain:u.chain,balance:Vt(u.balance,u.chain.nativeCurrency.symbol,3,!0)},options:c.map((({chain:e,balance:t})=>({chain:e,balance:Vt(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:f}),t(zp,{children:t(jp,{style:{marginTop:"1.5rem"},children:"To"})}),t(Xp,{chain:i,balance:o}),t(qt,{style:{marginTop:"1rem"},children:a}),e(nd,{style:{marginTop:"1rem"},loading:p||h,disabled:h||p,onClick:m,children:["Confirm with ",n]}),t(kc,{}),t(Ot,{})]}),Um=({wallet:n,displayName:a,addressToFund:i,chainId:o,chainName:l,isBridging:s,isErc20Flow:d,totalPriceInNativeCurrency:c,totalPriceInUsd:u,gasPriceInNativeCurrency:h,gasPriceInUsd:p})=>e(r,{children:[t(mp,{}),t(fp,{}),t(Cc,{style:{marginTop:"16px"},children:t(Qc,{icon:tu(n.walletClientType,n.connectorType,n.walletClientType),name:n.walletClientType})}),t(Rc,{style:{marginTop:"8px",marginBottom:"12px"},title:`${s?"Bridging":"Confirming"} with ${a}`}),!s&&!d&&e(Hp,{children:[e(zp,{children:[t(jp,{children:"Total"}),t(qp,{children:u||c})]}),e(zp,{children:[t(jp,{children:"To"}),t(qp,{children:t(Pt,{address:i,showCopyIcon:!1})})]}),e(zp,{children:[t(jp,{children:"Network"}),t(qp,{children:e(Wm,{children:[t(Yp,{chainId:o,height:16,width:16})," ",l]})})]}),h&&e(zp,{children:[t(jp,{children:"Estimated fee"}),t(qp,{children:p||h})]})]}),t(Nc,{height:24}),t(Ot,{})]});let Wm=kr.div`
1792
1798
  display: flex;
1793
1799
  flex-direction: row;
1794
1800
  align-items: center;
1795
1801
  gap: 4px;
1796
- `;const Um=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}];let Wm=2n**256n-1n;const Bm=({amount:e,decimals:t})=>e===Wm?"Maximum":Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t),Gm=async({chain:e,address:t,appId:r,rpcConfig:n,erc20Address:a})=>{let i=mn({chain:e,transport:fn(Qe(e,n,r))});return{balance:await i.readContract({address:a,abi:Hm,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}};let Hm=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];let zm=({status:n,onClickCta:a})=>{let{title:i,body:o,cta:l}=c((()=>(e=>{switch(e){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Almost done. Retrieving transaction status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(n)),[n]);return e(r,{children:[e(qm,{children:[t(jm,{isSucccess:"success"===n}),e(xc,{children:[t("h3",{children:i}),t(Vm,{children:o})]})]}),l&&t(rd,{onClick:a,children:l})]})},jm=({isSucccess:r})=>{if(!r){let r="var(--privy-color-foreground-4)";return e("div",{style:{position:"relative"},children:[t(Gt,{color:r,style:{position:"absolute"}}),t(Xt,{color:r}),t(is,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let n=(e=>e?Yr:()=>t(Dn,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}))(r),a=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(r);return t("div",{style:{borderColor:a,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&t(n,{width:"4rem",height:"4rem",color:a})})},Vm=kr.p`
1802
+ `;const Bm=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}];let Gm=2n**256n-1n;const Hm=({amount:e,decimals:t})=>e===Gm?"Maximum":Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t),zm=async({chain:e,address:t,appId:r,rpcConfig:n,erc20Address:a})=>{let i=mn({chain:e,transport:fn(Qe(e,n,r))});return{balance:await i.readContract({address:a,abi:jm,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}};let jm=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];let Vm=({status:n,onClickCta:a})=>{let{title:i,body:o,cta:l}=c((()=>(e=>{switch(e){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Almost done. Retrieving transaction status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(n)),[n]);return e(r,{children:[e(Zm,{children:[t(qm,{isSucccess:"success"===n}),e(xc,{children:[t("h3",{children:i}),t(Km,{children:o})]})]}),l&&t(rd,{onClick:a,children:l})]})},qm=({isSucccess:r})=>{if(!r){let r="var(--privy-color-foreground-4)";return e("div",{style:{position:"relative"},children:[t(Gt,{color:r,style:{position:"absolute"}}),t(Xt,{color:r}),t(is,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let n=(e=>e?Yr:()=>t(Dn,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}))(r),a=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(r);return t("div",{style:{borderColor:a,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&t(n,{width:"4rem",height:"4rem",color:a})})},Km=kr.p`
1797
1803
  font-size: 1rem;
1798
1804
  color: var(--privy-color-foreground-3);
1799
1805
  margin-bottom: 1rem;
1800
1806
  display: flex;
1801
1807
  flex-direction: column;
1802
1808
  gap: 1rem;
1803
- `,qm=kr.div`
1809
+ `,Zm=kr.div`
1804
1810
  display: flex;
1805
1811
  flex-direction: column;
1806
1812
  align-items: center;
@@ -1808,7 +1814,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
1808
1814
  margin-left: 1.75rem;
1809
1815
  margin-right: 1.75rem;
1810
1816
  padding: 2rem 0;
1811
- `;const Km=({children:r,theme:n})=>e(Zm,{$theme:n,children:[t(Br,{width:"3rem",color:"var(--privy-color-error)"}),r]});let Zm=kr.div`
1817
+ `;const Ym=({children:r,theme:n})=>e(Xm,{$theme:n,children:[t(Br,{width:"3rem",color:"var(--privy-color-error)"}),r]});let Xm=kr.div`
1812
1818
  display: flex;
1813
1819
  gap: 0.5rem;
1814
1820
 
@@ -1828,7 +1834,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
1828
1834
  border: 1px solid var(--privy-color-error);
1829
1835
  border-radius: var(--privy-border-radius-sm);
1830
1836
  }
1831
- `;const Ym=e=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 210.2",xmlSpace:"preserve",...e,children:t("path",{d:"M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9 C103.4,10,99.5,19.8,93.6,27.1 M102.3,40.9c-13.9-0.8-25.8,7.9-32.4,7.9c-6.7,0-16.8-7.5-27.8-7.3c-14.3,0.2-27.6,8.3-34.9,21.2 c-15,25.8-3.9,64,10.6,85c7.1,10.4,15.6,21.8,26.8,21.4c10.6-0.4,14.8-6.9,27.6-6.9c12.9,0,16.6,6.9,27.8,6.7 c11.6-0.2,18.9-10.4,26-20.8c8.1-11.8,11.4-23.3,11.6-23.9c-0.2-0.2-22.4-8.7-22.6-34.3c-0.2-21.4,17.5-31.6,18.3-32.2 C123.3,42.9,107.7,41.3,102.3,40.9 M182.6,11.9v155.9h24.2v-53.3h33.5c30.6,0,52.1-21,52.1-51.4c0-30.4-21.1-51.2-51.3-51.2H182.6z M206.8,32.3h27.9c21,0,33,11.2,33,30.9c0,19.7-12,31-33.1,31h-27.8V32.3z M336.6,169c15.2,0,29.3-7.7,35.7-19.9h0.5v18.7h22.4V90.2 c0-22.5-18-37-45.7-37c-25.7,0-44.7,14.7-45.4,34.9h21.8c1.8-9.6,10.7-15.9,22.9-15.9c14.8,0,23.1,6.9,23.1,19.6v8.6l-30.2,1.8 c-28.1,1.7-43.3,13.2-43.3,33.2C298.4,155.6,314.1,169,336.6,169z M343.1,150.5c-12.9,0-21.1-6.2-21.1-15.7c0-9.8,7.9-15.5,23-16.4 l26.9-1.7v8.8C371.9,140.1,359.5,150.5,343.1,150.5z M425.1,210.2c23.6,0,34.7-9,44.4-36.3L512,54.7h-24.6l-28.5,92.1h-0.5 l-28.5-92.1h-25.3l41,113.5l-2.2,6.9c-3.7,11.7-9.7,16.2-20.4,16.2c-1.9,0-5.6-0.2-7.1-0.4v18.7C417.3,210,423.3,210.2,425.1,210.2z"})}),Xm=r=>e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 38.1",xmlSpace:"preserve",...r,children:[t("path",{style:{fill:"#5F6368"},d:"M37.8,19.7V29h-3V6h7.8c1.9,0,3.7,0.7,5.1,2c1.4,1.2,2.1,3,2.1,4.9c0,1.9-0.7,3.6-2.1,4.9c-1.4,1.3-3.1,2-5.1,2 L37.8,19.7L37.8,19.7z M37.8,8.8v8h5c1.1,0,2.2-0.4,2.9-1.2c1.6-1.5,1.6-4,0.1-5.5c0,0-0.1-0.1-0.1-0.1c-0.8-0.8-1.8-1.3-2.9-1.2 L37.8,8.8L37.8,8.8z"}),t("path",{style:{fill:"#5F6368"},d:"M56.7,12.8c2.2,0,3.9,0.6,5.2,1.8s1.9,2.8,1.9,4.8V29H61v-2.2h-0.1c-1.2,1.8-2.9,2.7-4.9,2.7 c-1.7,0-3.2-0.5-4.4-1.5c-1.1-1-1.8-2.4-1.8-3.9c0-1.6,0.6-2.9,1.8-3.9c1.2-1,2.9-1.4,4.9-1.4c1.8,0,3.2,0.3,4.3,1v-0.7 c0-1-0.4-2-1.2-2.6c-0.8-0.7-1.8-1.1-2.9-1.1c-1.7,0-3,0.7-3.9,2.1l-2.6-1.6C51.8,13.8,53.9,12.8,56.7,12.8z M52.9,24.2 c0,0.8,0.4,1.5,1,1.9c0.7,0.5,1.5,0.8,2.3,0.8c1.2,0,2.4-0.5,3.3-1.4c1-0.9,1.5-2,1.5-3.2c-0.9-0.7-2.2-1.1-3.9-1.1 c-1.2,0-2.2,0.3-3,0.9C53.3,22.6,52.9,23.3,52.9,24.2z"}),t("path",{style:{fill:"#5F6368"},d:"M80,13.3l-9.9,22.7h-3l3.7-7.9l-6.5-14.7h3.2l4.7,11.3h0.1l4.6-11.3H80z"}),t("path",{style:{fill:"#4285F4"},d:"M25.9,17.7c0-0.9-0.1-1.8-0.2-2.7H13.2v5.1h7.1c-0.3,1.6-1.2,3.1-2.6,4v3.3H22C24.5,25.1,25.9,21.7,25.9,17.7z"}),t("path",{style:{fill:"#34A853"},d:"M13.2,30.6c3.6,0,6.6-1.2,8.8-3.2l-4.3-3.3c-1.2,0.8-2.7,1.3-4.5,1.3c-3.4,0-6.4-2.3-7.4-5.5H1.4v3.4 C3.7,27.8,8.2,30.6,13.2,30.6z"}),t("path",{style:{fill:"#FBBC04"},d:"M5.8,19.9c-0.6-1.6-0.6-3.4,0-5.1v-3.4H1.4c-1.9,3.7-1.9,8.1,0,11.9L5.8,19.9z"}),t("path",{style:{fill:"#EA4335"},d:"M13.2,9.4c1.9,0,3.7,0.7,5.1,2l0,0l3.8-3.8c-2.4-2.2-5.6-3.5-8.8-3.4c-5,0-9.6,2.8-11.8,7.3l4.4,3.4 C6.8,11.7,9.8,9.4,13.2,9.4z"})]}),Qm=e=>{let[t,r]=d();return p((()=>{e().then((e=>{r(e)})).catch((()=>{}))}),[]),t},Jm=async({address:e,chain:t,rpcConfig:r,privyAppId:n})=>{try{let a=mn({chain:t,transport:fn(Qe(t,r,n))}),[i,o]=await Promise.all([a.readContract({abi:ef,address:e,functionName:"symbol"}),a.readContract({abi:ef,address:e,functionName:"decimals"})]);return{decimals:o,symbol:i}}catch(e){return console.log(e),null}};let ef=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],tf=new Set([at.id,tt.id,it.id,ot.id,Je.id]),rf=new Set([at.id,tt.id,ot.id,it.id]);const nf=()=>window.open(void 0,void 0,af({w:440,h:680}));let af=({w:e,h:t})=>{let r=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,a=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(a-e)/2/(a/window.screen.availWidth)+r},top=${(i-t)/2/(i/window.screen.availHeight)+n}`};let of={[at.id]:"ethereum",[tt.id]:"base",[it.id]:"optimism",[ot.id]:"polygon",[Je.id]:"arbitrum"};const lf=(e,t,r,n,a,i)=>new Promise((async(o,l)=>{let s=nf();if(!s)return void l(Error("Unable to initialize flow"));let d="ethereum"===t.chainType?function(e){let t=of[e];if(!t)throw new _(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(t.chain.id):"solana",c=t.isUSDC?"USDC":"ethereum"===t.chainType?"ETH":"SOL",u=await e.initCoinbaseOnRamp({addresses:[{address:t.address,blockchains:[d]}],assets:[c]}),{url:h}=function({input:e,amount:t,blockchain:r,asset:n,experience:a}){let i=new URL("https://pay.coinbase.com/buy/select-asset");return i.searchParams.set("appId",e.app_id),i.searchParams.set("sessionToken",e.session_token),i.searchParams.set("defaultExperience",a),i.searchParams.set("presetCryptoAmount",t.startsWith(".")?`0${t}`:t),i.searchParams.set("defaultNetwork",r),i.searchParams.set("defaultPaymentMethod",el[a]),i.searchParams.set("defaultAsset",tl[n]),i.searchParams.set("partnerUserId",e.partner_user_id),{url:i}}({input:u,amount:t.amount,blockchain:d,asset:c,experience:i});s.location=h.toString(),r({funding:a?.funding,coinbaseOnrampStatus:{popup:s}}),n(Er.COINBASE_ONRAMP_STATUS_SCREEN),e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.cluster.name}}),setTimeout((()=>{r({funding:a?.funding,coinbaseOnrampStatus:{partnerUserId:u.partner_user_id,popup:s}})}),5e3),o()})),sf="moonpay";let df=new Set([at.id,Je.id,tt.id,ot.id]),cf=new Set([at.id,Je.id,it.id,tt.id,ot.id]);function uf(e){return parseFloat(e)}function hf(e){return!!e&&void 0!==e.config&&void 0!==e.provider}function pf(e){return!!e&&(void 0!==e.chain||void 0!==e.amount)}function mf(e,t=!1){let[r,n]=d(null),{createAnalyticsEvent:a}=D(),{data:i,navigate:o,setModalData:l}=$r(),c=i?.funding,u=s(0);return p((()=>{let r=setInterval((async()=>{if(e)try{let[i]=await async function(e,t){return xr(`${t?ut:ht}/transactions/ext/${e}`,{query:{apiKey:t?pt:mt}})}(e,t),s="waitingAuthorization"===i.status&&"credit_debit_card"===i.paymentMethod?"pending":i.status;if(["failed","completed","awaitingAuthorization"].includes(s)&&(a({eventName:$p,payload:{status:s,provider:sf,paymentMethod:i.paymentMethod,cardPaymentType:i.cardPaymentType,currency:i.currency?.code,baseCurrencyAmount:i.baseCurrencyAmount,quoteCurrencyAmount:i.quoteCurrencyAmount,feeAmount:i.feeAmount,extraFeeAmount:i.extraFeeAmount,networkFeeAmount:i.networkFeeAmount,isSandbox:t}}),clearInterval(r)),"failed"===s||"serviceFailure"===s)return l({funding:{...c,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),void o(Er.FUNDING_METHOD_SELECTION_SCREEN);n(s)}catch(e){404!==e.response?.status&&(u.current+=1),u.current>=3&&(a({eventName:$p,payload:{status:"serviceFailure",provider:sf}}),clearInterval(r),l({funding:{...c,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),o(Er.FUNDING_METHOD_SELECTION_SCREEN))}}),3e3);return()=>clearInterval(r)}),[e,u]),r}const ff=async(e,t,r,n,a,i,o,l)=>{let s=nf();if(!s)throw Error("Unable to initialize flow");let d="ethereum"===t.chainType?t.moonpayConfigOverride?.currencyCode??function(e,t){switch(e){case Je.id:return"native-currency"===t?"ETH_ARBITRUM":"USDC_ARBITRUM";case 43114:return"AVAX_CCHAIN";case tt.id:return"native-currency"===t?"ETH_BASE":"USDC_BASE";case rt.id:return"CELO_CELO";case ot.id:return"native-currency"===t?"MATIC_POLYGON":"USDC_POLYGON";case at.id:return"native-currency"===t?"ETH_ETHEREUM":"USDC_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}(t.chain.id,n):"SOL",{signedUrl:c,externalTransactionId:u}=await e.signMoonpayOnRampUrl({address:t.address,useSandbox:r.fundingMethodConfig.moonpay.useSandbox??!1,config:{uiConfig:{accentColor:r.appearance.palette.accent,theme:r.appearance.palette.colorScheme},...t.moonpayConfigOverride,paymentMethod:l,currencyCode:d,quoteCurrencyAmount:t.moonpayConfigOverride?.quoteCurrencyAmount??uf(t.amount)}});e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"moonpay",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.cluster.name}}),s.location=c,a({moonpayStatus:{},funding:o?.funding}),i(Er.MOONPAY_STATUS_SCREEN),setTimeout((()=>{a({moonpayStatus:{externalTransactionId:u},funding:o?.funding})}),8e3)};let gf=async e=>"undefined"!=typeof window&&"PaymentRequest"in window&&await new window.PaymentRequest([{supportedMethods:e}],{id:"0",total:{label:"Item",amount:{currency:"USD",value:"1.00"}}}).canMakePayment();const yf=()=>gf("https://apple.com/apple-pay"),wf=()=>gf("https://google.com/pay"),vf=({children:r,theme:n})=>e(Cf,{$theme:n,children:[t(Hn,{width:"1.25rem",color:"dark"===n?"var(--privy-color-accent-light)":"var(--privy-color-accent-dark)"}),r]});let Cf=kr.div`
1837
+ `;const Qm=({children:r,theme:n})=>e(Jm,{$theme:n,children:[t(Bn,{width:"1.25rem",color:"dark"===n?"var(--privy-color-accent-light)":"var(--privy-color-accent-dark)",style:{minWidth:"1.25rem"}}),r]});let Jm=kr.div`
1832
1838
  display: flex;
1833
1839
  gap: 0.5rem;
1834
1840
  background-color: ${e=>"dark"===e.$theme?"var(--privy-color-accent-darkest)":"var(--privy-color-accent-lightest)"};
@@ -1846,16 +1852,16 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
1846
1852
 
1847
1853
  && {
1848
1854
  border-radius: var(--privy-border-radius-sm);
1849
- ${e=>"dark"===e.$theme?"border: 1px solid var(--privy-color-accent)":""};
1855
+ border: 1px solid var(--privy-color-accent);
1850
1856
  }
1851
- `;let bf=({...e})=>t(ws,{color:"black",...e}),$f={devnet:"Devnet","mainnet-beta":"Solana",testnet:"Testnet"};const Ef=({size:r=61,...n})=>t("svg",{width:r,height:r,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:e("g",{id:"moonpay_symbol_wht 2",children:[t("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),t("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});let Tf=({status:n,onClickCta:a})=>{let{title:i,body:o,cta:l}=c((()=>(e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}})(n)),[n]);return e(r,{children:[e(Af,{children:[t(xf,{status:n}),e(xc,{children:[t("h3",{children:i}),t(_f,{children:o})]})]}),l&&t(rd,{onClick:a,children:l})]})},xf=({status:r})=>{if(!r||"pending"===r){let r="var(--privy-color-foreground-4)";return e("div",{style:{position:"relative"},children:[t(Gt,{color:r,style:{position:"absolute"}}),t(Xt,{color:r}),t(Ef,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let n=(e=>{switch(e){case"completed":return Yr;case"waitingAuthorization":return()=>t(Dn,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}})(r),a=(e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)")(r);return t("div",{style:{borderColor:a,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&t(n,{width:"4rem",height:"4rem",color:a})})},_f=kr.p`
1857
+ `;const ef=e=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 210.2",xmlSpace:"preserve",...e,children:t("path",{d:"M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9 C103.4,10,99.5,19.8,93.6,27.1 M102.3,40.9c-13.9-0.8-25.8,7.9-32.4,7.9c-6.7,0-16.8-7.5-27.8-7.3c-14.3,0.2-27.6,8.3-34.9,21.2 c-15,25.8-3.9,64,10.6,85c7.1,10.4,15.6,21.8,26.8,21.4c10.6-0.4,14.8-6.9,27.6-6.9c12.9,0,16.6,6.9,27.8,6.7 c11.6-0.2,18.9-10.4,26-20.8c8.1-11.8,11.4-23.3,11.6-23.9c-0.2-0.2-22.4-8.7-22.6-34.3c-0.2-21.4,17.5-31.6,18.3-32.2 C123.3,42.9,107.7,41.3,102.3,40.9 M182.6,11.9v155.9h24.2v-53.3h33.5c30.6,0,52.1-21,52.1-51.4c0-30.4-21.1-51.2-51.3-51.2H182.6z M206.8,32.3h27.9c21,0,33,11.2,33,30.9c0,19.7-12,31-33.1,31h-27.8V32.3z M336.6,169c15.2,0,29.3-7.7,35.7-19.9h0.5v18.7h22.4V90.2 c0-22.5-18-37-45.7-37c-25.7,0-44.7,14.7-45.4,34.9h21.8c1.8-9.6,10.7-15.9,22.9-15.9c14.8,0,23.1,6.9,23.1,19.6v8.6l-30.2,1.8 c-28.1,1.7-43.3,13.2-43.3,33.2C298.4,155.6,314.1,169,336.6,169z M343.1,150.5c-12.9,0-21.1-6.2-21.1-15.7c0-9.8,7.9-15.5,23-16.4 l26.9-1.7v8.8C371.9,140.1,359.5,150.5,343.1,150.5z M425.1,210.2c23.6,0,34.7-9,44.4-36.3L512,54.7h-24.6l-28.5,92.1h-0.5 l-28.5-92.1h-25.3l41,113.5l-2.2,6.9c-3.7,11.7-9.7,16.2-20.4,16.2c-1.9,0-5.6-0.2-7.1-0.4v18.7C417.3,210,423.3,210.2,425.1,210.2z"})}),tf=r=>e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 38.1",xmlSpace:"preserve",...r,children:[t("path",{style:{fill:"#5F6368"},d:"M37.8,19.7V29h-3V6h7.8c1.9,0,3.7,0.7,5.1,2c1.4,1.2,2.1,3,2.1,4.9c0,1.9-0.7,3.6-2.1,4.9c-1.4,1.3-3.1,2-5.1,2 L37.8,19.7L37.8,19.7z M37.8,8.8v8h5c1.1,0,2.2-0.4,2.9-1.2c1.6-1.5,1.6-4,0.1-5.5c0,0-0.1-0.1-0.1-0.1c-0.8-0.8-1.8-1.3-2.9-1.2 L37.8,8.8L37.8,8.8z"}),t("path",{style:{fill:"#5F6368"},d:"M56.7,12.8c2.2,0,3.9,0.6,5.2,1.8s1.9,2.8,1.9,4.8V29H61v-2.2h-0.1c-1.2,1.8-2.9,2.7-4.9,2.7 c-1.7,0-3.2-0.5-4.4-1.5c-1.1-1-1.8-2.4-1.8-3.9c0-1.6,0.6-2.9,1.8-3.9c1.2-1,2.9-1.4,4.9-1.4c1.8,0,3.2,0.3,4.3,1v-0.7 c0-1-0.4-2-1.2-2.6c-0.8-0.7-1.8-1.1-2.9-1.1c-1.7,0-3,0.7-3.9,2.1l-2.6-1.6C51.8,13.8,53.9,12.8,56.7,12.8z M52.9,24.2 c0,0.8,0.4,1.5,1,1.9c0.7,0.5,1.5,0.8,2.3,0.8c1.2,0,2.4-0.5,3.3-1.4c1-0.9,1.5-2,1.5-3.2c-0.9-0.7-2.2-1.1-3.9-1.1 c-1.2,0-2.2,0.3-3,0.9C53.3,22.6,52.9,23.3,52.9,24.2z"}),t("path",{style:{fill:"#5F6368"},d:"M80,13.3l-9.9,22.7h-3l3.7-7.9l-6.5-14.7h3.2l4.7,11.3h0.1l4.6-11.3H80z"}),t("path",{style:{fill:"#4285F4"},d:"M25.9,17.7c0-0.9-0.1-1.8-0.2-2.7H13.2v5.1h7.1c-0.3,1.6-1.2,3.1-2.6,4v3.3H22C24.5,25.1,25.9,21.7,25.9,17.7z"}),t("path",{style:{fill:"#34A853"},d:"M13.2,30.6c3.6,0,6.6-1.2,8.8-3.2l-4.3-3.3c-1.2,0.8-2.7,1.3-4.5,1.3c-3.4,0-6.4-2.3-7.4-5.5H1.4v3.4 C3.7,27.8,8.2,30.6,13.2,30.6z"}),t("path",{style:{fill:"#FBBC04"},d:"M5.8,19.9c-0.6-1.6-0.6-3.4,0-5.1v-3.4H1.4c-1.9,3.7-1.9,8.1,0,11.9L5.8,19.9z"}),t("path",{style:{fill:"#EA4335"},d:"M13.2,9.4c1.9,0,3.7,0.7,5.1,2l0,0l3.8-3.8c-2.4-2.2-5.6-3.5-8.8-3.4c-5,0-9.6,2.8-11.8,7.3l4.4,3.4 C6.8,11.7,9.8,9.4,13.2,9.4z"})]}),rf=e=>{let[t,r]=d();return p((()=>{e().then((e=>{r(e)})).catch((()=>{}))}),[]),t},nf=async({address:e,chain:t,rpcConfig:r,privyAppId:n})=>{try{let a=mn({chain:t,transport:fn(Qe(t,r,n))}),[i,o]=await Promise.all([a.readContract({abi:af,address:e,functionName:"symbol"}),a.readContract({abi:af,address:e,functionName:"decimals"})]);return{decimals:o,symbol:i}}catch(e){return console.log(e),null}};let af=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],of=new Set([at.id,tt.id,it.id,ot.id,Je.id]),lf=new Set([at.id,tt.id,ot.id,it.id]);const sf=()=>window.open(void 0,void 0,df({w:440,h:680}));let df=({w:e,h:t})=>{let r=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,a=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(a-e)/2/(a/window.screen.availWidth)+r},top=${(i-t)/2/(i/window.screen.availHeight)+n}`};let cf={[at.id]:"ethereum",[tt.id]:"base",[it.id]:"optimism",[ot.id]:"polygon",[Je.id]:"arbitrum"};const uf=(e,t,r,n,a,i)=>new Promise((async(o,l)=>{let s=sf();if(!s)return void l(Error("Unable to initialize flow"));let d="ethereum"===t.chainType?function(e){let t=cf[e];if(!t)throw new _(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(t.chain.id):"solana",c=t.isUSDC?"USDC":"ethereum"===t.chainType?"ETH":"SOL",u=await e.initCoinbaseOnRamp({addresses:[{address:t.address,blockchains:[d]}],assets:[c]}),{url:h}=function({input:e,amount:t,blockchain:r,asset:n,experience:a}){let i=new URL("https://pay.coinbase.com/buy/select-asset");return i.searchParams.set("appId",e.app_id),i.searchParams.set("sessionToken",e.session_token),i.searchParams.set("defaultExperience",a),i.searchParams.set("presetCryptoAmount",t.startsWith(".")?`0${t}`:t),i.searchParams.set("defaultNetwork",r),i.searchParams.set("defaultPaymentMethod",el[a]),i.searchParams.set("defaultAsset",tl[n]),i.searchParams.set("partnerUserId",e.partner_user_id),{url:i}}({input:u,amount:t.amount,blockchain:d,asset:c,experience:i});s.location=h.toString(),r({funding:a?.funding,coinbaseOnrampStatus:{popup:s}}),n(Er.COINBASE_ONRAMP_STATUS_SCREEN),e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.cluster.name}}),setTimeout((()=>{r({funding:a?.funding,coinbaseOnrampStatus:{partnerUserId:u.partner_user_id,popup:s}})}),5e3),o()})),hf="moonpay";let pf=new Set([at.id,Je.id,tt.id,ot.id]),mf=new Set([at.id,Je.id,it.id,tt.id,ot.id]);function ff(e){return parseFloat(e)}function gf(e){return!!e&&void 0!==e.config&&void 0!==e.provider}function yf(e){return!!e&&(void 0!==e.chain||void 0!==e.amount)}function wf(e,t=!1){let[r,n]=d(null),{createAnalyticsEvent:a}=D(),{data:i,navigate:o,setModalData:l}=$r(),c=i?.funding,u=s(0);return p((()=>{let r=setInterval((async()=>{if(e)try{let[i]=await async function(e,t){return xr(`${t?ut:ht}/transactions/ext/${e}`,{query:{apiKey:t?pt:mt}})}(e,t),s="waitingAuthorization"===i.status&&"credit_debit_card"===i.paymentMethod?"pending":i.status;if(["failed","completed","awaitingAuthorization"].includes(s)&&(a({eventName:$p,payload:{status:s,provider:hf,paymentMethod:i.paymentMethod,cardPaymentType:i.cardPaymentType,currency:i.currency?.code,baseCurrencyAmount:i.baseCurrencyAmount,quoteCurrencyAmount:i.quoteCurrencyAmount,feeAmount:i.feeAmount,extraFeeAmount:i.extraFeeAmount,networkFeeAmount:i.networkFeeAmount,isSandbox:t}}),clearInterval(r)),"failed"===s||"serviceFailure"===s)return l({funding:{...c,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),void o(Er.FUNDING_METHOD_SELECTION_SCREEN);n(s)}catch(e){404!==e.response?.status&&(u.current+=1),u.current>=3&&(a({eventName:$p,payload:{status:"serviceFailure",provider:hf}}),clearInterval(r),l({funding:{...c,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),o(Er.FUNDING_METHOD_SELECTION_SCREEN))}}),3e3);return()=>clearInterval(r)}),[e,u]),r}const vf=async(e,t,r,n,a,i,o,l)=>{let s=sf();if(!s)throw Error("Unable to initialize flow");let d="ethereum"===t.chainType?t.moonpayConfigOverride?.currencyCode??function(e,t){switch(e){case Je.id:return"native-currency"===t?"ETH_ARBITRUM":"USDC_ARBITRUM";case 43114:return"AVAX_CCHAIN";case tt.id:return"native-currency"===t?"ETH_BASE":"USDC_BASE";case rt.id:return"CELO_CELO";case ot.id:return"native-currency"===t?"MATIC_POLYGON":"USDC_POLYGON";case at.id:return"native-currency"===t?"ETH_ETHEREUM":"USDC_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}}(t.chain.id,n):"SOL",{signedUrl:c,externalTransactionId:u}=await e.signMoonpayOnRampUrl({address:t.address,useSandbox:r.fundingMethodConfig.moonpay.useSandbox??!1,config:{uiConfig:{accentColor:r.appearance.palette.accent,theme:r.appearance.palette.colorScheme},...t.moonpayConfigOverride,paymentMethod:l,currencyCode:d,quoteCurrencyAmount:t.moonpayConfigOverride?.quoteCurrencyAmount??ff(t.amount)}});e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"moonpay",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.cluster.name}}),s.location=c,a({moonpayStatus:{},funding:o?.funding}),i(Er.MOONPAY_STATUS_SCREEN),setTimeout((()=>{a({moonpayStatus:{externalTransactionId:u},funding:o?.funding})}),8e3)};let Cf=async e=>"undefined"!=typeof window&&"PaymentRequest"in window&&await new window.PaymentRequest([{supportedMethods:e}],{id:"0",total:{label:"Item",amount:{currency:"USD",value:"1.00"}}}).canMakePayment();const bf=()=>Cf("https://apple.com/apple-pay"),$f=()=>Cf("https://google.com/pay");let Ef=({...e})=>t(ws,{color:"black",...e}),Tf={devnet:"Devnet","mainnet-beta":"Solana",testnet:"Testnet"};const xf=({size:r=61,...n})=>t("svg",{width:r,height:r,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:e("g",{id:"moonpay_symbol_wht 2",children:[t("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),t("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});let _f=({status:n,onClickCta:a})=>{let{title:i,body:o,cta:l}=c((()=>(e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}})(n)),[n]);return e(r,{children:[e(Sf,{children:[t(Af,{status:n}),e(xc,{children:[t("h3",{children:i}),t(kf,{children:o})]})]}),l&&t(rd,{onClick:a,children:l})]})},Af=({status:r})=>{if(!r||"pending"===r){let r="var(--privy-color-foreground-4)";return e("div",{style:{position:"relative"},children:[t(Gt,{color:r,style:{position:"absolute"}}),t(Xt,{color:r}),t(xf,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let n=(e=>{switch(e){case"completed":return Yr;case"waitingAuthorization":return()=>t(Dn,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}})(r),a=(e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)")(r);return t("div",{style:{borderColor:a,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&t(n,{width:"4rem",height:"4rem",color:a})})},kf=kr.p`
1852
1858
  font-size: 1rem;
1853
1859
  color: var(--privy-color-foreground-3);
1854
1860
  margin-bottom: 1rem;
1855
1861
  display: flex;
1856
1862
  flex-direction: column;
1857
1863
  gap: 1rem;
1858
- `,Af=kr.div`
1864
+ `,Sf=kr.div`
1859
1865
  display: flex;
1860
1866
  flex-direction: column;
1861
1867
  align-items: center;
@@ -1863,7 +1869,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
1863
1869
  margin-left: 1.75rem;
1864
1870
  margin-right: 1.75rem;
1865
1871
  padding: 2rem 0;
1866
- `;const kf=({onClick:r,text:n})=>e(Id,{onClick:r,children:[t(Gr,{}),t(xd,{children:n}),t(zn,{})]});let Sf=({onClick:r,icon:n,name:a})=>e(Id,{onClick:r,children:[t(Am,{style:{width:20},children:t("img",{src:n})}),a,t(Dt,{color:"gray",style:{marginLeft:"auto"},children:"Connected"})]});let Nf=kr.div`
1872
+ `;const Nf=({onClick:r,text:n})=>e(Id,{onClick:r,children:[t(Gr,{}),t(xd,{children:n}),t(zn,{})]});let If=({onClick:r,icon:n,name:a})=>e(Id,{onClick:r,children:[t(Am,{style:{width:20},children:t("img",{src:n})}),a,t(Dt,{color:"gray",style:{marginLeft:"auto"},children:"Connected"})]});let Pf=kr.div`
1867
1873
  border-radius: 50%;
1868
1874
  height: 68px;
1869
1875
  width: 68px;
@@ -1873,18 +1879,18 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
1873
1879
  background-color: var(--privy-color-accent);
1874
1880
  color: white;
1875
1881
  margin: 0 auto 24px auto;
1876
- `;const If=({style:e,...r})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...r,children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})}),Pf=kr.div`
1882
+ `;const Of=({style:e,...r})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...r,children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})}),Rf=kr.div`
1877
1883
  display: flex;
1878
1884
  flex-direction: column;
1879
1885
  justify-content: flex-start;
1880
1886
  gap: 4px;
1881
- `,Of=kr.div`
1887
+ `,Mf=kr.div`
1882
1888
  &&& {
1883
1889
  margin-left: 7px; /* TODO: This is a total hack */
1884
1890
  border-left: 2px solid var(--privy-color-foreground-4);
1885
1891
  height: 12px;
1886
1892
  }
1887
- `,Rf=({children:r})=>e(Mf,{children:[t(If,{style:{width:"16px",height:"16px"}}),r]});let Mf=kr.div`
1893
+ `,Lf=({children:r})=>e(Df,{children:[t(Of,{style:{width:"16px",height:"16px"}}),r]});let Df=kr.div`
1888
1894
  display: flex;
1889
1895
  justify-content: flex-start;
1890
1896
  justify-items: center;
@@ -1902,20 +1908,20 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
1902
1908
  margin-bottom: auto;
1903
1909
  }
1904
1910
  }
1905
- `,Lf=()=>{let r=C.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return e(Df,{children:[t(Pc,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),t(Cc,{children:t(xs,{style:{width:"152px",height:"152px"}})}),e(Pf,{children:[t(Rf,{children:e("div",{children:[t("span",{children:"Install the "}),t("a",{href:r,target:"_blank",children:"Phantom browser extension"})]})}),t(Of,{}),t(Rf,{children:"Set up your first wallet"}),t(Of,{}),t(Rf,{children:"Store your recovery phrase in a safe place!"})]}),t(dd,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]})};let Df=kr(Cc)`
1911
+ `,Ff=()=>{let r=C.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return e(Uf,{children:[t(Pc,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),t(Cc,{children:t(xs,{style:{width:"152px",height:"152px"}})}),e(Rf,{children:[t(Lf,{children:e("div",{children:[t("span",{children:"Install the "}),t("a",{href:r,target:"_blank",children:"Phantom browser extension"})]})}),t(Mf,{}),t(Lf,{children:"Set up your first wallet"}),t(Mf,{}),t(Lf,{children:"Store your recovery phrase in a safe place!"})]}),t(dd,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]})};let Uf=kr(Cc)`
1906
1912
  gap: 30px;
1907
1913
 
1908
1914
  > :first-child > svg {
1909
1915
  margin-top: 20px;
1910
1916
  }
1911
- `,Ff={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",twitter_oauth:"twitter",wallet:"siwe",smart_wallet:"siwe",cross_app:"privy:",guest:"guest"};const Uf=e=>{let t=Ff[e];return"wallet"===e||"phone"===e?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}},Wf=()=>{let{app:e}=$r(),r=e?.appearance?.logo,n=`${e?.name} logo`,a={maxHeight:"90px",maxWidth:"180px"};return r?"string"==typeof r?t("img",{src:r,alt:n,style:a}):"svg"===r.type||"img"===r.type?l.cloneElement(r,{alt:n,style:a}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},Bf=e=>{let{app:r}=$r();return r?.appearance.logo?t(Gf,{...e,children:t(Wf,{})}):null},Gf=kr.div`
1917
+ `,Wf={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",twitter_oauth:"twitter",wallet:"siwe",smart_wallet:"siwe",cross_app:"privy:",guest:"guest"};const Bf=e=>{let t=Wf[e];return"wallet"===e||"phone"===e?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}},Gf=()=>{let{app:e}=$r(),r=e?.appearance?.logo,n=`${e?.name} logo`,a={maxHeight:"90px",maxWidth:"180px"};return r?"string"==typeof r?t("img",{src:r,alt:n,style:a}):"svg"===r.type||"img"===r.type?l.cloneElement(r,{alt:n,style:a}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},Hf=e=>{let{app:r}=$r();return r?.appearance.logo?t(zf,{...e,children:t(Gf,{})}):null},zf=kr.div`
1912
1918
  display: flex;
1913
1919
  flex-direction: column;
1914
1920
  align-items: center;
1915
1921
  padding: 24px 0;
1916
1922
  flex-grow: 1;
1917
1923
  justify-content: center;
1918
- `,Hf=({appId:n})=>{let[a,i]=d(void 0),{startCrossAppAuthFlow:o,authenticated:l}=F(),{client:s}=D();return p((()=>{(async()=>{s&&i(await s.getCrossAppProviderDetails(n))})()}),[s]),t(Id,{onClick:()=>o({appId:n,action:l?"link":"login"}),disabled:!a,children:a?e(r,{children:[t(wu,{name:a.name,logoUrl:a.icon_url||void 0,size:"24px"})," ",a.name]}):t(It,{})})};let zf=kr.label`
1924
+ `,jf=({appId:n})=>{let[a,i]=d(void 0),{startCrossAppAuthFlow:o,authenticated:l}=F(),{client:s}=D();return p((()=>{(async()=>{s&&i(await s.getCrossAppProviderDetails(n))})()}),[s]),t(Id,{onClick:()=>o({appId:n,action:l?"link":"login"}),disabled:!a,children:a?e(r,{children:[t(wu,{name:a.name,logoUrl:a.icon_url||void 0,size:"24px"})," ",a.name]}):t(It,{})})};let Vf=kr.label`
1919
1925
  display: block;
1920
1926
  position: relative;
1921
1927
  width: 100%;
@@ -1989,7 +1995,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
1989
1995
  color: var(--privy-color-foreground-3); /* Change text color to grey */
1990
1996
  }
1991
1997
  }
1992
- `;const jf=kr(zf)`
1998
+ `;const qf=kr(Vf)`
1993
1999
  background-color: var(--privy-color-background);
1994
2000
  transition: background-color 200ms ease;
1995
2001
 
@@ -2005,7 +2011,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2005
2011
  border-color: var(--privy-color-accent);
2006
2012
  }
2007
2013
  }
2008
- `,Vf=kr(zf)`
2014
+ `,Kf=kr(Vf)`
2009
2015
  && > input {
2010
2016
  overflow: hidden;
2011
2017
  white-space: nowrap;
@@ -2037,7 +2043,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2037
2043
  outline: none;
2038
2044
  }
2039
2045
  }
2040
- `,qf=kr.div`
2046
+ `,Zf=kr.div`
2041
2047
  width: 100%;
2042
2048
 
2043
2049
  /* Add styling for the ErrorMessage within EmailInput */
@@ -2047,9 +2053,9 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2047
2053
  padding-left: var(--privy-border-radius-mdlg);
2048
2054
  padding-bottom: 5px;
2049
2055
  }
2050
- `,Kf=v(((n,a)=>{let[i,o]=d(n.defaultValue||""),[l,s]=d(""),[c,u]=d(!1),{authenticated:h}=F(),{initLoginWithEmail:m}=D(),{navigate:f,setModalData:g,currentScreen:y,data:w}=$r(),{enabled:v,token:C}=Jl(),[b,$]=d(!1),{accountType:E}=Lt(),T=We();p((()=>{!i&&T.disablePlusEmails&&w?.inlineError?.error instanceof S&&w?.inlineError?.error.privyErrorCode===k.DISALLOWED_PLUS_EMAIL&&!l&&s("Please enter a valid email address without a '+'."),l&&s("")}),[i]);let x=ft(i),_=c||!x,A=()=>{g({inlineError:void 0}),!v||C||h?(e=>{u(!0),m({email:i,captchaToken:e,disableSignup:w?.login?.disableSignup,withPrivyUi:!0}).then((()=>{f(Er.AWAITING_PASSWORDLESS_CODE)})).catch((e=>{g({errorModalData:{error:e,previousScreen:y||Er.LANDING}}),f(Er.ERROR_SCREEN)})).finally((()=>{u(!1)}))})(C):(g({captchaModalData:{callback:e=>m({email:i,captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:Er.ERROR_SCREEN}}),f(Er.CAPTCHA_SCREEN))};return e(r,{children:[e(Zf,{children:[t(qt,l?{style:{marginTop:"0.25rem",textAlign:"left"},children:l}:{style:{marginTop:"0.25rem",textAlign:"left",visibility:"hidden"},children:" "}),e(Yf,{stacked:n.stacked,$error:!!l,children:[t(Kr,{}),t("input",{ref:a,id:"email-input",className:"login-method-button",type:"email",placeholder:"your@email.com",onFocus:()=>$(!0),onChange:e=>o(e.target.value),onKeyUp:e=>{"Enter"===e.key&&A()},value:i,autoComplete:"email"}),"email"!==E||b?n.stacked?t("span",{}):t(cd,{isSubmitting:c,onClick:A,disabled:_,children:"Submit"}):t(Dt,{color:"gray",children:"Recent"})]})]}),n.stacked?t(rd,{loadingText:null,loading:c,disabled:_,onClick:A,children:"Submit"}):null]})}));let Zf=qf,Yf=Vf;const Xf=({isEditable:n,setIsEditable:a,defaultValue:i})=>{let o=s(null);return e(r,{children:[t(Od,{$if:!n,children:t(Kf,{ref:o,defaultValue:i})}),t(Od,{$if:n,children:e(Id,{onClick:()=>{a(),setTimeout((()=>{o.current?.focus()}),0)},children:[t(Kr,{})," Continue with Email"]})})]})},Qf=()=>{let[r,n]=d(!1),{currentScreen:a,navigate:i,setModalData:o,data:l}=$r(),{enabled:s,token:c}=Jl(),{initLoginWithFarcaster:u}=D(),{accountType:h}=Lt();return e(Id,{onClick:async()=>{n(!0);try{s&&!c?(o({captchaModalData:{callback:e=>u(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:Er.AWAITING_FARCASTER_CONNECTION,onErrorNavigateTo:Er.ERROR_SCREEN}}),i(Er.CAPTCHA_SCREEN)):(await u(c,l?.login?.disableSignup),i(Er.AWAITING_FARCASTER_CONNECTION))}catch(e){o({errorModalData:{error:e,previousScreen:a||Er.LANDING}}),i(Er.ERROR_SCREEN)}finally{n(!1)}},disabled:!1,children:[t(lp,{})," Farcaster",r&&t(It,{}),"farcaster"===h&&t(Jf,{color:"gray",children:"Recent"})]})};let Jf=kr(Dt)`
2056
+ `,Yf=v(((n,a)=>{let[i,o]=d(n.defaultValue||""),[l,s]=d(""),[c,u]=d(!1),{authenticated:h}=F(),{initLoginWithEmail:m}=D(),{navigate:f,setModalData:g,currentScreen:y,data:w}=$r(),{enabled:v,token:C}=Jl(),[b,$]=d(!1),{accountType:E}=Lt(),T=We();p((()=>{!i&&T.disablePlusEmails&&w?.inlineError?.error instanceof S&&w?.inlineError?.error.privyErrorCode===k.DISALLOWED_PLUS_EMAIL&&!l&&s("Please enter a valid email address without a '+'."),l&&s("")}),[i]);let x=ft(i),_=c||!x,A=()=>{g({inlineError:void 0}),!v||C||h?(e=>{u(!0),m({email:i,captchaToken:e,disableSignup:w?.login?.disableSignup,withPrivyUi:!0}).then((()=>{f(Er.AWAITING_PASSWORDLESS_CODE)})).catch((e=>{g({errorModalData:{error:e,previousScreen:y||Er.LANDING}}),f(Er.ERROR_SCREEN)})).finally((()=>{u(!1)}))})(C):(g({captchaModalData:{callback:e=>m({email:i,captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:Er.ERROR_SCREEN}}),f(Er.CAPTCHA_SCREEN))};return e(r,{children:[e(Xf,{children:[t(qt,l?{style:{marginTop:"0.25rem",textAlign:"left"},children:l}:{style:{marginTop:"0.25rem",textAlign:"left",visibility:"hidden"},children:" "}),e(Qf,{stacked:n.stacked,$error:!!l,children:[t(Kr,{}),t("input",{ref:a,id:"email-input",className:"login-method-button",type:"email",placeholder:"your@email.com",onFocus:()=>$(!0),onChange:e=>o(e.target.value),onKeyUp:e=>{"Enter"===e.key&&A()},value:i,autoComplete:"email"}),"email"!==E||b?n.stacked?t("span",{}):t(cd,{isSubmitting:c,onClick:A,disabled:_,children:"Submit"}):t(Dt,{color:"gray",children:"Recent"})]})]}),n.stacked?t(rd,{loadingText:null,loading:c,disabled:_,onClick:A,children:"Submit"}):null]})}));let Xf=Zf,Qf=Kf;const Jf=({isEditable:n,setIsEditable:a,defaultValue:i})=>{let o=s(null);return e(r,{children:[t(Od,{$if:!n,children:t(Yf,{ref:o,defaultValue:i})}),t(Od,{$if:n,children:e(Id,{onClick:()=>{a(),setTimeout((()=>{o.current?.focus()}),0)},children:[t(Kr,{})," Continue with Email"]})})]})},eg=()=>{let[r,n]=d(!1),{currentScreen:a,navigate:i,setModalData:o,data:l}=$r(),{enabled:s,token:c}=Jl(),{initLoginWithFarcaster:u}=D(),{accountType:h}=Lt();return e(Id,{onClick:async()=>{n(!0);try{s&&!c?(o({captchaModalData:{callback:e=>u(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:Er.AWAITING_FARCASTER_CONNECTION,onErrorNavigateTo:Er.ERROR_SCREEN}}),i(Er.CAPTCHA_SCREEN)):(await u(c,l?.login?.disableSignup),i(Er.AWAITING_FARCASTER_CONNECTION))}catch(e){o({errorModalData:{error:e,previousScreen:a||Er.LANDING}}),i(Er.ERROR_SCREEN)}finally{n(!1)}},disabled:!1,children:[t(lp,{})," Farcaster",r&&t(It,{}),"farcaster"===h&&t(tg,{color:"gray",children:"Recent"})]})};let tg=kr(Dt)`
2051
2057
  margin-left: auto;
2052
- `;const eg=()=>{let{enabled:e,token:r}=Jl(),{navigate:n,setModalData:a}=$r(),{initLoginWithPasskey:i}=D();return t(rg,{onClick:async()=>{e&&!r?(a({captchaModalData:{callback:e=>i({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_PASSKEY_SYSTEM_DIALOGUE,onErrorNavigateTo:Er.ERROR_SCREEN}}),n(Er.CAPTCHA_SCREEN)):(await i({withPrivyUi:!0}),n(Er.AWAITING_PASSKEY_SYSTEM_DIALOGUE))},children:"I have a passkey"})};let tg=Sr`
2058
+ `;const rg=()=>{let{enabled:e,token:r}=Jl(),{navigate:n,setModalData:a}=$r(),{initLoginWithPasskey:i}=D();return t(ag,{onClick:async()=>{e&&!r?(a({captchaModalData:{callback:e=>i({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_PASSKEY_SYSTEM_DIALOGUE,onErrorNavigateTo:Er.ERROR_SCREEN}}),n(Er.CAPTCHA_SCREEN)):(await i({withPrivyUi:!0}),n(Er.AWAITING_PASSKEY_SYSTEM_DIALOGUE))},children:"I have a passkey"})};let ng=Sr`
2053
2059
  && {
2054
2060
  width: 100%;
2055
2061
  font-size: 0.875rem;
@@ -2070,11 +2076,11 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2070
2076
  box-shadow: none;
2071
2077
  }
2072
2078
  }
2073
- `;const rg=kr.button`
2074
- ${tg}
2075
- `,ng=({value:r,onChange:n})=>t("select",{value:r,onChange:n,children:Jo.map((t=>e("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),ag=v(((n,a)=>{let{app:i}=$r(),[o,l]=d(!1),{accountType:s}=Lt(),[c,u]=d(""),[h,m]=d(i?.intl.defaultCountry??"US"),f=Yo(c,h),g=(e=>new Ko(e))(h),y=(e=>{let t=function(){return Ua(qo,arguments)}(e,Da)?.formatInternational();return t?.substring(t.indexOf(" ")+1)})(h),w=Zo(h),v=!f,[C,b]=d(!1),$=w.length,E=e=>{let t=e.target.value;m(t),u(""),n.onChange&&n.onChange({rawPhoneNumber:c,qualifiedPhoneNumber:Xo(c,t),countryCode:t,isValid:Yo(c,h)})},T=(e,t)=>{try{let r=e.replace(/\D/g,"")===c.replace(/\D/g,"")?e:g.input(e);u(r),n.onChange&&n.onChange({rawPhoneNumber:r,qualifiedPhoneNumber:Xo(e,t),countryCode:t,isValid:Yo(e,t)})}catch(e){console.error("Error processing phone number:",e)}},x=()=>{b(!0);let e=Xo(c,h);n.onSubmit({rawPhoneNumber:c,qualifiedPhoneNumber:e,countryCode:h,isValid:Yo(c,h)}).finally((()=>b(!1)))};return p((()=>{if(n.defaultValue){let e=(e=>{let t=new Ko;t.input(e);let r=t.getCountry()||"US",n=t.getCallingCode()||"1";return{countryCode:r,phone:e.replace("+"+n,"")}})(n.defaultValue);g.reset(),E({target:{value:e.countryCode}}),T(e.phone,e.countryCode)}}),[n.defaultValue]),e(r,{children:[t(ig,{children:e(og,{$callingCodeLength:$,$stacked:n.stacked,children:[t(ng,{value:h,onChange:E}),t("input",{ref:a,id:"phone-number-input",className:"login-method-button",type:"tel",placeholder:y,onFocus:()=>l(!0),onChange:e=>{T(e.target.value,h)},onKeyUp:e=>{"Enter"===e.key&&x()},value:c,autoComplete:"tel"}),"phone"!==s||o||n.hideRecent?n.stacked||n.noIncludeSubmitButton?t("span",{}):t(cd,{isSubmitting:C,onClick:x,disabled:v,children:"Submit"}):t(Dt,{color:"gray",children:"Recent"})]})}),n.stacked&&!n.noIncludeSubmitButton?t(rd,{loading:C,loadingText:null,onClick:x,disabled:v,children:"Submit"}):null]})}));let ig=kr.div`
2079
+ `;const ag=kr.button`
2080
+ ${ng}
2081
+ `,ig=({value:r,onChange:n})=>t("select",{value:r,onChange:n,children:Jo.map((t=>e("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),og=v(((n,a)=>{let{app:i}=$r(),[o,l]=d(!1),{accountType:s}=Lt(),[c,u]=d(""),[h,m]=d(i?.intl.defaultCountry??"US"),f=Yo(c,h),g=(e=>new Ko(e))(h),y=(e=>{let t=function(){return Ua(qo,arguments)}(e,Da)?.formatInternational();return t?.substring(t.indexOf(" ")+1)})(h),w=Zo(h),v=!f,[C,b]=d(!1),$=w.length,E=e=>{let t=e.target.value;m(t),u(""),n.onChange&&n.onChange({rawPhoneNumber:c,qualifiedPhoneNumber:Xo(c,t),countryCode:t,isValid:Yo(c,h)})},T=(e,t)=>{try{let r=e.replace(/\D/g,"")===c.replace(/\D/g,"")?e:g.input(e);u(r),n.onChange&&n.onChange({rawPhoneNumber:r,qualifiedPhoneNumber:Xo(e,t),countryCode:t,isValid:Yo(e,t)})}catch(e){console.error("Error processing phone number:",e)}},x=()=>{b(!0);let e=Xo(c,h);n.onSubmit({rawPhoneNumber:c,qualifiedPhoneNumber:e,countryCode:h,isValid:Yo(c,h)}).finally((()=>b(!1)))};return p((()=>{if(n.defaultValue){let e=(e=>{let t=new Ko;t.input(e);let r=t.getCountry()||"US",n=t.getCallingCode()||"1";return{countryCode:r,phone:e.replace("+"+n,"")}})(n.defaultValue);g.reset(),E({target:{value:e.countryCode}}),T(e.phone,e.countryCode)}}),[n.defaultValue]),e(r,{children:[t(lg,{children:e(sg,{$callingCodeLength:$,$stacked:n.stacked,children:[t(ig,{value:h,onChange:E}),t("input",{ref:a,id:"phone-number-input",className:"login-method-button",type:"tel",placeholder:y,onFocus:()=>l(!0),onChange:e=>{T(e.target.value,h)},onKeyUp:e=>{"Enter"===e.key&&x()},value:c,autoComplete:"tel"}),"phone"!==s||o||n.hideRecent?n.stacked||n.noIncludeSubmitButton?t("span",{}):t(cd,{isSubmitting:C,onClick:x,disabled:v,children:"Submit"}):t(Dt,{color:"gray",children:"Recent"})]})}),n.stacked&&!n.noIncludeSubmitButton?t(rd,{loading:C,loadingText:null,onClick:x,disabled:v,children:"Submit"}):null]})}));let lg=kr.div`
2076
2082
  width: 100%;
2077
- `,og=kr.label`
2083
+ `,sg=kr.label`
2078
2084
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.$callingCodeLength}px));
2079
2085
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.$callingCodeLength}px));
2080
2086
  display: block;
@@ -2167,15 +2173,15 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2167
2173
  && > input::placeholder {
2168
2174
  color: var(--privy-color-foreground-3);
2169
2175
  }
2170
- `;const lg=({isEditable:n,setIsEditable:a,defaultValue:i})=>{let o=s(null),{authenticated:l}=F(),{navigate:d,setModalData:c,currentScreen:u,data:h}=$r(),{initLoginWithSms:p}=D(),{enabled:m,token:f}=Jl();return e(r,{children:[t(Od,{$if:!n,children:t(ag,{ref:o,onSubmit:async function({qualifiedPhoneNumber:e}){if(!m||f||l)try{await p({phoneNumber:e,captchaToken:f,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),d(Er.AWAITING_PASSWORDLESS_CODE)}catch(e){c({errorModalData:{error:e,previousScreen:u||Er.LANDING}}),d(Er.ERROR_SCREEN)}else c({captchaModalData:{callback:t=>p({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:Er.ERROR_SCREEN}}),d(Er.CAPTCHA_SCREEN)},defaultValue:i})}),t(Od,{$if:n,children:e(Id,{onClick:()=>{a(),setTimeout((()=>{o.current?.focus()}),0)},children:[t(Zr,{})," Continue with SMS"]})})]})};let sg={apple:{logo:t(yl,{}),displayName:"Apple"},discord:{logo:t(wl,{}),displayName:"Discord"},github:{logo:t(vl,{}),displayName:"GitHub"},google:{logo:t(bl,{}),displayName:"Google"},linkedin:{logo:t(El,{}),displayName:"LinkedIn"},spotify:{logo:t(Tl,{}),displayName:"Spotify"},instagram:{logo:t($l,{}),displayName:"Instagram"},twitter:{logo:t(_l,{}),displayName:"Twitter"},tiktok:{logo:t(xl,{}),displayName:"TikTok"}};const dg=({provider:r})=>{let{enabled:n,token:a}=Jl(),{navigate:i,setModalData:o,data:l}=$r(),[s,c]=d(!1),{initLoginWithOAuth:u}=D(),{accountType:h}=Lt(),p=h?Uf(h):null,{displayName:m,logo:f}=sg[r];return e(Id,{onClick:()=>{c(!0),n&&!a?(o({captchaModalData:{callback:e=>u(r,e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Er.ERROR_SCREEN}}),i(Er.CAPTCHA_SCREEN)):u(r,void 0,l?.login?.disableSignup)},disabled:s,children:[f," ",m,p?.loginMethod===r&&t(cg,{color:"gray",children:"Recent"})]})};let cg=kr(Dt)`
2176
+ `;const dg=({isEditable:n,setIsEditable:a,defaultValue:i})=>{let o=s(null),{authenticated:l}=F(),{navigate:d,setModalData:c,currentScreen:u,data:h}=$r(),{initLoginWithSms:p}=D(),{enabled:m,token:f}=Jl();return e(r,{children:[t(Od,{$if:!n,children:t(og,{ref:o,onSubmit:async function({qualifiedPhoneNumber:e}){if(!m||f||l)try{await p({phoneNumber:e,captchaToken:f,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),d(Er.AWAITING_PASSWORDLESS_CODE)}catch(e){c({errorModalData:{error:e,previousScreen:u||Er.LANDING}}),d(Er.ERROR_SCREEN)}else c({captchaModalData:{callback:t=>p({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:Er.ERROR_SCREEN}}),d(Er.CAPTCHA_SCREEN)},defaultValue:i})}),t(Od,{$if:n,children:e(Id,{onClick:()=>{a(),setTimeout((()=>{o.current?.focus()}),0)},children:[t(Zr,{})," Continue with SMS"]})})]})};let cg={apple:{logo:t(yl,{}),displayName:"Apple"},discord:{logo:t(wl,{}),displayName:"Discord"},github:{logo:t(vl,{}),displayName:"GitHub"},google:{logo:t(bl,{}),displayName:"Google"},linkedin:{logo:t(El,{}),displayName:"LinkedIn"},spotify:{logo:t(Tl,{}),displayName:"Spotify"},instagram:{logo:t($l,{}),displayName:"Instagram"},twitter:{logo:t(_l,{}),displayName:"Twitter"},tiktok:{logo:t(xl,{}),displayName:"TikTok"}};const ug=({provider:r})=>{let{enabled:n,token:a}=Jl(),{navigate:i,setModalData:o,data:l}=$r(),[s,c]=d(!1),{initLoginWithOAuth:u}=D(),{accountType:h}=Lt(),p=h?Bf(h):null,{displayName:m,logo:f}=cg[r];return e(Id,{onClick:()=>{c(!0),n&&!a?(o({captchaModalData:{callback:e=>u(r,e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Er.ERROR_SCREEN}}),i(Er.CAPTCHA_SCREEN)):u(r,void 0,l?.login?.disableSignup)},disabled:s,children:[f," ",m,p?.loginMethod===r&&t(hg,{color:"gray",children:"Recent"})]})};let hg=kr(Dt)`
2171
2177
  margin-left: auto;
2172
- `;function ug(r){return e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...r,children:[t("defs",{children:e("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[t("stop",{offset:"0",stopColor:"#1d93d2"}),t("stop",{offset:"1",stopColor:"#38b0e3"})]})}),t("title",{children:"Telegram_logo"}),t("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),t("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),t("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),t("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}const hg=()=>{let{enabled:r,token:n}=Jl(),{navigate:a,setModalData:i,data:o}=$r(),[l,s]=d(!1),{initLoginWithTelegram:c}=D(),{accountType:u}=Lt();async function h(e){try{await c(e,o?.login?.disableSignup),i({telegramAuthModalData:{seamlessAuth:!1}}),a(Er.TELEGRAM_AUTH_SCREEN)}catch(e){console.error(e),s(!1)}}return e(Id,{onClick:async function(){if(s(!0),r&&!n)return i({captchaModalData:{callback:h,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Er.ERROR_SCREEN}}),void a(Er.CAPTCHA_SCREEN);await h(n)},disabled:l,children:[t(ug,{}),"Telegram","telegram"===u&&t(pg,{color:"gray",children:"Recent"})]})};let pg=kr(Dt)`
2178
+ `;function pg(r){return e("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...r,children:[t("defs",{children:e("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[t("stop",{offset:"0",stopColor:"#1d93d2"}),t("stop",{offset:"1",stopColor:"#38b0e3"})]})}),t("title",{children:"Telegram_logo"}),t("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),t("path",{d:"M81.229,128.772l14.237,39.406s1.78,3.687,3.686,3.687,30.255-29.492,30.255-29.492l31.525-60.89L81.737,118.6Z",fill:"#c8daea"}),t("path",{d:"M100.106,138.878l-2.733,29.046s-1.144,8.9,7.754,0,17.415-15.763,17.415-15.763",fill:"#a9c6d8"}),t("path",{d:"M81.486,130.178,52.2,120.636s-3.5-1.42-2.373-4.64c.232-.664.7-1.229,2.1-2.2,6.489-4.523,120.106-45.36,120.106-45.36s3.208-1.081,5.1-.362a2.766,2.766,0,0,1,1.885,2.055,9.357,9.357,0,0,1,.254,2.585c-.009.752-.1,1.449-.169,2.542-.692,11.165-21.4,94.493-21.4,94.493s-1.239,4.876-5.678,5.043A8.13,8.13,0,0,1,146.1,172.5c-8.711-7.493-38.819-27.727-45.472-32.177a1.27,1.27,0,0,1-.546-.9c-.093-.469.417-1.05.417-1.05s52.426-46.6,53.821-51.492c.108-.379-.3-.566-.848-.4-3.482,1.281-63.844,39.4-70.506,43.607A3.21,3.21,0,0,1,81.486,130.178Z",fill:"#fff"})]})}const mg=()=>{let{enabled:r,token:n}=Jl(),{navigate:a,setModalData:i,data:o}=$r(),[l,s]=d(!1),{initLoginWithTelegram:c}=D(),{accountType:u}=Lt();async function h(e){try{await c(e,o?.login?.disableSignup),i({telegramAuthModalData:{seamlessAuth:!1}}),a(Er.TELEGRAM_AUTH_SCREEN)}catch(e){console.error(e),s(!1)}}return e(Id,{onClick:async function(){if(s(!0),r&&!n)return i({captchaModalData:{callback:h,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Er.ERROR_SCREEN}}),void a(Er.CAPTCHA_SCREEN);await h(n)},disabled:l,children:[t(pg,{}),"Telegram","telegram"===u&&t(fg,{color:"gray",children:"Recent"})]})};let fg=kr(Dt)`
2173
2179
  margin-left: auto;
2174
- `;const mg=({onClick:r,text:n,icon:a})=>e(Id,{onClick:r,children:[a,t(xd,{children:n}),t(zn,{})]}),fg=({connectOnly:n})=>{let{closePrivyModal:a,connectors:i}=D(),{app:o,onUserCloseViaDialogOrKeybindRef:l,data:s}=$r(),{appearance:{palette:{colorScheme:c}}}=We(),{accountType:u,walletClientType:h,chainType:m}=Lt(),f=u?Uf(u):null,g=o.loginMethodsAndOrder?.primary??[],y=o.loginMethodsAndOrder?.overflow??[],w=[...g,...y],v=o.loginMethods.passkey,C=s?.login,b=[];h&&w.includes(h)?b.push(h):u&&w.includes(f?.loginMethod)&&b.push(f?.loginMethod);let[$,E]=d("default"),[T,x]=d("phone"===u?"sms":"email");p((()=>{"phone"===u&&x("sms");let e=w.indexOf("sms"),t=w.indexOf("email");e>-1&&e<t&&x("sms")}),[u,g,y]);let _=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{E("default")}),150)};l.current=_;let A=e=>"email"===e?t(Xf,{isEditable:"email"===T,setIsEditable:()=>{x("email")},defaultValue:"email"===C?.prefill?.type?C.prefill.value:void 0},e):"sms"===e?t(lg,{isEditable:"sms"===T,setIsEditable:()=>{x("sms")},defaultValue:"phone"===C?.prefill?.type?C.prefill.value:void 0},e):"apple"===e?t(dg,{provider:"apple"},e):"discord"===e?t(dg,{provider:"discord"},e):"farcaster"===e?t(Qf,{},e):"github"===e?t(dg,{provider:"github"},e):"google"===e?t(dg,{provider:"google"},e):"linkedin"===e?t(dg,{provider:"linkedin"},e):"spotify"===e?t(dg,{provider:"spotify"},e):"instagram"===e?t(dg,{provider:"instagram"},e):"tiktok"===e?t(dg,{provider:"tiktok"},e):"twitter"===e?t(dg,{provider:"twitter"},e):"telegram"===e?t(hg,{},e):e.startsWith("privy:")?t(Hf,{appId:e.replace("privy:","")},e):hu({walletList:o.appearance.walletList,walletChainType:o.appearance.walletChainType,connectors:i,connectOnly:n,ignore:w,walletConnectEnabled:o.externalWallets.walletConnect.enabled,forceWallet:{wallet:e,chainType:m??"ethereum"}}),k=b.flatMap(A),S=g.filter((e=>e!==h&&e!==f?.loginMethod)).flatMap(A),N=y.filter((e=>e!==h&&e!==f?.loginMethod)).flatMap(A),[I,P]=gt([...k,...S,...N],gg({primary:S.length+k.length,overflow:N.length}));return e(r,{children:[t(yd,{title:o.appearance.landingHeader,onClose:_,backFn:"default"===$?void 0:()=>{E("default")}}),"default"===$&&t(yg,{}),"default"===$&&("string"==typeof o.appearance.loginMessage?t(Nd,{children:o.appearance.loginMessage}):o.appearance.loginMessage),t(_d,{style:{overflow:"hidden"},children:e(kd,{$colorScheme:c,style:{maxHeight:400,overflowY:"scroll",padding:2},children:["default"===$&&e(r,{children:[I,P.length>0&&t(mg,{text:"More options",icon:t(un,{}),onClick:()=>E("overflow")})]}),"overflow"===$&&t(r,{children:P}),v&&"default"===$&&t(eg,{})]})}),o&&t(Ft,{app:o}),t(Ot,{})]})};let gg=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,yg=kr(Bf)`
2180
+ `;const gg=({onClick:r,text:n,icon:a})=>e(Id,{onClick:r,children:[a,t(xd,{children:n}),t(zn,{})]}),yg=({connectOnly:n})=>{let{closePrivyModal:a,connectors:i}=D(),{app:o,onUserCloseViaDialogOrKeybindRef:l,data:s}=$r(),{appearance:{palette:{colorScheme:c}}}=We(),{accountType:u,walletClientType:h,chainType:m}=Lt(),f=u?Bf(u):null,g=o.loginMethodsAndOrder?.primary??[],y=o.loginMethodsAndOrder?.overflow??[],w=[...g,...y],v=o.loginMethods.passkey,C=s?.login,b=[];h&&w.includes(h)?b.push(h):u&&w.includes(f?.loginMethod)&&b.push(f?.loginMethod);let[$,E]=d("default"),[T,x]=d("phone"===u?"sms":"email");p((()=>{"phone"===u&&x("sms");let e=w.indexOf("sms"),t=w.indexOf("email");e>-1&&e<t&&x("sms")}),[u,g,y]);let _=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{E("default")}),150)};l.current=_;let A=e=>"email"===e?t(Jf,{isEditable:"email"===T,setIsEditable:()=>{x("email")},defaultValue:"email"===C?.prefill?.type?C.prefill.value:void 0},e):"sms"===e?t(dg,{isEditable:"sms"===T,setIsEditable:()=>{x("sms")},defaultValue:"phone"===C?.prefill?.type?C.prefill.value:void 0},e):"apple"===e?t(ug,{provider:"apple"},e):"discord"===e?t(ug,{provider:"discord"},e):"farcaster"===e?t(eg,{},e):"github"===e?t(ug,{provider:"github"},e):"google"===e?t(ug,{provider:"google"},e):"linkedin"===e?t(ug,{provider:"linkedin"},e):"spotify"===e?t(ug,{provider:"spotify"},e):"instagram"===e?t(ug,{provider:"instagram"},e):"tiktok"===e?t(ug,{provider:"tiktok"},e):"twitter"===e?t(ug,{provider:"twitter"},e):"telegram"===e?t(mg,{},e):e.startsWith("privy:")?t(jf,{appId:e.replace("privy:","")},e):hu({walletList:o.appearance.walletList,walletChainType:o.appearance.walletChainType,connectors:i,connectOnly:n,ignore:w,walletConnectEnabled:o.externalWallets.walletConnect.enabled,forceWallet:{wallet:e,chainType:m??"ethereum"}}),k=b.flatMap(A),S=g.filter((e=>e!==h&&e!==f?.loginMethod)).flatMap(A),N=y.filter((e=>e!==h&&e!==f?.loginMethod)).flatMap(A),[I,P]=gt([...k,...S,...N],wg({primary:S.length+k.length,overflow:N.length}));return e(r,{children:[t(yd,{title:o.appearance.landingHeader,onClose:_,backFn:"default"===$?void 0:()=>{E("default")}}),"default"===$&&t(vg,{}),"default"===$&&("string"==typeof o.appearance.loginMessage?t(Nd,{children:o.appearance.loginMessage}):o.appearance.loginMessage),t(_d,{style:{overflow:"hidden"},children:e(kd,{$colorScheme:c,style:{maxHeight:400,overflowY:"scroll",padding:2},children:["default"===$&&e(r,{children:[I,P.length>0&&t(gg,{text:"More options",icon:t(un,{}),onClick:()=>E("overflow")})]}),"overflow"===$&&t(r,{children:P}),v&&"default"===$&&t(rg,{})]})}),o&&t(Ft,{app:o}),t(Ot,{})]})};let wg=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,vg=kr(Hf)`
2175
2181
  margin-bottom: 16px;
2176
- `;const wg=({...r})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...r,children:[e("g",{clipPath:"url(#clip0_2856_1743)",children:[t("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),t("defs",{children:t("clipPath",{id:"clip0_2856_1743",children:t("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),vg=({connectOnly:n})=>{let{closePrivyModal:a,connectors:i}=D(),{data:o,onUserCloseViaDialogOrKeybindRef:l}=$r(),s=We(),{accountType:u,walletClientType:h,chainType:m}=Lt(),f=u?Uf(u):null,g=o?.login,{email:y,sms:w,google:v,twitter:C,discord:b,github:$,spotify:E,instagram:T,tiktok:x,linkedin:_,apple:A,wallet:k,farcaster:S,telegram:N}=c((()=>g?.loginMethods?((e,t=!0)=>e.reduce(((e,r)=>({...e,[r]:t})),{}))(g.loginMethods,!0):null),[g])??s.loginMethods,{passkey:I}=s.loginMethods,P=[y&&"email",w&&"sms",v&&"google",C&&"twitter",b&&"discord",$&&"github",E&&"spotify",T&&"instagram",x&&"tiktok",_&&"linkedin",A&&"apple",S&&"farcaster",N&&"telegram"].filter((e=>!!e)),O=P.length>0,R=c((()=>k&&!O?"web3-first":k&&s?.appearance.loginGroupPriority||"web2-first"),[k,O,s?.appearance.loginGroupPriority]),M=s?.appearance.hideDirectWeb2Inputs,[L,F]=d("default"),[U,W]=d(Tg({mostRecentlyUsedAccountType:u,smsAvailable:w,emailAvailable:y,prefilledType:g?.prefill?.type}));p((()=>{W(Tg({mostRecentlyUsedAccountType:u,smsAvailable:w,emailAvailable:y,prefilledType:g?.prefill?.type}))}),[y,w,u]);let B=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{F("default")}),150)};l.current=B;let G=[];h&&k?G.push(h):f?.loginMethod&&P.includes(f.loginMethod)&&G.push(f.loginMethod);let H=e=>"email"===e?t(Xf,{isEditable:"email"===U,setIsEditable:()=>{W("email")},defaultValue:"email"===g?.prefill?.type?g.prefill.value:void 0},e):"sms"===e?t(lg,{isEditable:"sms"===U,setIsEditable:()=>{W("sms")},defaultValue:"phone"===g?.prefill?.type?g.prefill.value:void 0},e):"apple"===e?t(dg,{provider:"apple"},e):"discord"===e?t(dg,{provider:"discord"},e):"farcaster"===e?t(Qf,{},e):"github"===e?t(dg,{provider:"github"},e):"google"===e?t(dg,{provider:"google"},e):"linkedin"===e?t(dg,{provider:"linkedin"},e):"tiktok"===e?t(dg,{provider:"tiktok"},e):"spotify"===e?t(dg,{provider:"spotify"},e):"instagram"===e?t(dg,{provider:"instagram"},e):"twitter"===e?t(dg,{provider:"twitter"},e):"telegram"===e?t(hg,{},e):hu({walletList:s.appearance.walletList,walletChainType:s.appearance.walletChainType,connectors:i,connectOnly:n,ignore:[],walletConnectEnabled:s.externalWallets.walletConnect.enabled,forceWallet:{wallet:e,chainType:m??"ethereum"}}),z=hu({walletList:s.appearance.walletList.filter((e=>e!==h)),walletChainType:s.appearance.walletChainType,connectors:i,connectOnly:n,ignore:[...s.appearance.walletList,h],walletConnectEnabled:s.externalWallets.walletConnect.enabled}),j=P.filter((e=>e!==f?.loginMethod)).flatMap(H),V=G.flatMap(H);"web3-first"===R&&"default"===L?z.unshift(...V):"web2-first"===R&&j.unshift(...V);let q=P.filter((e=>"email"!==e&&"sms"!==e)),K=bg({priority:R,email:y,sms:w,social:q}),Z=$g({priority:R,email:y,sms:w,social:q}),Y=t(kf,{text:Eg({priority:R}),onClick:()=>F("web3-overflow")}),X=t(mg,{text:K,icon:Z,onClick:()=>F("web2-overflow")}),Q=M?0:1;return e(r,{children:[t(yd,{title:s.appearance.landingHeader,onClose:B,backFn:"default"===L?void 0:()=>{F("default")}}),"default"===L&&t(Cg,{}),"default"===L&&("string"==typeof s.appearance.loginMessage?t(Nd,{children:s.appearance.loginMessage}):s.appearance.loginMessage),t(_d,{style:{overflow:"hidden",padding:2},children:e(Ad,{children:["default"===L&&"web2-first"===R&&e(r,{children:[j.length>4?j.slice(0,3):j,j.length>4&&X,k&&Y]}),"default"===L&&"web3-first"===R&&e(r,{children:[k&&e(r,{children:[z.length>4?z.slice(0,3):z,z.length>4&&Y]}),j.length>Q&&X,j.length===Q&&j[0]]}),"web2-overflow"===L&&t(r,{children:"web3-first"===R?j:j.slice(3)}),"web3-overflow"===L?z:[],I&&"default"===L&&t(eg,{})]})}),s&&t(Ft,{app:s}),t(Ot,{})]})};let Cg=kr(Bf)`
2182
+ `;const Cg=({...r})=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...r,children:[e("g",{clipPath:"url(#clip0_2856_1743)",children:[t("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),t("defs",{children:t("clipPath",{id:"clip0_2856_1743",children:t("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),bg=({connectOnly:n})=>{let{closePrivyModal:a,connectors:i}=D(),{data:o,onUserCloseViaDialogOrKeybindRef:l}=$r(),s=We(),{accountType:u,walletClientType:h,chainType:m}=Lt(),f=u?Bf(u):null,g=o?.login,{email:y,sms:w,google:v,twitter:C,discord:b,github:$,spotify:E,instagram:T,tiktok:x,linkedin:_,apple:A,wallet:k,farcaster:S,telegram:N}=c((()=>g?.loginMethods?((e,t=!0)=>e.reduce(((e,r)=>({...e,[r]:t})),{}))(g.loginMethods,!0):null),[g])??s.loginMethods,{passkey:I}=s.loginMethods,P=[y&&"email",w&&"sms",v&&"google",C&&"twitter",b&&"discord",$&&"github",E&&"spotify",T&&"instagram",x&&"tiktok",_&&"linkedin",A&&"apple",S&&"farcaster",N&&"telegram"].filter((e=>!!e)),O=P.length>0,R=c((()=>k&&!O?"web3-first":k&&s?.appearance.loginGroupPriority||"web2-first"),[k,O,s?.appearance.loginGroupPriority]),M=s?.appearance.hideDirectWeb2Inputs,[L,F]=d("default"),[U,W]=d(_g({mostRecentlyUsedAccountType:u,smsAvailable:w,emailAvailable:y,prefilledType:g?.prefill?.type}));p((()=>{W(_g({mostRecentlyUsedAccountType:u,smsAvailable:w,emailAvailable:y,prefilledType:g?.prefill?.type}))}),[y,w,u]);let B=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{F("default")}),150)};l.current=B;let G=[];h&&k?G.push(h):f?.loginMethod&&P.includes(f.loginMethod)&&G.push(f.loginMethod);let H=e=>"email"===e?t(Jf,{isEditable:"email"===U,setIsEditable:()=>{W("email")},defaultValue:"email"===g?.prefill?.type?g.prefill.value:void 0},e):"sms"===e?t(dg,{isEditable:"sms"===U,setIsEditable:()=>{W("sms")},defaultValue:"phone"===g?.prefill?.type?g.prefill.value:void 0},e):"apple"===e?t(ug,{provider:"apple"},e):"discord"===e?t(ug,{provider:"discord"},e):"farcaster"===e?t(eg,{},e):"github"===e?t(ug,{provider:"github"},e):"google"===e?t(ug,{provider:"google"},e):"linkedin"===e?t(ug,{provider:"linkedin"},e):"tiktok"===e?t(ug,{provider:"tiktok"},e):"spotify"===e?t(ug,{provider:"spotify"},e):"instagram"===e?t(ug,{provider:"instagram"},e):"twitter"===e?t(ug,{provider:"twitter"},e):"telegram"===e?t(mg,{},e):hu({walletList:s.appearance.walletList,walletChainType:s.appearance.walletChainType,connectors:i,connectOnly:n,ignore:[],walletConnectEnabled:s.externalWallets.walletConnect.enabled,forceWallet:{wallet:e,chainType:m??"ethereum"}}),z=hu({walletList:s.appearance.walletList.filter((e=>e!==h)),walletChainType:s.appearance.walletChainType,connectors:i,connectOnly:n,ignore:[...s.appearance.walletList,h],walletConnectEnabled:s.externalWallets.walletConnect.enabled}),j=P.filter((e=>e!==f?.loginMethod)).flatMap(H),V=G.flatMap(H);"web3-first"===R&&"default"===L?z.unshift(...V):"web2-first"===R&&j.unshift(...V);let q=P.filter((e=>"email"!==e&&"sms"!==e)),K=Eg({priority:R,email:y,sms:w,social:q}),Z=Tg({priority:R,email:y,sms:w,social:q}),Y=t(Nf,{text:xg({priority:R}),onClick:()=>F("web3-overflow")}),X=t(gg,{text:K,icon:Z,onClick:()=>F("web2-overflow")}),Q=M?0:1;return e(r,{children:[t(yd,{title:s.appearance.landingHeader,onClose:B,backFn:"default"===L?void 0:()=>{F("default")}}),"default"===L&&t($g,{}),"default"===L&&("string"==typeof s.appearance.loginMessage?t(Nd,{children:s.appearance.loginMessage}):s.appearance.loginMessage),t(_d,{style:{overflow:"hidden",padding:2},children:e(Ad,{children:["default"===L&&"web2-first"===R&&e(r,{children:[j.length>4?j.slice(0,3):j,j.length>4&&X,k&&Y]}),"default"===L&&"web3-first"===R&&e(r,{children:[k&&e(r,{children:[z.length>4?z.slice(0,3):z,z.length>4&&Y]}),j.length>Q&&X,j.length===Q&&j[0]]}),"web2-overflow"===L&&t(r,{children:"web3-first"===R?j:j.slice(3)}),"web3-overflow"===L?z:[],I&&"default"===L&&t(rg,{})]})}),s&&t(Ft,{app:s}),t(Ot,{})]})};let $g=kr(Hf)`
2177
2183
  margin-bottom: 16px;
2178
- `,bg=({priority:e,email:t,sms:r,social:n})=>"web2-first"===e?"Other socials":t&&r&&n.length>0||t&&n.length>0?"Log in with email or socials":r&&n.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",$g=({priority:e,email:r,sms:n,social:a})=>"web2-first"===e||a.length>0?t(un,{}):r&&n?t(wg,{}):r?t(Kr,{}):n?t(Zr,{}):null,Eg=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets",Tg=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:r,prefilledType:n})=>r&&("email"===e&&"phone"!==n||"email"===n)||!t||"phone"!==e&&"phone"!==n?"email":"sms";const xg=({style:r,...n})=>e("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...r},...n,children:[t("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});function _g(){let{promptMfa:e,init:t,submit:r,cancel:n,mfaMethods:a}=u(q);return{promptMfa:e,init:t,submit:r,cancel:n,mfaMethods:a}}function Ag(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:n,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:i,unenroll:o,enrollInMfa:l}=u(q);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:n,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>o("sms"),unenrollWithTotp:()=>o("totp"),unenrollWithPasskey:()=>o("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}const kg=r=>e(Sg,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...r,children:[t("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]});let Sg=kr.svg`
2184
+ `,Eg=({priority:e,email:t,sms:r,social:n})=>"web2-first"===e?"Other socials":t&&r&&n.length>0||t&&n.length>0?"Log in with email or socials":r&&n.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",Tg=({priority:e,email:r,sms:n,social:a})=>"web2-first"===e||a.length>0?t(un,{}):r&&n?t(Cg,{}):r?t(Kr,{}):n?t(Zr,{}):null,xg=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets",_g=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:r,prefilledType:n})=>r&&("email"===e&&"phone"!==n||"email"===n)||!t||"phone"!==e&&"phone"!==n?"email":"sms";const Ag=({style:r,...n})=>e("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...r},...n,children:[t("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});function kg(){let{promptMfa:e,init:t,submit:r,cancel:n,mfaMethods:a}=u(q);return{promptMfa:e,init:t,submit:r,cancel:n,mfaMethods:a}}function Sg(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:n,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:i,unenroll:o,enrollInMfa:l}=u(q);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:n,submitEnrollmentWithTotp:a,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>o("sms"),unenrollWithTotp:()=>o("totp"),unenrollWithPasskey:()=>o("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}const Ng=r=>e(Ig,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...r,children:[t("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]});let Ig=kr.svg`
2179
2185
  height: 90px;
2180
2186
  width: 90px;
2181
2187
 
@@ -2186,9 +2192,9 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2186
2192
  > path {
2187
2193
  fill: white;
2188
2194
  }
2189
- `;const Ng=({showIntro:n,userMfaMethods:a,appMfaMethods:i,userHasAuthSms:o,isTotpLoading:l,isPasskeyLoading:s,error:d,onClose:c,onBackToIntro:u,handleSelectMethod:h,setRemovingMfaMethod:p})=>{let m=a.reduce(((e,t)=>({...e,[t]:!0})),{}),f=i.reduce(((e,t)=>({...e,[t]:!0})),{});return e(r,{children:[t(yd,{backFn:n?u:void 0,onClose:c},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(jn,{})}),t(Xd,{children:"Choose a verification method"}),a.length>0?t(Qd,{children:"To add or delete verification methods, verification is required."}):t(Qd,{children:"How would you like to verify your identity? You can change this later."}),d&&t(pc,{style:{marginTop:"1.25rem"},children:d.message}),e(ac,{children:[(f.totp||m.totp)&&e(ic,{children:[t(Id,{style:{justifyContent:"center"},disabled:m.totp||l,onClick:()=>h("totp"),children:l?t(Gt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):e(dc,{children:[e(lc,{children:[t(qn,{}),"Authenticator app"]}),m.totp?t(Ig,{color:"green",children:"Enabled"}):t(sc,{children:"Recommended"})]})}),m.totp&&t(oc,{style:{position:"absolute",right:0},onClick:()=>p("totp"),children:t(Zn,{})})]},"totp"),(f.sms||m.sms)&&e(ic,{children:[t(Id,{disabled:m.sms||o,onClick:()=>h("sms"),children:e(dc,{children:[e(lc,{children:[t(Zr,{}),"SMS"]}),m.sms&&t(Ig,{color:"green",children:"Enabled"}),o&&t(sc,{children:"Disabled"})]})}),m.sms&&t(oc,{style:{position:"absolute",right:0},onClick:()=>p("sms"),children:t(Zn,{})})]},"sms"),(f.passkey||m.passkey)&&e(ic,{children:[t(Id,{style:{justifyContent:"center"},onClick:()=>h("passkey"),disabled:m.passkey||s,children:s?t(Gt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):e(dc,{children:[e(lc,{children:[t(Kn,{}),"Passkey"]}),m.passkey?t(Ig,{color:"green",children:"Enabled"}):t(sc,{isAccent:!0,children:t(zn,{})})]})}),m.passkey&&t(oc,{style:{position:"absolute",right:0},onClick:()=>p("passkey"),children:t(Zn,{})})]},"passkey")]}),t(Mt,{})]})};let Ig=kr(Dt)`
2195
+ `;const Pg=({showIntro:n,userMfaMethods:a,appMfaMethods:i,userHasAuthSms:o,isTotpLoading:l,isPasskeyLoading:s,error:d,onClose:c,onBackToIntro:u,handleSelectMethod:h,setRemovingMfaMethod:p})=>{let m=a.reduce(((e,t)=>({...e,[t]:!0})),{}),f=i.reduce(((e,t)=>({...e,[t]:!0})),{});return e(r,{children:[t(yd,{backFn:n?u:void 0,onClose:c},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(jn,{})}),t(Xd,{children:"Choose a verification method"}),a.length>0?t(Qd,{children:"To add or delete verification methods, verification is required."}):t(Qd,{children:"How would you like to verify your identity? You can change this later."}),d&&t(pc,{style:{marginTop:"1.25rem"},children:d.message}),e(ac,{children:[(f.totp||m.totp)&&e(ic,{children:[t(Id,{style:{justifyContent:"center"},disabled:m.totp||l,onClick:()=>h("totp"),children:l?t(Gt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):e(dc,{children:[e(lc,{children:[t(qn,{}),"Authenticator app"]}),m.totp?t(Og,{color:"green",children:"Enabled"}):t(sc,{children:"Recommended"})]})}),m.totp&&t(oc,{style:{position:"absolute",right:0},onClick:()=>p("totp"),children:t(Zn,{})})]},"totp"),(f.sms||m.sms)&&e(ic,{children:[t(Id,{disabled:m.sms||o,onClick:()=>h("sms"),children:e(dc,{children:[e(lc,{children:[t(Zr,{}),"SMS"]}),m.sms&&t(Og,{color:"green",children:"Enabled"}),o&&t(sc,{children:"Disabled"})]})}),m.sms&&t(oc,{style:{position:"absolute",right:0},onClick:()=>p("sms"),children:t(Zn,{})})]},"sms"),(f.passkey||m.passkey)&&e(ic,{children:[t(Id,{style:{justifyContent:"center"},onClick:()=>h("passkey"),disabled:m.passkey||s,children:s?t(Gt,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):e(dc,{children:[e(lc,{children:[t(Kn,{}),"Passkey"]}),m.passkey?t(Og,{color:"green",children:"Enabled"}):t(sc,{isAccent:!0,children:t(zn,{})})]})}),m.passkey&&t(oc,{style:{position:"absolute",right:0},onClick:()=>p("passkey"),children:t(Zn,{})})]},"passkey")]}),t(Mt,{})]})};let Og=kr(Dt)`
2190
2196
  margin-right: 1.5rem;
2191
- `;const Pg=({onComplete:e,onClose:r,onReset:n})=>{let{user:a}=F(),{data:i}=$r(),{initLinkWithPasskey:o,linkWithPasskey:l}=D(),{initEnrollmentWithPasskey:s,submitEnrollmentWithPasskey:u}=Ag(),[h,p]=d(!1),[m,f]=d(!1),[g,y]=d(!1),[w,v]=d(null),C=c((()=>a?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[a]),b=()=>{i?.mfaEnrollmentFlow?.onSuccess(),e()},$=async e=>{p(!0);try{await s(),await u({credentialIds:e}),y(!0)}catch(e){v(e)}finally{p(!1)}},E=async()=>{f(!0),v(null);try{await o();let e=await l(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await $(t)}catch(e){v(e)}finally{f(!1)}};return 0===C.length||m?t(Og,{onReset:n,onClose:r,onClick:E,isCreating:m}):g?t(Mg,{onClick:b,onClose:b}):w?t(zh,{error:w,backFn:()=>v(null),onClick:()=>v(null)}):t(Rg,{passkeys:C,isSubmitting:h,isCreating:m,onReset:n,onClose:r,onSubmitEnrollment:()=>$(C.map((e=>e.credentialId))),onAddPasskey:E})};let Og=({onReset:n,onClose:a,onClick:i,isCreating:o})=>e(r,{children:[t(yd,{backFn:n,onClose:a},"header"),t(Yd,{children:e(hm,{children:[t(sm,{}),t(dm,{})]})}),t(Xd,{children:"Set up passkey verification"}),e(ec,{children:[e(rc,{children:[t(tc,{children:t(jn,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),e(rc,{children:[t(tc,{children:t(Rn,{})}),"Takes seconds to set up and use"]}),e(rc,{children:[t(tc,{children:t(Yn,{})}),"Use your passkey to verify transactions and login to your account"]})]}),t(rd,{style:{marginTop:"2.25rem"},onClick:i,loading:o,children:"Add a new passkey"}),t(Mt,{})]}),Rg=({onReset:n,onClose:a,onAddPasskey:i,onSubmitEnrollment:o,passkeys:l,isSubmitting:s,isCreating:c})=>{let[u,h]=d(!1),p=u?l.length:l.length>3?2:3;return e(r,{children:[t(yd,{backFn:u?()=>h(!1):n,onClose:a},"header"),!u&&t(Yd,{children:e(hm,{children:[t(sm,{}),t(dm,{})]})}),t(Xd,{children:"Enable your passkeys for verification"}),e(ec,{children:[l.slice(0,p).map((r=>e(Lg,{children:[t(Dg,{children:Ug(r)}),e(Fg,{children:["Last used: ",r.latestVerifiedAt?.toLocaleString()]})]},r.credentialId))),!u&&l.length>3&&t(Wg,{onClick:()=>h(!0),children:"View All"})]}),t(rd,{style:{marginTop:"1.5rem"},onClick:o,loading:s,children:"Enable passkeys"}),l.length<5&&t(Wg,{style:{marginTop:"0.5rem"},onClick:i,disabled:c,children:c?t(Gt,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),t(Mt,{})]})},Mg=({onClick:n,onClose:a})=>e(r,{children:[t(yd,{onClose:a},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Qr,{})}),t(Xd,{children:"Passkey verification added"}),t(Qd,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),t(nc,{children:t(rd,{onClick:n,children:"Done"})}),t(Mt,{})]}),Lg=kr.div`
2197
+ `;const Rg=({onComplete:e,onClose:r,onReset:n})=>{let{user:a}=F(),{data:i}=$r(),{initLinkWithPasskey:o,linkWithPasskey:l}=D(),{initEnrollmentWithPasskey:s,submitEnrollmentWithPasskey:u}=Sg(),[h,p]=d(!1),[m,f]=d(!1),[g,y]=d(!1),[w,v]=d(null),C=c((()=>a?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[a]),b=()=>{i?.mfaEnrollmentFlow?.onSuccess(),e()},$=async e=>{p(!0);try{await s(),await u({credentialIds:e}),y(!0)}catch(e){v(e)}finally{p(!1)}},E=async()=>{f(!0),v(null);try{await o();let e=await l(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await $(t)}catch(e){v(e)}finally{f(!1)}};return 0===C.length||m?t(Mg,{onReset:n,onClose:r,onClick:E,isCreating:m}):g?t(Dg,{onClick:b,onClose:b}):w?t(zh,{error:w,backFn:()=>v(null),onClick:()=>v(null)}):t(Lg,{passkeys:C,isSubmitting:h,isCreating:m,onReset:n,onClose:r,onSubmitEnrollment:()=>$(C.map((e=>e.credentialId))),onAddPasskey:E})};let Mg=({onReset:n,onClose:a,onClick:i,isCreating:o})=>e(r,{children:[t(yd,{backFn:n,onClose:a},"header"),t(Yd,{children:e(hm,{children:[t(sm,{}),t(dm,{})]})}),t(Xd,{children:"Set up passkey verification"}),e(ec,{children:[e(rc,{children:[t(tc,{children:t(jn,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),e(rc,{children:[t(tc,{children:t(Rn,{})}),"Takes seconds to set up and use"]}),e(rc,{children:[t(tc,{children:t(Yn,{})}),"Use your passkey to verify transactions and login to your account"]})]}),t(rd,{style:{marginTop:"2.25rem"},onClick:i,loading:o,children:"Add a new passkey"}),t(Mt,{})]}),Lg=({onReset:n,onClose:a,onAddPasskey:i,onSubmitEnrollment:o,passkeys:l,isSubmitting:s,isCreating:c})=>{let[u,h]=d(!1),p=u?l.length:l.length>3?2:3;return e(r,{children:[t(yd,{backFn:u?()=>h(!1):n,onClose:a},"header"),!u&&t(Yd,{children:e(hm,{children:[t(sm,{}),t(dm,{})]})}),t(Xd,{children:"Enable your passkeys for verification"}),e(ec,{children:[l.slice(0,p).map((r=>e(Fg,{children:[t(Ug,{children:Bg(r)}),e(Wg,{children:["Last used: ",r.latestVerifiedAt?.toLocaleString()]})]},r.credentialId))),!u&&l.length>3&&t(Gg,{onClick:()=>h(!0),children:"View All"})]}),t(rd,{style:{marginTop:"1.5rem"},onClick:o,loading:s,children:"Enable passkeys"}),l.length<5&&t(Gg,{style:{marginTop:"0.5rem"},onClick:i,disabled:c,children:c?t(Gt,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),t(Mt,{})]})},Dg=({onClick:n,onClose:a})=>e(r,{children:[t(yd,{onClose:a},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Qr,{})}),t(Xd,{children:"Passkey verification added"}),t(Qd,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),t(nc,{children:t(rd,{onClick:n,children:"Done"})}),t(Mt,{})]}),Fg=kr.div`
2192
2198
  && {
2193
2199
  padding: 0.75rem 1rem;
2194
2200
  text-align: left;
@@ -2196,19 +2202,19 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2196
2202
  border: 1px solid var(--privy-color-foreground-4);
2197
2203
  width: 100%;
2198
2204
  }
2199
- `,Dg=kr.div`
2205
+ `,Ug=kr.div`
2200
2206
  font-size: 0.875rem;
2201
2207
  line-height: 1.375rem;
2202
2208
  font-weight: 500;
2203
2209
 
2204
2210
  color: var(--privy-color-foreground-1);
2205
- `,Fg=kr.div`
2211
+ `,Wg=kr.div`
2206
2212
  font-size: 0.75rem;
2207
2213
  font-weight: 400;
2208
2214
  line-height: 1.125rem;
2209
2215
 
2210
2216
  color: var(--privy-color-foreground-2);
2211
- `,Ug=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device";const Wg=kr.button`
2217
+ `,Bg=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device";const Gg=kr.button`
2212
2218
  && {
2213
2219
  width: 100%;
2214
2220
  font-size: 0.875rem;
@@ -2233,7 +2239,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2233
2239
  box-shadow: none;
2234
2240
  }
2235
2241
  }
2236
- `;var Bg,Gg;let Hg=Array(6).fill("");function zg(e){return/^[0-9]{1}$/.test(e)}function jg(e){return 6===e.length&&e.every(zg)}(Gg=Bg||(Bg={}))[Gg.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",Gg[Gg.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT";const Vg=({onChange:n,disabled:a,errorReasonOverride:i,success:o})=>{let[l,s]=d(Hg),[c,u]=d(null),[h,p]=d(null),m=async e=>{e.preventDefault();let t=e.currentTarget.value.replace(/\s+/g,"");if(""===t)return;let r=l.reduce(((e,t)=>e+Number(zg(t))),0),a=t.split(""),i=!a.every(zg),o=a.length+r>6;if(i)return u("Passcode can only be numbers"),void p(1);if(o)return u("Passcode must be exactly 6 numbers"),void p(1);u(null),p(null);let d=Number(e.currentTarget.name?.charAt(4)),c=[...t||[""]].slice(0,6-d),h=[...l.slice(0,d),...c,...l.slice(d+c.length)];s(h);let m=Math.min(Math.max(d+c.length,0),5),f=document.querySelector(`input[name=pin-${m}]`);if(f?.focus(),jg(h))try{await n(h.join(""));let e=document.querySelector(`input[name=pin-${m}]`);e?.blur()}catch(e){p(1),u(e.message)}else try{await n(null)}catch(e){p(1),u(e.message)}},f=e=>{1===h&&(u(null),p(null));let t=[...l.slice(0,e),"",...l.slice(e+1)];if(s(t),e>0){let t=document.querySelector(`input[name=pin-${e-1}]`);t?.focus()}jg(t)?n(t.join("")):n(null)},g=o?"success":!(!i&&!c)?"fail":"";return t(r,{children:e(qg,{children:[t("div",{children:l.map(((e,r)=>t("input",{name:`pin-${r}`,type:"text",value:l[r],onChange:m,onKeyUp:e=>{"Backspace"===e.key&&f(r)},inputMode:"numeric",autoFocus:0===r,pattern:"[0-9]",className:g,autoComplete:b?"one-time-code":"off",disabled:a},r)))}),t("div",{children:t(Kg,{$fail:!!i||!!c,children:i||c})})]})})};let qg=kr.div`
2242
+ `;var Hg,zg;let jg=Array(6).fill("");function Vg(e){return/^[0-9]{1}$/.test(e)}function qg(e){return 6===e.length&&e.every(Vg)}(zg=Hg||(Hg={}))[zg.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",zg[zg.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT";const Kg=({onChange:n,disabled:a,errorReasonOverride:i,success:o})=>{let[l,s]=d(jg),[c,u]=d(null),[h,p]=d(null),m=async e=>{e.preventDefault();let t=e.currentTarget.value.replace(/\s+/g,"");if(""===t)return;let r=l.reduce(((e,t)=>e+Number(Vg(t))),0),a=t.split(""),i=!a.every(Vg),o=a.length+r>6;if(i)return u("Passcode can only be numbers"),void p(1);if(o)return u("Passcode must be exactly 6 numbers"),void p(1);u(null),p(null);let d=Number(e.currentTarget.name?.charAt(4)),c=[...t||[""]].slice(0,6-d),h=[...l.slice(0,d),...c,...l.slice(d+c.length)];s(h);let m=Math.min(Math.max(d+c.length,0),5),f=document.querySelector(`input[name=pin-${m}]`);if(f?.focus(),qg(h))try{await n(h.join(""));let e=document.querySelector(`input[name=pin-${m}]`);e?.blur()}catch(e){p(1),u(e.message)}else try{await n(null)}catch(e){p(1),u(e.message)}},f=e=>{1===h&&(u(null),p(null));let t=[...l.slice(0,e),"",...l.slice(e+1)];if(s(t),e>0){let t=document.querySelector(`input[name=pin-${e-1}]`);t?.focus()}qg(t)?n(t.join("")):n(null)},g=o?"success":!(!i&&!c)?"fail":"";return t(r,{children:e(Zg,{children:[t("div",{children:l.map(((e,r)=>t("input",{name:`pin-${r}`,type:"text",value:l[r],onChange:m,onKeyUp:e=>{"Backspace"===e.key&&f(r)},inputMode:"numeric",autoFocus:0===r,pattern:"[0-9]",className:g,autoComplete:b?"one-time-code":"off",disabled:a},r)))}),t("div",{children:t(Yg,{$fail:!!i||!!c,children:i||c})})]})})};let Zg=kr.div`
2237
2243
  display: flex;
2238
2244
  flex-direction: column;
2239
2245
  width: 100%;
@@ -2301,7 +2307,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2301
2307
  transform: translate(1px, 0px);
2302
2308
  }
2303
2309
  }
2304
- `,Kg=kr.div`
2310
+ `,Yg=kr.div`
2305
2311
  line-height: 20px;
2306
2312
  font-size: 13px;
2307
2313
  display: flex;
@@ -2309,7 +2315,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2309
2315
  width: 100%;
2310
2316
 
2311
2317
  color: ${e=>e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
2312
- `;const Zg=({onComplete:n,onReset:a,onClose:i})=>{let[o,l]=d(""),[s,c]=d(!1),[u,h]=d(null),[p,m]=d("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:g}=Ag(),{app:y,data:w}=$r();function v(){w?.mfaEnrollmentFlow?.onSuccess(),n()}return u?t(zh,{error:u,backFn:()=>h(null),onClick:()=>h(null)}):e(r,"enroll"===p?{children:[t(yd,{backFn:a,onClose:i},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Zr,{})}),t(Xd,{children:"Set up SMS verification"}),t(Qd,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),e(Jd,{children:[t(ag,{onSubmit:async function({qualifiedPhoneNumber:e}){try{await f({phoneNumber:e}),l(e),m("verify")}catch(e){h(e)}},hideRecent:!0}),e(cc,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),t(Mt,{})]}:s?{children:[t(yd,{onClose:v},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Qr,{})}),t(Xd,{children:"SMS verification added"}),t(Qd,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),t(nc,{children:t(rd,{onClick:v,children:"Done"})}),t(Mt,{})]}:{children:[t(yd,{backFn:function(){"verify"===p?m("enroll"):a()},onClose:i},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Zr,{})}),t(Xd,{children:"Enter enrollment code"}),e(Jd,{children:[t(Vg,{onChange:async function(e){try{if(!e)return;await g({phoneNumber:o,mfaCode:e}),c(!0)}catch(e){if(Lu(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Ru(e))throw Error("The code you entered is not valid");if(Ou(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw Du(e)?Error("Verification canceled"):Error("Unknown error")}}}),e(Qd,{children:["To continue, enter the 6-digit code sent to ",t("strong",{children:Qo(o)})]})]}),t(Mt,{})]})},Yg=({size:e,authUrl:r})=>t(op,{url:r,squareLogoElement:Xn,size:e,fgColor:"#1F1F1F"}),Xg=({onComplete:n,onClose:a,onReset:i,totpInfo:o})=>{let[l,s]=d("enroll"),[c,u]=d(!1),{submitEnrollmentWithTotp:h}=Ag(),{data:p}=$r();function m(){p?.mfaEnrollmentFlow?.onSuccess(),n()}return e(r,"enroll"===l?{children:[t(yd,{backFn:i,onClose:a},"header"),t(Xd,{children:"Scan QR code"}),t(Qd,{children:"Open your authenticator app and scan the QR code to continue."}),t($c,{children:t(Yg,{authUrl:o.authUrl,size:200})}),e(nc,{children:[t(Cc,{children:t(Kh,{itemName:"secret",text:o.secret})}),t(rd,{onClick:function(){s("verify")},children:"Continue"})]}),t(Mt,{})]}:c?{children:[t(yd,{onClose:m},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Qr,{})}),t(Xd,{children:"Authenticator app verification added"}),t(Qd,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),t(nc,{children:t(rd,{onClick:m,children:"Done"})}),t(Mt,{})]}:{children:[t(yd,{backFn:function(){"verify"===l?s("enroll"):i()},onClose:a},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(qn,{})}),t(Xd,{children:"Enter enrollment code"}),t(Jd,{children:t(Vg,{onChange:async function(e){try{if(!e)return;await h({mfaCode:e}),u(!0)}catch(e){if(Lu(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Ru(e))throw Error("The code you entered is not valid");if(Ou(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw Du(e)?Error("Verification canceled"):Error("Unknown error")}}})}),e(Qd,{children:["To continue, enter the 6-digit code generated from your ",t("strong",{children:"authenticator app"})]}),t(Mt,{})]})},Qg=({label:r,children:n,valueStyles:a})=>e(Jg,{children:[t("div",{children:r}),t(ey,{style:{...a},children:n})]});let Jg=kr.div`
2318
+ `;const Xg=({onComplete:n,onReset:a,onClose:i})=>{let[o,l]=d(""),[s,c]=d(!1),[u,h]=d(null),[p,m]=d("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:g}=Sg(),{app:y,data:w}=$r();function v(){w?.mfaEnrollmentFlow?.onSuccess(),n()}return u?t(zh,{error:u,backFn:()=>h(null),onClick:()=>h(null)}):e(r,"enroll"===p?{children:[t(yd,{backFn:a,onClose:i},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Zr,{})}),t(Xd,{children:"Set up SMS verification"}),t(Qd,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),e(Jd,{children:[t(og,{onSubmit:async function({qualifiedPhoneNumber:e}){try{await f({phoneNumber:e}),l(e),m("verify")}catch(e){h(e)}},hideRecent:!0}),e(cc,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),t(Mt,{})]}:s?{children:[t(yd,{onClose:v},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Qr,{})}),t(Xd,{children:"SMS verification added"}),t(Qd,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),t(nc,{children:t(rd,{onClick:v,children:"Done"})}),t(Mt,{})]}:{children:[t(yd,{backFn:function(){"verify"===p?m("enroll"):a()},onClose:i},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Zr,{})}),t(Xd,{children:"Enter enrollment code"}),e(Jd,{children:[t(Kg,{onChange:async function(e){try{if(!e)return;await g({phoneNumber:o,mfaCode:e}),c(!0)}catch(e){if(Lu(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Ru(e))throw Error("The code you entered is not valid");if(Ou(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw Du(e)?Error("Verification canceled"):Error("Unknown error")}}}),e(Qd,{children:["To continue, enter the 6-digit code sent to ",t("strong",{children:Qo(o)})]})]}),t(Mt,{})]})},Qg=({size:e,authUrl:r})=>t(op,{url:r,squareLogoElement:Xn,size:e,fgColor:"#1F1F1F"}),Jg=({onComplete:n,onClose:a,onReset:i,totpInfo:o})=>{let[l,s]=d("enroll"),[c,u]=d(!1),{submitEnrollmentWithTotp:h}=Sg(),{data:p}=$r();function m(){p?.mfaEnrollmentFlow?.onSuccess(),n()}return e(r,"enroll"===l?{children:[t(yd,{backFn:i,onClose:a},"header"),t(Xd,{children:"Scan QR code"}),t(Qd,{children:"Open your authenticator app and scan the QR code to continue."}),t($c,{children:t(Qg,{authUrl:o.authUrl,size:200})}),e(nc,{children:[t(Cc,{children:t(Kh,{itemName:"secret",text:o.secret})}),t(rd,{onClick:function(){s("verify")},children:"Continue"})]}),t(Mt,{})]}:c?{children:[t(yd,{onClose:m},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Qr,{})}),t(Xd,{children:"Authenticator app verification added"}),t(Qd,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),t(nc,{children:t(rd,{onClick:m,children:"Done"})}),t(Mt,{})]}:{children:[t(yd,{backFn:function(){"verify"===l?s("enroll"):i()},onClose:a},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(qn,{})}),t(Xd,{children:"Enter enrollment code"}),t(Jd,{children:t(Kg,{onChange:async function(e){try{if(!e)return;await h({mfaCode:e}),u(!0)}catch(e){if(Lu(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(Ru(e))throw Error("The code you entered is not valid");if(Ou(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw Du(e)?Error("Verification canceled"):Error("Unknown error")}}})}),e(Qd,{children:["To continue, enter the 6-digit code generated from your ",t("strong",{children:"authenticator app"})]}),t(Mt,{})]})},ey=({label:r,children:n,valueStyles:a})=>e(ty,{children:[t("div",{children:r}),t(ry,{style:{...a},children:n})]});let ty=kr.div`
2313
2319
  display: flex;
2314
2320
  align-items: center;
2315
2321
  justify-content: space-between;
@@ -2324,7 +2330,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2324
2330
  color: var(--privy-color-foreground-2);
2325
2331
  text-align: right;
2326
2332
  }
2327
- `,ey=kr.div`
2333
+ `,ry=kr.div`
2328
2334
  font-size: 14px;
2329
2335
  line-height: 100%;
2330
2336
  display: flex;
@@ -2333,28 +2339,28 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2333
2339
  border-radius: var(--privy-border-radius-full);
2334
2340
  background-color: var(--privy-color-background-2);
2335
2341
  padding: 4px 8px;
2336
- `;const ty=({weiQuantities:e,tokenPrice:r,tokenSymbol:n})=>{let a=Zt(e),i=r?Yt(a,r):void 0,o=Vt(a,n);return t(ay,{children:i||o})},ry=({weiQuantities:n,tokenPrice:a,tokenSymbol:i})=>{let o=Zt(n),l=a?Yt(o,a):void 0,s=Vt(o,i);return t(ay,{children:l?e(r,{children:[t(iy,{children:"USD"}),"<$0.01"===l?e(ly,{children:[t(oy,{children:"<"}),"$0.01"]}):l]}):s})},ny=({quantities:n,tokenPrice:a})=>{let i=n.reduce(((e,t)=>e+t),0n),o=a?Rp(i,a):void 0,l=Op(i);return t(ay,{children:o?t(r,{children:"<$0.01"===o?e(ly,{children:[t(oy,{children:"<"}),"$0.01"]}):o}):l})};let ay=kr.span`
2342
+ `;const ny=({weiQuantities:e,tokenPrice:r,tokenSymbol:n})=>{let a=Zt(e),i=r?Yt(a,r):void 0,o=Vt(a,n);return t(oy,{children:i||o})},ay=({weiQuantities:n,tokenPrice:a,tokenSymbol:i})=>{let o=Zt(n),l=a?Yt(o,a):void 0,s=Vt(o,i);return t(oy,{children:l?e(r,{children:[t(ly,{children:"USD"}),"<$0.01"===l?e(dy,{children:[t(sy,{children:"<"}),"$0.01"]}):l]}):s})},iy=({quantities:n,tokenPrice:a})=>{let i=n.reduce(((e,t)=>e+t),0n),o=a?Rp(i,a):void 0,l=Op(i);return t(oy,{children:o?t(r,{children:"<$0.01"===o?e(dy,{children:[t(sy,{children:"<"}),"$0.01"]}):o}):l})};let oy=kr.span`
2337
2343
  font-size: 14px;
2338
2344
  line-height: 140%;
2339
2345
  display: flex;
2340
2346
  gap: 4px;
2341
2347
  align-items: center;
2342
- `,iy=kr.span`
2348
+ `,ly=kr.span`
2343
2349
  font-size: 12px;
2344
2350
  line-height: 12px;
2345
2351
  color: var(--privy-color-foreground-3);
2346
- `,oy=kr.span`
2352
+ `,sy=kr.span`
2347
2353
  font-size: 10px;
2348
- `,ly=kr.span`
2354
+ `,dy=kr.span`
2349
2355
  display: flex;
2350
2356
  align-items: center;
2351
- `;const sy=({gas:r,tokenPrice:n,tokenSymbol:a})=>e(Tc,{style:{paddingBottom:"12px"},children:[e(cy,{children:[t(hy,{children:"Est. Fees"}),t("div",{children:t(ry,{weiQuantities:[r],tokenPrice:n,tokenSymbol:a})})]}),n&&t(uy,{children:`${Vt(r,a)}`})]}),dy=({transactionData:r,gas:n,tokenPrice:a,tokenSymbol:i})=>{let o=kt(r.value||0).add(kt(n)).toHexString();return e(Tc,{children:[e(cy,{children:[t(hy,{children:"Total (including fees)"}),t("div",{children:t(ry,{weiQuantities:[r.value||0,n],tokenPrice:a,tokenSymbol:i})})]}),a&&t(uy,{children:Vt(o,i)})]})};let cy=kr.div`
2357
+ `;const cy=({gas:r,tokenPrice:n,tokenSymbol:a})=>e(Tc,{style:{paddingBottom:"12px"},children:[e(hy,{children:[t(my,{children:"Est. Fees"}),t("div",{children:t(ay,{weiQuantities:[r],tokenPrice:n,tokenSymbol:a})})]}),n&&t(py,{children:`${Vt(r,a)}`})]}),uy=({transactionData:r,gas:n,tokenPrice:a,tokenSymbol:i})=>{let o=kt(r.value||0).add(kt(n)).toHexString();return e(Tc,{children:[e(hy,{children:[t(my,{children:"Total (including fees)"}),t("div",{children:t(ay,{weiQuantities:[r.value||0,n],tokenPrice:a,tokenSymbol:i})})]}),a&&t(py,{children:Vt(o,i)})]})};let hy=kr.div`
2352
2358
  display: flex;
2353
2359
  flex-direction: row;
2354
2360
  justify-content: space-between;
2355
2361
  align-items: center;
2356
2362
  padding-top: 4px;
2357
- `,uy=kr.div`
2363
+ `,py=kr.div`
2358
2364
  display: flex;
2359
2365
  flex-direction: row;
2360
2366
  height: 12px;
@@ -2363,23 +2369,23 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2363
2369
  line-height: 12px;
2364
2370
  color: var(--privy-color-foreground-3);
2365
2371
  font-weight: 400;
2366
- `,hy=kr.div`
2372
+ `,my=kr.div`
2367
2373
  font-size: 14px;
2368
2374
  line-height: 22.4px;
2369
2375
  font-weight: 400;
2370
- `;const py=h(void 0),my=h(void 0),fy=({defaultValue:e,children:r})=>{let[n,a]=d(e||null);return t(py.Provider,{value:{activePanel:n,togglePanel:e=>{a(n===e?null:e)}},children:t(Cy,{children:r})})},gy=({value:e,children:r})=>{let{activePanel:n,togglePanel:a}=u(py),i=n===e;return t(my.Provider,{value:{onToggle:()=>a(e),value:e},children:t(Ty,{isActive:i,"data-open":i,children:r})})},yy=({children:n})=>{let{activePanel:a}=u(py),{onToggle:i,value:o}=u(my),l=a===o;return e(r,{children:[e(by,{onClick:i,"data-open":l,children:[t(Ey,{children:n}),t(Ay,{isactive:l,children:t(On,{height:"16px",width:"16px",strokeWidth:"2"})})]}),t($y,{})]})},wy=({children:e})=>{let{activePanel:r}=u(py),{value:n}=u(my);return t(xy,{"data-open":r===n,children:t(_y,{children:e})})},vy=({children:e})=>{let{activePanel:r}=u(py),{value:n}=u(my);return t(_y,{children:"function"==typeof e?e({isActive:r===n}):e})};let Cy=kr.div`
2376
+ `;const fy=h(void 0),gy=h(void 0),yy=({defaultValue:e,children:r})=>{let[n,a]=d(e||null);return t(fy.Provider,{value:{activePanel:n,togglePanel:e=>{a(n===e?null:e)}},children:t($y,{children:r})})},wy=({value:e,children:r})=>{let{activePanel:n,togglePanel:a}=u(fy),i=n===e;return t(gy.Provider,{value:{onToggle:()=>a(e),value:e},children:t(_y,{isActive:i,"data-open":i,children:r})})},vy=({children:n})=>{let{activePanel:a}=u(fy),{onToggle:i,value:o}=u(gy),l=a===o;return e(r,{children:[e(Ey,{onClick:i,"data-open":l,children:[t(xy,{children:n}),t(Sy,{isactive:l,children:t(On,{height:"16px",width:"16px",strokeWidth:"2"})})]}),t(Ty,{})]})},Cy=({children:e})=>{let{activePanel:r}=u(fy),{value:n}=u(gy);return t(Ay,{"data-open":r===n,children:t(ky,{children:e})})},by=({children:e})=>{let{activePanel:r}=u(fy),{value:n}=u(gy);return t(ky,{children:"function"==typeof e?e({isActive:r===n}):e})};let $y=kr.div`
2371
2377
  display: flex;
2372
2378
  flex-direction: column;
2373
2379
  width: 100%;
2374
2380
  gap: 8px;
2375
- `,by=kr.div`
2381
+ `,Ey=kr.div`
2376
2382
  display: flex;
2377
2383
  justify-content: space-between;
2378
2384
  align-items: center;
2379
2385
  width: 100%;
2380
2386
  cursor: pointer;
2381
2387
  padding-bottom: 8px;
2382
- `,$y=kr.div`
2388
+ `,Ty=kr.div`
2383
2389
  width: 100%;
2384
2390
 
2385
2391
  && {
@@ -2387,13 +2393,13 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2387
2393
  border-color: var(--privy-color-foreground-4);
2388
2394
  }
2389
2395
  padding-bottom: 12px;
2390
- `,Ey=kr.div`
2396
+ `,xy=kr.div`
2391
2397
  font-size: 14px;
2392
2398
  font-weight: 500;
2393
2399
  line-height: 19.6px;
2394
2400
  width: 100%;
2395
2401
  padding-right: 8px;
2396
- `,Ty=kr.div`
2402
+ `,_y=kr.div`
2397
2403
  display: flex;
2398
2404
  flex-direction: column;
2399
2405
  width: 100%;
@@ -2405,7 +2411,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2405
2411
  border-color: var(--privy-color-foreground-4);
2406
2412
  border-radius: var(--privy-border-radius-md);
2407
2413
  }
2408
- `,xy=kr.div`
2414
+ `,Ay=kr.div`
2409
2415
  position: relative;
2410
2416
  overflow: hidden;
2411
2417
  transition: max-height 25ms ease-out;
@@ -2417,29 +2423,29 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2417
2423
  &[data-open='false'] {
2418
2424
  max-height: 0;
2419
2425
  }
2420
- `,_y=kr.div`
2426
+ `,ky=kr.div`
2421
2427
  display: flex;
2422
2428
  flex-direction: column;
2423
2429
  gap: 12px;
2424
2430
  flex: 1 1 auto;
2425
2431
  min-height: 1px;
2426
- `,Ay=kr.div`
2432
+ `,Sy=kr.div`
2427
2433
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2428
- `;const ky=({walletAddress:e,chainId:r=Xe,network:n,rpcEndpoint:a})=>t(Sy,{href:"ethereum"===n?er(r,e):Np(e,Sp(a||"")),target:"_blank",children:He(e)});let Sy=kr.a`
2434
+ `;const Ny=({walletAddress:e,chainId:r=Xe,network:n,rpcEndpoint:a})=>t(Iy,{href:"ethereum"===n?er(r,e):Np(e,Sp(a||"")),target:"_blank",children:He(e)});let Iy=kr.a`
2429
2435
  &:hover {
2430
2436
  text-decoration: underline;
2431
2437
  }
2432
- `;const Ny=({from:r,to:n,txn:a,transactionInfo:i,tokenPrice:o,gas:l,tokenSymbol:s})=>{let d=a?.value||0;return t(fy,{...We().render.standalone?{defaultValue:"details"}:{},children:e(gy,{value:"details",children:[t(yy,{children:e(Iy,{children:[t("div",{children:i?.title||i?.actionDescription||"Details"}),t(Py,{children:t(ty,{weiQuantities:[d],tokenPrice:o,tokenSymbol:s})})]})}),e(wy,{children:[t(Qg,{label:"From",children:t(ky,{walletAddress:r,chainId:a.chainId||Xe,network:"ethereum"})}),t(Qg,{label:"To",children:t(ky,{walletAddress:n,chainId:a.chainId||Xe,network:"ethereum"})}),i&&i.action&&t(Qg,{label:"Action",children:i.action}),l&&t(sy,{transactionData:a,gas:l,tokenPrice:o,tokenSymbol:s})]}),t(vy,{children:({isActive:e})=>t(dy,{transactionData:a,displayFee:e,gas:l||"0x0",tokenPrice:o,tokenSymbol:s})})]})})};let Iy=kr.div`
2438
+ `;const Py=({from:r,to:n,txn:a,transactionInfo:i,tokenPrice:o,gas:l,tokenSymbol:s})=>{let d=a?.value||0;return t(yy,{...We().render.standalone?{defaultValue:"details"}:{},children:e(wy,{value:"details",children:[t(vy,{children:e(Oy,{children:[t("div",{children:i?.title||i?.actionDescription||"Details"}),t(Ry,{children:t(ny,{weiQuantities:[d],tokenPrice:o,tokenSymbol:s})})]})}),e(Cy,{children:[t(ey,{label:"From",children:t(Ny,{walletAddress:r,chainId:a.chainId||Xe,network:"ethereum"})}),t(ey,{label:"To",children:t(Ny,{walletAddress:n,chainId:a.chainId||Xe,network:"ethereum"})}),i&&i.action&&t(ey,{label:"Action",children:i.action}),l&&t(cy,{transactionData:a,gas:l,tokenPrice:o,tokenSymbol:s})]}),t(by,{children:({isActive:e})=>t(uy,{transactionData:a,displayFee:e,gas:l||"0x0",tokenPrice:o,tokenSymbol:s})})]})})};let Oy=kr.div`
2433
2439
  display: flex;
2434
2440
  flex-direction: row;
2435
2441
  justify-content: space-between;
2436
- `,Py=kr.div`
2442
+ `,Ry=kr.div`
2437
2443
  flex-shrink: 0;
2438
2444
  padding-left: 8px;
2439
- `;const Oy=({pendingTransaction:e})=>{let{getAccessToken:r}=F(),{wallets:n}=st(),{walletProxy:a,rpcConfig:i,chains:o,appId:l,nativeTokenSymbolForChainId:s}=D(),[u,h]=d(null),[m,f]=d(e),{tokenPrice:g}=bp(m.chainId),y=s(e.chainId)||"ETH",w=c((()=>n.find((e=>"privy"===e.walletClientType))),[n]);return p((()=>{(async function(){if(!await r()||!a||!w)return m;let e=ye(m.chainId,o,i,{appId:l}),t=await La(w.address,m,e),{totalGasEstimate:n}=await Ra(t,e);return h(n.toHexString()),t})().then(f).catch(console.error)}),[a]),w?t(Ry,{children:t(Ny,{from:w.address,to:m.to,txn:m,gas:u??void 0,tokenPrice:g,tokenSymbol:y})}):null};let Ry=kr.div`
2445
+ `;const My=({pendingTransaction:e})=>{let{getAccessToken:r}=F(),{wallets:n}=st(),{walletProxy:a,rpcConfig:i,chains:o,appId:l,nativeTokenSymbolForChainId:s}=D(),[u,h]=d(null),[m,f]=d(e),{tokenPrice:g}=bp(m.chainId),y=s(e.chainId)||"ETH",w=c((()=>n.find((e=>"privy"===e.walletClientType))),[n]);return p((()=>{(async function(){if(!await r()||!a||!w)return m;let e=ye(m.chainId,o,i,{appId:l}),t=await La(w.address,m,e),{totalGasEstimate:n}=await Ra(t,e);return h(n.toHexString()),t})().then(f).catch(console.error)}),[a]),w?t(Ly,{children:t(Py,{from:w.address,to:m.to,txn:m,gas:u??void 0,tokenPrice:g,tokenSymbol:y})}):null};let Ly=kr.div`
2440
2446
  width: 100%;
2441
2447
  padding: 1rem 0;
2442
- `;const My=({hasBlockingError:n,error:a,onClose:i,onBack:o,handleSubmit:l,account:s,submitSuccess:d})=>{let{pendingTransaction:c}=D();return e(r,{children:[t(yd,{onClose:i},"header"),t(Td,{children:e("div",{children:[t(Rt,{success:d,fail:!!a}),t(a?Br:sm,{style:{width:"38px",height:"38px"}})]})}),t(Xd,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),e(ec,{children:[e(rc,{children:[t(tc,{children:t(jn,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),e(rc,{children:[t(tc,{children:t(na,{})}),"You last added a passkey on"," ",s?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),c&&t(Jd,{children:t(Oy,{pendingTransaction:c})}),a&&e(r,{children:[t(pc,{style:{marginTop:"1.25rem"},children:a.message}),t(rd,{disabled:n,onClick:l,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&t(uc,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),t(Mt,{})]})},Ly=({open:n,onClose:a})=>{let{user:i}=F(),[o,l]=d(i?.mfaMethods[0]??null),{init:c,cancel:u,submit:h}=_g(),[m,f]=d(!1),[g,y]=d(!1),[w,v]=d(null),[C,b]=d(null);p((()=>{l(i?.mfaMethods[0]??null)}),[i?.mfaMethods]);let $=s(!1);p((()=>{!$.current&&o&&n&&($.current=!0,x(o).finally((()=>{$.current=!1})))}),[n]);let E=e=>Mu(e)?(f(!0),Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Ru(e)?(f(!1),Error("The code you entered is not valid")):Ou(e)?(f(!0),Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(e),f(!1),Error("Something went wrong."));async function T(e){b(null);try{if(!e||!o)return;await h(o,e),y(!0),f(!1),a()}catch(e){throw E(e)}}async function x(e){if("passkey"!==e)try{l(e),await c(e)}catch(e){console.error(e)}else try{l(e);let t=await c(e);if(!t)throw Error("something went wrong");v(t),await h(e,t),y(!0),f(!1),a()}catch(e){b(E(e))}}let _=()=>{l(null),b(null),u(),a()};return n&&i?"passkey"===o?t(My,{account:i.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],selectedMethod:o,submitSuccess:g,hasBlockingError:m,error:C,onClose:_,onBack:()=>{l(null),b(null)},handleSubmit:()=>T(w).catch(b)}):o?t(Dy,{submitSuccess:g,hasBlockingError:m,handleSubmitCode:T,selectedMethod:o,onClose:_,onBack:i.mfaMethods.length>1?()=>l(null):void 0}):e(r,{children:[t(yd,{onClose:_},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(jn,{})}),t(Xd,{children:"Verify your identity"}),t(Qd,{children:"Choose a verification method"}),e(ac,{children:[i.mfaMethods.includes("totp")&&e(Id,{onClick:()=>x("totp"),children:[t(qn,{}),"Authenticator App"]},"totp"),i.mfaMethods.includes("sms")&&e(Id,{onClick:()=>x("sms"),children:[t(Zr,{}),"SMS"]},"sms"),i.mfaMethods.includes("passkey")&&e(Id,{onClick:()=>x("passkey"),children:[t(Kn,{}),"Passkey"]},"passkey")]}),t(Mt,{})]}):null};let Dy=({selectedMethod:n,submitSuccess:a,hasBlockingError:i,onClose:o,onBack:l,handleSubmitCode:s})=>{let{app:d}=$r(),{pendingTransaction:c}=D();switch(n){case"sms":return e(r,{children:[t(yd,{onClose:o},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Zr,{})}),t(Xd,{children:"Enter verification code"}),e(Jd,{children:[t(Vg,{success:a,disabled:i,onChange:s}),e(Qd,{children:["To continue, please enter the 6-digit code sent to your ",t("strong",{children:"mobile device"})]}),c&&t(Oy,{pendingTransaction:c})]}),l&&t(uc,{theme:d?.appearance.palette.colorScheme,onClick:l,children:"Choose another method"}),t(ld,{onClick:o,children:"Not now"}),t(Mt,{})]});case"totp":return e(r,{children:[t(yd,{onClose:o},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(qn,{})}),t(Xd,{children:"Enter verification code"}),e(Jd,{children:[t(Vg,{success:a,disabled:i,onChange:s}),e(Qd,{children:["To continue, please enter the 6-digit code generated from your"," ",t("strong",{children:"authenticator app"})]}),c&&t(Oy,{pendingTransaction:c})]}),l&&t(uc,{theme:d?.appearance.palette.colorScheme,onClick:l,children:"Choose another method"}),t(ld,{onClick:o,children:"Not now"}),t(Mt,{})]});default:return null}};let Fy=kr.div`
2448
+ `;const Dy=({hasBlockingError:n,error:a,onClose:i,onBack:o,handleSubmit:l,account:s,submitSuccess:d})=>{let{pendingTransaction:c}=D();return e(r,{children:[t(yd,{onClose:i},"header"),t(Td,{children:e("div",{children:[t(Rt,{success:d,fail:!!a}),t(a?Br:sm,{style:{width:"38px",height:"38px"}})]})}),t(Xd,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),e(ec,{children:[e(rc,{children:[t(tc,{children:t(jn,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),e(rc,{children:[t(tc,{children:t(na,{})}),"You last added a passkey on"," ",s?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),c&&t(Jd,{children:t(My,{pendingTransaction:c})}),a&&e(r,{children:[t(pc,{style:{marginTop:"1.25rem"},children:a.message}),t(rd,{disabled:n,onClick:l,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&t(uc,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),t(Mt,{})]})},Fy=({open:n,onClose:a})=>{let{user:i}=F(),[o,l]=d(i?.mfaMethods[0]??null),{init:c,cancel:u,submit:h}=kg(),[m,f]=d(!1),[g,y]=d(!1),[w,v]=d(null),[C,b]=d(null);p((()=>{l(i?.mfaMethods[0]??null)}),[i?.mfaMethods]);let $=s(!1);p((()=>{!$.current&&o&&n&&($.current=!0,x(o).finally((()=>{$.current=!1})))}),[n]);let E=e=>Mu(e)?(f(!0),Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Ru(e)?(f(!1),Error("The code you entered is not valid")):Ou(e)?(f(!0),Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(e),f(!1),Error("Something went wrong."));async function T(e){b(null);try{if(!e||!o)return;await h(o,e),y(!0),f(!1),a()}catch(e){throw E(e)}}async function x(e){if("passkey"!==e)try{l(e),await c(e)}catch(e){console.error(e)}else try{l(e);let t=await c(e);if(!t)throw Error("something went wrong");v(t),await h(e,t),y(!0),f(!1),a()}catch(e){b(E(e))}}let _=()=>{l(null),b(null),u(),a()};return n&&i?"passkey"===o?t(Dy,{account:i.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],selectedMethod:o,submitSuccess:g,hasBlockingError:m,error:C,onClose:_,onBack:()=>{l(null),b(null)},handleSubmit:()=>T(w).catch(b)}):o?t(Uy,{submitSuccess:g,hasBlockingError:m,handleSubmitCode:T,selectedMethod:o,onClose:_,onBack:i.mfaMethods.length>1?()=>l(null):void 0}):e(r,{children:[t(yd,{onClose:_},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(jn,{})}),t(Xd,{children:"Verify your identity"}),t(Qd,{children:"Choose a verification method"}),e(ac,{children:[i.mfaMethods.includes("totp")&&e(Id,{onClick:()=>x("totp"),children:[t(qn,{}),"Authenticator App"]},"totp"),i.mfaMethods.includes("sms")&&e(Id,{onClick:()=>x("sms"),children:[t(Zr,{}),"SMS"]},"sms"),i.mfaMethods.includes("passkey")&&e(Id,{onClick:()=>x("passkey"),children:[t(Kn,{}),"Passkey"]},"passkey")]}),t(Mt,{})]}):null};let Uy=({selectedMethod:n,submitSuccess:a,hasBlockingError:i,onClose:o,onBack:l,handleSubmitCode:s})=>{let{app:d}=$r(),{pendingTransaction:c}=D();switch(n){case"sms":return e(r,{children:[t(yd,{onClose:o},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Zr,{})}),t(Xd,{children:"Enter verification code"}),e(Jd,{children:[t(Kg,{success:a,disabled:i,onChange:s}),e(Qd,{children:["To continue, please enter the 6-digit code sent to your ",t("strong",{children:"mobile device"})]}),c&&t(My,{pendingTransaction:c})]}),l&&t(uc,{theme:d?.appearance.palette.colorScheme,onClick:l,children:"Choose another method"}),t(ld,{onClick:o,children:"Not now"}),t(Mt,{})]});case"totp":return e(r,{children:[t(yd,{onClose:o},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(qn,{})}),t(Xd,{children:"Enter verification code"}),e(Jd,{children:[t(Kg,{success:a,disabled:i,onChange:s}),e(Qd,{children:["To continue, please enter the 6-digit code generated from your"," ",t("strong",{children:"authenticator app"})]}),c&&t(My,{pendingTransaction:c})]}),l&&t(uc,{theme:d?.appearance.palette.colorScheme,onClick:l,children:"Choose another method"}),t(ld,{onClick:o,children:"Not now"}),t(Mt,{})]});default:return null}};let Wy=kr.div`
2443
2449
  display: flex;
2444
2450
  flex-direction: column;
2445
2451
  align-items: center;
@@ -2447,7 +2453,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2447
2453
  margin-left: 27px;
2448
2454
  margin-right: 27px;
2449
2455
  gap: 24px;
2450
- `;let Uy=kr.div`
2456
+ `;let By=kr.div`
2451
2457
  display: flex;
2452
2458
  flex-direction: column;
2453
2459
  align-items: center;
@@ -2470,9 +2476,9 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2470
2476
  stroke: var(--privy-color-accent) !important;
2471
2477
  fill: var(--privy-color-accent) !important;
2472
2478
  }
2473
- `;let Wy=kr(Cc)`
2479
+ `;let Gy=kr(Cc)`
2474
2480
  margin: 16px auto;
2475
- `;const By=kr.div`
2481
+ `;const Hy=kr.div`
2476
2482
  display: flex;
2477
2483
  flex-direction: column;
2478
2484
  align-items: center;
@@ -2494,18 +2500,18 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2494
2500
  font-weight: 400;
2495
2501
  line-height: 20px;
2496
2502
  }
2497
- `;let Gy=kr.div`
2503
+ `;let zy=kr.div`
2498
2504
  display: flex;
2499
2505
  flex-direction: column;
2500
2506
  justify-content: space-between;
2501
- `,Hy=kr.div`
2507
+ `,jy=kr.div`
2502
2508
  line-height: 20px;
2503
2509
  height: 20px;
2504
2510
  font-size: 13px;
2505
2511
  color: var(--privy-color-error);
2506
2512
  text-align: left;
2507
2513
  margin-top: 0.5rem;
2508
- `,zy=kr(rd)`
2514
+ `,Vy=kr(rd)`
2509
2515
  ${e=>e.hideAnimations&&Sr`
2510
2516
  && {
2511
2517
  // Remove animations because the recoverWallet task on the iframe partially
@@ -2513,21 +2519,21 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2513
2519
  transition: none;
2514
2520
  }
2515
2521
  `}
2516
- `;const jy=r=>e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...r,children:[t("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),t("defs",{children:e("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[t("stop",{stopColor:"#3E82F4"}),t("stop",{offset:1,stopColor:"#93DCF7"})]})})]}),Vy=({style:r,...n})=>e("svg",{width:"16",height:"14",style:r,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[e("g",{clipPath:"url(#clip0_2115_829)",children:[t("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),t("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),t("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),t("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),t("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),t("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),t("defs",{children:t("clipPath",{id:"clip0_2115_829",children:t("rect",{width:"16",height:"14",fill:"white"})})})]}),qy=kr.div`
2522
+ `;const qy=r=>e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...r,children:[t("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),t("defs",{children:e("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[t("stop",{stopColor:"#3E82F4"}),t("stop",{offset:1,stopColor:"#93DCF7"})]})})]}),Ky=({style:r,...n})=>e("svg",{width:"16",height:"14",style:r,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[e("g",{clipPath:"url(#clip0_2115_829)",children:[t("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),t("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),t("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),t("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),t("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),t("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),t("defs",{children:t("clipPath",{id:"clip0_2115_829",children:t("rect",{width:"16",height:"14",fill:"white"})})})]}),Zy=kr.div`
2517
2523
  display: flex;
2518
2524
  flex-direction: column;
2519
2525
  gap: 12px;
2520
2526
  padding-top: 24px;
2521
2527
  padding-bottom: 24px;
2522
- `,Ky=kr.div`
2528
+ `,Yy=kr.div`
2523
2529
  padding-bottom: 24px;
2524
- `;let Zy={"google-drive":{name:"Google Drive",component:Vy},icloud:{name:"iCloud",component:jy}};let Yy=kr.div`
2530
+ `;let Xy={"google-drive":{name:"Google Drive",component:Ky},icloud:{name:"iCloud",component:qy}};let Qy=kr.div`
2525
2531
  width: 24px;
2526
2532
  height: 24px;
2527
2533
  display: flex;
2528
2534
  justify-content: center;
2529
2535
  align-items: center;
2530
- `,Xy={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},Qy=({onClose:n})=>e(Ky,{children:[t(Rc,{title:"Why do I need to secure my account?",icon:t(Dr,{width:48}),description:e(r,{children:[t("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),t("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),t(rd,{onClick:n,children:"Select backup method"})]});const Jy=kr.div`
2536
+ `,Jy={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},ew=({onClose:n})=>e(Yy,{children:[t(Rc,{title:"Why do I need to secure my account?",icon:t(Dr,{width:48}),description:e(r,{children:[t("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),t("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),t(rd,{onClick:n,children:"Select backup method"})]});const tw=kr.div`
2531
2537
  && {
2532
2538
  border-width: 4px;
2533
2539
  }
@@ -2540,9 +2546,9 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2540
2546
  border-style: solid;
2541
2547
  border-color: ${e=>e.$color??"var(--privy-color-accent)"};
2542
2548
  border-radius: 50%;
2543
- `;async function ew({tx:e,accessToken:t,walletProxy:r,entropyId:n,entropyIdVerifier:a,transactingWalletAddress:i,transactingWalletIndex:o}){let l=function(e,t){if(Lp(e)){let r=e.message.staticAccountKeys.find((e=>e.toBase58()===t));if(!r)throw Error(`Transaction does not contain public key ${t}`);return r}let r=e.compileMessage().accountKeys.find((e=>e.toBase58()===t));if(!r)throw Error(`Transaction does not contain public key ${t}`);return r}(e,i),s=Lp(e)?Buffer.from(e.message.serialize()):e.serializeMessage(),{response:d}=await r.rpc({accessToken:t,entropyId:n,entropyIdVerifier:a,chainType:"solana",hdWalletIndex:o,request:{method:"signMessage",params:{message:s.toString("base64")}}}),c=d.data.signature;e.addSignature(l,Buffer.from(c,"base64"))}async function tw({tx:e,connection:t,accessToken:r,walletProxy:n,entropyId:a,entropyIdVerifier:i,transactingWalletAddress:o,transactingWalletIndex:l,transactionOptions:s}){let d;try{await ew({tx:e,accessToken:r,walletProxy:n,entropyId:a,entropyIdVerifier:i,transactingWalletAddress:o,transactingWalletIndex:l});let c=e.serialize();d=await t.sendRawTransaction(c,s);let u=await t.confirmTransaction(d);if(u.value.err||u.value.err){let e=u.value.err||u.value.err;if("string"==typeof e)throw Error(e);throw e}return{signature:d,receipt:await t.getParsedTransaction(d,{maxSupportedTransactionVersion:0})}}catch(e){throw e.txSignature=d,e}}const rw=n=>{let{chain:i,transactionDetails:o,isTokenContractInfoLoading:l,symbol:s}=n,{action:d,functionName:c}=o;return t(zt,{children:e(Hp,{children:["transaction"!==d&&e(zp,{children:[t(jp,{children:"Action"}),t(qp,{children:c})]}),"mint"===c&&"args"in o&&o.args.filter((e=>e)).map(((r,n)=>e(zp,{children:[t(jp,{children:`Param ${n}`}),t(qp,{children:"string"==typeof r&&a(r)?t(Pt,{address:r,url:i?.blockExplorers?.default?.url,showCopyIcon:!1}):r?.toString()})]},n))),"setApprovalForAll"===c&&o.operator&&e(zp,{children:[t(jp,{children:"Operator"}),t(qp,{children:t(Pt,{address:o.operator,url:i?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),"setApprovalForAll"===c&&void 0!==o.approved&&e(zp,{children:[t(jp,{children:"Set approval to"}),t(qp,{children:o.approved?"true":"false"})]}),"transfer"===c||"transferFrom"===c||"safeTransferFrom"===c||"approve"===c?e(r,{children:["formattedAmount"in o&&o.formattedAmount&&e(zp,{children:[t(jp,{children:"Amount"}),e(qp,{$isLoading:l,children:[o.formattedAmount," ",s]})]}),"tokenId"in o&&o.tokenId&&e(zp,{children:[t(jp,{children:"Token ID"}),t(qp,{children:o.tokenId.toString()})]})]}):null,"safeBatchTransferFrom"===c&&e(r,{children:["amounts"in o&&o.amounts&&e(zp,{children:[t(jp,{children:"Amounts"}),t(qp,{children:o.amounts.join(", ")})]}),"tokenIds"in o&&o.tokenIds&&e(zp,{children:[t(jp,{children:"Token IDs"}),t(qp,{children:o.tokenIds.join(", ")})]})]}),"approve"===c&&o.spender&&e(zp,{children:[t(jp,{children:"Spender"}),t(qp,{children:t(Pt,{address:o.spender,url:i?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&o.transferFrom&&e(zp,{children:[t(jp,{children:"Transferring from"}),t(qp,{children:t(Pt,{address:o.transferFrom,url:i?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&o.transferTo&&e(zp,{children:[t(jp,{children:"Transferring to"}),t(qp,{children:t(Pt,{address:o.transferTo,url:i?.blockExplorers?.default?.url,showCopyIcon:!1})})]})]})})},nw=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,aw=({img:n,submitError:a,prepareError:i,onClose:o,action:l,title:s,subtitle:c,total:u,txValue:h,to:p,network:m,missingFunds:f,fee:g,from:y,cta:w,disabled:v,chain:C,isSubmitting:b,isPreparing:$,isTokenPriceLoading:E,isTokenContractInfoLoading:T,isSponsored:x,symbol:_,balance:A,onClick:k,transactionDetails:S,transactionIndex:N,maxIndex:I,onBack:P,chainName:O})=>{let{showTransactionDetails:R,setShowTransactionDetails:M,hasMoreDetails:L,isErc20Ish:D}=(e=>{let[t,r]=d(!1),n=!0,a=!1;return(!e||e.isErc20Ish||"transaction"===e.action)&&(n=!1),n&&(a=Object.entries(e||{}).some((([e,t])=>t&&!["action","isErc20Ish","isNFTIsh"].includes(e)))),{showTransactionDetails:t,setShowTransactionDetails:r,hasMoreDetails:n&&a,isErc20Ish:e?.isErc20Ish}})(S);return e(r,{children:[t(yd,{onClose:o,backFn:P}),n&&t(lw,{children:n}),e(qu,{style:{marginTop:n?"1.5rem":0},children:[s,t(nw,{maxIndex:I,transactionIndex:N})]}),t(Vu,{children:c}),e(Hp,{style:{marginTop:"2rem"},children:[D&&e(r,{children:["approve"===l&&e(zp,{children:[t(jp,{children:"Action"}),t(qp,{children:S?.action})]}),e(zp,{children:[t(jp,{children:"Amount"}),e(qp,{$isLoading:D&&T,children:[S?.formattedAmount," ",_]})]})]}),u&&e(zp,{children:[t(jp,{children:"Total"}),t(qp,{$isLoading:$||E,children:u})]}),S&&"spender"in S&&S?.spender?e(zp,{children:[t(jp,{children:"Spender"}),t(qp,{children:t(Pt,{address:S.spender,url:C?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,p&&e(zp,{children:[t(jp,{children:"To"}),t(qp,{children:t(Pt,{address:p,url:C?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),e(zp,{children:[t(jp,{children:"Network"}),t(qp,{children:m})]}),e(zp,{children:[t(jp,{children:"Estimated fee"}),t(qp,{$isLoading:$||E||void 0===x,children:x?"Sponsored":g})]}),L&&e(r,{children:[t(zp,{className:"cursor-pointer",onClick:()=>M(!R),children:e(Vp,{className:"flex items-center gap-x-1",children:["Details"," ",t(oa,{style:{width:"0.75rem",marginLeft:"0.25rem",transform:R?"rotate(180deg)":void 0}})]})}),R&&S&&t(rw,{action:l,chain:C,transactionDetails:S,isTokenContractInfoLoading:T,symbol:_})]})]}),t(xd,{}),a?t(qt,{style:{marginTop:"2rem"},children:a.message}):i?t(qt,{style:{marginTop:"2rem"},children:ow}):null,t(iw,{$useSmallMargins:!(!i&&!a),title:Number(h)>0?void 0:!1!==x?"Your wallet":void 0,address:y,balance:A,isLoading:$||E,errMsg:$||i||a||!f?void 0:`Add funds on ${C?.name??O} to complete transaction.`}),t(rd,{style:{marginTop:"1rem"},loading:b,disabled:v||$,onClick:k,children:w}),t(Ot,{})]})};let iw=kr(Wt)`
2549
+ `;async function rw({tx:e,accessToken:t,walletProxy:r,entropyId:n,entropyIdVerifier:a,transactingWalletAddress:i,transactingWalletIndex:o}){let l=function(e,t){if(Lp(e)){let r=e.message.staticAccountKeys.find((e=>e.toBase58()===t));if(!r)throw Error(`Transaction does not contain public key ${t}`);return r}let r=e.compileMessage().accountKeys.find((e=>e.toBase58()===t));if(!r)throw Error(`Transaction does not contain public key ${t}`);return r}(e,i),s=Lp(e)?Buffer.from(e.message.serialize()):e.serializeMessage(),{response:d}=await r.rpc({accessToken:t,entropyId:n,entropyIdVerifier:a,chainType:"solana",hdWalletIndex:o,request:{method:"signMessage",params:{message:s.toString("base64")}}}),c=d.data.signature;e.addSignature(l,Buffer.from(c,"base64"))}async function nw({tx:e,connection:t,accessToken:r,walletProxy:n,entropyId:a,entropyIdVerifier:i,transactingWalletAddress:o,transactingWalletIndex:l,transactionOptions:s}){let d;try{await rw({tx:e,accessToken:r,walletProxy:n,entropyId:a,entropyIdVerifier:i,transactingWalletAddress:o,transactingWalletIndex:l});let c=e.serialize();d=await t.sendRawTransaction(c,s);let u=await t.confirmTransaction(d);if(u.value.err||u.value.err){let e=u.value.err||u.value.err;if("string"==typeof e)throw Error(e);throw e}return{signature:d,receipt:await t.getParsedTransaction(d,{maxSupportedTransactionVersion:0})}}catch(e){throw e.txSignature=d,e}}const aw=n=>{let{chain:i,transactionDetails:o,isTokenContractInfoLoading:l,symbol:s}=n,{action:d,functionName:c}=o;return t(zt,{children:e(Hp,{children:["transaction"!==d&&e(zp,{children:[t(jp,{children:"Action"}),t(qp,{children:c})]}),"mint"===c&&"args"in o&&o.args.filter((e=>e)).map(((r,n)=>e(zp,{children:[t(jp,{children:`Param ${n}`}),t(qp,{children:"string"==typeof r&&a(r)?t(Pt,{address:r,url:i?.blockExplorers?.default?.url,showCopyIcon:!1}):r?.toString()})]},n))),"setApprovalForAll"===c&&o.operator&&e(zp,{children:[t(jp,{children:"Operator"}),t(qp,{children:t(Pt,{address:o.operator,url:i?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),"setApprovalForAll"===c&&void 0!==o.approved&&e(zp,{children:[t(jp,{children:"Set approval to"}),t(qp,{children:o.approved?"true":"false"})]}),"transfer"===c||"transferFrom"===c||"safeTransferFrom"===c||"approve"===c?e(r,{children:["formattedAmount"in o&&o.formattedAmount&&e(zp,{children:[t(jp,{children:"Amount"}),e(qp,{$isLoading:l,children:[o.formattedAmount," ",s]})]}),"tokenId"in o&&o.tokenId&&e(zp,{children:[t(jp,{children:"Token ID"}),t(qp,{children:o.tokenId.toString()})]})]}):null,"safeBatchTransferFrom"===c&&e(r,{children:["amounts"in o&&o.amounts&&e(zp,{children:[t(jp,{children:"Amounts"}),t(qp,{children:o.amounts.join(", ")})]}),"tokenIds"in o&&o.tokenIds&&e(zp,{children:[t(jp,{children:"Token IDs"}),t(qp,{children:o.tokenIds.join(", ")})]})]}),"approve"===c&&o.spender&&e(zp,{children:[t(jp,{children:"Spender"}),t(qp,{children:t(Pt,{address:o.spender,url:i?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&o.transferFrom&&e(zp,{children:[t(jp,{children:"Transferring from"}),t(qp,{children:t(Pt,{address:o.transferFrom,url:i?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===c||"safeTransferFrom"===c||"safeBatchTransferFrom"===c)&&o.transferTo&&e(zp,{children:[t(jp,{children:"Transferring to"}),t(qp,{children:t(Pt,{address:o.transferTo,url:i?.blockExplorers?.default?.url,showCopyIcon:!1})})]})]})})},iw=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,ow=({img:n,submitError:a,prepareError:i,onClose:o,action:l,title:s,subtitle:c,total:u,txValue:h,to:p,network:m,missingFunds:f,fee:g,from:y,cta:w,disabled:v,chain:C,isSubmitting:b,isPreparing:$,isTokenPriceLoading:E,isTokenContractInfoLoading:T,isSponsored:x,symbol:_,balance:A,onClick:k,transactionDetails:S,transactionIndex:N,maxIndex:I,onBack:P,chainName:O})=>{let{showTransactionDetails:R,setShowTransactionDetails:M,hasMoreDetails:L,isErc20Ish:D}=(e=>{let[t,r]=d(!1),n=!0,a=!1;return(!e||e.isErc20Ish||"transaction"===e.action)&&(n=!1),n&&(a=Object.entries(e||{}).some((([e,t])=>t&&!["action","isErc20Ish","isNFTIsh"].includes(e)))),{showTransactionDetails:t,setShowTransactionDetails:r,hasMoreDetails:n&&a,isErc20Ish:e?.isErc20Ish}})(S);return e(r,{children:[t(yd,{onClose:o,backFn:P}),n&&t(dw,{children:n}),e(qu,{style:{marginTop:n?"1.5rem":0},children:[s,t(iw,{maxIndex:I,transactionIndex:N})]}),t(Vu,{children:c}),e(Hp,{style:{marginTop:"2rem"},children:[D&&e(r,{children:["approve"===l&&e(zp,{children:[t(jp,{children:"Action"}),t(qp,{children:S?.action})]}),e(zp,{children:[t(jp,{children:"Amount"}),e(qp,{$isLoading:D&&T,children:[S?.formattedAmount," ",_]})]})]}),u&&e(zp,{children:[t(jp,{children:"Total"}),t(qp,{$isLoading:$||E,children:u})]}),S&&"spender"in S&&S?.spender?e(zp,{children:[t(jp,{children:"Spender"}),t(qp,{children:t(Pt,{address:S.spender,url:C?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,p&&e(zp,{children:[t(jp,{children:"To"}),t(qp,{children:t(Pt,{address:p,url:C?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),e(zp,{children:[t(jp,{children:"Network"}),t(qp,{children:m})]}),e(zp,{children:[t(jp,{children:"Estimated fee"}),t(qp,{$isLoading:$||E||void 0===x,children:x?"Sponsored":g})]}),L&&e(r,{children:[t(zp,{className:"cursor-pointer",onClick:()=>M(!R),children:e(Vp,{className:"flex items-center gap-x-1",children:["Details"," ",t(oa,{style:{width:"0.75rem",marginLeft:"0.25rem",transform:R?"rotate(180deg)":void 0}})]})}),R&&S&&t(aw,{action:l,chain:C,transactionDetails:S,isTokenContractInfoLoading:T,symbol:_})]})]}),t(xd,{}),a?t(qt,{style:{marginTop:"2rem"},children:a.message}):i?t(qt,{style:{marginTop:"2rem"},children:sw}):null,t(lw,{$useSmallMargins:!(!i&&!a),title:Number(h)>0?void 0:!1!==x?"Your wallet":void 0,address:y,balance:A,isLoading:$||E,errMsg:$||i||a||!f?void 0:`Add funds on ${C?.name??O} to complete transaction.`}),t(rd,{style:{marginTop:"1rem"},loading:b,disabled:v||$,onClick:k,children:w}),t(Ot,{})]})};let lw=kr(Wt)`
2544
2550
  ${e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;"}
2545
- `,ow="There was an error preparing your transaction. Your transaction request will likely fail.",lw=kr.div`
2551
+ `,sw="There was an error preparing your transaction. Your transaction request will likely fail.",dw=kr.div`
2546
2552
  display: flex;
2547
2553
  width: 100%;
2548
2554
  justify-content: center;
@@ -2552,12 +2558,12 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2552
2558
  object-fit: contain;
2553
2559
  border-radius: var(--privy-border-radius-sm);
2554
2560
  }
2555
- `,sw=new Set([sa.CALL_EXCEPTION,sa.NONCE_EXPIRED,sa.REPLACEMENT_UNDERPRICED,sa.TRANSACTION_REPLACED]);const dw=e=>{let t;return e.code&&-32e3!==e.code&&sw.has(e.code)&&(t=e.transactionHash),t},cw=e=>"SERVER_ERROR"===e.code?e.error?.message??e.reason??e.message??"unknown error":"SERVER_ERROR"===e.error?.code?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";let uw=()=>e(gw,{children:[t(ww,{}),t(yw,{})]});const hw=({transactionError:n,chainId:a,onClose:i,onRetry:o,network:l,connection:s})=>{let{chains:c}=D(),[u,h]=d(!1),{errorCode:p,transactionHash:m,errorMessage:f}=((e,t)=>{if("ethereum"===t)return{errorCode:e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",transactionHash:dw(e),errorMessage:cw(e)};let r=e.txSignature,n=e?.transactionMessage||"Something went wrong.";if(Array.isArray(e.logs)){let t=e.logs.find((e=>/Transfer: insufficient lamports/gi.test(e)));t&&(n=t)}return{transactionHash:r,errorMessage:n}})(n,l),g=(({chains:e,chainId:t,network:r,connection:n,transactionHash:a})=>"ethereum"===r?e.find((e=>e.id===t))?.blockExplorers?.default.url??"https://etherscan.io":function(e,t){return`https://explorer.solana.com/tx/${e}?cluster=${t}`}(a||"",Sp(n?.rpcEndpoint||"")))({chains:c,chainId:a,network:l,connection:s,transactionHash:m});return e(r,{children:[t(yd,{onClose:i}),e(pw,{children:[t(uw,{}),t(mw,{children:p}),t(fw,{children:"Please try again."}),e(bw,{children:[t(Cw,{children:"Error message"}),t(Ew,{$clickable:!1,children:f})]}),m&&e(bw,{children:[t(Cw,{children:"Transaction hash"}),e($w,{children:["Copy this hash to view details about the transaction on a"," ",t("u",{children:t("a",{href:g,children:"block explorer"})}),"."]}),e(Ew,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(m),h(!0)},children:[m,t(_w,{clicked:u})]})]}),t(vw,{onClick:()=>o({resetNonce:!!m}),children:"Retry transaction"})]}),t(Mt,{})]})};let pw=kr.div`
2561
+ `,cw=new Set([sa.CALL_EXCEPTION,sa.NONCE_EXPIRED,sa.REPLACEMENT_UNDERPRICED,sa.TRANSACTION_REPLACED]);const uw=e=>{let t;return e.code&&-32e3!==e.code&&cw.has(e.code)&&(t=e.transactionHash),t},hw=e=>"SERVER_ERROR"===e.code?e.error?.message??e.reason??e.message??"unknown error":"SERVER_ERROR"===e.error?.code?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";let pw=()=>e(ww,{children:[t(Cw,{}),t(vw,{})]});const mw=({transactionError:n,chainId:a,onClose:i,onRetry:o,network:l,connection:s})=>{let{chains:c}=D(),[u,h]=d(!1),{errorCode:p,transactionHash:m,errorMessage:f}=((e,t)=>{if("ethereum"===t)return{errorCode:e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",transactionHash:uw(e),errorMessage:hw(e)};let r=e.txSignature,n=e?.transactionMessage||"Something went wrong.";if(Array.isArray(e.logs)){let t=e.logs.find((e=>/Transfer: insufficient lamports/gi.test(e)));t&&(n=t)}return{transactionHash:r,errorMessage:n}})(n,l),g=(({chains:e,chainId:t,network:r,connection:n,transactionHash:a})=>"ethereum"===r?e.find((e=>e.id===t))?.blockExplorers?.default.url??"https://etherscan.io":function(e,t){return`https://explorer.solana.com/tx/${e}?cluster=${t}`}(a||"",Sp(n?.rpcEndpoint||"")))({chains:c,chainId:a,network:l,connection:s,transactionHash:m});return e(r,{children:[t(yd,{onClose:i}),e(fw,{children:[t(pw,{}),t(gw,{children:p}),t(yw,{children:"Please try again."}),e(Ew,{children:[t($w,{children:"Error message"}),t(xw,{$clickable:!1,children:f})]}),m&&e(Ew,{children:[t($w,{children:"Transaction hash"}),e(Tw,{children:["Copy this hash to view details about the transaction on a"," ",t("u",{children:t("a",{href:g,children:"block explorer"})}),"."]}),e(xw,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(m),h(!0)},children:[m,t(kw,{clicked:u})]})]}),t(bw,{onClick:()=>o({resetNonce:!!m}),children:"Retry transaction"})]}),t(Mt,{})]})};let fw=kr.div`
2556
2562
  display: flex;
2557
2563
  flex-direction: column;
2558
2564
  align-items: center;
2559
2565
  justify-content: center;
2560
- `,mw=kr.span`
2566
+ `,gw=kr.span`
2561
2567
  color: var(--privy-color-foreground);
2562
2568
  text-align: center;
2563
2569
  font-size: 1.125rem;
@@ -2565,7 +2571,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2565
2571
  line-height: 1.25rem; /* 111.111% */
2566
2572
  text-align: center;
2567
2573
  margin: 10px;
2568
- `,fw=kr.span`
2574
+ `,yw=kr.span`
2569
2575
  margin-top: 4px;
2570
2576
  margin-bottom: 10px;
2571
2577
  color: var(--privy-color-foreground-3);
@@ -2576,7 +2582,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2576
2582
  font-weight: 400;
2577
2583
  line-height: 20px; /* 142.857% */
2578
2584
  letter-spacing: -0.008px;
2579
- `,gw=kr.div`
2585
+ `,ww=kr.div`
2580
2586
  position: relative;
2581
2587
  width: 60px;
2582
2588
  height: 60px;
@@ -2584,37 +2590,37 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2584
2590
  display: flex;
2585
2591
  justify-content: center;
2586
2592
  align-items: center;
2587
- `,yw=kr(Hr)`
2593
+ `,vw=kr(Hr)`
2588
2594
  position: absolute;
2589
2595
  width: 35px;
2590
2596
  height: 35px;
2591
2597
  color: var(--privy-color-error);
2592
- `,ww=kr.div`
2598
+ `,Cw=kr.div`
2593
2599
  position: absolute;
2594
2600
  width: 60px;
2595
2601
  height: 60px;
2596
2602
  border-radius: 50%;
2597
2603
  background-color: var(--privy-color-error);
2598
2604
  opacity: 0.1;
2599
- `,vw=kr(rd)`
2605
+ `,bw=kr(rd)`
2600
2606
  && {
2601
2607
  margin-top: 24px;
2602
2608
  }
2603
2609
  transition: color 350ms ease, background-color 350ms ease;
2604
- `,Cw=kr.span`
2610
+ `,$w=kr.span`
2605
2611
  width: 100%;
2606
2612
  text-align: left;
2607
2613
  font-size: 0.825rem;
2608
2614
  color: var(--privy-color-foreground);
2609
2615
  padding: 4px;
2610
- `,bw=kr.div`
2616
+ `,Ew=kr.div`
2611
2617
  width: 100%;
2612
2618
  margin: 5px;
2613
2619
  display: flex;
2614
2620
  flex-direction: column;
2615
2621
  justify-content: center;
2616
2622
  align-items: center;
2617
- `,$w=kr.text`
2623
+ `,Tw=kr.text`
2618
2624
  position: relative;
2619
2625
  width: 100%;
2620
2626
  padding: 5px;
@@ -2622,7 +2628,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2622
2628
  color: var(--privy-color-foreground-3);
2623
2629
  text-align: left;
2624
2630
  word-wrap: break-word;
2625
- `,Ew=kr.span`
2631
+ `,xw=kr.span`
2626
2632
  position: relative;
2627
2633
  width: 100%;
2628
2634
  background-color: var(--privy-color-background-2);
@@ -2634,19 +2640,19 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2634
2640
  text-align: left;
2635
2641
  word-wrap: break-word;
2636
2642
  ${e=>e.$clickable&&"cursor: pointer;\n transition: background-color 0.3s;\n padding-right: 45px;\n\n &:hover {\n background-color: var(--privy-color-foreground-4);\n }"}
2637
- `,Tw=kr(la)`
2643
+ `,_w=kr(la)`
2638
2644
  position: absolute;
2639
2645
  top: 13px;
2640
2646
  right: 13px;
2641
2647
  width: 24px;
2642
2648
  height: 24px;
2643
- `,xw=kr(dn)`
2649
+ `,Aw=kr(dn)`
2644
2650
  position: absolute;
2645
2651
  top: 13px;
2646
2652
  right: 13px;
2647
2653
  width: 24px;
2648
2654
  height: 24px;
2649
- `,_w=({clicked:e})=>t(e?xw:Tw,{});const Aw=({instructions:n,fees:a,transactionInfo:i,solPrice:o,rpcEndpoint:l})=>{let s=n.reduce(((e,{amount:t})=>e+t),0n),[c,u]=d(0),[h,m]=d(!1),f=n[c];return p((()=>{u(0)}),[n]),e(Hp,{children:[e(zp,{children:[t(jp,{children:"Total"}),t(qp,{children:t(ny,{quantities:[s,a],tokenPrice:o})})]}),i&&i.action&&e(zp,{children:[t(jp,{children:"Action"}),t(qp,{children:i.action})]}),e(zp,{children:[t(jp,{children:"Fees"}),t(qp,{children:t(ny,{quantities:[a||0n],tokenPrice:o})})]}),n.length>1?e(r,{children:[t(zp,{children:e(Rw,{onClick:()=>m((e=>!e)),children:[t("span",{children:"Details"}),t(On,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:h?"rotate(180deg)":void 0}})]})}),h&&t(zp,{children:e(Sw,{children:[e(Nw,{children:[e(Iw,{children:[c+1," of ",n.length," instructions"]}),e(Ow,{children:[c>0&&t(pd,{backFn:()=>u((e=>e-1))}),c<n.length-1&&t(md,{nextFn:()=>u((e=>e+1))})]})]}),t(Pw,{children:t(kw,{instruction:f,rpcEndpoint:l,solPrice:o})})]})})]}):t(kw,{instruction:f,rpcEndpoint:l,solPrice:o,hideAmount:!0})]})};function kw({instruction:r,rpcEndpoint:n,solPrice:a,hideAmount:i}){return r?e(Hp,{children:[!i&&e(zp,{children:[t(jp,{children:"Amount"}),t(qp,{children:t(ny,{quantities:[r.amount],tokenPrice:a})})]}),e(zp,{children:[t(jp,{children:"To"}),t(qp,{children:t(ky,{walletAddress:r.to,rpcEndpoint:n,network:"solana"})})]}),e(zp,{children:[t(jp,{children:"From"}),t(qp,{children:t(ky,{walletAddress:r.from,rpcEndpoint:n,network:"solana"})})]})]}):null}let Sw=kr.div`
2655
+ `,kw=({clicked:e})=>t(e?Aw:_w,{});const Sw=({instructions:n,fees:a,transactionInfo:i,solPrice:o,rpcEndpoint:l})=>{let s=n.reduce(((e,{amount:t})=>e+t),0n),[c,u]=d(0),[h,m]=d(!1),f=n[c];return p((()=>{u(0)}),[n]),e(Hp,{children:[e(zp,{children:[t(jp,{children:"Total"}),t(qp,{children:t(iy,{quantities:[s,a],tokenPrice:o})})]}),i&&i.action&&e(zp,{children:[t(jp,{children:"Action"}),t(qp,{children:i.action})]}),e(zp,{children:[t(jp,{children:"Fees"}),t(qp,{children:t(iy,{quantities:[a||0n],tokenPrice:o})})]}),n.length>1?e(r,{children:[t(zp,{children:e(Lw,{onClick:()=>m((e=>!e)),children:[t("span",{children:"Details"}),t(On,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:h?"rotate(180deg)":void 0}})]})}),h&&t(zp,{children:e(Iw,{children:[e(Pw,{children:[e(Ow,{children:[c+1," of ",n.length," instructions"]}),e(Mw,{children:[c>0&&t(pd,{backFn:()=>u((e=>e-1))}),c<n.length-1&&t(md,{nextFn:()=>u((e=>e+1))})]})]}),t(Rw,{children:t(Nw,{instruction:f,rpcEndpoint:l,solPrice:o})})]})})]}):t(Nw,{instruction:f,rpcEndpoint:l,solPrice:o,hideAmount:!0})]})};function Nw({instruction:r,rpcEndpoint:n,solPrice:a,hideAmount:i}){return r?e(Hp,{children:[!i&&e(zp,{children:[t(jp,{children:"Amount"}),t(qp,{children:t(iy,{quantities:[r.amount],tokenPrice:a})})]}),e(zp,{children:[t(jp,{children:"To"}),t(qp,{children:t(Ny,{walletAddress:r.to,rpcEndpoint:n,network:"solana"})})]}),e(zp,{children:[t(jp,{children:"From"}),t(qp,{children:t(Ny,{walletAddress:r.from,rpcEndpoint:n,network:"solana"})})]})]}):null}let Iw=kr.div`
2650
2656
  display: flex;
2651
2657
  flex-direction: column;
2652
2658
  width: 100%;
@@ -2657,45 +2663,45 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2657
2663
  border-color: var(--privy-color-foreground-4);
2658
2664
  border-radius: var(--privy-border-radius-md);
2659
2665
  }
2660
- `,Nw=kr.header`
2666
+ `,Pw=kr.header`
2661
2667
  display: flex;
2662
2668
  justify-content: space-between;
2663
2669
  align-items: center;
2664
2670
  padding: 12px;
2665
2671
  background-color: var(--privy-color-background-2);
2666
- `,Iw=kr.h4`
2672
+ `,Ow=kr.h4`
2667
2673
  font-size: 14px;
2668
2674
  font-weight: 500;
2669
2675
  line-height: 19.6px;
2670
- `,Pw=kr.div`
2676
+ `,Rw=kr.div`
2671
2677
  padding: 12px;
2672
- `,Ow=kr.div`
2678
+ `,Mw=kr.div`
2673
2679
  display: flex;
2674
2680
  gap: 8px;
2675
2681
  align-items: center;
2676
- `,Rw=kr(jp)`
2682
+ `,Lw=kr(jp)`
2677
2683
  cursor: pointer;
2678
2684
  display: inline-flex;
2679
2685
  gap: 8px;
2680
2686
  align-items: center;
2681
- `;const Mw=({instructions:n,fees:a,onClose:i,receiptHeader:o,receiptDescription:l,transactionInfo:s,solPrice:d,rpcEndpoint:c})=>e(r,{children:[t(yd,{onClose:i}),t(Td,{style:{marginBottom:"16px"},children:e("div",{children:[t(hd,{color:"var(--privy-color-success-light)"}),t(Qr,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-success)"})]})}),t(Rc,{title:o??"Transaction completed successfully.",description:l??""}),t(Aw,{solPrice:d,instructions:n,fees:a,transactionInfo:s,rpcEndpoint:c}),t(xd,{}),t(Lw,{loading:!1,onClick:i,children:"Close"}),t(kc,{}),t(Ot,{})]});let Lw=kr(rd)`
2687
+ `;const Dw=({instructions:n,fees:a,onClose:i,receiptHeader:o,receiptDescription:l,transactionInfo:s,solPrice:d,rpcEndpoint:c})=>e(r,{children:[t(yd,{onClose:i}),t(Td,{style:{marginBottom:"16px"},children:e("div",{children:[t(hd,{color:"var(--privy-color-success-light)"}),t(Qr,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-success)"})]})}),t(Rc,{title:o??"Transaction completed successfully.",description:l??""}),t(Sw,{solPrice:d,instructions:n,fees:a,transactionInfo:s,rpcEndpoint:c}),t(xd,{}),t(Fw,{loading:!1,onClick:i,children:"Close"}),t(kc,{}),t(Ot,{})]});let Fw=kr(rd)`
2682
2688
  && {
2683
2689
  margin-top: 24px;
2684
2690
  }
2685
2691
  transition: color 350ms ease, background-color 350ms ease;
2686
- `;async function Dw({accessToken:e,entropyId:t,entropyIdVerifier:r,transactingWallet:n,walletProxy:a,transactionRequest:i,provider:o,requesterAppId:l}){!function(e){for(let t of["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"]){let r=e[t];if(void 0!==r&&!function(e){let t="number"==typeof e,r="bigint"==typeof e,n="string"==typeof e&&/^-?0x[a-f0-9]+$/i.test(e);return t||r||n}(r))throw Error(`Transaction request property '${t}' must be a valid number, bigint, or hex string representing a quantity`)}if("number"!=typeof e.chainId)throw Error("Transaction request property 'chainId' must be a number")}(i=Object.assign({chainId:Xe},i));let s=(await a.rpc({entropyId:t,entropyIdVerifier:r,hdWalletIndex:n.walletIndex??0,chainType:"ethereum",accessToken:e,requesterAppId:l,request:{method:"eth_signTransaction",params:[i]}})).response.data;return await o.sendTransaction(s)}async function Fw(e,t,r,n){let a=await n.getBalance(e),i=t.value||0,o=!a.sub(kt(i)).sub(r).isNegative();return{balance:a,hasSufficientFunds:o}}function Uw(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}let Ww=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Jn.from(e.gasUsed),n=Jn.from(e.effectiveGasPrice),a=r.mul(n);if(t){let e=Jn.from(t);a=a.add(e)}return a.toString()}catch(e){return}};const Bw=({txn:n,receipt:a,transactionInfo:i,onClose:o,tokenPrice:l,tokenSymbol:s,l1GasEstimate:d,receiptHeader:c,receiptDescription:u})=>e(r,{children:[t(yd,{onClose:o}),t(Pc,{title:c??"Transaction complete!",description:u??"You're all set."}),t(Ny,{tokenPrice:l,from:a.from,to:a.to,gas:Ww(a,d),txn:n,transactionInfo:i,tokenSymbol:s}),t(xd,{}),t(Gw,{loading:!1,onClick:o,children:"All Done"}),t(kc,{}),t(Ot,{})]});let Gw=kr(rd)`
2692
+ `;async function Uw({accessToken:e,entropyId:t,entropyIdVerifier:r,transactingWallet:n,walletProxy:a,transactionRequest:i,provider:o,requesterAppId:l}){!function(e){for(let t of["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"]){let r=e[t];if(void 0!==r&&!function(e){let t="number"==typeof e,r="bigint"==typeof e,n="string"==typeof e&&/^-?0x[a-f0-9]+$/i.test(e);return t||r||n}(r))throw Error(`Transaction request property '${t}' must be a valid number, bigint, or hex string representing a quantity`)}if("number"!=typeof e.chainId)throw Error("Transaction request property 'chainId' must be a number")}(i=Object.assign({chainId:Xe},i));let s=(await a.rpc({entropyId:t,entropyIdVerifier:r,hdWalletIndex:n.walletIndex??0,chainType:"ethereum",accessToken:e,requesterAppId:l,request:{method:"eth_signTransaction",params:[i]}})).response.data;return await o.sendTransaction(s)}async function Ww(e,t,r,n){let a=await n.getBalance(e),i=t.value||0,o=!a.sub(kt(i)).sub(r).isNegative();return{balance:a,hasSufficientFunds:o}}function Bw(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}let Gw=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Jn.from(e.gasUsed),n=Jn.from(e.effectiveGasPrice),a=r.mul(n);if(t){let e=Jn.from(t);a=a.add(e)}return a.toString()}catch(e){return}};const Hw=({txn:n,receipt:a,transactionInfo:i,onClose:o,tokenPrice:l,tokenSymbol:s,l1GasEstimate:d,receiptHeader:c,receiptDescription:u})=>e(r,{children:[t(yd,{onClose:o}),t(Pc,{title:c??"Transaction complete!",description:u??"You're all set."}),t(Py,{tokenPrice:l,from:a.from,to:a.to,gas:Gw(a,d),txn:n,transactionInfo:i,tokenSymbol:s}),t(xd,{}),t(zw,{loading:!1,onClick:o,children:"All Done"}),t(kc,{}),t(Ot,{})]});let zw=kr(rd)`
2687
2693
  && {
2688
2694
  margin-top: 24px;
2689
2695
  }
2690
2696
  transition: color 350ms ease, background-color 350ms ease;
2691
- `;const Hw=[{constant:!1,inputs:[{name:"_salt",type:"bytes32"},{name:"_initializer",type:"bytes"}],name:"deployAccount",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],zw=[{name:"from",type:"address"},{name:"param2",type:"address"},{name:"param3",type:"bytes"},{name:"param4",type:"tuple",components:[]},{type:"tuple",components:[{name:"param5",type:"address"},{name:"param6",type:"uint256"},{name:"param7",type:"uint256"},{name:"encodedInitData",type:"bytes"}]}],jw=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Vw=[{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"payable",type:"function"}],qw=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Kw=[{constant:!1,inputs:[{name:"_operator",type:"address"},{name:"_approved",type:"bool"}],name:"setApprovalForAll",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Zw=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Yw=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenIds",type:"uint256[]"},{name:"_amounts",type:"uint256[]"},{name:"_data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Xw=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"},{name:"_amount",type:"uint256"},{name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Qw=(e,t)=>{let r=Jw(jw,e);if(r)return{action:"approve",functionName:"approve",isErc20Ish:!0,isNFTIsh:!1,spender:r.args[0],amount:r.args[1]};let n=Jw(Um,e);if(n)return{action:"transfer",functionName:"transfer",isErc20Ish:!0,isNFTIsh:!1,amount:n.args[1]};if(!t)return{action:"transaction",functionName:"",isErc20Ish:!1,isNFTIsh:!1};let a=Jw(Hw,e);if(a&&"string"==typeof a.args[1]){let e=ev(a.args[1]);if(e&&e[4].encodedInitData)return Qw(e[4].encodedInitData,t)}let i=Jw(Kw,e);if(i)return{action:"approve",functionName:"setApprovalForAll",isNFTIsh:!0,isErc20Ish:!1,operator:i.args[0],approved:i.args[1]};let o=Jw(Zw,e);if(o)return{action:"transfer",functionName:"transferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:o.args[0],transferTo:o.args[1],tokenId:o.args[2]};let l=Jw(qw,e);if(l)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:l.args[0],transferTo:l.args[1],tokenId:l.args[2]};let s=Jw(Xw,e);if(s)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:s.args[0],transferTo:s.args[1],tokenId:s.args[2],amount:s.args[3]};let d=Jw(Yw,e);if(d)return{action:"batch transfer",functionName:"safeBatchTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:d.args[0],transferTo:d.args[1],tokenIds:d.args[2],amounts:d.args[3]};let c=Jw(Vw,e);return c?{action:"mint",functionName:c.functionName,isNFTIsh:!0,isErc20Ish:!1,args:c.args}:{action:"transaction",isErc20Ish:!1,isNFTIsh:!1}};let Jw=(e,t)=>{try{let r=bn({abi:e,data:t});return{functionName:r.functionName,args:r.args||[]}}catch(e){return null}},ev=e=>{try{if("string"==typeof e)return $n(zw,`0x${e.slice(10)}`)}catch(e){return null}};const tv=(e,t,r)=>{let[n,a]=d(null),{getAccessToken:i}=F(),{walletProxy:o}=D();return p((()=>{n&&a(null),(async()=>{if(!await i()||!o||!t)return null;let n=[],a=await La(t.address,e,r).catch((t=>(n.push(t),e))),{totalGasEstimate:l,l1ExecutionFeeEstimate:s}=await Ra(a,r).catch((e=>(n.push(e),{totalGasEstimate:null,l1ExecutionFeeEstimate:null}))),{balance:d,hasSufficientFunds:c}=await Fw(t.address,a,l??Jn.from(0),r).catch((e=>(n.push(e),{balance:null,hasSufficientFunds:!1})));return{tx:a,totalGasEstimate:l,l1ExecutionFeeEstimate:s,balance:d,hasFunds:c,errors:n}})().then(a)}),[e]),n};let rv=new mr(new gr("There was an issue preparing your transaction",yr.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),nv=(e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0;const av=kr.img`
2697
+ `;const jw=[{constant:!1,inputs:[{name:"_salt",type:"bytes32"},{name:"_initializer",type:"bytes"}],name:"deployAccount",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Vw=[{name:"from",type:"address"},{name:"param2",type:"address"},{name:"param3",type:"bytes"},{name:"param4",type:"tuple",components:[]},{type:"tuple",components:[{name:"param5",type:"address"},{name:"param6",type:"uint256"},{name:"param7",type:"uint256"},{name:"encodedInitData",type:"bytes"}]}],qw=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Kw=[{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"payable",type:"function"}],Zw=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Yw=[{constant:!1,inputs:[{name:"_operator",type:"address"},{name:"_approved",type:"bool"}],name:"setApprovalForAll",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Xw=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Qw=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenIds",type:"uint256[]"},{name:"_amounts",type:"uint256[]"},{name:"_data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Jw=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"},{name:"_amount",type:"uint256"},{name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],ev=(e,t)=>{let r=tv(qw,e);if(r)return{action:"approve",functionName:"approve",isErc20Ish:!0,isNFTIsh:!1,spender:r.args[0],amount:r.args[1]};let n=tv(Bm,e);if(n)return{action:"transfer",functionName:"transfer",isErc20Ish:!0,isNFTIsh:!1,amount:n.args[1]};if(!t)return{action:"transaction",functionName:"",isErc20Ish:!1,isNFTIsh:!1};let a=tv(jw,e);if(a&&"string"==typeof a.args[1]){let e=rv(a.args[1]);if(e&&e[4].encodedInitData)return ev(e[4].encodedInitData,t)}let i=tv(Yw,e);if(i)return{action:"approve",functionName:"setApprovalForAll",isNFTIsh:!0,isErc20Ish:!1,operator:i.args[0],approved:i.args[1]};let o=tv(Xw,e);if(o)return{action:"transfer",functionName:"transferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:o.args[0],transferTo:o.args[1],tokenId:o.args[2]};let l=tv(Zw,e);if(l)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:l.args[0],transferTo:l.args[1],tokenId:l.args[2]};let s=tv(Jw,e);if(s)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:s.args[0],transferTo:s.args[1],tokenId:s.args[2],amount:s.args[3]};let d=tv(Qw,e);if(d)return{action:"batch transfer",functionName:"safeBatchTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:d.args[0],transferTo:d.args[1],tokenIds:d.args[2],amounts:d.args[3]};let c=tv(Kw,e);return c?{action:"mint",functionName:c.functionName,isNFTIsh:!0,isErc20Ish:!1,args:c.args}:{action:"transaction",isErc20Ish:!1,isNFTIsh:!1}};let tv=(e,t)=>{try{let r=bn({abi:e,data:t});return{functionName:r.functionName,args:r.args||[]}}catch(e){return null}},rv=e=>{try{if("string"==typeof e)return $n(Vw,`0x${e.slice(10)}`)}catch(e){return null}};const nv=(e,t,r)=>{let[n,a]=d(null),{getAccessToken:i}=F(),{walletProxy:o}=D();return p((()=>{n&&a(null),(async()=>{if(!await i()||!o||!t)return null;let n=[],a=await La(t.address,e,r).catch((t=>(n.push(t),e))),{totalGasEstimate:l,l1ExecutionFeeEstimate:s}=await Ra(a,r).catch((e=>(n.push(e),{totalGasEstimate:null,l1ExecutionFeeEstimate:null}))),{balance:d,hasSufficientFunds:c}=await Ww(t.address,a,l??Jn.from(0),r).catch((e=>(n.push(e),{balance:null,hasSufficientFunds:!1})));return{tx:a,totalGasEstimate:l,l1ExecutionFeeEstimate:s,balance:d,hasFunds:c,errors:n}})().then(a)}),[e]),n};let av=new mr(new gr("There was an issue preparing your transaction",yr.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),iv=(e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0;const ov=kr.img`
2692
2698
  && {
2693
2699
  height: ${e=>"sm"===e.size?"65px":"140px"};
2694
2700
  width: ${e=>"sm"===e.size?"65px":"140px"};
2695
2701
  border-radius: 16px;
2696
2702
  margin-bottom: 12px;
2697
2703
  }
2698
- `;let iv=e=>{if(!ar(e))return e;try{return da(e)}catch{return e}},ov=e=>JSON.stringify(e,null,2),lv=({data:r})=>{let n=r=>"object"==typeof r&&null!==r?t(cv,{children:Object.entries(r).map((([t,r])=>e("li",{children:[e("strong",{children:[t,":"]})," ",n(r)]},t)))}):t("span",{children:String(r)});return t("div",{children:n(r)})},sv=n=>{let{types:a,primaryType:i,...o}=n.typedData;return e(r,{children:[t(dv,{children:t(lv,{data:o})}),t(Kh,{text:ov(n.typedData),itemName:"full payload to clipboard"})," "]})};let dv=kr.div`
2704
+ `;let lv=e=>{if(!ar(e))return e;try{return da(e)}catch{return e}},sv=e=>JSON.stringify(e,null,2),dv=({data:r})=>{let n=r=>"object"==typeof r&&null!==r?t(hv,{children:Object.entries(r).map((([t,r])=>e("li",{children:[e("strong",{children:[t,":"]})," ",n(r)]},t)))}):t("span",{children:String(r)});return t("div",{children:n(r)})},cv=n=>{let{types:a,primaryType:i,...o}=n.typedData;return e(r,{children:[t(uv,{children:t(dv,{data:o})}),t(Kh,{text:sv(n.typedData),itemName:"full payload to clipboard"})," "]})};let uv=kr.div`
2699
2705
  margin-top: 1.5rem;
2700
2706
  background-color: var(--privy-color-background-2);
2701
2707
  border-radius: var(--privy-border-radius-md);
@@ -2714,7 +2720,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2714
2720
  display: none; /* Safari and Chrome */
2715
2721
  }
2716
2722
  }
2717
- `,cv=kr.ul`
2723
+ `,hv=kr.ul`
2718
2724
  margin-left: 12px !important;
2719
2725
  white-space: nowrap;
2720
2726
 
@@ -2726,7 +2732,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2726
2732
  font-weight: 500 !important;
2727
2733
  }
2728
2734
  }
2729
- `,uv=kr.div`
2735
+ `,pv=kr.div`
2730
2736
  line-height: 20px;
2731
2737
  height: 20px;
2732
2738
  font-size: 13px;
@@ -2736,20 +2742,20 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2736
2742
  width: 100%;
2737
2743
  margin-top: 16px;
2738
2744
  margin-bottom: 4px;
2739
- `,hv=kr.span`
2745
+ `,mv=kr.span`
2740
2746
  display: flex;
2741
2747
  align-items: center;
2742
2748
  gap: 8px;
2743
- `,pv=kr.div`
2749
+ `,fv=kr.div`
2744
2750
  display: flex;
2745
2751
  flex-direction: column;
2746
2752
  justify-content: center;
2747
2753
  align-items: center;
2748
2754
  width: 100%;
2749
2755
  height: 82px;
2750
- `,mv=kr.div`
2756
+ `,gv=kr.div`
2751
2757
  flex-grow: 1;
2752
- `;let fv=kr.div`
2758
+ `;let yv=kr.div`
2753
2759
  display: flex;
2754
2760
  flex-direction: column;
2755
2761
  align-items: center;
@@ -2757,7 +2763,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2757
2763
  margin-left: 27px;
2758
2764
  margin-right: 27px;
2759
2765
  gap: 24px;
2760
- `;const gv=v(((n,a)=>{let[i,o]=d(""),[l,s]=d(""),[c,u]=d(!1),{authenticated:h,user:p}=F(),{initUpdateEmail:m}=D(),{navigate:f,setModalData:g,currentScreen:y}=$r(),{enabled:w,token:v}=Jl(),C=We(),b=ft(i)&&(C.disablePlusEmails&&i.includes("+")?(l||s("Please enter a valid email address without a '+'."),!1):(l&&s(""),!0)),$=c||!b,E=()=>{!w||v||h?(async e=>{if(!p?.email)throw Error("User is required to have an email address to update it.");u(!0);try{await m(p.email.address,i,e),f(Er.AWAITING_PASSWORDLESS_CODE)}catch(e){g({errorModalData:{error:e,previousScreen:y||Er.LANDING}})}u(!1)})(v):(g({captchaModalData:{callback:e=>{if(!p?.email)throw Error("User is required to have an email address to update it.");return m(p.email.address,i,e)},userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:Er.ERROR_SCREEN}}),f(Er.CAPTCHA_SCREEN))};return e(r,{children:[e(yv,{children:[t(qt,l?{style:{marginTop:"0.25rem",textAlign:"left"},children:l}:{style:{marginTop:"0.25rem",textAlign:"left",visibility:"hidden"},children:" "}),e(wv,{$error:!!l,children:[t(Kr,{}),t("input",{ref:a,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>o(e.target.value),onKeyUp:e=>{"Enter"===e.key&&E()},value:i,autoComplete:"email"}),n.stacked?null:t(cd,{isSubmitting:c,onClick:E,disabled:$,children:"Submit"})]})]}),n.stacked?t(rd,{loadingText:null,loading:c,disabled:$,onClick:E,children:"Submit"}):null]})}));let yv=qf,wv=jf;const vv=({style:e,...r})=>t("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...r,children:t("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});let Cv=kr.div`
2766
+ `;const wv=v(((n,a)=>{let[i,o]=d(""),[l,s]=d(""),[c,u]=d(!1),{authenticated:h,user:p}=F(),{initUpdateEmail:m}=D(),{navigate:f,setModalData:g,currentScreen:y}=$r(),{enabled:w,token:v}=Jl(),C=We(),b=ft(i)&&(C.disablePlusEmails&&i.includes("+")?(l||s("Please enter a valid email address without a '+'."),!1):(l&&s(""),!0)),$=c||!b,E=()=>{!w||v||h?(async e=>{if(!p?.email)throw Error("User is required to have an email address to update it.");u(!0);try{await m(p.email.address,i,e),f(Er.AWAITING_PASSWORDLESS_CODE)}catch(e){g({errorModalData:{error:e,previousScreen:y||Er.LANDING}})}u(!1)})(v):(g({captchaModalData:{callback:e=>{if(!p?.email)throw Error("User is required to have an email address to update it.");return m(p.email.address,i,e)},userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:Er.ERROR_SCREEN}}),f(Er.CAPTCHA_SCREEN))};return e(r,{children:[e(vv,{children:[t(qt,l?{style:{marginTop:"0.25rem",textAlign:"left"},children:l}:{style:{marginTop:"0.25rem",textAlign:"left",visibility:"hidden"},children:" "}),e(Cv,{$error:!!l,children:[t(Kr,{}),t("input",{ref:a,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>o(e.target.value),onKeyUp:e=>{"Enter"===e.key&&E()},value:i,autoComplete:"email"}),n.stacked?null:t(cd,{isSubmitting:c,onClick:E,disabled:$,children:"Submit"})]})]}),n.stacked?t(rd,{loadingText:null,loading:c,disabled:$,onClick:E,children:"Submit"}):null]})}));let vv=Zf,Cv=qf;const bv=({style:e,...r})=>t("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...r,children:t("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});let $v=kr.div`
2761
2767
  display: flex;
2762
2768
  flex-direction: column;
2763
2769
  align-items: center;
@@ -2766,7 +2772,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2766
2772
  width: 100%;
2767
2773
  padding-top: 8px;
2768
2774
  padding-bottom: 32px;
2769
- `,bv=kr.div`
2775
+ `,Ev=kr.div`
2770
2776
  display: flex;
2771
2777
  align-items: center;
2772
2778
  justify-content: center;
@@ -2775,11 +2781,11 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2775
2781
  color: var(--privy-color-error);
2776
2782
  background-color: var(--privy-color-error-light);
2777
2783
  border-radius: 50%;
2778
- `,$v=kr.div`
2784
+ `,Tv=kr.div`
2779
2785
  display: flex;
2780
2786
  flex-direction: column;
2781
2787
  gap: 8px;
2782
- `;const Ev=Ir`
2788
+ `;const xv=Ir`
2783
2789
  :root {
2784
2790
  // Borders
2785
2791
  --privy-border-radius-sm: 6px;
@@ -2816,7 +2822,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2816
2822
  --privy-height-modal-full: 620px;
2817
2823
  --privy-height-modal-compact: 480px;
2818
2824
  };
2819
- `,Tv=kr.div`
2825
+ `,_v=kr.div`
2820
2826
  // css normalize only the privy application to avoid conflicts
2821
2827
  // with consuming application
2822
2828
  ${"\n *,\n ::before,\n ::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n }\n\n line-height: 1.15;\n -webkit-text-size-adjust: 100%;\n -moz-tab-size: 4;\n tab-size: 4;\n font-feature-settings: normal;\n\n margin: 0;\n font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji';\n\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n\n abbr:where([title]) {\n text-decoration: underline dotted;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,\n 'Apple Color Emoji', 'Segoe UI Emoji';\n display: inline;\n }\n\n a {\n color: inherit;\n text-decoration: inherit;\n }\n\n b,\n strong {\n font-weight: bolder;\n }\n\n code,\n kbd,\n samp,\n pre {\n font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;\n font-size: 1em;\n }\n\n small {\n font-size: 80%;\n }\n\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n\n sub {\n bottom: -0.25em;\n }\n\n sup {\n top: -0.5em;\n }\n\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n\n button,\n input,\n optgroup,\n select,\n textarea {\n font-family: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n }\n\n button,\n select {\n text-transform: none;\n }\n\n button,\n [type='button'],\n [type='reset'],\n [type='submit'] {\n -webkit-appearance: button;\n background-color: transparent;\n background-image: none;\n }\n\n ::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n :-moz-focusring {\n outline: 1px dotted ButtonText;\n }\n\n :-moz-ui-invalid {\n box-shadow: none;\n }\n\n legend {\n padding: 0;\n }\n\n progress {\n vertical-align: baseline;\n }\n\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n\n [type='search'] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n }\n\n summary {\n display: list-item;\n }\n\n blockquote,\n dl,\n dd,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n hr,\n figure,\n p,\n pre {\n margin: 0;\n }\n\n fieldset {\n margin: 0;\n padding: 0;\n }\n\n legend {\n padding: 0;\n }\n\n ol,\n ul,\n menu {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n textarea {\n resize: vertical;\n }\n\n input::placeholder,\n textarea::placeholder {\n opacity: 1;\n color: #9ca3af;\n }\n\n button,\n [role='button'] {\n cursor: pointer;\n }\n\n :disabled {\n cursor: default;\n }\n\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n }\n\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n\n [hidden] {\n display: none;\n }\n"}
@@ -2870,7 +2876,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2870
2876
  opacity: 1;
2871
2877
  }
2872
2878
  }
2873
- `,xv=({children:r,open:n,onClick:a,...i})=>t(Sn,{show:n,as:l.Fragment,children:e(Nn,{onClose:a,...i,as:Av,children:[t(In,{as:l.Fragment,enterFrom:"entering",leaveTo:"leaving",children:t(_v,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),t(kv,{children:t(In,{as:l.Fragment,enterFrom:"entering",leaveTo:"leaving",children:t(Pn,{as:Sv,children:r})})})]})});let _v=kr.div`
2879
+ `,Av=({children:r,open:n,onClick:a,...i})=>t(Sn,{show:n,as:l.Fragment,children:e(Nn,{onClose:a,...i,as:Sv,children:[t(In,{as:l.Fragment,enterFrom:"entering",leaveTo:"leaving",children:t(kv,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),t(Nv,{children:t(In,{as:l.Fragment,enterFrom:"entering",leaveTo:"leaving",children:t(Pn,{as:Iv,children:r})})})]})});let kv=kr.div`
2874
2880
  position: fixed;
2875
2881
  inset: 0;
2876
2882
 
@@ -2883,10 +2889,10 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2883
2889
  backdrop-filter: unset;
2884
2890
  -webkit-backdrop-filter: unset;
2885
2891
  }
2886
- `,Av=kr.div`
2892
+ `,Sv=kr.div`
2887
2893
  position: relative;
2888
2894
  z-index: 999999;
2889
- `,kv=kr.div`
2895
+ `,Nv=kr.div`
2890
2896
  position: fixed;
2891
2897
  inset: 0;
2892
2898
  display: flex;
@@ -2894,7 +2900,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2894
2900
  justify-content: center;
2895
2901
  width: 100vw;
2896
2902
  min-height: 100vh;
2897
- `;const Sv=kr.div`
2903
+ `;const Iv=kr.div`
2898
2904
  // reset some default dialog styles
2899
2905
  padding: 0;
2900
2906
  background: transparent;
@@ -2941,13 +2947,13 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2941
2947
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
2942
2948
  border-radius: var(--privy-border-radius-lg);
2943
2949
  }
2944
- `,Nv=kr.div`
2950
+ `,Pv=kr.div`
2945
2951
  display: flex;
2946
2952
  flex-direction: column;
2947
2953
  align-items: center;
2948
2954
  justify-content: center;
2949
2955
  height: 100%;
2950
- `;let Iv={[Er.LANDING]:()=>{let{app:e}=$r();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?t(fg,{connectOnly:!1}):t(vg,{connectOnly:!1})},[Er.CONNECT_OR_CREATE]:()=>{let{app:e}=$r();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?t(fg,{connectOnly:!0}):t(vg,{connectOnly:!0})},[Er.AWAITING_PASSWORDLESS_CODE]:()=>{let{app:n,navigate:a,lastScreen:i,navigateBack:o,setModalData:l,onUserCloseViaDialogOrKeybindRef:s}=$r(),{closePrivyModal:c,resendEmailCode:u,resendSmsCode:h,getAuthMeta:m,loginWithCode:f,updateWallets:g,createAnalyticsEvent:y}=D(),{authenticated:w,logout:v,user:C}=F(),[$,E]=d(Bc),[T,x]=d(!1),[_,A]=d(null),[S,N]=d(null),[I,P]=d(0);s.current=()=>null;let O=m()?.email?0:1,R=Be-500;p((()=>{if(I){let e=setTimeout((()=>{P(I-1)}),1e3);return()=>clearTimeout(e)}}),[I]),p((()=>{if(w&&T&&C){if(n?.legal.requireUsersAcceptTerms&&!C.hasAcceptedTerms){let e=setTimeout((()=>{a(Er.AFFIRMATIVE_CONSENT_SCREEN)}),R);return()=>clearTimeout(e)}if(U(C,n?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),v()},callAuthOnSuccessOnClose:!0}}),a(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),R);return()=>clearTimeout(e)}{g();let e=setTimeout((()=>c({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be);return()=>clearTimeout(e)}}}),[w,T,C]),p((()=>{if(_&&0===S){let e=setTimeout((()=>{E(Bc),A(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[_]);let M=e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return A("Code should be numeric"),void N(1);A(null),N(null);let r=Number(e.currentTarget.name?.charAt(5)),n=[...t||[""]].slice(0,6-r),o=[...$.slice(0,r),...n,...$.slice(r+n.length)];E(o);let s=Math.min(Math.max(r+n.length,0),5);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${s}]`);e?.focus()}if(o.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${s}]`);e?.blur(),f(o.join("")).then((()=>x(!0))).catch((e=>{if(e instanceof L&&e.privyErrorCode===k.INVALID_CREDENTIALS)A("Invalid or expired verification code");else if(e instanceof L&&e.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE)A(e.message);else{if(e instanceof L&&e.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),void a(Er.USER_LIMIT_REACHED_SCREEN);if(e instanceof L&&e.privyErrorCode===k.USER_DOES_NOT_EXIST)return void a(Er.ACCOUNT_NOT_FOUND_SCREEN);if(e instanceof L&&e.privyErrorCode===k.LINKED_TO_ANOTHER_USER)return l({errorModalData:{error:e,previousScreen:i??Er.AWAITING_PASSWORDLESS_CODE}}),void a(Er.ERROR_SCREEN,!1);if(e instanceof L&&e.privyErrorCode===k.DISALLOWED_PLUS_EMAIL)return l({inlineError:{error:e}}),void a(Er.CONNECT_OR_CREATE,!1);if(e instanceof L&&e.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return l({accountTransfer:{nonce:e.data?.data?.nonce,account:0===O?m()?.email:m()?.phoneNumber,displayName:e.data?.data?.account?.displayName,linkMethod:0===O?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void a(Er.LINK_CONFLICT_SCREEN);A("Issue verifying code")}N(0)}))}},B=0==O?t(Kr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):t(Zr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),G=e("p",0==O?{children:["Please check ",t(Kc,{children:m()?.email})," for an email from privy.io and enter your code below."]}:{children:["Please check ",t(Kc,{children:m()?.phoneNumber})," for a message from ",n?.name||"Privy"," and enter your code below."]});return e(r,{children:[t(yd,{backFn:()=>o()},"header"),e(Gc,{children:[t(Rc,{title:"Enter confirmation code",description:G,icon:B}),e(bc,{children:[e(Hc,{children:[t(zc,{$fail:!!_,$success:T,children:t("span",{children:_||(T?"Success!":"")})}),t("div",{children:$.map(((e,r)=>t("input",{name:`code-${r}`,type:"text",value:$[r],onChange:M,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(1===S&&(A(null),N(null)),E([...$.slice(0,e),"",...$.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(r)},inputMode:"numeric",autoFocus:0===r,pattern:"[0-9]",className:`${T?"success":""} ${_?"fail":""}`,autoComplete:b?"one-time-code":"off"},r)))})]}),e(jc,{children:[e("span",{children:["Didn't get ",0==O?"an email":"a message","?"]}),I?e(qc,{children:[t(qr,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),t("span",{children:"Code sent"})]}):t(Vc,{children:t("button",{onClick:async()=>{P(30),0==O?await u():await h()},children:"Resend code"})})]})]})]}),t(Ot,{})]})},[Er.AWAITING_CONNECTION]:()=>{let n,[a,i]=d(!1),[o,l]=d(!1),[c,u]=d(void 0),{authenticated:h,logout:f}=F(),{app:g,navigate:y,navigateBack:w,lastScreen:v,currentScreen:C,setModalData:$,data:E}=$r(),{getAuthFlow:T,walletConnectionStatus:x,closePrivyModal:_,initLoginWithWallet:A,loginWithWallet:S,updateWallets:N,createAnalyticsEvent:I}=D(),{walletConnectors:P}=F(),[O,R]=d(0),{user:M}=F(),[L]=d(M?.linkedAccounts.length||0),[B,G]=d(""),[H,z]=d(""),[j,V]=d(!1),{hasTabbedAway:q}=function(){let[e,t]=d(!1),r=m((()=>{document.hidden&&t(!0)}),[]);return p((()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r))),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:K,token:Z}=Jl(),Y=b&&"wallet_connect_v2"===x?.connector?.connectorType||b&&"coinbase_wallet"===x?.connector?.connectorType||b&&"injected"===x?.connector?.connectorType&&"phantom"===x?.connector?.walletClientType,X="connected"===x?.status,Q="switching_to_supported_chain"===x?.status;p((()=>{let e=T(),t=e instanceof Ol||e instanceof Zl?e:void 0;X&&!t&&(!K||Z||h?A(x.connectedWallet,Z,E?.login?.disableSignup).then((()=>{V(!0)})):($({captchaModalData:{callback:e=>A(x.connectedWallet,e,E?.login?.disableSignup).then((()=>{V(!0)})),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_CONNECTION,onErrorNavigateTo:Er.ERROR_SCREEN}}),y(Er.CAPTCHA_SCREEN,!1))),t&&Y&&X&&!t.preparedMessage?t.buildMessage():t&&!Y&&X&&(o||(async()=>{l(!0),u(void 0);try{"wallet_connect_v2"===x?.connector?.connectorType&&"metamask"===x?.connector?.walletClientType&&await ze(2500),await ee()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{l(!1)}})())}),[O,X,j]),p((()=>{if(M&&a){let e=Be-500;if(g?.legal.requireUsersAcceptTerms&&!M.hasAcceptedTerms){let t=setTimeout((()=>{y(Er.AFFIRMATIVE_CONSENT_SCREEN)}),e);return()=>clearTimeout(t)}if(U(M,g?.embeddedWallets?.createOnLogin)){let t=setTimeout((()=>{$({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),I({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),f()},callAuthOnSuccessOnClose:!0}}),y(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),e);return()=>clearTimeout(t)}N();let t=setTimeout((()=>_({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be);return()=>clearTimeout(t)}}),[M,a]);let J=e=>{if(e?.privyErrorCode!==k.ALLOWLIST_REJECTED){if(e?.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),void y(Er.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode!==k.USER_DOES_NOT_EXIST)return e?.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?($({accountTransfer:{nonce:e.data?.data?.nonce,account:T()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:T()?.meta.walletClientType,chainId:T()?.meta.chainId,connectorType:T()?.meta.connectorType},linkMethod:"siwe",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void y(Er.LINK_CONFLICT_SCREEN)):void u(pu(e));y(Er.ACCOUNT_NOT_FOUND_SCREEN)}else y(Er.ALLOWLIST_REJECTION_SCREEN)};async function ee(){try{await S(),i(!0)}catch(e){J(e)}finally{l(!1)}}p((()=>{x?.connectError&&J(x?.connectError)}),[x]),((e,t)=>{let r=s((()=>{}));p((()=>{r.current=e})),p((()=>{if(null!==t){let e=setInterval((()=>r.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===te&&x?.connector instanceof Ms?x.connector.redirectUri:void 0;e&&G(e);let t="wallet_connect_v2"===te&&x?.connector instanceof Ms?x.connector.fallbackUniversalRedirectUri:void 0;t&&z(t)}),x?.connector instanceof Ms&&!B?500:null);let te=x?.connector?.connectorType||"injected",re=x?.connector?.walletClientType||"unknown",ne=Jc[re]?.displayName||x?.connector?.walletBranding.name||"Browser Extension",ae=Jc[re]?.logo||x?.connector?.walletBranding.icon||(e=>t(Es,{...e})),ie="Browser Extension"===ne?ne.toLowerCase():ne;n=a?`Successfully connected with ${ie}`:c?c.message:Q?"Switching networks":X?o&&Y?"Signing":"Sign to verify":`Waiting for ${ie}`;let oe="Don’t see your wallet? Check your other browser windows.";a?oe=L===(M?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":O>=2&&c?oe="Unable to connect wallet":c?oe=c.detail:Q?oe="Switch your wallet to the requested network.":X&&Y?oe="Sign the message in your wallet to verify it belongs to you.":"metamask"===re&&b?oe="Click continue to open and connect MetaMask.":"metamask"===re?oe="For the best experience, connect only one wallet at a time.":"wallet_connect"===te?oe="Open your mobile wallet app to continue":"coinbase_wallet"!==te||Ge()||(oe=Ls(M)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue.");let le=P?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),se="coinbase_wallet"===re&&(Ls(M)||c===pr.ERROR_USER_EXISTS);return e(r,{children:[t(yd,{backFn:v&&C!==v?w:void 0}),e(mu,{children:[t(gu,{walletLogo:ae,success:a,fail:!!c}),e(xc,{children:[t("h3",{children:n}),t("p",{children:oe}),X||!B||q?null:e("p",{children:["Still here?"," ",t("a",{href:B,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),H&&e(r,{children:[" ","or"," ",t("a",{href:H,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]})]}),se?t(rd,{onClick:()=>le&&le?.disconnect(),disabled:a,children:"Use a different wallet"}):c==pr.ERROR_USER_EXISTS&&C!==v?t(rd,{onClick:w,children:"Use a different wallet"}):X&&!a&&Y?t(rd,{onClick:()=>{l(!0),ee()},disabled:o,children:o?"Signing":"Sign with your wallet"}):!a&&c?.retryable&&O<2?t(rd,{onClick:()=>{R(O+1),u(void 0),X?(l(!0),ee()):x?.connectRetry()},disabled:!a&&(!c?.retryable||O>=2),children:"Retry"}):a||c?null:t(rd,{onClick:()=>{},disabled:!0,children:"Connecting"})]}),t(Mt,{})]})},[Er.AWAITING_CONNECT_ONLY_CONNECTION]:()=>{let n,{navigateBack:a,navigate:i,lastScreen:o,currentScreen:l,data:s,setModalData:c}=$r(),{walletConnectionStatus:u,closePrivyModal:h}=D(),[m,f]=d(void 0),[g,y]=d(0),w="connected"===u?.status,v="switching_to_supported_chain"===u?.status;p((()=>{if(w){let e;if(s?.externalConnectWallet?.onCompleteNavigateTo){let t=s.externalConnectWallet.onCompleteNavigateTo,r=u.connectedWallet?.address;e=setTimeout((()=>{s.funding&&c({...s,funding:{...s.funding,connectedWalletAddress:r}}),i(t({walletChainType:u.connector?.chainType}))}),Be)}else e=setTimeout(h,Be);return()=>clearTimeout(e)}}),[w]);p((()=>{u?.connectError&&(e=>{f(pu(e))})(u?.connectError)}),[u]);let C=u?.connector?.connectorType||"injected",$=u?.connector?.walletClientType||"unknown",E=Jc[$]?.displayName||u?.connector?.walletBranding.name||"Browser Extension",T=Jc[$]?.logo||u?.connector?.walletBranding.icon||(e=>t(Es,{...e})),x="Browser Extension"===E?E.toLowerCase():E;n=w?`Successfully connected with ${x}`:m?m.message:v?"Switching networks":`Waiting for ${x}`;let _="Don’t see your wallet? Check your other browser windows.";return w?_="You’re good to go!":g>=2&&m?_="Unable to connect wallet":m?_=m.detail:v?_="Switch your wallet to the requested network.":"metamask"===$&&b?_="Click to continue to open and connect MetaMask.":"metamask"===$?_="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===C?_="Open your mobile wallet app to continue":"coinbase_wallet"===C&&(_="Open the Coinbase app on your phone to continue."),e(r,{children:[t(yd,{backFn:l===o?void 0:a}),e(yu,{children:[t(gu,{walletLogo:T,success:w,fail:!!m}),e(xc,{children:[t("h3",{children:n}),t("p",{children:_})]}),m==pr.ERROR_USER_EXISTS?t(rd,{onClick:a,children:"Use a different wallet"}):!w&&m?.retryable&&g<2?t(rd,{onClick:()=>{y(g+1),f(void 0),u?.connectRetry()},disabled:!w&&(!m?.retryable||g>=2),children:"Retry"}):!w&&m&&g>=2?t(rd,{onClick:a,children:"Use a different wallet"}):null]}),t(Mt,{})]})},[Er.AWAITING_FARCASTER_CONNECTION]:()=>{let{authenticated:n,logout:a,ready:i,user:o}=F(),{lastScreen:l,navigate:c,navigateBack:u,setModalData:h,app:m}=$r(),{getAuthFlow:f,loginWithFarcaster:g,closePrivyModal:y,createAnalyticsEvent:w}=D(),[v,C]=d(void 0),[E,T]=d(!1),[x,_]=d(!1),A=s([]),S=f(),N=S?.meta.connectUri;return p((()=>{let e=Date.now(),t=setInterval((async()=>{let r=await S.pollForReady.execute(),n=Date.now()-e;if(r){clearInterval(t),T(!0);try{await g(),_(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===k.ALLOWLIST_REJECTED)return void c(Er.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),void c(Er.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===k.USER_DOES_NOT_EXIST)return void c(Er.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===k.LINKED_TO_ANOTHER_USER)t.detail=e.message??"This account has already been linked to another user.";else{if(e?.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return h({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:"farcaster",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,farcasterEmbeddedAddress:e.data?.data?.otherUser?.farcasterEmbeddedAddress}}),void c(Er.LINK_CONFLICT_SCREEN);e?.privyErrorCode===k.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===k.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}C(t)}}else n>12e4&&(clearInterval(t),C({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),A.current.forEach((e=>clearTimeout(e)))}}),[]),p((()=>{if(i&&n&&x&&o){if(m?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let e=setTimeout((()=>{c(Er.AFFIRMATIVE_CONSENT_SCREEN)}),Be);return()=>clearTimeout(e)}x&&(U(o,m?.embeddedWallets.createOnLogin)?A.current.push(setTimeout((()=>{h({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),c(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),Be)):A.current.push(setTimeout((()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be)))}}),[x,i,n,o]),e(r,b||E?{children:[t(yd,{backFn:l?u:void 0,onClose:y},"header"),t(Ac,{}),t(r,$?{children:e(cp,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:x,fail:!!v}),t(lp,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t(Xd,{children:v?v.message:"Sign in with Farcaster"}),t(Qd,{children:v?v.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),N&&t(rd,{onClick:e=>{e.preventDefault(),window.location.href=N},children:"Open Warpcast app"})]})}:{children:e(dp,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:x,fail:!!v}),t(lp,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t(Xd,{children:v?v.message:"Signing in with Farcaster"}),t(Qd,{children:v?v.detail:"This should only take a moment"}),t(Cc,{children:N&&b&&t(Yh,{text:"Take me to Warpcast",url:N,color:sp})})]})]})}),t(Mt,{})]}:{children:[t(yd,{backFn:l?u:void 0,onClose:y},"header"),t(Ac,{}),t(dp,{children:e("div",{children:[t(Xd,{children:"Sign in with Farcaster"}),t(Qd,{children:"Scan with your phone's camera to continue."}),t($c,{children:N?t(op,{url:N,size:275,squareLogoElement:lp}):t(Gt,{})}),e(Cc,{children:[t(Qd,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),N&&t(Kh,{text:N,itemName:"link",color:sp})]})]})}),t(Mt,{})]})},[Er.AWAITING_FARCASTER_SIGNER]:()=>{let{lastScreen:n,navigateBack:a,data:i,app:o}=$r(),{requestFarcasterSignerStatus:l,closePrivyModal:c}=D(),[u,h]=d(void 0),[m,f]=d(!1),[g,y]=d(!1),w=s([]),v=i?.farcasterSigner;p((()=>{let e=Date.now(),t=setInterval((async()=>{if(!v?.public_key)return clearInterval(t),void h({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===v.status&&(clearInterval(t),f(!1),y(!0),w.current.push(setTimeout((()=>c({shouldCallAuthOnSuccess:!1,isSuccess:!0})),Be)));let r=await l(v?.public_key),n=Date.now()-e;"approved"===r.status?(clearInterval(t),f(!1),y(!0),w.current.push(setTimeout((()=>c({shouldCallAuthOnSuccess:!1,isSuccess:!0})),Be))):n>3e5?(clearInterval(t),h({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):"revoked"===r.status&&(clearInterval(t),h({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))}),2e3);return()=>{clearInterval(t),w.current.forEach((e=>clearTimeout(e)))}}),[]);let C="pending_approval"===v?.status?v.signer_approval_url:void 0;return e(r,b||m?{children:[t(yd,{backFn:n?a:void 0,onClose:c},"header"),t(Ac,{}),t(r,$?{children:e(pp,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:g,fail:!!u}),t(lp,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t(Xd,{children:u?u.message:"Add a signer to Farcaster"}),t(Qd,{children:u?u.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),C&&t(rd,{onClick:e=>{e.preventDefault(),window.location.href=C},children:"Open Warpcast app"})]})}:{children:e(hp,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:g,fail:!!u}),t(lp,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t(Xd,{children:u?u.message:"Requesting signer from Farcaster"}),t(Qd,{children:u?u.detail:"This should only take a moment"}),t(Cc,{children:C&&b&&t(Yh,{text:"Take me to Warpcast",url:C,color:up})})]})]})}),t(Mt,{})]}:{children:[t(yd,{backFn:n?a:void 0,onClose:c},"header"),t(Ac,{}),t(hp,{children:e("div",{children:[t(Xd,{children:"Add a signer to Farcaster"}),e(Qd,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),t($c,{children:"pending_approval"===v?.status?t(op,{url:v.signer_approval_url,size:275,squareLogoElement:lp}):t(Gt,{})}),e(Cc,{children:[t(Qd,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),"pending_approval"===v?.status&&t(Kh,{text:v.signer_approval_url,itemName:"link",color:up})]})]})}),t(Mt,{})]})},[Er.AWAITING_PASSKEY_SYSTEM_DIALOGUE]:()=>{let{lastScreen:n,currentScreen:a,navigateBack:i}=$r(),{loginWithPasskey:o,closePrivyModal:l}=D(),[c,u]=d("loading"),[h,m]=d(null),f=s([]);p((()=>()=>{f.current.forEach((e=>clearTimeout(e))),f.current=[]}),[]);let g=async()=>{u("loading");try{await o(),u("success")}catch(e){m(e),u("error")}};return p((()=>{"success"===c&&(e=>{f.current=[e,...f.current]})(setTimeout((()=>{l({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),Be))}),[c]),p((()=>{g()}),[]),e(r,{children:[t(yd,{backFn:n&&a!==n?i:void 0}),e(Uy,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:"success"===c,fail:"error"===c}),t(dm,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t("h3",{children:(()=>{switch(c){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})()}),t("p",{style:{whiteSpace:"pre-wrap"},children:(()=>{switch(c){case"loading":return"Please follow prompts to verify your passkey.\nYou will have to sign up with another method first to register a passkey for your account.";case"success":return"You've successfully logged in with your passkey.";case"error":if(h instanceof S){if(h.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(h.privyErrorCode===k.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()})]}),(()=>{switch(c){case"loading":case"success":return t(rd,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return t(rd,{onClick:g,disabled:!1,children:"Retry"})}})()]}),t(Mt,{})]})},[Er.PHANTOM_INTERSTITIAL_SCREEN]:()=>{let{forkSession:n,ready:a,authenticated:i}=F(),{walletConnectionStatus:o}=D(),[l,s]=d(""),[c,u]=d(!1);p((()=>{a&&i&&n().then(s)}),[a,i]);let h=((e,t,r)=>{let n=encodeURIComponent(new URL(window.location.href).href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=${r?"solana_adapter":"injected"}&privy_wallet_client=${r?"phantom_solana":"phantom"}`);if(!Ee()&&b)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${n}?ref=${n}`})(l,!c,"solana"===o?.connector?.chainType),m={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return a&&(m.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",m.footnote="Once you're done, you can always return here and refresh to view your updated account."),c&&(m.title="Still here?",m.description="You may need to install the Phantom mobile app.",m.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Oc,{title:m.title,description:m.description}),e(vc,{children:[t(Wy,{children:t(xs,{style:{width:"72px",height:"72px"}})}),t(id,{href:h,onClick:()=>{setTimeout((()=>u(!0)),1e3)},loading:a&&!h,children:c?"Go to App Store":"Continue"}),m.footnote?t("p",{children:m.footnote}):null]}),t(kc,{}),t(Ot,{})]})},[Er.LOGIN_FAILED_SCREEN]:()=>{let{closePrivyModal:n}=D(),{navigate:a}=$r();return e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(xg,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),t(Oc,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),e(vc,{children:[t(rd,{onClick:()=>a(Er.LANDING),children:"Try again"}),t(ld,{onClick:()=>n(),children:"Cancel"})]}),t(kc,{}),t(Ot,{})]})},[Er.AWAITING_OAUTH_SCREEN]:()=>{let{authenticated:n,logout:a,ready:i,user:o}=F(),{app:l,setModalData:s,navigate:c,resetNavigation:u}=$r(),{getAuthMeta:h,initLoginWithOAuth:m,loginWithOAuth:f,updateWallets:g,setReadyToTrue:y,closePrivyModal:w,createAnalyticsEvent:v}=D(),[C,b]=d(!1),[$,E]=d(void 0),T=h()?.provider||"google",{name:x,component:_}=kl(T),A=Or();p((()=>{f(T).then((e=>{b(!0),y(!0),e&&A("login","onOAuthLoginComplete",e)})).catch((e=>{if(y(!1),e?.privyErrorCode===k.ALLOWLIST_REJECTED)return E(void 0),u(),void c(Er.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),E(void 0),u(),void c(Er.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===k.USER_DOES_NOT_EXIST)return E(void 0),u(),void c(Er.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return E(void 0),u(),s({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:h()?.provider,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void c(Er.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=function(e,t){let r={detail:"",retryable:!1},n=gl(t);if(e?.privyErrorCode===k.LINKED_TO_ANOTHER_USER&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode===k.INVALID_CREDENTIALS&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode===k.OAUTH_USER_DENIED&&(r.detail=`Retry and check ${n} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode===k.TOO_MANY_REQUESTS&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===k.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let e=kl(t).name;r.detail=`Request limit reached for ${e}. Please wait a moment and try again.`}if(e?.privyErrorCode===k.OAUTH_ACCOUNT_SUSPENDED){let e=kl(t).name;r.detail=`Your ${e} account is suspended. Please try another login method.`}return e?.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode===k.OAUTH_UNEXPECTED&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}(e,T);E({retryable:t,detail:r,message:"Authentication failed"})})).finally((()=>{Nl()}))}),[x,T]),p((()=>{if(i&&n&&C&&o){if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let e=setTimeout((()=>{c(Er.AFFIRMATIVE_CONSENT_SCREEN)}),Be);return()=>clearTimeout(e)}if(U(o,l?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{s({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:T,screen:"OAuthStatusScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),c(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),Be);return()=>clearTimeout(e)}{let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be);return g(),()=>clearTimeout(e)}}}),[i,n,C,o]);let S=C?`Successfully connected with ${x}`:$?$.message:`Verifying connection to ${x}`,N="";return N=C?"You’re good to go!":$?$.detail:"Just a few moments more",e(r,{children:[t(yd,{}),t(Ac,{}),e(Fy,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:C,fail:!!$}),t(_,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t("h3",{children:S}),t("p",{children:N})]}),$&&$?.retryable?t(dd,{onClick:()=>{Nl(),m(T),E(void 0)},disabled:!C&&!$?.retryable,children:"Retry"}):null]}),t(kc,{}),t(Mt,{})]})},[Er.CROSS_APP_AUTH_SCREEN]:()=>{let n=We(),{data:a,navigate:i,setModalData:o,onUserCloseViaDialogOrKeybindRef:l}=$r(),{crossAppAuthFlow:s,updateWallets:u,closePrivyModal:h,createAnalyticsEvent:m}=D(),{logout:f}=Ut(),[g,y]=d({}),w=a?.crossAppAuth,v={id:w.appId,name:w.name,logoUrl:w.logoUrl},C=new _(`There was an issue connecting your ${v.name} account. Please try again.`),b=new Il((async e=>{if(w.popup)try{let t=await s({appId:e,popup:w.popup,action:w.action});y({data:t})}catch(e){e instanceof _?y({error:e}):(e instanceof L&&w.popup&&w.popup.close(),y({error:C}))}else y({error:C})})),$=()=>{g.data&&(u(),w.onSuccess(g.data),h({shouldCallAuthOnSuccess:!0,isSuccess:!0})),w.onError(g.error??new _("User canceled flow")),h({shouldCallAuthOnSuccess:!1,isSuccess:!1})};l.current=$,p((()=>{v.id.length&&b.execute(v.id)}),[v.id]),p((()=>{if(!g.data)return;let e=g.data;if(n.legal.requireUsersAcceptTerms&&!e.hasAcceptedTerms){let e=setTimeout((()=>{i(Er.AFFIRMATIVE_CONSENT_SCREEN)}),Be);return()=>clearTimeout(e)}if(U(e,n.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{o({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${v.id}`,screen:"CrossAppAuthScreen"}}),f()},callAuthOnSuccessOnClose:!0}}),i(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),Be);return()=>clearTimeout(e)}let t=setTimeout($,Be);return()=>clearTimeout(t)}),[g.data]);let{title:E,subtitle:T}=c((()=>g.data?{title:`Successfully connected with ${v.name}`,subtitle:"You're good to go!"}:g.error?{title:"Authentication failed",subtitle:g.error.message}:{title:`Connecting to ${v.name}`,subtitle:`Please check the pop-up from ${v.name} to continue`}),[g,v.name]);return e(r,{children:[t(yd,{onClose:$}),t(Ac,{}),e(vu,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:!!g.data,fail:!!g.error}),t(wu,{name:v.name,logoUrl:v.logoUrl})]})}),e(xc,{children:[t("h3",{children:E}),t("p",{children:T})]})]}),t(kc,{}),t(Mt,{})]})},[Er.ALLOWLIST_REJECTION_SCREEN]:()=>{let{navigate:n,app:a}=$r(),i=a?.allowlistConfig.errorTitle||"You don't have access to this app",o=a?.allowlistConfig.errorDetail||"Have you been invited?",l=a?.allowlistConfig.errorCtaText||"Try another account";return e(r,{children:[t(yd,{}),e(yc,{children:[t(Td,{children:e("div",{children:[t(Ld,{}),t(gc,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),e(wc,{children:[t("string"==typeof i?"h3":r,{children:i}),t("string"==typeof o?"p":r,{children:o})]}),a?.allowlistConfig.errorCtaLink?t(rd,{as:"a",href:a.allowlistConfig.errorCtaLink,children:l}):t(rd,{onClick:()=>{n(Er.LANDING)},children:l})]})]})},[Er.ACCOUNT_NOT_FOUND_SCREEN]:()=>{let{navigate:n,app:a}=$r();return e(r,{children:[t(yd,{}),e(Rd,{children:[t(Td,{children:e("div",{children:[t(hd,{color:"var(--privy-color-warn-light)"}),t(Dr,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),e(Md,{children:[t("h3",{children:"Account not found"}),e("p",{children:["Please try logging in again or go to ",a.name," to create an account."]})]}),t(xd,{}),t(rd,{onClick:()=>n(Er.LANDING),children:"Try logging in again"})]})]})},[Er.USER_LIMIT_REACHED_SCREEN]:()=>{let{navigate:n}=$r();return e(r,{children:[t(yd,{}),e(Cv,{children:[t(bv,{children:t(vv,{})}),e($v,{children:[t("h3",{children:"Unable to sign in"}),t("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),t(rd,{onClick:()=>{n(Er.LANDING)},children:"Go back"})]}),t(Ot,{})]})},[Er.INSTALL_PHANTOM_SCREEN]:()=>{let{navigateBack:n}=$r();return e(r,{children:[t(yd,{backFn:n},"header"),t(Ac,{}),t(Lf,{}),t(kc,{}),e(Mt,{children:[t("span",{children:"Still not sure? "}),t("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},[Er.LINK_EMAIL_SCREEN]:()=>{let{app:n}=$r();return e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Rc,{title:"Connect your email",description:`Add your email to your ${n?.name} account`,icon:t(Kr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),t(vc,{children:t(Kf,{stacked:!0})}),t(kc,{}),t(Ot,{})]})},[Er.LINK_PHONE_SCREEN]:()=>{let{app:n,currentScreen:a,data:i,navigate:o,setModalData:l}=$r(),{initLoginWithSms:s}=D();return e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Rc,{title:"Connect your phone",description:`Add your number to your ${n?.name} account`,icon:t(Zr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),t(vc,{children:t(ag,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{await s({phoneNumber:e,withPrivyUi:!0}),o(Er.AWAITING_PASSWORDLESS_CODE)}catch(e){l({errorModalData:{error:e,previousScreen:i?.errorModalData?.previousScreen||a||Er.LINK_PHONE_SCREEN}}),o(Er.ERROR_SCREEN)}},hideRecent:!0})}),t(kc,{}),t(Ot,{})]})},[Er.LINK_WALLET_SCREEN]:()=>{let{app:n,data:a}=$r(),i=a?.externalConnectWallet?.suggestedAddress,o=i?e("span",{children:["Link the wallet with address ",t(Pt,{showCopyIcon:!1,address:i})," ",n?.name?`to ${n.name}.`:"."]}):`Link a wallet to your ${n?.name} account`;return e(r,{children:[t(yd,{},"header"),t(Oc,{title:"Link your wallet",description:o}),t(Ad,{children:t(uu,{connectOnly:!1})}),t(Ot,{})]})},[Er.LINK_PASSKEY_SCREEN]:()=>{let{user:n,unlinkPasskey:a}=F(),{linkWithPasskey:i,closePrivyModal:o}=D(),l=n?.linkedAccounts.filter((e=>"passkey"===e.type)),[s,c]=d(!1),[u,h]=d(""),[m,f]=d(!1),[g,y]=d(!1);p((()=>{0===l.length&&y(!1)}),[l.length]);let w=async e=>(c(!0),await a(e).then((()=>f(!0))).catch((e=>{e instanceof S&&e.privyErrorCode===k.MISSING_MFA_CREDENTIALS?h("Cannot unlink a passkey enrolled in MFA"):h("Unknown error occurred.")})).finally((()=>{c(!1)})));return e(r,m?{children:[t(yd,{onClose:()=>o()},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Qr,{})}),t(ym,{style:{marginBottom:"1.5rem"},children:"Passkeys updated"}),t(wm,{children:" "}),t(nc,{children:t(rd,{onClick:()=>o(),children:"Done"})}),t(Mt,{})]}:g?{children:[t(yd,{backFn:()=>y(!1),onClose:()=>o()},"header"),t(cm,{passkeys:l,expanded:g,onUnlink:w,onExpand:()=>y(!0)}),t(Mt,{})]}:{children:[t(yd,{onClose:()=>o()},"header"),t(Yd,{children:e(hm,{children:[t(sm,{}),t(dm,{})]})}),t(ym,{children:"Secure your account with a passkey"}),t(vm,{}),0===l.length?t(um,{}):t(cm,{passkeys:l,expanded:g,onUnlink:w,onExpand:()=>y(!0)}),e(nc,{style:{marginTop:"12px"},children:[u&&t(pm,{$fail:!0,children:u}),t(rd,{onClick:()=>{c(!0),i().then((()=>f(!0))).catch((e=>{if(e instanceof S){if(e.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE)return void h("Cannot link more passkeys to account.");if(e.privyErrorCode===k.PASSKEY_NOT_ALLOWED)return void h("Passkey request timed out or rejected by user.")}h("Unknown error occurred.")})).finally((()=>{c(!1)}))},loading:s,children:"Add new passkey"})]}),t(Mt,{})]})},[Er.UPDATE_EMAIL_SCREEN]:()=>e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Rc,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:t(Kr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),t(vc,{children:t(gv,{stacked:!0})}),t(kc,{}),t(Ot,{})]}),[Er.UPDATE_PHONE_SCREEN]:()=>{let{currentScreen:n,data:a,navigate:i,setModalData:o}=$r(),{user:l}=F(),{initUpdatePhone:s}=D();return e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Rc,{title:"Update your phone number",description:"Add the phone number you'd like to use going forward. We'll send you a confirmation code",icon:t(Zr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),t(vc,{children:t(ag,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{if(!l?.phone?.number)throw Error("User is required to have an phone number to update it.");await s(l?.phone?.number,e),i(Er.AWAITING_PASSWORDLESS_CODE)}catch(e){o({errorModalData:{error:e,previousScreen:a?.errorModalData?.previousScreen||n||Er.LINK_PHONE_SCREEN}}),i(Er.ERROR_SCREEN)}},hideRecent:!0})}),t(kc,{}),t(Ot,{})]})},[Er.CONNECT_ONLY_LANDING_SCREEN]:()=>{let{app:n,data:a}=$r(),i=a?.externalConnectWallet?.suggestedAddress,o=i?e("span",{children:["Connect the wallet with address ",t(Pt,{showCopyIcon:!1,address:i})," ",n?.name?`to ${n.name}.`:"."]}):`Connect a wallet to your ${n?.name} account`;return e(r,{children:[t(yd,{},"header"),t(Pc,{title:"Connect your wallet",description:o}),t(Ad,{children:t(uu,{connectOnly:!0})}),n&&t(Ft,{app:n,alwaysShowImplicitConsent:!0}),t(Ot,{})]})},[Er.CONNECT_ONLY_AUTHENTICATED_SCREEN]:()=>{let{app:n,data:a}=$r(),i=a?.externalConnectWallet?.suggestedAddress,o=i?`Connect the wallet with address ${He(i)} ${n?.name?`to ${n.name}.`:"."}`:`Connect a wallet to ${n?.name}`;return e(r,{children:[t(yd,{},"header"),t(Oc,{title:"Connect your wallet",description:o}),t(Ad,{children:t(uu,{connectOnly:!0})}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN]:()=>{let{app:n,setModalData:a,navigate:i,data:o,onUserCloseViaDialogOrKeybindRef:l}=$r(),[s,c]=d(""),{embeddedWallets:u}=We(),{authenticated:h,user:m}=F(),{closePrivyModal:f}=D(),{onSuccess:g,onFailure:y,callAuthOnSuccessOnClose:w}=o.createWallet,v=!0===n?.embeddedWallets.requireUserOwnedRecoveryOnCreate,{createWallet:C}=Qu(),[b,$]=d(null),E=new Il((async()=>{try{let e=await C({user:m});if(!e)return;$(e),i(Er.EMBEDDED_WALLET_CREATED_SCREEN)}catch(e){c(e.message)}}));return p((()=>h&&m?v?(a({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}}),i(Uu({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:u.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void E.execute():(i(Er.LANDING),void y(Error("User must be authenticated before creating a Privy wallet")))),[v,h]),l.current=()=>null,s?e(r,{children:[t(yd,{closeable:!1}),e(Ec,{children:[t(Xr,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),t(Rc,{title:"Something went wrong",description:s})]}),t(rd,{onClick:()=>{b?(g(b),f({shouldCallAuthOnSuccess:w})):(y(new z("User wallet creation failed")),f({shouldCallAuthOnSuccess:!1}))},children:"Close"}),t(Ju,{})]}):t(Tu,{})},[Er.EMBEDDED_WALLET_CREATED_SCREEN]:()=>{let{user:n}=F(),{closePrivyModal:a,isNewUserThisSession:i,updateWallets:o}=D(),{app:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=$r(),{onSuccess:c,onFailure:u,callAuthOnSuccessOnClose:h}=s.createWallet,m=()=>{let e=G(n);e?(o(),c(e)):u(Error("Failed to create wallet")),a({shouldCallAuthOnSuccess:h})};return p((()=>{let e=setTimeout(m,je);return()=>clearTimeout(e)}),[]),d.current=m,e(r,{children:[t(yd,{onClose:m}),t(Ac,{}),e(Ec,{children:[t(Yr,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),t(Rc,{title:i?"Welcome"+(l?.name?` to ${l?.name}`:""):"All set!",description:i?"You’ve successfully created an account.":"Your account is secured."})]}),t(kc,{}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_CONNECTING_SCREEN]:()=>{let{authenticated:n,user:a,getAccessToken:i}=F(),{closePrivyModal:o,createAnalyticsEvent:l,walletProxy:s}=D(),{navigate:u,data:h,setModalData:m,onUserCloseViaDialogOrKeybindRef:f}=$r(),g=c((()=>Date.now()),[]),[y,w]=d(!1),{onCompleteNavigateTo:v,onFailure:C,shouldForceMFA:b,entropyId:$,entropyIdVerifier:E}=h?.connectWallet,T=e=>{y||(w(!0),C("string"==typeof e?Error(e):e))};p((()=>{let e,t=B(a,$);return n&&t?s?((async()=>{let r=await i();if(!r)return T("User must be authenticated and have a Privy wallet before it can be connected");try{await s.connect({accessToken:r,entropyId:$,entropyIdVerifier:E}),b&&await s.verifyMfa({accessToken:r});let t=(Date.now()-g)/1e3;v===Er.EMBEDDED_WALLET_KEY_EXPORT_SCREEN&&t<1?e=setTimeout((()=>{u(v,!1)}),1e3*(1-t)):u(v,!1)}catch(e){if(Pu(e)&&"privy"===t.recoveryMethod){let e=await i();if(!e)return T("User must be authenticated and have a Privy wallet before it can be recovered");try{l({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:t.address}});let r=await(s?.recover({accessToken:e,entropyId:$,entropyIdVerifier:E}));r?.entropyId||T(Error("Unable to recover wallet")),v?u(v):o({shouldCallAuthOnSuccess:!1}),l({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}}),u(v)}catch(e){T("An error has occurred, please try again.")}}else Pu(e)&&"privy"!==t.recoveryMethod?(m({...h,recoverWallet:{entropyId:$,entropyIdVerifier:E,onCompleteNavigateTo:v,onFailure:C},recoveryOAuthStatus:{provider:t.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}}),u(Wu(t.recoveryMethod))):T(e)}})(),()=>clearTimeout(e)):void 0:T("User must be authenticated and have a Privy wallet before it can be connected")}),[n,a,s]);let x=()=>{T("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return f.current=x,e(r,{children:[t(yd,{onClose:x}),y?e(r,{children:[e(Ec,{children:[t(Xr,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),t(Rc,{title:"Something went wrong",description:"We’re on it. Please try again later."})]}),t(rd,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):t(Tu,{}),t(Hu,{})]})},[Er.EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN]:()=>{let[n,a]=d(!0),{authenticated:i,getAccessToken:o,user:l}=F(),{walletProxy:s,closePrivyModal:c,createAnalyticsEvent:u}=D(),{navigate:h,data:m,onUserCloseViaDialogOrKeybindRef:f}=$r(),[g,y]=d(void 0),[w,v]=d(""),[C,b]=d(!1),{entropyId:$,entropyIdVerifier:E,onCompleteNavigateTo:T,onSuccess:x,onFailure:_}=m.recoverWallet,A=(e="User exited before their wallet could be recovered")=>{c({shouldCallAuthOnSuccess:!1}),_("string"==typeof e?new z(e):e)};f.current=A,p((()=>{if(!i)return A("User must be authenticated and have a Privy wallet before it can be recovered")}),[i]);return e(r,{children:[t(yd,{onClose:A}),t(Ac,{}),e(Gy,{children:[e(By,{children:[t(jn,{height:48,width:48,stroke:"var(--privy-color-accent)"}),t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),e("div",{children:[e(lh,{children:[t(ih,{type:n?"password":"text",onChange:e=>(e=>{e&&y(e)})(e.target.value),disabled:C,style:{paddingRight:"2.3rem"}}),t(hh,{style:{right:"0.75rem"},children:n?t(mh,{onClick:()=>a(!1)}):t(fh,{onClick:()=>a(!0)})})]}),!!w&&t(Hy,{children:w})]}),e("div",{children:[e(_c,{children:[t("h4",{children:"Why is this necessary?"}),t("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),t(zy,{loading:C||!s,disabled:!g,onClick:async()=>{b(!0);let e=await o(),t=B(l,$);if(!e||!t||null===g)return A("User must be authenticated and have a Privy wallet before it can be recovered");try{u({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t.address}}),await(s?.recover({accessToken:e,entropyId:$,entropyIdVerifier:E,recoveryPassword:g})),v(""),T?h(T):c({shouldCallAuthOnSuccess:!1}),x?.(t),u({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}})}catch(e){!function(e){return Iu(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?v("An error has occurred, please try again."):v("Invalid recovery password, please try again.")}finally{b(!1)}},warn:!1,hideAnimations:!$&&C,children:"Recover your account"})]})]}),t(kc,{}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN]:()=>{let[n,a]=d(!1),{navigate:i,lastScreen:o,navigateBack:l,setModalData:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=$r(),{user:h}=F(),{embeddedWallets:p}=We(),{closePrivyModal:m}=D(),f=j(h),g=null===f,{isInAccountCreateFlow:y,isResettingPassword:w}=c.recoverySelection,v=f&&"privy"!==f.recoveryMethod,C=v?e("span",{children:["Your account is currently secured using"," ",t("strong",{children:Xy[f?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function b(e){s({recoveryOAuthStatus:{provider:e,action:g?"create-wallet":"set-recovery",isInAccountCreateFlow:y}}),i(Er.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN)}function $(){c?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),m({shouldCallAuthOnSuccess:c?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return u.current=$,e(r,{children:[t(yd,{onClose:$,backFn:n?()=>a(!1):o?l:void 0,infoFn:o||n?void 0:()=>a(!0)},"header"),n?t(Qy,{onClose:()=>a(!1)}):e(r,{children:[t(Rc,{title:v?"Update backup method":"Secure your account",icon:t(aa,{width:48}),description:C}),t(qy,{children:p.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(f?.recoveryMethod||"")||e!==f?.recoveryMethod)).sort().map((r=>{switch(r){case"google-drive":return e(Id,{onClick:()=>b("google-drive"),children:[t(Yy,{children:t(Vy,{style:{width:18}})}),"Back up to Google Drive"]},r);case"icloud":return e(Id,{onClick:()=>b("icloud"),children:[t(Yy,{children:t(jy,{style:{width:24}})}),"Back up to Apple iCloud"]},r);case"user-passcode":return e(Id,{onClick:()=>{i(Fu({isCreatingWallet:g,skipSplashScreen:!0}))},children:[t(Yy,{children:t(ia,{style:{width:18}})}),w?"Reset your":"Set a"," password"]},r);default:return null}}))})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN]:()=>{let{user:n,getAccessToken:a}=F(),{walletProxy:i,refreshUser:o,closePrivyModal:l}=D(),s=$r(),{entropyId:c,entropyIdVerifier:u}=s.data?.recoverWallet,[h,p]=d(!1),[m,f]=d(null),[g,y]=d(null);function w(){if(!h){if(g)return s.data?.setWalletPassword?.onFailure(g),void l();if(!m)return s.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void l()}}s.onUserCloseViaDialogOrKeybindRef.current=w;let v=!(!h&&!m);return e(r,g?{children:[t(yd,{onClose:w},"header"),t(Jy,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:t(Br,{height:38,width:38,stroke:"var(--privy-color-error)"})}),t(qu,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),t(xd,{style:{minHeight:"2rem"}}),t(nd,{onClick:()=>y(null),children:"Try again"}),t(Ot,{})]}:{children:[t(yd,{onClose:w},"header"),t(aa,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),t(qu,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),t(Vu,{style:{marginTop:"1rem"},children:"When you log into a new device, you’ll only need to authenticate to access your account. Never get logged out if you forget your password."}),t(xd,{style:{minHeight:"2rem"}}),t(nd,{loading:h,disabled:v,onClick:()=>async function(){p(!0);try{let e=await a(),t=B(n,c);if(!e||!i||!t)return;if(!(await i.setRecovery({accessToken:e,entropyId:c,entropyIdVerifier:u,existingRecoveryMethod:t.recoveryMethod,recoveryMethod:"privy"})).entropyId)throw Error("Unable to set recovery on wallet");let r=await o();if(!r)throw Error("Unable to set recovery on wallet");let d=B(r,t.address);if(!d)throw Error("Unabled to set recovery on wallet");f(!!r),setTimeout((()=>{s.data?.setWalletPassword?.onSuccess(d),l()}),Be)}catch(e){y(e)}finally{p(!1)}}(),children:m?"Success":"Confirm"}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN]:()=>{let{logout:n}=F(),{navigate:a,setModalData:i,data:o}=$r(),{recoveryOAuthFlow:l,closePrivyModal:s,createAnalyticsEvent:c}=D(),[u,h]=d(!1),{provider:f,action:g,isInAccountCreateFlow:y}=o?.recoveryOAuthStatus,[w,v]=d(void 0),[C,b]=d("create-wallet"===g);if("user-passcode"===f)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let $=Zy[f].name,E=Zy[f].component,T=o?.recoverWallet?.onCompleteNavigateTo,x=new Il((async(e="create-wallet")=>(b(!0),new Promise(((t,r)=>{setTimeout((async()=>{try{let r=window.open();await l(f,e,r),h(!0),t()}catch(t){v({message:`${"recover"===e?"Recovery":"Back up"} with ${$} unsuccessful`,detail:"recover"===g?`Please verify that you are selecting the ${$} account associated with your backup.`:"",retryable:!0}),r()}}),0)})))));p((()=>{"recover"!==g&&x.execute(y?"create-wallet":"set-recovery")}),[]),p((()=>{if(!u)return;let e=setTimeout((()=>{y?(i({createWallet:{onSuccess:()=>{},onFailure:e=>{c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),a(Er.EMBEDDED_WALLET_CREATED_SCREEN)):s({shouldCallAuthOnSuccess:!1})}),Be);return()=>clearTimeout(e)}),[u]);let _=m((async()=>{await x.execute("recover"),T?a(T):h(!0)}),[]),A="google-drive"===f?"Google Drive":"Apple iCloud",k=u&&`Successfully ${"recover"===g?"recovered":"backed up"} with ${A}.`||w&&w.message||`${"recover"===g?"Recovering":"Backing up"} with ${A}...`,S=w?w.detail:"";return e(r,{children:[t(yd,{}),C?t(r,{children:e(qy,{children:[t(Rc,{title:k,icon:t(E,{style:{width:"38px",height:"38px"}}),description:S}),w&&w?.retryable?t(rd,{onClick:()=>{Nl(),v(void 0),"create-wallet"===g?x.execute("create-wallet"):_()},disabled:!u&&!w?.retryable,children:"Try again"}):null]})}):e(qy,{children:[t(Rc,{title:"Confirm it's really you",icon:t(E,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${A} where your account is backed up.`}),e(rd,{onClick:_,children:["Confirm with ",A]})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_KEY_EXPORT_SCREEN]:()=>{let[n,a]=d(null),{authenticated:i,user:o,getAccessToken:l}=F(),{closePrivyModal:s,createAnalyticsEvent:c,clientAnalyticsId:u}=D(),h=We(),{data:m,onUserCloseViaDialogOrKeybindRef:f}=$r(),{onFailure:g,onSuccess:y,origin:w,appId:v,appClientId:C,walletToExport:b,primaryWallet:$}=m.keyExport,E=e=>{s({shouldCallAuthOnSuccess:!1}),g("string"==typeof e?Error(e):e)},T=()=>{s({shouldCallAuthOnSuccess:!1}),y(),c({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:b.address}})};return p((()=>{if(!i||!b)return E("User must be authenticated before exporting their wallet");l().then(a,E)}),[i,o]),f.current=T,e(r,{children:[t(yd,{onClose:T}),e(Zu,{children:[t(qu,{children:"Transfer wallet"}),e(Vu,{children:["Either copy your private key or seed phrase to transfer your wallet."," ",t("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),t(zu,{theme:h.appearance.palette.colorScheme,children:"Never share your private key or seed phrase with anyone."}),t(Wt,{isLoading:!1,isPulsing:!1,title:"Your wallet",address:b.address,showIcon:!0}),t("div",{style:{width:"100%"},children:n&&t(Ku,{origin:w,appId:v,appClientId:C,accessToken:n,clientAnalyticsId:u,walletToExport:b,primaryWallet:$,dimensions:{height:"44px"}})})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN]:()=>{let{authenticated:n}=F(),{initializeWalletProxy:a,closePrivyModal:i}=D(),{navigate:o,data:l,onUserCloseViaDialogOrKeybindRef:s}=$r(),[c,u]=d(!0),[h,m]=d(""),[f,g]=d(),[y,w]=d(null),[v,C]=d(!1),b=null!==y;p((()=>{n||o(Er.LANDING)}),[n]),p((()=>{a(qe).then((e=>{u(!1),e||(m("An error has occurred, please try again."),g(new mr(new gr(h,yr.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:$,data:E,confirmAndSign:T,onSuccess:x,onFailure:_,uiOptions:A}=l.signMessage,k={title:A.title||"Sign message",description:A.description||"Signing this message will not cost you any fees.",buttonText:A.buttonText||"Sign and continue"},S=e=>{e?x(e):_(f||new mr(new gr("The user rejected the request.",yr.E4001_USER_REJECTED_REQUEST.eipCode))),i({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{w(null),m(""),g(void 0)}),200)};return s.current=()=>{S(y)},e(r,{children:[t(yd,{onClose:()=>S(y)}),t(Ac,{}),A.iconUrl&&"string"==typeof A.iconUrl?t(pv,{children:t(av,{size:"sm",src:A.iconUrl,alt:"app image"})}):null,t(qu,{children:k.title}),t(Vu,{children:k.description}),"personal_sign"===$&&t(dv,{children:iv(E)}),"eth_signTypedData_v4"===$&&t(sv,{typedData:E}),"solana_signMessage"===$&&t(dv,{children:E}),t(mv,{}),t(uv,{$fail:!0,children:h}),t(nd,{disabled:v||b||c,loading:v,onClick:async()=>{C(!0),m("");try{let e=await T();w(e),C(!1),setTimeout((()=>{S(e)}),Be)}catch(e){console.error(e),m("An error has occurred, please try again."),g(new mr(new gr(h,yr.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),C(!1)}},children:v?"Signing...":b?e(hv,{children:[t(qh,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",t("span",{children:"Success"})]}):k.buttonText}),t(kc,{}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN]:()=>{let e,{data:r,onUserCloseViaDialogOrKeybindRef:n,setModalData:a,navigate:i}=$r(),{rpcConfig:o,chains:l,closePrivyModal:s,walletProxy:u}=D(),{getAccessToken:h,user:m}=F(),f=We(),[g,y]=d(0),w=(e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(r),[v,C]=d(nv(r,g)),[b,$]=d(null),[E,T]=d(),[x,_]=d(!1),[A,k]=d(null),[S,N]=d(null);if(!v||!r?.sendTransaction||!r?.sendTransaction.transactingWallet)return t(zh,{error:Error("Invalid transaction request"),onClick:()=>{r?.sendTransaction?.onFailure(rv),s({shouldCallAuthOnSuccess:!1})}});let{entropyId:I,entropyIdVerifier:P,transactingWallet:O}=r.sendTransaction,R=c((()=>l.find((e=>Number(e.id)===Number(v.chainId)))),[v.chainId]),M=R?.nativeCurrency.symbol??"ETH",L=c((()=>Qw(v.data,!!f.embeddedWallets.extendedCalldataDecoding)),[v.data]),{action:U,isErc20Ish:W,isNFTIsh:B}=L;p((()=>{v.to&&R&&W&&Jm({address:v.to,chain:R,rpcConfig:f.rpcConfig,privyAppId:f.id}).then($).catch(console.error)}),[v.to,R]);let{tokenPrice:G,isTokenPriceLoading:H}=bp(v.chainId),z=c((()=>ye(Number(v.chainId),l,o,{appId:f.id})),[v.chainId,o]),j=tv(v,O,z);p((()=>{C(nv(r,g))}),[g]),p((()=>{r.sendTransaction?.getIsSponsored?r.sendTransaction.getIsSponsored().then(T).catch(console.error):T(!1)}),[r.sendTransaction.getIsSponsored]);let V=()=>{if(!x)return A?r?.sendTransaction?.onSuccess(A.response):S||j?.errors[0]?r?.sendTransaction?.onFailure(S??j?.errors[0]??rv):r?.sendTransaction?.onFailure(new mr(new gr("The user rejected the request",yr.E4001_USER_REJECTED_REQUEST.eipCode))),s({shouldCallAuthOnSuccess:!1})};n.current=V;let q=!!(r.funding&&r.funding.supportedOptions.length>0),K="fiat-currency"===f.embeddedWallets.priceDisplay.primary,Z=kt(j?.tx.value??0).add(kt(j?.totalGasEstimate?.toBigInt()??0)).toHexString(),Y=Vt(Z,M),X=K&&G?Yt(Z,G):void 0,Q=Vt(j?.totalGasEstimate?.toString()??0,M),J=K&&G?Yt(j?.totalGasEstimate?.toString()??0,G):void 0,ee=Vt(j?.balance?.toString()??0,M,void 0,!0),te=K&&G?Yt(j?.balance?.toString()??0,G):void 0,re=r.sendTransaction?.uiOptions?.transactionInfo?.title;re||(re="approve"===U?W?"Confirm address":"Confirm action":`Approve ${U}`);let ne=r.sendTransaction?.uiOptions?.description||`${f.name} wants your permission to approve the following transaction.`,ae=r.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?t("img",{src:r.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:r.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,ie=!(!j||j.errors[0]||j.hasFunds||!1!==E),oe=ie&&q,le=oe?"Add funds":r.sendTransaction?.uiOptions?.buttonText||(g<w?"Continue":"Approve");if(A?.receipt)return t(Bw,{txn:j?.tx??v,onClose:V,receipt:A.receipt,transactionInfo:r.sendTransaction?.uiOptions.transactionInfo,tokenPrice:G,tokenSymbol:M,l1GasEstimate:j?.l1ExecutionFeeEstimate?.toString(),receiptHeader:r.sendTransaction?.uiOptions.successHeader,receiptDescription:r.sendTransaction?.uiOptions.successDescription});if(S)return t(hw,{transactionError:S,network:"ethereum",chainId:j?.tx.chainId??v.chainId,onClose:V,onRetry:({resetNonce:e})=>{N(null);let t={...j?.tx??v};e&&(t.nonce=void 0),C(t)}});let se=0!==w&&"number"==typeof g&&0!==g?()=>{y(g-1)}:void 0;return"amount"in L&&L.amount&&(L.isNFTIsh?e=L.amount.toString():b&&(e=Bm({amount:L.amount,decimals:b.decimals}))),t(aw,{transactionIndex:g,onBack:se,maxIndex:w,disabled:ie&&!q,isSubmitting:x,submitError:S,isPreparing:!j,isTokenPriceLoading:H,isTokenContractInfoLoading:!B&&!b,prepareError:j?.errors[0],symbol:b?.symbol,chain:R,img:ae,title:re,subtitle:ne,total:v.value?X??Y:void 0,txValue:v.value,fee:J??Q,isSponsored:E,from:O?.address??"",to:v.to,network:f.chains.find((e=>e.id===v.chainId))?.name??"",transactionDetails:{...L,formattedAmount:e},cta:le,missingFunds:ie,action:U,balance:te??ee,onClose:V,onClick:oe?async()=>{if(!O)return;if(!q)throw Error("Funding wallet is not enabled");let e=Er.FUNDING_METHOD_SELECTION_SCREEN;a({...r,funding:{...r.funding,methodScreen:e,chainType:"ethereum",amount:En(BigInt(j?.tx.value??0)+BigInt(j?.totalGasEstimate?.toString()??0)),chain:R}}),i(e)}:async()=>{if(g<w)y(g+1);else{_(!0);try{let e=await h();if(x||!e||!O||!u||!m)return;let t=r?.sendTransaction?.onConfirm?await r.sendTransaction.onConfirm().then((e=>z.getTransaction(e))):await Dw({accessToken:e,transactingWallet:O,entropyId:I,entropyIdVerifier:P,walletProxy:u,transactionRequest:j?.tx??v,provider:z,requesterAppId:r.sendTransaction?.requesterAppId}),n=await t.wait();k({receipt:Uw(n),response:t})}catch(e){console.warn({transaction:j?.tx??v,error:e}),N(e)}finally{_(!1)}}}})},[Er.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN]:()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:a}=$r(),{closePrivyModal:i,walletProxy:o}=D(),l=We(),{user:s,getAccessToken:c}=F(),[u,h]=d(e?.sendSolanaTransaction?.transactionRequest),[m,f]=d(),[g,y]=d(),[w,v]=d(0),[C,b]=d(!1),[$,E]=d(),[T,x]=d(null),_=e?.sendSolanaTransaction?.connection,A=e?.sendSolanaTransaction?.transactingWallet,k=m?.instructions.at(w),S=m?.instructions.length??1,N=Sp(_?.rpcEndpoint||""),I=j(s);if(p((()=>{!async function(){if(u&&_)try{y(void 0);let e=await Bp(u,_);f(e),v(0)}catch(e){console.warn("Failed to prepare transaction",e),y(e)}}()}),[u,_]),!(u&&e?.sendSolanaTransaction&&A&&_)){let r=Error("Invalid transaction request");return t(zh,{error:r,onClick:()=>{e?.sendSolanaTransaction?.onFailure(r),i({shouldCallAuthOnSuccess:!1})}})}let{solPrice:O,isSolPriceLoading:R}=Cp(),M=()=>{if(!C)return $?e?.sendSolanaTransaction?.onSuccess($):(e?.sendSolanaTransaction?.onFailure(T??g??Error("User exited the modal before submitting the transaction")),v(0)),i({shouldCallAuthOnSuccess:!1})};r.current=M;let L="fiat-currency"===l.embeddedWallets.priceDisplay.primary,U=e.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===k?.action?"Confirm address":"Approve transaction"),W=e.sendTransaction?.uiOptions?.description||`${l.name} wants your permission to approve the following transaction.`,B=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?t("img",{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,G=k?.amount||0n,H=0===w&&m?.fees||0n,z=k?.balance||0n,V=k?.from,q=k?.to,K=G+H,Z=Op(K),Y=L&&O?Rp(K,O):void 0,X=H?Op(H):void 0,Q=L&&O?Rp(H,O):void 0,J=z?Op(z):void 0,ee=L&&O?Rp(z,O):void 0,te=!g&&!k?.hasFunds,re=!!(e.funding&&e.funding.supportedOptions.length>0),ne=te&&re,ae=ne?"Add funds":e.sendTransaction?.uiOptions?.buttonText||"Approve";return $?t(Mw,{instructions:m?.instructions.map((({from:e,to:t,amount:r})=>({from:e.toBase58(),to:t.toBase58(),amount:r})))??[],fees:0===w?$.fees:0n,onClose:M,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,solPrice:O,receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription,rpcEndpoint:_.rpcEndpoint}):T?t(hw,{transactionError:T,connection:_,onClose:M,network:"solana",onRetry:async()=>{x(null);let{blockhash:e}=await _.getLatestBlockhash();Lp(u)?u.message.recentBlockhash=e:u.recentBlockhash=e,h(u)}}):t(aw,{isSubmitting:C,submitError:T,isPreparing:!m,isTokenPriceLoading:R,isTokenContractInfoLoading:!1,symbol:"SOL",chain:void 0,img:B,title:U,subtitle:W,from:V?.toBase58()||"",to:q?.toBase58(),fee:Q??X,total:null!=G?Y??Z:void 0,txValue:G,spender:k?.spender?.toBase58(),network:N,cta:ae,missingFunds:te,action:k?.action,balance:ee??J,prepareError:g,chainName:"Solana",onClose:M,onClick:ne?async()=>{if(!A)return;if(!re)throw Error("Funding wallet is not enabled");let t=Er.FUNDING_METHOD_SELECTION_SCREEN;n({...e,funding:{...e.funding,methodScreen:t}}),a(t)}:async()=>{if(w<(m?.instructions.length??1)-1)v(w+1);else try{b(!0);let t=await c();if(C||!t||!A||!o||!s||!I)return;let{entropyId:r,entropyIdVerifier:n}=P(I),{signature:a,receipt:i}=await tw({tx:u,accessToken:t,connection:_,walletProxy:o,entropyId:r,entropyIdVerifier:n,transactingWalletAddress:A.address,transactingWalletIndex:A.walletIndex??0,transactionOptions:e.sendSolanaTransaction?.transactionOptions});E(Wp(a,i))}catch(e){console.warn({transaction:u,error:e}),x(e)}finally{b(!1)}},isSponsored:!1,transactionIndex:w,maxIndex:S-1,disabled:te&&!re,onBack:w>0&&S>1?()=>v(w-1):void 0})},[Er.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN]:()=>{let{app:n,data:a}=$r(),{closePrivyModal:i}=D(),[o,l]=d(!1),[s,c]=d(),{address:u,onDelegate:h,onSuccess:m,onError:f}=a.delegatedActions.consent,g=async()=>{o?m():f(s??new _("User declined delegating actions.")),i({shouldCallAuthOnSuccess:!1})};return p((()=>{if(!o&&!s)return;let e=setTimeout(g,je);return()=>clearTimeout(e)}),[o,s]),e(r,o||s?{children:[t(yd,{onClose:g}),t(Ac,{}),e(bc,{children:[s?t(Hr,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):t(Qr,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Nc,{height:20}),t(Rc,{title:s?"Something went wrong":"Success!",description:s?"Please try again.":`You’ve successfully granted delegated action permissions to ${n.name}.`})]}),t(kc,{}),t(Ot,{})]}:{children:[t(yd,{closeable:!0,onClose:g}),t(Cu,{width:56,height:56,style:{margin:"auto"}}),t(Xd,{style:{marginTop:24,color:"var(--privy-color-foreground)"},children:"Enable delegated actions"}),e(Qd,{style:{marginBottom:24,textWrap:"pretty"},children:["Give ",n.name," permissions to transact on your behalf. You can revoke this later."," ",t("a",{style:{color:"var(--privy-color-accent-dark)"},href:"https://www.privy.io/using-privy",target:"_blank",children:"Learn more"})]}),t($u,{showIcon:!0,address:u,title:"Wallet",isLoading:!1}),e(bu,{style:{marginTop:24},children:[t(ld,{onClick:g,children:"Not now"}),t(rd,{onClick:async()=>{try{await h(),l(!0)}catch(e){c(e)}},children:"Accept"})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_DELEGATED_ACTIONS_REVOKE_SCREEN]:()=>{let{app:n,data:a}=$r(),{closePrivyModal:i}=D(),[o,l]=d(!1),[s,c]=d(),{onRevoke:u,onSuccess:h,onError:m}=a.delegatedActions.revoke,f=async()=>{o?h():m(s??new _("User declined revoking access to their delegated wallet.")),i({shouldCallAuthOnSuccess:!1})};return p((()=>{if(!o&&!s)return;let e=setTimeout(f,je);return()=>clearTimeout(e)}),[o,s]),e(r,o||s?{children:[t(yd,{onClose:f}),t(Ac,{}),e(bc,{children:[s?t(Hr,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):t(Qr,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Nc,{height:20}),t(Rc,{title:s?"Something went wrong":"Success!",description:s?"Please try again.":"You've successfully revoked permissions."})]}),t(kc,{}),t(Ot,{})]}:{children:[t(yd,{closeable:!0,onClose:f}),t(Cu,{width:56,height:56,style:{margin:"auto"}}),t(Xd,{style:{marginTop:24},children:"Revoke permission"}),e(Qd,{children:["Revoke permission for ",n.name," to transact on your behalf."]}),e(Eu,{style:{marginTop:24},children:[t(ld,{onClick:f,children:"Deny"}),t(rd,{onClick:async()=>{try{await u(),l(!0)}catch(e){c(e)}},children:"Confirm"})]}),t(Ot,{})]})},[Er.FUNDING_METHOD_SELECTION_SCREEN]:()=>{let{wallets:a}=st(),{wallets:i}=fr(),{navigate:o,data:l,setModalData:s}=$r(),d=We(),{client:u}=D(),h=l?.funding,m=Qm(yf),f=Qm(wf),g="solana"===h.chainType,y=g?void 0:h;p((()=>{y?.erc20Address&&!y.erc20ContractInfo&&Jm({address:y.erc20Address,chain:y.chain,rpcConfig:d.rpcConfig,privyAppId:d.id}).then((e=>s({...l,funding:{...y,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}}))).catch(console.error)}),[y?.erc20Address,y?.chain]);let w=g?i.find((({address:e})=>e===h.address)):a.find((({address:e})=>n(e)===n(h.address))),v=w&&"privy"!==w.walletClientType?eu(w.walletClientType,w.connectorType,w.walletClientType):d.name,C=!(!y?.erc20Address||y?.erc20ContractInfo),b=h.isUSDC?"USDC":y?.erc20Address?void 0:"native-currency",$=!!g||b&&((e,t)=>{switch(t){case"native-currency":return df.has(e);case"USDC":return cf.has(e);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}})(Number(h.chain.id),b),E=!!g||b&&((e,t)=>{switch(t){case"native-currency":return tf.has(e);case"USDC":return rf.has(e);default:return console.warn("Unknown asset passed to Coinbase Onramp"),!1}})(Number(h.chain.id),b),T=c((()=>{for(let e of l?.funding?.supportedOptions??[]){if("card"===e.method&&"coinbase"===e.provider&&E)return()=>lf(u,h,s,o,l,"buy");if("card"===e.method&&"moonpay"===e.provider&&$&&b)return()=>ff(u,h,d,b,s,o,l,"credit_debit_card")}}),[l?.funding?.supportedOptions,$,E,b]),x=c((()=>{for(let e of l?.funding?.supportedOptions??[])if("exchange"===e.method&&"coinbase"===e.provider&&E)return()=>lf(u,h,s,o,l,"buy")}),[l?.funding?.supportedOptions,$,E,b]),_=c((()=>{for(let e of l?.funding?.supportedOptions??[])if("wallets"===e.method)return()=>o(Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN)}),[l?.funding?.supportedOptions]);return e(r,{children:[t(mp,{}),e("h3",{children:["Add funds to your"," ",v?.toLowerCase().endsWith("wallet")?v:v+" wallet"]}),e(_m,{children:[h.errorMessage&&t(Km,{theme:d.appearance.palette.colorScheme,children:h.errorMessage}),T&&e(Id,{disabled:C,onClick:T,children:[t(Am,{children:t(Un,{style:{width:24}})}),"Pay with card",m?t(Ym,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):f?t(Xm,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):null]}),x&&e(Id,{disabled:C,onClick:x,children:[t(Am,{children:t(Dn,{style:{width:24}})}),"Transfer from an exchange"]}),_&&e(Id,{disabled:C,onClick:_,children:[t(Am,{children:t(Qt,{style:{width:24}})}),"Transfer from wallet"]}),e(Id,{disabled:C,onClick:()=>o(Er.FUNDING_MANUAL_TRANSFER_SCREEN),children:[t(Am,{children:t(Wn,{style:{width:24}})}),"Receive funds"]})]}),t(Ot,{})]})},[Er.MOONPAY_STATUS_SCREEN]:()=>{let{app:n,data:a,navigateBack:i}=$r(),{closePrivyModal:o}=D(),{externalTransactionId:l}=a?.moonpayStatus,s=mf(l||null,n.fundingMethodConfig.moonpay.useSandbox??!1);return e(r,{children:[t(yd,{title:"Fund account",backFn:i}),t(Tf,{status:s,onClickCta:o}),t(Ot,{})]})},[Er.COINBASE_ONRAMP_STATUS_SCREEN]:()=>{let{data:n,setModalData:a,navigate:i}=$r(),{closePrivyModal:o,createAnalyticsEvent:l,client:c}=D(),[u,h]=d("pending-in-flow"),m=s(0),f=n?.funding,g=n?.coinbaseOnrampStatus;if(!g)throw Error("Screen mounted without correct data");let{partnerUserId:y,popup:w}=g;return p((()=>{if("pending-in-flow"===u||"pending-after-flow"===u){let e=setInterval((async()=>{if(y)try{let{status:e}=await c.getCoinbaseOnRampStatus({partnerUserId:y});if("success"===e)return void h("success");if("failure"===e)throw Error("There was an error completing Coinbase Onramp flow.");if(m.current>=3)return a({funding:f}),void i(Er.FUNDING_METHOD_SELECTION_SCREEN);w.closed&&(m.current=m.current+1,h("pending-after-flow"))}catch(e){console.error(e),h("error"),l({eventName:$p,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),a({funding:{...f,errorMessage:"Something went wrong adding funds. Please try again or use another method."}}),i(Er.FUNDING_METHOD_SELECTION_SCREEN)}}),1500);return()=>clearInterval(e)}}),[y,w,u]),e(r,{children:[t(yd,{title:"Fund account"},"header"),t(zm,{status:u,onClickCta:o}),t(Ot,{})]})},[Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:()=>{let n,{connectors:a}=D(),{app:i,setModalData:o,data:l,navigate:s}=$r(),{wallets:c}=st(),{wallets:u}=fr(),[h,m]=d("default"),f="solana"===l?.funding?.chainType,g=!!l?.funding?.crossChainBridgingEnabled;n="ethereum"===l?.funding?.chainType?l.funding.erc20Address?"ethereum-only":g&&!l.funding.chain.testnet?"ethereum-and-solana":"ethereum-only":g?"ethereum-and-solana":"solana-only";let y=c.filter((e=>"privy"!==e.walletClientType)),w=y.map((e=>e.walletClientType)),v=u.filter((e=>"privy"!==e.walletClientType)),C=v.map((e=>e.walletClientType)),b=[],$=({address:e,walletChainType:t})=>{o({...l,funding:{...l.funding,connectedWalletAddress:e,onContinueWithExternalWallet:()=>s(T({destChainType:f?"solana":"ethereum",sourceChainType:t}))}}),s(Er.FUNDING_EDIT_AMOUNT_SCREEN)};"solana-only"!==n&&b.push(...y.map(((e,r)=>t(Sf,{onClick:()=>$({address:e.address,walletChainType:"ethereum"}),icon:e.meta.icon,name:e.meta.name},r)))),"ethereum-only"!==n&&b.push(...v.map(((e,r)=>t(Sf,{onClick:()=>$({address:e.address,walletChainType:"solana"}),icon:e.meta.icon,name:e.meta.name},r)))),b.push(...hu({walletList:i.appearance.walletList.filter((e=>!y.some((t=>t.walletClientType===e))&&!v.some((t=>t.walletClientType===e)))),walletChainType:n,connectors:a,connectOnly:!0,ignore:[...i.appearance.walletList,...w,...C],walletConnectEnabled:i.externalWallets.walletConnect.enabled}));let E=t(kf,{text:"More wallets",onClick:()=>m("overflow")}),T=({sourceChainType:e,destChainType:t})=>"ethereum"===e&&"solana"===t?Er.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN:"ethereum"===e&&"ethereum"===t?Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN:"solana"===e&&"ethereum"===t?Er.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN:Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN;return p((()=>{o({...l,externalConnectWallet:{onCompleteNavigateTo:({walletChainType:e})=>(o({...l,funding:{...l.funding,onContinueWithExternalWallet:()=>{s(T({destChainType:e??"ethereum",sourceChainType:f?"solana":"ethereum"}))}}}),Er.FUNDING_EDIT_AMOUNT_SCREEN)}})}),[]),e(r,"overflow"===h?{children:[t(yd,{backFn:()=>m("default")},"header"),e(Ad,{children:[t(Vu,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),b]}),t(Ot,{})]}:{children:[t(mp,{}),t(Rc,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),e(Ad,{children:[b.length>4?b.slice(0,3):b,b.length>4&&E]}),t(Ot,{})]})},[Er.FUNDING_EDIT_AMOUNT_SCREEN]:()=>{let{data:n,setModalData:a}=$r(),i=n?.funding,o="solana"===i.chainType,l=s(null),[c,u]=d(!1),{tokenPrice:h}=bp(o?"solana":i.chain.id);p((()=>{l.current&&l.current.style.setProperty("--funding-input-length",Math.max(i.amount.length,1).toString())}),[i.amount,l.current]);let m=o?void 0:i,f=!(!m?.erc20Address||m?.erc20ContractInfo),g=o?"SOL":i.erc20Address?i.erc20ContractInfo?.symbol:i.chain.nativeCurrency.symbol||"ETH",y=parseFloat(i.amount),w=!isNaN(y)&&y>0,v=h?Kt(i.amount,h):void 0;return e(r,{children:[t(mp,{}),t(qu,{children:"Confirm or edit amount"}),e(Tc,{style:{marginTop:"32px"},children:[t(km,{children:f?t(fp,{size:"50px"}):e(r,{children:[e(Sm,{onClick:()=>l.current?.focus(),children:[t(Im,{ref:l,value:i.amount,onFocus:()=>u(!0),onBlur:()=>u(!1),onChange:e=>{let t=e.target.value;/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1&&a({...n,funding:{...i,amount:t}})}}),t(Om,{children:g}),!c&&t(Pm,{children:t(Fn,{width:12,height:12})})]}),!m?.erc20Address&&t(Rm,{children:v&&w?v:""})]})}),t(fm,{onClick:()=>{l.current?.focus()},children:"Edit amount"}),t(nd,{style:{marginTop:"1rem"},disabled:!w,onClick:i.onContinueWithExternalWallet,children:"Continue"})]}),t(Ot,{})]})},[Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:()=>{let{rpcConfig:n,appId:a,closePrivyModal:i,createAnalyticsEvent:o}=D(),{navigate:l,setModalData:s,app:c,data:u}=$r(),{wallets:h}=st(),[m,f]=d(!1),[g,y]=d(0n),[w,v]=d(!1),[C,b]=d(null),[$,E]=d(null),[T,x]=d([]),[A,S]=d(0),[N,I]=d(!1),[P,O]=d(!1),[R,M]=d(!1),[L,F]=d(!1);if(!u?.funding||"ethereum"!==u.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:U,chain:W,amount:B,connectedWalletAddress:G}=u.funding,H=u.funding.address,z=u.funding.erc20Address;p((()=>{z&&!U&&b(Error("Unable to fetch token details"))}),[]);let j=!!z&&!!U,V=j?BigInt(parseFloat(B)*10**U.decimals):vn(B),q=G?h.find((({address:e})=>e===G)):h[0],[K,Z]=d(null);p((()=>{(async()=>{if(!q)return;let e=await q.getEthereumProvider();Z(gn({account:q.address,transport:yn(e)}).extend(wn))})().catch(console.error)}),[q]);let[Y,X]=d(0n);p((()=>{mn({chain:W,transport:fn(Qe(W,n,a))}).getBalance({address:H}).then(X).catch(console.error)}),[]);let[Q,J]=d(0n);p((()=>{j&&Gm({chain:W,address:H,appId:a,rpcConfig:n,erc20Address:z}).then((e=>J(e.balance))).catch(console.error)}),[]);let{tokenPrice:ee}=bp(W.id),[te,re]=d({to:H,chain:W,value:V,data:void 0});p((()=>{(async()=>{let e,t;if(!K||!q||N||R)return;I(!0);let r=mn({chain:te.chain,transport:fn(Qe(te.chain,n,a))});if(j&&!te.data)return await r.simulateContract({address:z,chain:te.chain,abi:Um,functionName:"transfer",args:[H,V],account:q.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(I(!1),void re({to:z,chain:te.chain,data:Cn({abi:Um,functionName:"transfer",args:[H,V]}),value:"0x0"})):(I(!1),void v(!0));try{e=await r.prepareTransactionRequest({account:q.address,to:te.to,chain:te.chain,data:te.data,value:BigInt(te.value??0)})}catch(e){if(console.error(e),T.length>1)E(e.shortMessage??"Something went wrong");else if(P&&0===T.length)return void b(new _(`Wallet ${He(q.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE))}if(!e)return I(!1),void v(!0);I(!1),M(!0),f(!0),y(e.gas);try{await K.switchChain({id:te.chain.id})}catch(e){await K.addChain({chain:te.chain}),await K.switchChain({id:te.chain.id})}try{t=await K.sendTransaction(e),o({eventName:$p,payload:{provider:"external",status:"success",address:q.address,chainId:te.chain.id,value:te.value?.toString(),txHash:t}})}catch(e){if(console.error(e),"TransactionExecutionError"===e.name)if(T.length<1){let t=e.shortMessage;(e.shortMessage.includes("rejected the request")||e.details.includes("rejected the request"))&&(t="User rejected the request."),b(new _(t,void 0,k.TRANSACTION_FAILURE))}else E(e.shortMessage??"Something went wrong")}t?(await K.waitForTransactionReceipt({hash:t}),M(!1),F(!0)):M(!1)})().catch(console.error)}),[K,te]),p((()=>{(async()=>{if(!w||!K||!q)return;let e=Ye(c.chains).filter((e=>e.id!==W.id&&!!e.testnet==!!W.testnet));j&&e.unshift(W);let t=await Gp({chains:e,address:q.address,appId:a,rpcConfig:n}),r=j?t.filter((e=>e.balance>0n)):t.filter((e=>e.balance>V));if(r.length<1)return void b(new _(`Wallet ${He(q.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));r.sort(((e,t)=>Number(t.balance-e.balance)));let i=(await Promise.allSettled(r.map((async e=>({quote:await xp({isTestnet:!!W.testnet,input:Tp({amount:V.toString(),user:q.address,recipient:H,destinationChainId:W.id,destinationCurrency:z,originChainId:e.chain.id})}),...e}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(i.length<1)return void b(new _(`Wallet ${He(q.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));let o=i.map((e=>({bridgeTx:_p(e.quote),balance:e.balance,chain:e.chain}))).filter((e=>!!e.bridgeTx));if(o.length>1)return void x(o);let l=o[0];l?(O(!0),re({data:l.bridgeTx.data,to:l.bridgeTx.to,value:l.bridgeTx.value,chain:l.chain})):b(new _(`Wallet ${He(q.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE))})().catch(console.error)}),[w]),p((()=>{if(!C)return;let e={error:C,previousScreen:Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN};s({funding:u?.funding,sendTransaction:u?.sendTransaction,errorModalData:e}),l(Er.ERROR_SCREEN,!1)}),[C]);let ne=q?eu(q.walletClientType,q.connectorType,q.walletClientType)||"wallet":null,ae=!j&&ee?Kt(u?.funding?.amount??"0",ee):void 0,ie=j?g:Zt([g,V]),oe=ie&&ee?Yt(ie,ee):void 0,le=ie?Vt(ie,"ETH"):void 0,se=g&&ee?Yt(g,ee):void 0,de=g?Vt(g,"ETH"):void 0;if(p((()=>{if(!L)return;let e=setTimeout(i,dt);return()=>clearTimeout(e)}),[L]),L)return e(r,{children:[t(mp,{}),t(Ac,{}),e(Ec,{children:[t(Qr,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Rc,{title:"Success!",description:`You’ve successfully added ${B} ${j?U.symbol:W.nativeCurrency.symbol} to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),t(kc,{}),t(Ot,{})]});let ce=j?`${Bm({amount:Q,decimals:U.decimals})} ${U.symbol}`:Vt(Y,W.nativeCurrency.symbol,3,!0),ue=T[A];return T.length>1&&ue?t(Lm,{displayName:ne,configuredFundingChain:W,formattedBalance:ce,fundingAmount:B,fundingCurrency:j?U.symbol:W.nativeCurrency.symbol,fundingAmountInUsd:ae,options:T,selectedOption:ue,isPreparing:N,isSubmitting:R,errorMessage:$,onSubmit:()=>{re({to:ue.bridgeTx.to,data:ue.bridgeTx.data,value:ue.bridgeTx.value,chain:ue.chain})},onSelect:e=>{e!==A&&(E(null),S(e))}}):m&&g&&q&&u?.funding?t(Dm,{wallet:q,displayName:ne,addressToFund:H,isBridging:P,isErc20Flow:j,totalPriceInUsd:oe,totalPriceInNativeCurrency:le,gasPriceInUsd:se,gasPriceInNativeCurrency:de,chainId:W.id,chainName:W.name}):e(r,{children:[t(mp,{}),t(fp,{}),t("div",{style:{marginTop:"1rem"}}),t(Ot,{})]})},[Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN]:()=>{let{closePrivyModal:n,createAnalyticsEvent:a}=D(),{navigate:i,setModalData:o,app:l,data:c}=$r(),{wallets:u}=fr(),[h,m]=d(0n),[f,g]=d(null),[y,w]=d(!1),[v,C]=d(!1),b=s(!1);if(!c?.funding||"solana"!==c.funding.chainType)throw Error("Invalid funding data");let{address:$,amount:E,cluster:T,connectedWalletAddress:x}=c.funding,A=Ip(T),{tokenPrice:S}=bp("solana"),{fundingAmountInBaseUnit:N,totalPriceInUsd:I,totalPriceInNativeCurrency:P,feePriceInNativeCurrency:O,feePriceInUsd:R}=Mp({amount:E,fee:h,tokenPrice:S}),M=x?u.find((({address:e})=>e===x)):u[0];if(p((()=>{(async()=>{if("solana"!==M?.type||!M.sendTransaction||y||b.current)return;b.current=!0;let{Connection:e,PublicKey:t,SystemProgram:r,Transaction:n}=await import("@solana/web3.js"),i=new t(M.address),o=new n;o.add(r.transfer({fromPubkey:i,toPubkey:new t($),lamports:N}));let l=new e(A),s=await l.getLatestBlockhash();o.recentBlockhash=s.blockhash,o.feePayer=i;let d=await o.getEstimatedFee(l);null!=d&&m(BigInt(d)),w(!0);try{let e=await l.simulateTransaction(o);if(e.value.err)return e.value.logs?.find((e=>/Transfer: insufficient lamports/gi.test(e)))?void g(new _(`Wallet ${He(M.address,void 0,void 0,"solana")} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",e.value.err),void g(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE)));let t=await M.sendTransaction(o,l);a({eventName:$p,payload:{provider:"external",status:"success",address:M.address,value:N.toString(),txHash:t,chainType:"solana",rpcEndpoint:A}}),w(!1),C(!0)}catch(e){if(console.error(e),w(!1),/user rejected the request/gi.test(e.message||""))return void g(new _("Transaction was rejected by the user",void 0,k.TRANSACTION_FAILURE));g(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE))}})().catch(console.error).finally((()=>b.current=!1))}),[]),p((()=>{if(!f)return;let e={error:f,previousScreen:Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN};o({funding:c?.funding,sendTransaction:c?.sendTransaction,errorModalData:e}),i(Er.ERROR_SCREEN,!1)}),[f]),p((()=>{if(!v)return;let e=setTimeout(n,dt);return()=>clearTimeout(e)}),[v]),v)return e(r,{children:[t(mp,{}),t(Ac,{}),e(Ec,{children:[t(Qr,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Rc,{title:"Success!",description:`You’ve successfully added ${E} SOL to your ${l.name} wallet. It may take a minute before the funds are available to use.`})]}),t(kc,{}),t(Ot,{})]});let L=M?eu(M.walletClientType,M.connectorType,M.walletClientType)||"wallet":null;return M&&y?t(Dm,{wallet:M,displayName:L,addressToFund:$,isBridging:!1,isErc20Flow:!1,totalPriceInUsd:I,totalPriceInNativeCurrency:P,gasPriceInUsd:R,gasPriceInNativeCurrency:O,chainId:"solana",chainName:T.name}):e(r,{children:[t(mp,{}),t(fp,{}),t("div",{style:{marginTop:"1rem"}}),t(Ot,{})]})},[Er.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN]:()=>{let{rpcConfig:n,appId:a,closePrivyModal:i,createAnalyticsEvent:o}=D(),{navigate:l,setModalData:s,app:c,data:u}=$r(),{wallets:h}=st(),[m,f]=d(null),[g,y]=d(null),[w,v]=d([]),[C,b]=d(0),[$,E]=d(!1),[T,x]=d(!1),[A,S]=d(!1),[N,I]=d(!1);if(!u?.funding||"solana"!==u.funding.chainType)throw Error("Invalid funding data");let{address:P,cluster:O,amount:R,connectedWalletAddress:M}=u.funding,L=M?h.find((({address:e})=>e===M)):h[0],[F,U]=d(null);p((()=>{(async()=>{if(!L)return;let e=await L.getEthereumProvider();U(gn({account:L.address,transport:yn(e)}).extend(wn))})().catch(console.error)}),[L]);let[W,B]=d(0n),G=Op(W);p((()=>{(async()=>{let{Connection:e,PublicKey:t}=await import("@solana/web3.js");new e(Ip(O)).getBalance(new t(P)).then((e=>B(BigInt(e))))})()}),[]);let[H,z]=d(),{tokenPrice:j}=bp("solana"),{fundingAmountInBaseUnit:V,fundingAmountInUsd:q}=Mp({amount:R,fee:0n,tokenPrice:j});p((()=>{(async()=>{if(!F||!L)return;let e=["testnet","devnet"].includes(O.name);e&&console.warn("Solana testnets are not supported for bridging");let t=Ye(c.chains).filter((({testnet:t})=>!!t===e)),r=(await Gp({chains:t,address:L.address,appId:a,rpcConfig:n})).filter((e=>e.balance>0n));if(r.length<1)return void f(new _(`Wallet ${He(L.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));r.sort(((e,t)=>Number(t.balance-e.balance)));let i=(await Promise.allSettled(r.map((async e=>({...e,quote:await xp({isTestnet:!1,input:Tp({amount:V.toString(),user:L.address,recipient:P,destinationChainId:Ap,destinationCurrency:kp,originChainId:e.chain.id})})}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(i.length<1)return void f(new _(`Unable to fetch quotes for bridging. Wallet ${He(L.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));let o=i.map((({quote:e,balance:t,chain:r})=>({bridgeTx:_p(e),balance:t,chain:r}))).filter((({bridgeTx:e})=>!!e));if(o.length>1)return void v(o);let l=o.at(0);l?(x(!0),z({data:l.bridgeTx.data,to:l.bridgeTx.to,value:l.bridgeTx.value,chain:l.chain})):f(new _(`Unable to select bridge option from quotes. Wallet ${He(L.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE))})().catch(console.error)}),[F]),p((()=>{(async()=>{let e,t;if(!F||!L||$||A||!H)return;E(!0);let r=mn({chain:H.chain,transport:fn(Qe(H.chain,n,a))});try{e=await r.prepareTransactionRequest({account:L.address,to:H.to,chain:H.chain,data:H.data,value:BigInt(H.value??0)})}catch(e){console.error(e),w.length>1&&y(e.shortMessage??"Something went wrong")}if(e){E(!1),S(!0);try{await F.switchChain({id:H.chain.id})}catch(e){await F.addChain({chain:H.chain}),await F.switchChain({id:H.chain.id})}try{t=await F.sendTransaction(e),o({eventName:$p,payload:{provider:"external",status:"success",address:L.address,chainId:H.chain.id,value:H.value?.toString(),txHash:t}})}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(w.length<1?f(new _(e.shortMessage,void 0,k.TRANSACTION_FAILURE)):y(e.shortMessage??"Something went wrong"))}t?(await F.waitForTransactionReceipt({hash:t}),S(!1),I(!0)):S(!1)}else E(!1)})().catch(console.error)}),[F,H]),p((()=>{if(!m)return;let e={error:m,previousScreen:Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN};s({funding:u?.funding,sendTransaction:u?.sendTransaction,errorModalData:e}),l(Er.ERROR_SCREEN,!1)}),[m]);let K=L?eu(L.walletClientType,L.connectorType,L.walletClientType)||"wallet":null;if(p((()=>{if(!N)return;let e=setTimeout(i,dt);return()=>clearTimeout(e)}),[N]),N)return e(r,{children:[t(mp,{}),t(Ac,{}),e(Ec,{children:[t(Qr,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Rc,{title:"Success!",description:`You’ve successfully added ${R} SOL to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),t(kc,{}),t(Ot,{})]});let Z=w[C];return w.length>1&&Z?t(Lm,{displayName:K,configuredFundingChain:O,formattedBalance:G,fundingAmount:R,fundingCurrency:"SOL",fundingAmountInUsd:q,options:w,selectedOption:Z,isPreparing:$,isSubmitting:A,errorMessage:g,onSubmit:()=>{z({to:Z.bridgeTx.to,data:Z.bridgeTx.data,value:Z.bridgeTx.value,chain:Z.chain})},onSelect:e=>{e!==C&&(y(null),b(e))}}):A&&L?t(Dm,{wallet:L,displayName:K,addressToFund:P,isBridging:T,isErc20Flow:!1,chainId:"solana",chainName:O.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):e(r,{children:[t(mp,{}),t(fp,{}),t("div",{style:{marginTop:"1rem"}}),t(Ot,{})]})},[Er.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN]:function(){let{closePrivyModal:n,createAnalyticsEvent:a}=D(),{navigate:i,setModalData:o,app:l,data:c}=$r(),{wallets:u}=fr(),h=s(!1),[m,f]=d(!1),[g,y]=d(!1),[w,v]=d(null);if(!c?.funding||"ethereum"!==c.funding.chainType)throw Error("Invalid funding data");let{amount:C,connectedWalletAddress:b,chain:$}=c.funding,E=c.funding.address,T={name:"mainnet-beta"},x=b?u.find((({address:e})=>e===b)):u[0];if(p((()=>{(async function(){if(!x||!$||h.current)return;h.current=!0,$?.testnet&&console.warn("Solana testnets are not supported for bridging");let e=vn(C),t=await xp({isTestnet:!!$.testnet,input:Tp({amount:e.toString(),user:x.address,recipient:E,destinationChainId:$.id,originChainId:Ap,originCurrency:kp})}).catch(console.error);if(!t)return void v(new _(`Unable to fetch quotes for bridging. Wallet ${ct(x.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));let r=await(async e=>{let t=e.steps[0]?.items?.[0];if(!t)return;let{PublicKey:r,TransactionInstruction:n}=await import("@solana/web3.js");return{instructions:t.data.instructions.map((({keys:e,programId:t,data:a})=>new n({keys:e.map((({pubkey:e,isSigner:t,isWritable:n})=>({pubkey:new r(e),isSigner:t,isWritable:n}))),programId:new r(t),data:Buffer.from(a,"hex")}))),addressLookupTableAddresses:t.data.addressLookupTableAddresses?.map((e=>new r(e)))}})(t);if(r)try{let{Connection:t,PublicKey:n,TransactionMessage:i,VersionedTransaction:o}=await import("@solana/web3.js"),l=new t(Ip(T)),s=await Promise.all((r.addressLookupTableAddresses??[]).map((async e=>l.getAddressLookupTable(e).then((e=>e.value))))),{blockhash:d}=await l.getLatestBlockhash(),c=new o(new i({payerKey:new n(x.address),instructions:r.instructions,recentBlockhash:d}).compileToV0Message(s));f(!0);let u=await l.simulateTransaction(c);if(u.value.err)return u.value.logs?.find((e=>/Transfer: insufficient lamports/gi.test(e)))?void v(new _(`Wallet ${ct(x?.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",u.value.err),void v(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE)));let h=await x.sendTransaction(c,l),p=await l.confirmTransaction(h);if(p.value.err)return console.error("Transaction failed:",p.value.err),void v(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE));a({eventName:$p,payload:{provider:"external",status:"success",address:x.address,chainId:$.id,value:e.toString(),txHash:h}}),y(!0)}catch(e){if(console.error(e),/user rejected the request/gi.test(e.message||""))return void v(new _("Transaction was rejected by the user",void 0,k.TRANSACTION_FAILURE));v(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE))}else v(new _(`Unable to select bridge option from quotes. Wallet ${ct(x.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE))})().catch(console.error)}),[]),p((()=>{if(!g)return;let e=setTimeout(n,dt);return()=>clearTimeout(e)}),[g]),p((()=>{if(!w)return;let e={error:w,previousScreen:Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN};o({funding:c?.funding,sendTransaction:c?.sendTransaction,errorModalData:e}),i(Er.ERROR_SCREEN,!1)}),[w]),g)return e(r,{children:[t(mp,{}),t(Ac,{}),e(Ec,{children:[t(Qr,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Rc,{title:"Success!",description:`You’ve successfully added ${C} ${$.nativeCurrency.symbol} to your ${l.name} wallet. It may take a minute before the funds are available to use.`})]}),t(kc,{}),t(Ot,{})]});if(m&&x){let e=x?eu(x.walletClientType,x.connectorType,x.walletClientType)||"wallet":null;return t(Dm,{wallet:x,displayName:e,addressToFund:E,isBridging:m,isErc20Flow:!1,chainId:$.id,chainName:$.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0})}return e(r,{children:[t(mp,{}),t(fp,{}),t("div",{style:{marginTop:"1rem"}}),t(Ot,{})]})},[Er.FUNDING_MANUAL_TRANSFER_SCREEN]:()=>{let{wallets:n}=st(),{wallets:a}=fr(),{data:i,setModalData:o,navigate:l,lastScreen:s}=$r(),{rpcConfig:u,appId:h,createAnalyticsEvent:m}=D(),f=We(),[g,y]=d(void 0),w=i?.funding,{reloadBalance:v}=Jt({rpcConfig:u,appId:h,address:"ethereum"===w.chainType?w.address:void 0,chain:"ethereum"===w.chainType?w.chain:void 0}),C="solana"===w.chainType,b=C?"SOL":w.erc20Address?w.erc20ContractInfo?.symbol:w.chain.nativeCurrency.symbol,$=C?a.find((({address:e})=>e===w.address)):n.find((({address:e})=>He(e)===He(w.address)));if(!w)return o({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:s||Er.FUNDING_METHOD_SELECTION_SCREEN},funding:i?.funding,sendTransaction:i?.sendTransaction}),l(Er.ERROR_SCREEN),t(r,{});p((()=>{let e=C?async function(){if("solana"!==w.chainType)return;let{Connection:e,PublicKey:t}=await import("@solana/web3.js");new e(Ip(w.cluster)).getBalance(new t(w.address)).then((e=>{y((t=>(t&&e>t&&m({eventName:$p,payload:{provider:"manual",status:"success",chainType:"solana",address:$?.address,value:(e-t).toString()}}),e)))}))}:async function(){"ethereum"===w.chainType&&(async()=>{if(!w.erc20Address)return await v()??BigInt(0);{let{balance:e}=await Gm({chain:w.chain,address:w.address,erc20Address:w.erc20Address,rpcConfig:u,appId:h});return e}})().then((e=>{let t=parseFloat(Gn(e,"ether"));y((e=>(e&&t>e&&m({eventName:$p,payload:{provider:"manual",status:"success",chainType:"ethereum",address:$?.address,value:(t-e).toString()}}),t)))})).catch((()=>y(void 0)))},t=setInterval(e,2e3);return e(),()=>clearInterval(t)}),[]);let E=c((()=>void 0!==g&&g>=parseFloat(w.amount)),[g,w.amount]),T=null!=g?C?Op(BigInt(g),2,!0,!0):g.toPrecision(2):"",x="ethereum"===w.chainType?w.chain.name:$f[w.cluster.name];return e(r,{children:[t(mp,{}),t(qu,{children:"Receive funds"}),e(Vu,{children:["Scan this code or copy your wallet address to receive funds on ",x,"."]}),e(Tc,{style:{gap:"1rem",margin:"1rem 0"},children:[t(op,{url:w.address,size:200,squareLogoElement:bf}),t(Wt,{title:"Your wallet",errMsg:void 0,showIcon:!0,isLoading:!w||void 0===g,isPulsing:!E,balance:`${T} ${b}`,address:w.address,statusColor:E?"green":"gray"}),e(vf,{theme:f.appearance.palette.colorScheme,children:["Make sure to send funds on ",x,"."]})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN]:()=>{let{closePrivyModal:n}=D(),{data:a,setModalData:i,navigate:o,onUserCloseViaDialogOrKeybindRef:l}=$r(),{onSuccess:s,onFailure:d}=a.setWalletPassword,c=()=>{d(new z("Exited before password was added to wallet")),n({shouldCallAuthOnSuccess:!1})};return l.current=c,e(r,{children:[t(yd,{onClose:c}),t(Ac,{}),e(Ec,{children:[e(Sc,{children:[t(un,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),t(Ic,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:t(hn,{width:"12px",height:"12px",fill:"white"})})]}),e(Rc,{title:"Secure Your Account",children:["Please set a password to secure your account.",t("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),t(rd,{onClick:()=>{i({createWallet:{onFailure:d,onSuccess:s,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o(Er.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN)},children:"Add password"}),t(kc,{}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN]:()=>{let[e,r]=d(null),[n,a]=d(!1),[i,o]=d(null),[l,s]=d(""),{authenticated:c,getAccessToken:u,user:h}=F(),{walletProxy:m,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:y}=D(),{app:w,navigate:v,data:C,onUserCloseViaDialogOrKeybindRef:b}=$r(),{onSuccess:$,onFailure:E}=C.createWallet,T=j(h),x="user-passcode"===e?.recoveryMethod,_="user-passcode"===T?.recoveryMethod;p((()=>{c||(v(Er.LANDING),E(new V("User must be authenticated before setting a password on a Privy wallet")))}),[c]);let A=()=>i?(E(i),void g({shouldCallAuthOnSuccess:!1})):x?($(e),void g({shouldCallAuthOnSuccess:!1})):(E(new z("Exited before password was added to wallet")),void g({shouldCallAuthOnSuccess:!1}));b.current=A;return t(Hh,{appName:w?.name||"privy",config:{initiatedBy:"user",onCancel:A},error:i?"An error has occurred, please try again.":void 0,buttonLoading:n,buttonHideAnimations:!1,password:l,isResettingPassword:_,onPasswordGenerate:()=>s(Oh()),onPasswordChange:s,onSubmit:async()=>{x?($(e),g({shouldCallAuthOnSuccess:!1})):(a(!0),o(null),await(async()=>{let e=await u();if(e&&T?.address&&l&&m)try{y({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:_}});let{entropyId:t,entropyIdVerifier:n}=P(T);if(!(await m.setRecovery({accessToken:e,entropyId:t,entropyIdVerifier:n,recoveryPassword:l,recoveryMethod:"user-passcode"})).entropyId)return o(new z("Error setting password on privy wallet")),void y({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:_,reason:"error setting password"}});let a=await f(),i=j(a);if(!i)return o(new z("Error setting password on privy wallet")),void y({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:_,reason:"wallet disconnected"}});r(i),y({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:_}})}catch(e){console.warn(e),o(e instanceof Error?e:Error("Error setting password on privy wallet")),y({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:T.address,reason:e}})}})(),a(!1))},onClose:A})},[Er.EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN]:()=>{let{app:e,navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:a}=$r(),[i,o]=d(""),[l,s]=d(!1),[c,u]=d(),[h,m]=d(null),{authenticated:f,user:g}=F(),{closePrivyModal:y,isNewUserThisSession:w,initializeWalletProxy:v}=D(),{onSuccess:C,onFailure:b,callAuthOnSuccessOnClose:$}=n.createWallet,{createWallet:E}=Qu(),[T,x]=d(null),_=new Il((async()=>{try{let e=await E({recoveryPassword:c,user:g});if(!e)return;x(e),w?r(Er.EMBEDDED_WALLET_CREATED_SCREEN):(C(e),y({shouldCallAuthOnSuccess:$}))}catch(e){o(e.message)}}));p((()=>{h||v(3e4).then((e=>m(e)))}),[h]),p((()=>{if(!f||!g)return r(Er.LANDING),void b(Error("User must be authenticated before creating a Privy wallet"))}),[f]),a.current=()=>null;return t(Hh,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!h,buttonLoading:l,buttonHideAnimations:!T&&l,isResettingPassword:!1,error:i,password:c||"",onClose:()=>{T&&"user-passcode"!==T?.recoveryMethod?(b(new z("User created a wallet but failed to set a password for it")),y({shouldCallAuthOnSuccess:!1})):T?(C(T),y({shouldCallAuthOnSuccess:$})):(b(new z("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))},onPasswordChange:u,onPasswordGenerate:()=>u(Oh()),onSubmit:async()=>(s(!0),_.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>s(!1))))})},[Er.MFA_ENROLLMENT_FLOW_SCREEN]:()=>{let{user:n,enrollInMfa:a}=F(),[i,o]=d(null),{unenrollWithSms:l,unenrollWithTotp:s,unenrollWithPasskey:c}=Ag(),{app:u,ready:h,data:m,onUserCloseViaDialogOrKeybindRef:f}=$r(),{closePrivyModal:g}=D(),{promptMfa:y}=_g(),{initEnrollmentWithTotp:w}=Ag(),[v,C]=d(!1),[b,$]=d(null),[E,T]=d(null),x=()=>{g({shouldCallAuthOnSuccess:!0}),a(!1),setTimeout((()=>{o(null),$(null)}),500)},{initEnrollmentWithPasskey:_,submitEnrollmentWithPasskey:A}=Ag(),[k,S]=d(!1),[N,I]=d(null);f.current=x;let P=n?.mfaMethods.includes("sms"),O=!!n?.phone,R=n?.mfaMethods.includes("totp"),M=n?.mfaMethods.includes("passkey"),L=P||R||M,U=n?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function W(){o(null),$(null)}if(p((()=>{L&&C(!0)}),[L]),!h||!n||!u)return e(r,{children:[t(yd,{onClose:x},"header"),t(Yd,{children:t(kg,{})}),t(Jd,{children:t(Gt,{})}),t(Mt,{})]});if("sms"===i)return e(r,{children:[t(yd,{backFn:W,onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Dr,{})}),t(Xd,{children:"Remove SMS verification?"}),e(Qd,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),t(nc,{children:t(rd,{warn:!0,onClick:async function(){o(null);try{await l()}catch(e){o(null)}},children:"Remove SMS for MFA"})}),t(Mt,{})]});if("totp"===i)return e(r,{children:[t(yd,{backFn:W,onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Dr,{})}),t(Xd,{children:"Remove Authenticator App verification?"}),e(Qd,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),t(nc,{children:t(rd,{warn:!0,onClick:async function(){o(null);try{await s()}catch(e){o(null)}},children:"Remove Authenticator App for MFA"})}),t(Mt,{})]});if("passkey"===i)return e(r,{children:[t(yd,{backFn:W,onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Dr,{})}),t(Xd,{children:"Are you sure you want to remove passkey verification?"}),t(Qd,{children:"This will disable any passkeys you have set up for verification. You’ll still be able to login with your passkeys if you’ve set up passkey login."}),t(nc,{children:t(rd,{warn:!0,onClick:async function(){o(null);try{await y(),await c()}catch(e){o(null)}},children:"Yes, remove"})}),t(Mt,{})]});if(0===m.mfaEnrollmentFlow.mfaMethods.length&&!L)return e(r,{children:[t(yd,{onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(jn,{})}),t(Xd,{children:"Add more security"}),e(Qd,{children:[u?.name," does not have any verification methods enabled."]}),t(nc,{children:t(rd,{onClick:x,children:"Close"})}),t(Mt,{})]});let B=!L&&!v;return B?e(r,{children:[t(yd,{onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(jn,{})}),t(Xd,{children:"Transaction Protection"}),t(Qd,{children:"Set up transaction protection to add an extra layer of security to your account"}),e(ec,{children:[e(rc,{children:[t(tc,{children:t(Ln,{})}),"Enable 2-Step verification for your ",u?.name," wallet."]}),e(rc,{children:[t(tc,{children:t(Vn,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),e(nc,{children:[t(rd,{onClick:()=>C(!0),children:"Continue"}),t(ld,{onClick:x,children:"Not now"})]}),t(Mt,{})]}):"sms"===b?t(Zg,{onComplete:x,onReset:W,onClose:x}):"totp"===b&&E?t(Xg,{onComplete:x,onClose:x,onReset:W,totpInfo:E}):"passkey"===b?t(Pg,{onComplete:x,onReset:W,onClose:x}):t(Ng,{showIntro:B,userMfaMethods:n.mfaMethods,appMfaMethods:u.mfa.methods,userHasAuthSms:O,onBackToIntro:function(){C(!1)},handleSelectMethod:async function(e){return await y().catch(I),"totp"===e?($(e),T(null),void w().then((e=>{T(e)})).catch((()=>{T(null),W()}))):"passkey"===e&&1===U.length?await async function(){S(!0);try{await _(),await A({credentialIds:U})}catch(e){I(e)}finally{S(!1)}}():void $(e)},isTotpLoading:"totp"===b&&!E,isPasskeyLoading:k,error:N,onClose:x,setRemovingMfaMethod:o})},[Er.CAPTCHA_SCREEN]:()=>{let{lastScreen:n,currentScreen:a,data:i,navigateBack:o,navigate:l,setModalData:c}=$r(),{status:u,token:h,waitForResult:m,reset:f,execute:g}=Jl(),y=s([]),w=e=>{y.current=[e,...y.current]},[v,C]=d(!0);p((()=>(w(setTimeout(C,1e3,!1)),()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]})),[]);let[b,$]=d(""),[E,T]=d("Checking that you are a human..."),[x,_]=d(t(rd,{onClick:()=>{},disabled:!0,children:"Continue"})),[A,k]=d(!1),[S,N]=d(3),I=i?.captchaModalData,P=async e=>{try{await(I?.callback(e)),I?.onSuccessNavigateTo&&l(I?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof Xl)return;c({errorModalData:{error:e,previousScreen:n||Er.LANDING}}),l(I?.onErrorNavigateTo||Er.ERROR_SCREEN,!1)}};p((()=>{"success"===u?w(setTimeout((async()=>{let e=await m();!e||I?.userIntentRequired||P(e)}),1e3)):"ready"===u&&w(setTimeout((()=>{"ready"===u&&g()}),500))}),[u]),p((()=>{if(!v)switch(u){case"success":$("Success!"),T("CAPTCHA passed successfully."),_(t(rd,{onClick:()=>{k(!0),P(h)},disabled:!I?.userIntentRequired,loading:A,children:I?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":$(""),T("Checking that you are a human..."),_(t(rd,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":$("Something went wrong"),S<=0?(T("If you use an adblocker or VPN, try disabling and re-attempting."),_(null)):(T("You did not pass CAPTCHA. Please try again."),_(t(rd,{onClick:O,children:"Retry"})))}}),[u,v,A]);let O=async()=>{if(S<=0)return;N((e=>e-1)),f(),g();let e=await m();!e||I?.userIntentRequired||P(e)};return e(r,{children:[t(yd,{backFn:n&&a!==n?o:void 0}),e(Xc,{children:["success"===u?t(Yr,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):"error"===u?t(Xr,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):t(Zc,{}),e(xc,{children:[b?t("h3",{children:b}):null,t("p",{children:E})]}),x]}),t(Mt,{})]})},[Er.ERROR_SCREEN]:()=>{let{navigate:e,navigateBack:r,data:n,lastScreen:a,currentScreen:i}=$r(),o=n?.errorModalData?.previousScreen||(a===i?void 0:a);return t(zh,{error:n?.errorModalData?.error||Error(),backFn:()=>o?e(o,!1):r(),onClick:()=>e(o||Er.LANDING,!1)})},[Er.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE]:()=>{let{closePrivyModal:n}=D();return e(r,{children:[t(yd,{},"header"),t(Nf,{children:t(jr,{style:{width:32,height:32}})}),t(Oc,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),t(vc,{children:t(rd,{onClick:()=>n(),children:"Close"})}),t(kc,{}),t(Ot,{})]})},[Er.AFFIRMATIVE_CONSENT_SCREEN]:()=>{let{user:e,logout:r}=F(),{app:n,onUserCloseViaDialogOrKeybindRef:a,setModalData:i,navigate:o}=$r(),{acceptTerms:l,closePrivyModal:s,createAnalyticsEvent:d}=D(),c=e=>{e?.preventDefault(),s({shouldCallAuthOnSuccess:!1}),r()};a.current=c;return t(mc,{termsAndConditionsUrl:n?.legal.termsAndConditionsUrl,privacyPolicyUrl:n?.legal.privacyPolicyUrl,onAccept:async t=>{t.preventDefault(),await l(),e&&U(e,n?.embeddedWallets?.createOnLogin)?(i({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),d({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),o(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)):s()},onDecline:c})},[Er.TELEGRAM_AUTH_SCREEN]:()=>{let{authenticated:n,logout:a,ready:i,user:o}=F(),{app:l,setModalData:s,navigate:c,resetNavigation:u,data:h}=$r(),{initLoginWithTelegram:m,loginWithTelegram:f,updateWallets:g,setReadyToTrue:y,closePrivyModal:w,createAnalyticsEvent:v,getAuthMeta:C}=D(),[b,$]=d(!1),[E,T]=d(void 0),x=Jl();async function _(){try{let e=await async function(){let e;if(x.enabled&&"error"===x.status)throw new Xl(x.error,null,k.CAPTCHA_FAILURE);return x.enabled&&"success"!==x.status&&(x.execute(),e=await x.waitForResult()),e}();await f(e),$(!0),y(!0)}catch(e){if(e?.privyErrorCode===k.ALLOWLIST_REJECTED)return T(void 0),u(),void c(Er.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),T(void 0),u(),void c(Er.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===k.USER_DOES_NOT_EXIST)return T(void 0),u(),void c(Er.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return T(void 0),u(),s({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:C()?.telegramAuthResult,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void c(Er.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=ts(e);T({retryable:t,detail:r,message:"Authentication failed"})}}p((()=>{_()}),[]),p((()=>{if(!(i&&n&&b&&o))return;if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let e=setTimeout((()=>{c(Er.AFFIRMATIVE_CONSENT_SCREEN)}),Be);return()=>clearTimeout(e)}if(U(o,l?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{s({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),c(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),Be);return()=>clearTimeout(e)}g();let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be);return()=>clearTimeout(e)}),[i,n,b,o]);let A=b?"Successfully connected with Telegram":E?E.message:"Verifying connection to Telegram",S="";return S=b?"You’re good to go!":E?E.detail:"Just a few moments more",e(r,{children:[t(yd,{}),t(Ac,{}),e(fv,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:b,fail:!!E}),t(ug,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t("h3",{children:A}),t("p",{children:S})]}),E&&E?.retryable?t(dd,{onClick:async()=>{try{T(void 0),h?.telegramAuthModalData?.seamlessAuth||await m(void 0,h?.login?.disableSignup),await _()}catch(e){let{retryable:t,detail:r}=ts(e);T({retryable:t,detail:r,message:"Authentication failed"})}},disabled:!b&&!E?.retryable,children:"Retry"}):null]}),t(kc,{}),t(Mt,{})]})},[Er.LINK_CONFLICT_SCREEN]:()=>{let{initiateAccountTransfer:e,closePrivyModal:r}=D(),{data:n,navigate:a,lastScreen:i,setModalData:o}=$r(),[l,s]=d(void 0),[c,u]=d(!1),[h,p]=d(!1),m=async()=>{try{if(!n?.accountTransfer?.nonce||!n?.accountTransfer?.account)throw Error("missing account transfer inputs");p(!0),await e({nonce:n?.accountTransfer?.nonce,account:n?.accountTransfer?.account,accountType:n?.accountTransfer?.linkMethod,externalWalletMetadata:n?.accountTransfer?.externalWalletMetadata,telegramAuthResult:n?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:n?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:n?.accountTransfer?.oAuthUserInfo}),u(!0),p(!1),setTimeout(r,1e3)}catch(e){o({errorModalData:{error:e,previousScreen:i||Er.LINK_CONFLICT_SCREEN}}),a(Er.ERROR_SCREEN,!0)}};return l?t(qd,{address:l,onClose:r,onRetry:()=>s(void 0),onTransfer:m,isTransferring:h,transferSuccess:c}):t(Kd,{onClose:r,onInfo:()=>s(n?.accountTransfer?.embeddedWalletAddress),onContinue:()=>s(n?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:h,transferSuccess:c,data:n})}},Pv=[Er.LANDING,Er.AWAITING_CONNECTION],Ov=({isMfaVerifying:n,onMfaVerificationComplete:a})=>{let{ready:i,isModalOpen:o}=F(),{headless:l}=We(),{ready:s,currentScreen:d}=$r(),{status:c,execute:u,reset:h,enabled:m}=Jl(),f=o&&d&&Pv.includes(d)&&!l&&"ready"===c;return p((()=>{f&&u()}),[f]),p((()=>{!o&&m&&h()}),[o,m]),i&&s||d===Er.AWAITING_OAUTH_SCREEN||d===Er.CROSS_APP_AUTH_SCREEN||d===Er.TELEGRAM_AUTH_SCREEN?!d&&n?t(Ly,{open:n,onClose:a}):d?e(r,{children:[t(Od,{$if:!!n,children:t(Iv[d],{})}),t(Od,{$if:!n,children:t(Ly,{open:n,onClose:a})})]}):null:e(r,{children:[t(yd,{}),t(Ac,{}),t(Nv,{children:t(Gt,{})}),t(kc,{}),t(Mt,{})]})},Rv=({isMfaVerifying:e,onMfaVerificationComplete:r})=>{let n=s(null);return t(Dv,{style:{height:tr(n)},id:"privy-modal-content",children:t("div",{ref:n,children:t(Ov,{isMfaVerifying:e,onMfaVerificationComplete:r})})})};const Mv=({open:e})=>{let{app:r}=$r(),{gracefulClosePrivyModal:n}=(()=>{let{closePrivyModal:e}=D(),{onUserCloseViaDialogOrKeybindRef:t}=$r();return{gracefulClosePrivyModal:m((()=>{if(!t?.current)return e({shouldCallAuthOnSuccess:!1});t.current()}),[e])}})(),[a,i]=d(!1);ed({onMfaRequired:()=>{r?.mfa.noPromptOnMfaRequired||i(!0)}});let o=e||a;return r.render.standalone?t(Tv,{children:t(Lv,{id:"privy-modal-content",children:t(Ov,{isMfaVerifying:a,onMfaVerificationComplete:()=>i(!1)})})}):t(xv,{open:o,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>n(),children:t(Tv,{children:t(Rv,{isMfaVerifying:a,onMfaVerificationComplete:()=>i(!1)})})})};let Lv=kr.div`
2956
+ `;let Ov={[Er.LANDING]:()=>{let{app:e}=$r();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?t(yg,{connectOnly:!1}):t(bg,{connectOnly:!1})},[Er.CONNECT_OR_CREATE]:()=>{let{app:e}=$r();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?t(yg,{connectOnly:!0}):t(bg,{connectOnly:!0})},[Er.AWAITING_PASSWORDLESS_CODE]:()=>{let{app:n,navigate:a,lastScreen:i,navigateBack:o,setModalData:l,onUserCloseViaDialogOrKeybindRef:s}=$r(),{closePrivyModal:c,resendEmailCode:u,resendSmsCode:h,getAuthMeta:m,loginWithCode:f,updateWallets:g,createAnalyticsEvent:y}=D(),{authenticated:w,logout:v,user:C}=F(),[$,E]=d(Bc),[T,x]=d(!1),[_,A]=d(null),[S,N]=d(null),[I,P]=d(0);s.current=()=>null;let O=m()?.email?0:1,R=Be-500;p((()=>{if(I){let e=setTimeout((()=>{P(I-1)}),1e3);return()=>clearTimeout(e)}}),[I]),p((()=>{if(w&&T&&C){if(n?.legal.requireUsersAcceptTerms&&!C.hasAcceptedTerms){let e=setTimeout((()=>{a(Er.AFFIRMATIVE_CONSENT_SCREEN)}),R);return()=>clearTimeout(e)}if(U(C,n?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),v()},callAuthOnSuccessOnClose:!0}}),a(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),R);return()=>clearTimeout(e)}{g();let e=setTimeout((()=>c({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be);return()=>clearTimeout(e)}}}),[w,T,C]),p((()=>{if(_&&0===S){let e=setTimeout((()=>{E(Bc),A(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[_]);let M=e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return A("Code should be numeric"),void N(1);A(null),N(null);let r=Number(e.currentTarget.name?.charAt(5)),n=[...t||[""]].slice(0,6-r),o=[...$.slice(0,r),...n,...$.slice(r+n.length)];E(o);let s=Math.min(Math.max(r+n.length,0),5);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${s}]`);e?.focus()}if(o.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${s}]`);e?.blur(),f(o.join("")).then((()=>x(!0))).catch((e=>{if(e instanceof L&&e.privyErrorCode===k.INVALID_CREDENTIALS)A("Invalid or expired verification code");else if(e instanceof L&&e.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE)A(e.message);else{if(e instanceof L&&e.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),void a(Er.USER_LIMIT_REACHED_SCREEN);if(e instanceof L&&e.privyErrorCode===k.USER_DOES_NOT_EXIST)return void a(Er.ACCOUNT_NOT_FOUND_SCREEN);if(e instanceof L&&e.privyErrorCode===k.LINKED_TO_ANOTHER_USER)return l({errorModalData:{error:e,previousScreen:i??Er.AWAITING_PASSWORDLESS_CODE}}),void a(Er.ERROR_SCREEN,!1);if(e instanceof L&&e.privyErrorCode===k.DISALLOWED_PLUS_EMAIL)return l({inlineError:{error:e}}),void a(Er.CONNECT_OR_CREATE,!1);if(e instanceof L&&e.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return l({accountTransfer:{nonce:e.data?.data?.nonce,account:0===O?m()?.email:m()?.phoneNumber,displayName:e.data?.data?.account?.displayName,linkMethod:0===O?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void a(Er.LINK_CONFLICT_SCREEN);A("Issue verifying code")}N(0)}))}},B=0==O?t(Kr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):t(Zr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),G=e("p",0==O?{children:["Please check ",t(Kc,{children:m()?.email})," for an email from privy.io and enter your code below."]}:{children:["Please check ",t(Kc,{children:m()?.phoneNumber})," for a message from ",n?.name||"Privy"," and enter your code below."]});return e(r,{children:[t(yd,{backFn:()=>o()},"header"),e(Gc,{children:[t(Rc,{title:"Enter confirmation code",description:G,icon:B}),e(bc,{children:[e(Hc,{children:[t(zc,{$fail:!!_,$success:T,children:t("span",{children:_||(T?"Success!":"")})}),t("div",{children:$.map(((e,r)=>t("input",{name:`code-${r}`,type:"text",value:$[r],onChange:M,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(1===S&&(A(null),N(null)),E([...$.slice(0,e),"",...$.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(r)},inputMode:"numeric",autoFocus:0===r,pattern:"[0-9]",className:`${T?"success":""} ${_?"fail":""}`,autoComplete:b?"one-time-code":"off"},r)))})]}),e(jc,{children:[e("span",{children:["Didn't get ",0==O?"an email":"a message","?"]}),I?e(qc,{children:[t(qr,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),t("span",{children:"Code sent"})]}):t(Vc,{children:t("button",{onClick:async()=>{P(30),0==O?await u():await h()},children:"Resend code"})})]})]})]}),t(Ot,{})]})},[Er.AWAITING_CONNECTION]:()=>{let n,[a,i]=d(!1),[o,l]=d(!1),[c,u]=d(void 0),{authenticated:h,logout:f}=F(),{app:g,navigate:y,navigateBack:w,lastScreen:v,currentScreen:C,setModalData:$,data:E}=$r(),{getAuthFlow:T,walletConnectionStatus:x,closePrivyModal:_,initLoginWithWallet:A,loginWithWallet:S,updateWallets:N,createAnalyticsEvent:I}=D(),{walletConnectors:P}=F(),[O,R]=d(0),{user:M}=F(),[L]=d(M?.linkedAccounts.length||0),[B,G]=d(""),[H,z]=d(""),[j,V]=d(!1),{hasTabbedAway:q}=function(){let[e,t]=d(!1),r=m((()=>{document.hidden&&t(!0)}),[]);return p((()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r))),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:K,token:Z}=Jl(),Y=b&&"wallet_connect_v2"===x?.connector?.connectorType||b&&"coinbase_wallet"===x?.connector?.connectorType||b&&"injected"===x?.connector?.connectorType&&"phantom"===x?.connector?.walletClientType,X="connected"===x?.status,Q="switching_to_supported_chain"===x?.status;p((()=>{let e=T(),t=e instanceof Ol||e instanceof Zl?e:void 0;X&&!t&&(!K||Z||h?A(x.connectedWallet,Z,E?.login?.disableSignup).then((()=>{V(!0)})):($({captchaModalData:{callback:e=>A(x.connectedWallet,e,E?.login?.disableSignup).then((()=>{V(!0)})),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_CONNECTION,onErrorNavigateTo:Er.ERROR_SCREEN}}),y(Er.CAPTCHA_SCREEN,!1))),t&&Y&&X&&!t.preparedMessage?t.buildMessage():t&&!Y&&X&&(o||(async()=>{l(!0),u(void 0);try{"wallet_connect_v2"===x?.connector?.connectorType&&"metamask"===x?.connector?.walletClientType&&await ze(2500),await ee()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{l(!1)}})())}),[O,X,j]),p((()=>{if(M&&a){let e=Be-500;if(g?.legal.requireUsersAcceptTerms&&!M.hasAcceptedTerms){let t=setTimeout((()=>{y(Er.AFFIRMATIVE_CONSENT_SCREEN)}),e);return()=>clearTimeout(t)}if(U(M,g?.embeddedWallets?.createOnLogin)){let t=setTimeout((()=>{$({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),I({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),f()},callAuthOnSuccessOnClose:!0}}),y(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),e);return()=>clearTimeout(t)}N();let t=setTimeout((()=>_({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be);return()=>clearTimeout(t)}}),[M,a]);let J=e=>{if(e?.privyErrorCode!==k.ALLOWLIST_REJECTED){if(e?.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),void y(Er.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode!==k.USER_DOES_NOT_EXIST)return e?.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?($({accountTransfer:{nonce:e.data?.data?.nonce,account:T()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:T()?.meta.walletClientType,chainId:T()?.meta.chainId,connectorType:T()?.meta.connectorType},linkMethod:"siwe",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void y(Er.LINK_CONFLICT_SCREEN)):void u(pu(e));y(Er.ACCOUNT_NOT_FOUND_SCREEN)}else y(Er.ALLOWLIST_REJECTION_SCREEN)};async function ee(){try{await S(),i(!0)}catch(e){J(e)}finally{l(!1)}}p((()=>{x?.connectError&&J(x?.connectError)}),[x]),((e,t)=>{let r=s((()=>{}));p((()=>{r.current=e})),p((()=>{if(null!==t){let e=setInterval((()=>r.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===te&&x?.connector instanceof Ms?x.connector.redirectUri:void 0;e&&G(e);let t="wallet_connect_v2"===te&&x?.connector instanceof Ms?x.connector.fallbackUniversalRedirectUri:void 0;t&&z(t)}),x?.connector instanceof Ms&&!B?500:null);let te=x?.connector?.connectorType||"injected",re=x?.connector?.walletClientType||"unknown",ne=Jc[re]?.displayName||x?.connector?.walletBranding.name||"Browser Extension",ae=Jc[re]?.logo||x?.connector?.walletBranding.icon||(e=>t(Es,{...e})),ie="Browser Extension"===ne?ne.toLowerCase():ne;n=a?`Successfully connected with ${ie}`:c?c.message:Q?"Switching networks":X?o&&Y?"Signing":"Sign to verify":`Waiting for ${ie}`;let oe="Don’t see your wallet? Check your other browser windows.";a?oe=L===(M?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":O>=2&&c?oe="Unable to connect wallet":c?oe=c.detail:Q?oe="Switch your wallet to the requested network.":X&&Y?oe="Sign the message in your wallet to verify it belongs to you.":"metamask"===re&&b?oe="Click continue to open and connect MetaMask.":"metamask"===re?oe="For the best experience, connect only one wallet at a time.":"wallet_connect"===te?oe="Open your mobile wallet app to continue":"coinbase_wallet"!==te||Ge()||(oe=Ls(M)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue.");let le=P?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),se="coinbase_wallet"===re&&(Ls(M)||c===pr.ERROR_USER_EXISTS);return e(r,{children:[t(yd,{backFn:v&&C!==v?w:void 0}),e(mu,{children:[t(gu,{walletLogo:ae,success:a,fail:!!c}),e(xc,{children:[t("h3",{children:n}),t("p",{children:oe}),X||!B||q?null:e("p",{children:["Still here?"," ",t("a",{href:B,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),H&&e(r,{children:[" ","or"," ",t("a",{href:H,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]})]}),se?t(rd,{onClick:()=>le&&le?.disconnect(),disabled:a,children:"Use a different wallet"}):c==pr.ERROR_USER_EXISTS&&C!==v?t(rd,{onClick:w,children:"Use a different wallet"}):X&&!a&&Y?t(rd,{onClick:()=>{l(!0),ee()},disabled:o,children:o?"Signing":"Sign with your wallet"}):!a&&c?.retryable&&O<2?t(rd,{onClick:()=>{R(O+1),u(void 0),X?(l(!0),ee()):x?.connectRetry()},disabled:!a&&(!c?.retryable||O>=2),children:"Retry"}):a||c?null:t(rd,{onClick:()=>{},disabled:!0,children:"Connecting"})]}),t(Mt,{})]})},[Er.AWAITING_CONNECT_ONLY_CONNECTION]:()=>{let n,{navigateBack:a,navigate:i,lastScreen:o,currentScreen:l,data:s,setModalData:c}=$r(),{walletConnectionStatus:u,closePrivyModal:h}=D(),[m,f]=d(void 0),[g,y]=d(0),w="connected"===u?.status,v="switching_to_supported_chain"===u?.status;p((()=>{if(w){let e;if(s?.externalConnectWallet?.onCompleteNavigateTo){let t=s.externalConnectWallet.onCompleteNavigateTo,r=u.connectedWallet?.address;e=setTimeout((()=>{s.funding&&c({...s,funding:{...s.funding,connectedWalletAddress:r}}),i(t({walletChainType:u.connector?.chainType}))}),Be)}else e=setTimeout(h,Be);return()=>clearTimeout(e)}}),[w]);p((()=>{u?.connectError&&(e=>{f(pu(e))})(u?.connectError)}),[u]);let C=u?.connector?.connectorType||"injected",$=u?.connector?.walletClientType||"unknown",E=Jc[$]?.displayName||u?.connector?.walletBranding.name||"Browser Extension",T=Jc[$]?.logo||u?.connector?.walletBranding.icon||(e=>t(Es,{...e})),x="Browser Extension"===E?E.toLowerCase():E;n=w?`Successfully connected with ${x}`:m?m.message:v?"Switching networks":`Waiting for ${x}`;let _="Don’t see your wallet? Check your other browser windows.";return w?_="You’re good to go!":g>=2&&m?_="Unable to connect wallet":m?_=m.detail:v?_="Switch your wallet to the requested network.":"metamask"===$&&b?_="Click to continue to open and connect MetaMask.":"metamask"===$?_="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===C?_="Open your mobile wallet app to continue":"coinbase_wallet"===C&&(_="Open the Coinbase app on your phone to continue."),e(r,{children:[t(yd,{backFn:l===o?void 0:a}),e(yu,{children:[t(gu,{walletLogo:T,success:w,fail:!!m}),e(xc,{children:[t("h3",{children:n}),t("p",{children:_})]}),m==pr.ERROR_USER_EXISTS?t(rd,{onClick:a,children:"Use a different wallet"}):!w&&m?.retryable&&g<2?t(rd,{onClick:()=>{y(g+1),f(void 0),u?.connectRetry()},disabled:!w&&(!m?.retryable||g>=2),children:"Retry"}):!w&&m&&g>=2?t(rd,{onClick:a,children:"Use a different wallet"}):null]}),t(Mt,{})]})},[Er.AWAITING_FARCASTER_CONNECTION]:()=>{let{authenticated:n,logout:a,ready:i,user:o}=F(),{lastScreen:l,navigate:c,navigateBack:u,setModalData:h,app:m}=$r(),{getAuthFlow:f,loginWithFarcaster:g,closePrivyModal:y,createAnalyticsEvent:w}=D(),[v,C]=d(void 0),[E,T]=d(!1),[x,_]=d(!1),A=s([]),S=f(),N=S?.meta.connectUri;return p((()=>{let e=Date.now(),t=setInterval((async()=>{let r=await S.pollForReady.execute(),n=Date.now()-e;if(r){clearInterval(t),T(!0);try{await g(),_(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===k.ALLOWLIST_REJECTED)return void c(Er.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),void c(Er.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===k.USER_DOES_NOT_EXIST)return void c(Er.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===k.LINKED_TO_ANOTHER_USER)t.detail=e.message??"This account has already been linked to another user.";else{if(e?.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return h({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:"farcaster",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,farcasterEmbeddedAddress:e.data?.data?.otherUser?.farcasterEmbeddedAddress}}),void c(Er.LINK_CONFLICT_SCREEN);e?.privyErrorCode===k.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===k.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}C(t)}}else n>12e4&&(clearInterval(t),C({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),A.current.forEach((e=>clearTimeout(e)))}}),[]),p((()=>{if(i&&n&&x&&o){if(m?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let e=setTimeout((()=>{c(Er.AFFIRMATIVE_CONSENT_SCREEN)}),Be);return()=>clearTimeout(e)}x&&(U(o,m?.embeddedWallets.createOnLogin)?A.current.push(setTimeout((()=>{h({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),c(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),Be)):A.current.push(setTimeout((()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be)))}}),[x,i,n,o]),e(r,b||E?{children:[t(yd,{backFn:l?u:void 0,onClose:y},"header"),t(Ac,{}),t(r,$?{children:e(cp,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:x,fail:!!v}),t(lp,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t(Xd,{children:v?v.message:"Sign in with Farcaster"}),t(Qd,{children:v?v.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),N&&t(rd,{onClick:e=>{e.preventDefault(),window.location.href=N},children:"Open Warpcast app"})]})}:{children:e(dp,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:x,fail:!!v}),t(lp,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t(Xd,{children:v?v.message:"Signing in with Farcaster"}),t(Qd,{children:v?v.detail:"This should only take a moment"}),t(Cc,{children:N&&b&&t(Yh,{text:"Take me to Warpcast",url:N,color:sp})})]})]})}),t(Mt,{})]}:{children:[t(yd,{backFn:l?u:void 0,onClose:y},"header"),t(Ac,{}),t(dp,{children:e("div",{children:[t(Xd,{children:"Sign in with Farcaster"}),t(Qd,{children:"Scan with your phone's camera to continue."}),t($c,{children:N?t(op,{url:N,size:275,squareLogoElement:lp}):t(Gt,{})}),e(Cc,{children:[t(Qd,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),N&&t(Kh,{text:N,itemName:"link",color:sp})]})]})}),t(Mt,{})]})},[Er.AWAITING_FARCASTER_SIGNER]:()=>{let{lastScreen:n,navigateBack:a,data:i,app:o}=$r(),{requestFarcasterSignerStatus:l,closePrivyModal:c}=D(),[u,h]=d(void 0),[m,f]=d(!1),[g,y]=d(!1),w=s([]),v=i?.farcasterSigner;p((()=>{let e=Date.now(),t=setInterval((async()=>{if(!v?.public_key)return clearInterval(t),void h({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===v.status&&(clearInterval(t),f(!1),y(!0),w.current.push(setTimeout((()=>c({shouldCallAuthOnSuccess:!1,isSuccess:!0})),Be)));let r=await l(v?.public_key),n=Date.now()-e;"approved"===r.status?(clearInterval(t),f(!1),y(!0),w.current.push(setTimeout((()=>c({shouldCallAuthOnSuccess:!1,isSuccess:!0})),Be))):n>3e5?(clearInterval(t),h({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):"revoked"===r.status&&(clearInterval(t),h({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))}),2e3);return()=>{clearInterval(t),w.current.forEach((e=>clearTimeout(e)))}}),[]);let C="pending_approval"===v?.status?v.signer_approval_url:void 0;return e(r,b||m?{children:[t(yd,{backFn:n?a:void 0,onClose:c},"header"),t(Ac,{}),t(r,$?{children:e(pp,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:g,fail:!!u}),t(lp,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t(Xd,{children:u?u.message:"Add a signer to Farcaster"}),t(Qd,{children:u?u.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),C&&t(rd,{onClick:e=>{e.preventDefault(),window.location.href=C},children:"Open Warpcast app"})]})}:{children:e(hp,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:g,fail:!!u}),t(lp,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t(Xd,{children:u?u.message:"Requesting signer from Farcaster"}),t(Qd,{children:u?u.detail:"This should only take a moment"}),t(Cc,{children:C&&b&&t(Yh,{text:"Take me to Warpcast",url:C,color:up})})]})]})}),t(Mt,{})]}:{children:[t(yd,{backFn:n?a:void 0,onClose:c},"header"),t(Ac,{}),t(hp,{children:e("div",{children:[t(Xd,{children:"Add a signer to Farcaster"}),e(Qd,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),t($c,{children:"pending_approval"===v?.status?t(op,{url:v.signer_approval_url,size:275,squareLogoElement:lp}):t(Gt,{})}),e(Cc,{children:[t(Qd,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),"pending_approval"===v?.status&&t(Kh,{text:v.signer_approval_url,itemName:"link",color:up})]})]})}),t(Mt,{})]})},[Er.AWAITING_PASSKEY_SYSTEM_DIALOGUE]:()=>{let{lastScreen:n,currentScreen:a,navigateBack:i}=$r(),{loginWithPasskey:o,closePrivyModal:l}=D(),[c,u]=d("loading"),[h,m]=d(null),f=s([]);p((()=>()=>{f.current.forEach((e=>clearTimeout(e))),f.current=[]}),[]);let g=async()=>{u("loading");try{await o(),u("success")}catch(e){m(e),u("error")}};return p((()=>{"success"===c&&(e=>{f.current=[e,...f.current]})(setTimeout((()=>{l({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),Be))}),[c]),p((()=>{g()}),[]),e(r,{children:[t(yd,{backFn:n&&a!==n?i:void 0}),e(By,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:"success"===c,fail:"error"===c}),t(dm,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t("h3",{children:(()=>{switch(c){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})()}),t("p",{style:{whiteSpace:"pre-wrap"},children:(()=>{switch(c){case"loading":return"Please follow prompts to verify your passkey.\nYou will have to sign up with another method first to register a passkey for your account.";case"success":return"You've successfully logged in with your passkey.";case"error":if(h instanceof S){if(h.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(h.privyErrorCode===k.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()})]}),(()=>{switch(c){case"loading":case"success":return t(rd,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return t(rd,{onClick:g,disabled:!1,children:"Retry"})}})()]}),t(Mt,{})]})},[Er.PHANTOM_INTERSTITIAL_SCREEN]:()=>{let{forkSession:n,ready:a,authenticated:i}=F(),{walletConnectionStatus:o}=D(),[l,s]=d(""),[c,u]=d(!1);p((()=>{a&&i&&n().then(s)}),[a,i]);let h=((e,t,r)=>{let n=encodeURIComponent(new URL(window.location.href).href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=${r?"solana_adapter":"injected"}&privy_wallet_client=${r?"phantom_solana":"phantom"}`);if(!Ee()&&b)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${n}?ref=${n}`})(l,!c,"solana"===o?.connector?.chainType),m={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return a&&(m.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",m.footnote="Once you're done, you can always return here and refresh to view your updated account."),c&&(m.title="Still here?",m.description="You may need to install the Phantom mobile app.",m.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Oc,{title:m.title,description:m.description}),e(vc,{children:[t(Gy,{children:t(xs,{style:{width:"72px",height:"72px"}})}),t(id,{href:h,onClick:()=>{setTimeout((()=>u(!0)),1e3)},loading:a&&!h,children:c?"Go to App Store":"Continue"}),m.footnote?t("p",{children:m.footnote}):null]}),t(kc,{}),t(Ot,{})]})},[Er.LOGIN_FAILED_SCREEN]:()=>{let{closePrivyModal:n}=D(),{navigate:a}=$r();return e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Ag,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),t(Oc,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),e(vc,{children:[t(rd,{onClick:()=>a(Er.LANDING),children:"Try again"}),t(ld,{onClick:()=>n(),children:"Cancel"})]}),t(kc,{}),t(Ot,{})]})},[Er.AWAITING_OAUTH_SCREEN]:()=>{let{authenticated:n,logout:a,ready:i,user:o}=F(),{app:l,setModalData:s,navigate:c,resetNavigation:u}=$r(),{getAuthMeta:h,initLoginWithOAuth:m,loginWithOAuth:f,updateWallets:g,setReadyToTrue:y,closePrivyModal:w,createAnalyticsEvent:v}=D(),[C,b]=d(!1),[$,E]=d(void 0),T=h()?.provider||"google",{name:x,component:_}=kl(T),A=Or();p((()=>{f(T).then((e=>{b(!0),y(!0),e&&A("login","onOAuthLoginComplete",e)})).catch((e=>{if(y(!1),e?.privyErrorCode===k.ALLOWLIST_REJECTED)return E(void 0),u(),void c(Er.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),E(void 0),u(),void c(Er.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===k.USER_DOES_NOT_EXIST)return E(void 0),u(),void c(Er.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return E(void 0),u(),s({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:h()?.provider,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void c(Er.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=function(e,t){let r={detail:"",retryable:!1},n=gl(t);if(e?.privyErrorCode===k.LINKED_TO_ANOTHER_USER&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode===k.INVALID_CREDENTIALS&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode===k.OAUTH_USER_DENIED&&(r.detail=`Retry and check ${n} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode===k.TOO_MANY_REQUESTS&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===k.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let e=kl(t).name;r.detail=`Request limit reached for ${e}. Please wait a moment and try again.`}if(e?.privyErrorCode===k.OAUTH_ACCOUNT_SUSPENDED){let e=kl(t).name;r.detail=`Your ${e} account is suspended. Please try another login method.`}return e?.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode===k.OAUTH_UNEXPECTED&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}(e,T);E({retryable:t,detail:r,message:"Authentication failed"})})).finally((()=>{Nl()}))}),[x,T]),p((()=>{if(i&&n&&C&&o){if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let e=setTimeout((()=>{c(Er.AFFIRMATIVE_CONSENT_SCREEN)}),Be);return()=>clearTimeout(e)}if(U(o,l?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{s({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:T,screen:"OAuthStatusScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),c(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),Be);return()=>clearTimeout(e)}{let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be);return g(),()=>clearTimeout(e)}}}),[i,n,C,o]);let S=C?`Successfully connected with ${x}`:$?$.message:`Verifying connection to ${x}`,N="";return N=C?"You’re good to go!":$?$.detail:"Just a few moments more",e(r,{children:[t(yd,{}),t(Ac,{}),e(Wy,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:C,fail:!!$}),t(_,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t("h3",{children:S}),t("p",{children:N})]}),$&&$?.retryable?t(dd,{onClick:()=>{Nl(),m(T),E(void 0)},disabled:!C&&!$?.retryable,children:"Retry"}):null]}),t(kc,{}),t(Mt,{})]})},[Er.CROSS_APP_AUTH_SCREEN]:()=>{let n=We(),{data:a,navigate:i,setModalData:o,onUserCloseViaDialogOrKeybindRef:l}=$r(),{crossAppAuthFlow:s,updateWallets:u,closePrivyModal:h,createAnalyticsEvent:m}=D(),{logout:f}=Ut(),[g,y]=d({}),w=a?.crossAppAuth,v={id:w.appId,name:w.name,logoUrl:w.logoUrl},C=new _(`There was an issue connecting your ${v.name} account. Please try again.`),b=new Il((async e=>{if(w.popup)try{let t=await s({appId:e,popup:w.popup,action:w.action});y({data:t})}catch(e){e instanceof _?y({error:e}):(e instanceof L&&w.popup&&w.popup.close(),y({error:C}))}else y({error:C})})),$=()=>{g.data&&(u(),w.onSuccess(g.data),h({shouldCallAuthOnSuccess:!0,isSuccess:!0})),w.onError(g.error??new _("User canceled flow")),h({shouldCallAuthOnSuccess:!1,isSuccess:!1})};l.current=$,p((()=>{v.id.length&&b.execute(v.id)}),[v.id]),p((()=>{if(!g.data)return;let e=g.data;if(n.legal.requireUsersAcceptTerms&&!e.hasAcceptedTerms){let e=setTimeout((()=>{i(Er.AFFIRMATIVE_CONSENT_SCREEN)}),Be);return()=>clearTimeout(e)}if(U(e,n.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{o({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),m({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${v.id}`,screen:"CrossAppAuthScreen"}}),f()},callAuthOnSuccessOnClose:!0}}),i(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),Be);return()=>clearTimeout(e)}let t=setTimeout($,Be);return()=>clearTimeout(t)}),[g.data]);let{title:E,subtitle:T}=c((()=>g.data?{title:`Successfully connected with ${v.name}`,subtitle:"You're good to go!"}:g.error?{title:"Authentication failed",subtitle:g.error.message}:{title:`Connecting to ${v.name}`,subtitle:`Please check the pop-up from ${v.name} to continue`}),[g,v.name]);return e(r,{children:[t(yd,{onClose:$}),t(Ac,{}),e(vu,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:!!g.data,fail:!!g.error}),t(wu,{name:v.name,logoUrl:v.logoUrl})]})}),e(xc,{children:[t("h3",{children:E}),t("p",{children:T})]})]}),t(kc,{}),t(Mt,{})]})},[Er.ALLOWLIST_REJECTION_SCREEN]:()=>{let{navigate:n,app:a}=$r(),i=a?.allowlistConfig.errorTitle||"You don't have access to this app",o=a?.allowlistConfig.errorDetail||"Have you been invited?",l=a?.allowlistConfig.errorCtaText||"Try another account";return e(r,{children:[t(yd,{}),e(yc,{children:[t(Td,{children:e("div",{children:[t(Ld,{}),t(gc,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),e(wc,{children:[t("string"==typeof i?"h3":r,{children:i}),t("string"==typeof o?"p":r,{children:o})]}),a?.allowlistConfig.errorCtaLink?t(rd,{as:"a",href:a.allowlistConfig.errorCtaLink,children:l}):t(rd,{onClick:()=>{n(Er.LANDING)},children:l})]})]})},[Er.ACCOUNT_NOT_FOUND_SCREEN]:()=>{let{navigate:n,app:a}=$r();return e(r,{children:[t(yd,{}),e(Rd,{children:[t(Td,{children:e("div",{children:[t(hd,{color:"var(--privy-color-warn-light)"}),t(Dr,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),e(Md,{children:[t("h3",{children:"Account not found"}),e("p",{children:["Please try logging in again or go to ",a.name," to create an account."]})]}),t(xd,{}),t(rd,{onClick:()=>n(Er.LANDING),children:"Try logging in again"})]})]})},[Er.USER_LIMIT_REACHED_SCREEN]:()=>{let{navigate:n}=$r();return e(r,{children:[t(yd,{}),e($v,{children:[t(Ev,{children:t(bv,{})}),e(Tv,{children:[t("h3",{children:"Unable to sign in"}),t("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),t(rd,{onClick:()=>{n(Er.LANDING)},children:"Go back"})]}),t(Ot,{})]})},[Er.INSTALL_PHANTOM_SCREEN]:()=>{let{navigateBack:n}=$r();return e(r,{children:[t(yd,{backFn:n},"header"),t(Ac,{}),t(Ff,{}),t(kc,{}),e(Mt,{children:[t("span",{children:"Still not sure? "}),t("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},[Er.LINK_EMAIL_SCREEN]:()=>{let{app:n}=$r();return e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Rc,{title:"Connect your email",description:`Add your email to your ${n?.name} account`,icon:t(Kr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),t(vc,{children:t(Yf,{stacked:!0})}),t(kc,{}),t(Ot,{})]})},[Er.LINK_PHONE_SCREEN]:()=>{let{app:n,currentScreen:a,data:i,navigate:o,setModalData:l}=$r(),{initLoginWithSms:s}=D();return e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Rc,{title:"Connect your phone",description:`Add your number to your ${n?.name} account`,icon:t(Zr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),t(vc,{children:t(og,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{await s({phoneNumber:e,withPrivyUi:!0}),o(Er.AWAITING_PASSWORDLESS_CODE)}catch(e){l({errorModalData:{error:e,previousScreen:i?.errorModalData?.previousScreen||a||Er.LINK_PHONE_SCREEN}}),o(Er.ERROR_SCREEN)}},hideRecent:!0})}),t(kc,{}),t(Ot,{})]})},[Er.LINK_WALLET_SCREEN]:()=>{let{app:n,data:a}=$r(),i=a?.externalConnectWallet?.suggestedAddress,o=i?e("span",{children:["Link the wallet with address ",t(Pt,{showCopyIcon:!1,address:i})," ",n?.name?`to ${n.name}.`:"."]}):`Link a wallet to your ${n?.name} account`;return e(r,{children:[t(yd,{},"header"),t(Oc,{title:"Link your wallet",description:o}),t(Ad,{children:t(uu,{connectOnly:!1})}),t(Ot,{})]})},[Er.LINK_PASSKEY_SCREEN]:()=>{let{user:n,unlinkPasskey:a}=F(),{linkWithPasskey:i,closePrivyModal:o}=D(),l=n?.linkedAccounts.filter((e=>"passkey"===e.type)),[s,c]=d(!1),[u,h]=d(""),[m,f]=d(!1),[g,y]=d(!1);p((()=>{0===l.length&&y(!1)}),[l.length]);let w=async e=>(c(!0),await a(e).then((()=>f(!0))).catch((e=>{e instanceof S&&e.privyErrorCode===k.MISSING_MFA_CREDENTIALS?h("Cannot unlink a passkey enrolled in MFA"):h("Unknown error occurred.")})).finally((()=>{c(!1)})));return e(r,m?{children:[t(yd,{onClose:()=>o()},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Qr,{})}),t(ym,{style:{marginBottom:"1.5rem"},children:"Passkeys updated"}),t(wm,{children:" "}),t(nc,{children:t(rd,{onClick:()=>o(),children:"Done"})}),t(Mt,{})]}:g?{children:[t(yd,{backFn:()=>y(!1),onClose:()=>o()},"header"),t(cm,{passkeys:l,expanded:g,onUnlink:w,onExpand:()=>y(!0)}),t(Mt,{})]}:{children:[t(yd,{onClose:()=>o()},"header"),t(Yd,{children:e(hm,{children:[t(sm,{}),t(dm,{})]})}),t(ym,{children:"Secure your account with a passkey"}),t(vm,{}),0===l.length?t(um,{}):t(cm,{passkeys:l,expanded:g,onUnlink:w,onExpand:()=>y(!0)}),e(nc,{style:{marginTop:"12px"},children:[u&&t(pm,{$fail:!0,children:u}),t(rd,{onClick:()=>{c(!0),i().then((()=>f(!0))).catch((e=>{if(e instanceof S){if(e.privyErrorCode===k.CANNOT_LINK_MORE_OF_TYPE)return void h("Cannot link more passkeys to account.");if(e.privyErrorCode===k.PASSKEY_NOT_ALLOWED)return void h("Passkey request timed out or rejected by user.")}h("Unknown error occurred.")})).finally((()=>{c(!1)}))},loading:s,children:"Add new passkey"})]}),t(Mt,{})]})},[Er.UPDATE_EMAIL_SCREEN]:()=>e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Rc,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:t(Kr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),t(vc,{children:t(wv,{stacked:!0})}),t(kc,{}),t(Ot,{})]}),[Er.UPDATE_PHONE_SCREEN]:()=>{let{currentScreen:n,data:a,navigate:i,setModalData:o}=$r(),{user:l}=F(),{initUpdatePhone:s}=D();return e(r,{children:[t(yd,{},"header"),t(Ac,{}),t(Rc,{title:"Update your phone number",description:"Add the phone number you'd like to use going forward. We'll send you a confirmation code",icon:t(Zr,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),t(vc,{children:t(og,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{if(!l?.phone?.number)throw Error("User is required to have an phone number to update it.");await s(l?.phone?.number,e),i(Er.AWAITING_PASSWORDLESS_CODE)}catch(e){o({errorModalData:{error:e,previousScreen:a?.errorModalData?.previousScreen||n||Er.LINK_PHONE_SCREEN}}),i(Er.ERROR_SCREEN)}},hideRecent:!0})}),t(kc,{}),t(Ot,{})]})},[Er.CONNECT_ONLY_LANDING_SCREEN]:()=>{let{app:n,data:a}=$r(),i=a?.externalConnectWallet?.suggestedAddress,o=i?e("span",{children:["Connect the wallet with address ",t(Pt,{showCopyIcon:!1,address:i})," ",n?.name?`to ${n.name}.`:"."]}):`Connect a wallet to your ${n?.name} account`;return e(r,{children:[t(yd,{},"header"),t(Pc,{title:"Connect your wallet",description:o}),t(Ad,{children:t(uu,{connectOnly:!0})}),n&&t(Ft,{app:n,alwaysShowImplicitConsent:!0}),t(Ot,{})]})},[Er.CONNECT_ONLY_AUTHENTICATED_SCREEN]:()=>{let{app:n,data:a}=$r(),i=a?.externalConnectWallet?.suggestedAddress,o=i?`Connect the wallet with address ${He(i)} ${n?.name?`to ${n.name}.`:"."}`:`Connect a wallet to ${n?.name}`;return e(r,{children:[t(yd,{},"header"),t(Oc,{title:"Connect your wallet",description:o}),t(Ad,{children:t(uu,{connectOnly:!0})}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN]:()=>{let{app:n,setModalData:a,navigate:i,data:o,onUserCloseViaDialogOrKeybindRef:l}=$r(),[s,c]=d(""),{embeddedWallets:u}=We(),{authenticated:h,user:m}=F(),{closePrivyModal:f}=D(),{onSuccess:g,onFailure:y,callAuthOnSuccessOnClose:w}=o.createWallet,v=!0===n?.embeddedWallets.requireUserOwnedRecoveryOnCreate,{createWallet:C}=Qu(),[b,$]=d(null),E=new Il((async()=>{try{let e=await C({user:m});if(!e)return;$(e),i(Er.EMBEDDED_WALLET_CREATED_SCREEN)}catch(e){c(e.message)}}));return p((()=>h&&m?v?(a({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}}),i(Uu({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:u.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void E.execute():(i(Er.LANDING),void y(Error("User must be authenticated before creating a Privy wallet")))),[v,h]),l.current=()=>null,s?e(r,{children:[t(yd,{closeable:!1}),e(Ec,{children:[t(Xr,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),t(Rc,{title:"Something went wrong",description:s})]}),t(rd,{onClick:()=>{b?(g(b),f({shouldCallAuthOnSuccess:w})):(y(new z("User wallet creation failed")),f({shouldCallAuthOnSuccess:!1}))},children:"Close"}),t(Ju,{})]}):t(Tu,{})},[Er.EMBEDDED_WALLET_CREATED_SCREEN]:()=>{let{user:n}=F(),{closePrivyModal:a,isNewUserThisSession:i,updateWallets:o}=D(),{app:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=$r(),{onSuccess:c,onFailure:u,callAuthOnSuccessOnClose:h}=s.createWallet,m=()=>{let e=G(n);e?(o(),c(e)):u(Error("Failed to create wallet")),a({shouldCallAuthOnSuccess:h})};return p((()=>{let e=setTimeout(m,je);return()=>clearTimeout(e)}),[]),d.current=m,e(r,{children:[t(yd,{onClose:m}),t(Ac,{}),e(Ec,{children:[t(Yr,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),t(Rc,{title:i?"Welcome"+(l?.name?` to ${l?.name}`:""):"All set!",description:i?"You’ve successfully created an account.":"Your account is secured."})]}),t(kc,{}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_CONNECTING_SCREEN]:()=>{let{authenticated:n,user:a,getAccessToken:i}=F(),{closePrivyModal:o,createAnalyticsEvent:l,walletProxy:s}=D(),{navigate:u,data:h,setModalData:m,onUserCloseViaDialogOrKeybindRef:f}=$r(),g=c((()=>Date.now()),[]),[y,w]=d(!1),{onCompleteNavigateTo:v,onFailure:C,shouldForceMFA:b,entropyId:$,entropyIdVerifier:E}=h?.connectWallet,T=e=>{y||(w(!0),C("string"==typeof e?Error(e):e))};p((()=>{let e,t=B(a,$);return n&&t?s?((async()=>{let r=await i();if(!r)return T("User must be authenticated and have a Privy wallet before it can be connected");try{await s.connect({accessToken:r,entropyId:$,entropyIdVerifier:E}),b&&await s.verifyMfa({accessToken:r});let t=(Date.now()-g)/1e3;v===Er.EMBEDDED_WALLET_KEY_EXPORT_SCREEN&&t<1?e=setTimeout((()=>{u(v,!1)}),1e3*(1-t)):u(v,!1)}catch(e){if(Pu(e)&&"privy"===t.recoveryMethod){let e=await i();if(!e)return T("User must be authenticated and have a Privy wallet before it can be recovered");try{l({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:t.address}});let r=await(s?.recover({accessToken:e,entropyId:$,entropyIdVerifier:E}));r?.entropyId||T(Error("Unable to recover wallet")),v?u(v):o({shouldCallAuthOnSuccess:!1}),l({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}}),u(v)}catch(e){T("An error has occurred, please try again.")}}else Pu(e)&&"privy"!==t.recoveryMethod?(m({...h,recoverWallet:{entropyId:$,entropyIdVerifier:E,onCompleteNavigateTo:v,onFailure:C},recoveryOAuthStatus:{provider:t.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}}),u(Wu(t.recoveryMethod))):T(e)}})(),()=>clearTimeout(e)):void 0:T("User must be authenticated and have a Privy wallet before it can be connected")}),[n,a,s]);let x=()=>{T("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return f.current=x,e(r,{children:[t(yd,{onClose:x}),y?e(r,{children:[e(Ec,{children:[t(Xr,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),t(Rc,{title:"Something went wrong",description:"We’re on it. Please try again later."})]}),t(rd,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):t(Tu,{}),t(Hu,{})]})},[Er.EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN]:()=>{let[n,a]=d(!0),{authenticated:i,getAccessToken:o,user:l}=F(),{walletProxy:s,closePrivyModal:c,createAnalyticsEvent:u}=D(),{navigate:h,data:m,onUserCloseViaDialogOrKeybindRef:f}=$r(),[g,y]=d(void 0),[w,v]=d(""),[C,b]=d(!1),{entropyId:$,entropyIdVerifier:E,onCompleteNavigateTo:T,onSuccess:x,onFailure:_}=m.recoverWallet,A=(e="User exited before their wallet could be recovered")=>{c({shouldCallAuthOnSuccess:!1}),_("string"==typeof e?new z(e):e)};f.current=A,p((()=>{if(!i)return A("User must be authenticated and have a Privy wallet before it can be recovered")}),[i]);return e(r,{children:[t(yd,{onClose:A}),t(Ac,{}),e(zy,{children:[e(Hy,{children:[t(jn,{height:48,width:48,stroke:"var(--privy-color-accent)"}),t("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),t("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),e("div",{children:[e(lh,{children:[t(ih,{type:n?"password":"text",onChange:e=>(e=>{e&&y(e)})(e.target.value),disabled:C,style:{paddingRight:"2.3rem"}}),t(hh,{style:{right:"0.75rem"},children:n?t(mh,{onClick:()=>a(!1)}):t(fh,{onClick:()=>a(!0)})})]}),!!w&&t(jy,{children:w})]}),e("div",{children:[e(_c,{children:[t("h4",{children:"Why is this necessary?"}),t("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),t(Vy,{loading:C||!s,disabled:!g,onClick:async()=>{b(!0);let e=await o(),t=B(l,$);if(!e||!t||null===g)return A("User must be authenticated and have a Privy wallet before it can be recovered");try{u({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t.address}}),await(s?.recover({accessToken:e,entropyId:$,entropyIdVerifier:E,recoveryPassword:g})),v(""),T?h(T):c({shouldCallAuthOnSuccess:!1}),x?.(t),u({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}})}catch(e){!function(e){return Iu(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?v("An error has occurred, please try again."):v("Invalid recovery password, please try again.")}finally{b(!1)}},warn:!1,hideAnimations:!$&&C,children:"Recover your account"})]})]}),t(kc,{}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN]:()=>{let[n,a]=d(!1),{navigate:i,lastScreen:o,navigateBack:l,setModalData:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=$r(),{user:h}=F(),{embeddedWallets:p}=We(),{closePrivyModal:m}=D(),f=j(h),g=null===f,{isInAccountCreateFlow:y,isResettingPassword:w}=c.recoverySelection,v=f&&"privy"!==f.recoveryMethod,C=v?e("span",{children:["Your account is currently secured using"," ",t("strong",{children:Jy[f?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function b(e){s({recoveryOAuthStatus:{provider:e,action:g?"create-wallet":"set-recovery",isInAccountCreateFlow:y}}),i(Er.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN)}function $(){c?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),m({shouldCallAuthOnSuccess:c?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return u.current=$,e(r,{children:[t(yd,{onClose:$,backFn:n?()=>a(!1):o?l:void 0,infoFn:o||n?void 0:()=>a(!0)},"header"),n?t(ew,{onClose:()=>a(!1)}):e(r,{children:[t(Rc,{title:v?"Update backup method":"Secure your account",icon:t(aa,{width:48}),description:C}),t(Zy,{children:p.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(f?.recoveryMethod||"")||e!==f?.recoveryMethod)).sort().map((r=>{switch(r){case"google-drive":return e(Id,{onClick:()=>b("google-drive"),children:[t(Qy,{children:t(Ky,{style:{width:18}})}),"Back up to Google Drive"]},r);case"icloud":return e(Id,{onClick:()=>b("icloud"),children:[t(Qy,{children:t(qy,{style:{width:24}})}),"Back up to Apple iCloud"]},r);case"user-passcode":return e(Id,{onClick:()=>{i(Fu({isCreatingWallet:g,skipSplashScreen:!0}))},children:[t(Qy,{children:t(ia,{style:{width:18}})}),w?"Reset your":"Set a"," password"]},r);default:return null}}))})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN]:()=>{let{user:n,getAccessToken:a}=F(),{walletProxy:i,refreshUser:o,closePrivyModal:l}=D(),s=$r(),{entropyId:c,entropyIdVerifier:u}=s.data?.recoverWallet,[h,p]=d(!1),[m,f]=d(null),[g,y]=d(null);function w(){if(!h){if(g)return s.data?.setWalletPassword?.onFailure(g),void l();if(!m)return s.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void l()}}s.onUserCloseViaDialogOrKeybindRef.current=w;let v=!(!h&&!m);return e(r,g?{children:[t(yd,{onClose:w},"header"),t(tw,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:t(Br,{height:38,width:38,stroke:"var(--privy-color-error)"})}),t(qu,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),t(xd,{style:{minHeight:"2rem"}}),t(nd,{onClick:()=>y(null),children:"Try again"}),t(Ot,{})]}:{children:[t(yd,{onClose:w},"header"),t(aa,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),t(qu,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),t(Vu,{style:{marginTop:"1rem"},children:"When you log into a new device, you’ll only need to authenticate to access your account. Never get logged out if you forget your password."}),t(xd,{style:{minHeight:"2rem"}}),t(nd,{loading:h,disabled:v,onClick:()=>async function(){p(!0);try{let e=await a(),t=B(n,c);if(!e||!i||!t)return;if(!(await i.setRecovery({accessToken:e,entropyId:c,entropyIdVerifier:u,existingRecoveryMethod:t.recoveryMethod,recoveryMethod:"privy"})).entropyId)throw Error("Unable to set recovery on wallet");let r=await o();if(!r)throw Error("Unable to set recovery on wallet");let d=B(r,t.address);if(!d)throw Error("Unabled to set recovery on wallet");f(!!r),setTimeout((()=>{s.data?.setWalletPassword?.onSuccess(d),l()}),Be)}catch(e){y(e)}finally{p(!1)}}(),children:m?"Success":"Confirm"}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN]:()=>{let{logout:n}=F(),{navigate:a,setModalData:i,data:o}=$r(),{recoveryOAuthFlow:l,closePrivyModal:s,createAnalyticsEvent:c}=D(),[u,h]=d(!1),{provider:f,action:g,isInAccountCreateFlow:y}=o?.recoveryOAuthStatus,[w,v]=d(void 0),[C,b]=d("create-wallet"===g);if("user-passcode"===f)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let $=Xy[f].name,E=Xy[f].component,T=o?.recoverWallet?.onCompleteNavigateTo,x=new Il((async(e="create-wallet")=>(b(!0),new Promise(((t,r)=>{setTimeout((async()=>{try{let r=window.open();await l(f,e,r),h(!0),t()}catch(t){v({message:`${"recover"===e?"Recovery":"Back up"} with ${$} unsuccessful`,detail:"recover"===g?`Please verify that you are selecting the ${$} account associated with your backup.`:"",retryable:!0}),r()}}),0)})))));p((()=>{"recover"!==g&&x.execute(y?"create-wallet":"set-recovery")}),[]),p((()=>{if(!u)return;let e=setTimeout((()=>{y?(i({createWallet:{onSuccess:()=>{},onFailure:e=>{c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),a(Er.EMBEDDED_WALLET_CREATED_SCREEN)):s({shouldCallAuthOnSuccess:!1})}),Be);return()=>clearTimeout(e)}),[u]);let _=m((async()=>{await x.execute("recover"),T?a(T):h(!0)}),[]),A="google-drive"===f?"Google Drive":"Apple iCloud",k=u&&`Successfully ${"recover"===g?"recovered":"backed up"} with ${A}.`||w&&w.message||`${"recover"===g?"Recovering":"Backing up"} with ${A}...`,S=w?w.detail:"";return e(r,{children:[t(yd,{}),C?t(r,{children:e(Zy,{children:[t(Rc,{title:k,icon:t(E,{style:{width:"38px",height:"38px"}}),description:S}),w&&w?.retryable?t(rd,{onClick:()=>{Nl(),v(void 0),"create-wallet"===g?x.execute("create-wallet"):_()},disabled:!u&&!w?.retryable,children:"Try again"}):null]})}):e(Zy,{children:[t(Rc,{title:"Confirm it's really you",icon:t(E,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${A} where your account is backed up.`}),e(rd,{onClick:_,children:["Confirm with ",A]})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_KEY_EXPORT_SCREEN]:()=>{let[n,a]=d(null),{authenticated:i,user:o,getAccessToken:l}=F(),{closePrivyModal:s,createAnalyticsEvent:c,clientAnalyticsId:u}=D(),h=We(),{data:m,onUserCloseViaDialogOrKeybindRef:f}=$r(),{onFailure:g,onSuccess:y,origin:w,appId:v,appClientId:C,walletToExport:b,primaryWallet:$}=m.keyExport,E=e=>{s({shouldCallAuthOnSuccess:!1}),g("string"==typeof e?Error(e):e)},T=()=>{s({shouldCallAuthOnSuccess:!1}),y(),c({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:b.address}})};return p((()=>{if(!i||!b)return E("User must be authenticated before exporting their wallet");l().then(a,E)}),[i,o]),f.current=T,e(r,{children:[t(yd,{onClose:T}),e(Zu,{children:[t(qu,{children:"Transfer wallet"}),e(Vu,{children:["Either copy your private key or seed phrase to transfer your wallet."," ",t("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),t(zu,{theme:h.appearance.palette.colorScheme,children:"Never share your private key or seed phrase with anyone."}),t(Wt,{isLoading:!1,isPulsing:!1,title:"Your wallet",address:b.address,showIcon:!0}),t("div",{style:{width:"100%"},children:n&&t(Ku,{origin:w,appId:v,appClientId:C,accessToken:n,clientAnalyticsId:u,walletToExport:b,primaryWallet:$,dimensions:{height:"44px"}})})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN]:()=>{let{authenticated:n}=F(),{initializeWalletProxy:a,closePrivyModal:i}=D(),{navigate:o,data:l,onUserCloseViaDialogOrKeybindRef:s}=$r(),[c,u]=d(!0),[h,m]=d(""),[f,g]=d(),[y,w]=d(null),[v,C]=d(!1),b=null!==y;p((()=>{n||o(Er.LANDING)}),[n]),p((()=>{a(qe).then((e=>{u(!1),e||(m("An error has occurred, please try again."),g(new mr(new gr(h,yr.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:$,data:E,confirmAndSign:T,onSuccess:x,onFailure:_,uiOptions:A}=l.signMessage,k={title:A.title||"Sign message",description:A.description||"Signing this message will not cost you any fees.",buttonText:A.buttonText||"Sign and continue"},S=e=>{e?x(e):_(f||new mr(new gr("The user rejected the request.",yr.E4001_USER_REJECTED_REQUEST.eipCode))),i({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{w(null),m(""),g(void 0)}),200)};return s.current=()=>{S(y)},e(r,{children:[t(yd,{onClose:()=>S(y)}),t(Ac,{}),A.iconUrl&&"string"==typeof A.iconUrl?t(fv,{children:t(ov,{size:"sm",src:A.iconUrl,alt:"app image"})}):null,t(qu,{children:k.title}),t(Vu,{children:k.description}),"personal_sign"===$&&t(uv,{children:lv(E)}),"eth_signTypedData_v4"===$&&t(cv,{typedData:E}),"solana_signMessage"===$&&t(uv,{children:E}),t(gv,{}),t(pv,{$fail:!0,children:h}),t(nd,{disabled:v||b||c,loading:v,onClick:async()=>{C(!0),m("");try{let e=await T();w(e),C(!1),setTimeout((()=>{S(e)}),Be)}catch(e){console.error(e),m("An error has occurred, please try again."),g(new mr(new gr(h,yr.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),C(!1)}},children:v?"Signing...":b?e(mv,{children:[t(qh,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",t("span",{children:"Success"})]}):k.buttonText}),t(kc,{}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN]:()=>{let e,{data:r,onUserCloseViaDialogOrKeybindRef:n,setModalData:a,navigate:i}=$r(),{rpcConfig:o,chains:l,closePrivyModal:s,walletProxy:u}=D(),{getAccessToken:h,user:m}=F(),f=We(),[g,y]=d(0),w=(e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(r),[v,C]=d(iv(r,g)),[b,$]=d(null),[E,T]=d(),[x,_]=d(!1),[A,k]=d(null),[S,N]=d(null);if(!v||!r?.sendTransaction||!r?.sendTransaction.transactingWallet)return t(zh,{error:Error("Invalid transaction request"),onClick:()=>{r?.sendTransaction?.onFailure(av),s({shouldCallAuthOnSuccess:!1})}});let{entropyId:I,entropyIdVerifier:P,transactingWallet:O}=r.sendTransaction,R=c((()=>l.find((e=>Number(e.id)===Number(v.chainId)))),[v.chainId]),M=R?.nativeCurrency.symbol??"ETH",L=c((()=>ev(v.data,!!f.embeddedWallets.extendedCalldataDecoding)),[v.data]),{action:U,isErc20Ish:W,isNFTIsh:B}=L;p((()=>{v.to&&R&&W&&nf({address:v.to,chain:R,rpcConfig:f.rpcConfig,privyAppId:f.id}).then($).catch(console.error)}),[v.to,R]);let{tokenPrice:G,isTokenPriceLoading:H}=bp(v.chainId),z=c((()=>ye(Number(v.chainId),l,o,{appId:f.id})),[v.chainId,o]),j=nv(v,O,z);p((()=>{C(iv(r,g))}),[g]),p((()=>{r.sendTransaction?.getIsSponsored?r.sendTransaction.getIsSponsored().then(T).catch(console.error):T(!1)}),[r.sendTransaction.getIsSponsored]);let V=()=>{if(!x)return A?r?.sendTransaction?.onSuccess(A.response):S||j?.errors[0]?r?.sendTransaction?.onFailure(S??j?.errors[0]??av):r?.sendTransaction?.onFailure(new mr(new gr("The user rejected the request",yr.E4001_USER_REJECTED_REQUEST.eipCode))),s({shouldCallAuthOnSuccess:!1})};n.current=V;let q=!!(r.funding&&r.funding.supportedOptions.length>0),K="fiat-currency"===f.embeddedWallets.priceDisplay.primary,Z=kt(j?.tx.value??0).add(kt(j?.totalGasEstimate?.toBigInt()??0)).toHexString(),Y=Vt(Z,M),X=K&&G?Yt(Z,G):void 0,Q=Vt(j?.totalGasEstimate?.toString()??0,M),J=K&&G?Yt(j?.totalGasEstimate?.toString()??0,G):void 0,ee=Vt(j?.balance?.toString()??0,M,void 0,!0),te=K&&G?Yt(j?.balance?.toString()??0,G):void 0,re=r.sendTransaction?.uiOptions?.transactionInfo?.title;re||(re="approve"===U?W?"Confirm address":"Confirm action":`Approve ${U}`);let ne=r.sendTransaction?.uiOptions?.description||`${f.name} wants your permission to approve the following transaction.`,ae=r.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?t("img",{src:r.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:r.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,ie=!(!j||j.errors[0]||j.hasFunds||!1!==E),oe=ie&&q,le=oe?"Add funds":r.sendTransaction?.uiOptions?.buttonText||(g<w?"Continue":"Approve");if(A?.receipt)return t(Hw,{txn:j?.tx??v,onClose:V,receipt:A.receipt,transactionInfo:r.sendTransaction?.uiOptions.transactionInfo,tokenPrice:G,tokenSymbol:M,l1GasEstimate:j?.l1ExecutionFeeEstimate?.toString(),receiptHeader:r.sendTransaction?.uiOptions.successHeader,receiptDescription:r.sendTransaction?.uiOptions.successDescription});if(S)return t(mw,{transactionError:S,network:"ethereum",chainId:j?.tx.chainId??v.chainId,onClose:V,onRetry:({resetNonce:e})=>{N(null);let t={...j?.tx??v};e&&(t.nonce=void 0),C(t)}});let se=0!==w&&"number"==typeof g&&0!==g?()=>{y(g-1)}:void 0;return"amount"in L&&L.amount&&(L.isNFTIsh?e=L.amount.toString():b&&(e=Hm({amount:L.amount,decimals:b.decimals}))),t(ow,{transactionIndex:g,onBack:se,maxIndex:w,disabled:ie&&!q,isSubmitting:x,submitError:S,isPreparing:!j,isTokenPriceLoading:H,isTokenContractInfoLoading:!B&&!b,prepareError:j?.errors[0],symbol:b?.symbol,chain:R,img:ae,title:re,subtitle:ne,total:v.value?X??Y:void 0,txValue:v.value,fee:J??Q,isSponsored:E,from:O?.address??"",to:v.to,network:f.chains.find((e=>e.id===v.chainId))?.name??"",transactionDetails:{...L,formattedAmount:e},cta:le,missingFunds:ie,action:U,balance:te??ee,onClose:V,onClick:oe?async()=>{if(!O)return;if(!q)throw Error("Funding wallet is not enabled");let e=Er.FUNDING_METHOD_SELECTION_SCREEN;a({...r,funding:{...r.funding,methodScreen:e,chainType:"ethereum",amount:En(BigInt(j?.tx.value??0)+BigInt(j?.totalGasEstimate?.toString()??0)),chain:R}}),i(e)}:async()=>{if(g<w)y(g+1);else{_(!0);try{let e=await h();if(x||!e||!O||!u||!m)return;let t=r?.sendTransaction?.onConfirm?await r.sendTransaction.onConfirm().then((e=>z.getTransaction(e))):await Uw({accessToken:e,transactingWallet:O,entropyId:I,entropyIdVerifier:P,walletProxy:u,transactionRequest:j?.tx??v,provider:z,requesterAppId:r.sendTransaction?.requesterAppId}),n=await t.wait();k({receipt:Bw(n),response:t})}catch(e){console.warn({transaction:j?.tx??v,error:e}),N(e)}finally{_(!1)}}}})},[Er.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN]:()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:a}=$r(),{closePrivyModal:i,walletProxy:o}=D(),l=We(),{user:s,getAccessToken:c}=F(),[u,h]=d(e?.sendSolanaTransaction?.transactionRequest),[m,f]=d(),[g,y]=d(),[w,v]=d(0),[C,b]=d(!1),[$,E]=d(),[T,x]=d(null),_=e?.sendSolanaTransaction?.connection,A=e?.sendSolanaTransaction?.transactingWallet,k=m?.instructions.at(w),S=m?.instructions.length??1,N=Sp(_?.rpcEndpoint||""),I=j(s);if(p((()=>{!async function(){if(u&&_)try{y(void 0);let e=await Bp(u,_);f(e),v(0)}catch(e){console.warn("Failed to prepare transaction",e),y(e)}}()}),[u,_]),!(u&&e?.sendSolanaTransaction&&A&&_)){let r=Error("Invalid transaction request");return t(zh,{error:r,onClick:()=>{e?.sendSolanaTransaction?.onFailure(r),i({shouldCallAuthOnSuccess:!1})}})}let{solPrice:O,isSolPriceLoading:R}=Cp(),M=()=>{if(!C)return $?e?.sendSolanaTransaction?.onSuccess($):(e?.sendSolanaTransaction?.onFailure(T??g??Error("User exited the modal before submitting the transaction")),v(0)),i({shouldCallAuthOnSuccess:!1})};r.current=M;let L="fiat-currency"===l.embeddedWallets.priceDisplay.primary,U=e.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===k?.action?"Confirm address":"Approve transaction"),W=e.sendTransaction?.uiOptions?.description||`${l.name} wants your permission to approve the following transaction.`,B=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?t("img",{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,G=k?.amount||0n,H=0===w&&m?.fees||0n,z=k?.balance||0n,V=k?.from,q=k?.to,K=G+H,Z=Op(K),Y=L&&O?Rp(K,O):void 0,X=H?Op(H):void 0,Q=L&&O?Rp(H,O):void 0,J=z?Op(z):void 0,ee=L&&O?Rp(z,O):void 0,te=!g&&!k?.hasFunds,re=!!(e.funding&&e.funding.supportedOptions.length>0),ne=te&&re,ae=ne?"Add funds":e.sendTransaction?.uiOptions?.buttonText||"Approve";return $?t(Dw,{instructions:m?.instructions.map((({from:e,to:t,amount:r})=>({from:e.toBase58(),to:t.toBase58(),amount:r})))??[],fees:0===w?$.fees:0n,onClose:M,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,solPrice:O,receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription,rpcEndpoint:_.rpcEndpoint}):T?t(mw,{transactionError:T,connection:_,onClose:M,network:"solana",onRetry:async()=>{x(null);let{blockhash:e}=await _.getLatestBlockhash();Lp(u)?u.message.recentBlockhash=e:u.recentBlockhash=e,h(u)}}):t(ow,{isSubmitting:C,submitError:T,isPreparing:!m,isTokenPriceLoading:R,isTokenContractInfoLoading:!1,symbol:"SOL",chain:void 0,img:B,title:U,subtitle:W,from:V?.toBase58()||"",to:q?.toBase58(),fee:Q??X,total:null!=G?Y??Z:void 0,txValue:G,spender:k?.spender?.toBase58(),network:N,cta:ae,missingFunds:te,action:k?.action,balance:ee??J,prepareError:g,chainName:"Solana",onClose:M,onClick:ne?async()=>{if(!A)return;if(!re)throw Error("Funding wallet is not enabled");let t=Er.FUNDING_METHOD_SELECTION_SCREEN;n({...e,funding:{...e.funding,methodScreen:t}}),a(t)}:async()=>{if(w<(m?.instructions.length??1)-1)v(w+1);else try{b(!0);let t=await c();if(C||!t||!A||!o||!s||!I)return;let{entropyId:r,entropyIdVerifier:n}=P(I),{signature:a,receipt:i}=await nw({tx:u,accessToken:t,connection:_,walletProxy:o,entropyId:r,entropyIdVerifier:n,transactingWalletAddress:A.address,transactingWalletIndex:A.walletIndex??0,transactionOptions:e.sendSolanaTransaction?.transactionOptions});E(Wp(a,i))}catch(e){console.warn({transaction:u,error:e}),x(e)}finally{b(!1)}},isSponsored:!1,transactionIndex:w,maxIndex:S-1,disabled:te&&!re,onBack:w>0&&S>1?()=>v(w-1):void 0})},[Er.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN]:()=>{let{app:n,data:a}=$r(),{closePrivyModal:i}=D(),[o,l]=d(!1),[s,c]=d(),{address:u,onDelegate:h,onSuccess:m,onError:f}=a.delegatedActions.consent,g=async()=>{o?m():f(s??new _("User declined delegating actions.")),i({shouldCallAuthOnSuccess:!1})};return p((()=>{if(!o&&!s)return;let e=setTimeout(g,je);return()=>clearTimeout(e)}),[o,s]),e(r,o||s?{children:[t(yd,{onClose:g}),t(Ac,{}),e(bc,{children:[s?t(Hr,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):t(Qr,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Nc,{height:20}),t(Rc,{title:s?"Something went wrong":"Success!",description:s?"Please try again.":`You’ve successfully granted delegated action permissions to ${n.name}.`})]}),t(kc,{}),t(Ot,{})]}:{children:[t(yd,{closeable:!0,onClose:g}),t(Cu,{width:56,height:56,style:{margin:"auto"}}),t(Xd,{style:{marginTop:24,color:"var(--privy-color-foreground)"},children:"Enable delegated actions"}),e(Qd,{style:{marginBottom:24,textWrap:"pretty"},children:["Give ",n.name," permissions to transact on your behalf. You can revoke this later."," ",t("a",{style:{color:"var(--privy-color-accent-dark)"},href:"https://www.privy.io/using-privy",target:"_blank",children:"Learn more"})]}),t($u,{showIcon:!0,address:u,title:"Wallet",isLoading:!1}),e(bu,{style:{marginTop:24},children:[t(ld,{onClick:g,children:"Not now"}),t(rd,{onClick:async()=>{try{await h(),l(!0)}catch(e){c(e)}},children:"Accept"})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_DELEGATED_ACTIONS_REVOKE_SCREEN]:()=>{let{app:n,data:a}=$r(),{closePrivyModal:i}=D(),[o,l]=d(!1),[s,c]=d(),{onRevoke:u,onSuccess:h,onError:m}=a.delegatedActions.revoke,f=async()=>{o?h():m(s??new _("User declined revoking access to their delegated wallet.")),i({shouldCallAuthOnSuccess:!1})};return p((()=>{if(!o&&!s)return;let e=setTimeout(f,je);return()=>clearTimeout(e)}),[o,s]),e(r,o||s?{children:[t(yd,{onClose:f}),t(Ac,{}),e(bc,{children:[s?t(Hr,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):t(Qr,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Nc,{height:20}),t(Rc,{title:s?"Something went wrong":"Success!",description:s?"Please try again.":"You've successfully revoked permissions."})]}),t(kc,{}),t(Ot,{})]}:{children:[t(yd,{closeable:!0,onClose:f}),t(Cu,{width:56,height:56,style:{margin:"auto"}}),t(Xd,{style:{marginTop:24},children:"Revoke permission"}),e(Qd,{children:["Revoke permission for ",n.name," to transact on your behalf."]}),e(Eu,{style:{marginTop:24},children:[t(ld,{onClick:f,children:"Deny"}),t(rd,{onClick:async()=>{try{await u(),l(!0)}catch(e){c(e)}},children:"Confirm"})]}),t(Ot,{})]})},[Er.FUNDING_METHOD_SELECTION_SCREEN]:()=>{let{wallets:a}=st(),{wallets:i}=fr(),{navigate:o,data:l,setModalData:s}=$r(),d=We(),{client:u}=D(),h=l?.funding,m=rf(bf),f=rf($f),g="solana"===h.chainType,y=g?void 0:h;p((()=>{y?.erc20Address&&!y.erc20ContractInfo&&nf({address:y.erc20Address,chain:y.chain,rpcConfig:d.rpcConfig,privyAppId:d.id}).then((e=>s({...l,funding:{...y,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}}))).catch(console.error)}),[y?.erc20Address,y?.chain]);let w=g?i.find((({address:e})=>e===h.address)):a.find((({address:e})=>n(e)===n(h.address))),v=w&&"privy"!==w.walletClientType?eu(w.walletClientType,w.connectorType,w.walletClientType):d.name,C=!(!y?.erc20Address||y?.erc20ContractInfo),b=h.isUSDC?"USDC":y?.erc20Address?void 0:"native-currency",$=!!g||b&&((e,t)=>{switch(t){case"native-currency":return pf.has(e);case"USDC":return mf.has(e);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}})(Number(h.chain.id),b),E=!!g||b&&((e,t)=>{switch(t){case"native-currency":return of.has(e);case"USDC":return lf.has(e);default:return console.warn("Unknown asset passed to Coinbase Onramp"),!1}})(Number(h.chain.id),b),T=c((()=>{let e=[];for(let t of l?.funding?.supportedOptions??[])"card"===t.method&&"coinbase"===t.provider&&E&&e.push((()=>uf(u,h,s,o,l,"buy"))),"card"===t.method&&"moonpay"===t.provider&&$&&b&&e.push((()=>vf(u,h,d,b,s,o,l,"credit_debit_card")));return e}),[l?.funding?.supportedOptions,$,E,b]),x=c((()=>{for(let e of l?.funding?.supportedOptions??[])if("exchange"===e.method&&"coinbase"===e.provider&&E)return()=>uf(u,h,s,o,l,"buy")}),[l?.funding?.supportedOptions,$,E,b]),_=c((()=>{for(let e of l?.funding?.supportedOptions??[])if("wallets"===e.method)return()=>o(Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN)}),[l?.funding?.supportedOptions]);return e(r,{children:[t(mp,{}),e("h3",{children:["Add funds to your"," ",v?.toLowerCase().endsWith("wallet")?v:v+" wallet"]}),e(_m,{children:[h.errorMessage&&t(Ym,{theme:d.appearance.palette.colorScheme,children:h.errorMessage}),T[0]&&e(Id,{disabled:C,onClick:T[0],children:[t(Am,{children:t(Un,{style:{width:24}})}),"Pay with card",m?t(ef,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):f?t(tf,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):null]}),x&&e(Id,{disabled:C,onClick:x,children:[t(Am,{children:t(Dn,{style:{width:24}})}),"Transfer from an exchange"]}),_&&e(Id,{disabled:C,onClick:_,children:[t(Am,{children:t(Qt,{style:{width:24}})}),"Transfer from wallet"]}),e(Id,{disabled:C,onClick:()=>o(Er.FUNDING_MANUAL_TRANSFER_SCREEN),children:[t(Am,{children:t(Wn,{style:{width:24}})}),"Receive funds"]}),h?.showAlternateFundingMethod&&T[1]&&t(Qm,{theme:d.appearance.palette.colorScheme,children:e(Lm,{children:["Having trouble or facing location restrictions?"," ",t(Dm,{onClick:T[1],children:"Try a different provider."})]})})]}),t(Ot,{})]})},[Er.MOONPAY_STATUS_SCREEN]:()=>{let{app:n,data:a,navigateBack:i}=$r(),{closePrivyModal:o}=D(),{externalTransactionId:l}=a?.moonpayStatus,s=wf(l||null,n.fundingMethodConfig.moonpay.useSandbox??!1);return e(r,{children:[t(yd,{title:"Fund account",backFn:i}),t(_f,{status:s,onClickCta:o}),t(Ot,{})]})},[Er.COINBASE_ONRAMP_STATUS_SCREEN]:()=>{let{data:n,setModalData:a,navigate:i}=$r(),{closePrivyModal:o,createAnalyticsEvent:l,client:c}=D(),[u,h]=d("pending-in-flow"),m=s(0),f=n?.funding,g=n?.coinbaseOnrampStatus;if(!g)throw Error("Screen mounted without correct data");let{partnerUserId:y,popup:w}=g;return p((()=>{if("pending-in-flow"===u||"pending-after-flow"===u){let e=setInterval((async()=>{if(y)try{let{status:e}=await c.getCoinbaseOnRampStatus({partnerUserId:y});if("success"===e)return void h("success");if("failure"===e)throw Error("There was an error completing Coinbase Onramp flow.");if(m.current>=3)return a({funding:{...f,showAlternateFundingMethod:!0}}),void i(Er.FUNDING_METHOD_SELECTION_SCREEN);w.closed&&(m.current=m.current+1,h("pending-after-flow"))}catch(e){console.error(e),h("error"),l({eventName:$p,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),a({funding:{...f,errorMessage:"Something went wrong adding funds. Please try again or use another method."}}),i(Er.FUNDING_METHOD_SELECTION_SCREEN)}}),1500);return()=>clearInterval(e)}}),[y,w,u]),e(r,{children:[t(yd,{title:"Fund account"},"header"),t(Vm,{status:u,onClickCta:o}),t(Ot,{})]})},[Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:()=>{let n,{connectors:a}=D(),{app:i,setModalData:o,data:l,navigate:s}=$r(),{wallets:c}=st(),{wallets:u}=fr(),[h,m]=d("default"),f="solana"===l?.funding?.chainType,g=!!l?.funding?.crossChainBridgingEnabled;n="ethereum"===l?.funding?.chainType?l.funding.erc20Address?"ethereum-only":g&&!l.funding.chain.testnet?"ethereum-and-solana":"ethereum-only":g?"ethereum-and-solana":"solana-only";let y=c.filter((e=>"privy"!==e.walletClientType)),w=y.map((e=>e.walletClientType)),v=u.filter((e=>"privy"!==e.walletClientType)),C=v.map((e=>e.walletClientType)),b=[],$=({address:e,walletChainType:t})=>{o({...l,funding:{...l.funding,connectedWalletAddress:e,onContinueWithExternalWallet:()=>s(T({destChainType:f?"solana":"ethereum",sourceChainType:t}))}}),s(Er.FUNDING_EDIT_AMOUNT_SCREEN)};"solana-only"!==n&&b.push(...y.map(((e,r)=>t(If,{onClick:()=>$({address:e.address,walletChainType:"ethereum"}),icon:e.meta.icon,name:e.meta.name},r)))),"ethereum-only"!==n&&b.push(...v.map(((e,r)=>t(If,{onClick:()=>$({address:e.address,walletChainType:"solana"}),icon:e.meta.icon,name:e.meta.name},r)))),b.push(...hu({walletList:i.appearance.walletList.filter((e=>!y.some((t=>t.walletClientType===e))&&!v.some((t=>t.walletClientType===e)))),walletChainType:n,connectors:a,connectOnly:!0,ignore:[...i.appearance.walletList,...w,...C],walletConnectEnabled:i.externalWallets.walletConnect.enabled}));let E=t(Nf,{text:"More wallets",onClick:()=>m("overflow")}),T=({sourceChainType:e,destChainType:t})=>"ethereum"===e&&"solana"===t?Er.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN:"ethereum"===e&&"ethereum"===t?Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN:"solana"===e&&"ethereum"===t?Er.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN:Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN;return p((()=>{o({...l,externalConnectWallet:{onCompleteNavigateTo:({walletChainType:e})=>(o({...l,funding:{...l.funding,onContinueWithExternalWallet:()=>{s(T({destChainType:f?"solana":"ethereum",sourceChainType:e??"ethereum"}))}}}),Er.FUNDING_EDIT_AMOUNT_SCREEN)}})}),[]),e(r,"overflow"===h?{children:[t(yd,{backFn:()=>m("default")},"header"),e(Ad,{children:[t(Vu,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),b]}),t(Ot,{})]}:{children:[t(mp,{}),t(Rc,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),e(Ad,{children:[b.length>4?b.slice(0,3):b,b.length>4&&E]}),t(Ot,{})]})},[Er.FUNDING_EDIT_AMOUNT_SCREEN]:()=>{let{data:n,setModalData:a}=$r(),i=n?.funding,o="solana"===i.chainType,l=s(null),[c,u]=d(!1),{tokenPrice:h}=bp(o?"solana":i.chain.id);p((()=>{l.current&&l.current.style.setProperty("--funding-input-length",Math.max(i.amount.length,1).toString())}),[i.amount,l.current]);let m=o?void 0:i,f=!(!m?.erc20Address||m?.erc20ContractInfo),g=o?"SOL":i.erc20Address?i.erc20ContractInfo?.symbol:i.chain.nativeCurrency.symbol||"ETH",y=parseFloat(i.amount),w=!isNaN(y)&&y>0,v=h?Kt(i.amount,h):void 0;return e(r,{children:[t(mp,{}),t(qu,{children:"Confirm or edit amount"}),e(Tc,{style:{marginTop:"32px"},children:[t(km,{children:f?t(fp,{size:"50px"}):e(r,{children:[e(Sm,{onClick:()=>l.current?.focus(),children:[t(Im,{ref:l,value:i.amount,onFocus:()=>u(!0),onBlur:()=>u(!1),onChange:e=>{let t=e.target.value;/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1&&a({...n,funding:{...i,amount:t}})}}),t(Om,{children:g}),!c&&t(Pm,{children:t(Fn,{width:12,height:12})})]}),!m?.erc20Address&&t(Rm,{children:v&&w?v:""})]})}),t(fm,{onClick:()=>{l.current?.focus()},children:"Edit amount"}),t(nd,{style:{marginTop:"1rem"},disabled:!w,onClick:i.onContinueWithExternalWallet,children:"Continue"})]}),t(Ot,{})]})},[Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:()=>{let{rpcConfig:n,appId:a,closePrivyModal:i,createAnalyticsEvent:o}=D(),{navigate:l,setModalData:s,app:c,data:u}=$r(),{wallets:h}=st(),[m,f]=d(!1),[g,y]=d(0n),[w,v]=d(!1),[C,b]=d(null),[$,E]=d(null),[T,x]=d([]),[A,S]=d(0),[N,I]=d(!1),[P,O]=d(!1),[R,M]=d(!1),[L,F]=d(!1);if(!u?.funding||"ethereum"!==u.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:U,chain:W,amount:B,connectedWalletAddress:G}=u.funding,H=u.funding.address,z=u.funding.erc20Address;p((()=>{z&&!U&&b(Error("Unable to fetch token details"))}),[]);let j=!!z&&!!U,V=j?BigInt(parseFloat(B)*10**U.decimals):vn(B),q=G?h.find((({address:e})=>e===G)):h[0],[K,Z]=d(null);p((()=>{(async()=>{if(!q)return;let e=await q.getEthereumProvider();Z(gn({account:q.address,transport:yn(e)}).extend(wn))})().catch(console.error)}),[q]);let[Y,X]=d(0n);p((()=>{mn({chain:W,transport:fn(Qe(W,n,a))}).getBalance({address:H}).then(X).catch(console.error)}),[]);let[Q,J]=d(0n);p((()=>{j&&zm({chain:W,address:H,appId:a,rpcConfig:n,erc20Address:z}).then((e=>J(e.balance))).catch(console.error)}),[]);let{tokenPrice:ee}=bp(W.id),[te,re]=d({to:H,chain:W,value:V,data:void 0});p((()=>{(async()=>{let e,t;if(!K||!q||N||R)return;I(!0);let r=mn({chain:te.chain,transport:fn(Qe(te.chain,n,a))});if(j&&!te.data)return await r.simulateContract({address:z,chain:te.chain,abi:Bm,functionName:"transfer",args:[H,V],account:q.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(I(!1),void re({to:z,chain:te.chain,data:Cn({abi:Bm,functionName:"transfer",args:[H,V]}),value:"0x0"})):(I(!1),void v(!0));try{e=await r.prepareTransactionRequest({account:q.address,to:te.to,chain:te.chain,data:te.data,value:BigInt(te.value??0)})}catch(e){if(console.error(e),T.length>1)E(e.shortMessage??"Something went wrong");else if(P&&0===T.length)return void b(new _(`Wallet ${He(q.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE))}if(!e)return I(!1),void v(!0);I(!1),M(!0),f(!0),y(e.gas);try{await K.switchChain({id:te.chain.id})}catch(e){await K.addChain({chain:te.chain}),await K.switchChain({id:te.chain.id})}try{t=await K.sendTransaction(e),o({eventName:$p,payload:{provider:"external",status:"success",address:q.address,chainId:te.chain.id,value:te.value?.toString(),txHash:t}})}catch(e){if(console.error(e),"TransactionExecutionError"===e.name)if(T.length<1){let t=e.shortMessage;(e.shortMessage.includes("rejected the request")||e.details.includes("rejected the request"))&&(t="User rejected the request."),b(new _(t,void 0,k.TRANSACTION_FAILURE))}else E(e.shortMessage??"Something went wrong")}t?(await K.waitForTransactionReceipt({hash:t}),M(!1),F(!0)):M(!1)})().catch(console.error)}),[K,te]),p((()=>{(async()=>{if(!w||!K||!q)return;let e=Ye(c.chains).filter((e=>e.id!==W.id&&!!e.testnet==!!W.testnet));j&&e.unshift(W);let t=await Gp({chains:e,address:q.address,appId:a,rpcConfig:n}),r=j?t.filter((e=>e.balance>0n)):t.filter((e=>e.balance>V));if(r.length<1)return void b(new _(`Wallet ${He(q.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));r.sort(((e,t)=>Number(t.balance-e.balance)));let i=(await Promise.allSettled(r.map((async e=>({quote:await xp({isTestnet:!!W.testnet,input:Tp({amount:V.toString(),user:q.address,recipient:H,destinationChainId:W.id,destinationCurrency:z,originChainId:e.chain.id})}),...e}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(i.length<1)return void b(new _(`Wallet ${He(q.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));let o=i.map((e=>({bridgeTx:_p(e.quote),balance:e.balance,chain:e.chain}))).filter((e=>!!e.bridgeTx));if(o.length>1)return void x(o);let l=o[0];l?(O(!0),re({data:l.bridgeTx.data,to:l.bridgeTx.to,value:l.bridgeTx.value,chain:l.chain})):b(new _(`Wallet ${He(q.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE))})().catch(console.error)}),[w]),p((()=>{if(!C)return;let e={error:C,previousScreen:Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN};s({funding:u?.funding,sendTransaction:u?.sendTransaction,errorModalData:e}),l(Er.ERROR_SCREEN,!1)}),[C]);let ne=q?eu(q.walletClientType,q.connectorType,q.walletClientType)||"wallet":null,ae=!j&&ee?Kt(u?.funding?.amount??"0",ee):void 0,ie=j?g:Zt([g,V]),oe=ie&&ee?Yt(ie,ee):void 0,le=ie?Vt(ie,"ETH"):void 0,se=g&&ee?Yt(g,ee):void 0,de=g?Vt(g,"ETH"):void 0;if(p((()=>{if(!L)return;let e=setTimeout(i,dt);return()=>clearTimeout(e)}),[L]),L)return e(r,{children:[t(mp,{}),t(Ac,{}),e(Ec,{children:[t(Qr,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Rc,{title:"Success!",description:`You’ve successfully added ${B} ${j?U.symbol:W.nativeCurrency.symbol} to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),t(kc,{}),t(Ot,{})]});let ce=j?`${Hm({amount:Q,decimals:U.decimals})} ${U.symbol}`:Vt(Y,W.nativeCurrency.symbol,3,!0),ue=T[A];return T.length>1&&ue?t(Fm,{displayName:ne,configuredFundingChain:W,formattedBalance:ce,fundingAmount:B,fundingCurrency:j?U.symbol:W.nativeCurrency.symbol,fundingAmountInUsd:ae,options:T,selectedOption:ue,isPreparing:N,isSubmitting:R,errorMessage:$,onSubmit:()=>{re({to:ue.bridgeTx.to,data:ue.bridgeTx.data,value:ue.bridgeTx.value,chain:ue.chain})},onSelect:e=>{e!==A&&(E(null),S(e))}}):m&&g&&q&&u?.funding?t(Um,{wallet:q,displayName:ne,addressToFund:H,isBridging:P,isErc20Flow:j,totalPriceInUsd:oe,totalPriceInNativeCurrency:le,gasPriceInUsd:se,gasPriceInNativeCurrency:de,chainId:W.id,chainName:W.name}):e(r,{children:[t(mp,{}),t(fp,{}),t("div",{style:{marginTop:"1rem"}}),t(Ot,{})]})},[Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN]:()=>{let{closePrivyModal:n,createAnalyticsEvent:a}=D(),{navigate:i,setModalData:o,app:l,data:c}=$r(),{wallets:u}=fr(),[h,m]=d(0n),[f,g]=d(null),[y,w]=d(!1),[v,C]=d(!1),b=s(!1);if(!c?.funding||"solana"!==c.funding.chainType)throw Error("Invalid funding data");let{address:$,amount:E,cluster:T,connectedWalletAddress:x}=c.funding,A=Ip(T),{tokenPrice:S}=bp("solana"),{fundingAmountInBaseUnit:N,totalPriceInUsd:I,totalPriceInNativeCurrency:P,feePriceInNativeCurrency:O,feePriceInUsd:R}=Mp({amount:E,fee:h,tokenPrice:S}),M=x?u.find((({address:e})=>e===x)):u[0];if(p((()=>{(async()=>{if("solana"!==M?.type||!M.sendTransaction||y||b.current)return;b.current=!0;let{Connection:e,PublicKey:t,SystemProgram:r,Transaction:n}=await import("@solana/web3.js"),i=new t(M.address),o=new n;o.add(r.transfer({fromPubkey:i,toPubkey:new t($),lamports:N}));let l=new e(A),s=await l.getLatestBlockhash();o.recentBlockhash=s.blockhash,o.feePayer=i;let d=await o.getEstimatedFee(l);null!=d&&m(BigInt(d)),w(!0);try{let e=await l.simulateTransaction(o);if(e.value.err)return e.value.logs?.find((e=>/Transfer: insufficient lamports/gi.test(e)))?void g(new _(`Wallet ${He(M.address,void 0,void 0,"solana")} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",e.value.err),void g(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE)));let t=await M.sendTransaction(o,l);a({eventName:$p,payload:{provider:"external",status:"success",address:M.address,value:N.toString(),txHash:t,chainType:"solana",rpcEndpoint:A}}),w(!1),C(!0)}catch(e){if(console.error(e),w(!1),/user rejected the request/gi.test(e.message||""))return void g(new _("Transaction was rejected by the user",void 0,k.TRANSACTION_FAILURE));g(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE))}})().catch(console.error).finally((()=>b.current=!1))}),[]),p((()=>{if(!f)return;let e={error:f,previousScreen:Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN};o({funding:c?.funding,sendTransaction:c?.sendTransaction,errorModalData:e}),i(Er.ERROR_SCREEN,!1)}),[f]),p((()=>{if(!v)return;let e=setTimeout(n,dt);return()=>clearTimeout(e)}),[v]),v)return e(r,{children:[t(mp,{}),t(Ac,{}),e(Ec,{children:[t(Qr,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Rc,{title:"Success!",description:`You’ve successfully added ${E} SOL to your ${l.name} wallet. It may take a minute before the funds are available to use.`})]}),t(kc,{}),t(Ot,{})]});let L=M?eu(M.walletClientType,M.connectorType,M.walletClientType)||"wallet":null;return M&&y?t(Um,{wallet:M,displayName:L,addressToFund:$,isBridging:!1,isErc20Flow:!1,totalPriceInUsd:I,totalPriceInNativeCurrency:P,gasPriceInUsd:R,gasPriceInNativeCurrency:O,chainId:"solana",chainName:T.name}):e(r,{children:[t(mp,{}),t(fp,{}),t("div",{style:{marginTop:"1rem"}}),t(Ot,{})]})},[Er.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN]:()=>{let{rpcConfig:n,appId:a,closePrivyModal:i,createAnalyticsEvent:o}=D(),{navigate:l,setModalData:s,app:c,data:u}=$r(),{wallets:h}=st(),[m,f]=d(null),[g,y]=d(null),[w,v]=d([]),[C,b]=d(0),[$,E]=d(!1),[T,x]=d(!1),[A,S]=d(!1),[N,I]=d(!1);if(!u?.funding||"solana"!==u.funding.chainType)throw Error("Invalid funding data");let{address:P,cluster:O,amount:R,connectedWalletAddress:M}=u.funding,L=M?h.find((({address:e})=>e===M)):h[0],[F,U]=d(null);p((()=>{(async()=>{if(!L)return;let e=await L.getEthereumProvider();U(gn({account:L.address,transport:yn(e)}).extend(wn))})().catch(console.error)}),[L]);let[W,B]=d(0n),G=Op(W);p((()=>{(async()=>{let{Connection:e,PublicKey:t}=await import("@solana/web3.js");new e(Ip(O)).getBalance(new t(P)).then((e=>B(BigInt(e))))})()}),[]);let[H,z]=d(),{tokenPrice:j}=bp("solana"),{fundingAmountInBaseUnit:V,fundingAmountInUsd:q}=Mp({amount:R,fee:0n,tokenPrice:j});p((()=>{(async()=>{if(!F||!L)return;let e=["testnet","devnet"].includes(O.name);e&&console.warn("Solana testnets are not supported for bridging");let t=Ye(c.chains).filter((({testnet:t})=>!!t===e)),r=(await Gp({chains:t,address:L.address,appId:a,rpcConfig:n})).filter((e=>e.balance>0n));if(r.length<1)return void f(new _(`Wallet ${He(L.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));r.sort(((e,t)=>Number(t.balance-e.balance)));let i=(await Promise.allSettled(r.map((async e=>({...e,quote:await xp({isTestnet:!1,input:Tp({amount:V.toString(),user:L.address,recipient:P,destinationChainId:Ap,destinationCurrency:kp,originChainId:e.chain.id})})}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(i.length<1)return void f(new _(`Unable to fetch quotes for bridging. Wallet ${He(L.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));let o=i.map((({quote:e,balance:t,chain:r})=>({bridgeTx:_p(e),balance:t,chain:r}))).filter((({bridgeTx:e})=>!!e));if(o.length>1)return void v(o);let l=o.at(0);l?(x(!0),z({data:l.bridgeTx.data,to:l.bridgeTx.to,value:l.bridgeTx.value,chain:l.chain})):f(new _(`Unable to select bridge option from quotes. Wallet ${He(L.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE))})().catch(console.error)}),[F]),p((()=>{(async()=>{let e,t;if(!F||!L||$||A||!H)return;E(!0);let r=mn({chain:H.chain,transport:fn(Qe(H.chain,n,a))});try{e=await r.prepareTransactionRequest({account:L.address,to:H.to,chain:H.chain,data:H.data,value:BigInt(H.value??0)})}catch(e){console.error(e),w.length>1&&y(e.shortMessage??"Something went wrong")}if(e){E(!1),S(!0);try{await F.switchChain({id:H.chain.id})}catch(e){await F.addChain({chain:H.chain}),await F.switchChain({id:H.chain.id})}try{t=await F.sendTransaction(e),o({eventName:$p,payload:{provider:"external",status:"success",address:L.address,chainId:H.chain.id,value:H.value?.toString(),txHash:t}})}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(w.length<1?f(new _(e.shortMessage,void 0,k.TRANSACTION_FAILURE)):y(e.shortMessage??"Something went wrong"))}t?(await F.waitForTransactionReceipt({hash:t}),S(!1),I(!0)):S(!1)}else E(!1)})().catch(console.error)}),[F,H]),p((()=>{if(!m)return;let e={error:m,previousScreen:Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN};s({funding:u?.funding,sendTransaction:u?.sendTransaction,errorModalData:e}),l(Er.ERROR_SCREEN,!1)}),[m]);let K=L?eu(L.walletClientType,L.connectorType,L.walletClientType)||"wallet":null;if(p((()=>{if(!N)return;let e=setTimeout(i,dt);return()=>clearTimeout(e)}),[N]),N)return e(r,{children:[t(mp,{}),t(Ac,{}),e(Ec,{children:[t(Qr,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Rc,{title:"Success!",description:`You’ve successfully added ${R} SOL to your ${c.name} wallet. It may take a minute before the funds are available to use.`})]}),t(kc,{}),t(Ot,{})]});let Z=w[C];return w.length>1&&Z?t(Fm,{displayName:K,configuredFundingChain:O,formattedBalance:G,fundingAmount:R,fundingCurrency:"SOL",fundingAmountInUsd:q,options:w,selectedOption:Z,isPreparing:$,isSubmitting:A,errorMessage:g,onSubmit:()=>{z({to:Z.bridgeTx.to,data:Z.bridgeTx.data,value:Z.bridgeTx.value,chain:Z.chain})},onSelect:e=>{e!==C&&(y(null),b(e))}}):A&&L?t(Um,{wallet:L,displayName:K,addressToFund:P,isBridging:T,isErc20Flow:!1,chainId:"solana",chainName:O.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):e(r,{children:[t(mp,{}),t(fp,{}),t("div",{style:{marginTop:"1rem"}}),t(Ot,{})]})},[Er.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN]:function(){let{closePrivyModal:n,createAnalyticsEvent:a}=D(),{navigate:i,setModalData:o,app:l,data:c}=$r(),{wallets:u}=fr(),h=s(!1),[m,f]=d(!1),[g,y]=d(!1),[w,v]=d(null);if(!c?.funding||"ethereum"!==c.funding.chainType)throw Error("Invalid funding data");let{amount:C,connectedWalletAddress:b,chain:$}=c.funding,E=c.funding.address,T={name:"mainnet-beta"},x=b?u.find((({address:e})=>e===b)):u[0];if(p((()=>{(async function(){if(!x||!$||h.current)return;h.current=!0,$?.testnet&&console.warn("Solana testnets are not supported for bridging");let e=vn(C),t=await xp({isTestnet:!!$.testnet,input:Tp({amount:e.toString(),user:x.address,recipient:E,destinationChainId:$.id,originChainId:Ap,originCurrency:kp})}).catch(console.error);if(!t)return void v(new _(`Unable to fetch quotes for bridging. Wallet ${ct(x.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE));let r=await(async e=>{let t=e.steps[0]?.items?.[0];if(!t)return;let{PublicKey:r,TransactionInstruction:n}=await import("@solana/web3.js");return{instructions:t.data.instructions.map((({keys:e,programId:t,data:a})=>new n({keys:e.map((({pubkey:e,isSigner:t,isWritable:n})=>({pubkey:new r(e),isSigner:t,isWritable:n}))),programId:new r(t),data:Buffer.from(a,"hex")}))),addressLookupTableAddresses:t.data.addressLookupTableAddresses?.map((e=>new r(e)))}})(t);if(r)try{let{Connection:t,PublicKey:n,TransactionMessage:i,VersionedTransaction:o}=await import("@solana/web3.js"),l=new t(Ip(T)),s=await Promise.all((r.addressLookupTableAddresses??[]).map((async e=>l.getAddressLookupTable(e).then((e=>e.value))))),{blockhash:d}=await l.getLatestBlockhash(),c=new o(new i({payerKey:new n(x.address),instructions:r.instructions,recentBlockhash:d}).compileToV0Message(s));f(!0);let u=await l.simulateTransaction(c);if(u.value.err)return u.value.logs?.find((e=>/Transfer: insufficient lamports/gi.test(e)))?void v(new _(`Wallet ${ct(x?.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE)):(console.error("Transaction failed:",u.value.err),void v(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE)));let h=await x.sendTransaction(c,l),p=await l.confirmTransaction(h);if(p.value.err)return console.error("Transaction failed:",p.value.err),void v(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE));a({eventName:$p,payload:{provider:"external",status:"success",address:x.address,chainId:$.id,value:e.toString(),txHash:h}}),y(!0)}catch(e){if(console.error(e),/user rejected the request/gi.test(e.message||""))return void v(new _("Transaction was rejected by the user",void 0,k.TRANSACTION_FAILURE));v(new _("Something went wrong",void 0,k.TRANSACTION_FAILURE))}else v(new _(`Unable to select bridge option from quotes. Wallet ${ct(x.address)} does not have enough funds.`,void 0,k.INSUFFICIENT_BALANCE))})().catch(console.error)}),[]),p((()=>{if(!g)return;let e=setTimeout(n,dt);return()=>clearTimeout(e)}),[g]),p((()=>{if(!w)return;let e={error:w,previousScreen:Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN};o({funding:c?.funding,sendTransaction:c?.sendTransaction,errorModalData:e}),i(Er.ERROR_SCREEN,!1)}),[w]),g)return e(r,{children:[t(mp,{}),t(Ac,{}),e(Ec,{children:[t(Qr,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),t(Rc,{title:"Success!",description:`You’ve successfully added ${C} ${$.nativeCurrency.symbol} to your ${l.name} wallet. It may take a minute before the funds are available to use.`})]}),t(kc,{}),t(Ot,{})]});if(m&&x){let e=x?eu(x.walletClientType,x.connectorType,x.walletClientType)||"wallet":null;return t(Um,{wallet:x,displayName:e,addressToFund:E,isBridging:m,isErc20Flow:!1,chainId:$.id,chainName:$.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0})}return e(r,{children:[t(mp,{}),t(fp,{}),t("div",{style:{marginTop:"1rem"}}),t(Ot,{})]})},[Er.FUNDING_MANUAL_TRANSFER_SCREEN]:()=>{let{wallets:n}=st(),{wallets:a}=fr(),{data:i,setModalData:o,navigate:l,lastScreen:s}=$r(),{rpcConfig:u,appId:h,createAnalyticsEvent:m}=D(),f=We(),[g,y]=d(void 0),w=i?.funding,{reloadBalance:v}=Jt({rpcConfig:u,appId:h,address:"ethereum"===w.chainType?w.address:void 0,chain:"ethereum"===w.chainType?w.chain:void 0}),C="solana"===w.chainType,b=C?"SOL":w.erc20Address?w.erc20ContractInfo?.symbol:w.chain.nativeCurrency.symbol,$=C?a.find((({address:e})=>e===w.address)):n.find((({address:e})=>He(e)===He(w.address)));if(!w)return o({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:s||Er.FUNDING_METHOD_SELECTION_SCREEN},funding:i?.funding,sendTransaction:i?.sendTransaction}),l(Er.ERROR_SCREEN),t(r,{});p((()=>{let e=C?async function(){if("solana"!==w.chainType)return;let{Connection:e,PublicKey:t}=await import("@solana/web3.js");new e(Ip(w.cluster)).getBalance(new t(w.address)).then((e=>{y((t=>(t&&e>t&&m({eventName:$p,payload:{provider:"manual",status:"success",chainType:"solana",address:$?.address,value:(e-t).toString()}}),e)))}))}:async function(){"ethereum"===w.chainType&&(async()=>{if(!w.erc20Address)return await v()??BigInt(0);{let{balance:e}=await zm({chain:w.chain,address:w.address,erc20Address:w.erc20Address,rpcConfig:u,appId:h});return e}})().then((e=>{let t=parseFloat(Hn(e,"ether"));y((e=>(e&&t>e&&m({eventName:$p,payload:{provider:"manual",status:"success",chainType:"ethereum",address:$?.address,value:(t-e).toString()}}),t)))})).catch((()=>y(void 0)))},t=setInterval(e,2e3);return e(),()=>clearInterval(t)}),[]);let E=c((()=>void 0!==g&&g>=parseFloat(w.amount)),[g,w.amount]),T=null!=g?C?Op(BigInt(g),2,!0,!0):g.toPrecision(2):"",x="ethereum"===w.chainType?w.chain.name:Tf[w.cluster.name];return e(r,{children:[t(mp,{}),t(qu,{children:"Receive funds"}),e(Vu,{children:["Scan this code or copy your wallet address to receive funds on ",x,"."]}),e(Tc,{style:{gap:"1rem",margin:"1rem 0"},children:[t(op,{url:w.address,size:200,squareLogoElement:Ef}),t(Wt,{title:"Your wallet",errMsg:void 0,showIcon:!0,isLoading:!w||void 0===g,isPulsing:!E,balance:`${T} ${b}`,address:w.address,statusColor:E?"green":"gray"}),e(Qm,{theme:f.appearance.palette.colorScheme,children:["Make sure to send funds on ",x,"."]})]}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN]:()=>{let{closePrivyModal:n}=D(),{data:a,setModalData:i,navigate:o,onUserCloseViaDialogOrKeybindRef:l}=$r(),{onSuccess:s,onFailure:d}=a.setWalletPassword,c=()=>{d(new z("Exited before password was added to wallet")),n({shouldCallAuthOnSuccess:!1})};return l.current=c,e(r,{children:[t(yd,{onClose:c}),t(Ac,{}),e(Ec,{children:[e(Sc,{children:[t(un,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),t(Ic,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:t(hn,{width:"12px",height:"12px",fill:"white"})})]}),e(Rc,{title:"Secure Your Account",children:["Please set a password to secure your account.",t("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),t(rd,{onClick:()=>{i({createWallet:{onFailure:d,onSuccess:s,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),o(Er.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN)},children:"Add password"}),t(kc,{}),t(Ot,{})]})},[Er.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN]:()=>{let[e,r]=d(null),[n,a]=d(!1),[i,o]=d(null),[l,s]=d(""),{authenticated:c,getAccessToken:u,user:h}=F(),{walletProxy:m,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:y}=D(),{app:w,navigate:v,data:C,onUserCloseViaDialogOrKeybindRef:b}=$r(),{onSuccess:$,onFailure:E}=C.createWallet,T=j(h),x="user-passcode"===e?.recoveryMethod,_="user-passcode"===T?.recoveryMethod;p((()=>{c||(v(Er.LANDING),E(new V("User must be authenticated before setting a password on a Privy wallet")))}),[c]);let A=()=>i?(E(i),void g({shouldCallAuthOnSuccess:!1})):x?($(e),void g({shouldCallAuthOnSuccess:!1})):(E(new z("Exited before password was added to wallet")),void g({shouldCallAuthOnSuccess:!1}));b.current=A;return t(Hh,{appName:w?.name||"privy",config:{initiatedBy:"user",onCancel:A},error:i?"An error has occurred, please try again.":void 0,buttonLoading:n,buttonHideAnimations:!1,password:l,isResettingPassword:_,onPasswordGenerate:()=>s(Oh()),onPasswordChange:s,onSubmit:async()=>{x?($(e),g({shouldCallAuthOnSuccess:!1})):(a(!0),o(null),await(async()=>{let e=await u();if(e&&T?.address&&l&&m)try{y({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:_}});let{entropyId:t,entropyIdVerifier:n}=P(T);if(!(await m.setRecovery({accessToken:e,entropyId:t,entropyIdVerifier:n,recoveryPassword:l,recoveryMethod:"user-passcode"})).entropyId)return o(new z("Error setting password on privy wallet")),void y({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:_,reason:"error setting password"}});let a=await f(),i=j(a);if(!i)return o(new z("Error setting password on privy wallet")),void y({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:_,reason:"wallet disconnected"}});r(i),y({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:T.address,existingRecoveryMethod:T.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:_}})}catch(e){console.warn(e),o(e instanceof Error?e:Error("Error setting password on privy wallet")),y({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:T.address,reason:e}})}})(),a(!1))},onClose:A})},[Er.EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN]:()=>{let{app:e,navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:a}=$r(),[i,o]=d(""),[l,s]=d(!1),[c,u]=d(),[h,m]=d(null),{authenticated:f,user:g}=F(),{closePrivyModal:y,isNewUserThisSession:w,initializeWalletProxy:v}=D(),{onSuccess:C,onFailure:b,callAuthOnSuccessOnClose:$}=n.createWallet,{createWallet:E}=Qu(),[T,x]=d(null),_=new Il((async()=>{try{let e=await E({recoveryPassword:c,user:g});if(!e)return;x(e),w?r(Er.EMBEDDED_WALLET_CREATED_SCREEN):(C(e),y({shouldCallAuthOnSuccess:$}))}catch(e){o(e.message)}}));p((()=>{h||v(3e4).then((e=>m(e)))}),[h]),p((()=>{if(!f||!g)return r(Er.LANDING),void b(Error("User must be authenticated before creating a Privy wallet"))}),[f]),a.current=()=>null;return t(Hh,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!h,buttonLoading:l,buttonHideAnimations:!T&&l,isResettingPassword:!1,error:i,password:c||"",onClose:()=>{T&&"user-passcode"!==T?.recoveryMethod?(b(new z("User created a wallet but failed to set a password for it")),y({shouldCallAuthOnSuccess:!1})):T?(C(T),y({shouldCallAuthOnSuccess:$})):(b(new z("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))},onPasswordChange:u,onPasswordGenerate:()=>u(Oh()),onSubmit:async()=>(s(!0),_.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>s(!1))))})},[Er.MFA_ENROLLMENT_FLOW_SCREEN]:()=>{let{user:n,enrollInMfa:a}=F(),[i,o]=d(null),{unenrollWithSms:l,unenrollWithTotp:s,unenrollWithPasskey:c}=Sg(),{app:u,ready:h,data:m,onUserCloseViaDialogOrKeybindRef:f}=$r(),{closePrivyModal:g}=D(),{promptMfa:y}=kg(),{initEnrollmentWithTotp:w}=Sg(),[v,C]=d(!1),[b,$]=d(null),[E,T]=d(null),x=()=>{g({shouldCallAuthOnSuccess:!0}),a(!1),setTimeout((()=>{o(null),$(null)}),500)},{initEnrollmentWithPasskey:_,submitEnrollmentWithPasskey:A}=Sg(),[k,S]=d(!1),[N,I]=d(null);f.current=x;let P=n?.mfaMethods.includes("sms"),O=!!n?.phone,R=n?.mfaMethods.includes("totp"),M=n?.mfaMethods.includes("passkey"),L=P||R||M,U=n?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function W(){o(null),$(null)}if(p((()=>{L&&C(!0)}),[L]),!h||!n||!u)return e(r,{children:[t(yd,{onClose:x},"header"),t(Yd,{children:t(Ng,{})}),t(Jd,{children:t(Gt,{})}),t(Mt,{})]});if("sms"===i)return e(r,{children:[t(yd,{backFn:W,onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Dr,{})}),t(Xd,{children:"Remove SMS verification?"}),e(Qd,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),t(nc,{children:t(rd,{warn:!0,onClick:async function(){o(null);try{await l()}catch(e){o(null)}},children:"Remove SMS for MFA"})}),t(Mt,{})]});if("totp"===i)return e(r,{children:[t(yd,{backFn:W,onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Dr,{})}),t(Xd,{children:"Remove Authenticator App verification?"}),e(Qd,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),t(nc,{children:t(rd,{warn:!0,onClick:async function(){o(null);try{await s()}catch(e){o(null)}},children:"Remove Authenticator App for MFA"})}),t(Mt,{})]});if("passkey"===i)return e(r,{children:[t(yd,{backFn:W,onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(Dr,{})}),t(Xd,{children:"Are you sure you want to remove passkey verification?"}),t(Qd,{children:"This will disable any passkeys you have set up for verification. You’ll still be able to login with your passkeys if you’ve set up passkey login."}),t(nc,{children:t(rd,{warn:!0,onClick:async function(){o(null);try{await y(),await c()}catch(e){o(null)}},children:"Yes, remove"})}),t(Mt,{})]});if(0===m.mfaEnrollmentFlow.mfaMethods.length&&!L)return e(r,{children:[t(yd,{onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(jn,{})}),t(Xd,{children:"Add more security"}),e(Qd,{children:[u?.name," does not have any verification methods enabled."]}),t(nc,{children:t(rd,{onClick:x,children:"Close"})}),t(Mt,{})]});let B=!L&&!v;return B?e(r,{children:[t(yd,{onClose:x},"header"),t(hc,{style:{marginBottom:"1.5rem"},children:t(jn,{})}),t(Xd,{children:"Transaction Protection"}),t(Qd,{children:"Set up transaction protection to add an extra layer of security to your account"}),e(ec,{children:[e(rc,{children:[t(tc,{children:t(Ln,{})}),"Enable 2-Step verification for your ",u?.name," wallet."]}),e(rc,{children:[t(tc,{children:t(Vn,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),e(nc,{children:[t(rd,{onClick:()=>C(!0),children:"Continue"}),t(ld,{onClick:x,children:"Not now"})]}),t(Mt,{})]}):"sms"===b?t(Xg,{onComplete:x,onReset:W,onClose:x}):"totp"===b&&E?t(Jg,{onComplete:x,onClose:x,onReset:W,totpInfo:E}):"passkey"===b?t(Rg,{onComplete:x,onReset:W,onClose:x}):t(Pg,{showIntro:B,userMfaMethods:n.mfaMethods,appMfaMethods:u.mfa.methods,userHasAuthSms:O,onBackToIntro:function(){C(!1)},handleSelectMethod:async function(e){return await y().catch(I),"totp"===e?($(e),T(null),void w().then((e=>{T(e)})).catch((()=>{T(null),W()}))):"passkey"===e&&1===U.length?await async function(){S(!0);try{await _(),await A({credentialIds:U})}catch(e){I(e)}finally{S(!1)}}():void $(e)},isTotpLoading:"totp"===b&&!E,isPasskeyLoading:k,error:N,onClose:x,setRemovingMfaMethod:o})},[Er.CAPTCHA_SCREEN]:()=>{let{lastScreen:n,currentScreen:a,data:i,navigateBack:o,navigate:l,setModalData:c}=$r(),{status:u,token:h,waitForResult:m,reset:f,execute:g}=Jl(),y=s([]),w=e=>{y.current=[e,...y.current]},[v,C]=d(!0);p((()=>(w(setTimeout(C,1e3,!1)),()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]})),[]);let[b,$]=d(""),[E,T]=d("Checking that you are a human..."),[x,_]=d(t(rd,{onClick:()=>{},disabled:!0,children:"Continue"})),[A,k]=d(!1),[S,N]=d(3),I=i?.captchaModalData,P=async e=>{try{await(I?.callback(e)),I?.onSuccessNavigateTo&&l(I?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof Xl)return;c({errorModalData:{error:e,previousScreen:n||Er.LANDING}}),l(I?.onErrorNavigateTo||Er.ERROR_SCREEN,!1)}};p((()=>{"success"===u?w(setTimeout((async()=>{let e=await m();!e||I?.userIntentRequired||P(e)}),1e3)):"ready"===u&&w(setTimeout((()=>{"ready"===u&&g()}),500))}),[u]),p((()=>{if(!v)switch(u){case"success":$("Success!"),T("CAPTCHA passed successfully."),_(t(rd,{onClick:()=>{k(!0),P(h)},disabled:!I?.userIntentRequired,loading:A,children:I?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":$(""),T("Checking that you are a human..."),_(t(rd,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":$("Something went wrong"),S<=0?(T("If you use an adblocker or VPN, try disabling and re-attempting."),_(null)):(T("You did not pass CAPTCHA. Please try again."),_(t(rd,{onClick:O,children:"Retry"})))}}),[u,v,A]);let O=async()=>{if(S<=0)return;N((e=>e-1)),f(),g();let e=await m();!e||I?.userIntentRequired||P(e)};return e(r,{children:[t(yd,{backFn:n&&a!==n?o:void 0}),e(Xc,{children:["success"===u?t(Yr,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):"error"===u?t(Xr,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):t(Zc,{}),e(xc,{children:[b?t("h3",{children:b}):null,t("p",{children:E})]}),x]}),t(Mt,{})]})},[Er.ERROR_SCREEN]:()=>{let{navigate:e,navigateBack:r,data:n,lastScreen:a,currentScreen:i}=$r(),o=n?.errorModalData?.previousScreen||(a===i?void 0:a);return t(zh,{error:n?.errorModalData?.error||Error(),backFn:()=>o?e(o,!1):r(),onClick:()=>e(o||Er.LANDING,!1)})},[Er.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE]:()=>{let{closePrivyModal:n}=D();return e(r,{children:[t(yd,{},"header"),t(Pf,{children:t(jr,{style:{width:32,height:32}})}),t(Oc,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),t(vc,{children:t(rd,{onClick:()=>n(),children:"Close"})}),t(kc,{}),t(Ot,{})]})},[Er.AFFIRMATIVE_CONSENT_SCREEN]:()=>{let{user:e,logout:r}=F(),{app:n,onUserCloseViaDialogOrKeybindRef:a,setModalData:i,navigate:o}=$r(),{acceptTerms:l,closePrivyModal:s,createAnalyticsEvent:d}=D(),c=e=>{e?.preventDefault(),s({shouldCallAuthOnSuccess:!1}),r()};a.current=c;return t(mc,{termsAndConditionsUrl:n?.legal.termsAndConditionsUrl,privacyPolicyUrl:n?.legal.privacyPolicyUrl,onAccept:async t=>{t.preventDefault(),await l(),e&&U(e,n?.embeddedWallets?.createOnLogin)?(i({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),d({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),o(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)):s()},onDecline:c})},[Er.TELEGRAM_AUTH_SCREEN]:()=>{let{authenticated:n,logout:a,ready:i,user:o}=F(),{app:l,setModalData:s,navigate:c,resetNavigation:u,data:h}=$r(),{initLoginWithTelegram:m,loginWithTelegram:f,updateWallets:g,setReadyToTrue:y,closePrivyModal:w,createAnalyticsEvent:v,getAuthMeta:C}=D(),[b,$]=d(!1),[E,T]=d(void 0),x=Jl();async function _(){try{let e=await async function(){let e;if(x.enabled&&"error"===x.status)throw new Xl(x.error,null,k.CAPTCHA_FAILURE);return x.enabled&&"success"!==x.status&&(x.execute(),e=await x.waitForResult()),e}();await f(e),$(!0),y(!0)}catch(e){if(e?.privyErrorCode===k.ALLOWLIST_REJECTED)return T(void 0),u(),void c(Er.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===k.USER_LIMIT_REACHED)return console.error(new W(e).toString()),T(void 0),u(),void c(Er.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===k.USER_DOES_NOT_EXIST)return T(void 0),u(),void c(Er.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===k.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return T(void 0),u(),s({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:C()?.telegramAuthResult,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void c(Er.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=ts(e);T({retryable:t,detail:r,message:"Authentication failed"})}}p((()=>{_()}),[]),p((()=>{if(!(i&&n&&b&&o))return;if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let e=setTimeout((()=>{c(Er.AFFIRMATIVE_CONSENT_SCREEN)}),Be);return()=>clearTimeout(e)}if(U(o,l?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{s({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),c(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),Be);return()=>clearTimeout(e)}g();let e=setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),Be);return()=>clearTimeout(e)}),[i,n,b,o]);let A=b?"Successfully connected with Telegram":E?E.message:"Verifying connection to Telegram",S="";return S=b?"You’re good to go!":E?E.detail:"Just a few moments more",e(r,{children:[t(yd,{}),t(Ac,{}),e(yv,{children:[t(Td,{children:e("div",{children:[t(Rt,{success:b,fail:!!E}),t(pg,{style:{width:"38px",height:"38px"}})]})}),e(xc,{children:[t("h3",{children:A}),t("p",{children:S})]}),E&&E?.retryable?t(dd,{onClick:async()=>{try{T(void 0),h?.telegramAuthModalData?.seamlessAuth||await m(void 0,h?.login?.disableSignup),await _()}catch(e){let{retryable:t,detail:r}=ts(e);T({retryable:t,detail:r,message:"Authentication failed"})}},disabled:!b&&!E?.retryable,children:"Retry"}):null]}),t(kc,{}),t(Mt,{})]})},[Er.LINK_CONFLICT_SCREEN]:()=>{let{initiateAccountTransfer:e,closePrivyModal:r}=D(),{data:n,navigate:a,lastScreen:i,setModalData:o}=$r(),[l,s]=d(void 0),[c,u]=d(!1),[h,p]=d(!1),m=async()=>{try{if(!n?.accountTransfer?.nonce||!n?.accountTransfer?.account)throw Error("missing account transfer inputs");p(!0),await e({nonce:n?.accountTransfer?.nonce,account:n?.accountTransfer?.account,accountType:n?.accountTransfer?.linkMethod,externalWalletMetadata:n?.accountTransfer?.externalWalletMetadata,telegramAuthResult:n?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:n?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:n?.accountTransfer?.oAuthUserInfo}),u(!0),p(!1),setTimeout(r,1e3)}catch(e){o({errorModalData:{error:e,previousScreen:i||Er.LINK_CONFLICT_SCREEN}}),a(Er.ERROR_SCREEN,!0)}};return l?t(qd,{address:l,onClose:r,onRetry:()=>s(void 0),onTransfer:m,isTransferring:h,transferSuccess:c}):t(Kd,{onClose:r,onInfo:()=>s(n?.accountTransfer?.embeddedWalletAddress),onContinue:()=>s(n?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:h,transferSuccess:c,data:n})}},Rv=[Er.LANDING,Er.AWAITING_CONNECTION],Mv=({isMfaVerifying:n,onMfaVerificationComplete:a})=>{let{ready:i,isModalOpen:o}=F(),{headless:l}=We(),{ready:s,currentScreen:d}=$r(),{status:c,execute:u,reset:h,enabled:m}=Jl(),f=o&&d&&Rv.includes(d)&&!l&&"ready"===c;return p((()=>{f&&u()}),[f]),p((()=>{!o&&m&&h()}),[o,m]),i&&s||d===Er.AWAITING_OAUTH_SCREEN||d===Er.CROSS_APP_AUTH_SCREEN||d===Er.TELEGRAM_AUTH_SCREEN?!d&&n?t(Fy,{open:n,onClose:a}):d?e(r,{children:[t(Od,{$if:!!n,children:t(Ov[d],{})}),t(Od,{$if:!n,children:t(Fy,{open:n,onClose:a})})]}):null:e(r,{children:[t(yd,{}),t(Ac,{}),t(Pv,{children:t(Gt,{})}),t(kc,{}),t(Mt,{})]})},Lv=({isMfaVerifying:e,onMfaVerificationComplete:r})=>{let n=s(null);return t(Uv,{style:{height:tr(n)},id:"privy-modal-content",children:t("div",{ref:n,children:t(Mv,{isMfaVerifying:e,onMfaVerificationComplete:r})})})};const Dv=({open:e})=>{let{app:r}=$r(),{gracefulClosePrivyModal:n}=(()=>{let{closePrivyModal:e}=D(),{onUserCloseViaDialogOrKeybindRef:t}=$r();return{gracefulClosePrivyModal:m((()=>{if(!t?.current)return e({shouldCallAuthOnSuccess:!1});t.current()}),[e])}})(),[a,i]=d(!1);ed({onMfaRequired:()=>{r?.mfa.noPromptOnMfaRequired||i(!0)}});let o=e||a;return r.render.standalone?t(_v,{children:t(Fv,{id:"privy-modal-content",children:t(Mv,{isMfaVerifying:a,onMfaVerificationComplete:()=>i(!1)})})}):t(Av,{open:o,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>n(),children:t(_v,{children:t(Lv,{isMfaVerifying:a,onMfaVerificationComplete:()=>i(!1)})})})};let Fv=kr.div`
2951
2957
  display: flex;
2952
2958
  flex-direction: column;
2953
2959
  text-align: center;
@@ -2956,7 +2962,7 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2956
2962
  width: 100%;
2957
2963
  background: var(--privy-color-background);
2958
2964
  padding: 0 16px;
2959
- `,Dv=kr(Lv)`
2965
+ `,Uv=kr(Fv)`
2960
2966
  transition: height 150ms ease-out;
2961
2967
  overflow: hidden;
2962
2968
 
@@ -2970,4 +2976,4 @@ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{getAddres
2970
2976
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
2971
2977
  border-radius: var(--privy-border-radius-lg);
2972
2978
  }
2973
- `;function Fv(e){let r=s(null),n=s();return p((()=>{n.current?.remove(),n.current=function({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:n}=new URL(t);return r.async=!0,r.src=`${n}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}(e),r.current?.after(n.current)}),[e]),t("div",{ref:r,hidden:!0})}async function Uv(e,t,r,n,a,i=!1){let o=i,l=async l=>{if(o&&t&&t.length>0){l===(i?0:1)?a("configureMfa","onMfaRequired",t):n.current?.reject(new Nu("missing_or_invalid_mfa","MFA verification failed, retry."));let o=await new Promise(((e,t)=>{r.current={resolve:e,reject:t},setTimeout((()=>{let e=new Nu("mfa_timeout","Timed out waiting for MFA code");n.current?.reject(e),t(e)}),3e5)}));return await e(o)}return await e()},s=null;for(let e=0;e<4;e++)try{s=await l(e),n.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw n.current?.resolve(void 0),e;o=!0}if(null===s){let e=new Nu("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw n.current?.reject(e),e}return s}var Wv;let Bv=(Wv=0,()=>"id-"+Wv++);function Gv(e){return void 0!==e.error}let Hv=new class{enqueue(e,t){this.callbacks[e]=t}dequeue(e,t){let r=this.callbacks[t];if(!r)throw Error(`cannot dequeue ${e} event: no event found for id ${t}`);switch(delete this.callbacks[t],e){case"privy:iframe:ready":case"privy:wallets:create":case"privy:wallets:add":case"privy:wallets:set-recovery":case"privy:wallets:connect":case"privy:wallets:recover":case"privy:wallets:rpc":case"privy:wallet:create":case"privy:wallet:import":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":case"privy:farcaster:init-signer":case"privy:farcaster:sign":case"privy:solana-wallet:create":case"privy:delegated-actions:consent":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}},zv=new Map,jv=(e,t)=>"bigint"==typeof t?t.toString():t,Vv=(e,t)=>`${e}${JSON.stringify(t,jv)}`;function qv(e,t,r,n){let a=r.contentWindow;if(!a)throw Error("iframe not initialized");let i=Vv(e,t);if("privy:wallet:create"===e){let e=zv.get(i);if(e)return e}let o=new Promise(((r,i)=>{let o=Bv();Hv.enqueue(o,{resolve:r,reject:i}),a.postMessage({id:o,event:e,data:t},n)})).finally((()=>{zv.delete(i)}));return zv.set(i,o),o}function Kv(e){let r=s(null),n=s(e.mfaMethods),a=Or(),[i,o]=d(!1);return p((()=>{n.current=e.mfaMethods}),[e.mfaMethods]),p((()=>{if(!i)return;let t=r.current;if(!t)return;function o(t){var r;t&&t.origin===e.origin&&"string"==typeof(r=t.data).event&&/^privy:.+/.test(r.event)&&function(e){switch(e.event){case"privy:iframe:ready":let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallets:create":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:add":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:set-recovery":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:connect":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:recover":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:rpc":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallet:create":let r=Hv.dequeue(e.event,e.id);return Gv(e)?r.reject(new Nu(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let n=Hv.dequeue(e.event,e.id);return Gv(e)?n.reject(new Nu(e.error.type,e.error.message)):n.resolve(e.data);case"privy:mfa:verify":let a=Hv.dequeue(e.event,e.id);return Gv(e)?a.reject(new Nu(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:init-enrollment":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:submit-enrollment":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:unenroll":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:clear":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:solana-wallet:create":let i=Hv.dequeue(e.event,e.id);return Gv(e)?i.reject(new Nu(e.error.type,e.error.message)):i.resolve(e.data);case"privy:farcaster:init-signer":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:sign":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:delegated-actions:consent":{let t=Hv.dequeue(e.event,e.id);return Gv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}(t.data)}let l={createWallet:r=>Uv((n=>qv("privy:wallets:create",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),addWallet:r=>qv("privy:wallets:add",r,t,e.origin),setRecovery:r=>Uv((n=>qv("privy:wallets:set-recovery",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),connect:r=>Uv((n=>qv("privy:wallets:connect",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),recover:r=>Uv((n=>qv("privy:wallets:recover",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a,!r.recoveryAccessToken&&!r.recoveryPassword&&!r.recoverySecretOverride),rpc:r=>Uv((n=>qv("privy:wallets:rpc",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),create:r=>qv("privy:wallet:create",r,t,e.origin),import:r=>qv("privy:wallet:import",r,t,e.origin),createSolana:r=>Uv((n=>qv("privy:solana-wallet:create",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),createDelegatedAction:r=>qv("privy:delegated-actions:consent",r,t,e.origin),verifyMfa:r=>Uv((n=>qv("privy:mfa:verify",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a,!0),initEnrollMfa:r=>Uv((n=>qv("privy:mfa:init-enrollment",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),submitEnrollMfa:r=>Uv((n=>qv("privy:mfa:submit-enrollment",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),unenrollMfa:r=>Uv((n=>qv("privy:mfa:unenroll",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a,!0),clearMfa:r=>qv("privy:mfa:clear",r,t,e.origin),initFarcasterSigner:r=>qv("privy:farcaster:init-signer",r,t,e.origin),signFarcasterMessage:r=>qv("privy:farcaster:sign",r,t,e.origin)};window.addEventListener("message",o);let s=new AbortController;return he((()=>qv("privy:iframe:ready",{},t,e.origin)),{abortSignal:s.signal}).then((()=>e.onLoad(l)),((...t)=>{console.warn("Privy iframe failed to load: ",...t),e.onLoadFailed()})),()=>{window.removeEventListener("message",o),s.abort()}}),[i]),t("iframe",{ref:r,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>o(!0),src:Ve(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}const Zv=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.delegated));class Yv{async handleSignMessage(e){if(!e.params||"string"!=typeof e.params.message)throw Error("Message must be provided as a string for Solana signMessage RPC");return await xC({message:e.params.message})}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await vC())throw Error("User must be authenticated to use embedded Solana wallet");if(!await TC())throw new _("Unable to connect to Solana embedded wallet");if("signMessage"===e.method)return await this.handleSignMessage(e);throw Error("Embedded Solana provider does not yet support this RPC method.")}constructor(e,t){this.walletProxy=e,this.address=t}}function Xv(e){let t=new RegExp(RegExp("^eip155:(?<chainId>\\d+)$","gm")),r=t.exec(e)?.groups?.chainId;if(r)return parseInt(r);throw Error("Chain ID not compatible with CAIP-2 format.")}const Qv="popup-privy-oauth",Jv="PRIVY_OAUTH_USE_BROADCAST_CHANNEL";class eC{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post(ol,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post(ll,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw A(e)}}constructor({authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}){this.meta={authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}}}async function tC({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find((e=>e.provider_app_id===r));if(!n)throw new _("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}const rC=async({user:e,address:t,client:r,request:n,requesterAppId:a,reconnect:i})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:n.method}});let o=e?.linkedAccounts.find((e=>"cross_app"===e.type&&(e.embeddedWallets.some((e=>e.address===t))||e.smartWallets.some((e=>e.address===t)))));if(!e||!o)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new _("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(o.providerApp.id),s=await tC({api:r.api,requesterAppId:a,providerAppId:o.providerApp.id});if(!l){if(s.readOnly)throw console.error("cannot transact against a read-only provider app"),new _("Cannot transact against a read-only provider app");await i({appId:o.providerApp.id,action:"link"})&&(l=r.getProviderAccessToken(o.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new _("Transactions require a valid token");let d=nf();if(!d)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new _("Failed to initialize signature request");let c=new URL(`${s.apiUrl}/oauth/transact`);return c.searchParams.set("token",l||""),c.searchParams.set("request",nC(n)),d.location=c.href,new Promise(((e,a)=>{let i=setTimeout((()=>{c(),a(new _("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})}),12e4),l=setInterval((()=>{d.closed&&(c(),a(new _("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))}),300),s=i=>{i.data&&("set"===i.data.token?.action&&void 0!==i.data.token?.value?r.storeProviderAccessToken(o.providerApp.id,i.data.token.value):"clear"===i.data.token?.action&&r.storeProviderAccessToken(o.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===i.data.type&&i.data.result&&(c(),e(i.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:n.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===i.data.type&&i.data.error&&(c(),a(i.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:i.data.error,address:t}})))};window.addEventListener("message",s);let c=()=>{d.close(),clearInterval(l),clearTimeout(i),window.removeEventListener("message",s)}}))};let nC=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin});const aC=e=>e.filter((e=>"wallets"===e.method||("exchange"===e.method?"coinbase"===e.provider:"card"===e.method||"payment-request"===e.method?"coinbase"===e.provider||"moonpay"===e.provider:(e.method,!1)))),iC={[at.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[yt.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[it.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[wt.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[ot.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[vt.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[tt.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[Ct.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[et.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[bt.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[Je.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[$t.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"},oC=({address:e,appConfig:t,fundWalletConfig:r,methodScreen:n,chainIdOverride:a,comingFromSendTransactionScreen:i=!1})=>{let o,l;if(!t.fundingConfig)throw Error("Wallet funding is not enabled");let s=aC(t.fundingConfig.options);if(s.length<1)throw Error("Wallet funding is not enabled");o=a||(pf(r)&&r.chain?r.chain.id:Xv(t.fundingConfig.defaultRecommendedCurrency.chain));let d=t.chains.find((e=>e.id===o));if(!d)throw new _(`Funding chain ${o} is not in PrivyProvider chains list`);let c=pf(r)&&r.amount?r.amount:t.fundingConfig.defaultRecommendedAmount,u=!1;function h(){if(!o)return;let e=iC[o];s.find((e=>"wallets"===e.method))&&!e&&console.warn("Attempting to fund with USDC on chain where USDC address is not known. Funding via external wallet will be disabled."),l=e,u=!0}return pf(r)&&"asset"in r?"USDC"===r.asset?h():"string"!=typeof r.asset&&"erc20"in r.asset&&(u=((e,t)=>e===iC[t.id])(l=r.asset.erc20,d)):"USDC"===t.fundingConfig.defaultRecommendedCurrency.asset&&h(),{chainType:"ethereum",address:e,amount:c,chain:d,erc20Address:l,erc20ContractInfo:u?{symbol:"USDC",decimals:6}:void 0,isUSDC:u,methodScreen:n,supportedOptions:s,comingFromSendTransactionScreen:i,crossChainBridgingEnabled:t.fundingConfig.crossChainBridgingEnabled??!1,...hf(r)?{moonpayConfigOverride:r.config}:{}}};function lC({address:e,fundWalletConfig:t,appConfig:r,comingFromSendTransactionScreen:n,methodScreen:a}){if(!r.fundingConfig)throw Error("Wallet funding is not enabled");let i=aC(r.fundingConfig.options);if(i.length<1)throw Error("Wallet funding is not enabled");return{chainType:"solana",address:e,supportedOptions:i,amount:t?.amount??r.fundingConfig.defaultRecommendedAmount,isUSDC:!1,methodScreen:a,comingFromSendTransactionScreen:n,cluster:t?.cluster??{name:"mainnet-beta"},crossChainBridgingEnabled:r.fundingConfig.crossChainBridgingEnabled??!1}}const sC=[Er.FUNDING_METHOD_SELECTION_SCREEN,Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN,Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN,Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN,Er.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN,Er.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN,Er.FUNDING_MANUAL_TRANSFER_SCREEN,Er.MOONPAY_STATUS_SCREEN],dC={[Er.FUNDING_METHOD_SELECTION_SCREEN]:null,[Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:"external",[Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:"external",[Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN]:"external",[Er.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN]:"external",[Er.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN]:"external",[Er.FUNDING_MANUAL_TRANSFER_SCREEN]:"manual",[Er.MOONPAY_STATUS_SCREEN]:"moonpay"};async function cC({url:e,popup:t,provider:r}){return t.location=e,new Promise(((e,r)=>{function n(){t?.close(),window.removeEventListener("message",a)}function a(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),n()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),n()),"PRIVY_OAUTH_ERROR"===t.data.type&&(r(t.data.error),n()))}window.addEventListener("message",a)}))}let uC,hC,pC,mC,fC,gC,yC;function wC(){return uC?uC.getCustomerAccessToken():Promise.resolve(Nt.get(_e)||null)}async function vC(){return uC?uC.getAccessToken():Promise.resolve(Nt.get(Ae)||Nt.get(_e)||null)}const CC=(e,t,r)=>hC(e,t,r),bC=(e,t,r)=>pC(e,t,r),$C=(e,t,r,n)=>mC(e,t,r,n),EC=()=>fC(),TC=()=>gC(),xC=({message:e})=>yC({message:e});const _C=({config:e,...r})=>{var n;if("undefined"!=typeof window&&0>["localhost","127.0.0.1"].indexOf(window.location.hostname)&&"https:"!==window.location.protocol)throw new _("Embedded wallet is only available over HTTPS");if("string"!=typeof(n=r.appId)||25!==n.length)throw new _("Cannot initialize the Privy provider with an invalid Privy app ID");uC||(uC=new Xs({appId:r.appId,appClientId:r.clientId,apiUrl:r.apiUrl}));let a=Object.assign({},e);return void 0!==r.createPrivyWalletOnLogin&&void 0===a.embeddedWallets?.createOnLogin&&(a.embeddedWallets||(a.embeddedWallets={}),a.embeddedWallets.createOnLogin=r.createPrivyWalletOnLogin?"users-without-wallets":"off"),void 0!==r.createPrivyWalletOnLogin&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),t(Et,{client:uC,clientConfig:a,legacyCreateEmbeddedWalletFlag:r.createPrivyWalletOnLogin,children:t(AC,{...r,client:uC})})};let AC=r=>{let a=r.client,[l,u]=d(!1),[h,m]=d(!1),[f,g]=d(!1),[y,w]=d(null),[v,C]=d([]),[b,$]=d([]),[E,x]=d(null),O=s(v),[R,M]=d(!1),[L,D]=d(null),[F,W]=d(!1),[B,z]=d({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:N}),[V,re]=d({status:"initial"}),[ne,ie]=d({status:"initial"}),[de,ce]=d({status:"initial"}),[he,pe]=d({status:"initial"}),[me,fe]=d({status:"initial"}),[ve,Ce]=d(null),be=We(),$e=Tt(),[Te,xe]=d(!0),[_e,Ae]=d({}),[ke,Ne]=d(null),[Ie,Pe]=d(null),[Oe,Re]=d(!1),[Me,Le]=d(!1),[Fe,Be]=d(be.customAuth?.enabled?{status:"initial"}:{status:"not-enabled"}),Ge=s(null),He=s(null),ze=s(Rr),[je,Ve]=d(!1);a.onStoreCustomerAccessToken=e=>{e&&Mr(ze,"accessToken","onAccessTokenGranted",e)},a.onDeleteCustomerAccessToken=()=>{w(null),g(!1),Mr(ze,"accessToken","onAccessTokenRemoved")};let Ke=s(null),Ze=s(null),Ye=s(!1),Xe=({showWalletUIs:e,typedData:t})=>Ye.current?Ye.current:void 0!==e?!e:void 0!==be.embeddedWallets.showWalletUIs?!be.embeddedWallets.showWalletUIs:t?be.embeddedWallets.noPromptOnSignature||(be.legacyWalletUiConfig??!1):!!be.embeddedWallets.noPromptOnSignature,Qe=e=>{D(e),setTimeout((()=>{u(!0)}),15),a.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:e}})},Je=e=>{"off"!==be.embeddedWallets.createOnLogin&&xe(!0),Qe(e)};p((()=>{let e=H(y);if(!e||!ve)return void x(null);let t={type:"solana",imported:!1,address:e.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",walletIndex:e.walletIndex??void 0,meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund(){throw new _("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:()=>{throw new _("Cannot unlink an embedded Solana wallet")},getProvider:async()=>new Yv(ve,e.address),async signMessage(e){let t=await vC(),r=j(y);if(!t||!ve||!r)throw new _("Must have valid access token and Privy wallet to send transaction",k.MUST_BE_AUTHENTICATED);if(!await At.recoverPrimaryWallet().catch((()=>!1)))throw new _("Wallet couldn't be connected",k.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:n,entropyIdVerifier:a}=P(r),{response:i}=await ve.rpc({accessToken:t,entropyId:n,entropyIdVerifier:a,chainType:"solana",hdWalletIndex:this.walletIndex??0,request:{method:"signMessage",params:{message:Buffer.from(e).toString("base64")}}});return Buffer.from(i.data.signature,"base64")},async sendTransaction(e,t,r){let{signature:n}=await wt({transaction:e,connection:t,transactionOptions:r,wallet:this});return n},async signTransaction(e){let t=await vC();if(!t||!ve)throw new _("Must have valid access token and Privy wallet to send transaction",k.MUST_BE_AUTHENTICATED);if(!await At.recoverPrimaryWallet().catch((()=>!1)))throw new _("Wallet couldn't be connected",k.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:r,entropyIdVerifier:n}=Z(y);return await ew({tx:e,accessToken:t,walletProxy:ve,entropyId:r,entropyIdVerifier:n,transactingWalletAddress:this.address,transactingWalletIndex:this.walletIndex??0}),e},loginOrLink:async()=>{throw new _("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{x(null)},isConnected:async()=>!0};x(t)}),[ve,y]),p((()=>{if(!y)return void a.connectors?.removeEmbeddedWalletConnectors();let e=G(y),t=Y(y),n=K(y);e&&t.length||a.connectors?.removeEmbeddedWalletConnectors(),n||a.connectors?.removeImportedWalletConnector(),a.connectors?ve?(e&&a.connectors.addEmbeddedWalletConnectors({walletProxy:ve,rootWallet:e,embeddedWallets:t,defaultChain:be.defaultChain,appId:r.appId}),n&&a.connectors.addImportedWalletConnector(ve,n.address,be.defaultChain,r.appId)):console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized"):console.debug("Failed to add embedded wallet connector: Client connectors not initialized")}),[ve,y]),p((()=>{ve&&Ie?.(ve)}),[ve]);let et=s();p((()=>{(async()=>{if(!be.customAuth?.enabled)return void Be({status:"not-enabled"});xe(!0);let{getCustomAccessToken:e,isLoading:t}=be.customAuth;if(h&&!t&&"loading"!==Fe.status){Be({status:"loading"});try{let t=await e();if(t===et.current)return void Be({status:"done"});if(!t&&f)return et.current=t,await _t.logout(),Be({status:"done"}),void Mr(ze,"customAuth","onUnauthenticated");if(!t)return et.current=t,void Be({status:"done"});a.startAuthFlow(new dl(t));let{user:r,isNewUser:n}=await a.authenticate();if(!r)return await _t.logout(),Be({status:"error",error:new _("Failed to sync with custom auth provider")}),void Mr(ze,"customAuth","onUnauthenticated");void 0!==n&&Mr(ze,"login","onComplete",r,n,!1,"custom",null),et.current=t,Mr(ze,"customAuth","onAuthenticated",{user:r}),Be({status:"done"}),w(r||null),M(n||!1),g(!0),Le(!0)}catch(e){if(console.warn(e),await _t.logout(),Mr(ze,"customAuth","onUnauthenticated"),"User already exists with provided custom JWT account."===e.message)return void Be({status:"initial"});Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),Be({status:"error",error:e})}}})()}),["initial"===Fe.status,be.customAuth?.enabled,be.customAuth?.getCustomAccessToken,be.customAuth?.isLoading,h,f]),p((()=>{Me&&ve&&y&&U(y,be.embeddedWallets.createOnLogin)&&(Le(!1),pt(y,qe).catch(console.error))}),[Me&&ve&&y]),p((()=>{if(be.externalWallets.solana.connectors)return be.externalWallets.solana.connectors.onMount(),()=>be.externalWallets.solana.connectors?.onUnmount()}),[be.externalWallets.solana.connectors]),p((()=>{!h&&$e&&async function(){let e,t=tt(),r=rt();(()=>{let e=new URLSearchParams(window.location.search).get("privy_token");if(!e)return;Nt.put(Se,e);let t=new URL(window.location.href);t.searchParams.delete("privy_token"),window.history.pushState({},"",t)})();let n=o();a.initializeConnectorManager({walletConnectCloudProjectId:be.walletConnectCloudProjectId,rpcConfig:be.rpcConfig,chains:be.chains,defaultChain:be.defaultChain,store:n,walletList:be.appearance.walletList,shouldEnforceDefaultChainOnConnect:be.shouldEnforceDefaultChainOnConnect,externalWalletConfig:be.externalWallets,appName:be.name??"Privy",walletChainType:be.appearance.walletChainType}),a.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=a.connectors.walletConnectors.length,r=a.connectors.walletConnectors.reduce(((e,t)=>e+(t.initialized?1:0)),0);r===t?Ve(!0):e=setTimeout((()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:r,expected:t}),Ve(!0)}),1500)})),a.connectors?.initialize().then((()=>{lt()}));let i=await a.getAuthenticatedUser(),l=!!i;be.legal.requireUsersAcceptTerms&&i&&!i.hasAcceptedTerms?(await a.logout(),At.setReadyToTrue(!0),Mr(ze,"logout","onSuccess")):(be.customAuth?.enabled||(g(!!i),i&&Mr(ze,"login","onComplete",i,!1,!0,null,null),w(i)),t?Ze.current=l?"link":"login":r&&!l?(Ze.current="login",Ae({telegramAuthModalData:{seamlessAuth:!0}}),Je(Er.TELEGRAM_AUTH_SCREEN)):At.setReadyToTrue(!!i))}()}),[a,ke,h,$e]),p((()=>{if(h){if(!y||!y.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void Re(!0);Re(!!v.find((e=>"privy"===e.walletClientType)))}}),[h,y,v]);let tt=()=>{let e=Sl();return e.inProgress&&e.popupFlow?window.opener.location.origin!==window.location.origin?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."}):"error"===e.authorizationCode?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."}):void window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}):(e.inProgress&&function(e){return e.startsWith("privy:")}(e.provider)&&!e.popupFlow&&(new BroadcastChannel(Qv).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!!e.withPrivyUi&&(a.startAuthFlow(new fl(e)),Je(Er.AWAITING_OAUTH_SCREEN),!0))},rt=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),n=Number(e.get("auth_date")||""),a=e.get("first_name");if(t&&a&&n&&r)return Object.fromEntries(e.entries())}())?(rs(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("user"),n=Number(t.get("auth_date")||""),a=t.get("hash");return r&&n&&a?Object.fromEntries(t.entries()):void 0}())?(rs(),{flowType:"web-app",authData:e}):void 0}();if(!e||!be.loginMethods.telegram||!be.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new es;return a.startAuthFlow(t),"login-url"===e.flowType&&(t.meta.telegramWebAppData=void 0,t.meta.telegramAuthResult=e.authData),"web-app"===e.flowType&&(t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData=e.authData),!0},nt=async(e,t,r,n)=>{at(await(a.connectors?.createEthereumWalletConnector(e,t))||null,t,r,n)};async function at(e,t,r,n){if(!e)return z({status:"disconnected",connectedWallet:null,connectError:new I("Unable to connect to wallet."),connector:null,connectRetry:N}),n?.(null,r);z({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:N}),e instanceof Ms&&t&&await e.resetConnection(t),z({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>at(e,t,r,n)});try{let t=await e.connect({showPrompt:!0});if((!t||os(t))&&be.shouldEnforceDefaultChainOnConnect&&!be.chains.find((e=>e.id===Number(t?.chainId.replace("eip155:",""))))&&("wallet_connect_v2"!==t?.connectorType||"metamask"!==t?.walletClientType)){z((t=>({...t,connector:e,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:N})));try{await(t?.switchChain(be.defaultChain.id)),t&&(t.chainId=ue(ge(be.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${be.defaultChain.id}`)}}return z((e=>({...e,status:"connected",connectedWallet:t,connectError:null,connectRetry:N}))),t&&Mr(ze,"connectWallet","onSuccess",(e.chainType,t)),n?.(t,r)}catch(e){return e instanceof S?(console.warn(e.cause?e.cause:e.message),Mr(ze,"connectWallet","onError",e.privyErrorCode||k.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),Mr(ze,"connectWallet","onError",k.UNKNOWN_CONNECT_WALLET_ERROR)),z((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),n?.(null,r)}}let it=async(e,t,r)=>{if(null===e||!os(e))return;let n=new Ol(e,a,t,r);a.startAuthFlow(n)},ot=async(e,t)=>{if(null===e||!wr(e))return;let r=new Zl(e,a,t);a.startAuthFlow(r)},lt=()=>{let e=new URLSearchParams(window.location.search),t=e.get("privy_connector"),r=e.get("privy_wallet_client");if(!t||!r)return;if("phantom"!==r||Ee()||Je(Er.LOGIN_FAILED_SCREEN),!a.connectors)throw new _("Connector not initialized");Qe(Er.AWAITING_CONNECTION);let n=new URL(window.location.href);n.searchParams.delete("privy_connector"),n.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",n),nt(t,r,void 0,it)};p((()=>{h&&f&&null===y&&a.getAuthenticatedUser().then(w)}),[h,f,y,a]);let st=e=>{if(!f)throw Mr(ze,"linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:e}),new _("User must be authenticated before linking an account.")},dt=()=>{st("siwe"),Ke.current="siwe",Ze.current="link",Qe(Er.LINK_WALLET_SCREEN)},ct=e=>{if(!f||!y)return!1;if("privy"===e.walletClientType)return!0;for(let t of y.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},ut=async e=>{let t;if(!a.connectors)throw new _("Connector not initialized");t="ethereum"===e.type?a.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:a.connectors.findSolanaWalletConnector(e.connectorType,e.walletClientType)||null,z((r=>({...r,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:N}))),be.captchaEnabled&&!f?(Ae({captchaModalData:{callback:t=>os(e)?it(e,t):ot(e,t),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_CONNECTION,onErrorNavigateTo:Er.ERROR_SCREEN}}),Je(Er.CAPTCHA_SCREEN)):(os(e)?await it(e):await ot(e),Je(Er.AWAITING_CONNECTION))},ht=()=>{C((e=>{let t=a.connectors?.wallets.filter(os).map((e=>({...e,linked:ct(e),loginOrLink:async()=>{if(!await e.isConnected())throw new _("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new _("Cannot link or login with embedded wallet");ut(e)},fund:async t=>{await At.fundWallet(e.address,t)},unlink:async()=>{if(!f)throw new _("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new _("Cannot unlink an embedded wallet");w(await a.unlinkEthereumWallet(e.address))}})))||[];return ls(e,t)?e:t})),$((e=>{let t=a.connectors?.wallets.filter(wr).map((e=>({...e,linked:ct(e),loginOrLink:async()=>{if(!await e.isConnected())throw new _("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new _("Cannot link or login with embedded wallet");ut(e)},fund:async()=>{throw new _("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:async()=>{if(!f)throw new _("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new _("Cannot unlink an embedded wallet");w(await a.unlinkSolanaWallet(e.address))}})))||[];return ls(e,t)?e:t}))};p((()=>{ht()}),[y?.linkedAccounts,f,h]),p((()=>{if(h){if(!a.connectors)throw new _("Connector not initialized");ht(),a.connectors.on("walletsUpdated",ht)}}),[h]),p((()=>{[...be.loginMethodsAndOrder?.primary??[],...be.loginMethodsAndOrder?.overflow??[]].filter((e=>e.startsWith("privy:"))).forEach((e=>a.getCrossAppProviderDetails(e.replace("privy:",""))))}),[!!a]),p((()=>{let e;if(!v[0])return;let t=v[0],r=O.current.find((e=>e.address===t.address));if(e="privy"===t.walletClientType?y?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"===e.walletClientType)):y?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"!==e.walletClientType)),!r&&e){let t=Object.assign({},y);t.wallet=e&&{address:e.address,chainType:e.chainType,chainId:e.chainId,walletClient:e.walletClient,walletClientType:e.walletClientType,connectorType:e.connectorType,imported:e.imported,delegated:e.delegated,walletIndex:e.walletIndex},w(t)}O.current=v}),[v]);let pt=async(e,t,r)=>{let n=G(e),a=H(e);if(r&&"walletIndex"in r)return ft(e,t,r.walletIndex,n,a);let i=r&&"createAdditional"in r&&r.createAdditional;if(n&&!i)throw Mr(ze,"createWallet","onError",k.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");let[o,l]=await Promise.all([At.initializeWalletProxy(t),vC()]);if(!o&&be.customAuth?.enabled)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(!o||!l||be.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return mt();if(!n)return console.log("solanaWallet",a),await o.create({accessToken:l,solanaAddress:a?.address}),gt(0);{let t=(X(e)?.walletIndex??0)+1,{entropyId:r,entropyIdVerifier:n}=P(j(e));return await At.recoverPrimaryWallet(),await o.addWallet({accessToken:l,entropyId:r,entropyIdVerifier:n,chainType:"ethereum",hdWalletIndex:t}),gt(t)}},mt=async()=>new Promise(((e,t)=>{xe(!0),Ae({createWallet:{onSuccess:t=>{Mr(ze,"createWallet","onSuccess",t),e(t)},onFailure:e=>{Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),t(e)},callAuthOnSuccessOnClose:!1}}),Qe(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)})),ft=async(e,t,r,n,a)=>{if(r<0)throw Mr(ze,"createWallet","onError",k.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${r}) is invalid.`);let[i,o]=await Promise.all([At.initializeWalletProxy(t),vC()]);if(!i&&be.customAuth?.enabled)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(!i||!o||be.embeddedWallets?.requireUserOwnedRecoveryOnCreate){if(0==r)return mt();throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Create wallet UI can only be displayed when walletIndex is 0.")}if(0==r){if(n)return n;await i.create({accessToken:o,solanaAddress:a?.address})}else{if(!n)throw Mr(ze,"createWallet","onError",k.EMBEDDED_WALLET_CREATE_ERROR),Error("A user must have a wallet at HD index 0 before creating a wallet at greater HD indices.");let t=Y(e).find((e=>e.walletIndex===r));if(t)return t;let{entropyId:a,entropyIdVerifier:l}=P(j(e));await At.recoverPrimaryWallet(),await i.addWallet({accessToken:o,entropyId:a,entropyIdVerifier:l,chainType:"ethereum",hdWalletIndex:r})}return gt(r)},gt=async e=>{let t=Y(await At.refreshUser()).find((t=>t.walletIndex===e));if(!t)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");return Mr(ze,"createWallet","onSuccess",t),t},yt=(e,t,a,i)=>new Promise((async(o,l)=>{let{requesterAppId:s}=t||{};if(!f||!y)return Mr(ze,"sendTransaction","onError",k.MUST_BE_AUTHENTICATED),void l(Error("User must be authenticated before signing with a Privy wallet"));let d=i??G(y)?.address;if(!d)throw new _("User must have an embedded wallet to send a transaction.");let{signingWallet:c,rootWallet:u}=Q(y,d);if(!u||!c)return Mr(ze,"sendTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),void l(Error("Must have a Privy wallet before signing"));xe(!0);let h=kt.wallets.find((e=>"privy"===e.walletClientType&&n(e.address)===n(c.address))),p=await(h?.getEthereumProvider());if(!h||!p)throw new _(`Cannot sendTransaction before embedded wallet ${c.address} is connected`);let m=e.chainId?Number(e.chainId):Xv(h.chainId);(e=>{if(!be.chains.map((e=>e.id)).includes(e))throw new I(`Chain ID ${e} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,k.UNSUPPORTED_CHAIN_ID)})(m);let g=Object.assign({},e,{chainId:m});if(Xe({showWalletUIs:t?.showWalletUIs}))(async()=>{let e=await vC();if(!e||!ve)return Mr(ze,"sendTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),void l(Error("Must have valid access token and Privy wallet to send transaction"));try{if(!await At.recoverPrimaryWallet())return Mr(ze,"sendTransaction","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),void l(Error("Unable to connect to wallet"));let n=ye(g.chainId,be.chains,be.rpcConfig,{appId:r.appId}),a=await La(c.address,g,n);if(Xe({showWalletUIs:t?.showWalletUIs})){let{totalGasEstimate:e}=await Ra(a,n),{hasSufficientFunds:t}=await Fw(c.address,a,e,n);if(!t)throw new mr(new gr("Wallet has insufficient funds for this transaction.",yr.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let{entropyId:i,entropyIdVerifier:d}=P(u),h=await Dw({accessToken:e,entropyId:i,entropyIdVerifier:d,transactingWallet:c,walletProxy:ve,transactionRequest:a,provider:n,requesterAppId:s});Mr(ze,"sendTransaction","onSuccess",h),o(h)}catch(e){Mr(ze,"sendTransaction","onError",k.TRANSACTION_FAILURE),l(e)}})();else{let{entropyId:e,entropyIdVerifier:r}=P(u),n={entropyId:e,entropyIdVerifier:r,onCompleteNavigateTo:Er.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:e=>{Mr(ze,"sendTransaction","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),l(e)}},i=oC({address:c.address,appConfig:be,fundWalletConfig:a,methodScreen:Er.FUNDING_METHOD_SELECTION_SCREEN,chainIdOverride:g.chainId,comingFromSendTransactionScreen:!0});Ae({connectWallet:n,sendTransaction:{transactionRequest:g,transactingWallet:c,entropyId:e,entropyIdVerifier:r,onSuccess:e=>{Mr(ze,"sendTransaction","onSuccess",e),o(e)},onFailure:e=>{Mr(ze,"sendTransaction","onError",k.TRANSACTION_FAILURE),l(e)},uiOptions:t||{},fundWalletConfig:a,requesterAppId:s},funding:i}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),wt=({transaction:e,connection:t,transactionOptions:r,fundWalletConfig:n,uiOptions:a,wallet:i})=>new Promise((async(o,l)=>{let{requesterAppId:s}=a||{};if(!f||!y)return Mr(ze,"sendSolanaTransaction","onError",k.MUST_BE_AUTHENTICATED),void l(new _("User must be authenticated before signing with a Privy wallet",k.MUST_BE_AUTHENTICATED));let d=i?y.linkedAccounts.find((e=>"wallet"===e.type&&e.address===i.address)):H(y);if(!d)return Mr(ze,"sendSolanaTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),void l(new _("Must have a Privy wallet before signing",k.EMBEDDED_WALLET_NOT_FOUND));xe(!0);let c=i??E,u=await(c?.isConnected());if(!c||!u)throw Mr(ze,"sendSolanaTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),new _(`Cannot sendSolanaTransaction before embedded wallet ${d.address} is connected`,k.EMBEDDED_WALLET_NOT_FOUND);if(Xe({showWalletUIs:a?.showWalletUIs}))(async()=>{let n=await vC();if(!n||!ve)return Mr(ze,"sendSolanaTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),void l(new _("Must have valid access token and Privy wallet to send transaction",k.EMBEDDED_WALLET_NOT_FOUND));try{if(!await At.recoverPrimaryWallet())return Mr(ze,"sendSolanaTransaction","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),void l(new _("Unable to connect to wallet",k.UNKNOWN_CONNECT_WALLET_ERROR));if(Xe({showWalletUIs:a?.showWalletUIs})){let{instructions:r}=await Bp(e,t);r.every((e=>e.hasFunds))||(Mr(ze,"sendSolanaTransaction","onError",k.INSUFFICIENT_BALANCE),l(new _("Solana wallet has insufficient funds for this transaction.",k.INSUFFICIENT_BALANCE)))}let{entropyId:i,entropyIdVerifier:s}=Z(y),{signature:c,receipt:u}=await tw({accessToken:n,tx:e,connection:t,walletProxy:ve,transactionOptions:r,entropyId:i,entropyIdVerifier:s,transactingWalletAddress:d.address,transactingWalletIndex:d.walletIndex??0}),h=Wp(c,u);Mr(ze,"sendSolanaTransaction","onSuccess",h),o(h)}catch(e){Mr(ze,"sendSolanaTransaction","onError",k.TRANSACTION_FAILURE),l(e)}})();else{let{entropyId:i,entropyIdVerifier:c}=P(d),u={entropyId:i,entropyIdVerifier:c,onCompleteNavigateTo:Er.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN,onFailure:e=>{Mr(ze,"sendSolanaTransaction","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),l(e)}},h=lC({address:d.address,appConfig:be,methodScreen:Er.FUNDING_METHOD_SELECTION_SCREEN,fundWalletConfig:n,comingFromSendTransactionScreen:!0});Ae({connectWallet:u,sendSolanaTransaction:{transactionRequest:e,connection:t,transactionOptions:r,transactingWallet:d,onSuccess:e=>{Mr(ze,"sendSolanaTransaction","onSuccess",e),o(e)},onFailure:e=>{Mr(ze,"sendSolanaTransaction","onError",k.TRANSACTION_FAILURE),l(e)},uiOptions:a||{},requesterAppId:s},funding:h}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}}));function vt(){return new Promise((async(e,t)=>{let r=await vC();if(!r||!ve)throw Error("Must have valid access token to enroll in MFA");try{await ve.verifyMfa({accessToken:r}),e()}catch(e){t(e)}}))}let Ct=e=>e?.linkedAccounts.filter((e=>null!==e.latestVerifiedAt&&!("wallet"===e.type&&"privy"===e.walletClientType))).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0],bt=e=>{let t=y?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:r,loginMethod:n}=Uf(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw Mr(ze,"linkAccount","onError",k.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:n}),new _(`User already has an account of type ${r} linked.`)};async function $t({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){D(null);let r=t?"setWalletPassword":"setWalletRecovery";if(!f||!y)throw Mr(ze,r,"onError",k.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let n=j(y);if(!n||!ve)throw Mr(ze,r,"onError",k.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");try{await vt()}catch(e){throw Mr(ze,r,"onError",k.MISSING_MFA_CREDENTIALS),e}return new Promise(((a,i)=>{xe(!0);let o={onSuccess:e=>{Mr(ze,r,"onSuccess","user-passcode",e),a(e)},onFailure:e=>{Mr(ze,r,"onError",k.USER_EXITED_SET_PASSWORD_FLOW),i(e)},callAuthOnSuccessOnClose:!1},l="user-passcode"===n.recoveryMethod,s=Uu({walletAction:"update",availableRecoveryMethods:be.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:l,showAutomaticRecovery:e}),{entropyId:d,entropyIdVerifier:c}=P(n);Ae({setWalletPassword:o,recoverWallet:{entropyId:d,entropyIdVerifier:c,onFailure:i},createWallet:o,connectWallet:{onCompleteNavigateTo:s,shouldForceMFA:!1,entropyId:d,entropyIdVerifier:c,onFailure:e=>{Mr(ze,r,"onError",k.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}},recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:l}}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}))}async function Et({appId:e,action:t}){let r=await vC();if("link"===t&&!r)throw Mr(ze,"linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new _("User must be authenticated before linking an account.");if("login"===t&&r)throw Mr(ze,"login","onError",k.UNKNOWN_AUTH_ERROR),new _("Attempted to log in, but user is already logged in. Use a `link` helper instead.");Ke.current=`privy:${e}`,Ze.current=t;let n=nf();return a.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(r,i)=>{let{name:o,logoUrl:l}=await tC({api:a.api,providerAppId:e,requesterAppId:be.id});Ae({crossAppAuth:{appId:e,name:o,logoUrl:l,action:t,popup:n,onSuccess:r,onError:i}}),Je(Er.CROSS_APP_AUTH_SCREEN)}))}let _t={ready:h,authenticated:f,user:y,walletConnectors:a.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),Ae({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress}}),Qe(f?Er.CONNECT_ONLY_AUTHENTICATED_SCREEN:Er.CONNECT_ONLY_LANDING_SCREEN)},linkWallet:dt,startCrossAppAuthFlow:Et,linkEmail:()=>{st("email"),bt("email"),Ke.current="email",Ze.current="link",Qe(Er.LINK_EMAIL_SCREEN)},linkPhone:()=>{st("sms"),bt("phone"),Ke.current="sms",Ze.current="link",Qe(Er.LINK_PHONE_SCREEN)},linkGoogle:async()=>{st("google"),bt("google_oauth"),Ze.current="link",await At.initLoginWithOAuth("google")},linkTwitter:async()=>{st("twitter"),bt("twitter_oauth"),Ze.current="link",await At.initLoginWithOAuth("twitter")},linkDiscord:async()=>{st("discord"),bt("discord_oauth"),Ze.current="link",await At.initLoginWithOAuth("discord")},linkGithub:async()=>{st("github"),bt("github_oauth"),Ze.current="link",await At.initLoginWithOAuth("github")},linkSpotify:async()=>{st("spotify"),bt("spotify_oauth"),Ze.current="link",await At.initLoginWithOAuth("spotify")},linkInstagram:async()=>{st("instagram"),bt("instagram_oauth"),Ze.current="link",await At.initLoginWithOAuth("instagram")},linkTiktok:async()=>{st("tiktok"),bt("tiktok_oauth"),Ze.current="link",await At.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{st("linkedin"),bt("linkedin_oauth"),Ze.current="link",await At.initLoginWithOAuth("linkedin")},linkApple:async()=>{st("apple"),bt("apple_oauth"),Ze.current="link",await At.initLoginWithOAuth("apple")},linkPasskey:async()=>{st("passkey"),bt("passkey"),await At.initLinkWithPasskey(),Qe(Er.LINK_PASSKEY_SCREEN)},linkTelegram:async()=>{st("telegram"),bt("telegram"),Ze.current="link",Ke.current="telegram",await At.initLoginWithTelegram(),Qe(Er.TELEGRAM_AUTH_SCREEN)},linkFarcaster:async()=>{st("farcaster"),bt("farcaster"),await At.initLoginWithFarcaster(),Ze.current="link",Ke.current="farcaster",Qe(Er.AWAITING_FARCASTER_CONNECTION)},updateEmail:()=>{if(st("email"),!y?.email)throw new _("User does not have an email linked to their account.");Ze.current="update",Ke.current="email",Qe(Er.UPDATE_EMAIL_SCREEN)},updatePhone:()=>{if(st("sms"),!y?.phone)throw new _("User does not have a phone number linked to their account.");Ze.current="update",Ke.current="sms",Qe(Er.UPDATE_PHONE_SCREEN)},login:async e=>{e&&"target"in e&&e&&(e=void 0);let t="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!h){let e=await new Promise((e=>{Ne((t=>e.bind(t)))}));if(Ne(null),e)return void console.warn(t)}!y||y.isGuest?(Ze.current="login",Ae({login:e}),Je(Er.LANDING)):console.warn(t)},connectOrCreateWallet:async()=>{h||(await new Promise((e=>{Ne((()=>e))})),Ne(null)),f?console.warn("User must be unauthenticated to `connectOrCreateWallet`"):(Ze.current="login",Je(Er.CONNECT_OR_CREATE))},logout:async()=>{if(Ze.current=null,Ke.current=null,y&&a.clearProviderAcccessTokens(y),D(null),await a.logout(),y&&ve)try{await ve.clearMfa({userId:y.id})}catch(e){}w(null),g(!1),Mr(ze,"logout","onSuccess"),u(!1),Nt.del(Ue),Nt.del(ae(be.id))},getAccessToken:()=>a.getCustomerAccessToken(),getEthereumProvider:()=>{if(!y||!y.wallet)return new ds;let e=v.find((e=>y.wallet&&e.address===y.wallet.address)),t=a.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new ds},getEthersProvider:()=>{if(!y||!y.wallet)return new i(new cs(new ds));let e=v.find((e=>y.wallet&&e.address===y.wallet.address)),t=a.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new i(new cs(e&&t?t.proxyProvider:new ds))},getWeb3jsProvider:()=>{if(!y||!y.wallet)return new us(new ds);let e=v.find((e=>y.wallet&&e.address===y.wallet.address)),t=a.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new us(e&&t?t.proxyProvider:new ds)},unlinkWallet:async e=>{let t;return w(t=e.startsWith("0x")?await a.unlinkEthereumWallet(e):await a.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await a.unlinkEmail(e);return w(t),t},unlinkPhone:async e=>{let t=await a.unlinkPhone(e);return w(t),t},unlinkGoogle:async e=>{let t=await a.unlinkOAuth("google",e);return w(t),t},unlinkTwitter:async e=>{let t=await a.unlinkOAuth("twitter",e);return w(t),t},unlinkDiscord:async e=>{let t=await a.unlinkOAuth("discord",e);return w(t),t},unlinkGithub:async e=>{let t=await a.unlinkOAuth("github",e);return w(t),t},unlinkSpotify:async e=>{let t=await a.unlinkOAuth("spotify",e);return w(t),t},unlinkInstagram:async e=>{let t=await a.unlinkOAuth("instagram",e);return w(t),t},unlinkTiktok:async e=>{let t=await a.unlinkOAuth("tiktok",e);return w(t),t},unlinkLinkedIn:async e=>{let t=await a.unlinkOAuth("linkedin",e);return w(t),t},unlinkApple:async e=>{let t=await a.unlinkOAuth("apple",e);return w(t),t},unlinkFarcaster:async e=>{let t=await a.unlinkFarcaster(e);return w(t),t},unlinkTelegram:async e=>{let t=await a.unlinkTelegram(e);return w(t),t},unlinkPasskey:async e=>{let t=await a.unlinkPasskey(e);return w(t),t},unlinkCrossAppAccount:async({subject:e})=>{let t=y?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new _("Invalid subject");a.storeProviderAccessToken(t.id,null);let r=await a.unlinkOAuth(`privy:${t.id}`,e);return w(r),r},setActiveWallet:async e=>{let t=v.find((t=>n(t.address)===n(e))),r=y?.linkedAccounts.find((t=>"wallet"===t.type&&n(t.address)===n(e)));if(t&&await t.isConnected())if(t.linked){let e=Object.assign({},y);e.wallet=r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,imported:r.imported,delegated:r.delegated,walletIndex:r.walletIndex},w(e)}else t.loginOrLink();else Ae({externalConnectWallet:{suggestedAddress:e}}),dt()},forkSession:()=>a.forkSession(),createWallet:async e=>{if(e&&"target"in e&&e&&(e=void 0),!f||!y)throw Mr(ze,"createWallet","onError",k.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return pt(y,15e3,e)},setWalletRecovery:async e=>$t({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>$t({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:o}=t||{};if(!f||!y)return Mr(ze,"signMessage","onError",k.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let l=r??G(y)?.address;if(!l)throw new _("User must have an embedded wallet to sign a message.");let{signingWallet:s,rootWallet:d}=Q(y,l);if(!s||!d)return Mr(ze,"signMessage","onError",k.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));if("string"!=typeof e||e.length<1)return Mr(ze,"signMessage","onError",k.INVALID_MESSAGE),void i(Error("Message must be a non-empty string"));xe(!0);let c=async()=>{if(!f)throw Error("User must be authenticated before signing with a Privy wallet");let t=await vC();if(!ve||!t||!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");a.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:s.address,requesterAppId:o}});let{entropyId:r,entropyIdVerifier:n}=P(d),{response:i}=await ve.rpc({accessToken:t,entropyId:r,entropyIdVerifier:n,chainType:"ethereum",hdWalletIndex:s.walletIndex??0,requesterAppId:o,request:{method:"personal_sign",params:[e,s.address]}}),l=i.data;return a.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:s.address,requesterAppId:o}}),l};if(Xe({showWalletUIs:t?.showWalletUIs}))try{let e=await c();Mr(ze,"signMessage","onSuccess",e),n(e)}catch(e){Mr(ze,"signMessage","onError",k.UNABLE_TO_SIGN),i(e??new mr("Unable to sign message"))}else{let{entropyId:r,entropyIdVerifier:a}=P(d);Ae({signMessage:{method:"personal_sign",data:e,confirmAndSign:c,onSuccess:e=>{Mr(ze,"signMessage","onSuccess",e),n(e)},onFailure:e=>{Mr(ze,"signMessage","onError",k.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{entropyId:r,entropyIdVerifier:a,onCompleteNavigateTo:Er.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{Mr(ze,"signMessage","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}}}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),signTypedData:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:o}=t||{};if(!f||!y)return Mr(ze,"signTypedData","onError",k.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let l=r??G(y)?.address;if(!l)throw new _("User must have an embedded wallet to sign a message.");let{signingWallet:s,rootWallet:d}=Q(y,l);if(!d||!s)return Mr(ze,"signTypedData","onError",k.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));xe(!0);let c=we(e),u=async()=>{if(!f)throw Error("User must be authenticated before signing with a Privy wallet");let e=await vC();if(!ve||!e||!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");a.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:s.address,requesterAppId:o}});let{entropyId:t,entropyIdVerifier:r}=P(d),{response:n}=await ve.rpc({accessToken:e,entropyId:t,entropyIdVerifier:r,chainType:"ethereum",hdWalletIndex:s.walletIndex??0,requesterAppId:o,request:{method:"eth_signTypedData_v4",params:[s.address,c]}}),i=n.data;return a.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:s.address,requesterAppId:o}}),i};if(Xe({showWalletUIs:t?.showWalletUIs,typedData:!0}))try{let e=await u();Mr(ze,"signTypedData","onSuccess",e),n(e)}catch(e){Mr(ze,"signTypedData","onError",k.UNABLE_TO_SIGN),i(e??new mr("Unable to sign message"))}else{let{entropyId:e,entropyIdVerifier:r}=P(d);Ae({signMessage:{method:"eth_signTypedData_v4",data:c,confirmAndSign:u,onSuccess:e=>{Mr(ze,"signTypedData","onSuccess",e),n(e)},onFailure:e=>{Mr(ze,"signTypedData","onError",k.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{entropyId:e,entropyIdVerifier:r,onCompleteNavigateTo:Er.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{Mr(ze,"signMessage","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}}}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),sendTransaction:async(e,t,r,n)=>{let a=await yt(e,t,r,n);return Uw(await a.wait())},sendSolanaTransaction:async(e,t,r,n,a)=>await wt({transaction:e,connection:t,transactionOptions:n,uiOptions:r,fundWalletConfig:a,wallet:E??void 0}),exportWallet:e=>new Promise((async(t,n)=>{if(!f||!y)return void n(Error("User must be authenticated before exporting their Privy wallet"));e&&"target"in e&&e&&(e=void 0);let i=e?.address??G(y)?.address;if(!i)return void n(Error("User does not have an HD Ethereum wallet. To export an imported wallet, pass the `address` of the wallet to `exportWallet`."));let{signingWallet:o,rootWallet:l}=Q(y,i);if(!o||!l)return void n(Error("Must have a Privy wallet before exporting"));xe(!0);let{entropyId:s,entropyIdVerifier:d}=P(l),c={entropyId:s,entropyIdVerifier:d,onCompleteNavigateTo:Er.EMBEDDED_WALLET_KEY_EXPORT_SCREEN,onFailure:n,shouldForceMFA:!0};Ae(_e),await vC()&&ve?ve?(Ae({keyExport:{appId:r.appId,appClientId:r.clientId,origin:a.apiUrl,walletToExport:o,primaryWallet:l,onSuccess:t,onFailure:n},connectWallet:c}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)):n(Error("Must have a Privy wallet before exporting")):n(Error("Must have valid access token to enroll in MFA"))})),promptMfa:vt,async init(e){switch(e){case"sms":return void await a.initMfaSmsVerification();case"passkey":return await a.initMfaPasskeyVerification();case"totp":return;default:throw Error(`Unsupported MFA method: ${e}`)}},async submit(e,t){switch(e){case"totp":case"sms":if("string"!=typeof t)throw new _("Invalid MFA code");Ge.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{He.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new _("Invalid authenticator response");let r=await import("@simplewebauthn/browser"),n=(e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}))(await r.startAuthentication(t));Ge.current?.resolve({mfaMethod:e,mfaCode:n,relyingParty:window.origin}),await new Promise(((e,t)=>{He.current={resolve:e,reject:t}}));break;default:throw Ge.current?.reject(new _("Unsupported MFA method")),new _(`Unsupported MFA method: ${e}`)}},cancel(){Ge.current?.reject(new _("MFA canceled"))},async initEnrollmentWithSms(e){let t=await vC();if(!t||!ve)throw Error("Must have valid access token to enroll in MFA");await ve.initEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber})},enrollInMfa:e=>new Promise(((t,r)=>{if(!e)return At.closePrivyModal(),void t();be.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),Ae({mfaEnrollmentFlow:{mfaMethods:be.mfa.methods,onSuccess:t,onFailure:r}}),Qe(Er.MFA_ENROLLMENT_FLOW_SCREEN)})),async initEnrollmentWithTotp(){let e=await vC();if(!e||!ve)throw Error("Must have valid access token to enroll in MFA");let t=await ve.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await vC();if(!t||!ve)throw Error("Must have valid access token to enroll in MFA");await ve.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),w(await a.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await vC();if(!t||!ve)throw Error("Must have valid access token to enroll in MFA");await ve.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),w(await a.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e}){let t=await vC();if(!t||!ve)throw Error("Must have valid access token to enroll in MFA");await ve.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:e}),w(await a.getAuthenticatedUser())},async unenroll(e){let t=await vC();if(!t||!ve)throw Error("Must have valid access token to remove MFA");"passkey"===e?await ve.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:[]}):await ve.unenrollMfa({method:e,accessToken:t}),w(await a.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await vC(),t=y?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!ve||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(!y?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");let r=await ve.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===r.status&&w(await a.getAuthenticatedUser()||y||null),Ae({farcasterSigner:r}),Qe(Er.AWAITING_FARCASTER_SIGNER)},getFarcasterSignerPublicKey:async()=>{let e,t=await vC(),r=y?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!ve||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!y?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");if(!y.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=y.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await vC(),r=y?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!ve||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!y?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");if(!y.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let n=await import("@simplewebauthn/browser"),a=await ve.signFarcasterMessage({address:r.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:n.bufferToBase64URLString(e)},fid:BigInt(y.farcaster.fid),relyingParty:window.origin});return new Uint8Array(n.base64URLStringToBuffer(a.signature))},createGuestAccount:async()=>{if(y&&!y.isGuest)throw Error("User cannot already be authenticated to create a guest account");return y?.isGuest?y:At.loginWithGuestAccountFlow()},signMessageWithCrossAppWallet(e,{address:t}){let r=y?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return rC({user:y,client:a,address:t,requesterAppId:be.id,request:{method:r?"privy_signSmartWalletMessage":"personal_sign",params:[e,t]},reconnect:Et})},signTypedDataWithCrossAppWallet(e,{address:t}){let r=y?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t)))),n=we(e);return rC({user:y,client:a,address:t,requesterAppId:be.id,request:{method:r?"privy_signSmartWalletTypedData":"eth_signTypedData_v4",params:[t,n]},reconnect:Et})},sendTransactionWithCrossAppWallet(e,{address:t}){let r=y?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return rC({user:y,client:a,address:t,requesterAppId:be.id,request:{method:r?"privy_sendSmartWalletTx":"eth_sendTransaction",params:[e]},reconnect:Et})},isModalOpen:l,mfaMethods:be.mfa.methods};hC=_t.signMessage,pC=_t.signTypedData,mC=async(...e)=>{let t=await yt(...e);return be.embeddedWallets.waitForTransactionConfirmation&&await t.wait(),t};let At={isNewUserThisSession:R,pendingTransaction:null,walletConnectionStatus:B,connectors:a.connectors?.walletConnectors??[],solanaWallets:b,rpcConfig:be.rpcConfig,chains:be.chains,appId:r.appId,showFiatPrices:"native-token"!==be.embeddedWallets.priceDisplay.primary,clientAnalyticsId:a.clientAnalyticsId,customAuthStatus:Fe,noPromptOnSignature:Ye,emailOtpState:ne,setEmailOtpState:ie,smsOtpState:de,setSmsOtpState:ce,oAuthState:me,setOAuthState:fe,siweState:he,setSiweState:pe,isHeadlessOAuthLoading:F,nativeTokenSymbolForChainId:e=>be.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(ve)return ve;let t=new Promise((e=>{Pe((()=>t=>e(t)))})),r=new Promise((t=>setTimeout((()=>t(null)),e))),n=await Promise.race([t,r]);return Pe(null),n},getAuthFlow:()=>a.authFlow,getAuthMeta:()=>a.authFlow?.meta,client:a,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,n=h&&f&&y;n&&Ke.current&&(t=Ct(y)),"login"===Ze.current?e.shouldCallAuthOnSuccess&&n&&Ke.current?(Mr(ze,"login","onComplete",y,R,!1,Ke.current,t??null),r.onSuccess?.(y,R)):Mr(ze,"login","onError",k.USER_EXITED_AUTH_FLOW):"link"===Ze.current&&t?e.isSuccess&&n&&Ke.current?Mr(ze,"linkAccount","onSuccess",y,Ke.current,t):Ke.current&&Mr(ze,"linkAccount","onError",k.USER_EXITED_LINK_FLOW,{linkMethod:Ke.current}):"update"===Ze.current&&t&&(e.isSuccess&&n&&Ke.current?Mr(ze,"update","onSuccess",y,Ke.current,t):Ke.current&&Mr(ze,"update","onError",k.USER_EXITED_UPDATE_FLOW,{linkMethod:Ke.current}));let i=L&&sC.includes(L),o=L===Er.ERROR_SCREEN&&_e.errorModalData&&sC.includes(_e.errorModalData.previousScreen);if((i||o)&&_e.funding){let e,t=dC[L]??null;if("solana"===_e.funding.chainType){let{Connection:r,PublicKey:n}=await import("@solana/web3.js");try{e=await new r(Ip(_e.funding.cluster)).getBalance(new n(_e.funding.address)).then((e=>BigInt(e)))}catch{console.error("Unable to pull wallet balance")}Mr(ze,"fundSolanaWallet","onUserExited",{address:_e.funding.address,cluster:_e.funding.cluster,fundingMethod:t,balance:e})}else{let n=ye(_e.funding.chain.id,be.chains,be.rpcConfig,{appId:r.appId});try{e=(await n.getBalance(_e.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}Mr(ze,"fundWallet","onUserExited",{address:_e.funding.address,chain:_e.funding.chain,fundingMethod:t,balance:e})}}Ae({..._e,externalConnectWallet:{suggestedAddress:void 0}}),Ze.current=null,Ke.current=null,M(!1),u(!1),setTimeout((()=>{a.authFlow=void 0}),200),a.createAnalyticsEvent({eventName:"modal_closed"})},solanaSignMessage:async({message:e})=>new Promise((async(t,r)=>{let n=async()=>{let t=await a.getAccessToken();if(!t)throw Error("User must be authenticated to use their embedded wallet.");if(!E)throw Error("User must have an embedded Solana wallet to sign messages for Solana.");let r=At.walletProxy??await At.initializeWalletProxy(15e3);if(!r)throw Error("Failed to initialize embedded wallet proxy.");let{entropyId:n,entropyIdVerifier:i}=Z(y),{response:o}=await r.rpc({accessToken:t,entropyId:n,entropyIdVerifier:i,chainType:"solana",hdWalletIndex:E.walletIndex??0,request:{method:"signMessage",params:{message:e}}});return o.data.signature};if(Xe({showWalletUIs:void 0}))try{let e=await n();t({signature:e})}catch(e){r(e)}else Ae({signMessage:{method:"solana_signMessage",data:e,confirmAndSign:n,onSuccess:e=>{t({signature:e})},onFailure:e=>{r(e)},uiOptions:{}}}),Je(Er.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN)})),openPrivyModal:Qe,connectWallet:at,initLoginWithWallet:async(e,t,r)=>{os(e)?(Ke.current="siwe",it(e,t,r)):(Ke.current="siws",ot(e,t))},loginWithWallet:async()=>{let e,t,r;if(!h)throw new J;if(a.authFlow instanceof Ol?e="siwe":a.authFlow instanceof Zl&&(e="siws"),!e)throw new _("Must initialize SIWE/SIWS flow first.");if(null!==await a.getAccessToken())try{({user:t}=await a.link()),Ke.current=e}catch(t){throw Mr(ze,"linkAccount","onError",t.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:r}=await a.authenticate()),Ke.current=e}catch(e){throw Mr(ze,"login","onError",e.privyErrorCode||k.GENERIC_CONNECT_WALLET_ERROR),e}w(t||y||null),M(r||!1),g(!0)},delegateWallet:async({address:e,chainType:t})=>new Promise((async(r,n)=>{let a=await vC();if(!f||!y||!a)throw new _("User must be authenticated and have an embedded wallet to delegate actions.");if("solana"!==t&&"ethereum"!==t)throw new _("Only Solana and Ethereum embedded wallets are supported for delegation and revocation.");let i=At.walletProxy??await At.initializeWalletProxy(15e3);if(!i)throw new _("Wallet proxy not initialized.");if((({address:e,chainType:t,user:r})=>!!Zv(r).find((r=>r.address===e&&r.chainType===t)))({address:e,chainType:t,user:y}))throw new _(`Wallet with address ${e} is already delegated.`);let o=(({address:e,user:t})=>{let r=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!r)throw new _("Address to delegate is not associated with current user.");return{address:r.address,chainType:r.chainType,walletIndex:r.walletIndex??0}})({address:e,user:y}),l=(({address:e,user:t})=>{let r,n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new _("Address to delegate is not associated with current user.");if(!(r="ethereum"===n.chainType?n.imported?K(t):G(t):n))throw new _("Unable to determine root address for delegated address.");return{address:r.address,chainType:r.chainType,imported:r.imported}})({address:e,user:y});await At.recoverPrimaryWallet(),Ae({delegatedActions:{consent:{address:e,onDelegate:async()=>{await i.createDelegatedAction({accessToken:a,rootWallet:l,delegatedWallets:[o]}),await At.refreshUser()},onSuccess:async()=>{r()},onError:async e=>{n(e)}}}}),Qe(Er.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN)})),revokeDelegatedWallets:async()=>new Promise((async(e,t)=>{if(!f||!y)throw new _("User must be authenticated and have an embedded wallet to revoke a delegated wallet.");if(0===Zv(y).length)throw new _("User has no delegated wallets to revoke.");Ae({delegatedActions:{revoke:{onRevoke:async()=>{await a.revokeDelegatedWallet(),await At.refreshUser()},onSuccess:async()=>{e()},onError:async e=>{t(e)}}}}),Qe(Er.EMBEDDED_WALLET_DELEGATED_ACTIONS_REVOKE_SCREEN)})),initLoginWithFarcaster:async(e,t)=>{let r=new ql(e,t);a.startAuthFlow(r);try{Ke.current="farcaster",await r.initializeFarcasterConnect()}catch(e){throw"login"===Ze.current?Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR):"link"===Ze.current&&Mr(ze,"linkAccount","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!h)throw new J;if(!(a.authFlow instanceof ql))throw new _("Must initialize Farcaster flow first.");if(null!==await a.getAccessToken())try{({user:e}=await a.link()),Ke.current="farcaster"}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await a.authenticate()),Ke.current="farcaster"}catch(e){throw Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}w(e||null),M(t||!1),g(!0)},async loginWithGuestAccountFlow(){let e=new ul(this.appId);a.startAuthFlow(e);try{Ze.current="login",Ke.current="guest";let{user:e,isNewUser:t}=await a.authenticate();if(t=t||!1,!e)throw new _("Unable to authenticate guest account");if(U(e,be.embeddedWallets.createOnLogin))try{await pt(e,15e3),e=await At.refreshUser()}catch(t){w(e),console.warn("Unable to create embedded wallet for guest account")}else w(e);return M(t),g(!0),Mr(ze,"login","onComplete",e,t,!1,"guest",null),e}catch(e){throw Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}},async crossAppAuthFlow({appId:e,popup:t,action:r}){let n=`privy:${e}`;Ke.current=n;let{url:i,stateCode:o,codeVerifier:l}=await async function({api:e,appId:t}){let r=hl(),n=pl(),a=await ml(r);try{let{url:i}=await e.post(il,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:a,state_code:n});return{url:i,stateCode:n,codeVerifier:r}}catch(e){throw A(e)}}({api:a.api,appId:e});if(!i)throw a.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new _("No authorization URL returned for cross-app auth.");try{let s=await async function({url:e,popup:t}){return t.location=e,new Promise(((e,r)=>{let n,a=setTimeout((()=>{r(new _("Authorization request timed out after 2 minutes.")),i()}),12e4);function i(){t?.close(),window.removeEventListener("message",l)}let o=setInterval((()=>{t?.closed&&!n&&(i(),clearInterval(o),clearTimeout(a),r(new _("User rejected request")))}),300);function l(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(a),e(t.data),i()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(a),r(new _(t.data.error)),i()),t.data.type===Jv&&((n=new BroadcastChannel(Qv)).onmessage=l))}window.addEventListener("message",l)}))}({url:i,popup:t,provider:n}),d=s.stateCode,c=s.authorizationCode;if(d!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:n,storedStateCode:o??"",returnedStateCode:d??""}}),new _("Unexpected auth flow. This may be a phishing attempt.",void 0,k.OAUTH_UNEXPECTED);let u=await async function({appId:e,stateCode:t,codeVerifier:r,authorizationCode:n,action:a,client:i}){if(!n||!t)throw new _("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===n)throw new _("User denied confirmation during cross-app auth flow");try{let o=new eC({authorizationCode:n,stateCode:t,codeVerifier:r,provider:`privy:${e}`});i.startAuthFlow(o);let l="link"===a?await i.link():await i.authenticate(),s=l.oAuthTokens?.accessToken;return console.debug(),s}catch(e){let t=A(e);if(t.privyErrorCode)throw new _(t.message||"Invalid code during cross-app auth flow.",void 0,t.privyErrorCode);if("User denied confirmation during cross-app auth flow"===t.message)throw new _("Invalid code during cross-app auth flow.",void 0,k.OAUTH_USER_DENIED);throw new _("Invalid code during cross-app auth flow.",void 0,k.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:l,stateCode:d,authorizationCode:c,action:r,client:a});u&&a.storeProviderAccessToken(e,u);let h=await At.refreshUser();if(!h)throw new _("Unable to update user");return a.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),h}catch(e){throw a.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:n}}),e}},async initLoginWithOAuth(e,t,r){if(Ke.current=e,!St())return void Je(Er.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);if("google"===e&&ru(window.navigator.userAgent))return void Je(Er.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);"twitter"===e&&window.opener&&window.opener.postMessage({type:Jv},"*"),Nt.del(oe),Nt.del(le);let n=new fl({provider:e,disableSignup:!!r,withPrivyUi:!0});t&&n.addCaptchaToken(t),a.startAuthFlow(n);let i=await a.authFlow.getAuthorizationUrl();i&&i.url&&("twitter"===e&&T&&(i.url=i.url.replace("x.com","twitter.com")),window.location.assign(i.url))},async initLoginWithTelegram(e,t){if(!h)throw new J;Ke.current="telegram";let r=new es(e,t);a.startAuthFlow(r),r.meta.telegramWebAppData=void 0,r.meta.telegramAuthResult=await new Promise(((e,t)=>be.loginConfig.telegramAuthConfiguration?window.Telegram?void window.Telegram.Login.auth({bot_id:be.loginConfig.telegramAuthConfiguration.botId,request_access:!0},(r=>r?e(r):t(new _("Telegram auth failed or was canceled by the client")))):t(new _("Telegram was not initialized")):t(new _("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(e){let t,r;if(!(a.authFlow instanceof es))throw new _("Must initialize Telegram flow before calling loginWithTelegram");if(a.authFlow.meta.captchaToken||=e,"login"===Ze.current)try{let e=await a.authenticate();t=e.user,r=e.isNewUser,Ke.current="telegram"}catch(e){throw Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}else{if("link"!==Ze.current)throw new _("Unknown auth intent");try{t=(await a.link()).user,Ke.current="telegram"}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}w(t),M(r||!1),g(!0)},async recoveryOAuthFlow(e,t,r){let n,i;function o(t){if(!t)throw a.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:e}}),new _("Recovery OAuth failed")}switch(e){case"google-drive":{let t,l,{url:s,codeVerifier:d,stateCode:c}=await Bu({api:uC.api,provider:e});o(s);try{let n=await cC({url:s,popup:r,provider:e});if(t=n.stateCode,l=n.authorizationCode,t!==c)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:c??"",returnedStateCode:t??""}}),new _("Unexpected auth flow. This may be a phishing attempt.",void 0,k.OAUTH_UNEXPECTED)}catch(t){throw a.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:e}}),new _("Recovery OAuth failed")}[n,i]=await Promise.all([vC(),Gu({api:uC.api,provider:e,codeVerifier:d,stateCode:t,authorizationCode:l})]);break}case"icloud":{let{url:t}=await Bu({api:uC.api,provider:e});o(t);let{ckWebAuthToken:a}=await cC({url:t,popup:r,provider:e});i=a,n=await vC()}}if(!ve)throw new _("Cannot connect to wallet proxy");if(!n)throw new _("Unable to authorize user");switch(t){case"recover":{let t=_e.recoverWallet?.entropyId,r=_e.recoverWallet?.entropyIdVerifier;if(!t||!r)throw new _("Recovery OAuth failed");a.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t,recoveryMethod:e}}),await ve.recover({accessToken:n,entropyId:t,entropyIdVerifier:r,recoveryAccessToken:i}),a.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t,recoveryMethod:e}});break}case"create-wallet":{a.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await ve.create({accessToken:n,recoveryAccessToken:i,recoveryMethod:e});let t=G(await At.refreshUser());if(!t)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");a.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:t.address}}),Mr(ze,"createWallet","onSuccess",t);break}case"set-recovery":{let t=j(y);if(!t)throw Mr(ze,"setWalletRecovery","onError",k.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");a.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:t.address,existingRecoveryMethod:t.recoveryMethod,targetRecoveryMethod:e}});let{entropyId:r,entropyIdVerifier:o}=P(t);await ve.setRecovery({accessToken:n,entropyId:r,entropyIdVerifier:o,recoveryMethod:e,recoveryAccessToken:i});let l=j(await At.refreshUser());if(!l)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");a.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:t.address,existingRecoveryMethod:t.recoveryMethod,targetRecoveryMethod:e}}),Mr(ze,"setWalletRecovery","onSuccess",e,l);break}default:throw new _("Unsupported recovery action")}},async loginWithOAuth(e){let t,r,n;if(!(a.authFlow instanceof fl))throw new _("Must initialize OAuth flow before calling loginWithOAuth");let i=Nt.get(se),o=a.authFlow.meta.stateCode;if(i!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:o??""}}),new _("Unexpected auth flow. This may be a phishing attempt.",void 0,k.OAUTH_UNEXPECTED);if(null!==await a.getAccessToken())try{let r=await a.link();t=r.user,n=r.oAuthTokens,Ke.current=e}catch(t){throw Mr(ze,"linkAccount","onError",t.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await a.authenticate();t=i.user,r=i.isNewUser,n=i.oAuthTokens,Ke.current=e}catch(t){throw"login"===Ze.current?Mr(ze,"login","onError",t.privyErrorCode||k.UNKNOWN_AUTH_ERROR):"link"===Ze.current&&Mr(ze,"linkAccount","onError",t.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return w(t),M(r||!1),g(!0),n&&t&&Mr(ze,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),n},passkeyAuthState:V,setPasskeyAuthState:re,async initLoginWithPasskey({captchaToken:e,withPrivyUi:t}){let r=new Kl({captchaToken:e,setPasskeyAuthState:re});a.startAuthFlow(r),Ze.current="login";try{Ke.current="passkey",re({status:"generating-challenge"}),await r.initAuthenticationFlow(t),re({status:"awaiting-passkey"})}catch(e){throw re({status:"error",error:e}),Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(){let e,t;if(!h)throw new J;if(!(a.authFlow instanceof Kl))throw new _("Must initialize Passkey flow first.");if("passkey"!==Ke.current){let e=new _("Must init login with Passkey flow first.");throw re({status:"error",error:e}),e}let r=await vC();try{Ke.current="passkey",re({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await a.authenticate())}catch(e){throw re({status:"error",error:e}),Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}w(e),M(t||!1),g(!0),re({status:"done"});let n=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!r,loginAccount:n}},async initLinkWithPasskey(e){let t=new Kl({captchaToken:e});a.startAuthFlow(t),Ze.current="link",Ke.current="passkey",re({status:"generating-challenge"});try{await t.initLinkFlow(),re({status:"awaiting-passkey"})}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),re({status:"error",error:e}),e}},async linkWithPasskey(){let e;if(!h)throw new J;if(!(a.authFlow instanceof Kl))throw new _("Must initialize Passkey flow first.");if("passkey"!==Ke.current)throw new _("Must init login with Passkey flow first.");try{Ke.current="passkey",({user:e}=await a.link())}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return w(e||y||null),re({status:"done"}),e},async initLoginWithHeadlessOAuth(e,t,r){if(!St())throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");if("google"===e&&ru(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let n=new fl({provider:e,withPrivyUi:!1,disableSignup:r??!1});t&&n.addCaptchaToken(t),fe({status:"loading"});let i=await a.startAuthFlow(n).getAuthorizationUrl();i?.url&&window.location.assign(i.url)},async loginWithHeadlessOAuth(e){let t,r,n;W(!0),fe({status:"loading"}),a.startAuthFlow(new fl(e));let i=Nt.get(se),o=e.stateCode;if(i!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:o??""}}),W(!1),new _("Unexpected auth flow. This may be a phishing attempt.",void 0,k.OAUTH_UNEXPECTED);if(null!==await a.getAccessToken())try{({user:t,oAuthTokens:n}=await a.link()),Ke.current=e.provider;let r=Ct(t);t&&r&&Mr(ze,"linkAccount","onSuccess",t,Ke.current,r)}catch(t){throw W(!1),Mr(ze,"linkAccount","onError",t.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:r,oAuthTokens:n}=await a.authenticate()),Ke.current=e.provider;let i=Ct(t);t&&i&&void 0!==r&&Mr(ze,"login","onComplete",t,r,!1,Ke.current,i)}catch(e){throw W(!1),fe({status:"error",error:e}),Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}return w(t),M(r||!1),g(!0),W(!1),fe({status:"done"}),n&&t&&Mr(ze,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),t??void 0},initLoginWithEmail:async({email:e,captchaToken:t,disableSignup:r,withPrivyUi:n})=>{let i=new Dl({email:e,captchaToken:t,disableSignup:r});a.startAuthFlow(i);try{Ke.current="email",ie({status:"sending-code"}),await i.sendCodeEmail({withPrivyUi:n}),ie({status:"awaiting-code-input"})}catch(e){throw ie({status:"error",error:e}),"login"===Ze.current?Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR):"link"===Ze.current&&Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async(e,t,r)=>{let n=new Fl(e,t,r);a.startAuthFlow(n);try{await n.sendCodeEmail({withPrivyUi:!0})}catch(e){Mr(ze,"update","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:Ke.current})}},initUpdatePhone:async(e,t,r)=>{let n=new Ml(e,t,r);a.startAuthFlow(n);try{await n.sendSmsCode({withPrivyUi:!0})}catch(e){Mr(ze,"update","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:Ke.current})}},initLoginWithSms:async({phoneNumber:e,captchaToken:t,disableSignup:r,withPrivyUi:n})=>{ce({status:"sending-code"});let i=new Rl({phoneNumber:e,captchaToken:t,disableSignup:r});a.startAuthFlow(i);try{Ke.current="sms",await i.sendSmsCode({withPrivyUi:n}),ce({status:"awaiting-code-input"})}catch(e){throw ce({status:"error",error:e}),"login"===Ze.current?Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR):"link"===Ze.current&&Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(a.authFlow?.sendCodeEmail({withPrivyUi:!0}))},resendSmsCode:async()=>{await(a.authFlow?.sendSmsCode({withPrivyUi:!0}))},loginWithCode:async e=>{let t,r;function n(e){a.authFlow instanceof Dl?ie(e):a.authFlow instanceof Rl&&ce(e)}if(n({status:"submitting-code"}),!h){let e=new J;throw n({status:"error",error:e}),e}if(a.authFlow instanceof Dl)a.authFlow.meta.emailCode=e.trim();else{if(!(a.authFlow instanceof Rl)){let e=new _("Must initialize a passwordless code flow first");throw n({status:"error",error:e}),e}a.authFlow.meta.smsCode=e.trim()}let i=await vC();if("link"===Ze.current)try{({user:t}=await a.link())}catch(e){throw n({status:"error",error:e}),Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:Ke.current}),e}else if("update"===Ze.current)try{({user:t}=await a.link())}catch(e){throw n({status:"error",error:e}),Mr(ze,"update","onError",e.privyErrorCode||k.FAILED_TO_UPDATE_ACCOUNT,{linkMethod:Ke.current}),e}else try{({user:t,isNewUser:r}=await a.authenticate())}catch(e){throw n({status:"error",error:e}),Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}let o=t||y;w(o||null),M(r||!1),g(!0),n({status:"done"});let l=null;return a.authFlow instanceof Dl?l=o?.linkedAccounts.find((({type:e})=>"email"===e))||null:a.authFlow instanceof Rl&&(l=o?.linkedAccounts.find((({type:e})=>"phone"===e))||null),{user:o,isNewUser:r||!1,wasAlreadyAuthenticated:!!i,linkedAccount:l}},generateSiweMessage:async({address:e,chainId:t,captchaToken:r})=>{Ze.current="link",Ke.current="siwe",pe({status:"generating-message"});let n=await a.generateSiweNonce({address:e,captchaToken:r});return pe({status:"awaiting-signature"}),Pl({address:e,chainId:t.replace("eip155:",""),nonce:n})},generateSiweMessageForSmartWallet:async({address:e,chainId:t})=>{let r=await a.generateSiweNonce({address:e});return Pl({address:e,chainId:t.replace("eip155:",""),nonce:r})},linkSmartWallet:async({message:e,signature:t,smartWalletType:r})=>{let n;try{n=await a.linkSmartWallet({message:e,signature:t,smartWalletType:r}),n=await At.refreshUser()??n}catch(e){throw e}w(n||y||null)},linkWithSiwe:async({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})=>{let o;st("siwe");let l=null;try{pe({status:"submitting-signature"}),o=await a.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}),o=await At.refreshUser()??o,pe({status:"done"}),(l=Ct(o)||null)&&Mr(ze,"linkAccount","onSuccess",o,"siwe",l)}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"siwe"}),Ze.current=null,Ke.current=null,pe({status:"error",error:e}),e}let s=o||y;return w(s||null),Ze.current=null,Ke.current=null,{user:s,linkedAccount:l}},refreshUser:async()=>{let e=await a.getAuthenticatedUser();return g(!!e),w(e),e},walletProxy:ve,createAnalyticsEvent:({eventName:e,payload:t,timestamp:r})=>a.createAnalyticsEvent({eventName:e,payload:t,timestamp:r}),acceptTerms:async()=>{let e=await a.acceptTerms();return w(e),e},getUsdTokenPrice:e=>a.getUsdTokenPrice(e),getUsdPriceForSol:()=>a.getUsdPriceForSol(),recoverPrimaryWallet:async e=>new Promise((async(t,r)=>{let n=j(e?.user??y)||K(e?.user??y),i=await vC();if(!i||!ve||!n)return void r(Error("Must have valid access token and Privy wallet to recover wallet"));xe(!0);let{entropyId:o,entropyIdVerifier:l}=P(n);try{await ve.connect({accessToken:i,entropyId:o,entropyIdVerifier:l}),t(!0)}catch(e){Pu(e)&&"privy"===n.recoveryMethod?(a.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:n.address}}),(await ve.recover({entropyId:o,entropyIdVerifier:l,accessToken:i})).entropyId||r(Error("Unable to recover wallet")),a.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n.address}}),t(!0)):Pu(e)&&"privy"!==n.recoveryMethod?(Ae({recoverWallet:{entropyId:o,entropyIdVerifier:l,onFailure:r,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:n.recoveryMethod,action:"recover"}}),Qe(Wu(n.recoveryMethod))):r(e)}})),embeddedSolanaWallet:E,createEmbeddedSolanaWallet:async()=>{xe(!0);let e=await vC(),t=await At.refreshUser(),r=H(t),n=G(t);if(!t||!e)throw new _("User must be logged in to create a Solana wallet");if(r)throw new _("User already has an embedded Solana wallet.");n&&await At.recoverPrimaryWallet({user:t});let i=await At.initializeWalletProxy(15e3);if(!i)throw new _("Unable to initialize wallet proxy");a.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await i.createSolana({accessToken:e,ethereumAddress:n?.address});let t=await At.refreshUser(),r=H(t);if(!r)throw new _("Could not get Solana wallet for user");return a.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:r.address}}),r}catch(e){throw a.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new _("Failed to create Solana embedded wallet with error ",e)}},exportSolanaWallet:e=>new Promise((async(t,n)=>{if(!f||!y)return void n(Error("User must be authenticated before exporting their Privy wallet"));let i=e?.address??H(y)?.address;if(!i)return void n(Error("User does not have an HD Solana wallet."));let{signingWallet:o,rootWallet:l}=ee(y,i);if(!o||!l)return void n(Error("Must have a Privy wallet before exporting"));if(xe(!0),!await vC()||!ve)return void n(Error("Must have valid access token to enroll in MFA"));if(!ve)return void n(Error("Must have a Privy wallet before exporting"));let{entropyId:s,entropyIdVerifier:d}=P(l);Ae({connectWallet:{entropyId:s,entropyIdVerifier:d,onCompleteNavigateTo:Er.EMBEDDED_WALLET_KEY_EXPORT_SCREEN,onFailure:n,shouldForceMFA:!0},keyExport:{appId:r.appId,appClientId:r.clientId,origin:a.apiUrl,walletToExport:o,primaryWallet:l,onSuccess:t,onFailure:n}}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)})),setReadyToTrue:e=>{m(!0),ke?.(e)},updateWallets:()=>ht(),fundWallet:async(e,t)=>{let r=Er.FUNDING_METHOD_SELECTION_SCREEN;Ae({funding:oC({address:e,appConfig:be,fundWalletConfig:t,methodScreen:r})}),Qe(r)},fundSolanaWallet:async(e,t)=>{let r=Er.FUNDING_METHOD_SELECTION_SCREEN;Ae({funding:lC({address:e,appConfig:be,fundWalletConfig:t,methodScreen:r})}),Qe(r)},requestFarcasterSignerStatus:async e=>{let t=await vC(),r=y?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!ve||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!y?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let n=await a.requestFarcasterSignerStatus(e);return"approved"===n.status&&w(await a.getAuthenticatedUser()||y||null),n},connectCoinbaseSmartWallet:async()=>{be.externalWallets.coinbaseWallet.connectionOptions="smartWalletOnly";let e=a.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||a.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),at(e);await nt("coinbase_wallet","coinbase_smart_wallet")},initiateAccountTransfer:async({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:o,oAuthUserInfo:l})=>{try{let s=await a.sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:o,oAuthUserInfo:l});return w(s),s}catch(e){throw e}}};fC=At.recoverPrimaryWallet,gC=At.recoverPrimaryWallet,yC=At.solanaSignMessage;let kt=c((()=>({wallets:v,ready:Oe&&je})),[v,Oe,je]),It=a.authFlow instanceof es,Pt=!be.headless&&be.captchaEnabled&&!f&&(h||It);return t(q.Provider,{value:_t,children:t(Lr.Provider,{value:ze,children:t(xt.Provider,{value:kt,children:t(Ql,{...be,children:e(te.Provider,{value:At,children:[t(rr,{children:e(Tr,{data:_e,setModalData:Ae,setInitialScreen:D,initialScreen:L,authenticated:f,open:l,children:[r.children,Pt&&t(Js,{delayedExecution:!1}),t(Ev,{theme:{...be.appearance.palette||{}}}),!be.render.standalone&&t(Mv,{open:l})]})}),Te&&$e?t(Kv,{appId:r.appId,appClientId:r.clientId,clientAnalyticsId:a.clientAnalyticsId,origin:a.apiUrl,mfaMethods:y?.mfaMethods,mfaPromise:Ge,mfaSubmitPromise:He,onLoad:Ce,onLoadFailed:()=>null}):null,be.loginConfig.telegramAuthConfiguration&&t(Od,{$if:!0,children:t(Fv,{scriptHost:r.apiUrl||De,botUsername:be.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};const kC=()=>{let{getAccessToken:e,user:t}=F(),{refreshUser:r,initializeWalletProxy:n}=D(),a=Or();return{importWallet:m((({privateKey:i})=>(async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:r,refreshUser:n,user:a},{privateKey:i})=>{if(!a)throw e("linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new _("User must be authenticated before linking an account.");let[o,l]=await Promise.all([t(),r(15e3)]);if(!l||!o)throw e("linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new _("User must be authenticated before linking an account.");await l.import({privateKey:i,accessToken:o});let s=K(await n());if(!s)throw e("createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",s),s})({getAccessToken:e,user:t,initializeWalletProxy:n,refreshUser:r,emitPrivyEvent:a},{privateKey:i})),[t,e,r,n,a])}},SC=()=>{let{importWallet:e}=kC();return{...u(q),importWallet:e}},NC=e=>{Pr("login",e);let t=Jl(),r=Tt(),{ready:n,user:a}=F(),{initLoginWithHeadlessOAuth:i,loginWithHeadlessOAuth:o,oAuthState:l,setOAuthState:s,isHeadlessOAuthLoading:d}=D(),c=m((async e=>{try{if(t.enabled&&"success"!==t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);return await i(e.provider,t.token,e.disableSignup)}catch(e){throw s({status:"error",error:e}),e}}),[i,t]),u=m((async()=>{let e=Sl();try{if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw s({status:"error",error:e}),e}try{return await o(e)}catch(e){throw s({status:"error",error:e}),e}finally{Nl()}}),[o]);return p((()=>{let e=Sl();n&&r&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&u()}),[n,r]),{initOAuth:c,loading:d,state:l}},IC=e=>{let t=Jl(),{emailOtpState:r,setEmailOtpState:n,initLoginWithEmail:a,loginWithCode:i}=D();return{sendCode:m((async({email:r,disableSignup:i})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({email:r,captchaToken:e,disableSignup:i,withPrivyUi:!1})}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:m((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);let{user:n,isNewUser:a,wasAlreadyAuthenticated:o,linkedAccount:l}=await i(r);e?.onComplete?.(n,a,o,"email",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR),r}}),[i,t.status]),state:r}},PC=e=>{let t=Jl(),{initLoginWithPasskey:r,loginWithPasskey:n,passkeyAuthState:a,setPasskeyAuthState:i}=D();return{loginWithPasskey:m((async()=>{try{let a;if(t.enabled&&"error"===t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),a=await t.waitForResult()),await r({captchaToken:a,withPrivyUi:!1});let{user:i,isNewUser:o,wasAlreadyAuthenticated:l,loginAccount:s}=await n();e?.onComplete?.(i,o,l,"passkey",s)}catch(t){throw i({status:"error",error:t}),e?.onError?.(t),t}}),[n,t.status]),state:a}},OC=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:n,setPasskeyAuthState:a}=D();return{linkWithPasskey:m((async()=>{try{await t();let n=await r();if(!n)throw Error("Error, user not found");let a=n.linkedAccounts.filter((e=>"passkey"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0];e?.onSuccess?.(n,"passkey",a)}catch(t){throw a({status:"error",error:t}),e?.onError?.(t,{linkMethod:"passkey"}),t}}),[r]),state:n}},RC=e=>{let t=Jl(),{smsOtpState:r,setSmsOtpState:n,initLoginWithSms:a,loginWithCode:i}=D();return{sendCode:m((async({phoneNumber:r,disableSignup:i})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({phoneNumber:r,captchaToken:e,disableSignup:i,withPrivyUi:!1})}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:m((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);let{user:n,isNewUser:a,wasAlreadyAuthenticated:o,linkedAccount:l}=await i(r);e?.onComplete?.(n,a,o,"sms",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR),r}}),[i,t.status]),state:r}},MC=e=>{let t=Jl(),{siweState:r,setSiweState:n,linkWithSiwe:a,generateSiweMessage:i}=D();return{generateSiweMessage:m((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await i({address:t,chainId:r}).then((e=>e))}catch(t){throw n({status:"error",error:t}),e?.onError?.(t.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[i]),linkWithSiwe:m((async({signature:r,message:i,chainId:o,walletClientType:l,connectorType:s})=>{try{if(t.enabled&&"success"!==t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);let{user:n,linkedAccount:d}=await a({message:i,signature:r,chainId:o,walletClientType:l,connectorType:s});d&&e?.onSuccess?.(n,"siwe",d)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[a,t.status]),state:r}};function LC(e){let{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:a,linkApple:i,linkTwitter:o,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:c,linkSpotify:h,linkInstagram:p,linkTelegram:m,linkFarcaster:f}=u(q);return Pr("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:a,linkApple:i,linkTwitter:o,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:c,linkSpotify:h,linkInstagram:p,linkFarcaster:f,linkTelegram:m}}function DC(e){let{updateEmail:t,updatePhone:r}=u(q);return Pr("update",e),{updateEmail:t,updatePhone:r}}function FC(e){let{createWallet:t}=u(q);return Pr("createWallet",e),{createWallet:t}}const UC=()=>{let{connectCoinbaseSmartWallet:e}=D();return{connectCoinbaseSmartWallet:e}},WC=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:n,sendTransactionWithCrossAppWallet:a}=F();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:n,sendTransaction:a}};function BC(e){let{sendTransaction:t}=u(q);return Pr("sendTransaction",e),{sendTransaction:t}}function GC(e){let{sendSolanaTransaction:t}=u(q);return Pr("sendSolanaTransaction",e),{sendSolanaTransaction:t}}function HC(e){let{setWalletPassword:t}=u(q);return Pr("setWalletPassword",e),{setWalletPassword:t}}function zC(){let{createGuestAccount:e}=u(q);return{createGuestAccount:e}}function jC(e){let{setWalletRecovery:t}=u(q);return Pr("setWalletRecovery",e),{setWalletRecovery:t}}function VC(e){let{signMessage:t}=u(q);return Pr("signMessage",e),{signMessage:t}}function qC(e){let{signTypedData:t}=u(q);return Pr("signTypedData",e),{signTypedData:t}}const KC=()=>{let{isModalOpen:e}=u(q);return{isOpen:e}};function ZC(e){let{getAccessToken:t}=u(q);return Pr("accessToken",e),{getAccessToken:t}}function YC(e){let{authenticated:t,user:r}=F(),{initLoginWithOAuth:n}=D(),a=Or();return Pr("oAuthAuthorization",e),{reauthorize:e=>XC(t,r,n,a,e.provider)}}let XC=async(e,t,r,n,a)=>{if(!e)throw n("linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:a}),new _("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(a))))throw new _(`OAuth account of type ${a} not linked to the account.`);await r(a)};const QC=e=>{let{customAuthStatus:t}=D();return Pr("customAuth",e),{status:t}},JC=eb;function eb(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=F();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}const tb=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=D();return{delegateWallet:t,revokeWallets:e}};export{cs as AsExternalProvider,Js as Captcha,Ds as ConnectorManager,ms as EthereumWalletConnector,Mv as LoginModal,Xs as PrivyClient,_C as PrivyProvider,ds as PrivyProxyProvider,xe as VERSION,cr as WalletConnector,Mu as errorIndicatesMaxMfaRetries,Ou as errorIndicatesMfaTimeout,Ru as errorIndicatesMfaVerificationFailed,wC as getAccessToken,UC as useConnectCoinbaseSmartWallet,FC as useCreateWallet,WC as useCrossAppAccounts,QC as useCustomAuth,tb as useDelegatedActions,JC as useExperimentalFarcasterSigner,eb as useFarcasterSigner,zC as useGuestAccounts,kC as useImportWallet,LC as useLinkAccount,OC as useLinkWithPasskey,MC as useLinkWithSiwe,IC as useLoginWithEmail,NC as useLoginWithOAuth,PC as useLoginWithPasskey,RC as useLoginWithSms,Ut as useLogout,_g as useMfa,Ag as useMfaEnrollment,KC as useModalStatus,YC as useOAuthTokens,SC as usePrivy,ed as useRegisterMfaListener,GC as useSendSolanaTransaction,BC as useSendTransaction,HC as useSetWalletPassword,jC as useSetWalletRecovery,VC as useSignMessage,qC as useSignTypedData,fr as useSolanaWallets,ZC as useToken,DC as useUpdateAccount,st as useWallets};
2979
+ `;function Wv(e){let r=s(null),n=s();return p((()=>{n.current?.remove(),n.current=function({botUsername:e,scriptHost:t}){let r=document.createElement("script"),{origin:n}=new URL(t);return r.async=!0,r.src=`${n}/js/telegram-login.js`,r.setAttribute("data-telegram-login",e),r.setAttribute("data-request-access","write"),r.setAttribute("data-lang","en"),r}(e),r.current?.after(n.current)}),[e]),t("div",{ref:r,hidden:!0})}async function Bv(e,t,r,n,a,i=!1){let o=i,l=async l=>{if(o&&t&&t.length>0){l===(i?0:1)?a("configureMfa","onMfaRequired",t):n.current?.reject(new Nu("missing_or_invalid_mfa","MFA verification failed, retry."));let o=await new Promise(((e,t)=>{r.current={resolve:e,reject:t},setTimeout((()=>{let e=new Nu("mfa_timeout","Timed out waiting for MFA code");n.current?.reject(e),t(e)}),3e5)}));return await e(o)}return await e()},s=null;for(let e=0;e<4;e++)try{s=await l(e),n.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw n.current?.resolve(void 0),e;o=!0}if(null===s){let e=new Nu("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw n.current?.reject(e),e}return s}var Gv;let Hv=(Gv=0,()=>"id-"+Gv++);function zv(e){return void 0!==e.error}let jv=new class{enqueue(e,t){this.callbacks[e]=t}dequeue(e,t){let r=this.callbacks[t];if(!r)throw Error(`cannot dequeue ${e} event: no event found for id ${t}`);switch(delete this.callbacks[t],e){case"privy:iframe:ready":case"privy:wallets:create":case"privy:wallets:add":case"privy:wallets:set-recovery":case"privy:wallets:connect":case"privy:wallets:recover":case"privy:wallets:rpc":case"privy:wallet:create":case"privy:wallet:import":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":case"privy:farcaster:init-signer":case"privy:farcaster:sign":case"privy:solana-wallet:create":case"privy:delegated-actions:consent":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}},Vv=new Map,qv=(e,t)=>"bigint"==typeof t?t.toString():t,Kv=(e,t)=>`${e}${JSON.stringify(t,qv)}`;function Zv(e,t,r,n){let a=r.contentWindow;if(!a)throw Error("iframe not initialized");let i=Kv(e,t);if("privy:wallet:create"===e){let e=Vv.get(i);if(e)return e}let o=new Promise(((r,i)=>{let o=Hv();jv.enqueue(o,{resolve:r,reject:i}),a.postMessage({id:o,event:e,data:t},n)})).finally((()=>{Vv.delete(i)}));return Vv.set(i,o),o}function Yv(e){let r=s(null),n=s(e.mfaMethods),a=Or(),[i,o]=d(!1);return p((()=>{n.current=e.mfaMethods}),[e.mfaMethods]),p((()=>{if(!i)return;let t=r.current;if(!t)return;function o(t){var r;t&&t.origin===e.origin&&"string"==typeof(r=t.data).event&&/^privy:.+/.test(r.event)&&function(e){switch(e.event){case"privy:iframe:ready":let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallets:create":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:add":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:set-recovery":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:connect":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:recover":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallets:rpc":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:wallet:create":let r=jv.dequeue(e.event,e.id);return zv(e)?r.reject(new Nu(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:import":let n=jv.dequeue(e.event,e.id);return zv(e)?n.reject(new Nu(e.error.type,e.error.message)):n.resolve(e.data);case"privy:mfa:verify":let a=jv.dequeue(e.event,e.id);return zv(e)?a.reject(new Nu(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:init-enrollment":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:submit-enrollment":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:unenroll":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:clear":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:solana-wallet:create":let i=jv.dequeue(e.event,e.id);return zv(e)?i.reject(new Nu(e.error.type,e.error.message)):i.resolve(e.data);case"privy:farcaster:init-signer":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:sign":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:delegated-actions:consent":{let t=jv.dequeue(e.event,e.id);return zv(e)?t.reject(new Nu(e.error.type,e.error.message)):t.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}(t.data)}let l={createWallet:r=>Bv((n=>Zv("privy:wallets:create",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),addWallet:r=>Zv("privy:wallets:add",r,t,e.origin),setRecovery:r=>Bv((n=>Zv("privy:wallets:set-recovery",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),connect:r=>Bv((n=>Zv("privy:wallets:connect",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),recover:r=>Bv((n=>Zv("privy:wallets:recover",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a,!r.recoveryAccessToken&&!r.recoveryPassword&&!r.recoverySecretOverride),rpc:r=>Bv((n=>Zv("privy:wallets:rpc",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),create:r=>Zv("privy:wallet:create",r,t,e.origin),import:r=>Zv("privy:wallet:import",r,t,e.origin),createSolana:r=>Bv((n=>Zv("privy:solana-wallet:create",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),createDelegatedAction:r=>Zv("privy:delegated-actions:consent",r,t,e.origin),verifyMfa:r=>Bv((n=>Zv("privy:mfa:verify",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a,!0),initEnrollMfa:r=>Bv((n=>Zv("privy:mfa:init-enrollment",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),submitEnrollMfa:r=>Bv((n=>Zv("privy:mfa:submit-enrollment",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a),unenrollMfa:r=>Bv((n=>Zv("privy:mfa:unenroll",{...r,...n},t,e.origin)),n.current,e.mfaPromise,e.mfaSubmitPromise,a,!0),clearMfa:r=>Zv("privy:mfa:clear",r,t,e.origin),initFarcasterSigner:r=>Zv("privy:farcaster:init-signer",r,t,e.origin),signFarcasterMessage:r=>Zv("privy:farcaster:sign",r,t,e.origin)};window.addEventListener("message",o);let s=new AbortController;return he((()=>Zv("privy:iframe:ready",{},t,e.origin)),{abortSignal:s.signal}).then((()=>e.onLoad(l)),((...t)=>{console.warn("Privy iframe failed to load: ",...t),e.onLoadFailed()})),()=>{window.removeEventListener("message",o),s.abort()}}),[i]),t("iframe",{ref:r,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>o(!0),src:Ve(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId,client_id:e.appClientId})})}const Xv=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.delegated));class Qv{async handleSignMessage(e){if(!e.params||"string"!=typeof e.params.message)throw Error("Message must be provided as a string for Solana signMessage RPC");return await AC({message:e.params.message})}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await bC())throw Error("User must be authenticated to use embedded Solana wallet");if(!await _C())throw new _("Unable to connect to Solana embedded wallet");if("signMessage"===e.method)return await this.handleSignMessage(e);throw Error("Embedded Solana provider does not yet support this RPC method.")}constructor(e,t){this.walletProxy=e,this.address=t}}function Jv(e){let t=new RegExp(RegExp("^eip155:(?<chainId>\\d+)$","gm")),r=t.exec(e)?.groups?.chainId;if(r)return parseInt(r);throw Error("Chain ID not compatible with CAIP-2 format.")}const eC="popup-privy-oauth",tC="PRIVY_OAUTH_USE_BROADCAST_CHANNEL";class rC{async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post(ol,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw A(e)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post(ll,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw A(e)}}constructor({authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}){this.meta={authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}}}async function nC({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find((e=>e.provider_app_id===r));if(!n)throw new _("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}const aC=async({user:e,address:t,client:r,request:n,requesterAppId:a,reconnect:i})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:n.method}});let o=e?.linkedAccounts.find((e=>"cross_app"===e.type&&(e.embeddedWallets.some((e=>e.address===t))||e.smartWallets.some((e=>e.address===t)))));if(!e||!o)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new _("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(o.providerApp.id),s=await nC({api:r.api,requesterAppId:a,providerAppId:o.providerApp.id});if(!l){if(s.readOnly)throw console.error("cannot transact against a read-only provider app"),new _("Cannot transact against a read-only provider app");await i({appId:o.providerApp.id,action:"link"})&&(l=r.getProviderAccessToken(o.providerApp.id))}if(!l)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new _("Transactions require a valid token");let d=sf();if(!d)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new _("Failed to initialize signature request");let c=new URL(`${s.apiUrl}/oauth/transact`);return c.searchParams.set("token",l||""),c.searchParams.set("request",iC(n)),d.location=c.href,new Promise(((e,a)=>{let i=setTimeout((()=>{c(),a(new _("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})}),12e4),l=setInterval((()=>{d.closed&&(c(),a(new _("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))}),300),s=i=>{i.data&&("set"===i.data.token?.action&&void 0!==i.data.token?.value?r.storeProviderAccessToken(o.providerApp.id,i.data.token.value):"clear"===i.data.token?.action&&r.storeProviderAccessToken(o.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===i.data.type&&i.data.result&&(c(),e(i.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:n.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===i.data.type&&i.data.error&&(c(),a(i.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:i.data.error,address:t}})))};window.addEventListener("message",s);let c=()=>{d.close(),clearInterval(l),clearTimeout(i),window.removeEventListener("message",s)}}))};let iC=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin});const oC=e=>e.filter((e=>"wallets"===e.method||("exchange"===e.method?"coinbase"===e.provider:"card"===e.method||"payment-request"===e.method?"coinbase"===e.provider||"moonpay"===e.provider:(e.method,!1)))),lC={[at.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[yt.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[it.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[wt.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[ot.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[vt.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[tt.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[Ct.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[et.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[bt.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[Je.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[$t.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"},sC=({address:e,appConfig:t,fundWalletConfig:r,methodScreen:n,chainIdOverride:a,comingFromSendTransactionScreen:i=!1})=>{let o,l;if(!t.fundingConfig)throw Error("Wallet funding is not enabled");let s=oC(t.fundingConfig.options);if(s.length<1)throw Error("Wallet funding is not enabled");o=a||(yf(r)&&r.chain?r.chain.id:Jv(t.fundingConfig.defaultRecommendedCurrency.chain));let d=t.chains.find((e=>e.id===o));if(!d)throw new _(`Funding chain ${o} is not in PrivyProvider chains list`);let c=yf(r)&&r.amount?r.amount:t.fundingConfig.defaultRecommendedAmount,u=!1;function h(){if(!o)return;let e=lC[o];s.find((e=>"wallets"===e.method))&&!e&&console.warn("Attempting to fund with USDC on chain where USDC address is not known. Funding via external wallet will be disabled."),l=e,u=!0}return yf(r)&&"asset"in r?"USDC"===r.asset?h():"string"!=typeof r.asset&&"erc20"in r.asset&&(u=((e,t)=>e===lC[t.id])(l=r.asset.erc20,d)):"USDC"===t.fundingConfig.defaultRecommendedCurrency.asset&&h(),{chainType:"ethereum",address:e,amount:c,chain:d,erc20Address:l,erc20ContractInfo:u?{symbol:"USDC",decimals:6}:void 0,isUSDC:u,methodScreen:n,supportedOptions:s,comingFromSendTransactionScreen:i,crossChainBridgingEnabled:t.fundingConfig.crossChainBridgingEnabled??!1,...gf(r)?{moonpayConfigOverride:r.config}:{}}};function dC({address:e,fundWalletConfig:t,appConfig:r,comingFromSendTransactionScreen:n,methodScreen:a}){if(!r.fundingConfig)throw Error("Wallet funding is not enabled");let i=oC(r.fundingConfig.options);if(i.length<1)throw Error("Wallet funding is not enabled");return{chainType:"solana",address:e,supportedOptions:i,amount:t?.amount??r.fundingConfig.defaultRecommendedAmount,isUSDC:!1,methodScreen:a,comingFromSendTransactionScreen:n,cluster:t?.cluster??{name:"mainnet-beta"},crossChainBridgingEnabled:r.fundingConfig.crossChainBridgingEnabled??!1}}const cC=[Er.FUNDING_METHOD_SELECTION_SCREEN,Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN,Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN,Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN,Er.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN,Er.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN,Er.FUNDING_MANUAL_TRANSFER_SCREEN,Er.MOONPAY_STATUS_SCREEN],uC={[Er.FUNDING_METHOD_SELECTION_SCREEN]:null,[Er.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:"external",[Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:"external",[Er.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN]:"external",[Er.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN]:"external",[Er.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN]:"external",[Er.FUNDING_MANUAL_TRANSFER_SCREEN]:"manual",[Er.MOONPAY_STATUS_SCREEN]:"moonpay"};async function hC({url:e,popup:t,provider:r}){return t.location=e,new Promise(((e,r)=>{function n(){t?.close(),window.removeEventListener("message",a)}function a(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),n()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),n()),"PRIVY_OAUTH_ERROR"===t.data.type&&(r(t.data.error),n()))}window.addEventListener("message",a)}))}let pC,mC,fC,gC,yC,wC,vC;function CC(){return pC?pC.getCustomerAccessToken():Promise.resolve(Nt.get(_e)||null)}async function bC(){return pC?pC.getAccessToken():Promise.resolve(Nt.get(Ae)||Nt.get(_e)||null)}const $C=(e,t,r)=>mC(e,t,r),EC=(e,t,r)=>fC(e,t,r),TC=(e,t,r,n)=>gC(e,t,r,n),xC=()=>yC(),_C=()=>wC(),AC=({message:e})=>vC({message:e});const kC=({config:e,...r})=>{var n;if("undefined"!=typeof window&&0>["localhost","127.0.0.1"].indexOf(window.location.hostname)&&"https:"!==window.location.protocol)throw new _("Embedded wallet is only available over HTTPS");if("string"!=typeof(n=r.appId)||25!==n.length)throw new _("Cannot initialize the Privy provider with an invalid Privy app ID");pC||(pC=new Xs({appId:r.appId,appClientId:r.clientId,apiUrl:r.apiUrl}));let a=Object.assign({},e);return void 0!==r.createPrivyWalletOnLogin&&void 0===a.embeddedWallets?.createOnLogin&&(a.embeddedWallets||(a.embeddedWallets={}),a.embeddedWallets.createOnLogin=r.createPrivyWalletOnLogin?"users-without-wallets":"off"),void 0!==r.createPrivyWalletOnLogin&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),t(Et,{client:pC,clientConfig:a,legacyCreateEmbeddedWalletFlag:r.createPrivyWalletOnLogin,children:t(SC,{...r,client:pC})})};let SC=r=>{let a=r.client,[l,u]=d(!1),[h,m]=d(!1),[f,g]=d(!1),[y,w]=d(null),[v,C]=d([]),[b,$]=d([]),[E,x]=d(null),O=s(v),[R,M]=d(!1),[L,D]=d(null),[F,W]=d(!1),[B,z]=d({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:N}),[V,re]=d({status:"initial"}),[ne,ie]=d({status:"initial"}),[de,ce]=d({status:"initial"}),[he,pe]=d({status:"initial"}),[me,fe]=d({status:"initial"}),[ve,Ce]=d(null),be=We(),$e=Tt(),[Te,xe]=d(!0),[_e,Ae]=d({}),[ke,Ne]=d(null),[Ie,Pe]=d(null),[Oe,Re]=d(!1),[Me,Le]=d(!1),[Fe,Be]=d(be.customAuth?.enabled?{status:"initial"}:{status:"not-enabled"}),Ge=s(null),He=s(null),ze=s(Rr),[je,Ve]=d(!1);a.onStoreCustomerAccessToken=e=>{e&&Mr(ze,"accessToken","onAccessTokenGranted",e)},a.onDeleteCustomerAccessToken=()=>{w(null),g(!1),Mr(ze,"accessToken","onAccessTokenRemoved")};let Ke=s(null),Ze=s(null),Ye=s(!1),Xe=({showWalletUIs:e,typedData:t})=>Ye.current?Ye.current:void 0!==e?!e:void 0!==be.embeddedWallets.showWalletUIs?!be.embeddedWallets.showWalletUIs:t?be.embeddedWallets.noPromptOnSignature||(be.legacyWalletUiConfig??!1):!!be.embeddedWallets.noPromptOnSignature,Qe=e=>{D(e),setTimeout((()=>{u(!0)}),15),a.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:e}})},Je=e=>{"off"!==be.embeddedWallets.createOnLogin&&xe(!0),Qe(e)};p((()=>{let e=H(y);if(!e||!ve)return void x(null);let t={type:"solana",imported:!1,address:e.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",walletIndex:e.walletIndex??void 0,meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund(){throw new _("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:()=>{throw new _("Cannot unlink an embedded Solana wallet")},getProvider:async()=>new Qv(ve,e.address),async signMessage(e){let t=await bC(),r=j(y);if(!t||!ve||!r)throw new _("Must have valid access token and Privy wallet to send transaction",k.MUST_BE_AUTHENTICATED);if(!await At.recoverPrimaryWallet().catch((()=>!1)))throw new _("Wallet couldn't be connected",k.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:n,entropyIdVerifier:a}=P(r),{response:i}=await ve.rpc({accessToken:t,entropyId:n,entropyIdVerifier:a,chainType:"solana",hdWalletIndex:this.walletIndex??0,request:{method:"signMessage",params:{message:Buffer.from(e).toString("base64")}}});return Buffer.from(i.data.signature,"base64")},async sendTransaction(e,t,r){let{signature:n}=await wt({transaction:e,connection:t,transactionOptions:r,wallet:this});return n},async signTransaction(e){let t=await bC();if(!t||!ve)throw new _("Must have valid access token and Privy wallet to send transaction",k.MUST_BE_AUTHENTICATED);if(!await At.recoverPrimaryWallet().catch((()=>!1)))throw new _("Wallet couldn't be connected",k.UNKNOWN_CONNECT_WALLET_ERROR);let{entropyId:r,entropyIdVerifier:n}=Z(y);return await rw({tx:e,accessToken:t,walletProxy:ve,entropyId:r,entropyIdVerifier:n,transactingWalletAddress:this.address,transactingWalletIndex:this.walletIndex??0}),e},loginOrLink:async()=>{throw new _("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{x(null)},isConnected:async()=>!0};x(t)}),[ve,y]),p((()=>{if(!y)return void a.connectors?.removeEmbeddedWalletConnectors();let e=G(y),t=Y(y),n=K(y);e&&t.length||a.connectors?.removeEmbeddedWalletConnectors(),n||a.connectors?.removeImportedWalletConnector(),a.connectors?ve?(e&&a.connectors.addEmbeddedWalletConnectors({walletProxy:ve,rootWallet:e,embeddedWallets:t,defaultChain:be.defaultChain,appId:r.appId}),n&&a.connectors.addImportedWalletConnector(ve,n.address,be.defaultChain,r.appId)):console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized"):console.debug("Failed to add embedded wallet connector: Client connectors not initialized")}),[ve,y]),p((()=>{ve&&Ie?.(ve)}),[ve]);let et=s();p((()=>{(async()=>{if(!be.customAuth?.enabled)return void Be({status:"not-enabled"});xe(!0);let{getCustomAccessToken:e,isLoading:t}=be.customAuth;if(h&&!t&&"loading"!==Fe.status){Be({status:"loading"});try{let t=await e();if(t===et.current)return void Be({status:"done"});if(!t&&f)return et.current=t,await _t.logout(),Be({status:"done"}),void Mr(ze,"customAuth","onUnauthenticated");if(!t)return et.current=t,void Be({status:"done"});a.startAuthFlow(new dl(t));let{user:r,isNewUser:n}=await a.authenticate();if(!r)return await _t.logout(),Be({status:"error",error:new _("Failed to sync with custom auth provider")}),void Mr(ze,"customAuth","onUnauthenticated");void 0!==n&&Mr(ze,"login","onComplete",r,n,!1,"custom",null),et.current=t,Mr(ze,"customAuth","onAuthenticated",{user:r}),Be({status:"done"}),w(r||null),M(n||!1),g(!0),Le(!0)}catch(e){if(console.warn(e),await _t.logout(),Mr(ze,"customAuth","onUnauthenticated"),"User already exists with provided custom JWT account."===e.message)return void Be({status:"initial"});Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),Be({status:"error",error:e})}}})()}),["initial"===Fe.status,be.customAuth?.enabled,be.customAuth?.getCustomAccessToken,be.customAuth?.isLoading,h,f]),p((()=>{Me&&ve&&y&&U(y,be.embeddedWallets.createOnLogin)&&(Le(!1),pt(y,qe).catch(console.error))}),[Me&&ve&&y]),p((()=>{if(be.externalWallets.solana.connectors)return be.externalWallets.solana.connectors.onMount(),()=>be.externalWallets.solana.connectors?.onUnmount()}),[be.externalWallets.solana.connectors]),p((()=>{!h&&$e&&async function(){let e,t=tt(),r=rt();(()=>{let e=new URLSearchParams(window.location.search).get("privy_token");if(!e)return;Nt.put(Se,e);let t=new URL(window.location.href);t.searchParams.delete("privy_token"),window.history.pushState({},"",t)})();let n=o();a.initializeConnectorManager({walletConnectCloudProjectId:be.walletConnectCloudProjectId,rpcConfig:be.rpcConfig,chains:be.chains,defaultChain:be.defaultChain,store:n,walletList:be.appearance.walletList,shouldEnforceDefaultChainOnConnect:be.shouldEnforceDefaultChainOnConnect,externalWalletConfig:be.externalWallets,appName:be.name??"Privy",walletChainType:be.appearance.walletChainType}),a.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=a.connectors.walletConnectors.length,r=a.connectors.walletConnectors.reduce(((e,t)=>e+(t.initialized?1:0)),0);r===t?Ve(!0):e=setTimeout((()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:r,expected:t}),Ve(!0)}),1500)})),a.connectors?.initialize().then((()=>{lt()}));let i=await a.getAuthenticatedUser(),l=!!i;be.legal.requireUsersAcceptTerms&&i&&!i.hasAcceptedTerms?(await a.logout(),At.setReadyToTrue(!0),Mr(ze,"logout","onSuccess")):(be.customAuth?.enabled||(g(!!i),i&&Mr(ze,"login","onComplete",i,!1,!0,null,null),w(i)),t?Ze.current=l?"link":"login":r&&!l?(Ze.current="login",Ae({telegramAuthModalData:{seamlessAuth:!0}}),Je(Er.TELEGRAM_AUTH_SCREEN)):At.setReadyToTrue(!!i))}()}),[a,ke,h,$e]),p((()=>{if(h){if(!y||!y.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void Re(!0);Re(!!v.find((e=>"privy"===e.walletClientType)))}}),[h,y,v]);let tt=()=>{let e=Sl();return e.inProgress&&e.popupFlow?window.opener.location.origin!==window.location.origin?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."}):"error"===e.authorizationCode?void window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Something went wrong. Try again."}):void window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}):(e.inProgress&&function(e){return e.startsWith("privy:")}(e.provider)&&!e.popupFlow&&(new BroadcastChannel(eC).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!!e.withPrivyUi&&(a.startAuthFlow(new fl(e)),Je(Er.AWAITING_OAUTH_SCREEN),!0))},rt=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),n=Number(e.get("auth_date")||""),a=e.get("first_name");if(t&&a&&n&&r)return Object.fromEntries(e.entries())}())?(rs(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("user"),n=Number(t.get("auth_date")||""),a=t.get("hash");return r&&n&&a?Object.fromEntries(t.entries()):void 0}())?(rs(),{flowType:"web-app",authData:e}):void 0}();if(!e||!be.loginMethods.telegram||!be.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new es;return a.startAuthFlow(t),"login-url"===e.flowType&&(t.meta.telegramWebAppData=void 0,t.meta.telegramAuthResult=e.authData),"web-app"===e.flowType&&(t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData=e.authData),!0},nt=async(e,t,r,n)=>{at(await(a.connectors?.createEthereumWalletConnector(e,t))||null,t,r,n)};async function at(e,t,r,n){if(!e)return z({status:"disconnected",connectedWallet:null,connectError:new I("Unable to connect to wallet."),connector:null,connectRetry:N}),n?.(null,r);z({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:N}),e instanceof Ms&&t&&await e.resetConnection(t),z({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>at(e,t,r,n)});try{let t=await e.connect({showPrompt:!0});if((!t||os(t))&&be.shouldEnforceDefaultChainOnConnect&&!be.chains.find((e=>e.id===Number(t?.chainId.replace("eip155:",""))))&&("wallet_connect_v2"!==t?.connectorType||"metamask"!==t?.walletClientType)){z((t=>({...t,connector:e,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:N})));try{await(t?.switchChain(be.defaultChain.id)),t&&(t.chainId=ue(ge(be.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${be.defaultChain.id}`)}}return z((e=>({...e,status:"connected",connectedWallet:t,connectError:null,connectRetry:N}))),t&&Mr(ze,"connectWallet","onSuccess",(e.chainType,t)),n?.(t,r)}catch(e){return e instanceof S?(console.warn(e.cause?e.cause:e.message),Mr(ze,"connectWallet","onError",e.privyErrorCode||k.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),Mr(ze,"connectWallet","onError",k.UNKNOWN_CONNECT_WALLET_ERROR)),z((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),n?.(null,r)}}let it=async(e,t,r)=>{if(null===e||!os(e))return;let n=new Ol(e,a,t,r);a.startAuthFlow(n)},ot=async(e,t)=>{if(null===e||!wr(e))return;let r=new Zl(e,a,t);a.startAuthFlow(r)},lt=()=>{let e=new URLSearchParams(window.location.search),t=e.get("privy_connector"),r=e.get("privy_wallet_client");if(!t||!r)return;if("phantom"!==r||Ee()||Je(Er.LOGIN_FAILED_SCREEN),!a.connectors)throw new _("Connector not initialized");Qe(Er.AWAITING_CONNECTION);let n=new URL(window.location.href);n.searchParams.delete("privy_connector"),n.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",n),nt(t,r,void 0,it)};p((()=>{h&&f&&null===y&&a.getAuthenticatedUser().then(w)}),[h,f,y,a]);let st=e=>{if(!f)throw Mr(ze,"linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:e}),new _("User must be authenticated before linking an account.")},dt=()=>{st("siwe"),Ke.current="siwe",Ze.current="link",Qe(Er.LINK_WALLET_SCREEN)},ct=e=>{if(!f||!y)return!1;if("privy"===e.walletClientType)return!0;for(let t of y.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},ut=async e=>{let t;if(!a.connectors)throw new _("Connector not initialized");t="ethereum"===e.type?a.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:a.connectors.findSolanaWalletConnector(e.connectorType,e.walletClientType)||null,z((r=>({...r,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:N}))),be.captchaEnabled&&!f?(Ae({captchaModalData:{callback:t=>os(e)?it(e,t):ot(e,t),userIntentRequired:!1,onSuccessNavigateTo:Er.AWAITING_CONNECTION,onErrorNavigateTo:Er.ERROR_SCREEN}}),Je(Er.CAPTCHA_SCREEN)):(os(e)?await it(e):await ot(e),Je(Er.AWAITING_CONNECTION))},ht=()=>{C((e=>{let t=a.connectors?.wallets.filter(os).map((e=>({...e,linked:ct(e),loginOrLink:async()=>{if(!await e.isConnected())throw new _("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new _("Cannot link or login with embedded wallet");ut(e)},fund:async t=>{await At.fundWallet(e.address,t)},unlink:async()=>{if(!f)throw new _("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new _("Cannot unlink an embedded wallet");w(await a.unlinkEthereumWallet(e.address))}})))||[];return ls(e,t)?e:t})),$((e=>{let t=a.connectors?.wallets.filter(wr).map((e=>({...e,linked:ct(e),loginOrLink:async()=>{if(!await e.isConnected())throw new _("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new _("Cannot link or login with embedded wallet");ut(e)},fund:async()=>{throw new _("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:async()=>{if(!f)throw new _("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new _("Cannot unlink an embedded wallet");w(await a.unlinkSolanaWallet(e.address))}})))||[];return ls(e,t)?e:t}))};p((()=>{ht()}),[y?.linkedAccounts,f,h]),p((()=>{if(h){if(!a.connectors)throw new _("Connector not initialized");ht(),a.connectors.on("walletsUpdated",ht)}}),[h]),p((()=>{[...be.loginMethodsAndOrder?.primary??[],...be.loginMethodsAndOrder?.overflow??[]].filter((e=>e.startsWith("privy:"))).forEach((e=>a.getCrossAppProviderDetails(e.replace("privy:",""))))}),[!!a]),p((()=>{let e;if(!v[0])return;let t=v[0],r=O.current.find((e=>e.address===t.address));if(e="privy"===t.walletClientType?y?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"===e.walletClientType)):y?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"!==e.walletClientType)),!r&&e){let t=Object.assign({},y);t.wallet=e&&{address:e.address,chainType:e.chainType,chainId:e.chainId,walletClient:e.walletClient,walletClientType:e.walletClientType,connectorType:e.connectorType,imported:e.imported,delegated:e.delegated,walletIndex:e.walletIndex},w(t)}O.current=v}),[v]);let pt=async(e,t,r)=>{let n=G(e),a=H(e);if(r&&"walletIndex"in r)return ft(e,t,r.walletIndex,n,a);let i=r&&"createAdditional"in r&&r.createAdditional;if(n&&!i)throw Mr(ze,"createWallet","onError",k.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");let[o,l]=await Promise.all([At.initializeWalletProxy(t),bC()]);if(!o&&be.customAuth?.enabled)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(!o||!l||be.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return mt();if(!n)return console.log("solanaWallet",a),await o.create({accessToken:l,solanaAddress:a?.address}),gt(0);{let t=(X(e)?.walletIndex??0)+1,{entropyId:r,entropyIdVerifier:n}=P(j(e));return await At.recoverPrimaryWallet(),await o.addWallet({accessToken:l,entropyId:r,entropyIdVerifier:n,chainType:"ethereum",hdWalletIndex:t}),gt(t)}},mt=async()=>new Promise(((e,t)=>{xe(!0),Ae({createWallet:{onSuccess:t=>{Mr(ze,"createWallet","onSuccess",t),e(t)},onFailure:e=>{Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),t(e)},callAuthOnSuccessOnClose:!1}}),Qe(Er.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)})),ft=async(e,t,r,n,a)=>{if(r<0)throw Mr(ze,"createWallet","onError",k.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${r}) is invalid.`);let[i,o]=await Promise.all([At.initializeWalletProxy(t),bC()]);if(!i&&be.customAuth?.enabled)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(!i||!o||be.embeddedWallets?.requireUserOwnedRecoveryOnCreate){if(0==r)return mt();throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Create wallet UI can only be displayed when walletIndex is 0.")}if(0==r){if(n)return n;await i.create({accessToken:o,solanaAddress:a?.address})}else{if(!n)throw Mr(ze,"createWallet","onError",k.EMBEDDED_WALLET_CREATE_ERROR),Error("A user must have a wallet at HD index 0 before creating a wallet at greater HD indices.");let t=Y(e).find((e=>e.walletIndex===r));if(t)return t;let{entropyId:a,entropyIdVerifier:l}=P(j(e));await At.recoverPrimaryWallet(),await i.addWallet({accessToken:o,entropyId:a,entropyIdVerifier:l,chainType:"ethereum",hdWalletIndex:r})}return gt(r)},gt=async e=>{let t=Y(await At.refreshUser()).find((t=>t.walletIndex===e));if(!t)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");return Mr(ze,"createWallet","onSuccess",t),t},yt=(e,t,a,i)=>new Promise((async(o,l)=>{let{requesterAppId:s}=t||{};if(!f||!y)return Mr(ze,"sendTransaction","onError",k.MUST_BE_AUTHENTICATED),void l(Error("User must be authenticated before signing with a Privy wallet"));let d=i??G(y)?.address;if(!d)throw new _("User must have an embedded wallet to send a transaction.");let{signingWallet:c,rootWallet:u}=Q(y,d);if(!u||!c)return Mr(ze,"sendTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),void l(Error("Must have a Privy wallet before signing"));xe(!0);let h=kt.wallets.find((e=>"privy"===e.walletClientType&&n(e.address)===n(c.address))),p=await(h?.getEthereumProvider());if(!h||!p)throw new _(`Cannot sendTransaction before embedded wallet ${c.address} is connected`);let m=e.chainId?Number(e.chainId):Jv(h.chainId);(e=>{if(!be.chains.map((e=>e.id)).includes(e))throw new I(`Chain ID ${e} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,k.UNSUPPORTED_CHAIN_ID)})(m);let g=Object.assign({},e,{chainId:m});if(Xe({showWalletUIs:t?.showWalletUIs}))(async()=>{let e=await bC();if(!e||!ve)return Mr(ze,"sendTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),void l(Error("Must have valid access token and Privy wallet to send transaction"));try{if(!await At.recoverPrimaryWallet())return Mr(ze,"sendTransaction","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),void l(Error("Unable to connect to wallet"));let n=ye(g.chainId,be.chains,be.rpcConfig,{appId:r.appId}),a=await La(c.address,g,n);if(Xe({showWalletUIs:t?.showWalletUIs})){let{totalGasEstimate:e}=await Ra(a,n),{hasSufficientFunds:t}=await Ww(c.address,a,e,n);if(!t)throw new mr(new gr("Wallet has insufficient funds for this transaction.",yr.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let{entropyId:i,entropyIdVerifier:d}=P(u),h=await Uw({accessToken:e,entropyId:i,entropyIdVerifier:d,transactingWallet:c,walletProxy:ve,transactionRequest:a,provider:n,requesterAppId:s});Mr(ze,"sendTransaction","onSuccess",h),o(h)}catch(e){Mr(ze,"sendTransaction","onError",k.TRANSACTION_FAILURE),l(e)}})();else{let{entropyId:e,entropyIdVerifier:r}=P(u),n={entropyId:e,entropyIdVerifier:r,onCompleteNavigateTo:Er.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:e=>{Mr(ze,"sendTransaction","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),l(e)}},i=sC({address:c.address,appConfig:be,fundWalletConfig:a,methodScreen:Er.FUNDING_METHOD_SELECTION_SCREEN,chainIdOverride:g.chainId,comingFromSendTransactionScreen:!0});Ae({connectWallet:n,sendTransaction:{transactionRequest:g,transactingWallet:c,entropyId:e,entropyIdVerifier:r,onSuccess:e=>{Mr(ze,"sendTransaction","onSuccess",e),o(e)},onFailure:e=>{Mr(ze,"sendTransaction","onError",k.TRANSACTION_FAILURE),l(e)},uiOptions:t||{},fundWalletConfig:a,requesterAppId:s},funding:i}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),wt=({transaction:e,connection:t,transactionOptions:r,fundWalletConfig:n,uiOptions:a,wallet:i})=>new Promise((async(o,l)=>{let{requesterAppId:s}=a||{};if(!f||!y)return Mr(ze,"sendSolanaTransaction","onError",k.MUST_BE_AUTHENTICATED),void l(new _("User must be authenticated before signing with a Privy wallet",k.MUST_BE_AUTHENTICATED));let d=i?y.linkedAccounts.find((e=>"wallet"===e.type&&e.address===i.address)):H(y);if(!d)return Mr(ze,"sendSolanaTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),void l(new _("Must have a Privy wallet before signing",k.EMBEDDED_WALLET_NOT_FOUND));xe(!0);let c=i??E,u=await(c?.isConnected());if(!c||!u)throw Mr(ze,"sendSolanaTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),new _(`Cannot sendSolanaTransaction before embedded wallet ${d.address} is connected`,k.EMBEDDED_WALLET_NOT_FOUND);if(Xe({showWalletUIs:a?.showWalletUIs}))(async()=>{let n=await bC();if(!n||!ve)return Mr(ze,"sendSolanaTransaction","onError",k.EMBEDDED_WALLET_NOT_FOUND),void l(new _("Must have valid access token and Privy wallet to send transaction",k.EMBEDDED_WALLET_NOT_FOUND));try{if(!await At.recoverPrimaryWallet())return Mr(ze,"sendSolanaTransaction","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),void l(new _("Unable to connect to wallet",k.UNKNOWN_CONNECT_WALLET_ERROR));if(Xe({showWalletUIs:a?.showWalletUIs})){let{instructions:r}=await Bp(e,t);r.every((e=>e.hasFunds))||(Mr(ze,"sendSolanaTransaction","onError",k.INSUFFICIENT_BALANCE),l(new _("Solana wallet has insufficient funds for this transaction.",k.INSUFFICIENT_BALANCE)))}let{entropyId:i,entropyIdVerifier:s}=Z(y),{signature:c,receipt:u}=await nw({accessToken:n,tx:e,connection:t,walletProxy:ve,transactionOptions:r,entropyId:i,entropyIdVerifier:s,transactingWalletAddress:d.address,transactingWalletIndex:d.walletIndex??0}),h=Wp(c,u);Mr(ze,"sendSolanaTransaction","onSuccess",h),o(h)}catch(e){Mr(ze,"sendSolanaTransaction","onError",k.TRANSACTION_FAILURE),l(e)}})();else{let{entropyId:i,entropyIdVerifier:c}=P(d),u={entropyId:i,entropyIdVerifier:c,onCompleteNavigateTo:Er.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN,onFailure:e=>{Mr(ze,"sendSolanaTransaction","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),l(e)}},h=dC({address:d.address,appConfig:be,methodScreen:Er.FUNDING_METHOD_SELECTION_SCREEN,fundWalletConfig:n,comingFromSendTransactionScreen:!0});Ae({connectWallet:u,sendSolanaTransaction:{transactionRequest:e,connection:t,transactionOptions:r,transactingWallet:d,onSuccess:e=>{Mr(ze,"sendSolanaTransaction","onSuccess",e),o(e)},onFailure:e=>{Mr(ze,"sendSolanaTransaction","onError",k.TRANSACTION_FAILURE),l(e)},uiOptions:a||{},requesterAppId:s},funding:h}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}}));function vt(){return new Promise((async(e,t)=>{let r=await bC();if(!r||!ve)throw Error("Must have valid access token to enroll in MFA");try{await ve.verifyMfa({accessToken:r}),e()}catch(e){t(e)}}))}let Ct=e=>e?.linkedAccounts.filter((e=>null!==e.latestVerifiedAt&&!("wallet"===e.type&&"privy"===e.walletClientType))).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0],bt=e=>{let t=y?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:r,loginMethod:n}=Bf(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw Mr(ze,"linkAccount","onError",k.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:n}),new _(`User already has an account of type ${r} linked.`)};async function $t({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){D(null);let r=t?"setWalletPassword":"setWalletRecovery";if(!f||!y)throw Mr(ze,r,"onError",k.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let n=j(y);if(!n||!ve)throw Mr(ze,r,"onError",k.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");try{await vt()}catch(e){throw Mr(ze,r,"onError",k.MISSING_MFA_CREDENTIALS),e}return new Promise(((a,i)=>{xe(!0);let o={onSuccess:e=>{Mr(ze,r,"onSuccess","user-passcode",e),a(e)},onFailure:e=>{Mr(ze,r,"onError",k.USER_EXITED_SET_PASSWORD_FLOW),i(e)},callAuthOnSuccessOnClose:!1},l="user-passcode"===n.recoveryMethod,s=Uu({walletAction:"update",availableRecoveryMethods:be.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:l,showAutomaticRecovery:e}),{entropyId:d,entropyIdVerifier:c}=P(n);Ae({setWalletPassword:o,recoverWallet:{entropyId:d,entropyIdVerifier:c,onFailure:i},createWallet:o,connectWallet:{onCompleteNavigateTo:s,shouldForceMFA:!1,entropyId:d,entropyIdVerifier:c,onFailure:e=>{Mr(ze,r,"onError",k.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}},recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:l}}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}))}async function Et({appId:e,action:t}){let r=await bC();if("link"===t&&!r)throw Mr(ze,"linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new _("User must be authenticated before linking an account.");if("login"===t&&r)throw Mr(ze,"login","onError",k.UNKNOWN_AUTH_ERROR),new _("Attempted to log in, but user is already logged in. Use a `link` helper instead.");Ke.current=`privy:${e}`,Ze.current=t;let n=sf();return a.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(r,i)=>{let{name:o,logoUrl:l}=await nC({api:a.api,providerAppId:e,requesterAppId:be.id});Ae({crossAppAuth:{appId:e,name:o,logoUrl:l,action:t,popup:n,onSuccess:r,onError:i}}),Je(Er.CROSS_APP_AUTH_SCREEN)}))}let _t={ready:h,authenticated:f,user:y,walletConnectors:a.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),Ae({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress}}),Qe(f?Er.CONNECT_ONLY_AUTHENTICATED_SCREEN:Er.CONNECT_ONLY_LANDING_SCREEN)},linkWallet:dt,startCrossAppAuthFlow:Et,linkEmail:()=>{st("email"),bt("email"),Ke.current="email",Ze.current="link",Qe(Er.LINK_EMAIL_SCREEN)},linkPhone:()=>{st("sms"),bt("phone"),Ke.current="sms",Ze.current="link",Qe(Er.LINK_PHONE_SCREEN)},linkGoogle:async()=>{st("google"),bt("google_oauth"),Ze.current="link",await At.initLoginWithOAuth("google")},linkTwitter:async()=>{st("twitter"),bt("twitter_oauth"),Ze.current="link",await At.initLoginWithOAuth("twitter")},linkDiscord:async()=>{st("discord"),bt("discord_oauth"),Ze.current="link",await At.initLoginWithOAuth("discord")},linkGithub:async()=>{st("github"),bt("github_oauth"),Ze.current="link",await At.initLoginWithOAuth("github")},linkSpotify:async()=>{st("spotify"),bt("spotify_oauth"),Ze.current="link",await At.initLoginWithOAuth("spotify")},linkInstagram:async()=>{st("instagram"),bt("instagram_oauth"),Ze.current="link",await At.initLoginWithOAuth("instagram")},linkTiktok:async()=>{st("tiktok"),bt("tiktok_oauth"),Ze.current="link",await At.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{st("linkedin"),bt("linkedin_oauth"),Ze.current="link",await At.initLoginWithOAuth("linkedin")},linkApple:async()=>{st("apple"),bt("apple_oauth"),Ze.current="link",await At.initLoginWithOAuth("apple")},linkPasskey:async()=>{st("passkey"),bt("passkey"),await At.initLinkWithPasskey(),Qe(Er.LINK_PASSKEY_SCREEN)},linkTelegram:async()=>{st("telegram"),bt("telegram"),Ze.current="link",Ke.current="telegram",await At.initLoginWithTelegram(),Qe(Er.TELEGRAM_AUTH_SCREEN)},linkFarcaster:async()=>{st("farcaster"),bt("farcaster"),await At.initLoginWithFarcaster(),Ze.current="link",Ke.current="farcaster",Qe(Er.AWAITING_FARCASTER_CONNECTION)},updateEmail:()=>{if(st("email"),!y?.email)throw new _("User does not have an email linked to their account.");Ze.current="update",Ke.current="email",Qe(Er.UPDATE_EMAIL_SCREEN)},updatePhone:()=>{if(st("sms"),!y?.phone)throw new _("User does not have a phone number linked to their account.");Ze.current="update",Ke.current="sms",Qe(Er.UPDATE_PHONE_SCREEN)},login:async e=>{e&&"target"in e&&e&&(e=void 0);let t="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!h){let e=await new Promise((e=>{Ne((t=>e.bind(t)))}));if(Ne(null),e)return void console.warn(t)}!y||y.isGuest?(Ze.current="login",Ae({login:e}),Je(Er.LANDING)):console.warn(t)},connectOrCreateWallet:async()=>{h||(await new Promise((e=>{Ne((()=>e))})),Ne(null)),f?console.warn("User must be unauthenticated to `connectOrCreateWallet`"):(Ze.current="login",Je(Er.CONNECT_OR_CREATE))},logout:async()=>{if(Ze.current=null,Ke.current=null,y&&a.clearProviderAcccessTokens(y),D(null),await a.logout(),y&&ve)try{await ve.clearMfa({userId:y.id})}catch(e){}w(null),g(!1),Mr(ze,"logout","onSuccess"),u(!1),Nt.del(Ue),Nt.del(ae(be.id))},getAccessToken:()=>a.getCustomerAccessToken(),getEthereumProvider:()=>{if(!y||!y.wallet)return new ds;let e=v.find((e=>y.wallet&&e.address===y.wallet.address)),t=a.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new ds},getEthersProvider:()=>{if(!y||!y.wallet)return new i(new cs(new ds));let e=v.find((e=>y.wallet&&e.address===y.wallet.address)),t=a.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new i(new cs(e&&t?t.proxyProvider:new ds))},getWeb3jsProvider:()=>{if(!y||!y.wallet)return new us(new ds);let e=v.find((e=>y.wallet&&e.address===y.wallet.address)),t=a.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new us(e&&t?t.proxyProvider:new ds)},unlinkWallet:async e=>{let t;return w(t=e.startsWith("0x")?await a.unlinkEthereumWallet(e):await a.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await a.unlinkEmail(e);return w(t),t},unlinkPhone:async e=>{let t=await a.unlinkPhone(e);return w(t),t},unlinkGoogle:async e=>{let t=await a.unlinkOAuth("google",e);return w(t),t},unlinkTwitter:async e=>{let t=await a.unlinkOAuth("twitter",e);return w(t),t},unlinkDiscord:async e=>{let t=await a.unlinkOAuth("discord",e);return w(t),t},unlinkGithub:async e=>{let t=await a.unlinkOAuth("github",e);return w(t),t},unlinkSpotify:async e=>{let t=await a.unlinkOAuth("spotify",e);return w(t),t},unlinkInstagram:async e=>{let t=await a.unlinkOAuth("instagram",e);return w(t),t},unlinkTiktok:async e=>{let t=await a.unlinkOAuth("tiktok",e);return w(t),t},unlinkLinkedIn:async e=>{let t=await a.unlinkOAuth("linkedin",e);return w(t),t},unlinkApple:async e=>{let t=await a.unlinkOAuth("apple",e);return w(t),t},unlinkFarcaster:async e=>{let t=await a.unlinkFarcaster(e);return w(t),t},unlinkTelegram:async e=>{let t=await a.unlinkTelegram(e);return w(t),t},unlinkPasskey:async e=>{let t=await a.unlinkPasskey(e);return w(t),t},unlinkCrossAppAccount:async({subject:e})=>{let t=y?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new _("Invalid subject");a.storeProviderAccessToken(t.id,null);let r=await a.unlinkOAuth(`privy:${t.id}`,e);return w(r),r},setActiveWallet:async e=>{let t=v.find((t=>n(t.address)===n(e))),r=y?.linkedAccounts.find((t=>"wallet"===t.type&&n(t.address)===n(e)));if(t&&await t.isConnected())if(t.linked){let e=Object.assign({},y);e.wallet=r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,imported:r.imported,delegated:r.delegated,walletIndex:r.walletIndex},w(e)}else t.loginOrLink();else Ae({externalConnectWallet:{suggestedAddress:e}}),dt()},forkSession:()=>a.forkSession(),createWallet:async e=>{if(e&&"target"in e&&e&&(e=void 0),!f||!y)throw Mr(ze,"createWallet","onError",k.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return pt(y,15e3,e)},setWalletRecovery:async e=>$t({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>$t({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:o}=t||{};if(!f||!y)return Mr(ze,"signMessage","onError",k.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let l=r??G(y)?.address;if(!l)throw new _("User must have an embedded wallet to sign a message.");let{signingWallet:s,rootWallet:d}=Q(y,l);if(!s||!d)return Mr(ze,"signMessage","onError",k.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));if("string"!=typeof e||e.length<1)return Mr(ze,"signMessage","onError",k.INVALID_MESSAGE),void i(Error("Message must be a non-empty string"));xe(!0);let c=async()=>{if(!f)throw Error("User must be authenticated before signing with a Privy wallet");let t=await bC();if(!ve||!t||!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");a.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:s.address,requesterAppId:o}});let{entropyId:r,entropyIdVerifier:n}=P(d),{response:i}=await ve.rpc({accessToken:t,entropyId:r,entropyIdVerifier:n,chainType:"ethereum",hdWalletIndex:s.walletIndex??0,requesterAppId:o,request:{method:"personal_sign",params:[e,s.address]}}),l=i.data;return a.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:s.address,requesterAppId:o}}),l};if(Xe({showWalletUIs:t?.showWalletUIs}))try{let e=await c();Mr(ze,"signMessage","onSuccess",e),n(e)}catch(e){Mr(ze,"signMessage","onError",k.UNABLE_TO_SIGN),i(e??new mr("Unable to sign message"))}else{let{entropyId:r,entropyIdVerifier:a}=P(d);Ae({signMessage:{method:"personal_sign",data:e,confirmAndSign:c,onSuccess:e=>{Mr(ze,"signMessage","onSuccess",e),n(e)},onFailure:e=>{Mr(ze,"signMessage","onError",k.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{entropyId:r,entropyIdVerifier:a,onCompleteNavigateTo:Er.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{Mr(ze,"signMessage","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}}}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),signTypedData:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:o}=t||{};if(!f||!y)return Mr(ze,"signTypedData","onError",k.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let l=r??G(y)?.address;if(!l)throw new _("User must have an embedded wallet to sign a message.");let{signingWallet:s,rootWallet:d}=Q(y,l);if(!d||!s)return Mr(ze,"signTypedData","onError",k.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));xe(!0);let c=we(e),u=async()=>{if(!f)throw Error("User must be authenticated before signing with a Privy wallet");let e=await bC();if(!ve||!e||!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");a.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:s.address,requesterAppId:o}});let{entropyId:t,entropyIdVerifier:r}=P(d),{response:n}=await ve.rpc({accessToken:e,entropyId:t,entropyIdVerifier:r,chainType:"ethereum",hdWalletIndex:s.walletIndex??0,requesterAppId:o,request:{method:"eth_signTypedData_v4",params:[s.address,c]}}),i=n.data;return a.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:s.address,requesterAppId:o}}),i};if(Xe({showWalletUIs:t?.showWalletUIs,typedData:!0}))try{let e=await u();Mr(ze,"signTypedData","onSuccess",e),n(e)}catch(e){Mr(ze,"signTypedData","onError",k.UNABLE_TO_SIGN),i(e??new mr("Unable to sign message"))}else{let{entropyId:e,entropyIdVerifier:r}=P(d);Ae({signMessage:{method:"eth_signTypedData_v4",data:c,confirmAndSign:u,onSuccess:e=>{Mr(ze,"signTypedData","onSuccess",e),n(e)},onFailure:e=>{Mr(ze,"signTypedData","onError",k.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{entropyId:e,entropyIdVerifier:r,onCompleteNavigateTo:Er.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{Mr(ze,"signMessage","onError",k.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}}}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),sendTransaction:async(e,t,r,n)=>{let a=await yt(e,t,r,n);return Bw(await a.wait())},sendSolanaTransaction:async(e,t,r,n,a)=>await wt({transaction:e,connection:t,transactionOptions:n,uiOptions:r,fundWalletConfig:a,wallet:E??void 0}),exportWallet:e=>new Promise((async(t,n)=>{if(!f||!y)return void n(Error("User must be authenticated before exporting their Privy wallet"));e&&"target"in e&&e&&(e=void 0);let i=e?.address??G(y)?.address;if(!i)return void n(Error("User does not have an HD Ethereum wallet. To export an imported wallet, pass the `address` of the wallet to `exportWallet`."));let{signingWallet:o,rootWallet:l}=Q(y,i);if(!o||!l)return void n(Error("Must have a Privy wallet before exporting"));xe(!0);let{entropyId:s,entropyIdVerifier:d}=P(l),c={entropyId:s,entropyIdVerifier:d,onCompleteNavigateTo:Er.EMBEDDED_WALLET_KEY_EXPORT_SCREEN,onFailure:n,shouldForceMFA:!0};Ae(_e),await bC()&&ve?ve?(Ae({keyExport:{appId:r.appId,appClientId:r.clientId,origin:a.apiUrl,walletToExport:o,primaryWallet:l,onSuccess:t,onFailure:n},connectWallet:c}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)):n(Error("Must have a Privy wallet before exporting")):n(Error("Must have valid access token to enroll in MFA"))})),promptMfa:vt,async init(e){switch(e){case"sms":return void await a.initMfaSmsVerification();case"passkey":return await a.initMfaPasskeyVerification();case"totp":return;default:throw Error(`Unsupported MFA method: ${e}`)}},async submit(e,t){switch(e){case"totp":case"sms":if("string"!=typeof t)throw new _("Invalid MFA code");Ge.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{He.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new _("Invalid authenticator response");let r=await import("@simplewebauthn/browser"),n=(e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type}))(await r.startAuthentication(t));Ge.current?.resolve({mfaMethod:e,mfaCode:n,relyingParty:window.origin}),await new Promise(((e,t)=>{He.current={resolve:e,reject:t}}));break;default:throw Ge.current?.reject(new _("Unsupported MFA method")),new _(`Unsupported MFA method: ${e}`)}},cancel(){Ge.current?.reject(new _("MFA canceled"))},async initEnrollmentWithSms(e){let t=await bC();if(!t||!ve)throw Error("Must have valid access token to enroll in MFA");await ve.initEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber})},enrollInMfa:e=>new Promise(((t,r)=>{if(!e)return At.closePrivyModal(),void t();be.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),Ae({mfaEnrollmentFlow:{mfaMethods:be.mfa.methods,onSuccess:t,onFailure:r}}),Qe(Er.MFA_ENROLLMENT_FLOW_SCREEN)})),async initEnrollmentWithTotp(){let e=await bC();if(!e||!ve)throw Error("Must have valid access token to enroll in MFA");let t=await ve.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await bC();if(!t||!ve)throw Error("Must have valid access token to enroll in MFA");await ve.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),w(await a.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await bC();if(!t||!ve)throw Error("Must have valid access token to enroll in MFA");await ve.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),w(await a.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e}){let t=await bC();if(!t||!ve)throw Error("Must have valid access token to enroll in MFA");await ve.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:e}),w(await a.getAuthenticatedUser())},async unenroll(e){let t=await bC();if(!t||!ve)throw Error("Must have valid access token to remove MFA");"passkey"===e?await ve.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:[]}):await ve.unenrollMfa({method:e,accessToken:t}),w(await a.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await bC(),t=y?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!ve||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(!y?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");let r=await ve.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===r.status&&w(await a.getAuthenticatedUser()||y||null),Ae({farcasterSigner:r}),Qe(Er.AWAITING_FARCASTER_SIGNER)},getFarcasterSignerPublicKey:async()=>{let e,t=await bC(),r=y?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!ve||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!y?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");if(!y.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=y.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await bC(),r=y?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!ve||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!y?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await At.recoverPrimaryWallet())throw Error("Unable to connect to wallet");if(!y.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let n=await import("@simplewebauthn/browser"),a=await ve.signFarcasterMessage({address:r.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:n.bufferToBase64URLString(e)},fid:BigInt(y.farcaster.fid),relyingParty:window.origin});return new Uint8Array(n.base64URLStringToBuffer(a.signature))},createGuestAccount:async()=>{if(y&&!y.isGuest)throw Error("User cannot already be authenticated to create a guest account");return y?.isGuest?y:At.loginWithGuestAccountFlow()},signMessageWithCrossAppWallet(e,{address:t}){let r=y?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return aC({user:y,client:a,address:t,requesterAppId:be.id,request:{method:r?"privy_signSmartWalletMessage":"personal_sign",params:[e,t]},reconnect:Et})},signTypedDataWithCrossAppWallet(e,{address:t}){let r=y?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t)))),n=we(e);return aC({user:y,client:a,address:t,requesterAppId:be.id,request:{method:r?"privy_signSmartWalletTypedData":"eth_signTypedData_v4",params:[t,n]},reconnect:Et})},sendTransactionWithCrossAppWallet(e,{address:t}){let r=y?.linkedAccounts.some((e=>"cross_app"===e.type&&e.smartWallets.some((e=>e.address===t))));return aC({user:y,client:a,address:t,requesterAppId:be.id,request:{method:r?"privy_sendSmartWalletTx":"eth_sendTransaction",params:[e]},reconnect:Et})},isModalOpen:l,mfaMethods:be.mfa.methods};mC=_t.signMessage,fC=_t.signTypedData,gC=async(...e)=>{let t=await yt(...e);return be.embeddedWallets.waitForTransactionConfirmation&&await t.wait(),t};let At={isNewUserThisSession:R,pendingTransaction:null,walletConnectionStatus:B,connectors:a.connectors?.walletConnectors??[],solanaWallets:b,rpcConfig:be.rpcConfig,chains:be.chains,appId:r.appId,showFiatPrices:"native-token"!==be.embeddedWallets.priceDisplay.primary,clientAnalyticsId:a.clientAnalyticsId,customAuthStatus:Fe,noPromptOnSignature:Ye,emailOtpState:ne,setEmailOtpState:ie,smsOtpState:de,setSmsOtpState:ce,oAuthState:me,setOAuthState:fe,siweState:he,setSiweState:pe,isHeadlessOAuthLoading:F,nativeTokenSymbolForChainId:e=>be.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(ve)return ve;let t=new Promise((e=>{Pe((()=>t=>e(t)))})),r=new Promise((t=>setTimeout((()=>t(null)),e))),n=await Promise.race([t,r]);return Pe(null),n},getAuthFlow:()=>a.authFlow,getAuthMeta:()=>a.authFlow?.meta,client:a,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,n=h&&f&&y;n&&Ke.current&&(t=Ct(y)),"login"===Ze.current?e.shouldCallAuthOnSuccess&&n&&Ke.current?(Mr(ze,"login","onComplete",y,R,!1,Ke.current,t??null),r.onSuccess?.(y,R)):Mr(ze,"login","onError",k.USER_EXITED_AUTH_FLOW):"link"===Ze.current&&t?e.isSuccess&&n&&Ke.current?Mr(ze,"linkAccount","onSuccess",y,Ke.current,t):Ke.current&&Mr(ze,"linkAccount","onError",k.USER_EXITED_LINK_FLOW,{linkMethod:Ke.current}):"update"===Ze.current&&t&&(e.isSuccess&&n&&Ke.current?Mr(ze,"update","onSuccess",y,Ke.current,t):Ke.current&&Mr(ze,"update","onError",k.USER_EXITED_UPDATE_FLOW,{linkMethod:Ke.current}));let i=L&&cC.includes(L),o=L===Er.ERROR_SCREEN&&_e.errorModalData&&cC.includes(_e.errorModalData.previousScreen);if((i||o)&&_e.funding){let e,t=uC[L]??null;if("solana"===_e.funding.chainType){let{Connection:r,PublicKey:n}=await import("@solana/web3.js");try{e=await new r(Ip(_e.funding.cluster)).getBalance(new n(_e.funding.address)).then((e=>BigInt(e)))}catch{console.error("Unable to pull wallet balance")}Mr(ze,"fundSolanaWallet","onUserExited",{address:_e.funding.address,cluster:_e.funding.cluster,fundingMethod:t,balance:e})}else{let n=ye(_e.funding.chain.id,be.chains,be.rpcConfig,{appId:r.appId});try{e=(await n.getBalance(_e.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}Mr(ze,"fundWallet","onUserExited",{address:_e.funding.address,chain:_e.funding.chain,fundingMethod:t,balance:e})}}Ae({..._e,externalConnectWallet:{suggestedAddress:void 0}}),Ze.current=null,Ke.current=null,M(!1),u(!1),setTimeout((()=>{a.authFlow=void 0}),200),a.createAnalyticsEvent({eventName:"modal_closed"})},solanaSignMessage:async({message:e})=>new Promise((async(t,r)=>{let n=async()=>{let t=await a.getAccessToken();if(!t)throw Error("User must be authenticated to use their embedded wallet.");if(!E)throw Error("User must have an embedded Solana wallet to sign messages for Solana.");let r=At.walletProxy??await At.initializeWalletProxy(15e3);if(!r)throw Error("Failed to initialize embedded wallet proxy.");let{entropyId:n,entropyIdVerifier:i}=Z(y),{response:o}=await r.rpc({accessToken:t,entropyId:n,entropyIdVerifier:i,chainType:"solana",hdWalletIndex:E.walletIndex??0,request:{method:"signMessage",params:{message:e}}});return o.data.signature};if(Xe({showWalletUIs:void 0}))try{let e=await n();t({signature:e})}catch(e){r(e)}else Ae({signMessage:{method:"solana_signMessage",data:e,confirmAndSign:n,onSuccess:e=>{t({signature:e})},onFailure:e=>{r(e)},uiOptions:{}}}),Je(Er.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN)})),openPrivyModal:Qe,connectWallet:at,initLoginWithWallet:async(e,t,r)=>{os(e)?(Ke.current="siwe",it(e,t,r)):(Ke.current="siws",ot(e,t))},loginWithWallet:async()=>{let e,t,r;if(!h)throw new J;if(a.authFlow instanceof Ol?e="siwe":a.authFlow instanceof Zl&&(e="siws"),!e)throw new _("Must initialize SIWE/SIWS flow first.");if(null!==await a.getAccessToken())try{({user:t}=await a.link()),Ke.current=e}catch(t){throw Mr(ze,"linkAccount","onError",t.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:r}=await a.authenticate()),Ke.current=e}catch(e){throw Mr(ze,"login","onError",e.privyErrorCode||k.GENERIC_CONNECT_WALLET_ERROR),e}w(t||y||null),M(r||!1),g(!0)},delegateWallet:async({address:e,chainType:t})=>new Promise((async(r,n)=>{let a=await bC();if(!f||!y||!a)throw new _("User must be authenticated and have an embedded wallet to delegate actions.");if("solana"!==t&&"ethereum"!==t)throw new _("Only Solana and Ethereum embedded wallets are supported for delegation and revocation.");let i=At.walletProxy??await At.initializeWalletProxy(15e3);if(!i)throw new _("Wallet proxy not initialized.");if((({address:e,chainType:t,user:r})=>!!Xv(r).find((r=>r.address===e&&r.chainType===t)))({address:e,chainType:t,user:y}))throw new _(`Wallet with address ${e} is already delegated.`);let o=(({address:e,user:t})=>{let r=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!r)throw new _("Address to delegate is not associated with current user.");return{address:r.address,chainType:r.chainType,walletIndex:r.walletIndex??0}})({address:e,user:y}),l=(({address:e,user:t})=>{let r,n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new _("Address to delegate is not associated with current user.");if(!(r="ethereum"===n.chainType?n.imported?K(t):G(t):n))throw new _("Unable to determine root address for delegated address.");return{address:r.address,chainType:r.chainType,imported:r.imported}})({address:e,user:y});await At.recoverPrimaryWallet(),Ae({delegatedActions:{consent:{address:e,onDelegate:async()=>{await i.createDelegatedAction({accessToken:a,rootWallet:l,delegatedWallets:[o]}),await At.refreshUser()},onSuccess:async()=>{r()},onError:async e=>{n(e)}}}}),Qe(Er.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN)})),revokeDelegatedWallets:async()=>new Promise((async(e,t)=>{if(!f||!y)throw new _("User must be authenticated and have an embedded wallet to revoke a delegated wallet.");if(0===Xv(y).length)throw new _("User has no delegated wallets to revoke.");Ae({delegatedActions:{revoke:{onRevoke:async()=>{await a.revokeDelegatedWallet(),await At.refreshUser()},onSuccess:async()=>{e()},onError:async e=>{t(e)}}}}),Qe(Er.EMBEDDED_WALLET_DELEGATED_ACTIONS_REVOKE_SCREEN)})),initLoginWithFarcaster:async(e,t)=>{let r=new ql(e,t);a.startAuthFlow(r);try{Ke.current="farcaster",await r.initializeFarcasterConnect()}catch(e){throw"login"===Ze.current?Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR):"link"===Ze.current&&Mr(ze,"linkAccount","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!h)throw new J;if(!(a.authFlow instanceof ql))throw new _("Must initialize Farcaster flow first.");if(null!==await a.getAccessToken())try{({user:e}=await a.link()),Ke.current="farcaster"}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await a.authenticate()),Ke.current="farcaster"}catch(e){throw Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}w(e||null),M(t||!1),g(!0)},async loginWithGuestAccountFlow(){let e=new ul(this.appId);a.startAuthFlow(e);try{Ze.current="login",Ke.current="guest";let{user:e,isNewUser:t}=await a.authenticate();if(t=t||!1,!e)throw new _("Unable to authenticate guest account");if(U(e,be.embeddedWallets.createOnLogin))try{await pt(e,15e3),e=await At.refreshUser()}catch(t){w(e),console.warn("Unable to create embedded wallet for guest account")}else w(e);return M(t),g(!0),Mr(ze,"login","onComplete",e,t,!1,"guest",null),e}catch(e){throw Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}},async crossAppAuthFlow({appId:e,popup:t,action:r}){let n=`privy:${e}`;Ke.current=n;let{url:i,stateCode:o,codeVerifier:l}=await async function({api:e,appId:t}){let r=hl(),n=pl(),a=await ml(r);try{let{url:i}=await e.post(il,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:a,state_code:n});return{url:i,stateCode:n,codeVerifier:r}}catch(e){throw A(e)}}({api:a.api,appId:e});if(!i)throw a.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new _("No authorization URL returned for cross-app auth.");try{let s=await async function({url:e,popup:t}){return t.location=e,new Promise(((e,r)=>{let n,a=setTimeout((()=>{r(new _("Authorization request timed out after 2 minutes.")),i()}),12e4);function i(){t?.close(),window.removeEventListener("message",l)}let o=setInterval((()=>{t?.closed&&!n&&(i(),clearInterval(o),clearTimeout(a),r(new _("User rejected request")))}),300);function l(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(a),e(t.data),i()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(a),r(new _(t.data.error)),i()),t.data.type===tC&&((n=new BroadcastChannel(eC)).onmessage=l))}window.addEventListener("message",l)}))}({url:i,popup:t,provider:n}),d=s.stateCode,c=s.authorizationCode;if(d!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:n,storedStateCode:o??"",returnedStateCode:d??""}}),new _("Unexpected auth flow. This may be a phishing attempt.",void 0,k.OAUTH_UNEXPECTED);let u=await async function({appId:e,stateCode:t,codeVerifier:r,authorizationCode:n,action:a,client:i}){if(!n||!t)throw new _("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===n)throw new _("User denied confirmation during cross-app auth flow");try{let o=new rC({authorizationCode:n,stateCode:t,codeVerifier:r,provider:`privy:${e}`});i.startAuthFlow(o);let l="link"===a?await i.link():await i.authenticate(),s=l.oAuthTokens?.accessToken;return console.debug(),s}catch(e){let t=A(e);if(t.privyErrorCode)throw new _(t.message||"Invalid code during cross-app auth flow.",void 0,t.privyErrorCode);if("User denied confirmation during cross-app auth flow"===t.message)throw new _("Invalid code during cross-app auth flow.",void 0,k.OAUTH_USER_DENIED);throw new _("Invalid code during cross-app auth flow.",void 0,k.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:l,stateCode:d,authorizationCode:c,action:r,client:a});u&&a.storeProviderAccessToken(e,u);let h=await At.refreshUser();if(!h)throw new _("Unable to update user");return a.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),h}catch(e){throw a.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:n}}),e}},async initLoginWithOAuth(e,t,r){if(Ke.current=e,!St())return void Je(Er.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);if("google"===e&&ru(window.navigator.userAgent))return void Je(Er.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);"twitter"===e&&window.opener&&window.opener.postMessage({type:tC},"*"),Nt.del(oe),Nt.del(le);let n=new fl({provider:e,disableSignup:!!r,withPrivyUi:!0});t&&n.addCaptchaToken(t),a.startAuthFlow(n);let i=await a.authFlow.getAuthorizationUrl();i&&i.url&&("twitter"===e&&T&&(i.url=i.url.replace("x.com","twitter.com")),window.location.assign(i.url))},async initLoginWithTelegram(e,t){if(!h)throw new J;Ke.current="telegram";let r=new es(e,t);a.startAuthFlow(r),r.meta.telegramWebAppData=void 0,r.meta.telegramAuthResult=await new Promise(((e,t)=>be.loginConfig.telegramAuthConfiguration?window.Telegram?void window.Telegram.Login.auth({bot_id:be.loginConfig.telegramAuthConfiguration.botId,request_access:!0},(r=>r?e(r):t(new _("Telegram auth failed or was canceled by the client")))):t(new _("Telegram was not initialized")):t(new _("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(e){let t,r;if(!(a.authFlow instanceof es))throw new _("Must initialize Telegram flow before calling loginWithTelegram");if(a.authFlow.meta.captchaToken||=e,"login"===Ze.current)try{let e=await a.authenticate();t=e.user,r=e.isNewUser,Ke.current="telegram"}catch(e){throw Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}else{if("link"!==Ze.current)throw new _("Unknown auth intent");try{t=(await a.link()).user,Ke.current="telegram"}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}w(t),M(r||!1),g(!0)},async recoveryOAuthFlow(e,t,r){let n,i;function o(t){if(!t)throw a.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:e}}),new _("Recovery OAuth failed")}switch(e){case"google-drive":{let t,l,{url:s,codeVerifier:d,stateCode:c}=await Bu({api:pC.api,provider:e});o(s);try{let n=await hC({url:s,popup:r,provider:e});if(t=n.stateCode,l=n.authorizationCode,t!==c)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:c??"",returnedStateCode:t??""}}),new _("Unexpected auth flow. This may be a phishing attempt.",void 0,k.OAUTH_UNEXPECTED)}catch(t){throw a.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:e}}),new _("Recovery OAuth failed")}[n,i]=await Promise.all([bC(),Gu({api:pC.api,provider:e,codeVerifier:d,stateCode:t,authorizationCode:l})]);break}case"icloud":{let{url:t}=await Bu({api:pC.api,provider:e});o(t);let{ckWebAuthToken:a}=await hC({url:t,popup:r,provider:e});i=a,n=await bC()}}if(!ve)throw new _("Cannot connect to wallet proxy");if(!n)throw new _("Unable to authorize user");switch(t){case"recover":{let t=_e.recoverWallet?.entropyId,r=_e.recoverWallet?.entropyIdVerifier;if(!t||!r)throw new _("Recovery OAuth failed");a.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t,recoveryMethod:e}}),await ve.recover({accessToken:n,entropyId:t,entropyIdVerifier:r,recoveryAccessToken:i}),a.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t,recoveryMethod:e}});break}case"create-wallet":{a.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await ve.create({accessToken:n,recoveryAccessToken:i,recoveryMethod:e});let t=G(await At.refreshUser());if(!t)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");a.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:t.address}}),Mr(ze,"createWallet","onSuccess",t);break}case"set-recovery":{let t=j(y);if(!t)throw Mr(ze,"setWalletRecovery","onError",k.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");a.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:t.address,existingRecoveryMethod:t.recoveryMethod,targetRecoveryMethod:e}});let{entropyId:r,entropyIdVerifier:o}=P(t);await ve.setRecovery({accessToken:n,entropyId:r,entropyIdVerifier:o,recoveryMethod:e,recoveryAccessToken:i});let l=j(await At.refreshUser());if(!l)throw Mr(ze,"createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");a.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:t.address,existingRecoveryMethod:t.recoveryMethod,targetRecoveryMethod:e}}),Mr(ze,"setWalletRecovery","onSuccess",e,l);break}default:throw new _("Unsupported recovery action")}},async loginWithOAuth(e){let t,r,n;if(!(a.authFlow instanceof fl))throw new _("Must initialize OAuth flow before calling loginWithOAuth");let i=Nt.get(se),o=a.authFlow.meta.stateCode;if(i!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:o??""}}),new _("Unexpected auth flow. This may be a phishing attempt.",void 0,k.OAUTH_UNEXPECTED);if(null!==await a.getAccessToken())try{let r=await a.link();t=r.user,n=r.oAuthTokens,Ke.current=e}catch(t){throw Mr(ze,"linkAccount","onError",t.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await a.authenticate();t=i.user,r=i.isNewUser,n=i.oAuthTokens,Ke.current=e}catch(t){throw"login"===Ze.current?Mr(ze,"login","onError",t.privyErrorCode||k.UNKNOWN_AUTH_ERROR):"link"===Ze.current&&Mr(ze,"linkAccount","onError",t.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return w(t),M(r||!1),g(!0),n&&t&&Mr(ze,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),n},passkeyAuthState:V,setPasskeyAuthState:re,async initLoginWithPasskey({captchaToken:e,withPrivyUi:t}){let r=new Kl({captchaToken:e,setPasskeyAuthState:re});a.startAuthFlow(r),Ze.current="login";try{Ke.current="passkey",re({status:"generating-challenge"}),await r.initAuthenticationFlow(t),re({status:"awaiting-passkey"})}catch(e){throw re({status:"error",error:e}),Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(){let e,t;if(!h)throw new J;if(!(a.authFlow instanceof Kl))throw new _("Must initialize Passkey flow first.");if("passkey"!==Ke.current){let e=new _("Must init login with Passkey flow first.");throw re({status:"error",error:e}),e}let r=await bC();try{Ke.current="passkey",re({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await a.authenticate())}catch(e){throw re({status:"error",error:e}),Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}w(e),M(t||!1),g(!0),re({status:"done"});let n=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!r,loginAccount:n}},async initLinkWithPasskey(e){let t=new Kl({captchaToken:e});a.startAuthFlow(t),Ze.current="link",Ke.current="passkey",re({status:"generating-challenge"});try{await t.initLinkFlow(),re({status:"awaiting-passkey"})}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),re({status:"error",error:e}),e}},async linkWithPasskey(){let e;if(!h)throw new J;if(!(a.authFlow instanceof Kl))throw new _("Must initialize Passkey flow first.");if("passkey"!==Ke.current)throw new _("Must init login with Passkey flow first.");try{Ke.current="passkey",({user:e}=await a.link())}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return w(e||y||null),re({status:"done"}),e},async initLoginWithHeadlessOAuth(e,t,r){if(!St())throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");if("google"===e&&ru(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let n=new fl({provider:e,withPrivyUi:!1,disableSignup:r??!1});t&&n.addCaptchaToken(t),fe({status:"loading"});let i=await a.startAuthFlow(n).getAuthorizationUrl();i?.url&&window.location.assign(i.url)},async loginWithHeadlessOAuth(e){let t,r,n;W(!0),fe({status:"loading"}),a.startAuthFlow(new fl(e));let i=Nt.get(se),o=e.stateCode;if(i!==o)throw a.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:o??""}}),W(!1),new _("Unexpected auth flow. This may be a phishing attempt.",void 0,k.OAUTH_UNEXPECTED);if(null!==await a.getAccessToken())try{({user:t,oAuthTokens:n}=await a.link()),Ke.current=e.provider;let r=Ct(t);t&&r&&Mr(ze,"linkAccount","onSuccess",t,Ke.current,r)}catch(t){throw W(!1),Mr(ze,"linkAccount","onError",t.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:r,oAuthTokens:n}=await a.authenticate()),Ke.current=e.provider;let i=Ct(t);t&&i&&void 0!==r&&Mr(ze,"login","onComplete",t,r,!1,Ke.current,i)}catch(e){throw W(!1),fe({status:"error",error:e}),Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}return w(t),M(r||!1),g(!0),W(!1),fe({status:"done"}),n&&t&&Mr(ze,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),t??void 0},initLoginWithEmail:async({email:e,captchaToken:t,disableSignup:r,withPrivyUi:n})=>{let i=new Dl({email:e,captchaToken:t,disableSignup:r});a.startAuthFlow(i);try{Ke.current="email",ie({status:"sending-code"}),await i.sendCodeEmail({withPrivyUi:n}),ie({status:"awaiting-code-input"})}catch(e){throw ie({status:"error",error:e}),"login"===Ze.current?Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR):"link"===Ze.current&&Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async(e,t,r)=>{let n=new Fl(e,t,r);a.startAuthFlow(n);try{await n.sendCodeEmail({withPrivyUi:!0})}catch(e){Mr(ze,"update","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:Ke.current})}},initUpdatePhone:async(e,t,r)=>{let n=new Ml(e,t,r);a.startAuthFlow(n);try{await n.sendSmsCode({withPrivyUi:!0})}catch(e){Mr(ze,"update","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:Ke.current})}},initLoginWithSms:async({phoneNumber:e,captchaToken:t,disableSignup:r,withPrivyUi:n})=>{ce({status:"sending-code"});let i=new Rl({phoneNumber:e,captchaToken:t,disableSignup:r});a.startAuthFlow(i);try{Ke.current="sms",await i.sendSmsCode({withPrivyUi:n}),ce({status:"awaiting-code-input"})}catch(e){throw ce({status:"error",error:e}),"login"===Ze.current?Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR):"link"===Ze.current&&Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(a.authFlow?.sendCodeEmail({withPrivyUi:!0}))},resendSmsCode:async()=>{await(a.authFlow?.sendSmsCode({withPrivyUi:!0}))},loginWithCode:async e=>{let t,r;function n(e){a.authFlow instanceof Dl?ie(e):a.authFlow instanceof Rl&&ce(e)}if(n({status:"submitting-code"}),!h){let e=new J;throw n({status:"error",error:e}),e}if(a.authFlow instanceof Dl)a.authFlow.meta.emailCode=e.trim();else{if(!(a.authFlow instanceof Rl)){let e=new _("Must initialize a passwordless code flow first");throw n({status:"error",error:e}),e}a.authFlow.meta.smsCode=e.trim()}let i=await bC();if("link"===Ze.current)try{({user:t}=await a.link())}catch(e){throw n({status:"error",error:e}),Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:Ke.current}),e}else if("update"===Ze.current)try{({user:t}=await a.link())}catch(e){throw n({status:"error",error:e}),Mr(ze,"update","onError",e.privyErrorCode||k.FAILED_TO_UPDATE_ACCOUNT,{linkMethod:Ke.current}),e}else try{({user:t,isNewUser:r}=await a.authenticate())}catch(e){throw n({status:"error",error:e}),Mr(ze,"login","onError",e.privyErrorCode||k.UNKNOWN_AUTH_ERROR),e}let o=t||y;w(o||null),M(r||!1),g(!0),n({status:"done"});let l=null;return a.authFlow instanceof Dl?l=o?.linkedAccounts.find((({type:e})=>"email"===e))||null:a.authFlow instanceof Rl&&(l=o?.linkedAccounts.find((({type:e})=>"phone"===e))||null),{user:o,isNewUser:r||!1,wasAlreadyAuthenticated:!!i,linkedAccount:l}},generateSiweMessage:async({address:e,chainId:t,captchaToken:r})=>{Ze.current="link",Ke.current="siwe",pe({status:"generating-message"});let n=await a.generateSiweNonce({address:e,captchaToken:r});return pe({status:"awaiting-signature"}),Pl({address:e,chainId:t.replace("eip155:",""),nonce:n})},generateSiweMessageForSmartWallet:async({address:e,chainId:t})=>{let r=await a.generateSiweNonce({address:e});return Pl({address:e,chainId:t.replace("eip155:",""),nonce:r})},linkSmartWallet:async({message:e,signature:t,smartWalletType:r})=>{let n;try{n=await a.linkSmartWallet({message:e,signature:t,smartWalletType:r}),n=await At.refreshUser()??n}catch(e){throw e}w(n||y||null)},linkWithSiwe:async({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})=>{let o;st("siwe");let l=null;try{pe({status:"submitting-signature"}),o=await a.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}),o=await At.refreshUser()??o,pe({status:"done"}),(l=Ct(o)||null)&&Mr(ze,"linkAccount","onSuccess",o,"siwe",l)}catch(e){throw Mr(ze,"linkAccount","onError",e.privyErrorCode||k.FAILED_TO_LINK_ACCOUNT,{linkMethod:"siwe"}),Ze.current=null,Ke.current=null,pe({status:"error",error:e}),e}let s=o||y;return w(s||null),Ze.current=null,Ke.current=null,{user:s,linkedAccount:l}},refreshUser:async()=>{let e=await a.getAuthenticatedUser();return g(!!e),w(e),e},walletProxy:ve,createAnalyticsEvent:({eventName:e,payload:t,timestamp:r})=>a.createAnalyticsEvent({eventName:e,payload:t,timestamp:r}),acceptTerms:async()=>{let e=await a.acceptTerms();return w(e),e},getUsdTokenPrice:e=>a.getUsdTokenPrice(e),getUsdPriceForSol:()=>a.getUsdPriceForSol(),recoverPrimaryWallet:async e=>new Promise((async(t,r)=>{let n=j(e?.user??y)||K(e?.user??y),i=await bC();if(!i||!ve||!n)return void r(Error("Must have valid access token and Privy wallet to recover wallet"));xe(!0);let{entropyId:o,entropyIdVerifier:l}=P(n);try{await ve.connect({accessToken:i,entropyId:o,entropyIdVerifier:l}),t(!0)}catch(e){Pu(e)&&"privy"===n.recoveryMethod?(a.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:n.address}}),(await ve.recover({entropyId:o,entropyIdVerifier:l,accessToken:i})).entropyId||r(Error("Unable to recover wallet")),a.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n.address}}),t(!0)):Pu(e)&&"privy"!==n.recoveryMethod?(Ae({recoverWallet:{entropyId:o,entropyIdVerifier:l,onFailure:r,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:n.recoveryMethod,action:"recover"}}),Qe(Wu(n.recoveryMethod))):r(e)}})),embeddedSolanaWallet:E,createEmbeddedSolanaWallet:async()=>{xe(!0);let e=await bC(),t=await At.refreshUser(),r=H(t),n=G(t);if(!t||!e)throw new _("User must be logged in to create a Solana wallet");if(r)throw new _("User already has an embedded Solana wallet.");n&&await At.recoverPrimaryWallet({user:t});let i=await At.initializeWalletProxy(15e3);if(!i)throw new _("Unable to initialize wallet proxy");a.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await i.createSolana({accessToken:e,ethereumAddress:n?.address});let t=await At.refreshUser(),r=H(t);if(!r)throw new _("Could not get Solana wallet for user");return a.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:r.address}}),r}catch(e){throw a.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new _("Failed to create Solana embedded wallet with error ",e)}},exportSolanaWallet:e=>new Promise((async(t,n)=>{if(!f||!y)return void n(Error("User must be authenticated before exporting their Privy wallet"));let i=e?.address??H(y)?.address;if(!i)return void n(Error("User does not have an HD Solana wallet."));let{signingWallet:o,rootWallet:l}=ee(y,i);if(!o||!l)return void n(Error("Must have a Privy wallet before exporting"));if(xe(!0),!await bC()||!ve)return void n(Error("Must have valid access token to enroll in MFA"));if(!ve)return void n(Error("Must have a Privy wallet before exporting"));let{entropyId:s,entropyIdVerifier:d}=P(l);Ae({connectWallet:{entropyId:s,entropyIdVerifier:d,onCompleteNavigateTo:Er.EMBEDDED_WALLET_KEY_EXPORT_SCREEN,onFailure:n,shouldForceMFA:!0},keyExport:{appId:r.appId,appClientId:r.clientId,origin:a.apiUrl,walletToExport:o,primaryWallet:l,onSuccess:t,onFailure:n}}),Qe(Er.EMBEDDED_WALLET_CONNECTING_SCREEN)})),setReadyToTrue:e=>{m(!0),ke?.(e)},updateWallets:()=>ht(),fundWallet:async(e,t)=>{let r=Er.FUNDING_METHOD_SELECTION_SCREEN;Ae({funding:sC({address:e,appConfig:be,fundWalletConfig:t,methodScreen:r})}),Qe(r)},fundSolanaWallet:async(e,t)=>{let r=Er.FUNDING_METHOD_SELECTION_SCREEN;Ae({funding:dC({address:e,appConfig:be,fundWalletConfig:t,methodScreen:r})}),Qe(r)},requestFarcasterSignerStatus:async e=>{let t=await bC(),r=y?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!ve||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!y?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let n=await a.requestFarcasterSignerStatus(e);return"approved"===n.status&&w(await a.getAuthenticatedUser()||y||null),n},connectCoinbaseSmartWallet:async()=>{be.externalWallets.coinbaseWallet.connectionOptions="smartWalletOnly";let e=a.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||a.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),at(e);await nt("coinbase_wallet","coinbase_smart_wallet")},initiateAccountTransfer:async({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:o,oAuthUserInfo:l})=>{try{let s=await a.sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:o,oAuthUserInfo:l});return w(s),s}catch(e){throw e}}};yC=At.recoverPrimaryWallet,wC=At.recoverPrimaryWallet,vC=At.solanaSignMessage;let kt=c((()=>({wallets:v,ready:Oe&&je})),[v,Oe,je]),It=a.authFlow instanceof es,Pt=!be.headless&&be.captchaEnabled&&!f&&(h||It);return t(q.Provider,{value:_t,children:t(Lr.Provider,{value:ze,children:t(xt.Provider,{value:kt,children:t(Ql,{...be,children:e(te.Provider,{value:At,children:[t(rr,{children:e(Tr,{data:_e,setModalData:Ae,setInitialScreen:D,initialScreen:L,authenticated:f,open:l,children:[r.children,Pt&&t(Js,{delayedExecution:!1}),t(xv,{theme:{...be.appearance.palette||{}}}),!be.render.standalone&&t(Dv,{open:l})]})}),Te&&$e?t(Yv,{appId:r.appId,appClientId:r.clientId,clientAnalyticsId:a.clientAnalyticsId,origin:a.apiUrl,mfaMethods:y?.mfaMethods,mfaPromise:Ge,mfaSubmitPromise:He,onLoad:Ce,onLoadFailed:()=>null}):null,be.loginConfig.telegramAuthConfiguration&&t(Od,{$if:!0,children:t(Wv,{scriptHost:r.apiUrl||De,botUsername:be.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};const NC=()=>{let{getAccessToken:e,user:t}=F(),{refreshUser:r,initializeWalletProxy:n}=D(),a=Or();return{importWallet:m((({privateKey:i})=>(async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:r,refreshUser:n,user:a},{privateKey:i})=>{if(!a)throw e("linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new _("User must be authenticated before linking an account.");let[o,l]=await Promise.all([t(),r(15e3)]);if(!l||!o)throw e("linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new _("User must be authenticated before linking an account.");await l.import({privateKey:i,accessToken:o});let s=K(await n());if(!s)throw e("createWallet","onError",k.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",s),s})({getAccessToken:e,user:t,initializeWalletProxy:n,refreshUser:r,emitPrivyEvent:a},{privateKey:i})),[t,e,r,n,a])}},IC=()=>{let{importWallet:e}=NC();return{...u(q),importWallet:e}},PC=e=>{Pr("login",e);let t=Jl(),r=Tt(),{ready:n,user:a}=F(),{initLoginWithHeadlessOAuth:i,loginWithHeadlessOAuth:o,oAuthState:l,setOAuthState:s,isHeadlessOAuthLoading:d}=D(),c=m((async e=>{try{if(t.enabled&&"success"!==t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);return await i(e.provider,t.token,e.disableSignup)}catch(e){throw s({status:"error",error:e}),e}}),[i,t]),u=m((async()=>{let e=Sl();try{if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw s({status:"error",error:e}),e}try{return await o(e)}catch(e){throw s({status:"error",error:e}),e}finally{Nl()}}),[o]);return p((()=>{let e=Sl();n&&r&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&u()}),[n,r]),{initOAuth:c,loading:d,state:l}},OC=e=>{let t=Jl(),{emailOtpState:r,setEmailOtpState:n,initLoginWithEmail:a,loginWithCode:i}=D();return{sendCode:m((async({email:r,disableSignup:i})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({email:r,captchaToken:e,disableSignup:i,withPrivyUi:!1})}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:m((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);let{user:n,isNewUser:a,wasAlreadyAuthenticated:o,linkedAccount:l}=await i(r);e?.onComplete?.(n,a,o,"email",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR),r}}),[i,t.status]),state:r}},RC=e=>{let t=Jl(),{initLoginWithPasskey:r,loginWithPasskey:n,passkeyAuthState:a,setPasskeyAuthState:i}=D();return{loginWithPasskey:m((async()=>{try{let a;if(t.enabled&&"error"===t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),a=await t.waitForResult()),await r({captchaToken:a,withPrivyUi:!1});let{user:i,isNewUser:o,wasAlreadyAuthenticated:l,loginAccount:s}=await n();e?.onComplete?.(i,o,l,"passkey",s)}catch(t){throw i({status:"error",error:t}),e?.onError?.(t),t}}),[n,t.status]),state:a}},MC=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:n,setPasskeyAuthState:a}=D();return{linkWithPasskey:m((async()=>{try{await t();let n=await r();if(!n)throw Error("Error, user not found");let a=n.linkedAccounts.filter((e=>"passkey"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0];e?.onSuccess?.(n,"passkey",a)}catch(t){throw a({status:"error",error:t}),e?.onError?.(t,{linkMethod:"passkey"}),t}}),[r]),state:n}},LC=e=>{let t=Jl(),{smsOtpState:r,setSmsOtpState:n,initLoginWithSms:a,loginWithCode:i}=D();return{sendCode:m((async({phoneNumber:r,disableSignup:i})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({phoneNumber:r,captchaToken:e,disableSignup:i,withPrivyUi:!1})}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:m((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);let{user:n,isNewUser:a,wasAlreadyAuthenticated:o,linkedAccount:l}=await i(r);e?.onComplete?.(n,a,o,"sms",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR),r}}),[i,t.status]),state:r}},DC=e=>{let t=Jl(),{siweState:r,setSiweState:n,linkWithSiwe:a,generateSiweMessage:i}=D();return{generateSiweMessage:m((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await i({address:t,chainId:r}).then((e=>e))}catch(t){throw n({status:"error",error:t}),e?.onError?.(t.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[i]),linkWithSiwe:m((async({signature:r,message:i,chainId:o,walletClientType:l,connectorType:s})=>{try{if(t.enabled&&"success"!==t.status)throw new Xl(t.error,null,k.CAPTCHA_FAILURE);let{user:n,linkedAccount:d}=await a({message:i,signature:r,chainId:o,walletClientType:l,connectorType:s});d&&e?.onSuccess?.(n,"siwe",d)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||k.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[a,t.status]),state:r}};function FC(e){let{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:a,linkApple:i,linkTwitter:o,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:c,linkSpotify:h,linkInstagram:p,linkTelegram:m,linkFarcaster:f}=u(q);return Pr("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:a,linkApple:i,linkTwitter:o,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:c,linkSpotify:h,linkInstagram:p,linkFarcaster:f,linkTelegram:m}}function UC(e){let{updateEmail:t,updatePhone:r}=u(q);return Pr("update",e),{updateEmail:t,updatePhone:r}}function WC(e){let{createWallet:t}=u(q);return Pr("createWallet",e),{createWallet:t}}const BC=()=>{let{connectCoinbaseSmartWallet:e}=D();return{connectCoinbaseSmartWallet:e}},GC=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:n,sendTransactionWithCrossAppWallet:a}=F();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:n,sendTransaction:a}};function HC(e){let{sendTransaction:t}=u(q);return Pr("sendTransaction",e),{sendTransaction:t}}function zC(e){let{sendSolanaTransaction:t}=u(q);return Pr("sendSolanaTransaction",e),{sendSolanaTransaction:t}}function jC(e){let{setWalletPassword:t}=u(q);return Pr("setWalletPassword",e),{setWalletPassword:t}}function VC(){let{createGuestAccount:e}=u(q);return{createGuestAccount:e}}function qC(e){let{setWalletRecovery:t}=u(q);return Pr("setWalletRecovery",e),{setWalletRecovery:t}}function KC(e){let{signMessage:t}=u(q);return Pr("signMessage",e),{signMessage:t}}function ZC(e){let{signTypedData:t}=u(q);return Pr("signTypedData",e),{signTypedData:t}}const YC=()=>{let{isModalOpen:e}=u(q);return{isOpen:e}};function XC(e){let{getAccessToken:t}=u(q);return Pr("accessToken",e),{getAccessToken:t}}function QC(e){let{authenticated:t,user:r}=F(),{initLoginWithOAuth:n}=D(),a=Or();return Pr("oAuthAuthorization",e),{reauthorize:e=>JC(t,r,n,a,e.provider)}}let JC=async(e,t,r,n,a)=>{if(!e)throw n("linkAccount","onError",k.MUST_BE_AUTHENTICATED,{linkMethod:a}),new _("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(a))))throw new _(`OAuth account of type ${a} not linked to the account.`);await r(a)};const eb=e=>{let{customAuthStatus:t}=D();return Pr("customAuth",e),{status:t}},tb=rb;function rb(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=F();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}const nb=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=D();return{delegateWallet:t,revokeWallets:e}};export{cs as AsExternalProvider,Js as Captcha,Ds as ConnectorManager,ms as EthereumWalletConnector,Dv as LoginModal,Xs as PrivyClient,kC as PrivyProvider,ds as PrivyProxyProvider,xe as VERSION,cr as WalletConnector,Mu as errorIndicatesMaxMfaRetries,Ou as errorIndicatesMfaTimeout,Ru as errorIndicatesMfaVerificationFailed,CC as getAccessToken,BC as useConnectCoinbaseSmartWallet,WC as useCreateWallet,GC as useCrossAppAccounts,eb as useCustomAuth,nb as useDelegatedActions,tb as useExperimentalFarcasterSigner,rb as useFarcasterSigner,VC as useGuestAccounts,NC as useImportWallet,FC as useLinkAccount,MC as useLinkWithPasskey,DC as useLinkWithSiwe,OC as useLoginWithEmail,PC as useLoginWithOAuth,RC as useLoginWithPasskey,LC as useLoginWithSms,Ut as useLogout,kg as useMfa,Sg as useMfaEnrollment,YC as useModalStatus,QC as useOAuthTokens,IC as usePrivy,ed as useRegisterMfaListener,zC as useSendSolanaTransaction,HC as useSendTransaction,jC as useSetWalletPassword,qC as useSetWalletRecovery,KC as useSignMessage,ZC as useSignTypedData,fr as useSolanaWallets,XC as useToken,UC as useUpdateAccount,st as useWallets};