@privy-io/react-auth 1.90.0 → 1.90.1-beta-20241015193827

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("@ethersproject/address"),r=require("@ethersproject/providers"),n=require("@solana/web3.js"),i=require("mipd"),a=require("react"),o=require("react-device-detect"),s=require("./privy-context.js"),l=require("jose"),d=require("./useWallets.js"),c=require("./useFundWallet.js"),u=require("uuid"),h=require("./events-context.js"),p=require("@ethersproject/bytes"),y=require("eventemitter3"),m=require("@coinbase/wallet-sdk"),f=require("./useSolanaWallets.js"),g=require("@walletconnect/ethereum-provider"),v=require("./getEmbeddedConnectedWallet.js"),w=require("ofetch"),x=require("js-cookie"),C=require("@marsidev/react-turnstile"),E=require("styled-components"),b=require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),S=require("@heroicons/react/24/outline/ArrowLeftIcon"),A=require("@heroicons/react/24/outline/ArrowRightIcon"),j=require("@heroicons/react/24/outline/XMarkIcon"),$=require("@heroicons/react/24/outline/ExclamationTriangleIcon"),T=require("@heroicons/react/24/outline/WalletIcon"),P=require("@heroicons/react/24/outline"),_=require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon"),k=require("@heroicons/react/24/solid/DocumentCheckIcon"),N=require("@heroicons/react/20/solid/CheckIcon"),I=require("@heroicons/react/24/outline/EnvelopeIcon"),M=require("@heroicons/react/24/outline/PhoneIcon"),O=require("@heroicons/react/24/solid/CheckCircleIcon"),R=require("@heroicons/react/24/solid/XCircleIcon"),F=require("fast-password-entropy"),L=require("secure-password-utilities"),U=require("secure-password-utilities/wordlists"),D=require("@heroicons/react/24/outline/ArrowPathIcon"),W=require("@heroicons/react/24/outline/EyeIcon"),B=require("@heroicons/react/24/outline/EyeSlashIcon"),H=require("@heroicons/react/24/outline/KeyIcon"),G=require("@heroicons/react/24/outline/ArrowDownTrayIcon"),q=require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),z=require("@heroicons/react/24/outline/DocumentDuplicateIcon"),V=require("@heroicons/react/24/outline/UserCircleIcon"),K=require("@heroicons/react/24/solid/LockClosedIcon"),Y=require("qrcode"),Z=require("@heroicons/react/24/outline/CheckCircleIcon"),X=require("@heroicons/react/24/outline/GlobeAltIcon"),J=require("viem"),Q=require("@headlessui/react"),ee=require("@heroicons/react/24/outline/ClockIcon"),te=require("@heroicons/react/24/outline/TrashIcon"),re=require("@heroicons/react/24/solid/CheckBadgeIcon"),ne=require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),ie=require("@heroicons/react/24/outline/PencilIcon"),ae=require("@ethersproject/units"),oe=require("@heroicons/react/24/outline/InformationCircleIcon"),se=require("@heroicons/react/24/outline/QrCodeIcon"),le=require("@heroicons/react/24/outline/LinkIcon"),de=require("@heroicons/react/24/outline/ChevronRightIcon"),ce=require("@heroicons/react/24/outline/ShieldCheckIcon"),ue=require("@heroicons/react/24/solid/IdentificationIcon"),he=require("@heroicons/react/24/outline/DevicePhoneMobileIcon"),pe=require("@heroicons/react/24/outline/FingerPrintIcon"),ye=require("@heroicons/react/24/outline/MinusCircleIcon"),me=require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon"),fe=require("@heroicons/react/24/solid/ShieldCheckIcon"),ge=require("@ethersproject/abstract-signer"),ve=require("@ethersproject/bignumber"),we=require("@ethersproject/contracts"),xe=require("@ethersproject/transactions"),Ce=require("fetch-retry"),Ee=require("@heroicons/react/24/outline/ChevronDownIcon"),be=require("@heroicons/react/24/outline/CalendarIcon"),Se=require("@heroicons/react/24/outline/LockClosedIcon"),Ae=require("@heroicons/react/24/outline/PencilSquareIcon"),je=require("@solana/wallet-adapter-base"),$e=require("@heroicons/react/24/outline/ClipboardDocumentIcon"),Te=require("@heroicons/react/24/outline/ExclamationCircleIcon"),Pe=require("@ethersproject/logger"),_e=require("@ethersproject/strings");function ke(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function Ne(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}require("tinycolor2"),require("@heroicons/react/24/outline/Square2StackIcon");var Ie=ke(a),Me=Ne(o),Oe=Ne(l),Re=ke(y),Fe=ke(x),Le=ke(b),Ue=ke(S),De=ke(A),We=ke(j),Be=ke($),He=ke(T),Ge=ke(_),qe=ke(k),ze=ke(N),Ve=ke(I),Ke=ke(M),Ye=ke(O),Ze=ke(R),Xe=ke(F),Je=Ne(L),Qe=ke(D),et=ke(W),tt=ke(B),rt=ke(H),nt=ke(G),it=ke(q),at=ke(z),ot=ke(V),st=ke(K),lt=ke(Y),dt=ke(Z),ct=ke(X),ut=ke(ee),ht=ke(te),pt=ke(re),yt=ke(ne),mt=ke(ie),ft=ke(oe),gt=ke(se),vt=ke(le),wt=ke(de),xt=ke(ce),Ct=ke(ue),Et=ke(he),bt=ke(pe),St=ke(ye),At=ke(me),jt=ke(fe),$t=ke(Ce),Tt=ke(Ee),Pt=ke(be),_t=ke(Se),kt=ke(Ae),Nt=ke($e),It=ke(Te);let Mt={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"}}},Ot={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},Rt={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},Ft={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"}}},Lt={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},Ut={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},Dt={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"}}},Wt={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},Bt={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},Ht={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"}}},Gt={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},qt={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"}}},zt={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},Vt={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},Kt=e=>[Mt.id,Ot.id,Rt.id].includes(e),Yt=e=>[56,97].includes(e),Zt="0x420000000000000000000000000000000000000F",Xt=["function getL1Fee(bytes memory _data) external view returns (uint256)"],Jt=e=>[Ft.id,Lt.id,Ut.id,Dt.id,Wt.id,Bt.id,qt.id,Vt.id,zt.id,81457,168587773].includes(e);let Qt={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},er=$t.default(fetch,{retries:3,retryDelay:500}),tr=e=>[Ht.id,Gt.id,Qt.id].includes(e),rr=e=>({maxPriorityFee:ae.parseUnits(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:ae.parseUnits(e.maxFee.toFixed(9),"gwei").toHexString()}),nr=async e=>{let t="";switch(e){case Ht.id:t="https://gasstation.polygon.technology/v2";break;case Gt.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Qt.id:t="https://gasstation.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}let r=await er(t),n=await r.json();if(r.status>399)throw n;return{safeLow:rr(n.safeLow),standard:rr(n.standard),fast:rr(n.fast)}};async function ir(e,t){if(!e.gasLimit)throw new f.l("gasLimit was not successfully set for transaction.");let r=c.i(e.gasLimit),n=ve.BigNumber.from(0);if(2==e.type){if(!e.maxFeePerGas)throw new f.l("maxFeePerGas was not successfully set for transaction of type 2.");n=c.i(e.maxFeePerGas)}else{if(!e.gasPrice)throw new f.l("gasPrice was not successfully set for transaction of type 0 or 1.");n=c.i(e.gasPrice)}let i=r.mul(n),a=ve.BigNumber.from(0);if(e.chainId&&Jt(e.chainId))try{a=await async function(e,t){if(!e.chainId||e.chainId&&!Jt(e.chainId))return ve.BigNumber.from(0);let r=ve.BigNumber.from(0);try{let n=new we.Contract(Zt,Xt,t),i=c.r(e),a=xe.serialize(i);r=await n.getL1Fee(a)}catch(e){}return r}(e,t),i=i.add(a)}catch(e){}return{totalGasEstimate:i,l1ExecutionFeeEstimate:a}}function ar(e){return/^-?0x[a-f0-9]+$/i.test(e)}async function or(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&&ar(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 ge.VoidSigner(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&&ar(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),0===(t=tr(t.chainId)?await async function(e){if(!tr(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 nr(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):Kt(t.chainId)?await(async(e,t)=>{if(!Kt(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(ve.BigNumber.from(120)).div(ve.BigNumber.from(100));e.maxFeePerGas=c.t(t),e.maxPriorityFeePerGas=c.t(ve.BigNumber.from(0))}}catch(e){throw Error(`Failed to set gas price for Arbitrum transaction: ${e}.`)}return e})(t,r):Jt(t.chainId)?await(async(e,t)=>{if(!Jt(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=ve.BigNumber.from(r).mul(ve.BigNumber.from(126)).div(ve.BigNumber.from(100)).add(ve.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=c.t(n)}}catch(e){throw Error(`Failed to set gas price for OP stack transaction: ${e}.`)}return e})(t,r):Yt(t.chainId)?await(async(e,t)=>{if(!Yt(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 sr={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"},lr={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 dr(e,t){var r=Array.prototype.slice.call(t);return r.push(lr),e.apply(this,r)}function cr(e){return(cr="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 ur(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hr(e){var t="function"==typeof Map?new Map:void 0;return(hr=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 pr(e,arguments,fr(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),mr(r,e)})(e)}function pr(e,t,r){return(pr=yr()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&mr(i,r.prototype),i}).apply(null,arguments)}function yr(){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 mr(e,t){return(mr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function fr(e){return(fr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var gr=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&&mr(e,t)}(n,hr(Error));var t,r=(t=yr(),function(){var e=fr(n);return function(e,t){if(t&&("object"===cr(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return ur(e)}(this,t?Reflect.construct(e,arguments,fr(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(ur(t=r.call(this,e)),n.prototype),t.name=t.constructor.name,t}return Object.defineProperty(n,"prototype",{writable:!1}),n}(),vr="0-90-9٠-٩۰-۹",wr="".concat("-‐-―−ー-").concat("//").concat("..").concat("  ­​⁠ ").concat("()()[]\\[\\]").concat("~⁓∼~");function xr(e,t){e=e.split("-"),t=t.split("-");for(var r=e[0].split("."),n=t[0].split("."),i=0;i<3;i++){var a=Number(r[i]),o=Number(n[i]);if(a>o)return 1;if(o>a)return-1;if(!isNaN(a)&&isNaN(o))return 1;if(isNaN(a)&&!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 Cr(e){return(Cr="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 Er(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function br(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 Sr=" ext. ",Ar=/^\d+$/,jr=function(){function e(t){Er(this,e),function(e){if(!e)throw Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Nr(e)||!Nr(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(Nr(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Ir(e)+": "+e,"."))}(t),this.metadata=t,Or.call(this,t)}return br(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&&Ar.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw Error("Unknown country: ".concat(e));this.numberingPlan=new $r(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw Error("Unknown calling code: ".concat(t));this.numberingPlan=new $r(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}(),$r=function(){function e(t,r){Er(this,e),this.globalMetadataObject=r,this.metadata=t,Or.call(this,r.metadata)}return br(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 Tr(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()&&kr(this.types(),e))return new _r(kr(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?Sr:this.metadata[13]||Sr}}]),e}(),Tr=function(){function e(t,r){Er(this,e),this._format=t,this.metadata=r}return br(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()||Pr.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Pr=/^\(?\$1\)?$/,_r=function(){function e(t,r){Er(this,e),this.type=t,this.metadata=r}return br(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 kr(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 Nr=function(e){return"object"===Cr(e)},Ir=function(e){return Cr(e)};function Mr(e,t){if((t=new jr(t)).hasCountry(e))return t.country(e).countryCallingCode();throw Error("Unknown country: ".concat(e))}function Or(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===xr(t,"1.2.0")?this.v2=!0:-1===xr(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Rr=function(e){return"([".concat(vr,"]{1,").concat(e,"})")};function Fr(e){var t="[  \\t,]*",r="[:\\..]?[  \\t,-]*",n="[  \\t]*";return";ext="+Rr("20")+"|"+t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+r+Rr("20")+"#?|"+t+"(?:[xx##~~]|int|int)"+r+Rr("9")+"#?|[- ]+"+Rr("6")+"#|"+n+"(?:,{2}|;)"+r+Rr("15")+"#?|"+n+"(?:,)+"+r+Rr("9")+"#?"}var Lr=RegExp("^[++]{0,1}(?:["+wr+"]*["+vr+"]){1,2}$","i"),Ur="[++]{0,1}(?:["+wr+"]*["+vr+"]){3,}["+wr+vr+"]*(?:"+Fr()+")?",Dr=RegExp("^["+vr+"]{2}$|^"+Ur+"$","i"),Wr=RegExp("(?:"+Fr()+")$","i");function Br(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 Hr={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 Gr(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 Br(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 Br(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 i=Hr[t.value];i&&(r+=i)}return r}function qr(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 zr(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 qr(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 qr(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 Hr[e]}(t.value,r)||"";return r}function Vr(e,t){return function(e,t,r){var n=r.type(t),i=n&&n.possibleLengths()||r.possibleLengths();if(!i)return"IS_POSSIBLE";var a=e.length,o=i[0];return o===a?"IS_POSSIBLE":o>a?"TOO_SHORT":i[i.length-1]<a?"TOO_LONG":i.indexOf(a,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function Kr(e,t){return"IS_POSSIBLE"===Vr(e,t)}function Yr(e,t){return e=e||"",RegExp("^(?:"+t+")$").test(e)}function Zr(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 Xr=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Jr(e,t,r){if(t=t||{},e.country){(r=new jr(r)).selectNumberingPlan(e.country,e.countryCallingCode);var n=t.v2?e.nationalNumber:e.phone;if(Yr(n,r.nationalNumberPattern())){if(Qr(n,"FIXED_LINE",r))return r.type("MOBILE")&&""===r.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":r.type("MOBILE")?Qr(n,"MOBILE",r)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var i,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 Zr(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 Zr(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.")}(Xr);!(i=a()).done;){var o=i.value;if(Qr(n,o,r))return o}}}}function Qr(e,t,r){return!(!(t=r.type(t))||!t.pattern())&&!(t.possibleLengths()&&0>t.possibleLengths().indexOf(e.length))&&Yr(e,t.pattern())}function en(e){return e.replace(RegExp("[".concat(wr,"]+"),"g")," ").trim()}var tn=/(\$\d)/;function rn(e,t,r){var n=r.useInternationalFormat,i=r.withNationalPrefix;r.carrierCode,r.metadata;var a=e.replace(new RegExp(t.pattern()),n?t.internationalFormat():i&&t.nationalPrefixFormattingRule()?t.format().replace(tn,t.nationalPrefixFormattingRule()):t.format());return n?en(a):a}var nn=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function an(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 on(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 sn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?on(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)):on(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ln={formatExtension:function(e,t,r){return"".concat(e).concat(r.ext()).concat(t)}};function dn(e,t,r,n,i){var a=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 an(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 an(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 i=r.value;if(i.leadingDigitsPatterns().length>0){var a=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(0!==t.search(a))continue}if(Yr(t,i.pattern()))return i}}(n.formats(),e);return a?rn(e,a,{useInternationalFormat:"INTERNATIONAL"===r,withNationalPrefix:!a.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!i||!1!==i.nationalPrefix,carrierCode:t,metadata:n}):e}function cn(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 un(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cn(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)):cn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var hn=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 i,a,o,s=(o=new jr(n),pn(e)?(i=e,o.selectNumberingPlan(i),a=o.countryCallingCode()):a=e,{country:i,countryCallingCode:a}),l=s.country,d=s.countryCallingCode;this.country=l,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 jr(r=this.getMetadata()).getCountryCodesForCallingCode(e))?n.filter((function(e){var n;return(n=new jr(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 jr(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 Kr(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 jr(t)).selectNumberingPlan(this.country,this.countryCallingCode),t.hasTypes()?void 0!==Jr(this,e,t.metadata):Yr(e.v2?this.nationalNumber:this.phone,t.nationalNumberPattern())}},{key:"isNonGeographic",value:function(){return new jr(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Jr(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return function(e,t,r,n){if(r=r?sn(sn({},ln),r):ln,n=new jr(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 i,a,o,s,l,d,c,u,h,p,y,m,f,g=n.countryCallingCode(),v=r.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return v?(i=f=dn(v,e.carrierCode,"NATIONAL",n,r),a=e.ext,o=n,s=r.formatExtension,a?s(i,a,o):i):"";case"INTERNATIONAL":return v?(f=dn(v,null,"INTERNATIONAL",n,r),l=f="+".concat(g," ").concat(f),d=e.ext,c=n,u=r.formatExtension,d?u(l,d,c):l):"+".concat(g);case"E.164":return"+".concat(g).concat(v);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(g).concat(v),ext:e.ext});case"IDD":if(!r.fromCountry)return;return h=function(e,t,r,n,i){if(Mr(n,i.metadata)===r){var a,o=dn(e,t,"NATIONAL",i);return"1"===r?r+" "+o:o}var s=(void 0,(a=new jr(i.metadata)).selectNumberingPlan(n,undefined),a.defaultIDDPrefix()?a.defaultIDDPrefix():nn.test(a.IDDPrefix())?a.IDDPrefix():void 0);if(s)return"".concat(s," ").concat(r," ").concat(dn(e,null,"INTERNATIONAL",i))}(v,e.carrierCode,g,r.fromCountry,n),p=e.ext,y=n,m=r.formatExtension,p?m(h,p,y):h;default:throw Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}(this,e,t?un(un({},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}(),pn=function(e){return/^[A-Z]{2}$/.test(e)},yn=RegExp("(["+vr+"])");function mn(e,t,r,n){if(t){var i=new jr(n);i.selectNumberingPlan(t,r);var a=new RegExp(i.IDDPrefix());if(0===e.search(a)){var o=(e=e.slice(e.match(a)[0].length)).match(yn);if(!(o&&null!=o[1]&&o[1].length>0&&"0"===o[1]))return e}}}function fn(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var r=RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),n=r.exec(e);if(n){var i,a,o,s=n.length-1,l=s>0&&n[s];if(t.nationalPrefixTransformRule()&&l)i=e.replace(r,t.nationalPrefixTransformRule()),s>1&&(a=n[1]);else{var d=n[0];i=e.slice(d.length),l&&(a=n[1])}if(l){var c=e.indexOf(n[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(o=t.numberingPlan.nationalPrefix())}else o=n[0];return{nationalNumber:i,nationalPrefix:o,carrierCode:a}}}return{nationalNumber:e}}function gn(e,t){var r=fn(e,t),n=r.carrierCode,i=r.nationalNumber;return i!==e&&(Yr(e,t.nationalNumberPattern())&&!Yr(i,t.nationalNumberPattern())||t.possibleLengths()&&!function(e,t){switch(Vr(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(i,t))?{nationalNumber:e}:{nationalNumber:i,carrierCode:n}}function vn(e,t,r,n){var i=t?Mr(t,n):r;if(0===e.indexOf(i)){(n=new jr(n)).selectNumberingPlan(t,r);var a=e.slice(i.length),o=gn(a,n).nationalNumber,s=gn(e,n).nationalNumber;if(!Yr(s,n.nationalNumberPattern())&&Yr(o,n.nationalNumberPattern())||"TOO_LONG"===Vr(s,n))return{countryCallingCode:i,number:a}}return{number:e}}function wn(e,t,r,n){if(!e)return{};if("+"!==e[0]){var i,a=mn(e,t,r,n);if(!a||a===e){if(t||r){var o=vn(e,t,r,n),s=o.countryCallingCode,l=o.number;if(s)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:s,number:l}}return{number:e}}i=!0,e="+"+a}if("0"===e[1])return{};n=new jr(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:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(d)};d++}return{}}function xn(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 Cn(e,t){var r=t.countries,n=t.defaultCountry,i=t.metadata;i=new jr(i);for(var a,o=[],s=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 xn(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 xn(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);!(a=s()).done;){var l=a.value;if(i.country(l),i.leadingDigits()){if(e&&0===e.search(i.leadingDigits()))return l}else if(Jr({phone:e,country:l},void 0,i.metadata)){if(!n||l===n)return l;o.push(l)}}if(o.length>0)return o[0]}function En(e,t){var r=t.nationalNumber,n=t.defaultCountry,i=t.metadata,a=i.getCountryCodesForCallingCode(e);return a?1===a.length?a[0]:Cn(r,{countries:a,defaultCountry:n,metadata:i.metadata}):void 0}var bn="(["+vr+"]|[\\-\\.\\(\\)]?)",Sn=RegExp("^\\+"+bn+"*["+vr+"]"+bn+"*$","g"),An=RegExp("^(["+vr+"]+((\\-)*["+vr+"])*\\.)*[a-zA-Z]+((\\-)*["+vr+"])*\\.?$","g"),jn="tel:",$n=";phone-context=",Tn=RegExp("[++"+vr+"]"),Pn=RegExp("[^"+vr+"#]+$");function _n(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 kn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_n(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)):_n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Nn(e){return(Nn="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 In(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 Mn(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 On(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 Rn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?On(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)):On(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Fn(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 Ln(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fn(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)):Fn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Un(){var e=function(e){var t,r,n,i=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,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),4!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(t)||function(e,t){if(e){if("string"==typeof e)return Mn(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 Mn(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.")}(),a=i[0],o=i[1],s=i[2],l=i[3];if("string"!=typeof a)throw TypeError("A text for parsing must be a string.");if(o&&"string"!=typeof o){if("object"!==Nn(o))throw Error("Invalid second argument: ".concat(o));s?(r=o,n=s):n=o}else l?(r=s,n=l):(r=void 0,n=s),o&&(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?In(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)):In(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({defaultCountry:o},r));return{text:a,options:r,metadata:n}}(arguments),t=e.text,r=e.options,n=e.metadata,i=function(e,t,r){var n;t&&t.defaultCountry&&(n=t.defaultCountry,!r.countries.hasOwnProperty(n))&&(t=Rn(Rn({},t),{},{defaultCountry:void 0}));try{return function(e,t,r){if(t=t||{},r=new jr(r),t.defaultCountry&&!r.hasCountry(t.defaultCountry)){if(t.v2)throw new gr("INVALID_COUNTRY");throw Error("Unknown country: ".concat(t.defaultCountry))}var n,i=function(e,t,r){var n=function(e,t){var r,n=t.extractFormattedPhoneNumber,i=function(e){var t=e.indexOf($n);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!==i&&(0===i.length||!Sn.test(i)&&!An.test(i)))throw new gr("NOT_A_NUMBER");if(null===i)r=n(e)||"";else{r="","+"===i.charAt(0)&&(r+=i);var a,o=e.indexOf(jn);a=o>=0?o+4:0;var s=e.indexOf($n);r+=e.substring(a,s)}var l=r.indexOf(";isub=");if(l>0&&(r=r.substring(0,l)),""!==r)return r}(e,{extractFormattedPhoneNumber:function(e){return function(e,t,r){if(e){if(e.length>250){if(r)throw new gr("TOO_LONG");return}if(!1===t)return e;var n=e.search(Tn);if(!(n<0))return e.slice(n).replace(Pn,"")}}(e,r,t)}});if(!n)return{};if(!(n.length>=2&&Dr.test(n)))return Lr.test(n)?{error:"TOO_SHORT"}:{};var i=function(e){var t=e.search(Wr);if(t<0)return{};for(var r=e.slice(0,t),n=e.match(Wr),i=1;i<n.length;){if(n[i])return{number:r,ext:n[i]};i++}}(n);return i.ext?i:{number:n}}(e,t.v2,t.extract),a=i.number,o=i.ext,s=i.error;if(!a){if(t.v2){if("TOO_SHORT"===s)throw new gr("TOO_SHORT");throw new gr("NOT_A_NUMBER")}return{}}var l=function(e,t,r,n){var i,a=wn(zr(e),t,r,n.metadata),o=a.countryCallingCodeSource,s=a.countryCallingCode,l=a.number;if(s)n.selectNumberingPlan(s);else{if(!l||!t&&!r)return{};n.selectNumberingPlan(t,r),t&&(i=t),s=r||Mr(t,n.metadata)}if(!l)return{countryCallingCodeSource:o,countryCallingCode:s};var d=gn(zr(l),n),c=d.nationalNumber,u=d.carrierCode,h=En(s,{nationalNumber:c,defaultCountry:t,metadata:n});return h&&(i=h,"001"===h||n.country(i)),{country:i,countryCallingCode:s,countryCallingCodeSource:o,nationalNumber:c,carrierCode:u}}(a,t.defaultCountry,t.defaultCallingCode,r),d=l.country,c=l.nationalNumber,u=l.countryCallingCode,h=l.countryCallingCodeSource,p=l.carrierCode;if(!r.hasSelectedNumberingPlan()){if(t.v2)throw new gr("INVALID_COUNTRY");return{}}if(!c||c.length<2){if(t.v2)throw new gr("TOO_SHORT");return{}}if(c.length>17){if(t.v2)throw new gr("TOO_LONG");return{}}if(t.v2){var y=new hn(u,c,r.metadata);return d&&(y.country=d),p&&(y.carrierCode=p),o&&(y.ext=o),y.__countryCallingCodeSource=h,y}var m=!!(t.extended?r.hasSelectedNumberingPlan():d)&&Yr(c,r.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:u,carrierCode:p,valid:m,possible:!!m||!(!0!==t.extended||!r.possibleLengths()||!Kr(c,r)),phone:c,ext:o}:m?(n={country:d,phone:c},o&&(n.ext=o),n):{}}(e,kn(kn({},t),{},{v2:!0}),r)}catch(e){if(!(e instanceof gr))throw e}}(t,r=Ln(Ln({},r),{},{extract:!1}),n);return i&&i.isPossible()||!1}var Dn=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 Wn(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 Bn=/x/;function Hn(e,t){if(t<1)return"";for(var r="";t>1;)1&t&&(r+=e),t>>=1,e+=e;return r+e}function Gn(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,i="";t.push(e.length);for(var a=0;a<t.length;a++){var o=t[a];i+=e.slice(n,o),n=o+1}return i}(e.slice(0,t))}function qn(e,t,r){var n=r.metadata,i=r.useNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix,o=rn(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:i,metadata:n});if(i||(e.nationalPrefix?o=e.nationalPrefix+a(t)+o:e.complexPrefixBeforeNationalSignificantNumber&&(o=e.complexPrefixBeforeNationalSignificantNumber+" "+o)),Gr(o)===e.getNationalDigits())return o}var zn=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([Yn(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(Kn);if(t){var r=t[1],n=e.slice(0,t.index),i=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 a=this.getContext().branches;a.push(Yn(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:a});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(Yn(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,i=e[r+1].charCodeAt(0)-1,a=n;a<=i;)t.push(String.fromCharCode(a)),a++}else t.push(e[r]);r++}return t}(n)});break;default:throw Error("Unknown operator: ".concat(r))}i&&this.parsePattern(i)}else{if(Vn.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}(),Vn=/[\(\)\[\]\?\:\|]/,Kn=RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Yn(e){return 1===e.length?e[0]:e}function Zn(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 Xn(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 Xn(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 Xn(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 Jn=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 zn).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 i=t.join("");return 0===r.indexOf(i)?t.length===r.length?{match:!0,matchedChars:t}:{partialMatch:!0}:0===i.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 a=t.slice(),o=0;o<r.length;){var s=e(a,r[o],n&&o===r.length-1);if(!s)return;if(s.overflow)return s;if(!s.match){if(s.partialMatch)return{partialMatch:!0};throw Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}if(0===(a=a.slice(s.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-a.length)}}switch(r.op){case"|":for(var l,d,c=Zn(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)));l=!0}}return l?{partialMatch:!0}:void 0;case"[]":for(var h,p=Zn(r.args);!(h=p()).done;){var y=h.value;if(t[0]===y)return 1===t.length?{match:!0,matchedChars:t}:n?{overflow:!0}:{match:!0,matchedChars:[y]}}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 Qn(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 ei(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 ei(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 ei(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 ti=Hn("9",15),ri=/[- ]/,ni=RegExp("["+wr+"]*\\$1["+wr+"]*(\\$\\d["+wr+"]*)*$"),ii=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"===Vr(t.nationalSignificantNumber,this.metadata))for(var n,i=Qn(this.matchingFormats);!(n=i()).done;){var a=n.value,o=function(e,t,r){var n=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,r){var n=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,i(t)){var o=qn(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:a,metadata:n});if(o)return o}return qn(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:a,metadata:n})}(e,t,{metadata:n,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:a})}(t,a,{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=a,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,i=e.international,a=r.length-3;a<0&&(a=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,i,n)&&t.formatMatches(e,r,a)})),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 i=e.leadingDigitsPatterns()[r];if(t.length<3)try{return void 0!==new Jn(i).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(i,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,r,n=Qn(this.matchingFormats.slice());!(r=n()).done&&"break"!=(t=r.value,this.chosenFormat===t?"break":ni.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()&&ri.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 Gn(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")+Hn("x",t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var r=t.nationalSignificantNumber,n=t.international,i=t.nationalPrefix,a=t.complexPrefixBeforeNationalSignificantNumber,o=e.pattern();o=o.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var s=ti.match(o)[0];if(!(r.length>s.length)){var l=RegExp("^"+o+"$"),d=r.replace(/\d/g,"9");l.test(d)&&(s=d);var c,u=this.getFormatFormat(e,n);if(this.shouldTryNationalPrefixFormattingRule(e,{international:n,nationalPrefix:i})){var h=u.replace(tn,e.nationalPrefixFormattingRule());if(Gr(e.nationalPrefixFormattingRule())===(i||"")+Gr("$1")&&(u=h,c=!0,i))for(var p=i.length;p>0;)u=u.replace(/\d/,"x"),p--}var y=s.replace(new RegExp(o),u).replace(/9/g,"x");return c||(a?y=Hn("x",a.length)+" "+y:i&&(y=Hn("x",i.length)+this.getSeparatorAfterNationalPrefix(e)+y)),n&&(y=en(y)),y}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,r){for(var n,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 Wn(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 Wn(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=i()).done;){var a=n.value;if(0>e.slice(t+1).search(Bn))return;t=e.search(Bn),e=e.replace(Bn,a)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Gn(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var r=t.international,n=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var i=e.usesNationalPrefix();if(i&&n||!i&&!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 ai(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,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return oi(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 oi(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 oi(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 si=RegExp("^["+wr+vr+"]+$","i"),li="(?:[++]["+wr+vr+"]*|["+wr+vr+"]+)",di=RegExp("[^"+wr+vr+"]+.*$"),ci=/[^\d\[\]]/,ui=function(){var e;function t(e){var r=e.defaultCountry,n=e.defaultCallingCode,i=e.metadata,a=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=i,this.onNationalSignificantNumberChange=a}return e=[{key:"input",value:function(e,t){var r,n,i,a,o,s=(i=(n=ai("+"===(r=function(e){var t,r=e.search(li);if(!(r<0))return"+"===(e=e.slice(r))[0]&&(t=!0,e=e.slice(1)),e=e.replace(di,""),t&&(e="+"+e),e}(e)||"")[0]?[r.slice(1),!0]:[r],2))[0],a=n[1],si.test(i)||(i=""),[i,a]),l=ai(s,2),d=l[0],c=l[1],u=Gr(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=wn("+"+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&&ci.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var r=fn(e,this.metadata),n=r.nationalPrefix,i=r.nationalNumber,a=r.carrierCode;if(i!==e)return this.onExtractedNationalNumber(n,a,i,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,r){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,r);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var n=fn(e,this.metadata),i=n.nationalPrefix,a=n.nationalNumber,o=n.carrierCode;if(a!==t)return this.onExtractedNationalNumber(i,o,a,e,r),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,r,n,i){var a,o,s=n.lastIndexOf(r);if(s>=0&&s===n.length-r.length){o=!0;var l=n.slice(0,s);l!==e&&(a=l)}i({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:r,nationalSignificantNumberMatchesInput:o,complexPrefixBeforeNationalSignificantNumber:a}),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 i=mn(n,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==i&&i!==n?(e.update({IDDPrefix:n.slice(0,n.length-i.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=vn(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 hi(e){return(hi="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 pi(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 yi=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 jr(r);var n,i=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,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),2!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(n)||function(e,t){if(e){if("string"==typeof e)return pi(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 pi(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.")}(),a=i[0],o=i[1];this.defaultCountry=a,this.defaultCallingCode=o,this.reset()}return e=[{key:"getCountryAndCallingCode",value:function(e){var t,r;return e&&("object"===hi(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 i=this.state.getNationalDigits();i&&(t=this.formatter.format(i,this.state))}this.formattedOutput=t?this.getFullNumber(t):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new Dn({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 ii({state:this.state,metadata:this.metadata}),this.parser=new ui({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,i=t,a=r||n;return a&&(i=a+i),i}},{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(En(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,i=e.nationalSignificantNumber;if(t)return this.isInternational()?r?"+"+r+i:"+"+t:n||r?"+"+(n?this.metadata.countryCallingCode():r)+i:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.carrierCode,n=e.callingCode,i=this._getCountry();if(t&&(i||n)){if(i&&i===this.defaultCountry){var a=new jr(this.metadata.metadata);a.selectNumberingPlan(i);var o=a.numberingPlan.callingCode(),s=this.metadata.getCountryCodesForCallingCode(o);if(s.length>1){var l=Cn(t,{countries:s,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});l&&(i=l)}}var d=new hn(i||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 mi(e){return new jr(e).getCountries()}function fi(e,t,r){if(t[e])return new hn(e,t[e],r)}function gi(e){return yi.call(this,e,lr)}function vi(){return dr(Mr,arguments)}gi.prototype=Object.create(yi.prototype,{}),gi.prototype.constructor=gi;let wi=(e,t)=>function(){return dr(Un,arguments)}(String(e),t),xi=(e,t)=>`+${vi(t)} ${e}`,Ci=e=>`*${e.replaceAll("-","").slice(-4)}`,Ei=function(){return dr(mi,arguments)}().map((e=>({code:e,callCode:vi(e)})));const bi="/api/v1/sessions",Si="/api/v1/sessions/logout",Ai="/api/v1/sessions/fork/recover",ji="/api/v1/oauth/init",$i="/api/v1/oauth/authenticate",Ti="/api/v1/oauth/link",Pi="/api/v1/analytics_events";class _i{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/custom_jwt_account/authenticate",{token:this.meta.token});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){throw Error("Unimplemented")}constructor(e){this.meta={token:e}}}class ki{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new s.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{let e=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"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new s.PrivyClientError("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 s.formatApiError(e)}}async sendCodeEmail(e,t){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new s.PrivyClientError("Email must be set when initialzing authentication.");try{return await this.api.post("/api/v1/passwordless/init",{email:this.meta.email,token:this.meta.captchaToken})}catch(e){throw s.formatApiError(e)}}constructor(e,t,r=!1){this.meta={email:e,captchaToken:t,disableSignup:r}}}class Ni extends ki{async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new s.PrivyClientError("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 s.formatApiError(e)}}constructor(e,t,r){super(t,r),this.meta={email:t,captchaToken:r,oldAddress:e,disableSignup:!1}}}const Ii=e=>{let t;try{t=new URL(e).hostname}catch(e){return}for(let[e,r]of Object.entries(Mi))if(t.includes(r.hostname))return{walletClientType:e,entry:r}},Mi={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 Oi(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let Ri="WALLETCONNECT_DEEPLINK_CHOICE";function Fi(e){return e.startsWith("http://")||e.startsWith("https://")}function Li(e,t){if(Fi(e))return Ui(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 Ui(e,t){if(!Fi(e))return Li(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function Di(e,t){window.open(e,t,"noreferrer noopener")}class Wi{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}class Bi{get meta(){return this._meta}async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new s.PrivyClientError("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 s.PrivyClientError("No response from authentication");return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("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 s.formatApiError(e)}}async _startChannelOnce(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");let e=await this.api.post("/api/v1/farcaster/init",{token:this.captchaToken});o.isMobile&&!o.isIOS&&e.connect_uri&&Di(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new s.PrivyClientError("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 Wi(this._startChannelOnce.bind(this)),this.pollForReady=new Wi(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function Hi(e){return crypto.getRandomValues(new Uint8Array(e))}class Gi{getOrCreateGuestCredential(e){let t=d.getGuestCredentialStorageKey(e);if(c.e()){if(c.e6.get(t))return c.e6.get(t);{let e=l.base64url.encode(Hi(32));return c.e6.put(t,e),e}}return l.base64url.encode(Hi(32))}async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/guest/authenticate",{guest_credential:this.meta.guestCredential});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function qi(){return l.base64url.encode(Hi(36))}function zi(){return qi()}async function Vi(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 l.base64url.encode(t)}}function Ki(){return!!c.e6.get(d.HEADLESS_OAUTH_KEY)}class Yi{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new s.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new s.PrivyClientError("User denied confirmation during OAuth flow");let e=function(){let e=c.e6.get(d.CODE_VERIFIER_KEY);if(!e)throw new s.PrivyClientError("Authentication error.");return e}();try{let t=await this.api.post($i,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return c.e6.del(d.CODE_VERIFIER_KEY),c.e6.del(d.HEADLESS_OAUTH_KEY),c.e6.del(d.OAUTH_DISABLE_SIGNUP_KEY),{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user,oauth_tokens:t.oauth_tokens}}catch(e){let t=s.formatApiError(e);if(t.privyErrorCode)throw new s.PrivyClientError(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new s.PrivyClientError("Invalid code during oauth flow.",void 0,s.PrivyErrorCode.OAUTH_USER_DENIED);throw new s.PrivyClientError("Invalid code during OAuth flow.",void 0,s.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new s.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new s.PrivyClientError("User denied confirmation during OAuth flow");let e=c.e6.get(d.CODE_VERIFIER_KEY);if(!e)throw new s.PrivyClientError("Authentication error.");try{let t=await this.api.post(Ti,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return c.e6.del(d.CODE_VERIFIER_KEY),t}catch(e){throw s.formatApiError(e)}}async getAuthorizationUrl(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.provider)throw new s.PrivyClientError("Provider must be set when initializing OAuth authentication.");let e=qi();c.e6.put(d.CODE_VERIFIER_KEY,e);let t=zi();c.e6.put(d.STATE_CODE_KEY,t);let r=await Vi(e);this.meta.headless&&c.e6.put(d.HEADLESS_OAUTH_KEY,!0),this.meta.disableSignup&&c.e6.put(d.OAUTH_DISABLE_SIGNUP_KEY,!0);try{return await this.api.post(ji,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:r,state_code:t})}catch(e){throw s.formatApiError(e)}}constructor(e){let t="boolean"==typeof e.headless?e.headless:Ki();this.meta={...e,headless:t}}}function Zi(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Xi=({style:t,...r})=>e.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...t},...r,children:[e.jsx("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"}),e.jsx("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"})]}),Ji=({style:t,...r})=>e.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...t},...r,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("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"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"71",height:"55",fill:"white"})})})]}),Qi=({style:t,...r})=>e.jsx("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...t},...r,children:e.jsx("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"})}),ea=({style:t})=>e.jsx(ct.default,{style:{color:"var(--privy-color-error)",...t}}),ta=({style:t,...r})=>e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...r,children:[e.jsx("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"}),e.jsx("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"}),e.jsx("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"}),e.jsx("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 ra(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...t,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"b",children:[e.jsx("stop",{offset:"0",stopColor:"#3771c8"}),e.jsx("stop",{stopColor:"#3771c8",offset:".128"}),e.jsx("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"a",children:[e.jsx("stop",{offset:"0",stopColor:"#fd5"}),e.jsx("stop",{offset:".1",stopColor:"#fd5"}),e.jsx("stop",{offset:".5",stopColor:"#ff543e"}),e.jsx("stop",{offset:"1",stopColor:"#c837ab"})]}),e.jsx("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),e.jsx("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),e.jsx("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),e.jsx("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),e.jsx("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}function na({style:t,...r}){return e.jsx("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",...t},...r,children:e.jsx("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:e.jsx("g",{transform:"scale(5.12,5.12)",children:e.jsx("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 ia(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...t,children:[e.jsx("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),e.jsx("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}function aa(t){return e.jsxs("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,...t,children:[e.jsx("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"}),e.jsx("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"}),e.jsx("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 oa=({style:t,...r})=>e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...t},...r,children:e.jsx("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 sa={google:{name:"Google",component:ta},discord:{name:"Discord",component:Ji},github:{name:"Github",component:Qi},linkedin:{name:"LinkedIn",component:na},twitter:{name:"Twitter",component:oa},spotify:{name:"Spotify",component:ia},instagram:{name:"Instagram",component:ra},tiktok:{name:"Tiktok",component:aa},apple:{name:"Apple",component:Xi}};const la=e=>e in sa?sa[e]:{name:"Unknown",component:ea};function da(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),n=e.get("privy_oauth_provider");if(!t||!r||!n)return{inProgress:!1};let i=!1;try{i=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:n,headless:Ki(),popupFlow:null!==window.opener&&i,disableSignup:!!c.e6.get(d.OAUTH_DISABLE_SIGNUP_KEY)}}function ca(){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"),c.e6.del(d.STATE_CODE_KEY),window.history.replaceState({},"",e)}class ua{async initAuthenticationFlow(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new s.PrivyClientError("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 s.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new s.PrivyClientError("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));this.meta.setPasskeyAuthState?.({status:"submitting-response"});let r=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)});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(e){if("NotAllowedError"===e.name)throw new s.PrivyClientError("Passkey request timed out or rejected by user.",void 0,s.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw s.formatApiError(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new s.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,r=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return 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 s.PrivyClientError("Passkey request timed out or rejected by user.",void 0,s.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw s.formatApiError(e)}}async _initAuthenticateOnce(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");return await this.api.post("/api/v1/passkeys/authenticate/init",{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new s.PrivyClientError("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(e,t){this.initAuthenticateOnce=new Wi(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Wi(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}const ha=({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 pa{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 s.PrivyClientError("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign(),r=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"});return{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.client)throw new s.PrivyClientError("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 s.formatApiError(e)}}async sign(){if(!this.client)throw new s.PrivyClientError("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new s.PrivyClientError("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 s.PrivyClientError("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new s.PrivyClientError("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=ha({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Wi(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class ya{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new s.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign(),r=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"});return{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.client)throw new s.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw s.formatApiError(e)}}async sign(){if(!this.client)throw new s.PrivyClientError("SiwsFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new s.PrivyClientError("Could not prepare SIWS message");if(!this.wallet.signMessage)throw new s.PrivyClientError("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 s.PrivyClientError("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new s.PrivyClientError("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 Wi(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class ma{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new s.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{let e=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"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new s.PrivyClientError("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 s.formatApiError(e)}}async sendSmsCode(e,t){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new s.PrivyClientError("phone nNumber must be set when initialzing authentication.");try{return await this.api.post("/api/v1/passwordless_sms/init",{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(e){throw s.formatApiError(e)}}constructor(e,t,r=!1){this.meta={phoneNumber:e,captchaToken:t,disableSignup:r}}}class fa extends ma{async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new s.PrivyClientError("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 s.formatApiError(e)}}constructor(e,t,r){super(t,r),this.meta={phoneNumber:t,captchaToken:r,oldPhoneNumber:e,disableSignup:!1}}}const ga=a.createContext({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:s.notImplemented,setError:s.notImplemented,setExecuting:s.notImplemented,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:s.notImplemented,reset:s.notImplemented,execute:s.notImplemented});class va extends s.PrivyError{constructor(e,t,r){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}const wa=({children:t,id:r,captchaSiteKey:n,captchaEnabled:i})=>{let o=a.useRef(null),[l,d]=a.useState(),[u,h]=a.useState(),[p,y]=a.useState(!1),m=a.useMemo((()=>i?p||l||u?!p||l||u?l&&!u?{status:"success",token:l}:u?{status:"error",error:u}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[i,l,u,p]);return e.jsx(ga.Provider,{value:{...m,ref:o,enabled:i,siteKey:n,appId:r,setToken:d,setError:h,setExecuting:y,remove(){i&&(o.current?.remove(),y(!1),h(void 0),d(void 0))},reset(){i&&(o.current?.reset(),y(!1),h(void 0),d(void 0))},execute(){i&&(y(!0),o.current?.execute())},async waitForResult(){if(!i)return"";try{return await c.pollForResult((()=>o.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new va("Captcha failed",null,s.PrivyErrorCode.CAPTCHA_TIMEOUT)}}},children:t})},xa=()=>a.useContext(ga);class Ca{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{let e=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"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("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 s.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Ea(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===s.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===s.PrivyErrorCode.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===s.PrivyErrorCode.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===s.PrivyErrorCode.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof va&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function ba(){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)}const Sa=({style:t,...r})=>e.jsxs("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]}),Aa=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation"];class ja{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 s.PrivyConnectorError(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw f.formatConnectorError(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 f.WalletTimeoutError,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||d.DEFAULT_RPC_TIMEOUT,this._subscriptions=[]}}let $a=class extends Error{constructor(e,t,r){super(e),this.code=t,this.data=r}};class Ta extends Re.default{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new $a(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await Ag()||!this.address)throw new $a("Disconnected",4900);return(await Tg(t,void 0,void 0,this.address)).hash}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new $a(`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 $a(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.provider=c.getJsonRpcProvider(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 jg(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 $g(c.generateTypedDataWithDomainType(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:c.toHex(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 c.toHex(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=>Aa.includes(e))(e.method))return this.provider.send(e.method,e.params);{let t=await Ag();if(await Pg(),!t||!this.address)throw new $a("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.rootAddress,accessToken:t,hdWalletIndex:this.walletIndex,request:{method:e.method,params:e.params}})).response.data}catch(e){throw console.error(e),new $a("Disconnected",4900)}}}async connect(){let e=await Ag();if(!e||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:e})).address}catch(e){return console.error(e),null}}constructor({walletProxy:e,address:t,rootAddress:r,rpcConfig:n,chains:i,appId:a,chainId:o=1,walletIndex:s}){super(),this.walletProxy=e,this.address=t,this.rootAddress=r,this.chainId=o,this.rpcConfig=n,this.chains=i,this.provider=c.getJsonRpcProvider(o,this.chains,n,{appId:a}),this.rpcTimeoutDuration=eo(n,"privy"),this.appId=a,this.walletIndex=s}}class Pa extends ja{constructor(e){super(e,e.rpcTimeoutDuration)}}class _a extends ja{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 ka;function Na(e){return"ethereum"===e.chainType}function Ia(e){return"ethereum"===e.type}class Ma extends f.WalletConnector{buildConnectedWallet(e,n,i,a){let o=async()=>!!this.wallets.find((r=>t.getAddress(r.address)===t.getAddress(e)));return{type:"ethereum",address:t.getAddress(e),chainId:n,meta:i,imported:a,switchChain:async r=>{let i,a;if(!o)throw new s.PrivyConnectorError("Wallet is not currently connected.");let l=this.wallets.find((r=>t.getAddress(r.address)===t.getAddress(e)))?.chainId;if(!l)throw new s.PrivyConnectorError("Unable to determine current chainId.");if("number"==typeof r?(i=`0x${r.toString(16)}`,a=r):(i=r,a=Number(r)),l===c.formatChainIdToCAIP2(i))return;let d=this.chains.find((e=>e.id===a));if(!d)throw new s.PrivyConnectorError(`Unsupported chainId: ${r}`);let u=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})};try{return await u()}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:i,chainName:d.name,nativeCurrency:d.nativeCurrency,rpcUrls:[d.rpcUrls.default?.http[0]??""],blockExplorerUrls:[d.blockExplorers?.default.url??""]}]}),u();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new s.PrivyConnectorError(`Rainbow does not support the chainId ${n}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:o,getEthereumProvider:async()=>{if(!await o())throw new s.PrivyConnectorError("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await o())throw new s.PrivyConnectorError("Wallet is not currently connected.");return new r.Web3Provider(new Pa(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await o())throw new s.PrivyConnectorError("Wallet is not currently connected.");return new _a(this.proxyProvider)},sign:async e=>{if(!await o())throw new s.PrivyConnectorError("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let r,n=e;try{if(void 0===n){let e=await c.invokeUntilSettled((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(n=e)}}catch(e){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let i=n[0],a=t.getAddress(i),o=[];if("privy"===this.walletClientType){let e=c.e6.get(d.getPrivyWalletKey(a));this.chains.find((t=>t.id===Number(e)))||(c.e6.del(d.getPrivyWalletKey(a)),e=null),r=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${r} on initialization`)}}else try{let e=await c.invokeUntilSettled((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)r=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");r=`0x${e.toString(16)}`}}catch(e){console.warn(`Failed to get chainId from provider, defaulting to ${d.DEFAULT_NETWORK}`,e),r=d.DEFAULT_NETWORK}let s=c.formatChainIdToCAIP2(r);if(!o.find((e=>t.getAddress(e.address)===a))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};o.push(this.buildConnectedWallet(t.getAddress(i),s,e,"embedded_imported"===this.connectorType))}ro(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((r=>e.find((e=>t.getAddress(e)===t.getAddress(r.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 r.Web3Provider(new Pa(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=c.formatChainIdToCAIP2(e),"privy"===this.walletClientType&&c.e6.put(d.getPrivyWalletKey(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=eo(n,e),this.connected=!1,this.initialized=!1}}let Oa=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],Ra=(e,t)=>e.makeWeb3Provider({options:t});class Fa extends Ma{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:Sa,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 s.PrivyConnectorError("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw f.formatConnectorError(e)}}updateConnectionPreference(e){this.connectionOptions=e,this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(Ra(ka,this.connectionOptions))}constructor(e,t,r,n,i,a){if(super("coinbase_wallet",e,t,r),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new ja(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"),!ka){let r=[t.id].concat(e.map((e=>e.id))),n="eoaOnly"!==this.connectionOptions?r.filter((e=>!Oa.includes(e))):[];n.length>0&&!n.every((e=>d.DEFAULT_SUPPORTED_CHAIN_IDS.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${n.join(", ")}`),ka=new m.CoinbaseWalletSDK({appName:i,appLogoUrl:a,appChainIds:r})}this.proxyProvider.setWalletProvider(Ra(ka,this.connectionOptions))}}const La=({...t})=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:t.color||"var(--privy-color-foreground-3)"})});class Ua extends Ma{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:[c.toHex(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:La,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:r,rpcConfig:n,imported:i,walletIndex:a}){super("privy",t,r,n),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=a,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const Da=({style:t,...r})=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...t},...r,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),Wa=({style:t,...r})=>e.jsxs("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",...t},...r,children:[e.jsx("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),e.jsx("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),e.jsx("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),e.jsx("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),e.jsx("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),e.jsx("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),e.jsx("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),e.jsx("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),e.jsx("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),e.jsx("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),e.jsx("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),e.jsx("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),e.jsx("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]}),Ba=({style:t,...r})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});function Ha(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Ga=0;class qa extends Ma{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 s.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw f.formatConnectorError(e)}}constructor(e,t,r,n,i){super(i||"unknown",e,t,r),this.connectorType="injected",this.proxyProvider=new ja(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=n;let a=n.provider;this.proxyProvider.setWalletProvider(a)}}var za="__private_"+Ga+++"__walletBranding";class Va extends Ma{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 Ha(this,za)[za]??{name:"Browser Extension",icon:Da,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 s.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw f.formatConnectorError(e)}}constructor(e,t,r,n,i){super(i??"unknown",e,t,r),Object.defineProperty(this,za,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new ja(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(n),"metamask"===i?Ha(this,za)[za]={name:"MetaMask",icon:Wa,id:"io.metamask"}:"phantom"===i&&(Ha(this,za)[za]={name:"Phantom",icon:Ba,id:"phantom"})}}class Ka extends qa{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{o.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new s.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw f.formatConnectorError(e)}}}class Ya extends Ma{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 ja(void 0,d.DEFAULT_RPC_TIMEOUT),this.connectorType=e}}class Za extends Ya{get walletBranding(){return{name:"Phantom",icon:Ba,id:"phantom"}}constructor(e){super("phantom",e)}}const Xa=({style:t,...r})=>{let{app:n}=v.usePrivyModal();return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"dark"===n?.appearance.palette.colorScheme?"#3396ff":"#141414"}),e.jsx("g",{clipPath:"url(#clip0_1765_9946)",children:e.jsx("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_1765_9946",children:e.jsx("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};class Ja extends Ma{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=Ii(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:Wa,id:"io.metamask"}:{name:c.stripEmoji(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Xa,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=Mi[e],this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(Ri)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new f.UserRejectedConnectionError)},(async()=>{let t="",r=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(r?.length&&(t=r[0]),!t||""===t)throw new s.PrivyConnectorError("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let e=Ii(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=eo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(r),e()})().catch((e=>{t(e?f.formatConnectorError(e):new s.PrivyConnectorError("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=c.getJsonRpcEndpoint(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 g.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:r,optionalEvents:g.OPTIONAL_EVENTS,optionalMethods:g.OPTIONAL_METHODS,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(),o.isMobile&&this.walletEntry){let{redirect:t,href:r}=function(e,t){let r=Oi(t);if(r.deepLink)return Li(r.deepLink,e);if(r.universalLink)return Ui(r.universalLink,e);throw new s.PrivyClientError(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);(function({href:e,name:t}){try{localStorage.setItem(Ri,JSON.stringify({href:e,name:t}))}catch{}})({href:r,name:this.walletEntry.displayName}),this.redirectUri=t;let n=function(e,t){let r=Oi(t);if(r.universalLink)return Ui(r.universalLink,e)}(e,this.walletEntry);n?.redirect&&(this.fallbackUniversalRedirectUri=n.redirect),Di(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=Ii(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,i,a,o,s){super(s||"unknown",r,n,t),this.connectorType="wallet_connect_v2",this.privyAppId=a,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new ja(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Mi[s],this.walletClientType=s)}}const Qa=e=>{let r=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>p.isHexString(e))).map((e=>t.getAddress(e)));return!!r?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&r.includes(e.address))).length},eo=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||d.DEFAULT_RPC_TIMEOUT;class to extends Re.default{get wallets(){let e=new Set,t=this.walletConnectors.flatMap((e=>e.wallets)).sort(((e,t)=>e.connectedAt&&t.connectedAt?t.connectedAt-e.connectedAt:0)).filter((t=>{let r=`${t.address}${t.walletClientType}${t.connectorType}`;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;c.e6.get(d.CONNECTORS_STATE_KEY)&&(c.e6.getKeys().forEach((e=>{e.startsWith("walletconnect")&&c.e6.del(e)})),c.e6.del(d.CONNECTORS_STATE_KEY));let e=c.detectInjectedConnectors(this.store,this.walletList,this.externalWalletConfig).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"),!c.isPhantomInstalled()&&this.walletList.includes("phantom")&&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(Na).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(Na).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findSolanaWalletConnector(e,t){return this.walletConnectors.filter(f.isSolanaWalletConnector).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:i}){for(let a of r){let r=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===a.walletIndex));if(r&&Na(r))r.proxyProvider.walletProxy=e;else{let r=new Ua({provider:new Ta({walletProxy:e,address:a.address,rootAddress:t.address,rpcConfig:this.rpcConfig,chains:this.chains,appId:i,chainId:n.id,walletIndex:a.walletIndex}),chains:this.chains,defaultChain:n,rpcConfig:this.rpcConfig,imported:!1,walletIndex:a.walletIndex});this.addWalletConnector(r)}}}addImportedWalletConnector(e,t,r,n){let i=this.findWalletConnector("embedded_imported","privy");if(i&&Na(i))i.proxyProvider.walletProxy=e;else{let i=new Ua({provider:new Ta({walletProxy:e,rootAddress:t,address:t,walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:n,chainId:r.id}),chains:this.chains,walletIndex:0,defaultChain:r,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(i)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.saveConnectionHistory(),this.storedConnections=no(),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=no(),this.emit("walletsUpdated")}}async createEthereumWalletConnector(e,t,r){let n=this.findWalletConnector(e,t);if(n&&Na(n))return n instanceof Ja&&n.resetConnection(t),n;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new Fa(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):"phantom"===e?new Za(this.defaultChain):new Ja(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,t):"metamask"===t&&r?.eip6963InjectedProvider?new Ka(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,"metamask"):"metamask"===t&&r?.legacyInjectedProvider?new Va(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"metamask"):"phantom"===t&&r?.legacyInjectedProvider?new Va(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"phantom"):r?.legacyInjectedProvider&&"unknown_browser_extension"===t?new Va(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider):r?.eip6963InjectedProvider?new qa(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,t):void 0)();return i&&this.addWalletConnector(i),i||null}addWalletConnector(e){this.walletConnectors.push(e),e.on("initialized",(()=>this.onInitialized(e))),e.on("walletsUpdated",(()=>this.onWalletsUpdated(e))),e.initialize().catch((e=>{console.debug("Failed to initialize connector",e)}))}saveConnectionHistory(){let e=this.wallets.map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt})));c.e6.put(d.CONNECTIONS_HISTORY_KEY,e)}async activeWalletSign(e){let t=this.wallets,r=t.length>0?t[0]:null;return r&&Ia(r)?r.sign(e):null}setActiveWallet(e){this.activeWallet=t.getAddress(e),this.emit("walletsUpdated")}constructor(e,t,r,n,i,a,o,s,l,d,c){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 ja},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=a,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=d,this.privyAppLogo=c,this.storedConnections=no()}}function ro(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n?.address!==i?.address||n&&i&&Ia(n)&&Ia(i)&&n?.chainId!==i?.chainId||n?.connectorType!==i?.connectorType||n?.connectedAt!==i?.connectedAt||n?.walletClientType!==i?.walletClientType||n?.isConnected!==i?.isConnected||n?.linked!==i?.linked)return!1}return!0}const no=()=>{let e=c.e6.get(d.CONNECTIONS_HISTORY_KEY);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 io=[bi,Ai,Si,Pi];class ao{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw s.formatApiError(e)}}async post(e,t,r){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...r})}catch(e){throw s.formatApiError(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw s.formatApiError(e)}}constructor({appId:e,appClientId:t,client:r,defaults:n}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=d.VERSION,this.client=r,this.defaults=n,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=w.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:e,options:t})=>{let r=new Headers(t.headers);r.set("privy-app-id",this.appId),this.appClientId&&r.set("privy-client-id",this.appClientId),r.set("privy-ca-id",this.clientAnalyticsId||""),r.set("privy-client",`react-auth:${this.sdkVersion}`);let n=io.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 s.PrivyTimeoutError}})}}function oo(){return!(o.isSafari&&window.location.origin.startsWith("http://localhost"))}class so{static parse(e){try{return new so(e)}catch(e){return null}}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=Oe.decodeJwt(e)}}class lo{get token(){try{let e=c.e6.get(d.TOKEN_STORAGE_KEY);return"string"==typeof e?new so(e).value:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=c.e6.get(d.REFRESH_TOKEN_STORAGE_KEY);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get forkedToken(){try{let e=c.e6.get(d.FORKED_TOKEN_STORAGE_KEY);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=c.e6.get(d.getProviderAccessTokenStorageKey(e));if("string"!=typeof t)return null;{let r=new so(t);return r.isExpired()?(c.e6.del(d.getProviderAccessTokenStorageKey(e)),null):r.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=Fe.default.get(d.SESSION_COOKIE_KEY);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||"string"==typeof this.token&&"string"==typeof this.refreshToken&&this.refreshToken!==d.DEPRECATED_REFRESH_TOKEN}hasRecoveryCredentials(){return"string"==typeof this.forkedToken}hasActiveToken(){let e=so.parse(this.token);return null!==e&&!e.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?c.e6.put(d.getProviderAccessTokenStorageKey(e),t):c.e6.del(d.getProviderAccessTokenStorageKey(e))}async _authenticate(e){try{let t=await e.authenticate(),{user:r,is_new_user:n,oauth_tokens:i}=t;this.handleTokenResponse(t);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:i.scopes}:void 0,o=function(e){return e instanceof ki?"email":e instanceof ma?"sms":e instanceof pa?"siwe":e instanceof Gi?"guest":e instanceof _i?"custom_auth":e instanceof Yi?e.meta.provider:null}(e);return o&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:o,isNewUser:n}}),"siwe"===o&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}}),{user:h.convertUserResponseToUser(r),isNewUser:n,oAuthTokens:a}}catch(e){throw console.warn("Error authenticating session"),s.formatPrivyError(e)}}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:h.convertUserResponseToUser(t),oAuthTokens:n}}catch(e){throw console.warn("Error linking account"),s.formatPrivyError(e)}}async _refresh(){if(!this.api)throw new s.PrivyClientError("Session has no API instance");if(!this.client)throw new s.PrivyClientError("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 i={};e&&(i.authorization=`Bearer ${e}`),n=await this.api.post(bi,t?{refresh_token:t}:{},{headers:i}),r&&this.clearForkedToken()}else{if(!r)return null;n=await this.api.post(Ai,{refresh_token:r}),this.clearForkedToken()}return this.handleTokenResponse(n),h.convertUserResponseToUser(n.user)}catch(e){if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw s.formatPrivyError(e)}}handleTokenResponse(e){e.session_update_action?"set"===e.session_update_action?(this.storeRefreshToken(e.refresh_token),this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token)):"clear"===e.session_update_action?this.destroyLocalState():"ignore"===e.session_update_action&&e.token&&(this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token)):(this.storeRefreshToken(e.refresh_token),this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token))}async _destroy(){try{await(this.api?.post(Si,{refresh_token:this.refreshToken}))}catch(e){console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new s.PrivyClientError("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.storeToken(t.token),t.new_session_refresh_token}catch(e){throw s.formatPrivyError(e)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeToken(e){if("string"==typeof e){let t=c.e6.get(d.TOKEN_STORAGE_KEY);if(c.e6.put(d.TOKEN_STORAGE_KEY,e),!this.client?.useServerCookies){let t=so.parse(e)?.expiration;Fe.default.set(d.TOKEN_COOKIE_KEY,e,{sameSite:"Strict",secure:oo(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreToken?.(e)}else c.e6.del(d.TOKEN_STORAGE_KEY),Fe.default.remove(d.TOKEN_COOKIE_KEY),this.client?.onDeleteToken?.()}storeRefreshToken(e){"string"==typeof e?(c.e6.put(d.REFRESH_TOKEN_STORAGE_KEY,e),this.client?.useServerCookies||Fe.default.set(d.SESSION_COOKIE_KEY,"t",{sameSite:"Strict",secure:oo(),expires:30})):(c.e6.del(d.REFRESH_TOKEN_STORAGE_KEY),Fe.default.remove(d.REFRESH_TOKEN_COOKIE_KEY),Fe.default.remove(d.SESSION_COOKIE_KEY))}storeIdentityToken(e){if(this.client?.useServerCookies)return;c.e6.put(d.IDENTITY_TOKEN_STORAGE_KEY,e);let t=so.parse(e)?.expiration;Fe.default.set(d.IDENTITY_TOKEN_COOKIE_KEY,e,{sameSite:"Strict",secure:oo(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){c.e6.del(d.IDENTITY_TOKEN_STORAGE_KEY),Fe.default.remove(d.IDENTITY_TOKEN_COOKIE_KEY)}clearForkedToken(){c.e6.del(d.FORKED_TOKEN_STORAGE_KEY)}constructor(){this.authenticateOnce=new Wi((async e=>this._authenticate(e))),this.linkOnce=new Wi((async e=>this._link(e))),this.refreshOnce=new Wi(this._refresh.bind(this)),this.destroyOnce=new Wi(this._destroy.bind(this)),this.forkSessionOnce=new Wi(this._forkSession.bind(this))}}let co;var uo=0,ho="__private_"+uo+++"__getOrGenerateClientAnalyticsId";class po{initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:r,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l}){this.connectors||(this.connectors=new to(this.appId,e,t,r,n,i,a,o,s,l))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let e=new ao({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 s.PrivyClientError("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new s.PrivyClientError("No auth flow in progress.");let{oAuthTokens:e}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:e}}storeProviderAccessToken(e,t){this.session.storeProviderAccessToken(e,t)}getProviderAccessToken(e){return this.session.getProviderAccessToken(e)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(e){e.linkedAccounts.filter((e=>"cross_app"===e.type)).forEach((e=>{this.storeProviderAccessToken(e.providerApp.id,null)}))}startAuthFlow(e){return e.api=this.api,this.authFlow=e,this.authFlow}async initMfaSmsVerification(){try{await this.api.post("/api/v1/mfa/passwordless_sms/init",{action:"verify"})}catch(e){throw s.formatApiError(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 s.formatApiError(e)}}async acceptTerms(){try{let e=await this.api.post("/api/v1/users/me/accept_terms",{});return h.convertUserResponseToUser(e)}catch(e){throw s.formatPrivyError(e)}}async unlinkEmail(e){try{let t=await this.api.post("/api/v1/passwordless/unlink",{address:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkPhone(e){try{let t=await this.api.post("/api/v1/passwordless_sms/unlink",{phoneNumber:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post("/api/v1/siwe/unlink",{address:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post("/api/v1/siws/unlink",{address:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkOAuth(e,t){try{let r=await this.api.post("/api/v1/oauth/unlink",{provider:e,subject:t});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(r)}catch(e){throw s.formatPrivyError(e)}}async unlinkFarcaster(e){try{let t=await this.api.post("/api/v1/farcaster/unlink",{fid:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkTelegram(e){try{let t=await this.api.post("/api/v1/telegram/unlink",{telegram_user_id:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkPasskey(e){try{let t=await this.api.post("/api/v1/passkeys/unlink",{credential_id:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:r,options:n}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Pi,{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 s.formatPrivyError(e)}}async initCoinbaseOnRamp(e){try{return this.api.post("/api/v1/funding/coinbase_on_ramp/init",e)}catch(e){throw s.formatPrivyError(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`/api/v1/funding/coinbase_on_ramp/status?partnerUserId=${e}`)}catch(e){throw s.formatPrivyError(e)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(e){return this.session.hasActiveToken()?this.session.hasRefreshCredentials()?so.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:(this.session.destroyLocalState(),null):!e?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):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})))}:{enabled:r.enabled}}catch(e){throw s.formatPrivyError(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,i=r.funding_config?{methods:r.funding_config.methods,defaultRecommendedAmount:r.funding_config.default_recommended_amount,defaultRecommendedCurrency:r.funding_config.default_recommended_currency,promptFundingOnWalletCreation:r.funding_config.prompt_funding_on_wallet_creation}: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,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,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:i}}catch(e){throw s.formatPrivyError(e)}}async getUsdTokenPrice(e){try{return(await this.api.get(`/api/v1/token_price?chainId=${e.id}&tokenSymbol=${e.nativeCurrency.symbol}`)).usd}catch(t){return void console.error(`Unable to fetch token price for chain with id ${e.id}`)}}async getUsdPriceForSol(){try{return(await this.api.get("/api/v1/token_price?chainId=0&tokenSymbol=SOL")).usd}catch(e){return void console.error("Unable to fetch token price for SOL")}}async 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 s.formatPrivyError(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a}){return await this.api.post("/api/v1/siwe/authenticate",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a})}async linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){return await this.api.post("/api/v1/siwe/link",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})}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 h.convertUserResponseToUser(n)}catch(e){throw s.formatPrivyError(e)}}async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i});return h.convertUserResponseToUser(a)}catch(e){throw s.formatPrivyError(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 s.formatPrivyError(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n,mode:i}){return await this.api.post("/api/v1/siws/authenticate",{message:e,signature:t,walletClientType:r,connectorType:n,mode:i})}async sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o}){try{let s,l;switch(r){case"email":s="/api/v1/passwordless/transfer",l={nonce:e,email:t};break;case"sms":s="/api/v1/passwordless_sms/transfer",l={nonce:e,phoneNumber:t};break;case"siwe":if(s="/api/v1/siwe/transfer",!n)throw Error("Wallet parameters must be defined");l={nonce:e,address:t,...n};break;case"farcaster":s="/api/v1/farcaster/transfer",l={nonce:e,farcaster_id:t,farcaster_embedded_address:a};break;case"telegram":s="/api/v1/telegram/transfer",l={nonce:e,telegram_auth_result:i};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:s="/api/v1/oauth/transfer",l={nonce:e,userInfo:o}}let d=await this.api.post(s,l);return await this.getAuthenticatedUser()??h.convertUserResponseToUser(d)}catch(e){throw s.formatPrivyError(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 i=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n});return h.convertUserResponseToUser(i)}catch(e){throw s.formatPrivyError(e)}}constructor(e){Object.defineProperty(this,ho,{value:yo}),this.apiUrl=e.apiUrl||d.DEFAULT_PRIVY_API_URL,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!e.apiUrl&&e.apiUrl.startsWith("https://privy."),this.timeout=e.timeout||d.DEFAULT_API_TIMEOUT_MS,this.appId=e.appId,this.appClientId=e.appClientId,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,ho)[ho](),co||(co=new lo),this.session=co,this.api=this.generateApi(),this.session.client=this}}function yo(){if("undefined"==typeof window)return null;try{let e=c.e6.get(d.CLIENT_ANALYTICS_ID_KEY);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=u.v4();try{return c.e6.put(d.CLIENT_ANALYTICS_ID_KEY,e),e}catch(t){return e}}const mo=t=>{let{enabled:r,siteKey:n,appId:i,setError:o,setToken:s,setExecuting:l,ref:d}=xa(),[,c]=a.useMemo((()=>n?.split("t:")||[]),[n]);if(a.useEffect((()=>d.current?.remove),[]),!r)return null;if(!c)throw Error("Unsupported captcha site key");return e.jsx("div",{className:"hidden h-0 w-0",children:e.jsx(C.Turnstile,{...t,ref:d,siteKey:c,options:{action:i,size:"invisible",...t.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{t.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{t.onError?.(),o("Captcha failed"),l(!1)},onSuccess:e=>{t.onSuccess?.(e),s(e),l(!1)},onExpire:()=>{t.onExpire?.();try{d.current?.reset(),o(void 0),s(void 0)}catch(e){o("expired_and_failed_reset")}}})})};function fo(e){h.usePrivyEventSubscription("configureMfa",e)}const go=({success:t,fail:r})=>e.jsxs(e.Fragment,{children:[e.jsx(vo,{className:t?"success":r?"fail":""}),e.jsx(wo,{className:t?"success":r?"fail":""})]}),vo=E.styled.span`
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("@ethersproject/address"),r=require("@ethersproject/providers"),n=require("@solana/web3.js"),i=require("mipd"),a=require("react"),o=require("react-device-detect"),s=require("./privy-context.js"),l=require("jose"),d=require("./useWallets.js"),c=require("./useFundWallet.js"),u=require("uuid"),h=require("./events-context.js"),p=require("@ethersproject/bytes"),y=require("eventemitter3"),m=require("@coinbase/wallet-sdk"),f=require("./useSolanaWallets.js"),g=require("@walletconnect/ethereum-provider"),v=require("./getEmbeddedConnectedWallet.js"),w=require("ofetch"),x=require("js-cookie"),C=require("@marsidev/react-turnstile"),E=require("styled-components"),b=require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),S=require("@heroicons/react/24/outline/ArrowLeftIcon"),A=require("@heroicons/react/24/outline/ArrowRightIcon"),j=require("@heroicons/react/24/outline/XMarkIcon"),$=require("@heroicons/react/24/outline/ExclamationTriangleIcon"),T=require("@heroicons/react/24/outline/WalletIcon"),P=require("@heroicons/react/24/outline"),_=require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon"),k=require("@heroicons/react/24/solid/DocumentCheckIcon"),N=require("@heroicons/react/20/solid/CheckIcon"),I=require("@heroicons/react/24/outline/EnvelopeIcon"),M=require("@heroicons/react/24/outline/PhoneIcon"),O=require("@heroicons/react/24/solid/CheckCircleIcon"),R=require("@heroicons/react/24/solid/XCircleIcon"),F=require("fast-password-entropy"),L=require("secure-password-utilities"),U=require("secure-password-utilities/wordlists"),D=require("@heroicons/react/24/outline/ArrowPathIcon"),W=require("@heroicons/react/24/outline/EyeIcon"),B=require("@heroicons/react/24/outline/EyeSlashIcon"),H=require("@heroicons/react/24/outline/KeyIcon"),G=require("@heroicons/react/24/outline/ArrowDownTrayIcon"),q=require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),z=require("@heroicons/react/24/outline/DocumentDuplicateIcon"),V=require("@heroicons/react/24/outline/UserCircleIcon"),K=require("@heroicons/react/24/solid/LockClosedIcon"),Y=require("qrcode"),Z=require("@heroicons/react/24/outline/CheckCircleIcon"),X=require("@heroicons/react/24/outline/GlobeAltIcon"),J=require("viem"),Q=require("@headlessui/react"),ee=require("@heroicons/react/24/outline/ClockIcon"),te=require("@heroicons/react/24/outline/TrashIcon"),re=require("@heroicons/react/24/solid/CheckBadgeIcon"),ne=require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),ie=require("@heroicons/react/24/outline/PencilIcon"),ae=require("@ethersproject/units"),oe=require("@heroicons/react/24/outline/InformationCircleIcon"),se=require("@heroicons/react/24/outline/QrCodeIcon"),le=require("@heroicons/react/24/outline/LinkIcon"),de=require("@heroicons/react/24/outline/ChevronRightIcon"),ce=require("@heroicons/react/24/outline/ShieldCheckIcon"),ue=require("@heroicons/react/24/solid/IdentificationIcon"),he=require("@heroicons/react/24/outline/DevicePhoneMobileIcon"),pe=require("@heroicons/react/24/outline/FingerPrintIcon"),ye=require("@heroicons/react/24/outline/MinusCircleIcon"),me=require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon"),fe=require("@heroicons/react/24/solid/ShieldCheckIcon"),ge=require("@ethersproject/abstract-signer"),ve=require("@ethersproject/bignumber"),we=require("@ethersproject/contracts"),xe=require("@ethersproject/transactions"),Ce=require("fetch-retry"),Ee=require("@heroicons/react/24/outline/ChevronDownIcon"),be=require("@heroicons/react/24/outline/CalendarIcon"),Se=require("@heroicons/react/24/outline/LockClosedIcon"),Ae=require("@heroicons/react/24/outline/PencilSquareIcon"),je=require("@solana/wallet-adapter-base"),$e=require("@heroicons/react/24/outline/ClipboardDocumentIcon"),Te=require("@heroicons/react/24/outline/ExclamationCircleIcon"),Pe=require("@ethersproject/logger"),_e=require("@ethersproject/strings");function ke(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function Ne(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}require("tinycolor2"),require("@heroicons/react/24/outline/Square2StackIcon"),require("viem/actions"),require("viem/chains");var Ie=ke(a),Me=Ne(o),Oe=Ne(l),Re=ke(y),Fe=ke(x),Le=ke(b),Ue=ke(S),De=ke(A),We=ke(j),Be=ke($),He=ke(T),Ge=ke(_),qe=ke(k),ze=ke(N),Ve=ke(I),Ke=ke(M),Ye=ke(O),Ze=ke(R),Xe=ke(F),Je=Ne(L),Qe=ke(D),et=ke(W),tt=ke(B),rt=ke(H),nt=ke(G),it=ke(q),at=ke(z),ot=ke(V),st=ke(K),lt=ke(Y),dt=ke(Z),ct=ke(X),ut=ke(ee),ht=ke(te),pt=ke(re),yt=ke(ne),mt=ke(ie),ft=ke(oe),gt=ke(se),vt=ke(le),wt=ke(de),xt=ke(ce),Ct=ke(ue),Et=ke(he),bt=ke(pe),St=ke(ye),At=ke(me),jt=ke(fe),$t=ke(Ce),Tt=ke(Ee),Pt=ke(be),_t=ke(Se),kt=ke(Ae),Nt=ke($e),It=ke(Te);let Mt={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"}}},Ot={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},Rt={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},Ft={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"}}},Lt={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},Ut={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},Dt={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"}}},Wt={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},Bt={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},Ht={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"}}},Gt={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},qt={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"}}},zt={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},Vt={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},Kt=e=>[Mt.id,Ot.id,Rt.id].includes(e),Yt=e=>[56,97].includes(e),Zt="0x420000000000000000000000000000000000000F",Xt=["function getL1Fee(bytes memory _data) external view returns (uint256)"],Jt=e=>[Ft.id,Lt.id,Ut.id,Dt.id,Wt.id,Bt.id,qt.id,Vt.id,zt.id,81457,168587773].includes(e);let Qt={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},er=$t.default(fetch,{retries:3,retryDelay:500}),tr=e=>[Ht.id,Gt.id,Qt.id].includes(e),rr=e=>({maxPriorityFee:ae.parseUnits(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:ae.parseUnits(e.maxFee.toFixed(9),"gwei").toHexString()}),nr=async e=>{let t="";switch(e){case Ht.id:t="https://gasstation.polygon.technology/v2";break;case Gt.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Qt.id:t="https://gasstation.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}let r=await er(t),n=await r.json();if(r.status>399)throw n;return{safeLow:rr(n.safeLow),standard:rr(n.standard),fast:rr(n.fast)}};async function ir(e,t){if(!e.gasLimit)throw new f.l("gasLimit was not successfully set for transaction.");let r=c.i(e.gasLimit),n=ve.BigNumber.from(0);if(2==e.type){if(!e.maxFeePerGas)throw new f.l("maxFeePerGas was not successfully set for transaction of type 2.");n=c.i(e.maxFeePerGas)}else{if(!e.gasPrice)throw new f.l("gasPrice was not successfully set for transaction of type 0 or 1.");n=c.i(e.gasPrice)}let i=r.mul(n),a=ve.BigNumber.from(0);if(e.chainId&&Jt(e.chainId))try{a=await async function(e,t){if(!e.chainId||e.chainId&&!Jt(e.chainId))return ve.BigNumber.from(0);let r=ve.BigNumber.from(0);try{let n=new we.Contract(Zt,Xt,t),i=c.r(e),a=xe.serialize(i);r=await n.getL1Fee(a)}catch(e){}return r}(e,t),i=i.add(a)}catch(e){}return{totalGasEstimate:i,l1ExecutionFeeEstimate:a}}function ar(e){return/^-?0x[a-f0-9]+$/i.test(e)}async function or(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&&ar(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 ge.VoidSigner(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&&ar(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),0===(t=tr(t.chainId)?await async function(e){if(!tr(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 nr(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):Kt(t.chainId)?await(async(e,t)=>{if(!Kt(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(ve.BigNumber.from(120)).div(ve.BigNumber.from(100));e.maxFeePerGas=c.t(t),e.maxPriorityFeePerGas=c.t(ve.BigNumber.from(0))}}catch(e){throw Error(`Failed to set gas price for Arbitrum transaction: ${e}.`)}return e})(t,r):Jt(t.chainId)?await(async(e,t)=>{if(!Jt(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=ve.BigNumber.from(r).mul(ve.BigNumber.from(126)).div(ve.BigNumber.from(100)).add(ve.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=c.t(n)}}catch(e){throw Error(`Failed to set gas price for OP stack transaction: ${e}.`)}return e})(t,r):Yt(t.chainId)?await(async(e,t)=>{if(!Yt(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 sr={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"},lr={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 dr(e,t){var r=Array.prototype.slice.call(t);return r.push(lr),e.apply(this,r)}function cr(e){return(cr="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 ur(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hr(e){var t="function"==typeof Map?new Map:void 0;return(hr=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 pr(e,arguments,fr(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),mr(r,e)})(e)}function pr(e,t,r){return(pr=yr()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&mr(i,r.prototype),i}).apply(null,arguments)}function yr(){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 mr(e,t){return(mr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function fr(e){return(fr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var gr=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&&mr(e,t)}(n,hr(Error));var t,r=(t=yr(),function(){var e=fr(n);return function(e,t){if(t&&("object"===cr(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return ur(e)}(this,t?Reflect.construct(e,arguments,fr(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(ur(t=r.call(this,e)),n.prototype),t.name=t.constructor.name,t}return Object.defineProperty(n,"prototype",{writable:!1}),n}(),vr="0-90-9٠-٩۰-۹",wr="".concat("-‐-―−ー-").concat("//").concat("..").concat("  ­​⁠ ").concat("()()[]\\[\\]").concat("~⁓∼~");function xr(e,t){e=e.split("-"),t=t.split("-");for(var r=e[0].split("."),n=t[0].split("."),i=0;i<3;i++){var a=Number(r[i]),o=Number(n[i]);if(a>o)return 1;if(o>a)return-1;if(!isNaN(a)&&isNaN(o))return 1;if(isNaN(a)&&!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 Cr(e){return(Cr="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 Er(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function br(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 Sr=" ext. ",Ar=/^\d+$/,jr=function(){function e(t){Er(this,e),function(e){if(!e)throw Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Nr(e)||!Nr(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(Nr(e)?"an object of shape: { "+Object.keys(e).join(", ")+" }":"a "+Ir(e)+": "+e,"."))}(t),this.metadata=t,Or.call(this,t)}return br(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&&Ar.test(e)&&(t=e,e=null),e&&"001"!==e){if(!this.hasCountry(e))throw Error("Unknown country: ".concat(e));this.numberingPlan=new $r(this.getCountryMetadata(e),this)}else if(t){if(!this.hasCallingCode(t))throw Error("Unknown calling code: ".concat(t));this.numberingPlan=new $r(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}(),$r=function(){function e(t,r){Er(this,e),this.globalMetadataObject=r,this.metadata=t,Or.call(this,r.metadata)}return br(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 Tr(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()&&kr(this.types(),e))return new _r(kr(this.types(),e),this)}},{key:"ext",value:function(){return this.v1||this.v2?Sr:this.metadata[13]||Sr}}]),e}(),Tr=function(){function e(t,r){Er(this,e),this._format=t,this.metadata=r}return br(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()||Pr.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),e}(),Pr=/^\(?\$1\)?$/,_r=function(){function e(t,r){Er(this,e),this.type=t,this.metadata=r}return br(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 kr(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 Nr=function(e){return"object"===Cr(e)},Ir=function(e){return Cr(e)};function Mr(e,t){if((t=new jr(t)).hasCountry(e))return t.country(e).countryCallingCode();throw Error("Unknown country: ".concat(e))}function Or(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===xr(t,"1.2.0")?this.v2=!0:-1===xr(t,"1.7.35")?this.v3=!0:this.v4=!0:this.v1=!0}var Rr=function(e){return"([".concat(vr,"]{1,").concat(e,"})")};function Fr(e){var t="[  \\t,]*",r="[:\\..]?[  \\t,-]*",n="[  \\t]*";return";ext="+Rr("20")+"|"+t+"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)"+r+Rr("20")+"#?|"+t+"(?:[xx##~~]|int|int)"+r+Rr("9")+"#?|[- ]+"+Rr("6")+"#|"+n+"(?:,{2}|;)"+r+Rr("15")+"#?|"+n+"(?:,)+"+r+Rr("9")+"#?"}var Lr=RegExp("^[++]{0,1}(?:["+wr+"]*["+vr+"]){1,2}$","i"),Ur="[++]{0,1}(?:["+wr+"]*["+vr+"]){3,}["+wr+vr+"]*(?:"+Fr()+")?",Dr=RegExp("^["+vr+"]{2}$|^"+Ur+"$","i"),Wr=RegExp("(?:"+Fr()+")$","i");function Br(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 Hr={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 Gr(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 Br(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 Br(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 i=Hr[t.value];i&&(r+=i)}return r}function qr(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 zr(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 qr(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 qr(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 Hr[e]}(t.value,r)||"";return r}function Vr(e,t){return function(e,t,r){var n=r.type(t),i=n&&n.possibleLengths()||r.possibleLengths();if(!i)return"IS_POSSIBLE";var a=e.length,o=i[0];return o===a?"IS_POSSIBLE":o>a?"TOO_SHORT":i[i.length-1]<a?"TOO_LONG":i.indexOf(a,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}(e,void 0,t)}function Kr(e,t){return"IS_POSSIBLE"===Vr(e,t)}function Yr(e,t){return e=e||"",RegExp("^(?:"+t+")$").test(e)}function Zr(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 Xr=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Jr(e,t,r){if(t=t||{},e.country){(r=new jr(r)).selectNumberingPlan(e.country,e.countryCallingCode);var n=t.v2?e.nationalNumber:e.phone;if(Yr(n,r.nationalNumberPattern())){if(Qr(n,"FIXED_LINE",r))return r.type("MOBILE")&&""===r.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":r.type("MOBILE")?Qr(n,"MOBILE",r)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";for(var i,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 Zr(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 Zr(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.")}(Xr);!(i=a()).done;){var o=i.value;if(Qr(n,o,r))return o}}}}function Qr(e,t,r){return!(!(t=r.type(t))||!t.pattern())&&!(t.possibleLengths()&&0>t.possibleLengths().indexOf(e.length))&&Yr(e,t.pattern())}function en(e){return e.replace(RegExp("[".concat(wr,"]+"),"g")," ").trim()}var tn=/(\$\d)/;function rn(e,t,r){var n=r.useInternationalFormat,i=r.withNationalPrefix;r.carrierCode,r.metadata;var a=e.replace(new RegExp(t.pattern()),n?t.internationalFormat():i&&t.nationalPrefixFormattingRule()?t.format().replace(tn,t.nationalPrefixFormattingRule()):t.format());return n?en(a):a}var nn=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function an(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 on(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 sn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?on(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)):on(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ln={formatExtension:function(e,t,r){return"".concat(e).concat(r.ext()).concat(t)}};function dn(e,t,r,n,i){var a=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 an(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 an(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 i=r.value;if(i.leadingDigitsPatterns().length>0){var a=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(0!==t.search(a))continue}if(Yr(t,i.pattern()))return i}}(n.formats(),e);return a?rn(e,a,{useInternationalFormat:"INTERNATIONAL"===r,withNationalPrefix:!a.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!i||!1!==i.nationalPrefix,carrierCode:t,metadata:n}):e}function cn(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 un(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cn(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)):cn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var hn=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 i,a,o,s=(o=new jr(n),pn(e)?(i=e,o.selectNumberingPlan(i),a=o.countryCallingCode()):a=e,{country:i,countryCallingCode:a}),l=s.country,d=s.countryCallingCode;this.country=l,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 jr(r=this.getMetadata()).getCountryCodesForCallingCode(e))?n.filter((function(e){var n;return(n=new jr(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 jr(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 Kr(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 jr(t)).selectNumberingPlan(this.country,this.countryCallingCode),t.hasTypes()?void 0!==Jr(this,e,t.metadata):Yr(e.v2?this.nationalNumber:this.phone,t.nationalNumberPattern())}},{key:"isNonGeographic",value:function(){return new jr(this.getMetadata()).isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(e){return this.number===e.number&&this.ext===e.ext}},{key:"getType",value:function(){return Jr(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(e,t){return function(e,t,r,n){if(r=r?sn(sn({},ln),r):ln,n=new jr(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 i,a,o,s,l,d,c,u,h,p,y,m,f,g=n.countryCallingCode(),v=r.v2?e.nationalNumber:e.phone;switch(t){case"NATIONAL":return v?(i=f=dn(v,e.carrierCode,"NATIONAL",n,r),a=e.ext,o=n,s=r.formatExtension,a?s(i,a,o):i):"";case"INTERNATIONAL":return v?(f=dn(v,null,"INTERNATIONAL",n,r),l=f="+".concat(g," ").concat(f),d=e.ext,c=n,u=r.formatExtension,d?u(l,d,c):l):"+".concat(g);case"E.164":return"+".concat(g).concat(v);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(g).concat(v),ext:e.ext});case"IDD":if(!r.fromCountry)return;return h=function(e,t,r,n,i){if(Mr(n,i.metadata)===r){var a,o=dn(e,t,"NATIONAL",i);return"1"===r?r+" "+o:o}var s=(void 0,(a=new jr(i.metadata)).selectNumberingPlan(n,undefined),a.defaultIDDPrefix()?a.defaultIDDPrefix():nn.test(a.IDDPrefix())?a.IDDPrefix():void 0);if(s)return"".concat(s," ").concat(r," ").concat(dn(e,null,"INTERNATIONAL",i))}(v,e.carrierCode,g,r.fromCountry,n),p=e.ext,y=n,m=r.formatExtension,p?m(h,p,y):h;default:throw Error('Unknown "format" argument passed to "formatNumber()": "'.concat(t,'"'))}}(this,e,t?un(un({},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}(),pn=function(e){return/^[A-Z]{2}$/.test(e)},yn=RegExp("(["+vr+"])");function mn(e,t,r,n){if(t){var i=new jr(n);i.selectNumberingPlan(t,r);var a=new RegExp(i.IDDPrefix());if(0===e.search(a)){var o=(e=e.slice(e.match(a)[0].length)).match(yn);if(!(o&&null!=o[1]&&o[1].length>0&&"0"===o[1]))return e}}}function fn(e,t){if(e&&t.numberingPlan.nationalPrefixForParsing()){var r=RegExp("^(?:"+t.numberingPlan.nationalPrefixForParsing()+")"),n=r.exec(e);if(n){var i,a,o,s=n.length-1,l=s>0&&n[s];if(t.nationalPrefixTransformRule()&&l)i=e.replace(r,t.nationalPrefixTransformRule()),s>1&&(a=n[1]);else{var d=n[0];i=e.slice(d.length),l&&(a=n[1])}if(l){var c=e.indexOf(n[1]);e.slice(0,c)===t.numberingPlan.nationalPrefix()&&(o=t.numberingPlan.nationalPrefix())}else o=n[0];return{nationalNumber:i,nationalPrefix:o,carrierCode:a}}}return{nationalNumber:e}}function gn(e,t){var r=fn(e,t),n=r.carrierCode,i=r.nationalNumber;return i!==e&&(Yr(e,t.nationalNumberPattern())&&!Yr(i,t.nationalNumberPattern())||t.possibleLengths()&&!function(e,t){switch(Vr(e,t)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}(i,t))?{nationalNumber:e}:{nationalNumber:i,carrierCode:n}}function vn(e,t,r,n){var i=t?Mr(t,n):r;if(0===e.indexOf(i)){(n=new jr(n)).selectNumberingPlan(t,r);var a=e.slice(i.length),o=gn(a,n).nationalNumber,s=gn(e,n).nationalNumber;if(!Yr(s,n.nationalNumberPattern())&&Yr(o,n.nationalNumberPattern())||"TOO_LONG"===Vr(s,n))return{countryCallingCode:i,number:a}}return{number:e}}function wn(e,t,r,n){if(!e)return{};if("+"!==e[0]){var i,a=mn(e,t,r,n);if(!a||a===e){if(t||r){var o=vn(e,t,r,n),s=o.countryCallingCode,l=o.number;if(s)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:s,number:l}}return{number:e}}i=!0,e="+"+a}if("0"===e[1])return{};n=new jr(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:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:c,number:e.slice(d)};d++}return{}}function xn(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 Cn(e,t){var r=t.countries,n=t.defaultCountry,i=t.metadata;i=new jr(i);for(var a,o=[],s=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 xn(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 xn(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);!(a=s()).done;){var l=a.value;if(i.country(l),i.leadingDigits()){if(e&&0===e.search(i.leadingDigits()))return l}else if(Jr({phone:e,country:l},void 0,i.metadata)){if(!n||l===n)return l;o.push(l)}}if(o.length>0)return o[0]}function En(e,t){var r=t.nationalNumber,n=t.defaultCountry,i=t.metadata,a=i.getCountryCodesForCallingCode(e);return a?1===a.length?a[0]:Cn(r,{countries:a,defaultCountry:n,metadata:i.metadata}):void 0}var bn="(["+vr+"]|[\\-\\.\\(\\)]?)",Sn=RegExp("^\\+"+bn+"*["+vr+"]"+bn+"*$","g"),An=RegExp("^(["+vr+"]+((\\-)*["+vr+"])*\\.)*[a-zA-Z]+((\\-)*["+vr+"])*\\.?$","g"),jn="tel:",$n=";phone-context=",Tn=RegExp("[++"+vr+"]"),Pn=RegExp("[^"+vr+"#]+$");function _n(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 kn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_n(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)):_n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Nn(e){return(Nn="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 In(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 Mn(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 On(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 Rn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?On(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)):On(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Fn(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 Ln(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fn(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)):Fn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Un(){var e=function(e){var t,r,n,i=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,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),4!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(t)||function(e,t){if(e){if("string"==typeof e)return Mn(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 Mn(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.")}(),a=i[0],o=i[1],s=i[2],l=i[3];if("string"!=typeof a)throw TypeError("A text for parsing must be a string.");if(o&&"string"!=typeof o){if("object"!==Nn(o))throw Error("Invalid second argument: ".concat(o));s?(r=o,n=s):n=o}else l?(r=s,n=l):(r=void 0,n=s),o&&(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?In(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)):In(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({defaultCountry:o},r));return{text:a,options:r,metadata:n}}(arguments),t=e.text,r=e.options,n=e.metadata,i=function(e,t,r){var n;t&&t.defaultCountry&&(n=t.defaultCountry,!r.countries.hasOwnProperty(n))&&(t=Rn(Rn({},t),{},{defaultCountry:void 0}));try{return function(e,t,r){if(t=t||{},r=new jr(r),t.defaultCountry&&!r.hasCountry(t.defaultCountry)){if(t.v2)throw new gr("INVALID_COUNTRY");throw Error("Unknown country: ".concat(t.defaultCountry))}var n,i=function(e,t,r){var n=function(e,t){var r,n=t.extractFormattedPhoneNumber,i=function(e){var t=e.indexOf($n);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!==i&&(0===i.length||!Sn.test(i)&&!An.test(i)))throw new gr("NOT_A_NUMBER");if(null===i)r=n(e)||"";else{r="","+"===i.charAt(0)&&(r+=i);var a,o=e.indexOf(jn);a=o>=0?o+4:0;var s=e.indexOf($n);r+=e.substring(a,s)}var l=r.indexOf(";isub=");if(l>0&&(r=r.substring(0,l)),""!==r)return r}(e,{extractFormattedPhoneNumber:function(e){return function(e,t,r){if(e){if(e.length>250){if(r)throw new gr("TOO_LONG");return}if(!1===t)return e;var n=e.search(Tn);if(!(n<0))return e.slice(n).replace(Pn,"")}}(e,r,t)}});if(!n)return{};if(!(n.length>=2&&Dr.test(n)))return Lr.test(n)?{error:"TOO_SHORT"}:{};var i=function(e){var t=e.search(Wr);if(t<0)return{};for(var r=e.slice(0,t),n=e.match(Wr),i=1;i<n.length;){if(n[i])return{number:r,ext:n[i]};i++}}(n);return i.ext?i:{number:n}}(e,t.v2,t.extract),a=i.number,o=i.ext,s=i.error;if(!a){if(t.v2){if("TOO_SHORT"===s)throw new gr("TOO_SHORT");throw new gr("NOT_A_NUMBER")}return{}}var l=function(e,t,r,n){var i,a=wn(zr(e),t,r,n.metadata),o=a.countryCallingCodeSource,s=a.countryCallingCode,l=a.number;if(s)n.selectNumberingPlan(s);else{if(!l||!t&&!r)return{};n.selectNumberingPlan(t,r),t&&(i=t),s=r||Mr(t,n.metadata)}if(!l)return{countryCallingCodeSource:o,countryCallingCode:s};var d=gn(zr(l),n),c=d.nationalNumber,u=d.carrierCode,h=En(s,{nationalNumber:c,defaultCountry:t,metadata:n});return h&&(i=h,"001"===h||n.country(i)),{country:i,countryCallingCode:s,countryCallingCodeSource:o,nationalNumber:c,carrierCode:u}}(a,t.defaultCountry,t.defaultCallingCode,r),d=l.country,c=l.nationalNumber,u=l.countryCallingCode,h=l.countryCallingCodeSource,p=l.carrierCode;if(!r.hasSelectedNumberingPlan()){if(t.v2)throw new gr("INVALID_COUNTRY");return{}}if(!c||c.length<2){if(t.v2)throw new gr("TOO_SHORT");return{}}if(c.length>17){if(t.v2)throw new gr("TOO_LONG");return{}}if(t.v2){var y=new hn(u,c,r.metadata);return d&&(y.country=d),p&&(y.carrierCode=p),o&&(y.ext=o),y.__countryCallingCodeSource=h,y}var m=!!(t.extended?r.hasSelectedNumberingPlan():d)&&Yr(c,r.nationalNumberPattern());return t.extended?{country:d,countryCallingCode:u,carrierCode:p,valid:m,possible:!!m||!(!0!==t.extended||!r.possibleLengths()||!Kr(c,r)),phone:c,ext:o}:m?(n={country:d,phone:c},o&&(n.ext=o),n):{}}(e,kn(kn({},t),{},{v2:!0}),r)}catch(e){if(!(e instanceof gr))throw e}}(t,r=Ln(Ln({},r),{},{extract:!1}),n);return i&&i.isPossible()||!1}var Dn=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 Wn(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 Bn=/x/;function Hn(e,t){if(t<1)return"";for(var r="";t>1;)1&t&&(r+=e),t>>=1,e+=e;return r+e}function Gn(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,i="";t.push(e.length);for(var a=0;a<t.length;a++){var o=t[a];i+=e.slice(n,o),n=o+1}return i}(e.slice(0,t))}function qn(e,t,r){var n=r.metadata,i=r.useNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix,o=rn(e.nationalSignificantNumber,t,{carrierCode:e.carrierCode,useInternationalFormat:e.international,withNationalPrefix:i,metadata:n});if(i||(e.nationalPrefix?o=e.nationalPrefix+a(t)+o:e.complexPrefixBeforeNationalSignificantNumber&&(o=e.complexPrefixBeforeNationalSignificantNumber+" "+o)),Gr(o)===e.getNationalDigits())return o}var zn=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([Yn(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(Kn);if(t){var r=t[1],n=e.slice(0,t.index),i=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 a=this.getContext().branches;a.push(Yn(this.getContext().instructions)),this.endContext(),this.getContext().instructions.push({op:"|",args:a});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(Yn(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,i=e[r+1].charCodeAt(0)-1,a=n;a<=i;)t.push(String.fromCharCode(a)),a++}else t.push(e[r]);r++}return t}(n)});break;default:throw Error("Unknown operator: ".concat(r))}i&&this.parsePattern(i)}else{if(Vn.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}(),Vn=/[\(\)\[\]\?\:\|]/,Kn=RegExp("(\\||\\(\\?\\:|\\)|\\[|\\])");function Yn(e){return 1===e.length?e[0]:e}function Zn(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 Xn(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 Xn(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 Xn(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 Jn=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 zn).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 i=t.join("");return 0===r.indexOf(i)?t.length===r.length?{match:!0,matchedChars:t}:{partialMatch:!0}:0===i.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 a=t.slice(),o=0;o<r.length;){var s=e(a,r[o],n&&o===r.length-1);if(!s)return;if(s.overflow)return s;if(!s.match){if(s.partialMatch)return{partialMatch:!0};throw Error("Unsupported match result:\n".concat(JSON.stringify(s,null,2)))}if(0===(a=a.slice(s.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-a.length)}}switch(r.op){case"|":for(var l,d,c=Zn(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)));l=!0}}return l?{partialMatch:!0}:void 0;case"[]":for(var h,p=Zn(r.args);!(h=p()).done;){var y=h.value;if(t[0]===y)return 1===t.length?{match:!0,matchedChars:t}:n?{overflow:!0}:{match:!0,matchedChars:[y]}}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 Qn(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 ei(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 ei(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 ei(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 ti=Hn("9",15),ri=/[- ]/,ni=RegExp("["+wr+"]*\\$1["+wr+"]*(\\$\\d["+wr+"]*)*$"),ii=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"===Vr(t.nationalSignificantNumber,this.metadata))for(var n,i=Qn(this.matchingFormats);!(n=i()).done;){var a=n.value,o=function(e,t,r){var n=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix;if(new RegExp("^(?:".concat(t.pattern(),")$")).test(e.nationalSignificantNumber))return function(e,t,r){var n=r.metadata,i=r.shouldTryNationalPrefixFormattingRule,a=r.getSeparatorAfterNationalPrefix;if(e.nationalSignificantNumber,e.international,e.nationalPrefix,e.carrierCode,i(t)){var o=qn(e,t,{useNationalPrefixFormattingRule:!0,getSeparatorAfterNationalPrefix:a,metadata:n});if(o)return o}return qn(e,t,{useNationalPrefixFormattingRule:!1,getSeparatorAfterNationalPrefix:a,metadata:n})}(e,t,{metadata:n,shouldTryNationalPrefixFormattingRule:i,getSeparatorAfterNationalPrefix:a})}(t,a,{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=a,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,i=e.international,a=r.length-3;a<0&&(a=0),this.matchingFormats=this.matchingFormats.filter((function(e){return t.formatSuits(e,i,n)&&t.formatMatches(e,r,a)})),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 i=e.leadingDigitsPatterns()[r];if(t.length<3)try{return void 0!==new Jn(i).match(t,{allowOverflow:!0})}catch(e){return console.error(e),!0}return new RegExp("^(".concat(i,")")).test(t)}},{key:"getFormatFormat",value:function(e,t){return t?e.internationalFormat():e.format()}},{key:"chooseFormat",value:function(e){for(var t,r,n=Qn(this.matchingFormats.slice());!(r=n()).done&&"break"!=(t=r.value,this.chosenFormat===t?"break":ni.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()&&ri.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 Gn(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")+Hn("x",t.callingCode.length)+" "+e:this.template=e}},{key:"getTemplateForFormat",value:function(e,t){var r=t.nationalSignificantNumber,n=t.international,i=t.nationalPrefix,a=t.complexPrefixBeforeNationalSignificantNumber,o=e.pattern();o=o.replace(/\[([^\[\]])*\]/g,"\\d").replace(/\d(?=[^,}][^,}])/g,"\\d");var s=ti.match(o)[0];if(!(r.length>s.length)){var l=RegExp("^"+o+"$"),d=r.replace(/\d/g,"9");l.test(d)&&(s=d);var c,u=this.getFormatFormat(e,n);if(this.shouldTryNationalPrefixFormattingRule(e,{international:n,nationalPrefix:i})){var h=u.replace(tn,e.nationalPrefixFormattingRule());if(Gr(e.nationalPrefixFormattingRule())===(i||"")+Gr("$1")&&(u=h,c=!0,i))for(var p=i.length;p>0;)u=u.replace(/\d/,"x"),p--}var y=s.replace(new RegExp(o),u).replace(/9/g,"x");return c||(a?y=Hn("x",a.length)+" "+y:i&&(y=Hn("x",i.length)+this.getSeparatorAfterNationalPrefix(e)+y)),n&&(y=en(y)),y}}},{key:"formatNextNationalNumberDigits",value:function(e){var t=function(e,t,r){for(var n,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 Wn(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 Wn(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=i()).done;){var a=n.value;if(0>e.slice(t+1).search(Bn))return;t=e.search(Bn),e=e.replace(Bn,a)}return[e,t]}(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,e);if(t)return this.populatedNationalNumberTemplate=t[0],this.populatedNationalNumberTemplatePosition=t[1],Gn(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1);this.resetFormat()}},{key:"shouldTryNationalPrefixFormattingRule",value:function(e,t){var r=t.international,n=t.nationalPrefix;if(e.nationalPrefixFormattingRule()){var i=e.usesNationalPrefix();if(i&&n||!i&&!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 ai(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,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return oi(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 oi(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 oi(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 si=RegExp("^["+wr+vr+"]+$","i"),li="(?:[++]["+wr+vr+"]*|["+wr+vr+"]+)",di=RegExp("[^"+wr+vr+"]+.*$"),ci=/[^\d\[\]]/,ui=function(){var e;function t(e){var r=e.defaultCountry,n=e.defaultCallingCode,i=e.metadata,a=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=i,this.onNationalSignificantNumberChange=a}return e=[{key:"input",value:function(e,t){var r,n,i,a,o,s=(i=(n=ai("+"===(r=function(e){var t,r=e.search(li);if(!(r<0))return"+"===(e=e.slice(r))[0]&&(t=!0,e=e.slice(1)),e=e.replace(di,""),t&&(e="+"+e),e}(e)||"")[0]?[r.slice(1),!0]:[r],2))[0],a=n[1],si.test(i)||(i=""),[i,a]),l=ai(s,2),d=l[0],c=l[1],u=Gr(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=wn("+"+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&&ci.test(t)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(e,t){if(this.hasSelectedNumberingPlan){var r=fn(e,this.metadata),n=r.nationalPrefix,i=r.nationalNumber,a=r.carrierCode;if(i!==e)return this.onExtractedNationalNumber(n,a,i,e,t),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(e,t,r){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(e,r);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var n=fn(e,this.metadata),i=n.nationalPrefix,a=n.nationalNumber,o=n.carrierCode;if(a!==t)return this.onExtractedNationalNumber(i,o,a,e,r),!0}}},{key:"onExtractedNationalNumber",value:function(e,t,r,n,i){var a,o,s=n.lastIndexOf(r);if(s>=0&&s===n.length-r.length){o=!0;var l=n.slice(0,s);l!==e&&(a=l)}i({nationalPrefix:e,carrierCode:t,nationalSignificantNumber:r,nationalSignificantNumberMatchesInput:o,complexPrefixBeforeNationalSignificantNumber:a}),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 i=mn(n,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);return void 0!==i&&i!==n?(e.update({IDDPrefix:n.slice(0,n.length-i.length)}),this.startInternationalNumber(e,{country:void 0,callingCode:void 0}),!0):void 0}}},{key:"fixMissingPlus",value:function(e){if(!e.international){var t=vn(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 hi(e){return(hi="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 pi(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 yi=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 jr(r);var n,i=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,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),2!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(n)||function(e,t){if(e){if("string"==typeof e)return pi(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 pi(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.")}(),a=i[0],o=i[1];this.defaultCountry=a,this.defaultCallingCode=o,this.reset()}return e=[{key:"getCountryAndCallingCode",value:function(e){var t,r;return e&&("object"===hi(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 i=this.state.getNationalDigits();i&&(t=this.formatter.format(i,this.state))}this.formattedOutput=t?this.getFullNumber(t):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var e=this;return this.state=new Dn({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 ii({state:this.state,metadata:this.metadata}),this.parser=new ui({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,i=t,a=r||n;return a&&(i=a+i),i}},{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(En(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,i=e.nationalSignificantNumber;if(t)return this.isInternational()?r?"+"+r+i:"+"+t:n||r?"+"+(n?this.metadata.countryCallingCode():r)+i:void 0}},{key:"getNumber",value:function(){var e=this.state,t=e.nationalSignificantNumber,r=e.carrierCode,n=e.callingCode,i=this._getCountry();if(t&&(i||n)){if(i&&i===this.defaultCountry){var a=new jr(this.metadata.metadata);a.selectNumberingPlan(i);var o=a.numberingPlan.callingCode(),s=this.metadata.getCountryCodesForCallingCode(o);if(s.length>1){var l=Cn(t,{countries:s,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});l&&(i=l)}}var d=new hn(i||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 mi(e){return new jr(e).getCountries()}function fi(e,t,r){if(t[e])return new hn(e,t[e],r)}function gi(e){return yi.call(this,e,lr)}function vi(){return dr(Mr,arguments)}gi.prototype=Object.create(yi.prototype,{}),gi.prototype.constructor=gi;let wi=(e,t)=>function(){return dr(Un,arguments)}(String(e),t),xi=(e,t)=>`+${vi(t)} ${e}`,Ci=e=>`*${e.replaceAll("-","").slice(-4)}`,Ei=function(){return dr(mi,arguments)}().map((e=>({code:e,callCode:vi(e)})));const bi="/api/v1/sessions",Si="/api/v1/sessions/logout",Ai="/api/v1/sessions/fork/recover",ji="/api/v1/oauth/init",$i="/api/v1/oauth/authenticate",Ti="/api/v1/oauth/link",Pi="/api/v1/analytics_events";class _i{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/custom_jwt_account/authenticate",{token:this.meta.token});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){throw Error("Unimplemented")}constructor(e){this.meta={token:e}}}class ki{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new s.PrivyClientError("Email and email code must be set prior to calling authenticate.");try{let e=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"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new s.PrivyClientError("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 s.formatApiError(e)}}async sendCodeEmail(e,t){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.email=e),t&&(this.meta.captchaToken=t),!this.meta.email)throw new s.PrivyClientError("Email must be set when initialzing authentication.");try{return await this.api.post("/api/v1/passwordless/init",{email:this.meta.email,token:this.meta.captchaToken})}catch(e){throw s.formatApiError(e)}}constructor(e,t,r=!1){this.meta={email:e,captchaToken:t,disableSignup:r}}}class Ni extends ki{async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new s.PrivyClientError("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 s.formatApiError(e)}}constructor(e,t,r){super(t,r),this.meta={email:t,captchaToken:r,oldAddress:e,disableSignup:!1}}}const Ii=e=>{let t;try{t=new URL(e).hostname}catch(e){return}for(let[e,r]of Object.entries(Mi))if(t.includes(r.hostname))return{walletClientType:e,entry:r}},Mi={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 Oi(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let Ri="WALLETCONNECT_DEEPLINK_CHOICE";function Fi(e){return e.startsWith("http://")||e.startsWith("https://")}function Li(e,t){if(Fi(e))return Ui(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 Ui(e,t){if(!Fi(e))return Li(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function Di(e,t){window.open(e,t,"noreferrer noopener")}class Wi{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}class Bi{get meta(){return this._meta}async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new s.PrivyClientError("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 s.PrivyClientError("No response from authentication");return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("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 s.formatApiError(e)}}async _startChannelOnce(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");let e=await this.api.post("/api/v1/farcaster/init",{token:this.captchaToken});o.isMobile&&!o.isIOS&&e.connect_uri&&Di(e.connect_uri,"_blank"),this._meta={...this._meta,connectUri:e.connect_uri,channelToken:e.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.channelToken)throw new s.PrivyClientError("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 Wi(this._startChannelOnce.bind(this)),this.pollForReady=new Wi(this._pollForReady.bind(this)),this._meta.disableSignup=t}}function Hi(e){return crypto.getRandomValues(new Uint8Array(e))}class Gi{getOrCreateGuestCredential(e){let t=d.getGuestCredentialStorageKey(e);if(c.e()){if(c.e6.get(t))return c.e6.get(t);{let e=l.base64url.encode(Hi(32));return c.e6.put(t,e),e}}return l.base64url.encode(Hi(32))}async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{let e=await this.api.post("/api/v1/guest/authenticate",{guest_credential:this.meta.guestCredential});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){throw Error("Linking is not supported for the guest flow")}constructor(e){this.meta={guestCredential:this.getOrCreateGuestCredential(e)}}}function qi(){return l.base64url.encode(Hi(36))}function zi(){return qi()}async function Vi(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 l.base64url.encode(t)}}function Ki(){return!!c.e6.get(d.HEADLESS_OAUTH_KEY)}class Yi{addCaptchaToken(e){this.meta.captchaToken=e}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new s.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if("undefined"===this.meta.authorizationCode)throw new s.PrivyClientError("User denied confirmation during OAuth flow");let e=function(){let e=c.e6.get(d.CODE_VERIFIER_KEY);if(!e)throw new s.PrivyClientError("Authentication error.");return e}();try{let t=await this.api.post($i,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"});return c.e6.del(d.CODE_VERIFIER_KEY),c.e6.del(d.HEADLESS_OAUTH_KEY),c.e6.del(d.OAUTH_DISABLE_SIGNUP_KEY),{user:t.user,token:t.token,refresh_token:t.refresh_token,identity_token:t.identity_token,is_new_user:t.is_new_user,oauth_tokens:t.oauth_tokens}}catch(e){let t=s.formatApiError(e);if(t.privyErrorCode)throw new s.PrivyClientError(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new s.PrivyClientError("Invalid code during oauth flow.",void 0,s.PrivyErrorCode.OAUTH_USER_DENIED);throw new s.PrivyClientError("Invalid code during OAuth flow.",void 0,s.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new s.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if("undefined"===this.meta.authorizationCode)throw new s.PrivyClientError("User denied confirmation during OAuth flow");let e=c.e6.get(d.CODE_VERIFIER_KEY);if(!e)throw new s.PrivyClientError("Authentication error.");try{let t=await this.api.post(Ti,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:e});return c.e6.del(d.CODE_VERIFIER_KEY),t}catch(e){throw s.formatApiError(e)}}async getAuthorizationUrl(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.provider)throw new s.PrivyClientError("Provider must be set when initializing OAuth authentication.");let e=qi();c.e6.put(d.CODE_VERIFIER_KEY,e);let t=zi();c.e6.put(d.STATE_CODE_KEY,t);let r=await Vi(e);this.meta.headless&&c.e6.put(d.HEADLESS_OAUTH_KEY,!0),this.meta.disableSignup&&c.e6.put(d.OAUTH_DISABLE_SIGNUP_KEY,!0);try{return await this.api.post(ji,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:r,state_code:t})}catch(e){throw s.formatApiError(e)}}constructor(e){let t="boolean"==typeof e.headless?e.headless:Ki();this.meta={...e,headless:t}}}function Zi(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Xi=({style:t,...r})=>e.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...t},...r,children:[e.jsx("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"}),e.jsx("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"})]}),Ji=({style:t,...r})=>e.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...t},...r,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("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"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"71",height:"55",fill:"white"})})})]}),Qi=({style:t,...r})=>e.jsx("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...t},...r,children:e.jsx("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"})}),ea=({style:t})=>e.jsx(ct.default,{style:{color:"var(--privy-color-error)",...t}}),ta=({style:t,...r})=>e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...r,children:[e.jsx("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"}),e.jsx("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"}),e.jsx("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"}),e.jsx("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 ra(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...t,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"b",children:[e.jsx("stop",{offset:"0",stopColor:"#3771c8"}),e.jsx("stop",{stopColor:"#3771c8",offset:".128"}),e.jsx("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"a",children:[e.jsx("stop",{offset:"0",stopColor:"#fd5"}),e.jsx("stop",{offset:".1",stopColor:"#fd5"}),e.jsx("stop",{offset:".5",stopColor:"#ff543e"}),e.jsx("stop",{offset:"1",stopColor:"#c837ab"})]}),e.jsx("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),e.jsx("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),e.jsx("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),e.jsx("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),e.jsx("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}function na({style:t,...r}){return e.jsx("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",...t},...r,children:e.jsx("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:e.jsx("g",{transform:"scale(5.12,5.12)",children:e.jsx("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 ia(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...t,children:[e.jsx("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),e.jsx("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}function aa(t){return e.jsxs("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,...t,children:[e.jsx("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"}),e.jsx("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"}),e.jsx("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 oa=({style:t,...r})=>e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...t},...r,children:e.jsx("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 sa={google:{name:"Google",component:ta},discord:{name:"Discord",component:Ji},github:{name:"Github",component:Qi},linkedin:{name:"LinkedIn",component:na},twitter:{name:"Twitter",component:oa},spotify:{name:"Spotify",component:ia},instagram:{name:"Instagram",component:ra},tiktok:{name:"Tiktok",component:aa},apple:{name:"Apple",component:Xi}};const la=e=>e in sa?sa[e]:{name:"Unknown",component:ea};function da(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),n=e.get("privy_oauth_provider");if(!t||!r||!n)return{inProgress:!1};let i=!1;try{i=!!window.opener.location.origin}catch{}return{inProgress:!0,authorizationCode:t,stateCode:r,provider:n,headless:Ki(),popupFlow:null!==window.opener&&i,disableSignup:!!c.e6.get(d.OAUTH_DISABLE_SIGNUP_KEY)}}function ca(){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"),c.e6.del(d.STATE_CODE_KEY),window.history.replaceState({},"",e)}class ua{async initAuthenticationFlow(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new s.PrivyClientError("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 s.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new s.PrivyClientError("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));this.meta.setPasskeyAuthState?.({status:"submitting-response"});let r=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)});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(e){if("NotAllowedError"===e.name)throw new s.PrivyClientError("Passkey request timed out or rejected by user.",void 0,s.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw s.formatApiError(e)}}async link(){let e=await import("@simplewebauthn/browser");if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!e.browserSupportsWebAuthn())throw new s.PrivyClientError("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let t=this.meta.initLinkResponse.options,r=await e.startRegistration(this._transformInitLinkOptionsToCamelCase(t));return 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 s.PrivyClientError("Passkey request timed out or rejected by user.",void 0,s.PrivyErrorCode.PASSKEY_NOT_ALLOWED);throw s.formatApiError(e)}}async _initAuthenticateOnce(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");return await this.api.post("/api/v1/passkeys/authenticate/init",{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new s.PrivyClientError("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(e,t){this.initAuthenticateOnce=new Wi(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Wi(this._initLinkOnce.bind(this)),this.meta={captchaToken:e,setPasskeyAuthState:t}}}const ha=({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 pa{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 s.PrivyClientError("SiweFlow has no client instance");try{let{message:e,signature:t}=await this.sign(),r=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"});return{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.client)throw new s.PrivyClientError("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 s.formatApiError(e)}}async sign(){if(!this.client)throw new s.PrivyClientError("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new s.PrivyClientError("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 s.PrivyClientError("SiweFlow has no client instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new s.PrivyClientError("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=ha({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,r,n=!1){this._meta={disableSignup:!1},this.getNonceOnce=new Wi(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class ya{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup}}async authenticate(){if(!this.client)throw new s.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign(),r=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"});return{user:r.user,token:r.token,refresh_token:r.refresh_token,identity_token:r.identity_token,is_new_user:r.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.client)throw new s.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw s.formatApiError(e)}}async sign(){if(!this.client)throw new s.PrivyClientError("SiwsFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new s.PrivyClientError("Could not prepare SIWS message");if(!this.wallet.signMessage)throw new s.PrivyClientError("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 s.PrivyClientError("SiwsFlow has no client instance");return await this.client.generateSiwsNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new s.PrivyClientError("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 Wi(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=r,this.client=t,this._meta.disableSignup=n}}class ma{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new s.PrivyClientError("phone number and sms code must be set prior to calling authenticate.");try{let e=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"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new s.PrivyClientError("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 s.formatApiError(e)}}async sendSmsCode(e,t){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(e&&(this.meta.phoneNumber=e),t&&(this.meta.captchaToken=t),!this.meta.phoneNumber)throw new s.PrivyClientError("phone nNumber must be set when initialzing authentication.");try{return await this.api.post("/api/v1/passwordless_sms/init",{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(e){throw s.formatApiError(e)}}constructor(e,t,r=!1){this.meta={phoneNumber:e,captchaToken:t,disableSignup:r}}}class fa extends ma{async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode||!this.meta.oldPhoneNumber)throw new s.PrivyClientError("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 s.formatApiError(e)}}constructor(e,t,r){super(t,r),this.meta={phoneNumber:t,captchaToken:r,oldPhoneNumber:e,disableSignup:!1}}}const ga=a.createContext({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:s.notImplemented,setError:s.notImplemented,setExecuting:s.notImplemented,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:s.notImplemented,reset:s.notImplemented,execute:s.notImplemented});class va extends s.PrivyError{constructor(e,t,r){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}const wa=({children:t,id:r,captchaSiteKey:n,captchaEnabled:i})=>{let o=a.useRef(null),[l,c]=a.useState(),[u,h]=a.useState(),[p,y]=a.useState(!1),m=a.useMemo((()=>i?p||l||u?!p||l||u?l&&!u?{status:"success",token:l}:u?{status:"error",error:u}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[i,l,u,p]);return e.jsx(ga.Provider,{value:{...m,ref:o,enabled:i,siteKey:n,appId:r,setToken:c,setError:h,setExecuting:y,remove(){i&&(o.current?.remove(),y(!1),h(void 0),c(void 0))},reset(){i&&(o.current?.reset(),y(!1),h(void 0),c(void 0))},execute(){i&&(y(!0),o.current?.execute())},async waitForResult(){if(!i)return"";try{return await d.pollForResult((()=>o.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new va("Captcha failed",null,s.PrivyErrorCode.CAPTCHA_TIMEOUT)}}},children:t})},xa=()=>a.useContext(ga);class Ca{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{let e=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"});return{user:e.user,token:e.token,refresh_token:e.refresh_token,identity_token:e.identity_token,is_new_user:e.is_new_user}}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("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 s.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}}function Ea(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===s.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===s.PrivyErrorCode.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===s.PrivyErrorCode.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===s.PrivyErrorCode.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("rate limit")&&(t.detail="Request limit reached for Telegram. Please wait a moment and try again."),e instanceof va&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function ba(){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)}const Sa=({style:t,...r})=>e.jsxs("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});function Aa(e){return"ethereum"===e.type}function ja(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n?.address!==i?.address||n&&i&&Aa(n)&&Aa(i)&&n?.chainId!==i?.chainId||n?.connectorType!==i?.connectorType||n?.connectedAt!==i?.connectedAt||n?.walletClientType!==i?.walletClientType||n?.isConnected!==i?.isConnected||n?.linked!==i?.linked)return!1}return!0}const $a=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||d.DEFAULT_RPC_TIMEOUT,Ta=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4","csw_signUserOperation"];class Pa{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 s.PrivyConnectorError(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw f.formatConnectorError(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 f.WalletTimeoutError,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||d.DEFAULT_RPC_TIMEOUT,this._subscriptions=[]}}let _a=class extends Error{constructor(e,t,r){super(e),this.code=t,this.data=r}};class ka extends Re.default{async handleSendTransaction(e){if(!e.params||!Array.isArray(e.params))throw new _a(`Invalid params for ${e.method}`,4200);let t=e.params[0];if(!await jg()||!this.address)throw new _a("Disconnected",4900);return(await Pg(t,void 0,void 0,this.address)).hash}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new _a(`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 _a(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.chainId=Number(t),this.provider=d.getJsonRpcProvider(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 $g(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 Tg(d.generateTypedDataWithDomainType(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:d.toHex(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 d.toHex(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=>Ta.includes(e))(e.method))return this.provider.send(e.method,e.params);{let t=await jg();if(await _g(),!t||!this.address)throw new _a("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.rootAddress,accessToken:t,hdWalletIndex:this.walletIndex,request:{method:e.method,params:e.params}})).response.data}catch(e){throw console.error(e),new _a("Disconnected",4900)}}}async connect(){let e=await jg();if(!e||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:e})).address}catch(e){return console.error(e),null}}constructor({walletProxy:e,address:t,rootAddress:r,rpcConfig:n,chains:i,appId:a,chainId:o=1,walletIndex:s}){super(),this.walletProxy=e,this.address=t,this.rootAddress=r,this.chainId=o,this.rpcConfig=n,this.chains=i,this.provider=d.getJsonRpcProvider(o,this.chains,n,{appId:a}),this.rpcTimeoutDuration=$a(n,"privy"),this.appId=a,this.walletIndex=s}}class Na extends Pa{constructor(e){super(e,e.rpcTimeoutDuration)}}class Ia extends Pa{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 Ma;function Oa(e){return"ethereum"===e.chainType}class Ra extends f.WalletConnector{buildConnectedWallet(e,n,i,a){let o=async()=>!!this.wallets.find((r=>t.getAddress(r.address)===t.getAddress(e)));return{type:"ethereum",address:t.getAddress(e),chainId:n,meta:i,imported:a,switchChain:async r=>{let i,a;if(!o)throw new s.PrivyConnectorError("Wallet is not currently connected.");let l=this.wallets.find((r=>t.getAddress(r.address)===t.getAddress(e)))?.chainId;if(!l)throw new s.PrivyConnectorError("Unable to determine current chainId.");if("number"==typeof r?(i=`0x${r.toString(16)}`,a=r):(i=r,a=Number(r)),l===d.formatChainIdToCAIP2(i))return;let c=this.chains.find((e=>e.id===a));if(!c)throw new s.PrivyConnectorError(`Unsupported chainId: ${r}`);let u=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})};try{return await u()}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:i,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:[c.rpcUrls.default?.http[0]??""],blockExplorerUrls:[c.blockExplorers?.default.url??""]}]}),u();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new s.PrivyConnectorError(`Rainbow does not support the chainId ${n}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:o,getEthereumProvider:async()=>{if(!await o())throw new s.PrivyConnectorError("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await o())throw new s.PrivyConnectorError("Wallet is not currently connected.");return new r.Web3Provider(new Na(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await o())throw new s.PrivyConnectorError("Wallet is not currently connected.");return new Ia(this.proxyProvider)},sign:async e=>{if(!await o())throw new s.PrivyConnectorError("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let r,n=e;try{if(void 0===n){let e=await d.invokeUntilSettled((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(n=e)}}catch(e){console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let i=n[0],a=t.getAddress(i),o=[];if("privy"===this.walletClientType){let e=c.e6.get(d.getPrivyWalletKey(a));this.chains.find((t=>t.id===Number(e)))||(c.e6.del(d.getPrivyWalletKey(a)),e=null),r=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${r} on initialization`)}}else try{let e=await d.invokeUntilSettled((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)r=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");r=`0x${e.toString(16)}`}}catch(e){console.warn(`Failed to get chainId from provider, defaulting to ${d.DEFAULT_NETWORK}`,e),r=d.DEFAULT_NETWORK}let s=d.formatChainIdToCAIP2(r);if(!o.find((e=>t.getAddress(e.address)===a))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};o.push(this.buildConnectedWallet(t.getAddress(i),s,e,"embedded_imported"===this.connectorType))}ja(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((r=>e.find((e=>t.getAddress(e)===t.getAddress(r.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 r.Web3Provider(new Na(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=d.formatChainIdToCAIP2(e),"privy"===this.walletClientType&&c.e6.put(d.getPrivyWalletKey(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=$a(n,e),this.connected=!1,this.initialized=!1}}let Fa=[1,11155111,137,10,8453,84532,42161,7777777,43114,56],La=(e,t)=>e.makeWeb3Provider({options:t});class Ua extends Ra{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:Sa,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 s.PrivyConnectorError("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([e[0]])}catch(e){throw f.formatConnectorError(e)}}updateConnectionPreference(e){this.connectionOptions=e,this.walletClientType="smartWalletOnly"===e?"coinbase_smart_wallet":"coinbase_wallet",this.proxyProvider.setWalletProvider(La(Ma,this.connectionOptions))}constructor(e,t,r,n,i,a){if(super("coinbase_wallet",e,t,r),this.connectorType="coinbase_wallet",this.displayName="Coinbase Wallet",this.proxyProvider=new Pa(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"),!Ma){let r=[t.id].concat(e.map((e=>e.id))),n="eoaOnly"!==this.connectionOptions?r.filter((e=>!Fa.includes(e))):[];n.length>0&&!n.every((e=>d.DEFAULT_SUPPORTED_CHAIN_IDS.has(e)))&&console.info(`The configured chains are not supported by Coinbase Smart Wallet: ${n.join(", ")}`),Ma=new m.CoinbaseWalletSDK({appName:i,appLogoUrl:a,appChainIds:r})}this.proxyProvider.setWalletProvider(La(Ma,this.connectionOptions))}}const Da=({...t})=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:t.color||"var(--privy-color-foreground-3)"})});class Wa extends Ra{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:[d.toHex(e?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Da,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}constructor({provider:e,chains:t,defaultChain:r,rpcConfig:n,imported:i,walletIndex:a}){super("privy",t,r,n),this.connectorType="embedded",this.proxyProvider=e,this.walletIndex=a,i&&(this.connectorType="embedded_imported"),this.subscribeListeners()}}const Ba=({style:t,...r})=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...t},...r,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),Ha=({style:t,...r})=>e.jsxs("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",...t},...r,children:[e.jsx("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),e.jsx("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),e.jsx("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),e.jsx("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),e.jsx("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),e.jsx("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),e.jsx("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),e.jsx("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),e.jsx("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),e.jsx("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),e.jsx("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),e.jsx("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),e.jsx("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]}),Ga=({style:t,...r})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});function qa(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var za=0;class Va extends Ra{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 s.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw f.formatConnectorError(e)}}constructor(e,t,r,n,i){super(i||"unknown",e,t,r),this.connectorType="injected",this.proxyProvider=new Pa(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=n;let a=n.provider;this.proxyProvider.setWalletProvider(a)}}var Ka="__private_"+za+++"__walletBranding";class Ya extends Ra{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 qa(this,Ka)[Ka]??{name:"Browser Extension",icon:Ba,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 s.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw f.formatConnectorError(e)}}constructor(e,t,r,n,i){super(i??"unknown",e,t,r),Object.defineProperty(this,Ka,{writable:!0,value:void 0}),this.connectorType="injected",this.proxyProvider=new Pa(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(n),"metamask"===i?qa(this,Ka)[Ka]={name:"MetaMask",icon:Ha,id:"io.metamask"}:"phantom"===i&&(qa(this,Ka)[Ka]={name:"Phantom",icon:Ga,id:"phantom"})}}class Za extends Va{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{o.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let e=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!e||0===e.length||!e[0])throw new s.PrivyConnectorError("Unable to retrieve accounts");await this.syncAccounts([e[0]])}catch(e){throw f.formatConnectorError(e)}}}class Xa extends Ra{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 Pa(void 0,d.DEFAULT_RPC_TIMEOUT),this.connectorType=e}}class Ja extends Xa{get walletBranding(){return{name:"Phantom",icon:Ga,id:"phantom"}}constructor(e){super("phantom",e)}}const Qa=({style:t,...r})=>{let{app:n}=v.usePrivyModal();return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"dark"===n?.appearance.palette.colorScheme?"#3396ff":"#141414"}),e.jsx("g",{clipPath:"url(#clip0_1765_9946)",children:e.jsx("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_1765_9946",children:e.jsx("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};class eo extends Ra{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=Ii(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:Ha,id:"io.metamask"}:{name:d.stripEmoji(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Qa,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=Mi[e],this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(Ri)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{this.onQrModalClosed=()=>{t(new f.UserRejectedConnectionError)},(async()=>{let t="",r=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(r?.length&&(t=r[0]),!t||""===t)throw new s.PrivyConnectorError("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let e=Ii(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=e?.entry,this.walletClientType=e?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=$a(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(r),e()})().catch((e=>{t(e?f.formatConnectorError(e):new s.PrivyConnectorError("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=d.getJsonRpcEndpoint(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 g.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:r,optionalEvents:g.OPTIONAL_EVENTS,optionalMethods:g.OPTIONAL_METHODS,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(),o.isMobile&&this.walletEntry){let{redirect:t,href:r}=function(e,t){let r=Oi(t);if(r.deepLink)return Li(r.deepLink,e);if(r.universalLink)return Ui(r.universalLink,e);throw new s.PrivyClientError(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);(function({href:e,name:t}){try{localStorage.setItem(Ri,JSON.stringify({href:e,name:t}))}catch{}})({href:r,name:this.walletEntry.displayName}),this.redirectUri=t;let n=function(e,t){let r=Oi(t);if(r.universalLink)return Ui(r.universalLink,e)}(e,this.walletEntry);n?.redirect&&(this.fallbackUniversalRedirectUri=n.redirect),Di(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=Ii(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,i,a,o,s){super(s||"unknown",r,n,t),this.connectorType="wallet_connect_v2",this.privyAppId=a,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new Pa(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Mi[s],this.walletClientType=s)}}const to=e=>{let r=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>p.isHexString(e))).map((e=>t.getAddress(e)));return!!r?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&r.includes(e.address))).length};class ro extends Re.default{get wallets(){let e=new Set,t=this.walletConnectors.flatMap((e=>e.wallets)).sort(((e,t)=>e.connectedAt&&t.connectedAt?t.connectedAt-e.connectedAt:0)).filter((t=>{let r=`${t.address}${t.walletClientType}${t.connectorType}`;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;c.e6.get(d.CONNECTORS_STATE_KEY)&&(c.e6.getKeys().forEach((e=>{e.startsWith("walletconnect")&&c.e6.del(e)})),c.e6.del(d.CONNECTORS_STATE_KEY));let e=d.detectInjectedConnectors(this.store,this.walletList,this.externalWalletConfig).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"),!d.isPhantomInstalled()&&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(Oa).find((t=>t.connectorType===e))??null:this.walletConnectors.filter(Oa).find((r=>r.connectorType===e&&r.walletClientType===t))??null}findSolanaWalletConnector(e,t){return this.walletConnectors.filter(f.isSolanaWalletConnector).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:i}){for(let a of r){let r=this.findEmbeddedWalletConnectors().find((e=>e.walletIndex===a.walletIndex));if(r&&Oa(r))r.proxyProvider.walletProxy=e;else{let r=new Wa({provider:new ka({walletProxy:e,address:a.address,rootAddress:t.address,rpcConfig:this.rpcConfig,chains:this.chains,appId:i,chainId:n.id,walletIndex:a.walletIndex}),chains:this.chains,defaultChain:n,rpcConfig:this.rpcConfig,imported:!1,walletIndex:a.walletIndex});this.addWalletConnector(r)}}}addImportedWalletConnector(e,t,r,n){let i=this.findWalletConnector("embedded_imported","privy");if(i&&Oa(i))i.proxyProvider.walletProxy=e;else{let i=new Wa({provider:new ka({walletProxy:e,rootAddress:t,address:t,walletIndex:0,rpcConfig:this.rpcConfig,chains:this.chains,appId:n,chainId:r.id}),chains:this.chains,walletIndex:0,defaultChain:r,rpcConfig:this.rpcConfig,imported:!0});this.addWalletConnector(i)}}removeEmbeddedWalletConnectors(){this.walletConnectors=this.walletConnectors.filter((e=>"embedded"!==e.connectorType)),this.saveConnectionHistory(),this.storedConnections=no(),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=no(),this.emit("walletsUpdated")}}async createEthereumWalletConnector(e,t,r){let n=this.findWalletConnector(e,t);if(n&&Oa(n))return n instanceof eo&&n.resetConnection(t),n;let i=(()=>"injected"!==e?"coinbase_wallet"===e?new Ua(this.chains,this.defaultChain,this.rpcConfig,this.externalWalletConfig,this.privyAppName,this.privyAppLogo):"phantom"===e?new Ja(this.defaultChain):new eo(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,this.privyAppName,t):"metamask"===t&&r?.eip6963InjectedProvider?new Za(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,"metamask"):"metamask"===t&&r?.legacyInjectedProvider?new Ya(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"metamask"):"phantom"===t&&r?.legacyInjectedProvider&&"solana-only"!==this.walletChainType?new Ya(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider,"phantom"):r?.legacyInjectedProvider&&"unknown_browser_extension"===t?new Ya(this.chains,this.defaultChain,this.rpcConfig,r?.legacyInjectedProvider):r?.eip6963InjectedProvider?new Va(this.chains,this.defaultChain,this.rpcConfig,r?.eip6963InjectedProvider,t):void 0)();return i&&this.addWalletConnector(i),i||null}addWalletConnector(e){this.walletConnectors.push(e),e.on("initialized",(()=>this.onInitialized(e))),e.on("walletsUpdated",(()=>this.onWalletsUpdated(e))),e.initialize().catch((e=>{console.debug("Failed to initialize connector",e)}))}saveConnectionHistory(){let e=this.wallets.map((e=>({address:e.address,connectorType:e.connectorType,walletClientType:e.walletClientType,connectedAt:e.connectedAt})));c.e6.put(d.CONNECTIONS_HISTORY_KEY,e)}async activeWalletSign(e){let t=this.wallets,r=t.length>0?t[0]:null;return r&&Aa(r)?r.sign(e):null}setActiveWallet(e){this.activeWallet=t.getAddress(e),this.emit("walletsUpdated")}constructor(e,t,r,n,i,a,o,s,l,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 Pa},this.privyAppId=e,this.walletConnectCloudProjectId=t,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=a,this.walletList=o,this.shouldEnforceDefaultChainOnConnect=s,this.externalWalletConfig=l,this.privyAppName=d,this.privyAppLogo=u,this.walletChainType=c,this.storedConnections=no()}}const no=()=>{let e=c.e6.get(d.CONNECTIONS_HISTORY_KEY);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 io=[bi,Ai,Si,Pi];class ao{async get(e,t){try{return await this.baseFetch(e,t)}catch(e){throw s.formatApiError(e)}}async post(e,t,r){try{return await this.baseFetch(e,{method:"POST",...t?{body:t}:{},...r})}catch(e){throw s.formatApiError(e)}}async delete(e,t){try{return await this.baseFetch(e,{method:"DELETE",...t})}catch(e){throw s.formatApiError(e)}}constructor({appId:e,appClientId:t,client:r,defaults:n}){this.appId=e,this.appClientId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=d.VERSION,this.client=r,this.defaults=n,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=w.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:e,options:t})=>{let r=new Headers(t.headers);r.set("privy-app-id",this.appId),this.appClientId&&r.set("privy-client-id",this.appClientId),r.set("privy-ca-id",this.clientAnalyticsId||""),r.set("privy-client",`react-auth:${this.sdkVersion}`);let n=io.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 s.PrivyTimeoutError}})}}function oo(){return!(o.isSafari&&window.location.origin.startsWith("http://localhost"))}class so{static parse(e){try{return new so(e)}catch(e){return null}}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=Oe.decodeJwt(e)}}class lo{get token(){try{let e=c.e6.get(d.TOKEN_STORAGE_KEY);return"string"==typeof e?new so(e).value:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get refreshToken(){try{let e=c.e6.get(d.REFRESH_TOKEN_STORAGE_KEY);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}get forkedToken(){try{let e=c.e6.get(d.FORKED_TOKEN_STORAGE_KEY);return"string"==typeof e?e:null}catch(e){return console.error(e),this.destroyLocalState(),null}}getProviderAccessToken(e){try{let t=c.e6.get(d.getProviderAccessTokenStorageKey(e));if("string"!=typeof t)return null;{let r=new so(t);return r.isExpired()?(c.e6.del(d.getProviderAccessTokenStorageKey(e)),null):r.value}}catch(e){return console.error(e),null}}get mightHaveServerCookies(){try{let e=Fe.default.get(d.SESSION_COOKIE_KEY);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||"string"==typeof this.token&&"string"==typeof this.refreshToken&&this.refreshToken!==d.DEPRECATED_REFRESH_TOKEN}hasRecoveryCredentials(){return"string"==typeof this.forkedToken}hasActiveToken(){let e=so.parse(this.token);return null!==e&&!e.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?c.e6.put(d.getProviderAccessTokenStorageKey(e),t):c.e6.del(d.getProviderAccessTokenStorageKey(e))}async _authenticate(e){try{let t=await e.authenticate(),{user:r,is_new_user:n,oauth_tokens:i}=t;this.handleTokenResponse(t);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,refreshTokenExpiresInSeconds:i.refresh_token_expires_in_seconds,scopes:i.scopes}:void 0,o=function(e){return e instanceof ki?"email":e instanceof ma?"sms":e instanceof pa?"siwe":e instanceof Gi?"guest":e instanceof _i?"custom_auth":e instanceof Yi?e.meta.provider:null}(e);return o&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:o,isNewUser:n}}),"siwe"===o&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:e.meta.connectorType,walletClientType:e.meta.walletClientType}}),{user:h.convertUserResponseToUser(r),isNewUser:n,oAuthTokens:a}}catch(e){throw console.warn("Error authenticating session"),s.formatPrivyError(e)}}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:h.convertUserResponseToUser(t),oAuthTokens:n}}catch(e){throw console.warn("Error linking account"),s.formatPrivyError(e)}}async _refresh(){if(!this.api)throw new s.PrivyClientError("Session has no API instance");if(!this.client)throw new s.PrivyClientError("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 i={};e&&(i.authorization=`Bearer ${e}`),n=await this.api.post(bi,t?{refresh_token:t}:{},{headers:i}),r&&this.clearForkedToken()}else{if(!r)return null;n=await this.api.post(Ai,{refresh_token:r}),this.clearForkedToken()}return this.handleTokenResponse(n),h.convertUserResponseToUser(n.user)}catch(e){if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN)return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw s.formatPrivyError(e)}}handleTokenResponse(e){e.session_update_action?"set"===e.session_update_action?(this.storeRefreshToken(e.refresh_token),this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token)):"clear"===e.session_update_action?this.destroyLocalState():"ignore"===e.session_update_action&&e.token&&(this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token)):(this.storeRefreshToken(e.refresh_token),this.storeToken(e.token),e.identity_token&&this.storeIdentityToken(e.identity_token))}async _destroy(){try{await(this.api?.post(Si,{refresh_token:this.refreshToken}))}catch(e){console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new s.PrivyClientError("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.storeToken(t.token),t.new_session_refresh_token}catch(e){throw s.formatPrivyError(e)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearIdentityToken(),this.clearForkedToken()}storeToken(e){if("string"==typeof e){let t=c.e6.get(d.TOKEN_STORAGE_KEY);if(c.e6.put(d.TOKEN_STORAGE_KEY,e),!this.client?.useServerCookies){let t=so.parse(e)?.expiration;Fe.default.set(d.TOKEN_COOKIE_KEY,e,{sameSite:"Strict",secure:oo(),expires:t?new Date(1e3*t):void 0})}t!==e&&this.client?.onStoreToken?.(e)}else c.e6.del(d.TOKEN_STORAGE_KEY),Fe.default.remove(d.TOKEN_COOKIE_KEY),this.client?.onDeleteToken?.()}storeRefreshToken(e){"string"==typeof e?(c.e6.put(d.REFRESH_TOKEN_STORAGE_KEY,e),this.client?.useServerCookies||Fe.default.set(d.SESSION_COOKIE_KEY,"t",{sameSite:"Strict",secure:oo(),expires:30})):(c.e6.del(d.REFRESH_TOKEN_STORAGE_KEY),Fe.default.remove(d.REFRESH_TOKEN_COOKIE_KEY),Fe.default.remove(d.SESSION_COOKIE_KEY))}storeIdentityToken(e){if(this.client?.useServerCookies)return;c.e6.put(d.IDENTITY_TOKEN_STORAGE_KEY,e);let t=so.parse(e)?.expiration;Fe.default.set(d.IDENTITY_TOKEN_COOKIE_KEY,e,{sameSite:"Strict",secure:oo(),expires:t?new Date(1e3*t):void 0})}clearIdentityToken(){c.e6.del(d.IDENTITY_TOKEN_STORAGE_KEY),Fe.default.remove(d.IDENTITY_TOKEN_COOKIE_KEY)}clearForkedToken(){c.e6.del(d.FORKED_TOKEN_STORAGE_KEY)}constructor(){this.authenticateOnce=new Wi((async e=>this._authenticate(e))),this.linkOnce=new Wi((async e=>this._link(e))),this.refreshOnce=new Wi(this._refresh.bind(this)),this.destroyOnce=new Wi(this._destroy.bind(this)),this.forkSessionOnce=new Wi(this._forkSession.bind(this))}}let co;var uo=0,ho="__private_"+uo+++"__getOrGenerateClientAnalyticsId";class po{initializeConnectorManager({walletConnectCloudProjectId:e,rpcConfig:t,chains:r,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:o,externalWalletConfig:s,appName:l,walletChainType:d}){this.connectors||(this.connectors=new ro(this.appId,e,t,r,n,i,a,o,s,l,d,void 0))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let e=new ao({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 s.PrivyClientError("No auth flow in progress.");return this.session.authenticate(this.authFlow)}async link(){if(!this.authFlow)throw new s.PrivyClientError("No auth flow in progress.");let{oAuthTokens:e}=await this.session.link(this.authFlow);return{user:await this.getAuthenticatedUser(),oAuthTokens:e}}storeProviderAccessToken(e,t){this.session.storeProviderAccessToken(e,t)}getProviderAccessToken(e){return this.session.getProviderAccessToken(e)}async logout(){await this.session.destroy(),this.authFlow=void 0}clearProviderAcccessTokens(e){e.linkedAccounts.filter((e=>"cross_app"===e.type)).forEach((e=>{this.storeProviderAccessToken(e.providerApp.id,null)}))}startAuthFlow(e){return e.api=this.api,this.authFlow=e,this.authFlow}async initMfaSmsVerification(){try{await this.api.post("/api/v1/mfa/passwordless_sms/init",{action:"verify"})}catch(e){throw s.formatApiError(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 s.formatApiError(e)}}async acceptTerms(){try{let e=await this.api.post("/api/v1/users/me/accept_terms",{});return h.convertUserResponseToUser(e)}catch(e){throw s.formatPrivyError(e)}}async unlinkEmail(e){try{let t=await this.api.post("/api/v1/passwordless/unlink",{address:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkPhone(e){try{let t=await this.api.post("/api/v1/passwordless_sms/unlink",{phoneNumber:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkEthereumWallet(e){try{let t=await this.api.post("/api/v1/siwe/unlink",{address:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkSolanaWallet(e){try{let t=await this.api.post("/api/v1/siws/unlink",{address:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkOAuth(e,t){try{let r=await this.api.post("/api/v1/oauth/unlink",{provider:e,subject:t});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(r)}catch(e){throw s.formatPrivyError(e)}}async unlinkFarcaster(e){try{let t=await this.api.post("/api/v1/farcaster/unlink",{fid:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkTelegram(e){try{let t=await this.api.post("/api/v1/telegram/unlink",{telegram_user_id:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async unlinkPasskey(e){try{let t=await this.api.post("/api/v1/passkeys/unlink",{credential_id:e});return await this.getAuthenticatedUser()??h.convertUserResponseToUser(t)}catch(e){throw s.formatPrivyError(e)}}async createAnalyticsEvent({eventName:e,payload:t,timestamp:r,options:n}){if("undefined"!=typeof window)try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Pi,{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 s.formatPrivyError(e)}}async initCoinbaseOnRamp(e){try{return this.api.post("/api/v1/funding/coinbase_on_ramp/init",e)}catch(e){throw s.formatPrivyError(e)}}async getCoinbaseOnRampStatus({partnerUserId:e}){try{return this.api.get(`/api/v1/funding/coinbase_on_ramp/status?partnerUserId=${e}`)}catch(e){throw s.formatPrivyError(e)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(e){return this.session.hasActiveToken()?this.session.hasRefreshCredentials()?so.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:(this.session.destroyLocalState(),null):!e?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):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})))}:{enabled:r.enabled}}catch(e){throw s.formatPrivyError(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,i=r.funding_config?{methods:r.funding_config.methods,defaultRecommendedAmount:r.funding_config.default_recommended_amount,defaultRecommendedCurrency:r.funding_config.default_recommended_currency,promptFundingOnWalletCreation:r.funding_config.prompt_funding_on_wallet_creation}: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,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,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:i}}catch(e){throw s.formatPrivyError(e)}}async getUsdTokenPrice(e){try{return(await this.api.get(`/api/v1/token_price?chainId=${e.id}&tokenSymbol=${e.nativeCurrency.symbol}`)).usd}catch(t){return void console.error(`Unable to fetch token price for chain with id ${e.id}`)}}async getUsdPriceForSol(){try{return(await this.api.get("/api/v1/token_price?chainId=0&tokenSymbol=SOL")).usd}catch(e){return void console.error("Unable to fetch token price for SOL")}}async 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 s.formatPrivyError(e)}}async authenticateWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a}){return await this.api.post("/api/v1/siwe/authenticate",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i,mode:a})}async linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){return await this.api.post("/api/v1/siwe/link",{message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})}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 h.convertUserResponseToUser(n)}catch(e){throw s.formatPrivyError(e)}}async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){try{let a=await this.linkWithSiweInternal({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i});return h.convertUserResponseToUser(a)}catch(e){throw s.formatPrivyError(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 s.formatPrivyError(e)}}async authenticateWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n,mode:i}){return await this.api.post("/api/v1/siws/authenticate",{message:e,signature:t,walletClientType:r,connectorType:n,mode:i})}async sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o}){try{let s,l;switch(r){case"email":s="/api/v1/passwordless/transfer",l={nonce:e,email:t};break;case"sms":s="/api/v1/passwordless_sms/transfer",l={nonce:e,phoneNumber:t};break;case"siwe":if(s="/api/v1/siwe/transfer",!n)throw Error("Wallet parameters must be defined");l={nonce:e,address:t,...n};break;case"farcaster":s="/api/v1/farcaster/transfer",l={nonce:e,farcaster_id:t,farcaster_embedded_address:a};break;case"telegram":s="/api/v1/telegram/transfer",l={nonce:e,telegram_auth_result:i};break;case"custom":case"guest":case"passkey":throw Error("Invalid transfer account type");default:s="/api/v1/oauth/transfer",l={nonce:e,userInfo:o}}let d=await this.api.post(s,l);return await this.getAuthenticatedUser()??h.convertUserResponseToUser(d)}catch(e){throw s.formatPrivyError(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 i=await this.linkWithSiwsInternal({message:e,signature:t,walletClientType:r,connectorType:n});return h.convertUserResponseToUser(i)}catch(e){throw s.formatPrivyError(e)}}constructor(e){Object.defineProperty(this,ho,{value:yo}),this.apiUrl=e.apiUrl||d.DEFAULT_PRIVY_API_URL,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!!e.apiUrl&&e.apiUrl.startsWith("https://privy."),this.timeout=e.timeout||d.DEFAULT_API_TIMEOUT_MS,this.appId=e.appId,this.appClientId=e.appClientId,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,ho)[ho](),co||(co=new lo),this.session=co,this.api=this.generateApi(),this.session.client=this}}function yo(){if("undefined"==typeof window)return null;try{let e=c.e6.get(d.CLIENT_ANALYTICS_ID_KEY);if("string"==typeof e&&e.length>0)return e}catch(e){}let e=u.v4();try{return c.e6.put(d.CLIENT_ANALYTICS_ID_KEY,e),e}catch(t){return e}}const mo=t=>{let{enabled:r,siteKey:n,appId:i,setError:o,setToken:s,setExecuting:l,ref:d}=xa(),[,c]=a.useMemo((()=>n?.split("t:")||[]),[n]);if(a.useEffect((()=>d.current?.remove),[]),!r)return null;if(!c)throw Error("Unsupported captcha site key");return e.jsx("div",{className:"hidden h-0 w-0",children:e.jsx(C.Turnstile,{...t,ref:d,siteKey:c,options:{action:i,size:"invisible",...t.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{t.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{t.onError?.(),o("Captcha failed"),l(!1)},onSuccess:e=>{t.onSuccess?.(e),s(e),l(!1)},onExpire:()=>{t.onExpire?.();try{d.current?.reset(),o(void 0),s(void 0)}catch(e){o("expired_and_failed_reset")}}})})};function fo(e){h.usePrivyEventSubscription("configureMfa",e)}const go=({success:t,fail:r})=>e.jsxs(e.Fragment,{children:[e.jsx(vo,{className:t?"success":r?"fail":""}),e.jsx(wo,{className:t?"success":r?"fail":""})]}),vo=E.styled.span`
2
2
  && {
3
3
  width: 82px;
4
4
  height: 82px;
@@ -924,7 +924,7 @@
924
924
  justify-content: center;
925
925
  gap: 24px;
926
926
  width: 100%;
927
- `;const wl=({icon:t,name:r})=>"string"==typeof t?e.jsx("img",{alt:`${r||"wallet"} logo`,src:t,style:{height:24,width:24,borderRadius:4}}):t?e.jsx(t,{}):null,xl={coinbase_wallet:{logo:Sa,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:Sa,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Wa,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Ba,displayName:"Phantom"},rainbow:{logo:({style:t,...r})=>e.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("g",{clipPath:"url(#clip0_5_32)",children:e.jsxs("g",{clipPath:"url(#clip1_5_32)",children:[e.jsx("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:e.jsx("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),e.jsx("g",{mask:"url(#mask0_5_32)",children:e.jsx("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),e.jsx("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),e.jsx("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),e.jsx("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),e.jsx("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),e.jsx("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),e.jsx("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),e.jsx("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),e.jsx("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),e.jsx("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#174299"}),e.jsx("stop",{offset:"1",stopColor:"#001E59"})]}),e.jsxs("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[e.jsx("stop",{offset:"0.770277",stopColor:"#FF4000"}),e.jsx("stop",{offset:"1",stopColor:"#8754C9"})]}),e.jsxs("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FF4000"}),e.jsx("stop",{offset:"1",stopColor:"#8754C9"})]}),e.jsxs("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8754C9"}),e.jsx("stop",{offset:"1",stopColor:"#FF4000"})]}),e.jsxs("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[e.jsx("stop",{offset:"0.723929",stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[e.jsx("stop",{offset:"0.59513",stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsxs("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[e.jsx("stop",{stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsxs("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[e.jsx("stop",{stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsx("clipPath",{id:"clip0_5_32",children:e.jsx("rect",{width:"120",height:"120",fill:"white"})}),e.jsx("clipPath",{id:"clip1_5_32",children:e.jsx("rect",{width:"120",height:"120",fill:"white"})})]})]}),displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Xa,displayName:"WalletConnect"},zerion:{logo:({style:t,...r})=>e.jsxs("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsxs("g",{clipPath:"url(#clip0_1704_1423)",children:[e.jsx("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_1704_1423",children:e.jsx("rect",{width:"176",height:"176",fill:"white"})})})]}),displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:({...t})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...t,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0",stopColor:"#f1562b"}),e.jsx("stop",{offset:"0.3",stopColor:"#f1542b"}),e.jsx("stop",{offset:"0.41",stopColor:"#f04d2a"}),e.jsx("stop",{offset:"0.49",stopColor:"#ef4229"}),e.jsx("stop",{offset:"0.5",stopColor:"#ef4029"}),e.jsx("stop",{offset:"0.56",stopColor:"#e83e28"}),e.jsx("stop",{offset:"0.67",stopColor:"#e13c26"}),e.jsx("stop",{offset:"1",stopColor:"#df3c26"})]})}),e.jsx("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),e.jsx("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]}),displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:({style:t,...r})=>e.jsxs("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),e.jsx("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),e.jsxs("g",{mask:"url(#mask0_16909_31415)",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#002D72"}),e.jsx("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),e.jsxs("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),e.jsx("stop",{offset:"1",stopColor:"#002D72"})]})]})]}),displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:({style:t,...r})=>e.jsxs("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),e.jsxs("g",{children:[e.jsx("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),e.jsx("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),e.jsx("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),e.jsx("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),e.jsx("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),e.jsx("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),e.jsx("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]}),displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:t=>e.jsxs("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),e.jsx("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),e.jsx("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"white"}),e.jsx("stop",{offset:"1",stopColor:"white"})]}),e.jsxs("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8697FF"}),e.jsx("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8697FF"}),e.jsx("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"white"}),e.jsx("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]}),displayName:"Rabby Wallet",rdns:"io.rabby.wallet"},safe:{displayName:"Safe",logo:({style:t,...r})=>e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"#12FF80"}),e.jsx("path",{d:"M22.5151 13.9979H20.4244C19.7981 13.9979 19.2945 14.5058 19.2945 15.128V18.163C19.2945 18.7894 18.7866 19.2931 18.1645 19.2931H9.8398C9.21344 19.2931 8.70981 19.8011 8.70981 20.4233V22.5185C8.70981 23.145 9.21767 23.6487 9.8398 23.6487H18.6427C19.2691 23.6487 19.7642 23.1407 19.7642 22.5185V20.8423C19.7642 20.2159 20.2721 19.7757 20.8942 19.7757H22.5151C23.1415 19.7757 23.6451 19.2677 23.6451 18.6455V15.1196C23.6451 14.4889 23.1373 13.9979 22.5151 13.9979Z",fill:"black"}),e.jsx("path",{d:"M8.7098 9.84127C8.7098 9.21481 9.21766 8.71111 9.83978 8.71111H18.156C18.7823 8.71111 19.286 8.20317 19.286 7.58095V5.48995C19.286 4.86349 18.7781 4.35979 18.156 4.35979H9.35732C8.73096 4.35979 8.22733 4.86772 8.22733 5.48995V7.10264C8.22733 7.7291 7.71947 8.2328 7.09734 8.2328H5.48912C4.86276 8.2328 4.35913 8.74074 4.35913 9.36296V12.8931C4.35913 13.5196 4.86699 13.9979 5.49335 13.9979H7.58404C8.2104 13.9979 8.71403 13.4899 8.71403 12.8677L8.7098 9.84127Z",fill:"black"}),e.jsx("path",{d:"M13.0139 11.8011H15.0242C15.6802 11.8011 16.2092 12.3344 16.2092 12.9862V14.9968C16.2092 15.6529 15.6759 16.182 15.0242 16.182H13.0139C12.3579 16.182 11.8289 15.6487 11.8289 14.9968V12.9862C11.8289 12.3302 12.3621 11.8011 13.0139 11.8011Z",fill:"black"})]})},universal_profile:{displayName:"Universal Profile",logo:({style:t,...r})=>e.jsxs("svg",{fill:"none",height:"1024",width:"1024",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsxs("filter",{id:"a","color-interpolation-filters":"sRGB",filterUnits:"userSpaceOnUse",height:"1228",width:"1244",x:"-72",y:"-72",children:[e.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"BackgroundImageFix",mode:"normal",result:"shape"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"-72",dy:"-72"}),e.jsx("feGaussianBlur",{stdDeviation:"54"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),e.jsx("feBlend",{in2:"shape",mode:"normal",result:"effect1_innerShadow_3981_20791"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"152",dy:"132"}),e.jsx("feGaussianBlur",{stdDeviation:"74"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.15 0"}),e.jsx("feBlend",{in2:"effect1_innerShadow_3981_20791",mode:"normal",result:"effect2_innerShadow_3981_20791"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"32",dy:"20"}),e.jsx("feGaussianBlur",{stdDeviation:"50"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"}),e.jsx("feBlend",{in2:"effect2_innerShadow_3981_20791",mode:"normal",result:"effect3_innerShadow_3981_20791"})]}),e.jsxs("filter",{id:"b","color-interpolation-filters":"sRGB",filterUnits:"userSpaceOnUse",height:"352",width:"747",x:"142",y:"352",children:[e.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"BackgroundImageFix",mode:"normal",result:"shape"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"8",dy:"12"}),e.jsx("feGaussianBlur",{stdDeviation:"5"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.120833 0 0 0 0 0.120833 0 0 0 0 0.120833 0 0 0 0.69 0"}),e.jsx("feBlend",{in2:"shape",mode:"normal",result:"effect1_innerShadow_3981_20791"})]}),e.jsxs("linearGradient",{id:"c",gradientUnits:"userSpaceOnUse",x1:"0",x2:"1024",y1:"0",y2:"1024",children:[e.jsx("stop",{offset:"0","stop-color":"#8992d1"}),e.jsx("stop",{offset:"1","stop-color":"#646c9f"})]}),e.jsx("clipPath",{id:"d",children:e.jsx("path",{d:"m0 0h1024v1024h-1024z"})}),e.jsxs("g",{"clip-path":"url(#d)",children:[e.jsx("g",{filter:"url(#a)",children:e.jsx("rect",{fill:"url(#c)",height:"1024",rx:"230",width:"1024"})}),e.jsxs("g",{fill:"#fff",filter:"url(#b)",children:[e.jsx("path",{d:"m212.459 354h-54.459c-8.837 0-16 7.163-16 16v203c0 66.826 54.174 121 121 121h44c66.826 0 121-54.174 121-121v-203c0-8.837-7.163-16-16-16h-56.548c-8.837 0-16 7.163-16 16v198.829c0 28.607-23.19 51.797-51.797 51.797-32.693 0-59.196-26.503-59.196-59.196v-191.43c0-8.837-7.163-16-16-16z"}),e.jsx("path",{d:"m868.426 352h-68.495c-6.98 0-12.487 5.934-11.967 12.895l14.206 190c.468 6.263 5.686 11.105 11.966 11.105h45.412c6.409 0 11.687-5.037 11.987-11.44l8.878-190c.32-6.84-5.14-12.56-11.987-12.56z"}),e.jsx("ellipse",{cx:"834",cy:"649.5",rx:"47",ry:"44.5"}),e.jsx("path",{"clip-rule":"evenodd",d:"m522 687h50c8.837 0 16-7.163 16-16v-80c0-8.837 7.163-16 16-16h33.5c61.58 0 111.5-49.92 111.5-111.5s-49.92-111.5-111.5-111.5h-115.5c-8.837 0-16 7.163-16 16v303c0 8.837 7.163 16 16 16zm70-252v58c0 6.627 5.373 12 12 12h14c20.987 0 38-17.013 38-38v-6c0-20.987-17.013-38-38-38h-14c-6.627 0-12 5.373-12 12z","fill-rule":"evenodd"})]})]})]})},bybit_wallet:{displayName:"Bybit Wallet",logo:({style:t,...r})=>e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("path",{d:"M0 10.2C0 4.56669 4.5667 0 10.2 0H37.8C43.4333 0 48 4.5667 48 10.2V37.8C48 43.4333 43.4333 48 37.8 48H10.2C4.56669 48 0 43.4333 0 37.8V10.2Z",fill:"#604E93"}),e.jsx("path",{d:"M4.13353 14.6218C3.70207 13.1338 4.62517 11.5926 6.14065 11.2707L31.424 5.90036C32.6242 5.64544 33.8434 6.24236 34.3782 7.34668L45.7343 30.7995L13.7343 47.7328L4.13353 14.6218Z",fill:"url(#paint0_linear_362_37285)"}),e.jsx("path",{d:"M4.46332 16.4519C4.00953 14.8821 5.06159 13.277 6.68213 13.0669L40.1928 8.72077C41.5851 8.5402 42.879 9.47008 43.1517 10.8473L48.0004 35.333L13.467 47.5999L4.46332 16.4519Z",fill:"white"}),e.jsx("path",{d:"M0 18.6666C0 15.7211 2.38781 13.3333 5.33333 13.3333H37.3333C43.2244 13.3333 48 18.1089 48 24V37.3333C48 43.2243 43.2244 48 37.3333 48H10.6667C4.77563 48 0 43.2243 0 37.3333V18.6666Z",fill:"black"}),e.jsx("path",{d:"M31.7559 33.3796V23.3867H33.7051V33.3796H31.7559Z",fill:"#F7A600"}),e.jsx("path",{d:"M9.51303 36.362H5.33398V26.3691H9.3449C11.2941 26.3691 12.4301 27.4639 12.4301 29.176C12.4301 30.2844 11.7008 31.0006 11.1964 31.2393C11.7996 31.5201 12.5709 32.1511 12.5709 33.4846C12.5709 35.3513 11.2941 36.362 9.51303 36.362ZM9.19043 28.1096H7.28322V30.4117H9.19043C10.0174 30.4117 10.4808 29.9489 10.4808 29.2612C10.4808 28.5723 10.0185 28.1096 9.19043 28.1096ZM9.31653 32.1658H7.28322V34.6215H9.31653C10.2003 34.6215 10.6206 34.0599 10.6206 33.3868C10.6216 32.7127 10.2003 32.1658 9.31653 32.1658Z",fill:"white"}),e.jsx("path",{d:"M17.9425 32.2637V36.362H16.007V32.2637L13.0059 26.3691H15.1232L16.9884 30.3969L18.8252 26.3691H20.9426L17.9425 32.2637Z",fill:"white"}),e.jsx("path",{d:"M26.4896 36.362H22.3105V26.3691H26.3215C28.2707 26.3691 29.4066 27.4639 29.4066 29.176C29.4066 30.2844 28.6774 31.0006 28.173 31.2393C28.7761 31.5201 29.5474 32.1511 29.5474 33.4846C29.5464 35.3513 28.2696 36.362 26.4896 36.362ZM26.167 28.1096H24.2598V30.4117H26.167C26.994 30.4117 27.4574 29.9489 27.4574 29.2612C27.4563 28.5723 26.994 28.1096 26.167 28.1096ZM26.2931 32.1658H24.2598V34.6215H26.2931C27.1768 34.6215 27.5971 34.0599 27.5971 33.3868C27.5971 32.7127 27.1758 32.1658 26.2931 32.1658Z",fill:"white"}),e.jsx("path",{d:"M40.0573 28.1096V36.362H38.1081V28.1096H35.5V26.3691H42.6665V28.1096H40.0573Z",fill:"white"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"paint0_linear_362_37285",x1:"4.00094",y1:"13.9604",x2:"46.1673",y2:"11.8482",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{"stop-color":"#FFD748"}),e.jsx("stop",{offset:"1","stop-color":"#F7A600"})]})})]})}},Cl=(e,t,r)=>xl[e]?.displayName?"coinbase_wallet"===e?xl[r].displayName:xl[e].displayName:"wallet_connect_v2"===t&&"wallet_connect"===e?"Wallet Connect":void 0,El=(e,t,r)=>xl[e]?.logo?"coinbase_wallet"===e?xl[r].logo:xl[e].logo:"wallet_connect_v2"===t&&"wallet_connect"===e?Xa:void 0;function bl(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const Sl=({provider:t,displayName:r,logo:n,connectOnly:i,connector:a})=>{let{navigate:l}=v.usePrivyModal(),{connectWallet:d}=s.usePrivyInternal(),u=c.useRecentlyUsedLogin(),h="wallet_connect_v2"===a.connectorType?t:a.walletClientType,p=window.matchMedia("(display-mode: standalone)").matches;return e.jsxs(Al,{onClick:"phantom"===a.connectorType||"solana_adapter"===a.connectorType&&"phantom"===a.walletClientType?()=>{c.isPhantomInstalled()||"solana"===a.chainType&&"isInstalled"in a&&a.isInstalled?(d(a,h),l(i?v.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION:v.ModalScreen.AWAITING_CONNECTION)):o.isMobile?l(v.ModalScreen.PHANTOM_INTERSTITIAL_SCREEN):l(v.ModalScreen.INSTALL_PHANTOM_SCREEN)}:"coinbase_wallet"!==a.connectorType||"eoaOnly"!==a.connectionOptions||!o.isMobile||p||c.isCoinbaseWalletInstalled()?()=>{(!bl(window.navigator.userAgent)||event?.isTrusted)&&(d(a,h),l(i?v.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION:v.ModalScreen.AWAITING_CONNECTION))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`},children:[e.jsx(wl,{icon:El(t,a.connectorType,a.walletClientType)??n,name:a.walletClientType}),e.jsx("span",{children:Cl(t,a.connectorType,a.walletClientType)||r||a.walletClientType}),e.jsxs($l,{id:"chip-container",children:[u?.walletClientType===h&&u?.chainType===a.chainType?e.jsx(jl,{color:"gray",children:"Recent"}):e.jsx("span",{id:"connect-text",children:"Connect"}),"solana_adapter"===a.connectorType&&e.jsx(jl,{color:"gray",children:"Solana"})]})]})};let Al=E.styled(Jo)`
927
+ `;const wl=({icon:t,name:r})=>"string"==typeof t?e.jsx("img",{alt:`${r||"wallet"} logo`,src:t,style:{height:24,width:24,borderRadius:4}}):t?e.jsx(t,{}):null,xl={coinbase_wallet:{logo:Sa,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},coinbase_smart_wallet:{logo:Sa,displayName:"Coinbase Smart Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Ha,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Ga,displayName:"Phantom"},rainbow:{logo:({style:t,...r})=>e.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("g",{clipPath:"url(#clip0_5_32)",children:e.jsxs("g",{clipPath:"url(#clip1_5_32)",children:[e.jsx("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:e.jsx("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),e.jsx("g",{mask:"url(#mask0_5_32)",children:e.jsx("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),e.jsx("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),e.jsx("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),e.jsx("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),e.jsx("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),e.jsx("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),e.jsx("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),e.jsx("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),e.jsx("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),e.jsx("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#174299"}),e.jsx("stop",{offset:"1",stopColor:"#001E59"})]}),e.jsxs("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[e.jsx("stop",{offset:"0.770277",stopColor:"#FF4000"}),e.jsx("stop",{offset:"1",stopColor:"#8754C9"})]}),e.jsxs("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FF4000"}),e.jsx("stop",{offset:"1",stopColor:"#8754C9"})]}),e.jsxs("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8754C9"}),e.jsx("stop",{offset:"1",stopColor:"#FF4000"})]}),e.jsxs("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[e.jsx("stop",{offset:"0.723929",stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#FFF700"}),e.jsx("stop",{offset:"1",stopColor:"#FF9901"})]}),e.jsxs("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[e.jsx("stop",{offset:"0.59513",stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsxs("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[e.jsx("stop",{stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsxs("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[e.jsx("stop",{stopColor:"#00AAFF"}),e.jsx("stop",{offset:"1",stopColor:"#01DA40"})]}),e.jsx("clipPath",{id:"clip0_5_32",children:e.jsx("rect",{width:"120",height:"120",fill:"white"})}),e.jsx("clipPath",{id:"clip1_5_32",children:e.jsx("rect",{width:"120",height:"120",fill:"white"})})]})]}),displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Qa,displayName:"WalletConnect"},zerion:{logo:({style:t,...r})=>e.jsxs("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsxs("g",{clipPath:"url(#clip0_1704_1423)",children:[e.jsx("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_1704_1423",children:e.jsx("rect",{width:"176",height:"176",fill:"white"})})})]}),displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:({...t})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...t,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0",stopColor:"#f1562b"}),e.jsx("stop",{offset:"0.3",stopColor:"#f1542b"}),e.jsx("stop",{offset:"0.41",stopColor:"#f04d2a"}),e.jsx("stop",{offset:"0.49",stopColor:"#ef4229"}),e.jsx("stop",{offset:"0.5",stopColor:"#ef4029"}),e.jsx("stop",{offset:"0.56",stopColor:"#e83e28"}),e.jsx("stop",{offset:"0.67",stopColor:"#e13c26"}),e.jsx("stop",{offset:"1",stopColor:"#df3c26"})]})}),e.jsx("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),e.jsx("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]}),displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:({style:t,...r})=>e.jsxs("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),e.jsx("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),e.jsxs("g",{mask:"url(#mask0_16909_31415)",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#002D72"}),e.jsx("stop",{offset:"1",stopColor:"#002D72",stopOpacity:"0.01"})]}),e.jsxs("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#002D72",stopOpacity:"0.01"}),e.jsx("stop",{offset:"1",stopColor:"#002D72"})]})]})]}),displayName:"Crypto.com DeFi Wallet",rdns:"com.crypto.wallet"},uniswap:{logo:({style:t,...r})=>e.jsxs("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),e.jsxs("g",{children:[e.jsx("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),e.jsx("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),e.jsx("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),e.jsx("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),e.jsx("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),e.jsx("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),e.jsx("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]}),displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="},rabby_wallet:{logo:t=>e.jsxs("svg",{width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("rect",{width:"52",height:"52",rx:"26",fill:"#7084FF"}),e.jsx("path",{d:"M43.6781 28.2954C45.1053 25.0988 38.0498 16.168 31.3094 12.4472C27.0608 9.56481 22.6337 9.96081 21.737 11.2264C19.7693 14.0039 28.2527 16.3574 33.9263 19.1037C32.7067 19.6348 31.5574 20.5879 30.8816 21.8067C28.7664 19.4915 24.1239 17.4977 18.6765 19.1037C15.0056 20.186 11.9547 22.7374 10.7756 26.5911C10.4891 26.4635 10.1719 26.3925 9.83814 26.3925C8.56192 26.3925 7.52734 27.4298 7.52734 28.7094C7.52734 29.989 8.56192 31.0263 9.83814 31.0263C10.0747 31.0263 10.8143 30.8672 10.8143 30.8672L22.6337 30.953C17.9068 38.4713 14.1713 39.5704 14.1713 40.8729C14.1713 42.1754 17.7455 41.8224 19.0876 41.3369C25.5121 39.0127 32.4123 31.7692 33.5964 29.6841C38.5688 30.3061 42.7476 30.3796 43.6781 28.2954Z",fill:"url(#paint0_linear_81034_11443)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.8741 19.076C33.8926 19.084 33.911 19.092 33.9294 19.1001C34.1923 18.9962 34.1498 18.6068 34.0776 18.301C33.9116 17.5981 31.0479 14.7629 28.3588 13.493C24.6934 11.762 21.9946 11.8518 21.5972 12.65C22.3407 14.1849 25.8031 15.6258 29.4193 17.1308C30.9407 17.7639 32.4893 18.4084 33.8741 19.076Z",fill:"url(#paint1_linear_81034_11443)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.272 34.5374C28.5323 34.2543 27.697 33.9945 26.7477 33.7587C27.7625 31.9382 27.9754 29.2432 27.0171 27.5392C25.6721 25.1478 23.9838 23.875 20.0605 23.875C17.9027 23.875 12.093 24.6037 11.9899 29.4663C11.9791 29.9743 11.9895 30.44 12.026 30.8685L22.6335 30.9456C21.2017 33.2229 19.8609 34.9113 18.6873 36.1947C20.0979 36.5571 21.2615 36.8612 22.3297 37.1404C23.3394 37.4043 24.2638 37.646 25.2309 37.8934C26.6941 36.8249 28.0698 35.6597 29.272 34.5374Z",fill:"url(#paint2_linear_81034_11443)"}),e.jsx("path",{d:"M10.6324 30.3712C11.0658 34.065 13.1596 35.5127 17.4381 35.9411C21.7166 36.3695 24.1708 36.0821 27.4381 36.3801C30.167 36.6291 32.6036 38.0233 33.5075 37.5415C34.321 37.1079 33.8659 35.5412 32.7774 34.5361C31.3663 33.2333 29.4135 32.3274 25.9773 32.006C26.6621 30.1261 26.4702 27.4903 25.4067 26.0562C23.8689 23.9827 21.0305 23.0453 17.4381 23.4549C13.6848 23.8828 10.0885 25.7354 10.6324 30.3712Z",fill:"url(#paint3_linear_81034_11443)"}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_81034_11443",x1:"18.249",y1:"25.4646",x2:"43.3806",y2:"32.5728",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"white"}),e.jsx("stop",{offset:"1",stopColor:"white"})]}),e.jsxs("linearGradient",{id:"paint1_linear_81034_11443",x1:"39.1432",y1:"24.9813",x2:"20.9691",y2:"6.81008",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8697FF"}),e.jsx("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"paint2_linear_81034_11443",x1:"29.7761",y1:"35.1727",x2:"12.345",y2:"25.1792",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#8697FF"}),e.jsx("stop",{offset:"1",stopColor:"#8697FF",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"paint3_linear_81034_11443",x1:"19.7472",y1:"25.2716",x2:"31.5549",y2:"40.2352",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"white"}),e.jsx("stop",{offset:"0.983895",stopColor:"#D1D8FF"})]})]})]}),displayName:"Rabby Wallet",rdns:"io.rabby.wallet"},safe:{displayName:"Safe",logo:({style:t,...r})=>e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...r,children:[e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"#12FF80"}),e.jsx("path",{d:"M22.5151 13.9979H20.4244C19.7981 13.9979 19.2945 14.5058 19.2945 15.128V18.163C19.2945 18.7894 18.7866 19.2931 18.1645 19.2931H9.8398C9.21344 19.2931 8.70981 19.8011 8.70981 20.4233V22.5185C8.70981 23.145 9.21767 23.6487 9.8398 23.6487H18.6427C19.2691 23.6487 19.7642 23.1407 19.7642 22.5185V20.8423C19.7642 20.2159 20.2721 19.7757 20.8942 19.7757H22.5151C23.1415 19.7757 23.6451 19.2677 23.6451 18.6455V15.1196C23.6451 14.4889 23.1373 13.9979 22.5151 13.9979Z",fill:"black"}),e.jsx("path",{d:"M8.7098 9.84127C8.7098 9.21481 9.21766 8.71111 9.83978 8.71111H18.156C18.7823 8.71111 19.286 8.20317 19.286 7.58095V5.48995C19.286 4.86349 18.7781 4.35979 18.156 4.35979H9.35732C8.73096 4.35979 8.22733 4.86772 8.22733 5.48995V7.10264C8.22733 7.7291 7.71947 8.2328 7.09734 8.2328H5.48912C4.86276 8.2328 4.35913 8.74074 4.35913 9.36296V12.8931C4.35913 13.5196 4.86699 13.9979 5.49335 13.9979H7.58404C8.2104 13.9979 8.71403 13.4899 8.71403 12.8677L8.7098 9.84127Z",fill:"black"}),e.jsx("path",{d:"M13.0139 11.8011H15.0242C15.6802 11.8011 16.2092 12.3344 16.2092 12.9862V14.9968C16.2092 15.6529 15.6759 16.182 15.0242 16.182H13.0139C12.3579 16.182 11.8289 15.6487 11.8289 14.9968V12.9862C11.8289 12.3302 12.3621 11.8011 13.0139 11.8011Z",fill:"black"})]})},universal_profile:{displayName:"Universal Profile",logo:({style:t,...r})=>e.jsxs("svg",{fill:"none",height:"1024",width:"1024",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsxs("filter",{id:"a","color-interpolation-filters":"sRGB",filterUnits:"userSpaceOnUse",height:"1228",width:"1244",x:"-72",y:"-72",children:[e.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"BackgroundImageFix",mode:"normal",result:"shape"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"-72",dy:"-72"}),e.jsx("feGaussianBlur",{stdDeviation:"54"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),e.jsx("feBlend",{in2:"shape",mode:"normal",result:"effect1_innerShadow_3981_20791"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"152",dy:"132"}),e.jsx("feGaussianBlur",{stdDeviation:"74"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.15 0"}),e.jsx("feBlend",{in2:"effect1_innerShadow_3981_20791",mode:"normal",result:"effect2_innerShadow_3981_20791"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"32",dy:"20"}),e.jsx("feGaussianBlur",{stdDeviation:"50"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0"}),e.jsx("feBlend",{in2:"effect2_innerShadow_3981_20791",mode:"normal",result:"effect3_innerShadow_3981_20791"})]}),e.jsxs("filter",{id:"b","color-interpolation-filters":"sRGB",filterUnits:"userSpaceOnUse",height:"352",width:"747",x:"142",y:"352",children:[e.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),e.jsx("feBlend",{in:"SourceGraphic",in2:"BackgroundImageFix",mode:"normal",result:"shape"}),e.jsx("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),e.jsx("feOffset",{dx:"8",dy:"12"}),e.jsx("feGaussianBlur",{stdDeviation:"5"}),e.jsx("feComposite",{in2:"hardAlpha",k2:"-1",k3:"1",operator:"arithmetic"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.120833 0 0 0 0 0.120833 0 0 0 0 0.120833 0 0 0 0.69 0"}),e.jsx("feBlend",{in2:"shape",mode:"normal",result:"effect1_innerShadow_3981_20791"})]}),e.jsxs("linearGradient",{id:"c",gradientUnits:"userSpaceOnUse",x1:"0",x2:"1024",y1:"0",y2:"1024",children:[e.jsx("stop",{offset:"0","stop-color":"#8992d1"}),e.jsx("stop",{offset:"1","stop-color":"#646c9f"})]}),e.jsx("clipPath",{id:"d",children:e.jsx("path",{d:"m0 0h1024v1024h-1024z"})}),e.jsxs("g",{"clip-path":"url(#d)",children:[e.jsx("g",{filter:"url(#a)",children:e.jsx("rect",{fill:"url(#c)",height:"1024",rx:"230",width:"1024"})}),e.jsxs("g",{fill:"#fff",filter:"url(#b)",children:[e.jsx("path",{d:"m212.459 354h-54.459c-8.837 0-16 7.163-16 16v203c0 66.826 54.174 121 121 121h44c66.826 0 121-54.174 121-121v-203c0-8.837-7.163-16-16-16h-56.548c-8.837 0-16 7.163-16 16v198.829c0 28.607-23.19 51.797-51.797 51.797-32.693 0-59.196-26.503-59.196-59.196v-191.43c0-8.837-7.163-16-16-16z"}),e.jsx("path",{d:"m868.426 352h-68.495c-6.98 0-12.487 5.934-11.967 12.895l14.206 190c.468 6.263 5.686 11.105 11.966 11.105h45.412c6.409 0 11.687-5.037 11.987-11.44l8.878-190c.32-6.84-5.14-12.56-11.987-12.56z"}),e.jsx("ellipse",{cx:"834",cy:"649.5",rx:"47",ry:"44.5"}),e.jsx("path",{"clip-rule":"evenodd",d:"m522 687h50c8.837 0 16-7.163 16-16v-80c0-8.837 7.163-16 16-16h33.5c61.58 0 111.5-49.92 111.5-111.5s-49.92-111.5-111.5-111.5h-115.5c-8.837 0-16 7.163-16 16v303c0 8.837 7.163 16 16 16zm70-252v58c0 6.627 5.373 12 12 12h14c20.987 0 38-17.013 38-38v-6c0-20.987-17.013-38-38-38h-14c-6.627 0-12 5.373-12 12z","fill-rule":"evenodd"})]})]})]})},bybit_wallet:{displayName:"Bybit Wallet",logo:({style:t,...r})=>e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...t},...r,children:[e.jsx("path",{d:"M0 10.2C0 4.56669 4.5667 0 10.2 0H37.8C43.4333 0 48 4.5667 48 10.2V37.8C48 43.4333 43.4333 48 37.8 48H10.2C4.56669 48 0 43.4333 0 37.8V10.2Z",fill:"#604E93"}),e.jsx("path",{d:"M4.13353 14.6218C3.70207 13.1338 4.62517 11.5926 6.14065 11.2707L31.424 5.90036C32.6242 5.64544 33.8434 6.24236 34.3782 7.34668L45.7343 30.7995L13.7343 47.7328L4.13353 14.6218Z",fill:"url(#paint0_linear_362_37285)"}),e.jsx("path",{d:"M4.46332 16.4519C4.00953 14.8821 5.06159 13.277 6.68213 13.0669L40.1928 8.72077C41.5851 8.5402 42.879 9.47008 43.1517 10.8473L48.0004 35.333L13.467 47.5999L4.46332 16.4519Z",fill:"white"}),e.jsx("path",{d:"M0 18.6666C0 15.7211 2.38781 13.3333 5.33333 13.3333H37.3333C43.2244 13.3333 48 18.1089 48 24V37.3333C48 43.2243 43.2244 48 37.3333 48H10.6667C4.77563 48 0 43.2243 0 37.3333V18.6666Z",fill:"black"}),e.jsx("path",{d:"M31.7559 33.3796V23.3867H33.7051V33.3796H31.7559Z",fill:"#F7A600"}),e.jsx("path",{d:"M9.51303 36.362H5.33398V26.3691H9.3449C11.2941 26.3691 12.4301 27.4639 12.4301 29.176C12.4301 30.2844 11.7008 31.0006 11.1964 31.2393C11.7996 31.5201 12.5709 32.1511 12.5709 33.4846C12.5709 35.3513 11.2941 36.362 9.51303 36.362ZM9.19043 28.1096H7.28322V30.4117H9.19043C10.0174 30.4117 10.4808 29.9489 10.4808 29.2612C10.4808 28.5723 10.0185 28.1096 9.19043 28.1096ZM9.31653 32.1658H7.28322V34.6215H9.31653C10.2003 34.6215 10.6206 34.0599 10.6206 33.3868C10.6216 32.7127 10.2003 32.1658 9.31653 32.1658Z",fill:"white"}),e.jsx("path",{d:"M17.9425 32.2637V36.362H16.007V32.2637L13.0059 26.3691H15.1232L16.9884 30.3969L18.8252 26.3691H20.9426L17.9425 32.2637Z",fill:"white"}),e.jsx("path",{d:"M26.4896 36.362H22.3105V26.3691H26.3215C28.2707 26.3691 29.4066 27.4639 29.4066 29.176C29.4066 30.2844 28.6774 31.0006 28.173 31.2393C28.7761 31.5201 29.5474 32.1511 29.5474 33.4846C29.5464 35.3513 28.2696 36.362 26.4896 36.362ZM26.167 28.1096H24.2598V30.4117H26.167C26.994 30.4117 27.4574 29.9489 27.4574 29.2612C27.4563 28.5723 26.994 28.1096 26.167 28.1096ZM26.2931 32.1658H24.2598V34.6215H26.2931C27.1768 34.6215 27.5971 34.0599 27.5971 33.3868C27.5971 32.7127 27.1758 32.1658 26.2931 32.1658Z",fill:"white"}),e.jsx("path",{d:"M40.0573 28.1096V36.362H38.1081V28.1096H35.5V26.3691H42.6665V28.1096H40.0573Z",fill:"white"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"paint0_linear_362_37285",x1:"4.00094",y1:"13.9604",x2:"46.1673",y2:"11.8482",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{"stop-color":"#FFD748"}),e.jsx("stop",{offset:"1","stop-color":"#F7A600"})]})})]})}},Cl=(e,t,r)=>xl[e]?.displayName?"coinbase_wallet"===e?xl[r].displayName:xl[e].displayName:"wallet_connect_v2"===t&&"wallet_connect"===e?"Wallet Connect":void 0,El=(e,t,r)=>xl[e]?.logo?"coinbase_wallet"===e?xl[r].logo:xl[e].logo:"wallet_connect_v2"===t&&"wallet_connect"===e?Qa:void 0;function bl(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const Sl=({provider:t,displayName:r,logo:n,connectOnly:i,connector:a})=>{let{navigate:l}=v.usePrivyModal(),{connectWallet:u}=s.usePrivyInternal(),h=c.useRecentlyUsedLogin(),p="wallet_connect_v2"===a.connectorType?t:a.walletClientType,y=window.matchMedia("(display-mode: standalone)").matches;return e.jsxs(Al,{onClick:"solana_adapter"===a.connectorType&&"phantom"===a.walletClientType?()=>{"solana"===a.chainType&&"isInstalled"in a&&a.isInstalled?(u(a,p),l(i?v.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION:v.ModalScreen.AWAITING_CONNECTION)):o.isMobile?l(v.ModalScreen.PHANTOM_INTERSTITIAL_SCREEN):l(v.ModalScreen.INSTALL_PHANTOM_SCREEN)}:"coinbase_wallet"!==a.connectorType||"eoaOnly"!==a.connectionOptions||!o.isMobile||y||d.isCoinbaseWalletInstalled()?()=>{(!bl(window.navigator.userAgent)||event?.isTrusted)&&(u(a,p),l(i?v.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION:v.ModalScreen.AWAITING_CONNECTION))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`},children:[e.jsx(wl,{icon:El(t,a.connectorType,a.walletClientType)??n,name:a.walletClientType}),e.jsx("span",{children:Cl(t,a.connectorType,a.walletClientType)||r||a.walletClientType}),e.jsxs($l,{id:"chip-container",children:[h?.walletClientType===p&&h?.chainType===a.chainType?e.jsx(jl,{color:"gray",children:"Recent"}):e.jsx("span",{id:"connect-text",children:"Connect"}),"solana_adapter"===a.connectorType&&e.jsx(jl,{color:"gray",children:"Solana"})]})]})};let Al=E.styled(Jo)`
928
928
  /* Show "Connect" on hover */
929
929
  > #chip-container > #connect-text {
930
930
  font-weight: 500;
@@ -1095,7 +1095,7 @@
1095
1095
  font-weight: 600;
1096
1096
  line-height: 1.875rem; /* 166.667% */
1097
1097
  text-align: center;
1098
- `;function yd(t){let[r,n]=a.useState(t.dimensions.width),[i,o]=a.useState(void 0),s=a.useRef(null);a.useEffect((()=>{if(s.current&&void 0===r){let{width:e}=s.current.getBoundingClientRect();n(e)}let e=getComputedStyle(document.documentElement);o({background:e.getPropertyValue("--privy-color-background"),background2:e.getPropertyValue("--privy-color-background-2"),foreground3:e.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:e.getPropertyValue("--privy-color-foreground-accent"),accent:e.getPropertyValue("--privy-color-accent"),accentDark:e.getPropertyValue("--privy-color-accent-dark"),success:e.getPropertyValue("--privy-color-success")})}),[]);let l="ethereum"===t.wallet.chainType&&!t.wallet.imported;return e.jsx("div",{ref:s,children:r&&e.jsxs(fd,{children:[e.jsx("iframe",{style:{position:"absolute",zIndex:1},width:r,height:t.dimensions.height,allow:"clipboard-write self *",src:c.constructURL(t.origin,`/apps/${t.appId}/embedded-wallets/export`,{client_id:t.appClientId,address:t.wallet.address,width:`${r}px`,caid:t.clientAnalyticsId,phrase_export:l,...i},{token:t.accessToken})}),e.jsx(gd,{children:"Loading..."}),l&&e.jsx(gd,{children:"Loading..."})]})})}let md=E.styled.div`
1098
+ `;function yd(t){let[r,n]=a.useState(t.dimensions.width),[i,o]=a.useState(void 0),s=a.useRef(null);a.useEffect((()=>{if(s.current&&void 0===r){let{width:e}=s.current.getBoundingClientRect();n(e)}let e=getComputedStyle(document.documentElement);o({background:e.getPropertyValue("--privy-color-background"),background2:e.getPropertyValue("--privy-color-background-2"),foreground3:e.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:e.getPropertyValue("--privy-color-foreground-accent"),accent:e.getPropertyValue("--privy-color-accent"),accentDark:e.getPropertyValue("--privy-color-accent-dark"),success:e.getPropertyValue("--privy-color-success")})}),[]);let l="ethereum"===t.wallet.chainType&&!t.wallet.imported;return e.jsx("div",{ref:s,children:r&&e.jsxs(fd,{children:[e.jsx("iframe",{style:{position:"absolute",zIndex:1},width:r,height:t.dimensions.height,allow:"clipboard-write self *",src:d.constructURL(t.origin,`/apps/${t.appId}/embedded-wallets/export`,{client_id:t.appClientId,address:t.wallet.address,width:`${r}px`,caid:t.clientAnalyticsId,phrase_export:l,...i},{token:t.accessToken})}),e.jsx(gd,{children:"Loading..."}),l&&e.jsx(gd,{children:"Loading..."})]})})}let md=E.styled.div`
1099
1099
  display: flex;
1100
1100
  flex-direction: column;
1101
1101
  gap: 1.25rem;
@@ -1118,7 +1118,7 @@
1118
1118
  border-radius: var(--privy-border-radius-md);
1119
1119
  background-color: var(--privy-color-background-2);
1120
1120
  color: var(--privy-color-foreground-3);
1121
- `;function vd(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=s.usePrivyInternal(),n=a.useRef(!1);return{createWallet:a.useCallback((async({user:i,recoveryPassword:a})=>{let o=await Ag();if(!o)throw t({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),Error("An error has occured, please login again.");try{t({eventName:"embedded_wallet_creation_started"});let s=await r(d.WALLET_PROXY_TIMEOUT);if(!s)throw Error("walletProxy does not exist.");let l=new Promise(((e,t)=>{setTimeout((()=>{t(Error("walletProxy.create timed out."))}),2e4)})),c=h.getPrivySolanaWallet(i);if(!await Promise.race([s.create({accessToken:o,recoveryPassword:a,solanaAddress:c?.address}),l]))throw Error("walletProxy.create did not send a response.");let u=await e();if(!u)throw Error("Failed to refresh user.");let p=h.getPrivyEthereumWallet(u);if(!p)throw Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:p.address}}),n.current=!0,p}catch(i){if(n.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:i.toString()}}),console.warn(i),i}}),[])}}let wd=E.styled.div`
1121
+ `;function vd(){let{getAccessToken:e}=s.usePrivy(),{refreshUser:t,createAnalyticsEvent:r,initializeWalletProxy:n}=s.usePrivyInternal(),i=a.useRef(!1);return{createWallet:a.useCallback((async({user:a,recoveryPassword:o})=>{let s=await e();if(!s)throw r({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),Error("An error has occured, please login again.");try{r({eventName:"embedded_wallet_creation_started"});let e=await n(d.WALLET_PROXY_TIMEOUT);if(!e)throw Error("walletProxy does not exist.");let l=new Promise(((e,t)=>{setTimeout((()=>{t(Error("walletProxy.create timed out."))}),2e4)})),c=h.getPrivySolanaWallet(a);if(!await Promise.race([e.create({accessToken:s,recoveryPassword:o,solanaAddress:c?.address}),l]))throw Error("walletProxy.create did not send a response.");let u=await t();if(!u)throw Error("Failed to refresh user.");let p=h.getPrivyEthereumWallet(u);if(!p)throw Error("Updated user is missing embedded wallet.");return r({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:p.address}}),i.current=!0,p}catch(a){if(i.current)return;throw r({eventName:"embedded_wallet_creation_failed",payload:{error:a.toString()}}),console.warn(a),a}}),[])}}let wd=E.styled.div`
1122
1122
  height: 44px;
1123
1123
  `,xd=E.css`
1124
1124
  font-size: 14px;
@@ -1449,7 +1449,7 @@
1449
1449
  width: 14px;
1450
1450
  height: 14px;
1451
1451
  }
1452
- `;const vc=()=>e.jsx("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:e.jsx("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});let wc=(e,t,r,n,i)=>{for(let a=t;a<t+n;a++)for(let t=r;t<r+i;t++){let r=e?.[t];r&&r[a]&&(r[a]=0)}return e},xc=({x:t,y:r,cellSize:n,bgColor:i,fgColor:a})=>e.jsx(e.Fragment,{children:[0,1,2].map((o=>e.jsx("circle",{r:n*(7-2*o)/2,cx:t+7*n/2,cy:r+7*n/2,fill:o%2!=0?i:a},`finder-${t}-${r}-${o}`)))}),Cc=({cellSize:t,matrixSize:r,bgColor:n,fgColor:i})=>e.jsx(e.Fragment,{children:[[0,0],[(r-7)*t,0],[0,(r-7)*t]].map((([r,a])=>e.jsx(xc,{x:r,y:a,cellSize:t,bgColor:n,fgColor:i},`finder-${r}-${a}`)))}),Ec=({matrix:t,cellSize:r,color:n})=>e.jsx(e.Fragment,{children:t.map(((t,i)=>t.map(((t,a)=>t?e.jsx("rect",{height:r-.4,width:r-.4,x:i*r+.1*r,y:a*r+.1*r,rx:.5*r,ry:.5*r,fill:n},`cell-${i}-${a}`):e.jsx(Ie.default.Fragment,{},`circle-${i}-${a}`)))))}),bc=({cellSize:t,matrixSize:r,element:n,sizePercentage:i,bgColor:a})=>{if(!n)return e.jsx(e.Fragment,{});let o=r*(i||.14),s=Math.floor(r/2-o/2),l=Math.floor(r/2+o/2);(l-s)%2!=r%2&&(l+=1);let d=(l-s)*t,c=d-.2*d,u=s*t;return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:s*t,y:s*t,width:d,height:d,fill:a}),e.jsx(n,{x:u+.1*d,y:u+.1*d,height:c,width:c})]})},Sc=t=>{let r=t.outputSize,n=((e,t)=>{let r=lt.default.create(e,{errorCorrectionLevel:t}).modules,n=c.convert1dTo2dArray(Array.from(r.data),r.size);return n=wc(n,0,0,7,7),n=wc(n,n.length-7,0,7,7),wc(n,0,n.length-7,7,7)})(t.url,t.errorCorrectionLevel),i=r/n.length,a=c.clamp(2*i,{min:.025*r,max:.036*r});return e.jsxs("svg",{height:t.outputSize,width:t.outputSize,viewBox:`0 0 ${t.outputSize} ${t.outputSize}`,style:{height:"100%",width:"100%",padding:`${a}px`},children:[e.jsx(Ec,{matrix:n,cellSize:i,color:t.fgColor}),e.jsx(Cc,{cellSize:i,matrixSize:n.length,fgColor:t.fgColor,bgColor:t.bgColor}),e.jsx(bc,{cellSize:i,element:t.logo?.element,bgColor:t.bgColor,matrixSize:n.length})]})},Ac=E.styled.div`
1452
+ `;const vc=()=>e.jsx("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:e.jsx("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});let wc=(e,t,r,n,i)=>{for(let a=t;a<t+n;a++)for(let t=r;t<r+i;t++){let r=e?.[t];r&&r[a]&&(r[a]=0)}return e},xc=({x:t,y:r,cellSize:n,bgColor:i,fgColor:a})=>e.jsx(e.Fragment,{children:[0,1,2].map((o=>e.jsx("circle",{r:n*(7-2*o)/2,cx:t+7*n/2,cy:r+7*n/2,fill:o%2!=0?i:a},`finder-${t}-${r}-${o}`)))}),Cc=({cellSize:t,matrixSize:r,bgColor:n,fgColor:i})=>e.jsx(e.Fragment,{children:[[0,0],[(r-7)*t,0],[0,(r-7)*t]].map((([r,a])=>e.jsx(xc,{x:r,y:a,cellSize:t,bgColor:n,fgColor:i},`finder-${r}-${a}`)))}),Ec=({matrix:t,cellSize:r,color:n})=>e.jsx(e.Fragment,{children:t.map(((t,i)=>t.map(((t,a)=>t?e.jsx("rect",{height:r-.4,width:r-.4,x:i*r+.1*r,y:a*r+.1*r,rx:.5*r,ry:.5*r,fill:n},`cell-${i}-${a}`):e.jsx(Ie.default.Fragment,{},`circle-${i}-${a}`)))))}),bc=({cellSize:t,matrixSize:r,element:n,sizePercentage:i,bgColor:a})=>{if(!n)return e.jsx(e.Fragment,{});let o=r*(i||.14),s=Math.floor(r/2-o/2),l=Math.floor(r/2+o/2);(l-s)%2!=r%2&&(l+=1);let d=(l-s)*t,c=d-.2*d,u=s*t;return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:s*t,y:s*t,width:d,height:d,fill:a}),e.jsx(n,{x:u+.1*d,y:u+.1*d,height:c,width:c})]})},Sc=t=>{let r=t.outputSize,n=((e,t)=>{let r=lt.default.create(e,{errorCorrectionLevel:t}).modules,n=d.convert1dTo2dArray(Array.from(r.data),r.size);return n=wc(n,0,0,7,7),n=wc(n,n.length-7,0,7,7),wc(n,0,n.length-7,7,7)})(t.url,t.errorCorrectionLevel),i=r/n.length,a=d.clamp(2*i,{min:.025*r,max:.036*r});return e.jsxs("svg",{height:t.outputSize,width:t.outputSize,viewBox:`0 0 ${t.outputSize} ${t.outputSize}`,style:{height:"100%",width:"100%",padding:`${a}px`},children:[e.jsx(Ec,{matrix:n,cellSize:i,color:t.fgColor}),e.jsx(Cc,{cellSize:i,matrixSize:n.length,fgColor:t.fgColor,bgColor:t.bgColor}),e.jsx(bc,{cellSize:i,element:t.logo?.element,bgColor:t.bgColor,matrixSize:n.length})]})},Ac=E.styled.div`
1453
1453
  display: flex;
1454
1454
  justify-content: center;
1455
1455
  align-items: center;
@@ -1577,19 +1577,19 @@
1577
1577
  flex-direction: row;
1578
1578
  align-items: center;
1579
1579
  gap: 4px;
1580
- `;const cu=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],uu=({amount:e,decimals:t})=>Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t);let hu="0x0000000000000000000000000000000000000000";const pu=({destinationCurrency:e,...t})=>({tradeType:"EXACT_OUTPUT",originCurrency:hu,destinationCurrency:e??hu,...t}),yu=async({input:e,isTestnet:t})=>{let r=await fetch(t?"https://api.testnets.relay.link/execute/swap":"https://api.relay.link/execute/swap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await r.json();if(!(r.ok||"string"==typeof n.message&&n.message.startsWith("Invalid address")))throw console.error("Relay error:",n),Error(n.message??"Error fetching quote from relay");return n},mu=e=>{let t=e.steps[0]?.items?.[0];if(t)return{from:t.data.from,to:t.data.to,value:Number(t.data.value),chainId:Number(t.data.chainId),data:t.data.data}};let fu=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];const gu=({balance:t,className:r,chain:n})=>e.jsx(c.Box,{className:r,$state:void 0,children:e.jsx(vu,{balance:t,chain:n})}),vu=({balance:t,chain:r})=>e.jsxs(e.Fragment,{children:[e.jsxs(wu,{children:[e.jsx(xu,{chainId:r.id}),e.jsx(iu,{children:r.name})]}),e.jsx(c.Chip,{isLoading:!1,isPulsing:!1,color:"gray",children:t})]});let wu=E.styled.div`
1580
+ `;const cu=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],uu=({amount:e,decimals:t})=>Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t);let hu="0x0000000000000000000000000000000000000000";const pu=({destinationCurrency:e,...t})=>({tradeType:"EXACT_OUTPUT",originCurrency:hu,destinationCurrency:e??hu,...t}),yu=async({input:e,isTestnet:t})=>{let r=await fetch(t?"https://api.testnets.relay.link/execute/swap":"https://api.relay.link/execute/swap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await r.json();if(!(r.ok||"string"==typeof n.message&&n.message.startsWith("Invalid address")))throw console.error("Relay error:",n),Error(n.message??"Error fetching quote from relay");return n},mu=e=>{let t=e.steps[0]?.items?.[0];if(t)return{from:t.data.from,to:t.data.to,value:Number(t.data.value),chainId:Number(t.data.chainId),data:t.data.data}},fu=async({chain:e,address:t,appId:r,rpcConfig:n,erc20Address:i})=>{let a=J.createPublicClient({chain:e,transport:J.http(d.getJsonRpcEndpointFromChain(e,n,r))});return{balance:await a.readContract({address:i,abi:gu,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}};let gu=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];const vu=({balance:t,className:r,chain:n})=>e.jsx(c.Box,{className:r,$state:void 0,children:e.jsx(wu,{balance:t,chain:n})}),wu=({balance:t,chain:r})=>e.jsxs(e.Fragment,{children:[e.jsxs(xu,{children:[e.jsx(Cu,{chainId:r.id}),e.jsx(iu,{children:r.name})]}),e.jsx(c.Chip,{isLoading:!1,isPulsing:!1,color:"gray",children:t})]});let xu=E.styled.div`
1581
1581
  display: flex;
1582
1582
  align-items: center;
1583
- `,xu=E.styled(su)`
1583
+ `,Cu=E.styled(su)`
1584
1584
  height: 1.25rem;
1585
1585
  width: 1.25rem;
1586
1586
  display: inline-block;
1587
1587
  margin-right: 0.5rem;
1588
1588
  border-radius: 4px;
1589
- `;const Cu=({options:t,onSelect:r,selected:n,className:i})=>e.jsxs(Q.Menu,{as:Eu,children:[e.jsxs(Q.Menu.Button,{as:ju,children:[e.jsx(vu,{balance:n.balance,chain:n.chain}),e.jsx(Au,{height:16})]}),e.jsx(Q.Menu.Items,{as:bu,className:i,children:t.map(((t,n)=>e.jsx(Q.Menu.Item,{as:Su,onClick:()=>r(n),children:e.jsx(vu,{balance:t.balance,chain:t.chain})},n)))})]});let Eu=E.styled.div`
1589
+ `;const Eu=({options:t,onSelect:r,selected:n,className:i})=>e.jsxs(Q.Menu,{as:bu,children:[e.jsxs(Q.Menu.Button,{as:$u,children:[e.jsx(wu,{balance:n.balance,chain:n.chain}),e.jsx(ju,{height:16})]}),e.jsx(Q.Menu.Items,{as:Su,className:i,children:t.map(((t,n)=>e.jsx(Q.Menu.Item,{as:Au,onClick:()=>r(n),children:e.jsx(wu,{balance:t.balance,chain:t.chain})},n)))})]});let bu=E.styled.div`
1590
1590
  width: 100%;
1591
1591
  position: relative;
1592
- `,bu=E.styled.div`
1592
+ `,Su=E.styled.div`
1593
1593
  width: 100%;
1594
1594
  margin-top: 0.5rem;
1595
1595
  position: absolute;
@@ -1605,7 +1605,7 @@
1605
1605
  }
1606
1606
 
1607
1607
  z-index: 1;
1608
- `,Su=E.styled.button`
1608
+ `,Au=E.styled.button`
1609
1609
  width: 100%;
1610
1610
  display: flex;
1611
1611
  justify-content: space-between;
@@ -1621,10 +1621,10 @@
1621
1621
  :hover {
1622
1622
  background: var(--privy-color-background-2);
1623
1623
  }
1624
- `,Au=E.styled(P.ChevronDownIcon)`
1624
+ `,ju=E.styled(P.ChevronDownIcon)`
1625
1625
  height: 1rem;
1626
1626
  margin-left: 0.5rem;
1627
- `,ju=E.styled.button`
1627
+ `,$u=E.styled.button`
1628
1628
  ${c.BoxStyles}
1629
1629
 
1630
1630
  /* Push the chip all the way to the right */
@@ -1632,16 +1632,16 @@
1632
1632
  margin-left: auto;
1633
1633
  }
1634
1634
 
1635
- ${Au} {
1635
+ ${ju} {
1636
1636
  transition: rotate 100ms ease-in;
1637
1637
  }
1638
1638
 
1639
1639
  &[aria-expanded='true'] {
1640
- ${Au} {
1640
+ ${ju} {
1641
1641
  rotate: -180deg;
1642
1642
  }
1643
1643
  }
1644
- `;const $u=({style:t,...r})=>e.jsx("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...t},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...r,children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})}),Tu=({style:t,...r})=>e.jsxs("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...t},xmlns:"http://www.w3.org/2000/svg",...r,children:[e.jsxs("g",{clipPath:"url(#clip0_113_33841)",children:[e.jsx("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),e.jsx("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),e.jsx("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),e.jsx("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),e.jsx("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),e.jsx("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),e.jsx("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),e.jsx("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),e.jsx("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),e.jsx("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),e.jsx("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),e.jsx("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),e.jsx("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),e.jsx("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),e.jsx("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),e.jsx("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),e.jsx("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),e.jsx("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),e.jsx("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),e.jsx("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),e.jsx("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),e.jsx("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_113_33841",children:e.jsx("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});let Pu=({passkeys:t,expanded:r,onUnlink:n,onExpand:i})=>{let[o,s]=a.useState([]),l=r?t.length:2,d=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device";return e.jsxs("div",{children:[e.jsx(Uu,{children:"Your passkeys"}),e.jsxs(Ou,{children:[t.slice(0,l).map((t=>e.jsxs(Bu,{children:[e.jsxs("div",{children:[e.jsx(Du,{children:d(t)}),e.jsxs(Wu,{children:["Last used: ",(t.latestVerifiedAt??t.verifiedAt).toLocaleString()]})]}),e.jsx(Gu,{disabled:o.includes(t.credentialId),onClick:()=>(async e=>{s((t=>t.concat([e]))),await n(e),s((t=>t.filter((t=>t!==e))))})(t.credentialId),children:o.includes(t.credentialId)?e.jsx(xo,{}):e.jsx(ht.default,{height:"1.6em"})})]},t.credentialId))),t.length>2&&!r&&e.jsx(Mu,{onClick:i,children:"View all"})]})]})},_u=()=>e.jsxs(Ou,{children:[e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(pt.default,{})}),"Log in with Touch ID, Face ID, or a security key."]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(st.default,{})}),"More secure than a password."]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(ut.default,{})}),"Takes seconds to set up and use."]})]});const ku=E.styled.div`
1644
+ `;const Tu=({style:t,...r})=>e.jsx("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...t},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...r,children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})}),Pu=({style:t,...r})=>e.jsxs("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...t},xmlns:"http://www.w3.org/2000/svg",...r,children:[e.jsxs("g",{clipPath:"url(#clip0_113_33841)",children:[e.jsx("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),e.jsx("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),e.jsx("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),e.jsx("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),e.jsx("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),e.jsx("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),e.jsx("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),e.jsx("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),e.jsx("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),e.jsx("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),e.jsx("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),e.jsx("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),e.jsx("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),e.jsx("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),e.jsx("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),e.jsx("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),e.jsx("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),e.jsx("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),e.jsx("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),e.jsx("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),e.jsx("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),e.jsx("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_113_33841",children:e.jsx("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});let _u=({passkeys:t,expanded:r,onUnlink:n,onExpand:i})=>{let[o,s]=a.useState([]),l=r?t.length:2,d=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device";return e.jsxs("div",{children:[e.jsx(Du,{children:"Your passkeys"}),e.jsxs(Ru,{children:[t.slice(0,l).map((t=>e.jsxs(Hu,{children:[e.jsxs("div",{children:[e.jsx(Wu,{children:d(t)}),e.jsxs(Bu,{children:["Last used: ",(t.latestVerifiedAt??t.verifiedAt).toLocaleString()]})]}),e.jsx(qu,{disabled:o.includes(t.credentialId),onClick:()=>(async e=>{s((t=>t.concat([e]))),await n(e),s((t=>t.filter((t=>t!==e))))})(t.credentialId),children:o.includes(t.credentialId)?e.jsx(xo,{}):e.jsx(ht.default,{height:"1.6em"})})]},t.credentialId))),t.length>2&&!r&&e.jsx(Ou,{onClick:i,children:"View all"})]})]})},ku=()=>e.jsxs(Ru,{children:[e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(pt.default,{})}),"Log in with Touch ID, Face ID, or a security key."]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(st.default,{})}),"More secure than a password."]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(ut.default,{})}),"Takes seconds to set up and use."]})]});const Nu=E.styled.div`
1645
1645
  display: flex;
1646
1646
  align-items: center;
1647
1647
  justify-content: center;
@@ -1657,7 +1657,7 @@
1657
1657
  stroke: var(--privy-color-accent) !important;
1658
1658
  fill: var(--privy-color-accent) !important;
1659
1659
  }
1660
- `;let Nu=E.styled.div`
1660
+ `;let Iu=E.styled.div`
1661
1661
  line-height: 20px;
1662
1662
  height: 20px;
1663
1663
  font-size: 13px;
@@ -1665,7 +1665,7 @@
1665
1665
  display: flex;
1666
1666
  justify-content: flex-beginngin;
1667
1667
  width: 100%;
1668
- `,Iu=E.css`
1668
+ `,Mu=E.css`
1669
1669
  && {
1670
1670
  width: 100%;
1671
1671
  font-size: 0.875rem;
@@ -1690,9 +1690,9 @@
1690
1690
  box-shadow: none;
1691
1691
  }
1692
1692
  }
1693
- `;const Mu=E.styled.button`
1694
- ${Iu}
1695
- `;let Ou=E.styled.div`
1693
+ `;const Ou=E.styled.button`
1694
+ ${Mu}
1695
+ `;let Ru=E.styled.div`
1696
1696
  display: flex;
1697
1697
  flex-direction: column;
1698
1698
  align-items: stretch;
@@ -1700,18 +1700,18 @@
1700
1700
  padding: 0.5rem 0rem 0rem;
1701
1701
  flex-grow: 1;
1702
1702
  width: 100%;
1703
- `,Ru=E.styled.div`
1703
+ `,Fu=E.styled.div`
1704
1704
  font-size: 18px;
1705
1705
  line-height: 18px;
1706
1706
  text-align: center;
1707
1707
  font-weight: 600;
1708
- `,Fu=E.styled.div`
1708
+ `,Lu=E.styled.div`
1709
1709
  font-size: 0.875rem;
1710
1710
  text-align: center;
1711
1711
  margin-top: 10px;
1712
- `,Lu=E.styled.div`
1713
- height: 32px;
1714
1712
  `,Uu=E.styled.div`
1713
+ height: 32px;
1714
+ `,Du=E.styled.div`
1715
1715
  line-height: 20px;
1716
1716
  height: 20px;
1717
1717
  font-size: 1em;
@@ -1719,18 +1719,18 @@
1719
1719
  display: flex;
1720
1720
  justify-content: flex-beginning;
1721
1721
  width: 100%;
1722
- `,Du=E.styled.div`
1722
+ `,Wu=E.styled.div`
1723
1723
  font-size: 1em;
1724
1724
  line-height: 1.3em;
1725
1725
  font-weight: 500;
1726
1726
  color: var(--privy-color-foreground-2);
1727
1727
  padding: 0.2em 0;
1728
- `,Wu=E.styled.div`
1728
+ `,Bu=E.styled.div`
1729
1729
  font-size: 0.875rem;
1730
1730
  line-height: 1rem;
1731
1731
  color: #64668b;
1732
1732
  padding: 0.2em 0;
1733
- `,Bu=E.styled.div`
1733
+ `,Hu=E.styled.div`
1734
1734
  display: flex;
1735
1735
  align-items: center;
1736
1736
  justify-content: space-between;
@@ -1743,7 +1743,7 @@
1743
1743
  border: 1px solid #e2e3f0 !important;
1744
1744
  width: 100%;
1745
1745
  height: 5em;
1746
- `,Hu=E.css`
1746
+ `,Gu=E.css`
1747
1747
  :focus,
1748
1748
  :hover,
1749
1749
  :active {
@@ -1760,15 +1760,15 @@
1760
1760
  svg:hover {
1761
1761
  color: var(--privy-color-foreground-3);
1762
1762
  }
1763
- `,Gu=E.styled.button`
1764
- ${Hu}
1765
- `;const qu=E.styled.div`
1763
+ `,qu=E.styled.button`
1764
+ ${Gu}
1765
+ `;const zu=E.styled.div`
1766
1766
  display: flex;
1767
1767
  flex-direction: column;
1768
1768
  gap: 12px;
1769
1769
  padding-top: 24px;
1770
1770
  padding-bottom: 24px;
1771
- `,zu=E.styled.div`
1771
+ `,Vu=E.styled.div`
1772
1772
  width: 24px;
1773
1773
  height: 24px;
1774
1774
  display: flex;
@@ -1778,19 +1778,19 @@
1778
1778
  svg {
1779
1779
  border-radius: var(--privy-border-radius-sm);
1780
1780
  }
1781
- `,Vu=E.styled.div`
1781
+ `,Ku=E.styled.div`
1782
1782
  display: flex;
1783
1783
  flex-direction: column;
1784
1784
  justify-content: center;
1785
1785
  align-items: center;
1786
1786
  gap: 8px;
1787
- `,Ku=E.styled.div`
1787
+ `,Yu=E.styled.div`
1788
1788
  display: flex;
1789
1789
  align-items: baseline;
1790
1790
  gap: 4px;
1791
- `,Yu=E.styled.div`
1791
+ `,Zu=E.styled.div`
1792
1792
  font-size: 42px !important;
1793
- `,Zu=E.styled.input`
1793
+ `,Xu=E.styled.input`
1794
1794
  font-size: 42px !important;
1795
1795
  text-align: right;
1796
1796
  background-color: var(--privy-color-background);
@@ -1805,17 +1805,17 @@
1805
1805
  border: none !important;
1806
1806
  box-shadow: none !important;
1807
1807
  }
1808
- `,Xu=E.styled.div`
1808
+ `,Ju=E.styled.div`
1809
1809
  cursor: pointer;
1810
1810
  padding-left: 4px;
1811
- `,Ju=E.styled.div`
1812
- font-size: 18px;
1813
1811
  `,Qu=E.styled.div`
1812
+ font-size: 18px;
1813
+ `,eh=E.styled.div`
1814
1814
  font-size: 12px;
1815
1815
  color: var(--privy-color-foreground-3);
1816
1816
  // we need this container to maintain a static height if there's no content
1817
1817
  height: 20px;
1818
- `,eh=E.styled.div`
1818
+ `,th=E.styled.div`
1819
1819
  display: flex;
1820
1820
  flex-direction: row;
1821
1821
  line-height: 22px;
@@ -1825,26 +1825,26 @@
1825
1825
  margin-right: 6px;
1826
1826
  margin: auto;
1827
1827
  }
1828
- `,th=E.styled(Mu)`
1828
+ `,rh=E.styled(Ou)`
1829
1829
  margin-top: 16px;
1830
- `;let rh=E.keyframes`
1830
+ `;let nh=E.keyframes`
1831
1831
  from {
1832
1832
  opacity: 0;
1833
1833
  }
1834
1834
  to {
1835
1835
  opacity: 1;
1836
1836
  }
1837
- `;const nh=E.styled(_o)`
1837
+ `;const ih=E.styled(_o)`
1838
1838
  border-radius: var(--privy-border-radius-md) !important;
1839
- animation: ${rh} 0.3s ease-in-out;
1840
- `,ih=({displayName:t,errorMessage:r,configuredFundingChain:n,formattedBalance:i,fundingAmount:a,fundingCurrency:o,fundingAmountInUsd:s,options:l,selectedOption:d,isPreparing:u,isSubmitting:h,onSubmit:p,onSelect:y})=>e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Ks,{}),e.jsx(pd,{children:"Transfer from another network"}),e.jsxs(hd,{children:["You need more funds on the ",n.name," network. Bridge from another blockchain network."]}),e.jsxs(Vu,{style:{marginTop:"2rem"},children:[e.jsxs(Ku,{children:[e.jsx(Yu,{children:a}),e.jsx(Ju,{children:o})]}),s&&e.jsx(Qu,{children:s})]}),e.jsx(ru,{style:{marginTop:"1.5rem"},children:e.jsx(nu,{children:"From"})}),e.jsx(Cu,{selected:{chain:d.chain,balance:c.getNativeCurrencyFromWei(d.balance,d.chain.nativeCurrency.symbol,3,!0)},options:l.map((({chain:e,balance:t})=>({chain:e,balance:c.getNativeCurrencyFromWei(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:y}),e.jsx(ru,{children:e.jsx(nu,{style:{marginTop:"1.5rem"},children:"To"})}),e.jsx(gu,{chain:n,balance:i}),e.jsx(c.ErrorMessage,{style:{marginTop:"1rem"},children:r}),e.jsxs(So,{style:{marginTop:"1rem"},loading:h||u,disabled:u||h,onClick:p,children:["Confirm with ",t]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});class ah{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{return await this.api.post($i,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(Ti,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw s.formatApiError(e)}}constructor({authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}){this.meta={authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}}}async function oh({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 s.PrivyClientError("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}const sh=async({user:e,address:t,client:r,request:n,requesterAppId:i,reconnect:a})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:n.method}});let o=e?.linkedAccounts.find((e=>!("cross_app"!==e.type||!e.embeddedWallets.find((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 s.PrivyClientError("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(o.providerApp.id),d=await oh({api:r.api,requesterAppId:i,providerAppId:o.providerApp.id});if(!l){if(d.readOnly)throw console.error("cannot transact against a read-only provider app"),new s.PrivyClientError("Cannot transact against a read-only provider app");await a({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 s.PrivyClientError("Transactions require a valid token");let c=window.open(void 0,void 0,dh({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new s.PrivyClientError("Failed to initialize signature request");let u=new URL(`${d.apiUrl}/oauth/transact`);return u.searchParams.set("token",l||""),u.searchParams.set("request",lh(n)),c.location=u.href,new Promise(((e,i)=>{let a=setTimeout((()=>{u(),i(new s.PrivyClientError("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})}),12e4),l=setInterval((()=>{c.closed&&(u(),i(new s.PrivyClientError("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))}),300),d=a=>{a.data&&("set"===a.data.token?.action&&void 0!==a.data.token?.value?r.storeProviderAccessToken(o.providerApp.id,a.data.token.value):"clear"===a.data.token?.action&&r.storeProviderAccessToken(o.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===a.data.type&&a.data.result&&(u(),e(a.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:n.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===a.data.type&&a.data.error&&(u(),i(a.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:a.data.error,address:t}})))};window.addEventListener("message",d);let u=()=>{c.close(),clearInterval(l),clearTimeout(a),window.removeEventListener("message",d)}}))};let lh=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin});const dh=({w:e,h:t})=>{let r=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,i=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(i-e)/2/(i/window.screen.availWidth)+r},top=${(a-t)/2/(a/window.screen.availHeight)+n}`};let ch=new Set([d.mainnet.id,d.base.id,d.optimism.id,d.polygon.id,d.arbitrum.id]),uh=new Set([d.mainnet.id,d.base.id,d.polygon.id,d.optimism.id]),hh={[d.mainnet.id]:"ethereum",[d.base.id]:"base",[d.optimism.id]:"optimism",[d.polygon.id]:"polygon",[d.arbitrum.id]:"arbitrum"};let ph=Math.floor(160);let yh=({status:t,onClickCta:r})=>{let{title:n,body:i,cta:o}=a.useMemo((()=>(e=>{switch(e){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Getting your purchase status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(t)),[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(gh,{children:[e.jsx(mh,{isSucccess:"success"===t}),e.jsxs(zs,{children:[e.jsx("h3",{children:n}),e.jsx(fh,{children:i})]})]}),o&&e.jsx(bo,{onClick:r,children:o})]})},mh=({isSucccess:t})=>{if(!t){let t="var(--privy-color-foreground-4)";return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(vo,{color:t,style:{position:"absolute"}}),e.jsx(wo,{color:t}),e.jsx(Sa,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let r=(t=>t?Ye.default:()=>e.jsx(yt.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}))(t),n=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(t);return e.jsx("div",{style:{borderColor:n,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&e.jsx(r,{width:"4rem",height:"4rem",color:n})})},fh=E.styled.p`
1839
+ animation: ${nh} 0.3s ease-in-out;
1840
+ `,ah=({displayName:t,errorMessage:r,configuredFundingChain:n,formattedBalance:i,fundingAmount:a,fundingCurrency:o,fundingAmountInUsd:s,options:l,selectedOption:d,isPreparing:u,isSubmitting:h,onSubmit:p,onSelect:y})=>e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Ks,{}),e.jsx(pd,{children:"Transfer from another network"}),e.jsxs(hd,{children:["You need more funds on the ",n.name," network. Bridge from another blockchain network."]}),e.jsxs(Ku,{style:{marginTop:"2rem"},children:[e.jsxs(Yu,{children:[e.jsx(Zu,{children:a}),e.jsx(Qu,{children:o})]}),s&&e.jsx(eh,{children:s})]}),e.jsx(ru,{style:{marginTop:"1.5rem"},children:e.jsx(nu,{children:"From"})}),e.jsx(Eu,{selected:{chain:d.chain,balance:c.getNativeCurrencyFromWei(d.balance,d.chain.nativeCurrency.symbol,3,!0)},options:l.map((({chain:e,balance:t})=>({chain:e,balance:c.getNativeCurrencyFromWei(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:y}),e.jsx(ru,{children:e.jsx(nu,{style:{marginTop:"1.5rem"},children:"To"})}),e.jsx(vu,{chain:n,balance:i}),e.jsx(c.ErrorMessage,{style:{marginTop:"1rem"},children:r}),e.jsxs(So,{style:{marginTop:"1rem"},loading:h||u,disabled:u||h,onClick:p,children:["Confirm with ",t]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});class oh{async authenticate(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{return await this.api.post($i,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw s.formatApiError(e)}}async link(){if(!this.api)throw new s.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(Ti,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw s.formatApiError(e)}}constructor({authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}){this.meta={authorizationCode:e,stateCode:t,codeVerifier:r,provider:n}}}async function sh({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 s.PrivyClientError("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only}}const lh=async({user:e,address:t,client:r,request:n,requesterAppId:i,reconnect:a})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:n.method}});let o=e?.linkedAccounts.find((e=>!("cross_app"!==e.type||!e.embeddedWallets.find((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 s.PrivyClientError("Cannot request a signature with this wallet address");let l=r.getProviderAccessToken(o.providerApp.id),d=await sh({api:r.api,requesterAppId:i,providerAppId:o.providerApp.id});if(!l){if(d.readOnly)throw console.error("cannot transact against a read-only provider app"),new s.PrivyClientError("Cannot transact against a read-only provider app");await a({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 s.PrivyClientError("Transactions require a valid token");let c=window.open(void 0,void 0,ch({w:400,h:680}));if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new s.PrivyClientError("Failed to initialize signature request");let u=new URL(`${d.apiUrl}/oauth/transact`);return u.searchParams.set("token",l||""),u.searchParams.set("request",dh(n)),c.location=u.href,new Promise(((e,i)=>{let a=setTimeout((()=>{u(),i(new s.PrivyClientError("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})}),12e4),l=setInterval((()=>{c.closed&&(u(),i(new s.PrivyClientError("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))}),300),d=a=>{a.data&&("set"===a.data.token?.action&&void 0!==a.data.token?.value?r.storeProviderAccessToken(o.providerApp.id,a.data.token.value):"clear"===a.data.token?.action&&r.storeProviderAccessToken(o.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===a.data.type&&a.data.result&&(u(),e(a.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:n.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===a.data.type&&a.data.error&&(u(),i(a.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:a.data.error,address:t}})))};window.addEventListener("message",d);let u=()=>{c.close(),clearInterval(l),clearTimeout(a),window.removeEventListener("message",d)}}))};let dh=e=>JSON.stringify({content:{request:{request:e}},timestamp:Date.now(),callbackUrl:window.origin});const ch=({w:e,h:t})=>{let r=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,i=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(i-e)/2/(i/window.screen.availWidth)+r},top=${(a-t)/2/(a/window.screen.availHeight)+n}`};let uh=new Set([d.mainnet.id,d.base.id,d.optimism.id,d.polygon.id,d.arbitrum.id]),hh=new Set([d.mainnet.id,d.base.id,d.polygon.id,d.optimism.id]),ph={[d.mainnet.id]:"ethereum",[d.base.id]:"base",[d.optimism.id]:"optimism",[d.polygon.id]:"polygon",[d.arbitrum.id]:"arbitrum"};let yh=Math.floor(160);let mh=({status:t,onClickCta:r})=>{let{title:n,body:i,cta:o}=a.useMemo((()=>(e=>{switch(e){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Getting your purchase status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(t)),[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(vh,{children:[e.jsx(fh,{isSucccess:"success"===t}),e.jsxs(zs,{children:[e.jsx("h3",{children:n}),e.jsx(gh,{children:i})]})]}),o&&e.jsx(bo,{onClick:r,children:o})]})},fh=({isSucccess:t})=>{if(!t){let t="var(--privy-color-foreground-4)";return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(vo,{color:t,style:{position:"absolute"}}),e.jsx(wo,{color:t}),e.jsx(Sa,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let r=(t=>t?Ye.default:()=>e.jsx(yt.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}))(t),n=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(t);return e.jsx("div",{style:{borderColor:n,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&e.jsx(r,{width:"4rem",height:"4rem",color:n})})},gh=E.styled.p`
1841
1841
  font-size: 1rem;
1842
1842
  color: var(--privy-color-foreground-3);
1843
1843
  margin-bottom: 1rem;
1844
1844
  display: flex;
1845
1845
  flex-direction: column;
1846
1846
  gap: 1rem;
1847
- `,gh=E.styled.div`
1847
+ `,vh=E.styled.div`
1848
1848
  display: flex;
1849
1849
  flex-direction: column;
1850
1850
  align-items: center;
@@ -1852,7 +1852,7 @@
1852
1852
  margin-left: 1.75rem;
1853
1853
  margin-right: 1.75rem;
1854
1854
  padding: 2rem 0;
1855
- `;const vh=({children:t})=>e.jsxs(wh,{children:[e.jsx(P.ExclamationTriangleIcon,{width:"3rem",color:"var(--privy-color-error)"}),t]});let wh=E.styled.div`
1855
+ `;const wh=({children:t})=>e.jsxs(xh,{children:[e.jsx(P.ExclamationTriangleIcon,{width:"3rem",color:"var(--privy-color-error)"}),t]});let xh=E.styled.div`
1856
1856
  display: flex;
1857
1857
  gap: 0.5rem;
1858
1858
  background-color: var(--privy-color-error-light);
@@ -1871,11 +1871,11 @@
1871
1871
  border: 1px solid var(--privy-color-error);
1872
1872
  border-radius: var(--privy-border-radius-sm);
1873
1873
  }
1874
- `;const xh=async({address:e,chain:t,rpcConfig:r,privyAppId:n})=>{try{let i=J.createPublicClient({chain:t,transport:J.http(c.getJsonRpcEndpointFromChain(t,r,n))}),[a,o]=await Promise.all([i.readContract({abi:Ch,address:e,functionName:"symbol"}),i.readContract({abi:Ch,address:e,functionName:"decimals"})]);return{decimals:o,symbol:a}}catch(e){return console.log(e),null}};let Ch=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];const Eh="moonpay";let bh=new Set([d.mainnet.id,d.arbitrum.id,d.base.id,d.polygon.id]),Sh=new Set([d.mainnet.id,d.arbitrum.id,d.optimism.id,d.base.id,d.polygon.id]);function Ah(e){return parseFloat(e)}function jh(e){return!!e&&void 0!==e.config&&void 0!==e.provider}function $h(e){return!!e&&(void 0!==e.chain||void 0!==e.amount)}function Th(e,t=!1){let[r,n]=a.useState(null),{createAnalyticsEvent:i}=s.usePrivyInternal(),{data:o,navigate:l,setModalData:c}=v.usePrivyModal(),u=o?.funding,h=a.useRef(0);return a.useEffect((()=>{let r=setInterval((async()=>{if(e)try{let[a]=await async function(e,t){return w.ofetch(`${t?d.MOONPAY_API_URL_SANDBOX:d.MOONPAY_API_URL}/transactions/ext/${e}`,{query:{apiKey:t?d.MOONPAY_PUBLIC_KEY_SANDBOX:d.MOONPAY_PUBLIC_KEY}})}(e,t),o="waitingAuthorization"===a.status&&"credit_debit_card"===a.paymentMethod?"pending":a.status;if(["failed","completed","awaitingAuthorization"].includes(o)&&(i({eventName:Bc,payload:{status:o,provider:Eh,paymentMethod:a.paymentMethod,cardPaymentType:a.cardPaymentType,currency:a.currency?.code,baseCurrencyAmount:a.baseCurrencyAmount,quoteCurrencyAmount:a.quoteCurrencyAmount,feeAmount:a.feeAmount,extraFeeAmount:a.extraFeeAmount,networkFeeAmount:a.networkFeeAmount,isSandbox:t}}),clearInterval(r)),"failed"===o||"serviceFailure"===o)return c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),void l(v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN);n(o)}catch(e){404!==e.response?.status&&(h.current+=1),h.current>=3&&(i({eventName:Bc,payload:{status:"serviceFailure",provider:Eh}}),clearInterval(r),c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),l(v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN))}}),3e3);return()=>clearInterval(r)}),[e,h]),r}const Ph=({size:t=61,...r})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:e.jsxs("g",{id:"moonpay_symbol_wht 2",children:[e.jsx("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),e.jsx("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});let _h=({...t})=>e.jsx(La,{color:"black",...t}),kh=t=>{let[r,n]=a.useState(!1);return e.jsx(Fh,{onClick:()=>{n(!0),navigator.clipboard.writeText(t.text),setTimeout((()=>n(!1)),1500)},children:e.jsxs(Rh,{children:[r?e.jsx(pc,{style:{height:"16px",width:"16px"},strokeWidth:"2"}):e.jsx(at.default,{style:{height:"16px",width:"16px"}}),r?"Copied":"Copy address"]})})},Nh=E.styled.div`
1874
+ `;const Ch=async({address:e,chain:t,rpcConfig:r,privyAppId:n})=>{try{let i=J.createPublicClient({chain:t,transport:J.http(d.getJsonRpcEndpointFromChain(t,r,n))}),[a,o]=await Promise.all([i.readContract({abi:Eh,address:e,functionName:"symbol"}),i.readContract({abi:Eh,address:e,functionName:"decimals"})]);return{decimals:o,symbol:a}}catch(e){return console.log(e),null}};let Eh=[{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];const bh="moonpay";let Sh=new Set([d.mainnet.id,d.arbitrum.id,d.base.id,d.polygon.id]),Ah=new Set([d.mainnet.id,d.arbitrum.id,d.optimism.id,d.base.id,d.polygon.id]);function jh(e){return parseFloat(e)}function $h(e){return!!e&&void 0!==e.config&&void 0!==e.provider}function Th(e){return!!e&&(void 0!==e.chain||void 0!==e.amount)}function Ph(e,t=!1){let[r,n]=a.useState(null),{createAnalyticsEvent:i}=s.usePrivyInternal(),{data:o,navigate:l,setModalData:c}=v.usePrivyModal(),u=o?.funding,h=a.useRef(0);return a.useEffect((()=>{let r=setInterval((async()=>{if(e)try{let[a]=await async function(e,t){return w.ofetch(`${t?d.MOONPAY_API_URL_SANDBOX:d.MOONPAY_API_URL}/transactions/ext/${e}`,{query:{apiKey:t?d.MOONPAY_PUBLIC_KEY_SANDBOX:d.MOONPAY_PUBLIC_KEY}})}(e,t),o="waitingAuthorization"===a.status&&"credit_debit_card"===a.paymentMethod?"pending":a.status;if(["failed","completed","awaitingAuthorization"].includes(o)&&(i({eventName:Bc,payload:{status:o,provider:bh,paymentMethod:a.paymentMethod,cardPaymentType:a.cardPaymentType,currency:a.currency?.code,baseCurrencyAmount:a.baseCurrencyAmount,quoteCurrencyAmount:a.quoteCurrencyAmount,feeAmount:a.feeAmount,extraFeeAmount:a.extraFeeAmount,networkFeeAmount:a.networkFeeAmount,isSandbox:t}}),clearInterval(r)),"failed"===o||"serviceFailure"===o)return c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),void l(v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN);n(o)}catch(e){404!==e.response?.status&&(h.current+=1),h.current>=3&&(i({eventName:Bc,payload:{status:"serviceFailure",provider:bh}}),clearInterval(r),c({funding:{...u,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."}}),l(v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN))}}),3e3);return()=>clearInterval(r)}),[e,h]),r}const _h=({size:t=61,...r})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:e.jsxs("g",{id:"moonpay_symbol_wht 2",children:[e.jsx("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),e.jsx("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});let kh=({...t})=>e.jsx(Da,{color:"black",...t}),Nh=t=>{let[r,n]=a.useState(!1);return e.jsx(Lh,{onClick:()=>{n(!0),navigator.clipboard.writeText(t.text),setTimeout((()=>n(!1)),1500)},children:e.jsxs(Fh,{children:[r?e.jsx(pc,{style:{height:"16px",width:"16px"},strokeWidth:"2"}):e.jsx(at.default,{style:{height:"16px",width:"16px"}}),r?"Copied":"Copy address"]})})},Ih=E.styled.div`
1875
1875
  display: flex;
1876
1876
  flex-direction: row;
1877
1877
  gap: 8px;
1878
- `,Ih=E.styled.div`
1878
+ `,Mh=E.styled.div`
1879
1879
  display: flex;
1880
1880
  flex-direction: row;
1881
1881
  padding: 8px;
@@ -1884,11 +1884,11 @@
1884
1884
  svg {
1885
1885
  margin-right: 12px;
1886
1886
  }
1887
- `,Mh=E.styled.div`
1888
- line-height: 20px;
1889
- font-size: 18px
1890
- text-align: center;
1891
1887
  `,Oh=E.styled.div`
1888
+ line-height: 20px;
1889
+ font-size: 18px;
1890
+ text-align: center;
1891
+ `,Rh=E.styled.div`
1892
1892
  display: flex;
1893
1893
  flex-direction: column;
1894
1894
  background-color: var(--privy-color-background-2);
@@ -1898,11 +1898,11 @@
1898
1898
  }
1899
1899
  padding: 16px;
1900
1900
  gap: 8px;
1901
- `,Rh=E.styled.span`
1901
+ `,Fh=E.styled.span`
1902
1902
  display: flex;
1903
1903
  align-items: center;
1904
1904
  margin: auto;
1905
- `,Fh=E.styled.button`
1905
+ `,Lh=E.styled.button`
1906
1906
  display: flex;
1907
1907
  align-items: center;
1908
1908
  width: 100%;
@@ -1939,7 +1939,7 @@
1939
1939
  width: 18px;
1940
1940
  height: 18px;
1941
1941
  }
1942
- `;const Lh=({title:t,desc:r,icon:n})=>e.jsxs(qh,{children:[e.jsx(Vh,{children:n}),e.jsxs(zh,{children:[e.jsx(Hh,{children:t}),e.jsx(Gh,{children:r})]})]}),Uh=({app:t,signedUrl:r,onContinue:n})=>e.jsxs(e.Fragment,{children:[e.jsxs(Wh,{children:[e.jsx(Ph,{size:"3.75rem"}),e.jsxs(Bh,{children:[t?.name," uses ",e.jsx("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),e.jsxs(Kh,{children:[e.jsx(Lh,{icon:e.jsx(vt.default,{width:"1rem"}),title:"Purchase assets to fund your account",desc:e.jsxs(e.Fragment,{children:["Connect a payment method (",e.jsx("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),e.jsx(Lh,{icon:e.jsx(ut.default,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),e.jsx(Lh,{icon:e.jsx(tt.default,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),e.jsx(Yh,{className:"mobile-only"})]}),e.jsx(Dh,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),e.jsx(jo,{disabled:!r,href:r??"#",target:"_blank",rel:"noopener noreferrer",onClick:n,children:"Continue to Moonpay"})]});let Dh=E.styled.span`
1942
+ `;const Uh=({title:t,desc:r,icon:n})=>e.jsxs(zh,{children:[e.jsx(Kh,{children:n}),e.jsxs(Vh,{children:[e.jsx(Gh,{children:t}),e.jsx(qh,{children:r})]})]}),Dh=({app:t,signedUrl:r,onContinue:n})=>e.jsxs(e.Fragment,{children:[e.jsxs(Bh,{children:[e.jsx(_h,{size:"3.75rem"}),e.jsxs(Hh,{children:[t?.name," uses ",e.jsx("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),e.jsxs(Yh,{children:[e.jsx(Uh,{icon:e.jsx(vt.default,{width:"1rem"}),title:"Purchase assets to fund your account",desc:e.jsxs(e.Fragment,{children:["Connect a payment method (",e.jsx("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),e.jsx(Uh,{icon:e.jsx(ut.default,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),e.jsx(Uh,{icon:e.jsx(tt.default,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),e.jsx(Zh,{className:"mobile-only"})]}),e.jsx(Wh,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),e.jsx(jo,{disabled:!r,href:r??"#",target:"_blank",rel:"noopener noreferrer",onClick:n,children:"Continue to Moonpay"})]});let Wh=E.styled.span`
1943
1943
  display: inline-block;
1944
1944
  color: var(--privy-color-foreground-3);
1945
1945
  text-align: center;
@@ -1948,13 +1948,13 @@
1948
1948
  font-weight: 400;
1949
1949
  line-height: 140%; /* 0.875rem */
1950
1950
  margin-bottom: 0.25rem;
1951
- `,Wh=E.styled.div`
1951
+ `,Bh=E.styled.div`
1952
1952
  display: flex;
1953
1953
  flex-direction: column;
1954
1954
  align-items: center;
1955
1955
  justify-content: center;
1956
1956
  padding: 1.5rem 0;
1957
- `,Bh=E.styled.span`
1957
+ `,Hh=E.styled.span`
1958
1958
  color: var(--privy-color-foreground);
1959
1959
  text-align: center;
1960
1960
  font-size: 1.125rem;
@@ -1963,46 +1963,46 @@
1963
1963
  margin: 1.5rem 0;
1964
1964
  text-align: center;
1965
1965
  max-width: 19.5rem;
1966
- `,Hh=E.styled.span`
1966
+ `,Gh=E.styled.span`
1967
1967
  color: var(--privy-color-foreground);
1968
1968
  font-size: 0.875rem;
1969
1969
  font-weight: 500;
1970
1970
  line-height: 1.225rem;
1971
1971
  width: 100%;
1972
- `,Gh=E.styled.span`
1972
+ `,qh=E.styled.span`
1973
1973
  color: var(--privy-color-foreground-2);
1974
1974
  font-size: 0.875rem;
1975
1975
  font-weight: 400;
1976
1976
  line-height: 1.225rem;
1977
- `,qh=E.styled.div`
1977
+ `,zh=E.styled.div`
1978
1978
  display: flex;
1979
1979
  align-items: flex-start;
1980
1980
  gap: 0.5rem;
1981
1981
  align-self: stretch;
1982
- `,zh=E.styled.div`
1982
+ `,Vh=E.styled.div`
1983
1983
  display: flex;
1984
1984
  flex-direction: column;
1985
1985
  gap: 0.25rem;
1986
1986
  align-items: flex-start;
1987
1987
  text-align: left;
1988
1988
  flex: 1 0 0;
1989
- `,Vh=E.styled.div`
1990
- padding-top: 2px;
1991
1989
  `,Kh=E.styled.div`
1990
+ padding-top: 2px;
1991
+ `,Yh=E.styled.div`
1992
1992
  display: flex;
1993
1993
  flex-direction: column;
1994
1994
  gap: 1.25rem;
1995
1995
  margin: 0 0.5rem;
1996
- `,Yh=E.styled.div`
1996
+ `,Zh=E.styled.div`
1997
1997
  margin: 30px 0;
1998
- `;let Zh=({status:t,onClickCta:r})=>{let{title:n,body:i,cta:o}=a.useMemo((()=>(e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}})(t)),[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(Qh,{children:[e.jsx(Xh,{status:t}),e.jsxs(zs,{children:[e.jsx("h3",{children:n}),e.jsx(Jh,{children:i})]})]}),o&&e.jsx(bo,{onClick:r,children:o})]})},Xh=({status:t})=>{if(!t||"pending"===t){let t="var(--privy-color-foreground-4)";return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(vo,{color:t,style:{position:"absolute"}}),e.jsx(wo,{color:t}),e.jsx(Ph,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let r=(t=>{switch(t){case"completed":return Ye.default;case"waitingAuthorization":return()=>e.jsx(yt.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}})(t),n=(e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)")(t);return e.jsx("div",{style:{borderColor:n,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&e.jsx(r,{width:"4rem",height:"4rem",color:n})})},Jh=E.styled.p`
1998
+ `;let Xh=({status:t,onClickCta:r})=>{let{title:n,body:i,cta:o}=a.useMemo((()=>(e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}})(t)),[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(ep,{children:[e.jsx(Jh,{status:t}),e.jsxs(zs,{children:[e.jsx("h3",{children:n}),e.jsx(Qh,{children:i})]})]}),o&&e.jsx(bo,{onClick:r,children:o})]})},Jh=({status:t})=>{if(!t||"pending"===t){let t="var(--privy-color-foreground-4)";return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(vo,{color:t,style:{position:"absolute"}}),e.jsx(wo,{color:t}),e.jsx(_h,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let r=(t=>{switch(t){case"completed":return Ye.default;case"waitingAuthorization":return()=>e.jsx(yt.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}})(t),n=(e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)")(t);return e.jsx("div",{style:{borderColor:n,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:r&&e.jsx(r,{width:"4rem",height:"4rem",color:n})})},Qh=E.styled.p`
1999
1999
  font-size: 1rem;
2000
2000
  color: var(--privy-color-foreground-3);
2001
2001
  margin-bottom: 1rem;
2002
2002
  display: flex;
2003
2003
  flex-direction: column;
2004
2004
  gap: 1rem;
2005
- `,Qh=E.styled.div`
2005
+ `,ep=E.styled.div`
2006
2006
  display: flex;
2007
2007
  flex-direction: column;
2008
2008
  align-items: center;
@@ -2010,7 +2010,7 @@
2010
2010
  margin-left: 1.75rem;
2011
2011
  margin-right: 1.75rem;
2012
2012
  padding: 2rem 0;
2013
- `;const ep=()=>{let{enabled:t,token:r}=xa(),{navigate:n,setModalData:i}=v.usePrivyModal(),{initLoginWithPasskey:a}=s.usePrivyInternal();return e.jsx(rp,{onClick:async()=>{t&&!r?(i({captchaModalData:{callback:e=>a(e),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),n(v.ModalScreen.CAPTCHA_SCREEN)):(await a(),n(v.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE))},children:"I have a passkey"})};let tp=E.css`
2013
+ `;const tp=()=>{let{enabled:t,token:r}=xa(),{navigate:n,setModalData:i}=v.usePrivyModal(),{initLoginWithPasskey:a}=s.usePrivyInternal();return e.jsx(np,{onClick:async()=>{t&&!r?(i({captchaModalData:{callback:e=>a(e),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),n(v.ModalScreen.CAPTCHA_SCREEN)):(await a(),n(v.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE))},children:"I have a passkey"})};let rp=E.css`
2014
2014
  && {
2015
2015
  width: 100%;
2016
2016
  font-size: 0.875rem;
@@ -2035,9 +2035,9 @@
2035
2035
  box-shadow: none;
2036
2036
  }
2037
2037
  }
2038
- `;const rp=E.styled.button`
2039
- ${tp}
2040
- `,np=({onClick:t,text:r})=>e.jsxs(Jo,{onClick:t,children:[e.jsx(He.default,{}),e.jsx(zo,{children:r}),e.jsx(wt.default,{})]});let ip=E.styled.div`
2038
+ `;const np=E.styled.button`
2039
+ ${rp}
2040
+ `,ip=({onClick:t,text:r})=>e.jsxs(Jo,{onClick:t,children:[e.jsx(He.default,{}),e.jsx(zo,{children:r}),e.jsx(wt.default,{})]});let ap=E.styled.div`
2041
2041
  border-radius: 50%;
2042
2042
  height: 68px;
2043
2043
  width: 68px;
@@ -2047,18 +2047,18 @@
2047
2047
  background-color: var(--privy-color-accent);
2048
2048
  color: white;
2049
2049
  margin: 0 auto 24px auto;
2050
- `;const ap=({style:t,...r})=>e.jsx("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",...t},...r,children:e.jsx("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)"})}),op=E.styled.div`
2050
+ `;const op=({style:t,...r})=>e.jsx("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",...t},...r,children:e.jsx("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)"})}),sp=E.styled.div`
2051
2051
  display: flex;
2052
2052
  flex-direction: column;
2053
2053
  justify-content: flex-start;
2054
2054
  gap: 4px;
2055
- `,sp=E.styled.div`
2055
+ `,lp=E.styled.div`
2056
2056
  &&& {
2057
2057
  margin-left: 7px; /* TODO: This is a total hack */
2058
2058
  border-left: 2px solid var(--privy-color-foreground-4);
2059
2059
  height: 12px;
2060
2060
  }
2061
- `,lp=({children:t})=>e.jsxs(dp,{children:[e.jsx(ap,{style:{width:"16px",height:"16px"}}),t]});let dp=E.styled.div`
2061
+ `,dp=({children:t})=>e.jsxs(cp,{children:[e.jsx(op,{style:{width:"16px",height:"16px"}}),t]});let cp=E.styled.div`
2062
2062
  display: flex;
2063
2063
  justify-content: flex-start;
2064
2064
  justify-items: center;
@@ -2076,22 +2076,22 @@
2076
2076
  margin-bottom: auto;
2077
2077
  }
2078
2078
  }
2079
- `,cp=()=>{let t=Me.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return e.jsxs(up,{children:[e.jsx(Qs,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),e.jsx(Ws,{children:e.jsx(Ba,{style:{width:"152px",height:"152px"}})}),e.jsxs(op,{children:[e.jsx(lp,{children:e.jsxs("div",{children:[e.jsx("span",{children:"Install the "}),e.jsx("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),e.jsx(sp,{}),e.jsx(lp,{children:"Set up your first wallet"}),e.jsx(sp,{}),e.jsx(lp,{children:"Store your recovery phrase in a safe place!"})]}),e.jsx(_o,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]})};let up=E.styled(Ws)`
2079
+ `,up=()=>{let t=Me.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return e.jsxs(hp,{children:[e.jsx(Qs,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),e.jsx(Ws,{children:e.jsx(Ga,{style:{width:"152px",height:"152px"}})}),e.jsxs(sp,{children:[e.jsx(dp,{children:e.jsxs("div",{children:[e.jsx("span",{children:"Install the "}),e.jsx("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),e.jsx(lp,{}),e.jsx(dp,{children:"Set up your first wallet"}),e.jsx(lp,{}),e.jsx(dp,{children:"Store your recovery phrase in a safe place!"})]}),e.jsx(_o,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]})};let hp=E.styled(Ws)`
2080
2080
  gap: 30px;
2081
2081
 
2082
2082
  > :first-child > svg {
2083
2083
  margin-top: 20px;
2084
2084
  }
2085
- `,hp={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 pp=e=>{let t=hp[e];return"wallet"===e||"phone"===e?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}},yp=()=>{let{app:t}=v.usePrivyModal(),r=t?.appearance?.logo,n=`${t?.name} logo`,i={maxHeight:"90px",maxWidth:"180px"};return r?"string"==typeof r?e.jsx("img",{src:r,alt:n,style:i}):"svg"===r.type||"img"===r.type?Ie.default.cloneElement(r,{alt:n,style:i}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},mp=t=>{let{app:r}=v.usePrivyModal();return r?.appearance.logo?e.jsx(fp,{...t,children:e.jsx(yp,{})}):null},fp=E.styled.div`
2085
+ `,pp={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 yp=e=>{let t=pp[e];return"wallet"===e||"phone"===e?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}},mp=()=>{let{app:t}=v.usePrivyModal(),r=t?.appearance?.logo,n=`${t?.name} logo`,i={maxHeight:"90px",maxWidth:"180px"};return r?"string"==typeof r?e.jsx("img",{src:r,alt:n,style:i}):"svg"===r.type||"img"===r.type?Ie.default.cloneElement(r,{alt:n,style:i}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},fp=t=>{let{app:r}=v.usePrivyModal();return r?.appearance.logo?e.jsx(gp,{...t,children:e.jsx(mp,{})}):null},gp=E.styled.div`
2086
2086
  display: flex;
2087
2087
  flex-direction: column;
2088
2088
  align-items: center;
2089
2089
  padding: 24px 0;
2090
2090
  flex-grow: 1;
2091
2091
  justify-content: center;
2092
- `,gp=a.forwardRef(((t,r)=>{let[n,i]=a.useState(t.defaultValue||""),[o,l]=a.useState(!1),{authenticated:d}=s.usePrivy(),{initLoginWithEmail:u}=s.usePrivyInternal(),{navigate:h,setModalData:p,currentScreen:y,data:m}=v.usePrivyModal(),{enabled:f,token:g}=xa(),[w,x]=a.useState(!1),{accountType:C}=c.useRecentlyUsedLogin(),E=c.validateEmail(n),b=o||!E,S=()=>{!f||g||d?(e=>{l(!0),u(n,e,m?.login?.disableSignup).then((()=>{h(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)})).catch((e=>{p({errorModalData:{error:e,previousScreen:y||v.ModalScreen.LANDING}}),h(v.ModalScreen.ERROR_SCREEN)})).finally((()=>{l(!1)}))})(g):(p({captchaModalData:{callback:e=>u(n,e),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),h(v.ModalScreen.CAPTCHA_SCREEN))};return e.jsxs(e.Fragment,{children:[e.jsx(vp,{children:e.jsxs(wp,{$stacked:t.stacked,children:[e.jsx(Ve.default,{}),e.jsx("input",{ref:r,id:"email-input",type:"email",placeholder:"your@email.com",onFocus:()=>x(!0),onChange:e=>i(e.target.value),onKeyUp:e=>{"Enter"===e.key&&S()},value:n,autoComplete:"email"}),"email"!==C||w?t.stacked?e.jsx("span",{}):e.jsx(ko,{isSubmitting:o,onClick:S,disabled:b,children:"Submit"}):e.jsx(c.Chip,{color:"gray",children:"Recent"})]})}),t.stacked?e.jsx(bo,{loadingText:null,loading:o,disabled:b,onClick:S,children:"Submit"}):null]})}));let vp=E.styled.div`
2092
+ `,vp=a.forwardRef(((t,r)=>{let[n,i]=a.useState(t.defaultValue||""),[o,l]=a.useState(!1),{authenticated:u}=s.usePrivy(),{initLoginWithEmail:h}=s.usePrivyInternal(),{navigate:p,setModalData:y,currentScreen:m,data:f}=v.usePrivyModal(),{enabled:g,token:w}=xa(),[x,C]=a.useState(!1),{accountType:E}=c.useRecentlyUsedLogin(),b=d.validateEmail(n),S=o||!b,A=()=>{!g||w||u?(e=>{l(!0),h(n,e,f?.login?.disableSignup).then((()=>{p(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)})).catch((e=>{y({errorModalData:{error:e,previousScreen:m||v.ModalScreen.LANDING}}),p(v.ModalScreen.ERROR_SCREEN)})).finally((()=>{l(!1)}))})(w):(y({captchaModalData:{callback:e=>h(n,e),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),p(v.ModalScreen.CAPTCHA_SCREEN))};return e.jsxs(e.Fragment,{children:[e.jsx(wp,{children:e.jsxs(xp,{$stacked:t.stacked,children:[e.jsx(Ve.default,{}),e.jsx("input",{ref:r,id:"email-input",type:"email",placeholder:"your@email.com",onFocus:()=>C(!0),onChange:e=>i(e.target.value),onKeyUp:e=>{"Enter"===e.key&&A()},value:n,autoComplete:"email"}),"email"!==E||x?t.stacked?e.jsx("span",{}):e.jsx(ko,{isSubmitting:o,onClick:A,disabled:S,children:"Submit"}):e.jsx(c.Chip,{color:"gray",children:"Recent"})]})}),t.stacked?e.jsx(bo,{loadingText:null,loading:o,disabled:S,onClick:A,children:"Submit"}):null]})}));let wp=E.styled.div`
2093
2093
  width: 100%;
2094
- `,wp=E.styled.label`
2094
+ `,xp=E.styled.label`
2095
2095
  display: block;
2096
2096
  position: relative;
2097
2097
  width: 100%;
@@ -2158,11 +2158,11 @@
2158
2158
  && > input::placeholder {
2159
2159
  color: var(--privy-color-foreground-3);
2160
2160
  }
2161
- `;const xp=({isEditable:t,setIsEditable:r,defaultValue:n})=>{let i=a.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsx(es,{$if:!t,children:e.jsx(gp,{ref:i,defaultValue:n})}),e.jsx(es,{$if:t,children:e.jsxs(Jo,{onClick:()=>{r(),setTimeout((()=>{i.current?.focus()}),0)},children:[e.jsx(Ve.default,{})," Continue with Email"]})})]})},Cp=()=>{let[t,r]=a.useState(!1),{currentScreen:n,navigate:i,setModalData:o,data:l}=v.usePrivyModal(),{enabled:d,token:u}=xa(),{initLoginWithFarcaster:h}=s.usePrivyInternal(),{accountType:p}=c.useRecentlyUsedLogin();return e.jsxs(Jo,{onClick:async()=>{r(!0);try{d&&!u?(o({captchaModalData:{callback:e=>h(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:v.ModalScreen.AWAITING_FARCASTER_CONNECTION,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),i(v.ModalScreen.CAPTCHA_SCREEN)):(await h(u,l?.login?.disableSignup),i(v.ModalScreen.AWAITING_FARCASTER_CONNECTION))}catch(e){o({errorModalData:{error:e,previousScreen:n||v.ModalScreen.LANDING}}),i(v.ModalScreen.ERROR_SCREEN)}finally{r(!1)}},disabled:!1,children:[e.jsx($c,{})," Farcaster",t&&e.jsx(xo,{}),"farcaster"===p&&e.jsx(Ep,{color:"gray",children:"Recent"})]})};let Ep=E.styled(c.Chip)`
2161
+ `;const Cp=({isEditable:t,setIsEditable:r,defaultValue:n})=>{let i=a.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsx(es,{$if:!t,children:e.jsx(vp,{ref:i,defaultValue:n})}),e.jsx(es,{$if:t,children:e.jsxs(Jo,{onClick:()=>{r(),setTimeout((()=>{i.current?.focus()}),0)},children:[e.jsx(Ve.default,{})," Continue with Email"]})})]})},Ep=()=>{let[t,r]=a.useState(!1),{currentScreen:n,navigate:i,setModalData:o,data:l}=v.usePrivyModal(),{enabled:d,token:u}=xa(),{initLoginWithFarcaster:h}=s.usePrivyInternal(),{accountType:p}=c.useRecentlyUsedLogin();return e.jsxs(Jo,{onClick:async()=>{r(!0);try{d&&!u?(o({captchaModalData:{callback:e=>h(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:v.ModalScreen.AWAITING_FARCASTER_CONNECTION,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),i(v.ModalScreen.CAPTCHA_SCREEN)):(await h(u,l?.login?.disableSignup),i(v.ModalScreen.AWAITING_FARCASTER_CONNECTION))}catch(e){o({errorModalData:{error:e,previousScreen:n||v.ModalScreen.LANDING}}),i(v.ModalScreen.ERROR_SCREEN)}finally{r(!1)}},disabled:!1,children:[e.jsx($c,{})," Farcaster",t&&e.jsx(xo,{}),"farcaster"===p&&e.jsx(bp,{color:"gray",children:"Recent"})]})};let bp=E.styled(c.Chip)`
2162
2162
  margin-left: auto;
2163
- `;const bp=({value:t,onChange:r})=>e.jsx("select",{value:t,onChange:r,children:Ei.map((t=>e.jsxs("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),Sp=a.forwardRef(((t,r)=>{let{app:n}=v.usePrivyModal(),[i,o]=a.useState(!1),{accountType:s}=c.useRecentlyUsedLogin(),[l,d]=a.useState(""),[u,h]=a.useState(n?.intl.defaultCountry??"US"),p=wi(l,u),y=(e=>new gi(e))(u),m=(e=>{let t=function(){return dr(fi,arguments)}(e,sr)?.formatInternational();return t?.substring(t.indexOf(" ")+1)})(u),f=vi(u),g=!p,[w,x]=a.useState(!1),C=f.length,E=e=>{let r=e.target.value;h(r),d(""),t.onChange&&t.onChange({rawPhoneNumber:l,qualifiedPhoneNumber:xi(l,r),countryCode:r,isValid:wi(l,u)})},b=(e,r)=>{try{let n=e.replace(/\D/g,"")===l.replace(/\D/g,"")?e:y.input(e);d(n),t.onChange&&t.onChange({rawPhoneNumber:n,qualifiedPhoneNumber:xi(e,r),countryCode:r,isValid:wi(e,r)})}catch(e){console.error("Error processing phone number:",e)}},S=()=>{x(!0);let e=xi(l,u);t.onSubmit({rawPhoneNumber:l,qualifiedPhoneNumber:e,countryCode:u,isValid:wi(l,u)}).finally((()=>x(!1)))};return a.useEffect((()=>{if(t.defaultValue){let e=(e=>{let t=new gi;t.input(e);let r=t.getCountry()||"US",n=t.getCallingCode()||"1";return{countryCode:r,phone:e.replace("+"+n,"")}})(t.defaultValue);y.reset(),E({target:{value:e.countryCode}}),b(e.phone,e.countryCode)}}),[t.defaultValue]),e.jsxs(e.Fragment,{children:[e.jsx(Ap,{children:e.jsxs(jp,{$callingCodeLength:C,$stacked:t.stacked,children:[e.jsx(bp,{value:u,onChange:E}),e.jsx("input",{ref:r,id:"phone-number-input",type:"tel",placeholder:m,onFocus:()=>o(!0),onChange:e=>{b(e.target.value,u)},onKeyUp:e=>{"Enter"===e.key&&S()},value:l,autoComplete:"tel"}),"phone"!==s||i||t.hideRecent?t.stacked||t.noIncludeSubmitButton?e.jsx("span",{}):e.jsx(ko,{isSubmitting:w,onClick:S,disabled:g,children:"Submit"}):e.jsx(c.Chip,{color:"gray",children:"Recent"})]})}),t.stacked&&!t.noIncludeSubmitButton?e.jsx(bo,{loading:w,loadingText:null,onClick:S,disabled:g,children:"Submit"}):null]})}));let Ap=E.styled.div`
2163
+ `;const Sp=({value:t,onChange:r})=>e.jsx("select",{value:t,onChange:r,children:Ei.map((t=>e.jsxs("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),Ap=a.forwardRef(((t,r)=>{let{app:n}=v.usePrivyModal(),[i,o]=a.useState(!1),{accountType:s}=c.useRecentlyUsedLogin(),[l,d]=a.useState(""),[u,h]=a.useState(n?.intl.defaultCountry??"US"),p=wi(l,u),y=(e=>new gi(e))(u),m=(e=>{let t=function(){return dr(fi,arguments)}(e,sr)?.formatInternational();return t?.substring(t.indexOf(" ")+1)})(u),f=vi(u),g=!p,[w,x]=a.useState(!1),C=f.length,E=e=>{let r=e.target.value;h(r),d(""),t.onChange&&t.onChange({rawPhoneNumber:l,qualifiedPhoneNumber:xi(l,r),countryCode:r,isValid:wi(l,u)})},b=(e,r)=>{try{let n=e.replace(/\D/g,"")===l.replace(/\D/g,"")?e:y.input(e);d(n),t.onChange&&t.onChange({rawPhoneNumber:n,qualifiedPhoneNumber:xi(e,r),countryCode:r,isValid:wi(e,r)})}catch(e){console.error("Error processing phone number:",e)}},S=()=>{x(!0);let e=xi(l,u);t.onSubmit({rawPhoneNumber:l,qualifiedPhoneNumber:e,countryCode:u,isValid:wi(l,u)}).finally((()=>x(!1)))};return a.useEffect((()=>{if(t.defaultValue){let e=(e=>{let t=new gi;t.input(e);let r=t.getCountry()||"US",n=t.getCallingCode()||"1";return{countryCode:r,phone:e.replace("+"+n,"")}})(t.defaultValue);y.reset(),E({target:{value:e.countryCode}}),b(e.phone,e.countryCode)}}),[t.defaultValue]),e.jsxs(e.Fragment,{children:[e.jsx(jp,{children:e.jsxs($p,{$callingCodeLength:C,$stacked:t.stacked,children:[e.jsx(Sp,{value:u,onChange:E}),e.jsx("input",{ref:r,id:"phone-number-input",type:"tel",placeholder:m,onFocus:()=>o(!0),onChange:e=>{b(e.target.value,u)},onKeyUp:e=>{"Enter"===e.key&&S()},value:l,autoComplete:"tel"}),"phone"!==s||i||t.hideRecent?t.stacked||t.noIncludeSubmitButton?e.jsx("span",{}):e.jsx(ko,{isSubmitting:w,onClick:S,disabled:g,children:"Submit"}):e.jsx(c.Chip,{color:"gray",children:"Recent"})]})}),t.stacked&&!t.noIncludeSubmitButton?e.jsx(bo,{loading:w,loadingText:null,onClick:S,disabled:g,children:"Submit"}):null]})}));let jp=E.styled.div`
2164
2164
  width: 100%;
2165
- `,jp=E.styled.label`
2165
+ `,$p=E.styled.label`
2166
2166
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.$callingCodeLength}px));
2167
2167
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.$callingCodeLength}px));
2168
2168
  display: block;
@@ -2255,15 +2255,15 @@
2255
2255
  && > input::placeholder {
2256
2256
  color: var(--privy-color-foreground-3);
2257
2257
  }
2258
- `;const $p=({isEditable:t,setIsEditable:r,defaultValue:n})=>{let i=a.useRef(null),{authenticated:o}=s.usePrivy(),{navigate:l,setModalData:d,currentScreen:c,data:u}=v.usePrivyModal(),{initLoginWithSms:h}=s.usePrivyInternal(),{enabled:p,token:y}=xa();return e.jsxs(e.Fragment,{children:[e.jsx(es,{$if:!t,children:e.jsx(Sp,{ref:i,onSubmit:async function({qualifiedPhoneNumber:e}){if(!p||y||o)try{await h(e,y,u?.login?.disableSignup),l(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){d({errorModalData:{error:e,previousScreen:c||v.ModalScreen.LANDING}}),l(v.ModalScreen.ERROR_SCREEN)}else d({captchaModalData:{callback:t=>h(e,t,u?.login?.disableSignup),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),l(v.ModalScreen.CAPTCHA_SCREEN)},defaultValue:n})}),e.jsx(es,{$if:t,children:e.jsxs(Jo,{onClick:()=>{r(),setTimeout((()=>{i.current?.focus()}),0)},children:[e.jsx(Ke.default,{})," Continue with SMS"]})})]})};let Tp={apple:{logo:e.jsx(Xi,{}),displayName:"Apple"},discord:{logo:e.jsx(Ji,{}),displayName:"Discord"},github:{logo:e.jsx(Qi,{}),displayName:"GitHub"},google:{logo:e.jsx(ta,{}),displayName:"Google"},linkedin:{logo:e.jsx(na,{}),displayName:"LinkedIn"},spotify:{logo:e.jsx(ia,{}),displayName:"Spotify"},instagram:{logo:e.jsx(ra,{}),displayName:"Instagram"},twitter:{logo:e.jsx(oa,{}),displayName:"Twitter"},tiktok:{logo:e.jsx(aa,{}),displayName:"TikTok"}};const Pp=({provider:t})=>{let{enabled:r,token:n}=xa(),{navigate:i,setModalData:o,data:l}=v.usePrivyModal(),[d,u]=a.useState(!1),{initLoginWithOAuth:h}=s.usePrivyInternal(),{accountType:p}=c.useRecentlyUsedLogin(),y=p?pp(p):null,{displayName:m,logo:f}=Tp[t];return e.jsxs(Jo,{onClick:()=>{u(!0),r&&!n?(o({captchaModalData:{callback:e=>h(t,e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),i(v.ModalScreen.CAPTCHA_SCREEN)):h(t,void 0,l?.login?.disableSignup)},disabled:d,children:[f," ",m,y?.loginMethod===t&&e.jsx(_p,{color:"gray",children:"Recent"})]})};let _p=E.styled(c.Chip)`
2258
+ `;const Tp=({isEditable:t,setIsEditable:r,defaultValue:n})=>{let i=a.useRef(null),{authenticated:o}=s.usePrivy(),{navigate:l,setModalData:d,currentScreen:c,data:u}=v.usePrivyModal(),{initLoginWithSms:h}=s.usePrivyInternal(),{enabled:p,token:y}=xa();return e.jsxs(e.Fragment,{children:[e.jsx(es,{$if:!t,children:e.jsx(Ap,{ref:i,onSubmit:async function({qualifiedPhoneNumber:e}){if(!p||y||o)try{await h(e,y,u?.login?.disableSignup),l(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){d({errorModalData:{error:e,previousScreen:c||v.ModalScreen.LANDING}}),l(v.ModalScreen.ERROR_SCREEN)}else d({captchaModalData:{callback:t=>h(e,t,u?.login?.disableSignup),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),l(v.ModalScreen.CAPTCHA_SCREEN)},defaultValue:n})}),e.jsx(es,{$if:t,children:e.jsxs(Jo,{onClick:()=>{r(),setTimeout((()=>{i.current?.focus()}),0)},children:[e.jsx(Ke.default,{})," Continue with SMS"]})})]})};let Pp={apple:{logo:e.jsx(Xi,{}),displayName:"Apple"},discord:{logo:e.jsx(Ji,{}),displayName:"Discord"},github:{logo:e.jsx(Qi,{}),displayName:"GitHub"},google:{logo:e.jsx(ta,{}),displayName:"Google"},linkedin:{logo:e.jsx(na,{}),displayName:"LinkedIn"},spotify:{logo:e.jsx(ia,{}),displayName:"Spotify"},instagram:{logo:e.jsx(ra,{}),displayName:"Instagram"},twitter:{logo:e.jsx(oa,{}),displayName:"Twitter"},tiktok:{logo:e.jsx(aa,{}),displayName:"TikTok"}};const _p=({provider:t})=>{let{enabled:r,token:n}=xa(),{navigate:i,setModalData:o,data:l}=v.usePrivyModal(),[d,u]=a.useState(!1),{initLoginWithOAuth:h}=s.usePrivyInternal(),{accountType:p}=c.useRecentlyUsedLogin(),y=p?yp(p):null,{displayName:m,logo:f}=Pp[t];return e.jsxs(Jo,{onClick:()=>{u(!0),r&&!n?(o({captchaModalData:{callback:e=>h(t,e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),i(v.ModalScreen.CAPTCHA_SCREEN)):h(t,void 0,l?.login?.disableSignup)},disabled:d,children:[f," ",m,y?.loginMethod===t&&e.jsx(kp,{color:"gray",children:"Recent"})]})};let kp=E.styled(c.Chip)`
2259
2259
  margin-left: auto;
2260
- `;function kp(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...t,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[e.jsx("stop",{offset:"0",stopColor:"#1d93d2"}),e.jsx("stop",{offset:"1",stopColor:"#38b0e3"})]})}),e.jsx("title",{children:"Telegram_logo"}),e.jsx("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),e.jsx("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"}),e.jsx("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"}),e.jsx("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 Np=()=>{let{enabled:t,token:r}=xa(),{navigate:n,setModalData:i,data:o}=v.usePrivyModal(),[l,d]=a.useState(!1),{initLoginWithTelegram:u}=s.usePrivyInternal(),{accountType:h}=c.useRecentlyUsedLogin();async function p(e){try{await u(e,o?.login?.disableSignup),i({telegramAuthModalData:{seamlessAuth:!1}}),n(v.ModalScreen.TELEGRAM_AUTH_SCREEN)}catch(e){console.error(e),d(!1)}}return e.jsxs(Jo,{onClick:async function(){if(d(!0),t&&!r)return i({captchaModalData:{callback:p,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),void n(v.ModalScreen.CAPTCHA_SCREEN);await p(r)},disabled:l,children:[e.jsx(kp,{}),"Telegram","telegram"===h&&e.jsx(Ip,{color:"gray",children:"Recent"})]})};let Ip=E.styled(c.Chip)`
2260
+ `;function Np(t){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 240 240",...t,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{x1:"120",y1:"240",x2:"120",gradientUnits:"userSpaceOnUse",id:"telegram-linear-gradient",children:[e.jsx("stop",{offset:"0",stopColor:"#1d93d2"}),e.jsx("stop",{offset:"1",stopColor:"#38b0e3"})]})}),e.jsx("title",{children:"Telegram_logo"}),e.jsx("circle",{cx:"120",cy:"120",r:"120",fill:"url(#telegram-linear-gradient)"}),e.jsx("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"}),e.jsx("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"}),e.jsx("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 Ip=()=>{let{enabled:t,token:r}=xa(),{navigate:n,setModalData:i,data:o}=v.usePrivyModal(),[l,d]=a.useState(!1),{initLoginWithTelegram:u}=s.usePrivyInternal(),{accountType:h}=c.useRecentlyUsedLogin();async function p(e){try{await u(e,o?.login?.disableSignup),i({telegramAuthModalData:{seamlessAuth:!1}}),n(v.ModalScreen.TELEGRAM_AUTH_SCREEN)}catch(e){console.error(e),d(!1)}}return e.jsxs(Jo,{onClick:async function(){if(d(!0),t&&!r)return i({captchaModalData:{callback:p,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),void n(v.ModalScreen.CAPTCHA_SCREEN);await p(r)},disabled:l,children:[e.jsx(Np,{}),"Telegram","telegram"===h&&e.jsx(Mp,{color:"gray",children:"Recent"})]})};let Mp=E.styled(c.Chip)`
2261
2261
  margin-left: auto;
2262
- `;const Mp=({onClick:t,text:r,icon:n})=>e.jsxs(Jo,{onClick:t,children:[n,e.jsx(zo,{children:r}),e.jsx(wt.default,{})]}),Op=({connectOnly:t})=>{let{closePrivyModal:r,connectors:n}=s.usePrivyInternal(),{app:i,onUserCloseViaDialogOrKeybindRef:o,data:l}=v.usePrivyModal(),{appearance:{palette:{colorScheme:u}}}=d.useAppConfig(),{accountType:h,walletClientType:p}=c.useRecentlyUsedLogin(),y=h?pp(h):null,m=i.loginMethodsAndOrder?.primary??[],f=i.loginMethodsAndOrder?.overflow??[],g=[...m,...f],w=i.loginMethods.passkey,x=l?.login,C=[];p&&g.includes(p)?C.push(p):h&&g.includes(y?.loginMethod)&&C.push(y?.loginMethod);let[E,b]=a.useState("default"),[S,A]=a.useState("phone"===h?"sms":"email");a.useEffect((()=>{"phone"===h&&A("sms");let e=g.indexOf("sms"),t=g.indexOf("email");e>-1&&e<t&&A("sms")}),[h,m,f]);let j=()=>{r({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{b("default")}),150)};o.current=j;let $=r=>"email"===r?e.jsx(xp,{isEditable:"email"===S,setIsEditable:()=>{A("email")},defaultValue:"email"===x?.prefill?.type?x.prefill.value:void 0},r):"sms"===r?e.jsx($p,{isEditable:"sms"===S,setIsEditable:()=>{A("sms")},defaultValue:"phone"===x?.prefill?.type?x.prefill.value:void 0},r):"apple"===r?e.jsx(Pp,{provider:"apple"},r):"discord"===r?e.jsx(Pp,{provider:"discord"},r):"farcaster"===r?e.jsx(Cp,{},r):"github"===r?e.jsx(Pp,{provider:"github"},r):"google"===r?e.jsx(Pp,{provider:"google"},r):"linkedin"===r?e.jsx(Pp,{provider:"linkedin"},r):"spotify"===r?e.jsx(Pp,{provider:"spotify"},r):"instagram"===r?e.jsx(Pp,{provider:"instagram"},r):"tiktok"===r?e.jsx(Pp,{provider:"tiktok"},r):"twitter"===r?e.jsx(Pp,{provider:"twitter"},r):"telegram"===r?e.jsx(Np,{},r):Il([r],i.appearance.walletChainType,n,t,g,i.externalWallets.walletConnect.enabled),T=C.flatMap($),P=m.filter((e=>e!==p&&e!==y?.loginMethod)).flatMap($),_=f.filter((e=>e!==p&&e!==y?.loginMethod)).flatMap($),[k,N]=c.splitAtIndex([...T,...P,..._],Rp({primary:P.length+T.length,overflow:_.length}));return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{title:i.appearance.landingHeader,onClose:j,backFn:"default"===E?void 0:()=>{b("default")}}),"default"===E&&e.jsx(Fp,{}),"default"===E&&("string"==typeof i.appearance.loginMessage?e.jsx(Xo,{children:i.appearance.loginMessage}):i.appearance.loginMessage),e.jsx(Vo,{style:{overflow:"hidden"},children:e.jsxs(Yo,{$colorScheme:u,style:{maxHeight:400,overflowY:"scroll",padding:2},children:["default"===E&&e.jsxs(e.Fragment,{children:[...k,N.length>0&&e.jsx(Mp,{text:"More options",icon:e.jsx(ot.default,{}),onClick:()=>b("overflow")})]}),"overflow"===E&&e.jsxs(e.Fragment,{children:[...N]}),w&&"default"===E&&e.jsx(ep,{})]})}),i&&e.jsx(c.TermsAndConditions,{app:i}),e.jsx(c.BlobbyFooter,{})]})};let Rp=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,Fp=E.styled(mp)`
2262
+ `;const Op=({onClick:t,text:r,icon:n})=>e.jsxs(Jo,{onClick:t,children:[n,e.jsx(zo,{children:r}),e.jsx(wt.default,{})]}),Rp=({connectOnly:t})=>{let{closePrivyModal:r,connectors:n}=s.usePrivyInternal(),{app:i,onUserCloseViaDialogOrKeybindRef:o,data:l}=v.usePrivyModal(),{appearance:{palette:{colorScheme:u}}}=d.useAppConfig(),{accountType:h,walletClientType:p}=c.useRecentlyUsedLogin(),y=h?yp(h):null,m=i.loginMethodsAndOrder?.primary??[],f=i.loginMethodsAndOrder?.overflow??[],g=[...m,...f],w=i.loginMethods.passkey,x=l?.login,C=[];p&&g.includes(p)?C.push(p):h&&g.includes(y?.loginMethod)&&C.push(y?.loginMethod);let[E,b]=a.useState("default"),[S,A]=a.useState("phone"===h?"sms":"email");a.useEffect((()=>{"phone"===h&&A("sms");let e=g.indexOf("sms"),t=g.indexOf("email");e>-1&&e<t&&A("sms")}),[h,m,f]);let j=()=>{r({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{b("default")}),150)};o.current=j;let $=r=>"email"===r?e.jsx(Cp,{isEditable:"email"===S,setIsEditable:()=>{A("email")},defaultValue:"email"===x?.prefill?.type?x.prefill.value:void 0},r):"sms"===r?e.jsx(Tp,{isEditable:"sms"===S,setIsEditable:()=>{A("sms")},defaultValue:"phone"===x?.prefill?.type?x.prefill.value:void 0},r):"apple"===r?e.jsx(_p,{provider:"apple"},r):"discord"===r?e.jsx(_p,{provider:"discord"},r):"farcaster"===r?e.jsx(Ep,{},r):"github"===r?e.jsx(_p,{provider:"github"},r):"google"===r?e.jsx(_p,{provider:"google"},r):"linkedin"===r?e.jsx(_p,{provider:"linkedin"},r):"spotify"===r?e.jsx(_p,{provider:"spotify"},r):"instagram"===r?e.jsx(_p,{provider:"instagram"},r):"tiktok"===r?e.jsx(_p,{provider:"tiktok"},r):"twitter"===r?e.jsx(_p,{provider:"twitter"},r):"telegram"===r?e.jsx(Ip,{},r):Il([r],i.appearance.walletChainType,n,t,g,i.externalWallets.walletConnect.enabled),T=C.flatMap($),P=m.filter((e=>e!==p&&e!==y?.loginMethod)).flatMap($),_=f.filter((e=>e!==p&&e!==y?.loginMethod)).flatMap($),[k,N]=d.splitAtIndex([...T,...P,..._],Fp({primary:P.length+T.length,overflow:_.length}));return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{title:i.appearance.landingHeader,onClose:j,backFn:"default"===E?void 0:()=>{b("default")}}),"default"===E&&e.jsx(Lp,{}),"default"===E&&("string"==typeof i.appearance.loginMessage?e.jsx(Xo,{children:i.appearance.loginMessage}):i.appearance.loginMessage),e.jsx(Vo,{style:{overflow:"hidden"},children:e.jsxs(Yo,{$colorScheme:u,style:{maxHeight:400,overflowY:"scroll",padding:2},children:["default"===E&&e.jsxs(e.Fragment,{children:[...k,N.length>0&&e.jsx(Op,{text:"More options",icon:e.jsx(ot.default,{}),onClick:()=>b("overflow")})]}),"overflow"===E&&e.jsxs(e.Fragment,{children:[...N]}),w&&"default"===E&&e.jsx(tp,{})]})}),i&&e.jsx(c.TermsAndConditions,{app:i}),e.jsx(c.BlobbyFooter,{})]})};let Fp=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,Lp=E.styled(fp)`
2263
2263
  margin-bottom: 16px;
2264
- `;const Lp=({...t})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...t,children:[e.jsxs("g",{clipPath:"url(#clip0_2856_1743)",children:[e.jsx("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_2856_1743",children:e.jsx("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),Up=({connectOnly:t})=>{let{closePrivyModal:r,connectors:n}=s.usePrivyInternal(),{data:i,onUserCloseViaDialogOrKeybindRef:o}=v.usePrivyModal(),l=d.useAppConfig(),{accountType:u,walletClientType:h}=c.useRecentlyUsedLogin(),p=u?pp(u):null,y=i?.login,{email:m,sms:f,google:g,twitter:w,discord:x,github:C,spotify:E,instagram:b,tiktok:S,linkedin:A,apple:j,wallet:$,farcaster:T,telegram:P}=a.useMemo((()=>y?.loginMethods?((e,t=!0)=>e.reduce(((e,r)=>({...e,[r]:t})),{}))(y.loginMethods,!0):null),[y])??l.loginMethods,{passkey:_}=l.loginMethods,k=[m&&"email",f&&"sms",g&&"google",w&&"twitter",x&&"discord",C&&"github",E&&"spotify",b&&"instagram",S&&"tiktok",A&&"linkedin",j&&"apple",T&&"farcaster",P&&"telegram"].filter((e=>!!e)),N=k.length>0,I=a.useMemo((()=>$&&!N?"web3-first":$&&l?.appearance.loginGroupPriority||"web2-first"),[$,N,l?.appearance.loginGroupPriority]),M=l?.appearance.hideDirectWeb2Inputs,[O,R]=a.useState("default"),[F,L]=a.useState(Gp({mostRecentlyUsedAccountType:u,smsAvailable:f,emailAvailable:m,prefilledType:y?.prefill?.type}));a.useEffect((()=>{L(Gp({mostRecentlyUsedAccountType:u,smsAvailable:f,emailAvailable:m,prefilledType:y?.prefill?.type}))}),[m,f,u]);let U=()=>{r({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{R("default")}),150)};o.current=U;let D=[];h&&$?D.push(h):p?.loginMethod&&k.includes(p.loginMethod)&&D.push(p.loginMethod);let W=r=>"email"===r?e.jsx(xp,{isEditable:"email"===F,setIsEditable:()=>{L("email")},defaultValue:"email"===y?.prefill?.type?y.prefill.value:void 0},r):"sms"===r?e.jsx($p,{isEditable:"sms"===F,setIsEditable:()=>{L("sms")},defaultValue:"phone"===y?.prefill?.type?y.prefill.value:void 0},r):"apple"===r?e.jsx(Pp,{provider:"apple"},r):"discord"===r?e.jsx(Pp,{provider:"discord"},r):"farcaster"===r?e.jsx(Cp,{},r):"github"===r?e.jsx(Pp,{provider:"github"},r):"google"===r?e.jsx(Pp,{provider:"google"},r):"linkedin"===r?e.jsx(Pp,{provider:"linkedin"},r):"tiktok"===r?e.jsx(Pp,{provider:"tiktok"},r):"spotify"===r?e.jsx(Pp,{provider:"spotify"},r):"instagram"===r?e.jsx(Pp,{provider:"instagram"},r):"twitter"===r?e.jsx(Pp,{provider:"twitter"},r):"telegram"===r?e.jsx(Np,{},r):Il([r],l.appearance.walletChainType,n,t,[],l.externalWallets.walletConnect.enabled),B=Il(l.appearance.walletList.filter((e=>e!==h)),l.appearance.walletChainType,n,t,[...l.appearance.walletList,h],l.externalWallets.walletConnect.enabled),H=k.filter((e=>e!==p?.loginMethod)).flatMap(W),G=D.flatMap(W);"web3-first"===I&&"default"===O?B.unshift(...G):"web2-first"===I&&H.unshift(...G);let q=k.filter((e=>"email"!==e&&"sms"!==e)),z=Wp({priority:I,email:m,sms:f,social:q}),V=Bp({priority:I,email:m,sms:f,social:q}),K=e.jsx(np,{text:Hp({priority:I}),onClick:()=>R("web3-overflow")}),Y=e.jsx(Mp,{text:z,icon:V,onClick:()=>R("web2-overflow")}),Z=M?0:1;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{title:l.appearance.landingHeader,onClose:U,backFn:"default"===O?void 0:()=>{R("default")}}),"default"===O&&e.jsx(Dp,{}),"default"===O&&("string"==typeof l.appearance.loginMessage?e.jsx(Xo,{children:l.appearance.loginMessage}):l.appearance.loginMessage),e.jsx(Vo,{style:{overflow:"hidden",padding:2},children:e.jsxs(Ko,{children:["default"===O&&"web2-first"===I&&e.jsxs(e.Fragment,{children:[...H.length>4?H.slice(0,3):H,H.length>4&&Y,$&&K]}),"default"===O&&"web3-first"===I&&e.jsxs(e.Fragment,{children:[$&&e.jsxs(e.Fragment,{children:[...B.length>4?B.slice(0,3):B,B.length>4&&K]}),H.length>Z&&Y,H.length===Z&&H[0]]}),"web2-overflow"===O&&e.jsxs(e.Fragment,{children:[..."web3-first"===I?H:H.slice(3)]}),..."web3-overflow"===O?B:[],_&&"default"===O&&e.jsx(ep,{})]})}),l&&e.jsx(c.TermsAndConditions,{app:l}),e.jsx(c.BlobbyFooter,{})]})};let Dp=E.styled(mp)`
2264
+ `;const Up=({...t})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...t,children:[e.jsxs("g",{clipPath:"url(#clip0_2856_1743)",children:[e.jsx("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_2856_1743",children:e.jsx("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),Dp=({connectOnly:t})=>{let{closePrivyModal:r,connectors:n}=s.usePrivyInternal(),{data:i,onUserCloseViaDialogOrKeybindRef:o}=v.usePrivyModal(),l=d.useAppConfig(),{accountType:u,walletClientType:h}=c.useRecentlyUsedLogin(),p=u?yp(u):null,y=i?.login,{email:m,sms:f,google:g,twitter:w,discord:x,github:C,spotify:E,instagram:b,tiktok:S,linkedin:A,apple:j,wallet:$,farcaster:T,telegram:P}=a.useMemo((()=>y?.loginMethods?((e,t=!0)=>e.reduce(((e,r)=>({...e,[r]:t})),{}))(y.loginMethods,!0):null),[y])??l.loginMethods,{passkey:_}=l.loginMethods,k=[m&&"email",f&&"sms",g&&"google",w&&"twitter",x&&"discord",C&&"github",E&&"spotify",b&&"instagram",S&&"tiktok",A&&"linkedin",j&&"apple",T&&"farcaster",P&&"telegram"].filter((e=>!!e)),N=k.length>0,I=a.useMemo((()=>$&&!N?"web3-first":$&&l?.appearance.loginGroupPriority||"web2-first"),[$,N,l?.appearance.loginGroupPriority]),M=l?.appearance.hideDirectWeb2Inputs,[O,R]=a.useState("default"),[F,L]=a.useState(qp({mostRecentlyUsedAccountType:u,smsAvailable:f,emailAvailable:m,prefilledType:y?.prefill?.type}));a.useEffect((()=>{L(qp({mostRecentlyUsedAccountType:u,smsAvailable:f,emailAvailable:m,prefilledType:y?.prefill?.type}))}),[m,f,u]);let U=()=>{r({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{R("default")}),150)};o.current=U;let D=[];h&&$?D.push(h):p?.loginMethod&&k.includes(p.loginMethod)&&D.push(p.loginMethod);let W=r=>"email"===r?e.jsx(Cp,{isEditable:"email"===F,setIsEditable:()=>{L("email")},defaultValue:"email"===y?.prefill?.type?y.prefill.value:void 0},r):"sms"===r?e.jsx(Tp,{isEditable:"sms"===F,setIsEditable:()=>{L("sms")},defaultValue:"phone"===y?.prefill?.type?y.prefill.value:void 0},r):"apple"===r?e.jsx(_p,{provider:"apple"},r):"discord"===r?e.jsx(_p,{provider:"discord"},r):"farcaster"===r?e.jsx(Ep,{},r):"github"===r?e.jsx(_p,{provider:"github"},r):"google"===r?e.jsx(_p,{provider:"google"},r):"linkedin"===r?e.jsx(_p,{provider:"linkedin"},r):"tiktok"===r?e.jsx(_p,{provider:"tiktok"},r):"spotify"===r?e.jsx(_p,{provider:"spotify"},r):"instagram"===r?e.jsx(_p,{provider:"instagram"},r):"twitter"===r?e.jsx(_p,{provider:"twitter"},r):"telegram"===r?e.jsx(Ip,{},r):Il([r],l.appearance.walletChainType,n,t,[],l.externalWallets.walletConnect.enabled),B=Il(l.appearance.walletList.filter((e=>e!==h)),l.appearance.walletChainType,n,t,[...l.appearance.walletList,h],l.externalWallets.walletConnect.enabled),H=k.filter((e=>e!==p?.loginMethod)).flatMap(W),G=D.flatMap(W);"web3-first"===I&&"default"===O?B.unshift(...G):"web2-first"===I&&H.unshift(...G);let q=k.filter((e=>"email"!==e&&"sms"!==e)),z=Bp({priority:I,email:m,sms:f,social:q}),V=Hp({priority:I,email:m,sms:f,social:q}),K=e.jsx(ip,{text:Gp({priority:I}),onClick:()=>R("web3-overflow")}),Y=e.jsx(Op,{text:z,icon:V,onClick:()=>R("web2-overflow")}),Z=M?0:1;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{title:l.appearance.landingHeader,onClose:U,backFn:"default"===O?void 0:()=>{R("default")}}),"default"===O&&e.jsx(Wp,{}),"default"===O&&("string"==typeof l.appearance.loginMessage?e.jsx(Xo,{children:l.appearance.loginMessage}):l.appearance.loginMessage),e.jsx(Vo,{style:{overflow:"hidden",padding:2},children:e.jsxs(Ko,{children:["default"===O&&"web2-first"===I&&e.jsxs(e.Fragment,{children:[...H.length>4?H.slice(0,3):H,H.length>4&&Y,$&&K]}),"default"===O&&"web3-first"===I&&e.jsxs(e.Fragment,{children:[$&&e.jsxs(e.Fragment,{children:[...B.length>4?B.slice(0,3):B,B.length>4&&K]}),H.length>Z&&Y,H.length===Z&&H[0]]}),"web2-overflow"===O&&e.jsxs(e.Fragment,{children:[..."web3-first"===I?H:H.slice(3)]}),..."web3-overflow"===O?B:[],_&&"default"===O&&e.jsx(tp,{})]})}),l&&e.jsx(c.TermsAndConditions,{app:l}),e.jsx(c.BlobbyFooter,{})]})};let Wp=E.styled(fp)`
2265
2265
  margin-bottom: 16px;
2266
- `,Wp=({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",Bp=({priority:t,email:r,sms:n,social:i})=>"web2-first"===t||i.length>0?e.jsx(ot.default,{}):r&&n?e.jsx(Lp,{}):r?e.jsx(Ve.default,{}):n?e.jsx(Ke.default,{}):null,Hp=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets",Gp=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:r,prefilledType:n})=>r&&("email"===e&&"phone"!==n||"email"===n)||!t||"phone"!==e&&"phone"!==n?"email":"sms";const qp=({style:t,...r})=>e.jsxs("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...r,children:[e.jsx("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),e.jsx("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 zp(){let{promptMfa:e,init:t,submit:r,cancel:n,mfaMethods:i}=a.useContext(s.PrivyContext);return{promptMfa:e,init:t,submit:r,cancel:n,mfaMethods:i}}function Vp(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:n,submitEnrollmentWithTotp:i,submitEnrollmentWithPasskey:o,unenroll:l,enrollInMfa:d}=a.useContext(s.PrivyContext);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:n,submitEnrollmentWithTotp:i,submitEnrollmentWithPasskey:o,unenrollWithSms:()=>l("sms"),unenrollWithTotp:()=>l("totp"),unenrollWithPasskey:()=>l("passkey"),showMfaEnrollmentModal:()=>d(!0),closeMfaEnrollmentModal:()=>d(!1)}}const Kp=t=>e.jsxs(Yp,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...t,children:[e.jsx("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]});let Yp=E.styled.svg`
2266
+ `,Bp=({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",Hp=({priority:t,email:r,sms:n,social:i})=>"web2-first"===t||i.length>0?e.jsx(ot.default,{}):r&&n?e.jsx(Up,{}):r?e.jsx(Ve.default,{}):n?e.jsx(Ke.default,{}):null,Gp=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets",qp=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:r,prefilledType:n})=>r&&("email"===e&&"phone"!==n||"email"===n)||!t||"phone"!==e&&"phone"!==n?"email":"sms";const zp=({style:t,...r})=>e.jsxs("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...t},...r,children:[e.jsx("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),e.jsx("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 Vp(){let{promptMfa:e,init:t,submit:r,cancel:n,mfaMethods:i}=a.useContext(s.PrivyContext);return{promptMfa:e,init:t,submit:r,cancel:n,mfaMethods:i}}function Kp(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:n,submitEnrollmentWithTotp:i,submitEnrollmentWithPasskey:o,unenroll:l,enrollInMfa:d}=a.useContext(s.PrivyContext);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:n,submitEnrollmentWithTotp:i,submitEnrollmentWithPasskey:o,unenrollWithSms:()=>l("sms"),unenrollWithTotp:()=>l("totp"),unenrollWithPasskey:()=>l("passkey"),showMfaEnrollmentModal:()=>d(!0),closeMfaEnrollmentModal:()=>d(!1)}}const Yp=t=>e.jsxs(Zp,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...t,children:[e.jsx("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]});let Zp=E.styled.svg`
2267
2267
  height: 90px;
2268
2268
  width: 90px;
2269
2269
 
@@ -2274,9 +2274,9 @@
2274
2274
  > path {
2275
2275
  fill: white;
2276
2276
  }
2277
- `;const Zp=({showIntro:t,userMfaMethods:r,appMfaMethods:n,userHasAuthSms:i,isTotpLoading:a,isPasskeyLoading:o,error:s,onClose:l,onBackToIntro:d,handleSelectMethod:u,setRemovingMfaMethod:h})=>{let p=r.reduce(((e,t)=>({...e,[t]:!0})),{}),y=n.reduce(((e,t)=>({...e,[t]:!0})),{});return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t?d:void 0,onClose:l},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(xt.default,{})}),e.jsx(vs,{children:"Choose a verification method"}),r.length>0?e.jsx(ws,{children:"To add or delete verification methods, verification is required."}):e.jsx(ws,{children:"How would you like to verify your identity? You can change this later."}),s&&e.jsx(Ms,{style:{marginTop:"1.25rem"},children:s.message}),e.jsxs(As,{children:[(y.totp||p.totp)&&e.jsxs(js,{children:[e.jsx(Jo,{style:{justifyContent:"center"},disabled:p.totp||a,onClick:()=>u("totp"),children:a?e.jsx(vo,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):e.jsxs(_s,{children:[e.jsxs(Ts,{children:[e.jsx(Et.default,{}),"Authenticator app"]}),p.totp?e.jsx(Xp,{color:"green",children:"Enabled"}):e.jsx(Ps,{children:"Recommended"})]})}),p.totp&&e.jsx($s,{style:{position:"absolute",right:0},onClick:()=>h("totp"),children:e.jsx(St.default,{})})]},"totp"),(y.sms||p.sms)&&e.jsxs(js,{children:[e.jsx(Jo,{disabled:p.sms||i,onClick:()=>u("sms"),children:e.jsxs(_s,{children:[e.jsxs(Ts,{children:[e.jsx(Ke.default,{}),"SMS"]}),p.sms&&e.jsx(Xp,{color:"green",children:"Enabled"}),i&&e.jsx(Ps,{children:"Disabled"})]})}),p.sms&&e.jsx($s,{style:{position:"absolute",right:0},onClick:()=>h("sms"),children:e.jsx(St.default,{})})]},"sms"),(y.passkey||p.passkey)&&e.jsxs(js,{children:[e.jsx(Jo,{style:{justifyContent:"center"},onClick:()=>u("passkey"),disabled:p.passkey||o,children:o?e.jsx(vo,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):e.jsxs(_s,{children:[e.jsxs(Ts,{children:[e.jsx(bt.default,{}),"Passkey"]}),p.passkey?e.jsx(Xp,{color:"green",children:"Enabled"}):e.jsx(Ps,{isAccent:!0,children:e.jsx(wt.default,{})})]})}),p.passkey&&e.jsx($s,{style:{position:"absolute",right:0},onClick:()=>h("passkey"),children:e.jsx(St.default,{})})]},"passkey")]}),e.jsx(c.ModalFooter,{})]})};let Xp=E.styled(c.Chip)`
2277
+ `;const Xp=({showIntro:t,userMfaMethods:r,appMfaMethods:n,userHasAuthSms:i,isTotpLoading:a,isPasskeyLoading:o,error:s,onClose:l,onBackToIntro:d,handleSelectMethod:u,setRemovingMfaMethod:h})=>{let p=r.reduce(((e,t)=>({...e,[t]:!0})),{}),y=n.reduce(((e,t)=>({...e,[t]:!0})),{});return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t?d:void 0,onClose:l},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(xt.default,{})}),e.jsx(vs,{children:"Choose a verification method"}),r.length>0?e.jsx(ws,{children:"To add or delete verification methods, verification is required."}):e.jsx(ws,{children:"How would you like to verify your identity? You can change this later."}),s&&e.jsx(Ms,{style:{marginTop:"1.25rem"},children:s.message}),e.jsxs(As,{children:[(y.totp||p.totp)&&e.jsxs(js,{children:[e.jsx(Jo,{style:{justifyContent:"center"},disabled:p.totp||a,onClick:()=>u("totp"),children:a?e.jsx(vo,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):e.jsxs(_s,{children:[e.jsxs(Ts,{children:[e.jsx(Et.default,{}),"Authenticator app"]}),p.totp?e.jsx(Jp,{color:"green",children:"Enabled"}):e.jsx(Ps,{children:"Recommended"})]})}),p.totp&&e.jsx($s,{style:{position:"absolute",right:0},onClick:()=>h("totp"),children:e.jsx(St.default,{})})]},"totp"),(y.sms||p.sms)&&e.jsxs(js,{children:[e.jsx(Jo,{disabled:p.sms||i,onClick:()=>u("sms"),children:e.jsxs(_s,{children:[e.jsxs(Ts,{children:[e.jsx(Ke.default,{}),"SMS"]}),p.sms&&e.jsx(Jp,{color:"green",children:"Enabled"}),i&&e.jsx(Ps,{children:"Disabled"})]})}),p.sms&&e.jsx($s,{style:{position:"absolute",right:0},onClick:()=>h("sms"),children:e.jsx(St.default,{})})]},"sms"),(y.passkey||p.passkey)&&e.jsxs(js,{children:[e.jsx(Jo,{style:{justifyContent:"center"},onClick:()=>u("passkey"),disabled:p.passkey||o,children:o?e.jsx(vo,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):e.jsxs(_s,{children:[e.jsxs(Ts,{children:[e.jsx(bt.default,{}),"Passkey"]}),p.passkey?e.jsx(Jp,{color:"green",children:"Enabled"}):e.jsx(Ps,{isAccent:!0,children:e.jsx(wt.default,{})})]})}),p.passkey&&e.jsx($s,{style:{position:"absolute",right:0},onClick:()=>h("passkey"),children:e.jsx(St.default,{})})]},"passkey")]}),e.jsx(c.ModalFooter,{})]})};let Jp=E.styled(c.Chip)`
2278
2278
  margin-right: 1.5rem;
2279
- `;const Jp=({onComplete:t,onClose:r,onReset:n})=>{let{user:i}=s.usePrivy(),{data:o}=v.usePrivyModal(),{initLinkWithPasskey:l,linkWithPasskey:d}=s.usePrivyInternal(),{initEnrollmentWithPasskey:c,submitEnrollmentWithPasskey:u}=Vp(),[h,p]=a.useState(!1),[y,m]=a.useState(!1),[f,g]=a.useState(!1),[w,x]=a.useState(null),C=a.useMemo((()=>i?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[i]),E=()=>{o?.mfaEnrollmentFlow?.onSuccess(),t()},b=async e=>{p(!0);try{await c(),await u({credentialIds:e}),g(!0)}catch(e){x(e)}finally{p(!1)}},S=async()=>{m(!0),x(null);try{await l();let e=await d(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await b(t)}catch(e){x(e)}finally{m(!1)}};return 0===C.length||y?e.jsx(Qp,{onReset:n,onClose:r,onClick:S,isCreating:y}):f?e.jsx(ty,{onClick:E,onClose:E}):w?e.jsx(cc,{error:w,backFn:()=>x(null),onClick:()=>x(null)}):e.jsx(ey,{passkeys:C,isSubmitting:h,isCreating:y,onReset:n,onClose:r,onSubmitEnrollment:()=>b(C.map((e=>e.credentialId))),onAddPasskey:S})};let Qp=({onReset:t,onClose:r,onClick:n,isCreating:i})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t,onClose:r},"header"),e.jsx(gs,{children:e.jsxs(ku,{children:[e.jsx($u,{}),e.jsx(Tu,{})]})}),e.jsx(vs,{children:"Set up passkey verification"}),e.jsxs(Cs,{children:[e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(xt.default,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(ut.default,{})}),"Takes seconds to set up and use"]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(At.default,{})}),"Use your passkey to verify transactions and login to your account"]})]}),e.jsx(bo,{style:{marginTop:"2.25rem"},onClick:n,loading:i,children:"Add a new passkey"}),e.jsx(c.ModalFooter,{})]}),ey=({onReset:t,onClose:r,onAddPasskey:n,onSubmitEnrollment:i,passkeys:o,isSubmitting:s,isCreating:l})=>{let[d,u]=a.useState(!1),h=d?o.length:o.length>3?2:3;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:d?()=>u(!1):t,onClose:r},"header"),!d&&e.jsx(gs,{children:e.jsxs(ku,{children:[e.jsx($u,{}),e.jsx(Tu,{})]})}),e.jsx(vs,{children:"Enable your passkeys for verification"}),e.jsxs(Cs,{children:[o.slice(0,h).map((t=>e.jsxs(ry,{children:[e.jsx(ny,{children:ay(t)}),e.jsxs(iy,{children:["Last used: ",t.latestVerifiedAt?.toLocaleString()]})]},t.credentialId))),!d&&o.length>3&&e.jsx(oy,{onClick:()=>u(!0),children:"View All"})]}),e.jsx(bo,{style:{marginTop:"1.5rem"},onClick:i,loading:s,children:"Enable passkeys"}),o.length<5&&e.jsx(oy,{style:{marginTop:"0.5rem"},onClick:n,disabled:l,children:l?e.jsx(vo,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),e.jsx(c.ModalFooter,{})]})},ty=({onClick:t,onClose:r})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:r},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(dt.default,{})}),e.jsx(vs,{children:"Passkey verification added"}),e.jsx(ws,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),e.jsx(Ss,{children:e.jsx(bo,{onClick:t,children:"Done"})}),e.jsx(c.ModalFooter,{})]}),ry=E.styled.div`
2279
+ `;const Qp=({onComplete:t,onClose:r,onReset:n})=>{let{user:i}=s.usePrivy(),{data:o}=v.usePrivyModal(),{initLinkWithPasskey:l,linkWithPasskey:d}=s.usePrivyInternal(),{initEnrollmentWithPasskey:c,submitEnrollmentWithPasskey:u}=Kp(),[h,p]=a.useState(!1),[y,m]=a.useState(!1),[f,g]=a.useState(!1),[w,x]=a.useState(null),C=a.useMemo((()=>i?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[i]),E=()=>{o?.mfaEnrollmentFlow?.onSuccess(),t()},b=async e=>{p(!0);try{await c(),await u({credentialIds:e}),g(!0)}catch(e){x(e)}finally{p(!1)}},S=async()=>{m(!0),x(null);try{await l();let e=await d(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await b(t)}catch(e){x(e)}finally{m(!1)}};return 0===C.length||y?e.jsx(ey,{onReset:n,onClose:r,onClick:S,isCreating:y}):f?e.jsx(ry,{onClick:E,onClose:E}):w?e.jsx(cc,{error:w,backFn:()=>x(null),onClick:()=>x(null)}):e.jsx(ty,{passkeys:C,isSubmitting:h,isCreating:y,onReset:n,onClose:r,onSubmitEnrollment:()=>b(C.map((e=>e.credentialId))),onAddPasskey:S})};let ey=({onReset:t,onClose:r,onClick:n,isCreating:i})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t,onClose:r},"header"),e.jsx(gs,{children:e.jsxs(Nu,{children:[e.jsx(Tu,{}),e.jsx(Pu,{})]})}),e.jsx(vs,{children:"Set up passkey verification"}),e.jsxs(Cs,{children:[e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(xt.default,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(ut.default,{})}),"Takes seconds to set up and use"]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(At.default,{})}),"Use your passkey to verify transactions and login to your account"]})]}),e.jsx(bo,{style:{marginTop:"2.25rem"},onClick:n,loading:i,children:"Add a new passkey"}),e.jsx(c.ModalFooter,{})]}),ty=({onReset:t,onClose:r,onAddPasskey:n,onSubmitEnrollment:i,passkeys:o,isSubmitting:s,isCreating:l})=>{let[d,u]=a.useState(!1),h=d?o.length:o.length>3?2:3;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:d?()=>u(!1):t,onClose:r},"header"),!d&&e.jsx(gs,{children:e.jsxs(Nu,{children:[e.jsx(Tu,{}),e.jsx(Pu,{})]})}),e.jsx(vs,{children:"Enable your passkeys for verification"}),e.jsxs(Cs,{children:[o.slice(0,h).map((t=>e.jsxs(ny,{children:[e.jsx(iy,{children:oy(t)}),e.jsxs(ay,{children:["Last used: ",t.latestVerifiedAt?.toLocaleString()]})]},t.credentialId))),!d&&o.length>3&&e.jsx(sy,{onClick:()=>u(!0),children:"View All"})]}),e.jsx(bo,{style:{marginTop:"1.5rem"},onClick:i,loading:s,children:"Enable passkeys"}),o.length<5&&e.jsx(sy,{style:{marginTop:"0.5rem"},onClick:n,disabled:l,children:l?e.jsx(vo,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),e.jsx(c.ModalFooter,{})]})},ry=({onClick:t,onClose:r})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:r},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(dt.default,{})}),e.jsx(vs,{children:"Passkey verification added"}),e.jsx(ws,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),e.jsx(Ss,{children:e.jsx(bo,{onClick:t,children:"Done"})}),e.jsx(c.ModalFooter,{})]}),ny=E.styled.div`
2280
2280
  && {
2281
2281
  padding: 0.75rem 1rem;
2282
2282
  text-align: left;
@@ -2284,19 +2284,19 @@
2284
2284
  border: 1px solid var(--privy-color-foreground-4);
2285
2285
  width: 100%;
2286
2286
  }
2287
- `,ny=E.styled.div`
2287
+ `,iy=E.styled.div`
2288
2288
  font-size: 0.875rem;
2289
2289
  line-height: 1.375rem;
2290
2290
  font-weight: 500;
2291
2291
 
2292
2292
  color: var(--privy-color-foreground-1);
2293
- `,iy=E.styled.div`
2293
+ `,ay=E.styled.div`
2294
2294
  font-size: 0.75rem;
2295
2295
  font-weight: 400;
2296
2296
  line-height: 1.125rem;
2297
2297
 
2298
2298
  color: var(--privy-color-foreground-2);
2299
- `,ay=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 oy=E.styled.button`
2299
+ `,oy=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 sy=E.styled.button`
2300
2300
  && {
2301
2301
  width: 100%;
2302
2302
  font-size: 0.875rem;
@@ -2321,7 +2321,7 @@
2321
2321
  box-shadow: none;
2322
2322
  }
2323
2323
  }
2324
- `;var sy,ly;let dy=Array(6).fill("");function cy(e){return/^[0-9]{1}$/.test(e)}function uy(e){return 6===e.length&&e.every(cy)}(ly=sy||(sy={}))[ly.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",ly[ly.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT";const hy=({onChange:t,disabled:r,errorReasonOverride:n,success:i})=>{let[s,l]=a.useState(dy),[d,c]=a.useState(null),[u,h]=a.useState(null),p=async e=>{e.preventDefault();let r=e.currentTarget.value.replace(/\s+/g,"");if(""===r)return;let n=s.reduce(((e,t)=>e+Number(cy(t))),0),i=r.split(""),a=!i.every(cy),o=i.length+n>6;if(a)return c("Passcode can only be numbers"),void h(1);if(o)return c("Passcode must be exactly 6 numbers"),void h(1);c(null),h(null);let d=Number(e.currentTarget.name?.charAt(4)),u=[...r||[""]].slice(0,6-d),p=[...s.slice(0,d),...u,...s.slice(d+u.length)];l(p);let y=Math.min(Math.max(d+u.length,0),5),m=document.querySelector(`input[name=pin-${y}]`);if(m?.focus(),uy(p))try{await t(p.join(""));let e=document.querySelector(`input[name=pin-${y}]`);e?.blur()}catch(e){h(1),c(e.message)}else try{await t(null)}catch(e){h(1),c(e.message)}},y=e=>{1===u&&(c(null),h(null));let r=[...s.slice(0,e),"",...s.slice(e+1)];if(l(r),e>0){let t=document.querySelector(`input[name=pin-${e-1}]`);t?.focus()}uy(r)?t(r.join("")):t(null)},m=i?"success":!(!n&&!d)?"fail":"";return e.jsx(e.Fragment,{children:e.jsxs(py,{children:[e.jsx("div",{children:s.map(((t,n)=>e.jsx("input",{name:`pin-${n}`,type:"text",value:s[n],onChange:p,onKeyUp:e=>{"Backspace"===e.key&&y(n)},inputMode:"numeric",autoFocus:0===n,pattern:"[0-9]",className:m,autoComplete:o.isMobile?"one-time-code":"off",disabled:r},n)))}),e.jsx("div",{children:e.jsx(yy,{$fail:!!n||!!d,children:n||d})})]})})};let py=E.styled.div`
2324
+ `;var ly,dy;let cy=Array(6).fill("");function uy(e){return/^[0-9]{1}$/.test(e)}function hy(e){return 6===e.length&&e.every(uy)}(dy=ly||(ly={}))[dy.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",dy[dy.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT";const py=({onChange:t,disabled:r,errorReasonOverride:n,success:i})=>{let[s,l]=a.useState(cy),[d,c]=a.useState(null),[u,h]=a.useState(null),p=async e=>{e.preventDefault();let r=e.currentTarget.value.replace(/\s+/g,"");if(""===r)return;let n=s.reduce(((e,t)=>e+Number(uy(t))),0),i=r.split(""),a=!i.every(uy),o=i.length+n>6;if(a)return c("Passcode can only be numbers"),void h(1);if(o)return c("Passcode must be exactly 6 numbers"),void h(1);c(null),h(null);let d=Number(e.currentTarget.name?.charAt(4)),u=[...r||[""]].slice(0,6-d),p=[...s.slice(0,d),...u,...s.slice(d+u.length)];l(p);let y=Math.min(Math.max(d+u.length,0),5),m=document.querySelector(`input[name=pin-${y}]`);if(m?.focus(),hy(p))try{await t(p.join(""));let e=document.querySelector(`input[name=pin-${y}]`);e?.blur()}catch(e){h(1),c(e.message)}else try{await t(null)}catch(e){h(1),c(e.message)}},y=e=>{1===u&&(c(null),h(null));let r=[...s.slice(0,e),"",...s.slice(e+1)];if(l(r),e>0){let t=document.querySelector(`input[name=pin-${e-1}]`);t?.focus()}hy(r)?t(r.join("")):t(null)},m=i?"success":!(!n&&!d)?"fail":"";return e.jsx(e.Fragment,{children:e.jsxs(yy,{children:[e.jsx("div",{children:s.map(((t,n)=>e.jsx("input",{name:`pin-${n}`,type:"text",value:s[n],onChange:p,onKeyUp:e=>{"Backspace"===e.key&&y(n)},inputMode:"numeric",autoFocus:0===n,pattern:"[0-9]",className:m,autoComplete:o.isMobile?"one-time-code":"off",disabled:r},n)))}),e.jsx("div",{children:e.jsx(my,{$fail:!!n||!!d,children:n||d})})]})})};let yy=E.styled.div`
2325
2325
  display: flex;
2326
2326
  flex-direction: column;
2327
2327
  width: 100%;
@@ -2389,7 +2389,7 @@
2389
2389
  transform: translate(1px, 0px);
2390
2390
  }
2391
2391
  }
2392
- `,yy=E.styled.div`
2392
+ `,my=E.styled.div`
2393
2393
  line-height: 20px;
2394
2394
  font-size: 13px;
2395
2395
  display: flex;
@@ -2397,7 +2397,7 @@
2397
2397
  width: 100%;
2398
2398
 
2399
2399
  color: ${e=>e.$fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
2400
- `;const my=({onComplete:t,onReset:r,onClose:n})=>{let[i,o]=a.useState(""),[s,l]=a.useState(!1),[d,u]=a.useState(null),[h,p]=a.useState("enroll"),{initEnrollmentWithSms:y,submitEnrollmentWithSms:m}=Vp(),{app:f,data:g}=v.usePrivyModal();function w(){g?.mfaEnrollmentFlow?.onSuccess(),t()}return d?e.jsx(cc,{error:d,backFn:()=>u(null),onClick:()=>u(null)}):"enroll"===h?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:r,onClose:n},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Ke.default,{})}),e.jsx(vs,{children:"Set up SMS verification"}),e.jsx(ws,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),e.jsxs(xs,{children:[e.jsx(Sp,{onSubmit:async function({qualifiedPhoneNumber:e}){try{await y({phoneNumber:e}),o(e),p("verify")}catch(e){u(e)}},hideRecent:!0}),e.jsxs(ks,{children:["By providing your mobile number, you agree to receive text messages from ",f?.name,". Some carrier charges may apply"]})]}),e.jsx(c.ModalFooter,{})]}):s?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:w},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(dt.default,{})}),e.jsx(vs,{children:"SMS verification added"}),e.jsx(ws,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),e.jsx(Ss,{children:e.jsx(bo,{onClick:w,children:"Done"})}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:function(){"verify"===h?p("enroll"):r()},onClose:n},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Ke.default,{})}),e.jsx(vs,{children:"Enter enrollment code"}),e.jsxs(xs,{children:[e.jsx(hy,{onChange:async function(e){try{if(!e)return;await m({phoneNumber:i,mfaCode:e}),l(!0)}catch(e){if(rd(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(ed(e))throw Error("The code you entered is not valid");if(Ql(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw nd(e)?Error("Verification canceled"):Error("Unknown error")}}}),e.jsxs(ws,{children:["To continue, enter the 6-digit code sent to ",e.jsx("strong",{children:Ci(i)})]})]}),e.jsx(c.ModalFooter,{})]})},fy=({size:t,authUrl:r})=>e.jsx(jc,{url:r,squareLogoElement:jt.default,size:t,fgColor:"#1F1F1F"}),gy=({onComplete:t,onClose:r,onReset:n,totpInfo:i})=>{let[o,s]=a.useState("enroll"),[l,d]=a.useState(!1),{submitEnrollmentWithTotp:u}=Vp(),{data:h}=v.usePrivyModal();function p(){h?.mfaEnrollmentFlow?.onSuccess(),t()}return"enroll"===o?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:n,onClose:r},"header"),e.jsx(vs,{children:"Scan QR code"}),e.jsx(ws,{children:"Open your authenticator app and scan the QR code to continue."}),e.jsx(Hs,{children:e.jsx(fy,{authUrl:i.authUrl,size:200})}),e.jsxs(Ss,{children:[e.jsx(Ws,{children:e.jsx(yc,{itemName:"secret",text:i.secret})}),e.jsx(bo,{onClick:function(){s("verify")},children:"Continue"})]}),e.jsx(c.ModalFooter,{})]}):l?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:p},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(dt.default,{})}),e.jsx(vs,{children:"Authenticator app verification added"}),e.jsx(ws,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),e.jsx(Ss,{children:e.jsx(bo,{onClick:p,children:"Done"})}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:function(){"verify"===o?s("enroll"):n()},onClose:r},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Et.default,{})}),e.jsx(vs,{children:"Enter enrollment code"}),e.jsx(xs,{children:e.jsx(hy,{onChange:async function(e){try{if(!e)return;await u({mfaCode:e}),d(!0)}catch(e){if(rd(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(ed(e))throw Error("The code you entered is not valid");if(Ql(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw nd(e)?Error("Verification canceled"):Error("Unknown error")}}})}),e.jsxs(ws,{children:["To continue, enter the 6-digit code generated from your ",e.jsx("strong",{children:"authenticator app"})]}),e.jsx(c.ModalFooter,{})]})},vy=({label:t,children:r,valueStyles:n})=>e.jsxs(wy,{children:[e.jsx("div",{children:t}),e.jsx(xy,{style:{...n},children:r})]});let wy=E.styled.div`
2400
+ `;const fy=({onComplete:t,onReset:r,onClose:n})=>{let[i,o]=a.useState(""),[s,l]=a.useState(!1),[d,u]=a.useState(null),[h,p]=a.useState("enroll"),{initEnrollmentWithSms:y,submitEnrollmentWithSms:m}=Kp(),{app:f,data:g}=v.usePrivyModal();function w(){g?.mfaEnrollmentFlow?.onSuccess(),t()}return d?e.jsx(cc,{error:d,backFn:()=>u(null),onClick:()=>u(null)}):"enroll"===h?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:r,onClose:n},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Ke.default,{})}),e.jsx(vs,{children:"Set up SMS verification"}),e.jsx(ws,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),e.jsxs(xs,{children:[e.jsx(Ap,{onSubmit:async function({qualifiedPhoneNumber:e}){try{await y({phoneNumber:e}),o(e),p("verify")}catch(e){u(e)}},hideRecent:!0}),e.jsxs(ks,{children:["By providing your mobile number, you agree to receive text messages from ",f?.name,". Some carrier charges may apply"]})]}),e.jsx(c.ModalFooter,{})]}):s?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:w},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(dt.default,{})}),e.jsx(vs,{children:"SMS verification added"}),e.jsx(ws,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),e.jsx(Ss,{children:e.jsx(bo,{onClick:w,children:"Done"})}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:function(){"verify"===h?p("enroll"):r()},onClose:n},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Ke.default,{})}),e.jsx(vs,{children:"Enter enrollment code"}),e.jsxs(xs,{children:[e.jsx(py,{onChange:async function(e){try{if(!e)return;await m({phoneNumber:i,mfaCode:e}),l(!0)}catch(e){if(rd(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(ed(e))throw Error("The code you entered is not valid");if(Ql(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw nd(e)?Error("Verification canceled"):Error("Unknown error")}}}),e.jsxs(ws,{children:["To continue, enter the 6-digit code sent to ",e.jsx("strong",{children:Ci(i)})]})]}),e.jsx(c.ModalFooter,{})]})},gy=({size:t,authUrl:r})=>e.jsx(jc,{url:r,squareLogoElement:jt.default,size:t,fgColor:"#1F1F1F"}),vy=({onComplete:t,onClose:r,onReset:n,totpInfo:i})=>{let[o,s]=a.useState("enroll"),[l,d]=a.useState(!1),{submitEnrollmentWithTotp:u}=Kp(),{data:h}=v.usePrivyModal();function p(){h?.mfaEnrollmentFlow?.onSuccess(),t()}return"enroll"===o?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:n,onClose:r},"header"),e.jsx(vs,{children:"Scan QR code"}),e.jsx(ws,{children:"Open your authenticator app and scan the QR code to continue."}),e.jsx(Hs,{children:e.jsx(gy,{authUrl:i.authUrl,size:200})}),e.jsxs(Ss,{children:[e.jsx(Ws,{children:e.jsx(yc,{itemName:"secret",text:i.secret})}),e.jsx(bo,{onClick:function(){s("verify")},children:"Continue"})]}),e.jsx(c.ModalFooter,{})]}):l?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:p},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(dt.default,{})}),e.jsx(vs,{children:"Authenticator app verification added"}),e.jsx(ws,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),e.jsx(Ss,{children:e.jsx(bo,{onClick:p,children:"Done"})}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:function(){"verify"===o?s("enroll"):n()},onClose:r},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Et.default,{})}),e.jsx(vs,{children:"Enter enrollment code"}),e.jsx(xs,{children:e.jsx(py,{onChange:async function(e){try{if(!e)return;await u({mfaCode:e}),d(!0)}catch(e){if(rd(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(ed(e))throw Error("The code you entered is not valid");if(Ql(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw nd(e)?Error("Verification canceled"):Error("Unknown error")}}})}),e.jsxs(ws,{children:["To continue, enter the 6-digit code generated from your ",e.jsx("strong",{children:"authenticator app"})]}),e.jsx(c.ModalFooter,{})]})},wy=({label:t,children:r,valueStyles:n})=>e.jsxs(xy,{children:[e.jsx("div",{children:t}),e.jsx(Cy,{style:{...n},children:r})]});let xy=E.styled.div`
2401
2401
  display: flex;
2402
2402
  align-items: center;
2403
2403
  justify-content: space-between;
@@ -2412,7 +2412,7 @@
2412
2412
  color: var(--privy-color-foreground-2);
2413
2413
  text-align: right;
2414
2414
  }
2415
- `,xy=E.styled.div`
2415
+ `,Cy=E.styled.div`
2416
2416
  font-size: 14px;
2417
2417
  line-height: 100%;
2418
2418
  display: flex;
@@ -2421,28 +2421,28 @@
2421
2421
  border-radius: var(--privy-border-radius-full);
2422
2422
  background-color: var(--privy-color-background-2);
2423
2423
  padding: 4px 8px;
2424
- `;const Cy=({weiQuantities:t,tokenPrice:r,tokenSymbol:n})=>{let i=c.sumWeiQuantitiesToHexString(t),a=r?c.getDollarsFromWei(i,r):void 0,o=c.getNativeCurrencyFromWei(i,n);return e.jsx(Sy,{children:a||o})},Ey=({weiQuantities:t,tokenPrice:r,tokenSymbol:n})=>{let i=c.sumWeiQuantitiesToHexString(t),a=r?c.getDollarsFromWei(i,r):void 0,o=c.getNativeCurrencyFromWei(i,n);return e.jsx(Sy,{children:a?e.jsxs(e.Fragment,{children:[e.jsx(Ay,{children:"USD"}),"<$0.01"===a?e.jsxs($y,{children:[e.jsx(jy,{children:"<"}),"$0.01"]}):a]}):o})},by=({quantities:t,tokenPrice:r})=>{let n=t.reduce(((e,t)=>e+t),0n),i=r?Kc(n,r):void 0,a=Vc(n);return e.jsx(Sy,{children:i?e.jsx(e.Fragment,{children:"<$0.01"===i?e.jsxs($y,{children:[e.jsx(jy,{children:"<"}),"$0.01"]}):i}):a})};let Sy=E.styled.span`
2424
+ `;const Ey=({weiQuantities:t,tokenPrice:r,tokenSymbol:n})=>{let i=c.sumWeiQuantitiesToHexString(t),a=r?c.getDollarsFromWei(i,r):void 0,o=c.getNativeCurrencyFromWei(i,n);return e.jsx(Ay,{children:a||o})},by=({weiQuantities:t,tokenPrice:r,tokenSymbol:n})=>{let i=c.sumWeiQuantitiesToHexString(t),a=r?c.getDollarsFromWei(i,r):void 0,o=c.getNativeCurrencyFromWei(i,n);return e.jsx(Ay,{children:a?e.jsxs(e.Fragment,{children:[e.jsx(jy,{children:"USD"}),"<$0.01"===a?e.jsxs(Ty,{children:[e.jsx($y,{children:"<"}),"$0.01"]}):a]}):o})},Sy=({quantities:t,tokenPrice:r})=>{let n=t.reduce(((e,t)=>e+t),0n),i=r?Kc(n,r):void 0,a=Vc(n);return e.jsx(Ay,{children:i?e.jsx(e.Fragment,{children:"<$0.01"===i?e.jsxs(Ty,{children:[e.jsx($y,{children:"<"}),"$0.01"]}):i}):a})};let Ay=E.styled.span`
2425
2425
  font-size: 14px;
2426
2426
  line-height: 140%;
2427
2427
  display: flex;
2428
2428
  gap: 4px;
2429
2429
  align-items: center;
2430
- `,Ay=E.styled.span`
2430
+ `,jy=E.styled.span`
2431
2431
  font-size: 12px;
2432
2432
  line-height: 12px;
2433
2433
  color: var(--privy-color-foreground-3);
2434
- `,jy=E.styled.span`
2435
- font-size: 10px;
2436
2434
  `,$y=E.styled.span`
2435
+ font-size: 10px;
2436
+ `,Ty=E.styled.span`
2437
2437
  display: flex;
2438
2438
  align-items: center;
2439
- `;const Ty=({gas:t,tokenPrice:r,tokenSymbol:n})=>e.jsxs(qs,{style:{paddingBottom:"12px"},children:[e.jsxs(_y,{children:[e.jsx(Ny,{children:"Est. Fees"}),e.jsx("div",{children:e.jsx(Ey,{weiQuantities:[t],tokenPrice:r,tokenSymbol:n})})]}),r&&e.jsx(ky,{children:`${c.getNativeCurrencyFromWei(t,n)}`})]}),Py=({transactionData:t,gas:r,tokenPrice:n,tokenSymbol:i})=>{let a=c.i(t.value||0).add(c.i(r)).toHexString();return e.jsxs(qs,{children:[e.jsxs(_y,{children:[e.jsx(Ny,{children:"Total (including fees)"}),e.jsx("div",{children:e.jsx(Ey,{weiQuantities:[t.value||0,r],tokenPrice:n,tokenSymbol:i})})]}),n&&e.jsx(ky,{children:c.getNativeCurrencyFromWei(a,i)})]})};let _y=E.styled.div`
2439
+ `;const Py=({gas:t,tokenPrice:r,tokenSymbol:n})=>e.jsxs(qs,{style:{paddingBottom:"12px"},children:[e.jsxs(ky,{children:[e.jsx(Iy,{children:"Est. Fees"}),e.jsx("div",{children:e.jsx(by,{weiQuantities:[t],tokenPrice:r,tokenSymbol:n})})]}),r&&e.jsx(Ny,{children:`${c.getNativeCurrencyFromWei(t,n)}`})]}),_y=({transactionData:t,gas:r,tokenPrice:n,tokenSymbol:i})=>{let a=c.i(t.value||0).add(c.i(r)).toHexString();return e.jsxs(qs,{children:[e.jsxs(ky,{children:[e.jsx(Iy,{children:"Total (including fees)"}),e.jsx("div",{children:e.jsx(by,{weiQuantities:[t.value||0,r],tokenPrice:n,tokenSymbol:i})})]}),n&&e.jsx(Ny,{children:c.getNativeCurrencyFromWei(a,i)})]})};let ky=E.styled.div`
2440
2440
  display: flex;
2441
2441
  flex-direction: row;
2442
2442
  justify-content: space-between;
2443
2443
  align-items: center;
2444
2444
  padding-top: 4px;
2445
- `,ky=E.styled.div`
2445
+ `,Ny=E.styled.div`
2446
2446
  display: flex;
2447
2447
  flex-direction: row;
2448
2448
  height: 12px;
@@ -2451,23 +2451,23 @@
2451
2451
  line-height: 12px;
2452
2452
  color: var(--privy-color-foreground-3);
2453
2453
  font-weight: 400;
2454
- `,Ny=E.styled.div`
2454
+ `,Iy=E.styled.div`
2455
2455
  font-size: 14px;
2456
2456
  line-height: 22.4px;
2457
2457
  font-weight: 400;
2458
- `;const Iy=a.createContext(void 0),My=a.createContext(void 0),Oy=({defaultValue:t,children:r})=>{let[n,i]=a.useState(t||null);return e.jsx(Iy.Provider,{value:{activePanel:n,togglePanel:e=>{i(n===e?null:e)}},children:e.jsx(Dy,{children:r})})},Ry=({value:t,children:r})=>{let{activePanel:n,togglePanel:i}=a.useContext(Iy),o=n===t;return e.jsx(My.Provider,{value:{onToggle:()=>i(t),value:t},children:e.jsx(Gy,{isActive:o,"data-open":o,children:r})})},Fy=({children:t})=>{let{activePanel:r}=a.useContext(Iy),{onToggle:n,value:i}=a.useContext(My),o=r===i;return e.jsxs(e.Fragment,{children:[e.jsxs(Wy,{onClick:n,"data-open":o,children:[e.jsx(Hy,{children:t}),e.jsx(Vy,{isactive:o,children:e.jsx(Tt.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),e.jsx(By,{})]})},Ly=({children:t})=>{let{activePanel:r}=a.useContext(Iy),{value:n}=a.useContext(My);return e.jsx(qy,{"data-open":r===n,children:e.jsx(zy,{children:t})})},Uy=({children:t})=>{let{activePanel:r}=a.useContext(Iy),{value:n}=a.useContext(My);return e.jsx(zy,{children:"function"==typeof t?t({isActive:r===n}):t})};let Dy=E.styled.div`
2458
+ `;const My=a.createContext(void 0),Oy=a.createContext(void 0),Ry=({defaultValue:t,children:r})=>{let[n,i]=a.useState(t||null);return e.jsx(My.Provider,{value:{activePanel:n,togglePanel:e=>{i(n===e?null:e)}},children:e.jsx(Wy,{children:r})})},Fy=({value:t,children:r})=>{let{activePanel:n,togglePanel:i}=a.useContext(My),o=n===t;return e.jsx(Oy.Provider,{value:{onToggle:()=>i(t),value:t},children:e.jsx(qy,{isActive:o,"data-open":o,children:r})})},Ly=({children:t})=>{let{activePanel:r}=a.useContext(My),{onToggle:n,value:i}=a.useContext(Oy),o=r===i;return e.jsxs(e.Fragment,{children:[e.jsxs(By,{onClick:n,"data-open":o,children:[e.jsx(Gy,{children:t}),e.jsx(Ky,{isactive:o,children:e.jsx(Tt.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),e.jsx(Hy,{})]})},Uy=({children:t})=>{let{activePanel:r}=a.useContext(My),{value:n}=a.useContext(Oy);return e.jsx(zy,{"data-open":r===n,children:e.jsx(Vy,{children:t})})},Dy=({children:t})=>{let{activePanel:r}=a.useContext(My),{value:n}=a.useContext(Oy);return e.jsx(Vy,{children:"function"==typeof t?t({isActive:r===n}):t})};let Wy=E.styled.div`
2459
2459
  display: flex;
2460
2460
  flex-direction: column;
2461
2461
  width: 100%;
2462
2462
  gap: 8px;
2463
- `,Wy=E.styled.div`
2463
+ `,By=E.styled.div`
2464
2464
  display: flex;
2465
2465
  justify-content: space-between;
2466
2466
  align-items: center;
2467
2467
  width: 100%;
2468
2468
  cursor: pointer;
2469
2469
  padding-bottom: 8px;
2470
- `,By=E.styled.div`
2470
+ `,Hy=E.styled.div`
2471
2471
  width: 100%;
2472
2472
 
2473
2473
  && {
@@ -2475,13 +2475,13 @@
2475
2475
  border-color: var(--privy-color-foreground-4);
2476
2476
  }
2477
2477
  padding-bottom: 12px;
2478
- `,Hy=E.styled.div`
2478
+ `,Gy=E.styled.div`
2479
2479
  font-size: 14px;
2480
2480
  font-weight: 500;
2481
2481
  line-height: 19.6px;
2482
2482
  width: 100%;
2483
2483
  padding-right: 8px;
2484
- `,Gy=E.styled.div`
2484
+ `,qy=E.styled.div`
2485
2485
  display: flex;
2486
2486
  flex-direction: column;
2487
2487
  width: 100%;
@@ -2493,7 +2493,7 @@
2493
2493
  border-color: var(--privy-color-foreground-4);
2494
2494
  border-radius: var(--privy-border-radius-md);
2495
2495
  }
2496
- `,qy=E.styled.div`
2496
+ `,zy=E.styled.div`
2497
2497
  position: relative;
2498
2498
  overflow: hidden;
2499
2499
  transition: max-height 25ms ease-out;
@@ -2505,29 +2505,29 @@
2505
2505
  &[data-open='false'] {
2506
2506
  max-height: 0;
2507
2507
  }
2508
- `,zy=E.styled.div`
2508
+ `,Vy=E.styled.div`
2509
2509
  display: flex;
2510
2510
  flex-direction: column;
2511
2511
  gap: 12px;
2512
2512
  flex: 1 1 auto;
2513
2513
  min-height: 1px;
2514
- `,Vy=E.styled.div`
2514
+ `,Ky=E.styled.div`
2515
2515
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2516
- `;const Ky=({walletAddress:t,chainId:r=d.CHAIN_ID_MAINNET,network:n,rpcEndpoint:i})=>e.jsx(Yy,{href:"ethereum"===n?c.getBlockExplorerUrlForAddress(r,t):Gc(t,Hc(i||"")),target:"_blank",children:c.formatWalletAddress(t)});let Yy=E.styled.a`
2516
+ `;const Yy=({walletAddress:t,chainId:r=d.CHAIN_ID_MAINNET,network:n,rpcEndpoint:i})=>e.jsx(Zy,{href:"ethereum"===n?c.getBlockExplorerUrlForAddress(r,t):Gc(t,Hc(i||"")),target:"_blank",children:d.formatWalletAddress(t)});let Zy=E.styled.a`
2517
2517
  &:hover {
2518
2518
  text-decoration: underline;
2519
2519
  }
2520
- `;const Zy=({from:t,to:r,txn:n,transactionInfo:i,tokenPrice:a,gas:o,tokenSymbol:s})=>{let l=n?.value||0;return e.jsx(Oy,{...d.useAppConfig().render.standalone?{defaultValue:"details"}:{},children:e.jsxs(Ry,{value:"details",children:[e.jsx(Fy,{children:e.jsxs(Xy,{children:[e.jsx("div",{children:i?.title||i?.actionDescription||"Details"}),e.jsx(Jy,{children:e.jsx(Cy,{weiQuantities:[l],tokenPrice:a,tokenSymbol:s})})]})}),e.jsxs(Ly,{children:[e.jsx(vy,{label:"From",children:e.jsx(Ky,{walletAddress:t,chainId:n.chainId||d.CHAIN_ID_MAINNET,network:"ethereum"})}),e.jsx(vy,{label:"To",children:e.jsx(Ky,{walletAddress:r,chainId:n.chainId||d.CHAIN_ID_MAINNET,network:"ethereum"})}),i&&i.action&&e.jsx(vy,{label:"Action",children:i.action}),o&&e.jsx(Ty,{transactionData:n,gas:o,tokenPrice:a,tokenSymbol:s})]}),e.jsx(Uy,{children:({isActive:t})=>e.jsx(Py,{transactionData:n,displayFee:t,gas:o||"0x0",tokenPrice:a,tokenSymbol:s})})]})})};let Xy=E.styled.div`
2520
+ `;const Xy=({from:t,to:r,txn:n,transactionInfo:i,tokenPrice:a,gas:o,tokenSymbol:s})=>{let l=n?.value||0;return e.jsx(Ry,{...d.useAppConfig().render.standalone?{defaultValue:"details"}:{},children:e.jsxs(Fy,{value:"details",children:[e.jsx(Ly,{children:e.jsxs(Jy,{children:[e.jsx("div",{children:i?.title||i?.actionDescription||"Details"}),e.jsx(Qy,{children:e.jsx(Ey,{weiQuantities:[l],tokenPrice:a,tokenSymbol:s})})]})}),e.jsxs(Uy,{children:[e.jsx(wy,{label:"From",children:e.jsx(Yy,{walletAddress:t,chainId:n.chainId||d.CHAIN_ID_MAINNET,network:"ethereum"})}),e.jsx(wy,{label:"To",children:e.jsx(Yy,{walletAddress:r,chainId:n.chainId||d.CHAIN_ID_MAINNET,network:"ethereum"})}),i&&i.action&&e.jsx(wy,{label:"Action",children:i.action}),o&&e.jsx(Py,{transactionData:n,gas:o,tokenPrice:a,tokenSymbol:s})]}),e.jsx(Dy,{children:({isActive:t})=>e.jsx(_y,{transactionData:n,displayFee:t,gas:o||"0x0",tokenPrice:a,tokenSymbol:s})})]})})};let Jy=E.styled.div`
2521
2521
  display: flex;
2522
2522
  flex-direction: row;
2523
2523
  justify-content: space-between;
2524
- `,Jy=E.styled.div`
2524
+ `,Qy=E.styled.div`
2525
2525
  flex-shrink: 0;
2526
2526
  padding-left: 8px;
2527
- `;const Qy=({pendingTransaction:t})=>{let{getAccessToken:r}=s.usePrivy(),{wallets:n}=d.useWallets(),{walletProxy:i,rpcConfig:o,chains:l,appId:u,nativeTokenSymbolForChainId:h}=s.usePrivyInternal(),[p,y]=a.useState(null),[m,f]=a.useState(t),{tokenPrice:g}=Wc(m.chainId),v=h(t.chainId)||"ETH",w=a.useMemo((()=>n.find((e=>"privy"===e.walletClientType))),[n]);return a.useEffect((()=>{(async function(){if(!await r()||!i||!w)return m;let e=c.getJsonRpcProvider(m.chainId,l,o,{appId:u}),t=await or(w.address,m,e),{totalGasEstimate:n}=await ir(t,e);return y(n.toHexString()),t})().then(f).catch(console.error)}),[i]),w?e.jsx(em,{children:e.jsx(Zy,{from:w.address,to:m.to,txn:m,gas:p??void 0,tokenPrice:g,tokenSymbol:v})}):null};let em=E.styled.div`
2527
+ `;const em=({pendingTransaction:t})=>{let{getAccessToken:r}=s.usePrivy(),{wallets:n}=d.useWallets(),{walletProxy:i,rpcConfig:o,chains:l,appId:c,nativeTokenSymbolForChainId:u}=s.usePrivyInternal(),[h,p]=a.useState(null),[y,m]=a.useState(t),{tokenPrice:f}=Wc(y.chainId),g=u(t.chainId)||"ETH",v=a.useMemo((()=>n.find((e=>"privy"===e.walletClientType))),[n]);return a.useEffect((()=>{(async function(){if(!await r()||!i||!v)return y;let e=d.getJsonRpcProvider(y.chainId,l,o,{appId:c}),t=await or(v.address,y,e),{totalGasEstimate:n}=await ir(t,e);return p(n.toHexString()),t})().then(m).catch(console.error)}),[i]),v?e.jsx(tm,{children:e.jsx(Xy,{from:v.address,to:y.to,txn:y,gas:h??void 0,tokenPrice:f,tokenSymbol:g})}):null};let tm=E.styled.div`
2528
2528
  width: 100%;
2529
2529
  padding: 1rem 0;
2530
- `;const tm=({hasBlockingError:t,error:r,onClose:n,onBack:i,handleSubmit:a,account:o,submitSuccess:l})=>{let{pendingTransaction:d}=s.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:n},"header"),e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:l,fail:!!r}),r?e.jsx(Be.default,{style:{width:"38px",height:"38px"}}):e.jsx($u,{style:{width:"38px",height:"38px"}})]})}),e.jsx(vs,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),e.jsxs(Cs,{children:[e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(xt.default,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(Pt.default,{})}),"You last added a passkey on"," ",o?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),d&&e.jsx(xs,{children:e.jsx(Qy,{pendingTransaction:d})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(Ms,{style:{marginTop:"1.25rem"},children:r.message}),e.jsx(bo,{disabled:t,onClick:a,style:{marginTop:"1.25rem"},children:"Try again"})]}),i&&e.jsx(Ns,{style:{marginTop:"1rem"},onClick:i,children:"Choose another method"}),e.jsx(c.ModalFooter,{})]})},rm=({open:t,onClose:r})=>{let{user:n}=s.usePrivy(),[i,o]=a.useState(null),{init:l,cancel:d,submit:u}=zp(),[h,p]=a.useState(!1),[y,m]=a.useState(!1),[f,g]=a.useState(null),[v,w]=a.useState(null);a.useEffect((()=>{t&&n?.mfaMethods&&n.mfaMethods.length>0?E(n.mfaMethods[0]):o(null)}),[n?.mfaMethods,t]);let x=e=>td(e)?(p(!0),Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):ed(e)?(p(!1),Error("The code you entered is not valid")):Ql(e)?(p(!0),Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(e),p(!1),Error("Something went wrong."));async function C(e){w(null);try{if(!e||!i)return;await u(i,e),m(!0),p(!1),r()}catch(e){throw x(e)}}async function E(e){if("passkey"!==e)try{o(e),await l(e)}catch(e){console.error(e)}else try{o(e);let t=await l(e);if(!t)throw Error("something went wrong");g(t),await u(e,t),m(!0),p(!1),r()}catch(e){w(x(e))}}let b=()=>{o(null),w(null),d(),r()};return t&&n?"passkey"===i?e.jsx(tm,{account:n.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],selectedMethod:i,submitSuccess:y,hasBlockingError:h,error:v,onClose:b,onBack:()=>{o(null),w(null)},handleSubmit:()=>C(f).catch(w)}):i?e.jsx(nm,{submitSuccess:y,hasBlockingError:h,handleSubmitCode:C,selectedMethod:i,onClose:b,onBack:n.mfaMethods.length>1?()=>o(null):void 0}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:b},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(xt.default,{})}),e.jsx(vs,{children:"Verify your identity"}),e.jsx(ws,{children:"Choose a verification method"}),e.jsxs(As,{children:[n.mfaMethods.includes("totp")&&e.jsxs(Jo,{onClick:()=>E("totp"),children:[e.jsx(Et.default,{}),"Authenticator App"]},"totp"),n.mfaMethods.includes("sms")&&e.jsxs(Jo,{onClick:()=>E("sms"),children:[e.jsx(Ke.default,{}),"SMS"]},"sms"),n.mfaMethods.includes("passkey")&&e.jsxs(Jo,{onClick:()=>E("passkey"),children:[e.jsx(bt.default,{}),"Passkey"]},"passkey")]}),e.jsx(c.ModalFooter,{})]}):null};let nm=({selectedMethod:t,submitSuccess:r,hasBlockingError:n,onClose:i,onBack:a,handleSubmitCode:o})=>{let{app:l}=v.usePrivyModal(),{pendingTransaction:d}=s.usePrivyInternal();switch(t){case"sms":return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:i},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Ke.default,{})}),e.jsx(vs,{children:"Enter verification code"}),e.jsxs(xs,{children:[e.jsx(hy,{success:r,disabled:n,onChange:o}),e.jsxs(ws,{children:["To continue, please enter the 6-digit code sent to your ",e.jsx("strong",{children:"mobile device"})]}),d&&e.jsx(Qy,{pendingTransaction:d})]}),a&&e.jsx(Ns,{theme:l?.appearance.palette.colorScheme,onClick:a,children:"Choose another method"}),e.jsx(To,{onClick:i,children:"Not now"}),e.jsx(c.ModalFooter,{})]});case"totp":return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:i},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Et.default,{})}),e.jsx(vs,{children:"Enter verification code"}),e.jsxs(xs,{children:[e.jsx(hy,{success:r,disabled:n,onChange:o}),e.jsxs(ws,{children:["To continue, please enter the 6-digit code generated from your"," ",e.jsx("strong",{children:"authenticator app"})]}),d&&e.jsx(Qy,{pendingTransaction:d})]}),a&&e.jsx(Ns,{theme:l?.appearance.palette.colorScheme,onClick:a,children:"Choose another method"}),e.jsx(To,{onClick:i,children:"Not now"}),e.jsx(c.ModalFooter,{})]});default:return null}};let im=E.styled.div`
2530
+ `;const rm=({hasBlockingError:t,error:r,onClose:n,onBack:i,handleSubmit:a,account:o,submitSuccess:l})=>{let{pendingTransaction:d}=s.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:n},"header"),e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:l,fail:!!r}),r?e.jsx(Be.default,{style:{width:"38px",height:"38px"}}):e.jsx(Tu,{style:{width:"38px",height:"38px"}})]})}),e.jsx(vs,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),e.jsxs(Cs,{children:[e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(xt.default,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(Pt.default,{})}),"You last added a passkey on"," ",o?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),d&&e.jsx(xs,{children:e.jsx(em,{pendingTransaction:d})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(Ms,{style:{marginTop:"1.25rem"},children:r.message}),e.jsx(bo,{disabled:t,onClick:a,style:{marginTop:"1.25rem"},children:"Try again"})]}),i&&e.jsx(Ns,{style:{marginTop:"1rem"},onClick:i,children:"Choose another method"}),e.jsx(c.ModalFooter,{})]})},nm=({open:t,onClose:r})=>{let{user:n}=s.usePrivy(),[i,o]=a.useState(null),{init:l,cancel:d,submit:u}=Vp(),[h,p]=a.useState(!1),[y,m]=a.useState(!1),[f,g]=a.useState(null),[v,w]=a.useState(null);a.useEffect((()=>{t&&n?.mfaMethods&&n.mfaMethods.length>0?E(n.mfaMethods[0]):o(null)}),[n?.mfaMethods,t]);let x=e=>td(e)?(p(!0),Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):ed(e)?(p(!1),Error("The code you entered is not valid")):Ql(e)?(p(!0),Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(e),p(!1),Error("Something went wrong."));async function C(e){w(null);try{if(!e||!i)return;await u(i,e),m(!0),p(!1),r()}catch(e){throw x(e)}}async function E(e){if("passkey"!==e)try{o(e),await l(e)}catch(e){console.error(e)}else try{o(e);let t=await l(e);if(!t)throw Error("something went wrong");g(t),await u(e,t),m(!0),p(!1),r()}catch(e){w(x(e))}}let b=()=>{o(null),w(null),d(),r()};return t&&n?"passkey"===i?e.jsx(rm,{account:n.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],selectedMethod:i,submitSuccess:y,hasBlockingError:h,error:v,onClose:b,onBack:()=>{o(null),w(null)},handleSubmit:()=>C(f).catch(w)}):i?e.jsx(im,{submitSuccess:y,hasBlockingError:h,handleSubmitCode:C,selectedMethod:i,onClose:b,onBack:n.mfaMethods.length>1?()=>o(null):void 0}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:b},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(xt.default,{})}),e.jsx(vs,{children:"Verify your identity"}),e.jsx(ws,{children:"Choose a verification method"}),e.jsxs(As,{children:[n.mfaMethods.includes("totp")&&e.jsxs(Jo,{onClick:()=>E("totp"),children:[e.jsx(Et.default,{}),"Authenticator App"]},"totp"),n.mfaMethods.includes("sms")&&e.jsxs(Jo,{onClick:()=>E("sms"),children:[e.jsx(Ke.default,{}),"SMS"]},"sms"),n.mfaMethods.includes("passkey")&&e.jsxs(Jo,{onClick:()=>E("passkey"),children:[e.jsx(bt.default,{}),"Passkey"]},"passkey")]}),e.jsx(c.ModalFooter,{})]}):null};let im=({selectedMethod:t,submitSuccess:r,hasBlockingError:n,onClose:i,onBack:a,handleSubmitCode:o})=>{let{app:l}=v.usePrivyModal(),{pendingTransaction:d}=s.usePrivyInternal();switch(t){case"sms":return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:i},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Ke.default,{})}),e.jsx(vs,{children:"Enter verification code"}),e.jsxs(xs,{children:[e.jsx(py,{success:r,disabled:n,onChange:o}),e.jsxs(ws,{children:["To continue, please enter the 6-digit code sent to your ",e.jsx("strong",{children:"mobile device"})]}),d&&e.jsx(em,{pendingTransaction:d})]}),a&&e.jsx(Ns,{theme:l?.appearance.palette.colorScheme,onClick:a,children:"Choose another method"}),e.jsx(To,{onClick:i,children:"Not now"}),e.jsx(c.ModalFooter,{})]});case"totp":return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:i},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Et.default,{})}),e.jsx(vs,{children:"Enter verification code"}),e.jsxs(xs,{children:[e.jsx(py,{success:r,disabled:n,onChange:o}),e.jsxs(ws,{children:["To continue, please enter the 6-digit code generated from your"," ",e.jsx("strong",{children:"authenticator app"})]}),d&&e.jsx(em,{pendingTransaction:d})]}),a&&e.jsx(Ns,{theme:l?.appearance.palette.colorScheme,onClick:a,children:"Choose another method"}),e.jsx(To,{onClick:i,children:"Not now"}),e.jsx(c.ModalFooter,{})]});default:return null}};let am=E.styled.div`
2531
2531
  display: flex;
2532
2532
  flex-direction: column;
2533
2533
  align-items: center;
@@ -2535,7 +2535,7 @@
2535
2535
  margin-left: 27px;
2536
2536
  margin-right: 27px;
2537
2537
  gap: 24px;
2538
- `;let am=E.styled.div`
2538
+ `;let om=E.styled.div`
2539
2539
  display: flex;
2540
2540
  flex-direction: column;
2541
2541
  align-items: center;
@@ -2558,9 +2558,9 @@
2558
2558
  stroke: var(--privy-color-accent) !important;
2559
2559
  fill: var(--privy-color-accent) !important;
2560
2560
  }
2561
- `;let om=E.styled(Ws)`
2561
+ `;let sm=E.styled(Ws)`
2562
2562
  margin: 16px auto;
2563
- `;const sm=E.styled.div`
2563
+ `;const lm=E.styled.div`
2564
2564
  display: flex;
2565
2565
  flex-direction: column;
2566
2566
  align-items: center;
@@ -2582,18 +2582,18 @@
2582
2582
  font-weight: 400;
2583
2583
  line-height: 20px;
2584
2584
  }
2585
- `;let lm=E.styled.div`
2585
+ `;let dm=E.styled.div`
2586
2586
  display: flex;
2587
2587
  flex-direction: column;
2588
2588
  justify-content: space-between;
2589
- `,dm=E.styled.div`
2589
+ `,cm=E.styled.div`
2590
2590
  line-height: 20px;
2591
2591
  height: 20px;
2592
2592
  font-size: 13px;
2593
2593
  color: var(--privy-color-error);
2594
2594
  text-align: left;
2595
2595
  margin-top: 0.5rem;
2596
- `,cm=E.styled(bo)`
2596
+ `,um=E.styled(bo)`
2597
2597
  ${e=>e.hideAnimations&&E.css`
2598
2598
  && {
2599
2599
  // Remove animations because the recoverWallet task on the iframe partially
@@ -2601,21 +2601,21 @@
2601
2601
  transition: none;
2602
2602
  }
2603
2603
  `}
2604
- `;const um=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...t,children:[e.jsx("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#3E82F4"}),e.jsx("stop",{offset:1,stopColor:"#93DCF7"})]})})]}),hm=({style:t,...r})=>e.jsxs("svg",{width:"16",height:"14",style:t,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[e.jsxs("g",{clipPath:"url(#clip0_2115_829)",children:[e.jsx("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),e.jsx("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),e.jsx("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),e.jsx("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),e.jsx("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),e.jsx("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_2115_829",children:e.jsx("rect",{width:"16",height:"14",fill:"white"})})})]}),pm=E.styled.div`
2604
+ `;const hm=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...t,children:[e.jsx("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#3E82F4"}),e.jsx("stop",{offset:1,stopColor:"#93DCF7"})]})})]}),pm=({style:t,...r})=>e.jsxs("svg",{width:"16",height:"14",style:t,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[e.jsxs("g",{clipPath:"url(#clip0_2115_829)",children:[e.jsx("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),e.jsx("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),e.jsx("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),e.jsx("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),e.jsx("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),e.jsx("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_2115_829",children:e.jsx("rect",{width:"16",height:"14",fill:"white"})})})]}),ym=E.styled.div`
2605
2605
  display: flex;
2606
2606
  flex-direction: column;
2607
2607
  gap: 12px;
2608
2608
  padding-top: 24px;
2609
2609
  padding-bottom: 24px;
2610
- `,ym=E.styled.div`
2610
+ `,mm=E.styled.div`
2611
2611
  padding-bottom: 24px;
2612
- `;let mm={"google-drive":{name:"Google Drive",component:hm},icloud:{name:"iCloud",component:um}};let fm=E.styled.div`
2612
+ `;let fm={"google-drive":{name:"Google Drive",component:pm},icloud:{name:"iCloud",component:hm}};let gm=E.styled.div`
2613
2613
  width: 24px;
2614
2614
  height: 24px;
2615
2615
  display: flex;
2616
2616
  justify-content: center;
2617
2617
  align-items: center;
2618
- `,gm={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},vm=({onClose:t})=>e.jsxs(ym,{children:[e.jsx(tl,{title:"Why do I need to secure my account?",icon:e.jsx(Le.default,{width:48}),description:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),e.jsx("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),e.jsx(bo,{onClick:t,children:"Select backup method"})]});const wm=E.styled.div`
2618
+ `,vm={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy"},wm=({onClose:t})=>e.jsxs(mm,{children:[e.jsx(tl,{title:"Why do I need to secure my account?",icon:e.jsx(Le.default,{width:48}),description:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),e.jsx("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),e.jsx(bo,{onClick:t,children:"Select backup method"})]});const xm=E.styled.div`
2619
2619
  && {
2620
2620
  border-width: 4px;
2621
2621
  }
@@ -2628,9 +2628,9 @@
2628
2628
  border-style: solid;
2629
2629
  border-color: ${e=>e.$color??"var(--privy-color-accent)"};
2630
2630
  border-radius: 50%;
2631
- `;async function xm({tx:e,accessToken:t,walletProxy:r,transactingWalletAddress:n}){let i=function(e,t){if(Yc(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,n),a=Yc(e)?Buffer.from(e.message.serialize()):e.serializeMessage(),{response:o}=await r.rpcSolana({accessToken:t,publicKey:i.toBase58(),request:{method:"signMessage",params:{message:a.toString("base64")}}}),s=o.data.signature;e.addSignature(i,Buffer.from(s,"base64"))}async function Cm({tx:e,connection:t,accessToken:r,walletProxy:n,transactingWalletAddress:i,transactionOptions:a}){let o;try{await xm({tx:e,accessToken:r,walletProxy:n,transactingWalletAddress:i});let s=e.serialize();o=await t.sendRawTransaction(s,a);let l=await t.confirmTransaction(o);if(l.value.err||l.value.err){let e=l.value.err||l.value.err;if("string"==typeof e)throw Error(e);throw e}return{signature:o,receipt:await t.getParsedTransaction(o,{maxSupportedTransactionVersion:0})}}catch(e){throw e.txSignature=o,e}}function Em(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 bm={[d.mainnet.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[d.sepolia.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[d.optimism.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[d.optimismSepolia.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[d.polygon.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[d.polygonAmoy.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[d.base.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[d.baseSepolia.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[d.avalanche.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[d.avalancheFuji.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[d.arbitrum.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[d.arbitrumSepolia.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"},Sm=({address:e,appConfig:t,fundWalletConfig:r,methodScreen:n,chainIdOverride:i,comingFromSendTransactionScreen:a=!1})=>{let o,l;if(!t.fundingConfig||0===t.fundingConfig.methods.length)return;o=i||($h(r)&&r.chain?r.chain.id:Em(t.fundingConfig.defaultRecommendedCurrency.chain));let d=t.chains.find((e=>e.id===o));if(!d)throw new s.PrivyClientError(`Funding chain ${o} is not in PrivyProvider chains list`);let c=$h(r)&&r.amount?r.amount:t.fundingConfig.defaultRecommendedAmount,u=!1;function h(){if(!o)return;let e=bm[o];t.fundingConfig?.methods.includes("external")&&!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 $h(r)&&"asset"in r?"USDC"===r.asset?h():"string"!=typeof r.asset&&"erc20"in r.asset&&(u=((e,t)=>e===bm[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,comingFromSendTransactionScreen:a,...jh(r)?{moonpayConfigOverride:r.config}:{}}};function Am({address:e,fundWalletConfig:t,appConfig:r,comingFromSendTransactionScreen:n,methodScreen:i}){if(r.fundingConfig)return{chainType:"solana",address:e,amount:t?.amount??r.fundingConfig.defaultRecommendedAmount,isUSDC:!1,methodScreen:i,comingFromSendTransactionScreen:n,cluster:t?.cluster??{name:"mainnet-beta"}}}const jm=[v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN,v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN,v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN,v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN,v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN,v.ModalScreen.MOONPAY_PROMPT_SCREEN,v.ModalScreen.MOONPAY_STATUS_SCREEN],$m={[v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN]:null,[v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:"external",[v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:"external",[v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN]:"external",[v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN]:"manual",[v.ModalScreen.MOONPAY_PROMPT_SCREEN]:"moonpay",[v.ModalScreen.MOONPAY_STATUS_SCREEN]:"moonpay"},Tm={moonpay:v.ModalScreen.MOONPAY_PROMPT_SCREEN,"coinbase-onramp":v.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN,external:v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN};function Pm({fundingMethods:e}){if(0===e.length)throw Error("Wallet funding is not enabled");return 1===e.length?Tm[e[0]]:v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN}const _m=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,km=({img:t,submitError:r,prepareError:n,onClose:i,action:a,amount:o,title:s,subtitle:l,total:d,txValue:u,to:h,network:p,missingFunds:y,fee:m,from:f,cta:g,disabled:v,chain:w,isSubmitting:x,isPreparing:C,isTokenPriceLoading:E,isTokenContractInfoLoading:b,isSponsored:S,symbol:A,balance:j,onClick:$,spender:T,transactionIndex:P,maxIndex:_,onBack:k,chainName:N})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:i,backFn:k}),t&&e.jsx(Om,{children:t}),e.jsxs(pd,{style:{marginTop:t?"1.5rem":0},children:[s,e.jsx(_m,{maxIndex:_,transactionIndex:P})]}),e.jsx(hd,{children:l}),e.jsxs(tu,{style:{marginTop:"2rem"},children:[d&&e.jsxs(ru,{children:[e.jsx(nu,{children:"Total"}),e.jsx(iu,{$isLoading:C||E,children:d})]}),a&&"transaction"!==a&&"transfer"!==a&&e.jsxs(ru,{children:[e.jsx(nu,{children:"Action"}),e.jsx(iu,{children:a})]}),o?e.jsxs(ru,{children:[e.jsx(nu,{children:"Amount"}),e.jsxs(iu,{$isLoading:b,children:[Mm(o)," ",A]})]}):null,T?e.jsxs(ru,{children:[e.jsx(nu,{children:"Spender"}),e.jsx(iu,{children:e.jsx(c.Address,{address:T,url:w?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,h&&e.jsxs(ru,{children:[e.jsx(nu,{children:"To"}),e.jsx(iu,{children:e.jsx(c.Address,{address:h,url:w?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"Network"}),e.jsx(iu,{children:p})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"Estimated fee"}),e.jsx(iu,{$isLoading:C||E||void 0===S,children:S?"Sponsored":m})]})]}),e.jsx(zo,{}),r?e.jsx(c.ErrorMessage,{style:{marginTop:"2rem"},children:r.message}):n?e.jsx(c.ErrorMessage,{style:{marginTop:"2rem"},children:Im}):null,e.jsx(Nm,{$useSmallMargins:!(!n&&!r),title:Number(u)>0?void 0:!1!==S?"Your wallet":void 0,address:f,balance:j,isLoading:C||E,errMsg:C||n||r||!y?void 0:`Add funds on ${w?.name??N} to complete transaction.`}),e.jsx(bo,{style:{marginTop:"1rem"},loading:x,disabled:v||C,onClick:$,children:g}),e.jsx(c.BlobbyFooter,{})]});let Nm=E.styled(c.WalletInfoCard)`
2631
+ `;async function Cm({tx:e,accessToken:t,walletProxy:r,transactingWalletAddress:n}){let i=function(e,t){if(Yc(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,n),a=Yc(e)?Buffer.from(e.message.serialize()):e.serializeMessage(),{response:o}=await r.rpcSolana({accessToken:t,publicKey:i.toBase58(),request:{method:"signMessage",params:{message:a.toString("base64")}}}),s=o.data.signature;e.addSignature(i,Buffer.from(s,"base64"))}async function Em({tx:e,connection:t,accessToken:r,walletProxy:n,transactingWalletAddress:i,transactionOptions:a}){let o;try{await Cm({tx:e,accessToken:r,walletProxy:n,transactingWalletAddress:i});let s=e.serialize();o=await t.sendRawTransaction(s,a);let l=await t.confirmTransaction(o);if(l.value.err||l.value.err){let e=l.value.err||l.value.err;if("string"==typeof e)throw Error(e);throw e}return{signature:o,receipt:await t.getParsedTransaction(o,{maxSupportedTransactionVersion:0})}}catch(e){throw e.txSignature=o,e}}function bm(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 Sm={[d.mainnet.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[d.sepolia.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[d.optimism.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[d.optimismSepolia.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[d.polygon.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[d.polygonAmoy.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[d.base.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[d.baseSepolia.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[d.avalanche.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[d.avalancheFuji.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[d.arbitrum.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[d.arbitrumSepolia.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"},Am=({address:e,appConfig:t,fundWalletConfig:r,methodScreen:n,chainIdOverride:i,comingFromSendTransactionScreen:a=!1})=>{let o,l;if(!t.fundingConfig||0===t.fundingConfig.methods.length)return;o=i||(Th(r)&&r.chain?r.chain.id:bm(t.fundingConfig.defaultRecommendedCurrency.chain));let d=t.chains.find((e=>e.id===o));if(!d)throw new s.PrivyClientError(`Funding chain ${o} is not in PrivyProvider chains list`);let c=Th(r)&&r.amount?r.amount:t.fundingConfig.defaultRecommendedAmount,u=!1;function h(){if(!o)return;let e=Sm[o];t.fundingConfig?.methods.includes("external")&&!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 Th(r)&&"asset"in r?"USDC"===r.asset?h():"string"!=typeof r.asset&&"erc20"in r.asset&&(u=((e,t)=>e===Sm[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,comingFromSendTransactionScreen:a,...$h(r)?{moonpayConfigOverride:r.config}:{}}};function jm({address:e,fundWalletConfig:t,appConfig:r,comingFromSendTransactionScreen:n,methodScreen:i}){if(r.fundingConfig)return{chainType:"solana",address:e,amount:t?.amount??r.fundingConfig.defaultRecommendedAmount,isUSDC:!1,methodScreen:i,comingFromSendTransactionScreen:n,cluster:t?.cluster??{name:"mainnet-beta"}}}const $m=[v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN,v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN,v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN,v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN,v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN,v.ModalScreen.MOONPAY_PROMPT_SCREEN,v.ModalScreen.MOONPAY_STATUS_SCREEN],Tm={[v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN]:null,[v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:"external",[v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:"external",[v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN]:"external",[v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN]:"manual",[v.ModalScreen.MOONPAY_PROMPT_SCREEN]:"moonpay",[v.ModalScreen.MOONPAY_STATUS_SCREEN]:"moonpay"},Pm={moonpay:v.ModalScreen.MOONPAY_PROMPT_SCREEN,"coinbase-onramp":v.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN,external:v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN};function _m({fundingMethods:e}){if(0===e.length)throw Error("Wallet funding is not enabled");return 1===e.length?Pm[e[0]]:v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN}const km=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,Nm=({img:t,submitError:r,prepareError:n,onClose:i,action:a,amount:o,title:s,subtitle:l,total:d,txValue:u,to:h,network:p,missingFunds:y,fee:m,from:f,cta:g,disabled:v,chain:w,isSubmitting:x,isPreparing:C,isTokenPriceLoading:E,isTokenContractInfoLoading:b,isSponsored:S,symbol:A,balance:j,onClick:$,spender:T,transactionIndex:P,maxIndex:_,onBack:k,chainName:N})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:i,backFn:k}),t&&e.jsx(Rm,{children:t}),e.jsxs(pd,{style:{marginTop:t?"1.5rem":0},children:[s,e.jsx(km,{maxIndex:_,transactionIndex:P})]}),e.jsx(hd,{children:l}),e.jsxs(tu,{style:{marginTop:"2rem"},children:[d&&e.jsxs(ru,{children:[e.jsx(nu,{children:"Total"}),e.jsx(iu,{$isLoading:C||E,children:d})]}),a&&"transaction"!==a&&"transfer"!==a&&e.jsxs(ru,{children:[e.jsx(nu,{children:"Action"}),e.jsx(iu,{children:a})]}),o?e.jsxs(ru,{children:[e.jsx(nu,{children:"Amount"}),e.jsxs(iu,{$isLoading:b,children:[Om(o)," ",A]})]}):null,T?e.jsxs(ru,{children:[e.jsx(nu,{children:"Spender"}),e.jsx(iu,{children:e.jsx(c.Address,{address:T,url:w?.blockExplorers?.default?.url,showCopyIcon:!1})})]}):null,h&&e.jsxs(ru,{children:[e.jsx(nu,{children:"To"}),e.jsx(iu,{children:e.jsx(c.Address,{address:h,url:w?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"Network"}),e.jsx(iu,{children:p})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"Estimated fee"}),e.jsx(iu,{$isLoading:C||E||void 0===S,children:S?"Sponsored":m})]})]}),e.jsx(zo,{}),r?e.jsx(c.ErrorMessage,{style:{marginTop:"2rem"},children:r.message}):n?e.jsx(c.ErrorMessage,{style:{marginTop:"2rem"},children:Mm}):null,e.jsx(Im,{$useSmallMargins:!(!n&&!r),title:Number(u)>0?void 0:!1!==S?"Your wallet":void 0,address:f,balance:j,isLoading:C||E,errMsg:C||n||r||!y?void 0:`Add funds on ${w?.name??N} to complete transaction.`}),e.jsx(bo,{style:{marginTop:"1rem"},loading:x,disabled:v||C,onClick:$,children:g}),e.jsx(c.BlobbyFooter,{})]});let Im=E.styled(c.WalletInfoCard)`
2632
2632
  ${e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;"}
2633
- `,Im="There was an error preparing your transaction. Your transaction request will likely fail.",Mm=e=>e.toLocaleString(),Om=E.styled.div`
2633
+ `,Mm="There was an error preparing your transaction. Your transaction request will likely fail.",Om=e=>e.toLocaleString(),Rm=E.styled.div`
2634
2634
  display: flex;
2635
2635
  width: 100%;
2636
2636
  justify-content: center;
@@ -2640,12 +2640,12 @@
2640
2640
  object-fit: contain;
2641
2641
  border-radius: var(--privy-border-radius-sm);
2642
2642
  }
2643
- `,Rm=new Set([Pe.ErrorCode.CALL_EXCEPTION,Pe.ErrorCode.NONCE_EXPIRED,Pe.ErrorCode.REPLACEMENT_UNDERPRICED,Pe.ErrorCode.TRANSACTION_REPLACED]);const Fm=e=>{let t;return e.code&&-32e3!==e.code&&Rm.has(e.code)&&(t=e.transactionHash),t},Lm=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 Um=()=>e.jsxs(Gm,{children:[e.jsx(zm,{}),e.jsx(qm,{})]});const Dm=({transactionError:t,chainId:r,onClose:n,onRetry:i,network:o,connection:l})=>{let{chains:d}=s.usePrivyInternal(),[u,h]=a.useState(!1),{errorCode:p,transactionHash:y,errorMessage:m}=((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:Fm(e),errorMessage:Lm(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}})(t,o),f=(({chains:e,chainId:t,network:r,connection:n,transactionHash:i})=>"ethereum"===r?e.find((e=>e.id===t))?.blockExplorers?.default.url??"https://etherscan.io":function(e,t){return`https://explorer.solana.com/tx/${e}?cluster=${t}`}(i||"",Hc(n?.rpcEndpoint||"")))({chains:d,chainId:r,network:o,connection:l,transactionHash:y});return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:n}),e.jsxs(Wm,{children:[e.jsx(Um,{}),e.jsx(Bm,{children:p}),e.jsx(Hm,{children:"Please try again."}),e.jsxs(Ym,{children:[e.jsx(Km,{children:"Error message"}),e.jsx(Xm,{$clickable:!1,children:m})]}),y&&e.jsxs(Ym,{children:[e.jsx(Km,{children:"Transaction hash"}),e.jsxs(Zm,{children:["Copy this hash to view details about the transaction on a"," ",e.jsx("u",{children:e.jsx("a",{href:f,children:"block explorer"})}),"."]}),e.jsxs(Xm,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(y),h(!0)},children:[y,e.jsx(ef,{clicked:u})]})]}),e.jsx(Vm,{onClick:()=>i({resetNonce:!!y}),children:"Retry transaction"})]}),e.jsx(c.ModalFooter,{})]})};let Wm=E.styled.div`
2643
+ `,Fm=new Set([Pe.ErrorCode.CALL_EXCEPTION,Pe.ErrorCode.NONCE_EXPIRED,Pe.ErrorCode.REPLACEMENT_UNDERPRICED,Pe.ErrorCode.TRANSACTION_REPLACED]);const Lm=e=>{let t;return e.code&&-32e3!==e.code&&Fm.has(e.code)&&(t=e.transactionHash),t},Um=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 Dm=()=>e.jsxs(qm,{children:[e.jsx(Vm,{}),e.jsx(zm,{})]});const Wm=({transactionError:t,chainId:r,onClose:n,onRetry:i,network:o,connection:l})=>{let{chains:d}=s.usePrivyInternal(),[u,h]=a.useState(!1),{errorCode:p,transactionHash:y,errorMessage:m}=((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:Lm(e),errorMessage:Um(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}})(t,o),f=(({chains:e,chainId:t,network:r,connection:n,transactionHash:i})=>"ethereum"===r?e.find((e=>e.id===t))?.blockExplorers?.default.url??"https://etherscan.io":function(e,t){return`https://explorer.solana.com/tx/${e}?cluster=${t}`}(i||"",Hc(n?.rpcEndpoint||"")))({chains:d,chainId:r,network:o,connection:l,transactionHash:y});return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:n}),e.jsxs(Bm,{children:[e.jsx(Dm,{}),e.jsx(Hm,{children:p}),e.jsx(Gm,{children:"Please try again."}),e.jsxs(Zm,{children:[e.jsx(Ym,{children:"Error message"}),e.jsx(Jm,{$clickable:!1,children:m})]}),y&&e.jsxs(Zm,{children:[e.jsx(Ym,{children:"Transaction hash"}),e.jsxs(Xm,{children:["Copy this hash to view details about the transaction on a"," ",e.jsx("u",{children:e.jsx("a",{href:f,children:"block explorer"})}),"."]}),e.jsxs(Jm,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(y),h(!0)},children:[y,e.jsx(tf,{clicked:u})]})]}),e.jsx(Km,{onClick:()=>i({resetNonce:!!y}),children:"Retry transaction"})]}),e.jsx(c.ModalFooter,{})]})};let Bm=E.styled.div`
2644
2644
  display: flex;
2645
2645
  flex-direction: column;
2646
2646
  align-items: center;
2647
2647
  justify-content: center;
2648
- `,Bm=E.styled.span`
2648
+ `,Hm=E.styled.span`
2649
2649
  color: var(--privy-color-foreground);
2650
2650
  text-align: center;
2651
2651
  font-size: 1.125rem;
@@ -2653,7 +2653,7 @@
2653
2653
  line-height: 1.25rem; /* 111.111% */
2654
2654
  text-align: center;
2655
2655
  margin: 10px;
2656
- `,Hm=E.styled.span`
2656
+ `,Gm=E.styled.span`
2657
2657
  margin-top: 4px;
2658
2658
  margin-bottom: 10px;
2659
2659
  color: var(--privy-color-foreground-3);
@@ -2664,7 +2664,7 @@
2664
2664
  font-weight: 400;
2665
2665
  line-height: 20px; /* 142.857% */
2666
2666
  letter-spacing: -0.008px;
2667
- `,Gm=E.styled.div`
2667
+ `,qm=E.styled.div`
2668
2668
  position: relative;
2669
2669
  width: 60px;
2670
2670
  height: 60px;
@@ -2672,37 +2672,37 @@
2672
2672
  display: flex;
2673
2673
  justify-content: center;
2674
2674
  align-items: center;
2675
- `,qm=E.styled(It.default)`
2675
+ `,zm=E.styled(It.default)`
2676
2676
  position: absolute;
2677
2677
  width: 35px;
2678
2678
  height: 35px;
2679
2679
  color: var(--privy-color-error);
2680
- `,zm=E.styled.div`
2680
+ `,Vm=E.styled.div`
2681
2681
  position: absolute;
2682
2682
  width: 60px;
2683
2683
  height: 60px;
2684
2684
  border-radius: 50%;
2685
2685
  background-color: var(--privy-color-error);
2686
2686
  opacity: 0.1;
2687
- `,Vm=E.styled(bo)`
2687
+ `,Km=E.styled(bo)`
2688
2688
  && {
2689
2689
  margin-top: 24px;
2690
2690
  }
2691
2691
  transition: color 350ms ease, background-color 350ms ease;
2692
- `,Km=E.styled.span`
2692
+ `,Ym=E.styled.span`
2693
2693
  width: 100%;
2694
2694
  text-align: left;
2695
2695
  font-size: 0.825rem;
2696
2696
  color: var(--privy-color-foreground);
2697
2697
  padding: 4px;
2698
- `,Ym=E.styled.div`
2698
+ `,Zm=E.styled.div`
2699
2699
  width: 100%;
2700
2700
  margin: 5px;
2701
2701
  display: flex;
2702
2702
  flex-direction: column;
2703
2703
  justify-content: center;
2704
2704
  align-items: center;
2705
- `,Zm=E.styled.text`
2705
+ `,Xm=E.styled.text`
2706
2706
  position: relative;
2707
2707
  width: 100%;
2708
2708
  padding: 5px;
@@ -2710,7 +2710,7 @@
2710
2710
  color: var(--privy-color-foreground-3);
2711
2711
  text-align: left;
2712
2712
  word-wrap: break-word;
2713
- `,Xm=E.styled.span`
2713
+ `,Jm=E.styled.span`
2714
2714
  position: relative;
2715
2715
  width: 100%;
2716
2716
  background-color: var(--privy-color-background-2);
@@ -2722,19 +2722,19 @@
2722
2722
  text-align: left;
2723
2723
  word-wrap: break-word;
2724
2724
  ${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 }"}
2725
- `,Jm=E.styled(Nt.default)`
2725
+ `,Qm=E.styled(Nt.default)`
2726
2726
  position: absolute;
2727
2727
  top: 13px;
2728
2728
  right: 13px;
2729
2729
  width: 24px;
2730
2730
  height: 24px;
2731
- `,Qm=E.styled(it.default)`
2731
+ `,ef=E.styled(it.default)`
2732
2732
  position: absolute;
2733
2733
  top: 13px;
2734
2734
  right: 13px;
2735
2735
  width: 24px;
2736
2736
  height: 24px;
2737
- `,ef=({clicked:t})=>t?e.jsx(Qm,{}):e.jsx(Jm,{});const tf=({instructions:t,fees:r,transactionInfo:n,solPrice:i,rpcEndpoint:o})=>{let s=t.reduce(((e,{amount:t})=>e+t),0n),[l,d]=a.useState(0),[c,u]=a.useState(!1),h=t[l];return a.useEffect((()=>{d(0)}),[t]),e.jsxs(tu,{children:[e.jsxs(ru,{children:[e.jsx(nu,{children:"Total"}),e.jsx(iu,{children:e.jsx(by,{quantities:[s,r],tokenPrice:i})})]}),n&&n.action&&e.jsxs(ru,{children:[e.jsx(nu,{children:"Action"}),e.jsx(iu,{children:n.action})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"Fees"}),e.jsx(iu,{children:e.jsx(by,{quantities:[r||0n],tokenPrice:i})})]}),t.length>1?e.jsxs(e.Fragment,{children:[e.jsx(ru,{children:e.jsxs(df,{onClick:()=>u((e=>!e)),children:[e.jsx("span",{children:"Details"}),e.jsx(Tt.default,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:c?"rotate(180deg)":void 0}})]})}),c&&e.jsx(ru,{children:e.jsxs(nf,{children:[e.jsxs(af,{children:[e.jsxs(of,{children:[l+1," of ",t.length," instructions"]}),e.jsxs(lf,{children:[l>0&&e.jsx(Mo,{backFn:()=>d((e=>e-1))}),l<t.length-1&&e.jsx(Oo,{nextFn:()=>d((e=>e+1))})]})]}),e.jsx(sf,{children:e.jsx(rf,{instruction:h,rpcEndpoint:o,solPrice:i})})]})})]}):e.jsx(rf,{instruction:h,rpcEndpoint:o,solPrice:i,hideAmount:!0})]})};function rf({instruction:t,rpcEndpoint:r,solPrice:n,hideAmount:i}){return t?e.jsxs(tu,{children:[!i&&e.jsxs(ru,{children:[e.jsx(nu,{children:"Amount"}),e.jsx(iu,{children:e.jsx(by,{quantities:[t.amount],tokenPrice:n})})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"To"}),e.jsx(iu,{children:e.jsx(Ky,{walletAddress:t.to,rpcEndpoint:r,network:"solana"})})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"From"}),e.jsx(iu,{children:e.jsx(Ky,{walletAddress:t.from,rpcEndpoint:r,network:"solana"})})]})]}):null}let nf=E.styled.div`
2737
+ `,tf=({clicked:t})=>t?e.jsx(ef,{}):e.jsx(Qm,{});const rf=({instructions:t,fees:r,transactionInfo:n,solPrice:i,rpcEndpoint:o})=>{let s=t.reduce(((e,{amount:t})=>e+t),0n),[l,d]=a.useState(0),[c,u]=a.useState(!1),h=t[l];return a.useEffect((()=>{d(0)}),[t]),e.jsxs(tu,{children:[e.jsxs(ru,{children:[e.jsx(nu,{children:"Total"}),e.jsx(iu,{children:e.jsx(Sy,{quantities:[s,r],tokenPrice:i})})]}),n&&n.action&&e.jsxs(ru,{children:[e.jsx(nu,{children:"Action"}),e.jsx(iu,{children:n.action})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"Fees"}),e.jsx(iu,{children:e.jsx(Sy,{quantities:[r||0n],tokenPrice:i})})]}),t.length>1?e.jsxs(e.Fragment,{children:[e.jsx(ru,{children:e.jsxs(cf,{onClick:()=>u((e=>!e)),children:[e.jsx("span",{children:"Details"}),e.jsx(Tt.default,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:c?"rotate(180deg)":void 0}})]})}),c&&e.jsx(ru,{children:e.jsxs(af,{children:[e.jsxs(of,{children:[e.jsxs(sf,{children:[l+1," of ",t.length," instructions"]}),e.jsxs(df,{children:[l>0&&e.jsx(Mo,{backFn:()=>d((e=>e-1))}),l<t.length-1&&e.jsx(Oo,{nextFn:()=>d((e=>e+1))})]})]}),e.jsx(lf,{children:e.jsx(nf,{instruction:h,rpcEndpoint:o,solPrice:i})})]})})]}):e.jsx(nf,{instruction:h,rpcEndpoint:o,solPrice:i,hideAmount:!0})]})};function nf({instruction:t,rpcEndpoint:r,solPrice:n,hideAmount:i}){return t?e.jsxs(tu,{children:[!i&&e.jsxs(ru,{children:[e.jsx(nu,{children:"Amount"}),e.jsx(iu,{children:e.jsx(Sy,{quantities:[t.amount],tokenPrice:n})})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"To"}),e.jsx(iu,{children:e.jsx(Yy,{walletAddress:t.to,rpcEndpoint:r,network:"solana"})})]}),e.jsxs(ru,{children:[e.jsx(nu,{children:"From"}),e.jsx(iu,{children:e.jsx(Yy,{walletAddress:t.from,rpcEndpoint:r,network:"solana"})})]})]}):null}let af=E.styled.div`
2738
2738
  display: flex;
2739
2739
  flex-direction: column;
2740
2740
  width: 100%;
@@ -2745,45 +2745,45 @@
2745
2745
  border-color: var(--privy-color-foreground-4);
2746
2746
  border-radius: var(--privy-border-radius-md);
2747
2747
  }
2748
- `,af=E.styled.header`
2748
+ `,of=E.styled.header`
2749
2749
  display: flex;
2750
2750
  justify-content: space-between;
2751
2751
  align-items: center;
2752
2752
  padding: 12px;
2753
2753
  background-color: var(--privy-color-background-2);
2754
- `,of=E.styled.h4`
2754
+ `,sf=E.styled.h4`
2755
2755
  font-size: 14px;
2756
2756
  font-weight: 500;
2757
2757
  line-height: 19.6px;
2758
- `,sf=E.styled.div`
2759
- padding: 12px;
2760
2758
  `,lf=E.styled.div`
2759
+ padding: 12px;
2760
+ `,df=E.styled.div`
2761
2761
  display: flex;
2762
2762
  gap: 8px;
2763
2763
  align-items: center;
2764
- `,df=E.styled(nu)`
2764
+ `,cf=E.styled(nu)`
2765
2765
  cursor: pointer;
2766
2766
  display: inline-flex;
2767
2767
  gap: 8px;
2768
2768
  align-items: center;
2769
- `;const cf=({instructions:t,fees:r,onClose:n,receiptHeader:i,receiptDescription:a,transactionInfo:o,solPrice:s,rpcEndpoint:l})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:n}),e.jsx(qo,{style:{marginBottom:"16px"},children:e.jsxs("div",{children:[e.jsx(Io,{color:"var(--privy-color-success-light)"}),e.jsx(dt.default,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-success)"})]})}),e.jsx(tl,{title:i??"Transaction completed successfully.",description:a??""}),e.jsx(tf,{solPrice:s,instructions:t,fees:r,transactionInfo:o,rpcEndpoint:l}),e.jsx(zo,{}),e.jsx(uf,{loading:!1,onClick:n,children:"Close"}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});let uf=E.styled(bo)`
2769
+ `;const uf=({instructions:t,fees:r,onClose:n,receiptHeader:i,receiptDescription:a,transactionInfo:o,solPrice:s,rpcEndpoint:l})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:n}),e.jsx(qo,{style:{marginBottom:"16px"},children:e.jsxs("div",{children:[e.jsx(Io,{color:"var(--privy-color-success-light)"}),e.jsx(dt.default,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-success)"})]})}),e.jsx(tl,{title:i??"Transaction completed successfully.",description:a??""}),e.jsx(rf,{solPrice:s,instructions:t,fees:r,transactionInfo:o,rpcEndpoint:l}),e.jsx(zo,{}),e.jsx(hf,{loading:!1,onClick:n,children:"Close"}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});let hf=E.styled(bo)`
2770
2770
  && {
2771
2771
  margin-top: 24px;
2772
2772
  }
2773
2773
  transition: color 350ms ease, background-color 350ms ease;
2774
- `;async function hf({accessToken:e,rootWallet:t,transactingWallet:r,walletProxy:n,transactionRequest:i,provider:a,requesterAppId:o}){!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:d.CHAIN_ID_MAINNET},i));let s=(await n.rpc({address:t.address,hdWalletIndex:r.walletIndex??void 0,accessToken:e,requesterAppId:o,request:{method:"eth_signTransaction",params:[i]}})).response.data;return await a.sendTransaction(s)}async function pf(e,t,r,n){let i=await n.getBalance(e),a=t.value||0,o=!i.sub(c.i(a)).sub(r).isNegative();return{balance:i,hasSufficientFunds:o}}function yf(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 mf=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=ve.BigNumber.from(e.gasUsed),n=ve.BigNumber.from(e.effectiveGasPrice),i=r.mul(n);if(t){let e=ve.BigNumber.from(t);i=i.add(e)}return i.toString()}catch(e){return}};const ff=({txn:t,receipt:r,transactionInfo:n,onClose:i,tokenPrice:a,tokenSymbol:o,l1GasEstimate:s,receiptHeader:l,receiptDescription:d})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:i}),e.jsx(Qs,{title:l??"Transaction complete!",description:d??"You're all set."}),e.jsx(Zy,{tokenPrice:a,from:r.from,to:r.to,gas:mf(r,s),txn:t,transactionInfo:n,tokenSymbol:o}),e.jsx(zo,{}),e.jsx(gf,{loading:!1,onClick:i,children:"All Done"}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});let gf=E.styled(bo)`
2774
+ `;async function pf({accessToken:e,rootWallet:t,transactingWallet:r,walletProxy:n,transactionRequest:i,provider:a,requesterAppId:o}){!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:d.CHAIN_ID_MAINNET},i));let s=(await n.rpc({address:t.address,hdWalletIndex:r.walletIndex??void 0,accessToken:e,requesterAppId:o,request:{method:"eth_signTransaction",params:[i]}})).response.data;return await a.sendTransaction(s)}async function yf(e,t,r,n){let i=await n.getBalance(e),a=t.value||0,o=!i.sub(c.i(a)).sub(r).isNegative();return{balance:i,hasSufficientFunds:o}}function mf(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 ff=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=ve.BigNumber.from(e.gasUsed),n=ve.BigNumber.from(e.effectiveGasPrice),i=r.mul(n);if(t){let e=ve.BigNumber.from(t);i=i.add(e)}return i.toString()}catch(e){return}};const gf=({txn:t,receipt:r,transactionInfo:n,onClose:i,tokenPrice:a,tokenSymbol:o,l1GasEstimate:s,receiptHeader:l,receiptDescription:d})=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:i}),e.jsx(Qs,{title:l??"Transaction complete!",description:d??"You're all set."}),e.jsx(Xy,{tokenPrice:a,from:r.from,to:r.to,gas:ff(r,s),txn:t,transactionInfo:n,tokenSymbol:o}),e.jsx(zo,{}),e.jsx(vf,{loading:!1,onClick:i,children:"All Done"}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});let vf=E.styled(bo)`
2775
2775
  && {
2776
2776
  margin-top: 24px;
2777
2777
  }
2778
2778
  transition: color 350ms ease, background-color 350ms ease;
2779
- `;let vf=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],wf=e=>{try{return J.decodeFunctionData({abi:vf,data:e})}catch(e){return null}},xf=e=>{try{return J.decodeFunctionData({abi:cu,data:e})}catch(e){return null}};const Cf=(e,t,r)=>{let[n,i]=a.useState(null),{getAccessToken:o}=s.usePrivy(),{walletProxy:l}=s.usePrivyInternal();return a.useEffect((()=>{n&&i(null),(async()=>{if(!await o()||!l||!t)return null;let n=[],i=await or(t.address,e,r).catch((t=>(n.push(t),e))),{totalGasEstimate:a,l1ExecutionFeeEstimate:s}=await ir(i,r).catch((e=>(n.push(e),{totalGasEstimate:null,l1ExecutionFeeEstimate:null}))),{balance:d,hasSufficientFunds:c}=await pf(t.address,i,a??ve.BigNumber.from(0),r).catch((e=>(n.push(e),{balance:null,hasSufficientFunds:!1})));return{tx:i,totalGasEstimate:a,l1ExecutionFeeEstimate:s,balance:d,hasFunds:c,errors:n}})().then(i)}),[e]),n};let Ef=new f.PrivyProviderRpcError(new f.ProviderRpcError("There was an issue preparing your transaction",f.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode));const bf=E.styled.img`
2779
+ `;let wf=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],xf=e=>{try{return J.decodeFunctionData({abi:wf,data:e})}catch(e){return null}},Cf=e=>{try{return J.decodeFunctionData({abi:cu,data:e})}catch(e){return null}};const Ef=(e,t,r)=>{let[n,i]=a.useState(null),{getAccessToken:o}=s.usePrivy(),{walletProxy:l}=s.usePrivyInternal();return a.useEffect((()=>{n&&i(null),(async()=>{if(!await o()||!l||!t)return null;let n=[],i=await or(t.address,e,r).catch((t=>(n.push(t),e))),{totalGasEstimate:a,l1ExecutionFeeEstimate:s}=await ir(i,r).catch((e=>(n.push(e),{totalGasEstimate:null,l1ExecutionFeeEstimate:null}))),{balance:d,hasSufficientFunds:c}=await yf(t.address,i,a??ve.BigNumber.from(0),r).catch((e=>(n.push(e),{balance:null,hasSufficientFunds:!1})));return{tx:i,totalGasEstimate:a,l1ExecutionFeeEstimate:s,balance:d,hasFunds:c,errors:n}})().then(i)}),[e]),n};let bf=new f.PrivyProviderRpcError(new f.ProviderRpcError("There was an issue preparing your transaction",f.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode));const Sf=E.styled.img`
2780
2780
  && {
2781
2781
  height: ${e=>"sm"===e.size?"65px":"140px"};
2782
2782
  width: ${e=>"sm"===e.size?"65px":"140px"};
2783
2783
  border-radius: 16px;
2784
2784
  margin-bottom: 12px;
2785
2785
  }
2786
- `;let Sf=e=>{if(!p.isHexString(e))return e;try{return _e.toUtf8String(e)}catch{return e}},Af=e=>JSON.stringify(e,null,2),jf=({data:t})=>{let r=t=>"object"==typeof t&&null!==t?e.jsx(Pf,{children:Object.entries(t).map((([t,n])=>e.jsxs("li",{children:[e.jsxs("strong",{children:[t,":"]})," ",r(n)]},t)))}):e.jsx("span",{children:String(t)});return e.jsx("div",{children:r(t)})},$f=t=>{let{types:r,primaryType:n,...i}=t.typedData;return e.jsxs(e.Fragment,{children:[e.jsx(Tf,{children:e.jsx(jf,{data:i})}),e.jsx(yc,{text:Af(t.typedData),itemName:"full payload to clipboard"})," "]})};let Tf=E.styled.div`
2786
+ `;let Af=e=>{if(!p.isHexString(e))return e;try{return _e.toUtf8String(e)}catch{return e}},jf=e=>JSON.stringify(e,null,2),$f=({data:t})=>{let r=t=>"object"==typeof t&&null!==t?e.jsx(_f,{children:Object.entries(t).map((([t,n])=>e.jsxs("li",{children:[e.jsxs("strong",{children:[t,":"]})," ",r(n)]},t)))}):e.jsx("span",{children:String(t)});return e.jsx("div",{children:r(t)})},Tf=t=>{let{types:r,primaryType:n,...i}=t.typedData;return e.jsxs(e.Fragment,{children:[e.jsx(Pf,{children:e.jsx($f,{data:i})}),e.jsx(yc,{text:jf(t.typedData),itemName:"full payload to clipboard"})," "]})};let Pf=E.styled.div`
2787
2787
  margin-top: 1.5rem;
2788
2788
  background-color: var(--privy-color-background-2);
2789
2789
  border-radius: var(--privy-border-radius-md);
@@ -2802,7 +2802,7 @@
2802
2802
  display: none; /* Safari and Chrome */
2803
2803
  }
2804
2804
  }
2805
- `,Pf=E.styled.ul`
2805
+ `,_f=E.styled.ul`
2806
2806
  margin-left: 12px !important;
2807
2807
  white-space: nowrap;
2808
2808
 
@@ -2814,7 +2814,7 @@
2814
2814
  font-weight: 500 !important;
2815
2815
  }
2816
2816
  }
2817
- `,_f=E.styled.div`
2817
+ `,kf=E.styled.div`
2818
2818
  line-height: 20px;
2819
2819
  height: 20px;
2820
2820
  font-size: 13px;
@@ -2824,20 +2824,20 @@
2824
2824
  width: 100%;
2825
2825
  margin-top: 16px;
2826
2826
  margin-bottom: 4px;
2827
- `,kf=E.styled.span`
2827
+ `,Nf=E.styled.span`
2828
2828
  display: flex;
2829
2829
  align-items: center;
2830
2830
  gap: 8px;
2831
- `,Nf=E.styled.div`
2831
+ `,If=E.styled.div`
2832
2832
  display: flex;
2833
2833
  flex-direction: column;
2834
2834
  justify-content: center;
2835
2835
  align-items: center;
2836
2836
  width: 100%;
2837
2837
  height: 82px;
2838
- `,If=E.styled.div`
2838
+ `,Mf=E.styled.div`
2839
2839
  flex-grow: 1;
2840
- `;let Mf=E.styled.div`
2840
+ `;let Of=E.styled.div`
2841
2841
  display: flex;
2842
2842
  flex-direction: column;
2843
2843
  align-items: center;
@@ -2845,9 +2845,9 @@
2845
2845
  margin-left: 27px;
2846
2846
  margin-right: 27px;
2847
2847
  gap: 24px;
2848
- `;const Of=a.forwardRef(((t,r)=>{let[n,i]=a.useState(""),[o,l]=a.useState(!1),{authenticated:d,user:u}=s.usePrivy(),{initUpdateEmail:h}=s.usePrivyInternal(),{navigate:p,setModalData:y,currentScreen:m}=v.usePrivyModal(),{enabled:f,token:g}=xa(),w=c.validateEmail(n),x=o||!w,C=()=>{!f||g||d?(async e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");l(!0);try{await h(u.email.address,n,e),p(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){y({errorModalData:{error:e,previousScreen:m||v.ModalScreen.LANDING}})}l(!1)})(g):(y({captchaModalData:{callback:e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");return h(u.email.address,n,e)},userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),p(v.ModalScreen.CAPTCHA_SCREEN))};return e.jsxs(e.Fragment,{children:[e.jsx(Rf,{children:e.jsxs(Ff,{children:[e.jsx(Ve.default,{}),e.jsx("input",{ref:r,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>i(e.target.value),onKeyUp:e=>{"Enter"===e.key&&C()},value:n,autoComplete:"email"}),t.stacked?null:e.jsx(ko,{isSubmitting:o,onClick:C,disabled:x,children:"Submit"})]})}),t.stacked?e.jsx(bo,{loadingText:null,loading:o,disabled:x,onClick:C,children:"Submit"}):null]})}));let Rf=E.styled.div`
2848
+ `;const Rf=a.forwardRef(((t,r)=>{let[n,i]=a.useState(""),[o,l]=a.useState(!1),{authenticated:c,user:u}=s.usePrivy(),{initUpdateEmail:h}=s.usePrivyInternal(),{navigate:p,setModalData:y,currentScreen:m}=v.usePrivyModal(),{enabled:f,token:g}=xa(),w=d.validateEmail(n),x=o||!w,C=()=>{!f||g||c?(async e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");l(!0);try{await h(u.email.address,n,e),p(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){y({errorModalData:{error:e,previousScreen:m||v.ModalScreen.LANDING}})}l(!1)})(g):(y({captchaModalData:{callback:e=>{if(!u?.email)throw Error("User is required to have an email address to update it.");return h(u.email.address,n,e)},userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_PASSWORDLESS_CODE,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),p(v.ModalScreen.CAPTCHA_SCREEN))};return e.jsxs(e.Fragment,{children:[e.jsx(Ff,{children:e.jsxs(Lf,{children:[e.jsx(Ve.default,{}),e.jsx("input",{ref:r,id:"email-input",type:"email",placeholder:"your@email.com",onChange:e=>i(e.target.value),onKeyUp:e=>{"Enter"===e.key&&C()},value:n,autoComplete:"email"}),t.stacked?null:e.jsx(ko,{isSubmitting:o,onClick:C,disabled:x,children:"Submit"})]})}),t.stacked?e.jsx(bo,{loadingText:null,loading:o,disabled:x,onClick:C,children:"Submit"}):null]})}));let Ff=E.styled.div`
2849
2849
  width: 100%;
2850
- `,Ff=E.styled.label`
2850
+ `,Lf=E.styled.label`
2851
2851
  display: block;
2852
2852
  position: relative;
2853
2853
  width: 100%;
@@ -2905,7 +2905,7 @@
2905
2905
  && > input::placeholder {
2906
2906
  color: var(--privy-color-foreground-3);
2907
2907
  }
2908
- `;const Lf=({style:t,...r})=>e.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...t},...r,children:e.jsx("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});let Uf=E.styled.div`
2908
+ `;const Uf=({style:t,...r})=>e.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...t},...r,children:e.jsx("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});let Df=E.styled.div`
2909
2909
  display: flex;
2910
2910
  flex-direction: column;
2911
2911
  align-items: center;
@@ -2914,7 +2914,7 @@
2914
2914
  width: 100%;
2915
2915
  padding-top: 8px;
2916
2916
  padding-bottom: 32px;
2917
- `,Df=E.styled.div`
2917
+ `,Wf=E.styled.div`
2918
2918
  display: flex;
2919
2919
  align-items: center;
2920
2920
  justify-content: center;
@@ -2923,11 +2923,11 @@
2923
2923
  color: var(--privy-color-error);
2924
2924
  background-color: var(--privy-color-error-light);
2925
2925
  border-radius: 50%;
2926
- `,Wf=E.styled.div`
2926
+ `,Bf=E.styled.div`
2927
2927
  display: flex;
2928
2928
  flex-direction: column;
2929
2929
  gap: 8px;
2930
- `;const Bf=E.createGlobalStyle`
2930
+ `;const Hf=E.createGlobalStyle`
2931
2931
  :root {
2932
2932
  // Borders
2933
2933
  --privy-border-radius-sm: 6px;
@@ -2962,7 +2962,7 @@
2962
2962
  --privy-height-modal-full: 620px;
2963
2963
  --privy-height-modal-compact: 480px;
2964
2964
  };
2965
- `,Hf=E.styled.div`
2965
+ `,Gf=E.styled.div`
2966
2966
  // css normalize only the privy application to avoid conflicts
2967
2967
  // with consuming application
2968
2968
  ${"\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"}
@@ -3016,7 +3016,7 @@
3016
3016
  opacity: 1;
3017
3017
  }
3018
3018
  }
3019
- `,Gf=({children:t,open:r,onClick:n,...i})=>e.jsx(Q.Transition,{show:r,as:Ie.default.Fragment,children:e.jsxs(Q.Dialog,{onClose:n,...i,as:zf,children:[e.jsx(Q.Transition.Child,{as:Ie.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:e.jsx(qf,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),e.jsx(Vf,{children:e.jsx(Q.Transition.Child,{as:Ie.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:e.jsx(Q.Dialog.Panel,{as:Kf,children:t})})})]})});let qf=E.styled.div`
3019
+ `,qf=({children:t,open:r,onClick:n,...i})=>e.jsx(Q.Transition,{show:r,as:Ie.default.Fragment,children:e.jsxs(Q.Dialog,{onClose:n,...i,as:Vf,children:[e.jsx(Q.Transition.Child,{as:Ie.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:e.jsx(zf,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),e.jsx(Kf,{children:e.jsx(Q.Transition.Child,{as:Ie.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:e.jsx(Q.Dialog.Panel,{as:Yf,children:t})})})]})});let zf=E.styled.div`
3020
3020
  position: fixed;
3021
3021
  inset: 0;
3022
3022
 
@@ -3029,10 +3029,10 @@
3029
3029
  backdrop-filter: unset;
3030
3030
  -webkit-backdrop-filter: unset;
3031
3031
  }
3032
- `,zf=E.styled.div`
3032
+ `,Vf=E.styled.div`
3033
3033
  position: relative;
3034
3034
  z-index: 999999;
3035
- `,Vf=E.styled.div`
3035
+ `,Kf=E.styled.div`
3036
3036
  position: fixed;
3037
3037
  inset: 0;
3038
3038
  display: flex;
@@ -3040,7 +3040,7 @@
3040
3040
  justify-content: center;
3041
3041
  width: 100vw;
3042
3042
  min-height: 100vh;
3043
- `;const Kf=E.styled.div`
3043
+ `;const Yf=E.styled.div`
3044
3044
  // reset some default dialog styles
3045
3045
  padding: 0;
3046
3046
  background: transparent;
@@ -3087,13 +3087,13 @@
3087
3087
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3088
3088
  border-radius: var(--privy-border-radius-lg);
3089
3089
  }
3090
- `,Yf=E.styled.div`
3090
+ `,Zf=E.styled.div`
3091
3091
  display: flex;
3092
3092
  flex-direction: column;
3093
3093
  align-items: center;
3094
3094
  justify-content: center;
3095
3095
  height: 100%;
3096
- `;let Zf={[v.ModalScreen.LANDING]:()=>{let{app:t}=v.usePrivyModal();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?e.jsx(Op,{connectOnly:!1}):e.jsx(Up,{connectOnly:!1})},[v.ModalScreen.CONNECT_OR_CREATE]:()=>{let{app:t}=v.usePrivyModal();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?e.jsx(Op,{connectOnly:!0}):e.jsx(Up,{connectOnly:!0})},[v.ModalScreen.AWAITING_PASSWORDLESS_CODE]:()=>{let{app:t,navigate:r,lastScreen:n,navigateBack:i,setModalData:l,onUserCloseViaDialogOrKeybindRef:u}=v.usePrivyModal(),{closePrivyModal:p,resendEmailCode:y,resendSmsCode:m,getAuthMeta:f,loginWithCode:g,updateWallets:w,createAnalyticsEvent:x}=s.usePrivyInternal(),{authenticated:C,logout:E,user:b}=s.usePrivy(),[S,A]=a.useState(ll),[j,$]=a.useState(!1),[T,P]=a.useState(null),[_,k]=a.useState(null),[N,I]=a.useState(0);u.current=()=>null;let M=f()?.email?0:1,O=d.DEFAULT_SUCCESS_SCREEN_DURATION_MS-500;a.useEffect((()=>{if(N){let e=setTimeout((()=>{I(N-1)}),1e3);return()=>clearTimeout(e)}}),[N]),a.useEffect((()=>{if(C&&j&&b){if(t?.legal.requireUsersAcceptTerms&&!b.hasAcceptedTerms){let e=setTimeout((()=>{r(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),O);return()=>clearTimeout(e)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(b,t?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),E()},callAuthOnSuccessOnClose:!0}}),r(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),O);return()=>clearTimeout(e)}{w();let e=setTimeout((()=>p({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}}}),[C,j,b]),a.useEffect((()=>{if(T&&0===_){let e=setTimeout((()=>{A(ll),P(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[T]);let R=e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return P("Code should be numeric"),void k(1);P(null),k(null);let i=Number(e.currentTarget.name?.charAt(5)),a=[...t||[""]].slice(0,6-i),o=[...S.slice(0,i),...a,...S.slice(i+a.length)];A(o);let d=Math.min(Math.max(i+a.length,0),5);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${d}]`);e?.focus()}if(o.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${d}]`);e?.blur(),g(o.join("")).then((()=>$(!0))).catch((e=>{if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.INVALID_CREDENTIALS)P("Invalid or expired verification code");else if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)P(e.message);else{if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),void r(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.USER_DOES_NOT_EXIST)return void r(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.LINKED_TO_ANOTHER_USER)return l({errorModalData:{error:e,previousScreen:n??v.ModalScreen.AWAITING_PASSWORDLESS_CODE}}),void r(v.ModalScreen.ERROR_SCREEN,!1);if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return l({accountTransfer:{nonce:e.data?.data?.nonce,account:0===M?f()?.email:f()?.phoneNumber,displayName:e.data?.data?.account?.displayName,linkMethod:0===M?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void r(v.ModalScreen.LINK_CONFLICT_SCREEN);P("Issue verifying code")}k(0)}))}},F=0==M?e.jsx(Ve.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),L=0==M?e.jsxs("p",{children:["Please check ",e.jsx(ml,{children:f()?.email})," for an email from privy.io and enter your code below."]}):e.jsxs("p",{children:["Please check ",e.jsx(ml,{children:f()?.phoneNumber})," for a message from ",t?.name||"Privy"," and enter your code below."]});return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:()=>i()},"header"),e.jsxs(dl,{children:[e.jsx(tl,{title:"Enter confirmation code",description:L,icon:F}),e.jsxs(Bs,{children:[e.jsxs(cl,{children:[e.jsx(ul,{$fail:!!T,$success:j,children:e.jsx("span",{children:T||(j?"Success!":"")})}),e.jsx("div",{children:S.map(((t,r)=>e.jsx("input",{name:`code-${r}`,type:"text",value:S[r],onChange:R,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(1===_&&(P(null),k(null)),A([...S.slice(0,e),"",...S.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:`${j?"success":""} ${T?"fail":""}`,autoComplete:o.isMobile?"one-time-code":"off"},r)))})]}),e.jsxs(hl,{children:[e.jsxs("span",{children:["Didn't get ",0==M?"an email":"a message","?"]}),N?e.jsxs(yl,{children:[e.jsx(ze.default,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),e.jsx("span",{children:"Code sent"})]}):e.jsx(pl,{children:e.jsx("button",{onClick:async()=>{I(30),0==M?await y():await m()},children:"Resend code"})})]})]})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.AWAITING_CONNECTION]:()=>{let t,[r,n]=a.useState(!1),[i,l]=a.useState(!1),[u,p]=a.useState(void 0),{authenticated:y,logout:m}=s.usePrivy(),{app:g,navigate:w,navigateBack:x,lastScreen:C,currentScreen:E,setModalData:b,data:S}=v.usePrivyModal(),{getAuthFlow:A,walletConnectionStatus:j,closePrivyModal:$,initLoginWithWallet:T,loginWithWallet:P,updateWallets:_,createAnalyticsEvent:k}=s.usePrivyInternal(),{walletConnectors:N}=s.usePrivy(),[I,M]=a.useState(0),{user:O}=s.usePrivy(),[R]=a.useState(O?.linkedAccounts.length||0),[F,L]=a.useState(""),[U,D]=a.useState(""),[W,B]=a.useState(!1),{hasTabbedAway:H}=function(){let[e,t]=a.useState(!1),r=a.useCallback((()=>{document.hidden&&t(!0)}),[]);return a.useEffect((()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r))),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:G,token:q}=xa(),z=o.isMobile&&"wallet_connect_v2"===j?.connector?.connectorType||o.isMobile&&"coinbase_wallet"===j?.connector?.connectorType||o.isMobile&&"injected"===j?.connector?.connectorType&&"phantom"===j?.connector?.walletClientType,V="connected"===j?.status,K="switching_to_supported_chain"===j?.status;a.useEffect((()=>{let e=A(),t=e instanceof pa||e instanceof ya?e:void 0;V&&!t&&(!G||q||y?T(j.connectedWallet,q,S?.login?.disableSignup).then((()=>{B(!0)})):(b({captchaModalData:{callback:e=>T(j.connectedWallet,e,S?.login?.disableSignup).then((()=>{B(!0)})),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_CONNECTION,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),w(v.ModalScreen.CAPTCHA_SCREEN,!1))),t&&z&&V&&!t.preparedMessage?t.buildMessage():t&&!z&&V&&(i||(async()=>{l(!0),p(void 0);try{"wallet_connect_v2"===j?.connector?.connectorType&&"metamask"===j?.connector?.walletClientType&&await c.sleep(2500),await Z()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{l(!1)}})())}),[I,V,W]),a.useEffect((()=>{if(O&&r){let e=d.DEFAULT_SUCCESS_SCREEN_DURATION_MS-500;if(g?.legal.requireUsersAcceptTerms&&!O.hasAcceptedTerms){let t=setTimeout((()=>{w(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),e);return()=>clearTimeout(t)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(O,g?.embeddedWallets?.createOnLogin)){let t=setTimeout((()=>{b({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),k({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),m()},callAuthOnSuccessOnClose:!0}}),w(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),e);return()=>clearTimeout(t)}_();let t=setTimeout((()=>$({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(t)}}),[O,r]);let Y=e=>{if(e?.privyErrorCode!==s.PrivyErrorCode.ALLOWLIST_REJECTED){if(e?.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),void w(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode!==s.PrivyErrorCode.USER_DOES_NOT_EXIST)return e?.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(b({accountTransfer:{nonce:e.data?.data?.nonce,account:A()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:A()?.meta.walletClientType,chainId:A()?.meta.chainId,connectorType:A()?.meta.connectorType},linkMethod:"siwe",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void w(v.ModalScreen.LINK_CONFLICT_SCREEN)):void p(Ml(e));w(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN)}else w(v.ModalScreen.ALLOWLIST_REJECTION_SCREEN)};async function Z(){try{await P(),n(!0)}catch(e){Y(e)}finally{l(!1)}}a.useEffect((()=>{j?.connectError&&Y(j?.connectError)}),[j]),((e,t)=>{let r=a.useRef((()=>{}));a.useEffect((()=>{r.current=e})),a.useEffect((()=>{if(null!==t){let e=setInterval((()=>r.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===X&&j?.connector instanceof Ja?j.connector.redirectUri:void 0;e&&L(e);let t="wallet_connect_v2"===X&&j?.connector instanceof Ja?j.connector.fallbackUniversalRedirectUri:void 0;t&&D(t)}),j?.connector instanceof Ja&&!F?500:null);let X=j?.connector?.connectorType||"injected",J=j?.connector?.walletClientType||"unknown",Q=xl[J]?.displayName||j?.connector?.walletBranding.name||"Browser Extension",ee=xl[J]?.logo||j?.connector?.walletBranding.icon||(t=>e.jsx(Da,{...t})),te="Browser Extension"===Q?Q.toLowerCase():Q;t=r?`Successfully connected with ${te}`:u?u.message:K?"Switching networks":V?i&&z?"Signing":"Sign to verify":`Waiting for ${te}`;let re="Don’t see your wallet? Check your other browser windows.";r?re=R===(O?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":I>=2&&u?re="Unable to connect wallet":u?re=u.detail:K?re="Switch your wallet to the requested network.":V&&z?re="Sign the message in your wallet to verify it belongs to you.":"metamask"===J&&o.isMobile?re="Click continue to open and connect MetaMask.":"metamask"===J?re="For the best experience, connect only one wallet at a time.":"wallet_connect"===X?re="Open your mobile wallet app to continue":"coinbase_wallet"!==X||c.isCoinbaseWalletInstalled()||(re=Qa(O)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue.");let ne=N?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),ie="coinbase_wallet"===J&&(Qa(O)||u===f.ConnectorErrors.ERROR_USER_EXISTS);return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:C&&E!==C?x:void 0}),e.jsxs(Ol,{children:[e.jsx(Fl,{walletLogo:ee,success:r,fail:!!u}),e.jsxs(zs,{children:[e.jsx("h3",{children:t}),e.jsx("p",{children:re}),V||!F||H?null:e.jsxs("p",{children:["Still here?"," ",e.jsx("a",{href:F,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),U&&e.jsxs(e.Fragment,{children:[" ","or"," ",e.jsx("a",{href:U,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]})]}),ie?e.jsx(bo,{onClick:()=>ne&&ne?.disconnect(),disabled:r,children:"Use a different wallet"}):u==f.ConnectorErrors.ERROR_USER_EXISTS&&E!==C?e.jsx(bo,{onClick:x,children:"Use a different wallet"}):V&&!r&&z?e.jsx(bo,{onClick:()=>{l(!0),Z()},disabled:i,children:i?"Signing":"Sign with your wallet"}):!r&&u?.retryable&&I<2?e.jsx(bo,{onClick:()=>{M(I+1),p(void 0),V?(l(!0),Z()):j?.connectRetry()},disabled:!r&&(!u?.retryable||I>=2),children:"Retry"}):r||u?null:e.jsx(bo,{onClick:()=>{},disabled:!0,children:"Connecting"})]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION]:()=>{let t,{navigateBack:r,navigate:n,lastScreen:i,currentScreen:l,data:u,setModalData:h}=v.usePrivyModal(),{walletConnectionStatus:p,closePrivyModal:y}=s.usePrivyInternal(),[m,g]=a.useState(void 0),[w,x]=a.useState(0),C="connected"===p?.status,E="switching_to_supported_chain"===p?.status;a.useEffect((()=>{if(C){let e;if(u?.externalConnectWallet?.onCompleteNavigateTo){let t=u.externalConnectWallet.onCompleteNavigateTo;e=setTimeout((()=>{if(u.funding){let e=p.connectedWallet?.address;h({funding:{...u.funding,connectedWalletAddress:e}})}n(t)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}else e=setTimeout(y,d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}}),[C]);a.useEffect((()=>{p?.connectError&&(e=>{g(Ml(e))})(p?.connectError)}),[p]);let b=p?.connector?.connectorType||"injected",S=p?.connector?.walletClientType||"unknown",A=xl[S]?.displayName||p?.connector?.walletBranding.name||"Browser Extension",j=xl[S]?.logo||p?.connector?.walletBranding.icon||(t=>e.jsx(Da,{...t})),$="Browser Extension"===A?A.toLowerCase():A;t=C?`Successfully connected with ${$}`:m?m.message:E?"Switching networks":`Waiting for ${$}`;let T="Don’t see your wallet? Check your other browser windows.";return C?T="You’re good to go!":w>=2&&m?T="Unable to connect wallet":m?T=m.detail:E?T="Switch your wallet to the requested network.":"metamask"===S&&o.isMobile?T="Click to continue to open and connect MetaMask.":"metamask"===S?T="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===b?T="Open your mobile wallet app to continue":"coinbase_wallet"===b&&(T="Open the Coinbase app on your phone to continue."),e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:l===i?void 0:r}),e.jsxs(Ll,{children:[e.jsx(Fl,{walletLogo:j,success:C,fail:!!m}),e.jsxs(zs,{children:[e.jsx("h3",{children:t}),e.jsx("p",{children:T})]}),m==f.ConnectorErrors.ERROR_USER_EXISTS?e.jsx(bo,{onClick:r,children:"Use a different wallet"}):!C&&m?.retryable&&w<2?e.jsx(bo,{onClick:()=>{x(w+1),g(void 0),p?.connectRetry()},disabled:!C&&(!m?.retryable||w>=2),children:"Retry"}):!C&&m&&w>=2?e.jsx(bo,{onClick:r,children:"Use a different wallet"}):null]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.AWAITING_FARCASTER_CONNECTION]:()=>{let{authenticated:t,logout:r,ready:n,user:i}=s.usePrivy(),{lastScreen:l,navigate:u,navigateBack:p,setModalData:y,app:m}=v.usePrivyModal(),{getAuthFlow:f,loginWithFarcaster:g,closePrivyModal:w,createAnalyticsEvent:x}=s.usePrivyInternal(),[C,E]=a.useState(void 0),[b,S]=a.useState(!1),[A,j]=a.useState(!1),$=a.useRef([]),T=f(),P=T?.meta.connectUri;return a.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{let r=await T.pollForReady.execute(),n=Date.now()-e;if(r){clearInterval(t),S(!0);try{await g(),j(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===s.PrivyErrorCode.ALLOWLIST_REJECTED)return void u(v.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),void u(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_DOES_NOT_EXIST)return void u(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.LINKED_TO_ANOTHER_USER)t.detail="This account has already been linked to another user.";else{if(e?.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return y({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 u(v.ModalScreen.LINK_CONFLICT_SCREEN);e?.privyErrorCode===s.PrivyErrorCode.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}E(t)}}else n>12e4&&(clearInterval(t),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),$.current.forEach((e=>clearTimeout(e)))}}),[]),a.useEffect((()=>{if(n&&t&&A&&i){if(m?.legal.requireUsersAcceptTerms&&!i.hasAcceptedTerms){let e=setTimeout((()=>{u(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}A&&(h.shouldProceedtoEmbeddedWalletCreationFlow(i,m?.embeddedWallets.createOnLogin)?$.current.push(setTimeout((()=>{y({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),u(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)):$.current.push(setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)))}}),[A,n,t,i]),o.isMobile||b?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:l?p:void 0,onClose:w},"header"),e.jsx(Ks,{}),o.isIOS?e.jsx(e.Fragment,{children:e.jsxs(_c,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:A,fail:!!C}),e.jsx($c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx(vs,{children:C?C.message:"Sign in with Farcaster"}),e.jsx(ws,{children:C?C.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),P&&e.jsx(bo,{onClick:e=>{e.preventDefault(),window.location.href=P},children:"Open Warpcast app"})]})}):e.jsx(e.Fragment,{children:e.jsxs(Pc,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:A,fail:!!C}),e.jsx($c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx(vs,{children:C?C.message:"Signing in with Farcaster"}),e.jsx(ws,{children:C?C.detail:"This should only take a moment"}),e.jsx(Ws,{children:P&&o.isMobile&&e.jsx(fc,{text:"Take me to Warpcast",url:P,color:Tc})})]})]})}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:l?p:void 0,onClose:w},"header"),e.jsx(Ks,{}),e.jsx(Pc,{children:e.jsxs("div",{children:[e.jsx(vs,{children:"Sign in with Farcaster"}),e.jsx(ws,{children:"Scan with your phone's camera to continue."}),e.jsx(Hs,{children:P?e.jsx(jc,{url:P,size:275,squareLogoElement:$c}):e.jsx(vo,{})}),e.jsxs(Ws,{children:[e.jsx(ws,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),P&&e.jsx(yc,{text:P,itemName:"link",color:Tc})]})]})}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.AWAITING_FARCASTER_SIGNER]:()=>{let{lastScreen:t,navigateBack:r,data:n,app:i}=v.usePrivyModal(),{requestFarcasterSignerStatus:l,closePrivyModal:u}=s.usePrivyInternal(),[h,p]=a.useState(void 0),[y,m]=a.useState(!1),[f,g]=a.useState(!1),w=a.useRef([]),x=n?.farcasterSigner;a.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{if(!x?.public_key)return clearInterval(t),void p({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===x.status&&(clearInterval(t),m(!1),g(!0),w.current.push(setTimeout((()=>u({shouldCallAuthOnSuccess:!1,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)));let r=await l(x?.public_key),n=Date.now()-e;"approved"===r.status?(clearInterval(t),m(!1),g(!0),w.current.push(setTimeout((()=>u({shouldCallAuthOnSuccess:!1,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS))):n>3e5?(clearInterval(t),p({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):"revoked"===r.status&&(clearInterval(t),p({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"===x?.status?x.signer_approval_url:void 0;return o.isMobile||y?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t?r:void 0,onClose:u},"header"),e.jsx(Ks,{}),o.isIOS?e.jsx(e.Fragment,{children:e.jsxs(Ic,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:f,fail:!!h}),e.jsx($c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx(vs,{children:h?h.message:"Add a signer to Farcaster"}),e.jsx(ws,{children:h?h.detail:"This will allow "+i.name+" to add casts, likes, follows, and more on your behalf."})]}),C&&e.jsx(bo,{onClick:e=>{e.preventDefault(),window.location.href=C},children:"Open Warpcast app"})]})}):e.jsx(e.Fragment,{children:e.jsxs(Nc,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:f,fail:!!h}),e.jsx($c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx(vs,{children:h?h.message:"Requesting signer from Farcaster"}),e.jsx(ws,{children:h?h.detail:"This should only take a moment"}),e.jsx(Ws,{children:C&&o.isMobile&&e.jsx(fc,{text:"Take me to Warpcast",url:C,color:kc})})]})]})}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t?r:void 0,onClose:u},"header"),e.jsx(Ks,{}),e.jsx(Nc,{children:e.jsxs("div",{children:[e.jsx(vs,{children:"Add a signer to Farcaster"}),e.jsxs(ws,{children:["This will allow ",i.name," to add casts, likes, follows, and more on your behalf."]}),e.jsx(Hs,{children:"pending_approval"===x?.status?e.jsx(jc,{url:x.signer_approval_url,size:275,squareLogoElement:$c}):e.jsx(vo,{})}),e.jsxs(Ws,{children:[e.jsx(ws,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),"pending_approval"===x?.status&&e.jsx(yc,{text:x.signer_approval_url,itemName:"link",color:kc})]})]})}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE]:()=>{let{lastScreen:t,currentScreen:r,navigateBack:n}=v.usePrivyModal(),{loginWithPasskey:i,closePrivyModal:o}=s.usePrivyInternal(),[l,u]=a.useState("loading"),[h,p]=a.useState(null),y=a.useRef([]);a.useEffect((()=>()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]}),[]);let m=async()=>{u("loading");try{await i(),u("success")}catch(e){p(e),u("error")}};return a.useEffect((()=>{"success"===l&&(e=>{y.current=[e,...y.current]})(setTimeout((()=>{o({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS))}),[l]),a.useEffect((()=>{m()}),[]),e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t&&r!==t?n:void 0}),e.jsxs(am,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:"success"===l,fail:"error"===l}),e.jsx(Tu,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx("h3",{children:(()=>{switch(l){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})()}),e.jsx("p",{style:{whiteSpace:"pre-wrap"},children:(()=>{switch(l){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.PrivyError){if(h.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(h.privyErrorCode===s.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()})]}),(()=>{switch(l){case"loading":case"success":return e.jsx(bo,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return e.jsx(bo,{onClick:m,disabled:!1,children:"Retry"})}})()]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.PHANTOM_INTERSTITIAL_SCREEN]:()=>{let{forkSession:t,ready:r,authenticated:n}=s.usePrivy(),{walletConnectionStatus:i}=s.usePrivyInternal(),[l,d]=a.useState(""),[u,h]=a.useState(!1);a.useEffect((()=>{r&&n&&t().then(d)}),[r,n]);let p=((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(!c.isPhantomInstalled()&&o.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${n}?ref=${n}`})(l,!u,"solana"===i?.connector?.chainType),y={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return r&&(y.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",y.footnote="Once you're done, you can always return here and refresh to view your updated account."),u&&(y.title="Still here?",y.description="You may need to install the Phantom mobile app.",y.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(el,{title:y.title,description:y.description}),e.jsxs(Ds,{children:[e.jsx(om,{children:e.jsx(Ba,{style:{width:"72px",height:"72px"}})}),e.jsx(jo,{href:p,onClick:()=>{setTimeout((()=>h(!0)),1e3)},loading:r&&!p,children:u?"Go to App Store":"Continue"}),y.footnote?e.jsx("p",{children:y.footnote}):null]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.LOGIN_FAILED_SCREEN]:()=>{let{closePrivyModal:t}=s.usePrivyInternal(),{navigate:r}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(qp,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),e.jsx(el,{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.jsxs(Ds,{children:[e.jsx(bo,{onClick:()=>r(v.ModalScreen.LANDING),children:"Try again"}),e.jsx(To,{onClick:()=>t(),children:"Cancel"})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.AWAITING_OAUTH_SCREEN]:()=>{let{authenticated:t,logout:r,ready:n,user:i}=s.usePrivy(),{app:o,setModalData:l,navigate:u,resetNavigation:p}=v.usePrivyModal(),{getAuthMeta:y,initLoginWithOAuth:m,loginWithOAuth:f,updateWallets:g,setReadyToTrue:w,closePrivyModal:x,createAnalyticsEvent:C}=s.usePrivyInternal(),[E,b]=a.useState(!1),[S,A]=a.useState(void 0),j=y()?.provider||"google",{name:$,component:T}=la(j),P=h.useEmitPrivyEvent();a.useEffect((()=>{f(j).then((e=>{b(!0),w(!0),e&&P("login","onOAuthLoginComplete",e)})).catch((e=>{if(w(!1),e?.privyErrorCode===s.PrivyErrorCode.ALLOWLIST_REJECTED)return A(void 0),p(),void u(v.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),A(void 0),p(),void u(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_DOES_NOT_EXIST)return A(void 0),p(),void u(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return A(void 0),p(),l({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:y()?.provider,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void u(v.ModalScreen.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=function(e,t){let r={detail:"",retryable:!1},n=Zi(t);if(e?.privyErrorCode===s.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode===s.PrivyErrorCode.INVALID_CREDENTIALS&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode===s.PrivyErrorCode.OAUTH_USER_DENIED&&(r.detail=`Retry and check ${n} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let e=la(t).name;r.detail=`Request limit reached for ${e}. Please wait a moment and try again.`}if(e?.privyErrorCode===s.PrivyErrorCode.OAUTH_ACCOUNT_SUSPENDED){let e=la(t).name;r.detail=`Your ${e} account is suspended. Please try another login method.`}return e?.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode===s.PrivyErrorCode.OAUTH_UNEXPECTED&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}(e,j);A({retryable:t,detail:r,message:"Authentication failed"})})).finally((()=>{ca()}))}),[$,j]),a.useEffect((()=>{if(n&&t&&E&&i){if(o?.legal.requireUsersAcceptTerms&&!i.hasAcceptedTerms){let e=setTimeout((()=>{u(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(i,o?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:j,screen:"OAuthStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),u(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}{let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return g(),()=>clearTimeout(e)}}}),[n,t,E,i]);let _=E?`Successfully connected with ${$}`:S?S.message:`Verifying connection to ${$}`,k="";return k=E?"You’re good to go!":S?S.detail:"Just a few moments more",e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsx(Ks,{}),e.jsxs(im,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:E,fail:!!S}),e.jsx(T,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx("h3",{children:_}),e.jsx("p",{children:k})]}),S&&S?.retryable?e.jsx(_o,{onClick:()=>{ca(),m(j),A(void 0)},disabled:!E&&!S?.retryable,children:"Retry"}):null]}),e.jsx(Ys,{}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.CROSS_APP_AUTH_SCREEN]:()=>{let t=d.useAppConfig(),{data:r,navigate:n,setModalData:i,onUserCloseViaDialogOrKeybindRef:o}=v.usePrivyModal(),{crossAppAuthFlow:l,updateWallets:u,closePrivyModal:p,createAnalyticsEvent:y}=s.usePrivyInternal(),{logout:m}=c.useLogout(),[f,g]=a.useState({}),w=r?.crossAppAuth,x={id:w.appId,name:w.name,logoUrl:w.logoUrl},C=new s.PrivyClientError(`There was an issue connecting your ${x.name} account. Please try again.`),E=new Wi((async e=>{if(w.popup)try{let t=await l({appId:e,popup:w.popup,action:w.action});g({data:t})}catch(e){e instanceof s.PrivyClientError?g({error:e}):(e instanceof s.PrivyApiError&&w.popup&&w.popup.close(),g({error:C}))}else g({error:C})})),b=()=>{f.data&&(u(),w.onSuccess(f.data),p({shouldCallAuthOnSuccess:!0,isSuccess:!0})),w.onError(f.error??new s.PrivyClientError("User canceled flow")),p({shouldCallAuthOnSuccess:!1,isSuccess:!1})};o.current=b,a.useEffect((()=>{x.id.length&&E.execute(x.id)}),[x.id]),a.useEffect((()=>{if(!f.data)return;let e=f.data;if(t.legal.requireUsersAcceptTerms&&!e.hasAcceptedTerms){let e=setTimeout((()=>{n(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(e,t.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{i({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${x.id}`,screen:"CrossAppAuthScreen"}}),m()},callAuthOnSuccessOnClose:!0}}),n(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}let r=setTimeout(b,d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(r)}),[f.data]);let{title:S,subtitle:A}=a.useMemo((()=>f.data?{title:`Successfully connected with ${x.name}`,subtitle:"You're good to go!"}:f.error?{title:"Authentication failed",subtitle:f.error.message}:{title:`Connecting to ${x.name}`,subtitle:`Please check the pop-up from ${x.name} to continue`}),[f,x.name]);return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:b}),e.jsx(Ks,{}),e.jsxs(Dl,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:!!f.data,fail:!!f.error}),e.jsx(Ul,{name:x.name,logoUrl:x.logoUrl})]})}),e.jsxs(zs,{children:[e.jsx("h3",{children:S}),e.jsx("p",{children:A})]})]}),e.jsx(Ys,{}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.ALLOWLIST_REJECTION_SCREEN]:()=>{let{navigate:t,app:r}=v.usePrivyModal(),n=r?.allowlistConfig.errorTitle||"You don't have access to this app",i=r?.allowlistConfig.errorDetail||"Have you been invited?",a=r?.allowlistConfig.errorCtaText||"Try another account";return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsxs(Ls,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(ns,{}),e.jsx(Fs,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),e.jsxs(Us,{children:["string"==typeof n?e.jsx("h3",{children:n}):e.jsx(e.Fragment,{children:n}),"string"==typeof i?e.jsx("p",{children:i}):e.jsx(e.Fragment,{children:i})]}),r?.allowlistConfig.errorCtaLink?e.jsx(bo,{as:"a",href:r.allowlistConfig.errorCtaLink,children:a}):e.jsx(bo,{onClick:()=>{t(v.ModalScreen.LANDING)},children:a})]})]})},[v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN]:()=>{let{navigate:t,app:r}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsxs(ts,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(Io,{color:"var(--privy-color-warn-light)"}),e.jsx(Le.default,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),e.jsxs(rs,{children:[e.jsx("h3",{children:"Account not found"}),e.jsxs("p",{children:["Please try logging in again or go to ",r.name," to create an account."]})]}),e.jsx(zo,{}),e.jsx(bo,{onClick:()=>t(v.ModalScreen.LANDING),children:"Try logging in again"})]})]})},[v.ModalScreen.USER_LIMIT_REACHED_SCREEN]:()=>{let{navigate:t}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsxs(Uf,{children:[e.jsx(Df,{children:e.jsx(Lf,{})}),e.jsxs(Wf,{children:[e.jsx("h3",{children:"Unable to sign in"}),e.jsx("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),e.jsx(bo,{onClick:()=>{t(v.ModalScreen.LANDING)},children:"Go back"})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.INSTALL_PHANTOM_SCREEN]:()=>{let{navigateBack:t}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t},"header"),e.jsx(Ks,{}),e.jsx(cp,{}),e.jsx(Ys,{}),e.jsxs(c.ModalFooter,{children:[e.jsx("span",{children:"Still not sure? "}),e.jsx("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},[v.ModalScreen.LINK_EMAIL_SCREEN]:()=>{let{app:t}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(tl,{title:"Connect your email",description:`Add your email to your ${t?.name} account`,icon:e.jsx(Ve.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Ds,{children:e.jsx(gp,{stacked:!0})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.LINK_PHONE_SCREEN]:()=>{let{app:t,currentScreen:r,data:n,navigate:i,setModalData:a}=v.usePrivyModal(),{initLoginWithSms:o}=s.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(tl,{title:"Connect your phone",description:`Add your number to your ${t?.name} account`,icon:e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),e.jsx(Ds,{children:e.jsx(Sp,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{await o(e),i(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){a({errorModalData:{error:e,previousScreen:n?.errorModalData?.previousScreen||r||v.ModalScreen.LINK_PHONE_SCREEN}}),i(v.ModalScreen.ERROR_SCREEN)}},hideRecent:!0})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.LINK_WALLET_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?e.jsxs("span",{children:["Link the wallet with address ",e.jsx(c.Address,{showCopyIcon:!1,address:n})," ",t?.name?`to ${t.name}.`:"."]}):`Link a wallet to your ${t?.name} account`;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(el,{title:"Link your wallet",description:i}),e.jsx(Ko,{children:e.jsx(Nl,{connectOnly:!1})}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.LINK_PASSKEY_SCREEN]:()=>{let{user:t,unlinkPasskey:r}=s.usePrivy(),{linkWithPasskey:n,closePrivyModal:i}=s.usePrivyInternal(),o=t?.linkedAccounts.filter((e=>"passkey"===e.type)),[l,d]=a.useState(!1),[u,h]=a.useState(""),[p,y]=a.useState(!1),[m,f]=a.useState(!1);a.useEffect((()=>{0===o.length&&f(!1)}),[o.length]);let g=async e=>(d(!0),await r(e).then((()=>y(!0))).catch((e=>{e instanceof s.PrivyError&&e.privyErrorCode===s.PrivyErrorCode.MISSING_MFA_CREDENTIALS?h("Cannot unlink a passkey enrolled in MFA"):h("Unknown error occurred.")})).finally((()=>{d(!1)})));return p?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:()=>i()},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(dt.default,{})}),e.jsx(Ru,{style:{marginBottom:"1.5rem"},children:"Passkeys updated"}),e.jsx(Fu,{children:" "}),e.jsx(Ss,{children:e.jsx(bo,{onClick:()=>i(),children:"Done"})}),e.jsx(c.ModalFooter,{})]}):m?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:()=>f(!1),onClose:()=>i()},"header"),e.jsx(Pu,{passkeys:o,expanded:m,onUnlink:g,onExpand:()=>f(!0)}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:()=>i()},"header"),e.jsx(gs,{children:e.jsxs(ku,{children:[e.jsx($u,{}),e.jsx(Tu,{})]})}),e.jsx(Ru,{children:"Secure your account with a passkey"}),e.jsx(Lu,{}),0===o.length?e.jsx(_u,{}):e.jsx(Pu,{passkeys:o,expanded:m,onUnlink:g,onExpand:()=>f(!0)}),e.jsxs(Ss,{style:{marginTop:"12px"},children:[u&&e.jsx(Nu,{$fail:!0,children:u}),e.jsx(bo,{onClick:()=>{d(!0),n().then((()=>y(!0))).catch((e=>{if(e instanceof s.PrivyError){if(e.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return void h("Cannot link more passkeys to account.");if(e.privyErrorCode===s.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return void h("Passkey request timed out or rejected by user.")}h("Unknown error occurred.")})).finally((()=>{d(!1)}))},loading:l,children:"Add new passkey"})]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.UPDATE_EMAIL_SCREEN]:()=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(tl,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:e.jsx(Ve.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Ds,{children:e.jsx(Of,{stacked:!0})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]}),[v.ModalScreen.UPDATE_PHONE_SCREEN]:()=>{let{currentScreen:t,data:r,navigate:n,setModalData:i}=v.usePrivyModal(),{user:a}=s.usePrivy(),{initUpdatePhone:o}=s.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(tl,{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:e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Ds,{children:e.jsx(Sp,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{if(!a?.phone?.number)throw Error("User is required to have an phone number to update it.");await o(a?.phone?.number,e),n(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){i({errorModalData:{error:e,previousScreen:r?.errorModalData?.previousScreen||t||v.ModalScreen.LINK_PHONE_SCREEN}}),n(v.ModalScreen.ERROR_SCREEN)}},hideRecent:!0})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.CONNECT_ONLY_LANDING_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?e.jsxs("span",{children:["Connect the wallet with address ",e.jsx(c.Address,{showCopyIcon:!1,address:n})," ",t?.name?`to ${t.name}.`:"."]}):`Connect a wallet to your ${t?.name} account`;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Qs,{title:"Connect your wallet",description:i}),e.jsx(Ko,{children:e.jsx(Nl,{connectOnly:!0})}),t&&e.jsx(c.TermsAndConditions,{app:t,alwaysShowImplicitConsent:!0}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.CONNECT_ONLY_AUTHENTICATED_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?`Connect the wallet with address ${c.formatWalletAddress(n)} ${t?.name?`to ${t.name}.`:"."}`:`Connect a wallet to ${t?.name}`;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(el,{title:"Connect your wallet",description:i}),e.jsx(Ko,{children:e.jsx(Nl,{connectOnly:!0})}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN]:()=>{let{app:t,setModalData:r,navigate:n,data:i,onUserCloseViaDialogOrKeybindRef:o}=v.usePrivyModal(),[l,c]=a.useState(""),{embeddedWallets:u}=d.useAppConfig(),{authenticated:h,user:p}=s.usePrivy(),{closePrivyModal:y}=s.usePrivyInternal(),{onSuccess:m,onFailure:f,callAuthOnSuccessOnClose:g}=i.createWallet,w=!0===t?.embeddedWallets.requireUserOwnedRecoveryOnCreate,{createWallet:x}=vd(),[C,E]=a.useState(null),b=new Wi((async()=>{try{let e=await x({user:p});if(!e)return;E(e),n(v.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN)}catch(e){c(e.message)}}));return a.useEffect((()=>h&&p?w?(r({...i,recoverySelection:{...i?.recoverySelection,isInAccountCreateFlow:!0}}),n(ad({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:u.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void b.execute():(n(v.ModalScreen.LANDING),void f(Error("User must be authenticated before creating a Privy wallet")))),[w,h]),o.current=()=>null,l?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{closeable:!1}),e.jsxs(Gs,{children:[e.jsx(Ze.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(tl,{title:"Something went wrong",description:l})]}),e.jsx(bo,{onClick:()=>{C?(m(C),y({shouldCallAuthOnSuccess:g})):(f(new s.PrivyEmbeddedWalletError("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))},children:"Close"}),e.jsx(wd,{})]}):e.jsx(Gl,{})},[v.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN]:()=>{let{user:t}=s.usePrivy(),{closePrivyModal:r,isNewUserThisSession:n,updateWallets:i}=s.usePrivyInternal(),{app:o,data:l,onUserCloseViaDialogOrKeybindRef:u}=v.usePrivyModal(),{onSuccess:p,onFailure:y,callAuthOnSuccessOnClose:m}=l.createWallet,f=()=>{let e=h.getPrivyEthereumWallet(t);e?(i(),p(e)):y(Error("Failed to create wallet")),r({shouldCallAuthOnSuccess:m})};return a.useEffect((()=>{let e=setTimeout(f,d.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS);return()=>clearTimeout(e)}),[]),u.current=f,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:f}),e.jsx(Ks,{}),e.jsxs(Gs,{children:[e.jsx(Ye.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),e.jsx(tl,{title:n?"Welcome"+(o?.name?` to ${o?.name}`:""):"All set!",description:n?"You’ve successfully created an account.":"Your account is secured."})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN]:()=>{let{authenticated:t,user:r,getAccessToken:n}=s.usePrivy(),{closePrivyModal:i,createAnalyticsEvent:o,walletProxy:l}=s.usePrivyInternal(),{navigate:d,data:c,setModalData:u,onUserCloseViaDialogOrKeybindRef:p}=v.usePrivyModal(),y=a.useMemo((()=>Date.now()),[]),[m,f]=a.useState(!1),{onCompleteNavigateTo:g,onFailure:w,shouldForceMFA:x,address:C}=c?.connectWallet,E=e=>{m||(f(!0),w("string"==typeof e?Error(e):e))};a.useEffect((()=>{let e,a=C?r?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.address===C)):h.getPrivyEthereumWallet(r);return t&&a?l?((async()=>{let t=await n();if(!t)return E("User must be authenticated and have a Privy wallet before it can be connected");let r="ethereum"===a.chainType;try{r?await l.connect({accessToken:t,address:a.address}):await l.connectSolana({accessToken:t,publicKey:a.address}),x&&await l.verifyMfa({accessToken:t});let n=(Date.now()-y)/1e3;g===v.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN&&n<1?e=setTimeout((()=>{d(g,!1)}),1e3*(1-n)):d(g,!1)}catch(e){if(Jl(e)&&"privy"===a.recoveryMethod){let e=await n();if(!e)return E("User must be authenticated and have a Privy wallet before it can be recovered");try{if(o({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:a.address}}),r){let t=await(l?.recover({address:a.address,accessToken:e,recoveryMethod:a.recoveryMethod}));t?.address||E(Error("Unable to recover wallet"))}else{let t=await(l?.recoverSolana({publicKey:a.address,accessToken:e}));t?.publicKey||E(Error("Unable to recover wallet"))}g?d(g):i({shouldCallAuthOnSuccess:!1}),o({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:a.address}}),d(g)}catch(e){E("An error has occurred, please try again.")}}else Jl(e)&&"privy"!==a.recoveryMethod?(u({...c,recoverWallet:{privyWallet:a,onCompleteNavigateTo:g,onFailure:w},recoveryOAuthStatus:{provider:a.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}}),d(od(a.recoveryMethod))):E(e)}})(),()=>clearTimeout(e)):void 0:E("User must be authenticated and have a Privy wallet before it can be connected")}),[t,r,l]);let b=()=>{E("User exited before wallet could be connected"),i({shouldCallAuthOnSuccess:!1})};return p.current=b,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:b}),m?e.jsxs(e.Fragment,{children:[e.jsxs(Gs,{children:[e.jsx(Ze.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(tl,{title:"Something went wrong",description:"We’re on it. Please try again later."})]}),e.jsx(bo,{onClick:()=>i({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):e.jsx(Gl,{}),e.jsx(dd,{})]})},[v.ModalScreen.EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN]:()=>{let[t,r]=a.useState(!0),{authenticated:n,getAccessToken:i}=s.usePrivy(),{walletProxy:o,closePrivyModal:l,createAnalyticsEvent:d}=s.usePrivyInternal(),{navigate:u,data:h,onUserCloseViaDialogOrKeybindRef:p}=v.usePrivyModal(),[y,m]=a.useState(void 0),[f,g]=a.useState(""),[w,x]=a.useState(!1),{privyWallet:C,onCompleteNavigateTo:E,onSuccess:b,onFailure:S}=h.recoverWallet,A=(e="User exited before their wallet could be recovered")=>{l({shouldCallAuthOnSuccess:!1}),S("string"==typeof e?new s.PrivyEmbeddedWalletError(e):e)};p.current=A,a.useEffect((()=>{if(!n||!C)return A("User must be authenticated and have a Privy wallet before it can be recovered")}),[n]);return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A}),e.jsx(Ks,{}),e.jsxs(lm,{children:[e.jsxs(sm,{children:[e.jsx(xt.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),e.jsxs("div",{children:[e.jsxs($d,{children:[e.jsx(Ad,{type:t?"password":"text",onChange:e=>(e=>{e&&m(e)})(e.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),e.jsx(Nd,{style:{right:"0.75rem"},children:t?e.jsx(Md,{onClick:()=>r(!1)}):e.jsx(Od,{onClick:()=>r(!0)})})]}),!!f&&e.jsx(dm,{children:f})]}),e.jsxs("div",{children:[e.jsxs(Vs,{children:[e.jsx("h4",{children:"Why is this necessary?"}),e.jsx("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),e.jsx(cm,{loading:w||!o,disabled:!y,onClick:async()=>{x(!0);let e=await i();if(!e||!C||null===y)return A("User must be authenticated and have a Privy wallet before it can be recovered");try{d({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:C.address}}),await(o?.recover({address:C.address,accessToken:e,recoveryPin:y,recoveryMethod:C.recoveryMethod})),g(""),E?u(E):l({shouldCallAuthOnSuccess:!1}),b?.(C),d({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:C.address}})}catch(e){!function(e){return Xl(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?g("An error has occurred, please try again."):g("Invalid recovery password, please try again.")}finally{x(!1)}},warn:!1,hideAnimations:!C&&w,children:"Recover your account"})]})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN]:()=>{let[t,r]=a.useState(!1),{navigate:n,lastScreen:i,navigateBack:o,setModalData:l,data:u,onUserCloseViaDialogOrKeybindRef:p}=v.usePrivyModal(),{user:y}=s.usePrivy(),{embeddedWallets:m}=d.useAppConfig(),{closePrivyModal:f}=s.usePrivyInternal(),g=h.getPrivyEthereumWallet(y),w=null===g,{isInAccountCreateFlow:x,isResettingPassword:C}=u.recoverySelection,E=g&&"privy"!==g.recoveryMethod,b=E?e.jsxs("span",{children:["Your account is currently secured using"," ",e.jsx("strong",{children:gm[g?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function S(e){l({recoveryOAuthStatus:{provider:e,action:w?"create-wallet":"set-recovery",isInAccountCreateFlow:x}}),n(v.ModalScreen.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN)}function A(){u?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),f({shouldCallAuthOnSuccess:u?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return p.current=A,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A,backFn:t?()=>r(!1):i?o:void 0,infoFn:i||t?void 0:()=>r(!0)},"header"),t?e.jsx(vm,{onClose:()=>r(!1)}):e.jsxs(e.Fragment,{children:[e.jsx(tl,{title:E?"Update backup method":"Secure your account",icon:e.jsx(_t.default,{width:48}),description:b}),e.jsx(pm,{children:m.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(g?.recoveryMethod||"")||e!==g?.recoveryMethod)).sort().map((t=>{switch(t){case"google-drive":return e.jsxs(Jo,{onClick:()=>S("google-drive"),children:[e.jsx(fm,{children:e.jsx(hm,{style:{width:18}})}),"Back up to Google Drive"]},t);case"icloud":return e.jsxs(Jo,{onClick:()=>S("icloud"),children:[e.jsx(fm,{children:e.jsx(um,{style:{width:24}})}),"Back up to Apple iCloud"]},t);case"user-passcode":return e.jsxs(Jo,{onClick:()=>{n(id({isCreatingWallet:w,skipSplashScreen:!0}))},children:[e.jsx(fm,{children:e.jsx(kt.default,{style:{width:18}})}),C?"Reset your":"Set a"," password"]},t);default:return null}}))})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN]:()=>{let{user:t,getAccessToken:r}=s.usePrivy(),n=h.getPrivyEthereumWallet(t),{walletProxy:i,refreshUser:o,closePrivyModal:l}=s.usePrivyInternal(),u=v.usePrivyModal(),[p,y]=a.useState(!1),[m,f]=a.useState(null),[g,w]=a.useState(null);function x(){if(!p){if(g)return u.data?.setWalletPassword?.onFailure(g),void l();if(!m)return u.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void l()}}u.onUserCloseViaDialogOrKeybindRef.current=x;let C=!(!p&&!m);return g?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:x},"header"),e.jsx(wm,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:e.jsx(Be.default,{height:38,width:38,stroke:"var(--privy-color-error)"})}),e.jsx(pd,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),e.jsx(zo,{style:{minHeight:"2rem"}}),e.jsx(So,{onClick:()=>w(null),children:"Try again"}),e.jsx(c.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:x},"header"),e.jsx(_t.default,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),e.jsx(pd,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),e.jsx(hd,{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."}),e.jsx(zo,{style:{minHeight:"2rem"}}),e.jsx(So,{loading:p,disabled:C,onClick:()=>async function(){y(!0);try{let e=await r();if(!e||!i||!n)return;if(!(await i.setRecovery({recoveryMethod:"privy",address:n.address,accessToken:e})).address)throw Error("Unable to set recovery on wallet");let t=await o();if(!t)throw Error("Unable to set recovery on wallet");let a=h.getPrivyEthereumWallet(t);if(!a)throw Error("Unabled to set recovery on wallet");f(!!t),setTimeout((()=>{u.data?.setWalletPassword?.onSuccess(a),l()}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}catch(e){w(e)}finally{y(!1)}}(),children:m?"Success":"Confirm"}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN]:()=>{let{logout:t}=s.usePrivy(),{navigate:r,setModalData:n,data:i}=v.usePrivyModal(),{recoveryOAuthFlow:o,closePrivyModal:l,createAnalyticsEvent:u}=s.usePrivyInternal(),[h,p]=a.useState(!1),{provider:y,action:m,isInAccountCreateFlow:f}=i?.recoveryOAuthStatus,[g,w]=a.useState(void 0),[x,C]=a.useState("create-wallet"===m);if("user-passcode"===y)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let E=mm[y].name,b=mm[y].component,S=i?.recoverWallet?.onCompleteNavigateTo,A=new Wi((async(e="create-wallet")=>(C(!0),new Promise(((t,r)=>{setTimeout((async()=>{try{let r=window.open();await o(y,e,r),p(!0),t()}catch(t){w({message:`${"recover"===e?"Recovery":"Back up"} with ${E} unsuccessful`,detail:"recover"===m?`Please verify that you are selecting the ${E} account associated with your backup.`:"",retryable:!0}),r()}}),0)})))));a.useEffect((()=>{"recover"!==m&&A.execute(f?"create-wallet":"set-recovery")}),[]),a.useEffect((()=>{if(!h)return;let e=setTimeout((()=>{f?(n({createWallet:{onSuccess:()=>{},onFailure:e=>{u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),r(v.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN)):l({shouldCallAuthOnSuccess:!1})}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}),[h]);let j=a.useCallback((async()=>{await A.execute("recover"),S?r(S):p(!0)}),[]),$="google-drive"===y?"Google Drive":"Apple iCloud",T=h&&`Successfully ${"recover"===m?"recovered":"backed up"} with ${$}.`||g&&g.message||`${"recover"===m?"Recovering":"Backing up"} with ${$}...`,P=g?g.detail:"";return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),x?e.jsx(e.Fragment,{children:e.jsxs(pm,{children:[e.jsx(tl,{title:T,icon:e.jsx(b,{style:{width:"38px",height:"38px"}}),description:P}),g&&g?.retryable?e.jsx(bo,{onClick:()=>{ca(),w(void 0),"create-wallet"===m?A.execute("create-wallet"):j()},disabled:!h&&!g?.retryable,children:"Try again"}):null]})}):e.jsxs(pm,{children:[e.jsx(tl,{title:"Confirm it's really you",icon:e.jsx(b,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${$} where your account is backed up.`}),e.jsxs(bo,{onClick:j,children:["Confirm with ",$]})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN]:()=>{let[t,r]=a.useState(null),{authenticated:n,user:i,getAccessToken:o}=s.usePrivy(),{closePrivyModal:l,createAnalyticsEvent:u,clientAnalyticsId:h}=s.usePrivyInternal(),p=d.useAppConfig(),{data:y,onUserCloseViaDialogOrKeybindRef:m}=v.usePrivyModal(),{onFailure:f,onSuccess:g,origin:w,appId:x,appClientId:C,wallet:E}=y.keyExport,b=e=>{l({shouldCallAuthOnSuccess:!1}),f("string"==typeof e?Error(e):e)},S=()=>{l({shouldCallAuthOnSuccess:!1}),g(),u({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:E.address}})};return a.useEffect((()=>{if(!n||!E)return b("User must be authenticated before exporting their wallet");o().then(r,b)}),[n,i]),m.current=S,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:S}),e.jsxs(md,{children:[e.jsx(pd,{children:"Transfer wallet"}),e.jsxs(hd,{children:["Either copy your private key or seed phrase to transfer your wallet."," ",e.jsx("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),e.jsx(cd,{theme:p.appearance.palette.colorScheme,children:"Never share your private key or seed phrase with anyone."}),e.jsx(c.WalletInfoCard,{isLoading:!1,isPulsing:!1,title:"Your wallet",address:E.address,showIcon:!0}),e.jsx("div",{style:{width:"100%"},children:t&&e.jsx(yd,{origin:w,appId:x,appClientId:C,accessToken:t,clientAnalyticsId:h,wallet:E,dimensions:{height:"44px"}})})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN]:()=>{let{authenticated:t}=s.usePrivy(),{initializeWalletProxy:r,closePrivyModal:n}=s.usePrivyInternal(),{navigate:i,data:o,onUserCloseViaDialogOrKeybindRef:l}=v.usePrivyModal(),[u,h]=a.useState(!0),[p,y]=a.useState(""),[m,g]=a.useState(),[w,x]=a.useState(null),[C,E]=a.useState(!1),b=null!==w;a.useEffect((()=>{t||i(v.ModalScreen.LANDING)}),[t]),a.useEffect((()=>{r(d.WALLET_PROXY_TIMEOUT).then((e=>{h(!1),e||(y("An error has occurred, please try again."),g(new f.PrivyProviderRpcError(new f.ProviderRpcError(p,f.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:S,data:A,confirmAndSign:j,onSuccess:$,onFailure:T,uiOptions:P}=o.signMessage,_={title:P.title||"Sign message",description:P.description||"Signing this message will not cost you any fees.",buttonText:P.buttonText||"Sign and continue"},k=e=>{e?$(e):T(m||new f.PrivyProviderRpcError(new f.ProviderRpcError("The user rejected the request.",f.E.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{x(null),y(""),g(void 0)}),200)};return l.current=()=>{k(w)},e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:()=>k(w)}),e.jsx(Ks,{}),P.iconUrl&&"string"==typeof P.iconUrl?e.jsx(Nf,{children:e.jsx(bf,{size:"sm",src:P.iconUrl,alt:"app image"})}):null,e.jsx(pd,{children:_.title}),e.jsx(hd,{children:_.description}),"personal_sign"===S&&e.jsx(Tf,{children:Sf(A)}),"eth_signTypedData_v4"===S&&e.jsx($f,{typedData:A}),"solana_signMessage"===S&&e.jsx(Tf,{children:A}),e.jsx(If,{}),e.jsx(_f,{$fail:!0,children:p}),e.jsx(So,{disabled:C||b||u,loading:C,onClick:async()=>{E(!0),y("");try{let e=await j();x(e),E(!1),setTimeout((()=>{k(e)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}catch(e){console.error(e),y("An error has occurred, please try again."),g(new f.PrivyProviderRpcError(new f.ProviderRpcError(p,f.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),E(!1)}},children:C?"Signing...":b?e.jsxs(kf,{children:[e.jsx(pc,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",e.jsx("span",{children:"Success"})]}):_.buttonText}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN]:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:i}=v.usePrivyModal(),{rpcConfig:o,chains:l,closePrivyModal:u,walletProxy:h}=s.usePrivyInternal(),{getAccessToken:p,user:y}=s.usePrivy(),m=d.useAppConfig(),[g,w]=a.useState(0),x=(e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(t),[C,E]=a.useState(((e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0)(t,g)),[b,S]=a.useState(null),[A,j]=a.useState(),[$,T]=a.useState(!1),[P,_]=a.useState(null),[k,N]=a.useState(null);if(!C||!t?.sendTransaction||!t?.sendTransaction.transactingWallet)return e.jsx(cc,{error:Error("Invalid transaction request"),onClick:()=>{t?.sendTransaction?.onFailure(Ef),u({shouldCallAuthOnSuccess:!1})}});let I=t.sendTransaction.rootWallet,M=t.sendTransaction.transactingWallet,O=a.useMemo((()=>l.find((e=>Number(e.id)===Number(C.chainId)))),[C.chainId]),R=O?.nativeCurrency.symbol??"ETH",{action:F,amount:L,spender:U,isErc20Ish:D}=a.useMemo((()=>(e=>{let t=wf(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=xf(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}})(C.data)),[C.data]);a.useEffect((()=>{C.to&&O&&D&&xh({address:C.to,chain:O,rpcConfig:m.rpcConfig,privyAppId:m.id}).then(S).catch(console.error)}),[C.to,O]);let{tokenPrice:W,isTokenPriceLoading:B}=Wc(C.chainId),H=a.useMemo((()=>c.getJsonRpcProvider(Number(C.chainId),l,o,{appId:m.id})),[C.chainId,o]),G=Cf(C,M,H);a.useEffect((()=>{t.sendTransaction?.getIsSponsored?t.sendTransaction.getIsSponsored().then(j).catch(console.error):j(!1)}),[t.sendTransaction.getIsSponsored]);let q=()=>{if(!$)return P?t?.sendTransaction?.onSuccess(P.response):k||G?.errors[0]?t?.sendTransaction?.onFailure(k??G?.errors[0]??Ef):t?.sendTransaction?.onFailure(new f.PrivyProviderRpcError(new f.ProviderRpcError("The user rejected the request",f.E.E4001_USER_REJECTED_REQUEST.eipCode))),u({shouldCallAuthOnSuccess:!1})};r.current=q;let z=!!(m.fundingConfig&&m.fundingConfig.methods.length>0&&t.funding),V="fiat-currency"===m.embeddedWallets.priceDisplay.primary,K=c.i(G?.tx.value??0).add(c.i(G?.totalGasEstimate?.toBigInt()??0)).toHexString(),Y=c.getNativeCurrencyFromWei(K,R),Z=V&&W?c.getDollarsFromWei(K,W):void 0,X=c.getNativeCurrencyFromWei(G?.totalGasEstimate?.toString()??0,R),J=V&&W?c.getDollarsFromWei(G?.totalGasEstimate?.toString()??0,W):void 0,Q=c.getNativeCurrencyFromWei(G?.balance?.toString()??0,R,void 0,!0),ee=V&&W?c.getDollarsFromWei(G?.balance?.toString()??0,W):void 0,te=t.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===F?"Confirm address":`Approve ${F}`),re=t.sendTransaction?.uiOptions?.description||`${m.name} wants your permission to approve the following transaction.`,ne=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,ie=!(!G||G.errors[0]||G.hasFunds||!1!==A),ae=ie&&z,oe=ae?"Add funds":t.sendTransaction?.uiOptions?.buttonText||(g<x?"Continue":"Approve");if(P?.receipt)return e.jsx(ff,{txn:G?.tx??C,onClose:q,receipt:P.receipt,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,tokenPrice:W,tokenSymbol:R,l1GasEstimate:G?.l1ExecutionFeeEstimate?.toString(),receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription});if(k)return e.jsx(Dm,{transactionError:k,network:"ethereum",chainId:G?.tx.chainId??C.chainId,onClose:q,onRetry:({resetNonce:e})=>{N(null);let t={...G?.tx??C};e&&(t.nonce=void 0),E(t)}});let se=0!==x&&"number"==typeof g&&0!==g?()=>{w(g-1)}:void 0;return e.jsx(km,{transactionIndex:g,onBack:se,maxIndex:x,disabled:ie&&!z,isSubmitting:$,submitError:k,isPreparing:!G,isTokenPriceLoading:B,isTokenContractInfoLoading:!b,prepareError:G?.errors[0],symbol:b?.symbol,chain:O,img:ne,title:te,subtitle:re,spender:U,total:C.value?Z??Y:void 0,txValue:C.value,fee:J??X,isSponsored:A,to:C.to,network:m.chains.find((e=>e.id===C.chainId))?.name??"",from:M?.address??"",cta:oe,missingFunds:ie,action:F,balance:ee??Q,amount:L&&b?uu({amount:L,decimals:b.decimals}):L,onClose:q,onClick:ae?async()=>{if(!M)return;if(!z)throw Error("Funding wallet is not enabled");let e=Pm({fundingMethods:m.fundingConfig.methods});n({...t,funding:{...t.funding,methodScreen:e}}),i(e)}:async()=>{if(g<x)w(g+1);else{T(!0);try{let e=await p();if($||!e||!M||!h||!y)return;let r=t?.sendTransaction?.onConfirm?await t.sendTransaction.onConfirm().then((e=>H.getTransaction(e))):await hf({accessToken:e,transactingWallet:M,rootWallet:I,walletProxy:h,transactionRequest:G?.tx??C,provider:H,requesterAppId:t.sendTransaction?.requesterAppId}),n=await r.wait();_({receipt:yf(n),response:r})}catch(e){console.warn({transaction:G?.tx??C,error:e}),N(e)}finally{T(!1)}}}})},[v.ModalScreen.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN]:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:i}=v.usePrivyModal(),{closePrivyModal:o,walletProxy:l}=s.usePrivyInternal(),c=d.useAppConfig(),{user:u}=s.usePrivy(),[h,p]=a.useState(t?.sendSolanaTransaction?.transactionRequest),[y,m]=a.useState(),[f,g]=a.useState(),[w,x]=a.useState(0),[C,E]=a.useState(!1),[b,S]=a.useState(),[A,j]=a.useState(null),$=t?.sendSolanaTransaction?.connection,T=t?.sendSolanaTransaction?.transactingWallet,P=y?.instructions.at(w),_=y?.instructions.length??1,k=Hc($?.rpcEndpoint||"");if(a.useEffect((()=>{!async function(){if(h&&$)try{g(void 0);let e=await eu(h,$);m(e),x(0)}catch(e){console.warn("Failed to prepare transaction",e),g(e)}}()}),[h,$]),!(h&&t?.sendSolanaTransaction&&T&&$)){let r=Error("Invalid transaction request");return e.jsx(cc,{error:r,onClick:()=>{t?.sendSolanaTransaction?.onFailure(r),o({shouldCallAuthOnSuccess:!1})}})}let{solPrice:N,isSolPriceLoading:I}=Dc(),M=()=>{if(!C)return b?t?.sendSolanaTransaction?.onSuccess(b):(t?.sendSolanaTransaction?.onFailure(A??f??Error("User exited the modal before submitting the transaction")),x(0)),o({shouldCallAuthOnSuccess:!1})};r.current=M;let O="fiat-currency"===c.embeddedWallets.priceDisplay.primary,R=t.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===P?.action?"Confirm address":"Approve transaction"),F=t.sendTransaction?.uiOptions?.description||`${c.name} wants your permission to approve the following transaction.`,L=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,U=P?.amount||0n,D=0===w&&y?.fees||0n,W=P?.balance||0n,B=P?.from,H=P?.to,G=U+D,q=Vc(G),z=O&&N?Kc(G,N):void 0,V=D?Vc(D):void 0,K=O&&N?Kc(D,N):void 0,Y=W?Vc(W):void 0,Z=O&&N?Kc(W,N):void 0,X=!f&&!P?.hasFunds,J=!!(c.fundingConfig&&c.fundingConfig.methods.length>0&&t.funding),Q=X&&J,ee=Q?"Add funds":t.sendTransaction?.uiOptions?.buttonText||"Approve";return b?e.jsx(cf,{instructions:y?.instructions.map((({from:e,to:t,amount:r})=>({from:e.toBase58(),to:t.toBase58(),amount:r})))??[],fees:0===w?b.fees:0n,onClose:M,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,solPrice:N,receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription,rpcEndpoint:$.rpcEndpoint}):A?e.jsx(Dm,{transactionError:A,connection:$,onClose:M,network:"solana",onRetry:async()=>{j(null);let{blockhash:e}=await $.getLatestBlockhash();je.isVersionedTransaction(h)?h.message.recentBlockhash=e:h.recentBlockhash=e,p(h)}}):e.jsx(km,{isSubmitting:C,submitError:A,isPreparing:!y,isTokenPriceLoading:I,isTokenContractInfoLoading:!1,symbol:"SOL",chain:void 0,img:L,title:R,subtitle:F,from:B?.toBase58()||"",to:H?.toBase58(),fee:K??V,total:null!=U?z??q:void 0,txValue:U,spender:P?.spender?.toBase58(),network:k,cta:ee,missingFunds:X,action:P?.action,balance:Z??Y,prepareError:f,chainName:"Solana",onClose:M,onClick:Q?async()=>{if(!T)return;if(!J)throw Error("Funding wallet is not enabled");let e=Pm({fundingMethods:c.fundingConfig.methods});n({...t,funding:{...t.funding,methodScreen:e}}),i(e)}:async()=>{if(w<(y?.instructions.length??1)-1)x(w+1);else try{E(!0);let e=await Ag();if(C||!e||!T||!l||!u)return;let{signature:r,receipt:n}=await Cm({tx:h,accessToken:e,connection:$,walletProxy:l,transactingWalletAddress:T.address,transactionOptions:t.sendSolanaTransaction?.transactionOptions});S(Qc(r,n))}catch(e){console.warn({transaction:h,error:e}),j(e)}finally{E(!1)}},isSponsored:!1,transactionIndex:w,maxIndex:_-1,disabled:X&&!J,onBack:w>0&&_>1?()=>x(w-1):void 0})},[v.ModalScreen.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),{closePrivyModal:n}=s.usePrivyInternal(),[i,o]=a.useState(!1),[l,u]=a.useState(),h=async()=>{i?r?.delegatedActions?.onSuccess():r?.delegatedActions?.onError(l??new s.PrivyClientError("User declined delegating actions.")),n({shouldCallAuthOnSuccess:!1})};return a.useEffect((()=>{if(!i&&!l)return;let e=setTimeout(h,d.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS);return()=>clearTimeout(e)}),[i,l]),i||l?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:h}),e.jsx(Ks,{}),e.jsxs(Bs,{children:[l?e.jsx(P.ExclamationCircleIcon,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):e.jsx(P.CheckCircleIcon,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(Xs,{height:20}),e.jsx(tl,{title:l?"Something went wrong":"Success!",description:l?"Please try again.":"You've successfully delegated actions."})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{closeable:!0,onClose:h}),e.jsx(Wl,{width:56,height:56,style:{margin:"auto"}}),e.jsx(vs,{style:{marginTop:24},children:"Enable delegated actions"}),e.jsxs(ws,{children:["Give ",t.name," permissions to transact on your behalf. You can revoke this later."," ",e.jsx("a",{style:{color:"var(--privy-color-accent-dark)"},href:"https://www.privy.io/using-privy",target:"_blank",children:"Learn more"})]}),e.jsx(Hl,{showIcon:!0,address:r?.delegatedActions?.address??"",title:"Wallet",isLoading:!1}),e.jsxs(Bl,{style:{marginTop:24},children:[e.jsx(To,{onClick:h,children:"No thanks"}),e.jsx(bo,{onClick:async()=>{try{await(r?.delegatedActions?.onDelegate()),o(!0)}catch(e){u(e)}},children:"Accept"})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN]:()=>{let{wallets:r}=d.useWallets(),{wallets:n}=f.useSolanaWallets(),{navigate:i,data:o,setModalData:s}=v.usePrivyModal(),l=d.useAppConfig(),u=o?.funding,h=a.useRef(null),[p,y]=a.useState(!1);a.useEffect((()=>{h.current&&h.current.style.setProperty("--funding-input-length",Math.max(u.amount.length,1).toString())}),[u.amount,h.current]);let m=l.fundingConfig?.methods.slice()??[],g="solana"===u.chainType,w=g?void 0:u,{tokenPrice:x}=Wc(g?"solana":u.chain.id);a.useEffect((()=>{w?.erc20Address&&!w.erc20ContractInfo&&xh({address:w.erc20Address,chain:w.chain,rpcConfig:l.rpcConfig,privyAppId:l.id}).then((e=>s({...o,funding:{...w,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}}))).catch(console.error)}),[w?.erc20Address,w?.chain]);let C=x?c.getDollarsFromStringFloat(u.amount,x):void 0,E=g?n.find((({address:e})=>e===u.address)):r.find((({address:e})=>t.getAddress(e)===t.getAddress(u.address))),b=E&&"privy"!==E.walletClientType?Cl(E.walletClientType,E.connectorType,E.walletClientType):l.name,S=parseFloat(u.amount),A=!isNaN(S)&&S>0,j=!(!w?.erc20Address||w?.erc20ContractInfo),$=u.isUSDC?"USDC":w?.erc20Address?void 0:"native-currency",T=!!g||$&&((e,t)=>{switch(t){case"native-currency":return bh.has(e);case"USDC":return Sh.has(e);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}})(Number(u.chain.id),$),P=!!g||$&&((e,t)=>{switch(t){case"native-currency":return ch.has(e);case"USDC":return uh.has(e);default:return console.warn("Unknown asset passed to Coinbase Onramp"),!1}})(Number(u.chain.id),$),_=!!g||u.erc20Address||!u.erc20Address&&!u.isUSDC,k=g?"SOL":u.erc20Address?u.erc20ContractInfo?.symbol:u.chain.nativeCurrency.symbol||"ETH";return e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsxs("h3",{children:["Add funds to your"," ",b?.toLowerCase().endsWith("wallet")?b:b+" wallet"]}),e.jsx(qs,{style:{marginTop:"32px"},children:e.jsx(Vu,{children:j?e.jsx(Oc,{size:"50px"}):e.jsxs(e.Fragment,{children:[e.jsxs(Ku,{onClick:()=>h.current?.focus(),children:[e.jsx(Zu,{ref:h,value:u.amount,onFocus:()=>y(!0),onBlur:()=>y(!1),onChange:e=>{let t=e.target.value;/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1&&s({...o,funding:{...u,amount:t}})}}),e.jsx(Ju,{children:k}),!p&&e.jsx(Xu,{children:e.jsx(mt.default,{width:12,height:12})})]}),!w?.erc20Address&&e.jsx(Qu,{children:C&&A?C:""})]})})}),e.jsxs(qu,{children:[u.errorMessage&&e.jsx(vh,{children:u.errorMessage}),m.sort().map((t=>{switch(t){case"moonpay":return T?e.jsxs(Jo,{disabled:!A||j,onClick:()=>{i(v.ModalScreen.MOONPAY_PROMPT_SCREEN)},children:[e.jsx(zu,{children:e.jsx(Ph,{style:{width:24}})}),"Moonpay"]},t):null;case"coinbase-onramp":return P?e.jsxs(Jo,{disabled:!A||j,onClick:()=>{i(v.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN)},children:[e.jsx(zu,{children:e.jsx(Sa,{style:{width:24}})}),"Coinbase Onramp"]},t):null;case"external":return _?e.jsxs(Jo,{disabled:!A||j,onClick:()=>{i(v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN)},children:[e.jsx(zu,{children:e.jsx(He.default,{style:{width:24}})}),"Transfer from wallet"]},t):null}})),e.jsx(th,{disabled:!A,onClick:()=>i(v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN),children:"Send funds manually"})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.MOONPAY_PROMPT_SCREEN]:()=>{let{app:t,data:r,navigate:n,setModalData:i}=v.usePrivyModal(),{createAnalyticsEvent:o,getMoonpaySignedUrl:l}=s.usePrivyInternal(),[u,h]=a.useState(null),p=r?.funding,y=p.isUSDC?"USDC":"native-currency";return a.useEffect((()=>{!u&&p&&async function(){let e="ethereum"===p.chainType?p.moonpayConfigOverride?.currencyCode??function(e,t){switch(e){case d.arbitrum.id:return"native-currency"===t?"ETH_ARBITRUM":"USDC_ARBITRUM";case 43114:return"AVAX_CCHAIN";case d.base.id:return"native-currency"===t?"ETH_BASE":"USDC_BASE";case d.celo.id:return"CELO_CELO";case d.polygon.id:return"native-currency"===t?"MATIC_POLYGON":"USDC_POLYGON";case d.mainnet.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"}}(p.chain.id,y):"SOL",{signedUrl:n,externalTransactionId:a}=await l(p.address,{...t.fundingMethodConfig.moonpay,...p.moonpayConfigOverride,currencyCode:e,quoteCurrencyAmount:p.moonpayConfigOverride?.quoteCurrencyAmount??Ah(p.amount)});h(n),i({moonpayStatus:{externalTransactionId:a},funding:r?.funding})}()}),[u,p]),e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Uh,{app:t,signedUrl:u,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:Eh}}),n(v.ModalScreen.MOONPAY_STATUS_SCREEN)}}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.MOONPAY_STATUS_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),{closePrivyModal:n}=s.usePrivyInternal(),{externalTransactionId:i}=r?.moonpayStatus,a=Th(i||null,t.fundingMethodConfig.moonpay.useSandbox??!1);return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{title:"Fund account"},"header"),e.jsx(Zh,{status:a,onClickCta:n}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN]:()=>{let{data:t,setModalData:r,navigate:n}=v.usePrivyModal(),{closePrivyModal:i,createAnalyticsEvent:o,initCoinbaseOnRamp:l,getCoinbaseOnRampStatus:d}=s.usePrivyInternal(),[u,h]=a.useState("pending-in-flow"),p=t?.funding,y=p.isUSDC?"USDC":"ethereum"===p.chainType?"ETH":"SOL",[m,f]=a.useState(!1);return a.useEffect((()=>{if(m)return;f(!0);let e=async()=>{try{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:p.amount,chainType:p.chainType,chainId:"ethereum"===p.chainType?p.chain.id:p.cluster.name}});let e=window.open(void 0,void 0,dh({w:440,h:680})),t="ethereum"===p.chainType?function(e){let t=hh[e];if(!t)throw new s.PrivyClientError(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(p.chain.id):"solana",r=await l({addresses:[{address:p.address,blockchains:[t]}],assets:[y]}),{url:n}=(({input:e,amount:t,blockchain:r})=>{let n=new URL("https://pay.coinbase.com/buy/select-asset");return n.searchParams.set("appId",e.app_id),n.searchParams.set("sessionToken",e.session_token),n.searchParams.set("defaultExperience","buy"),n.searchParams.set("presetCryptoAmount",t.startsWith(".")?`0${t}`:t),n.searchParams.set("defaultNetwork",r),n.searchParams.set("partnerUserId",e.partner_user_id),{url:n}})({input:r,amount:p.amount,blockchain:t});if(!e)throw Error("Unable to initiate Coinbase Onramp flow.");e.location=n.toString();let i=0,a=!1;for(;i<ph;){i++;let{status:t}=await d({partnerUserId:r.partner_user_id});if("success"===t){a=!0;break}if("failure"===t)throw Error("There was an error completing Coinbase Onramp flow.");if(e.closed){h("pending-after-flow");let e=Math.floor(6.666666666666667);i=Math.max(i,ph-e)}await new Promise((e=>setTimeout(e,1500)))}if(!a)throw Error("Timed out waiting for transaction response from Coinbase Onramp.");h("success")}catch(e){console.error(e),h("error"),o({eventName:Bc,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),r({funding:{...p,errorMessage:"Something went wrong adding funds from Coinbase Onramp. Please try again or use another method to fund your wallet."}}),n(v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN)}finally{f(!1)}},t=setTimeout((()=>{e()}),500);return()=>clearTimeout(t)}),[]),e.jsxs(e.Fragment,{children:[e.jsx(Lo,{title:"Fund account"},"header"),e.jsx(yh,{status:u,onClickCta:i}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:()=>{let{connectors:t}=s.usePrivyInternal(),{app:r,setModalData:n,data:i,navigate:o}=v.usePrivyModal(),[l,d]=a.useState("default"),u="solana"===i?.funding?.chainType,h=Il(r.appearance.walletList,u?"solana-only":"ethereum-only",t,!0,r.appearance.walletList,r.externalWallets.walletConnect.enabled),p=e.jsx(np,{text:"More wallets",onClick:()=>d("overflow")});return a.useEffect((()=>{n({...i,externalConnectWallet:{onCompleteNavigateTo:u?v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN:v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN}})}),[]),"overflow"===l?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:()=>d("default")},"header"),e.jsxs(Ko,{children:[e.jsx(hd,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),h]}),e.jsx(c.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(tl,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),e.jsxs(Ko,{children:[...h.length>3?h.slice(0,2):h,h.length>3&&p,e.jsx(rp,{onClick:()=>o(v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN),children:"Send funds manually"})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:()=>{let{rpcConfig:t,appId:r,closePrivyModal:n,createAnalyticsEvent:i}=s.usePrivyInternal(),{navigate:o,setModalData:l,app:u,data:h}=v.usePrivyModal(),{wallets:p}=d.useWallets(),[y,m]=a.useState(!1),[f,g]=a.useState(0n),[w,x]=a.useState(!1),[C,E]=a.useState(null),[b,S]=a.useState(null),[A,j]=a.useState([]),[$,T]=a.useState(0),[P,_]=a.useState(!1),[k,N]=a.useState(!1),[I,M]=a.useState(!1),[O,R]=a.useState(!1);if(!h?.funding||"ethereum"!==h.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:F,chain:L,amount:U,connectedWalletAddress:D}=h.funding,W=h.funding.address,B=h.funding.erc20Address;a.useEffect((()=>{B&&!F&&E(Error("Unable to fetch token details"))}),[]);let H=!!B&&!!F,G=H?BigInt(parseFloat(U)*10**F.decimals):J.parseEther(U),q=D?p.find((({address:e})=>e===D)):p[0],[z,V]=a.useState(null);a.useEffect((()=>{(async()=>{if(!q)return;let e=await q.getEthereumProvider();V(J.createWalletClient({account:q.address,transport:J.custom(e)}).extend(J.publicActions))})().catch(console.error)}),[q]);let[K,Y]=a.useState(0n);a.useEffect((()=>{J.createPublicClient({chain:L,transport:J.http(c.getJsonRpcEndpointFromChain(L,t,r))}).getBalance({address:W}).then(Y).catch(console.error)}),[]);let[Z,X]=a.useState(0n);a.useEffect((()=>{H&&(async({chain:e,address:t,appId:r,rpcConfig:n,erc20Address:i})=>{let a=J.createPublicClient({chain:e,transport:J.http(c.getJsonRpcEndpointFromChain(e,n,r))});return{balance:await a.readContract({address:i,abi:fu,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}})({chain:L,address:W,appId:r,rpcConfig:t,erc20Address:B}).then((e=>X(e.balance))).catch(console.error)}),[]);let{tokenPrice:Q}=Wc(L.id),[ee,te]=a.useState({to:W,chain:L,value:G,data:void 0});a.useEffect((()=>{(async()=>{let e,n;if(!z||!q||P||I)return;_(!0);let a=J.createPublicClient({chain:ee.chain,transport:J.http(c.getJsonRpcEndpointFromChain(ee.chain,t,r))});if(H&&!ee.data)return await a.simulateContract({address:B,chain:ee.chain,abi:cu,functionName:"transfer",args:[W,G],account:q.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(_(!1),void te({to:B,chain:ee.chain,data:J.encodeFunctionData({abi:cu,functionName:"transfer",args:[W,G]}),value:"0x0"})):(_(!1),void x(!0));try{e=await a.prepareTransactionRequest({account:q.address,to:ee.to,chain:ee.chain,data:ee.data,value:BigInt(ee.value??0)})}catch(e){console.error(e),A.length>1&&S(e.shortMessage??"Something went wrong")}if(!e)return _(!1),void x(!0);_(!1),M(!0),m(!0),g(e.gas);try{await z.switchChain({id:ee.chain.id})}catch(e){await z.addChain({chain:ee.chain}),await z.switchChain({id:ee.chain.id})}try{n=await z.sendTransaction(e),i({eventName:Bc,payload:{provider:"external",status:"success",address:q.address,chainId:ee.chain.id,value:ee.value?.toString(),txHash:n}})}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(A.length<1?E(new s.PrivyClientError(e.shortMessage,void 0,s.PrivyErrorCode.TRANSACTION_FAILURE)):S(e.shortMessage??"Something went wrong"))}n?(await z.waitForTransactionReceipt({hash:n}),M(!1),R(!0)):M(!1)})().catch(console.error)}),[z,ee]),a.useEffect((()=>{(async()=>{if(!w||!z||!q)return;let e=d.addToDefaultChains(u.chains).filter((e=>e.id!==L.id&&!!e.testnet==!!L.testnet));H&&e.unshift(L);let n=await(({chains:e,appId:t,address:r,rpcConfig:n})=>Promise.all(e.map((async e=>{let i=J.createPublicClient({chain:e,transport:J.http(c.getJsonRpcEndpointFromChain(e,n,t))});return{balance:await i.getBalance({address:r}).catch((()=>0n)),chain:e}}))))({chains:e,address:q.address,appId:r,rpcConfig:t}),i=H?n.filter((e=>e.balance>0n)):n.filter((e=>e.balance>G));if(i.length<1)return void E(new s.PrivyClientError(`Wallet ${c.formatWalletAddress(q.address)} does not have enough funds.`,void 0,s.PrivyErrorCode.INSUFFICIENT_BALANCE));i.sort(((e,t)=>Number(t.balance-e.balance)));let a=(await Promise.allSettled(i.map((async e=>({quote:await yu({isTestnet:!!L.testnet,input:pu({amount:G.toString(),user:q.address,recipient:W,destinationChainId:L.id,destinationCurrency:B,originChainId:e.chain.id})}),...e}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(a.length<1)return void E(new s.PrivyClientError(`Wallet ${c.formatWalletAddress(q.address)} does not have enough funds.`,void 0,s.PrivyErrorCode.INSUFFICIENT_BALANCE));let o=a.map((e=>({bridgeTx:mu(e.quote),balance:e.balance,chain:e.chain}))).filter((e=>!!e.bridgeTx));if(o.length>1)return void j(o);let l=o[0];l?(N(!0),te({data:l.bridgeTx.data,to:l.bridgeTx.to,value:l.bridgeTx.value,chain:l.chain})):E(new s.PrivyClientError(`Wallet ${c.formatWalletAddress(q.address)} does not have enough funds.`,void 0,s.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[w]),a.useEffect((()=>{if(!C)return;let e={error:C,previousScreen:v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN};l({funding:h?.funding,sendTransaction:h?.sendTransaction,errorModalData:e}),o(v.ModalScreen.ERROR_SCREEN,!1)}),[C]);let re=q?Cl(q.walletClientType,q.connectorType,q.walletClientType)||"wallet":null,ne=!H&&Q?c.getDollarsFromStringFloat(h?.funding?.amount??"0",Q):void 0,ie=H?f:c.sumWeiQuantitiesToHexString([f,G]),ae=ie&&Q?c.getDollarsFromWei(ie,Q):void 0,oe=ie?c.getNativeCurrencyFromWei(ie,"ETH"):void 0,se=f&&Q?c.getDollarsFromWei(f,Q):void 0,le=f?c.getNativeCurrencyFromWei(f,"ETH"):void 0;if(a.useEffect((()=>{if(!O)return;let e=setTimeout(n,d.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS);return()=>clearTimeout(e)}),[O]),O)return e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Ks,{}),e.jsxs(Gs,{children:[e.jsx(dt.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(tl,{title:"Success!",description:`You’ve successfully added ${U} ${H?F.symbol:L.nativeCurrency.symbol} to your ${u.name} wallet. It may take a minute before the funds are available to use.`})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});let de=H?`${uu({amount:Z,decimals:F.decimals})} ${F.symbol}`:c.getNativeCurrencyFromWei(K,L.nativeCurrency.symbol,3,!0),ce=A[$];return A.length>1&&ce?e.jsx(ih,{displayName:re,configuredFundingChain:L,formattedBalance:de,fundingAmount:U,fundingCurrency:H?F.symbol:L.nativeCurrency.symbol,fundingAmountInUsd:ne,options:A,selectedOption:ce,isPreparing:P,isSubmitting:I,errorMessage:b,onSubmit:()=>{te({to:ce.bridgeTx.to,data:ce.bridgeTx.data,value:ce.bridgeTx.value,chain:ce.chain})},onSelect:e=>{e!==$&&(S(null),T(e))}}):y&&f&&q&&h?.funding?e.jsx(lu,{wallet:q,displayName:re,addressToFund:W,isBridging:k,isErc20Flow:H,totalPriceInUsd:ae,totalPriceInNativeCurrency:oe,gasPriceInUsd:se,gasPriceInNativeCurrency:le,chainId:L.id,chainName:L.name}):e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Oc,{}),e.jsx("div",{style:{marginTop:"1rem"}}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN]:()=>{let{closePrivyModal:t,createAnalyticsEvent:r}=s.usePrivyInternal(),{navigate:i,setModalData:o,app:l,data:u}=v.usePrivyModal(),{wallets:h}=f.useSolanaWallets(),[p,y]=a.useState(0n),[m,g]=a.useState(null),[w,x]=a.useState(!1),[C,E]=a.useState(!1),b=a.useRef(!1);if(!u?.funding||"solana"!==u.funding.chainType)throw Error("Invalid funding data");let{address:S,amount:A,cluster:j,connectedWalletAddress:$}=u.funding,T=qc(j),{tokenPrice:P}=Wc("solana"),{fundingAmountInBaseUnit:_,totalPriceInUsd:k,totalPriceInNativeCurrency:N,feePriceInNativeCurrency:I,feePriceInUsd:M}=function({amount:e,fee:t,tokenPrice:r}){let n=BigInt(1e9*parseFloat(e)),i=n+t;return{fundingAmountInBaseUnit:n,totalPriceInUsd:r?Kc(i,r):void 0,totalPriceInNativeCurrency:Vc(i),feePriceInNativeCurrency:Vc(t),feePriceInUsd:r?Kc(t,r):void 0}}({amount:A,fee:p,tokenPrice:P}),O=$?h.find((({address:e})=>e===$)):h[0];if(a.useEffect((()=>{(async()=>{if("solana"!==O?.type||!O.sendTransaction||w||b.current)return;b.current=!0;let e=new n.PublicKey(O.address),t=new n.Transaction;t.add(n.SystemProgram.transfer({fromPubkey:e,toPubkey:new n.PublicKey(S),lamports:_}));let i=new n.Connection(T),a=await i.getLatestBlockhash();t.recentBlockhash=a.blockhash,t.feePayer=e;let o=await t.getEstimatedFee(i);null!=o&&y(BigInt(o)),x(!0);try{let e=await i.simulateTransaction(t);if(e.value.err)return console.warn("Transaction simulation failed"),e.value.logs?.find((e=>/Transfer: insufficient lamports/gi.test(e)))?void g(new s.PrivyClientError(`Wallet ${c.formatWalletAddress(O.address,void 0,void 0,"solana")} does not have enough funds.`,void 0,s.PrivyErrorCode.INSUFFICIENT_BALANCE)):void g(Error(e.value.err.toString()));let n=await O.sendTransaction(t,i);r({eventName:Bc,payload:{provider:"external",status:"success",address:O.address,value:_.toString(),txHash:n,chainType:"solana",rpcEndpoint:T}}),x(!1),E(!0)}catch(e){if(console.error(e),x(!1),/user rejected the request/gi.test(e.message||""))return void g(new s.PrivyClientError("Transaction was rejected by the user",void 0,s.PrivyErrorCode.TRANSACTION_FAILURE));g(new s.PrivyClientError("Something went wrong",void 0,s.PrivyErrorCode.TRANSACTION_FAILURE))}})().catch(console.error).finally((()=>b.current=!1))}),[]),a.useEffect((()=>{if(!m)return;let e={error:m,previousScreen:v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN};o({funding:u?.funding,sendTransaction:u?.sendTransaction,errorModalData:e}),i(v.ModalScreen.ERROR_SCREEN,!1)}),[m]),a.useEffect((()=>{if(!C)return;let e=setTimeout(t,d.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS);return()=>clearTimeout(e)}),[C]),C)return e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Ks,{}),e.jsxs(Gs,{children:[e.jsx(dt.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(tl,{title:"Success!",description:`You’ve successfully added ${A} SOL to your ${l.name} wallet. It may take a minute before the funds are available to use.`})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});let R=O?Cl(O.walletClientType,O.connectorType,O.walletClientType)||"wallet":null;return O&&w?e.jsx(lu,{wallet:O,displayName:R,addressToFund:S,isBridging:!1,isErc20Flow:!1,totalPriceInUsd:k,totalPriceInNativeCurrency:N,gasPriceInUsd:M,gasPriceInNativeCurrency:I,chainId:"solana",chainName:j.name}):e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Oc,{}),e.jsx("div",{style:{marginTop:"1rem"}}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN]:()=>{let{wallets:t}=d.useWallets(),{wallets:r}=f.useSolanaWallets(),{app:i,data:o,setModalData:l,navigate:u,lastScreen:h}=v.usePrivyModal(),{chains:p,rpcConfig:y,appId:m,closePrivyModal:g,createAnalyticsEvent:w}=s.usePrivyInternal(),[x,C]=a.useState("default"),[E,b]=a.useState(void 0),S=o?.funding,A="solana"===S.chainType,{tokenPrice:j}=Wc(A?"solana":S.chain.id),$=A?S.cluster.name:S.chain.name,T=A?"SOL":S.erc20Address?S.erc20ContractInfo?.symbol:S.chain.nativeCurrency.symbol,P=parseFloat(S.amount),_=!isNaN(P)&&P>0,k=j?c.getDollarsFromStringFloat(S.amount,j):void 0,N=A?r.find((({address:e})=>e===S.address)):t.find((({address:e})=>c.formatWalletAddress(e)===c.formatWalletAddress(S.address))),I=N&&"privy"!==N.walletClientType?Cl(N.walletClientType,N.connectorType,N.walletClientType):i.name;if(!S)return l({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:h||v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN},funding:o?.funding,sendTransaction:o?.sendTransaction}),u(v.ModalScreen.ERROR_SCREEN),e.jsx(e.Fragment,{});a.useEffect((()=>{let e=A?async function(){"solana"===S.chainType&&new n.Connection(qc(S.cluster)).getBalance(new n.PublicKey(S.address)).then((e=>{b((t=>(t&&e>t&&w({eventName:Bc,payload:{provider:"manual",status:"success",chainType:"solana",address:N?.address,value:(e-t).toString()}}),e)))}))}:async function(){"ethereum"===S.chainType&&c.getJsonRpcProvider(S.chain.id,p,y,{appId:m}).getBalance(S.address).then((e=>{let t=parseFloat(ae.formatUnits(e,"ether"));b((e=>(e&&t>e&&w({eventName:Bc,payload:{provider:"manual",status:"success",chainType:"ethereum",address:N?.address,value:(t-e).toString()}}),t)))})).catch((()=>b(void 0)))},t=setInterval(e,2e3);return e(),()=>clearInterval(t)}),[]);let M=a.useMemo((()=>void 0!==E&&E>=parseFloat(S.amount)),[E,S.amount]),O=null!=E?A?Vc(BigInt(E),2,!0,!0):E.toPrecision(2):"",R=e.jsxs(e.Fragment,{children:[e.jsx(c.WalletInfoCard,{title:"Your wallet",errMsg:void 0,isLoading:!S||void 0===E,isPulsing:!M,balance:`${O} ${A?"SOL":"ETH"}`,address:S.address,statusColor:M?"green":"gray"}),M&&e.jsx(nh,{onClick:()=>g(),children:"Close"})]});return"qr-code"===x?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:()=>C("default")}),e.jsxs(qs,{style:{gap:"24px",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx(vs,{children:"Scan QR code"}),e.jsxs(ws,{children:["Scan this code using your mobile wallet to send funds to your ",I," ","wallet."]})]}),e.jsx(jc,{url:S.address,size:200,squareLogoElement:_h}),R]}),e.jsx(c.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(tl,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),e.jsxs(qs,{style:{gap:"16px"},children:[e.jsxs(Ih,{children:[e.jsx(ft.default,{height:"20px",width:"20px",color:"var(--privy-color-accent-light)"}),e.jsxs(Mh,{children:["Make sure to send on ",$,"."]})]}),e.jsxs(Oh,{children:[e.jsx(Xs,{height:16}),e.jsxs(Vu,{children:[e.jsxs(Ku,{children:[e.jsx(Yu,{children:S.amount}),e.jsx(Ju,{children:T})]}),e.jsx(Qu,{children:!A&&!S.erc20Address&&e.jsx(Qu,{children:k&&_?k:"..."})}),e.jsxs(eh,{children:[e.jsx(su,{chainId:A?"solana":S.chain.id,height:16,width:16})," ",$]})]}),e.jsx(Xs,{height:8}),e.jsxs(Nh,{children:[e.jsx(kh,{text:S.address}),e.jsx(Fh,{onClick:()=>C("qr-code"),children:e.jsxs(Rh,{children:[e.jsx(gt.default,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),R]}),e.jsx(Xs,{height:16}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN]:()=>{let{closePrivyModal:t}=s.usePrivyInternal(),{data:r,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=v.usePrivyModal(),{onSuccess:o,onFailure:l}=r.setWalletPassword,d=()=>{l(new s.PrivyEmbeddedWalletError("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=d,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:d}),e.jsx(Ks,{}),e.jsxs(Gs,{children:[e.jsxs(Zs,{children:[e.jsx(ot.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),e.jsx(Js,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:e.jsx(st.default,{width:"12px",height:"12px",fill:"white"})})]}),e.jsxs(tl,{title:"Secure Your Account",children:["Please set a password to secure your account.",e.jsx("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),e.jsx(bo,{onClick:()=>{n({createWallet:{onFailure:l,onSuccess:o,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i(v.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN)},children:"Add password"}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN]:()=>{let[t,r]=a.useState(null),[n,i]=a.useState(!1),[o,l]=a.useState(null),[d,c]=a.useState(""),{authenticated:u,getAccessToken:p,user:y}=s.usePrivy(),{walletProxy:m,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:w}=s.usePrivyInternal(),{app:x,navigate:C,data:E,onUserCloseViaDialogOrKeybindRef:b}=v.usePrivyModal(),{onSuccess:S,onFailure:A}=E.createWallet,j=h.getPrivyEthereumWallet(y),$="user-passcode"===t?.recoveryMethod,T="user-passcode"===j?.recoveryMethod;a.useEffect((()=>{u||(C(v.ModalScreen.LANDING),A(new s.PrivyUnauthenticatedError("User must be authenticated before setting a password on a Privy wallet")))}),[u]);let P=()=>o?(A(o),void g({shouldCallAuthOnSuccess:!1})):$?(S(t),void g({shouldCallAuthOnSuccess:!1})):(A(new s.PrivyEmbeddedWalletError("Exited before password was added to wallet")),void g({shouldCallAuthOnSuccess:!1}));b.current=P;return e.jsx(dc,{appName:x?.name||"privy",config:{initiatedBy:"user",onCancel:P},error:o?"An error has occurred, please try again.":void 0,buttonLoading:n,buttonHideAnimations:!1,password:d,isResettingPassword:T,onPasswordGenerate:()=>c(Qd()),onPasswordChange:c,onSubmit:async()=>{$?(S(t),g({shouldCallAuthOnSuccess:!1})):(i(!0),l(null),await(async()=>{let e=await p();if(e&&j?.address&&d&&m)try{if(w({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T}}),!(await m.setRecovery({accessToken:e,address:j.address,recoveryPassword:d,recoveryMethod:"user-passcode"})).address)return l(new s.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T,reason:"error setting password"}});let t=await f(),n=h.getPrivyEthereumWallet(t);if(!n)return l(new s.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T,reason:"wallet disconnected"}});r(n),w({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T}})}catch(e){console.warn(e),l(e instanceof Error?e:Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:j.address,reason:e}})}})(),i(!1))},onClose:P})},[v.ModalScreen.EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN]:()=>{let{app:t,navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:i}=v.usePrivyModal(),[o,l]=a.useState(""),[d,c]=a.useState(!1),[u,h]=a.useState(),[p,y]=a.useState(null),{authenticated:m,user:f}=s.usePrivy(),{closePrivyModal:g,isNewUserThisSession:w,initializeWalletProxy:x}=s.usePrivyInternal(),{onSuccess:C,onFailure:E,callAuthOnSuccessOnClose:b}=n.createWallet,{createWallet:S}=vd(),[A,j]=a.useState(null),$=new Wi((async()=>{try{let e=await S({recoveryPassword:u,user:f});if(!e)return;j(e),w?r(v.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN):(C(e),g({shouldCallAuthOnSuccess:b}))}catch(e){l(e.message)}}));a.useEffect((()=>{p||x(3e4).then((e=>y(e)))}),[p]),a.useEffect((()=>{if(!m||!f)return r(v.ModalScreen.LANDING),void E(Error("User must be authenticated before creating a Privy wallet"))}),[m]),i.current=()=>null;return e.jsx(dc,{config:{initiatedBy:"automatic"},appName:t?.name||"privy",loading:!p,buttonLoading:d,buttonHideAnimations:!A&&d,isResettingPassword:!1,error:o,password:u||"",onClose:()=>{A&&"user-passcode"!==A?.recoveryMethod?(E(new s.PrivyEmbeddedWalletError("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):A?(C(A),g({shouldCallAuthOnSuccess:b})):(E(new s.PrivyEmbeddedWalletError("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))},onPasswordChange:h,onPasswordGenerate:()=>h(Qd()),onSubmit:async()=>(c(!0),$.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>c(!1))))})},[v.ModalScreen.MFA_ENROLLMENT_FLOW_SCREEN]:()=>{let{user:t,enrollInMfa:r}=s.usePrivy(),[n,i]=a.useState(null),{unenrollWithSms:o,unenrollWithTotp:l,unenrollWithPasskey:d}=Vp(),{app:u,ready:h,data:p,onUserCloseViaDialogOrKeybindRef:y}=v.usePrivyModal(),{closePrivyModal:m}=s.usePrivyInternal(),{promptMfa:f}=zp(),{initEnrollmentWithTotp:g}=Vp(),[w,x]=a.useState(!1),[C,E]=a.useState(null),[b,S]=a.useState(null),A=()=>{m({shouldCallAuthOnSuccess:!0}),r(!1),setTimeout((()=>{i(null),E(null)}),500)},{initEnrollmentWithPasskey:j,submitEnrollmentWithPasskey:$}=Vp(),[T,P]=a.useState(!1),[_,k]=a.useState(null);y.current=A;let N=t?.mfaMethods.includes("sms"),I=!!t?.phone,M=t?.mfaMethods.includes("totp"),O=t?.mfaMethods.includes("passkey"),R=N||M||O,F=t?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function L(){i(null),E(null)}if(a.useEffect((()=>{R&&x(!0)}),[R]),!h||!t||!u)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A},"header"),e.jsx(gs,{children:e.jsx(Kp,{})}),e.jsx(xs,{children:e.jsx(vo,{})}),e.jsx(c.ModalFooter,{})]});if("sms"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:L,onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Le.default,{})}),e.jsx(vs,{children:"Remove SMS verification?"}),e.jsxs(ws,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),e.jsx(Ss,{children:e.jsx(bo,{warn:!0,onClick:async function(){i(null);try{await o()}catch(e){i(null)}},children:"Remove SMS for MFA"})}),e.jsx(c.ModalFooter,{})]});if("totp"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:L,onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Le.default,{})}),e.jsx(vs,{children:"Remove Authenticator App verification?"}),e.jsxs(ws,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),e.jsx(Ss,{children:e.jsx(bo,{warn:!0,onClick:async function(){i(null);try{await l()}catch(e){i(null)}},children:"Remove Authenticator App for MFA"})}),e.jsx(c.ModalFooter,{})]});if("passkey"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:L,onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Le.default,{})}),e.jsx(vs,{children:"Are you sure you want to remove passkey verification?"}),e.jsx(ws,{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."}),e.jsx(Ss,{children:e.jsx(bo,{warn:!0,onClick:async function(){i(null);try{await f(),await d()}catch(e){i(null)}},children:"Yes, remove"})}),e.jsx(c.ModalFooter,{})]});if(0===p.mfaEnrollmentFlow.mfaMethods.length&&!R)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(xt.default,{})}),e.jsx(vs,{children:"Add more security"}),e.jsxs(ws,{children:[u?.name," does not have any verification methods enabled."]}),e.jsx(Ss,{children:e.jsx(bo,{onClick:A,children:"Close"})}),e.jsx(c.ModalFooter,{})]});let U=!R&&!w;return U?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(xt.default,{})}),e.jsx(vs,{children:"Transaction Protection"}),e.jsx(ws,{children:"Set up transaction protection to add an extra layer of security to your account"}),e.jsxs(Cs,{children:[e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(pt.default,{})}),"Enable 2-Step verification for your ",u?.name," wallet."]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(Ct.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),e.jsxs(Ss,{children:[e.jsx(bo,{onClick:()=>x(!0),children:"Continue"}),e.jsx(To,{onClick:A,children:"Not now"})]}),e.jsx(c.ModalFooter,{})]}):"sms"===C?e.jsx(my,{onComplete:A,onReset:L,onClose:A}):"totp"===C&&b?e.jsx(gy,{onComplete:A,onClose:A,onReset:L,totpInfo:b}):"passkey"===C?e.jsx(Jp,{onComplete:A,onReset:L,onClose:A}):e.jsx(Zp,{showIntro:U,userMfaMethods:t.mfaMethods,appMfaMethods:u.mfa.methods,userHasAuthSms:I,onBackToIntro:function(){x(!1)},handleSelectMethod:async function(e){return await f().catch(k),"totp"===e?(E(e),S(null),void g().then((e=>{S(e)})).catch((()=>{S(null),L()}))):"passkey"===e&&1===F.length?await async function(){P(!0);try{await j(),await $({credentialIds:F})}catch(e){k(e)}finally{P(!1)}}():void E(e)},isTotpLoading:"totp"===C&&!b,isPasskeyLoading:T,error:_,onClose:A,setRemovingMfaMethod:i})},[v.ModalScreen.CAPTCHA_SCREEN]:()=>{let{lastScreen:t,currentScreen:r,data:n,navigateBack:i,navigate:o,setModalData:s}=v.usePrivyModal(),{status:l,token:d,waitForResult:u,reset:h,execute:p}=xa(),y=a.useRef([]),m=e=>{y.current=[e,...y.current]},[f,g]=a.useState(!0);a.useEffect((()=>(m(setTimeout(g,1e3,!1)),()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]})),[]);let[w,x]=a.useState(""),[C,E]=a.useState("Checking that you are a human..."),[b,S]=a.useState(e.jsx(bo,{onClick:()=>{},disabled:!0,children:"Continue"})),[A,j]=a.useState(!1),[$,T]=a.useState(3),P=n?.captchaModalData,_=async e=>{try{await(P?.callback(e)),P?.onSuccessNavigateTo&&o(P?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof va)return;s({errorModalData:{error:e,previousScreen:t||v.ModalScreen.LANDING}}),o(P?.onErrorNavigateTo||v.ModalScreen.ERROR_SCREEN,!1)}};a.useEffect((()=>{"success"===l?m(setTimeout((async()=>{let e=await u();!e||P?.userIntentRequired||_(e)}),1e3)):"ready"===l&&m(setTimeout((()=>{"ready"===l&&p()}),500))}),[l]),a.useEffect((()=>{if(!f)switch(l){case"success":x("Success!"),E("CAPTCHA passed successfully."),S(e.jsx(bo,{onClick:()=>{j(!0),_(d)},disabled:!P?.userIntentRequired,loading:A,children:P?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),E("Checking that you are a human..."),S(e.jsx(bo,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),$<=0?(E("If you use an adblocker or VPN, try disabling and re-attempting."),S(null)):(E("You did not pass CAPTCHA. Please try again."),S(e.jsx(bo,{onClick:k,children:"Retry"})))}}),[l,f,A]);let k=async()=>{if($<=0)return;T((e=>e-1)),h(),p();let e=await u();!e||P?.userIntentRequired||_(e)};return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t&&r!==t?i:void 0}),e.jsxs(vl,{children:["success"===l?e.jsx(Ye.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):"error"===l?e.jsx(Ze.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):e.jsx(fl,{}),e.jsxs(zs,{children:[w?e.jsx("h3",{children:w}):null,e.jsx("p",{children:C})]}),b]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.ERROR_SCREEN]:()=>{let{navigate:t,navigateBack:r,data:n,lastScreen:i,currentScreen:a}=v.usePrivyModal(),o=n?.errorModalData?.previousScreen||(i===a?void 0:i);return e.jsx(cc,{error:n?.errorModalData?.error||Error(),backFn:()=>o?t(o,!1):r(),onClick:()=>t(o||v.ModalScreen.LANDING,!1)})},[v.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE]:()=>{let{closePrivyModal:t}=s.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(ip,{children:e.jsx(Ge.default,{style:{width:32,height:32}})}),e.jsx(el,{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"}}),e.jsx(Ds,{children:e.jsx(bo,{onClick:()=>t(),children:"Close"})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN]:()=>{let{user:t,logout:r}=s.usePrivy(),{app:n,onUserCloseViaDialogOrKeybindRef:i,setModalData:a,navigate:o}=v.usePrivyModal(),{acceptTerms:l,closePrivyModal:d,createAnalyticsEvent:c}=s.usePrivyInternal(),u=e=>{e?.preventDefault(),d({shouldCallAuthOnSuccess:!1}),r()};i.current=u;return e.jsx(Os,{termsAndConditionsUrl:n?.legal.termsAndConditionsUrl,privacyPolicyUrl:n?.legal.privacyPolicyUrl,onAccept:async e=>{e.preventDefault(),await l(),t&&h.shouldProceedtoEmbeddedWalletCreationFlow(t,n?.embeddedWallets?.createOnLogin)?(a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),o(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)):d()},onDecline:u})},[v.ModalScreen.TELEGRAM_AUTH_SCREEN]:()=>{let{authenticated:t,logout:r,ready:n,user:i}=s.usePrivy(),{app:o,setModalData:l,navigate:u,resetNavigation:p,data:y}=v.usePrivyModal(),{initLoginWithTelegram:m,loginWithTelegram:f,updateWallets:g,setReadyToTrue:w,closePrivyModal:x,createAnalyticsEvent:C,getAuthMeta:E}=s.usePrivyInternal(),[b,S]=a.useState(!1),[A,j]=a.useState(void 0),$=xa();async function T(){try{let e=await async function(){let e;if($.enabled&&"error"===$.status)throw new va($.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);return $.enabled&&"success"!==$.status&&($.execute(),e=await $.waitForResult()),e}();await f(e),S(!0),w(!0)}catch(e){if(e?.privyErrorCode===s.PrivyErrorCode.ALLOWLIST_REJECTED)return j(void 0),p(),void u(v.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),j(void 0),p(),void u(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_DOES_NOT_EXIST)return j(void 0),p(),void u(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return j(void 0),p(),l({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:E()?.telegramAuthResult,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void u(v.ModalScreen.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=Ea(e);j({retryable:t,detail:r,message:"Authentication failed"})}}a.useEffect((()=>{T()}),[]),a.useEffect((()=>{if(!(n&&t&&b&&i))return;if(o?.legal.requireUsersAcceptTerms&&!i.hasAcceptedTerms){let e=setTimeout((()=>{u(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(i,o?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),u(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}g();let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}),[n,t,b,i]);let P=b?"Successfully connected with Telegram":A?A.message:"Verifying connection to Telegram",_="";return _=b?"You’re good to go!":A?A.detail:"Just a few moments more",e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsx(Ks,{}),e.jsxs(Mf,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:b,fail:!!A}),e.jsx(kp,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx("h3",{children:P}),e.jsx("p",{children:_})]}),A&&A?.retryable?e.jsx(_o,{onClick:async()=>{try{j(void 0),y?.telegramAuthModalData?.seamlessAuth||await m(void 0,y?.login?.disableSignup),await T()}catch(e){let{retryable:t,detail:r}=Ea(e);j({retryable:t,detail:r,message:"Authentication failed"})}},disabled:!b&&!A?.retryable,children:"Retry"}):null]}),e.jsx(Ys,{}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.LINK_CONFLICT_SCREEN]:()=>{let{initiateAccountTransfer:t,closePrivyModal:r}=s.usePrivyInternal(),{data:n,navigate:i,lastScreen:o,setModalData:l}=v.usePrivyModal(),[d,c]=a.useState(void 0),[u,h]=a.useState(!1),[p,y]=a.useState(!1),m=async()=>{try{if(!n?.accountTransfer?.nonce||!n?.accountTransfer?.account)throw Error("missing account transfer inputs");y(!0),await t({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}),h(!0),y(!1),setTimeout(r,1e3)}catch(e){l({errorModalData:{error:e,previousScreen:o||v.ModalScreen.LINK_CONFLICT_SCREEN}}),i(v.ModalScreen.ERROR_SCREEN,!0)}};return d?e.jsx(ys,{address:d,onClose:r,onRetry:()=>c(void 0),onTransfer:m,isTransferring:p,transferSuccess:u}):e.jsx(ms,{onClose:r,onInfo:()=>c(n?.accountTransfer?.embeddedWalletAddress),onContinue:()=>c(n?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:p,transferSuccess:u,data:n})}},Xf=[v.ModalScreen.LANDING,v.ModalScreen.AWAITING_CONNECTION],Jf=({isMfaVerifying:t,onMfaVerificationComplete:r})=>{let{ready:n,isModalOpen:i}=s.usePrivy(),{headless:o}=d.useAppConfig(),{ready:l,currentScreen:u}=v.usePrivyModal(),{status:h,execute:p,reset:y,enabled:m}=xa(),f=i&&u&&Xf.includes(u)&&!o&&"ready"===h;return a.useEffect((()=>{f&&p()}),[f]),a.useEffect((()=>{!i&&m&&y()}),[i,m]),n&&l||u===v.ModalScreen.AWAITING_OAUTH_SCREEN||u===v.ModalScreen.CROSS_APP_AUTH_SCREEN||u===v.ModalScreen.TELEGRAM_AUTH_SCREEN?!u&&t?e.jsx(rm,{open:t,onClose:r}):u?e.jsxs(e.Fragment,{children:[e.jsx(es,{$if:!!t,children:e.jsx(Zf[u],{})}),e.jsx(es,{$if:!t,children:e.jsx(rm,{open:t,onClose:r})})]}):null:e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsx(Ks,{}),e.jsx(Yf,{children:e.jsx(vo,{})}),e.jsx(Ys,{}),e.jsx(c.ModalFooter,{})]})},Qf=({isMfaVerifying:t,onMfaVerificationComplete:r})=>{let n=a.useRef(null);return e.jsx(rg,{style:{height:c.useElementHeight(n)},id:"privy-modal-content",children:e.jsx("div",{ref:n,children:e.jsx(Jf,{isMfaVerifying:t,onMfaVerificationComplete:r})})})};const eg=({open:t})=>{let{app:r}=v.usePrivyModal(),{gracefulClosePrivyModal:n}=(()=>{let{closePrivyModal:e}=s.usePrivyInternal(),{onUserCloseViaDialogOrKeybindRef:t}=v.usePrivyModal();return{gracefulClosePrivyModal:a.useCallback((()=>{if(!t?.current)return e({shouldCallAuthOnSuccess:!1});t.current()}),[e])}})(),[i,o]=a.useState(!1);fo({onMfaRequired:()=>{r?.mfa.noPromptOnMfaRequired||o(!0)}});let l=t||i;return r.render.standalone?e.jsx(Hf,{children:e.jsx(tg,{id:"privy-modal-content",children:e.jsx(Jf,{isMfaVerifying:i,onMfaVerificationComplete:()=>o(!1)})})}):e.jsx(Gf,{open:l,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>n(),children:e.jsx(Hf,{children:e.jsx(Qf,{isMfaVerifying:i,onMfaVerificationComplete:()=>o(!1)})})})};let tg=E.styled.div`
3096
+ `;let Xf={[v.ModalScreen.LANDING]:()=>{let{app:t}=v.usePrivyModal();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?e.jsx(Rp,{connectOnly:!1}):e.jsx(Dp,{connectOnly:!1})},[v.ModalScreen.CONNECT_OR_CREATE]:()=>{let{app:t}=v.usePrivyModal();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?e.jsx(Rp,{connectOnly:!0}):e.jsx(Dp,{connectOnly:!0})},[v.ModalScreen.AWAITING_PASSWORDLESS_CODE]:()=>{let{app:t,navigate:r,lastScreen:n,navigateBack:i,setModalData:l,onUserCloseViaDialogOrKeybindRef:u}=v.usePrivyModal(),{closePrivyModal:p,resendEmailCode:y,resendSmsCode:m,getAuthMeta:f,loginWithCode:g,updateWallets:w,createAnalyticsEvent:x}=s.usePrivyInternal(),{authenticated:C,logout:E,user:b}=s.usePrivy(),[S,A]=a.useState(ll),[j,$]=a.useState(!1),[T,P]=a.useState(null),[_,k]=a.useState(null),[N,I]=a.useState(0);u.current=()=>null;let M=f()?.email?0:1,O=d.DEFAULT_SUCCESS_SCREEN_DURATION_MS-500;a.useEffect((()=>{if(N){let e=setTimeout((()=>{I(N-1)}),1e3);return()=>clearTimeout(e)}}),[N]),a.useEffect((()=>{if(C&&j&&b){if(t?.legal.requireUsersAcceptTerms&&!b.hasAcceptedTerms){let e=setTimeout((()=>{r(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),O);return()=>clearTimeout(e)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(b,t?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),E()},callAuthOnSuccessOnClose:!0}}),r(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),O);return()=>clearTimeout(e)}{w();let e=setTimeout((()=>p({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}}}),[C,j,b]),a.useEffect((()=>{if(T&&0===_){let e=setTimeout((()=>{A(ll),P(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[T]);let R=e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return P("Code should be numeric"),void k(1);P(null),k(null);let i=Number(e.currentTarget.name?.charAt(5)),a=[...t||[""]].slice(0,6-i),o=[...S.slice(0,i),...a,...S.slice(i+a.length)];A(o);let d=Math.min(Math.max(i+a.length,0),5);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${d}]`);e?.focus()}if(o.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${d}]`);e?.blur(),g(o.join("")).then((()=>$(!0))).catch((e=>{if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.INVALID_CREDENTIALS)P("Invalid or expired verification code");else if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)P(e.message);else{if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),void r(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.USER_DOES_NOT_EXIST)return void r(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.LINKED_TO_ANOTHER_USER)return l({errorModalData:{error:e,previousScreen:n??v.ModalScreen.AWAITING_PASSWORDLESS_CODE}}),void r(v.ModalScreen.ERROR_SCREEN,!1);if(e instanceof s.PrivyApiError&&e.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return l({accountTransfer:{nonce:e.data?.data?.nonce,account:0===M?f()?.email:f()?.phoneNumber,displayName:e.data?.data?.account?.displayName,linkMethod:0===M?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void r(v.ModalScreen.LINK_CONFLICT_SCREEN);P("Issue verifying code")}k(0)}))}},F=0==M?e.jsx(Ve.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),L=0==M?e.jsxs("p",{children:["Please check ",e.jsx(ml,{children:f()?.email})," for an email from privy.io and enter your code below."]}):e.jsxs("p",{children:["Please check ",e.jsx(ml,{children:f()?.phoneNumber})," for a message from ",t?.name||"Privy"," and enter your code below."]});return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:()=>i()},"header"),e.jsxs(dl,{children:[e.jsx(tl,{title:"Enter confirmation code",description:L,icon:F}),e.jsxs(Bs,{children:[e.jsxs(cl,{children:[e.jsx(ul,{$fail:!!T,$success:j,children:e.jsx("span",{children:T||(j?"Success!":"")})}),e.jsx("div",{children:S.map(((t,r)=>e.jsx("input",{name:`code-${r}`,type:"text",value:S[r],onChange:R,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(1===_&&(P(null),k(null)),A([...S.slice(0,e),"",...S.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:`${j?"success":""} ${T?"fail":""}`,autoComplete:o.isMobile?"one-time-code":"off"},r)))})]}),e.jsxs(hl,{children:[e.jsxs("span",{children:["Didn't get ",0==M?"an email":"a message","?"]}),N?e.jsxs(yl,{children:[e.jsx(ze.default,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),e.jsx("span",{children:"Code sent"})]}):e.jsx(pl,{children:e.jsx("button",{onClick:async()=>{I(30),0==M?await y():await m()},children:"Resend code"})})]})]})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.AWAITING_CONNECTION]:()=>{let t,[r,n]=a.useState(!1),[i,l]=a.useState(!1),[u,p]=a.useState(void 0),{authenticated:y,logout:m}=s.usePrivy(),{app:g,navigate:w,navigateBack:x,lastScreen:C,currentScreen:E,setModalData:b,data:S}=v.usePrivyModal(),{getAuthFlow:A,walletConnectionStatus:j,closePrivyModal:$,initLoginWithWallet:T,loginWithWallet:P,updateWallets:_,createAnalyticsEvent:k}=s.usePrivyInternal(),{walletConnectors:N}=s.usePrivy(),[I,M]=a.useState(0),{user:O}=s.usePrivy(),[R]=a.useState(O?.linkedAccounts.length||0),[F,L]=a.useState(""),[U,D]=a.useState(""),[W,B]=a.useState(!1),{hasTabbedAway:H}=function(){let[e,t]=a.useState(!1),r=a.useCallback((()=>{document.hidden&&t(!0)}),[]);return a.useEffect((()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r))),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:G,token:q}=xa(),z=o.isMobile&&"wallet_connect_v2"===j?.connector?.connectorType||o.isMobile&&"coinbase_wallet"===j?.connector?.connectorType||o.isMobile&&"injected"===j?.connector?.connectorType&&"phantom"===j?.connector?.walletClientType,V="connected"===j?.status,K="switching_to_supported_chain"===j?.status;a.useEffect((()=>{let e=A(),t=e instanceof pa||e instanceof ya?e:void 0;V&&!t&&(!G||q||y?T(j.connectedWallet,q,S?.login?.disableSignup).then((()=>{B(!0)})):(b({captchaModalData:{callback:e=>T(j.connectedWallet,e,S?.login?.disableSignup).then((()=>{B(!0)})),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_CONNECTION,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),w(v.ModalScreen.CAPTCHA_SCREEN,!1))),t&&z&&V&&!t.preparedMessage?t.buildMessage():t&&!z&&V&&(i||(async()=>{l(!0),p(void 0);try{"wallet_connect_v2"===j?.connector?.connectorType&&"metamask"===j?.connector?.walletClientType&&await d.sleep(2500),await Z()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{l(!1)}})())}),[I,V,W]),a.useEffect((()=>{if(O&&r){let e=d.DEFAULT_SUCCESS_SCREEN_DURATION_MS-500;if(g?.legal.requireUsersAcceptTerms&&!O.hasAcceptedTerms){let t=setTimeout((()=>{w(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),e);return()=>clearTimeout(t)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(O,g?.embeddedWallets?.createOnLogin)){let t=setTimeout((()=>{b({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),k({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),m()},callAuthOnSuccessOnClose:!0}}),w(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),e);return()=>clearTimeout(t)}_();let t=setTimeout((()=>$({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(t)}}),[O,r]);let Y=e=>{if(e?.privyErrorCode!==s.PrivyErrorCode.ALLOWLIST_REJECTED){if(e?.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),void w(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode!==s.PrivyErrorCode.USER_DOES_NOT_EXIST)return e?.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(b({accountTransfer:{nonce:e.data?.data?.nonce,account:A()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:A()?.meta.walletClientType,chainId:A()?.meta.chainId,connectorType:A()?.meta.connectorType},linkMethod:"siwe",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void w(v.ModalScreen.LINK_CONFLICT_SCREEN)):void p(Ml(e));w(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN)}else w(v.ModalScreen.ALLOWLIST_REJECTION_SCREEN)};async function Z(){try{await P(),n(!0)}catch(e){Y(e)}finally{l(!1)}}a.useEffect((()=>{j?.connectError&&Y(j?.connectError)}),[j]),((e,t)=>{let r=a.useRef((()=>{}));a.useEffect((()=>{r.current=e})),a.useEffect((()=>{if(null!==t){let e=setInterval((()=>r.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===X&&j?.connector instanceof eo?j.connector.redirectUri:void 0;e&&L(e);let t="wallet_connect_v2"===X&&j?.connector instanceof eo?j.connector.fallbackUniversalRedirectUri:void 0;t&&D(t)}),j?.connector instanceof eo&&!F?500:null);let X=j?.connector?.connectorType||"injected",J=j?.connector?.walletClientType||"unknown",Q=xl[J]?.displayName||j?.connector?.walletBranding.name||"Browser Extension",ee=xl[J]?.logo||j?.connector?.walletBranding.icon||(t=>e.jsx(Ba,{...t})),te="Browser Extension"===Q?Q.toLowerCase():Q;t=r?`Successfully connected with ${te}`:u?u.message:K?"Switching networks":V?i&&z?"Signing":"Sign to verify":`Waiting for ${te}`;let re="Don’t see your wallet? Check your other browser windows.";r?re=R===(O?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":I>=2&&u?re="Unable to connect wallet":u?re=u.detail:K?re="Switch your wallet to the requested network.":V&&z?re="Sign the message in your wallet to verify it belongs to you.":"metamask"===J&&o.isMobile?re="Click continue to open and connect MetaMask.":"metamask"===J?re="For the best experience, connect only one wallet at a time.":"wallet_connect"===X?re="Open your mobile wallet app to continue":"coinbase_wallet"!==X||d.isCoinbaseWalletInstalled()||(re=to(O)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Open the Coinbase app on your phone to continue.");let ne=N?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),ie="coinbase_wallet"===J&&(to(O)||u===f.ConnectorErrors.ERROR_USER_EXISTS);return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:C&&E!==C?x:void 0}),e.jsxs(Ol,{children:[e.jsx(Fl,{walletLogo:ee,success:r,fail:!!u}),e.jsxs(zs,{children:[e.jsx("h3",{children:t}),e.jsx("p",{children:re}),V||!F||H?null:e.jsxs("p",{children:["Still here?"," ",e.jsx("a",{href:F,target:"_blank",style:{textDecoration:"underline"},children:"Try connecting again"}),U&&e.jsxs(e.Fragment,{children:[" ","or"," ",e.jsx("a",{href:U,target:"_blank",style:{textDecoration:"underline"},children:"use this different link"})]})]})]}),ie?e.jsx(bo,{onClick:()=>ne&&ne?.disconnect(),disabled:r,children:"Use a different wallet"}):u==f.ConnectorErrors.ERROR_USER_EXISTS&&E!==C?e.jsx(bo,{onClick:x,children:"Use a different wallet"}):V&&!r&&z?e.jsx(bo,{onClick:()=>{l(!0),Z()},disabled:i,children:i?"Signing":"Sign with your wallet"}):!r&&u?.retryable&&I<2?e.jsx(bo,{onClick:()=>{M(I+1),p(void 0),V?(l(!0),Z()):j?.connectRetry()},disabled:!r&&(!u?.retryable||I>=2),children:"Retry"}):r||u?null:e.jsx(bo,{onClick:()=>{},disabled:!0,children:"Connecting"})]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.AWAITING_CONNECT_ONLY_CONNECTION]:()=>{let t,{navigateBack:r,navigate:n,lastScreen:i,currentScreen:l,data:u,setModalData:h}=v.usePrivyModal(),{walletConnectionStatus:p,closePrivyModal:y}=s.usePrivyInternal(),[m,g]=a.useState(void 0),[w,x]=a.useState(0),C="connected"===p?.status,E="switching_to_supported_chain"===p?.status;a.useEffect((()=>{if(C){let e;if(u?.externalConnectWallet?.onCompleteNavigateTo){let t=u.externalConnectWallet.onCompleteNavigateTo;e=setTimeout((()=>{if(u.funding){let e=p.connectedWallet?.address;h({funding:{...u.funding,connectedWalletAddress:e}})}n(t)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}else e=setTimeout(y,d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}}),[C]);a.useEffect((()=>{p?.connectError&&(e=>{g(Ml(e))})(p?.connectError)}),[p]);let b=p?.connector?.connectorType||"injected",S=p?.connector?.walletClientType||"unknown",A=xl[S]?.displayName||p?.connector?.walletBranding.name||"Browser Extension",j=xl[S]?.logo||p?.connector?.walletBranding.icon||(t=>e.jsx(Ba,{...t})),$="Browser Extension"===A?A.toLowerCase():A;t=C?`Successfully connected with ${$}`:m?m.message:E?"Switching networks":`Waiting for ${$}`;let T="Don’t see your wallet? Check your other browser windows.";return C?T="You’re good to go!":w>=2&&m?T="Unable to connect wallet":m?T=m.detail:E?T="Switch your wallet to the requested network.":"metamask"===S&&o.isMobile?T="Click to continue to open and connect MetaMask.":"metamask"===S?T="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===b?T="Open your mobile wallet app to continue":"coinbase_wallet"===b&&(T="Open the Coinbase app on your phone to continue."),e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:l===i?void 0:r}),e.jsxs(Ll,{children:[e.jsx(Fl,{walletLogo:j,success:C,fail:!!m}),e.jsxs(zs,{children:[e.jsx("h3",{children:t}),e.jsx("p",{children:T})]}),m==f.ConnectorErrors.ERROR_USER_EXISTS?e.jsx(bo,{onClick:r,children:"Use a different wallet"}):!C&&m?.retryable&&w<2?e.jsx(bo,{onClick:()=>{x(w+1),g(void 0),p?.connectRetry()},disabled:!C&&(!m?.retryable||w>=2),children:"Retry"}):!C&&m&&w>=2?e.jsx(bo,{onClick:r,children:"Use a different wallet"}):null]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.AWAITING_FARCASTER_CONNECTION]:()=>{let{authenticated:t,logout:r,ready:n,user:i}=s.usePrivy(),{lastScreen:l,navigate:u,navigateBack:p,setModalData:y,app:m}=v.usePrivyModal(),{getAuthFlow:f,loginWithFarcaster:g,closePrivyModal:w,createAnalyticsEvent:x}=s.usePrivyInternal(),[C,E]=a.useState(void 0),[b,S]=a.useState(!1),[A,j]=a.useState(!1),$=a.useRef([]),T=f(),P=T?.meta.connectUri;return a.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{let r=await T.pollForReady.execute(),n=Date.now()-e;if(r){clearInterval(t),S(!0);try{await g(),j(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===s.PrivyErrorCode.ALLOWLIST_REJECTED)return void u(v.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),void u(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_DOES_NOT_EXIST)return void u(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.LINKED_TO_ANOTHER_USER)t.detail="This account has already been linked to another user.";else{if(e?.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return y({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 u(v.ModalScreen.LINK_CONFLICT_SCREEN);e?.privyErrorCode===s.PrivyErrorCode.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}E(t)}}else n>12e4&&(clearInterval(t),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),$.current.forEach((e=>clearTimeout(e)))}}),[]),a.useEffect((()=>{if(n&&t&&A&&i){if(m?.legal.requireUsersAcceptTerms&&!i.hasAcceptedTerms){let e=setTimeout((()=>{u(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}A&&(h.shouldProceedtoEmbeddedWalletCreationFlow(i,m?.embeddedWallets.createOnLogin)?$.current.push(setTimeout((()=>{y({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),x({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),u(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)):$.current.push(setTimeout((()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)))}}),[A,n,t,i]),o.isMobile||b?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:l?p:void 0,onClose:w},"header"),e.jsx(Ks,{}),o.isIOS?e.jsx(e.Fragment,{children:e.jsxs(_c,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:A,fail:!!C}),e.jsx($c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx(vs,{children:C?C.message:"Sign in with Farcaster"}),e.jsx(ws,{children:C?C.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),P&&e.jsx(bo,{onClick:e=>{e.preventDefault(),window.location.href=P},children:"Open Warpcast app"})]})}):e.jsx(e.Fragment,{children:e.jsxs(Pc,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:A,fail:!!C}),e.jsx($c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx(vs,{children:C?C.message:"Signing in with Farcaster"}),e.jsx(ws,{children:C?C.detail:"This should only take a moment"}),e.jsx(Ws,{children:P&&o.isMobile&&e.jsx(fc,{text:"Take me to Warpcast",url:P,color:Tc})})]})]})}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:l?p:void 0,onClose:w},"header"),e.jsx(Ks,{}),e.jsx(Pc,{children:e.jsxs("div",{children:[e.jsx(vs,{children:"Sign in with Farcaster"}),e.jsx(ws,{children:"Scan with your phone's camera to continue."}),e.jsx(Hs,{children:P?e.jsx(jc,{url:P,size:275,squareLogoElement:$c}):e.jsx(vo,{})}),e.jsxs(Ws,{children:[e.jsx(ws,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),P&&e.jsx(yc,{text:P,itemName:"link",color:Tc})]})]})}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.AWAITING_FARCASTER_SIGNER]:()=>{let{lastScreen:t,navigateBack:r,data:n,app:i}=v.usePrivyModal(),{requestFarcasterSignerStatus:l,closePrivyModal:u}=s.usePrivyInternal(),[h,p]=a.useState(void 0),[y,m]=a.useState(!1),[f,g]=a.useState(!1),w=a.useRef([]),x=n?.farcasterSigner;a.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{if(!x?.public_key)return clearInterval(t),void p({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});"approved"===x.status&&(clearInterval(t),m(!1),g(!0),w.current.push(setTimeout((()=>u({shouldCallAuthOnSuccess:!1,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)));let r=await l(x?.public_key),n=Date.now()-e;"approved"===r.status?(clearInterval(t),m(!1),g(!0),w.current.push(setTimeout((()=>u({shouldCallAuthOnSuccess:!1,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS))):n>3e5?(clearInterval(t),p({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):"revoked"===r.status&&(clearInterval(t),p({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"===x?.status?x.signer_approval_url:void 0;return o.isMobile||y?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t?r:void 0,onClose:u},"header"),e.jsx(Ks,{}),o.isIOS?e.jsx(e.Fragment,{children:e.jsxs(Ic,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:f,fail:!!h}),e.jsx($c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx(vs,{children:h?h.message:"Add a signer to Farcaster"}),e.jsx(ws,{children:h?h.detail:"This will allow "+i.name+" to add casts, likes, follows, and more on your behalf."})]}),C&&e.jsx(bo,{onClick:e=>{e.preventDefault(),window.location.href=C},children:"Open Warpcast app"})]})}):e.jsx(e.Fragment,{children:e.jsxs(Nc,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:f,fail:!!h}),e.jsx($c,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx(vs,{children:h?h.message:"Requesting signer from Farcaster"}),e.jsx(ws,{children:h?h.detail:"This should only take a moment"}),e.jsx(Ws,{children:C&&o.isMobile&&e.jsx(fc,{text:"Take me to Warpcast",url:C,color:kc})})]})]})}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t?r:void 0,onClose:u},"header"),e.jsx(Ks,{}),e.jsx(Nc,{children:e.jsxs("div",{children:[e.jsx(vs,{children:"Add a signer to Farcaster"}),e.jsxs(ws,{children:["This will allow ",i.name," to add casts, likes, follows, and more on your behalf."]}),e.jsx(Hs,{children:"pending_approval"===x?.status?e.jsx(jc,{url:x.signer_approval_url,size:275,squareLogoElement:$c}):e.jsx(vo,{})}),e.jsxs(Ws,{children:[e.jsx(ws,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),"pending_approval"===x?.status&&e.jsx(yc,{text:x.signer_approval_url,itemName:"link",color:kc})]})]})}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.AWAITING_PASSKEY_SYSTEM_DIALOGUE]:()=>{let{lastScreen:t,currentScreen:r,navigateBack:n}=v.usePrivyModal(),{loginWithPasskey:i,closePrivyModal:o}=s.usePrivyInternal(),[l,u]=a.useState("loading"),[h,p]=a.useState(null),y=a.useRef([]);a.useEffect((()=>()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]}),[]);let m=async()=>{u("loading");try{await i(),u("success")}catch(e){p(e),u("error")}};return a.useEffect((()=>{"success"===l&&(e=>{y.current=[e,...y.current]})(setTimeout((()=>{o({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS))}),[l]),a.useEffect((()=>{m()}),[]),e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t&&r!==t?n:void 0}),e.jsxs(om,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:"success"===l,fail:"error"===l}),e.jsx(Pu,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx("h3",{children:(()=>{switch(l){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})()}),e.jsx("p",{style:{whiteSpace:"pre-wrap"},children:(()=>{switch(l){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.PrivyError){if(h.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(h.privyErrorCode===s.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()})]}),(()=>{switch(l){case"loading":case"success":return e.jsx(bo,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return e.jsx(bo,{onClick:m,disabled:!1,children:"Retry"})}})()]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.PHANTOM_INTERSTITIAL_SCREEN]:()=>{let{forkSession:t,ready:r,authenticated:n}=s.usePrivy(),{walletConnectionStatus:i}=s.usePrivyInternal(),[l,u]=a.useState(""),[h,p]=a.useState(!1);a.useEffect((()=>{r&&n&&t().then(u)}),[r,n]);let y=((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(!d.isPhantomInstalled()&&o.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${n}?ref=${n}`})(l,!h,"solana"===i?.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 r&&(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."),h&&(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.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(el,{title:m.title,description:m.description}),e.jsxs(Ds,{children:[e.jsx(sm,{children:e.jsx(Ga,{style:{width:"72px",height:"72px"}})}),e.jsx(jo,{href:y,onClick:()=>{setTimeout((()=>p(!0)),1e3)},loading:r&&!y,children:h?"Go to App Store":"Continue"}),m.footnote?e.jsx("p",{children:m.footnote}):null]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.LOGIN_FAILED_SCREEN]:()=>{let{closePrivyModal:t}=s.usePrivyInternal(),{navigate:r}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(zp,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),e.jsx(el,{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.jsxs(Ds,{children:[e.jsx(bo,{onClick:()=>r(v.ModalScreen.LANDING),children:"Try again"}),e.jsx(To,{onClick:()=>t(),children:"Cancel"})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.AWAITING_OAUTH_SCREEN]:()=>{let{authenticated:t,logout:r,ready:n,user:i}=s.usePrivy(),{app:o,setModalData:l,navigate:u,resetNavigation:p}=v.usePrivyModal(),{getAuthMeta:y,initLoginWithOAuth:m,loginWithOAuth:f,updateWallets:g,setReadyToTrue:w,closePrivyModal:x,createAnalyticsEvent:C}=s.usePrivyInternal(),[E,b]=a.useState(!1),[S,A]=a.useState(void 0),j=y()?.provider||"google",{name:$,component:T}=la(j),P=h.useEmitPrivyEvent();a.useEffect((()=>{f(j).then((e=>{b(!0),w(!0),e&&P("login","onOAuthLoginComplete",e)})).catch((e=>{if(w(!1),e?.privyErrorCode===s.PrivyErrorCode.ALLOWLIST_REJECTED)return A(void 0),p(),void u(v.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),A(void 0),p(),void u(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_DOES_NOT_EXIST)return A(void 0),p(),void u(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return A(void 0),p(),l({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:y()?.provider,embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,oAuthUserInfo:e.data?.data?.otherUser?.oAuthUserInfo}}),void u(v.ModalScreen.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=function(e,t){let r={detail:"",retryable:!1},n=Zi(t);if(e?.privyErrorCode===s.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode===s.PrivyErrorCode.INVALID_CREDENTIALS&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode===s.PrivyErrorCode.OAUTH_USER_DENIED&&(r.detail=`Retry and check ${n} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===s.PrivyErrorCode.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let e=la(t).name;r.detail=`Request limit reached for ${e}. Please wait a moment and try again.`}if(e?.privyErrorCode===s.PrivyErrorCode.OAUTH_ACCOUNT_SUSPENDED){let e=la(t).name;r.detail=`Your ${e} account is suspended. Please try another login method.`}return e?.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(r.detail="You cannot authorize more than one account for this user."),e?.privyErrorCode===s.PrivyErrorCode.OAUTH_UNEXPECTED&&t.startsWith("privy:")&&(r.detail="Something went wrong. Please try again."),r}(e,j);A({retryable:t,detail:r,message:"Authentication failed"})})).finally((()=>{ca()}))}),[$,j]),a.useEffect((()=>{if(n&&t&&E&&i){if(o?.legal.requireUsersAcceptTerms&&!i.hasAcceptedTerms){let e=setTimeout((()=>{u(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(i,o?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:j,screen:"OAuthStatusScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),u(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}{let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return g(),()=>clearTimeout(e)}}}),[n,t,E,i]);let _=E?`Successfully connected with ${$}`:S?S.message:`Verifying connection to ${$}`,k="";return k=E?"You’re good to go!":S?S.detail:"Just a few moments more",e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsx(Ks,{}),e.jsxs(am,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:E,fail:!!S}),e.jsx(T,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx("h3",{children:_}),e.jsx("p",{children:k})]}),S&&S?.retryable?e.jsx(_o,{onClick:()=>{ca(),m(j),A(void 0)},disabled:!E&&!S?.retryable,children:"Retry"}):null]}),e.jsx(Ys,{}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.CROSS_APP_AUTH_SCREEN]:()=>{let t=d.useAppConfig(),{data:r,navigate:n,setModalData:i,onUserCloseViaDialogOrKeybindRef:o}=v.usePrivyModal(),{crossAppAuthFlow:l,updateWallets:u,closePrivyModal:p,createAnalyticsEvent:y}=s.usePrivyInternal(),{logout:m}=c.useLogout(),[f,g]=a.useState({}),w=r?.crossAppAuth,x={id:w.appId,name:w.name,logoUrl:w.logoUrl},C=new s.PrivyClientError(`There was an issue connecting your ${x.name} account. Please try again.`),E=new Wi((async e=>{if(w.popup)try{let t=await l({appId:e,popup:w.popup,action:w.action});g({data:t})}catch(e){e instanceof s.PrivyClientError?g({error:e}):(e instanceof s.PrivyApiError&&w.popup&&w.popup.close(),g({error:C}))}else g({error:C})})),b=()=>{f.data&&(u(),w.onSuccess(f.data),p({shouldCallAuthOnSuccess:!0,isSuccess:!0})),w.onError(f.error??new s.PrivyClientError("User canceled flow")),p({shouldCallAuthOnSuccess:!1,isSuccess:!1})};o.current=b,a.useEffect((()=>{x.id.length&&E.execute(x.id)}),[x.id]),a.useEffect((()=>{if(!f.data)return;let e=f.data;if(t.legal.requireUsersAcceptTerms&&!e.hasAcceptedTerms){let e=setTimeout((()=>{n(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(e,t.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{i({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:`privy:${x.id}`,screen:"CrossAppAuthScreen"}}),m()},callAuthOnSuccessOnClose:!0}}),n(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}let r=setTimeout(b,d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(r)}),[f.data]);let{title:S,subtitle:A}=a.useMemo((()=>f.data?{title:`Successfully connected with ${x.name}`,subtitle:"You're good to go!"}:f.error?{title:"Authentication failed",subtitle:f.error.message}:{title:`Connecting to ${x.name}`,subtitle:`Please check the pop-up from ${x.name} to continue`}),[f,x.name]);return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:b}),e.jsx(Ks,{}),e.jsxs(Dl,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:!!f.data,fail:!!f.error}),e.jsx(Ul,{name:x.name,logoUrl:x.logoUrl})]})}),e.jsxs(zs,{children:[e.jsx("h3",{children:S}),e.jsx("p",{children:A})]})]}),e.jsx(Ys,{}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.ALLOWLIST_REJECTION_SCREEN]:()=>{let{navigate:t,app:r}=v.usePrivyModal(),n=r?.allowlistConfig.errorTitle||"You don't have access to this app",i=r?.allowlistConfig.errorDetail||"Have you been invited?",a=r?.allowlistConfig.errorCtaText||"Try another account";return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsxs(Ls,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(ns,{}),e.jsx(Fs,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),e.jsxs(Us,{children:["string"==typeof n?e.jsx("h3",{children:n}):e.jsx(e.Fragment,{children:n}),"string"==typeof i?e.jsx("p",{children:i}):e.jsx(e.Fragment,{children:i})]}),r?.allowlistConfig.errorCtaLink?e.jsx(bo,{as:"a",href:r.allowlistConfig.errorCtaLink,children:a}):e.jsx(bo,{onClick:()=>{t(v.ModalScreen.LANDING)},children:a})]})]})},[v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN]:()=>{let{navigate:t,app:r}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsxs(ts,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(Io,{color:"var(--privy-color-warn-light)"}),e.jsx(Le.default,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-warn)"})]})}),e.jsxs(rs,{children:[e.jsx("h3",{children:"Account not found"}),e.jsxs("p",{children:["Please try logging in again or go to ",r.name," to create an account."]})]}),e.jsx(zo,{}),e.jsx(bo,{onClick:()=>t(v.ModalScreen.LANDING),children:"Try logging in again"})]})]})},[v.ModalScreen.USER_LIMIT_REACHED_SCREEN]:()=>{let{navigate:t}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsxs(Df,{children:[e.jsx(Wf,{children:e.jsx(Uf,{})}),e.jsxs(Bf,{children:[e.jsx("h3",{children:"Unable to sign in"}),e.jsx("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),e.jsx(bo,{onClick:()=>{t(v.ModalScreen.LANDING)},children:"Go back"})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.INSTALL_PHANTOM_SCREEN]:()=>{let{navigateBack:t}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t},"header"),e.jsx(Ks,{}),e.jsx(up,{}),e.jsx(Ys,{}),e.jsxs(c.ModalFooter,{children:[e.jsx("span",{children:"Still not sure? "}),e.jsx("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},[v.ModalScreen.LINK_EMAIL_SCREEN]:()=>{let{app:t}=v.usePrivyModal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(tl,{title:"Connect your email",description:`Add your email to your ${t?.name} account`,icon:e.jsx(Ve.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Ds,{children:e.jsx(vp,{stacked:!0})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.LINK_PHONE_SCREEN]:()=>{let{app:t,currentScreen:r,data:n,navigate:i,setModalData:a}=v.usePrivyModal(),{initLoginWithSms:o}=s.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(tl,{title:"Connect your phone",description:`Add your number to your ${t?.name} account`,icon:e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),e.jsx(Ds,{children:e.jsx(Ap,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{await o(e),i(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){a({errorModalData:{error:e,previousScreen:n?.errorModalData?.previousScreen||r||v.ModalScreen.LINK_PHONE_SCREEN}}),i(v.ModalScreen.ERROR_SCREEN)}},hideRecent:!0})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.LINK_WALLET_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?e.jsxs("span",{children:["Link the wallet with address ",e.jsx(c.Address,{showCopyIcon:!1,address:n})," ",t?.name?`to ${t.name}.`:"."]}):`Link a wallet to your ${t?.name} account`;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(el,{title:"Link your wallet",description:i}),e.jsx(Ko,{children:e.jsx(Nl,{connectOnly:!1})}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.LINK_PASSKEY_SCREEN]:()=>{let{user:t,unlinkPasskey:r}=s.usePrivy(),{linkWithPasskey:n,closePrivyModal:i}=s.usePrivyInternal(),o=t?.linkedAccounts.filter((e=>"passkey"===e.type)),[l,d]=a.useState(!1),[u,h]=a.useState(""),[p,y]=a.useState(!1),[m,f]=a.useState(!1);a.useEffect((()=>{0===o.length&&f(!1)}),[o.length]);let g=async e=>(d(!0),await r(e).then((()=>y(!0))).catch((e=>{e instanceof s.PrivyError&&e.privyErrorCode===s.PrivyErrorCode.MISSING_MFA_CREDENTIALS?h("Cannot unlink a passkey enrolled in MFA"):h("Unknown error occurred.")})).finally((()=>{d(!1)})));return p?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:()=>i()},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(dt.default,{})}),e.jsx(Fu,{style:{marginBottom:"1.5rem"},children:"Passkeys updated"}),e.jsx(Lu,{children:" "}),e.jsx(Ss,{children:e.jsx(bo,{onClick:()=>i(),children:"Done"})}),e.jsx(c.ModalFooter,{})]}):m?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:()=>f(!1),onClose:()=>i()},"header"),e.jsx(_u,{passkeys:o,expanded:m,onUnlink:g,onExpand:()=>f(!0)}),e.jsx(c.ModalFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:()=>i()},"header"),e.jsx(gs,{children:e.jsxs(Nu,{children:[e.jsx(Tu,{}),e.jsx(Pu,{})]})}),e.jsx(Fu,{children:"Secure your account with a passkey"}),e.jsx(Uu,{}),0===o.length?e.jsx(ku,{}):e.jsx(_u,{passkeys:o,expanded:m,onUnlink:g,onExpand:()=>f(!0)}),e.jsxs(Ss,{style:{marginTop:"12px"},children:[u&&e.jsx(Iu,{$fail:!0,children:u}),e.jsx(bo,{onClick:()=>{d(!0),n().then((()=>y(!0))).catch((e=>{if(e instanceof s.PrivyError){if(e.privyErrorCode===s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return void h("Cannot link more passkeys to account.");if(e.privyErrorCode===s.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return void h("Passkey request timed out or rejected by user.")}h("Unknown error occurred.")})).finally((()=>{d(!1)}))},loading:l,children:"Add new passkey"})]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.UPDATE_EMAIL_SCREEN]:()=>e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(tl,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:e.jsx(Ve.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Ds,{children:e.jsx(Rf,{stacked:!0})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]}),[v.ModalScreen.UPDATE_PHONE_SCREEN]:()=>{let{currentScreen:t,data:r,navigate:n,setModalData:i}=v.usePrivyModal(),{user:a}=s.usePrivy(),{initUpdatePhone:o}=s.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Ks,{}),e.jsx(tl,{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:e.jsx(Ke.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),e.jsx(Ds,{children:e.jsx(Ap,{stacked:!0,onSubmit:async function({qualifiedPhoneNumber:e}){try{if(!a?.phone?.number)throw Error("User is required to have an phone number to update it.");await o(a?.phone?.number,e),n(v.ModalScreen.AWAITING_PASSWORDLESS_CODE)}catch(e){i({errorModalData:{error:e,previousScreen:r?.errorModalData?.previousScreen||t||v.ModalScreen.LINK_PHONE_SCREEN}}),n(v.ModalScreen.ERROR_SCREEN)}},hideRecent:!0})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.CONNECT_ONLY_LANDING_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?e.jsxs("span",{children:["Connect the wallet with address ",e.jsx(c.Address,{showCopyIcon:!1,address:n})," ",t?.name?`to ${t.name}.`:"."]}):`Connect a wallet to your ${t?.name} account`;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(Qs,{title:"Connect your wallet",description:i}),e.jsx(Ko,{children:e.jsx(Nl,{connectOnly:!0})}),t&&e.jsx(c.TermsAndConditions,{app:t,alwaysShowImplicitConsent:!0}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.CONNECT_ONLY_AUTHENTICATED_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),n=r?.externalConnectWallet?.suggestedAddress,i=n?`Connect the wallet with address ${d.formatWalletAddress(n)} ${t?.name?`to ${t.name}.`:"."}`:`Connect a wallet to ${t?.name}`;return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(el,{title:"Connect your wallet",description:i}),e.jsx(Ko,{children:e.jsx(Nl,{connectOnly:!0})}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN]:()=>{let{app:t,setModalData:r,navigate:n,data:i,onUserCloseViaDialogOrKeybindRef:o}=v.usePrivyModal(),[l,c]=a.useState(""),{embeddedWallets:u}=d.useAppConfig(),{authenticated:h,user:p}=s.usePrivy(),{closePrivyModal:y}=s.usePrivyInternal(),{onSuccess:m,onFailure:f,callAuthOnSuccessOnClose:g}=i.createWallet,w=!0===t?.embeddedWallets.requireUserOwnedRecoveryOnCreate,{createWallet:x}=vd(),[C,E]=a.useState(null),b=new Wi((async()=>{try{let e=await x({user:p});if(!e)return;E(e),n(v.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN)}catch(e){c(e.message)}}));return a.useEffect((()=>h&&p?w?(r({...i,recoverySelection:{...i?.recoverySelection,isInAccountCreateFlow:!0}}),n(ad({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:u.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void b.execute():(n(v.ModalScreen.LANDING),void f(Error("User must be authenticated before creating a Privy wallet")))),[w,h]),o.current=()=>null,l?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{closeable:!1}),e.jsxs(Gs,{children:[e.jsx(Ze.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(tl,{title:"Something went wrong",description:l})]}),e.jsx(bo,{onClick:()=>{C?(m(C),y({shouldCallAuthOnSuccess:g})):(f(new s.PrivyEmbeddedWalletError("User wallet creation failed")),y({shouldCallAuthOnSuccess:!1}))},children:"Close"}),e.jsx(wd,{})]}):e.jsx(Gl,{})},[v.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN]:()=>{let{user:t}=s.usePrivy(),{closePrivyModal:r,isNewUserThisSession:n,updateWallets:i}=s.usePrivyInternal(),{app:o,data:l,onUserCloseViaDialogOrKeybindRef:u}=v.usePrivyModal(),{onSuccess:p,onFailure:y,callAuthOnSuccessOnClose:m}=l.createWallet,f=()=>{let e=h.getPrivyEthereumWallet(t);e?(i(),p(e)):y(Error("Failed to create wallet")),r({shouldCallAuthOnSuccess:m})};return a.useEffect((()=>{let e=setTimeout(f,d.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS);return()=>clearTimeout(e)}),[]),u.current=f,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:f}),e.jsx(Ks,{}),e.jsxs(Gs,{children:[e.jsx(Ye.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),e.jsx(tl,{title:n?"Welcome"+(o?.name?` to ${o?.name}`:""):"All set!",description:n?"You’ve successfully created an account.":"Your account is secured."})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN]:()=>{let{authenticated:t,user:r,getAccessToken:n}=s.usePrivy(),{closePrivyModal:i,createAnalyticsEvent:o,walletProxy:l}=s.usePrivyInternal(),{navigate:d,data:c,setModalData:u,onUserCloseViaDialogOrKeybindRef:p}=v.usePrivyModal(),y=a.useMemo((()=>Date.now()),[]),[m,f]=a.useState(!1),{onCompleteNavigateTo:g,onFailure:w,shouldForceMFA:x,address:C}=c?.connectWallet,E=e=>{m||(f(!0),w("string"==typeof e?Error(e):e))};a.useEffect((()=>{let e,a=C?r?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.address===C)):h.getPrivyEthereumWallet(r);return t&&a?l?((async()=>{let t=await n();if(!t)return E("User must be authenticated and have a Privy wallet before it can be connected");let r="ethereum"===a.chainType;try{r?await l.connect({accessToken:t,address:a.address}):await l.connectSolana({accessToken:t,publicKey:a.address}),x&&await l.verifyMfa({accessToken:t});let n=(Date.now()-y)/1e3;g===v.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN&&n<1?e=setTimeout((()=>{d(g,!1)}),1e3*(1-n)):d(g,!1)}catch(e){if(Jl(e)&&"privy"===a.recoveryMethod){let e=await n();if(!e)return E("User must be authenticated and have a Privy wallet before it can be recovered");try{if(o({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:a.address}}),r){let t=await(l?.recover({address:a.address,accessToken:e,recoveryMethod:a.recoveryMethod}));t?.address||E(Error("Unable to recover wallet"))}else{let t=await(l?.recoverSolana({publicKey:a.address,accessToken:e}));t?.publicKey||E(Error("Unable to recover wallet"))}g?d(g):i({shouldCallAuthOnSuccess:!1}),o({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:a.address}}),d(g)}catch(e){E("An error has occurred, please try again.")}}else Jl(e)&&"privy"!==a.recoveryMethod?(u({...c,recoverWallet:{privyWallet:a,onCompleteNavigateTo:g,onFailure:w},recoveryOAuthStatus:{provider:a.recoveryMethod,action:"recover",isInAccountCreateFlow:!1}}),d(od(a.recoveryMethod))):E(e)}})(),()=>clearTimeout(e)):void 0:E("User must be authenticated and have a Privy wallet before it can be connected")}),[t,r,l]);let b=()=>{E("User exited before wallet could be connected"),i({shouldCallAuthOnSuccess:!1})};return p.current=b,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:b}),m?e.jsxs(e.Fragment,{children:[e.jsxs(Gs,{children:[e.jsx(Ze.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),e.jsx(tl,{title:"Something went wrong",description:"We’re on it. Please try again later."})]}),e.jsx(bo,{onClick:()=>i({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):e.jsx(Gl,{}),e.jsx(dd,{})]})},[v.ModalScreen.EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN]:()=>{let[t,r]=a.useState(!0),{authenticated:n,getAccessToken:i}=s.usePrivy(),{walletProxy:o,closePrivyModal:l,createAnalyticsEvent:d}=s.usePrivyInternal(),{navigate:u,data:h,onUserCloseViaDialogOrKeybindRef:p}=v.usePrivyModal(),[y,m]=a.useState(void 0),[f,g]=a.useState(""),[w,x]=a.useState(!1),{privyWallet:C,onCompleteNavigateTo:E,onSuccess:b,onFailure:S}=h.recoverWallet,A=(e="User exited before their wallet could be recovered")=>{l({shouldCallAuthOnSuccess:!1}),S("string"==typeof e?new s.PrivyEmbeddedWalletError(e):e)};p.current=A,a.useEffect((()=>{if(!n||!C)return A("User must be authenticated and have a Privy wallet before it can be recovered")}),[n]);return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A}),e.jsx(Ks,{}),e.jsxs(dm,{children:[e.jsxs(lm,{children:[e.jsx(xt.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Enter your password"}),e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),e.jsxs("div",{children:[e.jsxs($d,{children:[e.jsx(Ad,{type:t?"password":"text",onChange:e=>(e=>{e&&m(e)})(e.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),e.jsx(Nd,{style:{right:"0.75rem"},children:t?e.jsx(Md,{onClick:()=>r(!1)}):e.jsx(Od,{onClick:()=>r(!0)})})]}),!!f&&e.jsx(cm,{children:f})]}),e.jsxs("div",{children:[e.jsxs(Vs,{children:[e.jsx("h4",{children:"Why is this necessary?"}),e.jsx("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),e.jsx(um,{loading:w||!o,disabled:!y,onClick:async()=>{x(!0);let e=await i();if(!e||!C||null===y)return A("User must be authenticated and have a Privy wallet before it can be recovered");try{d({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:C.address}}),await(o?.recover({address:C.address,accessToken:e,recoveryPin:y,recoveryMethod:C.recoveryMethod})),g(""),E?u(E):l({shouldCallAuthOnSuccess:!1}),b?.(C),d({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:C.address}})}catch(e){!function(e){return Xl(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?g("An error has occurred, please try again."):g("Invalid recovery password, please try again.")}finally{x(!1)}},warn:!1,hideAnimations:!C&&w,children:"Recover your account"})]})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN]:()=>{let[t,r]=a.useState(!1),{navigate:n,lastScreen:i,navigateBack:o,setModalData:l,data:u,onUserCloseViaDialogOrKeybindRef:p}=v.usePrivyModal(),{user:y}=s.usePrivy(),{embeddedWallets:m}=d.useAppConfig(),{closePrivyModal:f}=s.usePrivyInternal(),g=h.getPrivyEthereumWallet(y),w=null===g,{isInAccountCreateFlow:x,isResettingPassword:C}=u.recoverySelection,E=g&&"privy"!==g.recoveryMethod,b=E?e.jsxs("span",{children:["Your account is currently secured using"," ",e.jsx("strong",{children:vm[g?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function S(e){l({recoveryOAuthStatus:{provider:e,action:w?"create-wallet":"set-recovery",isInAccountCreateFlow:x}}),n(v.ModalScreen.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN)}function A(){u?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),f({shouldCallAuthOnSuccess:u?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return p.current=A,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A,backFn:t?()=>r(!1):i?o:void 0,infoFn:i||t?void 0:()=>r(!0)},"header"),t?e.jsx(wm,{onClose:()=>r(!1)}):e.jsxs(e.Fragment,{children:[e.jsx(tl,{title:E?"Update backup method":"Secure your account",icon:e.jsx(_t.default,{width:48}),description:b}),e.jsx(ym,{children:m.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(g?.recoveryMethod||"")||e!==g?.recoveryMethod)).sort().map((t=>{switch(t){case"google-drive":return e.jsxs(Jo,{onClick:()=>S("google-drive"),children:[e.jsx(gm,{children:e.jsx(pm,{style:{width:18}})}),"Back up to Google Drive"]},t);case"icloud":return e.jsxs(Jo,{onClick:()=>S("icloud"),children:[e.jsx(gm,{children:e.jsx(hm,{style:{width:24}})}),"Back up to Apple iCloud"]},t);case"user-passcode":return e.jsxs(Jo,{onClick:()=>{n(id({isCreatingWallet:w,skipSplashScreen:!0}))},children:[e.jsx(gm,{children:e.jsx(kt.default,{style:{width:18}})}),C?"Reset your":"Set a"," password"]},t);default:return null}}))})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN]:()=>{let{user:t,getAccessToken:r}=s.usePrivy(),n=h.getPrivyEthereumWallet(t),{walletProxy:i,refreshUser:o,closePrivyModal:l}=s.usePrivyInternal(),u=v.usePrivyModal(),[p,y]=a.useState(!1),[m,f]=a.useState(null),[g,w]=a.useState(null);function x(){if(!p){if(g)return u.data?.setWalletPassword?.onFailure(g),void l();if(!m)return u.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void l()}}u.onUserCloseViaDialogOrKeybindRef.current=x;let C=!(!p&&!m);return g?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:x},"header"),e.jsx(xm,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:e.jsx(Be.default,{height:38,width:38,stroke:"var(--privy-color-error)"})}),e.jsx(pd,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),e.jsx(zo,{style:{minHeight:"2rem"}}),e.jsx(So,{onClick:()=>w(null),children:"Try again"}),e.jsx(c.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:x},"header"),e.jsx(_t.default,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),e.jsx(pd,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),e.jsx(hd,{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."}),e.jsx(zo,{style:{minHeight:"2rem"}}),e.jsx(So,{loading:p,disabled:C,onClick:()=>async function(){y(!0);try{let e=await r();if(!e||!i||!n)return;if(!(await i.setRecovery({recoveryMethod:"privy",address:n.address,accessToken:e})).address)throw Error("Unable to set recovery on wallet");let t=await o();if(!t)throw Error("Unable to set recovery on wallet");let a=h.getPrivyEthereumWallet(t);if(!a)throw Error("Unabled to set recovery on wallet");f(!!t),setTimeout((()=>{u.data?.setWalletPassword?.onSuccess(a),l()}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}catch(e){w(e)}finally{y(!1)}}(),children:m?"Success":"Confirm"}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN]:()=>{let{logout:t}=s.usePrivy(),{navigate:r,setModalData:n,data:i}=v.usePrivyModal(),{recoveryOAuthFlow:o,closePrivyModal:l,createAnalyticsEvent:u}=s.usePrivyInternal(),[h,p]=a.useState(!1),{provider:y,action:m,isInAccountCreateFlow:f}=i?.recoveryOAuthStatus,[g,w]=a.useState(void 0),[x,C]=a.useState("create-wallet"===m);if("user-passcode"===y)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let E=fm[y].name,b=fm[y].component,S=i?.recoverWallet?.onCompleteNavigateTo,A=new Wi((async(e="create-wallet")=>(C(!0),new Promise(((t,r)=>{setTimeout((async()=>{try{let r=window.open();await o(y,e,r),p(!0),t()}catch(t){w({message:`${"recover"===e?"Recovery":"Back up"} with ${E} unsuccessful`,detail:"recover"===m?`Please verify that you are selecting the ${E} account associated with your backup.`:"",retryable:!0}),r()}}),0)})))));a.useEffect((()=>{"recover"!==m&&A.execute(f?"create-wallet":"set-recovery")}),[]),a.useEffect((()=>{if(!h)return;let e=setTimeout((()=>{f?(n({createWallet:{onSuccess:()=>{},onFailure:e=>{u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),r(v.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN)):l({shouldCallAuthOnSuccess:!1})}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}),[h]);let j=a.useCallback((async()=>{await A.execute("recover"),S?r(S):p(!0)}),[]),$="google-drive"===y?"Google Drive":"Apple iCloud",T=h&&`Successfully ${"recover"===m?"recovered":"backed up"} with ${$}.`||g&&g.message||`${"recover"===m?"Recovering":"Backing up"} with ${$}...`,P=g?g.detail:"";return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),x?e.jsx(e.Fragment,{children:e.jsxs(ym,{children:[e.jsx(tl,{title:T,icon:e.jsx(b,{style:{width:"38px",height:"38px"}}),description:P}),g&&g?.retryable?e.jsx(bo,{onClick:()=>{ca(),w(void 0),"create-wallet"===m?A.execute("create-wallet"):j()},disabled:!h&&!g?.retryable,children:"Try again"}):null]})}):e.jsxs(ym,{children:[e.jsx(tl,{title:"Confirm it's really you",icon:e.jsx(b,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${$} where your account is backed up.`}),e.jsxs(bo,{onClick:j,children:["Confirm with ",$]})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN]:()=>{let[t,r]=a.useState(null),{authenticated:n,user:i,getAccessToken:o}=s.usePrivy(),{closePrivyModal:l,createAnalyticsEvent:u,clientAnalyticsId:h}=s.usePrivyInternal(),p=d.useAppConfig(),{data:y,onUserCloseViaDialogOrKeybindRef:m}=v.usePrivyModal(),{onFailure:f,onSuccess:g,origin:w,appId:x,appClientId:C,wallet:E}=y.keyExport,b=e=>{l({shouldCallAuthOnSuccess:!1}),f("string"==typeof e?Error(e):e)},S=()=>{l({shouldCallAuthOnSuccess:!1}),g(),u({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:E.address}})};return a.useEffect((()=>{if(!n||!E)return b("User must be authenticated before exporting their wallet");o().then(r,b)}),[n,i]),m.current=S,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:S}),e.jsxs(md,{children:[e.jsx(pd,{children:"Transfer wallet"}),e.jsxs(hd,{children:["Either copy your private key or seed phrase to transfer your wallet."," ",e.jsx("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),e.jsx(cd,{theme:p.appearance.palette.colorScheme,children:"Never share your private key or seed phrase with anyone."}),e.jsx(c.WalletInfoCard,{isLoading:!1,isPulsing:!1,title:"Your wallet",address:E.address,showIcon:!0}),e.jsx("div",{style:{width:"100%"},children:t&&e.jsx(yd,{origin:w,appId:x,appClientId:C,accessToken:t,clientAnalyticsId:h,wallet:E,dimensions:{height:"44px"}})})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN]:()=>{let{authenticated:t}=s.usePrivy(),{initializeWalletProxy:r,closePrivyModal:n}=s.usePrivyInternal(),{navigate:i,data:o,onUserCloseViaDialogOrKeybindRef:l}=v.usePrivyModal(),[u,h]=a.useState(!0),[p,y]=a.useState(""),[m,g]=a.useState(),[w,x]=a.useState(null),[C,E]=a.useState(!1),b=null!==w;a.useEffect((()=>{t||i(v.ModalScreen.LANDING)}),[t]),a.useEffect((()=>{r(d.WALLET_PROXY_TIMEOUT).then((e=>{h(!1),e||(y("An error has occurred, please try again."),g(new f.PrivyProviderRpcError(new f.ProviderRpcError(p,f.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:S,data:A,confirmAndSign:j,onSuccess:$,onFailure:T,uiOptions:P}=o.signMessage,_={title:P.title||"Sign message",description:P.description||"Signing this message will not cost you any fees.",buttonText:P.buttonText||"Sign and continue"},k=e=>{e?$(e):T(m||new f.PrivyProviderRpcError(new f.ProviderRpcError("The user rejected the request.",f.E.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{x(null),y(""),g(void 0)}),200)};return l.current=()=>{k(w)},e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:()=>k(w)}),e.jsx(Ks,{}),P.iconUrl&&"string"==typeof P.iconUrl?e.jsx(If,{children:e.jsx(Sf,{size:"sm",src:P.iconUrl,alt:"app image"})}):null,e.jsx(pd,{children:_.title}),e.jsx(hd,{children:_.description}),"personal_sign"===S&&e.jsx(Pf,{children:Af(A)}),"eth_signTypedData_v4"===S&&e.jsx(Tf,{typedData:A}),"solana_signMessage"===S&&e.jsx(Pf,{children:A}),e.jsx(Mf,{}),e.jsx(kf,{$fail:!0,children:p}),e.jsx(So,{disabled:C||b||u,loading:C,onClick:async()=>{E(!0),y("");try{let e=await j();x(e),E(!1),setTimeout((()=>{k(e)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}catch(e){console.error(e),y("An error has occurred, please try again."),g(new f.PrivyProviderRpcError(new f.ProviderRpcError(p,f.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),E(!1)}},children:C?"Signing...":b?e.jsxs(Nf,{children:[e.jsx(pc,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",e.jsx("span",{children:"Success"})]}):_.buttonText}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN]:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:i}=v.usePrivyModal(),{rpcConfig:o,chains:l,closePrivyModal:u,walletProxy:h}=s.usePrivyInternal(),{getAccessToken:p,user:y}=s.usePrivy(),m=d.useAppConfig(),[g,w]=a.useState(0),x=(e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(t),[C,E]=a.useState(((e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0)(t,g)),[b,S]=a.useState(null),[A,j]=a.useState(),[$,T]=a.useState(!1),[P,_]=a.useState(null),[k,N]=a.useState(null);if(!C||!t?.sendTransaction||!t?.sendTransaction.transactingWallet)return e.jsx(cc,{error:Error("Invalid transaction request"),onClick:()=>{t?.sendTransaction?.onFailure(bf),u({shouldCallAuthOnSuccess:!1})}});let I=t.sendTransaction.rootWallet,M=t.sendTransaction.transactingWallet,O=a.useMemo((()=>l.find((e=>Number(e.id)===Number(C.chainId)))),[C.chainId]),R=O?.nativeCurrency.symbol??"ETH",{action:F,amount:L,spender:U,isErc20Ish:D}=a.useMemo((()=>(e=>{let t=xf(e);if(t)return{action:"approve",isErc20Ish:!0,functionName:t.functionName,spender:t.args[0],amount:t.args[1]};let r=Cf(e);return r?{action:"transfer",isErc20Ish:!0,functionName:r.functionName,amount:r.args[1]}:{action:"transaction",isErc20Ish:!1}})(C.data)),[C.data]);a.useEffect((()=>{C.to&&O&&D&&Ch({address:C.to,chain:O,rpcConfig:m.rpcConfig,privyAppId:m.id}).then(S).catch(console.error)}),[C.to,O]);let{tokenPrice:W,isTokenPriceLoading:B}=Wc(C.chainId),H=a.useMemo((()=>d.getJsonRpcProvider(Number(C.chainId),l,o,{appId:m.id})),[C.chainId,o]),G=Ef(C,M,H);a.useEffect((()=>{t.sendTransaction?.getIsSponsored?t.sendTransaction.getIsSponsored().then(j).catch(console.error):j(!1)}),[t.sendTransaction.getIsSponsored]);let q=()=>{if(!$)return P?t?.sendTransaction?.onSuccess(P.response):k||G?.errors[0]?t?.sendTransaction?.onFailure(k??G?.errors[0]??bf):t?.sendTransaction?.onFailure(new f.PrivyProviderRpcError(new f.ProviderRpcError("The user rejected the request",f.E.E4001_USER_REJECTED_REQUEST.eipCode))),u({shouldCallAuthOnSuccess:!1})};r.current=q;let z=!!(m.fundingConfig&&m.fundingConfig.methods.length>0&&t.funding),V="fiat-currency"===m.embeddedWallets.priceDisplay.primary,K=c.i(G?.tx.value??0).add(c.i(G?.totalGasEstimate?.toBigInt()??0)).toHexString(),Y=c.getNativeCurrencyFromWei(K,R),Z=V&&W?c.getDollarsFromWei(K,W):void 0,X=c.getNativeCurrencyFromWei(G?.totalGasEstimate?.toString()??0,R),J=V&&W?c.getDollarsFromWei(G?.totalGasEstimate?.toString()??0,W):void 0,Q=c.getNativeCurrencyFromWei(G?.balance?.toString()??0,R,void 0,!0),ee=V&&W?c.getDollarsFromWei(G?.balance?.toString()??0,W):void 0,te=t.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===F?"Confirm address":`Approve ${F}`),re=t.sendTransaction?.uiOptions?.description||`${m.name} wants your permission to approve the following transaction.`,ne=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,ie=!(!G||G.errors[0]||G.hasFunds||!1!==A),ae=ie&&z,oe=ae?"Add funds":t.sendTransaction?.uiOptions?.buttonText||(g<x?"Continue":"Approve");if(P?.receipt)return e.jsx(gf,{txn:G?.tx??C,onClose:q,receipt:P.receipt,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,tokenPrice:W,tokenSymbol:R,l1GasEstimate:G?.l1ExecutionFeeEstimate?.toString(),receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription});if(k)return e.jsx(Wm,{transactionError:k,network:"ethereum",chainId:G?.tx.chainId??C.chainId,onClose:q,onRetry:({resetNonce:e})=>{N(null);let t={...G?.tx??C};e&&(t.nonce=void 0),E(t)}});let se=0!==x&&"number"==typeof g&&0!==g?()=>{w(g-1)}:void 0;return e.jsx(Nm,{transactionIndex:g,onBack:se,maxIndex:x,disabled:ie&&!z,isSubmitting:$,submitError:k,isPreparing:!G,isTokenPriceLoading:B,isTokenContractInfoLoading:!b,prepareError:G?.errors[0],symbol:b?.symbol,chain:O,img:ne,title:te,subtitle:re,spender:U,total:C.value?Z??Y:void 0,txValue:C.value,fee:J??X,isSponsored:A,to:C.to,network:m.chains.find((e=>e.id===C.chainId))?.name??"",from:M?.address??"",cta:oe,missingFunds:ie,action:F,balance:ee??Q,amount:L&&b?uu({amount:L,decimals:b.decimals}):L,onClose:q,onClick:ae?async()=>{if(!M)return;if(!z)throw Error("Funding wallet is not enabled");let e=_m({fundingMethods:m.fundingConfig.methods});n({...t,funding:{...t.funding,methodScreen:e}}),i(e)}:async()=>{if(g<x)w(g+1);else{T(!0);try{let e=await p();if($||!e||!M||!h||!y)return;let r=t?.sendTransaction?.onConfirm?await t.sendTransaction.onConfirm().then((e=>H.getTransaction(e))):await pf({accessToken:e,transactingWallet:M,rootWallet:I,walletProxy:h,transactionRequest:G?.tx??C,provider:H,requesterAppId:t.sendTransaction?.requesterAppId}),n=await r.wait();_({receipt:mf(n),response:r})}catch(e){console.warn({transaction:G?.tx??C,error:e}),N(e)}finally{T(!1)}}}})},[v.ModalScreen.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN]:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:i}=v.usePrivyModal(),{closePrivyModal:o,walletProxy:l}=s.usePrivyInternal(),c=d.useAppConfig(),{user:u,getAccessToken:h}=s.usePrivy(),[p,y]=a.useState(t?.sendSolanaTransaction?.transactionRequest),[m,f]=a.useState(),[g,w]=a.useState(),[x,C]=a.useState(0),[E,b]=a.useState(!1),[S,A]=a.useState(),[j,$]=a.useState(null),T=t?.sendSolanaTransaction?.connection,P=t?.sendSolanaTransaction?.transactingWallet,_=m?.instructions.at(x),k=m?.instructions.length??1,N=Hc(T?.rpcEndpoint||"");if(a.useEffect((()=>{!async function(){if(p&&T)try{w(void 0);let e=await eu(p,T);f(e),C(0)}catch(e){console.warn("Failed to prepare transaction",e),w(e)}}()}),[p,T]),!(p&&t?.sendSolanaTransaction&&P&&T)){let r=Error("Invalid transaction request");return e.jsx(cc,{error:r,onClick:()=>{t?.sendSolanaTransaction?.onFailure(r),o({shouldCallAuthOnSuccess:!1})}})}let{solPrice:I,isSolPriceLoading:M}=Dc(),O=()=>{if(!E)return S?t?.sendSolanaTransaction?.onSuccess(S):(t?.sendSolanaTransaction?.onFailure(j??g??Error("User exited the modal before submitting the transaction")),C(0)),o({shouldCallAuthOnSuccess:!1})};r.current=O;let R="fiat-currency"===c.embeddedWallets.priceDisplay.primary,F=t.sendTransaction?.uiOptions?.transactionInfo?.title||("approve"===_?.action?"Confirm address":"Approve transaction"),L=t.sendTransaction?.uiOptions?.description||`${c.name} wants your permission to approve the following transaction.`,U=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,D=_?.amount||0n,W=0===x&&m?.fees||0n,B=_?.balance||0n,H=_?.from,G=_?.to,q=D+W,z=Vc(q),V=R&&I?Kc(q,I):void 0,K=W?Vc(W):void 0,Y=R&&I?Kc(W,I):void 0,Z=B?Vc(B):void 0,X=R&&I?Kc(B,I):void 0,J=!g&&!_?.hasFunds,Q=!!(c.fundingConfig&&c.fundingConfig.methods.length>0&&t.funding),ee=J&&Q,te=ee?"Add funds":t.sendTransaction?.uiOptions?.buttonText||"Approve";return S?e.jsx(uf,{instructions:m?.instructions.map((({from:e,to:t,amount:r})=>({from:e.toBase58(),to:t.toBase58(),amount:r})))??[],fees:0===x?S.fees:0n,onClose:O,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,solPrice:I,receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription,rpcEndpoint:T.rpcEndpoint}):j?e.jsx(Wm,{transactionError:j,connection:T,onClose:O,network:"solana",onRetry:async()=>{$(null);let{blockhash:e}=await T.getLatestBlockhash();je.isVersionedTransaction(p)?p.message.recentBlockhash=e:p.recentBlockhash=e,y(p)}}):e.jsx(Nm,{isSubmitting:E,submitError:j,isPreparing:!m,isTokenPriceLoading:M,isTokenContractInfoLoading:!1,symbol:"SOL",chain:void 0,img:U,title:F,subtitle:L,from:H?.toBase58()||"",to:G?.toBase58(),fee:Y??K,total:null!=D?V??z:void 0,txValue:D,spender:_?.spender?.toBase58(),network:N,cta:te,missingFunds:J,action:_?.action,balance:X??Z,prepareError:g,chainName:"Solana",onClose:O,onClick:ee?async()=>{if(!P)return;if(!Q)throw Error("Funding wallet is not enabled");let e=_m({fundingMethods:c.fundingConfig.methods});n({...t,funding:{...t.funding,methodScreen:e}}),i(e)}:async()=>{if(x<(m?.instructions.length??1)-1)C(x+1);else try{b(!0);let e=await h();if(E||!e||!P||!l||!u)return;let{signature:r,receipt:n}=await Em({tx:p,accessToken:e,connection:T,walletProxy:l,transactingWalletAddress:P.address,transactionOptions:t.sendSolanaTransaction?.transactionOptions});A(Qc(r,n))}catch(e){console.warn({transaction:p,error:e}),$(e)}finally{b(!1)}},isSponsored:!1,transactionIndex:x,maxIndex:k-1,disabled:J&&!Q,onBack:x>0&&k>1?()=>C(x-1):void 0})},[v.ModalScreen.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),{closePrivyModal:n}=s.usePrivyInternal(),[i,o]=a.useState(!1),[l,u]=a.useState(),h=async()=>{i?r?.delegatedActions?.onSuccess():r?.delegatedActions?.onError(l??new s.PrivyClientError("User declined delegating actions.")),n({shouldCallAuthOnSuccess:!1})};return a.useEffect((()=>{if(!i&&!l)return;let e=setTimeout(h,d.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS);return()=>clearTimeout(e)}),[i,l]),i||l?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:h}),e.jsx(Ks,{}),e.jsxs(Bs,{children:[l?e.jsx(P.ExclamationCircleIcon,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}):e.jsx(P.CheckCircleIcon,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(Xs,{height:20}),e.jsx(tl,{title:l?"Something went wrong":"Success!",description:l?"Please try again.":"You've successfully delegated actions."})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{closeable:!0,onClose:h}),e.jsx(Wl,{width:56,height:56,style:{margin:"auto"}}),e.jsx(vs,{style:{marginTop:24},children:"Enable delegated actions"}),e.jsxs(ws,{children:["Give ",t.name," permissions to transact on your behalf. You can revoke this later."," ",e.jsx("a",{style:{color:"var(--privy-color-accent-dark)"},href:"https://www.privy.io/using-privy",target:"_blank",children:"Learn more"})]}),e.jsx(Hl,{showIcon:!0,address:r?.delegatedActions?.address??"",title:"Wallet",isLoading:!1}),e.jsxs(Bl,{style:{marginTop:24},children:[e.jsx(To,{onClick:h,children:"No thanks"}),e.jsx(bo,{onClick:async()=>{try{await(r?.delegatedActions?.onDelegate()),o(!0)}catch(e){u(e)}},children:"Accept"})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN]:()=>{let{wallets:r}=d.useWallets(),{wallets:n}=f.useSolanaWallets(),{navigate:i,data:o,setModalData:s}=v.usePrivyModal(),l=d.useAppConfig(),u=o?.funding,h=a.useRef(null),[p,y]=a.useState(!1);a.useEffect((()=>{h.current&&h.current.style.setProperty("--funding-input-length",Math.max(u.amount.length,1).toString())}),[u.amount,h.current]);let m=l.fundingConfig?.methods.slice()??[],g="solana"===u.chainType,w=g?void 0:u,{tokenPrice:x}=Wc(g?"solana":u.chain.id);a.useEffect((()=>{w?.erc20Address&&!w.erc20ContractInfo&&Ch({address:w.erc20Address,chain:w.chain,rpcConfig:l.rpcConfig,privyAppId:l.id}).then((e=>s({...o,funding:{...w,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}}))).catch(console.error)}),[w?.erc20Address,w?.chain]);let C=x?c.getDollarsFromStringFloat(u.amount,x):void 0,E=g?n.find((({address:e})=>e===u.address)):r.find((({address:e})=>t.getAddress(e)===t.getAddress(u.address))),b=E&&"privy"!==E.walletClientType?Cl(E.walletClientType,E.connectorType,E.walletClientType):l.name,S=parseFloat(u.amount),A=!isNaN(S)&&S>0,j=!(!w?.erc20Address||w?.erc20ContractInfo),$=u.isUSDC?"USDC":w?.erc20Address?void 0:"native-currency",T=!!g||$&&((e,t)=>{switch(t){case"native-currency":return Sh.has(e);case"USDC":return Ah.has(e);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}})(Number(u.chain.id),$),P=!!g||$&&((e,t)=>{switch(t){case"native-currency":return uh.has(e);case"USDC":return hh.has(e);default:return console.warn("Unknown asset passed to Coinbase Onramp"),!1}})(Number(u.chain.id),$),_=!!g||u.erc20Address||!u.erc20Address&&!u.isUSDC,k=g?"SOL":u.erc20Address?u.erc20ContractInfo?.symbol:u.chain.nativeCurrency.symbol||"ETH";return e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsxs("h3",{children:["Add funds to your"," ",b?.toLowerCase().endsWith("wallet")?b:b+" wallet"]}),e.jsx(qs,{style:{marginTop:"32px"},children:e.jsx(Ku,{children:j?e.jsx(Oc,{size:"50px"}):e.jsxs(e.Fragment,{children:[e.jsxs(Yu,{onClick:()=>h.current?.focus(),children:[e.jsx(Xu,{ref:h,value:u.amount,onFocus:()=>y(!0),onBlur:()=>y(!1),onChange:e=>{let t=e.target.value;/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1&&s({...o,funding:{...u,amount:t}})}}),e.jsx(Qu,{children:k}),!p&&e.jsx(Ju,{children:e.jsx(mt.default,{width:12,height:12})})]}),!w?.erc20Address&&e.jsx(eh,{children:C&&A?C:""})]})})}),e.jsxs(zu,{children:[u.errorMessage&&e.jsx(wh,{children:u.errorMessage}),m.sort().map((t=>{switch(t){case"moonpay":return T?e.jsxs(Jo,{disabled:!A||j,onClick:()=>{i(v.ModalScreen.MOONPAY_PROMPT_SCREEN)},children:[e.jsx(Vu,{children:e.jsx(_h,{style:{width:24}})}),"Moonpay"]},t):null;case"coinbase-onramp":return P?e.jsxs(Jo,{disabled:!A||j,onClick:()=>{i(v.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN)},children:[e.jsx(Vu,{children:e.jsx(Sa,{style:{width:24}})}),"Coinbase Onramp"]},t):null;case"external":return _?e.jsxs(Jo,{disabled:!A||j,onClick:()=>{i(v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN)},children:[e.jsx(Vu,{children:e.jsx(He.default,{style:{width:24}})}),"Transfer from wallet"]},t):null}})),e.jsx(rh,{disabled:!A,onClick:()=>i(v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN),children:"Send funds manually"})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.MOONPAY_PROMPT_SCREEN]:()=>{let{app:t,data:r,navigate:n,setModalData:i}=v.usePrivyModal(),{createAnalyticsEvent:o,getMoonpaySignedUrl:l}=s.usePrivyInternal(),[u,h]=a.useState(null),p=r?.funding,y=p.isUSDC?"USDC":"native-currency";return a.useEffect((()=>{!u&&p&&async function(){let e="ethereum"===p.chainType?p.moonpayConfigOverride?.currencyCode??function(e,t){switch(e){case d.arbitrum.id:return"native-currency"===t?"ETH_ARBITRUM":"USDC_ARBITRUM";case 43114:return"AVAX_CCHAIN";case d.base.id:return"native-currency"===t?"ETH_BASE":"USDC_BASE";case d.celo.id:return"CELO_CELO";case d.polygon.id:return"native-currency"===t?"MATIC_POLYGON":"USDC_POLYGON";case d.mainnet.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"}}(p.chain.id,y):"SOL",{signedUrl:n,externalTransactionId:a}=await l(p.address,{...t.fundingMethodConfig.moonpay,...p.moonpayConfigOverride,currencyCode:e,quoteCurrencyAmount:p.moonpayConfigOverride?.quoteCurrencyAmount??jh(p.amount)});h(n),i({moonpayStatus:{externalTransactionId:a},funding:r?.funding})}()}),[u,p]),e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Dh,{app:t,signedUrl:u,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:bh}}),n(v.ModalScreen.MOONPAY_STATUS_SCREEN)}}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.MOONPAY_STATUS_SCREEN]:()=>{let{app:t,data:r}=v.usePrivyModal(),{closePrivyModal:n}=s.usePrivyInternal(),{externalTransactionId:i}=r?.moonpayStatus,a=Ph(i||null,t.fundingMethodConfig.moonpay.useSandbox??!1);return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{title:"Fund account"},"header"),e.jsx(Xh,{status:a,onClickCta:n}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.COINBASE_ONRAMP_STATUS_SCREEN]:()=>{let{data:t,setModalData:r,navigate:n}=v.usePrivyModal(),{closePrivyModal:i,createAnalyticsEvent:o,initCoinbaseOnRamp:l,getCoinbaseOnRampStatus:d}=s.usePrivyInternal(),[u,h]=a.useState("pending-in-flow"),p=t?.funding,y=p.isUSDC?"USDC":"ethereum"===p.chainType?"ETH":"SOL",[m,f]=a.useState(!1);return a.useEffect((()=>{if(m)return;f(!0);let e=async()=>{try{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:p.amount,chainType:p.chainType,chainId:"ethereum"===p.chainType?p.chain.id:p.cluster.name}});let e=window.open(void 0,void 0,ch({w:440,h:680})),t="ethereum"===p.chainType?function(e){let t=ph[e];if(!t)throw new s.PrivyClientError(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(p.chain.id):"solana",r=await l({addresses:[{address:p.address,blockchains:[t]}],assets:[y]}),{url:n}=(({input:e,amount:t,blockchain:r})=>{let n=new URL("https://pay.coinbase.com/buy/select-asset");return n.searchParams.set("appId",e.app_id),n.searchParams.set("sessionToken",e.session_token),n.searchParams.set("defaultExperience","buy"),n.searchParams.set("presetCryptoAmount",t.startsWith(".")?`0${t}`:t),n.searchParams.set("defaultNetwork",r),n.searchParams.set("partnerUserId",e.partner_user_id),{url:n}})({input:r,amount:p.amount,blockchain:t});if(!e)throw Error("Unable to initiate Coinbase Onramp flow.");e.location=n.toString();let i=0,a=!1;for(;i<yh;){i++;let{status:t}=await d({partnerUserId:r.partner_user_id});if("success"===t){a=!0;break}if("failure"===t)throw Error("There was an error completing Coinbase Onramp flow.");if(e.closed){h("pending-after-flow");let e=Math.floor(6.666666666666667);i=Math.max(i,yh-e)}await new Promise((e=>setTimeout(e,1500)))}if(!a)throw Error("Timed out waiting for transaction response from Coinbase Onramp.");h("success")}catch(e){console.error(e),h("error"),o({eventName:Bc,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),r({funding:{...p,errorMessage:"Something went wrong adding funds from Coinbase Onramp. Please try again or use another method to fund your wallet."}}),n(v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN)}finally{f(!1)}},t=setTimeout((()=>{e()}),500);return()=>clearTimeout(t)}),[]),e.jsxs(e.Fragment,{children:[e.jsx(Lo,{title:"Fund account"},"header"),e.jsx(mh,{status:u,onClickCta:i}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN]:()=>{let{connectors:t}=s.usePrivyInternal(),{app:r,setModalData:n,data:i,navigate:o}=v.usePrivyModal(),[l,d]=a.useState("default"),u="solana"===i?.funding?.chainType,h=Il(r.appearance.walletList,u?"solana-only":"ethereum-only",t,!0,r.appearance.walletList,r.externalWallets.walletConnect.enabled),p=e.jsx(ip,{text:"More wallets",onClick:()=>d("overflow")});return a.useEffect((()=>{n({...i,externalConnectWallet:{onCompleteNavigateTo:u?v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN:v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN}})}),[]),"overflow"===l?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:()=>d("default")},"header"),e.jsxs(Ko,{children:[e.jsx(hd,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),h]}),e.jsx(c.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(tl,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),e.jsxs(Ko,{children:[...h.length>3?h.slice(0,2):h,h.length>3&&p,e.jsx(np,{onClick:()=>o(v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN),children:"Send funds manually"})]}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN]:()=>{let{rpcConfig:t,appId:r,closePrivyModal:n,createAnalyticsEvent:i}=s.usePrivyInternal(),{navigate:o,setModalData:l,app:u,data:h}=v.usePrivyModal(),{wallets:p}=d.useWallets(),[y,m]=a.useState(!1),[f,g]=a.useState(0n),[w,x]=a.useState(!1),[C,E]=a.useState(null),[b,S]=a.useState(null),[A,j]=a.useState([]),[$,T]=a.useState(0),[P,_]=a.useState(!1),[k,N]=a.useState(!1),[I,M]=a.useState(!1),[O,R]=a.useState(!1);if(!h?.funding||"ethereum"!==h.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:F,chain:L,amount:U,connectedWalletAddress:D}=h.funding,W=h.funding.address,B=h.funding.erc20Address;a.useEffect((()=>{B&&!F&&E(Error("Unable to fetch token details"))}),[]);let H=!!B&&!!F,G=H?BigInt(parseFloat(U)*10**F.decimals):J.parseEther(U),q=D?p.find((({address:e})=>e===D)):p[0],[z,V]=a.useState(null);a.useEffect((()=>{(async()=>{if(!q)return;let e=await q.getEthereumProvider();V(J.createWalletClient({account:q.address,transport:J.custom(e)}).extend(J.publicActions))})().catch(console.error)}),[q]);let[K,Y]=a.useState(0n);a.useEffect((()=>{J.createPublicClient({chain:L,transport:J.http(d.getJsonRpcEndpointFromChain(L,t,r))}).getBalance({address:W}).then(Y).catch(console.error)}),[]);let[Z,X]=a.useState(0n);a.useEffect((()=>{H&&fu({chain:L,address:W,appId:r,rpcConfig:t,erc20Address:B}).then((e=>X(e.balance))).catch(console.error)}),[]);let{tokenPrice:Q}=Wc(L.id),[ee,te]=a.useState({to:W,chain:L,value:G,data:void 0});a.useEffect((()=>{(async()=>{let e,n;if(!z||!q||P||I)return;_(!0);let a=J.createPublicClient({chain:ee.chain,transport:J.http(d.getJsonRpcEndpointFromChain(ee.chain,t,r))});if(H&&!ee.data)return await a.simulateContract({address:B,chain:ee.chain,abi:cu,functionName:"transfer",args:[W,G],account:q.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(_(!1),void te({to:B,chain:ee.chain,data:J.encodeFunctionData({abi:cu,functionName:"transfer",args:[W,G]}),value:"0x0"})):(_(!1),void x(!0));try{e=await a.prepareTransactionRequest({account:q.address,to:ee.to,chain:ee.chain,data:ee.data,value:BigInt(ee.value??0)})}catch(e){console.error(e),A.length>1&&S(e.shortMessage??"Something went wrong")}if(!e)return _(!1),void x(!0);_(!1),M(!0),m(!0),g(e.gas);try{await z.switchChain({id:ee.chain.id})}catch(e){await z.addChain({chain:ee.chain}),await z.switchChain({id:ee.chain.id})}try{n=await z.sendTransaction(e),i({eventName:Bc,payload:{provider:"external",status:"success",address:q.address,chainId:ee.chain.id,value:ee.value?.toString(),txHash:n}})}catch(e){if(console.error(e),"TransactionExecutionError"===e.name)if(A.length<1){let t=e.shortMessage;(e.shortMessage.includes("rejected the request")||e.details.includes("rejected the request"))&&(t="User rejected the request."),E(new s.PrivyClientError(t,void 0,s.PrivyErrorCode.TRANSACTION_FAILURE))}else S(e.shortMessage??"Something went wrong")}n?(await z.waitForTransactionReceipt({hash:n}),M(!1),R(!0)):M(!1)})().catch(console.error)}),[z,ee]),a.useEffect((()=>{(async()=>{if(!w||!z||!q)return;let e=d.addToDefaultChains(u.chains).filter((e=>e.id!==L.id&&!!e.testnet==!!L.testnet));H&&e.unshift(L);let n=await(({chains:e,appId:t,address:r,rpcConfig:n})=>Promise.all(e.map((async e=>{let i=J.createPublicClient({chain:e,transport:J.http(d.getJsonRpcEndpointFromChain(e,n,t))});return{balance:await i.getBalance({address:r}).catch((()=>0n)),chain:e}}))))({chains:e,address:q.address,appId:r,rpcConfig:t}),i=H?n.filter((e=>e.balance>0n)):n.filter((e=>e.balance>G));if(i.length<1)return void E(new s.PrivyClientError(`Wallet ${d.formatWalletAddress(q.address)} does not have enough funds.`,void 0,s.PrivyErrorCode.INSUFFICIENT_BALANCE));i.sort(((e,t)=>Number(t.balance-e.balance)));let a=(await Promise.allSettled(i.map((async e=>({quote:await yu({isTestnet:!!L.testnet,input:pu({amount:G.toString(),user:q.address,recipient:W,destinationChainId:L.id,destinationCurrency:B,originChainId:e.chain.id})}),...e}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(a.length<1)return void E(new s.PrivyClientError(`Wallet ${d.formatWalletAddress(q.address)} does not have enough funds.`,void 0,s.PrivyErrorCode.INSUFFICIENT_BALANCE));let o=a.map((e=>({bridgeTx:mu(e.quote),balance:e.balance,chain:e.chain}))).filter((e=>!!e.bridgeTx));if(o.length>1)return void j(o);let l=o[0];l?(N(!0),te({data:l.bridgeTx.data,to:l.bridgeTx.to,value:l.bridgeTx.value,chain:l.chain})):E(new s.PrivyClientError(`Wallet ${d.formatWalletAddress(q.address)} does not have enough funds.`,void 0,s.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[w]),a.useEffect((()=>{if(!C)return;let e={error:C,previousScreen:v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN};l({funding:h?.funding,sendTransaction:h?.sendTransaction,errorModalData:e}),o(v.ModalScreen.ERROR_SCREEN,!1)}),[C]);let re=q?Cl(q.walletClientType,q.connectorType,q.walletClientType)||"wallet":null,ne=!H&&Q?c.getDollarsFromStringFloat(h?.funding?.amount??"0",Q):void 0,ie=H?f:c.sumWeiQuantitiesToHexString([f,G]),ae=ie&&Q?c.getDollarsFromWei(ie,Q):void 0,oe=ie?c.getNativeCurrencyFromWei(ie,"ETH"):void 0,se=f&&Q?c.getDollarsFromWei(f,Q):void 0,le=f?c.getNativeCurrencyFromWei(f,"ETH"):void 0;if(a.useEffect((()=>{if(!O)return;let e=setTimeout(n,d.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS);return()=>clearTimeout(e)}),[O]),O)return e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Ks,{}),e.jsxs(Gs,{children:[e.jsx(dt.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(tl,{title:"Success!",description:`You’ve successfully added ${U} ${H?F.symbol:L.nativeCurrency.symbol} to your ${u.name} wallet. It may take a minute before the funds are available to use.`})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});let de=H?`${uu({amount:Z,decimals:F.decimals})} ${F.symbol}`:c.getNativeCurrencyFromWei(K,L.nativeCurrency.symbol,3,!0),ce=A[$];return A.length>1&&ce?e.jsx(ah,{displayName:re,configuredFundingChain:L,formattedBalance:de,fundingAmount:U,fundingCurrency:H?F.symbol:L.nativeCurrency.symbol,fundingAmountInUsd:ne,options:A,selectedOption:ce,isPreparing:P,isSubmitting:I,errorMessage:b,onSubmit:()=>{te({to:ce.bridgeTx.to,data:ce.bridgeTx.data,value:ce.bridgeTx.value,chain:ce.chain})},onSelect:e=>{e!==$&&(S(null),T(e))}}):y&&f&&q&&h?.funding?e.jsx(lu,{wallet:q,displayName:re,addressToFund:W,isBridging:k,isErc20Flow:H,totalPriceInUsd:ae,totalPriceInNativeCurrency:oe,gasPriceInUsd:se,gasPriceInNativeCurrency:le,chainId:L.id,chainName:L.name}):e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Oc,{}),e.jsx("div",{style:{marginTop:"1rem"}}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN]:()=>{let{closePrivyModal:t,createAnalyticsEvent:r}=s.usePrivyInternal(),{navigate:i,setModalData:o,app:l,data:u}=v.usePrivyModal(),{wallets:h}=f.useSolanaWallets(),[p,y]=a.useState(0n),[m,g]=a.useState(null),[w,x]=a.useState(!1),[C,E]=a.useState(!1),b=a.useRef(!1);if(!u?.funding||"solana"!==u.funding.chainType)throw Error("Invalid funding data");let{address:S,amount:A,cluster:j,connectedWalletAddress:$}=u.funding,T=qc(j),{tokenPrice:P}=Wc("solana"),{fundingAmountInBaseUnit:_,totalPriceInUsd:k,totalPriceInNativeCurrency:N,feePriceInNativeCurrency:I,feePriceInUsd:M}=function({amount:e,fee:t,tokenPrice:r}){let n=BigInt(1e9*parseFloat(e)),i=n+t;return{fundingAmountInBaseUnit:n,totalPriceInUsd:r?Kc(i,r):void 0,totalPriceInNativeCurrency:Vc(i),feePriceInNativeCurrency:Vc(t),feePriceInUsd:r?Kc(t,r):void 0}}({amount:A,fee:p,tokenPrice:P}),O=$?h.find((({address:e})=>e===$)):h[0];if(a.useEffect((()=>{(async()=>{if("solana"!==O?.type||!O.sendTransaction||w||b.current)return;b.current=!0;let e=new n.PublicKey(O.address),t=new n.Transaction;t.add(n.SystemProgram.transfer({fromPubkey:e,toPubkey:new n.PublicKey(S),lamports:_}));let i=new n.Connection(T),a=await i.getLatestBlockhash();t.recentBlockhash=a.blockhash,t.feePayer=e;let o=await t.getEstimatedFee(i);null!=o&&y(BigInt(o)),x(!0);try{let e=await i.simulateTransaction(t);if(e.value.err)return console.warn("Transaction simulation failed"),e.value.logs?.find((e=>/Transfer: insufficient lamports/gi.test(e)))?void g(new s.PrivyClientError(`Wallet ${d.formatWalletAddress(O.address,void 0,void 0,"solana")} does not have enough funds.`,void 0,s.PrivyErrorCode.INSUFFICIENT_BALANCE)):void g(Error(e.value.err.toString()));let n=await O.sendTransaction(t,i);r({eventName:Bc,payload:{provider:"external",status:"success",address:O.address,value:_.toString(),txHash:n,chainType:"solana",rpcEndpoint:T}}),x(!1),E(!0)}catch(e){if(console.error(e),x(!1),/user rejected the request/gi.test(e.message||""))return void g(new s.PrivyClientError("Transaction was rejected by the user",void 0,s.PrivyErrorCode.TRANSACTION_FAILURE));g(new s.PrivyClientError("Something went wrong",void 0,s.PrivyErrorCode.TRANSACTION_FAILURE))}})().catch(console.error).finally((()=>b.current=!1))}),[]),a.useEffect((()=>{if(!m)return;let e={error:m,previousScreen:v.ModalScreen.FUNDING_TRANSFER_FROM_WALLET_SCREEN};o({funding:u?.funding,sendTransaction:u?.sendTransaction,errorModalData:e}),i(v.ModalScreen.ERROR_SCREEN,!1)}),[m]),a.useEffect((()=>{if(!C)return;let e=setTimeout(t,d.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS);return()=>clearTimeout(e)}),[C]),C)return e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Ks,{}),e.jsxs(Gs,{children:[e.jsx(dt.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),e.jsx(tl,{title:"Success!",description:`You’ve successfully added ${A} SOL to your ${l.name} wallet. It may take a minute before the funds are available to use.`})]}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]});let R=O?Cl(O.walletClientType,O.connectorType,O.walletClientType)||"wallet":null;return O&&w?e.jsx(lu,{wallet:O,displayName:R,addressToFund:S,isBridging:!1,isErc20Flow:!1,totalPriceInUsd:k,totalPriceInNativeCurrency:N,gasPriceInUsd:M,gasPriceInNativeCurrency:I,chainId:"solana",chainName:j.name}):e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(Oc,{}),e.jsx("div",{style:{marginTop:"1rem"}}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.FUNDING_MANUAL_TRANSFER_SCREEN]:()=>{let{wallets:t}=d.useWallets(),{wallets:r}=f.useSolanaWallets(),{app:i,data:o,setModalData:l,navigate:u,lastScreen:h}=v.usePrivyModal(),{rpcConfig:p,appId:y,closePrivyModal:m,createAnalyticsEvent:g}=s.usePrivyInternal(),[w,x]=a.useState("default"),[C,E]=a.useState(void 0),b=o?.funding,{reloadBalance:S}=c.useWalletBalance({rpcConfig:p,appId:y,address:"ethereum"===b.chainType?b.address:void 0,chain:"ethereum"===b.chainType?b.chain:void 0}),A="solana"===b.chainType,{tokenPrice:j}=Wc(A?"solana":b.chain.id),$=A?b.cluster.name:b.chain.name,T=A?"SOL":b.erc20Address?b.erc20ContractInfo?.symbol:b.chain.nativeCurrency.symbol,P=parseFloat(b.amount),_=!isNaN(P)&&P>0,k=j?c.getDollarsFromStringFloat(b.amount,j):void 0,N=A?r.find((({address:e})=>e===b.address)):t.find((({address:e})=>d.formatWalletAddress(e)===d.formatWalletAddress(b.address))),I=N&&"privy"!==N.walletClientType?Cl(N.walletClientType,N.connectorType,N.walletClientType):i.name;if(!b)return l({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:h||v.ModalScreen.FUNDING_METHOD_SELECTION_SCREEN},funding:o?.funding,sendTransaction:o?.sendTransaction}),u(v.ModalScreen.ERROR_SCREEN),e.jsx(e.Fragment,{});a.useEffect((()=>{let e=A?async function(){"solana"===b.chainType&&new n.Connection(qc(b.cluster)).getBalance(new n.PublicKey(b.address)).then((e=>{E((t=>(t&&e>t&&g({eventName:Bc,payload:{provider:"manual",status:"success",chainType:"solana",address:N?.address,value:(e-t).toString()}}),e)))}))}:async function(){"ethereum"===b.chainType&&(async()=>{if(!b.erc20Address)return await S()??BigInt(0);{let{balance:e}=await fu({chain:b.chain,address:b.address,erc20Address:b.erc20Address,rpcConfig:p,appId:y});return e}})().then((e=>{let t=parseFloat(ae.formatUnits(e,"ether"));E((e=>(e&&t>e&&g({eventName:Bc,payload:{provider:"manual",status:"success",chainType:"ethereum",address:N?.address,value:(t-e).toString()}}),t)))})).catch((()=>E(void 0)))},t=setInterval(e,2e3);return e(),()=>clearInterval(t)}),[]);let M=a.useMemo((()=>void 0!==C&&C>=parseFloat(b.amount)),[C,b.amount]),O=null!=C?A?Vc(BigInt(C),2,!0,!0):C.toPrecision(2):"",R=e.jsxs(e.Fragment,{children:[e.jsx(c.WalletInfoCard,{title:"Your wallet",errMsg:void 0,isLoading:!b||void 0===C,isPulsing:!M,balance:`${O} ${T}`,address:b.address,statusColor:M?"green":"gray"}),M&&e.jsx(ih,{onClick:()=>m(),children:"Close"})]});return"qr-code"===w?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:()=>x("default")}),e.jsxs(qs,{style:{gap:"24px",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx(vs,{children:"Scan QR code"}),e.jsxs(ws,{children:["Scan this code using your mobile wallet to send funds to your ",I," ","wallet."]})]}),e.jsx(jc,{url:b.address,size:200,squareLogoElement:kh}),R]}),e.jsx(c.BlobbyFooter,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Mc,{}),e.jsx(tl,{title:"Send funds",description:"Send funds directly to your wallet by copying your wallet address or scanning a QR code."}),e.jsxs(qs,{style:{gap:"16px"},children:[e.jsxs(Mh,{children:[e.jsx(ft.default,{height:"20px",width:"20px",color:"var(--privy-color-accent-light)"}),e.jsxs(Oh,{children:["Make sure to send on ",$,"."]})]}),e.jsxs(Rh,{children:[e.jsx(Xs,{height:16}),e.jsxs(Ku,{children:[e.jsxs(Yu,{children:[e.jsx(Zu,{children:b.amount}),e.jsx(Qu,{children:T})]}),e.jsx(eh,{children:!A&&!b.erc20Address&&e.jsx(eh,{children:k&&_?k:"..."})}),e.jsxs(th,{children:[e.jsx(su,{chainId:A?"solana":b.chain.id,height:16,width:16})," ",$]})]}),e.jsx(Xs,{height:8}),e.jsxs(Ih,{children:[e.jsx(Nh,{text:b.address}),e.jsx(Lh,{onClick:()=>x("qr-code"),children:e.jsxs(Fh,{children:[e.jsx(gt.default,{height:"16px",width:"16px"}),"Scan code"]})})]})]}),R]}),e.jsx(Xs,{height:16}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN]:()=>{let{closePrivyModal:t}=s.usePrivyInternal(),{data:r,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=v.usePrivyModal(),{onSuccess:o,onFailure:l}=r.setWalletPassword,d=()=>{l(new s.PrivyEmbeddedWalletError("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=d,e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:d}),e.jsx(Ks,{}),e.jsxs(Gs,{children:[e.jsxs(Zs,{children:[e.jsx(ot.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),e.jsx(Js,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:e.jsx(st.default,{width:"12px",height:"12px",fill:"white"})})]}),e.jsxs(tl,{title:"Secure Your Account",children:["Please set a password to secure your account.",e.jsx("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),e.jsx(bo,{onClick:()=>{n({createWallet:{onFailure:l,onSuccess:o,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i(v.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN)},children:"Add password"}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN]:()=>{let[t,r]=a.useState(null),[n,i]=a.useState(!1),[o,l]=a.useState(null),[d,c]=a.useState(""),{authenticated:u,getAccessToken:p,user:y}=s.usePrivy(),{walletProxy:m,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:w}=s.usePrivyInternal(),{app:x,navigate:C,data:E,onUserCloseViaDialogOrKeybindRef:b}=v.usePrivyModal(),{onSuccess:S,onFailure:A}=E.createWallet,j=h.getPrivyEthereumWallet(y),$="user-passcode"===t?.recoveryMethod,T="user-passcode"===j?.recoveryMethod;a.useEffect((()=>{u||(C(v.ModalScreen.LANDING),A(new s.PrivyUnauthenticatedError("User must be authenticated before setting a password on a Privy wallet")))}),[u]);let P=()=>o?(A(o),void g({shouldCallAuthOnSuccess:!1})):$?(S(t),void g({shouldCallAuthOnSuccess:!1})):(A(new s.PrivyEmbeddedWalletError("Exited before password was added to wallet")),void g({shouldCallAuthOnSuccess:!1}));b.current=P;return e.jsx(dc,{appName:x?.name||"privy",config:{initiatedBy:"user",onCancel:P},error:o?"An error has occurred, please try again.":void 0,buttonLoading:n,buttonHideAnimations:!1,password:d,isResettingPassword:T,onPasswordGenerate:()=>c(Qd()),onPasswordChange:c,onSubmit:async()=>{$?(S(t),g({shouldCallAuthOnSuccess:!1})):(i(!0),l(null),await(async()=>{let e=await p();if(e&&j?.address&&d&&m)try{if(w({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T}}),!(await m.setRecovery({accessToken:e,address:j.address,recoveryPassword:d,recoveryMethod:"user-passcode"})).address)return l(new s.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T,reason:"error setting password"}});let t=await f(),n=h.getPrivyEthereumWallet(t);if(!n)return l(new s.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void w({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T,reason:"wallet disconnected"}});r(n),w({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:j.address,existingRecoveryMethod:j.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:T}})}catch(e){console.warn(e),l(e instanceof Error?e:Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:j.address,reason:e}})}})(),i(!1))},onClose:P})},[v.ModalScreen.EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN]:()=>{let{app:t,navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:i}=v.usePrivyModal(),[o,l]=a.useState(""),[d,c]=a.useState(!1),[u,h]=a.useState(),[p,y]=a.useState(null),{authenticated:m,user:f}=s.usePrivy(),{closePrivyModal:g,isNewUserThisSession:w,initializeWalletProxy:x}=s.usePrivyInternal(),{onSuccess:C,onFailure:E,callAuthOnSuccessOnClose:b}=n.createWallet,{createWallet:S}=vd(),[A,j]=a.useState(null),$=new Wi((async()=>{try{let e=await S({recoveryPassword:u,user:f});if(!e)return;j(e),w?r(v.ModalScreen.EMBEDDED_WALLET_CREATED_SCREEN):(C(e),g({shouldCallAuthOnSuccess:b}))}catch(e){l(e.message)}}));a.useEffect((()=>{p||x(3e4).then((e=>y(e)))}),[p]),a.useEffect((()=>{if(!m||!f)return r(v.ModalScreen.LANDING),void E(Error("User must be authenticated before creating a Privy wallet"))}),[m]),i.current=()=>null;return e.jsx(dc,{config:{initiatedBy:"automatic"},appName:t?.name||"privy",loading:!p,buttonLoading:d,buttonHideAnimations:!A&&d,isResettingPassword:!1,error:o,password:u||"",onClose:()=>{A&&"user-passcode"!==A?.recoveryMethod?(E(new s.PrivyEmbeddedWalletError("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):A?(C(A),g({shouldCallAuthOnSuccess:b})):(E(new s.PrivyEmbeddedWalletError("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))},onPasswordChange:h,onPasswordGenerate:()=>h(Qd()),onSubmit:async()=>(c(!0),$.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>c(!1))))})},[v.ModalScreen.MFA_ENROLLMENT_FLOW_SCREEN]:()=>{let{user:t,enrollInMfa:r}=s.usePrivy(),[n,i]=a.useState(null),{unenrollWithSms:o,unenrollWithTotp:l,unenrollWithPasskey:d}=Kp(),{app:u,ready:h,data:p,onUserCloseViaDialogOrKeybindRef:y}=v.usePrivyModal(),{closePrivyModal:m}=s.usePrivyInternal(),{promptMfa:f}=Vp(),{initEnrollmentWithTotp:g}=Kp(),[w,x]=a.useState(!1),[C,E]=a.useState(null),[b,S]=a.useState(null),A=()=>{m({shouldCallAuthOnSuccess:!0}),r(!1),setTimeout((()=>{i(null),E(null)}),500)},{initEnrollmentWithPasskey:j,submitEnrollmentWithPasskey:$}=Kp(),[T,P]=a.useState(!1),[_,k]=a.useState(null);y.current=A;let N=t?.mfaMethods.includes("sms"),I=!!t?.phone,M=t?.mfaMethods.includes("totp"),O=t?.mfaMethods.includes("passkey"),R=N||M||O,F=t?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function L(){i(null),E(null)}if(a.useEffect((()=>{R&&x(!0)}),[R]),!h||!t||!u)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A},"header"),e.jsx(gs,{children:e.jsx(Yp,{})}),e.jsx(xs,{children:e.jsx(vo,{})}),e.jsx(c.ModalFooter,{})]});if("sms"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:L,onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Le.default,{})}),e.jsx(vs,{children:"Remove SMS verification?"}),e.jsxs(ws,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),e.jsx(Ss,{children:e.jsx(bo,{warn:!0,onClick:async function(){i(null);try{await o()}catch(e){i(null)}},children:"Remove SMS for MFA"})}),e.jsx(c.ModalFooter,{})]});if("totp"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:L,onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Le.default,{})}),e.jsx(vs,{children:"Remove Authenticator App verification?"}),e.jsxs(ws,{children:["MFA adds an extra layer of security to your ",u?.name," account. Make sure you have other methods to secure your account."]}),e.jsx(Ss,{children:e.jsx(bo,{warn:!0,onClick:async function(){i(null);try{await l()}catch(e){i(null)}},children:"Remove Authenticator App for MFA"})}),e.jsx(c.ModalFooter,{})]});if("passkey"===n)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:L,onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(Le.default,{})}),e.jsx(vs,{children:"Are you sure you want to remove passkey verification?"}),e.jsx(ws,{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."}),e.jsx(Ss,{children:e.jsx(bo,{warn:!0,onClick:async function(){i(null);try{await f(),await d()}catch(e){i(null)}},children:"Yes, remove"})}),e.jsx(c.ModalFooter,{})]});if(0===p.mfaEnrollmentFlow.mfaMethods.length&&!R)return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(xt.default,{})}),e.jsx(vs,{children:"Add more security"}),e.jsxs(ws,{children:[u?.name," does not have any verification methods enabled."]}),e.jsx(Ss,{children:e.jsx(bo,{onClick:A,children:"Close"})}),e.jsx(c.ModalFooter,{})]});let U=!R&&!w;return U?e.jsxs(e.Fragment,{children:[e.jsx(Lo,{onClose:A},"header"),e.jsx(Is,{style:{marginBottom:"1.5rem"},children:e.jsx(xt.default,{})}),e.jsx(vs,{children:"Transaction Protection"}),e.jsx(ws,{children:"Set up transaction protection to add an extra layer of security to your account"}),e.jsxs(Cs,{children:[e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(pt.default,{})}),"Enable 2-Step verification for your ",u?.name," wallet."]}),e.jsxs(bs,{children:[e.jsx(Es,{children:e.jsx(Ct.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),e.jsxs(Ss,{children:[e.jsx(bo,{onClick:()=>x(!0),children:"Continue"}),e.jsx(To,{onClick:A,children:"Not now"})]}),e.jsx(c.ModalFooter,{})]}):"sms"===C?e.jsx(fy,{onComplete:A,onReset:L,onClose:A}):"totp"===C&&b?e.jsx(vy,{onComplete:A,onClose:A,onReset:L,totpInfo:b}):"passkey"===C?e.jsx(Qp,{onComplete:A,onReset:L,onClose:A}):e.jsx(Xp,{showIntro:U,userMfaMethods:t.mfaMethods,appMfaMethods:u.mfa.methods,userHasAuthSms:I,onBackToIntro:function(){x(!1)},handleSelectMethod:async function(e){return await f().catch(k),"totp"===e?(E(e),S(null),void g().then((e=>{S(e)})).catch((()=>{S(null),L()}))):"passkey"===e&&1===F.length?await async function(){P(!0);try{await j(),await $({credentialIds:F})}catch(e){k(e)}finally{P(!1)}}():void E(e)},isTotpLoading:"totp"===C&&!b,isPasskeyLoading:T,error:_,onClose:A,setRemovingMfaMethod:i})},[v.ModalScreen.CAPTCHA_SCREEN]:()=>{let{lastScreen:t,currentScreen:r,data:n,navigateBack:i,navigate:o,setModalData:s}=v.usePrivyModal(),{status:l,token:d,waitForResult:u,reset:h,execute:p}=xa(),y=a.useRef([]),m=e=>{y.current=[e,...y.current]},[f,g]=a.useState(!0);a.useEffect((()=>(m(setTimeout(g,1e3,!1)),()=>{y.current.forEach((e=>clearTimeout(e))),y.current=[]})),[]);let[w,x]=a.useState(""),[C,E]=a.useState("Checking that you are a human..."),[b,S]=a.useState(e.jsx(bo,{onClick:()=>{},disabled:!0,children:"Continue"})),[A,j]=a.useState(!1),[$,T]=a.useState(3),P=n?.captchaModalData,_=async e=>{try{await(P?.callback(e)),P?.onSuccessNavigateTo&&o(P?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof va)return;s({errorModalData:{error:e,previousScreen:t||v.ModalScreen.LANDING}}),o(P?.onErrorNavigateTo||v.ModalScreen.ERROR_SCREEN,!1)}};a.useEffect((()=>{"success"===l?m(setTimeout((async()=>{let e=await u();!e||P?.userIntentRequired||_(e)}),1e3)):"ready"===l&&m(setTimeout((()=>{"ready"===l&&p()}),500))}),[l]),a.useEffect((()=>{if(!f)switch(l){case"success":x("Success!"),E("CAPTCHA passed successfully."),S(e.jsx(bo,{onClick:()=>{j(!0),_(d)},disabled:!P?.userIntentRequired,loading:A,children:P?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),E("Checking that you are a human..."),S(e.jsx(bo,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),$<=0?(E("If you use an adblocker or VPN, try disabling and re-attempting."),S(null)):(E("You did not pass CAPTCHA. Please try again."),S(e.jsx(bo,{onClick:k,children:"Retry"})))}}),[l,f,A]);let k=async()=>{if($<=0)return;T((e=>e-1)),h(),p();let e=await u();!e||P?.userIntentRequired||_(e)};return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{backFn:t&&r!==t?i:void 0}),e.jsxs(vl,{children:["success"===l?e.jsx(Ye.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):"error"===l?e.jsx(Ze.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):e.jsx(fl,{}),e.jsxs(zs,{children:[w?e.jsx("h3",{children:w}):null,e.jsx("p",{children:C})]}),b]}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.ERROR_SCREEN]:()=>{let{navigate:t,navigateBack:r,data:n,lastScreen:i,currentScreen:a}=v.usePrivyModal(),o=n?.errorModalData?.previousScreen||(i===a?void 0:i);return e.jsx(cc,{error:n?.errorModalData?.error||Error(),backFn:()=>o?t(o,!1):r(),onClick:()=>t(o||v.ModalScreen.LANDING,!1)})},[v.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE]:()=>{let{closePrivyModal:t}=s.usePrivyInternal();return e.jsxs(e.Fragment,{children:[e.jsx(Lo,{},"header"),e.jsx(ap,{children:e.jsx(Ge.default,{style:{width:32,height:32}})}),e.jsx(el,{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"}}),e.jsx(Ds,{children:e.jsx(bo,{onClick:()=>t(),children:"Close"})}),e.jsx(Ys,{}),e.jsx(c.BlobbyFooter,{})]})},[v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN]:()=>{let{user:t,logout:r}=s.usePrivy(),{app:n,onUserCloseViaDialogOrKeybindRef:i,setModalData:a,navigate:o}=v.usePrivyModal(),{acceptTerms:l,closePrivyModal:d,createAnalyticsEvent:c}=s.usePrivyInternal(),u=e=>{e?.preventDefault(),d({shouldCallAuthOnSuccess:!1}),r()};i.current=u;return e.jsx(Os,{termsAndConditionsUrl:n?.legal.termsAndConditionsUrl,privacyPolicyUrl:n?.legal.privacyPolicyUrl,onAccept:async e=>{e.preventDefault(),await l(),t&&h.shouldProceedtoEmbeddedWalletCreationFlow(t,n?.embeddedWallets?.createOnLogin)?(a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),o(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)):d()},onDecline:u})},[v.ModalScreen.TELEGRAM_AUTH_SCREEN]:()=>{let{authenticated:t,logout:r,ready:n,user:i}=s.usePrivy(),{app:o,setModalData:l,navigate:u,resetNavigation:p,data:y}=v.usePrivyModal(),{initLoginWithTelegram:m,loginWithTelegram:f,updateWallets:g,setReadyToTrue:w,closePrivyModal:x,createAnalyticsEvent:C,getAuthMeta:E}=s.usePrivyInternal(),[b,S]=a.useState(!1),[A,j]=a.useState(void 0),$=xa();async function T(){try{let e=await async function(){let e;if($.enabled&&"error"===$.status)throw new va($.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);return $.enabled&&"success"!==$.status&&($.execute(),e=await $.waitForResult()),e}();await f(e),S(!0),w(!0)}catch(e){if(e?.privyErrorCode===s.PrivyErrorCode.ALLOWLIST_REJECTED)return j(void 0),p(),void u(v.ModalScreen.ALLOWLIST_REJECTION_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new s.PrivyUserLimitReachedError(e).toString()),j(void 0),p(),void u(v.ModalScreen.USER_LIMIT_REACHED_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.USER_DOES_NOT_EXIST)return j(void 0),p(),void u(v.ModalScreen.ACCOUNT_NOT_FOUND_SCREEN);if(e?.privyErrorCode===s.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return j(void 0),p(),l({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:E()?.telegramAuthResult,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void u(v.ModalScreen.LINK_CONFLICT_SCREEN);let{retryable:t,detail:r}=Ea(e);j({retryable:t,detail:r,message:"Authentication failed"})}}a.useEffect((()=>{T()}),[]),a.useEffect((()=>{if(!(n&&t&&b&&i))return;if(o?.legal.requireUsersAcceptTerms&&!i.hasAcceptedTerms){let e=setTimeout((()=>{u(v.ModalScreen.AFFIRMATIVE_CONSENT_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}if(h.shouldProceedtoEmbeddedWalletCreationFlow(i,o?.embeddedWallets?.createOnLogin)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),C({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),r()},callAuthOnSuccessOnClose:!0}}),u(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}g();let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),d.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}),[n,t,b,i]);let P=b?"Successfully connected with Telegram":A?A.message:"Verifying connection to Telegram",_="";return _=b?"You’re good to go!":A?A.detail:"Just a few moments more",e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsx(Ks,{}),e.jsxs(Of,{children:[e.jsx(qo,{children:e.jsxs("div",{children:[e.jsx(go,{success:b,fail:!!A}),e.jsx(Np,{style:{width:"38px",height:"38px"}})]})}),e.jsxs(zs,{children:[e.jsx("h3",{children:P}),e.jsx("p",{children:_})]}),A&&A?.retryable?e.jsx(_o,{onClick:async()=>{try{j(void 0),y?.telegramAuthModalData?.seamlessAuth||await m(void 0,y?.login?.disableSignup),await T()}catch(e){let{retryable:t,detail:r}=Ea(e);j({retryable:t,detail:r,message:"Authentication failed"})}},disabled:!b&&!A?.retryable,children:"Retry"}):null]}),e.jsx(Ys,{}),e.jsx(c.ModalFooter,{})]})},[v.ModalScreen.LINK_CONFLICT_SCREEN]:()=>{let{initiateAccountTransfer:t,closePrivyModal:r}=s.usePrivyInternal(),{data:n,navigate:i,lastScreen:o,setModalData:l}=v.usePrivyModal(),[d,c]=a.useState(void 0),[u,h]=a.useState(!1),[p,y]=a.useState(!1),m=async()=>{try{if(!n?.accountTransfer?.nonce||!n?.accountTransfer?.account)throw Error("missing account transfer inputs");y(!0),await t({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}),h(!0),y(!1),setTimeout(r,1e3)}catch(e){l({errorModalData:{error:e,previousScreen:o||v.ModalScreen.LINK_CONFLICT_SCREEN}}),i(v.ModalScreen.ERROR_SCREEN,!0)}};return d?e.jsx(ys,{address:d,onClose:r,onRetry:()=>c(void 0),onTransfer:m,isTransferring:p,transferSuccess:u}):e.jsx(ms,{onClose:r,onInfo:()=>c(n?.accountTransfer?.embeddedWalletAddress),onContinue:()=>c(n?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:p,transferSuccess:u,data:n})}},Jf=[v.ModalScreen.LANDING,v.ModalScreen.AWAITING_CONNECTION],Qf=({isMfaVerifying:t,onMfaVerificationComplete:r})=>{let{ready:n,isModalOpen:i}=s.usePrivy(),{headless:o}=d.useAppConfig(),{ready:l,currentScreen:u}=v.usePrivyModal(),{status:h,execute:p,reset:y,enabled:m}=xa(),f=i&&u&&Jf.includes(u)&&!o&&"ready"===h;return a.useEffect((()=>{f&&p()}),[f]),a.useEffect((()=>{!i&&m&&y()}),[i,m]),n&&l||u===v.ModalScreen.AWAITING_OAUTH_SCREEN||u===v.ModalScreen.CROSS_APP_AUTH_SCREEN||u===v.ModalScreen.TELEGRAM_AUTH_SCREEN?!u&&t?e.jsx(nm,{open:t,onClose:r}):u?e.jsxs(e.Fragment,{children:[e.jsx(es,{$if:!!t,children:e.jsx(Xf[u],{})}),e.jsx(es,{$if:!t,children:e.jsx(nm,{open:t,onClose:r})})]}):null:e.jsxs(e.Fragment,{children:[e.jsx(Lo,{}),e.jsx(Ks,{}),e.jsx(Zf,{children:e.jsx(vo,{})}),e.jsx(Ys,{}),e.jsx(c.ModalFooter,{})]})},eg=({isMfaVerifying:t,onMfaVerificationComplete:r})=>{let n=a.useRef(null);return e.jsx(ng,{style:{height:c.useElementHeight(n)},id:"privy-modal-content",children:e.jsx("div",{ref:n,children:e.jsx(Qf,{isMfaVerifying:t,onMfaVerificationComplete:r})})})};const tg=({open:t})=>{let{app:r}=v.usePrivyModal(),{gracefulClosePrivyModal:n}=(()=>{let{closePrivyModal:e}=s.usePrivyInternal(),{onUserCloseViaDialogOrKeybindRef:t}=v.usePrivyModal();return{gracefulClosePrivyModal:a.useCallback((()=>{if(!t?.current)return e({shouldCallAuthOnSuccess:!1});t.current()}),[e])}})(),[i,o]=a.useState(!1);fo({onMfaRequired:()=>{r?.mfa.noPromptOnMfaRequired||o(!0)}});let l=t||i;return r.render.standalone?e.jsx(Gf,{children:e.jsx(rg,{id:"privy-modal-content",children:e.jsx(Qf,{isMfaVerifying:i,onMfaVerificationComplete:()=>o(!1)})})}):e.jsx(qf,{open:l,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>n(),children:e.jsx(Gf,{children:e.jsx(eg,{isMfaVerifying:i,onMfaVerificationComplete:()=>o(!1)})})})};let rg=E.styled.div`
3097
3097
  display: flex;
3098
3098
  flex-direction: column;
3099
3099
  text-align: center;
@@ -3102,7 +3102,7 @@
3102
3102
  width: 100%;
3103
3103
  background: var(--privy-color-background);
3104
3104
  padding: 0 16px;
3105
- `,rg=E.styled(tg)`
3105
+ `,ng=E.styled(rg)`
3106
3106
  transition: height 150ms ease-out;
3107
3107
  overflow: hidden;
3108
3108
 
@@ -3116,4 +3116,4 @@
3116
3116
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
3117
3117
  border-radius: var(--privy-border-radius-lg);
3118
3118
  }
3119
- `;function ng(t){let r=a.useRef(null),n=a.useRef();return a.useEffect((()=>{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}(t),r.current?.after(n.current)}),[t]),e.jsx("div",{ref:r,hidden:!0})}async function ig(e,t,r,n,i,a=!1){let o=a,s=async s=>{if(o&&t&&t.length>0){s===(a?0:1)?i("configureMfa","onMfaRequired",t):n.current?.reject(new Zl("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 Zl("mfa_timeout","Timed out waiting for MFA code");n.current?.reject(e),t(e)}),3e5)}));return await e(o)}return await e()},l=null;for(let e=0;e<4;e++)try{l=await s(e),n.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw n.current?.resolve(void 0),e;o=!0}if(null===l){let e=new Zl("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw n.current?.reject(e),e}return l}var ag;let og=(ag=0,()=>"id-"+ag++);function sg(e){return void 0!==e.error}let lg=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:wallet:create":case"privy:wallet:create-additional":case"privy:wallet:import":case"privy:wallet:connect":case"privy:wallet:recover":case"privy:wallet:rpc":case"privy:wallet:set-recovery":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:solana-wallet:connect":case"privy:solana-wallet:recover":case"privy:solana-wallet:rpc":case"privy:delegated-actions:consent":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}},dg=new Map,cg=(e,t)=>"bigint"==typeof t?t.toString():t,ug=(e,t)=>`${e}${JSON.stringify(t,cg)}`;function hg(e,t,r,n){let i=r.contentWindow;if(!i)throw Error("iframe not initialized");let a=ug(e,t);if("privy:wallet:create"===e){let e=dg.get(a);if(e)return e}let o=new Promise(((r,a)=>{let o=og();lg.enqueue(o,{resolve:r,reject:a}),i.postMessage({id:o,event:e,data:t},n)})).finally((()=>{dg.delete(a)}));return dg.set(a,o),o}function pg(t){let r=a.useRef(null),n=a.useRef(t.mfaMethods),i=h.useEmitPrivyEvent(),[o,s]=a.useState(!1);return a.useEffect((()=>{n.current=t.mfaMethods}),[t.mfaMethods]),a.useEffect((()=>{if(!o)return;let e=r.current;if(!e)return;function a(e){var r;e&&e.origin===t.origin&&"string"==typeof(r=e.data).event&&/^privy:.+/.test(r.event)&&function(e){switch(e.event){case"privy:iframe:ready":let t=lg.dequeue(e.event,e.id);return sg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=lg.dequeue(e.event,e.id);return sg(e)?r.reject(new Zl(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:create-additional":let n=lg.dequeue(e.event,e.id);return sg(e)?n.reject(new Zl(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:import":let i=lg.dequeue(e.event,e.id);return sg(e)?i.reject(new Zl(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:connect":let a=lg.dequeue(e.event,e.id);return sg(e)?a.reject(new Zl(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:recover":let o=lg.dequeue(e.event,e.id);return sg(e)?o.reject(new Zl(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:rpc":let s=lg.dequeue(e.event,e.id);return sg(e)?s.reject(new Zl(e.error.type,e.error.message)):s.resolve(e.data);case"privy:wallet:set-recovery":let l=lg.dequeue(e.event,e.id);return sg(e)?l.reject(new Zl(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let d=lg.dequeue(e.event,e.id);return sg(e)?d.reject(new Zl(e.error.type,e.error.message)):d.resolve(e.data);case"privy:mfa:init-enrollment":{let t=lg.dequeue(e.event,e.id);return sg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:submit-enrollment":{let t=lg.dequeue(e.event,e.id);return sg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:unenroll":{let t=lg.dequeue(e.event,e.id);return sg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:clear":{let t=lg.dequeue(e.event,e.id);return sg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:init-signer":{let t=lg.dequeue(e.event,e.id);return sg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:sign":{let t=lg.dequeue(e.event,e.id);return sg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:solana-wallet:create":let c=lg.dequeue(e.event,e.id);return sg(e)?c.reject(new Zl(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let u=lg.dequeue(e.event,e.id);return sg(e)?u.reject(new Zl(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:recover":let h=lg.dequeue(e.event,e.id);return sg(e)?h.reject(new Zl(e.error.type,e.error.message)):h.resolve(e.data);case"privy:solana-wallet:rpc":{let t=lg.dequeue(e.event,e.id);return sg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:delegated-actions:consent":{let t=lg.dequeue(e.event,e.id);return sg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}(e.data)}let s={create:r=>hg("privy:wallet:create",r,e,t.origin),createAdditional:r=>hg("privy:wallet:create-additional",r,e,t.origin),import:r=>hg("privy:wallet:import",r,e,t.origin),connect:r=>hg("privy:wallet:connect",r,e,t.origin),recover:r=>ig((n=>hg("privy:wallet:recover",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i,!r.recoveryMethod||"privy"===r.recoveryMethod),rpc:r=>ig((n=>hg("privy:wallet:rpc",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i),createSolana:r=>hg("privy:solana-wallet:create",r,e,t.origin),connectSolana:r=>hg("privy:solana-wallet:connect",r,e,t.origin),recoverSolana:r=>hg("privy:solana-wallet:recover",r,e,t.origin),rpcSolana:r=>hg("privy:solana-wallet:rpc",r,e,t.origin),createDelegatedAction:r=>hg("privy:delegated-actions:consent",r,e,t.origin),setRecovery:r=>ig((n=>hg("privy:wallet:set-recovery",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i),verifyMfa:r=>ig((n=>hg("privy:mfa:verify",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i,!0),initEnrollMfa:r=>ig((n=>hg("privy:mfa:init-enrollment",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i),submitEnrollMfa:r=>ig((n=>hg("privy:mfa:submit-enrollment",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i),unenrollMfa:r=>ig((n=>hg("privy:mfa:unenroll",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i,!0),clearMfa:r=>hg("privy:mfa:clear",r,e,t.origin),initFarcasterSigner:r=>hg("privy:farcaster:init-signer",r,e,t.origin),signFarcasterMessage:r=>hg("privy:farcaster:sign",r,e,t.origin)};window.addEventListener("message",a);let l=new AbortController;return c.invokeUntilSettled((()=>hg("privy:iframe:ready",{},e,t.origin)),{abortSignal:l.signal}).then((()=>t.onLoad(s)),((...e)=>{console.warn("Privy iframe failed to load: ",...e),t.onLoadFailed()})),()=>{window.removeEventListener("message",a),l.abort()}}),[o]),e.jsx("iframe",{ref:r,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>s(!0),src:c.constructURL(t.origin,`/apps/${t.appId}/embedded-wallets`,{caid:t.clientAnalyticsId,client_id:t.appClientId})})}class yg{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 kg({message:e.params.message})}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await Ag())throw Error("User must be authenticated to use embedded Solana wallet");if(!await _g())throw new s.PrivyClientError("Unable to connect to Solana embedded wallet");if("signMessage"===e.method)return await this.handleSignMessage(e);throw Error("Embedded Solana provider does not yet support this RPC method.")}constructor(e,t){this.walletProxy=e,this.address=t}}const mg="popup-privy-oauth",fg="PRIVY_OAUTH_USE_BROADCAST_CHANNEL";async function gg({url:e,popup:t,provider:r}){return t.location=e,new Promise(((e,r)=>{function n(){t?.close(),window.removeEventListener("message",i)}function i(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),n()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),n()),"PRIVY_OAUTH_ERROR"===t.data.type&&(r(t.data.error),n()))}window.addEventListener("message",i)}))}let vg,wg,xg,Cg,Eg,bg,Sg;function Ag(){return vg?vg.getAccessToken():Promise.resolve(c.e6.get(d.TOKEN_STORAGE_KEY)||null)}const jg=(e,t,r)=>wg(e,t,r),$g=(e,t,r)=>xg(e,t,r),Tg=(e,t,r,n)=>Cg(e,t,r,n),Pg=()=>Eg(),_g=()=>bg(),kg=({message:e})=>Sg({message:e});let Ng=l=>{let u=l.client,[p,y]=a.useState(!1),[m,g]=a.useState(!1),[w,x]=a.useState(!1),[C,E]=a.useState(null),[b,S]=a.useState([]),[A,j]=a.useState([]),[$,T]=a.useState(null),P=a.useRef(b),[_,k]=a.useState(!1),[N,I]=a.useState(null),[M,O]=a.useState(!1),[R,F]=a.useState({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:s.notImplemented}),[L,U]=a.useState({status:"initial"}),[D,W]=a.useState({status:"initial"}),[B,H]=a.useState({status:"initial"}),[G,q]=a.useState({status:"initial"}),[z,V]=a.useState({status:"initial"}),[K,Y]=a.useState(null),Z=d.useAppConfig(),X=d.useIsServerConfigLoaded(),[J,Q]=a.useState(!0),[ee,te]=a.useState({}),[re,ne]=a.useState(null),[ie,ae]=a.useState(null),[oe,se]=a.useState(!1),[le,de]=a.useState(!1),[ce,ue]=a.useState(Z.customAuth?.enabled?{status:"initial"}:{status:"not-enabled"}),he=a.useRef(null),pe=a.useRef(null),ye=a.useRef(h.privyEventsDefault),[me,fe]=a.useState(!1);u.onStoreToken=e=>{e&&h.emitPrivyEvent(ye,"accessToken","onAccessTokenGranted",e)},u.onDeleteToken=()=>{E(null),x(!1),h.emitPrivyEvent(ye,"accessToken","onAccessTokenRemoved")};let ge=a.useRef(null),ve=a.useRef(null),we=a.useRef(!1),xe=({showWalletUIs:e,typedData:t})=>we.current?we.current:void 0!==e?!e:void 0!==Z.embeddedWallets.showWalletUIs?!Z.embeddedWallets.showWalletUIs:t?Z.embeddedWallets.noPromptOnSignature||(Z.legacyWalletUiConfig??!1):!!Z.embeddedWallets.noPromptOnSignature,Ce=e=>{I(e),setTimeout((()=>{y(!0)}),15),u.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:e}})},Ee=e=>{"off"!==Z.embeddedWallets.createOnLogin&&Q(!0),Ce(e)};a.useEffect((()=>{let e=h.getPrivySolanaWallet(C);if(!e||!K)return void T(null);let t={type:"solana",imported:!1,address:e.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund(){throw new s.PrivyClientError("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:()=>{throw new s.PrivyClientError("Cannot unlink an embedded Solana wallet")},getProvider:async()=>new yg(K,e.address),signMessage:async e=>{let r=await Ag();if(!r||!K)throw new s.PrivyClientError("Must have valid access token and Privy wallet to send transaction",s.PrivyErrorCode.MUST_BE_AUTHENTICATED);if(!await Ge.recoverEmbeddedSolanaWallet().catch((()=>!1)))throw new s.PrivyClientError("Wallet couldn't be connected",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR);let{response:n}=await K.rpcSolana({accessToken:r,publicKey:t.address,request:{method:"signMessage",params:{message:Buffer.from(e).toString("base64")}}});return Buffer.from(n.data.signature,"base64")},async sendTransaction(e,t,r){let{signature:n}=await Fe({transaction:e,connection:t,transactionOptions:r,wallet:this});return n},async signTransaction(e){let t=await Ag();if(!t||!K)throw new s.PrivyClientError("Must have valid access token and Privy wallet to send transaction",s.PrivyErrorCode.MUST_BE_AUTHENTICATED);if(!await Ge.recoverEmbeddedSolanaWallet().catch((()=>!1)))throw new s.PrivyClientError("Wallet couldn't be connected",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR);return await xm({tx:e,accessToken:t,walletProxy:K,transactingWalletAddress:this.address}),e},loginOrLink:async()=>{throw new s.PrivyClientError("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{T(null)},isConnected:async()=>!0};T(t)}),[K,C]),a.useEffect((()=>{if(!C)return void u.connectors?.removeEmbeddedWalletConnectors();let e=h.getPrivyEthereumWallet(C),t=h.getPrivyEthereumHDWallets(C),r=h.getImportedPrivyEthereumWallet(C);e&&t.length||u.connectors?.removeEmbeddedWalletConnectors(),r||u.connectors?.removeImportedWalletConnector(),u.connectors?K?(e&&u.connectors.addEmbeddedWalletConnectors({walletProxy:K,rootWallet:e,embeddedWallets:t,defaultChain:Z.defaultChain,appId:l.appId}),r&&u.connectors.addImportedWalletConnector(K,r.address,Z.defaultChain,l.appId)):console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized"):console.debug("Failed to add embedded wallet connector: Client connectors not initialized")}),[K,C]),a.useEffect((()=>{K&&ie?.(K)}),[K]),a.useEffect((()=>{(async()=>{if(!Z.customAuth?.enabled)return void ue({status:"not-enabled"});Q(!0),ue({status:"loading"});let{getCustomAccessToken:e,isLoading:t}=Z.customAuth;if(m&&!t)try{let t=await e();if(!t&&w)return await He.logout(),ue({status:"done"}),void h.emitPrivyEvent(ye,"customAuth","onUnauthenticated");if(!t||w)return void ue({status:"done"});u.startAuthFlow(new _i(t));let{user:r,isNewUser:n}=await u.authenticate();if(!r)return await He.logout(),ue({status:"error",error:new s.PrivyClientError("Failed to sync with custom auth provider")}),void h.emitPrivyEvent(ye,"customAuth","onUnauthenticated");void 0!==n&&h.emitPrivyEvent(ye,"login","onComplete",r,n,!1,"custom",null),h.emitPrivyEvent(ye,"customAuth","onAuthenticated",{user:r}),ue({status:"done"}),E(r||null),k(n||!1),x(!0),de(!0)}catch(e){console.warn(e),w&&(await He.logout(),h.emitPrivyEvent(ye,"customAuth","onUnauthenticated")),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),ue({status:"error",error:e})}})()}),[Z.customAuth?.enabled,Z.customAuth?.getCustomAccessToken,Z.customAuth?.isLoading,m,w]),a.useEffect((()=>{le&&K&&C&&h.shouldProceedtoEmbeddedWalletCreationFlow(C,Z.embeddedWallets.createOnLogin)&&(de(!1),Oe(C,d.WALLET_PROXY_TIMEOUT).catch(console.error))}),[le&&K&&C]),a.useEffect((()=>{if(Z.externalWallets.solana.connectors)return Z.externalWallets.solana.connectors.onMount(),()=>Z.externalWallets.solana.connectors?.onUnmount()}),[Z.externalWallets.solana.connectors]),a.useEffect((()=>{!m&&X&&async function(){let e,t=be(),r=Se();(()=>{let e=new URLSearchParams(window.location.search).get("privy_token");if(!e)return;c.e6.put(d.FORKED_TOKEN_STORAGE_KEY,e);let t=new URL(window.location.href);t.searchParams.delete("privy_token"),window.history.pushState({},"",t)})();let n=i.createStore();u.initializeConnectorManager({walletConnectCloudProjectId:Z.walletConnectCloudProjectId,rpcConfig:Z.rpcConfig,chains:Z.chains,defaultChain:Z.defaultChain,store:n,walletList:Z.appearance.walletList,shouldEnforceDefaultChainOnConnect:Z.shouldEnforceDefaultChainOnConnect,externalWalletConfig:Z.externalWallets,appName:Z.name??"Privy"}),u.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=u.connectors.walletConnectors.length,r=u.connectors.walletConnectors.reduce(((e,t)=>e+(t.initialized?1:0)),0);r===t?fe(!0):e=setTimeout((()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:r,expected:t}),fe(!0)}),1500)})),u.connectors?.initialize().then((()=>{Pe()}));let a=await u.getAuthenticatedUser(),o=!!a;if(Z.customAuth?.enabled||(x(!!a),a&&h.emitPrivyEvent(ye,"login","onComplete",a,!1,!0,null,null),E(a)),!t)return r&&!o?(ve.current="login",te({telegramAuthModalData:{seamlessAuth:!0}}),void Ee(v.ModalScreen.TELEGRAM_AUTH_SCREEN)):void Ge.setReadyToTrue(!!a);ve.current=o?"link":"login"}()}),[u,re,m,X]),a.useEffect((()=>{if(m){if(!C||!C.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void se(!0);se(!!b.find((e=>"privy"===e.walletClientType)))}}),[m,C,b]);let be=()=>{let e=da();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(mg).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!e.headless&&(u.startAuthFlow(new Yi(e)),Ee(v.ModalScreen.AWAITING_OAUTH_SCREEN),!0))},Se=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),n=Number(e.get("auth_date")||""),i=e.get("first_name"),a=e.get("last_name")||void 0,o=e.get("username")||void 0,s=e.get("photo_url")||void 0;if(t&&i&&n&&r)return{id:t,first_name:i,last_name:a,username:o,photo_url:s,auth_date:n,hash:r}}())?(ba(),{...e,flowType:"login-url"}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id")||void 0,n=t.get("user"),i=Number(t.get("auth_date")||""),a=t.get("hash"),o=t.get("chat_instance")||void 0,s=t.get("chat_type")||void 0,l=t.get("start_param")||void 0;return n&&i&&a?{query_id:r,user:n,auth_date:i,hash:a,chat_instance:o,chat_type:s,start_param:l}:void 0}())?(ba(),{...e,flowType:"web-app"}):void 0}();if(!e||!Z.loginMethods.telegram||!Z.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new Ca;return u.startAuthFlow(t),"login-url"===e.flowType&&(t.meta.telegramWebAppData=void 0,t.meta.telegramAuthResult={id:e.id,first_name:e.first_name,last_name:e.last_name,auth_date:e.auth_date,username:e.username,photo_url:e.photo_url,hash:e.hash}),"web-app"===e.flowType&&(t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData={query_id:e.query_id,user:e.user,auth_date:e.auth_date,hash:e.hash,chat_instance:e.chat_instance,chat_type:e.chat_type,start_param:e.start_param}),!0},Ae=async(e,t,r,n)=>{je(await(u.connectors?.createEthereumWalletConnector(e,t))||null,t,r,n)};async function je(e,t,r,n){if(!e)return F({status:"disconnected",connectedWallet:null,connectError:new s.PrivyConnectorError("Unable to connect to wallet."),connector:null,connectRetry:s.notImplemented}),n?.(null,r);F({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:s.notImplemented}),e instanceof Ja&&t&&await e.resetConnection(t),F({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>je(e,t,r,n)});try{let t=await e.connect({showPrompt:!0});if((!t||Ia(t))&&Z.shouldEnforceDefaultChainOnConnect&&!Z.chains.find((e=>e.id===Number(t?.chainId.replace("eip155:",""))))&&("wallet_connect_v2"!==t?.connectorType||"metamask"!==t?.walletClientType)){F((t=>({...t,connector:e,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:s.notImplemented})));try{await(t?.switchChain(Z.defaultChain.id)),t&&(t.chainId=c.formatChainIdToCAIP2(c.toHex(Z.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${Z.defaultChain.id}`)}}return F((e=>({...e,status:"connected",connectedWallet:t,connectError:null,connectRetry:s.notImplemented}))),t&&h.emitPrivyEvent(ye,"connectWallet","onSuccess",t),n?.(t,r)}catch(e){return e instanceof s.PrivyError?(console.warn(e.cause?e.cause:e.message),h.emitPrivyEvent(ye,"connectWallet","onError",e.privyErrorCode||s.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),h.emitPrivyEvent(ye,"connectWallet","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR)),F((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),n?.(null,r)}}let $e=async(e,t,r)=>{if(null===e||!Ia(e))return;let n=new pa(e,u,t,r);u.startAuthFlow(n)},Te=async(e,t)=>{if(null===e||!f.isBaseConnectedSolanaWallet(e))return;let r=new ya(e,u,t);u.startAuthFlow(r)},Pe=()=>{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||c.isPhantomInstalled()||Ee(v.ModalScreen.LOGIN_FAILED_SCREEN),!u.connectors)throw new s.PrivyClientError("Connector not initialized");Ce(v.ModalScreen.AWAITING_CONNECTION);let n=new URL(window.location.href);n.searchParams.delete("privy_connector"),n.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",n),Ae(t,r,void 0,$e)};a.useEffect((()=>{m&&w&&null===C&&u.getAuthenticatedUser().then(E)}),[m,w,C,u]);let _e=e=>{if(!w)throw h.emitPrivyEvent(ye,"linkAccount","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:e}),new s.PrivyClientError("User must be authenticated before linking an account.")},ke=()=>{_e("siwe"),ge.current="siwe",ve.current="link",Ce(v.ModalScreen.LINK_WALLET_SCREEN)},Ne=e=>{if(!w||!C)return!1;if("privy"===e.walletClientType)return!0;for(let t of C.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},Ie=async e=>{let t;if(!u.connectors)throw new s.PrivyClientError("Connector not initialized");t="ethereum"===e.type?u.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:u.connectors.findSolanaWalletConnector(e.connectorType,e.walletClientType)||null,F((r=>({...r,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:s.notImplemented}))),Z.captchaEnabled&&!w?(te({captchaModalData:{callback:t=>Ia(e)?$e(e,t):Te(e,t),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_CONNECTION,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),Ee(v.ModalScreen.CAPTCHA_SCREEN)):(Ia(e)?await $e(e):await Te(e),Ee(v.ModalScreen.AWAITING_CONNECTION))},Me=()=>{S((e=>{let t=u.connectors?.wallets.filter(Ia).map((e=>({...e,linked:Ne(e),loginOrLink:async()=>{if(!await e.isConnected())throw new s.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new s.PrivyClientError("Cannot link or login with embedded wallet");Ie(e)},fund:async t=>{await Ge.fundWallet(e.address,t)},unlink:async()=>{if(!w)throw new s.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new s.PrivyClientError("Cannot unlink an embedded wallet");E(await u.unlinkEthereumWallet(e.address))}})))||[];return ro(e,t)?e:t})),j((e=>{let t=u.connectors?.wallets.filter(f.isBaseConnectedSolanaWallet).map((e=>({...e,linked:Ne(e),loginOrLink:async()=>{if(!await e.isConnected())throw new s.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new s.PrivyClientError("Cannot link or login with embedded wallet");Ie(e)},fund:async()=>{throw new s.PrivyClientError("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:async()=>{if(!w)throw new s.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new s.PrivyClientError("Cannot unlink an embedded wallet");E(await u.unlinkSolanaWallet(e.address))}})))||[];return ro(e,t)?e:t}))};a.useEffect((()=>{Me()}),[C?.linkedAccounts,w,m]),a.useEffect((()=>{if(m){if(!u.connectors)throw new s.PrivyClientError("Connector not initialized");Me(),u.connectors.on("walletsUpdated",Me)}}),[m]),a.useEffect((()=>{let e;if(!b[0])return;let t=b[0],r=P.current.find((e=>e.address===t.address));if(e="privy"===t.walletClientType?C?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"===e.walletClientType)):C?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"!==e.walletClientType)),!r&&e){let t=Object.assign({},C);t.wallet=e&&{address:e.address,chainType:e.chainType,chainId:e.chainId,walletClient:e.walletClient,walletClientType:e.walletClientType,connectorType:e.connectorType,imported:e.imported,walletIndex:e.walletIndex},E(t)}P.current=b}),[b]);let Oe=async(e,t,r)=>{let n=h.getPrivyEthereumWallet(e),i=h.getPrivySolanaWallet(e);if(n&&!r?.createAdditional)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");let[a,o]=await Promise.all([Ge.initializeWalletProxy(t),Ag()]);if(!a&&Z.customAuth?.enabled)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(!a||!o||Z.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise(((e,t)=>{Q(!0),te({createWallet:{onSuccess:t=>{h.emitPrivyEvent(ye,"createWallet","onSuccess",t),e(t)},onFailure:e=>{h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),t(e)},callAuthOnSuccessOnClose:!1}}),Ce(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}));{if(n){let t=h.getPrivyEthereumHDWallets(e),r=t?.length?Math.max(...t.map((e=>e.walletIndex))):n.walletIndex;await Ge.recoverEmbeddedEthereumWallet(),await a.createAdditional({accessToken:o,primaryWalletAddress:n?.address,hdWalletIndex:r+1})}else console.log("solanaWallet",i),await a.create({accessToken:o,solanaAddress:i?.address});let t=h.getPrivyEthereumWallet(await Ge.refreshUser());if(!t)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");return h.emitPrivyEvent(ye,"createWallet","onSuccess",t),t}},Re=(e,r,n,i)=>new Promise((async(a,o)=>{let{requesterAppId:d}=r||{};if(!w||!C)return h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),void o(Error("User must be authenticated before signing with a Privy wallet"));let u=i??h.getPrivyEthereumWallet(C)?.address;if(!u)throw new s.PrivyClientError("User must have an embedded wallet to send a transaction.");let{signingWallet:p,rootWallet:y}=h.getSigningAndRootWallet(C,u);if(!y||!p)return h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void o(Error("Must have a Privy wallet before signing"));Q(!0);let m=qe.wallets.find((e=>"privy"===e.walletClientType&&t.getAddress(e.address)===t.getAddress(p.address))),g=await(m?.getEthereumProvider());if(!m||!g)throw new s.PrivyClientError(`Cannot sendTransaction before embedded wallet ${p.address} is connected`);let x=e.chainId?Number(e.chainId):Em(m.chainId);(e=>{if(!Z.chains.map((e=>e.id)).includes(e))throw new s.PrivyConnectorError(`Chain ID ${e} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,s.PrivyErrorCode.UNSUPPORTED_CHAIN_ID)})(x);let E=Object.assign({},e,{chainId:x});if(xe({showWalletUIs:r?.showWalletUIs}))(async()=>{let e=await Ag();if(!e||!K)return h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void o(Error("Must have valid access token and Privy wallet to send transaction"));try{if(!await Ge.recoverEmbeddedEthereumWallet())return h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),void o(Error("Unable to connect to wallet"));let t=c.getJsonRpcProvider(E.chainId,Z.chains,Z.rpcConfig,{appId:l.appId}),n=await or(p.address,E,t);if(xe({showWalletUIs:r?.showWalletUIs})){let{totalGasEstimate:e}=await ir(n,t),{hasSufficientFunds:r}=await pf(p.address,n,e,t);if(!r)throw new f.PrivyProviderRpcError(new f.ProviderRpcError("Wallet has insufficient funds for this transaction.",f.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let i=await hf({accessToken:e,rootWallet:y,transactingWallet:p,walletProxy:K,transactionRequest:n,provider:t,requesterAppId:d});h.emitPrivyEvent(ye,"sendTransaction","onSuccess",i),a(i)}catch(e){h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.TRANSACTION_FAILURE),o(e)}})();else{let e={address:y.address,onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:e=>{h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),o(e)}},t=Sm({address:p.address,appConfig:Z,fundWalletConfig:n,chainIdOverride:E.chainId,comingFromSendTransactionScreen:!0});te({connectWallet:e,sendTransaction:{transactionRequest:E,transactingWallet:p,rootWallet:y,onSuccess:e=>{h.emitPrivyEvent(ye,"sendTransaction","onSuccess",e),a(e)},onFailure:e=>{h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.TRANSACTION_FAILURE),o(e)},uiOptions:r||{},fundWalletConfig:n,requesterAppId:d},funding:t}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),Fe=({transaction:e,connection:t,transactionOptions:r,fundWalletConfig:n,uiOptions:i,wallet:a})=>new Promise((async(o,l)=>{let{requesterAppId:d}=i||{};if(!w||!C)return h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),void l(new s.PrivyClientError("User must be authenticated before signing with a Privy wallet",s.PrivyErrorCode.MUST_BE_AUTHENTICATED));let c=a?C.linkedAccounts.find((e=>"wallet"===e.type&&e.address===a.address)):h.getPrivySolanaWallet(C);if(!c)return h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void l(new s.PrivyClientError("Must have a Privy wallet before signing",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND));Q(!0);let u=a??$,p=await(u?.isConnected());if(!u||!p)throw h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),new s.PrivyClientError(`Cannot sendSolanaTransaction before embedded wallet ${c.address} is connected`,s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND);if(xe({showWalletUIs:i?.showWalletUIs}))(async()=>{let n=await Ag();if(!n||!K)return h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void l(new s.PrivyClientError("Must have valid access token and Privy wallet to send transaction",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND));try{if(!await Ge.recoverEmbeddedSolanaWallet())return h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),void l(new s.PrivyClientError("Unable to connect to wallet",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR));if(xe({showWalletUIs:i?.showWalletUIs})){let{instructions:r}=await eu(e,t);r.every((e=>e.hasFunds))||(h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.INSUFFICIENT_BALANCE),l(new s.PrivyClientError("Solana wallet has insufficient funds for this transaction.",s.PrivyErrorCode.INSUFFICIENT_BALANCE)))}let{signature:a,receipt:d}=await Cm({accessToken:n,tx:e,connection:t,walletProxy:K,transactionOptions:r,transactingWalletAddress:c.address}),u=Qc(a,d);h.emitPrivyEvent(ye,"sendSolanaTransaction","onSuccess",u),o(u)}catch(e){h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.TRANSACTION_FAILURE),l(e)}})();else{let a={address:c.address,onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN,onFailure:e=>{h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),l(e)}},u=Am({address:c.address,appConfig:Z,fundWalletConfig:n,comingFromSendTransactionScreen:!0});te({connectWallet:a,sendSolanaTransaction:{transactionRequest:e,connection:t,transactionOptions:r,transactingWallet:c,onSuccess:e=>{h.emitPrivyEvent(ye,"sendSolanaTransaction","onSuccess",e),o(e)},onFailure:e=>{h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.TRANSACTION_FAILURE),l(e)},uiOptions:i||{},requesterAppId:d},funding:u}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}}));function Le(){return new Promise((async(e,t)=>{let r=await Ag();if(!r||!K)throw Error("Must have valid access token to enroll in MFA");try{await K.verifyMfa({accessToken:r}),e()}catch(e){t(e)}}))}let Ue=e=>e?.linkedAccounts.filter((e=>null!==e.latestVerifiedAt&&!("wallet"===e.type&&"privy"===e.walletClientType))).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0],De=e=>{let t=C?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:r,loginMethod:n}=pp(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw h.emitPrivyEvent(ye,"linkAccount","onError",s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:n}),new s.PrivyClientError(`User already has an account of type ${r} linked.`)};async function We({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){I(null);let r=t?"setWalletPassword":"setWalletRecovery";if(!w||!C)throw h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let n=h.getPrivyEthereumWallet(C);if(!n||!K)throw h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");if(h.getPrivySolanaWallet(C))throw Error("Cannot set user-controlled recovery for user with Solana.");try{await Le()}catch(e){throw h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.MISSING_MFA_CREDENTIALS),e}return new Promise(((i,a)=>{Q(!0);let o={onSuccess:e=>{h.emitPrivyEvent(ye,r,"onSuccess","user-passcode",e),i(e)},onFailure:e=>{h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.USER_EXITED_SET_PASSWORD_FLOW),a(e)},callAuthOnSuccessOnClose:!1},l="user-passcode"===n.recoveryMethod;te({setWalletPassword:o,createWallet:o,connectWallet:{onCompleteNavigateTo:ad({walletAction:"update",availableRecoveryMethods:Z.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:l,showAutomaticRecovery:e}),shouldForceMFA:!1,onFailure:e=>{h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),a(e)}},recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:l}}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}))}async function Be({appId:e,action:t}){let r=await Ag();if("link"===t&&!r)throw h.emitPrivyEvent(ye,"linkAccount","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new s.PrivyClientError("User must be authenticated before linking an account.");if("login"===t&&r)throw h.emitPrivyEvent(ye,"login","onError",s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),new s.PrivyClientError("Attempted to log in, but user is already logged in. Use a `link` helper instead.");ge.current=`privy:${e}`,ve.current=t;let n=window.open(void 0,void 0,dh({w:440,h:680}));return u.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(r,i)=>{let{name:a,logoUrl:o}=await oh({api:u.api,providerAppId:e,requesterAppId:Z.id});te({crossAppAuth:{appId:e,name:a,logoUrl:o,action:t,popup:n,onSuccess:r,onError:i}}),Ee(v.ModalScreen.CROSS_APP_AUTH_SCREEN)}))}let He={ready:m,authenticated:w,user:C,walletConnectors:u.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),te({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress}}),Ce(w?v.ModalScreen.CONNECT_ONLY_AUTHENTICATED_SCREEN:v.ModalScreen.CONNECT_ONLY_LANDING_SCREEN)},importWallet:async({privateKey:e})=>{_e("siwe");let[t,r]=await Promise.all([Ge.initializeWalletProxy(15e3),Ag()]);if(t&&r){await t.import({privateKey:e,accessToken:r});let n=h.getImportedPrivyEthereumWallet(await Ge.refreshUser());if(!n)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return h.emitPrivyEvent(ye,"createWallet","onSuccess",n),n}throw new s.PrivyClientError("User is not authenticated")},linkWallet:ke,startCrossAppAuthFlow:Be,linkEmail:()=>{_e("email"),De("email"),ge.current="email",ve.current="link",Ce(v.ModalScreen.LINK_EMAIL_SCREEN)},linkPhone:()=>{_e("sms"),De("phone"),ge.current="sms",ve.current="link",Ce(v.ModalScreen.LINK_PHONE_SCREEN)},linkGoogle:async()=>{_e("google"),De("google_oauth"),ve.current="link",await Ge.initLoginWithOAuth("google")},linkTwitter:async()=>{_e("twitter"),De("twitter_oauth"),ve.current="link",await Ge.initLoginWithOAuth("twitter")},linkDiscord:async()=>{_e("discord"),De("discord_oauth"),ve.current="link",await Ge.initLoginWithOAuth("discord")},linkGithub:async()=>{_e("github"),De("github_oauth"),ve.current="link",await Ge.initLoginWithOAuth("github")},linkSpotify:async()=>{_e("spotify"),De("spotify_oauth"),ve.current="link",await Ge.initLoginWithOAuth("spotify")},linkInstagram:async()=>{_e("instagram"),De("instagram_oauth"),ve.current="link",await Ge.initLoginWithOAuth("instagram")},linkTiktok:async()=>{_e("tiktok"),De("tiktok_oauth"),ve.current="link",await Ge.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{_e("linkedin"),De("linkedin_oauth"),ve.current="link",await Ge.initLoginWithOAuth("linkedin")},linkApple:async()=>{_e("apple"),De("apple_oauth"),ve.current="link",await Ge.initLoginWithOAuth("apple")},linkPasskey:async()=>{_e("passkey"),De("passkey"),await Ge.initLinkWithPasskey(),Ce(v.ModalScreen.LINK_PASSKEY_SCREEN)},linkTelegram:async()=>{_e("telegram"),De("telegram"),ve.current="link",ge.current="telegram",await Ge.initLoginWithTelegram(),Ce(v.ModalScreen.TELEGRAM_AUTH_SCREEN)},linkFarcaster:async()=>{_e("farcaster"),De("farcaster"),await Ge.initLoginWithFarcaster(),ve.current="link",ge.current="farcaster",Ce(v.ModalScreen.AWAITING_FARCASTER_CONNECTION)},updateEmail:()=>{if(_e("email"),!C?.email)throw new s.PrivyClientError("User does not have an email linked to their account.");ve.current="update",ge.current="email",Ce(v.ModalScreen.UPDATE_EMAIL_SCREEN)},updatePhone:()=>{if(_e("sms"),!C?.phone)throw new s.PrivyClientError("User does not have a phone number linked to their account.");ve.current="update",ge.current="sms",Ce(v.ModalScreen.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(!m){let e=await new Promise((e=>{ne((t=>e.bind(t)))}));if(ne(null),e)return void console.warn(t)}!C||C.isGuest?(ve.current="login",te({login:e}),Ee(v.ModalScreen.LANDING)):console.warn(t)},connectOrCreateWallet:async()=>{m||(await new Promise((e=>{ne((()=>e))})),ne(null)),w?console.warn("User must be unauthenticated to `connectOrCreateWallet`"):Ee(v.ModalScreen.CONNECT_OR_CREATE)},logout:async()=>{if(C&&u.clearProviderAcccessTokens(C),I(null),await u.logout(),C&&K)try{await K.clearMfa({userId:C.id})}catch(e){}E(null),x(!1),h.emitPrivyEvent(ye,"logout","onSuccess"),ve.current=null,ge.current=null,y(!1),c.e6.del(d.CLIENT_ANALYTICS_ID_KEY),c.e6.del(d.getGuestCredentialStorageKey(Z.id))},getAccessToken:()=>u.getAccessToken(),getEthereumProvider:()=>{if(!C||!C.wallet)return new ja;let e=b.find((e=>C.wallet&&e.address===C.wallet.address)),t=u.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new ja},getEthersProvider:()=>{if(!C||!C.wallet)return new r.Web3Provider(new Pa(new ja));let e=b.find((e=>C.wallet&&e.address===C.wallet.address)),t=u.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new r.Web3Provider(new Pa(e&&t?t.proxyProvider:new ja))},getWeb3jsProvider:()=>{if(!C||!C.wallet)return new _a(new ja);let e=b.find((e=>C.wallet&&e.address===C.wallet.address)),t=u.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new _a(e&&t?t.proxyProvider:new ja)},unlinkWallet:async e=>{let t;return E(t=e.startsWith("0x")?await u.unlinkEthereumWallet(e):await u.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await u.unlinkEmail(e);return E(t),t},unlinkPhone:async e=>{let t=await u.unlinkPhone(e);return E(t),t},unlinkGoogle:async e=>{let t=await u.unlinkOAuth("google",e);return E(t),t},unlinkTwitter:async e=>{let t=await u.unlinkOAuth("twitter",e);return E(t),t},unlinkDiscord:async e=>{let t=await u.unlinkOAuth("discord",e);return E(t),t},unlinkGithub:async e=>{let t=await u.unlinkOAuth("github",e);return E(t),t},unlinkSpotify:async e=>{let t=await u.unlinkOAuth("spotify",e);return E(t),t},unlinkInstagram:async e=>{let t=await u.unlinkOAuth("instagram",e);return E(t),t},unlinkTiktok:async e=>{let t=await u.unlinkOAuth("tiktok",e);return E(t),t},unlinkLinkedIn:async e=>{let t=await u.unlinkOAuth("linkedin",e);return E(t),t},unlinkApple:async e=>{let t=await u.unlinkOAuth("apple",e);return E(t),t},unlinkFarcaster:async e=>{let t=await u.unlinkFarcaster(e);return E(t),t},unlinkTelegram:async e=>{let t=await u.unlinkTelegram(e);return E(t),t},unlinkPasskey:async e=>{let t=await u.unlinkPasskey(e);return E(t),t},unlinkCrossAppAccount:async({subject:e})=>{let t=C?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new s.PrivyClientError("Invalid subject");u.storeProviderAccessToken(t.id,null);let r=await u.unlinkOAuth(`privy:${t.id}`,e);return E(r),r},setActiveWallet:async e=>{let r=b.find((r=>t.getAddress(r.address)===t.getAddress(e))),n=C?.linkedAccounts.find((r=>"wallet"===r.type&&t.getAddress(r.address)===t.getAddress(e)));if(r&&await r.isConnected())if(r.linked){let e=Object.assign({},C);e.wallet=n&&{address:n.address,chainType:n.chainType,chainId:n.chainId,walletClient:n.walletClient,walletClientType:n.walletClientType,connectorType:n.connectorType,imported:n.imported,walletIndex:n.walletIndex},E(e)}else r.loginOrLink();else te({externalConnectWallet:{suggestedAddress:e}}),ke()},forkSession:()=>u.forkSession(),createWallet:async e=>{if(e&&"target"in e&&e&&(e=void 0),!w||!C)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return Oe(C,15e3,e)},setWalletRecovery:async e=>We({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>We({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:a}=t||{};if(!w||!C)return h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let o=r??h.getPrivyEthereumWallet(C)?.address;if(!o)throw new s.PrivyClientError("User must have an embedded wallet to sign a message.");let{signingWallet:l,rootWallet:d}=h.getSigningAndRootWallet(C,o);if(!l||!d)return h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));if("string"!=typeof e||e.length<1)return h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.INVALID_MESSAGE),void i(Error("Message must be a non-empty string"));Q(!0);let c=async()=>{if(!w)throw Error("User must be authenticated before signing with a Privy wallet");let t=await Ag();if(!K||!t||!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");u.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:l.address,requesterAppId:a}});let{response:r}=await K.rpc({accessToken:t,address:d.address,hdWalletIndex:l.walletIndex??void 0,requesterAppId:a,request:{method:"personal_sign",params:[e,l.address]}}),n=r.data;return u.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:l.address,requesterAppId:a}}),n};if(xe({showWalletUIs:t?.showWalletUIs}))try{let e=await c();h.emitPrivyEvent(ye,"signMessage","onSuccess",e),n(e)}catch(e){h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.UNABLE_TO_SIGN),i(e??new f.PrivyProviderRpcError("Unable to sign message"))}else te({signMessage:{method:"personal_sign",data:e,confirmAndSign:c,onSuccess:e=>{h.emitPrivyEvent(ye,"signMessage","onSuccess",e),n(e)},onFailure:e=>{h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),i(e)},address:d.address}}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})),signTypedData:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:a}=t||{};if(!w||!C)return h.emitPrivyEvent(ye,"signTypedData","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let o=r??h.getPrivyEthereumWallet(C)?.address;if(!o)throw new s.PrivyClientError("User must have an embedded wallet to sign a message.");let{signingWallet:l,rootWallet:d}=h.getSigningAndRootWallet(C,o);if(!d||!l)return h.emitPrivyEvent(ye,"signTypedData","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));Q(!0);let p=c.generateTypedDataWithDomainType(e),y=async()=>{if(!w)throw Error("User must be authenticated before signing with a Privy wallet");let e=await Ag();if(!K||!e||!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");u.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:l.address,requesterAppId:a}});let{response:t}=await K.rpc({accessToken:e,address:d.address,hdWalletIndex:l.walletIndex??void 0,requesterAppId:a,request:{method:"eth_signTypedData_v4",params:[l.address,p]}}),r=t.data;return u.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:l.address,requesterAppId:a}}),r};if(xe({showWalletUIs:t?.showWalletUIs,typedData:!0}))try{let e=await y();h.emitPrivyEvent(ye,"signTypedData","onSuccess",e),n(e)}catch(e){h.emitPrivyEvent(ye,"signTypedData","onError",s.PrivyErrorCode.UNABLE_TO_SIGN),i(e??new f.PrivyProviderRpcError("Unable to sign message"))}else te({signMessage:{method:"eth_signTypedData_v4",data:p,confirmAndSign:y,onSuccess:e=>{h.emitPrivyEvent(ye,"signTypedData","onSuccess",e),n(e)},onFailure:e=>{h.emitPrivyEvent(ye,"signTypedData","onError",s.PrivyErrorCode.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{address:d.address,onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}}}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})),sendTransaction:async(e,t,r,n)=>{let i=await Re(e,t,r,n);return yf(await i.wait())},sendSolanaTransaction:async(e,t,r,n,i)=>await Fe({transaction:e,connection:t,transactionOptions:n,uiOptions:r,fundWalletConfig:i,wallet:$??void 0}),exportWallet:e=>new Promise((async(r,n)=>{if(!w||!C)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,a=C.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"ethereum"===e.chainType)),o=i?a.find((e=>e.address===t.getAddress(i))):a.find((e=>!e.imported))||a[0];if(!o)return void n(Error("Must have a Privy wallet before exporting"));Q(!0);let s={onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN,onFailure:n,address:o.address,shouldForceMFA:!0};te(ee),await Ag()&&K?K?(te({keyExport:{appId:l.appId,appClientId:l.clientId,origin:u.apiUrl,wallet:o,onSuccess:r,onFailure:n},connectWallet:s}),Ce(v.ModalScreen.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:Le,async init(e){switch(e){case"sms":return void await u.initMfaSmsVerification();case"passkey":return await u.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 s.PrivyClientError("Invalid MFA code");he.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{pe.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new s.PrivyClientError("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));he.current?.resolve({mfaMethod:e,mfaCode:n,relyingParty:window.origin}),await new Promise(((e,t)=>{pe.current={resolve:e,reject:t}}));break;default:throw he.current?.reject(new s.PrivyClientError("Unsupported MFA method")),new s.PrivyClientError(`Unsupported MFA method: ${e}`)}},cancel(){he.current?.reject(new s.PrivyClientError("MFA canceled"))},async initEnrollmentWithSms(e){let t=await Ag();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.initEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber})},enrollInMfa:e=>new Promise(((t,r)=>{if(!e)return Ge.closePrivyModal(),void t();Z.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."),te({mfaEnrollmentFlow:{mfaMethods:Z.mfa.methods,onSuccess:t,onFailure:r}}),Ce(v.ModalScreen.MFA_ENROLLMENT_FLOW_SCREEN)})),async initEnrollmentWithTotp(){let e=await Ag();if(!e||!K)throw Error("Must have valid access token to enroll in MFA");let t=await K.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await Ag();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),E(await u.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await Ag();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),E(await u.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e}){let t=await Ag();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:e}),E(await u.getAuthenticatedUser())},async unenroll(e){let t=await Ag();if(!t||!K)throw Error("Must have valid access token to remove MFA");"passkey"===e?await K.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:[]}):await K.unenrollMfa({method:e,accessToken:t}),E(await u.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await Ag(),t=C?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!K||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(!C?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");let r=await K.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===r.status&&E(await u.getAuthenticatedUser()||C||null),te({farcasterSigner:r}),Ce(v.ModalScreen.AWAITING_FARCASTER_SIGNER)},getFarcasterSignerPublicKey:async()=>{let e,t=await Ag(),r=C?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!K||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!C?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");if(!C.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=C.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await Ag(),r=C?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!K||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!C?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");if(!C.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let n=await import("@simplewebauthn/browser"),i=await K.signFarcasterMessage({address:r.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:n.bufferToBase64URLString(e)},fid:BigInt(C.farcaster.fid),relyingParty:window.origin});return new Uint8Array(n.base64URLStringToBuffer(i.signature))},createGuestAccount:async()=>{if(C&&!C.isGuest)throw Error("User cannot already be authenticated to create a guest account");return C?.isGuest?C:Ge.loginWithGuestAccountFlow()},isHeadlessOAuthLoading:M,async loginWithCode(e){await Ge.loginWithCode(e)},initLoginWithEmail:e=>Ge.initLoginWithEmail(e),initLoginWithSms:e=>Ge.initLoginWithSms(e),otpState:B,fundWallet:(e,t)=>Ge.fundWallet(e,t),initLoginWithHeadlessOAuth:(e,t)=>Ge.initLoginWithHeadlessOAuth(e,t),loginWithHeadlessOAuth:e=>Ge.loginWithHeadlessOAuth(e),generateSiweMessage:({address:e,chainId:t})=>Ge.generateSiweMessage({address:e,chainId:t}),async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){_e("siwe"),await Ge.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})},signMessageWithCrossAppWallet:(e,{address:t})=>sh({user:C,client:u,address:t,requesterAppId:Z.id,request:{method:"personal_sign",params:[e,t]},reconnect:Be}),signTypedDataWithCrossAppWallet(e,{address:t}){let r=c.generateTypedDataWithDomainType(e);return sh({user:C,client:u,address:t,requesterAppId:Z.id,request:{method:"eth_signTypedData_v4",params:[t,r]},reconnect:Be})},sendTransactionWithCrossAppWallet:(e,{address:t})=>sh({user:C,client:u,address:t,requesterAppId:Z.id,request:{method:"eth_sendTransaction",params:[e]},reconnect:Be}),isModalOpen:p,mfaMethods:Z.mfa.methods};wg=He.signMessage,xg=He.signTypedData,Cg=async(...e)=>{let t=await Re(...e);return Z.embeddedWallets.waitForTransactionConfirmation&&await t.wait(),t};let Ge={isNewUserThisSession:_,pendingTransaction:null,walletConnectionStatus:R,connectors:u.connectors?.walletConnectors??[],solanaWallets:A,rpcConfig:Z.rpcConfig,chains:Z.chains,appId:l.appId,showFiatPrices:"native-token"!==Z.embeddedWallets.priceDisplay.primary,clientAnalyticsId:u.clientAnalyticsId,customAuthStatus:ce,noPromptOnSignature:we,emailOtpState:D,setEmailOtpState:W,smsOtpState:B,setSmsOtpState:H,oAuthState:z,setOAuthState:V,siweState:G,setSiweState:q,nativeTokenSymbolForChainId:e=>Z.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(K)return K;let t=new Promise((e=>{ae((()=>t=>e(t)))})),r=new Promise((t=>setTimeout((()=>t(null)),e))),n=await Promise.race([t,r]);return ae(null),n},getAuthFlow:()=>u.authFlow,getAuthMeta:()=>u.authFlow?.meta,client:u,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,r=m&&w&&C;r&&ge.current&&(t=Ue(C)),"login"===ve.current?e.shouldCallAuthOnSuccess&&r&&ge.current?(h.emitPrivyEvent(ye,"login","onComplete",C,_,!1,ge.current,t??null),l.onSuccess?.(C,_)):h.emitPrivyEvent(ye,"login","onError",s.PrivyErrorCode.USER_EXITED_AUTH_FLOW):"link"===ve.current&&t?e.isSuccess&&r&&ge.current?h.emitPrivyEvent(ye,"linkAccount","onSuccess",C,ge.current,t):ge.current&&h.emitPrivyEvent(ye,"linkAccount","onError",s.PrivyErrorCode.USER_EXITED_LINK_FLOW,{linkMethod:ge.current}):"update"===ve.current&&t&&(e.isSuccess&&r&&ge.current?h.emitPrivyEvent(ye,"update","onSuccess",C,ge.current,t):ge.current&&h.emitPrivyEvent(ye,"update","onError",s.PrivyErrorCode.USER_EXITED_UPDATE_FLOW,{linkMethod:ge.current}));let i=N&&jm.includes(N),a=N===v.ModalScreen.ERROR_SCREEN&&ee.errorModalData&&jm.includes(ee.errorModalData.previousScreen);if((i||a)&&ee.funding){let e,t=$m[N]??null;if("solana"===ee.funding.chainType){try{e=await new n.Connection(qc(ee.funding.cluster)).getBalance(new n.PublicKey(ee.funding.address)).then((e=>BigInt(e)))}catch{console.error("Unable to pull wallet balance")}h.emitPrivyEvent(ye,"fundSolanaWallet","onUserExited",{address:ee.funding.address,cluster:ee.funding.cluster,fundingMethod:t,balance:e})}else{let r=c.getJsonRpcProvider(ee.funding.chain.id,Z.chains,Z.rpcConfig,{appId:l.appId});try{e=(await r.getBalance(ee.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}h.emitPrivyEvent(ye,"fundWallet","onUserExited",{address:ee.funding.address,chain:ee.funding.chain,fundingMethod:t,balance:e})}}te({...ee,externalConnectWallet:{suggestedAddress:void 0}}),ve.current=null,ge.current=null,k(!1),y(!1),setTimeout((()=>{u.authFlow=void 0}),200),u.createAnalyticsEvent({eventName:"modal_closed"})},solanaSignMessage:async({message:e})=>new Promise((async(t,r)=>{let n=async()=>{let t=await u.getAccessToken();if(!t)throw Error("User must be authenticated to use their embedded wallet.");if(!$)throw Error("User must have an embedded Solana wallet to sign messages for Solana.");let r=Ge.walletProxy??await Ge.initializeWalletProxy(15e3);if(!r)throw Error("Failed to initialize embedded wallet proxy.");let{response:n}=await r.rpcSolana({accessToken:t,publicKey:$.address,request:{method:"signMessage",params:{message:e}}});return n.data.signature};if(xe({showWalletUIs:void 0}))try{let e=await n();t({signature:e})}catch(e){r(e)}else te({signMessage:{method:"solana_signMessage",data:e,confirmAndSign:n,onSuccess:e=>{t({signature:e})},onFailure:e=>{r(e)},uiOptions:{}}}),Ee(v.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN)})),openPrivyModal:Ce,connectWallet:je,initLoginWithWallet:async(e,t,r)=>{Ia(e)?(ge.current="siwe",$e(e,t,r)):(ge.current="siws",Te(e,t))},loginWithWallet:async()=>{let e,t,r;if(!m)throw new s.PrivyNotReadyError;if(u.authFlow instanceof pa?e="siwe":u.authFlow instanceof ya&&(e="siws"),!e)throw new s.PrivyClientError("Must initialize SIWE/SIWS flow first.");if(null!==await u.getAccessToken())try{({user:t}=await u.link()),ge.current=e}catch(t){throw h.emitPrivyEvent(ye,"linkAccount","onError",t.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:r}=await u.authenticate()),ge.current=e}catch(e){throw h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR),e}E(t||C||null),k(r||!1),x(!0)},initDelegateAction:async({address:e})=>new Promise((async(t,r)=>{let n=await Ag();if(!w||!C||!n)throw new s.PrivyClientError("User must be authenticated and have an embedded wallet to delegate actions.");let i=Ge.walletProxy??await Ge.initializeWalletProxy(15e3);if(!i)throw new s.PrivyClientError("Wallet proxy not initialized.");let a=(({address:e,user:t})=>{let r=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!r)throw new s.PrivyClientError("Address to delegate is not associated with current user.");return{address:r.address,chainType:r.chainType,walletIndex:r.walletIndex??0}})({address:e,user:C}),o=(({address:e,user:t})=>{let r,n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new s.PrivyClientError("Address to delegate is not associated with current user.");if(!(r="ethereum"===n.chainType?n.imported?h.getImportedPrivyEthereumWallet(t):h.getPrivyEthereumWallet(t):n))throw new s.PrivyClientError("Unable to determine root address for delegated address.");return{address:r.address,chainType:r.chainType,imported:r.imported}})({address:e,user:C});"ethereum"===a.chainType?await Ge.recoverEmbeddedEthereumWallet():await Ge.recoverEmbeddedSolanaWallet(),te({delegatedActions:{address:e,onDelegate:async()=>{await i.createDelegatedAction({accessToken:n,rootWallet:o,delegatedWallets:[a]})},onSuccess:async()=>{t()},onError:async e=>{r(e)}}}),Ce(v.ModalScreen.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN)})),initLoginWithFarcaster:async(e,t)=>{let r=new Bi(e,t);u.startAuthFlow(r);try{ge.current="farcaster",await r.initializeFarcasterConnect()}catch(e){throw"login"===ve.current?h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ve.current&&h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!m)throw new s.PrivyNotReadyError;if(!(u.authFlow instanceof Bi))throw new s.PrivyClientError("Must initialize Farcaster flow first.");if(null!==await u.getAccessToken())try{({user:e}=await u.link()),ge.current="farcaster"}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await u.authenticate()),ge.current="farcaster"}catch(e){throw h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}E(e||null),k(t||!1),x(!0)},async loginWithGuestAccountFlow(){let e=new Gi(this.appId);u.startAuthFlow(e);try{ve.current="login",ge.current="guest";let{user:e,isNewUser:t}=await u.authenticate();if(t=t||!1,!e)throw new s.PrivyClientError("Unable to authenticate guest account");if(h.shouldProceedtoEmbeddedWalletCreationFlow(e,Z.embeddedWallets.createOnLogin))try{await Oe(e,15e3),e=await Ge.refreshUser()}catch(t){E(e),console.warn("Unable to create embedded wallet for guest account")}else E(e);return k(t),x(!0),h.emitPrivyEvent(ye,"login","onComplete",e,t,!1,"guest",null),e}catch(e){throw h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async crossAppAuthFlow({appId:e,popup:t,action:r}){let n=`privy:${e}`;ge.current=n;let{url:i,stateCode:a,codeVerifier:o}=await async function({api:e,appId:t}){let r=qi(),n=zi(),i=await Vi(r);try{let{url:a}=await e.post(ji,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:i,state_code:n});return{url:a,stateCode:n,codeVerifier:r}}catch(e){throw s.formatApiError(e)}}({api:u.api,appId:e});if(!i)throw u.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new s.PrivyClientError("No authorization URL returned for cross-app auth.");try{let l=await async function({url:e,popup:t}){return t.location=e,new Promise(((e,r)=>{let n,i=setTimeout((()=>{r(new s.PrivyClientError("Authorization request timed out after 2 minutes.")),a()}),12e4);function a(){t?.close(),window.removeEventListener("message",l)}let o=setInterval((()=>{t?.closed&&!n&&(a(),clearInterval(o),clearTimeout(i),r(new s.PrivyClientError("User rejected request")))}),300);function l(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(i),e(t.data),a()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(i),r(new s.PrivyClientError(t.data.error)),a()),t.data.type===fg&&((n=new BroadcastChannel(mg)).onmessage=l))}window.addEventListener("message",l)}))}({url:i,popup:t,provider:n}),d=l.stateCode,c=l.authorizationCode;if(d!==a)throw u.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:n,storedStateCode:a??"",returnedStateCode:d??""}}),new s.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,s.PrivyErrorCode.OAUTH_UNEXPECTED);let h=await async function({appId:e,stateCode:t,codeVerifier:r,authorizationCode:n,action:i,client:a}){if(!n||!t)throw new s.PrivyClientError("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===n)throw new s.PrivyClientError("User denied confirmation during cross-app auth flow");try{let o=new ah({authorizationCode:n,stateCode:t,codeVerifier:r,provider:`privy:${e}`});a.startAuthFlow(o);let s="link"===i?await a.link():await a.authenticate(),l=s.oAuthTokens?.accessToken;return console.debug(),l}catch(e){let t=s.formatApiError(e);if(t.privyErrorCode)throw new s.PrivyClientError(t.message||"Invalid code during cross-app auth flow.",void 0,t.privyErrorCode);if("User denied confirmation during cross-app auth flow"===t.message)throw new s.PrivyClientError("Invalid code during cross-app auth flow.",void 0,s.PrivyErrorCode.OAUTH_USER_DENIED);throw new s.PrivyClientError("Invalid code during cross-app auth flow.",void 0,s.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:o,stateCode:d,authorizationCode:c,action:r,client:u});h&&u.storeProviderAccessToken(e,h);let p=await Ge.refreshUser();if(!p)throw new s.PrivyClientError("Unable to update user");return u.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),p}catch(e){throw u.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:n}}),e}},async initLoginWithOAuth(e,t,r){if(ge.current=e,!c.e())return void Ee(v.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);if("google"===e&&bl(window.navigator.userAgent))return void Ee(v.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);"twitter"===e&&window.opener&&window.opener.postMessage({type:fg},"*"),c.e6.del(d.HEADLESS_OAUTH_KEY),c.e6.del(d.OAUTH_DISABLE_SIGNUP_KEY);let n=new Yi({provider:e,disableSignup:!!r});t&&n.addCaptchaToken(t),u.startAuthFlow(n);let i=await u.authFlow.getAuthorizationUrl();i&&i.url&&("twitter"===e&&o.isAndroid&&(i.url=i.url.replace("x.com","twitter.com")),window.location.assign(i.url))},async initLoginWithTelegram(e,t){if(!m)throw new s.PrivyNotReadyError;ge.current="telegram";let r=new Ca(e,t);u.startAuthFlow(r),r.meta.telegramWebAppData=void 0,r.meta.telegramAuthResult=await new Promise(((e,t)=>Z.loginConfig.telegramAuthConfiguration?window.Telegram?void window.Telegram.Login.auth({bot_id:Z.loginConfig.telegramAuthConfiguration.botId,request_access:!0},(r=>r?e(r):t(new s.PrivyClientError("Telegram auth failed or was canceled by the client")))):t(new s.PrivyClientError("Telegram was not initialized")):t(new s.PrivyClientError("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(e){let t,r;if(!(u.authFlow instanceof Ca))throw new s.PrivyClientError("Must initialize Telegram flow before calling loginWithTelegram");if(u.authFlow.meta.captchaToken||=e,"login"===ve.current)try{let e=await u.authenticate();t=e.user,r=e.isNewUser,ge.current="telegram"}catch(e){throw h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}else{if("link"!==ve.current)throw new s.PrivyClientError("Unknown auth intent");try{t=(await u.link()).user,ge.current="telegram"}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}E(t),k(r||!1),x(!0)},async recoveryOAuthFlow(e,t,r){let n,i;function a(t){if(!t)throw u.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:e}}),new s.PrivyClientError("Recovery OAuth failed")}switch(e){case"google-drive":{let t,o,{url:l,codeVerifier:d,stateCode:c}=await sd({api:vg.api,provider:e});a(l);try{let n=await gg({url:l,popup:r,provider:e});if(t=n.stateCode,o=n.authorizationCode,t!==c)throw u.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:c??"",returnedStateCode:t??""}}),new s.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,s.PrivyErrorCode.OAUTH_UNEXPECTED)}catch(t){throw u.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:e}}),new s.PrivyClientError("Recovery OAuth failed")}[n,i]=await Promise.all([Ag(),ld({api:vg.api,provider:e,codeVerifier:d,stateCode:t,authorizationCode:o})]);break}case"icloud":{let{url:t}=await sd({api:vg.api,provider:e});a(t);let{ckWebAuthToken:o}=await gg({url:t,popup:r,provider:e});i=o,n=await Ag()}}if(!K)throw new s.PrivyClientError("Cannot connect to wallet proxy");if(!n)throw new s.PrivyClientError("Unable to authorize user");switch(t){case"recover":let t=ee.recoverWallet?.privyWallet?.address;if(!t)throw new s.PrivyClientError("Recovery OAuth failed");u.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t,recoveryMethod:e}}),await K.recover({address:t,accessToken:n,recoveryAccessToken:i,recoveryMethod:e}),u.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t,recoveryMethod:e}});break;case"create-wallet":u.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"});let r=h.getPrivySolanaWallet(C);await K.create({accessToken:n,recoveryAccessToken:i,recoveryMethod:e,solanaAddress:r?.address});let a=h.getPrivyEthereumWallet(await Ge.refreshUser());if(!a)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");u.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:a.address}}),h.emitPrivyEvent(ye,"createWallet","onSuccess",a);break;case"set-recovery":let o=h.getPrivyEthereumWallet(C);if(!o)throw h.emitPrivyEvent(ye,"setWalletRecovery","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");u.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:o.address,existingRecoveryMethod:o.recoveryMethod,targetRecoveryMethod:e}}),await K.setRecovery({address:o.address,accessToken:n,recoveryAccessToken:i,recoveryMethod:e});let l=h.getPrivyEthereumWallet(await Ge.refreshUser());if(!l)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");u.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:o.address,existingRecoveryMethod:o.recoveryMethod,targetRecoveryMethod:e}}),h.emitPrivyEvent(ye,"setWalletRecovery","onSuccess",e,l);break;default:throw new s.PrivyClientError("Unsupported recovery action")}},async loginWithOAuth(e){let t,r,n;if(!(u.authFlow instanceof Yi))throw new s.PrivyClientError("Must initialize OAuth flow before calling loginWithOAuth");let i=c.e6.get(d.STATE_CODE_KEY),a=u.authFlow.meta.stateCode;if(i!==a)throw u.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:a??""}}),new s.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,s.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await u.getAccessToken())try{let r=await u.link();t=r.user,n=r.oAuthTokens,ge.current=e}catch(t){throw h.emitPrivyEvent(ye,"linkAccount","onError",t.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await u.authenticate();t=i.user,r=i.isNewUser,n=i.oAuthTokens,ge.current=e}catch(t){throw"login"===ve.current?h.emitPrivyEvent(ye,"login","onError",t.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ve.current&&h.emitPrivyEvent(ye,"linkAccount","onError",t.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return E(t),k(r||!1),x(!0),n&&t&&h.emitPrivyEvent(ye,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),n},passkeyAuthState:L,setPasskeyAuthState:U,async initLoginWithPasskey(e){let t=new ua(e,U);u.startAuthFlow(t),ve.current="login";try{ge.current="passkey",U({status:"generating-challenge"}),await t.initAuthenticationFlow(),U({status:"awaiting-passkey"})}catch(e){throw U({status:"error",error:e}),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(){let e,t;if(!m)throw new s.PrivyNotReadyError;if(!(u.authFlow instanceof ua))throw new s.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==ge.current){let e=new s.PrivyClientError("Must init login with Passkey flow first.");throw U({status:"error",error:e}),e}let r=await Ag();try{ge.current="passkey",U({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await u.authenticate())}catch(e){throw U({status:"error",error:e}),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}E(e),k(t||!1),x(!0),U({status:"done"});let n=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!r,loginAccount:n}},async initLinkWithPasskey(e){let t=new ua(e);u.startAuthFlow(t),ve.current="link",ge.current="passkey";try{await t.initLinkFlow()}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),e}},async linkWithPasskey(){let e;if(!m)throw new s.PrivyNotReadyError;if(!(u.authFlow instanceof ua))throw new s.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==ge.current)throw new s.PrivyClientError("Must init login with Passkey flow first.");try{ge.current="passkey",({user:e}=await u.link())}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return E(e||C||null),e},async initLoginWithHeadlessOAuth(e,t){if(!c.e())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&&bl(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let r=new Yi({provider:e,headless:!0,disableSignup:!1});t&&r.addCaptchaToken(t),V({status:"loading"});let n=await u.startAuthFlow(r).getAuthorizationUrl();n?.url&&window.location.assign(n.url)},async loginWithHeadlessOAuth(e){let t,r,n;O(!0),V({status:"loading"}),u.startAuthFlow(new Yi(e));let i=c.e6.get(d.STATE_CODE_KEY),a=e.stateCode;if(i!==a)throw u.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:a??""}}),O(!1),new s.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,s.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await u.getAccessToken())try{({user:t,oAuthTokens:n}=await u.link()),ge.current=e.provider;let r=Ue(t);t&&r&&h.emitPrivyEvent(ye,"linkAccount","onSuccess",t,ge.current,r)}catch(t){throw O(!1),h.emitPrivyEvent(ye,"linkAccount","onError",t.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:r,oAuthTokens:n}=await u.authenticate()),ge.current=e.provider;let i=Ue(t);t&&i&&void 0!==r&&"login"===ve.current&&h.emitPrivyEvent(ye,"login","onComplete",t,r,!1,ge.current,i)}catch(e){throw O(!1),V({status:"error",error:e}),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}return E(t),k(r||!1),x(!0),O(!1),V({status:"done"}),n&&t&&h.emitPrivyEvent(ye,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),t??void 0},initLoginWithEmail:async(e,t,r)=>{let n=new ki(e,t,r);u.startAuthFlow(n);try{ge.current="email",W({status:"sending-code"}),await n.sendCodeEmail(),W({status:"awaiting-code-input"})}catch(e){throw W({status:"error",error:e}),"login"===ve.current?h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ve.current&&h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async(e,t,r)=>{let n=new Ni(e,t,r);u.startAuthFlow(n);try{await n.sendCodeEmail()}catch(e){h.emitPrivyEvent(ye,"update","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:ge.current})}},initUpdatePhone:async(e,t,r)=>{let n=new fa(e,t,r);u.startAuthFlow(n);try{await n.sendSmsCode()}catch(e){h.emitPrivyEvent(ye,"update","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:ge.current})}},initLoginWithSms:async(e,t,r)=>{H({status:"sending-code"});let n=new ma(e,t,r);u.startAuthFlow(n);try{ge.current="sms",await n.sendSmsCode(),H({status:"awaiting-code-input"})}catch(e){throw H({status:"error",error:e}),"login"===ve.current?h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ve.current&&h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(u.authFlow?.sendCodeEmail())},resendSmsCode:async()=>{await(u.authFlow?.sendSmsCode())},loginWithCode:async e=>{let t,r;function n(e){u.authFlow instanceof ki?W(e):u.authFlow instanceof ma&&H(e)}if(n({status:"submitting-code"}),!m){let e=new s.PrivyNotReadyError;throw n({status:"error",error:e}),e}if(u.authFlow instanceof ki)u.authFlow.meta.emailCode=e.trim();else{if(!(u.authFlow instanceof ma)){let e=new s.PrivyClientError("Must initialize a passwordless code flow first");throw n({status:"error",error:e}),e}u.authFlow.meta.smsCode=e.trim()}let i=await Ag();if("link"===ve.current)try{({user:t}=await u.link())}catch(e){throw n({status:"error",error:e}),h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:ge.current}),e}else if("update"===ve.current)try{({user:t}=await u.link())}catch(e){throw n({status:"error",error:e}),h.emitPrivyEvent(ye,"update","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_UPDATE_ACCOUNT,{linkMethod:ge.current}),e}else try{({user:t,isNewUser:r}=await u.authenticate())}catch(e){throw n({status:"error",error:e}),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}let a=t||C;E(a||null),k(r||!1),x(!0),n({status:"done"});let o=null;return u.authFlow instanceof ki?o=a?.linkedAccounts.find((({type:e})=>"email"===e))||null:u.authFlow instanceof ma&&(o=a?.linkedAccounts.find((({type:e})=>"phone"===e))||null),{user:a,isNewUser:r||!1,wasAlreadyAuthenticated:!!i,linkedAccount:o}},generateSiweMessage:async({address:e,chainId:t,captchaToken:r})=>{ve.current="link",ge.current="siwe",q({status:"generating-message"});let n=await u.generateSiweNonce({address:e,captchaToken:r});return q({status:"awaiting-signature"}),ha({address:e,chainId:t.replace("eip155:",""),nonce:n})},generateSiweMessageForSmartWallet:async({address:e,chainId:t})=>{let r=await u.generateSiweNonce({address:e});return ha({address:e,chainId:t.replace("eip155:",""),nonce:r})},linkSmartWallet:async({message:e,signature:t,smartWalletType:r})=>{let n;try{n=await u.linkSmartWallet({message:e,signature:t,smartWalletType:r}),n=await Ge.refreshUser()??n}catch(e){throw e}E(n||C||null)},linkWithSiwe:async({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})=>{let a,o=null;try{q({status:"submitting-signature"}),a=await u.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}),a=await Ge.refreshUser()??a,q({status:"done"}),(o=Ue(a)||null)&&h.emitPrivyEvent(ye,"linkAccount","onSuccess",a,"siwe",o)}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"siwe"}),ve.current=null,ge.current=null,q({status:"error",error:e}),e}let l=a||C;return E(l||null),ve.current=null,ge.current=null,{user:l,linkedAccount:o}},refreshUser:async()=>{let e=await u.getAuthenticatedUser();return x(!!e),E(e),e},walletProxy:K,createAnalyticsEvent:({eventName:e,payload:t,timestamp:r})=>u.createAnalyticsEvent({eventName:e,payload:t,timestamp:r}),acceptTerms:async()=>{let e=await u.acceptTerms();return E(e),e},getUsdTokenPrice:e=>u.getUsdTokenPrice(e),getUsdPriceForSol:()=>u.getUsdPriceForSol(),recoverEmbeddedEthereumWallet:async e=>new Promise((async(t,r)=>{let n=h.getPrivyEthereumWallet(e?.user??C)||h.getImportedPrivyEthereumWallet(e?.user??C),i=await Ag();if(i&&K&&n){Q(!0);try{await K.connect({accessToken:i,address:n.address}),t(!0)}catch(e){Jl(e)&&"privy"===n.recoveryMethod?(u.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:n.address}}),(await K.recover({address:n.address,accessToken:i,recoveryMethod:n.recoveryMethod})).address||r(Error("Unable to recover wallet")),u.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n.address}}),t(!0)):Jl(e)&&"privy"!==n.recoveryMethod?(te({recoverWallet:{privyWallet:n,onFailure:r,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:n.recoveryMethod,action:"recover"}}),Ce(od(n.recoveryMethod))):r(e)}}else r(Error("Must have valid access token and Privy wallet to recover wallet"))})),embeddedSolanaWallet:$,createEmbeddedSolanaWallet:async()=>{Q(!0);let e=await Ag(),t=await Ge.refreshUser(),r=h.getPrivySolanaWallet(t),n=h.getPrivyEthereumWallet(t);if(!t||!e)throw new s.PrivyClientError("User must be logged in to create a Solana wallet");if(r)throw new s.PrivyClientError("User already has an embedded Solana wallet.");if(n){if("privy"!==n.recoveryMethod)throw new s.PrivyClientError("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");await Ge.recoverEmbeddedEthereumWallet({user:t})}let i=await Ge.initializeWalletProxy(15e3);if(!i)throw new s.PrivyClientError("Unable to initialize wallet proxy");u.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await i.createSolana({accessToken:e,ethereumAddress:n?.address});let t=await Ge.refreshUser(),r=h.getPrivySolanaWallet(t);if(!r)throw new s.PrivyClientError("Could not get Solana wallet for user");return u.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:r.address}}),r}catch(e){throw u.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new s.PrivyClientError("Failed to create Solana embedded wallet with error ",e)}},exportSolanaWallet:e=>new Promise((async(t,r)=>{if(!w||!C)return void r(Error("User must be authenticated before exporting their Privy wallet"));let n=e?.address,i=C.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"solana"===e.chainType)),a=n?i.find((e=>e.address.toLowerCase()===n.toLowerCase())):i.find((e=>!e.imported))||i[0];a?(Q(!0),await Ag()&&K?K?(await Ge.recoverEmbeddedSolanaWallet(),te({keyExport:{appId:l.appId,appClientId:l.clientId,origin:u.apiUrl,wallet:a,onSuccess:t,onFailure:r}}),Ce(v.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN)):r(Error("Must have a Privy wallet before exporting")):r(Error("Must have valid access token to enroll in MFA"))):r(Error("Must have a Privy wallet before exporting"))})),recoverEmbeddedSolanaWallet:async()=>new Promise((async(e,t)=>{let r=h.getPrivySolanaWallet(C),n=await Ag();if(n&&K&&r){Q(!0);try{await K.connectSolana({accessToken:n,publicKey:r.address}),e(!0)}catch(i){Jl(i)&&"privy"===r.recoveryMethod?(u.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:r.address}}),(await K.recoverSolana({publicKey:r.address,accessToken:n})).publicKey||t(Error("Unable to recover wallet")),u.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:r.address}}),e(!0)):t(i)}}else t(Error("Must have valid access token and Privy wallet to recover wallet"))})),getMoonpaySignedUrl:async(e,t)=>{let{signedUrl:r,externalTransactionId:n}=await async function(e,t,r,n,i=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},o=r.uiConfig||{accentColor:n.accent,theme:n.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:i,config:{...r,...a,...o}})}(u,e,t??{},Z.appearance.palette,Z.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:r,externalTransactionId:n}},initCoinbaseOnRamp:u.initCoinbaseOnRamp.bind(u),getCoinbaseOnRampStatus:u.getCoinbaseOnRampStatus.bind(u),setReadyToTrue:e=>{g(!0),re?.(e)},updateWallets:()=>Me(),fundWallet:async(e,t)=>{if(!Z.fundingConfig||0===Z.fundingConfig.methods.length)throw Error("Wallet funding is not enabled");let r=Pm({fundingMethods:Z.fundingConfig.methods});te({funding:Sm({address:e,appConfig:Z,fundWalletConfig:t,methodScreen:r})}),Ce(r)},fundSolanaWallet:async(e,t)=>{if(!Z.fundingConfig||0===Z.fundingConfig.methods.length)throw Error("Wallet funding is not enabled");let r=Pm({fundingMethods:Z.fundingConfig.methods});te({funding:Am({address:e,appConfig:Z,fundWalletConfig:t,methodScreen:r})}),Ce(r)},requestFarcasterSignerStatus:async e=>{let t=await Ag(),r=C?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!K||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!C?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let n=await u.requestFarcasterSignerStatus(e);return"approved"===n.status&&E(await u.getAuthenticatedUser()||C||null),n},connectCoinbaseSmartWallet:async()=>{Z.externalWallets.coinbaseWallet.connectionOptions="smartWalletOnly";let e=u.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||u.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),je(e);await Ae("coinbase_wallet","coinbase_smart_wallet")},initiateAccountTransfer:async({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o})=>{try{let s=await u.sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o});return E(s),s}catch(e){throw e}}};Eg=Ge.recoverEmbeddedEthereumWallet,bg=Ge.recoverEmbeddedSolanaWallet,Sg=Ge.solanaSignMessage;let qe=a.useMemo((()=>({wallets:b,ready:oe&&me})),[b,oe,me]),ze=u.authFlow instanceof Ca,Ve=!Z.headless&&Z.captchaEnabled&&!w&&(m||ze);return e.jsx(s.PrivyContext.Provider,{value:He,children:e.jsx(h.PrivyEventsContext.Provider,{value:ye,children:e.jsx(d.UseWalletsContext.Provider,{value:qe,children:e.jsx(wa,{...Z,children:e.jsxs(s.InternalPrivyContext.Provider,{value:Ge,children:[e.jsx(c.RecentlyUsedAccountProvider,{children:e.jsxs(v.ModalProvider,{data:ee,setModalData:te,setInitialScreen:I,initialScreen:N,authenticated:w,open:p,children:[l.children,Ve&&e.jsx(mo,{delayedExecution:!1}),e.jsx(Bf,{theme:{...Z.appearance.palette||{}}}),!Z.render.standalone&&e.jsx(eg,{open:p})]})}),J&&X?e.jsx(pg,{appId:l.appId,appClientId:l.clientId,clientAnalyticsId:u.clientAnalyticsId,origin:u.apiUrl,mfaMethods:C?.mfaMethods,mfaPromise:he,mfaSubmitPromise:pe,onLoad:Y,onLoadFailed:()=>null}):null,Z.loginConfig.telegramAuthConfiguration&&e.jsx(es,{$if:!0,children:e.jsx(ng,{scriptHost:l.apiUrl||d.DEFAULT_PRIVY_API_URL,botUsername:Z.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};let Ig=async(e,t,r,n,i)=>{if(!e)throw n("linkAccount","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:i}),new s.PrivyClientError("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new s.PrivyClientError(`OAuth account of type ${i} not linked to the account.`);await r(i)};const Mg=Og;function Og(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=s.usePrivy();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}exports.usePrivy=s.usePrivy,exports.SUPPORTED_CHAINS=d.DEFAULT_SUPPORTED_CHAINS,exports.VERSION=d.VERSION,exports.addPrivyRpcToChain=d.addPrivyRpcToChain,exports.addRpcUrlOverrideToChain=d.addRpcUrlOverrideToChain,exports.useWallets=d.useWallets,exports.useConnectWallet=c.useConnectWallet,exports.useFundWallet=c.useFundWallet,exports.useLogin=c.useLogin,exports.useLogout=c.useLogout,exports.WalletConnector=f.WalletConnector,exports.useSolanaWallets=f.useSolanaWallets,exports.getEmbeddedConnectedWallet=v.getEmbeddedConnectedWallet,exports.AsExternalProvider=Pa,exports.Captcha=mo,exports.ConnectorManager=to,exports.EthereumWalletConnector=Ma,exports.LoginModal=eg,exports.PrivyClient=po,exports.PrivyProvider=({config:t,...r})=>{var n;if("undefined"!=typeof window&&0>["localhost","127.0.0.1"].indexOf(window.location.hostname)&&"https:"!==window.location.protocol)throw new s.PrivyClientError("Embedded wallet is only available over HTTPS");if("string"!=typeof(n=r.appId)||25!==n.length)throw new s.PrivyClientError("Cannot initialize the Privy provider with an invalid Privy app ID");vg||(vg=new po({appId:r.appId,appClientId:r.clientId,apiUrl:r.apiUrl}));let i=Object.assign({},t);return void 0!==r.createPrivyWalletOnLogin&&void 0===i.embeddedWallets?.createOnLogin&&(i.embeddedWallets||(i.embeddedWallets={}),i.embeddedWallets.createOnLogin=r.createPrivyWalletOnLogin?"users-without-wallets":"off"),void 0!==r.createPrivyWalletOnLogin&&t?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),e.jsx(d.PrivyAppConfigProvider,{client:vg,clientConfig:i,legacyCreateEmbeddedWalletFlag:r.createPrivyWalletOnLogin,children:e.jsx(Ng,{...r,client:vg})})},exports.PrivyProxyProvider=ja,exports.errorIndicatesMaxMfaRetries=td,exports.errorIndicatesMfaTimeout=Ql,exports.errorIndicatesMfaVerificationFailed=ed,exports.getAccessToken=Ag,exports.useConnectCoinbaseSmartWallet=()=>{let{connectCoinbaseSmartWallet:e}=s.usePrivyInternal();return{connectCoinbaseSmartWallet:e}},exports.useCreateWallet=function(e){let{createWallet:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("createWallet",e),{createWallet:t}},exports.useCrossAppAccounts=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:n,sendTransactionWithCrossAppWallet:i}=s.usePrivy();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:n,sendTransaction:i}},exports.useCustomAuth=e=>{let{customAuthStatus:t}=s.usePrivyInternal();return h.usePrivyEventSubscription("customAuth",e),{status:t}},exports.useExperimentalFarcasterSigner=Mg,exports.useFarcasterSigner=Og,exports.useGuestAccounts=function(){let{createGuestAccount:e}=a.useContext(s.PrivyContext);return{createGuestAccount:e}},exports.useLinkAccount=function(e){let{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:i,linkApple:o,linkTwitter:l,linkDiscord:d,linkGithub:c,linkLinkedIn:u,linkTiktok:p,linkSpotify:y,linkInstagram:m,linkTelegram:f,linkFarcaster:g}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:i,linkApple:o,linkTwitter:l,linkDiscord:d,linkGithub:c,linkLinkedIn:u,linkTiktok:p,linkSpotify:y,linkInstagram:m,linkFarcaster:g,linkTelegram:f}},exports.useLinkWithSiwe=e=>{let t=xa(),{generateSiweMessage:r}=s.usePrivy(),{siweState:n,setSiweState:i,linkWithSiwe:o}=s.usePrivyInternal();return{generateSiweMessage:a.useCallback((async({address:t,chainId:n})=>{try{if(!t||!n)throw Error("wallet address and chainId required to generate nonce");return await r({address:t,chainId:n}).then((e=>e))}catch(t){throw i({status:"error",error:t}),e?.onError?.(t.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[r]),linkWithSiwe:a.useCallback((async({signature:r,message:n,chainId:a,walletClientType:l,connectorType:d})=>{try{if(t.enabled&&"success"!==t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);let{user:i,linkedAccount:c}=await o({message:n,signature:r,chainId:a,walletClientType:l,connectorType:d});c&&e?.onSuccess?.(i,"siwe",c)}catch(r){throw i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[o,t.status]),state:n}},exports.useLoginWithEmail=e=>{let t=xa(),{emailOtpState:r,setEmailOtpState:n,initLoginWithEmail:i,loginWithCode:o}=s.usePrivyInternal();return{sendCode:a.useCallback((async({email:r})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i(r,e)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:a.useCallback((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);let{user:n,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await o(r);e?.onComplete?.(n,i,a,"email",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[o,t.status]),state:r}},exports.useLoginWithOAuth=e=>{h.usePrivyEventSubscription("login",e);let t=xa(),r=d.useIsServerConfigLoaded(),{initLoginWithHeadlessOAuth:n,loginWithHeadlessOAuth:i,isHeadlessOAuthLoading:o,ready:l,user:c}=s.usePrivy(),{oAuthState:u,setOAuthState:p}=s.usePrivyInternal(),y=a.useCallback((async e=>{try{if(t.enabled&&"success"!==t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);return await n(e.provider,t.token)}catch(e){throw p({status:"error",error:e}),e}}),[n,t]),m=a.useCallback((async()=>{let e=da();try{if(c)return console.warn("Cannot login with OAuth when already logged in"),c;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw p({status:"error",error:e}),e}try{return await i(e)}catch(e){throw p({status:"error",error:e}),e}finally{ca()}}),[i]);return a.useEffect((()=>{let e=da();l&&r&&e.inProgress&&e.headless&&!e.popupFlow&&m()}),[l,r]),{initOAuth:y,loginWithOAuth:m,loading:o,state:u}},exports.useLoginWithPasskey=e=>{let t=xa(),{initLoginWithPasskey:r,loginWithPasskey:n,passkeyAuthState:i,setPasskeyAuthState:o}=s.usePrivyInternal();return{loginWithPasskey:a.useCallback((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r(i);let{user:a,isNewUser:o,wasAlreadyAuthenticated:l,loginAccount:d}=await n();e?.onComplete?.(a,o,l,"passkey",d)}catch(t){throw o({status:"error",error:t}),e?.onError?.(t),t}}),[n,t.status]),state:i}},exports.useLoginWithSms=e=>{let t=xa(),{smsOtpState:r,setSmsOtpState:n,initLoginWithSms:i,loginWithCode:o}=s.usePrivyInternal();return{sendCode:a.useCallback((async({phoneNumber:r})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i(r,e)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:a.useCallback((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);let{user:n,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await o(r);e?.onComplete?.(n,i,a,"sms",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[o,t.status]),state:r}},exports.useMfa=zp,exports.useMfaEnrollment=Vp,exports.useModalStatus=()=>{let{isModalOpen:e}=a.useContext(s.PrivyContext);return{isOpen:e}},exports.useOAuthTokens=function(e){let{authenticated:t,user:r}=s.usePrivy(),{initLoginWithOAuth:n}=s.usePrivyInternal(),i=h.useEmitPrivyEvent();return h.usePrivyEventSubscription("oAuthAuthorization",e),{reauthorize:e=>Ig(t,r,n,i,e.provider)}},exports.useRegisterMfaListener=fo,exports.useSendSolanaTransaction=function(e){let{sendSolanaTransaction:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("sendSolanaTransaction",e),{sendSolanaTransaction:t}},exports.useSendTransaction=function(e){let{sendTransaction:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("sendTransaction",e),{sendTransaction:t}},exports.useSetWalletPassword=function(e){let{setWalletPassword:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("setWalletPassword",e),{setWalletPassword:t}},exports.useSetWalletRecovery=function(e){let{setWalletRecovery:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("setWalletRecovery",e),{setWalletRecovery:t}},exports.useSignMessage=function(e){let{signMessage:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("signMessage",e),{signMessage:t}},exports.useSignTypedData=function(e){let{signTypedData:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("signTypedData",e),{signTypedData:t}},exports.useToken=function(e){let{getAccessToken:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("accessToken",e),{getAccessToken:t}},exports.useUpdateAccount=function(e){let{updateEmail:t,updatePhone:r}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("update",e),{updateEmail:t,updatePhone:r}};
3119
+ `;function ig(t){let r=a.useRef(null),n=a.useRef();return a.useEffect((()=>{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}(t),r.current?.after(n.current)}),[t]),e.jsx("div",{ref:r,hidden:!0})}async function ag(e,t,r,n,i,a=!1){let o=a,s=async s=>{if(o&&t&&t.length>0){s===(a?0:1)?i("configureMfa","onMfaRequired",t):n.current?.reject(new Zl("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 Zl("mfa_timeout","Timed out waiting for MFA code");n.current?.reject(e),t(e)}),3e5)}));return await e(o)}return await e()},l=null;for(let e=0;e<4;e++)try{l=await s(e),n.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw n.current?.resolve(void 0),e;o=!0}if(null===l){let e=new Zl("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw n.current?.reject(e),e}return l}var og;let sg=(og=0,()=>"id-"+og++);function lg(e){return void 0!==e.error}let dg=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:wallet:create":case"privy:wallet:create-additional":case"privy:wallet:import":case"privy:wallet:connect":case"privy:wallet:recover":case"privy:wallet:rpc":case"privy:wallet:set-recovery":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:solana-wallet:connect":case"privy:solana-wallet:recover":case"privy:solana-wallet:rpc":case"privy:delegated-actions:consent":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}},cg=new Map,ug=(e,t)=>"bigint"==typeof t?t.toString():t,hg=(e,t)=>`${e}${JSON.stringify(t,ug)}`;function pg(e,t,r,n){let i=r.contentWindow;if(!i)throw Error("iframe not initialized");let a=hg(e,t);if("privy:wallet:create"===e){let e=cg.get(a);if(e)return e}let o=new Promise(((r,a)=>{let o=sg();dg.enqueue(o,{resolve:r,reject:a}),i.postMessage({id:o,event:e,data:t},n)})).finally((()=>{cg.delete(a)}));return cg.set(a,o),o}function yg(t){let r=a.useRef(null),n=a.useRef(t.mfaMethods),i=h.useEmitPrivyEvent(),[o,s]=a.useState(!1);return a.useEffect((()=>{n.current=t.mfaMethods}),[t.mfaMethods]),a.useEffect((()=>{if(!o)return;let e=r.current;if(!e)return;function a(e){var r;e&&e.origin===t.origin&&"string"==typeof(r=e.data).event&&/^privy:.+/.test(r.event)&&function(e){switch(e.event){case"privy:iframe:ready":let t=dg.dequeue(e.event,e.id);return lg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=dg.dequeue(e.event,e.id);return lg(e)?r.reject(new Zl(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:create-additional":let n=dg.dequeue(e.event,e.id);return lg(e)?n.reject(new Zl(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:import":let i=dg.dequeue(e.event,e.id);return lg(e)?i.reject(new Zl(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:connect":let a=dg.dequeue(e.event,e.id);return lg(e)?a.reject(new Zl(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:recover":let o=dg.dequeue(e.event,e.id);return lg(e)?o.reject(new Zl(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:rpc":let s=dg.dequeue(e.event,e.id);return lg(e)?s.reject(new Zl(e.error.type,e.error.message)):s.resolve(e.data);case"privy:wallet:set-recovery":let l=dg.dequeue(e.event,e.id);return lg(e)?l.reject(new Zl(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:verify":let d=dg.dequeue(e.event,e.id);return lg(e)?d.reject(new Zl(e.error.type,e.error.message)):d.resolve(e.data);case"privy:mfa:init-enrollment":{let t=dg.dequeue(e.event,e.id);return lg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:submit-enrollment":{let t=dg.dequeue(e.event,e.id);return lg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:unenroll":{let t=dg.dequeue(e.event,e.id);return lg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:mfa:clear":{let t=dg.dequeue(e.event,e.id);return lg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:init-signer":{let t=dg.dequeue(e.event,e.id);return lg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:farcaster:sign":{let t=dg.dequeue(e.event,e.id);return lg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:solana-wallet:create":let c=dg.dequeue(e.event,e.id);return lg(e)?c.reject(new Zl(e.error.type,e.error.message)):c.resolve(e.data);case"privy:solana-wallet:connect":let u=dg.dequeue(e.event,e.id);return lg(e)?u.reject(new Zl(e.error.type,e.error.message)):u.resolve(e.data);case"privy:solana-wallet:recover":let h=dg.dequeue(e.event,e.id);return lg(e)?h.reject(new Zl(e.error.type,e.error.message)):h.resolve(e.data);case"privy:solana-wallet:rpc":{let t=dg.dequeue(e.event,e.id);return lg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}case"privy:delegated-actions:consent":{let t=dg.dequeue(e.event,e.id);return lg(e)?t.reject(new Zl(e.error.type,e.error.message)):t.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}(e.data)}let s={create:r=>pg("privy:wallet:create",r,e,t.origin),createAdditional:r=>pg("privy:wallet:create-additional",r,e,t.origin),import:r=>pg("privy:wallet:import",r,e,t.origin),connect:r=>pg("privy:wallet:connect",r,e,t.origin),recover:r=>ag((n=>pg("privy:wallet:recover",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i,!r.recoveryMethod||"privy"===r.recoveryMethod),rpc:r=>ag((n=>pg("privy:wallet:rpc",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i),createSolana:r=>pg("privy:solana-wallet:create",r,e,t.origin),connectSolana:r=>pg("privy:solana-wallet:connect",r,e,t.origin),recoverSolana:r=>pg("privy:solana-wallet:recover",r,e,t.origin),rpcSolana:r=>pg("privy:solana-wallet:rpc",r,e,t.origin),createDelegatedAction:r=>pg("privy:delegated-actions:consent",r,e,t.origin),setRecovery:r=>ag((n=>pg("privy:wallet:set-recovery",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i),verifyMfa:r=>ag((n=>pg("privy:mfa:verify",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i,!0),initEnrollMfa:r=>ag((n=>pg("privy:mfa:init-enrollment",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i),submitEnrollMfa:r=>ag((n=>pg("privy:mfa:submit-enrollment",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i),unenrollMfa:r=>ag((n=>pg("privy:mfa:unenroll",{...r,...n},e,t.origin)),n.current,t.mfaPromise,t.mfaSubmitPromise,i,!0),clearMfa:r=>pg("privy:mfa:clear",r,e,t.origin),initFarcasterSigner:r=>pg("privy:farcaster:init-signer",r,e,t.origin),signFarcasterMessage:r=>pg("privy:farcaster:sign",r,e,t.origin)};window.addEventListener("message",a);let l=new AbortController;return d.invokeUntilSettled((()=>pg("privy:iframe:ready",{},e,t.origin)),{abortSignal:l.signal}).then((()=>t.onLoad(s)),((...e)=>{console.warn("Privy iframe failed to load: ",...e),t.onLoadFailed()})),()=>{window.removeEventListener("message",a),l.abort()}}),[o]),e.jsx("iframe",{ref:r,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>s(!0),src:d.constructURL(t.origin,`/apps/${t.appId}/embedded-wallets`,{caid:t.clientAnalyticsId,client_id:t.appClientId})})}class mg{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 Ng({message:e.params.message})}async request(e){if(console.debug("EmbeddedSolanaProvider.request() called with args",e),!await jg())throw Error("User must be authenticated to use embedded Solana wallet");if(!await kg())throw new s.PrivyClientError("Unable to connect to Solana embedded wallet");if("signMessage"===e.method)return await this.handleSignMessage(e);throw Error("Embedded Solana provider does not yet support this RPC method.")}constructor(e,t){this.walletProxy=e,this.address=t}}const fg="popup-privy-oauth",gg="PRIVY_OAUTH_USE_BROADCAST_CHANNEL";async function vg({url:e,popup:t,provider:r}){return t.location=e,new Promise(((e,r)=>{function n(){t?.close(),window.removeEventListener("message",i)}function i(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),n()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),n()),"PRIVY_OAUTH_ERROR"===t.data.type&&(r(t.data.error),n()))}window.addEventListener("message",i)}))}let wg,xg,Cg,Eg,bg,Sg,Ag;function jg(){return wg?wg.getAccessToken():Promise.resolve(c.e6.get(d.TOKEN_STORAGE_KEY)||null)}const $g=(e,t,r)=>xg(e,t,r),Tg=(e,t,r)=>Cg(e,t,r),Pg=(e,t,r,n)=>Eg(e,t,r,n),_g=()=>bg(),kg=()=>Sg(),Ng=({message:e})=>Ag({message:e});let Ig=l=>{let u=l.client,[p,y]=a.useState(!1),[m,g]=a.useState(!1),[w,x]=a.useState(!1),[C,E]=a.useState(null),[b,S]=a.useState([]),[A,j]=a.useState([]),[$,T]=a.useState(null),P=a.useRef(b),[_,k]=a.useState(!1),[N,I]=a.useState(null),[M,O]=a.useState(!1),[R,F]=a.useState({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:s.notImplemented}),[L,U]=a.useState({status:"initial"}),[D,W]=a.useState({status:"initial"}),[B,H]=a.useState({status:"initial"}),[G,q]=a.useState({status:"initial"}),[z,V]=a.useState({status:"initial"}),[K,Y]=a.useState(null),Z=d.useAppConfig(),X=d.useIsServerConfigLoaded(),[J,Q]=a.useState(!0),[ee,te]=a.useState({}),[re,ne]=a.useState(null),[ie,ae]=a.useState(null),[oe,se]=a.useState(!1),[le,de]=a.useState(!1),[ce,ue]=a.useState(Z.customAuth?.enabled?{status:"initial"}:{status:"not-enabled"}),he=a.useRef(null),pe=a.useRef(null),ye=a.useRef(h.privyEventsDefault),[me,fe]=a.useState(!1);u.onStoreToken=e=>{e&&h.emitPrivyEvent(ye,"accessToken","onAccessTokenGranted",e)},u.onDeleteToken=()=>{E(null),x(!1),h.emitPrivyEvent(ye,"accessToken","onAccessTokenRemoved")};let ge=a.useRef(null),ve=a.useRef(null),we=a.useRef(!1),xe=({showWalletUIs:e,typedData:t})=>we.current?we.current:void 0!==e?!e:void 0!==Z.embeddedWallets.showWalletUIs?!Z.embeddedWallets.showWalletUIs:t?Z.embeddedWallets.noPromptOnSignature||(Z.legacyWalletUiConfig??!1):!!Z.embeddedWallets.noPromptOnSignature,Ce=e=>{I(e),setTimeout((()=>{y(!0)}),15),u.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:e}})},Ee=e=>{"off"!==Z.embeddedWallets.createOnLogin&&Q(!0),Ce(e)};a.useEffect((()=>{let e=h.getPrivySolanaWallet(C);if(!e||!K)return void T(null);let t={type:"solana",imported:!1,address:e.address,connectedAt:Date.now(),walletClientType:"privy",connectorType:"embedded",meta:{name:"Privy Wallet",icon:void 0,id:"io.privy.solana.wallet"},linked:!0,fund(){throw new s.PrivyClientError("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:()=>{throw new s.PrivyClientError("Cannot unlink an embedded Solana wallet")},getProvider:async()=>new mg(K,e.address),signMessage:async e=>{let r=await jg();if(!r||!K)throw new s.PrivyClientError("Must have valid access token and Privy wallet to send transaction",s.PrivyErrorCode.MUST_BE_AUTHENTICATED);if(!await Ge.recoverEmbeddedSolanaWallet().catch((()=>!1)))throw new s.PrivyClientError("Wallet couldn't be connected",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR);let{response:n}=await K.rpcSolana({accessToken:r,publicKey:t.address,request:{method:"signMessage",params:{message:Buffer.from(e).toString("base64")}}});return Buffer.from(n.data.signature,"base64")},async sendTransaction(e,t,r){let{signature:n}=await Fe({transaction:e,connection:t,transactionOptions:r,wallet:this});return n},async signTransaction(e){let t=await jg();if(!t||!K)throw new s.PrivyClientError("Must have valid access token and Privy wallet to send transaction",s.PrivyErrorCode.MUST_BE_AUTHENTICATED);if(!await Ge.recoverEmbeddedSolanaWallet().catch((()=>!1)))throw new s.PrivyClientError("Wallet couldn't be connected",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR);return await Cm({tx:e,accessToken:t,walletProxy:K,transactingWalletAddress:this.address}),e},loginOrLink:async()=>{throw new s.PrivyClientError("Cannot login or link with an embedded Solana wallet")},disconnect:()=>{T(null)},isConnected:async()=>!0};T(t)}),[K,C]),a.useEffect((()=>{if(!C)return void u.connectors?.removeEmbeddedWalletConnectors();let e=h.getPrivyEthereumWallet(C),t=h.getPrivyEthereumHDWallets(C),r=h.getImportedPrivyEthereumWallet(C);e&&t.length||u.connectors?.removeEmbeddedWalletConnectors(),r||u.connectors?.removeImportedWalletConnector(),u.connectors?K?(e&&u.connectors.addEmbeddedWalletConnectors({walletProxy:K,rootWallet:e,embeddedWallets:t,defaultChain:Z.defaultChain,appId:l.appId}),r&&u.connectors.addImportedWalletConnector(K,r.address,Z.defaultChain,l.appId)):console.debug("Failed to add embedded wallet connector: Wallet proxy not initialized"):console.debug("Failed to add embedded wallet connector: Client connectors not initialized")}),[K,C]),a.useEffect((()=>{K&&ie?.(K)}),[K]),a.useEffect((()=>{(async()=>{if(!Z.customAuth?.enabled)return void ue({status:"not-enabled"});Q(!0),ue({status:"loading"});let{getCustomAccessToken:e,isLoading:t}=Z.customAuth;if(m&&!t)try{let t=await e();if(!t&&w)return await He.logout(),ue({status:"done"}),void h.emitPrivyEvent(ye,"customAuth","onUnauthenticated");if(!t||w)return void ue({status:"done"});u.startAuthFlow(new _i(t));let{user:r,isNewUser:n}=await u.authenticate();if(!r)return await He.logout(),ue({status:"error",error:new s.PrivyClientError("Failed to sync with custom auth provider")}),void h.emitPrivyEvent(ye,"customAuth","onUnauthenticated");void 0!==n&&h.emitPrivyEvent(ye,"login","onComplete",r,n,!1,"custom",null),h.emitPrivyEvent(ye,"customAuth","onAuthenticated",{user:r}),ue({status:"done"}),E(r||null),k(n||!1),x(!0),de(!0)}catch(e){console.warn(e),w&&(await He.logout(),h.emitPrivyEvent(ye,"customAuth","onUnauthenticated")),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),ue({status:"error",error:e})}})()}),[Z.customAuth?.enabled,Z.customAuth?.getCustomAccessToken,Z.customAuth?.isLoading,m,w]),a.useEffect((()=>{le&&K&&C&&h.shouldProceedtoEmbeddedWalletCreationFlow(C,Z.embeddedWallets.createOnLogin)&&(de(!1),Oe(C,d.WALLET_PROXY_TIMEOUT).catch(console.error))}),[le&&K&&C]),a.useEffect((()=>{if(Z.externalWallets.solana.connectors)return Z.externalWallets.solana.connectors.onMount(),()=>Z.externalWallets.solana.connectors?.onUnmount()}),[Z.externalWallets.solana.connectors]),a.useEffect((()=>{!m&&X&&async function(){let e,t=be(),r=Se();(()=>{let e=new URLSearchParams(window.location.search).get("privy_token");if(!e)return;c.e6.put(d.FORKED_TOKEN_STORAGE_KEY,e);let t=new URL(window.location.href);t.searchParams.delete("privy_token"),window.history.pushState({},"",t)})();let n=i.createStore();u.initializeConnectorManager({walletConnectCloudProjectId:Z.walletConnectCloudProjectId,rpcConfig:Z.rpcConfig,chains:Z.chains,defaultChain:Z.defaultChain,store:n,walletList:Z.appearance.walletList,shouldEnforceDefaultChainOnConnect:Z.shouldEnforceDefaultChainOnConnect,externalWalletConfig:Z.externalWallets,appName:Z.name??"Privy",walletChainType:Z.appearance.walletChainType}),u.connectors?.on("connectorInitialized",(()=>{e&&clearTimeout(e);let t=u.connectors.walletConnectors.length,r=u.connectors.walletConnectors.reduce(((e,t)=>e+(t.initialized?1:0)),0);r===t?fe(!0):e=setTimeout((()=>{console.debug({message:"Unable to initialize all expected connectors before timeout",initialized:r,expected:t}),fe(!0)}),1500)})),u.connectors?.initialize().then((()=>{Pe()}));let a=await u.getAuthenticatedUser(),o=!!a;if(Z.customAuth?.enabled||(x(!!a),a&&h.emitPrivyEvent(ye,"login","onComplete",a,!1,!0,null,null),E(a)),!t)return r&&!o?(ve.current="login",te({telegramAuthModalData:{seamlessAuth:!0}}),void Ee(v.ModalScreen.TELEGRAM_AUTH_SCREEN)):void Ge.setReadyToTrue(!!a);ve.current=o?"link":"login"}()}),[u,re,m,X]),a.useEffect((()=>{if(m){if(!C||!C.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType)))return void se(!0);se(!!b.find((e=>"privy"===e.walletClientType)))}}),[m,C,b]);let be=()=>{let e=da();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(fg).postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:e.stateCode,authorizationCode:e.authorizationCode}),window.close()),!!e.inProgress&&!e.headless&&(u.startAuthFlow(new Yi(e)),Ee(v.ModalScreen.AWAITING_OAUTH_SCREEN),!0))},Se=()=>{let e=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),r=e.get("hash"),n=Number(e.get("auth_date")||""),i=e.get("first_name"),a=e.get("last_name")||void 0,o=e.get("username")||void 0,s=e.get("photo_url")||void 0;if(t&&i&&n&&r)return{id:t,first_name:i,last_name:a,username:o,photo_url:s,auth_date:n,hash:r}}())?(ba(),{...e,flowType:"login-url"}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=new URLSearchParams(decodeURIComponent(e.replace("#tgWebAppData=",""))),r=t.get("query_id")||void 0,n=t.get("user"),i=Number(t.get("auth_date")||""),a=t.get("hash"),o=t.get("chat_instance")||void 0,s=t.get("chat_type")||void 0,l=t.get("start_param")||void 0;return n&&i&&a?{query_id:r,user:n,auth_date:i,hash:a,chat_instance:o,chat_type:s,start_param:l}:void 0}())?(ba(),{...e,flowType:"web-app"}):void 0}();if(!e||!Z.loginMethods.telegram||!Z.loginConfig.telegramAuthConfiguration?.seamlessAuthEnabled)return;let t=new Ca;return u.startAuthFlow(t),"login-url"===e.flowType&&(t.meta.telegramWebAppData=void 0,t.meta.telegramAuthResult={id:e.id,first_name:e.first_name,last_name:e.last_name,auth_date:e.auth_date,username:e.username,photo_url:e.photo_url,hash:e.hash}),"web-app"===e.flowType&&(t.meta.telegramAuthResult=void 0,t.meta.telegramWebAppData={query_id:e.query_id,user:e.user,auth_date:e.auth_date,hash:e.hash,chat_instance:e.chat_instance,chat_type:e.chat_type,start_param:e.start_param}),!0},Ae=async(e,t,r,n)=>{je(await(u.connectors?.createEthereumWalletConnector(e,t))||null,t,r,n)};async function je(e,t,r,n){if(!e)return F({status:"disconnected",connectedWallet:null,connectError:new s.PrivyConnectorError("Unable to connect to wallet."),connector:null,connectRetry:s.notImplemented}),n?.(null,r);F({status:"disconnected",connectedWallet:null,connectError:null,connector:e,connectRetry:s.notImplemented}),e instanceof eo&&t&&await e.resetConnection(t),F({connector:e,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>je(e,t,r,n)});try{let t=await e.connect({showPrompt:!0});if((!t||Aa(t))&&Z.shouldEnforceDefaultChainOnConnect&&!Z.chains.find((e=>e.id===Number(t?.chainId.replace("eip155:",""))))&&("wallet_connect_v2"!==t?.connectorType||"metamask"!==t?.walletClientType)){F((t=>({...t,connector:e,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:s.notImplemented})));try{await(t?.switchChain(Z.defaultChain.id)),t&&(t.chainId=d.formatChainIdToCAIP2(d.toHex(Z.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${Z.defaultChain.id}`)}}return F((e=>({...e,status:"connected",connectedWallet:t,connectError:null,connectRetry:s.notImplemented}))),t&&h.emitPrivyEvent(ye,"connectWallet","onSuccess",t),n?.(t,r)}catch(e){return e instanceof s.PrivyError?(console.warn(e.cause?e.cause:e.message),h.emitPrivyEvent(ye,"connectWallet","onError",e.privyErrorCode||s.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),h.emitPrivyEvent(ye,"connectWallet","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR)),F((t=>({...t,status:"disconnected",connectedWallet:null,connectError:e}))),n?.(null,r)}}let $e=async(e,t,r)=>{if(null===e||!Aa(e))return;let n=new pa(e,u,t,r);u.startAuthFlow(n)},Te=async(e,t)=>{if(null===e||!f.isBaseConnectedSolanaWallet(e))return;let r=new ya(e,u,t);u.startAuthFlow(r)},Pe=()=>{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||d.isPhantomInstalled()||Ee(v.ModalScreen.LOGIN_FAILED_SCREEN),!u.connectors)throw new s.PrivyClientError("Connector not initialized");Ce(v.ModalScreen.AWAITING_CONNECTION);let n=new URL(window.location.href);n.searchParams.delete("privy_connector"),n.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",n),Ae(t,r,void 0,$e)};a.useEffect((()=>{m&&w&&null===C&&u.getAuthenticatedUser().then(E)}),[m,w,C,u]);let _e=e=>{if(!w)throw h.emitPrivyEvent(ye,"linkAccount","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:e}),new s.PrivyClientError("User must be authenticated before linking an account.")},ke=()=>{_e("siwe"),ge.current="siwe",ve.current="link",Ce(v.ModalScreen.LINK_WALLET_SCREEN)},Ne=e=>{if(!w||!C)return!1;if("privy"===e.walletClientType)return!0;for(let t of C.linkedAccounts)if("wallet"===t.type&&t.address===e.address&&"privy"!==t.walletClientType)return!0;return!1},Ie=async e=>{let t;if(!u.connectors)throw new s.PrivyClientError("Connector not initialized");t="ethereum"===e.type?u.connectors.findWalletConnector(e.connectorType,e.walletClientType)||null:u.connectors.findSolanaWalletConnector(e.connectorType,e.walletClientType)||null,F((r=>({...r,connector:t,status:"connected",connectedWallet:e,connectError:null,connectRetry:s.notImplemented}))),Z.captchaEnabled&&!w?(te({captchaModalData:{callback:t=>Aa(e)?$e(e,t):Te(e,t),userIntentRequired:!1,onSuccessNavigateTo:v.ModalScreen.AWAITING_CONNECTION,onErrorNavigateTo:v.ModalScreen.ERROR_SCREEN}}),Ee(v.ModalScreen.CAPTCHA_SCREEN)):(Aa(e)?await $e(e):await Te(e),Ee(v.ModalScreen.AWAITING_CONNECTION))},Me=()=>{S((e=>{let t=u.connectors?.wallets.filter(Aa).map((e=>({...e,linked:Ne(e),loginOrLink:async()=>{if(!await e.isConnected())throw new s.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new s.PrivyClientError("Cannot link or login with embedded wallet");Ie(e)},fund:async t=>{await Ge.fundWallet(e.address,t)},unlink:async()=>{if(!w)throw new s.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new s.PrivyClientError("Cannot unlink an embedded wallet");E(await u.unlinkEthereumWallet(e.address))}})))||[];return ja(e,t)?e:t})),j((e=>{let t=u.connectors?.wallets.filter(f.isBaseConnectedSolanaWallet).map((e=>({...e,linked:Ne(e),loginOrLink:async()=>{if(!await e.isConnected())throw new s.PrivyClientError("Wallet is not connected");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new s.PrivyClientError("Cannot link or login with embedded wallet");Ie(e)},fund:async()=>{throw new s.PrivyClientError("'fund' is deprecated for Solana wallets - use 'fundWallet' instead")},unlink:async()=>{if(!w)throw new s.PrivyClientError("User is not authenticated.");if("embedded"===e.connectorType&&"privy"===e.walletClientType)throw new s.PrivyClientError("Cannot unlink an embedded wallet");E(await u.unlinkSolanaWallet(e.address))}})))||[];return ja(e,t)?e:t}))};a.useEffect((()=>{Me()}),[C?.linkedAccounts,w,m]),a.useEffect((()=>{if(m){if(!u.connectors)throw new s.PrivyClientError("Connector not initialized");Me(),u.connectors.on("walletsUpdated",Me)}}),[m]),a.useEffect((()=>{let e;if(!b[0])return;let t=b[0],r=P.current.find((e=>e.address===t.address));if(e="privy"===t.walletClientType?C?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"===e.walletClientType)):C?.linkedAccounts.find((e=>"wallet"===e.type&&e.address===t.address&&"privy"!==e.walletClientType)),!r&&e){let t=Object.assign({},C);t.wallet=e&&{address:e.address,chainType:e.chainType,chainId:e.chainId,walletClient:e.walletClient,walletClientType:e.walletClientType,connectorType:e.connectorType,imported:e.imported,walletIndex:e.walletIndex},E(t)}P.current=b}),[b]);let Oe=async(e,t,r)=>{let n=h.getPrivyEthereumWallet(e),i=h.getPrivySolanaWallet(e);if(n&&!r?.createAdditional)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");let[a,o]=await Promise.all([Ge.initializeWalletProxy(t),jg()]);if(!a&&Z.customAuth?.enabled)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(!a||!o||Z.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise(((e,t)=>{Q(!0),te({createWallet:{onSuccess:t=>{h.emitPrivyEvent(ye,"createWallet","onSuccess",t),e(t)},onFailure:e=>{h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),t(e)},callAuthOnSuccessOnClose:!1}}),Ce(v.ModalScreen.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN)}));{if(n){let t=h.getPrivyEthereumHDWallets(e),r=t?.length?Math.max(...t.map((e=>e.walletIndex))):n.walletIndex;await Ge.recoverEmbeddedEthereumWallet(),await a.createAdditional({accessToken:o,primaryWalletAddress:n?.address,hdWalletIndex:r+1})}else console.log("solanaWallet",i),await a.create({accessToken:o,solanaAddress:i?.address});let t=h.getPrivyEthereumWallet(await Ge.refreshUser());if(!t)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");return h.emitPrivyEvent(ye,"createWallet","onSuccess",t),t}},Re=(e,r,n,i)=>new Promise((async(a,o)=>{let{requesterAppId:c}=r||{};if(!w||!C)return h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),void o(Error("User must be authenticated before signing with a Privy wallet"));let u=i??h.getPrivyEthereumWallet(C)?.address;if(!u)throw new s.PrivyClientError("User must have an embedded wallet to send a transaction.");let{signingWallet:p,rootWallet:y}=h.getSigningAndRootWallet(C,u);if(!y||!p)return h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void o(Error("Must have a Privy wallet before signing"));Q(!0);let m=qe.wallets.find((e=>"privy"===e.walletClientType&&t.getAddress(e.address)===t.getAddress(p.address))),g=await(m?.getEthereumProvider());if(!m||!g)throw new s.PrivyClientError(`Cannot sendTransaction before embedded wallet ${p.address} is connected`);let x=e.chainId?Number(e.chainId):bm(m.chainId);(e=>{if(!Z.chains.map((e=>e.id)).includes(e))throw new s.PrivyConnectorError(`Chain ID ${e} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,s.PrivyErrorCode.UNSUPPORTED_CHAIN_ID)})(x);let E=Object.assign({},e,{chainId:x});if(xe({showWalletUIs:r?.showWalletUIs}))(async()=>{let e=await jg();if(!e||!K)return h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void o(Error("Must have valid access token and Privy wallet to send transaction"));try{if(!await Ge.recoverEmbeddedEthereumWallet())return h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),void o(Error("Unable to connect to wallet"));let t=d.getJsonRpcProvider(E.chainId,Z.chains,Z.rpcConfig,{appId:l.appId}),n=await or(p.address,E,t);if(xe({showWalletUIs:r?.showWalletUIs})){let{totalGasEstimate:e}=await ir(n,t),{hasSufficientFunds:r}=await yf(p.address,n,e,t);if(!r)throw new f.PrivyProviderRpcError(new f.ProviderRpcError("Wallet has insufficient funds for this transaction.",f.E.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let i=await pf({accessToken:e,rootWallet:y,transactingWallet:p,walletProxy:K,transactionRequest:n,provider:t,requesterAppId:c});h.emitPrivyEvent(ye,"sendTransaction","onSuccess",i),a(i)}catch(e){h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.TRANSACTION_FAILURE),o(e)}})();else{let e={address:y.address,onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:e=>{h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),o(e)}},t=Am({address:p.address,appConfig:Z,fundWalletConfig:n,chainIdOverride:E.chainId,comingFromSendTransactionScreen:!0});te({connectWallet:e,sendTransaction:{transactionRequest:E,transactingWallet:p,rootWallet:y,onSuccess:e=>{h.emitPrivyEvent(ye,"sendTransaction","onSuccess",e),a(e)},onFailure:e=>{h.emitPrivyEvent(ye,"sendTransaction","onError",s.PrivyErrorCode.TRANSACTION_FAILURE),o(e)},uiOptions:r||{},fundWalletConfig:n,requesterAppId:c},funding:t}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}})),Fe=({transaction:e,connection:t,transactionOptions:r,fundWalletConfig:n,uiOptions:i,wallet:a})=>new Promise((async(o,l)=>{let{requesterAppId:d}=i||{};if(!w||!C)return h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),void l(new s.PrivyClientError("User must be authenticated before signing with a Privy wallet",s.PrivyErrorCode.MUST_BE_AUTHENTICATED));let c=a?C.linkedAccounts.find((e=>"wallet"===e.type&&e.address===a.address)):h.getPrivySolanaWallet(C);if(!c)return h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void l(new s.PrivyClientError("Must have a Privy wallet before signing",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND));Q(!0);let u=a??$,p=await(u?.isConnected());if(!u||!p)throw h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),new s.PrivyClientError(`Cannot sendSolanaTransaction before embedded wallet ${c.address} is connected`,s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND);if(xe({showWalletUIs:i?.showWalletUIs}))(async()=>{let n=await jg();if(!n||!K)return h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void l(new s.PrivyClientError("Must have valid access token and Privy wallet to send transaction",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND));try{if(!await Ge.recoverEmbeddedSolanaWallet())return h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),void l(new s.PrivyClientError("Unable to connect to wallet",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR));if(xe({showWalletUIs:i?.showWalletUIs})){let{instructions:r}=await eu(e,t);r.every((e=>e.hasFunds))||(h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.INSUFFICIENT_BALANCE),l(new s.PrivyClientError("Solana wallet has insufficient funds for this transaction.",s.PrivyErrorCode.INSUFFICIENT_BALANCE)))}let{signature:a,receipt:d}=await Em({accessToken:n,tx:e,connection:t,walletProxy:K,transactionOptions:r,transactingWalletAddress:c.address}),u=Qc(a,d);h.emitPrivyEvent(ye,"sendSolanaTransaction","onSuccess",u),o(u)}catch(e){h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.TRANSACTION_FAILURE),l(e)}})();else{let a={address:c.address,onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN,onFailure:e=>{h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),l(e)}},u=jm({address:c.address,appConfig:Z,fundWalletConfig:n,comingFromSendTransactionScreen:!0});te({connectWallet:a,sendSolanaTransaction:{transactionRequest:e,connection:t,transactionOptions:r,transactingWallet:c,onSuccess:e=>{h.emitPrivyEvent(ye,"sendSolanaTransaction","onSuccess",e),o(e)},onFailure:e=>{h.emitPrivyEvent(ye,"sendSolanaTransaction","onError",s.PrivyErrorCode.TRANSACTION_FAILURE),l(e)},uiOptions:i||{},requesterAppId:d},funding:u}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}}));function Le(){return new Promise((async(e,t)=>{let r=await jg();if(!r||!K)throw Error("Must have valid access token to enroll in MFA");try{await K.verifyMfa({accessToken:r}),e()}catch(e){t(e)}}))}let Ue=e=>e?.linkedAccounts.filter((e=>null!==e.latestVerifiedAt&&!("wallet"===e.type&&"privy"===e.walletClientType))).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0],De=e=>{let t=C?.linkedAccounts.filter((t=>t.type===e)).length??0,{displayName:r,loginMethod:n}=yp(e);if("passkey"===e&&t>=5||"passkey"!==e&&t>=1)throw h.emitPrivyEvent(ye,"linkAccount","onError",s.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE,{linkMethod:n}),new s.PrivyClientError(`User already has an account of type ${r} linked.`)};async function We({showAutomaticRecovery:e=!1,legacySetWalletPasswordFlow:t=!1}){I(null);let r=t?"setWalletPassword":"setWalletRecovery";if(!w||!C)throw h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before adding recovery method to Privy wallet");let n=h.getPrivyEthereumWallet(C);if(!n||!K)throw h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Must have a Privy wallet to add a recovery method");if(h.getPrivySolanaWallet(C))throw Error("Cannot set user-controlled recovery for user with Solana.");try{await Le()}catch(e){throw h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.MISSING_MFA_CREDENTIALS),e}return new Promise(((i,a)=>{Q(!0);let o={onSuccess:e=>{h.emitPrivyEvent(ye,r,"onSuccess","user-passcode",e),i(e)},onFailure:e=>{h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.USER_EXITED_SET_PASSWORD_FLOW),a(e)},callAuthOnSuccessOnClose:!1},l="user-passcode"===n.recoveryMethod;te({setWalletPassword:o,createWallet:o,connectWallet:{onCompleteNavigateTo:ad({walletAction:"update",availableRecoveryMethods:Z.embeddedWallets.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:t,isResettingPassword:l,showAutomaticRecovery:e}),shouldForceMFA:!1,onFailure:e=>{h.emitPrivyEvent(ye,r,"onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),a(e)}},recoverySelection:{isInAccountCreateFlow:!1,isResettingPassword:l}}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)}))}async function Be({appId:e,action:t}){let r=await jg();if("link"===t&&!r)throw h.emitPrivyEvent(ye,"linkAccount","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new s.PrivyClientError("User must be authenticated before linking an account.");if("login"===t&&r)throw h.emitPrivyEvent(ye,"login","onError",s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),new s.PrivyClientError("Attempted to log in, but user is already logged in. Use a `link` helper instead.");ge.current=`privy:${e}`,ve.current=t;let n=window.open(void 0,void 0,ch({w:440,h:680}));return u.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise((async(r,i)=>{let{name:a,logoUrl:o}=await sh({api:u.api,providerAppId:e,requesterAppId:Z.id});te({crossAppAuth:{appId:e,name:a,logoUrl:o,action:t,popup:n,onSuccess:r,onError:i}}),Ee(v.ModalScreen.CROSS_APP_AUTH_SCREEN)}))}let He={ready:m,authenticated:w,user:C,walletConnectors:u.connectors||null,connectWallet:e=>{e&&"target"in e&&e&&(e=void 0),te({externalConnectWallet:{walletList:e?.walletList&&e?.walletList.length>0?e.walletList:void 0,suggestedAddress:e?.suggestedAddress}}),Ce(w?v.ModalScreen.CONNECT_ONLY_AUTHENTICATED_SCREEN:v.ModalScreen.CONNECT_ONLY_LANDING_SCREEN)},importWallet:async({privateKey:e})=>{_e("siwe");let[t,r]=await Promise.all([Ge.initializeWalletProxy(15e3),jg()]);if(t&&r){await t.import({privateKey:e,accessToken:r});let n=h.getImportedPrivyEthereumWallet(await Ge.refreshUser());if(!n)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return h.emitPrivyEvent(ye,"createWallet","onSuccess",n),n}throw new s.PrivyClientError("User is not authenticated")},linkWallet:ke,startCrossAppAuthFlow:Be,linkEmail:()=>{_e("email"),De("email"),ge.current="email",ve.current="link",Ce(v.ModalScreen.LINK_EMAIL_SCREEN)},linkPhone:()=>{_e("sms"),De("phone"),ge.current="sms",ve.current="link",Ce(v.ModalScreen.LINK_PHONE_SCREEN)},linkGoogle:async()=>{_e("google"),De("google_oauth"),ve.current="link",await Ge.initLoginWithOAuth("google")},linkTwitter:async()=>{_e("twitter"),De("twitter_oauth"),ve.current="link",await Ge.initLoginWithOAuth("twitter")},linkDiscord:async()=>{_e("discord"),De("discord_oauth"),ve.current="link",await Ge.initLoginWithOAuth("discord")},linkGithub:async()=>{_e("github"),De("github_oauth"),ve.current="link",await Ge.initLoginWithOAuth("github")},linkSpotify:async()=>{_e("spotify"),De("spotify_oauth"),ve.current="link",await Ge.initLoginWithOAuth("spotify")},linkInstagram:async()=>{_e("instagram"),De("instagram_oauth"),ve.current="link",await Ge.initLoginWithOAuth("instagram")},linkTiktok:async()=>{_e("tiktok"),De("tiktok_oauth"),ve.current="link",await Ge.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{_e("linkedin"),De("linkedin_oauth"),ve.current="link",await Ge.initLoginWithOAuth("linkedin")},linkApple:async()=>{_e("apple"),De("apple_oauth"),ve.current="link",await Ge.initLoginWithOAuth("apple")},linkPasskey:async()=>{_e("passkey"),De("passkey"),await Ge.initLinkWithPasskey(),Ce(v.ModalScreen.LINK_PASSKEY_SCREEN)},linkTelegram:async()=>{_e("telegram"),De("telegram"),ve.current="link",ge.current="telegram",await Ge.initLoginWithTelegram(),Ce(v.ModalScreen.TELEGRAM_AUTH_SCREEN)},linkFarcaster:async()=>{_e("farcaster"),De("farcaster"),await Ge.initLoginWithFarcaster(),ve.current="link",ge.current="farcaster",Ce(v.ModalScreen.AWAITING_FARCASTER_CONNECTION)},updateEmail:()=>{if(_e("email"),!C?.email)throw new s.PrivyClientError("User does not have an email linked to their account.");ve.current="update",ge.current="email",Ce(v.ModalScreen.UPDATE_EMAIL_SCREEN)},updatePhone:()=>{if(_e("sms"),!C?.phone)throw new s.PrivyClientError("User does not have a phone number linked to their account.");ve.current="update",ge.current="sms",Ce(v.ModalScreen.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(!m){let e=await new Promise((e=>{ne((t=>e.bind(t)))}));if(ne(null),e)return void console.warn(t)}!C||C.isGuest?(ve.current="login",te({login:e}),Ee(v.ModalScreen.LANDING)):console.warn(t)},connectOrCreateWallet:async()=>{m||(await new Promise((e=>{ne((()=>e))})),ne(null)),w?console.warn("User must be unauthenticated to `connectOrCreateWallet`"):Ee(v.ModalScreen.CONNECT_OR_CREATE)},logout:async()=>{if(C&&u.clearProviderAcccessTokens(C),I(null),await u.logout(),C&&K)try{await K.clearMfa({userId:C.id})}catch(e){}E(null),x(!1),h.emitPrivyEvent(ye,"logout","onSuccess"),ve.current=null,ge.current=null,y(!1),c.e6.del(d.CLIENT_ANALYTICS_ID_KEY),c.e6.del(d.getGuestCredentialStorageKey(Z.id))},getAccessToken:()=>u.getAccessToken(),getEthereumProvider:()=>{if(!C||!C.wallet)return new Pa;let e=b.find((e=>C.wallet&&e.address===C.wallet.address)),t=u.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return e&&t?t.proxyProvider:new Pa},getEthersProvider:()=>{if(!C||!C.wallet)return new r.Web3Provider(new Na(new Pa));let e=b.find((e=>C.wallet&&e.address===C.wallet.address)),t=u.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new r.Web3Provider(new Na(e&&t?t.proxyProvider:new Pa))},getWeb3jsProvider:()=>{if(!C||!C.wallet)return new Ia(new Pa);let e=b.find((e=>C.wallet&&e.address===C.wallet.address)),t=u.connectors?.walletConnectors.find((t=>t.wallets.find((t=>t.address===e?.address))));return new Ia(e&&t?t.proxyProvider:new Pa)},unlinkWallet:async e=>{let t;return E(t=e.startsWith("0x")?await u.unlinkEthereumWallet(e):await u.unlinkSolanaWallet(e)),t},unlinkEmail:async e=>{let t=await u.unlinkEmail(e);return E(t),t},unlinkPhone:async e=>{let t=await u.unlinkPhone(e);return E(t),t},unlinkGoogle:async e=>{let t=await u.unlinkOAuth("google",e);return E(t),t},unlinkTwitter:async e=>{let t=await u.unlinkOAuth("twitter",e);return E(t),t},unlinkDiscord:async e=>{let t=await u.unlinkOAuth("discord",e);return E(t),t},unlinkGithub:async e=>{let t=await u.unlinkOAuth("github",e);return E(t),t},unlinkSpotify:async e=>{let t=await u.unlinkOAuth("spotify",e);return E(t),t},unlinkInstagram:async e=>{let t=await u.unlinkOAuth("instagram",e);return E(t),t},unlinkTiktok:async e=>{let t=await u.unlinkOAuth("tiktok",e);return E(t),t},unlinkLinkedIn:async e=>{let t=await u.unlinkOAuth("linkedin",e);return E(t),t},unlinkApple:async e=>{let t=await u.unlinkOAuth("apple",e);return E(t),t},unlinkFarcaster:async e=>{let t=await u.unlinkFarcaster(e);return E(t),t},unlinkTelegram:async e=>{let t=await u.unlinkTelegram(e);return E(t),t},unlinkPasskey:async e=>{let t=await u.unlinkPasskey(e);return E(t),t},unlinkCrossAppAccount:async({subject:e})=>{let t=C?.linkedAccounts.find((t=>"cross_app"===t.type&&t.subject===e))?.providerApp;if(!t)throw new s.PrivyClientError("Invalid subject");u.storeProviderAccessToken(t.id,null);let r=await u.unlinkOAuth(`privy:${t.id}`,e);return E(r),r},setActiveWallet:async e=>{let r=b.find((r=>t.getAddress(r.address)===t.getAddress(e))),n=C?.linkedAccounts.find((r=>"wallet"===r.type&&t.getAddress(r.address)===t.getAddress(e)));if(r&&await r.isConnected())if(r.linked){let e=Object.assign({},C);e.wallet=n&&{address:n.address,chainType:n.chainType,chainId:n.chainId,walletClient:n.walletClient,walletClientType:n.walletClientType,connectorType:n.connectorType,imported:n.imported,walletIndex:n.walletIndex},E(e)}else r.loginOrLink();else te({externalConnectWallet:{suggestedAddress:e}}),ke()},forkSession:()=>u.forkSession(),createWallet:async e=>{if(e&&"target"in e&&e&&(e=void 0),!w||!C)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return Oe(C,15e3,e)},setWalletRecovery:async e=>We({legacySetWalletPasswordFlow:!1,showAutomaticRecovery:e?.showAutomaticRecovery??!1}),setWalletPassword:async()=>We({legacySetWalletPasswordFlow:!0,showAutomaticRecovery:!1}),signMessage:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:a}=t||{};if(!w||!C)return h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let o=r??h.getPrivyEthereumWallet(C)?.address;if(!o)throw new s.PrivyClientError("User must have an embedded wallet to sign a message.");let{signingWallet:l,rootWallet:d}=h.getSigningAndRootWallet(C,o);if(!l||!d)return h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));if("string"!=typeof e||e.length<1)return h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.INVALID_MESSAGE),void i(Error("Message must be a non-empty string"));Q(!0);let c=async()=>{if(!w)throw Error("User must be authenticated before signing with a Privy wallet");let t=await jg();if(!K||!t||!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");u.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:l.address,requesterAppId:a}});let{response:r}=await K.rpc({accessToken:t,address:d.address,hdWalletIndex:l.walletIndex??void 0,requesterAppId:a,request:{method:"personal_sign",params:[e,l.address]}}),n=r.data;return u.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:l.address,requesterAppId:a}}),n};if(xe({showWalletUIs:t?.showWalletUIs}))try{let e=await c();h.emitPrivyEvent(ye,"signMessage","onSuccess",e),n(e)}catch(e){h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.UNABLE_TO_SIGN),i(e??new f.PrivyProviderRpcError("Unable to sign message"))}else te({signMessage:{method:"personal_sign",data:e,confirmAndSign:c,onSuccess:e=>{h.emitPrivyEvent(ye,"signMessage","onSuccess",e),n(e)},onFailure:e=>{h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),i(e)},address:d.address}}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})),signTypedData:(e,t,r)=>new Promise((async(n,i)=>{let{requesterAppId:a}=t||{};if(!w||!C)return h.emitPrivyEvent(ye,"signTypedData","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED),void i(Error("User must be authenticated before signing with a Privy wallet"));let o=r??h.getPrivyEthereumWallet(C)?.address;if(!o)throw new s.PrivyClientError("User must have an embedded wallet to sign a message.");let{signingWallet:l,rootWallet:c}=h.getSigningAndRootWallet(C,o);if(!c||!l)return h.emitPrivyEvent(ye,"signTypedData","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),void i(Error("Must have a Privy wallet before signing"));Q(!0);let p=d.generateTypedDataWithDomainType(e),y=async()=>{if(!w)throw Error("User must be authenticated before signing with a Privy wallet");let e=await jg();if(!K||!e||!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");u.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:l.address,requesterAppId:a}});let{response:t}=await K.rpc({accessToken:e,address:c.address,hdWalletIndex:l.walletIndex??void 0,requesterAppId:a,request:{method:"eth_signTypedData_v4",params:[l.address,p]}}),r=t.data;return u.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:l.address,requesterAppId:a}}),r};if(xe({showWalletUIs:t?.showWalletUIs,typedData:!0}))try{let e=await y();h.emitPrivyEvent(ye,"signTypedData","onSuccess",e),n(e)}catch(e){h.emitPrivyEvent(ye,"signTypedData","onError",s.PrivyErrorCode.UNABLE_TO_SIGN),i(e??new f.PrivyProviderRpcError("Unable to sign message"))}else te({signMessage:{method:"eth_signTypedData_v4",data:p,confirmAndSign:y,onSuccess:e=>{h.emitPrivyEvent(ye,"signTypedData","onSuccess",e),n(e)},onFailure:e=>{h.emitPrivyEvent(ye,"signTypedData","onError",s.PrivyErrorCode.UNABLE_TO_SIGN),i(e)},uiOptions:t||{}},connectWallet:{address:c.address,onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:e=>{h.emitPrivyEvent(ye,"signMessage","onError",s.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR),i(e)}}}),Ce(v.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})),sendTransaction:async(e,t,r,n)=>{let i=await Re(e,t,r,n);return mf(await i.wait())},sendSolanaTransaction:async(e,t,r,n,i)=>await Fe({transaction:e,connection:t,transactionOptions:n,uiOptions:r,fundWalletConfig:i,wallet:$??void 0}),exportWallet:e=>new Promise((async(r,n)=>{if(!w||!C)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,a=C.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"ethereum"===e.chainType)),o=i?a.find((e=>e.address===t.getAddress(i))):a.find((e=>!e.imported))||a[0];if(!o)return void n(Error("Must have a Privy wallet before exporting"));Q(!0);let s={onCompleteNavigateTo:v.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN,onFailure:n,address:o.address,shouldForceMFA:!0};te(ee),await jg()&&K?K?(te({keyExport:{appId:l.appId,appClientId:l.clientId,origin:u.apiUrl,wallet:o,onSuccess:r,onFailure:n},connectWallet:s}),Ce(v.ModalScreen.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:Le,async init(e){switch(e){case"sms":return void await u.initMfaSmsVerification();case"passkey":return await u.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 s.PrivyClientError("Invalid MFA code");he.current?.resolve({mfaMethod:e,mfaCode:t,relyingParty:window.origin}),await new Promise(((e,t)=>{pe.current={resolve:e,reject:t}}));break;case"passkey":if("string"==typeof t)throw new s.PrivyClientError("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));he.current?.resolve({mfaMethod:e,mfaCode:n,relyingParty:window.origin}),await new Promise(((e,t)=>{pe.current={resolve:e,reject:t}}));break;default:throw he.current?.reject(new s.PrivyClientError("Unsupported MFA method")),new s.PrivyClientError(`Unsupported MFA method: ${e}`)}},cancel(){he.current?.reject(new s.PrivyClientError("MFA canceled"))},async initEnrollmentWithSms(e){let t=await jg();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.initEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber})},enrollInMfa:e=>new Promise(((t,r)=>{if(!e)return Ge.closePrivyModal(),void t();Z.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."),te({mfaEnrollmentFlow:{mfaMethods:Z.mfa.methods,onSuccess:t,onFailure:r}}),Ce(v.ModalScreen.MFA_ENROLLMENT_FLOW_SCREEN)})),async initEnrollmentWithTotp(){let e=await jg();if(!e||!K)throw Error("Must have valid access token to enroll in MFA");let t=await K.initEnrollMfa({method:"totp",accessToken:e});return{secret:t.secret,authUrl:t.authUrl}},async submitEnrollmentWithSms(e){let t=await jg();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.submitEnrollMfa({method:"sms",accessToken:t,phoneNumber:e.phoneNumber,code:e.mfaCode}),E(await u.getAuthenticatedUser())},async submitEnrollmentWithTotp(e){let t=await jg();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.submitEnrollMfa({method:"totp",accessToken:t,code:e.mfaCode}),E(await u.getAuthenticatedUser())},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:e}){let t=await jg();if(!t||!K)throw Error("Must have valid access token to enroll in MFA");await K.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:e}),E(await u.getAuthenticatedUser())},async unenroll(e){let t=await jg();if(!t||!K)throw Error("Must have valid access token to remove MFA");"passkey"===e?await K.submitEnrollMfa({method:"passkey",accessToken:t,credentialIds:[]}):await K.unenrollMfa({method:e,accessToken:t}),E(await u.getAuthenticatedUser())},requestFarcasterSignerFromWarpcast:async()=>{let e=await jg(),t=C?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!e)throw Error("Must have valid access token to connect with Farcaster");if(!K||!t)throw Error("Must have an embedded wallet to use Farcaster signers");if(!C?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");let r=await K.initFarcasterSigner({address:t.address,hdWalletIndex:null,accessToken:e,mfaCode:null,mfaMethod:null,relyingParty:window.origin});"approved"===r.status&&E(await u.getAuthenticatedUser()||C||null),te({farcasterSigner:r}),Ce(v.ModalScreen.AWAITING_FARCASTER_SIGNER)},getFarcasterSignerPublicKey:async()=>{let e,t=await jg(),r=C?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!K||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!C?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");if(!C.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");return e=C.farcaster.signerPublicKey.slice(2),Uint8Array.from(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},signFarcasterMessage:async e=>{let t=await jg(),r=C?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!K||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!C?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");if(!await Ge.recoverEmbeddedEthereumWallet())throw Error("Unable to connect to wallet");if(!C.farcaster?.signerPublicKey)throw Error("Must have a Farcaster signer public key to sign");let n=await import("@simplewebauthn/browser"),i=await K.signFarcasterMessage({address:r.address,hdWalletIndex:null,accessToken:t,mfaCode:null,mfaMethod:null,payload:{hash:n.bufferToBase64URLString(e)},fid:BigInt(C.farcaster.fid),relyingParty:window.origin});return new Uint8Array(n.base64URLStringToBuffer(i.signature))},createGuestAccount:async()=>{if(C&&!C.isGuest)throw Error("User cannot already be authenticated to create a guest account");return C?.isGuest?C:Ge.loginWithGuestAccountFlow()},isHeadlessOAuthLoading:M,async loginWithCode(e){await Ge.loginWithCode(e)},initLoginWithEmail:e=>Ge.initLoginWithEmail(e),initLoginWithSms:e=>Ge.initLoginWithSms(e),otpState:B,fundWallet:(e,t)=>Ge.fundWallet(e,t),initLoginWithHeadlessOAuth:(e,t)=>Ge.initLoginWithHeadlessOAuth(e,t),loginWithHeadlessOAuth:e=>Ge.loginWithHeadlessOAuth(e),generateSiweMessage:({address:e,chainId:t})=>Ge.generateSiweMessage({address:e,chainId:t}),async linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}){_e("siwe"),await Ge.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})},signMessageWithCrossAppWallet:(e,{address:t})=>lh({user:C,client:u,address:t,requesterAppId:Z.id,request:{method:"personal_sign",params:[e,t]},reconnect:Be}),signTypedDataWithCrossAppWallet(e,{address:t}){let r=d.generateTypedDataWithDomainType(e);return lh({user:C,client:u,address:t,requesterAppId:Z.id,request:{method:"eth_signTypedData_v4",params:[t,r]},reconnect:Be})},sendTransactionWithCrossAppWallet:(e,{address:t})=>lh({user:C,client:u,address:t,requesterAppId:Z.id,request:{method:"eth_sendTransaction",params:[e]},reconnect:Be}),isModalOpen:p,mfaMethods:Z.mfa.methods};xg=He.signMessage,Cg=He.signTypedData,Eg=async(...e)=>{let t=await Re(...e);return Z.embeddedWallets.waitForTransactionConfirmation&&await t.wait(),t};let Ge={isNewUserThisSession:_,pendingTransaction:null,walletConnectionStatus:R,connectors:u.connectors?.walletConnectors??[],solanaWallets:A,rpcConfig:Z.rpcConfig,chains:Z.chains,appId:l.appId,showFiatPrices:"native-token"!==Z.embeddedWallets.priceDisplay.primary,clientAnalyticsId:u.clientAnalyticsId,customAuthStatus:ce,noPromptOnSignature:we,emailOtpState:D,setEmailOtpState:W,smsOtpState:B,setSmsOtpState:H,oAuthState:z,setOAuthState:V,siweState:G,setSiweState:q,nativeTokenSymbolForChainId:e=>Z.chains.find((t=>t.id===Number(e)))?.nativeCurrency.symbol,initializeWalletProxy:async e=>{if(K)return K;let t=new Promise((e=>{ae((()=>t=>e(t)))})),r=new Promise((t=>setTimeout((()=>t(null)),e))),n=await Promise.race([t,r]);return ae(null),n},getAuthFlow:()=>u.authFlow,getAuthMeta:()=>u.authFlow?.meta,client:u,closePrivyModal:async(e={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let t,r=m&&w&&C;r&&ge.current&&(t=Ue(C)),"login"===ve.current?e.shouldCallAuthOnSuccess&&r&&ge.current?(h.emitPrivyEvent(ye,"login","onComplete",C,_,!1,ge.current,t??null),l.onSuccess?.(C,_)):h.emitPrivyEvent(ye,"login","onError",s.PrivyErrorCode.USER_EXITED_AUTH_FLOW):"link"===ve.current&&t?e.isSuccess&&r&&ge.current?h.emitPrivyEvent(ye,"linkAccount","onSuccess",C,ge.current,t):ge.current&&h.emitPrivyEvent(ye,"linkAccount","onError",s.PrivyErrorCode.USER_EXITED_LINK_FLOW,{linkMethod:ge.current}):"update"===ve.current&&t&&(e.isSuccess&&r&&ge.current?h.emitPrivyEvent(ye,"update","onSuccess",C,ge.current,t):ge.current&&h.emitPrivyEvent(ye,"update","onError",s.PrivyErrorCode.USER_EXITED_UPDATE_FLOW,{linkMethod:ge.current}));let i=N&&$m.includes(N),a=N===v.ModalScreen.ERROR_SCREEN&&ee.errorModalData&&$m.includes(ee.errorModalData.previousScreen);if((i||a)&&ee.funding){let e,t=Tm[N]??null;if("solana"===ee.funding.chainType){try{e=await new n.Connection(qc(ee.funding.cluster)).getBalance(new n.PublicKey(ee.funding.address)).then((e=>BigInt(e)))}catch{console.error("Unable to pull wallet balance")}h.emitPrivyEvent(ye,"fundSolanaWallet","onUserExited",{address:ee.funding.address,cluster:ee.funding.cluster,fundingMethod:t,balance:e})}else{let r=d.getJsonRpcProvider(ee.funding.chain.id,Z.chains,Z.rpcConfig,{appId:l.appId});try{e=(await r.getBalance(ee.funding.address)).toBigInt()}catch{console.error("Unable to pull wallet balance")}h.emitPrivyEvent(ye,"fundWallet","onUserExited",{address:ee.funding.address,chain:ee.funding.chain,fundingMethod:t,balance:e})}}te({...ee,externalConnectWallet:{suggestedAddress:void 0}}),ve.current=null,ge.current=null,k(!1),y(!1),setTimeout((()=>{u.authFlow=void 0}),200),u.createAnalyticsEvent({eventName:"modal_closed"})},solanaSignMessage:async({message:e})=>new Promise((async(t,r)=>{let n=async()=>{let t=await u.getAccessToken();if(!t)throw Error("User must be authenticated to use their embedded wallet.");if(!$)throw Error("User must have an embedded Solana wallet to sign messages for Solana.");let r=Ge.walletProxy??await Ge.initializeWalletProxy(15e3);if(!r)throw Error("Failed to initialize embedded wallet proxy.");let{response:n}=await r.rpcSolana({accessToken:t,publicKey:$.address,request:{method:"signMessage",params:{message:e}}});return n.data.signature};if(xe({showWalletUIs:void 0}))try{let e=await n();t({signature:e})}catch(e){r(e)}else te({signMessage:{method:"solana_signMessage",data:e,confirmAndSign:n,onSuccess:e=>{t({signature:e})},onFailure:e=>{r(e)},uiOptions:{}}}),Ee(v.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN)})),openPrivyModal:Ce,connectWallet:je,initLoginWithWallet:async(e,t,r)=>{Aa(e)?(ge.current="siwe",$e(e,t,r)):(ge.current="siws",Te(e,t))},loginWithWallet:async()=>{let e,t,r;if(!m)throw new s.PrivyNotReadyError;if(u.authFlow instanceof pa?e="siwe":u.authFlow instanceof ya&&(e="siws"),!e)throw new s.PrivyClientError("Must initialize SIWE/SIWS flow first.");if(null!==await u.getAccessToken())try{({user:t}=await u.link()),ge.current=e}catch(t){throw h.emitPrivyEvent(ye,"linkAccount","onError",t.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{({user:t,isNewUser:r}=await u.authenticate()),ge.current=e}catch(e){throw h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR),e}E(t||C||null),k(r||!1),x(!0)},initDelegateAction:async({address:e})=>new Promise((async(t,r)=>{let n=await jg();if(!w||!C||!n)throw new s.PrivyClientError("User must be authenticated and have an embedded wallet to delegate actions.");let i=Ge.walletProxy??await Ge.initializeWalletProxy(15e3);if(!i)throw new s.PrivyClientError("Wallet proxy not initialized.");let a=(({address:e,user:t})=>{let r=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!r)throw new s.PrivyClientError("Address to delegate is not associated with current user.");return{address:r.address,chainType:r.chainType,walletIndex:r.walletIndex??0}})({address:e,user:C}),o=(({address:e,user:t})=>{let r,n=t.linkedAccounts.find((t=>"wallet"===t.type&&"privy"===t.walletClientType&&t.address===e));if(!n)throw new s.PrivyClientError("Address to delegate is not associated with current user.");if(!(r="ethereum"===n.chainType?n.imported?h.getImportedPrivyEthereumWallet(t):h.getPrivyEthereumWallet(t):n))throw new s.PrivyClientError("Unable to determine root address for delegated address.");return{address:r.address,chainType:r.chainType,imported:r.imported}})({address:e,user:C});"ethereum"===a.chainType?await Ge.recoverEmbeddedEthereumWallet():await Ge.recoverEmbeddedSolanaWallet(),te({delegatedActions:{address:e,onDelegate:async()=>{await i.createDelegatedAction({accessToken:n,rootWallet:o,delegatedWallets:[a]})},onSuccess:async()=>{t()},onError:async e=>{r(e)}}}),Ce(v.ModalScreen.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN)})),initLoginWithFarcaster:async(e,t)=>{let r=new Bi(e,t);u.startAuthFlow(r);try{ge.current="farcaster",await r.initializeFarcasterConnect()}catch(e){throw"login"===ve.current?h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ve.current&&h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"farcaster"}),e}},loginWithFarcaster:async()=>{let e,t;if(!m)throw new s.PrivyNotReadyError;if(!(u.authFlow instanceof Bi))throw new s.PrivyClientError("Must initialize Farcaster flow first.");if(null!==await u.getAccessToken())try{({user:e}=await u.link()),ge.current="farcaster"}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"farcaster"}),e}else try{({user:e,isNewUser:t}=await u.authenticate()),ge.current="farcaster"}catch(e){throw h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}E(e||null),k(t||!1),x(!0)},async loginWithGuestAccountFlow(){let e=new Gi(this.appId);u.startAuthFlow(e);try{ve.current="login",ge.current="guest";let{user:e,isNewUser:t}=await u.authenticate();if(t=t||!1,!e)throw new s.PrivyClientError("Unable to authenticate guest account");if(h.shouldProceedtoEmbeddedWalletCreationFlow(e,Z.embeddedWallets.createOnLogin))try{await Oe(e,15e3),e=await Ge.refreshUser()}catch(t){E(e),console.warn("Unable to create embedded wallet for guest account")}else E(e);return k(t),x(!0),h.emitPrivyEvent(ye,"login","onComplete",e,t,!1,"guest",null),e}catch(e){throw h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async crossAppAuthFlow({appId:e,popup:t,action:r}){let n=`privy:${e}`;ge.current=n;let{url:i,stateCode:a,codeVerifier:o}=await async function({api:e,appId:t}){let r=qi(),n=zi(),i=await Vi(r);try{let{url:a}=await e.post(ji,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:i,state_code:n});return{url:a,stateCode:n,codeVerifier:r}}catch(e){throw s.formatApiError(e)}}({api:u.api,appId:e});if(!i)throw u.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:"Unable to open cross-app auth popup",appId:e}}),new s.PrivyClientError("No authorization URL returned for cross-app auth.");try{let l=await async function({url:e,popup:t}){return t.location=e,new Promise(((e,r)=>{let n,i=setTimeout((()=>{r(new s.PrivyClientError("Authorization request timed out after 2 minutes.")),a()}),12e4);function a(){t?.close(),window.removeEventListener("message",l)}let o=setInterval((()=>{t?.closed&&!n&&(a(),clearInterval(o),clearTimeout(i),r(new s.PrivyClientError("User rejected request")))}),300);function l(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(clearTimeout(i),e(t.data),a()),"PRIVY_OAUTH_ERROR"===t.data.type&&(clearTimeout(i),r(new s.PrivyClientError(t.data.error)),a()),t.data.type===gg&&((n=new BroadcastChannel(fg)).onmessage=l))}window.addEventListener("message",l)}))}({url:i,popup:t,provider:n}),d=l.stateCode,c=l.authorizationCode;if(d!==a)throw u.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:n,storedStateCode:a??"",returnedStateCode:d??""}}),new s.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,s.PrivyErrorCode.OAUTH_UNEXPECTED);let h=await async function({appId:e,stateCode:t,codeVerifier:r,authorizationCode:n,action:i,client:a}){if(!n||!t)throw new s.PrivyClientError("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===n)throw new s.PrivyClientError("User denied confirmation during cross-app auth flow");try{let o=new oh({authorizationCode:n,stateCode:t,codeVerifier:r,provider:`privy:${e}`});a.startAuthFlow(o);let s="link"===i?await a.link():await a.authenticate(),l=s.oAuthTokens?.accessToken;return console.debug(),l}catch(e){let t=s.formatApiError(e);if(t.privyErrorCode)throw new s.PrivyClientError(t.message||"Invalid code during cross-app auth flow.",void 0,t.privyErrorCode);if("User denied confirmation during cross-app auth flow"===t.message)throw new s.PrivyClientError("Invalid code during cross-app auth flow.",void 0,s.PrivyErrorCode.OAUTH_USER_DENIED);throw new s.PrivyClientError("Invalid code during cross-app auth flow.",void 0,s.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}({appId:e,codeVerifier:o,stateCode:d,authorizationCode:c,action:r,client:u});h&&u.storeProviderAccessToken(e,h);let p=await Ge.refreshUser();if(!p)throw new s.PrivyClientError("Unable to update user");return u.createAnalyticsEvent({eventName:"cross_app_auth_completed",payload:{providerAppId:e}}),p}catch(e){throw u.createAnalyticsEvent({eventName:"cross_app_auth_error",payload:{error:e.toString(),provider:n}}),e}},async initLoginWithOAuth(e,t,r){if(ge.current=e,!c.e())return void Ee(v.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);if("google"===e&&bl(window.navigator.userAgent))return void Ee(v.ModalScreen.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE);"twitter"===e&&window.opener&&window.opener.postMessage({type:gg},"*"),c.e6.del(d.HEADLESS_OAUTH_KEY),c.e6.del(d.OAUTH_DISABLE_SIGNUP_KEY);let n=new Yi({provider:e,disableSignup:!!r});t&&n.addCaptchaToken(t),u.startAuthFlow(n);let i=await u.authFlow.getAuthorizationUrl();i&&i.url&&("twitter"===e&&o.isAndroid&&(i.url=i.url.replace("x.com","twitter.com")),window.location.assign(i.url))},async initLoginWithTelegram(e,t){if(!m)throw new s.PrivyNotReadyError;ge.current="telegram";let r=new Ca(e,t);u.startAuthFlow(r),r.meta.telegramWebAppData=void 0,r.meta.telegramAuthResult=await new Promise(((e,t)=>Z.loginConfig.telegramAuthConfiguration?window.Telegram?void window.Telegram.Login.auth({bot_id:Z.loginConfig.telegramAuthConfiguration.botId,request_access:!0},(r=>r?e(r):t(new s.PrivyClientError("Telegram auth failed or was canceled by the client")))):t(new s.PrivyClientError("Telegram was not initialized")):t(new s.PrivyClientError("Telegram Auth configuration is not loaded"))))},async loginWithTelegram(e){let t,r;if(!(u.authFlow instanceof Ca))throw new s.PrivyClientError("Must initialize Telegram flow before calling loginWithTelegram");if(u.authFlow.meta.captchaToken||=e,"login"===ve.current)try{let e=await u.authenticate();t=e.user,r=e.isNewUser,ge.current="telegram"}catch(e){throw h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}else{if("link"!==ve.current)throw new s.PrivyClientError("Unknown auth intent");try{t=(await u.link()).user,ge.current="telegram"}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"telegram"}),e}}E(t),k(r||!1),x(!0)},async recoveryOAuthFlow(e,t,r){let n,i;function a(t){if(!t)throw u.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:e}}),new s.PrivyClientError("Recovery OAuth failed")}switch(e){case"google-drive":{let t,o,{url:l,codeVerifier:d,stateCode:c}=await sd({api:wg.api,provider:e});a(l);try{let n=await vg({url:l,popup:r,provider:e});if(t=n.stateCode,o=n.authorizationCode,t!==c)throw u.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:c??"",returnedStateCode:t??""}}),new s.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,s.PrivyErrorCode.OAUTH_UNEXPECTED)}catch(t){throw u.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:e}}),new s.PrivyClientError("Recovery OAuth failed")}[n,i]=await Promise.all([jg(),ld({api:wg.api,provider:e,codeVerifier:d,stateCode:t,authorizationCode:o})]);break}case"icloud":{let{url:t}=await sd({api:wg.api,provider:e});a(t);let{ckWebAuthToken:o}=await vg({url:t,popup:r,provider:e});i=o,n=await jg()}}if(!K)throw new s.PrivyClientError("Cannot connect to wallet proxy");if(!n)throw new s.PrivyClientError("Unable to authorize user");switch(t){case"recover":let t=ee.recoverWallet?.privyWallet?.address;if(!t)throw new s.PrivyClientError("Recovery OAuth failed");u.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t,recoveryMethod:e}}),await K.recover({address:t,accessToken:n,recoveryAccessToken:i,recoveryMethod:e}),u.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t,recoveryMethod:e}});break;case"create-wallet":u.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"});let r=h.getPrivySolanaWallet(C);await K.create({accessToken:n,recoveryAccessToken:i,recoveryMethod:e,solanaAddress:r?.address});let a=h.getPrivyEthereumWallet(await Ge.refreshUser());if(!a)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");u.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:a.address}}),h.emitPrivyEvent(ye,"createWallet","onSuccess",a);break;case"set-recovery":let o=h.getPrivyEthereumWallet(C);if(!o)throw h.emitPrivyEvent(ye,"setWalletRecovery","onError",s.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");u.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:o.address,existingRecoveryMethod:o.recoveryMethod,targetRecoveryMethod:e}}),await K.setRecovery({address:o.address,accessToken:n,recoveryAccessToken:i,recoveryMethod:e});let l=h.getPrivyEthereumWallet(await Ge.refreshUser());if(!l)throw h.emitPrivyEvent(ye,"createWallet","onError",s.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");u.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:o.address,existingRecoveryMethod:o.recoveryMethod,targetRecoveryMethod:e}}),h.emitPrivyEvent(ye,"setWalletRecovery","onSuccess",e,l);break;default:throw new s.PrivyClientError("Unsupported recovery action")}},async loginWithOAuth(e){let t,r,n;if(!(u.authFlow instanceof Yi))throw new s.PrivyClientError("Must initialize OAuth flow before calling loginWithOAuth");let i=c.e6.get(d.STATE_CODE_KEY),a=u.authFlow.meta.stateCode;if(i!==a)throw u.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e,storedStateCode:i??"",returnedStateCode:a??""}}),new s.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,s.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await u.getAccessToken())try{let r=await u.link();t=r.user,n=r.oAuthTokens,ge.current=e}catch(t){throw h.emitPrivyEvent(ye,"linkAccount","onError",t.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}else try{let i=await u.authenticate();t=i.user,r=i.isNewUser,n=i.oAuthTokens,ge.current=e}catch(t){throw"login"===ve.current?h.emitPrivyEvent(ye,"login","onError",t.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ve.current&&h.emitPrivyEvent(ye,"linkAccount","onError",t.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e}),t}return E(t),k(r||!1),x(!0),n&&t&&h.emitPrivyEvent(ye,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),n},passkeyAuthState:L,setPasskeyAuthState:U,async initLoginWithPasskey(e){let t=new ua(e,U);u.startAuthFlow(t),ve.current="login";try{ge.current="passkey",U({status:"generating-challenge"}),await t.initAuthenticationFlow(),U({status:"awaiting-passkey"})}catch(e){throw U({status:"error",error:e}),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}},async loginWithPasskey(){let e,t;if(!m)throw new s.PrivyNotReadyError;if(!(u.authFlow instanceof ua))throw new s.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==ge.current){let e=new s.PrivyClientError("Must init login with Passkey flow first.");throw U({status:"error",error:e}),e}let r=await jg();try{ge.current="passkey",U({status:"awaiting-passkey"}),({user:e,isNewUser:t}=await u.authenticate())}catch(e){throw U({status:"error",error:e}),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}E(e),k(t||!1),x(!0),U({status:"done"});let n=e?.linkedAccounts.find((({type:e})=>"passkey"===e))||null;return{user:e,isNewUser:t||!1,wasAlreadyAuthenticated:!!r,loginAccount:n}},async initLinkWithPasskey(e){let t=new ua(e);u.startAuthFlow(t),ve.current="link",ge.current="passkey";try{await t.initLinkFlow()}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),e}},async linkWithPasskey(){let e;if(!m)throw new s.PrivyNotReadyError;if(!(u.authFlow instanceof ua))throw new s.PrivyClientError("Must initialize Passkey flow first.");if("passkey"!==ge.current)throw new s.PrivyClientError("Must init login with Passkey flow first.");try{ge.current="passkey",({user:e}=await u.link())}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"passkey"}),e}return E(e||C||null),e},async initLoginWithHeadlessOAuth(e,t){if(!c.e())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&&bl(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let r=new Yi({provider:e,headless:!0,disableSignup:!1});t&&r.addCaptchaToken(t),V({status:"loading"});let n=await u.startAuthFlow(r).getAuthorizationUrl();n?.url&&window.location.assign(n.url)},async loginWithHeadlessOAuth(e){let t,r,n;O(!0),V({status:"loading"}),u.startAuthFlow(new Yi(e));let i=c.e6.get(d.STATE_CODE_KEY),a=e.stateCode;if(i!==a)throw u.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:e.provider,storedStateCode:i??"",returnedStateCode:a??""}}),O(!1),new s.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,s.PrivyErrorCode.OAUTH_UNEXPECTED);if(null!==await u.getAccessToken())try{({user:t,oAuthTokens:n}=await u.link()),ge.current=e.provider;let r=Ue(t);t&&r&&h.emitPrivyEvent(ye,"linkAccount","onSuccess",t,ge.current,r)}catch(t){throw O(!1),h.emitPrivyEvent(ye,"linkAccount","onError",t.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:e.provider}),t}else try{({user:t,isNewUser:r,oAuthTokens:n}=await u.authenticate()),ge.current=e.provider;let i=Ue(t);t&&i&&void 0!==r&&"login"===ve.current&&h.emitPrivyEvent(ye,"login","onComplete",t,r,!1,ge.current,i)}catch(e){throw O(!1),V({status:"error",error:e}),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}return E(t),k(r||!1),x(!0),O(!1),V({status:"done"}),n&&t&&h.emitPrivyEvent(ye,"oAuthAuthorization","onOAuthTokenGrant",n,{user:t}),t??void 0},initLoginWithEmail:async(e,t,r)=>{let n=new ki(e,t,r);u.startAuthFlow(n);try{ge.current="email",W({status:"sending-code"}),await n.sendCodeEmail(),W({status:"awaiting-code-input"})}catch(e){throw W({status:"error",error:e}),"login"===ve.current?h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ve.current&&h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"email"}),e}},initUpdateEmail:async(e,t,r)=>{let n=new Ni(e,t,r);u.startAuthFlow(n);try{await n.sendCodeEmail()}catch(e){h.emitPrivyEvent(ye,"update","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:ge.current})}},initUpdatePhone:async(e,t,r)=>{let n=new fa(e,t,r);u.startAuthFlow(n);try{await n.sendSmsCode()}catch(e){h.emitPrivyEvent(ye,"update","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:ge.current})}},initLoginWithSms:async(e,t,r)=>{H({status:"sending-code"});let n=new ma(e,t,r);u.startAuthFlow(n);try{ge.current="sms",await n.sendSmsCode(),H({status:"awaiting-code-input"})}catch(e){throw H({status:"error",error:e}),"login"===ve.current?h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR):"link"===ve.current&&h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"sms"}),e}},resendEmailCode:async()=>{await(u.authFlow?.sendCodeEmail())},resendSmsCode:async()=>{await(u.authFlow?.sendSmsCode())},loginWithCode:async e=>{let t,r;function n(e){u.authFlow instanceof ki?W(e):u.authFlow instanceof ma&&H(e)}if(n({status:"submitting-code"}),!m){let e=new s.PrivyNotReadyError;throw n({status:"error",error:e}),e}if(u.authFlow instanceof ki)u.authFlow.meta.emailCode=e.trim();else{if(!(u.authFlow instanceof ma)){let e=new s.PrivyClientError("Must initialize a passwordless code flow first");throw n({status:"error",error:e}),e}u.authFlow.meta.smsCode=e.trim()}let i=await jg();if("link"===ve.current)try{({user:t}=await u.link())}catch(e){throw n({status:"error",error:e}),h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:ge.current}),e}else if("update"===ve.current)try{({user:t}=await u.link())}catch(e){throw n({status:"error",error:e}),h.emitPrivyEvent(ye,"update","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_UPDATE_ACCOUNT,{linkMethod:ge.current}),e}else try{({user:t,isNewUser:r}=await u.authenticate())}catch(e){throw n({status:"error",error:e}),h.emitPrivyEvent(ye,"login","onError",e.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),e}let a=t||C;E(a||null),k(r||!1),x(!0),n({status:"done"});let o=null;return u.authFlow instanceof ki?o=a?.linkedAccounts.find((({type:e})=>"email"===e))||null:u.authFlow instanceof ma&&(o=a?.linkedAccounts.find((({type:e})=>"phone"===e))||null),{user:a,isNewUser:r||!1,wasAlreadyAuthenticated:!!i,linkedAccount:o}},generateSiweMessage:async({address:e,chainId:t,captchaToken:r})=>{ve.current="link",ge.current="siwe",q({status:"generating-message"});let n=await u.generateSiweNonce({address:e,captchaToken:r});return q({status:"awaiting-signature"}),ha({address:e,chainId:t.replace("eip155:",""),nonce:n})},generateSiweMessageForSmartWallet:async({address:e,chainId:t})=>{let r=await u.generateSiweNonce({address:e});return ha({address:e,chainId:t.replace("eip155:",""),nonce:r})},linkSmartWallet:async({message:e,signature:t,smartWalletType:r})=>{let n;try{n=await u.linkSmartWallet({message:e,signature:t,smartWalletType:r}),n=await Ge.refreshUser()??n}catch(e){throw e}E(n||C||null)},linkWithSiwe:async({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i})=>{let a,o=null;try{q({status:"submitting-signature"}),a=await u.linkWithSiwe({message:e,signature:t,chainId:r,walletClientType:n,connectorType:i}),a=await Ge.refreshUser()??a,q({status:"done"}),(o=Ue(a)||null)&&h.emitPrivyEvent(ye,"linkAccount","onSuccess",a,"siwe",o)}catch(e){throw h.emitPrivyEvent(ye,"linkAccount","onError",e.privyErrorCode||s.PrivyErrorCode.FAILED_TO_LINK_ACCOUNT,{linkMethod:"siwe"}),ve.current=null,ge.current=null,q({status:"error",error:e}),e}let l=a||C;return E(l||null),ve.current=null,ge.current=null,{user:l,linkedAccount:o}},refreshUser:async()=>{let e=await u.getAuthenticatedUser();return x(!!e),E(e),e},walletProxy:K,createAnalyticsEvent:({eventName:e,payload:t,timestamp:r})=>u.createAnalyticsEvent({eventName:e,payload:t,timestamp:r}),acceptTerms:async()=>{let e=await u.acceptTerms();return E(e),e},getUsdTokenPrice:e=>u.getUsdTokenPrice(e),getUsdPriceForSol:()=>u.getUsdPriceForSol(),recoverEmbeddedEthereumWallet:async e=>new Promise((async(t,r)=>{let n=h.getPrivyEthereumWallet(e?.user??C)||h.getImportedPrivyEthereumWallet(e?.user??C),i=await jg();if(i&&K&&n){Q(!0);try{await K.connect({accessToken:i,address:n.address}),t(!0)}catch(e){Jl(e)&&"privy"===n.recoveryMethod?(u.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:n.address}}),(await K.recover({address:n.address,accessToken:i,recoveryMethod:n.recoveryMethod})).address||r(Error("Unable to recover wallet")),u.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n.address}}),t(!0)):Jl(e)&&"privy"!==n.recoveryMethod?(te({recoverWallet:{privyWallet:n,onFailure:r,onSuccess:()=>t(!0)},recoveryOAuthStatus:{provider:n.recoveryMethod,action:"recover"}}),Ce(od(n.recoveryMethod))):r(e)}}else r(Error("Must have valid access token and Privy wallet to recover wallet"))})),embeddedSolanaWallet:$,createEmbeddedSolanaWallet:async()=>{Q(!0);let e=await jg(),t=await Ge.refreshUser(),r=h.getPrivySolanaWallet(t),n=h.getPrivyEthereumWallet(t);if(!t||!e)throw new s.PrivyClientError("User must be logged in to create a Solana wallet");if(r)throw new s.PrivyClientError("User already has an embedded Solana wallet.");if(n){if("privy"!==n.recoveryMethod)throw new s.PrivyClientError("Cannot create an embedded Solana wallet for a user with an existing Ethereum wallet with user-controlled recovery.");await Ge.recoverEmbeddedEthereumWallet({user:t})}let i=await Ge.initializeWalletProxy(15e3);if(!i)throw new s.PrivyClientError("Unable to initialize wallet proxy");u.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_started"});try{await i.createSolana({accessToken:e,ethereumAddress:n?.address});let t=await Ge.refreshUser(),r=h.getPrivySolanaWallet(t);if(!r)throw new s.PrivyClientError("Could not get Solana wallet for user");return u.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_completed",payload:{walletAddress:r.address}}),r}catch(e){throw u.createAnalyticsEvent({eventName:"embedded_solana_wallet_creation_failed"}),new s.PrivyClientError("Failed to create Solana embedded wallet with error ",e)}},exportSolanaWallet:e=>new Promise((async(t,r)=>{if(!w||!C)return void r(Error("User must be authenticated before exporting their Privy wallet"));let n=e?.address,i=C.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"solana"===e.chainType)),a=n?i.find((e=>e.address.toLowerCase()===n.toLowerCase())):i.find((e=>!e.imported))||i[0];a?(Q(!0),await jg()&&K?K?(await Ge.recoverEmbeddedSolanaWallet(),te({keyExport:{appId:l.appId,appClientId:l.clientId,origin:u.apiUrl,wallet:a,onSuccess:t,onFailure:r}}),Ce(v.ModalScreen.EMBEDDED_WALLET_KEY_EXPORT_SCREEN)):r(Error("Must have a Privy wallet before exporting")):r(Error("Must have valid access token to enroll in MFA"))):r(Error("Must have a Privy wallet before exporting"))})),recoverEmbeddedSolanaWallet:async()=>new Promise((async(e,t)=>{let r=h.getPrivySolanaWallet(C),n=await jg();if(n&&K&&r){Q(!0);try{await K.connectSolana({accessToken:n,publicKey:r.address}),e(!0)}catch(i){Jl(i)&&"privy"===r.recoveryMethod?(u.createAnalyticsEvent({eventName:"embedded_solana_wallet_pinless_recovery_started",payload:{walletAddress:r.address}}),(await K.recoverSolana({publicKey:r.address,accessToken:n})).publicKey||t(Error("Unable to recover wallet")),u.createAnalyticsEvent({eventName:"embedded_solana_wallet_recovery_completed",payload:{walletAddress:r.address}}),e(!0)):t(i)}}else t(Error("Must have valid access token and Privy wallet to recover wallet"))})),getMoonpaySignedUrl:async(e,t)=>{let{signedUrl:r,externalTransactionId:n}=await async function(e,t,r,n,i=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},o=r.uiConfig||{accentColor:n.accent,theme:n.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:i,config:{...r,...a,...o}})}(u,e,t??{},Z.appearance.palette,Z.fundingMethodConfig?.moonpay.useSandbox??!1);return{signedUrl:r,externalTransactionId:n}},initCoinbaseOnRamp:u.initCoinbaseOnRamp.bind(u),getCoinbaseOnRampStatus:u.getCoinbaseOnRampStatus.bind(u),setReadyToTrue:e=>{g(!0),re?.(e)},updateWallets:()=>Me(),fundWallet:async(e,t)=>{if(!Z.fundingConfig||0===Z.fundingConfig.methods.length)throw Error("Wallet funding is not enabled");let r=_m({fundingMethods:Z.fundingConfig.methods});te({funding:Am({address:e,appConfig:Z,fundWalletConfig:t,methodScreen:r})}),Ce(r)},fundSolanaWallet:async(e,t)=>{if(!Z.fundingConfig||0===Z.fundingConfig.methods.length)throw Error("Wallet funding is not enabled");let r=_m({fundingMethods:Z.fundingConfig.methods});te({funding:jm({address:e,appConfig:Z,fundWalletConfig:t,methodScreen:r})}),Ce(r)},requestFarcasterSignerStatus:async e=>{let t=await jg(),r=C?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType));if(!t)throw Error("Must have valid access token to connect with Farcaster");if(!K||!r)throw Error("Must have an embedded wallet to use Farcaster signers");if(!C?.farcaster?.fid)throw Error("Must have Farcaster account to use Farcaster signers");let n=await u.requestFarcasterSignerStatus(e);return"approved"===n.status&&E(await u.getAuthenticatedUser()||C||null),n},connectCoinbaseSmartWallet:async()=>{Z.externalWallets.coinbaseWallet.connectionOptions="smartWalletOnly";let e=u.connectors?.findWalletConnector("coinbase_wallet","coinbase_smart_wallet")||u.connectors?.findWalletConnector("coinbase_wallet","coinbase_wallet");if(e)return e.updateConnectionPreference("smartWalletOnly"),je(e);await Ae("coinbase_wallet","coinbase_smart_wallet")},initiateAccountTransfer:async({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o})=>{try{let s=await u.sendAccountTransferRequest({nonce:e,account:t,accountType:r,externalWalletMetadata:n,telegramAuthResult:i,farcasterEmbeddedAddress:a,oAuthUserInfo:o});return E(s),s}catch(e){throw e}}};bg=Ge.recoverEmbeddedEthereumWallet,Sg=Ge.recoverEmbeddedSolanaWallet,Ag=Ge.solanaSignMessage;let qe=a.useMemo((()=>({wallets:b,ready:oe&&me})),[b,oe,me]),ze=u.authFlow instanceof Ca,Ve=!Z.headless&&Z.captchaEnabled&&!w&&(m||ze);return e.jsx(s.PrivyContext.Provider,{value:He,children:e.jsx(h.PrivyEventsContext.Provider,{value:ye,children:e.jsx(d.UseWalletsContext.Provider,{value:qe,children:e.jsx(wa,{...Z,children:e.jsxs(s.InternalPrivyContext.Provider,{value:Ge,children:[e.jsx(c.RecentlyUsedAccountProvider,{children:e.jsxs(v.ModalProvider,{data:ee,setModalData:te,setInitialScreen:I,initialScreen:N,authenticated:w,open:p,children:[l.children,Ve&&e.jsx(mo,{delayedExecution:!1}),e.jsx(Hf,{theme:{...Z.appearance.palette||{}}}),!Z.render.standalone&&e.jsx(tg,{open:p})]})}),J&&X?e.jsx(yg,{appId:l.appId,appClientId:l.clientId,clientAnalyticsId:u.clientAnalyticsId,origin:u.apiUrl,mfaMethods:C?.mfaMethods,mfaPromise:he,mfaSubmitPromise:pe,onLoad:Y,onLoadFailed:()=>null}):null,Z.loginConfig.telegramAuthConfiguration&&e.jsx(es,{$if:!0,children:e.jsx(ig,{scriptHost:l.apiUrl||d.DEFAULT_PRIVY_API_URL,botUsername:Z.loginConfig.telegramAuthConfiguration.botName})})]})})})})})};let Mg=async(e,t,r,n,i)=>{if(!e)throw n("linkAccount","onError",s.PrivyErrorCode.MUST_BE_AUTHENTICATED,{linkMethod:i}),new s.PrivyClientError("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new s.PrivyClientError(`OAuth account of type ${i} not linked to the account.`);await r(i)};const Og=Rg;function Rg(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=s.usePrivy();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}exports.usePrivy=s.usePrivy,exports.SUPPORTED_CHAINS=d.DEFAULT_SUPPORTED_CHAINS,exports.VERSION=d.VERSION,exports.addPrivyRpcToChain=d.addPrivyRpcToChain,exports.addRpcUrlOverrideToChain=d.addRpcUrlOverrideToChain,exports.useWallets=d.useWallets,exports.useConnectWallet=c.useConnectWallet,exports.useFundWallet=c.useFundWallet,exports.useLogin=c.useLogin,exports.useLogout=c.useLogout,exports.WalletConnector=f.WalletConnector,exports.useSolanaWallets=f.useSolanaWallets,exports.getEmbeddedConnectedWallet=v.getEmbeddedConnectedWallet,exports.useAbstractSmartWallets=v.useAbstractSmartWallets,exports.AsExternalProvider=Na,exports.Captcha=mo,exports.ConnectorManager=ro,exports.EthereumWalletConnector=Ra,exports.LoginModal=tg,exports.PrivyClient=po,exports.PrivyProvider=({config:t,...r})=>{var n;if("undefined"!=typeof window&&0>["localhost","127.0.0.1"].indexOf(window.location.hostname)&&"https:"!==window.location.protocol)throw new s.PrivyClientError("Embedded wallet is only available over HTTPS");if("string"!=typeof(n=r.appId)||25!==n.length)throw new s.PrivyClientError("Cannot initialize the Privy provider with an invalid Privy app ID");wg||(wg=new po({appId:r.appId,appClientId:r.clientId,apiUrl:r.apiUrl}));let i=Object.assign({},t);return void 0!==r.createPrivyWalletOnLogin&&void 0===i.embeddedWallets?.createOnLogin&&(i.embeddedWallets||(i.embeddedWallets={}),i.embeddedWallets.createOnLogin=r.createPrivyWalletOnLogin?"users-without-wallets":"off"),void 0!==r.createPrivyWalletOnLogin&&t?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),e.jsx(d.PrivyAppConfigProvider,{client:wg,clientConfig:i,legacyCreateEmbeddedWalletFlag:r.createPrivyWalletOnLogin,children:e.jsx(Ig,{...r,client:wg})})},exports.PrivyProxyProvider=Pa,exports.errorIndicatesMaxMfaRetries=td,exports.errorIndicatesMfaTimeout=Ql,exports.errorIndicatesMfaVerificationFailed=ed,exports.getAccessToken=jg,exports.useConnectCoinbaseSmartWallet=()=>{let{connectCoinbaseSmartWallet:e}=s.usePrivyInternal();return{connectCoinbaseSmartWallet:e}},exports.useCreateWallet=function(e){let{createWallet:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("createWallet",e),{createWallet:t}},exports.useCrossAppAccounts=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:n,sendTransactionWithCrossAppWallet:i}=s.usePrivy();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:n,sendTransaction:i}},exports.useCustomAuth=e=>{let{customAuthStatus:t}=s.usePrivyInternal();return h.usePrivyEventSubscription("customAuth",e),{status:t}},exports.useExperimentalFarcasterSigner=Og,exports.useFarcasterSigner=Rg,exports.useGuestAccounts=function(){let{createGuestAccount:e}=a.useContext(s.PrivyContext);return{createGuestAccount:e}},exports.useLinkAccount=function(e){let{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:i,linkApple:o,linkTwitter:l,linkDiscord:d,linkGithub:c,linkLinkedIn:u,linkTiktok:p,linkSpotify:y,linkInstagram:m,linkTelegram:f,linkFarcaster:g}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:n,linkGoogle:i,linkApple:o,linkTwitter:l,linkDiscord:d,linkGithub:c,linkLinkedIn:u,linkTiktok:p,linkSpotify:y,linkInstagram:m,linkFarcaster:g,linkTelegram:f}},exports.useLinkWithSiwe=e=>{let t=xa(),{generateSiweMessage:r}=s.usePrivy(),{siweState:n,setSiweState:i,linkWithSiwe:o}=s.usePrivyInternal();return{generateSiweMessage:a.useCallback((async({address:t,chainId:n})=>{try{if(!t||!n)throw Error("wallet address and chainId required to generate nonce");return await r({address:t,chainId:n}).then((e=>e))}catch(t){throw i({status:"error",error:t}),e?.onError?.(t.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[r]),linkWithSiwe:a.useCallback((async({signature:r,message:n,chainId:a,walletClientType:l,connectorType:d})=>{try{if(t.enabled&&"success"!==t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);let{user:i,linkedAccount:c}=await o({message:n,signature:r,chainId:a,walletClientType:l,connectorType:d});c&&e?.onSuccess?.(i,"siwe",c)}catch(r){throw i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[o,t.status]),state:n}},exports.useLoginWithEmail=e=>{let t=xa(),{emailOtpState:r,setEmailOtpState:n,initLoginWithEmail:i,loginWithCode:o}=s.usePrivyInternal();return{sendCode:a.useCallback((async({email:r})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i(r,e)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:a.useCallback((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);let{user:n,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await o(r);e?.onComplete?.(n,i,a,"email",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[o,t.status]),state:r}},exports.useLoginWithOAuth=e=>{h.usePrivyEventSubscription("login",e);let t=xa(),r=d.useIsServerConfigLoaded(),{initLoginWithHeadlessOAuth:n,loginWithHeadlessOAuth:i,isHeadlessOAuthLoading:o,ready:l,user:c}=s.usePrivy(),{oAuthState:u,setOAuthState:p}=s.usePrivyInternal(),y=a.useCallback((async e=>{try{if(t.enabled&&"success"!==t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);return await n(e.provider,t.token)}catch(e){throw p({status:"error",error:e}),e}}),[n,t]),m=a.useCallback((async()=>{let e=da();try{if(c)return console.warn("Cannot login with OAuth when already logged in"),c;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw p({status:"error",error:e}),e}try{return await i(e)}catch(e){throw p({status:"error",error:e}),e}finally{ca()}}),[i]);return a.useEffect((()=>{let e=da();l&&r&&e.inProgress&&e.headless&&!e.popupFlow&&m()}),[l,r]),{initOAuth:y,loginWithOAuth:m,loading:o,state:u}},exports.useLoginWithPasskey=e=>{let t=xa(),{initLoginWithPasskey:r,loginWithPasskey:n,passkeyAuthState:i,setPasskeyAuthState:o}=s.usePrivyInternal();return{loginWithPasskey:a.useCallback((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r(i);let{user:a,isNewUser:o,wasAlreadyAuthenticated:l,loginAccount:d}=await n();e?.onComplete?.(a,o,l,"passkey",d)}catch(t){throw o({status:"error",error:t}),e?.onError?.(t),t}}),[n,t.status]),state:i}},exports.useLoginWithSms=e=>{let t=xa(),{smsOtpState:r,setSmsOtpState:n,initLoginWithSms:i,loginWithCode:o}=s.usePrivyInternal();return{sendCode:a.useCallback((async({phoneNumber:r})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i(r,e)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:a.useCallback((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new va(t.error,null,s.PrivyErrorCode.CAPTCHA_FAILURE);let{user:n,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await o(r);e?.onComplete?.(n,i,a,"sms",l)}catch(r){throw n({status:"error",error:r}),e?.onError?.(r.privyErrorCode||s.PrivyErrorCode.UNKNOWN_AUTH_ERROR),r}}),[o,t.status]),state:r}},exports.useMfa=Vp,exports.useMfaEnrollment=Kp,exports.useModalStatus=()=>{let{isModalOpen:e}=a.useContext(s.PrivyContext);return{isOpen:e}},exports.useOAuthTokens=function(e){let{authenticated:t,user:r}=s.usePrivy(),{initLoginWithOAuth:n}=s.usePrivyInternal(),i=h.useEmitPrivyEvent();return h.usePrivyEventSubscription("oAuthAuthorization",e),{reauthorize:e=>Mg(t,r,n,i,e.provider)}},exports.useRegisterMfaListener=fo,exports.useSendSolanaTransaction=function(e){let{sendSolanaTransaction:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("sendSolanaTransaction",e),{sendSolanaTransaction:t}},exports.useSendTransaction=function(e){let{sendTransaction:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("sendTransaction",e),{sendTransaction:t}},exports.useSetWalletPassword=function(e){let{setWalletPassword:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("setWalletPassword",e),{setWalletPassword:t}},exports.useSetWalletRecovery=function(e){let{setWalletRecovery:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("setWalletRecovery",e),{setWalletRecovery:t}},exports.useSignMessage=function(e){let{signMessage:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("signMessage",e),{signMessage:t}},exports.useSignTypedData=function(e){let{signTypedData:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("signTypedData",e),{signTypedData:t}},exports.useToken=function(e){let{getAccessToken:t}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("accessToken",e),{getAccessToken:t}},exports.useUpdateAccount=function(e){let{updateEmail:t,updatePhone:r}=a.useContext(s.PrivyContext);return h.usePrivyEventSubscription("update",e),{updateEmail:t,updatePhone:r}};