@privy-io/react-auth 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/cjs/{SignRequestScreen-DtYBo-f4.js → SignRequestScreen-BbqNYmhD.js} +22 -22
  2. package/dist/cjs/abstract-smart-wallets.js +1 -1
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/{smart-wallets-DBtImXy4.js → smart-wallets-7Aqc5Nzs.js} +1 -1
  5. package/dist/cjs/smart-wallets.js +1 -1
  6. package/dist/cjs/solana.js +1 -1
  7. package/dist/cjs/ui.js +1 -1
  8. package/dist/cjs/{use-export-wallet-BJs7agWD.js → use-export-wallet-sK7TOD-_.js} +1 -1
  9. package/dist/cjs/{useActiveWallet-DxScd1-6.js → useActiveWallet-BtCoqsEN.js} +1 -1
  10. package/dist/cjs/{usePrivy-CglT1xI0.js → usePrivy-B_0-uaxv.js} +1 -1
  11. package/dist/dts/extended-chains.d.mts +1 -1
  12. package/dist/dts/extended-chains.d.ts +1 -1
  13. package/dist/dts/farcaster.d.mts +1 -1
  14. package/dist/dts/farcaster.d.ts +1 -1
  15. package/dist/dts/index.d.mts +2 -2
  16. package/dist/dts/index.d.ts +2 -2
  17. package/dist/dts/smart-wallets.d.mts +1 -1
  18. package/dist/dts/smart-wallets.d.ts +1 -1
  19. package/dist/dts/solana.d.mts +2 -2
  20. package/dist/dts/solana.d.ts +2 -2
  21. package/dist/dts/{types-Bxzk5tAd.d.mts → types-DbYYrJGX.d.mts} +1 -1
  22. package/dist/dts/{types-Bxzk5tAd.d.ts → types-DbYYrJGX.d.ts} +1 -1
  23. package/dist/dts/ui.d.mts +1 -1
  24. package/dist/dts/ui.d.ts +1 -1
  25. package/dist/esm/{SignRequestScreen-CRgklFXi.mjs → SignRequestScreen-BFYRKL3N.mjs} +2 -2
  26. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  27. package/dist/esm/index.mjs +2 -2
  28. package/dist/esm/{smart-wallets-4dHtOnWr.mjs → smart-wallets-kAXh6Vvw.mjs} +1 -1
  29. package/dist/esm/smart-wallets.mjs +1 -1
  30. package/dist/esm/solana.mjs +1 -1
  31. package/dist/esm/ui.mjs +1 -1
  32. package/dist/esm/{use-export-wallet-CyVLDmfF.mjs → use-export-wallet-BxcU5zVQ.mjs} +1 -1
  33. package/dist/esm/{useActiveWallet-DCVe9hvI.mjs → useActiveWallet-LdKZteNM.mjs} +1 -1
  34. package/dist/esm/{usePrivy-BagnGRiw.mjs → usePrivy-DPEbjcra.mjs} +1 -1
  35. package/package.json +4 -4
@@ -1,27 +1,27 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("lucide-react"),n=require("react"),r=require("./internal-context-DNWjSiYq.js"),i=require("./privy-context-CJzQZH6s.js"),a=require("styled-components"),o=require("@privy-io/urls"),s=require("@scure/base"),l=require("viem"),c=require("@privy-io/js-sdk-core"),d=require("./paths-B00ZrFQm.js"),u=require("tinycolor2"),p=require("@heroicons/react/24/outline/UserCircleIcon"),h=require("@heroicons/react/24/outline/ArrowLeftIcon");require("@heroicons/react/24/outline/ArrowRightIcon");var g=require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),m=require("@heroicons/react/24/outline/XMarkIcon"),y=require("@heroicons/react/20/solid/CheckIcon"),f=require("@heroicons/react/24/outline/EnvelopeIcon"),x=require("@heroicons/react/24/outline/PhoneIcon"),v=require("react-device-detect"),w=require("@heroicons/react/24/outline/ExclamationTriangleIcon"),C=require("@heroicons/react/24/outline/WalletIcon"),b=require("@heroicons/react/24/outline/ExclamationCircleIcon"),j=require("@heroicons/react/24/outline/Square2StackIcon"),k=require("fast-password-entropy"),T=require("secure-password-utilities"),A=require("secure-password-utilities/wordlists"),S=require("@heroicons/react/24/outline/LockClosedIcon"),E=require("@heroicons/react/24/outline/PencilSquareIcon"),I=require("jose"),P=require("@heroicons/react/24/outline/ArrowPathIcon"),N=require("@heroicons/react/24/outline/EyeIcon"),_=require("@heroicons/react/24/outline/EyeSlashIcon"),M=require("@heroicons/react/24/outline/KeyIcon"),F=require("@heroicons/react/24/solid/CheckCircleIcon"),L=require("@heroicons/react/24/outline/ArrowDownTrayIcon"),W=require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),D=require("@heroicons/react/24/outline/DocumentDuplicateIcon"),R=require("@heroicons/react/24/solid/XCircleIcon"),O=require("@heroicons/react/24/outline/ShieldCheckIcon"),B=require("@heroicons/react/24/outline"),U=require("@tanstack/react-virtual"),z=require("@heroicons/react/24/outline/CheckIcon"),H=require("qrcode"),V=require("viem/utils"),$=require("eventemitter3"),q=require("zustand"),G=require("@walletconnect/ethereum-provider"),Y=require("@heroicons/react/24/outline/CreditCardIcon"),Z=require("@heroicons/react/24/outline/QrCodeIcon"),K=require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),Q=require("@heroicons/react/24/outline/InformationCircleIcon"),X=require("@heroicons/react/24/outline/ClipboardDocumentIcon"),J=require("@heroicons/react/24/outline/ChevronDownIcon"),ee=require("@privy-io/ethereum"),te=require("@heroicons/react/24/outline/CheckCircleIcon"),ne=require("@heroicons/react/24/outline/GlobeAltIcon"),re=require("@headlessui/react"),ie=require("ofetch"),ae=require("@heroicons/react/24/outline/FingerPrintIcon");function oe(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function se(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var le=/*#__PURE__*/oe(n),ce=/*#__PURE__*/oe(u),de=/*#__PURE__*/oe(p),ue=/*#__PURE__*/oe(h),pe=/*#__PURE__*/oe(g),he=/*#__PURE__*/oe(m),ge=/*#__PURE__*/oe(y),me=/*#__PURE__*/oe(f),ye=/*#__PURE__*/oe(x),fe=/*#__PURE__*/se(v),xe=/*#__PURE__*/oe(w),ve=/*#__PURE__*/oe(C),we=/*#__PURE__*/oe(b),Ce=/*#__PURE__*/oe(j),be=/*#__PURE__*/oe(k),je=/*#__PURE__*/se(T),ke=/*#__PURE__*/oe(S),Te=/*#__PURE__*/oe(E),Ae=/*#__PURE__*/oe(P),Se=/*#__PURE__*/oe(N),Ee=/*#__PURE__*/oe(_),Ie=/*#__PURE__*/oe(M),Pe=/*#__PURE__*/oe(F),Ne=/*#__PURE__*/oe(L),_e=/*#__PURE__*/oe(W),Me=/*#__PURE__*/oe(D),Fe=/*#__PURE__*/oe(R),Le=/*#__PURE__*/oe(O),We=/*#__PURE__*/oe(z),De=/*#__PURE__*/oe(H),Re=/*#__PURE__*/oe($),Oe=/*#__PURE__*/oe(Y),Be=/*#__PURE__*/oe(Z),Ue=/*#__PURE__*/oe(K),ze=/*#__PURE__*/oe(Q),He=/*#__PURE__*/oe(X),Ve=/*#__PURE__*/oe(J),$e=/*#__PURE__*/oe(te),qe=/*#__PURE__*/oe(ne),Ge=/*#__PURE__*/oe(ae);class Ye{get(e){let t=localStorage.getItem(e);return null===t?void 0:JSON.parse(t)}put(e,t){void 0!==t?localStorage.setItem(e,JSON.stringify(t)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map((([e])=>e))}}var Ze="undefined"!=typeof window&&window.localStorage?new Ye:new class{get(e){return this._cache[e]}put(e,t){void 0!==t?this._cache[e]=t:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};function Ke(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Qe(e,t){let n=Ke(t);if(n.universalLink)return tt(n.universalLink,e)}let Xe="WALLETCONNECT_DEEPLINK_CHOICE";function Je(e){return e.startsWith("http://")||e.startsWith("https://")}function et(e,t){if(Je(e))return tt(e,t);let n=e;return n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function tt(e,t){if(!Je(e))return et(e,t);let n=e;return n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function nt(e,t){window.open(e,t,"noreferrer noopener")}class rt{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}const it=1400,at=4e3,ot="privy:state_code",st="privy:code_verifier",lt=e=>`privy:wallet:${e}`,ct="privy:connections",dt=12e4;function ut(e){return crypto.getRandomValues(new Uint8Array(e))}function pt(){return I.base64url.encode(ut(36))}function ht(){return pt()}async function gt(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 I.base64url.encode(t)}}function mt(e){return e.charAt(0).toUpperCase()+e.slice(1)}const yt=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#040507"}),/*#__PURE__*/e.jsx("path",{d:"M17.2949 6.37537C18.0156 5.44684 19.4671 4.57877 20.4927 4.46512C20.8178 4.42885 20.8581 4.43127 20.9312 4.50139L20.9967 4.56426L20.9816 4.99225C20.9564 5.65963 20.8682 6.12873 20.6716 6.6341C20.4751 7.13705 20.1198 7.71738 19.8426 7.97852C19.7594 8.06074 19.6007 8.22516 19.4948 8.34848C19.0563 8.84901 18.439 9.20205 17.5973 9.4366C17.2823 9.52606 17.2596 9.52848 16.8917 9.52606C16.4482 9.52365 16.3852 9.51156 16.3524 9.43176C16.3398 9.39791 16.3272 9.18996 16.3222 8.9675L16.3171 8.56127L16.423 8.17922C16.6347 7.41512 16.8791 6.90733 17.2949 6.37537Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M17.4512 10.2081C18.4163 9.84541 19.7595 9.48754 20.2584 9.46336C20.6616 9.4416 21.2966 9.49238 21.7225 9.57943C22.1383 9.66164 22.4357 9.76078 22.8666 9.96148C23.5571 10.2831 24.1442 10.7135 24.6104 11.2382C24.9582 11.6299 24.9783 11.6807 24.8397 11.8113C24.7944 11.8548 24.6885 11.9249 24.6054 11.9709C24.4542 12.0507 23.8368 12.5464 23.8368 12.5875C23.8368 12.5971 23.736 12.7108 23.6125 12.8341C23.2068 13.25 23.0279 13.5861 22.7683 14.4252C22.7078 14.6186 22.6448 14.8725 22.6272 14.9934C22.5566 15.4577 22.5919 16.125 22.7154 16.7344C22.7885 17.1044 23.0808 17.7306 23.3706 18.1489C23.7763 18.7317 24.3786 19.2491 24.9909 19.5514C25.316 19.7086 25.5 19.8464 25.5 19.9334C25.5 19.96 25.4773 20.0205 25.4521 20.064C25.4244 20.1075 25.3866 20.2164 25.3639 20.3034C25.311 20.521 25.001 21.244 24.807 21.5971C24.0862 22.9052 23.3731 23.8748 22.6095 24.5833C21.8611 25.2725 21.1606 25.582 20.4348 25.5385C19.9359 25.5094 19.4596 25.3934 18.7842 25.1322C18.2248 24.917 18.0081 24.8493 17.7939 24.8203C17.688 24.8058 17.4915 24.7768 17.3604 24.7574C16.9774 24.697 16.7254 24.6921 16.4533 24.7478C15.5461 24.9267 15.5133 24.9364 15.0144 25.1371C14.2231 25.4562 13.8073 25.5578 13.2907 25.5578C12.8875 25.5602 12.696 25.5143 12.2575 25.3087C11.8694 25.125 11.5948 24.9315 11.2546 24.5978C10.9295 24.2811 10.7052 24.0151 10.2642 23.4323C9.18818 22.0081 9.02187 21.7276 8.49519 20.4582C8.28612 19.9546 8.19971 19.7502 8.13026 19.5402C8.07498 19.373 8.03043 19.2023 7.94332 18.8744C7.73164 18.074 7.70896 17.9869 7.70896 17.8709C7.70896 17.8153 7.68628 17.675 7.66108 17.5565C7.44184 16.5917 7.44688 15.0007 7.67116 14.1713C7.82236 13.6127 8.02648 13.088 8.30367 12.5512C8.92863 11.3325 9.71738 10.5539 10.874 10.0123C11.2571 9.8309 11.5444 9.74627 12.0534 9.65922C12.2903 9.62054 12.5523 9.56976 12.6355 9.54799C12.8421 9.49238 13.3184 9.49963 13.6057 9.56008C14.2911 9.71 14.7548 9.84058 15.2059 10.0123C16.0551 10.3411 16.549 10.4789 16.7506 10.4475C16.7692 10.4444 16.7848 10.4418 16.8002 10.4387C16.8815 10.4225 16.9601 10.3929 17.4512 10.2081Z",fill:"white"})]}),ft=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#5462EB"}),/*#__PURE__*/e.jsx("path",{d:"M23.5433 8.87438C22.2479 8.26174 20.8587 7.81038 19.4063 7.55187C19.3799 7.54688 19.3534 7.55934 19.3398 7.58428C19.1612 7.91179 18.9633 8.33905 18.8247 8.67487C17.2625 8.43382 15.7084 8.43382 14.1782 8.67487C14.0396 8.33158 13.8345 7.91179 13.6551 7.58428C13.6414 7.56018 13.615 7.54771 13.5886 7.55187C12.1369 7.80955 10.7478 8.26092 9.45159 8.87438C9.44037 8.87937 9.43075 8.88769 9.42437 8.89849C6.78947 12.9558 6.06766 16.9134 6.42176 20.8219C6.42336 20.841 6.43378 20.8593 6.4482 20.871C8.18663 22.1868 9.87059 22.9857 11.5233 23.5152C11.5497 23.5235 11.5778 23.5135 11.5946 23.491C11.9855 22.9408 12.334 22.3606 12.6328 21.7504C12.6505 21.7147 12.6336 21.6723 12.5976 21.6581C12.0448 21.442 11.5185 21.1785 11.0122 20.8793C10.9721 20.8552 10.9689 20.7961 11.0058 20.7679C11.1123 20.6856 11.2189 20.6 11.3206 20.5135C11.339 20.4977 11.3647 20.4944 11.3863 20.5044C14.7125 22.0696 18.3136 22.0696 21.6006 20.5044C21.6222 20.4936 21.6479 20.4969 21.6671 20.5127C21.7688 20.5991 21.8754 20.6856 21.9827 20.7679C22.0196 20.7961 22.0172 20.8552 21.9771 20.8793C21.4708 21.1843 20.9445 21.442 20.3909 21.6573C20.3548 21.6715 20.3388 21.7147 20.3564 21.7504C20.6617 22.3597 21.0101 22.9399 21.3939 23.4902C21.4099 23.5135 21.4387 23.5235 21.4652 23.5152C23.1259 22.9857 24.8099 22.1868 26.5483 20.871C26.5635 20.8593 26.5731 20.8419 26.5747 20.8228C26.9985 16.3041 25.8649 12.3789 23.5697 8.89931C23.5641 8.88769 23.5545 8.87937 23.5433 8.87438ZM13.1295 18.442C12.1281 18.442 11.303 17.4944 11.303 16.3307C11.303 15.1669 12.1121 14.2193 13.1295 14.2193C14.155 14.2193 14.9721 15.1752 14.9561 16.3307C14.9561 17.4944 14.1469 18.442 13.1295 18.442ZM19.883 18.442C18.8816 18.442 18.0564 17.4944 18.0564 16.3307C18.0564 15.1669 18.8655 14.2193 19.883 14.2193C20.9084 14.2193 21.7255 15.1752 21.7095 16.3307C21.7095 17.4944 20.9084 18.442 19.883 18.442Z",fill:"#F7F7F7"})]}),xt=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.5083 5.62451C10.8896 5.62451 6.34741 10.2078 6.34741 15.878C6.34741 20.4104 9.25774 24.2471 13.2951 25.605C13.7999 25.7071 13.9848 25.3844 13.9848 25.1129C13.9848 24.8752 13.9682 24.0604 13.9682 23.2115C11.1417 23.8227 10.5531 21.9892 10.5531 21.9892C10.0988 20.8009 9.42579 20.4954 9.42579 20.4954C8.50068 19.8673 9.49318 19.8673 9.49318 19.8673C10.5194 19.9352 11.0578 20.9198 11.0578 20.9198C11.9661 22.4815 13.4297 22.0402 14.0185 21.7686C14.1025 21.1065 14.3719 20.6482 14.6579 20.3936C12.4035 20.1559 10.0317 19.2732 10.0317 15.3347C10.0317 14.2142 10.4351 13.2976 11.0745 12.5847C10.9736 12.3301 10.6202 11.2774 11.1756 9.86844C11.1756 9.86844 12.0335 9.59678 13.968 10.9209C14.7962 10.6965 15.6503 10.5823 16.5083 10.5814C17.3662 10.5814 18.2408 10.7003 19.0484 10.9209C20.9831 9.59678 21.841 9.86844 21.841 9.86844C22.3963 11.2774 22.0428 12.3301 21.9419 12.5847C22.5981 13.2976 22.9849 14.2142 22.9849 15.3347C22.9849 19.2732 20.6131 20.1388 18.3419 20.3936C18.7121 20.7161 19.0316 21.3271 19.0316 22.2948C19.0316 23.6698 19.0149 24.7733 19.0149 25.1127C19.0149 25.3844 19.2 25.7071 19.7046 25.6052C23.742 24.2469 26.6523 20.4104 26.6523 15.878C26.669 10.2078 22.1102 5.62451 16.5083 5.62451Z",fill:"white"})]}),vt=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#F1F2F9"}),/*#__PURE__*/e.jsx("path",{d:"M26.1001 16.2273C26.1001 15.5182 26.0365 14.8364 25.9183 14.1818H16.5001V18.05H21.8819C21.6501 19.3 20.9456 20.3591 19.8865 21.0682V23.5773H23.1183C25.0092 21.8364 26.1001 19.2727 26.1001 16.2273Z",fill:"#4285F4"}),/*#__PURE__*/e.jsx("path",{d:"M16.5001 26C19.2001 26 21.4637 25.1046 23.1182 23.5773L19.8864 21.0682C18.991 21.6682 17.8455 22.0227 16.5001 22.0227C13.8955 22.0227 11.691 20.2637 10.9046 17.9H7.56372V20.4909C9.20917 23.7591 12.591 26 16.5001 26Z",fill:"#34A853"}),/*#__PURE__*/e.jsx("path",{d:"M10.9047 17.8999C10.7047 17.2999 10.591 16.659 10.591 15.9999C10.591 15.3408 10.7047 14.6999 10.9047 14.0999V11.509H7.56376C6.86376 12.9025 6.49951 14.4405 6.50012 15.9999C6.50012 17.6136 6.88649 19.1408 7.56376 20.4908L10.9047 17.8999Z",fill:"#FBBC05"}),/*#__PURE__*/e.jsx("path",{d:"M16.5001 9.97726C17.9682 9.97726 19.2864 10.4818 20.3228 11.4727L23.191 8.60454C21.4591 6.99091 19.1955 6 16.5001 6C12.591 6 9.20917 8.2409 7.56372 11.5091L10.9046 14.1C11.691 11.7364 13.8955 9.97726 16.5001 9.97726Z",fill:"#EA4335"})]});function wt(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...t,children:[/*#__PURE__*/e.jsxs("defs",{children:[/*#__PURE__*/e.jsxs("linearGradient",{id:"b",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#3771c8"}),/*#__PURE__*/e.jsx("stop",{stopColor:"#3771c8",offset:".128"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),/*#__PURE__*/e.jsxs("linearGradient",{id:"a",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#fd5"}),/*#__PURE__*/e.jsx("stop",{offset:".1",stopColor:"#fd5"}),/*#__PURE__*/e.jsx("stop",{offset:".5",stopColor:"#ff543e"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#c837ab"})]}),/*#__PURE__*/e.jsx("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),/*#__PURE__*/e.jsx("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),/*#__PURE__*/e.jsx("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),/*#__PURE__*/e.jsx("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),/*#__PURE__*/e.jsx("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}function Ct(t){/*#__PURE__*/return e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#06C755"}),/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"url(#pattern0_1769_69)"}),/*#__PURE__*/e.jsxs("defs",{children:[/*#__PURE__*/e.jsx("pattern",{id:"pattern0_1769_69",patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:/*#__PURE__*/e.jsx("use",{xlinkHref:"#image0_1769_69",transform:"scale(0.003125)"})}),/*#__PURE__*/e.jsx("image",{id:"image0_1769_69",width:"320",height:"320",preserveAspectRatio:"none",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAYAAADNkKWqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABpkSURBVHgB7d1fbFTXtcfxdWZs45h7g6lClajoetJIRKIqGKmhTSvF5qEvqUqIitM+XEIikYf+QWlVaF+IACVPBamN0ps8NFL5cx+qmioOVXsf+oCJ1Pg2VMKkKlKRSMZVqlalCiaSHf9hZvesMx5jm/k/58w5Z+/vR3KM8cSAPf55rbX32ccTx/Rf3tO/uNiXWygsDnri5UTMgOd5/UZMTozXX3qU/2vAOl4++K+Y4LUR8V97U5KRyUwxM93bOzc5vWNsWhziicU07GYXeoY9I0P+mzljZJBwA6rzv0emM55MGvEuajD29SyM2xyKVgWgBt7cXO+g8YpP+BXdsASBB6AtfiD63dK4ZzJvzj36i3GxSOoDUENvZq57T0Zkf9EPPM+TfgEQGX9kNFY05s31vYtjaa8OUxuAvRPfGDZSOEroAfHRMDSenF74/C/HJIVSFYDBTG+u53ljzHcJPSBR8hqGfpv8st8m5yUlUhGAWu0VTfF58cweAZB0pzKSPZ6GIEx0AJbbXH+5flgApE3igzCRAdj9+5HBTEZ+TPABVkhsECYqAIMV3fmeo54/4xMAtklcECYmANf9/9efLxaLx1jcAKyW9zu744uPjp6SBIg9AP05X86f8/2cdhdwSt6vBnfFXQ1mJEZa9RVM4TLhBzgnV5TC+z0TTx2VGMVSAVL1AVjmyWTGZJ+MoxrseAXY84ev7aHqA7DMyKBfDV7onhh5RjqsowHY8we/3C1m3mChA8AaOb8d/XmnW+KOtMC6veXjue43qPoA1KOX1N2zbuHZThy0EHkA6ryvKMULnMMHoAkdWSWOtAXWKzoIPwAt0FXiC1pASYQiqwA1/PyPfoF5H4CWeTLdnZFdMztHJyUCkQQg4QcgNBGGYOgBSPgBCF1EIRhqABJ+ACITQQiGFoA6rNQNzoQfgMiEHIKhrAKXt7oQfgAiZaR/sSBvhLU63HYA6iZntroA6KBgi4xmj7Sp7QCc/bjn54QfgA7L6dVl0qa2AjC4tpcbFQGIgV5a2+61wy0vgujJDXrxsgBAnDLFJxc+/6uW7kvcUgByfS+AxPBXhjMmu6OV64ZbaoGLXuENwg9AIvgrw3rAsrSg6QAM5n5GBgUAEkLngeve/nrTd5NsqgUutb6F9wUAkqaFVripCrA09wOABGqhFW44AEvn9TP3A5BczbbCDbXArPoCSA2/Fe5bt/hgI0fqN1QB+nO/o4QfgFTwW+GZj3sa2iBdtwJk4QNAGnVnZUe9U2PqVoCl6g8A0uV2QX5c7zE1K0CqPwBplhGza+7Rc+PV318D1R+ANDPi1cywqhUg1R8AG9SqAqtWgFR/AGxgvMzz1d5XsQKk+gNgk77exY2V9gVWrAAL3u2qiQkAaTM721Px6pCKAeiZDKc8A7BH1lQs6u4KwJ63v7aHqz4AWMVIf+/E3uG1v31XAHqZ7H4BAMtU2hKzehHkwp7+nt7umwIAtqlwSMKqCrC7t5vZHwA76SEJc6szblUAZjzvCQEAS/mBt3/N23cYwz1+AdjLeDLYf3lPf/nt5QDsnfjGsACAzfw2eG6ua/mmbssBWDAFqj8A1jPGW8665QD0l4OHBAAsZ1ZkXWkbDNtfADikfG1wUAH2rMsOCwA4YvbjnmF9XWqBveygAIAjPDHD+rpr6Y0hI0B7+rvWy4bsehlYtyl4CX4v2ycb/N9XuXWfbOjj5Of/Gby+dXtGpguzcqvgv749G7w9tXDD//WMAG3K6X+CADRGBhu7QzBcpgE30LNJtq3PBQGngVYOu3Lgdcq7s/kgFKfmbwSBWX679JqARG3Gk+362mMBBJUM+OH22L1bZbuGnR9625dCLw3KQXjFf3nroz/L1NyN4NfASroQ4ukG6KIULgicpZWdht1j935GtvflZJv/0t/VJzYph+JFPxDf+ugqlSKkO9u9o6toFvvFq3t7YFhEA09DbvcnHpEhP/j017bTQC+F/Nbl3ysF4lU5/+GloFKEWxYKi4NdpRVglkBspy3t7o2f80Nvp5UVXiu2LVW7B+9/PHhbK8OzN8aDUJxaWoiBvTzxcroIkhNYSVtarfD2bRpOzfwuTisrRK0O3/Qrw1/7L8wPLeWZAW/dxMgFv/4bFlhBK72nNw0ReiHSleZX/v4bOX/zj1SGFvGMvEkAWkBnevvuGwra25UzLoSv3Caf8V+QckYmvZ6Jp97nJkjppC2uLmTsu2+YmV6HaVWoCycvfnCOqjC98gRgCmmlp4N7qr1koCpMLQ3AEZaAU0DbXA2979z/Faq9hNKq8KUPRgnCFCEAE47gSx8WTdKDAEwogi/9NAhLrfFFgjChCMCEIfjsQ2ucXARggujevZMDzxB8liIIk4cATADdzvLC5hFWdR1xZSYvI9dO0hYnAAEYI213Twzsl6f9yg/u0fkg+wjjRQDGROd8RzY/RbvrONrieBGAHabX6r7+0Ldod7EK1WA8CMAOoupDLXpA6+Gp01SDHUQAdgBVH5pBNdg5BGDE9LCCn33621R9aIrOBg9cf5WTqiPGWfgROpl7Rka3HCb80DQ9y/F3W48G26MQHSrACGjLe+7hQ07cawPR0yrwwPXXaIkjQAUYMt3UrD+5CT+EpfycGmjwxvJoHAEYIl3lLT1ROYoe4dLn1LUdP12+gRPCQQCGRGc1OvMDoqTPMeaC4ekStEUvZzs5sD84yADohCN+AG7I9smhqdOC9hCAbdDwY96HOBx84CtBW/zce68FG6jRGlrgFulAmvBDnPTeMPoc1B/EaA0B2ALCD0mhz8F3PvsjVohbRAA2qRx+rPQiKcqbpgnB5hGATSD8kFTlEKQdbg4B2CDCD0lHCDaPAGyAPqH00jbCD0mnM8HRLYcEjSEAG/CzT3+LBQ+khl46p8evoT4CsA7dda9HWgFpohvzuWKkPgKwBn0CHeFJhJTS5y7XDtdGAFahbQThh7TTa4e3M76pigCsoHyEPWCD0YcPs0ewCgKwAra7wCb6XH79oW8K7kYArqEtA+EH2+hIR08twmoE4Aq6csbQGLbSE2Q0CHEHAbhEZyRsG4DtdLbNlSJ3EIBLjmzeS+sL6+lz/Min9gpKCEAptb5Pc6IzHEErfIfzAUjrCxfRCpc4H4C0vnARrXCJ0wGoBxzQ+sJV2gq7fpWI0wF47uHDArjsZM7tvYHOBqAufND6wnW6GOLygoizAcjCB1Di8nXvTgYg1R9wh34vuDoLdzIAqf6A1Vw9+s25AKT6A+7mahXoXABS/QGVuVgFOhWAVH9Adfq94dqKsFMBSPUH1PbCZreuDnEmAPUnG9UfUJtr+wKdCcB9m4YEQH0u3QbWiQDUE1+45hdozL77hpw5KcaJAHzs3q0CoDEafo/9pxvfM13igCRUf1PzN2q+P+75ZL2/n0rLDHX69ozcKszWfMyGbB/n4dVw8IHH5fzNS2I76wNQ2984K8Cp+X/Kl68ebygAdR9WHGF94PqrcvbGeN3H6fFhl7b9qOZjzvgf55W//7ZuAOnXJIprUPXzvfNPPwxCsJ7RLYdrzrvenc0HX7tGPlZU9DkRx+4F/VrrD4g4/+2dYH0LHHf7q2HQSHWlj3npg1HptLc+utpQ+CkNhDM1Hqvh85wfpvo4/XWtF/0zD02dlrAdyp9u+Jv2lX/8tub7v9/Ex4qKPiemb89Kp2n4fXWj/Ysh1gdg3O3vdKHzT964TM3/q6nHv/L33/gB/GcJUzOfbw3iWv5a5/2dMl2IJ4SHHJidWx2AwTCXBZBEG7l2sm4QIR5UgCm3zfHjvtNAW8wD118TJE+pgLB7U7TVAejShs400zb4xRjmn6jP9g7K6gB0/YYvaaLD/rDngWif7XNAawOQ+V/66HacOFY8UZ3tYyRrA5D5X/roVqCRaycEyaGFhM2dlMUBOCBIH22D6+3PQ2dtW58TW1kbgEMb3L3VX9odyp9iHrhEr2TKxXwJ4naLA9DaS+H6s1znmWY6D3znsyf8FqxP0kCDKuwj17T93HffsMRtoOc+sZW1AcgMMN10Hvjce6/K6JZDkgZ6LbetJ45vX/+g2MrKFlh/cqalckB15z98h3lgAmi423pyjpUBSPVnD90fqIcrIF79WTsLCmsrQNhBL5Xb+5cT7A+Mma1FhZUB+F8WD21dpPPAQ1OnBPHZQAucHlSA9tHzA5kHxocWOEW4/aWddB7I0VnxsLUCdOKeILCDzgP1iPok7g/UhRrduxgmrbr03hy6xzBucW/GjoqVAUgLbK/g1gF/G5WTA/slSTScG721QDP0xkRp2hCeNnbOALkKJBUOPvCVln5Y6VH6ZyIImyTSwI/rSHwXOHFfYCSTHlhx5FN7pRWHp04zD0TbCEDESqvAVm5cVdofeFKAdhCAiN0Jf57XyqBfFx6iuLUm3GFlAOZpjVJF54DnHm7t0AOdB57/8JIAraACRCLopVatruzqqTHMA6Nl6/2tCUAkhs4DW7kNI7fWjJ5+jm1kZQDq1gGkk57/18o8UE+QZh4YnVsEYHoQgOml88DXH/qmtELngTYenZWEfa20wECHaBvc6jzQplZNfxiczD2TiKtAbC0qrLwU7t3ZKUG66Tzw/M0/pubmSBrav9t6VGxFC5wirAja4fWHvpWIgwAgcsXSU7mtDEBtgzhBOP30WLNW54EIz5WZvNjK2hngXxeoAm2greXB+x8XxOeWpQsgytoAnLT4p5ZrdCGglf2BCIet7a+yNgBtLttdpPNAznmMx1u30rEQ1QprA5CVYLvoPPBnn2YeGAeb99VaeyR+WjfEhv1k25Dts6Zy2v2JncE8MIk3R9I5mY1fO91RYXMLbG0A6kqw7iFL0+xIv4G2XP62hE331CXtCPlW6TzwrY+uJu6b8srM+5F87Y5sHpEX/Je42D5KsvpKkCu0wQHbLhEbffiwM/NAvRNePsYW9Nc3/yg2szoAOSfuDpv2Reo80JaKNumoAFNMqx42RNtp36Zh9gdGzPb5n7I6AHUO+O7s+wI76Xxse19OEA2dtdrO+tNg3qQNtpbOAV2aB3bamRsXxXbWB+D//sv+L6LLdB7Y6q01UZ22v2k5iacd1gdgeTsM7KXbfJgHhsuF9lc5cSAqbbD9dB7I0VnhefGDUXGBEwGobTCrweFI6rytfGvNZv5+/V3/Ibibbn1x5bYSTgSgtsFn/zUucRi6d6vETSsjnZVVsq1voOHKScOl1qqrfqxmAmgo5Kt09NaazcwDd2/8XM33//emYYmbfm1yVb52UflpAi81jIrXMzFixAFxHlmu85SLMc0hNZB2b3ykagAq/Wl/5sZ42x9Hnf/wHXnlH/9X52P1yVf9j/V0RAGjn2/9oVfrHDv9dzzWwA+ns/7nJa4rMfRzvu++4Y7eE0QXP7Zc/o64wpkAVBqAnCsHVKeXTbp0e1Gn7grnwr4moB1JPGknSk4F4K9vXmIxBKhC233X7qntVADqXOiVf/xGANzNla0vKzl3Y3Rd4aIKBFZzsfpTzgUgVSCwmn5PuFj9KecCUFEFAnfowoeL1Z9yMgD1J96hqVMCuE73/b3kaPWnnAxApTMPDkmA61764Jy4zNkAVC86/sWH2/SWEfWuALKd0wGoFaDrTwC4izGQ4wGoDk+dZkEEztFVX1cXPlZyPgB1QeSlv7k7BIZ7XF/4WMn5AFR6ATgLInDFl68eF5QQgEsOXH+VVhjWo/VdjQBcok+K5957VQBb6aovre9qBOAKpcM83ToOCG7QuR+rvncjANd4KWgR/imATfb+5SStbwUE4Bq6KqxDYuaBsIXO/d6dzQvuRgBWwDwQttBLPpn7VUcAVqHzQFePCIIdSnM/d+7v0QoCsAb9ycmiCNJIw680ypkRVEcA1nEof4pN0kgVDT0WPRpDADZg5NpJhshIDZ1f83xtDAHYgNJP1BNsj0Hi6dxaNzyjMQRgg7Sd0JkKIYik0vBjxbc5BGATCEEklS7WEX7NIwCbRAgiabTl1cU6NI8AbAEhiKTQxQ427beOAGxROQRZbUNc9LnHXr/2EIBtKIcgq27oNDY6h4MAbJM+AUeuneCyOXQM4RceAjAkugJHCCJq5fDjKo9wEIAh0hBkcQRR0Znfzj/9kPALEQEYMr1umBBE2FjwiAYBGAH9Cb3l8nc4SQaheOujq4RfRAjACOnmVL3bHNUgWnXmxrgffscIv4gQgBE7GzyBj3OkFpqmi2rPXWeTc5QIwA4o7xdklRiN4mCDzvB6JkaMoGMG1m2Scw8flm19OQEq0dEJ8+POIABjsm/TsLywea8fiJ8UQJU21Z9kXNJBBGCMtBo8snlEnvbDEG5jg3M8CMAE2L4+J6NbDlENOkr3+JVOHCf8Oo1FkAS4MpMP9g2yZcY9Z5Z2CRB+8aACTCDmg25gpTd+BGBC6XxQg/DpTUMEoWV0sUNvWK57RBEvAjDhNAgfu/czVISW0BGH3rOXg3STgQBMEVrjdGOxI3kIwBTa/YmdcvD+x/3KcKsgHXRjMzcuSh4CMMXK+wiH/CCkKkwuruxILgLQEtoe7974iF8dPiJIBuZ9yUcAWqa8aKJXl9Aix0fP8Dtw/X+Y9yUcAWgxwjAe7O9LDwLQEf1d6+WrfousQcjMMBocZpA+BKCj9DguDUKtEDUUNSDROra4pBMBiIAGoh7KoGE46L/mvMLGscUlvQhAVKQVYRCKfQMy0PtJ/7WG4gCV4gra8j733qty/sNLgnQiANGUcjDq6/I80cVqkVVeOxCAaJuuNusexIMPPO7E4gotrz0IQITK5uuVdWPzgeuvscprEQIQodOK8OTAM1ZdlaJzPp33cX9eu3AiNEKnc7GRayesqJSCs/v8dlf/PYSffQhAREYP/Uwz3du3808/4CADixGAiIze6yStBwFo6D3y7g9Y5bVclwARmvRDME3bZFjocAsBiEilqYLSqk8PMWDW5w4CEJFKQwBS9bmLAITTqPrcRgDCSVzHC0UAIlK6KTpp2NSMMgIQkUrS6TFUfViLAESkklIBMutDJQQgItWfjbcCZIUXtRCAiFScm6Cp+lAPAYjIbF//oD8D7JNOo+pDowhARGZDtrPhp5VeueoDGkEAIjJ6D5FO4Yh6tIIARGSGNnxGoqZV3+Gp03LmxrgAzfID0MuLmJwAIYt6BZhFDrQpTwWIyES1Aqzt7ot+8LHIgXZ1iTHT4gkQqihWgLXS04qPE5oRBk8rQC/j5Y0xgwKEKOwVYNpdRKHLGLklQMjCWgFmdRdRMV5pBpgXIGS53vbuC6z3Evl+/jRzPkTHeFNdRkyeESDC1moLzLYWdIyRya6erEwuFgQI1a3CbFOPL1/F8VP/hTkfOiHjFae7ZmYW8z293QKESWd3B+9/vO7jCD7Epbf39mTQ/fZMPPU+m6ERtkvbflR1LyB7+RArT6YXvjC6MdgI7Xky6a8G5wQIkd5YfN+mYRm6t3RJ3HRhJgg+DT2qPcTJ8+d/+joIwGLRTHmshCACZ/3FjLMsaCBhjHgX9XVG/+NJcVwAwBVLFWAQgAvzhXEBAEf03bMwrq+DAJRdY9PlRAQAq/lZN73DzzwpB2Dwe3JRAMBy3oqsWw7ArGfGBAAs563IuuUAnJu7PemXgdMCABabe/TcePnXywGoc0DdDygAYCnPyJsr386sfKMocloAwFJ+kbdq1LcqABfnFsdogwHYqrd3sXoA0gYDsJW2v+XtL2WZux4k5rgAgGWMeKfW/l7FK4B73h656b+nXwDAAnoDpPlHRx9c+/uZyo/2XhYAsETR8yruc64YgAtzCz8RALBE1mQqFnWVK8BgMcTjyhAA6efJqblHf5Gv9K5M1f/HFGmDAaRexmSrLuxWDUC9XMQfHI4LAKRVjepPZWr/v2yJAZBetaq/4P213kkVCCC16lR/qmYAqmJRvicAkDL1qr/gMfUesPil0UnDggiANGmg+lN1A1AtzheOcUgCgDTQqz4aqf5UQwEY7AvMsCACIPn8ADzeSPW39NjGrZsYuWBEhgUAEqjaNb/VNFYBLn/w7LO0wgCSys+oXc08vqkA1LKSVhhAIhVNw61vWVMtcBmtMIAk0YOc578wukOa1FQFuPyH0QoDSAid+3km+6S0oKUALJWZxWcFAGLWzKrvWi0FoFr44q/GhGuFAcQpmPuNnpIWtTQDXIl5IIBYeN7Ywhd+2VLrW9ZyBVg2P7f4pCdeXgCgQ3Tu17duoe0xXNsBGFwlIpldhCCATggWPSS7a+0tLlv8WOHo/v3IoL8UfYG7yQGIjJHpjJfd0eqix1rtV4BLSqfGyC62xwCIhJ8tmjFhhZ8KrQIsoxIEELql8NNCS0IUegAqQhBAaCIKPxVJACpCEEDbIgw/FdoMcC39C+uwktVhAK3Q1d4ow2/pz4hW78Q3ckaKF4yYnABAA8pbXcJc8KgksgqwTP8B83MLO8R4YwIAdeidKO/pXdwRdfgt/Vmd0zOx95j/Rx4VAKikaI4vfOncMemQjgag6p0Yecb4IUhLDGCZv9jRlS0+O/v5X3W0U+x4ACqdCxZN4Q3/Tx8UAE7TllfPGO1Ey7tWLAFYRksMOMyv+jwxx+e/eO4nEpNYA1CxSgy4J86qb83fIxmYDQIOSEDVt1JiAlAFs0G5fcz/a+0XAFbxTPHle+4pHAvjGKuwJCoAywhCwB7a7haL8r0or+hoVSIDsIwgBNKrNOfTe3acG5eESnQAlhGEQHp4njem7W6Sg68sFQFYpkFYMIvfzXjZJ1gsARJED0L2zMt9vbd/kqQZXz2pCsCVet7+2h6R7H7/k75HAHSeruh6Mpn0NreW1AZgWf/lPf1zc917isZ7gjAEIrYUekWR0+t7F8fSVO1VkvoAXKt3Yu+w8bw9pihDXGoHhMD4VV5GLnrGjPX23p5Me+itZF0ArqTV4ezH2WHxsoN+mT5kjB+InFAN1ODlS4FnpkyxON53T2HcpsBby+oArKTUMncNFo3p12D0f7wN+J+EnL7PiJcrPYoFFtho6XR2Y6aDX3vB6yl/QTEvRZlc37eYtznsKvk3kqxyUwkTXfIAAAAASUVORK5CYII="})]})]})}function bt(t){/*#__PURE__*/return e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_1715_1956)",children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#0977B6"}),/*#__PURE__*/e.jsx("path",{d:"M9.46878 6.82104C10.6699 6.82104 11.6461 7.79742 11.6461 8.999C11.6461 10.2017 10.6699 11.1782 9.46878 11.1782C8.26447 11.1782 7.28967 10.2017 7.28967 8.999C7.28967 7.79742 8.26447 6.82104 9.46878 6.82104ZM7.58908 12.8309H11.3467V24.9207H7.58908V12.8309Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M13.7032 12.8309H17.3076V14.4827H17.3576C17.8589 13.5322 19.0846 12.53 20.9127 12.53C24.7175 12.53 25.42 15.0341 25.42 18.2891V24.9207H21.6651V19.0415C21.6651 17.6388 21.6394 15.8355 19.7126 15.8355C17.7573 15.8355 17.4579 17.363 17.4579 18.9399V24.9207H13.7032L13.7032 12.8309Z",fill:"white"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1715_1956",children:/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"white"})})})]})}function jt(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...t,children:[/*#__PURE__*/e.jsx("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),/*#__PURE__*/e.jsx("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}function kt(t){/*#__PURE__*/return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","shape-rendering":"geometricPrecision","text-rendering":"geometricPrecision","image-rendering":"optimizeQuality","fill-rule":"evenodd","clip-rule":"evenodd",viewBox:"0 0 1000 1000",...t,children:/*#__PURE__*/e.jsx("path",{d:"M906.25 0H93.75C42.19 0 0 42.19 0 93.75v812.49c0 51.57 42.19 93.75 93.75 93.75l812.5.01c51.56 0 93.75-42.19 93.75-93.75V93.75C1000 42.19 957.81 0 906.25 0zM684.02 319.72c-32.42-21.13-55.81-54.96-63.11-94.38-1.57-8.51-2.45-17.28-2.45-26.25H515l-.17 414.65c-1.74 46.43-39.96 83.7-86.8 83.7-14.57 0-28.27-3.63-40.35-9.99-27.68-14.57-46.63-43.58-46.63-76.97 0-47.96 39.02-86.98 86.97-86.98 8.95 0 17.54 1.48 25.66 4.01V421.89c-8.41-1.15-16.95-1.86-25.66-1.86-105.01 0-190.43 85.43-190.43 190.45 0 64.42 32.18 121.44 81.3 155.92 30.93 21.72 68.57 34.51 109.14 34.51 105.01 0 190.43-85.43 190.43-190.43V400.21c40.58 29.12 90.3 46.28 143.95 46.28V343.03c-28.89 0-55.8-8.59-78.39-23.31z"})})}const Tt=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/e.jsx("path",{d:"M8.53901 8L14.7164 16.2153L8.5 22.8947H9.89907L15.3415 17.0468L19.7389 22.8947H24.5L17.975 14.2173L23.7612 8H22.3621L17.3499 13.3858L13.3001 8H8.53901ZM10.5964 9.02501H12.7837L22.4422 21.8695H20.255L10.5964 9.02501Z",fill:"#F7F7F7"})]});function At(){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"),Ze.del(ot),window.history.replaceState({},"",e)}const St=({address:e,chainId:t,nonce:n})=>`${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: ${n}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class Et{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 d.PrivyClientError("SiweFlow has no client instance");try{if(this.preparedMessage&&this.signature)return await this.client.authenticateWithSiweInternal({message:this.preparedMessage,signature:this.signature,chainId:this.wallet?.chainId,walletClientType:this.wallet?.walletClientType,connectorType:this.wallet?.connectorType,mode:this._meta.disableSignup?"no-signup":"login-or-sign-up"});if(!this.wallet)throw new d.PrivyClientError("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw d.formatApiError(e)}}async link(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");try{if(!this.wallet)throw new d.PrivyClientError("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw d.formatApiError(e)}}async sign(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new d.PrivyClientError("Could not prepare SIWE message");if(!this.wallet)throw new d.PrivyClientError("SiweFlow has no wallet instance");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");if(!this.wallet)throw new d.PrivyClientError("UI SiweFlow has no wallet instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");if(!this.wallet)throw new d.PrivyClientError("SiweFlow has no wallet instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=St({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,i){this._meta={disableSignup:!1},this.getNonceOnce=new rt(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=n,this.client=e,this._meta.disableSignup=r,this.preparedMessage=i?.message,this.signature=i?.signature}}const It=({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\n${`You are proving you own ${e}.`}\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class Pt{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup,messageType:this._meta.messageType,address:this.wallet?.address}}set messageType(e){this._meta.messageType=e}async authenticate(){if(!this.client)throw new d.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up",messageType:this.meta.messageType})}catch(e){throw d.formatApiError(e)}}async link(){if(!this.client)throw new d.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,messageType:this.meta.messageType})}catch(e){throw d.formatApiError(e)}}async sign(){let e,t;if(!this.client)throw new d.PrivyClientError("SiwsFlow has no client instance");await this.buildMessage();let n="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new d.PrivyClientError("Could not prepare SIWS message");if(!n&&!this.wallet.provider.signMessage||n&&!this.wallet.provider.signTransaction)throw new d.PrivyClientError("Wallet does not support the necessary signing methods");if(n&&this._plugin){let n=await this.wallet.provider.signTransaction({transaction:s.base64.decode(this.preparedMessage)});e=s.base64.encode(n.signedTransaction),t=this._plugin.getSignatureFromTransaction(n.signedTransaction,this.wallet.address)}else{e=this.preparedMessage;let n=await this.wallet.provider.signMessage({message:(new TextEncoder).encode(this.preparedMessage)});t=s.base64.encode(n.signature)}return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new d.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 d.PrivyClientError("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),"transaction"===this.meta.messageType&&this._plugin?this.preparedMessage=this._plugin.createSiwsMemoTransaction({address:e,nonce:this.nonce}):this.preparedMessage=It({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,i="plain",a){this._meta={disableSignup:!1,messageType:"plain"},this.getNonceOnce=new rt(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=n,this.client=t,this._meta.disableSignup=r,this._meta.messageType=i,this._plugin=a}}const Nt=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom||"isPhantom"in e?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,_t=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==Nt(e))return!1;if(e.providers)for(let t of e.providers)if(!_t(t))return!1;return!0},Mt=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},Ft=(e,t,n,r)=>{let i=Number(e),a=t.find((e=>e.id===i));if(!a)throw new d.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return l.createPublicClient({transport:l.http(Lt(a,n,r.appId)),chain:a})},Lt=(e,t,n)=>{let r,i=e.id,a=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])r=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[a])r=t.rpcUrls[a];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",n),r=t.toString()}else r=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!r)throw new d.PrivyConnectorError(`No RPC url found for ${i}`);return r},Wt=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Dt=(e,t=3,n=4,r="ethereum")=>{if(!e)return"";let i="ethereum"===r?2:0;return t+n+i+3>=e.length?e:`${e.slice(0,i+t)}...${e.slice(e.length-n,e.length)}`},Rt=(e,t=3,n=4)=>Dt(e,t,n,"solana"),Ot=e=>new Promise((t=>setTimeout(t,e)));const Bt=(e,t={})=>{let n=t.delayMs||150,r=t.maxAttempts||270;return new Promise((async(i,a)=>{let o=!1,s=0;for(;!o&&s<r;){if(t.abortSignal?.aborted)return;e().then((e=>{o=!0,i(e)}),((...e)=>{o=!0,a(...e)})),s+=1,await Ot(n)}o||a(Error("Exceeded max attempts before resolving function"))}))},Ut=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,"");function zt(e){return`eip155:${String(Number(e))}`}const Ht=(e,t,n,r)=>{let i=Number(e),a=t.find((e=>e.id===i));if(!a)throw new d.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return Lt(a,n,r)};const Vt=/*#__PURE__*/n.createContext({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:r.notImplemented,setError:r.notImplemented,setExecuting:r.notImplemented,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:r.notImplemented,reset:r.notImplemented,execute:r.notImplemented});class $t extends d.PrivyError{constructor(e,t,n){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=n}}const qt=()=>n.useContext(Vt);function Gt(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===d.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===d.PrivyErrorCode.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===d.PrivyErrorCode.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===d.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===d.PrivyErrorCode.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===d.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===d.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 $t&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function Yt(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function Zt(){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)}let Kt=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")};const Qt=(e,t)=>{if(t?.imported)return Kt(t);let n=i.getPrivyPrimaryWallet(e);if(!n)throw Error("Failed to find primary wallet");return Kt(n)},Xt=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),/*#__PURE__*/e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]}),Jt="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",en="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAALZJREFUaEPtmjEOhDAMBNc/O14GvOzys3CAKK6eAlmaVGl2Zc+kTOU685vkc9/bnD2prZK5/TZY24z9P+g4F5hNh7/GdoG37WlAA5CATwgCxHENYISwQAMQII5rACOEBRqAAHFcAxghLNAABIjjGsAIYYEGIEAc1wBGCAs0AAHiuAYwQligAQgQxzWAEcICDUCAOK4BjBAWaAACxHENYISwQAMQII6fBjr+VHkW3+u+tfyxMpJaDgYzYxb/ALZVAAAAAElFTkSuQmCC";class tn extends d.PrivyConnectorError{constructor(){super("Wallet timeout"),this.type="wallet_error"}}const nn=e=>e instanceof d.PrivyConnectorError?e:e?.code?new an(e):new d.PrivyConnectorError("Unknown connector error",e);class rn extends d.PrivyError{constructor(e,t,n){super(e),this.type="provider_error",this.code=t,this.data=n}}class an extends rn{constructor(e){super(e.message,e.code,e.data);let t=Object.values(c.ProviderErrors).find((t=>t.eipCode===e.code));this.details=t||c.ProviderErrors.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=c.ProviderErrors.E32002_CONNECTION_ALREADY_PENDING:this.details=c.ProviderErrors.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=c.ProviderErrors.E32002_WALLET_LOCKED))}}const on={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...c.ProviderErrors};function sn(e){return"ethereum"===e.type}function ln(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r?.address!==i?.address||r&&i&&sn(r)&&sn(i)&&r?.chainId!==i?.chainId||r?.connectorType!==i?.connectorType||r?.connectedAt!==i?.connectedAt||r?.walletClientType!==i?.walletClientType||r?.isConnected!==i?.isConnected||r?.linked!==i?.linked)return!1}return!0}class cn extends Re.default{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const dn=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||dt;class un extends cn{buildConnectedWallet(e,t,n,r){let i=async()=>!!this.wallets.find((t=>V.getAddress(t.address)===V.getAddress(e)));return{type:"ethereum",address:V.getAddress(e),chainId:t,meta:n,imported:r,switchChain:async n=>{let r,a;if(!i)throw new d.PrivyConnectorError("Wallet is not currently connected.");let o=this.wallets.find((t=>V.getAddress(t.address)===V.getAddress(e)))?.chainId;if(!o)throw new d.PrivyConnectorError("Unable to determine current chainId.");if("number"==typeof n?(r=`0x${n.toString(16)}`,a=n):(r=n,a=Number(n)),o===zt(r))return;let s=this.chains.find((e=>e.id===a));if(!s)throw new d.PrivyConnectorError(`Unsupported chainId: ${n}`);let l=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})};try{return await l()}catch(e){if(((e,t)=>{switch(t){case"coinbase_wallet":case"base_account":return e.message.includes("addEthereumChain");case"rabby_wallet":return e.message.includes("Unrecognized chain ID");default:return 4902===e.code||e.message?.includes("4902")}})(e,this.walletClientType))return"rabby_wallet"===this.walletClientType&&await Ot(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:r,chainName:s.name,nativeCurrency:s.nativeCurrency,rpcUrls:[s.rpcUrls.default?.http[0]??""],blockExplorerUrls:[s.blockExplorers?.default.url??""]}]}),l();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new d.PrivyConnectorError(`Rainbow does not support the chainId ${t}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new d.PrivyConnectorError("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await i())throw new d.PrivyConnectorError("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t,n=e;try{if(void 0===n){let e=await Bt((()=>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.debug("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let r=n[0],i=V.getAddress(r),a=[];if("privy"===this.walletClientType){let e=Ze.get(lt(i));this.chains.find((t=>t.id===Number(e)))||(Ze.del(lt(i)),e=null),t=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${t} on initialization`)}}else try{let e=await Bt((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)t=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");t=`0x${e.toString(16)}`}}catch(e){console.warn("Failed to get chainId from provider, defaulting to 0x1",e),t="0x1"}let o=zt(t);if(!a.find((e=>V.getAddress(e.address)===i))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(V.getAddress(r),o,e,"embedded_imported"===this.connectorType))}ln(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((t=>e.find((e=>V.getAddress(e)===V.getAddress(t.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),this.proxyProvider.request({method:"personal_sign",params:[V.toHex(e),this.wallets[0]?.address]})}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,n,r){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=zt(e),"privy"===this.walletClientType&&Ze.put(lt(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=async()=>{"base_account"===this.connectorType&&this.connected||(this.connected=!0,"coinbase_wallet"===this.connectorType&&await Ot(500),this.syncAccounts())},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=n,this.rpcConfig=r,this.rpcTimeoutDuration=dn(r,e),this.connected=!1,this.initialized=!1}}class pn{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 d.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 nn(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 tn,t=this.rpcTimeoutDuration)=>new Promise(((n,r)=>setTimeout((()=>{r(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||dt,this._subscriptions=[]}}const hn=({...t})=>/*#__PURE__*/e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:/*#__PURE__*/e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:t.color||"var(--privy-color-foreground-3)"})});class gn extends un{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the EthereumNullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the EthereumNullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the EthereumNullConnector for ${e}`)}constructor({id:e,name:t,icon:n,walletClientType:r,defaultChain:i}){super(r,[],i,{}),this.connectorType="null",this.proxyProvider=new pn(void 0,dt),this.id=e,this.name=t,this.icon=n,this.connectorType=r}}const mn=({style:t,...n})=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...t},...n,children:/*#__PURE__*/e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),yn=({...t})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"32",height:"32",rx:"6",fill:"#121314"}),/*#__PURE__*/e.jsx("g",{transform:"translate(4, 4)",children:/*#__PURE__*/e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 318.6 318.6",children:[/*#__PURE__*/e.jsx("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),/*#__PURE__*/e.jsx("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),/*#__PURE__*/e.jsx("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),/*#__PURE__*/e.jsx("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),/*#__PURE__*/e.jsx("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),/*#__PURE__*/e.jsx("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),/*#__PURE__*/e.jsx("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),/*#__PURE__*/e.jsx("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),/*#__PURE__*/e.jsx("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),/*#__PURE__*/e.jsx("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),/*#__PURE__*/e.jsx("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),/*#__PURE__*/e.jsx("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),/*#__PURE__*/e.jsx("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]})})]}),fn=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),/*#__PURE__*/e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]}),xn=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","ronin_wallet","haha_wallet","crypto.com_wallet_extension","crypto.com_onchain","binance","bitkeep","coinbase_wallet","coinbase_smart_wallet","base_account","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","bybit_wallet","ronin_wallet","haha_wallet","privy","unknown","phantom","solflare","glow","backpack","mobile_wallet_adapter"],vn=Object.freeze({phantom:{client:"phantom",name:"Phantom",installLink:fe.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",chainTypes:["ethereum","solana"],get isInstalled(){if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId||e?.phantom?.solana?.isPhantom)return!0}return!1},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Cn({client:this.client,isSolana:t,connectOnly:n});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`}},solflare:{client:"solflare",name:"Solflare",installLink:fe.isFirefox?"https://addons.mozilla.org/es/firefox/addon/solflare-wallet/":"https://chromewebstore.google.com/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic",chainTypes:["solana"],get isInstalled(){return"solflare"in window&&!!window?.solflare?.isSolflare},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Cn({client:this.client,isSolana:t,connectOnly:n});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${r}?ref=${r}`}},backpack:{client:"backpack",name:"Backpack",installLink:"https://chromewebstore.google.com/detail/backpack/aflkmfhebedbjioipglgcbcmnbpgliof",chainTypes:["ethereum","solana"],get isInstalled(){return!(!("backpack"in window)||!window?.backpack?.ethereum?.isBackpack&&!window?.backpack?.solana?.isBackpack)},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Cn({client:this.client,isSolana:t,connectOnly:n});return`${e?"backpack://ul/v1/":"https://backpack.app/ul/v1/"}browse/${r}?ref=${r}`}},okx_wallet:{client:"okx_wallet",name:"OKX Wallet",installLink:"https://chromewebstore.google.com/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge",chainTypes:["solana"],get isInstalled(){return"okxwallet"in window&&!!window?.okxwallet?.isOkxWallet},getMobileRedirect({isSolana:e,connectOnly:t}){return"https://www.okx.com/download?deeplink="+encodeURIComponent("okx://wallet/dapp/url?dappUrl="+Cn({client:this.client,isSolana:e,connectOnly:t}))}}});function wn({connectorType:e,walletClientType:t}){for(let n of xn)if(e===n||t===n)return vn[n]}function Cn({client:e,isSolana:t,connectOnly:n}){let r=new URL(window.location.href);return r.searchParams.set("privy_connector",t?"solana_adapter":"injected"),r.searchParams.set("privy_wallet_client",e),r.searchParams.set("privy_connect_only",String(n)),encodeURIComponent(r.href.replace(/\/$/g,""))}const bn=()=>{let e=Ze.get(ct);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 jn=["phantom","glow","solflare","backpack","okx_wallet","walletconnect","mobile_wallet_adapter"];function kn(e){return e.toLowerCase().split(" ").join("_")}class Tn extends cn{get isInstalled(){return!0}get wallet(){return this._wallet}buildConnectedWallet(){return this._wallet.accounts.map((e=>({type:"solana",provider:new c.ConnectedStandardSolanaWallet({wallet:this._wallet,account:e}),address:e.address,connectedAt:Date.now(),walletClientType:this._wallet.name,connectorType:this.connectorType,imported:!1,meta:{name:this._wallet.name,id:this._wallet.name,icon:this._wallet.icon},isConnected:async()=>this._wallet.accounts.length>0,disconnect:()=>{this.disconnect()}})))}async syncAccounts(){this.wallets=this.buildConnectedWallet(),this.emit("walletsUpdated")}get walletBranding(){return{id:this.wallet.name,name:this.wallet.name,icon:this.wallet.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAttemptAutoConnect()&&await(this.wallet.features["standard:connect"]?.connect({silent:!0}).catch((()=>{}))),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this._wallet.accounts.length>0}subscribeListeners(){this._unsubscribeListeners=this.wallet.features["standard:events"]?.on("change",this.onChange)}unsubscribeListeners(){this._unsubscribeListeners?.()}shouldAttemptAutoConnect(){return!(!this.autoConnectEnabled||!jn.includes(this.walletClientType))&&("phantom"!==this.walletClientType||bn().some((({walletClientType:e})=>"phantom"===e)))}constructor(e,t){super(kn(e.name)),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.wallet.features["standard:disconnect"]?.disconnect().catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await(this.wallet.features["standard:connect"]?.connect())}catch(e){throw nn(e)}},this.onChange=()=>{this.syncAccounts()},this._wallet=e,this.autoConnectEnabled=t,this.wallets=[]}}class An extends Tn{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the SolanaNullConnector")}constructor({id:e,name:t,icon:n}){super({name:t},!1),this.connectorType="null",this.proxyProvider=new pn(void 0,dt),this.disconnect=async()=>{throw Error("disconnect called for an uninstalled wallet via the SolanaNullConnector")},this.promptConnection=async()=>{throw Error("promptConnection called for an uninstalled wallet via the SolanaNullConnector")},this.id=e,this.name=t,this.icon=n}}function Sn(e){return"solana"===e.chainType}const En=q.create((()=>({listings:[]}))),In=En.setState,Pn=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return En.getState().listings.find((({homepage:e})=>{let n;try{n=new URL(e).hostname}catch(e){return!1}return t.includes(n)}))},Nn=e=>En((({listings:t})=>t.find((({slug:t})=>_n(t)===_n(e)))));function _n(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}const Mn={appearance:{landingHeader:"Log in or sign up",theme:"light",walletList:["detected_ethereum_wallets","metamask","coinbase_wallet","rainbow","base_account","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",externalWallets:{coinbaseWallet:{}},embeddedWallets:{extendedCalldataDecoding:!1},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let Fn=new Set(["coinbase_wallet","base_account","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","ronin_wallet","haha_wallet","wallet_connect","wallet_connect_qr","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe","solflare","backpack","binance","binanceus","bitkeep"]),Ln=e=>Fn.has(e),Wn=(e,t,n)=>n.indexOf(e)===t;function Dn(e,t){let n=Math.max(0,Math.min(1,e.toHsl().l+t));return ce.default({...e.toHsl(),l:n})}function Rn(e,t){let n=e.getLuminance(),r=t.getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function On({backgroundTheme:e,accentHex:t}){let n,r;"light"===e?n=!1:"dark"===e?n=!0:(n=.5>=ce.default(e).getLuminance(),r=ce.default(e).toHslString());let i=n?"dark":"light",a=n?Bn:Un,{accent:o,accentLight:s,accentHover:l,accentDark:c,accentDarkest:d}=function(e,t){if(!e){let e=t?Bn:Un;return{accent:ce.default(e.background.interactive),accentLight:ce.default(e.background.interactive),accentHover:ce.default(e.background["interactive-hover"]),accentDark:ce.default(e.background["interactive-clicked"]),accentDarkest:ce.default(e.background["interactive-disabled"])}}let n=ce.default(e);return{accent:n,accentLight:Dn(n,.15),accentHover:Dn(n,.3),accentDark:Dn(n,-.06),accentDarkest:Dn(n,-.6)}}(t,n),u=function(e){let t=ce.default(Un.text.default),n=ce.default(Bn.text.default),r=Rn(e,t),i=Rn(e,n),a=e.toHsl();return a.h>=220&&a.h<=300&&i>=3?Bn.text.default:r>i?Un.text.default:Bn.text.default}(o),p=ce.default(u),h=Rn(o,ce.default(a.background.default))>=3;return{colorScheme:i,background:r||a.background.default,background2:a.background.elevated,background3:a.background.interactive,foreground:a.text.default,foreground2:a.text.muted,foreground3:a.text.placeholder,foreground4:a.border.default,accent:o.toHslString(),accentLight:s.toHslString(),accentHover:l.toHslString(),accentDark:c.toHslString(),accentDarkest:d.toHslString(),foregroundAccent:p.toHslString(),success:a.background.success,successDark:a.text.success,successLight:a.background.success,error:a.text.error,errorLight:a.background.error,warn:a.background.warning,warnLight:a.background.warning,warningDark:a.text.warning,errorDark:a.text.error,successBg:a.background.success,errorBg:a.background.error,errorBgHover:a.background["error-hover"],warnBg:a.background.warning,infoBg:a.background.info,infoBgHover:a.background["info-hover"],borderDefault:a.border.default,borderHover:a.border["default-hover"],borderFocus:a.border.focused,borderError:a.border.error,borderSuccess:a.border.success,borderWarning:a.border.warning,borderInfo:a.border.info,borderInteractive:a.border.interactive,borderInteractiveHover:a.border["interactive-hover"],backgroundHover:a.background["default-hover"],backgroundClicked:a.background["default-clicked"],backgroundDisabled:a.background["default-disabled"],backgroundInteractive:a.background.interactive,backgroundInteractiveHover:a.background["interactive-hover"],backgroundInteractiveClicked:a.background["interactive-clicked"],backgroundInteractiveDisabled:a.background["interactive-disabled"],foregroundHover:a.text.default,foregroundClicked:a.text.default,foregroundDisabled:a.text["default-disabled"],foregroundInteractive:a.text.interactive,foregroundInteractiveHover:a.text["interactive-hover"],accentHasGoodContrast:h?"1":"0",linkNavigationColor:h?o.toHslString():a.text.default,linkNavigationDecoration:h?"none":"underline",iconDefault:a.icon.default,iconMuted:a.icon.muted,iconSubtle:a.icon.subtle,iconInverse:a.icon.inverse,iconSuccess:a.icon.success,iconWarning:a.icon.warning,iconError:a.icon.error,iconInteractive:a.icon.interactive,iconDefaultHover:a.icon["default-hover"],iconMutedHover:a.icon["muted-hover"],iconSubtleHover:a.icon["subtle-hover"],iconDefaultClicked:a.icon["default-clicked"],iconMutedClicked:a.icon["muted-clicked"],iconSubtleClicked:a.icon["subtle-clicked"],iconDefaultDisabled:a.icon["default-disabled"],iconMutedDisabled:a.icon["muted-disabled"],iconSubtleDisabled:a.icon["subtle-disabled"],iconErrorHover:a.icon["error-hover"],iconInteractiveHover:a.icon["interactive-hover"],iconErrorClicked:a.icon["error-clicked"],iconInteractiveClicked:a.icon["interactive-clicked"],iconMutedDisabledAlt:a.icon["muted-disabled"],iconSubtleDisabledAlt:a.icon["subtle-disabled"]}}const Bn={background:{default:"#020713",elevated:"#1A2230","default-hover":"#101724","elevated-hover":"#242B3B","default-clicked":"#1A2230","elevated-clicked":"#2C3444","default-disabled":"#020713","elevated-disabled":"#141824",success:"#0E3E2D",warning:"#373827",error:"#2E0C18",interactive:"#8B86FF","error-hover":"#441821","interactive-hover":"#7B73E5","interactive-clicked":"#6560CC","interactive-disabled":"#141824",info:"#1F2937","info-hover":"#141824"},icon:{default:"#F8F8F8",muted:"#9BA2AE",subtle:"#7B8491",inverse:"#020713",success:"#88E3B5",warning:"#FDF27B",error:"#EF4444",interactive:"#88B6FF","default-hover":"#F8F8F8","muted-hover":"#AEB3BD","subtle-hover":"#8B939E","default-clicked":"#F8F8F8","muted-clicked":"#9097A5","subtle-clicked":"#78818E","default-disabled":"#404452","muted-disabled":"#404452","subtle-disabled":"#404452","error-hover":"#F05555","interactive-hover":"#7B73E5","error-clicked":"#EF4444","interactive-clicked":"#6560CC","muted-disabled-alt":"#404452","subtle-disabled-alt":"#404452"},text:{default:"#F8F8F8",muted:"#9BA2AE",placeholder:"#7B8491",inverse:"#020713",success:"#ACEECB",warning:"#FEF9A0",error:"#FCA5A5",interactive:"#A29EFF","default-hover":"#F8F8F8","muted-hover":"#9BA2AE","placeholder-hover":"#656C78","default-clicked":"#F8F8F8","muted-clicked":"#9BA2AE","placeholder-clicked":"#656C78","default-disabled":"#404452","muted-disabled":"#404452","placeholder-disabled":"#404452","error-hover":"#FA8B8B","interactive-hover":"#8C88E5","error-clicked":"#F87171","interactive-clicked":"#7671CC","error-disabled":"#404452","interactive-disabled":"#404452"},border:{default:"#1F2937",primary:"#110F2A",interactive:"#88B0FF",focused:"#F8F8FC",info:"#5B83D3",success:"#317056",warning:"#FBBF24",error:"#F87171","default-hover":"#34304A","interactive-hover":"#88B0FF","default-clicked":"#1F2937","interactive-clicked":"#88B0FF","default-active":"#F8F8F8","default-disabled":"#1F2937","interactive-disabled":"#1F2937","error-hover":"#971B1C","error-clicked":"#971B1C","error-disabled":"#1F2937"}},Un={background:{default:"#FFFFFF",elevated:"#F1F2F9","default-hover":"#F8F9FC","elevated-hover":"#E8E9F4","default-clicked":"#F1F2F9","elevated-clicked":"#DFE0EF","default-disabled":"#FFFFFF","elevated-disabled":"#F1F2F9",success:"#DCFCE7",warning:"#FEF3C7",error:"#FEE2E2",interactive:"#5B4FFF","error-hover":"#FECACA","interactive-hover":"#4F46E5","interactive-clicked":"#4338CA","interactive-disabled":"#F1F2F9",info:"#E0E7FF","info-hover":"#EEF2FF"},icon:{default:"#110F2A",muted:"#64668B",subtle:"#9498B8",inverse:"#FFFFFF",success:"#33B287",warning:"#F59E0B",error:"#EF4444",interactive:"#564FFF","default-hover":"#1D1B35","muted-hover":"#64668B","subtle-hover":"#888AAE","default-clicked":"#060C23","muted-clicked":"#64668B","subtle-clicked":"#788804","default-disabled":"#CBCDE1","muted-disabled":"#CBCDE1","subtle-disabled":"#CBCDE1","error-hover":"#F06060","interactive-hover":"#4F46E5","error-clicked":"#DC3838","interactive-clicked":"#2BA482","error-disabled":"#CBCDE1","interactive-disabled":"#CBCDE1"},text:{default:"#040217",muted:"#64668B",placeholder:"#9498B8",inverse:"#FFFFFF",success:"#135638",warning:"#906218",error:"#991B1B",interactive:"#5B4FFF","default-hover":"#040217","muted-hover":"#64668B","placeholder-hover":"#9498B8","default-clicked":"#040217","muted-clicked":"#64668B","placeholder-clicked":"#9498B8","default-disabled":"#CBCDE1","muted-disabled":"#CBCDE1","placeholder-disabled":"#CBCDE1","error-hover":"#991B1B","interactive-hover":"#5B4FFF","error-clicked":"#991B1B","interactive-clicked":"#5B4FFF","error-disabled":"#CBCDE1","interactive-disabled":"#CBCDE1"},border:{default:"#E2E3F0",primary:"#110F2A",interactive:"#5B4FFF",focused:"#949DF9",info:"#F1F2F9",success:"#87D7B7",warning:"#FACD63",error:"#F69393","default-hover":"#E2E3F0","interactive-hover":"#5B4FFF","default-clicked":"#E2E3F0","interactive-clicked":"#5B4FFF","default-active":"#110F2A","default-disabled":"#E2E3F0","interactive-disabled":"#E2E3F0","error-hover":"#F69393","error-clicked":"#F69393","error-disabled":"#E2E3F0"}};function zn(e,t,n,r,i){let a,o,s,l,d,u,p,h,g,m,y,f,x,v,w,C,b=n?console.warn:()=>{};t?.loginMethods?(a=t.loginMethods.includes("email"),o=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),d=t.loginMethods.includes("google"),u=t.loginMethods.includes("twitter"),p=t.loginMethods.includes("discord"),m=t.loginMethods.includes("spotify"),y=t.loginMethods.includes("instagram"),h=t.loginMethods.includes("tiktok"),g=t.loginMethods.includes("line"),x=t.loginMethods.includes("github"),f=t.loginMethods.includes("linkedin"),v=t.loginMethods.includes("apple"),w=t.loginMethods.includes("farcaster"),C=t.loginMethods.includes("telegram"),s=t.loginMethods.includes("passkey")):(a=e.email_auth,o=e.sms_auth,l=e.wallet_auth||e.solana_wallet_auth,d=e.google_oauth,u=e.twitter_oauth,p=e.discord_oauth,x=e.github_oauth,m=e.spotify_oauth,y=e.instagram_oauth,h=e.tiktok_oauth,g=e.line_oauth,f=e.linkedin_oauth,v=e.apple_oauth,w=e.farcaster_auth,C=e.telegram_auth,s=e.passkey_auth),e.passkey_auth&&(s=!0),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential&&(s=!1);let j=[a,o].filter(Boolean),k=[d,u,p,x,m,y,h,g,f,v,w,C].filter(Boolean),T=[l].filter(Boolean),A=t?.loginMethods?.includes("passkey")??!1,S=e.passkeys_for_signup_enabled??!1,E=[s&&(S||A)].filter(Boolean);if(j.length+k.length+T.length+E.length===0)throw Error("You must enable at least one login method");let I=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.show_wallet_login_first;I&&0===T.length?(b("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),I=!1):I||k.length+j.length!==0||(b("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),I=!0);let P=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&b("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let N=(({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Ln).filter(Wn):e?e.filter(Ln).filter(Wn):Mn.appearance.walletList)({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),_=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],n=[];for(let n of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(n)?console.warn(`Duplicated login method: ${n}`):t.push(n);for(let r of e.overflow??[])t.includes(r)||n.includes(r)?console.warn(`Duplicated login method: ${r}`):n.push(r);return{primary:t,overflow:n}})({input:t?.loginMethodsAndOrder}),M=t?.intl?.defaultCountry??"US",{chains:F,defaultChain:L}=function({supportedChains:e,defaultChainFromConfig:t}){let n;if(e){if(0===e.length)throw Error("`supportedChains` must contain at least one chain");n=c.dedupeSupportedChains(e)}else n=[...c.DEFAULT_SUPPORTED_CHAINS];let r=e?n[0]:c.mainnet,i=t??r;if(!n.find((e=>e.id===i.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}({supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain}),W=!!t?.defaultChain,D=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,R=D?"all-users":e.embedded_wallet_config.ethereum.create_on_login,O=e.embedded_wallet_config.solana.create_on_login;e.solana_wallet_auth&&!t?.externalWallets?.solana?.connectors&&console.warn("App configuration has Solana wallet login enabled, but no Solana wallet connectors have been passed to Privy. Make sure to pass Solana connectors to the `config.externalWallets.solana.connectors` field of the `PrivyProvider`");let B=e.telegram_auth_config?{botId:e.telegram_auth_config.bot_id,botName:e.telegram_auth_config.bot_name,linkEnabled:e.telegram_auth_config.link_enabled,seamlessAuthEnabled:e.telegram_auth_config.seamless_auth_enabled}:void 0,U=e.funding_config?{methods:e.funding_config.methods,options:e.funding_config.options,defaultRecommendedAmount:e.funding_config.default_recommended_amount,defaultRecommendedCurrency:e.funding_config.default_recommended_currency,promptFundingOnWalletCreation:e.funding_config.prompt_funding_on_wallet_creation,crossChainBridgingEnabled:e.funding_config.cross_chain_bridging_enabled}:void 0;return{id:e.id,appClientId:i,name:e.name,allowlistConfig:{errorTitle:e.allowlist_config.error_title,errorDetail:e.allowlist_config.error_detail,errorCtaText:e.allowlist_config.cta_text,errorCtaLink:e.allowlist_config.cta_link},legacyWalletUiConfig:e.legacy_wallet_ui_config,appearance:{logo:t?.appearance?.logo??e.logo_url??void 0,landingHeader:t?.appearance?.landingHeader??Mn.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,footerLogo:t?.appearance?.footerLogo,palette:On({backgroundTheme:t?.appearance?.theme??Mn.appearance.theme,accentHex:t?.appearance?.accentColor??e.accent_color}),loginGroupPriority:I?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:N,walletChainType:t?.appearance?.walletChainType??(({evmWalletAuth:e,solanaWalletAuth:t})=>e&&t?"ethereum-and-solana":e?"ethereum-only":t?"solana-only":"ethereum-only")({evmWalletAuth:e.wallet_auth??!1,solanaWalletAuth:e.solana_wallet_auth??!1})},loginMethods:{wallet:l,email:a,sms:o,passkey:s,google:d,twitter:u,discord:p,github:x,spotify:m,instagram:y,tiktok:h,line:g,linkedin:f,apple:v,farcaster:w,telegram:C},customOAuthProviders:(e.custom_oauth_providers??[]).filter((e=>!1!==e.enabled)),disablePlusEmails:e.disable_plus_emails,loginMethodsAndOrder:_,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.terms_and_conditions_url,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacy_policy_url,requireUsersAcceptTerms:e.require_users_accept_terms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.wallet_connect_cloud_project_id??Mn.walletConnectCloudProjectId,rpcConfig:{rpcUrls:{},rpcTimeouts:t?.externalWallets?.signatureRequestTimeouts??{}},chains:F,defaultChain:L,intl:{defaultCountry:M},shouldEnforceDefaultChainOnConnect:W,captchaEnabled:e.captcha_enabled??Mn.captchaEnabled,captchaSiteKey:e.captcha_site_key,externalWallets:{coinbaseWallet:{config:{appName:e.name,appLogoUrl:e.logo_url,preference:{options:"all",...t?.externalWallets?.coinbaseWallet?.config?.preference},...t?.externalWallets?.coinbaseWallet?.config}},baseAccount:{config:{appName:e.name,appLogoUrl:e.logo_url,...t?.externalWallets?.baseAccount?.config,preference:{...t?.externalWallets?.baseAccount?.config?.preference,telemetry:!1}}},walletConnect:{enabled:P},solana:{connectors:t?.externalWallets?.solana?.connectors},disableAllExternalWallets:t?.externalWallets?.disableAllExternalWallets??!1},embeddedWallets:{requireUserOwnedRecoveryOnCreate:!D&&(e.embedded_wallet_config.require_user_owned_recovery_on_create??!1),userOwnedRecoveryOptions:D?["user-passcode"]:e.embedded_wallet_config.user_owned_recovery_options,priceDisplay:t?.embeddedWallets?.priceDisplay??{primary:"fiat-currency",secondary:"native-token"},ethereum:{createOnLogin:t?.embeddedWallets?.ethereum?.createOnLogin??R},solana:{createOnLogin:t?.embeddedWallets?.solana?.createOnLogin??O},disableAutomaticMigration:t?.embeddedWallets?.disableAutomaticMigration??!1,mode:e.embedded_wallet_config.mode,showWalletUIs:t?.embeddedWallets?.showWalletUIs??e.enforce_wallet_uis??!0,extendedCalldataDecoding:t?.embeddedWallets?.extendedCalldataDecoding??!1,transactionScanning:{enabled:t?.embeddedWallets?.transactionScanning?.enabled??!1,domain:t?.embeddedWallets?.transactionScanning?.domain??r??"https://auth.privy.io"}},mfa:{methods:e.mfa_methods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},passkeys:{shouldUnlinkOnUnenrollMfa:t?.passkeys?.shouldUnlinkOnUnenrollMfa,shouldUnenrollMfaOnUnlink:t?.passkeys?.shouldUnenrollMfaOnUnlink},customAuth:D?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:B,passkeysForSignupEnabled:e.passkeys_for_signup_enabled},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Mn._render.standalone},fundingConfig:U,fundingMethodConfig:{...t?.fundingMethodConfig??Mn.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Mn.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??Mn.fundingMethodConfig.moonpay.useSandbox}},whatsAppEnabled:!!e.whatsapp_enabled,customOAuthRedirectUrl:t?.customOAuthRedirectUrl,solanaRpcs:{"solana:mainnet":t?.solana?.rpcs?.["solana:mainnet"]??null,"solana:devnet":t?.solana?.rpcs?.["solana:devnet"]??null,"solana:testnet":t?.solana?.rpcs?.["solana:testnet"]??null}}}const Hn={show_wallet_login_first:!0,allowlist_config:{error_title:null,error_detail:null,cta_text:null,cta_link:null},wallet_auth:!0,email_auth:!0,sms_auth:!1,google_oauth:!1,twitter_oauth:!1,discord_oauth:!1,github_oauth:!1,linkedin_oauth:!1,apple_oauth:!1,disable_plus_emails:!1,terms_and_conditions_url:null,privacy_policy_url:null,embedded_wallet_config:{create_on_login:"off",ethereum:{create_on_login:"off"},solana:{create_on_login:"off"},require_user_owned_recovery_on_create:!1,user_owned_recovery_options:["user-passcode"],mode:"user-controlled-server-wallets-only"},fiat_on_ramp_enabled:!1,captcha_enabled:!1,captcha_site_key:"",enforce_wallet_uis:!1,legacy_wallet_ui_config:!1,id:"",name:"",passkeys_for_signup_enabled:!1,whatsapp_enabled:!1},Vn=zn(Hn,void 0,!1);let $n=/*#__PURE__*/n.createContext({appConfig:Vn,isServerConfigLoaded:!1});const qn=()=>{let{appConfig:e}=n.useContext($n);return e},Gn=({style:t,...n})=>{let r=qn();/*#__PURE__*/return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"dark"===r?.appearance.palette.colorScheme?"#3396ff":"#141414"}),/*#__PURE__*/e.jsx("g",{clipPath:"url(#clip0_1765_9946)",children:/*#__PURE__*/e.jsx("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1765_9946",children:/*#__PURE__*/e.jsx("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})},Yn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAHdElNRQfoDAIVODUC+w+GAAAGsUlEQVRYw6WXbYwWVxXHf+fOLAtCXYS2QJdIaClipGCTknXXNqBQMVHbfmhItH4Aral+IAEaG03UxJgYKQJGTUxtDWjaxDSNtcZqIGDwpRuW1oYiVqpdpZSlpC3qysu+PHPP3w/3mXnmeXZbPzjJZO7cefn/z/mfe865xlscq3dGDIguGiHLaMQVLja4s87FShcLo5jtApdddnHexUmHIy475JmdUkPRAQMu7gzT4ljnxJpdk0QPmMFkyAKN2OfOFpc2uuh1J3MZDrjAvXmVEQUuoosRxw642FcEG7IoDxiFxNiu8NYE+vcUYIFYRKKs113bXWx2Z34CoQZsVHOiCZ7mopdzdsFhv8NexEgRDHMxUSNREbh1bwNZwBsFblmfu/a4a6AEENYO5i3AOoEWeEUCF4MOOxBDMQAOk99OJALA2u80sBCwWGBZWG/yRwMaCAbBIAsQTJT3gea1OWfNeaPzvjoHEI85rA8ObtB1v7cIdJkIHgkh9AXpocy0LJjIKvB2wPpZB0v3wkrw5jdNEjeYeMhFX3BAyfn2ke9NUrgB9LrrcZcGJFCld4fWNddXbvbWfWzGR6xJFZsBGh0cBh3bBIxIEGTQ3W0h4NuDaSAzyAxCmGq11Vzf5uaa1aG8p+WFtrEYQGwvjICJkAEqvC+YNmcmMlMNvEaCdrcbyUvQAWDTjVuESHObM6cPGWHmzDwLaEtmzG9Z3qF1zUpXmuuZBb1z4bqeNC6f0WE1NtUTwHzEloiy3BvFisy0sYoLlQtT6XW15md2Qf9SY+2Ngfdca/TMSm/9ewz+/Boc/It45h/i4kSTsKw90SQJsPTvjSZbkWemDW7qTRZ0JEYJWSKxZJ7xmf6M224MzMzbX1s8F1YugjtvMg6eErt/4/z1jUrz1rXUKxnZC2zIg2mdBTK1mFUOKC1fOt/48kdzVixIz86Nij+eEacvpJWyZJ5xy7th8VzjjpuMJfMCW58QL73ekXPVlhsyE+vyzFiplJyauEIyrGIquruMq7qTxk+dcB495rzyTzFepCUWLIFv/kBg081Gd55WUk1IDGFTS89K++TDYxddzKnWcbluHd450xgdh7EGrOo1rr868PMTzqWJRGZ2d8oB/xpL33Xnxl2rjeNn4blXRXduzJ4B5y+28kWscAwXl+yeR654FFZPHoUb710YuPeDOUdPO48di1xptKpeEeHqOcYXNwQKGd88EDk3mqxtxPSfGRlsXRtYt8z4ytPOH/7eqpg1Aso7fYKgK4NPrMpYvsC4/poMA34yVJIQC3sCD9yecdsNyaV5yPj6ryJnR1PAvSNP4J+/1cgDfLbfePaMGGtM7Qdyl12WmKOmXgKKAp54vmBRTxfLrjE+tSYjBPjRM5FrrzIeuD2jf2lLzw8vN4JlfPVp581LsO1DgXv7jSzAiXPw/d+JiYLpjsu26Yfjf5O0rF5WoxsNT9G/bX0XKxakmPjlSee6HlizJJXSX7/oRDc+vjKR+f2wODcKd78/gR8/C9uedF44myJxmhh4OY/ipMQyqaWxmjn95TfEroMFOzbkvG+RceeqViPx1Aln1yEnOow1AnffHCpJAJ5/Vex4UvzptZRdY/O/1dJIS/NkcNmR6MTYah6qzseA4TfFtw4UvHBW1bc/O+7sPhwZHYf/jMODh5yfPudVbXj2TAJ/8XxrOZagNamj4Ei2/GNfuyRxh8t6BG2l15up+MIVODEiFr8rcPS0+O6RBF6mrrEGHHtFzOo2Lo7Dl37hvPQ6mNV6R9JYKgnYWcE37K5HlE2OT/5A0udaPUBHH+BQOMzuNsYLuDyZflTW+fTcmJFDHhJhaZqewMuewXDxcDR9IYyPN6Jj+6K4MF2vV8qBtZJScqVRNi6lpGONVJis5mpKi1WbgwsY+zIsBpcR8mzIZfuTRVZrtdu9odrptR/Xx5XONXJqBmCN0P6YMUQq9WJiwt0Je102WHdbpxSqydMObBWYdwDWLVcqcIMYe3NPjg0Ht84od0Ajju1w2XCr9e6QoqM9V23ZtnmI6cfAMMb9AY0YEHdb6oobEh4y3H3Ize6LsmGvN5IdUnhttdQ9UVrfLk/ljWEZ9wXsqAdQk1EA+O22GcgdZTke/bAs3OPY4HSdcB20HhvVtTMu0jmI8ekAhz2IICj2hKpNqI60NcuIRUHEej1quzubXa2tmZhenrfZmv3YYQ9ipDAIgvHptmblccuDjdRcmjFpWbDi/9ycZjZkRbk5jYztai/AUwiUx+qdEQB/m+25i9lxyvbcjrg45Lmd0uT/3p7/Fw6ODf+WO019AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI0LTEyLTAyVDIxOjU2OjQ4KzAwOjAwMVpslgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNC0xMi0wMlQyMTo1Njo0OCswMDowMEAH1CoAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjQtMTItMDJUMjE6NTY6NTMrMDA6MDDZv6GRAAAAAElFTkSuQmCC";class Zn extends un{async initialize(){let e=await this.createProvider();this.provider=e,this.proxyProvider.setWalletProvider(e),this.subscribeListeners(),e.session&&(this.walletProvider?.session?.peer.metadata.url&&(this.walletEntry=Pn(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown"),this.connected=!0,await this.syncAccounts()),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){let e=this.walletProvider?.session?.peer.metadata.icons?.[0];return{name:Ut(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:"string"==typeof e?e:Yn,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(e){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(Xe)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{(async()=>{let t="",n=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(n?.length&&(t=n[0]),!t||""===t)throw new d.PrivyConnectorError("Unable to retrieve address");this.walletProvider?.session?.peer.metadata.url&&(this.walletEntry=Pn(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown",this.proxyProvider.rpcTimeoutDuration=dn(this.rpcConfig,this.walletClientType)),this.connected=!0,await this.syncAccounts(n),e()})().catch((e=>{t(e?nn(e):new d.PrivyConnectorError("Unknown error during connection"))}))}))}disconnect(){this.walletProvider?.disconnect().then((()=>this.onDisconnect())).catch((()=>console.warn("Unable to disconnect WalletConnect provider")))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(e){this.proxyProvider.setWalletProvider(e)}async createProvider(){let e={};for(let t of this.chains){let n=Ht(t.id,this.chains,this.rpcConfig,this.privyAppId);n&&(e[t.id]=n)}let t=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map((e=>e.id)),r=await G.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:n,optionalEvents:G.OPTIONAL_EVENTS,optionalMethods:G.OPTIONAL_METHODS,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.origin,icons:[]}});return r.on("display_uri",(e=>{if(r.signer.abortPairingAttempt(),function(){try{localStorage.removeItem(Xe)}catch{}}(),!this.showPrivyQrModal)throw new d.PrivyConnectorError("WalletConnect modal not available - Privy handles wallet connections through its own UI");if(v.isMobile&&this.walletEntry){let{redirect:t,href:n}=function(e,t){let n=Ke(t);if(n.deepLink)return et(n.deepLink,e);if(n.universalLink)return tt(n.universalLink,e);throw new d.PrivyClientError(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);nt(t,"_self"),function({href:e,name:t}){try{localStorage.setItem(Xe,JSON.stringify({href:e,name:t}))}catch{}}({href:n,name:this.walletEntry.metadata?.shortName||this.walletEntry.name});let r=Qe(e,this.walletEntry);return this.redirectUri=t,this.fallbackUniversalRedirectUri=r?.redirect,this.showPrivyQrModal({native:t,universal:t})}if(this.redirectUri=void 0,this.walletEntry){let t=Qe(e,this.walletEntry);this.fallbackUniversalRedirectUri=t?.redirect}this.showPrivyQrModal({native:e,universal:void 0})})),r.on("connect",(()=>{r.session?.peer.metadata.url&&(this.walletEntry=Pn(r.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown")})),r}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await(this.walletProvider?.enable())}setWalletEntry(e,t){this.walletEntry=e,this.showPrivyQrModal=t}constructor({walletConnectCloudProjectId:e,rpcConfig:t,chains:n,defaultChain:r,shouldEnforceDefaultChainOnConnect:i,privyAppId:a,privyAppName:o,walletClientType:s}){super(s||"unknown",n,r,t),this.connectorType="wallet_connect_v2",this.privyAppId=a,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new pn(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=(e=>En.getState().listings.find((({slug:t})=>_n(t)===_n(e))))(s),this.walletClientType=s)}}function Kn({src:t,...n}){/*#__PURE__*/return e.jsx("img",{src:t,...n,style:{display:"none"}})}const Qn=/*#__PURE__*/n.createContext({currentScreen:null,lastScreen:null,navigate:r.notImplemented,navigateBack:r.notImplemented,resetNavigation:r.notImplemented,setModalData:r.notImplemented,onUserCloseViaDialogOrKeybindRef:void 0}),Xn=()=>n.useContext(Qn),Jn=/*#__PURE__*/n.createContext(void 0);let er=()=>n.useContext(Jn);function tr(e,t){if(!t)return;let r=er().current[e];return n.useEffect((()=>{for(let[n,i]of Object.entries(t))Object.prototype.hasOwnProperty.call(r,n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))Object.prototype.hasOwnProperty.call(r,n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]=r[n]?.filter((e=>e!==i))}}),[t])}function nr(e,t,n,...r){for(let i of e.current[t][n])i(...r)}function rr(){let e=er();return(t,n,...r)=>nr(e,t,n,...r)}const ir=/*#__PURE__*/a.styled.div.withConfig({displayName:"Grow",componentId:"sc-681ff332-0"})(["text-align:left;flex-grow:1;"]),ar=/*#__PURE__*/a.styled.div.withConfig({displayName:"AlignBottom",componentId:"sc-681ff332-1"})(["display:flex;flex-direction:column;justify-content:flex-end;flex-grow:1;"]),or=/*#__PURE__*/a.styled.div.withConfig({displayName:"LoginMethodContainer",componentId:"sc-681ff332-2"})(["display:flex;flex-direction:column;gap:8px;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]),sr=/*#__PURE__*/a.styled(or).withConfig({displayName:"LoginMethodContainerWithScrollShadows",componentId:"sc-681ff332-3"})([""," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;max-height:400px;overflow-y:auto;scrollbar-width:none;padding:3px;"],(e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0));let lr=/*#__PURE__*/a.css(["&&{width:100%;font-size:16px;line-height:24px;min-height:56px;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;align-items:center;color:var(--privy-color-foreground);padding:10px 12px;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);transition:background-color 200ms ease;cursor:pointer;&:hover{background-color:var(--privy-color-background-2);}&:disabled{cursor:pointer;background-color:var(--privy-color-background-2);}}"]);const cr=/*#__PURE__*/a.styled.div.withConfig({displayName:"Subtitle",componentId:"sc-681ff332-4"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),dr=/*#__PURE__*/a.styled.button.attrs({className:"login-method-button"}).withConfig({displayName:"LoginMethodButton",componentId:"sc-681ff332-5"})(["",""],lr),ur=/*#__PURE__*/a.styled.div.withConfig({displayName:"LoginMethodIconWrapper",componentId:"sc-681ff332-7"})(["width:32px;height:32px;border-radius:",";background:",";display:flex;align-items:center;justify-content:center;flex-shrink:0;svg{width:",";height:",";color:",";}"],(e=>e.$fullSize?"0":"4px"),(e=>e.$fullSize?"transparent":"var(--privy-color-background-2)"),(e=>e.$fullSize?"32px":"18px"),(e=>e.$fullSize?"32px":"18px"),(e=>e.$fullSize?"inherit":"var(--privy-color-icon-muted)")),pr=/*#__PURE__*/a.styled.div.withConfig({displayName:"Hide",componentId:"sc-681ff332-8"})(["width:100%;height:100%;min-height:inherit;display:flex;flex-direction:column;",""],(e=>e.$if?"display: none;":"")),hr=/*#__PURE__*/a.styled.div.withConfig({displayName:"EmptyWalletState",componentId:"sc-681ff332-9"})(["width:100%;height:100%;padding:",";"],(e=>e.$withPadding?"64px 0px":"0px")),gr=/*#__PURE__*/a.styled.div.withConfig({displayName:"Header",componentId:"sc-681ff332-10"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:32px;gap:12px;& h3{font-size:18px;font-style:normal;font-weight:600;line-height:24px;}& p{max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;}"]);function mr(t){/*#__PURE__*/return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40",...t,children:/*#__PURE__*/e.jsx("g",{fill:t.color||"var(--privy-color-foreground)",children:/*#__PURE__*/e.jsx("path",{d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02ZM187.65 5.71v5.72h-.27l-.09-.14a15.9 15.9 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a8.98 8.98 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.13 8.13 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.13 6.13 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73.08-1.56.4-2.91.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02ZM210.07 15.39l.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.79 6.79 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13.05 13.05 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13.03 13.03 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.46 7.46 0 0 0-2.8.5A7.07 7.07 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6.03 6.03 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.46 5.46 0 0 1 2.3-.63 10 10 0 0 1 1.13.02ZM69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.71 8.71 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49ZM133.34 2.17V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a4.99 4.99 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.63 2.63 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49ZM293.41 2.36a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.49 14.49 0 0 0-8.74-2.35ZM350.8 2.36a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.49 10.49 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.78 9.78 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.35 7.35 0 0 1-1.26-2.32 14.09 14.09 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03ZM363.63 3.1l-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a911.57 911.57 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4V3.08h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46V3.09h-5.6c-4.46 0-5.6 0-5.6.02ZM390.8 16.95V30.8h3.87l3.86-.01V3.09h-7.73ZM400.6 3.1l-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4V3.1h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01ZM430.98 3.1c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88l-3.88.01ZM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.89 4.89 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a11.87 11.87 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07ZM51.08 7.41c-2.33.12-4.3.84-5.95 2.16a9.89 9.89 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18.04 18.04 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.78 9.78 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04Zm1.42 3.78c.88.1 1.62.34 2.28.75a6.13 6.13 0 0 1 1.99 2.15 10.31 10.31 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03ZM92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.64 7.64 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.44 8.44 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18.3 18.3 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.32 5.32 0 0 1 2.9-.95c.2-.01.97 0 1.17.03ZM116.79 7.41c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.37 9.37 0 0 0 3.6 1.8 12.06 12.06 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.48 5.48 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.32 5.32 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 10.98 10.98 0 0 0-4.88-.74ZM156.2 7.41a9.87 9.87 0 0 0-6 2.29 11.02 11.02 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02ZM233.58 7.82l8.37 23.22a49.22 49.22 0 0 1-.67 1.9 5.36 5.36 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8.05 8.05 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3H233.53ZM293.05 35.8c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a48.55 48.55 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41.09 41.09 0 0 0-5.8-.24Zm0 0"})})})}let yr=/*#__PURE__*/a.styled.span.withConfig({displayName:"TermsAndConditionsContainer",componentId:"sc-ff3bd734-0"})(["margin-top:16px;font-size:13px;text-align:center;color:var(--privy-color-foreground-3);display:block;&& > a{color:var(--privy-color-accent);}"]);function fr({app:{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:n,requireUsersAcceptTerms:r}},alwaysShowImplicitConsent:i}){let a=!(!t||!n);return r&&!i||!n&&!t?
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("lucide-react"),n=require("react"),r=require("./internal-context-DNWjSiYq.js"),a=require("./privy-context-CJzQZH6s.js"),i=require("styled-components"),o=require("@privy-io/urls"),s=require("@scure/base"),l=require("viem"),c=require("@privy-io/js-sdk-core"),d=require("./paths-B00ZrFQm.js"),u=require("tinycolor2"),p=require("@heroicons/react/24/outline/UserCircleIcon"),h=require("@heroicons/react/24/outline/ArrowLeftIcon");require("@heroicons/react/24/outline/ArrowRightIcon");var g=require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),m=require("@heroicons/react/24/outline/XMarkIcon"),y=require("@heroicons/react/20/solid/CheckIcon"),f=require("@heroicons/react/24/outline/EnvelopeIcon"),x=require("@heroicons/react/24/outline/PhoneIcon"),v=require("react-device-detect"),w=require("@heroicons/react/24/outline/ExclamationTriangleIcon"),C=require("@heroicons/react/24/outline/WalletIcon"),b=require("@heroicons/react/24/outline/ExclamationCircleIcon"),j=require("@heroicons/react/24/outline/Square2StackIcon"),k=require("fast-password-entropy"),T=require("secure-password-utilities"),A=require("secure-password-utilities/wordlists"),S=require("@heroicons/react/24/outline/LockClosedIcon"),E=require("@heroicons/react/24/outline/PencilSquareIcon"),I=require("jose"),P=require("@heroicons/react/24/outline/ArrowPathIcon"),N=require("@heroicons/react/24/outline/EyeIcon"),_=require("@heroicons/react/24/outline/EyeSlashIcon"),M=require("@heroicons/react/24/outline/KeyIcon"),F=require("@heroicons/react/24/solid/CheckCircleIcon"),L=require("@heroicons/react/24/outline/ArrowDownTrayIcon"),W=require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),D=require("@heroicons/react/24/outline/DocumentDuplicateIcon"),R=require("@heroicons/react/24/solid/XCircleIcon"),O=require("@heroicons/react/24/outline/ShieldCheckIcon"),B=require("@heroicons/react/24/outline"),U=require("@tanstack/react-virtual"),z=require("@heroicons/react/24/outline/CheckIcon"),H=require("qrcode"),V=require("viem/utils"),$=require("eventemitter3"),q=require("zustand"),G=require("@walletconnect/ethereum-provider"),Y=require("@heroicons/react/24/outline/CreditCardIcon"),Z=require("@heroicons/react/24/outline/QrCodeIcon"),K=require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),Q=require("@heroicons/react/24/outline/InformationCircleIcon"),X=require("@heroicons/react/24/outline/ClipboardDocumentIcon"),J=require("@heroicons/react/24/outline/ChevronDownIcon"),ee=require("@privy-io/ethereum"),te=require("@heroicons/react/24/outline/CheckCircleIcon"),ne=require("@heroicons/react/24/outline/GlobeAltIcon"),re=require("@headlessui/react"),ae=require("ofetch"),ie=require("@heroicons/react/24/outline/FingerPrintIcon");function oe(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function se(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var le=/*#__PURE__*/oe(n),ce=/*#__PURE__*/oe(u),de=/*#__PURE__*/oe(p),ue=/*#__PURE__*/oe(h),pe=/*#__PURE__*/oe(g),he=/*#__PURE__*/oe(m),ge=/*#__PURE__*/oe(y),me=/*#__PURE__*/oe(f),ye=/*#__PURE__*/oe(x),fe=/*#__PURE__*/se(v),xe=/*#__PURE__*/oe(w),ve=/*#__PURE__*/oe(C),we=/*#__PURE__*/oe(b),Ce=/*#__PURE__*/oe(j),be=/*#__PURE__*/oe(k),je=/*#__PURE__*/se(T),ke=/*#__PURE__*/oe(S),Te=/*#__PURE__*/oe(E),Ae=/*#__PURE__*/oe(P),Se=/*#__PURE__*/oe(N),Ee=/*#__PURE__*/oe(_),Ie=/*#__PURE__*/oe(M),Pe=/*#__PURE__*/oe(F),Ne=/*#__PURE__*/oe(L),_e=/*#__PURE__*/oe(W),Me=/*#__PURE__*/oe(D),Fe=/*#__PURE__*/oe(R),Le=/*#__PURE__*/oe(O),We=/*#__PURE__*/oe(z),De=/*#__PURE__*/oe(H),Re=/*#__PURE__*/oe($),Oe=/*#__PURE__*/oe(Y),Be=/*#__PURE__*/oe(Z),Ue=/*#__PURE__*/oe(K),ze=/*#__PURE__*/oe(Q),He=/*#__PURE__*/oe(X),Ve=/*#__PURE__*/oe(J),$e=/*#__PURE__*/oe(te),qe=/*#__PURE__*/oe(ne),Ge=/*#__PURE__*/oe(ie);class Ye{get(e){let t=localStorage.getItem(e);return null===t?void 0:JSON.parse(t)}put(e,t){void 0!==t?localStorage.setItem(e,JSON.stringify(t)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map((([e])=>e))}}var Ze="undefined"!=typeof window&&window.localStorage?new Ye:new class{get(e){return this._cache[e]}put(e,t){void 0!==t?this._cache[e]=t:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};function Ke(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Qe(e,t){let n=Ke(t);if(n.universalLink)return tt(n.universalLink,e)}let Xe="WALLETCONNECT_DEEPLINK_CHOICE";function Je(e){return e.startsWith("http://")||e.startsWith("https://")}function et(e,t){if(Je(e))return tt(e,t);let n=e;return n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function tt(e,t){if(!Je(e))return et(e,t);let n=e;return n.endsWith("/")||(n=`${n}/`),{redirect:`${n}wc?uri=${encodeURIComponent(t)}`,href:n}}function nt(e,t){window.open(e,t,"noreferrer noopener")}class rt{execute(e){return null===this.promise&&(this.promise=(async()=>{try{return await this.fn(e)}finally{this.promise=null}})()),this.promise}constructor(e){this.promise=null,this.fn=e}}const at=1400,it=4e3,ot="privy:state_code",st="privy:code_verifier",lt=e=>`privy:wallet:${e}`,ct="privy:connections",dt=12e4;function ut(e){return crypto.getRandomValues(new Uint8Array(e))}function pt(){return I.base64url.encode(ut(36))}function ht(){return pt()}async function gt(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 I.base64url.encode(t)}}function mt(e){return e.charAt(0).toUpperCase()+e.slice(1)}const yt=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#040507"}),/*#__PURE__*/e.jsx("path",{d:"M17.2949 6.37537C18.0156 5.44684 19.4671 4.57877 20.4927 4.46512C20.8178 4.42885 20.8581 4.43127 20.9312 4.50139L20.9967 4.56426L20.9816 4.99225C20.9564 5.65963 20.8682 6.12873 20.6716 6.6341C20.4751 7.13705 20.1198 7.71738 19.8426 7.97852C19.7594 8.06074 19.6007 8.22516 19.4948 8.34848C19.0563 8.84901 18.439 9.20205 17.5973 9.4366C17.2823 9.52606 17.2596 9.52848 16.8917 9.52606C16.4482 9.52365 16.3852 9.51156 16.3524 9.43176C16.3398 9.39791 16.3272 9.18996 16.3222 8.9675L16.3171 8.56127L16.423 8.17922C16.6347 7.41512 16.8791 6.90733 17.2949 6.37537Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M17.4512 10.2081C18.4163 9.84541 19.7595 9.48754 20.2584 9.46336C20.6616 9.4416 21.2966 9.49238 21.7225 9.57943C22.1383 9.66164 22.4357 9.76078 22.8666 9.96148C23.5571 10.2831 24.1442 10.7135 24.6104 11.2382C24.9582 11.6299 24.9783 11.6807 24.8397 11.8113C24.7944 11.8548 24.6885 11.9249 24.6054 11.9709C24.4542 12.0507 23.8368 12.5464 23.8368 12.5875C23.8368 12.5971 23.736 12.7108 23.6125 12.8341C23.2068 13.25 23.0279 13.5861 22.7683 14.4252C22.7078 14.6186 22.6448 14.8725 22.6272 14.9934C22.5566 15.4577 22.5919 16.125 22.7154 16.7344C22.7885 17.1044 23.0808 17.7306 23.3706 18.1489C23.7763 18.7317 24.3786 19.2491 24.9909 19.5514C25.316 19.7086 25.5 19.8464 25.5 19.9334C25.5 19.96 25.4773 20.0205 25.4521 20.064C25.4244 20.1075 25.3866 20.2164 25.3639 20.3034C25.311 20.521 25.001 21.244 24.807 21.5971C24.0862 22.9052 23.3731 23.8748 22.6095 24.5833C21.8611 25.2725 21.1606 25.582 20.4348 25.5385C19.9359 25.5094 19.4596 25.3934 18.7842 25.1322C18.2248 24.917 18.0081 24.8493 17.7939 24.8203C17.688 24.8058 17.4915 24.7768 17.3604 24.7574C16.9774 24.697 16.7254 24.6921 16.4533 24.7478C15.5461 24.9267 15.5133 24.9364 15.0144 25.1371C14.2231 25.4562 13.8073 25.5578 13.2907 25.5578C12.8875 25.5602 12.696 25.5143 12.2575 25.3087C11.8694 25.125 11.5948 24.9315 11.2546 24.5978C10.9295 24.2811 10.7052 24.0151 10.2642 23.4323C9.18818 22.0081 9.02187 21.7276 8.49519 20.4582C8.28612 19.9546 8.19971 19.7502 8.13026 19.5402C8.07498 19.373 8.03043 19.2023 7.94332 18.8744C7.73164 18.074 7.70896 17.9869 7.70896 17.8709C7.70896 17.8153 7.68628 17.675 7.66108 17.5565C7.44184 16.5917 7.44688 15.0007 7.67116 14.1713C7.82236 13.6127 8.02648 13.088 8.30367 12.5512C8.92863 11.3325 9.71738 10.5539 10.874 10.0123C11.2571 9.8309 11.5444 9.74627 12.0534 9.65922C12.2903 9.62054 12.5523 9.56976 12.6355 9.54799C12.8421 9.49238 13.3184 9.49963 13.6057 9.56008C14.2911 9.71 14.7548 9.84058 15.2059 10.0123C16.0551 10.3411 16.549 10.4789 16.7506 10.4475C16.7692 10.4444 16.7848 10.4418 16.8002 10.4387C16.8815 10.4225 16.9601 10.3929 17.4512 10.2081Z",fill:"white"})]}),ft=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#5462EB"}),/*#__PURE__*/e.jsx("path",{d:"M23.5433 8.87438C22.2479 8.26174 20.8587 7.81038 19.4063 7.55187C19.3799 7.54688 19.3534 7.55934 19.3398 7.58428C19.1612 7.91179 18.9633 8.33905 18.8247 8.67487C17.2625 8.43382 15.7084 8.43382 14.1782 8.67487C14.0396 8.33158 13.8345 7.91179 13.6551 7.58428C13.6414 7.56018 13.615 7.54771 13.5886 7.55187C12.1369 7.80955 10.7478 8.26092 9.45159 8.87438C9.44037 8.87937 9.43075 8.88769 9.42437 8.89849C6.78947 12.9558 6.06766 16.9134 6.42176 20.8219C6.42336 20.841 6.43378 20.8593 6.4482 20.871C8.18663 22.1868 9.87059 22.9857 11.5233 23.5152C11.5497 23.5235 11.5778 23.5135 11.5946 23.491C11.9855 22.9408 12.334 22.3606 12.6328 21.7504C12.6505 21.7147 12.6336 21.6723 12.5976 21.6581C12.0448 21.442 11.5185 21.1785 11.0122 20.8793C10.9721 20.8552 10.9689 20.7961 11.0058 20.7679C11.1123 20.6856 11.2189 20.6 11.3206 20.5135C11.339 20.4977 11.3647 20.4944 11.3863 20.5044C14.7125 22.0696 18.3136 22.0696 21.6006 20.5044C21.6222 20.4936 21.6479 20.4969 21.6671 20.5127C21.7688 20.5991 21.8754 20.6856 21.9827 20.7679C22.0196 20.7961 22.0172 20.8552 21.9771 20.8793C21.4708 21.1843 20.9445 21.442 20.3909 21.6573C20.3548 21.6715 20.3388 21.7147 20.3564 21.7504C20.6617 22.3597 21.0101 22.9399 21.3939 23.4902C21.4099 23.5135 21.4387 23.5235 21.4652 23.5152C23.1259 22.9857 24.8099 22.1868 26.5483 20.871C26.5635 20.8593 26.5731 20.8419 26.5747 20.8228C26.9985 16.3041 25.8649 12.3789 23.5697 8.89931C23.5641 8.88769 23.5545 8.87937 23.5433 8.87438ZM13.1295 18.442C12.1281 18.442 11.303 17.4944 11.303 16.3307C11.303 15.1669 12.1121 14.2193 13.1295 14.2193C14.155 14.2193 14.9721 15.1752 14.9561 16.3307C14.9561 17.4944 14.1469 18.442 13.1295 18.442ZM19.883 18.442C18.8816 18.442 18.0564 17.4944 18.0564 16.3307C18.0564 15.1669 18.8655 14.2193 19.883 14.2193C20.9084 14.2193 21.7255 15.1752 21.7095 16.3307C21.7095 17.4944 20.9084 18.442 19.883 18.442Z",fill:"#F7F7F7"})]}),xt=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.5083 5.62451C10.8896 5.62451 6.34741 10.2078 6.34741 15.878C6.34741 20.4104 9.25774 24.2471 13.2951 25.605C13.7999 25.7071 13.9848 25.3844 13.9848 25.1129C13.9848 24.8752 13.9682 24.0604 13.9682 23.2115C11.1417 23.8227 10.5531 21.9892 10.5531 21.9892C10.0988 20.8009 9.42579 20.4954 9.42579 20.4954C8.50068 19.8673 9.49318 19.8673 9.49318 19.8673C10.5194 19.9352 11.0578 20.9198 11.0578 20.9198C11.9661 22.4815 13.4297 22.0402 14.0185 21.7686C14.1025 21.1065 14.3719 20.6482 14.6579 20.3936C12.4035 20.1559 10.0317 19.2732 10.0317 15.3347C10.0317 14.2142 10.4351 13.2976 11.0745 12.5847C10.9736 12.3301 10.6202 11.2774 11.1756 9.86844C11.1756 9.86844 12.0335 9.59678 13.968 10.9209C14.7962 10.6965 15.6503 10.5823 16.5083 10.5814C17.3662 10.5814 18.2408 10.7003 19.0484 10.9209C20.9831 9.59678 21.841 9.86844 21.841 9.86844C22.3963 11.2774 22.0428 12.3301 21.9419 12.5847C22.5981 13.2976 22.9849 14.2142 22.9849 15.3347C22.9849 19.2732 20.6131 20.1388 18.3419 20.3936C18.7121 20.7161 19.0316 21.3271 19.0316 22.2948C19.0316 23.6698 19.0149 24.7733 19.0149 25.1127C19.0149 25.3844 19.2 25.7071 19.7046 25.6052C23.742 24.2469 26.6523 20.4104 26.6523 15.878C26.669 10.2078 22.1102 5.62451 16.5083 5.62451Z",fill:"white"})]}),vt=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#F1F2F9"}),/*#__PURE__*/e.jsx("path",{d:"M26.1001 16.2273C26.1001 15.5182 26.0365 14.8364 25.9183 14.1818H16.5001V18.05H21.8819C21.6501 19.3 20.9456 20.3591 19.8865 21.0682V23.5773H23.1183C25.0092 21.8364 26.1001 19.2727 26.1001 16.2273Z",fill:"#4285F4"}),/*#__PURE__*/e.jsx("path",{d:"M16.5001 26C19.2001 26 21.4637 25.1046 23.1182 23.5773L19.8864 21.0682C18.991 21.6682 17.8455 22.0227 16.5001 22.0227C13.8955 22.0227 11.691 20.2637 10.9046 17.9H7.56372V20.4909C9.20917 23.7591 12.591 26 16.5001 26Z",fill:"#34A853"}),/*#__PURE__*/e.jsx("path",{d:"M10.9047 17.8999C10.7047 17.2999 10.591 16.659 10.591 15.9999C10.591 15.3408 10.7047 14.6999 10.9047 14.0999V11.509H7.56376C6.86376 12.9025 6.49951 14.4405 6.50012 15.9999C6.50012 17.6136 6.88649 19.1408 7.56376 20.4908L10.9047 17.8999Z",fill:"#FBBC05"}),/*#__PURE__*/e.jsx("path",{d:"M16.5001 9.97726C17.9682 9.97726 19.2864 10.4818 20.3228 11.4727L23.191 8.60454C21.4591 6.99091 19.1955 6 16.5001 6C12.591 6 9.20917 8.2409 7.56372 11.5091L10.9046 14.1C11.691 11.7364 13.8955 9.97726 16.5001 9.97726Z",fill:"#EA4335"})]});function wt(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...t,children:[/*#__PURE__*/e.jsxs("defs",{children:[/*#__PURE__*/e.jsxs("linearGradient",{id:"b",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#3771c8"}),/*#__PURE__*/e.jsx("stop",{stopColor:"#3771c8",offset:".128"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),/*#__PURE__*/e.jsxs("linearGradient",{id:"a",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#fd5"}),/*#__PURE__*/e.jsx("stop",{offset:".1",stopColor:"#fd5"}),/*#__PURE__*/e.jsx("stop",{offset:".5",stopColor:"#ff543e"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#c837ab"})]}),/*#__PURE__*/e.jsx("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),/*#__PURE__*/e.jsx("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),/*#__PURE__*/e.jsx("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),/*#__PURE__*/e.jsx("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),/*#__PURE__*/e.jsx("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}function Ct(t){/*#__PURE__*/return e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#06C755"}),/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"url(#pattern0_1769_69)"}),/*#__PURE__*/e.jsxs("defs",{children:[/*#__PURE__*/e.jsx("pattern",{id:"pattern0_1769_69",patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:/*#__PURE__*/e.jsx("use",{xlinkHref:"#image0_1769_69",transform:"scale(0.003125)"})}),/*#__PURE__*/e.jsx("image",{id:"image0_1769_69",width:"320",height:"320",preserveAspectRatio:"none",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAYAAADNkKWqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABpkSURBVHgB7d1fbFTXtcfxdWZs45h7g6lClajoetJIRKIqGKmhTSvF5qEvqUqIitM+XEIikYf+QWlVaF+IACVPBamN0ps8NFL5cx+qmioOVXsf+oCJ1Pg2VMKkKlKRSMZVqlalCiaSHf9hZvesMx5jm/k/58w5Z+/vR3KM8cSAPf55rbX32ccTx/Rf3tO/uNiXWygsDnri5UTMgOd5/UZMTozXX3qU/2vAOl4++K+Y4LUR8V97U5KRyUwxM93bOzc5vWNsWhziicU07GYXeoY9I0P+mzljZJBwA6rzv0emM55MGvEuajD29SyM2xyKVgWgBt7cXO+g8YpP+BXdsASBB6AtfiD63dK4ZzJvzj36i3GxSOoDUENvZq57T0Zkf9EPPM+TfgEQGX9kNFY05s31vYtjaa8OUxuAvRPfGDZSOEroAfHRMDSenF74/C/HJIVSFYDBTG+u53ljzHcJPSBR8hqGfpv8st8m5yUlUhGAWu0VTfF58cweAZB0pzKSPZ6GIEx0AJbbXH+5flgApE3igzCRAdj9+5HBTEZ+TPABVkhsECYqAIMV3fmeo54/4xMAtklcECYmANf9/9efLxaLx1jcAKyW9zu744uPjp6SBIg9AP05X86f8/2cdhdwSt6vBnfFXQ1mJEZa9RVM4TLhBzgnV5TC+z0TTx2VGMVSAVL1AVjmyWTGZJ+MoxrseAXY84ev7aHqA7DMyKBfDV7onhh5RjqsowHY8we/3C1m3mChA8AaOb8d/XmnW+KOtMC6veXjue43qPoA1KOX1N2zbuHZThy0EHkA6ryvKMULnMMHoAkdWSWOtAXWKzoIPwAt0FXiC1pASYQiqwA1/PyPfoF5H4CWeTLdnZFdMztHJyUCkQQg4QcgNBGGYOgBSPgBCF1EIRhqABJ+ACITQQiGFoA6rNQNzoQfgMiEHIKhrAKXt7oQfgAiZaR/sSBvhLU63HYA6iZntroA6KBgi4xmj7Sp7QCc/bjn54QfgA7L6dVl0qa2AjC4tpcbFQGIgV5a2+61wy0vgujJDXrxsgBAnDLFJxc+/6uW7kvcUgByfS+AxPBXhjMmu6OV64ZbaoGLXuENwg9AIvgrw3rAsrSg6QAM5n5GBgUAEkLngeve/nrTd5NsqgUutb6F9wUAkqaFVripCrA09wOABGqhFW44AEvn9TP3A5BczbbCDbXArPoCSA2/Fe5bt/hgI0fqN1QB+nO/o4QfgFTwW+GZj3sa2iBdtwJk4QNAGnVnZUe9U2PqVoCl6g8A0uV2QX5c7zE1K0CqPwBplhGza+7Rc+PV318D1R+ANDPi1cywqhUg1R8AG9SqAqtWgFR/AGxgvMzz1d5XsQKk+gNgk77exY2V9gVWrAAL3u2qiQkAaTM721Px6pCKAeiZDKc8A7BH1lQs6u4KwJ63v7aHqz4AWMVIf+/E3uG1v31XAHqZ7H4BAMtU2hKzehHkwp7+nt7umwIAtqlwSMKqCrC7t5vZHwA76SEJc6szblUAZjzvCQEAS/mBt3/N23cYwz1+AdjLeDLYf3lPf/nt5QDsnfjGsACAzfw2eG6ua/mmbssBWDAFqj8A1jPGW8665QD0l4OHBAAsZ1ZkXWkbDNtfADikfG1wUAH2rMsOCwA4YvbjnmF9XWqBveygAIAjPDHD+rpr6Y0hI0B7+rvWy4bsehlYtyl4CX4v2ycb/N9XuXWfbOjj5Of/Gby+dXtGpguzcqvgv749G7w9tXDD//WMAG3K6X+CADRGBhu7QzBcpgE30LNJtq3PBQGngVYOu3Lgdcq7s/kgFKfmbwSBWX679JqARG3Gk+362mMBBJUM+OH22L1bZbuGnR9625dCLw3KQXjFf3nroz/L1NyN4NfASroQ4ukG6KIULgicpZWdht1j935GtvflZJv/0t/VJzYph+JFPxDf+ugqlSKkO9u9o6toFvvFq3t7YFhEA09DbvcnHpEhP/j017bTQC+F/Nbl3ysF4lU5/+GloFKEWxYKi4NdpRVglkBspy3t7o2f80Nvp5UVXiu2LVW7B+9/PHhbK8OzN8aDUJxaWoiBvTzxcroIkhNYSVtarfD2bRpOzfwuTisrRK0O3/Qrw1/7L8wPLeWZAW/dxMgFv/4bFlhBK72nNw0ReiHSleZX/v4bOX/zj1SGFvGMvEkAWkBnevvuGwra25UzLoSv3Caf8V+QckYmvZ6Jp97nJkjppC2uLmTsu2+YmV6HaVWoCycvfnCOqjC98gRgCmmlp4N7qr1koCpMLQ3AEZaAU0DbXA2979z/Faq9hNKq8KUPRgnCFCEAE47gSx8WTdKDAEwogi/9NAhLrfFFgjChCMCEIfjsQ2ucXARggujevZMDzxB8liIIk4cATADdzvLC5hFWdR1xZSYvI9dO0hYnAAEYI213Twzsl6f9yg/u0fkg+wjjRQDGROd8RzY/RbvrONrieBGAHabX6r7+0Ldod7EK1WA8CMAOoupDLXpA6+Gp01SDHUQAdgBVH5pBNdg5BGDE9LCCn33621R9aIrOBg9cf5WTqiPGWfgROpl7Rka3HCb80DQ9y/F3W48G26MQHSrACGjLe+7hQ07cawPR0yrwwPXXaIkjQAUYMt3UrD+5CT+EpfycGmjwxvJoHAEYIl3lLT1ROYoe4dLn1LUdP12+gRPCQQCGRGc1OvMDoqTPMeaC4ekStEUvZzs5sD84yADohCN+AG7I9smhqdOC9hCAbdDwY96HOBx84CtBW/zce68FG6jRGlrgFulAmvBDnPTeMPoc1B/EaA0B2ALCD0mhz8F3PvsjVohbRAA2qRx+rPQiKcqbpgnB5hGATSD8kFTlEKQdbg4B2CDCD0lHCDaPAGyAPqH00jbCD0mnM8HRLYcEjSEAG/CzT3+LBQ+khl46p8evoT4CsA7dda9HWgFpohvzuWKkPgKwBn0CHeFJhJTS5y7XDtdGAFahbQThh7TTa4e3M76pigCsoHyEPWCD0YcPs0ewCgKwAra7wCb6XH79oW8K7kYArqEtA+EH2+hIR08twmoE4Aq6csbQGLbSE2Q0CHEHAbhEZyRsG4DtdLbNlSJ3EIBLjmzeS+sL6+lz/Min9gpKCEAptb5Pc6IzHEErfIfzAUjrCxfRCpc4H4C0vnARrXCJ0wGoBxzQ+sJV2gq7fpWI0wF47uHDArjsZM7tvYHOBqAufND6wnW6GOLygoizAcjCB1Di8nXvTgYg1R9wh34vuDoLdzIAqf6A1Vw9+s25AKT6A+7mahXoXABS/QGVuVgFOhWAVH9Adfq94dqKsFMBSPUH1PbCZreuDnEmAPUnG9UfUJtr+wKdCcB9m4YEQH0u3QbWiQDUE1+45hdozL77hpw5KcaJAHzs3q0CoDEafo/9pxvfM13igCRUf1PzN2q+P+75ZL2/n0rLDHX69ozcKszWfMyGbB/n4dVw8IHH5fzNS2I76wNQ2984K8Cp+X/Kl68ebygAdR9WHGF94PqrcvbGeN3H6fFhl7b9qOZjzvgf55W//7ZuAOnXJIprUPXzvfNPPwxCsJ7RLYdrzrvenc0HX7tGPlZU9DkRx+4F/VrrD4g4/+2dYH0LHHf7q2HQSHWlj3npg1HptLc+utpQ+CkNhDM1Hqvh85wfpvo4/XWtF/0zD02dlrAdyp9u+Jv2lX/8tub7v9/Ex4qKPiemb89Kp2n4fXWj/Ysh1gdg3O3vdKHzT964TM3/q6nHv/L33/gB/GcJUzOfbw3iWv5a5/2dMl2IJ4SHHJidWx2AwTCXBZBEG7l2sm4QIR5UgCm3zfHjvtNAW8wD118TJE+pgLB7U7TVAejShs400zb4xRjmn6jP9g7K6gB0/YYvaaLD/rDngWif7XNAawOQ+V/66HacOFY8UZ3tYyRrA5D5X/roVqCRaycEyaGFhM2dlMUBOCBIH22D6+3PQ2dtW58TW1kbgEMb3L3VX9odyp9iHrhEr2TKxXwJ4naLA9DaS+H6s1znmWY6D3znsyf8FqxP0kCDKuwj17T93HffsMRtoOc+sZW1AcgMMN10Hvjce6/K6JZDkgZ6LbetJ45vX/+g2MrKFlh/cqalckB15z98h3lgAmi423pyjpUBSPVnD90fqIcrIF79WTsLCmsrQNhBL5Xb+5cT7A+Mma1FhZUB+F8WD21dpPPAQ1OnBPHZQAucHlSA9tHzA5kHxocWOEW4/aWddB7I0VnxsLUCdOKeILCDzgP1iPok7g/UhRrduxgmrbr03hy6xzBucW/GjoqVAUgLbK/g1gF/G5WTA/slSTScG721QDP0xkRp2hCeNnbOALkKJBUOPvCVln5Y6VH6ZyIImyTSwI/rSHwXOHFfYCSTHlhx5FN7pRWHp04zD0TbCEDESqvAVm5cVdofeFKAdhCAiN0Jf57XyqBfFx6iuLUm3GFlAOZpjVJF54DnHm7t0AOdB57/8JIAraACRCLopVatruzqqTHMA6Nl6/2tCUAkhs4DW7kNI7fWjJ5+jm1kZQDq1gGkk57/18o8UE+QZh4YnVsEYHoQgOml88DXH/qmtELngTYenZWEfa20wECHaBvc6jzQplZNfxiczD2TiKtAbC0qrLwU7t3ZKUG66Tzw/M0/pubmSBrav9t6VGxFC5wirAja4fWHvpWIgwAgcsXSU7mtDEBtgzhBOP30WLNW54EIz5WZvNjK2hngXxeoAm2greXB+x8XxOeWpQsgytoAnLT4p5ZrdCGglf2BCIet7a+yNgBtLttdpPNAznmMx1u30rEQ1QprA5CVYLvoPPBnn2YeGAeb99VaeyR+WjfEhv1k25Dts6Zy2v2JncE8MIk3R9I5mY1fO91RYXMLbG0A6kqw7iFL0+xIv4G2XP62hE331CXtCPlW6TzwrY+uJu6b8srM+5F87Y5sHpEX/Je42D5KsvpKkCu0wQHbLhEbffiwM/NAvRNePsYW9Nc3/yg2szoAOSfuDpv2Reo80JaKNumoAFNMqx42RNtp36Zh9gdGzPb5n7I6AHUO+O7s+wI76Xxse19OEA2dtdrO+tNg3qQNtpbOAV2aB3bamRsXxXbWB+D//sv+L6LLdB7Y6q01UZ22v2k5iacd1gdgeTsM7KXbfJgHhsuF9lc5cSAqbbD9dB7I0VnhefGDUXGBEwGobTCrweFI6rytfGvNZv5+/V3/Ibibbn1x5bYSTgSgtsFn/zUucRi6d6vETSsjnZVVsq1voOHKScOl1qqrfqxmAmgo5Kt09NaazcwDd2/8XM33//emYYmbfm1yVb52UflpAi81jIrXMzFixAFxHlmu85SLMc0hNZB2b3ykagAq/Wl/5sZ42x9Hnf/wHXnlH/9X52P1yVf9j/V0RAGjn2/9oVfrHDv9dzzWwA+ns/7nJa4rMfRzvu++4Y7eE0QXP7Zc/o64wpkAVBqAnCsHVKeXTbp0e1Gn7grnwr4moB1JPGknSk4F4K9vXmIxBKhC233X7qntVADqXOiVf/xGANzNla0vKzl3Y3Rd4aIKBFZzsfpTzgUgVSCwmn5PuFj9KecCUFEFAnfowoeL1Z9yMgD1J96hqVMCuE73/b3kaPWnnAxApTMPDkmA61764Jy4zNkAVC86/sWH2/SWEfWuALKd0wGoFaDrTwC4izGQ4wGoDk+dZkEEztFVX1cXPlZyPgB1QeSlv7k7BIZ7XF/4WMn5AFR6ATgLInDFl68eF5QQgEsOXH+VVhjWo/VdjQBcok+K5957VQBb6aovre9qBOAKpcM83ToOCG7QuR+rvncjANd4KWgR/imATfb+5SStbwUE4Bq6KqxDYuaBsIXO/d6dzQvuRgBWwDwQttBLPpn7VUcAVqHzQFePCIIdSnM/d+7v0QoCsAb9ycmiCNJIw680ypkRVEcA1nEof4pN0kgVDT0WPRpDADZg5NpJhshIDZ1f83xtDAHYgNJP1BNsj0Hi6dxaNzyjMQRgg7Sd0JkKIYik0vBjxbc5BGATCEEklS7WEX7NIwCbRAgiabTl1cU6NI8AbAEhiKTQxQ427beOAGxROQRZbUNc9LnHXr/2EIBtKIcgq27oNDY6h4MAbJM+AUeuneCyOXQM4RceAjAkugJHCCJq5fDjKo9wEIAh0hBkcQRR0Znfzj/9kPALEQEYMr1umBBE2FjwiAYBGAH9Cb3l8nc4SQaheOujq4RfRAjACOnmVL3bHNUgWnXmxrgffscIv4gQgBE7GzyBj3OkFpqmi2rPXWeTc5QIwA4o7xdklRiN4mCDzvB6JkaMoGMG1m2Scw8flm19OQEq0dEJ8+POIABjsm/TsLywea8fiJ8UQJU21Z9kXNJBBGCMtBo8snlEnvbDEG5jg3M8CMAE2L4+J6NbDlENOkr3+JVOHCf8Oo1FkAS4MpMP9g2yZcY9Z5Z2CRB+8aACTCDmg25gpTd+BGBC6XxQg/DpTUMEoWV0sUNvWK57RBEvAjDhNAgfu/czVISW0BGH3rOXg3STgQBMEVrjdGOxI3kIwBTa/YmdcvD+x/3KcKsgHXRjMzcuSh4CMMXK+wiH/CCkKkwuruxILgLQEtoe7974iF8dPiJIBuZ9yUcAWqa8aKJXl9Aix0fP8Dtw/X+Y9yUcAWgxwjAe7O9LDwLQEf1d6+WrfousQcjMMBocZpA+BKCj9DguDUKtEDUUNSDROra4pBMBiIAGoh7KoGE46L/mvMLGscUlvQhAVKQVYRCKfQMy0PtJ/7WG4gCV4gra8j733qty/sNLgnQiANGUcjDq6/I80cVqkVVeOxCAaJuuNusexIMPPO7E4gotrz0IQITK5uuVdWPzgeuvscprEQIQodOK8OTAM1ZdlaJzPp33cX9eu3AiNEKnc7GRayesqJSCs/v8dlf/PYSffQhAREYP/Uwz3du3808/4CADixGAiIze6yStBwFo6D3y7g9Y5bVclwARmvRDME3bZFjocAsBiEilqYLSqk8PMWDW5w4CEJFKQwBS9bmLAITTqPrcRgDCSVzHC0UAIlK6KTpp2NSMMgIQkUrS6TFUfViLAESkklIBMutDJQQgItWfjbcCZIUXtRCAiFScm6Cp+lAPAYjIbF//oD8D7JNOo+pDowhARGZDtrPhp5VeueoDGkEAIjJ6D5FO4Yh6tIIARGSGNnxGoqZV3+Gp03LmxrgAzfID0MuLmJwAIYt6BZhFDrQpTwWIyES1Aqzt7ot+8LHIgXZ1iTHT4gkQqihWgLXS04qPE5oRBk8rQC/j5Y0xgwKEKOwVYNpdRKHLGLklQMjCWgFmdRdRMV5pBpgXIGS53vbuC6z3Evl+/jRzPkTHeFNdRkyeESDC1moLzLYWdIyRya6erEwuFgQI1a3CbFOPL1/F8VP/hTkfOiHjFae7ZmYW8z293QKESWd3B+9/vO7jCD7Epbf39mTQ/fZMPPU+m6ERtkvbflR1LyB7+RArT6YXvjC6MdgI7Xky6a8G5wQIkd5YfN+mYRm6t3RJ3HRhJgg+DT2qPcTJ8+d/+joIwGLRTHmshCACZ/3FjLMsaCBhjHgX9XVG/+NJcVwAwBVLFWAQgAvzhXEBAEf03bMwrq+DAJRdY9PlRAQAq/lZN73DzzwpB2Dwe3JRAMBy3oqsWw7ArGfGBAAs563IuuUAnJu7PemXgdMCABabe/TcePnXywGoc0DdDygAYCnPyJsr386sfKMocloAwFJ+kbdq1LcqABfnFsdogwHYqrd3sXoA0gYDsJW2v+XtL2WZux4k5rgAgGWMeKfW/l7FK4B73h656b+nXwDAAnoDpPlHRx9c+/uZyo/2XhYAsETR8yruc64YgAtzCz8RALBE1mQqFnWVK8BgMcTjyhAA6efJqblHf5Gv9K5M1f/HFGmDAaRexmSrLuxWDUC9XMQfHI4LAKRVjepPZWr/v2yJAZBetaq/4P213kkVCCC16lR/qmYAqmJRvicAkDL1qr/gMfUesPil0UnDggiANGmg+lN1A1AtzheOcUgCgDTQqz4aqf5UQwEY7AvMsCACIPn8ADzeSPW39NjGrZsYuWBEhgUAEqjaNb/VNFYBLn/w7LO0wgCSys+oXc08vqkA1LKSVhhAIhVNw61vWVMtcBmtMIAk0YOc578wukOa1FQFuPyH0QoDSAid+3km+6S0oKUALJWZxWcFAGLWzKrvWi0FoFr44q/GhGuFAcQpmPuNnpIWtTQDXIl5IIBYeN7Ywhd+2VLrW9ZyBVg2P7f4pCdeXgCgQ3Tu17duoe0xXNsBGFwlIpldhCCATggWPSS7a+0tLlv8WOHo/v3IoL8UfYG7yQGIjJHpjJfd0eqix1rtV4BLSqfGyC62xwCIhJ8tmjFhhZ8KrQIsoxIEELql8NNCS0IUegAqQhBAaCIKPxVJACpCEEDbIgw/FdoMcC39C+uwktVhAK3Q1d4ow2/pz4hW78Q3ckaKF4yYnABAA8pbXcJc8KgksgqwTP8B83MLO8R4YwIAdeidKO/pXdwRdfgt/Vmd0zOx95j/Rx4VAKikaI4vfOncMemQjgag6p0Yecb4IUhLDGCZv9jRlS0+O/v5X3W0U+x4ACqdCxZN4Q3/Tx8UAE7TllfPGO1Ey7tWLAFYRksMOMyv+jwxx+e/eO4nEpNYA1CxSgy4J86qb83fIxmYDQIOSEDVt1JiAlAFs0G5fcz/a+0XAFbxTPHle+4pHAvjGKuwJCoAywhCwB7a7haL8r0or+hoVSIDsIwgBNKrNOfTe3acG5eESnQAlhGEQHp4njem7W6Sg68sFQFYpkFYMIvfzXjZJ1gsARJED0L2zMt9vbd/kqQZXz2pCsCVet7+2h6R7H7/k75HAHSeruh6Mpn0NreW1AZgWf/lPf1zc917isZ7gjAEIrYUekWR0+t7F8fSVO1VkvoAXKt3Yu+w8bw9pihDXGoHhMD4VV5GLnrGjPX23p5Me+itZF0ArqTV4ezH2WHxsoN+mT5kjB+InFAN1ODlS4FnpkyxON53T2HcpsBby+oArKTUMncNFo3p12D0f7wN+J+EnL7PiJcrPYoFFtho6XR2Y6aDX3vB6yl/QTEvRZlc37eYtznsKvk3kqxyUwkTXfIAAAAASUVORK5CYII="})]})]})}function bt(t){/*#__PURE__*/return e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_1715_1956)",children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#0977B6"}),/*#__PURE__*/e.jsx("path",{d:"M9.46878 6.82104C10.6699 6.82104 11.6461 7.79742 11.6461 8.999C11.6461 10.2017 10.6699 11.1782 9.46878 11.1782C8.26447 11.1782 7.28967 10.2017 7.28967 8.999C7.28967 7.79742 8.26447 6.82104 9.46878 6.82104ZM7.58908 12.8309H11.3467V24.9207H7.58908V12.8309Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M13.7032 12.8309H17.3076V14.4827H17.3576C17.8589 13.5322 19.0846 12.53 20.9127 12.53C24.7175 12.53 25.42 15.0341 25.42 18.2891V24.9207H21.6651V19.0415C21.6651 17.6388 21.6394 15.8355 19.7126 15.8355C17.7573 15.8355 17.4579 17.363 17.4579 18.9399V24.9207H13.7032L13.7032 12.8309Z",fill:"white"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1715_1956",children:/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"white"})})})]})}function jt(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...t,children:[/*#__PURE__*/e.jsx("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),/*#__PURE__*/e.jsx("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}function kt(t){/*#__PURE__*/return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg","shape-rendering":"geometricPrecision","text-rendering":"geometricPrecision","image-rendering":"optimizeQuality","fill-rule":"evenodd","clip-rule":"evenodd",viewBox:"0 0 1000 1000",...t,children:/*#__PURE__*/e.jsx("path",{d:"M906.25 0H93.75C42.19 0 0 42.19 0 93.75v812.49c0 51.57 42.19 93.75 93.75 93.75l812.5.01c51.56 0 93.75-42.19 93.75-93.75V93.75C1000 42.19 957.81 0 906.25 0zM684.02 319.72c-32.42-21.13-55.81-54.96-63.11-94.38-1.57-8.51-2.45-17.28-2.45-26.25H515l-.17 414.65c-1.74 46.43-39.96 83.7-86.8 83.7-14.57 0-28.27-3.63-40.35-9.99-27.68-14.57-46.63-43.58-46.63-76.97 0-47.96 39.02-86.98 86.97-86.98 8.95 0 17.54 1.48 25.66 4.01V421.89c-8.41-1.15-16.95-1.86-25.66-1.86-105.01 0-190.43 85.43-190.43 190.45 0 64.42 32.18 121.44 81.3 155.92 30.93 21.72 68.57 34.51 109.14 34.51 105.01 0 190.43-85.43 190.43-190.43V400.21c40.58 29.12 90.3 46.28 143.95 46.28V343.03c-28.89 0-55.8-8.59-78.39-23.31z"})})}const Tt=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"black"}),/*#__PURE__*/e.jsx("path",{d:"M8.53901 8L14.7164 16.2153L8.5 22.8947H9.89907L15.3415 17.0468L19.7389 22.8947H24.5L17.975 14.2173L23.7612 8H22.3621L17.3499 13.3858L13.3001 8H8.53901ZM10.5964 9.02501H12.7837L22.4422 21.8695H20.255L10.5964 9.02501Z",fill:"#F7F7F7"})]});function At(){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"),Ze.del(ot),window.history.replaceState({},"",e)}const St=({address:e,chainId:t,nonce:n})=>`${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: ${n}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class Et{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 d.PrivyClientError("SiweFlow has no client instance");try{if(this.preparedMessage&&this.signature)return await this.client.authenticateWithSiweInternal({message:this.preparedMessage,signature:this.signature,chainId:this.wallet?.chainId,walletClientType:this.wallet?.walletClientType,connectorType:this.wallet?.connectorType,mode:this._meta.disableSignup?"no-signup":"login-or-sign-up"});if(!this.wallet)throw new d.PrivyClientError("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw d.formatApiError(e)}}async link(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");try{if(!this.wallet)throw new d.PrivyClientError("SiweFlow has no wallet instance");let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiweInternal({message:e,signature:t,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(e){throw d.formatApiError(e)}}async sign(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");if(await this.buildMessage(),!this.preparedMessage)throw new d.PrivyClientError("Could not prepare SIWE message");if(!this.wallet)throw new d.PrivyClientError("SiweFlow has no wallet instance");let e=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:e}}async _getNonceOnce(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");if(!this.wallet)throw new d.PrivyClientError("UI SiweFlow has no wallet instance");return await this.client.generateSiweNonce({address:this.wallet.address,captchaToken:this.captchaToken})}async buildMessage(){if(!this.client)throw new d.PrivyClientError("SiweFlow has no client instance");if(!this.wallet)throw new d.PrivyClientError("SiweFlow has no wallet instance");let e=this.wallet.address,t=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=St({address:e,chainId:t,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,a){this._meta={disableSignup:!1},this.getNonceOnce=new rt(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=n,this.client=e,this._meta.disableSignup=r,this.preparedMessage=a?.message,this.signature=a?.signature}}const It=({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\n${`You are proving you own ${e}.`}\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`;class Pt{get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType,disableSignup:this._meta.disableSignup,messageType:this._meta.messageType,address:this.wallet?.address}}set messageType(e){this._meta.messageType=e}async authenticate(){if(!this.client)throw new d.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.authenticateWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up",messageType:this.meta.messageType})}catch(e){throw d.formatApiError(e)}}async link(){if(!this.client)throw new d.PrivyClientError("SiwsFlow has no client instance");try{let{message:e,signature:t}=await this.sign();return await this.client.linkWithSiwsInternal({message:e,signature:t,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType,messageType:this.meta.messageType})}catch(e){throw d.formatApiError(e)}}async sign(){let e,t;if(!this.client)throw new d.PrivyClientError("SiwsFlow has no client instance");await this.buildMessage();let n="transaction"===this.meta.messageType;if(!this.preparedMessage)throw new d.PrivyClientError("Could not prepare SIWS message");if(!n&&!this.wallet.provider.signMessage||n&&!this.wallet.provider.signTransaction)throw new d.PrivyClientError("Wallet does not support the necessary signing methods");if(n&&this._plugin){let n=await this.wallet.provider.signTransaction({transaction:s.base64.decode(this.preparedMessage)});e=s.base64.encode(n.signedTransaction),t=this._plugin.getSignatureFromTransaction(n.signedTransaction,this.wallet.address)}else{e=this.preparedMessage;let n=await this.wallet.provider.signMessage({message:(new TextEncoder).encode(this.preparedMessage)});t=s.base64.encode(n.signature)}return{message:e,signature:t}}async _getNonceOnce(){if(!this.client)throw new d.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 d.PrivyClientError("SiwsFlow has no client instance");let e=this.wallet.address;return this.nonce||(this.nonce=await this.getNonceOnce.execute()),"transaction"===this.meta.messageType&&this._plugin?this.preparedMessage=this._plugin.createSiwsMemoTransaction({address:e,nonce:this.nonce}):this.preparedMessage=It({address:e,nonce:this.nonce}),this.preparedMessage}constructor(e,t,n,r=!1,a="plain",i){this._meta={disableSignup:!1,messageType:"plain"},this.getNonceOnce=new rt(this._getNonceOnce.bind(this)),this.wallet=e,this.captchaToken=n,this.client=t,this._meta.disableSignup=r,this._meta.messageType=a,this._plugin=i}}const Nt=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom||"isPhantom"in e?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,_t=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==Nt(e))return!1;if(e.providers)for(let t of e.providers)if(!_t(t))return!1;return!0},Mt=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},Ft=(e,t,n,r)=>{let a=Number(e),i=t.find((e=>e.id===a));if(!i)throw new d.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return l.createPublicClient({transport:l.http(Lt(i,n,r.appId)),chain:i})},Lt=(e,t,n)=>{let r,a=e.id,i=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])r=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[i])r=t.rpcUrls[i];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",n),r=t.toString()}else r=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!r)throw new d.PrivyConnectorError(`No RPC url found for ${a}`);return r},Wt=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Dt=(e,t=3,n=4,r="ethereum")=>{if(!e)return"";let a="ethereum"===r?2:0;return t+n+a+3>=e.length?e:`${e.slice(0,a+t)}...${e.slice(e.length-n,e.length)}`},Rt=(e,t=3,n=4)=>Dt(e,t,n,"solana"),Ot=e=>new Promise((t=>setTimeout(t,e)));const Bt=(e,t={})=>{let n=t.delayMs||150,r=t.maxAttempts||270;return new Promise((async(a,i)=>{let o=!1,s=0;for(;!o&&s<r;){if(t.abortSignal?.aborted)return;e().then((e=>{o=!0,a(e)}),((...e)=>{o=!0,i(...e)})),s+=1,await Ot(n)}o||i(Error("Exceeded max attempts before resolving function"))}))},Ut=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,"");function zt(e){return`eip155:${String(Number(e))}`}const Ht=(e,t,n,r)=>{let a=Number(e),i=t.find((e=>e.id===a));if(!i)throw new d.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return Lt(i,n,r)};const Vt=/*#__PURE__*/n.createContext({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:r.notImplemented,setError:r.notImplemented,setExecuting:r.notImplemented,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:r.notImplemented,reset:r.notImplemented,execute:r.notImplemented});class $t extends d.PrivyError{constructor(e,t,n){super(e||"Captcha failed"),this.type="Captcha",t instanceof Error&&(this.cause=t),this.privyErrorCode=n}}const qt=()=>n.useContext(Vt);function Gt(e){let t={detail:"",retryable:!1};return e?.privyErrorCode===d.PrivyErrorCode.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),e?.privyErrorCode===d.PrivyErrorCode.DISALLOWED_LOGIN_METHOD&&(t.detail="Login with Telegram not allowed."),e?.privyErrorCode===d.PrivyErrorCode.INVALID_DATA&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===d.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===d.PrivyErrorCode.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e?.privyErrorCode===d.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode===d.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 $t&&(t.retryable=!0,t.detail="Something went wrong. Try again."),t}function Yt(e){return Object.fromEntries(decodeURIComponent(e).split("&").map((e=>e.split("=").map(decodeURIComponent))))}function Zt(){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)}let Kt=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")};const Qt=(e,t)=>{if(t?.imported)return Kt(t);let n=a.getPrivyPrimaryWallet(e);if(!n)throw Error("Failed to find primary wallet");return Kt(n)},Xt=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),/*#__PURE__*/e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]}),Jt="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTAyNCAxMDI0JyBmaWxsPSdub25lJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHN0eWxlPSdoZWlnaHQ6MjhweDt3aWR0aDoyOHB4Jz48cmVjdCB3aWR0aD0nMTAyNCcgaGVpZ2h0PScxMDI0JyBmaWxsPScjMDA1MkZGJyByeD0nMTAwJyByeT0nMTAwJz48L3JlY3Q+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNTIgNTEyQzE1MiA3MTAuODIzIDMxMy4xNzcgODcyIDUxMiA4NzJDNzEwLjgyMyA4NzIgODcyIDcxMC44MjMgODcyIDUxMkM4NzIgMzEzLjE3NyA3MTAuODIzIDE1MiA1MTIgMTUyQzMxMy4xNzcgMTUyIDE1MiAzMTMuMTc3IDE1MiA1MTJaTTQyMCAzOTZDNDA2Ljc0NSAzOTYgMzk2IDQwNi43NDUgMzk2IDQyMFY2MDRDMzk2IDYxNy4yNTUgNDA2Ljc0NSA2MjggNDIwIDYyOEg2MDRDNjE3LjI1NSA2MjggNjI4IDYxNy4yNTUgNjI4IDYwNFY0MjBDNjI4IDQwNi43NDUgNjE3LjI1NSAzOTYgNjA0IDM5Nkg0MjBaJyBmaWxsPSd3aGl0ZSc+PC9wYXRoPjwvc3ZnPg==",en="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAALZJREFUaEPtmjEOhDAMBNc/O14GvOzys3CAKK6eAlmaVGl2Zc+kTOU685vkc9/bnD2prZK5/TZY24z9P+g4F5hNh7/GdoG37WlAA5CATwgCxHENYISwQAMQII5rACOEBRqAAHFcAxghLNAABIjjGsAIYYEGIEAc1wBGCAs0AAHiuAYwQligAQgQxzWAEcICDUCAOK4BjBAWaAACxHENYISwQAMQII6fBjr+VHkW3+u+tfyxMpJaDgYzYxb/ALZVAAAAAElFTkSuQmCC";class tn extends d.PrivyConnectorError{constructor(){super("Wallet timeout"),this.type="wallet_error"}}const nn=e=>e instanceof d.PrivyConnectorError?e:e?.code?new an(e):new d.PrivyConnectorError("Unknown connector error",e);class rn extends d.PrivyError{constructor(e,t,n){super(e),this.type="provider_error",this.code=t,this.data=n}}class an extends rn{constructor(e){super(e.message,e.code,e.data);let t=Object.values(c.ProviderErrors).find((t=>t.eipCode===e.code));this.details=t||c.ProviderErrors.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=c.ProviderErrors.E32002_CONNECTION_ALREADY_PENDING:this.details=c.ProviderErrors.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=c.ProviderErrors.E32002_WALLET_LOCKED))}}const on={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...c.ProviderErrors};function sn(e){return"ethereum"===e.type}function ln(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],a=t[n];if(r?.address!==a?.address||r&&a&&sn(r)&&sn(a)&&r?.chainId!==a?.chainId||r?.connectorType!==a?.connectorType||r?.connectedAt!==a?.connectedAt||r?.walletClientType!==a?.walletClientType||r?.isConnected!==a?.isConnected||r?.linked!==a?.linked)return!1}return!0}class cn extends Re.default{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const dn=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||dt;class un extends cn{buildConnectedWallet(e,t,n,r){let a=async()=>!!this.wallets.find((t=>V.getAddress(t.address)===V.getAddress(e)));return{type:"ethereum",address:V.getAddress(e),chainId:t,meta:n,imported:r,switchChain:async n=>{let r,i;if(!a)throw new d.PrivyConnectorError("Wallet is not currently connected.");let o=this.wallets.find((t=>V.getAddress(t.address)===V.getAddress(e)))?.chainId;if(!o)throw new d.PrivyConnectorError("Unable to determine current chainId.");if("number"==typeof n?(r=`0x${n.toString(16)}`,i=n):(r=n,i=Number(n)),o===zt(r))return;let s=this.chains.find((e=>e.id===i));if(!s)throw new d.PrivyConnectorError(`Unsupported chainId: ${n}`);let l=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})};try{return await l()}catch(e){if(((e,t)=>{switch(t){case"coinbase_wallet":case"base_account":return e.message.includes("addEthereumChain");case"rabby_wallet":return e.message.includes("Unrecognized chain ID");default:return 4902===e.code||e.message?.includes("4902")}})(e,this.walletClientType))return"rabby_wallet"===this.walletClientType&&await Ot(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:r,chainName:s.name,nativeCurrency:s.nativeCurrency,rpcUrls:[s.rpcUrls.default?.http[0]??""],blockExplorerUrls:[s.blockExplorers?.default.url??""]}]}),l();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new d.PrivyConnectorError(`Rainbow does not support the chainId ${t}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new d.PrivyConnectorError("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await a())throw new d.PrivyConnectorError("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t,n=e;try{if(void 0===n){let e=await Bt((()=>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.debug("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let r=n[0],a=V.getAddress(r),i=[];if("privy"===this.walletClientType){let e=Ze.get(lt(a));this.chains.find((t=>t.id===Number(e)))||(Ze.del(lt(a)),e=null),t=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${t} on initialization`)}}else try{let e=await Bt((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)t=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");t=`0x${e.toString(16)}`}}catch(e){console.warn("Failed to get chainId from provider, defaulting to 0x1",e),t="0x1"}let o=zt(t);if(!i.find((e=>V.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};i.push(this.buildConnectedWallet(V.getAddress(r),o,e,"embedded_imported"===this.connectorType))}ln(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((t=>e.find((e=>V.getAddress(e)===V.getAddress(t.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),this.proxyProvider.request({method:"personal_sign",params:[V.toHex(e),this.wallets[0]?.address]})}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,n,r){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=zt(e),"privy"===this.walletClientType&&Ze.put(lt(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=async()=>{"base_account"===this.connectorType&&this.connected||(this.connected=!0,"coinbase_wallet"===this.connectorType&&await Ot(500),this.syncAccounts())},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=n,this.rpcConfig=r,this.rpcTimeoutDuration=dn(r,e),this.connected=!1,this.initialized=!1}}class pn{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 d.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 nn(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 tn,t=this.rpcTimeoutDuration)=>new Promise(((n,r)=>setTimeout((()=>{r(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||dt,this._subscriptions=[]}}const hn=({...t})=>/*#__PURE__*/e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:/*#__PURE__*/e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:t.color||"var(--privy-color-foreground-3)"})});class gn extends un{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the EthereumNullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the EthereumNullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the EthereumNullConnector for ${e}`)}constructor({id:e,name:t,icon:n,walletClientType:r,defaultChain:a}){super(r,[],a,{}),this.connectorType="null",this.proxyProvider=new pn(void 0,dt),this.id=e,this.name=t,this.icon=n,this.connectorType=r}}const mn=({style:t,...n})=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...t},...n,children:/*#__PURE__*/e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})}),yn=({...t})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"32",height:"32",rx:"6",fill:"#121314"}),/*#__PURE__*/e.jsx("g",{transform:"translate(4, 4)",children:/*#__PURE__*/e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 318.6 318.6",children:[/*#__PURE__*/e.jsx("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),/*#__PURE__*/e.jsx("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),/*#__PURE__*/e.jsx("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),/*#__PURE__*/e.jsx("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),/*#__PURE__*/e.jsx("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),/*#__PURE__*/e.jsx("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),/*#__PURE__*/e.jsx("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),/*#__PURE__*/e.jsx("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),/*#__PURE__*/e.jsx("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),/*#__PURE__*/e.jsx("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),/*#__PURE__*/e.jsx("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),/*#__PURE__*/e.jsx("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),/*#__PURE__*/e.jsx("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]})})]}),fn=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),/*#__PURE__*/e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]}),xn=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","ronin_wallet","haha_wallet","crypto.com_wallet_extension","crypto.com_onchain","binance","bitkeep","coinbase_wallet","coinbase_smart_wallet","base_account","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","bybit_wallet","ronin_wallet","haha_wallet","privy","unknown","phantom","solflare","glow","backpack","mobile_wallet_adapter"],vn=Object.freeze({phantom:{client:"phantom",name:"Phantom",installLink:fe.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",chainTypes:["ethereum","solana"],get isInstalled(){if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId||e?.phantom?.solana?.isPhantom)return!0}return!1},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Cn({client:this.client,isSolana:t,connectOnly:n});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`}},solflare:{client:"solflare",name:"Solflare",installLink:fe.isFirefox?"https://addons.mozilla.org/es/firefox/addon/solflare-wallet/":"https://chromewebstore.google.com/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic",chainTypes:["solana"],get isInstalled(){return"solflare"in window&&!!window?.solflare?.isSolflare},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Cn({client:this.client,isSolana:t,connectOnly:n});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${r}?ref=${r}`}},backpack:{client:"backpack",name:"Backpack",installLink:"https://chromewebstore.google.com/detail/backpack/aflkmfhebedbjioipglgcbcmnbpgliof",chainTypes:["ethereum","solana"],get isInstalled(){return!(!("backpack"in window)||!window?.backpack?.ethereum?.isBackpack&&!window?.backpack?.solana?.isBackpack)},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:n}){let r=Cn({client:this.client,isSolana:t,connectOnly:n});return`${e?"backpack://ul/v1/":"https://backpack.app/ul/v1/"}browse/${r}?ref=${r}`}},okx_wallet:{client:"okx_wallet",name:"OKX Wallet",installLink:"https://chromewebstore.google.com/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge",chainTypes:["solana"],get isInstalled(){return"okxwallet"in window&&!!window?.okxwallet?.isOkxWallet},getMobileRedirect({isSolana:e,connectOnly:t}){return"https://www.okx.com/download?deeplink="+encodeURIComponent("okx://wallet/dapp/url?dappUrl="+Cn({client:this.client,isSolana:e,connectOnly:t}))}}});function wn({connectorType:e,walletClientType:t}){for(let n of xn)if(e===n||t===n)return vn[n]}function Cn({client:e,isSolana:t,connectOnly:n}){let r=new URL(window.location.href);return r.searchParams.set("privy_connector",t?"solana_adapter":"injected"),r.searchParams.set("privy_wallet_client",e),r.searchParams.set("privy_connect_only",String(n)),encodeURIComponent(r.href.replace(/\/$/g,""))}const bn=()=>{let e=Ze.get(ct);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 jn=["phantom","glow","solflare","backpack","okx_wallet","walletconnect","mobile_wallet_adapter"];function kn(e){return e.toLowerCase().split(" ").join("_")}class Tn extends cn{get isInstalled(){return!0}get wallet(){return this._wallet}buildConnectedWallet(){return this._wallet.accounts.map((e=>({type:"solana",provider:new c.ConnectedStandardSolanaWallet({wallet:this._wallet,account:e}),address:e.address,connectedAt:Date.now(),walletClientType:this._wallet.name,connectorType:this.connectorType,imported:!1,meta:{name:this._wallet.name,id:this._wallet.name,icon:this._wallet.icon},isConnected:async()=>this._wallet.accounts.length>0,disconnect:()=>{this.disconnect()}})))}async syncAccounts(){this.wallets=this.buildConnectedWallet(),this.emit("walletsUpdated")}get walletBranding(){return{id:this.wallet.name,name:this.wallet.name,icon:this.wallet.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAttemptAutoConnect()&&await(this.wallet.features["standard:connect"]?.connect({silent:!0}).catch((()=>{}))),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this._wallet.accounts.length>0}subscribeListeners(){this._unsubscribeListeners=this.wallet.features["standard:events"]?.on("change",this.onChange)}unsubscribeListeners(){this._unsubscribeListeners?.()}shouldAttemptAutoConnect(){return!(!this.autoConnectEnabled||!jn.includes(this.walletClientType))&&("phantom"!==this.walletClientType||bn().some((({walletClientType:e})=>"phantom"===e)))}constructor(e,t){super(kn(e.name)),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.wallet.features["standard:disconnect"]?.disconnect().catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await(this.wallet.features["standard:connect"]?.connect())}catch(e){throw nn(e)}},this.onChange=()=>{this.syncAccounts()},this._wallet=e,this.autoConnectEnabled=t,this.wallets=[]}}class An extends Tn{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the SolanaNullConnector")}constructor({id:e,name:t,icon:n}){super({name:t},!1),this.connectorType="null",this.proxyProvider=new pn(void 0,dt),this.disconnect=async()=>{throw Error("disconnect called for an uninstalled wallet via the SolanaNullConnector")},this.promptConnection=async()=>{throw Error("promptConnection called for an uninstalled wallet via the SolanaNullConnector")},this.id=e,this.name=t,this.icon=n}}function Sn(e){return"solana"===e.chainType}const En=q.create((()=>({listings:[]}))),In=En.setState,Pn=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return En.getState().listings.find((({homepage:e})=>{let n;try{n=new URL(e).hostname}catch(e){return!1}return t.includes(n)}))},Nn=e=>En((({listings:t})=>t.find((({slug:t})=>_n(t)===_n(e)))));function _n(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}const Mn={appearance:{landingHeader:"Log in or sign up",theme:"light",walletList:["detected_ethereum_wallets","metamask","coinbase_wallet","rainbow","base_account","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",externalWallets:{coinbaseWallet:{}},embeddedWallets:{extendedCalldataDecoding:!1},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let Fn=new Set(["coinbase_wallet","base_account","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","ronin_wallet","haha_wallet","wallet_connect","wallet_connect_qr","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe","solflare","backpack","binance","binanceus","bitkeep"]),Ln=e=>Fn.has(e),Wn=(e,t,n)=>n.indexOf(e)===t;function Dn(e,t){let n=Math.max(0,Math.min(1,e.toHsl().l+t));return ce.default({...e.toHsl(),l:n})}function Rn(e,t){let n=e.getLuminance(),r=t.getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function On({backgroundTheme:e,accentHex:t}){let n,r;"light"===e?n=!1:"dark"===e?n=!0:(n=.5>=ce.default(e).getLuminance(),r=ce.default(e).toHslString());let a=n?"dark":"light",i=n?Bn:Un,{accent:o,accentLight:s,accentHover:l,accentDark:c,accentDarkest:d}=function(e,t){if(!e){let e=t?Bn:Un;return{accent:ce.default(e.background.interactive),accentLight:ce.default(e.background.interactive),accentHover:ce.default(e.background["interactive-hover"]),accentDark:ce.default(e.background["interactive-clicked"]),accentDarkest:ce.default(e.background["interactive-disabled"])}}let n=ce.default(e);return{accent:n,accentLight:Dn(n,.15),accentHover:Dn(n,.3),accentDark:Dn(n,-.06),accentDarkest:Dn(n,-.6)}}(t,n),u=function(e){let t=ce.default(Un.text.default),n=ce.default(Bn.text.default),r=Rn(e,t),a=Rn(e,n),i=e.toHsl();return i.h>=220&&i.h<=300&&a>=3?Bn.text.default:r>a?Un.text.default:Bn.text.default}(o),p=ce.default(u),h=Rn(o,ce.default(i.background.default))>=3;return{colorScheme:a,background:r||i.background.default,background2:i.background.elevated,background3:i.background.interactive,foreground:i.text.default,foreground2:i.text.muted,foreground3:i.text.placeholder,foreground4:i.border.default,accent:o.toHslString(),accentLight:s.toHslString(),accentHover:l.toHslString(),accentDark:c.toHslString(),accentDarkest:d.toHslString(),foregroundAccent:p.toHslString(),success:i.background.success,successDark:i.text.success,successLight:i.background.success,error:i.text.error,errorLight:i.background.error,warn:i.background.warning,warnLight:i.background.warning,warningDark:i.text.warning,errorDark:i.text.error,successBg:i.background.success,errorBg:i.background.error,errorBgHover:i.background["error-hover"],warnBg:i.background.warning,infoBg:i.background.info,infoBgHover:i.background["info-hover"],borderDefault:i.border.default,borderHover:i.border["default-hover"],borderFocus:i.border.focused,borderError:i.border.error,borderSuccess:i.border.success,borderWarning:i.border.warning,borderInfo:i.border.info,borderInteractive:i.border.interactive,borderInteractiveHover:i.border["interactive-hover"],backgroundHover:i.background["default-hover"],backgroundClicked:i.background["default-clicked"],backgroundDisabled:i.background["default-disabled"],backgroundInteractive:i.background.interactive,backgroundInteractiveHover:i.background["interactive-hover"],backgroundInteractiveClicked:i.background["interactive-clicked"],backgroundInteractiveDisabled:i.background["interactive-disabled"],foregroundHover:i.text.default,foregroundClicked:i.text.default,foregroundDisabled:i.text["default-disabled"],foregroundInteractive:i.text.interactive,foregroundInteractiveHover:i.text["interactive-hover"],accentHasGoodContrast:h?"1":"0",linkNavigationColor:h?o.toHslString():i.text.default,linkNavigationDecoration:h?"none":"underline",iconDefault:i.icon.default,iconMuted:i.icon.muted,iconSubtle:i.icon.subtle,iconInverse:i.icon.inverse,iconSuccess:i.icon.success,iconWarning:i.icon.warning,iconError:i.icon.error,iconInteractive:i.icon.interactive,iconDefaultHover:i.icon["default-hover"],iconMutedHover:i.icon["muted-hover"],iconSubtleHover:i.icon["subtle-hover"],iconDefaultClicked:i.icon["default-clicked"],iconMutedClicked:i.icon["muted-clicked"],iconSubtleClicked:i.icon["subtle-clicked"],iconDefaultDisabled:i.icon["default-disabled"],iconMutedDisabled:i.icon["muted-disabled"],iconSubtleDisabled:i.icon["subtle-disabled"],iconErrorHover:i.icon["error-hover"],iconInteractiveHover:i.icon["interactive-hover"],iconErrorClicked:i.icon["error-clicked"],iconInteractiveClicked:i.icon["interactive-clicked"],iconMutedDisabledAlt:i.icon["muted-disabled"],iconSubtleDisabledAlt:i.icon["subtle-disabled"]}}const Bn={background:{default:"#020713",elevated:"#1A2230","default-hover":"#101724","elevated-hover":"#242B3B","default-clicked":"#1A2230","elevated-clicked":"#2C3444","default-disabled":"#020713","elevated-disabled":"#141824",success:"#0E3E2D",warning:"#373827",error:"#2E0C18",interactive:"#8B86FF","error-hover":"#441821","interactive-hover":"#7B73E5","interactive-clicked":"#6560CC","interactive-disabled":"#141824",info:"#1F2937","info-hover":"#141824"},icon:{default:"#F8F8F8",muted:"#9BA2AE",subtle:"#7B8491",inverse:"#020713",success:"#88E3B5",warning:"#FDF27B",error:"#EF4444",interactive:"#88B6FF","default-hover":"#F8F8F8","muted-hover":"#AEB3BD","subtle-hover":"#8B939E","default-clicked":"#F8F8F8","muted-clicked":"#9097A5","subtle-clicked":"#78818E","default-disabled":"#404452","muted-disabled":"#404452","subtle-disabled":"#404452","error-hover":"#F05555","interactive-hover":"#7B73E5","error-clicked":"#EF4444","interactive-clicked":"#6560CC","muted-disabled-alt":"#404452","subtle-disabled-alt":"#404452"},text:{default:"#F8F8F8",muted:"#9BA2AE",placeholder:"#7B8491",inverse:"#020713",success:"#ACEECB",warning:"#FEF9A0",error:"#FCA5A5",interactive:"#A29EFF","default-hover":"#F8F8F8","muted-hover":"#9BA2AE","placeholder-hover":"#656C78","default-clicked":"#F8F8F8","muted-clicked":"#9BA2AE","placeholder-clicked":"#656C78","default-disabled":"#404452","muted-disabled":"#404452","placeholder-disabled":"#404452","error-hover":"#FA8B8B","interactive-hover":"#8C88E5","error-clicked":"#F87171","interactive-clicked":"#7671CC","error-disabled":"#404452","interactive-disabled":"#404452"},border:{default:"#1F2937",primary:"#110F2A",interactive:"#88B0FF",focused:"#F8F8FC",info:"#5B83D3",success:"#317056",warning:"#FBBF24",error:"#F87171","default-hover":"#34304A","interactive-hover":"#88B0FF","default-clicked":"#1F2937","interactive-clicked":"#88B0FF","default-active":"#F8F8F8","default-disabled":"#1F2937","interactive-disabled":"#1F2937","error-hover":"#971B1C","error-clicked":"#971B1C","error-disabled":"#1F2937"}},Un={background:{default:"#FFFFFF",elevated:"#F1F2F9","default-hover":"#F8F9FC","elevated-hover":"#E8E9F4","default-clicked":"#F1F2F9","elevated-clicked":"#DFE0EF","default-disabled":"#FFFFFF","elevated-disabled":"#F1F2F9",success:"#DCFCE7",warning:"#FEF3C7",error:"#FEE2E2",interactive:"#5B4FFF","error-hover":"#FECACA","interactive-hover":"#4F46E5","interactive-clicked":"#4338CA","interactive-disabled":"#F1F2F9",info:"#E0E7FF","info-hover":"#EEF2FF"},icon:{default:"#110F2A",muted:"#64668B",subtle:"#9498B8",inverse:"#FFFFFF",success:"#33B287",warning:"#F59E0B",error:"#EF4444",interactive:"#564FFF","default-hover":"#1D1B35","muted-hover":"#64668B","subtle-hover":"#888AAE","default-clicked":"#060C23","muted-clicked":"#64668B","subtle-clicked":"#788804","default-disabled":"#CBCDE1","muted-disabled":"#CBCDE1","subtle-disabled":"#CBCDE1","error-hover":"#F06060","interactive-hover":"#4F46E5","error-clicked":"#DC3838","interactive-clicked":"#2BA482","error-disabled":"#CBCDE1","interactive-disabled":"#CBCDE1"},text:{default:"#040217",muted:"#64668B",placeholder:"#9498B8",inverse:"#FFFFFF",success:"#135638",warning:"#906218",error:"#991B1B",interactive:"#5B4FFF","default-hover":"#040217","muted-hover":"#64668B","placeholder-hover":"#9498B8","default-clicked":"#040217","muted-clicked":"#64668B","placeholder-clicked":"#9498B8","default-disabled":"#CBCDE1","muted-disabled":"#CBCDE1","placeholder-disabled":"#CBCDE1","error-hover":"#991B1B","interactive-hover":"#5B4FFF","error-clicked":"#991B1B","interactive-clicked":"#5B4FFF","error-disabled":"#CBCDE1","interactive-disabled":"#CBCDE1"},border:{default:"#E2E3F0",primary:"#110F2A",interactive:"#5B4FFF",focused:"#949DF9",info:"#F1F2F9",success:"#87D7B7",warning:"#FACD63",error:"#F69393","default-hover":"#E2E3F0","interactive-hover":"#5B4FFF","default-clicked":"#E2E3F0","interactive-clicked":"#5B4FFF","default-active":"#110F2A","default-disabled":"#E2E3F0","interactive-disabled":"#E2E3F0","error-hover":"#F69393","error-clicked":"#F69393","error-disabled":"#E2E3F0"}};function zn(e,t,n,r,a){let i,o,s,l,d,u,p,h,g,m,y,f,x,v,w,C,b=n?console.warn:()=>{};t?.loginMethods?(i=t.loginMethods.includes("email"),o=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),d=t.loginMethods.includes("google"),u=t.loginMethods.includes("twitter"),p=t.loginMethods.includes("discord"),m=t.loginMethods.includes("spotify"),y=t.loginMethods.includes("instagram"),h=t.loginMethods.includes("tiktok"),g=t.loginMethods.includes("line"),x=t.loginMethods.includes("github"),f=t.loginMethods.includes("linkedin"),v=t.loginMethods.includes("apple"),w=t.loginMethods.includes("farcaster"),C=t.loginMethods.includes("telegram"),s=t.loginMethods.includes("passkey")):(i=e.email_auth,o=e.sms_auth,l=e.wallet_auth||e.solana_wallet_auth,d=e.google_oauth,u=e.twitter_oauth,p=e.discord_oauth,x=e.github_oauth,m=e.spotify_oauth,y=e.instagram_oauth,h=e.tiktok_oauth,g=e.line_oauth,f=e.linkedin_oauth,v=e.apple_oauth,w=e.farcaster_auth,C=e.telegram_auth,s=e.passkey_auth),e.passkey_auth&&(s=!0),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential&&(s=!1);let j=[i,o].filter(Boolean),k=[d,u,p,x,m,y,h,g,f,v,w,C].filter(Boolean),T=[l].filter(Boolean),A=t?.loginMethods?.includes("passkey")??!1,S=e.passkeys_for_signup_enabled??!1,E=[s&&(S||A)].filter(Boolean);if(j.length+k.length+T.length+E.length===0)throw Error("You must enable at least one login method");let I=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.show_wallet_login_first;I&&0===T.length?(b("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),I=!1):I||k.length+j.length!==0||(b("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),I=!0);let P=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&b("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let N=(({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Ln).filter(Wn):e?e.filter(Ln).filter(Wn):Mn.appearance.walletList)({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),_=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],n=[];for(let n of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(n)?console.warn(`Duplicated login method: ${n}`):t.push(n);for(let r of e.overflow??[])t.includes(r)||n.includes(r)?console.warn(`Duplicated login method: ${r}`):n.push(r);return{primary:t,overflow:n}})({input:t?.loginMethodsAndOrder}),M=t?.intl?.defaultCountry??"US",{chains:F,defaultChain:L}=function({supportedChains:e,defaultChainFromConfig:t}){let n;if(e){if(0===e.length)throw Error("`supportedChains` must contain at least one chain");n=c.dedupeSupportedChains(e)}else n=[...c.DEFAULT_SUPPORTED_CHAINS];let r=e?n[0]:c.mainnet,a=t??r;if(!n.find((e=>e.id===a.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}({supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain}),W=!!t?.defaultChain,D=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,R=D?"all-users":e.embedded_wallet_config.ethereum.create_on_login,O=e.embedded_wallet_config.solana.create_on_login;e.solana_wallet_auth&&!t?.externalWallets?.solana?.connectors&&console.warn("App configuration has Solana wallet login enabled, but no Solana wallet connectors have been passed to Privy. Make sure to pass Solana connectors to the `config.externalWallets.solana.connectors` field of the `PrivyProvider`");let B=e.telegram_auth_config?{botId:e.telegram_auth_config.bot_id,botName:e.telegram_auth_config.bot_name,linkEnabled:e.telegram_auth_config.link_enabled,seamlessAuthEnabled:e.telegram_auth_config.seamless_auth_enabled}:void 0,U=e.funding_config?{methods:e.funding_config.methods,options:e.funding_config.options,defaultRecommendedAmount:e.funding_config.default_recommended_amount,defaultRecommendedCurrency:e.funding_config.default_recommended_currency,promptFundingOnWalletCreation:e.funding_config.prompt_funding_on_wallet_creation,crossChainBridgingEnabled:e.funding_config.cross_chain_bridging_enabled}:void 0;return{id:e.id,appClientId:a,name:e.name,allowlistConfig:{errorTitle:e.allowlist_config.error_title,errorDetail:e.allowlist_config.error_detail,errorCtaText:e.allowlist_config.cta_text,errorCtaLink:e.allowlist_config.cta_link},legacyWalletUiConfig:e.legacy_wallet_ui_config,appearance:{logo:t?.appearance?.logo??e.logo_url??void 0,landingHeader:t?.appearance?.landingHeader??Mn.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,footerLogo:t?.appearance?.footerLogo,palette:On({backgroundTheme:t?.appearance?.theme??Mn.appearance.theme,accentHex:t?.appearance?.accentColor??e.accent_color}),loginGroupPriority:I?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:N,walletChainType:t?.appearance?.walletChainType??(({evmWalletAuth:e,solanaWalletAuth:t})=>e&&t?"ethereum-and-solana":e?"ethereum-only":t?"solana-only":"ethereum-only")({evmWalletAuth:e.wallet_auth??!1,solanaWalletAuth:e.solana_wallet_auth??!1})},loginMethods:{wallet:l,email:i,sms:o,passkey:s,google:d,twitter:u,discord:p,github:x,spotify:m,instagram:y,tiktok:h,line:g,linkedin:f,apple:v,farcaster:w,telegram:C},customOAuthProviders:(e.custom_oauth_providers??[]).filter((e=>!1!==e.enabled)),disablePlusEmails:e.disable_plus_emails,loginMethodsAndOrder:_,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.terms_and_conditions_url,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacy_policy_url,requireUsersAcceptTerms:e.require_users_accept_terms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.wallet_connect_cloud_project_id??Mn.walletConnectCloudProjectId,rpcConfig:{rpcUrls:{},rpcTimeouts:t?.externalWallets?.signatureRequestTimeouts??{}},chains:F,defaultChain:L,intl:{defaultCountry:M},shouldEnforceDefaultChainOnConnect:W,captchaEnabled:e.captcha_enabled??Mn.captchaEnabled,captchaSiteKey:e.captcha_site_key,externalWallets:{coinbaseWallet:{config:{appName:e.name,appLogoUrl:e.logo_url,preference:{options:"all",...t?.externalWallets?.coinbaseWallet?.config?.preference},...t?.externalWallets?.coinbaseWallet?.config}},baseAccount:{config:{appName:e.name,appLogoUrl:e.logo_url,...t?.externalWallets?.baseAccount?.config,preference:{...t?.externalWallets?.baseAccount?.config?.preference,telemetry:!1}}},walletConnect:{enabled:P},solana:{connectors:t?.externalWallets?.solana?.connectors},disableAllExternalWallets:t?.externalWallets?.disableAllExternalWallets??!1},embeddedWallets:{requireUserOwnedRecoveryOnCreate:!D&&(e.embedded_wallet_config.require_user_owned_recovery_on_create??!1),userOwnedRecoveryOptions:D?["user-passcode"]:e.embedded_wallet_config.user_owned_recovery_options,priceDisplay:t?.embeddedWallets?.priceDisplay??{primary:"fiat-currency",secondary:"native-token"},ethereum:{createOnLogin:t?.embeddedWallets?.ethereum?.createOnLogin??R},solana:{createOnLogin:t?.embeddedWallets?.solana?.createOnLogin??O},disableAutomaticMigration:t?.embeddedWallets?.disableAutomaticMigration??!1,mode:e.embedded_wallet_config.mode,showWalletUIs:t?.embeddedWallets?.showWalletUIs??e.enforce_wallet_uis??!0,extendedCalldataDecoding:t?.embeddedWallets?.extendedCalldataDecoding??!1,transactionScanning:{enabled:t?.embeddedWallets?.transactionScanning?.enabled??!1,domain:t?.embeddedWallets?.transactionScanning?.domain??r??"https://auth.privy.io"}},mfa:{methods:e.mfa_methods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},passkeys:{shouldUnlinkOnUnenrollMfa:t?.passkeys?.shouldUnlinkOnUnenrollMfa,shouldUnenrollMfaOnUnlink:t?.passkeys?.shouldUnenrollMfaOnUnlink},customAuth:D?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:B,passkeysForSignupEnabled:e.passkeys_for_signup_enabled},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Mn._render.standalone},fundingConfig:U,fundingMethodConfig:{...t?.fundingMethodConfig??Mn.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Mn.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??Mn.fundingMethodConfig.moonpay.useSandbox}},whatsAppEnabled:!!e.whatsapp_enabled,customOAuthRedirectUrl:t?.customOAuthRedirectUrl,solanaRpcs:{"solana:mainnet":t?.solana?.rpcs?.["solana:mainnet"]??null,"solana:devnet":t?.solana?.rpcs?.["solana:devnet"]??null,"solana:testnet":t?.solana?.rpcs?.["solana:testnet"]??null}}}const Hn={show_wallet_login_first:!0,allowlist_config:{error_title:null,error_detail:null,cta_text:null,cta_link:null},wallet_auth:!0,email_auth:!0,sms_auth:!1,google_oauth:!1,twitter_oauth:!1,discord_oauth:!1,github_oauth:!1,linkedin_oauth:!1,apple_oauth:!1,disable_plus_emails:!1,terms_and_conditions_url:null,privacy_policy_url:null,embedded_wallet_config:{create_on_login:"off",ethereum:{create_on_login:"off"},solana:{create_on_login:"off"},require_user_owned_recovery_on_create:!1,user_owned_recovery_options:["user-passcode"],mode:"user-controlled-server-wallets-only"},fiat_on_ramp_enabled:!1,captcha_enabled:!1,captcha_site_key:"",enforce_wallet_uis:!1,legacy_wallet_ui_config:!1,id:"",name:"",passkeys_for_signup_enabled:!1,whatsapp_enabled:!1},Vn=zn(Hn,void 0,!1);let $n=/*#__PURE__*/n.createContext({appConfig:Vn,isServerConfigLoaded:!1});const qn=()=>{let{appConfig:e}=n.useContext($n);return e},Gn=({style:t,...n})=>{let r=qn();/*#__PURE__*/return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...t},...n,children:[/*#__PURE__*/e.jsx("rect",{width:"28",height:"28",rx:"3",fill:"dark"===r?.appearance.palette.colorScheme?"#3396ff":"#141414"}),/*#__PURE__*/e.jsx("g",{clipPath:"url(#clip0_1765_9946)",children:/*#__PURE__*/e.jsx("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1765_9946",children:/*#__PURE__*/e.jsx("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})},Yn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAHdElNRQfoDAIVODUC+w+GAAAGsUlEQVRYw6WXbYwWVxXHf+fOLAtCXYS2QJdIaClipGCTknXXNqBQMVHbfmhItH4Aral+IAEaG03UxJgYKQJGTUxtDWjaxDSNtcZqIGDwpRuW1oYiVqpdpZSlpC3qysu+PHPP3w/3mXnmeXZbPzjJZO7cefn/z/mfe865xlscq3dGDIguGiHLaMQVLja4s87FShcLo5jtApdddnHexUmHIy475JmdUkPRAQMu7gzT4ljnxJpdk0QPmMFkyAKN2OfOFpc2uuh1J3MZDrjAvXmVEQUuoosRxw642FcEG7IoDxiFxNiu8NYE+vcUYIFYRKKs113bXWx2Z34CoQZsVHOiCZ7mopdzdsFhv8NexEgRDHMxUSNREbh1bwNZwBsFblmfu/a4a6AEENYO5i3AOoEWeEUCF4MOOxBDMQAOk99OJALA2u80sBCwWGBZWG/yRwMaCAbBIAsQTJT3gea1OWfNeaPzvjoHEI85rA8ObtB1v7cIdJkIHgkh9AXpocy0LJjIKvB2wPpZB0v3wkrw5jdNEjeYeMhFX3BAyfn2ke9NUrgB9LrrcZcGJFCld4fWNddXbvbWfWzGR6xJFZsBGh0cBh3bBIxIEGTQ3W0h4NuDaSAzyAxCmGq11Vzf5uaa1aG8p+WFtrEYQGwvjICJkAEqvC+YNmcmMlMNvEaCdrcbyUvQAWDTjVuESHObM6cPGWHmzDwLaEtmzG9Z3qF1zUpXmuuZBb1z4bqeNC6f0WE1NtUTwHzEloiy3BvFisy0sYoLlQtT6XW15md2Qf9SY+2Ngfdca/TMSm/9ewz+/Boc/It45h/i4kSTsKw90SQJsPTvjSZbkWemDW7qTRZ0JEYJWSKxZJ7xmf6M224MzMzbX1s8F1YugjtvMg6eErt/4/z1jUrz1rXUKxnZC2zIg2mdBTK1mFUOKC1fOt/48kdzVixIz86Nij+eEacvpJWyZJ5xy7th8VzjjpuMJfMCW58QL73ekXPVlhsyE+vyzFiplJyauEIyrGIquruMq7qTxk+dcB495rzyTzFepCUWLIFv/kBg081Gd55WUk1IDGFTS89K++TDYxddzKnWcbluHd450xgdh7EGrOo1rr868PMTzqWJRGZ2d8oB/xpL33Xnxl2rjeNn4blXRXduzJ4B5y+28kWscAwXl+yeR654FFZPHoUb710YuPeDOUdPO48di1xptKpeEeHqOcYXNwQKGd88EDk3mqxtxPSfGRlsXRtYt8z4ytPOH/7eqpg1Aso7fYKgK4NPrMpYvsC4/poMA34yVJIQC3sCD9yecdsNyaV5yPj6ryJnR1PAvSNP4J+/1cgDfLbfePaMGGtM7Qdyl12WmKOmXgKKAp54vmBRTxfLrjE+tSYjBPjRM5FrrzIeuD2jf2lLzw8vN4JlfPVp581LsO1DgXv7jSzAiXPw/d+JiYLpjsu26Yfjf5O0rF5WoxsNT9G/bX0XKxakmPjlSee6HlizJJXSX7/oRDc+vjKR+f2wODcKd78/gR8/C9uedF44myJxmhh4OY/ipMQyqaWxmjn95TfEroMFOzbkvG+RceeqViPx1Aln1yEnOow1AnffHCpJAJ5/Vex4UvzptZRdY/O/1dJIS/NkcNmR6MTYah6qzseA4TfFtw4UvHBW1bc/O+7sPhwZHYf/jMODh5yfPudVbXj2TAJ/8XxrOZagNamj4Ei2/GNfuyRxh8t6BG2l15up+MIVODEiFr8rcPS0+O6RBF6mrrEGHHtFzOo2Lo7Dl37hvPQ6mNV6R9JYKgnYWcE37K5HlE2OT/5A0udaPUBHH+BQOMzuNsYLuDyZflTW+fTcmJFDHhJhaZqewMuewXDxcDR9IYyPN6Jj+6K4MF2vV8qBtZJScqVRNi6lpGONVJis5mpKi1WbgwsY+zIsBpcR8mzIZfuTRVZrtdu9odrptR/Xx5XONXJqBmCN0P6YMUQq9WJiwt0Je102WHdbpxSqydMObBWYdwDWLVcqcIMYe3NPjg0Ht84od0Ajju1w2XCr9e6QoqM9V23ZtnmI6cfAMMb9AY0YEHdb6oobEh4y3H3Ize6LsmGvN5IdUnhttdQ9UVrfLk/ljWEZ9wXsqAdQk1EA+O22GcgdZTke/bAs3OPY4HSdcB20HhvVtTMu0jmI8ekAhz2IICj2hKpNqI60NcuIRUHEej1quzubXa2tmZhenrfZmv3YYQ9ipDAIgvHptmblccuDjdRcmjFpWbDi/9ycZjZkRbk5jYztai/AUwiUx+qdEQB/m+25i9lxyvbcjrg45Lmd0uT/3p7/Fw6ODf+WO019AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI0LTEyLTAyVDIxOjU2OjQ4KzAwOjAwMVpslgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNC0xMi0wMlQyMTo1Njo0OCswMDowMEAH1CoAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjQtMTItMDJUMjE6NTY6NTMrMDA6MDDZv6GRAAAAAElFTkSuQmCC";class Zn extends un{async initialize(){let e=await this.createProvider();this.provider=e,this.proxyProvider.setWalletProvider(e),this.subscribeListeners(),e.session&&(this.walletProvider?.session?.peer.metadata.url&&(this.walletEntry=Pn(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown"),this.connected=!0,await this.syncAccounts()),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){let e=this.walletProvider?.session?.peer.metadata.icons?.[0];return{name:Ut(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:"string"==typeof e?e:Yn,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(e){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletClientType=e,this.redirectUri=void 0,this.fallbackUniversalRedirectUri=void 0,function(){try{localStorage.removeItem(Xe)}catch{}}(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise(((e,t)=>{(async()=>{let t="",n=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(n?.length&&(t=n[0]),!t||""===t)throw new d.PrivyConnectorError("Unable to retrieve address");this.walletProvider?.session?.peer.metadata.url&&(this.walletEntry=Pn(this.walletProvider?.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown",this.proxyProvider.rpcTimeoutDuration=dn(this.rpcConfig,this.walletClientType)),this.connected=!0,await this.syncAccounts(n),e()})().catch((e=>{t(e?nn(e):new d.PrivyConnectorError("Unknown error during connection"))}))}))}disconnect(){this.walletProvider?.disconnect().then((()=>this.onDisconnect())).catch((()=>console.warn("Unable to disconnect WalletConnect provider")))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(e){this.proxyProvider.setWalletProvider(e)}async createProvider(){let e={};for(let t of this.chains){let n=Ht(t.id,this.chains,this.rpcConfig,this.privyAppId);n&&(e[t.id]=n)}let t=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map((e=>e.id)),r=await G.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:t,optionalChains:n,optionalEvents:G.OPTIONAL_EVENTS,optionalMethods:G.OPTIONAL_METHODS,rpcMap:e,showQrModal:!1,metadata:{description:this.privyAppName,name:this.privyAppName,url:window.location.origin,icons:[]}});return r.on("display_uri",(e=>{if(r.signer.abortPairingAttempt(),function(){try{localStorage.removeItem(Xe)}catch{}}(),!this.showPrivyQrModal)throw new d.PrivyConnectorError("WalletConnect modal not available - Privy handles wallet connections through its own UI");if(v.isMobile&&this.walletEntry){let{redirect:t,href:n}=function(e,t){let n=Ke(t);if(n.deepLink)return et(n.deepLink,e);if(n.universalLink)return tt(n.universalLink,e);throw new d.PrivyClientError(`Unsupported wallet ${t.id}`)}(e,this.walletEntry);nt(t,"_self"),function({href:e,name:t}){try{localStorage.setItem(Xe,JSON.stringify({href:e,name:t}))}catch{}}({href:n,name:this.walletEntry.metadata?.shortName||this.walletEntry.name});let r=Qe(e,this.walletEntry);return this.redirectUri=t,this.fallbackUniversalRedirectUri=r?.redirect,this.showPrivyQrModal({native:t,universal:t})}if(this.redirectUri=void 0,this.walletEntry){let t=Qe(e,this.walletEntry);this.fallbackUniversalRedirectUri=t?.redirect}this.showPrivyQrModal({native:e,universal:void 0})})),r.on("connect",(()=>{r.session?.peer.metadata.url&&(this.walletEntry=Pn(r.session?.peer.metadata.url),this.walletClientType=this.walletEntry?.slug||"unknown")})),r}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await(this.walletProvider?.enable())}setWalletEntry(e,t){this.walletEntry=e,this.showPrivyQrModal=t}constructor({walletConnectCloudProjectId:e,rpcConfig:t,chains:n,defaultChain:r,shouldEnforceDefaultChainOnConnect:a,privyAppId:i,privyAppName:o,walletClientType:s}){super(s||"unknown",n,r,t),this.connectorType="wallet_connect_v2",this.privyAppId=i,this.privyAppName=o,this.walletConnectCloudProjectId=e,this.rpcConfig=t,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new pn(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=(e=>En.getState().listings.find((({slug:t})=>_n(t)===_n(e))))(s),this.walletClientType=s)}}function Kn({src:t,...n}){/*#__PURE__*/return e.jsx("img",{src:t,...n,style:{display:"none"}})}const Qn=/*#__PURE__*/n.createContext({currentScreen:null,lastScreen:null,navigate:r.notImplemented,navigateBack:r.notImplemented,resetNavigation:r.notImplemented,setModalData:r.notImplemented,onUserCloseViaDialogOrKeybindRef:void 0}),Xn=()=>n.useContext(Qn),Jn=/*#__PURE__*/n.createContext(void 0);let er=()=>n.useContext(Jn);function tr(e,t){if(!t)return;let r=er().current[e];return n.useEffect((()=>{for(let[n,a]of Object.entries(t))Object.prototype.hasOwnProperty.call(r,n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))Object.prototype.hasOwnProperty.call(r,n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]=r[n]?.filter((e=>e!==a))}}),[t])}function nr(e,t,n,...r){for(let a of e.current[t][n])a(...r)}function rr(){let e=er();return(t,n,...r)=>nr(e,t,n,...r)}const ar=/*#__PURE__*/i.styled.div.withConfig({displayName:"Grow",componentId:"sc-681ff332-0"})(["text-align:left;flex-grow:1;"]),ir=/*#__PURE__*/i.styled.div.withConfig({displayName:"AlignBottom",componentId:"sc-681ff332-1"})(["display:flex;flex-direction:column;justify-content:flex-end;flex-grow:1;"]),or=/*#__PURE__*/i.styled.div.withConfig({displayName:"LoginMethodContainer",componentId:"sc-681ff332-2"})(["display:flex;flex-direction:column;gap:8px;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]),sr=/*#__PURE__*/i.styled(or).withConfig({displayName:"LoginMethodContainerWithScrollShadows",componentId:"sc-681ff332-3"})([""," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;max-height:400px;overflow-y:auto;scrollbar-width:none;padding:3px;"],(e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0));let lr=/*#__PURE__*/i.css(["&&{width:100%;font-size:16px;line-height:24px;min-height:56px;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;align-items:center;color:var(--privy-color-foreground);padding:10px 12px;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);transition:background-color 200ms ease;cursor:pointer;&:hover{background-color:var(--privy-color-background-2);}&:disabled{cursor:pointer;background-color:var(--privy-color-background-2);}}"]);const cr=/*#__PURE__*/i.styled.div.withConfig({displayName:"Subtitle",componentId:"sc-681ff332-4"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),dr=/*#__PURE__*/i.styled.button.attrs({className:"login-method-button"}).withConfig({displayName:"LoginMethodButton",componentId:"sc-681ff332-5"})(["",""],lr),ur=/*#__PURE__*/i.styled.div.withConfig({displayName:"LoginMethodIconWrapper",componentId:"sc-681ff332-7"})(["width:32px;height:32px;border-radius:",";background:",";display:flex;align-items:center;justify-content:center;flex-shrink:0;svg{width:",";height:",";color:",";}"],(e=>e.$fullSize?"0":"4px"),(e=>e.$fullSize?"transparent":"var(--privy-color-background-2)"),(e=>e.$fullSize?"32px":"18px"),(e=>e.$fullSize?"32px":"18px"),(e=>e.$fullSize?"inherit":"var(--privy-color-icon-muted)")),pr=/*#__PURE__*/i.styled.div.withConfig({displayName:"Hide",componentId:"sc-681ff332-8"})(["width:100%;height:100%;min-height:inherit;display:flex;flex-direction:column;",""],(e=>e.$if?"display: none;":"")),hr=/*#__PURE__*/i.styled.div.withConfig({displayName:"EmptyWalletState",componentId:"sc-681ff332-9"})(["width:100%;height:100%;padding:",";"],(e=>e.$withPadding?"64px 0px":"0px")),gr=/*#__PURE__*/i.styled.div.withConfig({displayName:"Header",componentId:"sc-681ff332-10"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-bottom:32px;gap:12px;& h3{font-size:18px;font-style:normal;font-weight:600;line-height:24px;}& p{max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;}"]);function mr(t){/*#__PURE__*/return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40",...t,children:/*#__PURE__*/e.jsx("g",{fill:t.color||"var(--privy-color-foreground)",children:/*#__PURE__*/e.jsx("path",{d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02ZM187.65 5.71v5.72h-.27l-.09-.14a15.9 15.9 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a8.98 8.98 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.13 8.13 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.13 6.13 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73.08-1.56.4-2.91.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02ZM210.07 15.39l.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.79 6.79 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13.05 13.05 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13.03 13.03 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.46 7.46 0 0 0-2.8.5A7.07 7.07 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6.03 6.03 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.46 5.46 0 0 1 2.3-.63 10 10 0 0 1 1.13.02ZM69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.71 8.71 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49ZM133.34 2.17V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a4.99 4.99 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.63 2.63 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49ZM293.41 2.36a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.49 14.49 0 0 0-8.74-2.35ZM350.8 2.36a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.49 10.49 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.78 9.78 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.35 7.35 0 0 1-1.26-2.32 14.09 14.09 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03ZM363.63 3.1l-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a911.57 911.57 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4V3.08h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46V3.09h-5.6c-4.46 0-5.6 0-5.6.02ZM390.8 16.95V30.8h3.87l3.86-.01V3.09h-7.73ZM400.6 3.1l-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4V3.1h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01ZM430.98 3.1c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88l-3.88.01ZM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.89 4.89 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a11.87 11.87 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07ZM51.08 7.41c-2.33.12-4.3.84-5.95 2.16a9.89 9.89 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18.04 18.04 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.78 9.78 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04Zm1.42 3.78c.88.1 1.62.34 2.28.75a6.13 6.13 0 0 1 1.99 2.15 10.31 10.31 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03ZM92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.64 7.64 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.44 8.44 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18.3 18.3 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.32 5.32 0 0 1 2.9-.95c.2-.01.97 0 1.17.03ZM116.79 7.41c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.37 9.37 0 0 0 3.6 1.8 12.06 12.06 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.48 5.48 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.32 5.32 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 10.98 10.98 0 0 0-4.88-.74ZM156.2 7.41a9.87 9.87 0 0 0-6 2.29 11.02 11.02 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02ZM233.58 7.82l8.37 23.22a49.22 49.22 0 0 1-.67 1.9 5.36 5.36 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8.05 8.05 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3H233.53ZM293.05 35.8c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a48.55 48.55 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41.09 41.09 0 0 0-5.8-.24Zm0 0"})})})}let yr=/*#__PURE__*/i.styled.span.withConfig({displayName:"TermsAndConditionsContainer",componentId:"sc-ff3bd734-0"})(["margin-top:16px;font-size:13px;text-align:center;color:var(--privy-color-foreground-3);display:block;&& > a{color:var(--privy-color-accent);}"]);function fr({app:{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:n,requireUsersAcceptTerms:r}},alwaysShowImplicitConsent:a}){let i=!(!t||!n);return r&&!a||!n&&!t?
2
2
  /*#__PURE__*/e.jsx(yr,{}):
3
- /*#__PURE__*/ /*#__PURE__*/e.jsxs(yr,{children:["By logging in I agree to the"," ",n&&/*#__PURE__*/e.jsx("a",{href:n,target:"_blank",children:a?"Terms":"Terms of Service"}),a&&" & ",t&&/*#__PURE__*/e.jsx("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}const xr=({className:t})=>{let{appearance:n}=qn();/*#__PURE__*/return e.jsx(wr,{className:t,children:n.footerLogo??/*#__PURE__*/e.jsx(vr,{href:"https://www.privy.io/",target:"_blank",id:"protected-by-privy",children:/*#__PURE__*/e.jsx(mr,{color:"currentColor",height:13,width:150})})})};let vr=/*#__PURE__*/a.styled.a.withConfig({displayName:"PrivyLink",componentId:"sc-ff3bd734-1"})(["&&{padding:0;color:var(--privy-color-foreground-3);}"]);const wr=/*#__PURE__*/a.styled.div.withConfig({displayName:"ModalFooter",componentId:"sc-ff3bd734-2"})(["display:flex;align-items:center;justify-content:center;padding-top:8px;padding-bottom:12px;gap:8px;font-size:13px;&& a{padding:0.5rem 0;&:hover{text-decoration:none;}}@media all and (display-mode:standalone){padding-bottom:30px;}"]),Cr=({success:t,fail:n})=>/*#__PURE__*/e.jsxs(jr,{children:[/*#__PURE__*/e.jsx(br,{children:/*#__PURE__*/e.jsx(Tr,{className:t?"success":n?"fail":""})}),/*#__PURE__*/e.jsx(br,{children:/*#__PURE__*/e.jsx(kr,{className:t?"success":n?"fail":""})})]});let br=/*#__PURE__*/a.styled.span.withConfig({displayName:"PositionedAbsoluteLoader",componentId:"sc-aba6339d-0"})(["&&{position:absolute;top:0;left:0;z-index:2;}"]),jr=/*#__PURE__*/a.styled.span.withConfig({displayName:"ConnectionLoaderContainer",componentId:"sc-aba6339d-1"})(["position:relative;width:82px;height:82px;display:inline-block;"]);const kr=/*#__PURE__*/a.styled.span.withConfig({displayName:"Loader",componentId:"sc-aba6339d-2"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;}@keyframes rotation{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}&&&.success{border-color:var(--privy-color-icon-success);border-bottom-color:var(--privy-color-icon-success);}&&&.fail{border-color:var(--privy-color-icon-error);border-bottom-color:var(--privy-color-icon-error);}"],(e=>e.color??"var(--privy-color-icon-subtle)")),Tr=/*#__PURE__*/a.styled(kr).withConfig({displayName:"LoaderFaint",componentId:"sc-aba6339d-3"})(["&&{border-bottom-color:",";border-color:",";animation:none;opacity:0.5;}"],(e=>e.color??"var(--privy-color-border-default)"),(e=>e.color??"var(--privy-color-border-default)")),Ar=t=>/*#__PURE__*/e.jsx(Sr,{color:t.color||"var(--privy-color-foreground-3)"});let Sr=/*#__PURE__*/a.styled(kr).withConfig({displayName:"StyledButtonLoader",componentId:"sc-aba6339d-4"})(["&&{height:1rem;width:1rem;margin:2px 0;border-width:1.5px;transition:border-color 200ms ease;}"]);const Er=({variant:t="primary",size:n="lg",children:r,success:i,...a})=>{switch(t){case"secondary":/*#__PURE__*/return e.jsx(Fr,{size:n,...a,children:r});case"error":/*#__PURE__*/return e.jsx(Fr,{$warn:!0,size:n,...a,children:r});case"muted":/*#__PURE__*/return e.jsx(Lr,{size:n,...a,children:r});default:/*#__PURE__*/return e.jsx(Pr,{size:n,success:i,...a,children:r})}},Ir=/*#__PURE__*/a.styled.button.withConfig({displayName:"BaseButton",componentId:"sc-e537b447-0"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;user-select:none;&{width:auto;cursor:pointer;border-radius:",";font-size:14px;font-style:normal;font-weight:500;line-height:22px;letter-spacing:-0.016px;}&&{height:",";padding:0 ",";}"],(({$size:e})=>"sm"===e?"6px":"var(--privy-border-radius-sm)"),(({$size:e})=>"sm"===e?"28px":"48px"),(({$size:e})=>"sm"===e?"10px":"16px")),Pr=({children:t,loading:n,disabled:r,success:i,size:a="lg",loadingText:o="Loading...",as:s,onClick:l,...c})=>{let d="a"===s,u=!(!n&&!r);/*#__PURE__*/return e.jsx(Mr,{as:s,disabled:d?void 0:u,"aria-disabled":d?u:void 0,$success:i,$size:a,onClick:e=>{d&&u?e.preventDefault():l?.(e)},...c,children:n?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ar,{}),o?/*#__PURE__*/e.jsx("span",{style:{marginLeft:"8px"},children:o}):null]}):t})},Nr=({children:t,loading:n,disabled:r,...i})=>/*#__PURE__*/e.jsx(_r,{disabled:r,...i,children:n?/*#__PURE__*/e.jsx(Ar,{color:"var(--privy-color-foreground-accent)"}):t});let _r=/*#__PURE__*/a.styled(Ir).withConfig({displayName:"StyledPrimaryButtonWithoutGray",componentId:"sc-e537b447-1"})(["position:relative;&&{background-color:var(--privy-color-accent);color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:var(--privy-color-accent-dark);}&:active{background-color:var(--privy-color-accent-dark);}&:disabled,&:hover:disabled,&:active:disabled{cursor:not-allowed;color:var(--privy-color-foreground-disabled);background-color:var(--privy-color-accent-dark);}"]),Mr=/*#__PURE__*/a.styled(Ir).withConfig({displayName:"StyledPrimaryButton",componentId:"sc-e537b447-2"})(["position:relative;&&{background-color:",";color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:",";}&:active{background-color:",";}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;}&:disabled{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent-dark)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent-dark)"),(e=>e.disabled&&/*#__PURE__*/a.css(["&&&,&&&:hover,&&&:active{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"])));const Fr=({children:t,loading:n,disabled:r,size:i="lg",loadingText:a="Loading...",as:o,onClick:s,...l})=>{let c="a"===o,d=!(!n&&!r);/*#__PURE__*/return e.jsx(Wr,{as:o,disabled:c?void 0:d,"aria-disabled":c?d:void 0,$size:i,onClick:e=>{c&&d?e.preventDefault():s?.(e)},...l,children:n?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ar,{}),a?/*#__PURE__*/e.jsx("span",{style:{marginLeft:"8px"},children:a}):null]}):t})},Lr=({children:t,loading:n,disabled:r,size:i="lg",loadingText:a="Loading...",as:o,onClick:s,...l})=>{let c="a"===o,d=!(!n&&!r);/*#__PURE__*/return e.jsx(Dr,{as:o,disabled:c?void 0:d,"aria-disabled":c?d:void 0,$size:i,onClick:e=>{c&&d?e.preventDefault():s?.(e)},...l,children:n?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ar,{}),a?/*#__PURE__*/e.jsx("span",{style:{marginLeft:"8px"},children:a}):null]}):t})};let Wr=/*#__PURE__*/a.styled(Ir).withConfig({displayName:"StyledSecondaryButton",componentId:"sc-e537b447-3"})(["&&{border-width:1px;border-style:solid;border-color:",";background-color:var(--privy-color-background);color:",";transition:border-color 200ms ease,color 200ms ease,background-color 200ms ease;}&:hover{border-color:",";background-color:",";color:",";}&:active{border-color:",";background-color:",";color:",";}&:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-border-interactive-hover)"),(e=>e.$warn?"var(--privy-color-error-light)":"var(--privy-color-info-bg-hover)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-border-interactive)"),(e=>e.$warn?"var(--privy-color-error-bg-hover)":"var(--privy-color-info-bg)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.disabled&&/*#__PURE__*/a.css(["&&&,&&&:hover,&&&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"]))),Dr=/*#__PURE__*/a.styled(Ir).withConfig({displayName:"StyledMutedButton",componentId:"sc-e537b447-4"})(["&&{border-width:1px;border-style:solid;border-color:var(--privy-color-border-default);background-color:transparent;color:var(--privy-color-text-muted);transition:border-color 200ms ease,color 200ms ease,background-color 200ms ease;}&:hover{border-color:var(--privy-color-border-default);background-color:var(--privy-color-info-bg-hover);color:var(--privy-color-foreground-2);}&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-info-bg);color:var(--privy-color-foreground-2);}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;}&:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.disabled&&/*#__PURE__*/a.css(["&&&,&&&:hover,&&&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"])));const Rr=({children:t,onClick:n,disabled:r,isSubmitting:i,...a})=>/*#__PURE__*/e.jsxs(Or,{$isSubmitting:i,onClick:n,disabled:r,...a,children:[/*#__PURE__*/e.jsx("span",{children:t}),
4
- /*#__PURE__*/e.jsx("span",{children:/*#__PURE__*/e.jsx(Ar,{})})]});let Or=/*#__PURE__*/a.styled.button.withConfig({displayName:"StyledEmbeddedButton",componentId:"sc-e537b447-7"})(["&&{color:var(--privy-color-accent);font-size:16px;font-style:normal;font-weight:500;line-height:24px;cursor:pointer;border-radius:0px var(--privy-border-radius-mdlg) var(--privy-border-radius-mdlg) 0px;border:none;transition:color 200ms ease;@media (min-width:441px){font-size:14px;}:hover{color:var(--privy-color-accent-dark);}&& > :first-child{opacity:",";}&& > :last-child{position:absolute;display:flex;top:50%;left:50%;transform:translate3d(-50%,-50%,0);opacity:",";}:disabled,:hover:disabled{color:var(--privy-color-foreground-disabled);cursor:not-allowed;}}"],(e=>e.$isSubmitting?0:1),(e=>e.$isSubmitting?1:0));const Br=({backFn:t})=>/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Vr,{onClick:t,children:/*#__PURE__*/e.jsx(ue.default,{height:"16px",width:"16px",strokeWidth:2})})}),Ur=({infoFn:t})=>/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx($r,{"aria-label":"info",onClick:t,children:/*#__PURE__*/e.jsx(pe.default,{height:"22px",width:"22px",strokeWidth:2})})}),zr=t=>/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Vr,{"aria-label":"close modal",onClick:t.onClose,children:/*#__PURE__*/e.jsx(he.default,{height:"16px",width:"16px",strokeWidth:2})})}),Hr=({backFn:t,infoFn:n,onClose:i,title:a,closeable:o=!0,className:s})=>{let{closePrivyModal:l}=r.usePrivyInternal(),c=qn();/*#__PURE__*/return e.jsxs(qr,{className:s,children:[/*#__PURE__*/e.jsxs(Gr,{children:[t&&/*#__PURE__*/e.jsx(Br,{backFn:t}),n&&/*#__PURE__*/e.jsx(Ur,{infoFn:n})]}),a&&/*#__PURE__*/e.jsx(Zr,{id:"privy-dialog-title",children:a}),/*#__PURE__*/e.jsx(Yr,{children:!c.render.standalone&&o&&/*#__PURE__*/e.jsx(zr,{onClose:i||(()=>l())})})]})};let Vr=/*#__PURE__*/a.styled.button.withConfig({displayName:"StyledButton",componentId:"sc-e033e17a-0"})(["&&{cursor:pointer;display:flex;opacity:0.6;background-color:var(--privy-color-background-2);border-radius:var(--privy-border-radius-full);padding:4px;> svg{margin:auto;color:var(--privy-color-foreground);}:hover{opacity:1;}}"]),$r=/*#__PURE__*/a.styled(Vr).withConfig({displayName:"TransparentStyledButton",componentId:"sc-e033e17a-1"})(["&&{background-color:transparent;}"]),qr=/*#__PURE__*/a.styled.div.withConfig({displayName:"StyledHeader",componentId:"sc-e033e17a-2"})(["padding:16px 0;display:flex;align-items:center;justify-content:space-between;h2{font-size:16px;line-height:24px;font-weight:600;color:var(--privy-color-foreground);}"]),Gr=/*#__PURE__*/a.styled.div.withConfig({displayName:"LeftActionContainer",componentId:"sc-e033e17a-3"})(["flex:1;align-items:center;display:flex;gap:8px;"]),Yr=/*#__PURE__*/a.styled.div.withConfig({displayName:"RightActionContainer",componentId:"sc-e033e17a-4"})(["flex:1;display:flex;justify-content:flex-end;"]),Zr=/*#__PURE__*/a.styled.div.withConfig({displayName:"TitleContainer",componentId:"sc-e033e17a-5"})(["overflow:hidden;white-space:nowrap;max-width:100%;text-overflow:ellipsis;text-align:center;color:var(--privy-color-foreground-2);"]);const Kr=({size:t,centerIcon:n})=>/*#__PURE__*/e.jsx(Qr,{$size:t,children:/*#__PURE__*/e.jsxs(Xr,{children:[/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(ti,{}),n?/*#__PURE__*/e.jsx(Jr,{children:n}):null]})});let Qr=/*#__PURE__*/a.styled.div.withConfig({displayName:"LoadingContainer",componentId:"sc-ebc93df8-0"})(["--spinner-size:",";display:inline-flex;justify-content:center;align-items:center;@media all and (display-mode:standalone){margin-bottom:30px;}"],(e=>e.$size?e.$size:"96px")),Xr=/*#__PURE__*/a.styled.div.withConfig({displayName:"SpinnerContainer",componentId:"sc-ebc93df8-1"})(["position:relative;height:var(--spinner-size);width:var(--spinner-size);opacity:1;animation:fadein 200ms ease;"]),Jr=/*#__PURE__*/a.styled.div.withConfig({displayName:"CenterIconContainer",componentId:"sc-ebc93df8-2"})(["position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;svg,img{width:calc(var(--spinner-size) * 0.4);height:calc(var(--spinner-size) * 0.4);border-radius:var(--privy-border-radius-full);}"]),ei=/*#__PURE__*/a.styled.div.withConfig({displayName:"CircleFixed",componentId:"sc-ebc93df8-3"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);&&{border:4px solid var(--privy-color-border-default);border-radius:50%;}"]),ti=/*#__PURE__*/a.styled.div.withConfig({displayName:"CircleRotate",componentId:"sc-ebc93df8-4"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);animation:spin 1200ms linear infinite;&&{border:4px solid;border-color:var(--privy-color-icon-subtle) transparent transparent transparent;border-radius:50%;}@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}"]);const ni=/*#__PURE__*/a.styled.div.withConfig({displayName:"ScreenRoot",componentId:"sc-cc9e9a32-0"})(["--screen-space:16px;--screen-space-lg:calc(var(--screen-space) * 1.5);position:relative;overflow:hidden;margin:0 calc(-1 * var(--screen-space));height:100%;border-radius:var(--privy-border-radius-lg);"]),ri=/*#__PURE__*/a.styled.div.withConfig({displayName:"ScreenRootInner",componentId:"sc-cc9e9a32-1"})(["display:flex;flex-direction:column;gap:calc(var(--screen-space) * 1.5);width:100%;background:var(--privy-color-background);padding:0 var(--screen-space-lg) var(--screen-space);height:100%;border-radius:var(--privy-border-radius-lg);"]),ii=/*#__PURE__*/a.styled.div.withConfig({displayName:"HeaderContainer",componentId:"sc-cc9e9a32-2"})(["position:relative;display:flex;flex-direction:column;"]),ai=/*#__PURE__*/a.styled(Hr).withConfig({displayName:"StyledModalHeader",componentId:"sc-cc9e9a32-3"})(["margin:0 -8px;"]),oi=/*#__PURE__*/a.styled.div.withConfig({displayName:"BodyContainer",componentId:"sc-cc9e9a32-4"})(["flex:1 1 auto;display:flex;flex-direction:column;overflow-y:auto;padding:3px;margin:-3px;&::-webkit-scrollbar{display:none;}scrollbar-gutter:stable both-edges;scrollbar-width:none;-ms-overflow-style:none;"," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;"],(({$colorScheme:e})=>"light"===e?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0)),si=/*#__PURE__*/a.styled.div.withConfig({displayName:"FooterContainer",componentId:"sc-cc9e9a32-5"})(["display:flex;flex-direction:column;gap:var(--screen-space-lg);"]);let li=/*#__PURE__*/a.styled.div.withConfig({displayName:"CenteredHeader",componentId:"sc-cc9e9a32-6"})(["text-align:center;display:flex;flex-direction:column;align-items:center;gap:var(--screen-space);"]),ci=/*#__PURE__*/a.styled.div.withConfig({displayName:"TitleContainer",componentId:"sc-cc9e9a32-7"})(["display:flex;flex-direction:column;gap:4px;"]),di=/*#__PURE__*/a.styled.h3.withConfig({displayName:"HeaderTitle",componentId:"sc-cc9e9a32-8"})(["&&{font-size:20px;line-height:32px;font-weight:500;color:var(--privy-color-foreground);margin:0;}"]),ui=/*#__PURE__*/a.styled.p.withConfig({displayName:"HeaderSubtitle",componentId:"sc-cc9e9a32-9"})(["&&{margin:0;font-size:16px;font-weight:300;line-height:24px;color:var(--privy-color-foreground);}"]),pi=/*#__PURE__*/a.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-cc9e9a32-10"})(["background:",";border-radius:50%;width:64px;height:64px;display:flex;align-items:center;justify-content:center;"],(({$variant:e})=>{switch(e){case"success":return"var(--privy-color-success-bg, #EAFCEF)";case"warning":return"var(--privy-color-warn, #FEF3C7)";case"error":return"var(--privy-color-error-bg, #FEE2E2)";case"loading":case"logo":return"transparent";default:return"var(--privy-color-background-2)"}})),hi=/*#__PURE__*/a.styled.div.withConfig({displayName:"LogoContainer",componentId:"sc-cc9e9a32-11"})(["display:flex;align-items:center;justify-content:center;margin-bottom:var(--screen-space);img,svg{max-height:90px;max-width:180px;}"]),gi=/*#__PURE__*/a.styled.div.withConfig({displayName:"LoadingWithIconContainer",componentId:"sc-cc9e9a32-12"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > :first-child{position:relative;}> div > :last-child{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);}"]);const mi=({children:t,...n})=>/*#__PURE__*/e.jsx(ni,{children:/*#__PURE__*/e.jsx(ri,{...n,children:t})});let yi=/*#__PURE__*/a.styled.div.withConfig({displayName:"ProgressBarContainer",componentId:"sc-cc9e9a32-13"})(["position:absolute;top:0;left:calc(-1 * var(--screen-space-lg));width:calc(100% + calc(var(--screen-space-lg) * 2));height:4px;background:var(--privy-color-background-2);border-top-left-radius:inherit;border-top-right-radius:inherit;overflow:hidden;"]),fi=/*#__PURE__*/a.styled(xr).withConfig({displayName:"StyledBlobbyFooter",componentId:"sc-cc9e9a32-14"})(["padding:0;&& a{padding:0;color:var(--privy-color-foreground-3);}"]),xi=/*#__PURE__*/a.styled.div.withConfig({displayName:"ProgressBarFill",componentId:"sc-cc9e9a32-15"})(["height:100%;width:","%;background:var(--privy-color-foreground-3);border-radius:2px;transition:width 300ms ease-in-out;"],(({pct:e})=>e)),vi=({step:t})=>t?/*#__PURE__*/e.jsx(yi,{children:/*#__PURE__*/e.jsx(xi,{pct:Math.min(100,t.current/t.total*100)})}):null;mi.Header=({title:t,subtitle:n,icon:r,iconVariant:i,iconLoadingStatus:a,showBack:o,onBack:s,showInfo:l,onInfo:c,showClose:d,onClose:u,step:p,...h})=>/*#__PURE__*/e.jsxs(ii,{...h,children:[/*#__PURE__*/e.jsx(ai,{backFn:o?s:void 0,infoFn:l?c:void 0,onClose:d?u:void 0,closeable:d}),(r||i||t||n)&&/*#__PURE__*/e.jsxs(li,{children:[r||i?/*#__PURE__*/e.jsx(mi.Icon,{icon:r,variant:i,loadingStatus:a}):null,/*#__PURE__*/e.jsxs(ci,{children:[t&&/*#__PURE__*/e.jsx(di,{children:t}),n&&/*#__PURE__*/e.jsx(ui,{children:n})]})]}),p&&/*#__PURE__*/e.jsx(vi,{step:p})]}),mi.Body=/*#__PURE__*/le.default.forwardRef((({children:t,...n},r)=>/*#__PURE__*/e.jsx(oi,{ref:r,...n,children:t}))),mi.Body.displayName="Screen.Body",mi.Footer=({children:t,...n})=>/*#__PURE__*/e.jsx(si,{...n,children:t}),mi.Actions=({children:t,...n})=>/*#__PURE__*/e.jsx(wi,{...n,children:t}),mi.HelpText=({children:t,...n})=>/*#__PURE__*/e.jsx(Ci,{...n,children:t}),mi.Watermark=()=>/*#__PURE__*/e.jsx(fi,{}),mi.Icon=({icon:t,variant:n="subtle",loadingStatus:r})=>"logo"===n&&t?"string"==typeof t?/*#__PURE__*/e.jsx(hi,{children:/*#__PURE__*/e.jsx("img",{src:t,alt:""})}):/*#__PURE__*/le.default.isValidElement(t)?/*#__PURE__*/e.jsx(hi,{children:t}):
5
- /*#__PURE__*/e.jsx(hi,{children:/*#__PURE__*/le.default.createElement(t)}):"loading"===n?t?
6
- /*#__PURE__*/e.jsx(gi,{children:/*#__PURE__*/e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[/*#__PURE__*/e.jsx(Cr,{success:r?.success,fail:r?.fail}),"string"==typeof t?
3
+ /*#__PURE__*/ /*#__PURE__*/e.jsxs(yr,{children:["By logging in I agree to the"," ",n&&/*#__PURE__*/e.jsx("a",{href:n,target:"_blank",children:i?"Terms":"Terms of Service"}),i&&" & ",t&&/*#__PURE__*/e.jsx("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}const xr=({className:t})=>{let{appearance:n}=qn();/*#__PURE__*/return e.jsx(wr,{className:t,children:n.footerLogo??/*#__PURE__*/e.jsx(vr,{href:"https://www.privy.io/",target:"_blank",id:"protected-by-privy",children:/*#__PURE__*/e.jsx(mr,{color:"currentColor",height:13,width:150})})})};let vr=/*#__PURE__*/i.styled.a.withConfig({displayName:"PrivyLink",componentId:"sc-ff3bd734-1"})(["&&{padding:0;color:var(--privy-color-foreground-3);}"]);const wr=/*#__PURE__*/i.styled.div.withConfig({displayName:"ModalFooter",componentId:"sc-ff3bd734-2"})(["display:flex;align-items:center;justify-content:center;padding-top:8px;padding-bottom:12px;gap:8px;font-size:13px;&& a{padding:0.5rem 0;&:hover{text-decoration:none;}}@media all and (display-mode:standalone){padding-bottom:30px;}"]),Cr=({success:t,fail:n})=>/*#__PURE__*/e.jsxs(jr,{children:[/*#__PURE__*/e.jsx(br,{children:/*#__PURE__*/e.jsx(Tr,{className:t?"success":n?"fail":""})}),/*#__PURE__*/e.jsx(br,{children:/*#__PURE__*/e.jsx(kr,{className:t?"success":n?"fail":""})})]});let br=/*#__PURE__*/i.styled.span.withConfig({displayName:"PositionedAbsoluteLoader",componentId:"sc-aba6339d-0"})(["&&{position:absolute;top:0;left:0;z-index:2;}"]),jr=/*#__PURE__*/i.styled.span.withConfig({displayName:"ConnectionLoaderContainer",componentId:"sc-aba6339d-1"})(["position:relative;width:82px;height:82px;display:inline-block;"]);const kr=/*#__PURE__*/i.styled.span.withConfig({displayName:"Loader",componentId:"sc-aba6339d-2"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;}@keyframes rotation{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}&&&.success{border-color:var(--privy-color-icon-success);border-bottom-color:var(--privy-color-icon-success);}&&&.fail{border-color:var(--privy-color-icon-error);border-bottom-color:var(--privy-color-icon-error);}"],(e=>e.color??"var(--privy-color-icon-subtle)")),Tr=/*#__PURE__*/i.styled(kr).withConfig({displayName:"LoaderFaint",componentId:"sc-aba6339d-3"})(["&&{border-bottom-color:",";border-color:",";animation:none;opacity:0.5;}"],(e=>e.color??"var(--privy-color-border-default)"),(e=>e.color??"var(--privy-color-border-default)")),Ar=t=>/*#__PURE__*/e.jsx(Sr,{color:t.color||"var(--privy-color-foreground-3)"});let Sr=/*#__PURE__*/i.styled(kr).withConfig({displayName:"StyledButtonLoader",componentId:"sc-aba6339d-4"})(["&&{height:1rem;width:1rem;margin:2px 0;border-width:1.5px;transition:border-color 200ms ease;}"]);const Er=({variant:t="primary",size:n="lg",children:r,success:a,...i})=>{switch(t){case"secondary":/*#__PURE__*/return e.jsx(Fr,{size:n,...i,children:r});case"error":/*#__PURE__*/return e.jsx(Fr,{$warn:!0,size:n,...i,children:r});case"muted":/*#__PURE__*/return e.jsx(Lr,{size:n,...i,children:r});default:/*#__PURE__*/return e.jsx(Pr,{size:n,success:a,...i,children:r})}},Ir=/*#__PURE__*/i.styled.button.withConfig({displayName:"BaseButton",componentId:"sc-e537b447-0"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;user-select:none;&{width:auto;cursor:pointer;border-radius:",";font-size:14px;font-style:normal;font-weight:500;line-height:22px;letter-spacing:-0.016px;}&&{height:",";padding:0 ",";}"],(({$size:e})=>"sm"===e?"6px":"var(--privy-border-radius-sm)"),(({$size:e})=>"sm"===e?"28px":"48px"),(({$size:e})=>"sm"===e?"10px":"16px")),Pr=({children:t,loading:n,disabled:r,success:a,size:i="lg",loadingText:o="Loading...",as:s,onClick:l,...c})=>{let d="a"===s,u=!(!n&&!r);/*#__PURE__*/return e.jsx(Mr,{as:s,disabled:d?void 0:u,"aria-disabled":d?u:void 0,$success:a,$size:i,onClick:e=>{d&&u?e.preventDefault():l?.(e)},...c,children:n?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ar,{}),o?/*#__PURE__*/e.jsx("span",{style:{marginLeft:"8px"},children:o}):null]}):t})},Nr=({children:t,loading:n,disabled:r,...a})=>/*#__PURE__*/e.jsx(_r,{disabled:r,...a,children:n?/*#__PURE__*/e.jsx(Ar,{color:"var(--privy-color-foreground-accent)"}):t});let _r=/*#__PURE__*/i.styled(Ir).withConfig({displayName:"StyledPrimaryButtonWithoutGray",componentId:"sc-e537b447-1"})(["position:relative;&&{background-color:var(--privy-color-accent);color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:var(--privy-color-accent-dark);}&:active{background-color:var(--privy-color-accent-dark);}&:disabled,&:hover:disabled,&:active:disabled{cursor:not-allowed;color:var(--privy-color-foreground-disabled);background-color:var(--privy-color-accent-dark);}"]),Mr=/*#__PURE__*/i.styled(Ir).withConfig({displayName:"StyledPrimaryButton",componentId:"sc-e537b447-2"})(["position:relative;&&{background-color:",";color:var(--privy-color-foreground-accent);transition:background-color 200ms ease;}&:hover{background-color:",";}&:active{background-color:",";}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;}&:disabled{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent-dark)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent-dark)"),(e=>e.disabled&&/*#__PURE__*/i.css(["&&&,&&&:hover,&&&:active{background-color:var(--privy-color-background-2);border:1px solid var(--privy-color-border-default);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"])));const Fr=({children:t,loading:n,disabled:r,size:a="lg",loadingText:i="Loading...",as:o,onClick:s,...l})=>{let c="a"===o,d=!(!n&&!r);/*#__PURE__*/return e.jsx(Wr,{as:o,disabled:c?void 0:d,"aria-disabled":c?d:void 0,$size:a,onClick:e=>{c&&d?e.preventDefault():s?.(e)},...l,children:n?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ar,{}),i?/*#__PURE__*/e.jsx("span",{style:{marginLeft:"8px"},children:i}):null]}):t})},Lr=({children:t,loading:n,disabled:r,size:a="lg",loadingText:i="Loading...",as:o,onClick:s,...l})=>{let c="a"===o,d=!(!n&&!r);/*#__PURE__*/return e.jsx(Dr,{as:o,disabled:c?void 0:d,"aria-disabled":c?d:void 0,$size:a,onClick:e=>{c&&d?e.preventDefault():s?.(e)},...l,children:n?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ar,{}),i?/*#__PURE__*/e.jsx("span",{style:{marginLeft:"8px"},children:i}):null]}):t})};let Wr=/*#__PURE__*/i.styled(Ir).withConfig({displayName:"StyledSecondaryButton",componentId:"sc-e537b447-3"})(["&&{border-width:1px;border-style:solid;border-color:",";background-color:var(--privy-color-background);color:",";transition:border-color 200ms ease,color 200ms ease,background-color 200ms ease;}&:hover{border-color:",";background-color:",";color:",";}&:active{border-color:",";background-color:",";color:",";}&:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-border-interactive-hover)"),(e=>e.$warn?"var(--privy-color-error-light)":"var(--privy-color-info-bg-hover)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.$warn?"var(--privy-color-border-error)":"var(--privy-color-border-interactive)"),(e=>e.$warn?"var(--privy-color-error-bg-hover)":"var(--privy-color-info-bg)"),(e=>e.$warn?"var(--privy-color-error-dark)":"var(--privy-color-accent)"),(e=>e.disabled&&/*#__PURE__*/i.css(["&&&,&&&:hover,&&&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"]))),Dr=/*#__PURE__*/i.styled(Ir).withConfig({displayName:"StyledMutedButton",componentId:"sc-e537b447-4"})(["&&{border-width:1px;border-style:solid;border-color:var(--privy-color-border-default);background-color:transparent;color:var(--privy-color-text-muted);transition:border-color 200ms ease,color 200ms ease,background-color 200ms ease;}&:hover{border-color:var(--privy-color-border-default);background-color:var(--privy-color-info-bg-hover);color:var(--privy-color-foreground-2);}&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-info-bg);color:var(--privy-color-foreground-2);}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;}&:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}&:hover:disabled,&:active:disabled{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}",""],(e=>e.disabled&&/*#__PURE__*/i.css(["&&&,&&&:hover,&&&:active{border-color:var(--privy-color-border-default);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-disabled);cursor:not-allowed;}"])));const Rr=({children:t,onClick:n,disabled:r,isSubmitting:a,...i})=>/*#__PURE__*/e.jsxs(Or,{$isSubmitting:a,onClick:n,disabled:r,...i,children:[/*#__PURE__*/e.jsx("span",{children:t}),
4
+ /*#__PURE__*/e.jsx("span",{children:/*#__PURE__*/e.jsx(Ar,{})})]});let Or=/*#__PURE__*/i.styled.button.withConfig({displayName:"StyledEmbeddedButton",componentId:"sc-e537b447-7"})(["&&{color:var(--privy-color-accent);font-size:16px;font-style:normal;font-weight:500;line-height:24px;cursor:pointer;border-radius:0px var(--privy-border-radius-mdlg) var(--privy-border-radius-mdlg) 0px;border:none;transition:color 200ms ease;@media (min-width:441px){font-size:14px;}:hover{color:var(--privy-color-accent-dark);}&& > :first-child{opacity:",";}&& > :last-child{position:absolute;display:flex;top:50%;left:50%;transform:translate3d(-50%,-50%,0);opacity:",";}:disabled,:hover:disabled{color:var(--privy-color-foreground-disabled);cursor:not-allowed;}}"],(e=>e.$isSubmitting?0:1),(e=>e.$isSubmitting?1:0));const Br=({backFn:t})=>/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Vr,{onClick:t,children:/*#__PURE__*/e.jsx(ue.default,{height:"16px",width:"16px",strokeWidth:2})})}),Ur=({infoFn:t})=>/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx($r,{"aria-label":"info",onClick:t,children:/*#__PURE__*/e.jsx(pe.default,{height:"22px",width:"22px",strokeWidth:2})})}),zr=t=>/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Vr,{"aria-label":"close modal",onClick:t.onClose,children:/*#__PURE__*/e.jsx(he.default,{height:"16px",width:"16px",strokeWidth:2})})}),Hr=({backFn:t,infoFn:n,onClose:a,title:i,closeable:o=!0,className:s})=>{let{closePrivyModal:l}=r.usePrivyInternal(),c=qn();/*#__PURE__*/return e.jsxs(qr,{className:s,children:[/*#__PURE__*/e.jsxs(Gr,{children:[t&&/*#__PURE__*/e.jsx(Br,{backFn:t}),n&&/*#__PURE__*/e.jsx(Ur,{infoFn:n})]}),i&&/*#__PURE__*/e.jsx(Zr,{id:"privy-dialog-title",children:i}),/*#__PURE__*/e.jsx(Yr,{children:!c.render.standalone&&o&&/*#__PURE__*/e.jsx(zr,{onClose:a||(()=>l())})})]})};let Vr=/*#__PURE__*/i.styled.button.withConfig({displayName:"StyledButton",componentId:"sc-e033e17a-0"})(["&&{cursor:pointer;display:flex;opacity:0.6;background-color:var(--privy-color-background-2);border-radius:var(--privy-border-radius-full);padding:4px;> svg{margin:auto;color:var(--privy-color-foreground);}:hover{opacity:1;}}"]),$r=/*#__PURE__*/i.styled(Vr).withConfig({displayName:"TransparentStyledButton",componentId:"sc-e033e17a-1"})(["&&{background-color:transparent;}"]),qr=/*#__PURE__*/i.styled.div.withConfig({displayName:"StyledHeader",componentId:"sc-e033e17a-2"})(["padding:16px 0;display:flex;align-items:center;justify-content:space-between;h2{font-size:16px;line-height:24px;font-weight:600;color:var(--privy-color-foreground);}"]),Gr=/*#__PURE__*/i.styled.div.withConfig({displayName:"LeftActionContainer",componentId:"sc-e033e17a-3"})(["flex:1;align-items:center;display:flex;gap:8px;"]),Yr=/*#__PURE__*/i.styled.div.withConfig({displayName:"RightActionContainer",componentId:"sc-e033e17a-4"})(["flex:1;display:flex;justify-content:flex-end;"]),Zr=/*#__PURE__*/i.styled.div.withConfig({displayName:"TitleContainer",componentId:"sc-e033e17a-5"})(["overflow:hidden;white-space:nowrap;max-width:100%;text-overflow:ellipsis;text-align:center;color:var(--privy-color-foreground-2);"]);const Kr=({size:t,centerIcon:n})=>/*#__PURE__*/e.jsx(Qr,{$size:t,children:/*#__PURE__*/e.jsxs(Xr,{children:[/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(ta,{}),n?/*#__PURE__*/e.jsx(Jr,{children:n}):null]})});let Qr=/*#__PURE__*/i.styled.div.withConfig({displayName:"LoadingContainer",componentId:"sc-ebc93df8-0"})(["--spinner-size:",";display:inline-flex;justify-content:center;align-items:center;@media all and (display-mode:standalone){margin-bottom:30px;}"],(e=>e.$size?e.$size:"96px")),Xr=/*#__PURE__*/i.styled.div.withConfig({displayName:"SpinnerContainer",componentId:"sc-ebc93df8-1"})(["position:relative;height:var(--spinner-size);width:var(--spinner-size);opacity:1;animation:fadein 200ms ease;"]),Jr=/*#__PURE__*/i.styled.div.withConfig({displayName:"CenterIconContainer",componentId:"sc-ebc93df8-2"})(["position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;svg,img{width:calc(var(--spinner-size) * 0.4);height:calc(var(--spinner-size) * 0.4);border-radius:var(--privy-border-radius-full);}"]),ea=/*#__PURE__*/i.styled.div.withConfig({displayName:"CircleFixed",componentId:"sc-ebc93df8-3"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);&&{border:4px solid var(--privy-color-border-default);border-radius:50%;}"]),ta=/*#__PURE__*/i.styled.div.withConfig({displayName:"CircleRotate",componentId:"sc-ebc93df8-4"})(["position:absolute;top:0;right:0;bottom:0;left:0;width:var(--spinner-size);height:var(--spinner-size);animation:spin 1200ms linear infinite;&&{border:4px solid;border-color:var(--privy-color-icon-subtle) transparent transparent transparent;border-radius:50%;}@keyframes spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}"]);const na=/*#__PURE__*/i.styled.div.withConfig({displayName:"ScreenRoot",componentId:"sc-cc9e9a32-0"})(["--screen-space:16px;--screen-space-lg:calc(var(--screen-space) * 1.5);position:relative;overflow:hidden;margin:0 calc(-1 * var(--screen-space));height:100%;border-radius:var(--privy-border-radius-lg);"]),ra=/*#__PURE__*/i.styled.div.withConfig({displayName:"ScreenRootInner",componentId:"sc-cc9e9a32-1"})(["display:flex;flex-direction:column;gap:calc(var(--screen-space) * 1.5);width:100%;background:var(--privy-color-background);padding:0 var(--screen-space-lg) var(--screen-space);height:100%;border-radius:var(--privy-border-radius-lg);"]),aa=/*#__PURE__*/i.styled.div.withConfig({displayName:"HeaderContainer",componentId:"sc-cc9e9a32-2"})(["position:relative;display:flex;flex-direction:column;"]),ia=/*#__PURE__*/i.styled(Hr).withConfig({displayName:"StyledModalHeader",componentId:"sc-cc9e9a32-3"})(["margin:0 -8px;"]),oa=/*#__PURE__*/i.styled.div.withConfig({displayName:"BodyContainer",componentId:"sc-cc9e9a32-4"})(["flex:1 1 auto;display:flex;flex-direction:column;overflow-y:auto;padding:3px;margin:-3px;&::-webkit-scrollbar{display:none;}scrollbar-gutter:stable both-edges;scrollbar-width:none;-ms-overflow-style:none;"," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;"],(({$colorScheme:e})=>"light"===e?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0)),sa=/*#__PURE__*/i.styled.div.withConfig({displayName:"FooterContainer",componentId:"sc-cc9e9a32-5"})(["display:flex;flex-direction:column;gap:var(--screen-space-lg);"]);let la=/*#__PURE__*/i.styled.div.withConfig({displayName:"CenteredHeader",componentId:"sc-cc9e9a32-6"})(["text-align:center;display:flex;flex-direction:column;align-items:center;gap:var(--screen-space);"]),ca=/*#__PURE__*/i.styled.div.withConfig({displayName:"TitleContainer",componentId:"sc-cc9e9a32-7"})(["display:flex;flex-direction:column;gap:4px;"]),da=/*#__PURE__*/i.styled.h3.withConfig({displayName:"HeaderTitle",componentId:"sc-cc9e9a32-8"})(["&&{font-size:20px;line-height:32px;font-weight:500;color:var(--privy-color-foreground);margin:0;}"]),ua=/*#__PURE__*/i.styled.p.withConfig({displayName:"HeaderSubtitle",componentId:"sc-cc9e9a32-9"})(["&&{margin:0;font-size:16px;font-weight:300;line-height:24px;color:var(--privy-color-foreground);}"]),pa=/*#__PURE__*/i.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-cc9e9a32-10"})(["background:",";border-radius:50%;width:64px;height:64px;display:flex;align-items:center;justify-content:center;"],(({$variant:e})=>{switch(e){case"success":return"var(--privy-color-success-bg, #EAFCEF)";case"warning":return"var(--privy-color-warn, #FEF3C7)";case"error":return"var(--privy-color-error-bg, #FEE2E2)";case"loading":case"logo":return"transparent";default:return"var(--privy-color-background-2)"}})),ha=/*#__PURE__*/i.styled.div.withConfig({displayName:"LogoContainer",componentId:"sc-cc9e9a32-11"})(["display:flex;align-items:center;justify-content:center;margin-bottom:var(--screen-space);img,svg{max-height:90px;max-width:180px;}"]),ga=/*#__PURE__*/i.styled.div.withConfig({displayName:"LoadingWithIconContainer",componentId:"sc-cc9e9a32-12"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > :first-child{position:relative;}> div > :last-child{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);}"]);const ma=({children:t,...n})=>/*#__PURE__*/e.jsx(na,{children:/*#__PURE__*/e.jsx(ra,{...n,children:t})});let ya=/*#__PURE__*/i.styled.div.withConfig({displayName:"ProgressBarContainer",componentId:"sc-cc9e9a32-13"})(["position:absolute;top:0;left:calc(-1 * var(--screen-space-lg));width:calc(100% + calc(var(--screen-space-lg) * 2));height:4px;background:var(--privy-color-background-2);border-top-left-radius:inherit;border-top-right-radius:inherit;overflow:hidden;"]),fa=/*#__PURE__*/i.styled(xr).withConfig({displayName:"StyledBlobbyFooter",componentId:"sc-cc9e9a32-14"})(["padding:0;&& a{padding:0;color:var(--privy-color-foreground-3);}"]),xa=/*#__PURE__*/i.styled.div.withConfig({displayName:"ProgressBarFill",componentId:"sc-cc9e9a32-15"})(["height:100%;width:","%;background:var(--privy-color-foreground-3);border-radius:2px;transition:width 300ms ease-in-out;"],(({pct:e})=>e)),va=({step:t})=>t?/*#__PURE__*/e.jsx(ya,{children:/*#__PURE__*/e.jsx(xa,{pct:Math.min(100,t.current/t.total*100)})}):null;ma.Header=({title:t,subtitle:n,icon:r,iconVariant:a,iconLoadingStatus:i,showBack:o,onBack:s,showInfo:l,onInfo:c,showClose:d,onClose:u,step:p,...h})=>/*#__PURE__*/e.jsxs(aa,{...h,children:[/*#__PURE__*/e.jsx(ia,{backFn:o?s:void 0,infoFn:l?c:void 0,onClose:d?u:void 0,closeable:d}),(r||a||t||n)&&/*#__PURE__*/e.jsxs(la,{children:[r||a?/*#__PURE__*/e.jsx(ma.Icon,{icon:r,variant:a,loadingStatus:i}):null,/*#__PURE__*/e.jsxs(ca,{children:[t&&/*#__PURE__*/e.jsx(da,{children:t}),n&&/*#__PURE__*/e.jsx(ua,{children:n})]})]}),p&&/*#__PURE__*/e.jsx(va,{step:p})]}),ma.Body=/*#__PURE__*/le.default.forwardRef((({children:t,...n},r)=>/*#__PURE__*/e.jsx(oa,{ref:r,...n,children:t}))),ma.Body.displayName="Screen.Body",ma.Footer=({children:t,...n})=>/*#__PURE__*/e.jsx(sa,{...n,children:t}),ma.Actions=({children:t,...n})=>/*#__PURE__*/e.jsx(wa,{...n,children:t}),ma.HelpText=({children:t,...n})=>/*#__PURE__*/e.jsx(Ca,{...n,children:t}),ma.Watermark=()=>/*#__PURE__*/e.jsx(fa,{}),ma.Icon=({icon:t,variant:n="subtle",loadingStatus:r})=>"logo"===n&&t?"string"==typeof t?/*#__PURE__*/e.jsx(ha,{children:/*#__PURE__*/e.jsx("img",{src:t,alt:""})}):/*#__PURE__*/le.default.isValidElement(t)?/*#__PURE__*/e.jsx(ha,{children:t}):
5
+ /*#__PURE__*/e.jsx(ha,{children:/*#__PURE__*/le.default.createElement(t)}):"loading"===n?t?
6
+ /*#__PURE__*/e.jsx(ga,{children:/*#__PURE__*/e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[/*#__PURE__*/e.jsx(Cr,{success:r?.success,fail:r?.fail}),"string"==typeof t?
7
7
  /*#__PURE__*/e.jsx("span",{style:{background:`url('${t}') 0 0 / contain`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"contain"}}):/*#__PURE__*/le.default.isValidElement(t)?
8
8
  /*#__PURE__*/le.default.cloneElement(t,{style:{width:"38px",height:"38px"}}):
9
9
  /*#__PURE__*/le.default.createElement(t,{style:{width:"38px",height:"38px"}})]})}):
10
- /*#__PURE__*/e.jsx(pi,{$variant:n,children:/*#__PURE__*/e.jsx(Kr,{size:"64px"})}):/*#__PURE__*/e.jsx(pi,{$variant:n,children:t&&("string"==typeof t?
10
+ /*#__PURE__*/e.jsx(pa,{$variant:n,children:/*#__PURE__*/e.jsx(Kr,{size:"64px"})}):/*#__PURE__*/e.jsx(pa,{$variant:n,children:t&&("string"==typeof t?
11
11
  /*#__PURE__*/e.jsx("img",{src:t,alt:"",style:{width:"32px",height:"32px",borderRadius:"6px"}}):/*#__PURE__*/le.default.isValidElement(t)?t:
12
- /*#__PURE__*/le.default.createElement(t,{width:32,height:32,stroke:(()=>{switch(n){case"success":return"var(--privy-color-icon-success)";case"warning":return"var(--privy-color-icon-warning)";case"error":return"var(--privy-color-icon-error)";default:return"var(--privy-color-icon-muted)"}})(),strokeWidth:2}))});let wi=/*#__PURE__*/a.styled.div.withConfig({displayName:"ActionsContainer",componentId:"sc-cc9e9a32-16"})(["width:100%;display:flex;flex-direction:column;gap:calc(var(--screen-space) / 2);"]),Ci=/*#__PURE__*/a.styled.p.withConfig({displayName:"HelpTextContainer",componentId:"sc-cc9e9a32-17"})(["&&{margin:0;width:100%;text-align:center;color:var(--privy-color-foreground-3);font-size:14px;line-height:22px;& a{color:var(--privy-color-accent);}}"]);const bi=({primaryCta:t,secondaryCta:n,helpText:r,watermark:i=!0,children:a,...o})=>{let s=t||n?/*#__PURE__*/e.jsxs(e.Fragment,{children:[t&&(()=>{let{label:n,...r}=t,i=r.variant||"primary";/*#__PURE__*/return e.jsx(Er,{...r,variant:i,style:{width:"100%",...r.style},children:n})})(),n&&(()=>{let{label:t,...r}=n,i=r.variant||"secondary";/*#__PURE__*/return e.jsx(Er,{...r,variant:i,style:{width:"100%",...r.style},children:t})})()]}):null;/*#__PURE__*/return e.jsxs(mi,{id:o.id,className:o.className,children:[/*#__PURE__*/e.jsx(mi.Header,{...o}),a?/*#__PURE__*/e.jsx(mi.Body,{children:a}):null,r||s||i?/*#__PURE__*/e.jsxs(mi.Footer,{children:[r?/*#__PURE__*/e.jsx(mi.HelpText,{children:r}):null,s?/*#__PURE__*/e.jsx(mi.Actions,{children:s}):null,i?/*#__PURE__*/e.jsx(mi.Watermark,{}):null]}):null]})},ji=({label:t,children:n,valueStyles:r})=>/*#__PURE__*/e.jsxs(ki,{children:[/*#__PURE__*/e.jsx("div",{children:t}),/*#__PURE__*/e.jsx(Ti,{style:{...r},children:n})]});let ki=/*#__PURE__*/a.styled.div.withConfig({displayName:"StyledDetailsRow",componentId:"sc-4ebfdd45-0"})(["display:flex;align-items:center;justify-content:space-between;width:100%;> :first-child{color:var(--privy-color-foreground-3);text-align:left;}> :last-child{color:var(--privy-color-foreground-2);text-align:right;}"]),Ti=/*#__PURE__*/a.styled.div.withConfig({displayName:"ValueWrapper",componentId:"sc-4ebfdd45-1"})(["font-size:14px;line-height:100%;display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-full);background-color:var(--privy-color-background-2);padding:4px 8px;"]),Ai=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),Si=e=>Ai.format(e);const Ei=(e,t)=>{let n=Si(t*parseFloat(e));return"$0.00"!==n?n:"<$0.01"},Ii=(e,t)=>{let n=Si(t*parseFloat(l.formatEther(e)));return"$0.00"===n?"<$0.01":n},Pi=(e,t,n=6,r=!1)=>`${Ni(e,n,r)} ${t}`,Ni=(e,t=6,n=!1)=>{let r=parseFloat(l.formatEther(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return n?r:`${"0"===r?"<0.001":r}`},_i=e=>e.reduce(((e,t)=>e+t),0n),Mi=(e,t)=>{let{chains:n}=r.usePrivyInternal(),i=`https://etherscan.io/address/${t}`,a=`${((e,t)=>{let n=Number(e),r=t.find((e=>e.id===n));if(!r)throw new d.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url})(e,n)}/address/${t}`;if(!a)return i;try{new URL(a)}catch{return i}return a},Fi=1e9,Li={"solana:mainnet":{EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:{symbol:"USDC",decimals:6,address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:{symbol:"USDT",decimals:6,address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},"solana:devnet":{"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU":{symbol:"USDC",decimals:6,address:"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"},EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS:{symbol:"USDT",decimals:6,address:"EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},"solana:testnet":{}};function Wi(e,t){let n=parseFloat(e.toString())/Fi,r=Di.format(t*n);return"$0.00"===r?"<$0.01":r}let Di=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2});function Ri(e,t=6,n=!1,r=!1){let i=(parseFloat(e.toString())/1e9).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),a=r?"":" SOL";return n?`${i}${a}`:`${"0"===i?"<0.001":i}${a}`}const Oi=({weiQuantities:t,tokenPrice:n,tokenSymbol:r})=>{let i=_i(t),a=n?Ii(i,n):void 0,o=Pi(i,r);/*#__PURE__*/return e.jsx(Ui,{children:a||o})},Bi=({weiQuantities:t,tokenPrice:n,tokenSymbol:r})=>{let i=_i(t),a=n?Ii(i,n):void 0,o=Pi(i,r);/*#__PURE__*/return e.jsx(Ui,{children:a?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(zi,{children:"USD"}),"<$0.01"===a?
13
- /*#__PURE__*/e.jsxs(Vi,{children:[/*#__PURE__*/e.jsx(Hi,{children:"<"}),"$0.01"]}):a]}):o})};let Ui=/*#__PURE__*/a.styled.span.withConfig({displayName:"StyledPriceDisplay",componentId:"sc-3cd56c8a-0"})(["font-size:14px;line-height:140%;display:flex;gap:4px;align-items:center;"]),zi=/*#__PURE__*/a.styled.span.withConfig({displayName:"StyledPriceUnit",componentId:"sc-3cd56c8a-1"})(["font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);"]),Hi=/*#__PURE__*/a.styled.span.withConfig({displayName:"TinyLessThan",componentId:"sc-3cd56c8a-2"})(["font-size:10px;"]),Vi=/*#__PURE__*/a.styled.span.withConfig({displayName:"FlexCenter",componentId:"sc-3cd56c8a-3"})(["display:flex;align-items:center;"]);const $i=/*#__PURE__*/a.styled.div.withConfig({displayName:"BottomPusherContainer",componentId:"sc-cb963810-0"})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;margin-top:auto;gap:16px;flex-grow:100;"]),qi=/*#__PURE__*/a.styled.div.withConfig({displayName:"CenteredItem",componentId:"sc-cb963810-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;flex-grow:1;width:100%;"]),Gi=/*#__PURE__*/a.styled.div.withConfig({displayName:"HorizontallyCenteredItem",componentId:"sc-cb963810-2"})(["display:flex;flex-direction:column;align-items:center;width:100%;"]),Yi=/*#__PURE__*/a.styled(qi).withConfig({displayName:"CenteredItemWithPadding",componentId:"sc-cb963810-3"})(["padding:20px 0;"]),Zi=/*#__PURE__*/a.styled(qi).withConfig({displayName:"CenteredItemWithGap",componentId:"sc-cb963810-4"})(["gap:16px;"]),Ki=/*#__PURE__*/a.styled.div.withConfig({displayName:"FlexContainer",componentId:"sc-cb963810-5"})(["display:flex;flex-direction:column;width:100%;"]),Qi=/*#__PURE__*/a.styled.div.withConfig({displayName:"FixedGappedContainer",componentId:"sc-cb963810-6"})(["display:flex;flex-direction:column;gap:8px;"]),Xi=/*#__PURE__*/a.styled.div.withConfig({displayName:"StyledCalloutSection",componentId:"sc-cb963810-8"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;padding:16px;margin-top:16px;margin-bottom:16px;width:100%;background:var(--privy-color-background-2);border-radius:var(--privy-border-radius-md);&& h4{color:var(--privy-color-foreground-3);font-size:14px;text-decoration:underline;font-weight:medium;}&& p{color:var(--privy-color-foreground-3);font-size:14px;}"]),Ji=/*#__PURE__*/a.styled.div.withConfig({displayName:"RefactorSpacerTop",componentId:"sc-cb963810-9"})(["height:16px;"]),ea=/*#__PURE__*/a.styled.div.withConfig({displayName:"RefactorSpacerBottom",componentId:"sc-cb963810-10"})(["height:12px;"]),ta=/*#__PURE__*/a.styled.div.withConfig({displayName:"ConfigurableSpacer",componentId:"sc-cb963810-12"})(["height:","px;"],(e=>e.height??"12")),na=({gas:t,tokenPrice:n,tokenSymbol:r})=>/*#__PURE__*/e.jsxs(Ki,{style:{paddingBottom:"12px"},children:[/*#__PURE__*/e.jsxs(ia,{children:[/*#__PURE__*/e.jsx(oa,{children:"Est. Fees"}),/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Bi,{weiQuantities:[BigInt(t)],tokenPrice:n,tokenSymbol:r})})]}),n&&/*#__PURE__*/e.jsx(aa,{children:`${Pi(BigInt(t),r)}`})]}),ra=({value:t,gas:n,tokenPrice:r,tokenSymbol:i})=>{let a=BigInt(t??0)+BigInt(n);/*#__PURE__*/return e.jsxs(Ki,{children:[/*#__PURE__*/e.jsxs(ia,{children:[/*#__PURE__*/e.jsx(oa,{children:"Total (including fees)"}),/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Bi,{weiQuantities:[BigInt(t||0),BigInt(n)],tokenPrice:r,tokenSymbol:i})})]}),r&&/*#__PURE__*/e.jsx(aa,{children:Pi(a,i)})]})};let ia=/*#__PURE__*/a.styled.div.withConfig({displayName:"TransactionTotalRow",componentId:"sc-f8ef9b74-0"})(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-top:4px;"]),aa=/*#__PURE__*/a.styled.div.withConfig({displayName:"ValueConversionRow",componentId:"sc-f8ef9b74-1"})(["display:flex;flex-direction:row;height:12px;font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);font-weight:400;"]),oa=/*#__PURE__*/a.styled.div.withConfig({displayName:"TotalText",componentId:"sc-f8ef9b74-2"})(["font-size:14px;line-height:22.4px;font-weight:400;"]);const sa=/*#__PURE__*/n.createContext(void 0),la=/*#__PURE__*/n.createContext(void 0),ca=({defaultValue:t,children:r})=>{let[i,a]=n.useState(t||null);/*#__PURE__*/return e.jsx(sa.Provider,{value:{activePanel:i,togglePanel:e=>{a(i===e?null:e)}},children:/*#__PURE__*/e.jsx(ga,{children:r})})},da=({value:t,children:r})=>{let{activePanel:i,togglePanel:a}=n.useContext(sa),o=i===t;/*#__PURE__*/return e.jsx(la.Provider,{value:{onToggle:()=>a(t),value:t},children:/*#__PURE__*/e.jsx(xa,{isActive:o?"true":"false","data-open":String(o),children:r})})},ua=({children:t})=>{let{activePanel:r}=n.useContext(sa),{onToggle:i,value:a}=n.useContext(la),o=r===a;/*#__PURE__*/
14
- return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(ma,{onClick:i,"data-open":String(o),children:[/*#__PURE__*/e.jsx(fa,{children:t}),/*#__PURE__*/e.jsx(Ca,{isactive:o?"true":"false",children:/*#__PURE__*/e.jsx(Ve.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),/*#__PURE__*/e.jsx(ya,{})]})},pa=({children:t})=>{let{activePanel:r}=n.useContext(sa),{value:i}=n.useContext(la);/*#__PURE__*/return e.jsx(va,{"data-open":String(r===i),children:/*#__PURE__*/e.jsx(wa,{children:t})})},ha=({children:t})=>{let{activePanel:r}=n.useContext(sa),{value:i}=n.useContext(la);/*#__PURE__*/return e.jsx(wa,{children:"function"==typeof t?t({isActive:r===i}):t})};let ga=/*#__PURE__*/a.styled.div.withConfig({displayName:"AccordionRoot",componentId:"sc-d25f9267-0"})(["display:flex;flex-direction:column;width:100%;gap:8px;"]),ma=/*#__PURE__*/a.styled.div.withConfig({displayName:"AccordionTriggerContainer",componentId:"sc-d25f9267-1"})(["display:flex;justify-content:space-between;align-items:center;width:100%;cursor:pointer;padding-bottom:8px;"]),ya=/*#__PURE__*/a.styled.div.withConfig({displayName:"AccordionDivider",componentId:"sc-d25f9267-2"})(["width:100%;&&{border-top:1px solid;border-color:var(--privy-color-foreground-4);}padding-bottom:12px;"]),fa=/*#__PURE__*/a.styled.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-d25f9267-3"})(["font-size:14px;font-weight:500;line-height:19.6px;width:100%;padding-right:8px;"]),xa=/*#__PURE__*/a.styled.div.withConfig({displayName:"AccordionPanelContainer",componentId:"sc-d25f9267-4"})(["display:flex;flex-direction:column;width:100%;overflow:hidden;padding:12px;&&{border:1px solid;border-color:var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);}"]),va=/*#__PURE__*/a.styled.div.withConfig({displayName:"AccordionContentContainer",componentId:"sc-d25f9267-5"})(["position:relative;overflow:hidden;transition:max-height 25ms ease-out;&[data-open='true']{max-height:700px;}&[data-open='false']{max-height:0;}"]),wa=/*#__PURE__*/a.styled.div.withConfig({displayName:"ContentWrapper",componentId:"sc-d25f9267-6"})(["display:flex;flex-direction:column;gap:12px;flex:1 1 auto;min-height:1px;"]),Ca=/*#__PURE__*/a.styled.div.withConfig({displayName:"IconWrapper",componentId:"sc-d25f9267-7"})(["transform:",";"],(e=>"true"===e.isactive?"rotate(180deg)":"rotate(0deg)"));function ba(e,t){return`https://explorer.solana.com/account/${e}?chain=${t}`}const ja=t=>/*#__PURE__*/e.jsx(ka,{href:"ethereum"===t.chainType?Mi(t.chainId,t.walletAddress):ba(t.walletAddress,t.chainId),target:"_blank",children:Dt(t.walletAddress)});let ka=/*#__PURE__*/a.styled.a.withConfig({displayName:"StyledLink",componentId:"sc-dd6c0f9f-0"})(["&:hover{text-decoration:underline;}"]);const Ta=({from:t,to:n,txn:r,transactionInfo:i,tokenPrice:a,gas:o,tokenSymbol:s})=>{let l=BigInt(r?.value||0);/*#__PURE__*/
15
- return e.jsx(ca,{...qn().render.standalone?{defaultValue:"details"}:{},children:/*#__PURE__*/e.jsxs(da,{value:"details",children:[/*#__PURE__*/e.jsx(ua,{children:/*#__PURE__*/e.jsxs(Aa,{children:[/*#__PURE__*/e.jsx("div",{children:i?.title||"Details"}),/*#__PURE__*/e.jsx(Sa,{children:/*#__PURE__*/e.jsx(Oi,{weiQuantities:[l],tokenPrice:a,tokenSymbol:s})})]})}),/*#__PURE__*/e.jsxs(pa,{children:[/*#__PURE__*/e.jsx(ji,{label:"From",children:/*#__PURE__*/e.jsx(ja,{walletAddress:t,chainId:r.chainId||1,chainType:"ethereum"})}),/*#__PURE__*/e.jsx(ji,{label:"To",children:/*#__PURE__*/e.jsx(ja,{walletAddress:n,chainId:r.chainId||1,chainType:"ethereum"})}),i&&i.action&&/*#__PURE__*/e.jsx(ji,{label:"Action",children:i.action}),o&&/*#__PURE__*/e.jsx(na,{value:r.value,gas:o,tokenPrice:a,tokenSymbol:s})]}),/*#__PURE__*/e.jsx(ha,{children:({isActive:t})=>/*#__PURE__*/e.jsx(ra,{value:r.value,displayFee:t,gas:o||"0x0",tokenPrice:a,tokenSymbol:s})})]})})};let Aa=/*#__PURE__*/a.styled.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-2eff9f5c-0"})(["display:flex;flex-direction:row;justify-content:space-between;"]),Sa=/*#__PURE__*/a.styled.div.withConfig({displayName:"TotalText",componentId:"sc-2eff9f5c-1"})(["flex-shrink:0;padding-left:8px;"]);const Ea=({enabled:e=!0}={})=>{let{showFiatPrices:t,getUsdPriceForSol:i}=r.usePrivyInternal(),[a,o]=n.useState(!0),[s,l]=n.useState(void 0),[c,d]=n.useState(void 0);return n.useEffect((()=>{(async()=>{if(t&&e)try{o(!0);let e=await i();e?d(e):l(Error("Unable to fetch SOL price"))}catch(e){l(e)}finally{o(!1)}else o(!1)})()}),[]),{solPrice:c,isSolPriceLoading:a,solPriceError:s}};function Ia(e){let{tokenPrice:t,isTokenPriceLoading:i,tokenPriceError:a}=(e=>{let{showFiatPrices:t,getUsdTokenPrice:i,chains:a}=r.usePrivyInternal(),[o,s]=n.useState(!0),[l,d]=n.useState(void 0),[u,p]=n.useState(void 0);return n.useEffect((()=>{e||=1;let n=c.addToDefaultChains(a).find((t=>t.id===Number(e)));(async()=>{if(t){if(!n)return s(!1),void d(Error(`Unable to fetch token price on chain id ${e}`));try{s(!0);let e=await i(n);e?p(e):d(Error(`Unable to fetch token price on chain id ${n.id}`))}catch(e){d(e)}finally{s(!1)}}else s(!1)})()}),[e]),{tokenPrice:u,isTokenPriceLoading:o,tokenPriceError:l}})("solana"===e?-1:e),{solPrice:o,isSolPriceLoading:s,solPriceError:l}=Ea({enabled:"solana"===e});return"solana"===e?{tokenPrice:o,isTokenPriceLoading:s,tokenPriceError:l}:{tokenPrice:t,isTokenPriceLoading:i,tokenPriceError:a}}const Pa=/*#__PURE__*/n.createContext(null);function Na(){let e=n.useContext(Pa);return null===e?(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1}):e}async function _a(e,t,n,r){let i=ee.toViemTransactionSerializable(e),a=await(async()=>r?await r():await t.prepareTransactionRequest({...i,account:{address:n,type:"json-rpc"}}))();return{...a,type:ee.STRING_TO_NUMBER_TXN_TYPE[a.type]}}let Ma=/*#__PURE__*/a.styled.div.withConfig({displayName:"StackedContainer",componentId:"sc-f7e7d474-0"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > span{position:absolute;left:-41px;top:-41px;}> div > :last-child{position:absolute;left:-19px;top:-19px;}"]);const Fa=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];class La extends Error{constructor(e,t){super(t),this.type=e}}function Wa(e){let t=e.type;return"string"==typeof t&&Fa.includes(t)}function Da(e){return Wa(e)&&"wallet_not_on_device"===e.type}const Ra=()=>window.open(void 0,void 0,Oa({w:440,h:680}));let Oa=({w:e,h:t})=>{let n=void 0!==window.screenLeft?window.screenLeft:window.screenX,r=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)+n},top=${(a-t)/2/(a/window.screen.availHeight)+r}`};const Ba=({title:t,description:n,children:r,...i})=>
16
- /*#__PURE__*/e.jsx(za,{...i,children:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("h3",{children:t}),"string"==typeof n?/*#__PURE__*/e.jsx("p",{children:n}):n,r]})}),Ua=({title:t,description:n,icon:r,children:i,...a})=>/*#__PURE__*/e.jsxs(Ha,{...a,children:[r||null,/*#__PURE__*/e.jsx("h3",{children:t}),n&&"string"==typeof n?/*#__PURE__*/e.jsx("p",{children:n}):n,i]});let za=/*#__PURE__*/a.styled.div.withConfig({displayName:"StyledSection",componentId:"sc-523a75d6-1"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;width:100%;margin-bottom:24px;&& h3{font-size:17px;color:var(--privy-color-foreground);}&& p{color:var(--privy-color-foreground-2);font-size:14px;}"]),Ha=/*#__PURE__*/a.styled(za).withConfig({displayName:"CenteredStyledSection",componentId:"sc-523a75d6-2"})(["align-items:center;text-align:center;gap:16px;h3{margin-bottom:24px;}"]);const Va=t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...t,children:[/*#__PURE__*/e.jsx("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsxs("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[/*#__PURE__*/e.jsx("stop",{stopColor:"#3E82F4"}),/*#__PURE__*/e.jsx("stop",{offset:1,stopColor:"#93DCF7"})]})})]}),$a=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{width:"16",height:"14",style:t,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/e.jsxs("g",{clipPath:"url(#clip0_2115_829)",children:[/*#__PURE__*/e.jsx("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),/*#__PURE__*/e.jsx("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),/*#__PURE__*/e.jsx("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),/*#__PURE__*/e.jsx("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),/*#__PURE__*/e.jsx("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),/*#__PURE__*/e.jsx("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2115_829",children:/*#__PURE__*/e.jsx("rect",{width:"16",height:"14",fill:"white"})})})]});async function qa({url:e,popup:t,provider:n}){return t.location=e,new Promise(((e,n)=>{function r(){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),r()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),r()),"PRIVY_OAUTH_ERROR"===t.data.type&&(n(t.data.error),r()))}window.addEventListener("message",i)}))}async function Ga({api:e,provider:t,stateCode:n,codeVerifier:r,authorizationCode:i}){if(!i||!n)throw new d.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===i)throw new d.PrivyClientError("User denied confirmation during OAuth flow");try{return(await e.post(d.recoveryOAuthAuthenticatePath,{authorization_code:i,state_code:n,code_verifier:r,provider:t})).access_token}catch(e){let t=d.formatApiError(e);if(t.privyErrorCode)throw new d.PrivyClientError(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new d.PrivyClientError("Invalid code during oauth flow.",void 0,d.PrivyErrorCode.OAUTH_USER_DENIED);throw new d.PrivyClientError("Invalid code during OAuth flow.",void 0,d.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}async function Ya({api:e,provider:t}){let n=pt(),r=ht(),i=await gt(n);try{return"icloud"===t?{url:(await e.post(d.recoveryOAuthInitICloudPath,{client_type:"web"})).url}:{url:(await e.post(d.recoveryOAuthInitPath,{redirect_to:window.location.href,code_challenge:i,state_code:r})).url,codeVerifier:n,stateCode:r,provider:t}}catch(e){throw d.formatApiError(e)}}const Za=(e,{chainType:t,walletIndex:n}={})=>e?.linkedAccounts.filter((e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==n&&e.walletIndex!==n||void 0!==t&&e.chainType!==t)))??[],Ka=async({user:e,accessToken:t,proxy:n,refreshSessionAndUser:r,privy:a,appConfig:o,recoverEmbeddedWallet:s,setUser:l,walletIndex:d,chainType:u,recoveryMethod:p,recoveryPassword:h,recoveryAccessToken:g})=>{if(0===d)if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await c.create(a,{request:{chain_type:u}});else if("ethereum"===u){let r=i.getPrivySolanaWallet(e);r&&await s({address:r.address}),await n.create({accessToken:t,solanaAddress:r?.address,recoveryMethod:p,recoveryPassword:h,recoveryAccessToken:g})}else{if("solana"!==u)throw Error("Invalid input to create wallet");{let r=i.getPrivyEthereumWallet(e);r&&await s({address:r.address}),await n.createSolana({accessToken:t,ethereumAddress:r?.address,recoveryMethod:p,recoveryPassword:h,recoveryAccessToken:g})}}else if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await c.create(a,{request:{chain_type:u}});else{let{entropyId:r,entropyIdVerifier:i}=Qt(e);await s(),await n.addWallet({accessToken:t,entropyId:r,entropyIdVerifier:i,chainType:u,hdWalletIndex:d})}let m=await r(),y=Za(m,{chainType:u,walletIndex:d})[0];return l(m),{user:m,account:y}},Qa=()=>{let{walletProxy:e,recoverEmbeddedWallet:t,setUser:n,refreshSessionAndUser:i,privy:a,client:o}=r.usePrivyInternal(),s=qn();return{create:async({walletIndex:r,chainType:l,latestUser:c,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})=>{let h=c;h||(h=await i());let g=await o.getAccessToken();if(!h||!g||!e)throw Error("User must be authenticated before creating a Privy wallet");return await Ka({appConfig:s,user:h,refreshSessionAndUser:i,privy:a,accessToken:g,proxy:e,recoverEmbeddedWallet:t,setUser:n,walletIndex:r,chainType:l,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})}}},Xa=({title:n,description:r,onClose:i})=>/*#__PURE__*/e.jsx(bi,{title:n,subtitle:r,icon:t.CheckCircle,iconVariant:"success",watermark:!0,onBack:i}),Ja={component:()=>{let{user:t}=i.usePrivyContext(),{closePrivyModal:a,isNewUserThisSession:o,updateWallets:s}=r.usePrivyInternal(),{data:l,onUserCloseViaDialogOrKeybindRef:c}=Xn(),d=qn(),{onSuccess:u,onFailure:p,callAuthOnSuccessOnClose:h}=l.createWallet,g=()=>{let e=i.getPrivyEthereumWallet(t)??i.getPrivySolanaWallet(t);t&&e?(s(),u({user:t,account:e})):p(Error("Failed to create wallet")),a({shouldCallAuthOnSuccess:h})};n.useEffect((()=>{let e=setTimeout(g,2500);return()=>clearTimeout(e)}),[]),c.current=g;let m=o?"Welcome"+(d?.name?` to ${d?.name}`:""):"All set!";/*#__PURE__*/return e.jsx(Xa,{title:m,description:o?"You've successfully created an account.":"Your account is secured.",onClose:g})}},eo=/*#__PURE__*/a.styled.div.withConfig({displayName:"RecoveryContainer",componentId:"sc-12b46968-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),to=/*#__PURE__*/a.styled.div.withConfig({displayName:"RecoveryExplainerContainer",componentId:"sc-12b46968-1"})(["padding-bottom:24px;"]);let no={"google-drive":{name:"Google Drive",component:$a},icloud:{name:"iCloud",component:Va}};const ro={component:()=>{let{logout:t}=i.usePrivyContext(),{navigate:a,setModalData:o,data:s}=Xn(),{closePrivyModal:l,createAnalyticsEvent:c}=r.usePrivyInternal(),{execute:u}=(()=>{let{client:e,walletProxy:t,refreshSessionAndUser:n}=r.usePrivyInternal(),{data:a}=Xn(),{user:o}=i.usePrivyContext(),s=rr(),{create:l}=Qa();return{execute:async({provider:r,action:c,popup:u,shouldCreateEth:p,shouldCreateSol:h})=>{let g,m;if(!e)throw new d.PrivyClientError("Missing client");function y(t){if(!t&&e)throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:r}}),new d.PrivyClientError("Recovery OAuth failed")}switch(r){case"google-drive":{let t,n,{url:i,codeVerifier:a,stateCode:o}=await Ya({api:e.api,provider:r});y(i);try{let a=await qa({url:i,popup:u,provider:r});if(t=a.stateCode,n=a.authorizationCode,t!==o)throw e.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:r,storedStateCode:o??"",returnedStateCode:t??""}}),new d.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,d.PrivyErrorCode.OAUTH_UNEXPECTED)}catch(t){throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:r}}),new d.PrivyClientError("Recovery OAuth failed")}[g,m]=await Promise.all([e.getAccessToken(),Ga({api:e.api,provider:r,codeVerifier:a,stateCode:t,authorizationCode:n})]);break}case"icloud":{let{url:t}=await Ya({api:e.api,provider:r});y(t);let{ckWebAuthToken:n}=await qa({url:t,popup:u,provider:r});m=n,g=await e.getAccessToken()}}if(!t)throw new d.PrivyClientError("Cannot connect to wallet proxy");if(!g)throw new d.PrivyClientError("Unable to authorize user");switch(c){case"recover":{let n=a?.recoverWallet?.entropyId,i=a?.recoverWallet?.entropyIdVerifier;if(!n||!i)throw new d.PrivyClientError("Recovery OAuth failed");e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:n,recoveryMethod:r}}),await t.recover({accessToken:g,entropyId:n,entropyIdVerifier:i,recoveryAccessToken:m}),e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n,recoveryMethod:r}});break}case"create-wallet":{let t;if(e.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),p&&h)t=await l({recoveryMethod:r,recoveryAccessToken:m,chainType:"ethereum",walletIndex:0,latestUser:o}),t=await l({chainType:"solana",walletIndex:0,latestUser:t.user});else if(h)t=await l({recoveryMethod:r,recoveryAccessToken:m,chainType:"solana",walletIndex:0,latestUser:o});else{if(!p)throw Error("Invalid args to create wallet");t=await l({recoveryMethod:r,recoveryAccessToken:m,chainType:"ethereum",walletIndex:0,latestUser:o})}if(!t)throw s("createWallet","onError",d.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:t.account.address}}),s("createWallet","onSuccess",{wallet:t.account});break}case"set-recovery":{let a=i.getPrivyPrimaryWallet(o);if(!a)throw s("setWalletRecovery","onError",d.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:a.address,existingRecoveryMethod:a.recoveryMethod,targetRecoveryMethod:r}});let{entropyId:l,entropyIdVerifier:c}=Qt(o);await t.setRecovery({accessToken:g,entropyId:l,entropyIdVerifier:c,recoveryMethod:r,recoveryAccessToken:m});let u=i.getPrivyPrimaryWallet(await n());if(!u)throw s("createWallet","onError",d.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:a.address,existingRecoveryMethod:a.recoveryMethod,targetRecoveryMethod:r}}),s("setWalletRecovery","onSuccess",{method:r,wallet:u});break}default:throw new d.PrivyClientError("Unsupported recovery action")}}}})(),[p,h]=n.useState(!1),{provider:g,action:m,isInAccountCreateFlow:y,shouldCreateEth:f,shouldCreateSol:x}=s?.recoveryOAuthStatus,[v,w]=n.useState(void 0),[C,b]=n.useState("create-wallet"===m);if("user-passcode"===g)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let j=no[g].name,k=no[g].component,T=s?.recoverWallet?.onCompleteNavigateTo,A=new rt((async(e="create-wallet")=>(b(!0),new Promise(((t,n)=>{setTimeout((async()=>{try{let n=window.open();await u({provider:g,action:e,popup:n,shouldCreateEth:f,shouldCreateSol:x}),h(!0),t()}catch(t){w({message:`${"recover"===e?"Recovery":"Back up"} with ${j} unsuccessful`,detail:"recover"===m?`Please verify that you are selecting the ${j} account associated with your backup.`:"",retryable:!0}),n()}}),0)})))));n.useEffect((()=>{"recover"!==m&&A.execute(y?"create-wallet":"set-recovery")}),[]),n.useEffect((()=>{if(!p)return;let e=setTimeout((()=>{y?(o({createWallet:{onSuccess:()=>{},onFailure:e=>{c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0,shouldCreateEth:!1,shouldCreateSol:!1}}),a(Ja)):l({shouldCallAuthOnSuccess:!1})}),it);return()=>clearTimeout(e)}),[p]);let S=n.useCallback((async()=>{await A.execute("recover"),T?a(T):h(!0)}),[]),E="google-drive"===g?"Google Drive":"Apple iCloud",I=p&&`Successfully ${"recover"===m?"recovered":"backed up"} with ${E}.`||v&&v.message||`${"recover"===m?"Recovering":"Backing up"} with ${E}...`,P=v?v.detail:"";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{}),C?/*#__PURE__*/e.jsx(e.Fragment,{children:/*#__PURE__*/e.jsxs(eo,{children:[/*#__PURE__*/e.jsx(Ua,{title:I,icon:/*#__PURE__*/e.jsx(k,{style:{width:"38px",height:"38px"}}),description:P}),v&&v?.retryable?/*#__PURE__*/e.jsx(Pr,{onClick:()=>{At(),w(void 0),"create-wallet"===m?A.execute("create-wallet"):S()},disabled:!p&&!v?.retryable,children:"Try again"}):null]})}):/*#__PURE__*/e.jsxs(eo,{children:[/*#__PURE__*/e.jsx(Ua,{title:"Confirm it's really you",icon:/*#__PURE__*/e.jsx(k,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${E} where your account is backed up.`}),/*#__PURE__*/e.jsxs(Pr,{onClick:S,children:["Confirm with ",E]})]}),/*#__PURE__*/e.jsx(xr,{})]})}};let io=/*#__PURE__*/a.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-ccfae04f-0"})(["width:24px;height:24px;display:flex;justify-content:center;align-items:center;"]),ao={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy","privy-v2":"Privy"},oo=({onClose:t})=>/*#__PURE__*/e.jsxs(to,{children:[/*#__PURE__*/e.jsx(Ua,{title:"Why do I need to secure my account?",icon:/*#__PURE__*/e.jsx(pe.default,{width:48}),description:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),/*#__PURE__*/e.jsx("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),/*#__PURE__*/e.jsx(Pr,{onClick:t,children:"Select backup method"})]});const so={component:()=>{let[t,a]=n.useState(!1),{navigate:o,lastScreen:s,navigateBack:l,setModalData:c,data:d,onUserCloseViaDialogOrKeybindRef:u}=Xn(),{user:p}=i.usePrivyContext(),{embeddedWallets:h}=qn(),{closePrivyModal:g}=r.usePrivyInternal(),m=i.getPrivyPrimaryWallet(p),y=null===m,{isInAccountCreateFlow:f,isResettingPassword:x,shouldCreateEth:v,shouldCreateSol:w}=d.recoverySelection,C=m&&"privy"!==m.recoveryMethod,b=C?/*#__PURE__*/e.jsxs("span",{children:["Your account is currently secured using"," ",/*#__PURE__*/e.jsx("strong",{children:ao[m?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function j(e){c({recoveryOAuthStatus:{provider:e,action:y?"create-wallet":"set-recovery",isInAccountCreateFlow:f,shouldCreateEth:v,shouldCreateSol:w}}),o(ro)}function k(){d?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),g({shouldCallAuthOnSuccess:d?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return u.current=k,/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:k,backFn:t?()=>a(!1):s?l:void 0,infoFn:s||t?void 0:()=>a(!0)},"header"),t?/*#__PURE__*/e.jsx(oo,{onClose:()=>a(!1)}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ua,{title:C?"Update backup method":"Secure your account",icon:/*#__PURE__*/e.jsx(ke.default,{width:48}),description:b}),/*#__PURE__*/e.jsx(eo,{children:h.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(m?.recoveryMethod||"")||e!==m?.recoveryMethod)).sort().map((t=>{switch(t){case"google-drive":/*#__PURE__*/return e.jsxs(dr,{onClick:()=>j("google-drive"),children:[/*#__PURE__*/e.jsx(io,{children:/*#__PURE__*/e.jsx($a,{style:{width:18}})}),"Back up to Google Drive"]},t);case"icloud":/*#__PURE__*/return e.jsxs(dr,{onClick:()=>j("icloud"),children:[/*#__PURE__*/e.jsx(io,{children:/*#__PURE__*/e.jsx(Va,{style:{width:24}})}),"Back up to Apple iCloud"]},t);case"user-passcode":/*#__PURE__*/return e.jsxs(dr,{onClick:()=>{o(wg({isCreatingWallet:y,skipSplashScreen:!0}))},children:[/*#__PURE__*/e.jsx(io,{children:/*#__PURE__*/e.jsx(Te.default,{style:{width:18}})}),x?"Reset your":"Set a"," password"]},t);default:return null}}))})]}),/*#__PURE__*/e.jsx(xr,{})]})}};let lo=/*#__PURE__*/a.css(["font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;text-align:left;transition:color 0.1s ease-in;"]);const co=/*#__PURE__*/a.styled.span.withConfig({displayName:"StatusText",componentId:"sc-acac4b9-0"})([""," transition:color 0.1s ease-in;color:",";text-transform:",";&[aria-hidden='true']{visibility:hidden;}"],lo,(({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"),(({error:e})=>e?"":"capitalize")),uo=/*#__PURE__*/a.styled.div.withConfig({displayName:"EmbeddedWalletScreenContainer",componentId:"sc-acac4b9-1"})(["display:flex;flex-direction:column;justify-content:center;flex-grow:1;"]),po=/*#__PURE__*/a.styled(Pr).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-acac4b9-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/a.css(["&&{transition:none;}"])));let ho=/*#__PURE__*/a.css(["&&{width:100%;border-width:1px;border-radius:var(--privy-border-radius-md);border-color:var(--privy-color-foreground-3);background:var(--privy-color-background);color:var(--privy-color-foreground);padding:12px;font-size:16px;font-style:normal;font-weight:300;line-height:22px;}"]);const go=/*#__PURE__*/a.styled.input.withConfig({displayName:"PasswordInput",componentId:"sc-acac4b9-3"})([""," &::placeholder{color:var(--privy-color-foreground-3);font-style:italic;font-size:14px;}overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"],ho),mo=/*#__PURE__*/a.styled.div.withConfig({displayName:"PasswordDisplay",componentId:"sc-acac4b9-4"})(["",""],ho),yo=/*#__PURE__*/a.styled.div.withConfig({displayName:"PasswordContainer",componentId:"sc-acac4b9-5"})(["position:relative;width:100%;display:flex;align-items:center;justify-content:",";"],(({centered:e})=>e?"center":"space-between")),fo=/*#__PURE__*/a.styled.div.withConfig({displayName:"Header",componentId:"sc-acac4b9-6"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:32px 0;gap:4px;& h3{font-size:18px;font-style:normal;font-weight:600;line-height:24px;}& p{max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;}"]),xo=/*#__PURE__*/a.styled.div.withConfig({displayName:"Details",componentId:"sc-acac4b9-7"})(["display:flex;flex-direction:column;gap:10px;padding-bottom:1rem;"]),vo=/*#__PURE__*/a.styled.div.withConfig({displayName:"DetailItem",componentId:"sc-acac4b9-8"})(["display:flex;text-align:left;align-items:center;gap:8px;max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;margin:0 8px;color:var(--privy-color-foreground-2);> :first-child{min-width:24px;}"]),wo=/*#__PURE__*/a.styled(Er).withConfig({displayName:"ExportButton",componentId:"sc-acac4b9-10"})(["display:flex;flex:1;gap:4px;justify-content:center;&&{background:var(--privy-color-background);border-radius:var(--privy-border-radius-md);border-color:var(--privy-color-foreground-3);border-width:1px;}"]),Co=/*#__PURE__*/a.styled.div.withConfig({displayName:"InputRightIcons",componentId:"sc-acac4b9-11"})(["position:absolute;right:0.5rem;display:flex;flex-direction:row;justify-content:space-around;align-items:center;"]),bo=/*#__PURE__*/a.styled(Ae.default).withConfig({displayName:"RegenerateIcon",componentId:"sc-acac4b9-12"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),jo=/*#__PURE__*/a.styled(Ee.default).withConfig({displayName:"HiddenIcon",componentId:"sc-acac4b9-13"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),ko=/*#__PURE__*/a.styled(Se.default).withConfig({displayName:"ShownIcon",componentId:"sc-acac4b9-14"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),To=/*#__PURE__*/a.styled.progress.withConfig({displayName:"StrengthMeter",componentId:"sc-acac4b9-15"})(["height:4px;width:100%;margin:8px 0;::-webkit-progress-bar{border-radius:8px;background:var(--privy-color-foreground-4);}::-webkit-progress-value{border-radius:8px;transition:all 0.1s ease-out;background:",";}"],(({label:e})=>("Strong"===e?"#78dca6":"Medium"===e&&"var(--privy-color-warn)")||"var(--privy-color-error)")),Ao=({buttonHideAnimations:t,buttonLoading:r,password:i,onSubmit:a,onBack:o})=>{let[s,l]=n.useState(!0),[c,d]=n.useState(!1),[u,p]=n.useState(""),h=i===u;return n.useEffect((()=>{u&&!c&&d(!0)}),[u]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{closeable:!1,backFn:o}),/*#__PURE__*/e.jsx(Ji,{}),/*#__PURE__*/e.jsxs(uo,{children:[/*#__PURE__*/e.jsxs(fo,{children:[/*#__PURE__*/e.jsx(xe.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),/*#__PURE__*/e.jsxs(yo,{children:[/*#__PURE__*/e.jsx(go,{value:u,onChange:e=>p(e.target.value),onKeyUp:e=>{"Enter"===e.key&&a()},onBlur:()=>d(!0),placeholder:"confirm your password",type:s?"password":"text",style:{paddingRight:"2.3rem"}}),/*#__PURE__*/e.jsx(Co,{style:{right:"0.75rem"},children:s?/*#__PURE__*/e.jsx(jo,{onClick:()=>l(!1)}):/*#__PURE__*/e.jsx(ko,{onClick:()=>l(!0)})})]}),
17
- /*#__PURE__*/e.jsx(co,{"aria-hidden":!c||h,error:!0,children:"Passwords do not match"})]}),/*#__PURE__*/e.jsx(po,{onClick:a,loading:r,disabled:!h,$hideAnimations:t,children:"Continue"}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]})},So=({className:t,checked:n,color:r="var(--privy-color-accent)",...i})=>/*#__PURE__*/e.jsx("label",{children:/*#__PURE__*/e.jsxs(Eo,{className:t,children:[/*#__PURE__*/e.jsx(Po,{checked:n,...i}),/*#__PURE__*/e.jsx(No,{color:r,checked:n,children:/*#__PURE__*/e.jsx(Io,{viewBox:"0 0 24 24",children:/*#__PURE__*/e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})});let Eo=/*#__PURE__*/a.styled.div.withConfig({displayName:"CheckboxContainer",componentId:"sc-db51b935-1"})(["display:inline-block;vertical-align:middle;"]),Io=/*#__PURE__*/a.styled.svg.withConfig({displayName:"Icon",componentId:"sc-db51b935-2"})(["fill:none;stroke:white;stroke-width:3px;"]),Po=/*#__PURE__*/a.styled.input.attrs({type:"checkbox"}).withConfig({displayName:"HiddenCheckbox",componentId:"sc-db51b935-3"})(["border:0;clip:rect(0 0 0 0);clippath:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px;"]),No=/*#__PURE__*/a.styled.div.withConfig({displayName:"StyledCheckbox",componentId:"sc-db51b935-4"})(["display:inline-block;width:18px;height:18px;transition:all 150ms;cursor:pointer;border-color:",";border-radius:3px;background:",";&&{border-width:1px;}",":focus + &{box-shadow:0 0 0 1px ",";}","{visibility:",";}"],(e=>e.color),(e=>e.checked?e.color:"var(--privy-color-background)"),Po,(e=>e.color),Io,(e=>e.checked?"visible":"hidden"));const _o=({buttonHideAnimations:t,buttonLoading:r,onSubmit:i,onBack:a,config:o})=>{let[s,l]=n.useState(!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{closeable:!1,backFn:a}),/*#__PURE__*/e.jsx(Ji,{}),/*#__PURE__*/e.jsxs(uo,{children:[/*#__PURE__*/e.jsxs(fo,{children:[/*#__PURE__*/e.jsx(xe.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),/*#__PURE__*/e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),/*#__PURE__*/e.jsx(xo,{children:/*#__PURE__*/e.jsxs(vo,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:e=>{e.preventDefault(),l((e=>!e))},children:[/*#__PURE__*/e.jsx(So,{color:"var(--privy-color-error)",readOnly:!0,checked:s}),/*#__PURE__*/e.jsx(e.Fragment,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),/*#__PURE__*/e.jsxs(Mo,{children:["user"===o.initiatedBy&&/*#__PURE__*/e.jsx(Fr,{onClick:o.onCancel,disabled:r,children:"Cancel"}),/*#__PURE__*/e.jsx(po,{onClick:i,loading:r,$hideAnimations:t,disabled:!s,children:"Set Password"})]}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]})};let Mo=/*#__PURE__*/a.styled.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-d1659c5f-0"})(["display:flex;gap:10px;"]),Fo=/[a-z]/,Lo=/[A-Z]/,Wo=/[0-9]/,Do="!@#$%^&*()\\-_+.",Ro=`a-zA-Z0-9${Do}`,Oo=RegExp(`[${Do}]`),Bo=RegExp(`[${Ro}]`);const Uo=RegExp(`^[${Ro}]{6,}$`),zo=()=>je.generatePassphrase(4,A.DEFAULT_WORDLIST);function Ho(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Vo(e=""){return(.3*function(e){if(e.length<8)return 0;let t=0;return Fo.test(e)&&(t+=1),Lo.test(e)&&(t+=1),Wo.test(e)&&(t+=1),Oo.test(e)&&(t+=1),Math.max(0,Math.min(1,t/3))}(e)+be.default(e)/95)/2}const $o=({buttonHideAnimations:t,buttonLoading:r,password:i="",config:a,isResettingPassword:o,onSubmit:s,onClose:l,onBack:c,onPasswordChange:d,onPasswordGenerate:u})=>{let[p,h]=n.useState(!1),[g,m]=n.useState(!1);n.useEffect((()=>{i&&!g&&m(!0)}),[i]);let y=n.useMemo((()=>g?6>(i?.length||0)?"Password must be at least 6 characters":Uo.test(i||"")?null:`Invalid characters used ( ${((e="")=>[...new Set(e.split("").filter((e=>!Bo.test(e))).map((e=>e.replace(" ","SPACE"))))])(i).join(" ")} )`:null),[i,g]),f=n.useMemo((()=>y?{value:0,label:"Weak"}:function(e=""){let t=Vo(e);return{value:t,label:Ho(t)}}(i)),[i,y]),x=n.useMemo((()=>!i?.length||!!y),[y,i]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:l,closeable:"user"===a.initiatedBy,backFn:c}),/*#__PURE__*/e.jsx(Ji,{}),/*#__PURE__*/e.jsxs(uo,{children:[/*#__PURE__*/e.jsxs(fo,{children:[/*#__PURE__*/e.jsx(Ie.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),/*#__PURE__*/e.jsxs("h3",{style:{color:"var(--privy-color-foreground)"},children:[o?"Reset":"Set"," your password"]}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),/*#__PURE__*/e.jsxs(yo,{children:[/*#__PURE__*/e.jsx(go,{value:i,onChange:e=>d(e.target.value),onKeyUp:e=>{"Enter"===e.key&&s()},placeholder:"enter or generate a strong password",type:p?"password":"text",style:{paddingRight:"3.8rem"}}),/*#__PURE__*/e.jsxs(Co,{style:{width:"3.5rem"},children:[p?/*#__PURE__*/e.jsx(jo,{onClick:()=>h(!1)}):/*#__PURE__*/e.jsx(ko,{onClick:()=>h(!0)}),/*#__PURE__*/e.jsx(bo,{onClick:u})]})]}),/*#__PURE__*/e.jsx(To,{value:0===f.value?.01:f.value,label:f.label}),/*#__PURE__*/e.jsx(co,{error:!!y,children:y||`Password Strength: ${g?f.label:"--"}`}),/*#__PURE__*/e.jsxs(Go,{children:[/*#__PURE__*/e.jsx(qo,{children:/*#__PURE__*/e.jsxs(xo,{children:[/*#__PURE__*/e.jsxs(vo,{children:[/*#__PURE__*/e.jsx(Pe.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),/*#__PURE__*/e.jsxs(vo,{children:[/*#__PURE__*/e.jsx(Pe.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),/*#__PURE__*/e.jsx(po,{onClick:s,loading:r,disabled:x,$hideAnimations:t,children:"Continue"})]})]}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]})};let qo=/*#__PURE__*/a.styled(xo).withConfig({displayName:"DetailsContainer",componentId:"sc-2da5fe90-0"})(["flex:1;padding-top:1rem;"]),Go=/*#__PURE__*/a.styled.div.withConfig({displayName:"LowerContainer",componentId:"sc-2da5fe90-1"})(["display:flex;flex-direction:column;height:100%;"]);const Yo=({buttonHideAnimations:t,buttonLoading:r,appName:i,password:a,onSubmit:o,onBack:s})=>{let[l,c]=n.useState(!1),[d,u]=n.useState(!0),p=n.useCallback((()=>{c(!0),a&&navigator.clipboard.writeText(a)}),[a]),h=n.useCallback((()=>{let e=document.createElement("a"),t=i.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),n=new Blob([Zo(i,a)],{type:"text/plain"}),r=URL.createObjectURL(n);e.href=r,e.target="_blank",e.download=`${t}-privy-wallet-recovery.txt`,document.body.appendChild(e),e.click(),setTimeout((()=>{e.remove(),URL.revokeObjectURL(r)}),5e3)}),[a]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{backFn:s,closeable:!1}),/*#__PURE__*/e.jsx(Ji,{}),/*#__PURE__*/e.jsxs(uo,{children:[/*#__PURE__*/e.jsxs(fo,{children:[/*#__PURE__*/e.jsx(xe.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),/*#__PURE__*/e.jsxs(yo,{centered:!0,children:[/*#__PURE__*/e.jsx(mo,{children:d?"•".repeat(a.length):a}),/*#__PURE__*/e.jsx(Co,{style:{right:"0.75rem"},children:d?/*#__PURE__*/e.jsx(jo,{onClick:()=>u(!1)}):/*#__PURE__*/e.jsx(ko,{onClick:()=>u(!0)})})]}),/*#__PURE__*/e.jsxs("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[/*#__PURE__*/e.jsx(wo,{onClick:p,children:l?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(_e.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Me.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),/*#__PURE__*/e.jsxs(wo,{onClick:h,children:[/*#__PURE__*/e.jsx(Ne.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),/*#__PURE__*/e.jsx(po,{onClick:o,loading:r,$hideAnimations:t,children:"Continue"}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]})};let Zo=(e,t)=>`Your wallet recovery password for ${e} is\n\n${t}\n\nYou will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;const Ko=({error:t,onClose:n})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{closeable:!1}),/*#__PURE__*/e.jsx(Ji,{}),t?/*#__PURE__*/e.jsxs(Zi,{children:[/*#__PURE__*/e.jsx(Fe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ua,{title:"Something went wrong",description:t})]}):/*#__PURE__*/e.jsxs(Zi,{children:[/*#__PURE__*/e.jsx(Pe.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ua,{title:"Success"})]}),/*#__PURE__*/e.jsx(Pr,{onClick:n,children:"Close"}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]});let Qo=(e,t)=>{switch(e){case"creating":return"back"===t?e:"saving";case"saving":return"back"===t?"creating":"confirming";case"confirming":return"back"===t?"saving":"finalizing";case"finalizing":return"back"===t?"confirming":"done";default:return e}};const Xo=({onSubmit:t,...r})=>{let{lastScreen:i,navigate:a}=Xn(),{send:o,state:s}=(()=>{let[e,t]=n.useReducer(Qo,"creating");return{send:t,state:e}})(),l=n.useCallback((async()=>{"finalizing"===s&&await t(),o("next")}),[s,o,t]);n.useEffect((()=>{let e;return"done"===s&&"automatic"===r.config.initiatedBy&&(e=setTimeout((()=>r.onClose?.()),it)),()=>{e&&clearTimeout(e)}}),[s,r.config.initiatedBy,r.onClose]);let c=n.useCallback((()=>{o("back")}),[o]),d=n.useCallback((()=>{a(so)}),[i,a]);return"creating"===s?/*#__PURE__*/e.jsx($o,{...r,onSubmit:l,onBack:i===so?d:void 0}):"saving"===s?/*#__PURE__*/e.jsx(Yo,{...r,onSubmit:l,onBack:c}):"confirming"===s?/*#__PURE__*/e.jsx(Ao,{...r,onSubmit:l,onBack:c}):"finalizing"===s?/*#__PURE__*/e.jsx(_o,{...r,onSubmit:l,onBack:c}):"done"===s?/*#__PURE__*/e.jsx(Ko,{...r,onSubmit:l}):null};let Jo={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",line_oauth:"line",twitter_oauth:"twitter",wallet:"siwe",smart_wallet:"siwe",cross_app:"privy:"};const es=e=>{if(i.isCustomOAuthProvider(e))return{displayName:e.replace("custom:",""),loginMethod:"custom"};let t=Jo[e];return"wallet"===e||"phone"===e?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};let ts=/*#__PURE__*/n.createContext({});let ns=e=>`privy:${e}:recent-login-method`,rs=e=>`privy:${e}:recent-login-wallet-client`,is=e=>`privy:${e}:recent-login-chain-type`;const as=()=>n.useContext(ts),os=()=>{let t=qn(),n=t?.appearance?.logo,r=`${t?.name} logo`,i={maxHeight:"90px",maxWidth:"180px"};return n?"string"==typeof n?/*#__PURE__*/e.jsx("img",{src:n,alt:r,style:i}):"svg"===n.type||"img"===n.type?/*#__PURE__*/le.default.cloneElement(n,{alt:r,style:i}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},ss=t=>{let n=qn();return n?.appearance.logo?/*#__PURE__*/e.jsx(ls,{...t,children:/*#__PURE__*/e.jsx(os,{})}):null},ls=/*#__PURE__*/a.styled.div.withConfig({displayName:"AppLogoContainer",componentId:"sc-b210074-0"})(["display:flex;flex-direction:column;align-items:center;padding:24px 0;flex-grow:1;justify-content:center;"]),cs=({name:t,logoUrl:n,size:r="38px"})=>{let i=`${t??"Provider app"} logo`;return"string"==typeof n?/*#__PURE__*/e.jsx("img",{src:n,alt:i,style:{width:r,height:r,maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):
18
- /*#__PURE__*/e.jsx("span",{})},ds=({appId:t})=>{let[a,o]=n.useState(void 0),{startCrossAppAuthFlow:s,authenticated:l}=i.usePrivyContext(),{client:c}=r.usePrivyInternal();return n.useEffect((()=>{(async()=>{c&&o(await c.getCrossAppProviderDetails(t))})()}),[c]),/*#__PURE__*/e.jsx(dr,{onClick:()=>s({appId:t,action:l?"link":"login"}),disabled:!a,children:a?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(cs,{name:a.name,logoUrl:a.icon_url||void 0,size:"24px"})," ",a.name]}):/*#__PURE__*/e.jsx(Ar,{})})};let us=/*#__PURE__*/a.styled.a.withConfig({displayName:"StyledLink",componentId:"sc-c8577138-0"})(["&&{color:",";font-weight:400;text-decoration:",";text-underline-offset:4px;text-decoration-thickness:1px;cursor:",";opacity:",";font-size:",";line-height:",";transition:color 200ms ease,text-decoration-color 200ms ease,opacity 200ms ease;&:hover{color:",";text-decoration:",";text-underline-offset:4px;}&:active{color:",";}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;border-radius:2px;}}"],(({$variant:e})=>"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))"),(({$variant:e})=>"underlined"===e?"underline":"var(--privy-link-navigation-decoration, none)"),(({$disabled:e})=>e?"not-allowed":"pointer"),(({$disabled:e})=>e?.5:1),(({$size:e})=>{switch(e){case"xs":return"12px";case"sm":return"14px";default:return"16px"}}),(({$size:e})=>{switch(e){case"xs":return"18px";case"sm":return"22px";default:return"24px"}}),(({$variant:e,$disabled:t})=>"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))"),(({$disabled:e})=>e?"none":"underline"),(({$variant:e,$disabled:t})=>t?"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))":"var(--privy-color-foreground)"));const ps=({size:t="md",variant:n="navigation",disabled:r=!1,as:i,children:a,onClick:o,...s})=>/*#__PURE__*/e.jsx(us,{as:i,$size:t,$variant:n,$disabled:r,onClick:e=>{r?e.preventDefault():o?.(e)},...s,children:a}),hs=(e,t)=>!i.getPrivyEthereumWallet(e)&&("all-users"===t||"users-without-wallets"===t&&!gs(e).length);let gs=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"ethereum"===e.chainType));const ms=(e,t)=>!i.getPrivySolanaWallet(e)&&("all-users"===t||"users-without-wallets"===t&&!ys(e).length);let ys=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"solana"===e.chainType));const fs=(e,t)=>hs(e,t.ethereum.createOnLogin)||ms(e,t.solana.createOnLogin),xs=({title:n="Account not found",subtitle:r,appName:i="this app",ctaText:a="Try logging in again",onRetry:o})=>/*#__PURE__*/e.jsx(bi,{title:n,subtitle:r||`Please try logging in again or go to ${i} to create an account.`,icon:t.HelpCircle,iconVariant:"warning",primaryCta:{label:a,onClick:o},watermark:!0}),vs={component:()=>{let{navigate:t,setModalData:n,data:i}=Xn(),a=qn(),{getAuthMeta:o,client:s}=r.usePrivyInternal();/*#__PURE__*/return e.jsx(xs,{appName:a?.name,onRetry:()=>{let e=o();n({...i,login:{...i?.login,...e?.disableSignup?{disableSignup:!0}:{}}}),s?.authFlow&&(s.authFlow=void 0),t(cg)}})}},ws=/*#__PURE__*/a.styled.span.withConfig({displayName:"CircleBorder",componentId:"sc-9056b8b8-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;border-bottom-color:",";}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)")),Cs=({address:r,showCopyIcon:i,url:a,className:o})=>{let[s,l]=n.useState(!1);function c(e){e.stopPropagation(),navigator.clipboard.writeText(r).then((()=>l(!0))).catch(console.error)}return n.useEffect((()=>{if(s){let e=setTimeout((()=>l(!1)),3e3);return()=>clearTimeout(e)}}),[s]),a?/*#__PURE__*/e.jsxs(bs,{children:[/*#__PURE__*/e.jsx(ks,{title:r,className:o,href:`${a}/address/${r}`,target:"_blank",children:Dt(r)}),i&&/*#__PURE__*/e.jsx(Fr,{onClick:c,size:"sm",style:{gap:"0.375rem"},children:s?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(t.Check,{size:16})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(t.Copy,{size:16})]})})]}):/*#__PURE__*/e.jsxs(bs,{children:[/*#__PURE__*/e.jsx(js,{title:r,className:o,children:Dt(r)}),i&&/*#__PURE__*/e.jsx(Fr,{onClick:c,size:"sm",style:{gap:"0.375rem",fontSize:"14px"},children:s?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(t.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(t.Copy,{size:14})]})})]})};let bs=/*#__PURE__*/a.styled.span.withConfig({displayName:"AddressContainer",componentId:"sc-3a987cc8-0"})(["display:inline-flex;align-items:center;gap:0.5rem;"]),js=/*#__PURE__*/a.styled.span.withConfig({displayName:"AddressText",componentId:"sc-3a987cc8-1"})(["font-size:14px;font-weight:500;color:var(--privy-color-foreground);"]),ks=/*#__PURE__*/a.styled.a.withConfig({displayName:"AddressLink",componentId:"sc-3a987cc8-2"})(["font-size:14px;color:var(--privy-color-foreground);text-decoration:none;&:hover{text-decoration:underline;}"]);function Ts(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...t,children:[/*#__PURE__*/e.jsx("circle",{cx:"12",cy:"12",r:"10"}),/*#__PURE__*/e.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),/*#__PURE__*/e.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}const As=792703809,Ss="11111111111111111111111111111111";let Es="0x0000000000000000000000000000000000000000";const Is=({originCurrency:e,destinationCurrency:t,...n})=>({tradeType:"EXPECTED_OUTPUT",originCurrency:e??Es,destinationCurrency:t??Es,...n});let Ps="https://api.relay.link",Ns="https://api.testnets.relay.link";const _s=async({input:e,isTestnet:t})=>{let n=await fetch((t?Ns:Ps)+"/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await n.json();if(!(n.ok||"string"==typeof r.message&&r.message.startsWith("Invalid address")))throw console.error("Relay error:",r),Error(r.message??"Error fetching quote from relay");return r},Ms=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}};async function Fs({transactionHash:e,isTestnet:t}){let n=await fetch((t?Ns:Ps)+"/requests/v2?hash="+e),r=await n.json();if(!n.ok){if("message"in r&&"string"==typeof r.message)throw Error(r.message);throw Error("Error fetching request from relay")}return r.requests.at(0)?.status??"pending"}function Ls({transactionHash:e,isTestnet:t,bridgingStatus:r,setBridgingStatus:i,onSuccess:a,onFailure:o}){n.useEffect((()=>{if(e&&r){if(["delayed","waiting","pending"].includes(r)){let n=setInterval((async()=>{try{let n=await Fs({transactionHash:e,isTestnet:t});i(n)}catch(e){console.error(e)}}),1e3);return()=>clearInterval(n)}"success"===r?a({transactionHash:e}):["refund","failure"].includes(r)&&o({error:new Ws(e,t)})}}),[r,e,t])}class Ws extends d.PrivyClientError{constructor(e,t){super("We were unable to complete the bridging transaction. Funds will be refunded on your wallet.",void 0,d.PrivyErrorCode.TRANSACTION_FAILURE),this.relayLink=t?`https://testnets.relay.link/transaction/${e}`:`https://relay.link/transaction/${e}`}}const Ds=({error:n,allowlistConfig:r,onRetry:i,onCaptchaReset:a,onBack:o})=>{let s=((n,r)=>{if(n instanceof Ws)return{title:"Transaction failed",detail:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("span",{children:n.message}),/*#__PURE__*/e.jsxs("span",{children:[" ","Check the"," ",/*#__PURE__*/e.jsx(Os,{href:n.relayLink,target:"_blank",children:"refund status"}),"."]})]}),ctaText:"Try again",icon:t.AlertTriangle};if(n instanceof d.PrivyClientError)switch(n.privyErrorCode){case d.PrivyErrorCode.CLIENT_REQUEST_TIMEOUT:return{title:"Timed out",detail:n.message,ctaText:"Try again",icon:t.AlertTriangle};case d.PrivyErrorCode.INSUFFICIENT_BALANCE:return{title:"Insufficient balance",detail:n.message,ctaText:"Try again",icon:t.AlertTriangle};case d.PrivyErrorCode.TRANSACTION_FAILURE:return{title:"Transaction failure",detail:n.message,ctaText:"Try again",icon:t.AlertTriangle};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t.AlertTriangle}}else{if(n instanceof La&&"twilio_verification_failed"===n.type)return{title:"Something went wrong",detail:n.message,ctaText:"Try again",icon:t.Phone};if(!(n instanceof d.PrivyError))return n instanceof d.PrivyApiError&&n.status&&[400,422].includes(n.status)?{title:"Something went wrong",detail:n.message,ctaText:"Try again",icon:t.AlertTriangle}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t.AlertTriangle};switch(n.privyErrorCode){case d.PrivyErrorCode.INVALID_CAPTCHA:return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t.AlertTriangle};case d.PrivyErrorCode.DISALLOWED_LOGIN_METHOD:return{title:"Not allowed",detail:n.message,ctaText:"Try another method",icon:t.AlertTriangle};case d.PrivyErrorCode.ALLOWLIST_REJECTED:return{title:r.errorTitle||"You don't have access to this app",detail:r.errorDetail||"Have you been invited?",ctaText:r.errorCtaText||"Try another account",icon:t.Lock};case d.PrivyErrorCode.CAPTCHA_FAILURE:return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:null};case d.PrivyErrorCode.CAPTCHA_TIMEOUT:return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:null};case d.PrivyErrorCode.LINKED_TO_ANOTHER_USER:return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t.AlertTriangle};case d.PrivyErrorCode.NOT_SUPPORTED:return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:t.AlertTriangle};case d.PrivyErrorCode.TOO_MANY_REQUESTS:return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:t.AlertTriangle};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t.AlertTriangle}}}})(n,r);/*#__PURE__*/return e.jsx(bi,{title:s.title,subtitle:s.detail,icon:s.icon,onBack:o,iconVariant:"error",primaryCta:{label:s.ctaText,onClick:()=>{n instanceof d.PrivyError&&(n.privyErrorCode===d.PrivyErrorCode.INVALID_CAPTCHA&&a?.(),n.privyErrorCode===d.PrivyErrorCode.ALLOWLIST_REJECTED&&r.errorCtaLink)?window.location.href=r.errorCtaLink:i?.()},variant:"error"},watermark:!0})},Rs={component:()=>{let{navigate:t,data:n,lastScreen:r,currentScreen:i}=Xn(),a=qn(),{reset:o}=qt(),s=n?.errorModalData?.previousScreen||(r===i?void 0:r);/*#__PURE__*/return e.jsx(Ds,{error:n?.errorModalData?.error||Error(),allowlistConfig:a.allowlistConfig,onRetry:()=>{t(s||cg,!1)},onCaptchaReset:o})}};let Os=/*#__PURE__*/a.styled.a.withConfig({displayName:"Link",componentId:"sc-e29a7de8-0"})(["color:var(--privy-color-accent) !important;font-weight:600;"]);const Bs=({onTransfer:t,isTransferring:n,transferSuccess:r})=>/*#__PURE__*/e.jsx(Pr,{...r?{success:!0,children:"Success!"}:{warn:!0,loading:n,onClick:t,children:"Transfer and delete account"}}),Us=/*#__PURE__*/a.styled.div.withConfig({displayName:"ConnectContainer",componentId:"sc-3505eb4c-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;width:100%;padding-bottom:16px;"]),zs=/*#__PURE__*/a.styled.div.withConfig({displayName:"GappedContainer",componentId:"sc-3505eb4c-1"})(["display:flex;flex-direction:column;&& p{font-size:14px;}width:100%;gap:16px;"]),Hs=/*#__PURE__*/a.styled.div.withConfig({displayName:"DisclosedAccountContainer",componentId:"sc-3505eb4c-2"})(["display:flex;cursor:pointer;align-items:center;width:100%;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);padding:8px 10px;font-size:14px;font-weight:500;gap:8px;"]),Vs=/*#__PURE__*/a.styled(we.default).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-3505eb4c-3"})(["position:relative;width:",";height:",";color:var(--privy-color-foreground-3);margin-left:auto;"],(({$iconSize:e})=>`${e}px`),(({$iconSize:e})=>`${e}px`)),$s=/*#__PURE__*/a.styled(Ce.default).withConfig({displayName:"StyledCopyIcon",componentId:"sc-3505eb4c-4"})(["position:relative;width:15px;height:15px;color:var(--privy-color-foreground-3);margin-left:auto;"]),qs=/*#__PURE__*/a.styled.ol.withConfig({displayName:"ListContainer",componentId:"sc-3505eb4c-5"})(["display:flex;flex-direction:column;font-size:14px;width:100%;text-align:left;"]),Gs=/*#__PURE__*/a.styled.li.withConfig({displayName:"ListItem",componentId:"sc-3505eb4c-6"})(["font-size:14px;list-style-type:auto;list-style-position:outside;margin-left:1rem;margin-bottom:0.5rem;&:last-child{margin-bottom:0;}"]),Ys=/*#__PURE__*/a.styled.div.withConfig({displayName:"CircleContainer",componentId:"sc-3505eb4c-7"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]);let Zs=()=>/*#__PURE__*/e.jsx(Ys,{children:/*#__PURE__*/e.jsx(Vs,{$iconSize:60})});const Ks=({address:t,onClose:n,onRetry:r,onTransfer:i,isTransferring:a,transferSuccess:o})=>{let{defaultChain:s}=qn(),l=s.blockExplorers?.default.url??"https://etherscan.io";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:n,backFn:r}),/*#__PURE__*/e.jsxs(Us,{children:[/*#__PURE__*/e.jsx(Zs,{}),/*#__PURE__*/e.jsxs(zs,{children:[/*#__PURE__*/e.jsx("h3",{children:"Check account assets before transferring"}),/*#__PURE__*/e.jsx("p",{children:"Before transferring, ensure there are no assets in the other account. Assets in that account will not transfer automatically and may be lost."}),/*#__PURE__*/e.jsxs(qs,{children:[/*#__PURE__*/e.jsx("p",{children:" To check your balance, you can:"}),/*#__PURE__*/e.jsx(Gs,{children:"Log out and log back into the other account, or "}),/*#__PURE__*/e.jsxs(Gs,{children:["Copy your wallet address and use a"," ",/*#__PURE__*/e.jsx("u",{children:/*#__PURE__*/e.jsx("a",{target:"_blank",href:l,children:"block explorer"})})," ","to see if the account holds any assets."]})]}),/*#__PURE__*/e.jsxs(Hs,{onClick:()=>navigator.clipboard.writeText(t).catch(console.error),children:[/*#__PURE__*/e.jsx(ve.default,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/e.jsx(Cs,{address:t,showCopyIcon:!1}),/*#__PURE__*/e.jsx($s,{})]}),/*#__PURE__*/e.jsx(Bs,{onTransfer:i,isTransferring:a,transferSuccess:o})]})]}),/*#__PURE__*/e.jsx(xr,{})]})},Qs={component:()=>{let{initiateAccountTransfer:t,closePrivyModal:i}=r.usePrivyInternal(),{data:a,navigate:o,lastScreen:s,setModalData:l}=Xn(),[c,d]=n.useState(void 0),[u,p]=n.useState(!1),[h,g]=n.useState(!1),m=async()=>{try{if(!a?.accountTransfer?.nonce||!a?.accountTransfer?.account)throw Error("missing account transfer inputs");g(!0),await t({nonce:a?.accountTransfer?.nonce,account:a?.accountTransfer?.account,accountType:a?.accountTransfer?.linkMethod,externalWalletMetadata:a?.accountTransfer?.externalWalletMetadata,telegramWebAppData:a?.accountTransfer?.telegramWebAppData,telegramAuthResult:a?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:a?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:a?.accountTransfer?.oAuthUserInfo}),p(!0),g(!1),setTimeout(i,1e3)}catch(e){l({errorModalData:{error:e,previousScreen:s||Qs}}),o(Rs,!0)}};return c?/*#__PURE__*/e.jsx(Ks,{address:c,onClose:i,onRetry:()=>d(void 0),onTransfer:m,isTransferring:h,transferSuccess:u}):/*#__PURE__*/e.jsx(Xs,{onClose:i,onInfo:()=>d(a?.accountTransfer?.embeddedWalletAddress),onContinue:()=>d(a?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:h,transferSuccess:u,data:a})}},Xs=({onClose:t,onContinue:n,onInfo:r,onTransfer:i,transferSuccess:a,isTransferring:o,data:s})=>{if(!s?.accountTransfer?.linkMethod||!s?.accountTransfer?.displayName)return;let l={method:s?.accountTransfer?.linkMethod,handle:s?.accountTransfer?.displayName,disclosedAccount:s?.accountTransfer?.embeddedWalletAddress?{type:"wallet",handle:s?.accountTransfer?.embeddedWalletAddress}:void 0};/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{closeable:!0}),/*#__PURE__*/e.jsxs(Us,{children:[/*#__PURE__*/e.jsx(Ma,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx(ws,{color:"var(--privy-color-error)"}),/*#__PURE__*/e.jsx(xe.default,{height:38,width:38,stroke:"var(--privy-color-error)"})]})}),/*#__PURE__*/e.jsxs(zs,{children:[/*#__PURE__*/e.jsxs("h3",{children:[function(e){switch(e){case"sms":return"Phone number";case"email":return"Email address";case"siwe":return"Wallet address";case"siws":return"Solana wallet address";case"linkedin":return"LinkedIn profile";case"google":case"apple":case"discord":case"github":case"instagram":case"spotify":case"tiktok":case"line":case"twitter":case"telegram":case"farcaster":return`${mt(e.replace("_oauth",""))} profile`;default:return e.startsWith("privy:")?"Cross-app account":e}}(l.method)," is associated with another account"]}),/*#__PURE__*/e.jsxs("p",{children:["Do you want to transfer",/*#__PURE__*/e.jsx("b",{children:l.handle?` ${l.handle}`:""})," to this account instead? This will delete your other account."]}),/*#__PURE__*/e.jsx(Js,{onClick:r,disclosedAccount:l.disclosedAccount})]}),/*#__PURE__*/e.jsxs(zs,{style:{gap:12,marginTop:12},children:[s?.accountTransfer?.embeddedWalletAddress?/*#__PURE__*/e.jsx(Pr,{onClick:n,children:"Continue"}):/*#__PURE__*/e.jsx(Bs,{onTransfer:i,transferSuccess:a,isTransferring:o}),/*#__PURE__*/e.jsx(Fr,{onClick:t,children:"No thanks"})]})]}),/*#__PURE__*/e.jsx(xr,{})]})};function Js({disclosedAccount:t,onClick:n}){return t?/*#__PURE__*/e.jsxs(Hs,{onClick:n,children:[/*#__PURE__*/e.jsx(ve.default,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/e.jsx(Cs,{address:t.handle,showCopyIcon:!1}),/*#__PURE__*/e.jsx(Ts,{width:15,height:15,color:"var(--privy-color-foreground-3)",style:{marginLeft:"auto"}})]}):null}const el=({errorMessage:n,onClose:r})=>n?/*#__PURE__*/e.jsx(bi,{title:"Something went wrong",subtitle:n,icon:t.XCircle,iconVariant:"error",primaryCta:{label:"Close",onClick:r},watermark:!0}):/*#__PURE__*/e.jsx(bi,{title:"Creating your wallet",subtitle:"Please wait...",iconVariant:"loading",watermark:!1}),tl={component:()=>{let{setModalData:t,navigate:a,data:o,onUserCloseViaDialogOrKeybindRef:s}=Xn(),l=qn(),[c,u]=n.useState(""),{embeddedWallets:p}=qn(),{authenticated:h,user:g}=i.usePrivyContext(),{closePrivyModal:m,walletProxy:y,client:f}=r.usePrivyInternal(),{onSuccess:x,onFailure:v,callAuthOnSuccessOnClose:w,shouldCreateEth:C,shouldCreateSol:b}=o.createWallet,j="legacy-embedded-wallets-only"===l.embeddedWallets.mode&&!0===l?.embeddedWallets.requireUserOwnedRecoveryOnCreate,[k,T]=n.useState(null),{create:A}=Qa(),S=C??(!!g&&hs(g,l.embeddedWallets.ethereum.createOnLogin)),E=b??(!!g&&ms(g,l.embeddedWallets.solana.createOnLogin)),I=new rt((async()=>{let e=await f.getAccessToken();if(g&&e&&y)try{let e;if(S&&E)e=await A({chainType:"ethereum",walletIndex:0,latestUser:g}),e=await A({chainType:"solana",walletIndex:0,latestUser:e.user});else if(E)e=await A({chainType:"solana",walletIndex:0,latestUser:g});else{if(!S)return void m({shouldCallAuthOnSuccess:w});e=await A({chainType:"ethereum",walletIndex:0,latestUser:g})}T(e),a(Ja)}catch(e){u(e.message)}}));return n.useEffect((()=>h&&g?j?(t({...o,createWallet:{...o.createWallet,shouldCreateEth:S,shouldCreateSol:E},recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0,shouldCreateEth:S,shouldCreateSol:E}}),a(Cg({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:p.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void I.execute():(a(cg),void v(Error("User must be authenticated before creating a Privy wallet")))),[j,h]),s.current=()=>null/*#__PURE__*/,e.jsx(el,{errorMessage:c||void 0,onClose:()=>{k?(x(k),m({shouldCallAuthOnSuccess:w})):(v(new d.PrivyEmbeddedWalletError("User wallet creation failed")),m({shouldCallAuthOnSuccess:!1}))}})}},nl={component:()=>{let{user:t,logout:n}=i.usePrivyContext(),{onUserCloseViaDialogOrKeybindRef:a,setModalData:o,navigate:s}=Xn(),l=qn(),{acceptTerms:c,closePrivyModal:d,createAnalyticsEvent:u}=r.usePrivyInternal(),p=e=>{e?.preventDefault(),d({shouldCallAuthOnSuccess:!1}),n()};a.current=p;/*#__PURE__*/return e.jsx(rl,{termsAndConditionsUrl:l?.legal.termsAndConditionsUrl,privacyPolicyUrl:l?.legal.privacyPolicyUrl,onAccept:async e=>{e?.preventDefault(),await c(),t&&fs(t,l.embeddedWallets)?(o({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),s(tl)):d()},onDecline:p})}},rl=({termsAndConditionsUrl:n,privacyPolicyUrl:r,onAccept:i,onDecline:a,title:o="One last step",subtitle:s="By signing up, you agree to our terms and privacy policy."})=>/*#__PURE__*/e.jsx(bi,{title:o,subtitle:s,icon:t.FileCheck,primaryCta:{label:"Accept",onClick:i},secondaryCta:{label:"No thanks",onClick:a},watermark:!0,children:(n||r)&&/*#__PURE__*/e.jsxs(il,{children:[n&&/*#__PURE__*/e.jsxs(Er,{variant:"muted",href:n,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Terms",/*#__PURE__*/e.jsx(t.ExternalLink,{width:16,height:16,strokeWidth:2.25})]}),r&&/*#__PURE__*/e.jsxs(Er,{variant:"muted",href:r,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Privacy Policy",/*#__PURE__*/e.jsx(t.ExternalLink,{width:16,height:16,strokeWidth:2.25})]})]})});let il=/*#__PURE__*/a.styled.div.withConfig({displayName:"LinksContainer",componentId:"sc-21e1b98c-0"})(["display:flex;flex-direction:column;gap:12px;margin-top:var(--screen-space);"]);const al=({color:t,...n})=>/*#__PURE__*/e.jsx("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...n,children:/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:t||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});let ol=/*#__PURE__*/a.styled.button.withConfig({displayName:"CopyTextButton",componentId:"sc-4b0620dc-0"})(["display:flex;align-items:center;gap:0.5rem;&:hover{text-decoration:underline;}svg{width:0.875rem;height:0.875rem;}"]),sl=/*#__PURE__*/a.styled.span.withConfig({displayName:"CopiedText",componentId:"sc-4b0620dc-1"})(["display:flex;align-items:center;gap:0.25rem;font-size:0.875rem;color:var(--privy-color-foreground-2);"]),ll=/*#__PURE__*/a.styled(We.default).withConfig({displayName:"GreenCheck",componentId:"sc-4b0620dc-2"})(["color:var(--privy-color-success);"]),cl=/*#__PURE__*/a.styled(al).withConfig({displayName:"StyledCopy",componentId:"sc-4b0620dc-3"})(["color:var(--privy-color-foreground-3);opactiy:0.5;"]);function dl({children:t,iconOnly:r,value:i,hideCopyIcon:a,...o}){let[s,l]=n.useState(!1);/*#__PURE__*/return e.jsxs(ol,{...o,onClick:()=>{navigator.clipboard.writeText(i||t).catch(console.error),l(!0),setTimeout((()=>l(!1)),1500)},children:[t," ",s?/*#__PURE__*/e.jsxs(sl,{children:[/*#__PURE__*/e.jsx(ll,{})," ",!r&&"Copied"]}):!a&&/*#__PURE__*/e.jsx(cl,{})]})}const ul=()=>/*#__PURE__*/e.jsx("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:/*#__PURE__*/e.jsx("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});let pl=(e,t,n,r,i)=>{for(let a=t;a<t+r;a++)for(let t=n;t<n+i;t++){let n=e?.[t];n&&n[a]&&(n[a]=0)}return e},hl=({x:t,y:n,cellSize:r,bgColor:i,fgColor:a})=>
19
- /*#__PURE__*/e.jsx(e.Fragment,{children:[0,1,2].map((o=>/*#__PURE__*/e.jsx("circle",{r:r*(7-2*o)/2,cx:t+7*r/2,cy:n+7*r/2,fill:o%2!=0?i:a},`finder-${t}-${n}-${o}`)))}),gl=({cellSize:t,matrixSize:n,bgColor:r,fgColor:i})=>/*#__PURE__*/e.jsx(e.Fragment,{children:[[0,0],[(n-7)*t,0],[0,(n-7)*t]].map((([n,a])=>/*#__PURE__*/e.jsx(hl,{x:n,y:a,cellSize:t,bgColor:r,fgColor:i},`finder-${n}-${a}`)))}),ml=({matrix:t,cellSize:n,color:r})=>/*#__PURE__*/e.jsx(e.Fragment,{children:t.map(((t,i)=>t.map(((t,a)=>t?/*#__PURE__*/e.jsx("rect",{height:n-.4,width:n-.4,x:i*n+.1*n,y:a*n+.1*n,rx:.5*n,ry:.5*n,fill:r},`cell-${i}-${a}`):/*#__PURE__*/e.jsx(le.default.Fragment,{},`circle-${i}-${a}`)))))}),yl=({cellSize:t,matrixSize:n,element:r,sizePercentage:i,bgColor:a})=>{if(!r)/*#__PURE__*/return e.jsx(e.Fragment,{});let o=n*(i||.14),s=Math.floor(n/2-o/2),l=Math.floor(n/2+o/2);(l-s)%2!=n%2&&(l+=1);let c=(l-s)*t,d=c-.2*c,u=s*t;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("rect",{x:s*t,y:s*t,width:c,height:c,fill:a}),/*#__PURE__*/e.jsx(r,{x:u+.1*c,y:u+.1*c,height:d,width:d})]})},fl=t=>{let n=t.outputSize,r=((e,t)=>{let n=De.default.create(e,{errorCorrectionLevel:t}).modules,r=((e,t)=>{let n=e.slice(0),r=[];for(;n.length;)r.push(n.splice(0,t));return r})(Array.from(n.data),n.size);return r=pl(r,0,0,7,7),r=pl(r,r.length-7,0,7,7),pl(r,0,r.length-7,7,7)})(t.url,t.errorCorrectionLevel),i=n/r.length,a=function(e,{min:t,max:n}){return Math.min(Math.max(e,t),n)}(2*i,{min:.025*n,max:.036*n});/*#__PURE__*/return e.jsxs("svg",{height:t.outputSize,width:t.outputSize,viewBox:`0 0 ${t.outputSize} ${t.outputSize}`,style:{height:"100%",width:"100%",padding:`${a}px`},children:[/*#__PURE__*/e.jsx(ml,{matrix:r,cellSize:i,color:t.fgColor}),/*#__PURE__*/e.jsx(gl,{cellSize:i,matrixSize:r.length,fgColor:t.fgColor,bgColor:t.bgColor}),/*#__PURE__*/e.jsx(yl,{cellSize:i,element:t.logo?.element,bgColor:t.bgColor,matrixSize:r.length})]})},xl=/*#__PURE__*/a.styled.div.attrs({className:"ph-no-capture"}).withConfig({displayName:"QrContainer",componentId:"sc-597e27f3-0"})(["display:flex;justify-content:center;align-items:center;height:",";width:",";margin:auto;background-color:",";&&{border-width:2px;border-color:",";border-radius:var(--privy-border-radius-md);}"],(e=>`${e.$size}px`),(e=>`${e.$size}px`),(e=>e.$bgColor),(e=>e.$borderColor));const vl=t=>{let{appearance:n}=qn(),r=t.bgColor||"#FFFFFF",i=t.fgColor||"#000000",a=t.size||160,o="dark"===n.palette.colorScheme?r:i;/*#__PURE__*/return e.jsx(xl,{$size:a,$bgColor:r,$fgColor:i,$borderColor:o,children:/*#__PURE__*/e.jsx(fl,{url:t.url,logo:{element:t.squareLogoElement??ul},outputSize:a,bgColor:r,fgColor:i,errorCorrectionLevel:t.errorCorrectionLevel||"Q"})})},wl=/*#__PURE__*/a.styled.span.withConfig({displayName:"ErrorMessage",componentId:"sc-fcb8cd50-0"})(["text-align:left;font-size:0.75rem;font-weight:500;line-height:1.125rem;color:var(--privy-color-error);"]);let Cl=/*#__PURE__*/a.styled.label.withConfig({displayName:"BaseEmailForm",componentId:"sc-f34af797-0"})(["display:block;position:relative;width:100%;height:56px;&& > :first-child{position:absolute;left:0.75em;top:50%;transform:translate(0,-50%);}&& > input{font-size:16px;line-height:24px;color:var(--privy-color-foreground);padding:12px 88px 12px 52px;flex-grow:1;background:var(--privy-color-background);border:1px solid ",";border-radius:var(--privy-border-radius-md);width:100%;height:100%;@media (min-width:441px){font-size:14px;padding-right:78px;}:focus{outline:none;border-color:",";box-shadow:",";}:autofill,:-webkit-autofill{background:var(--privy-color-background);}&& > input::placeholder{color:var(--privy-color-foreground-3);}&:disabled{opacity:0.4;cursor:not-allowed;}&:disabled,&:disabled:hover,&:disabled > span{color:var(--privy-color-foreground-3);}}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;}&:disabled{opacity:0.4;cursor:not-allowed;}&:disabled,&:disabled:hover,&:disabled > span{color:var(--privy-color-foreground-3);}}"],(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-foreground-4)"),(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-accent-light)"),(({$error:e})=>e?"none":"0 0 0 1px var(--privy-color-accent-light)"));const bl=/*#__PURE__*/a.styled(Cl).withConfig({displayName:"EmailUpdateForm",componentId:"sc-f34af797-1"})(["background-color:var(--privy-color-background);transition:background-color 200ms ease;&& > button{right:0;line-height:24px;position:absolute;padding:13px 17px;background-color:#090;:focus{outline:none;border-color:var(--privy-color-accent);}}"]),jl=/*#__PURE__*/a.styled(Cl).withConfig({displayName:"EmailInputForm",componentId:"sc-f34af797-2"})(["&& > input{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-right:",";border:1px solid ",";&& > input::placeholder{color:var(--privy-color-foreground-3);}}&& > :last-child{right:16px;position:absolute;top:50%;transform:translate(0,-50%);}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;}}"],(e=>e.$stacked?"16px":"88px"),(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-foreground-4)")),kl=/*#__PURE__*/a.styled.div.withConfig({displayName:"InputContainerForm",componentId:"sc-f34af797-3"})(["width:100%;&& > ","{display:block;text-align:left;padding-left:var(--privy-border-radius-md);padding-bottom:5px;}"],wl),Tl=({...t})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),/*#__PURE__*/e.jsx("path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2"}),/*#__PURE__*/e.jsx("path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21"})]}),Al={phantom:{mobile:{native:"phantom://",universal:"https://phantom.app/ul/"}},solflare:{mobile:{native:void 0,universal:"https://solflare.com/ul/v1/"}},metamask:{image_url:{sm:yn,md:yn}}};class Sl{static normalize(e){return e.replace(/[-_]wallet$/,"").replace(/[-_]extension$/,"").toLowerCase()}isEth(e){return e.chains.some((e=>e.startsWith("eip155:")))}isSol(e){return e.chains.some((e=>e.startsWith("solana:")))}inAllowList(e,t){if(!this.normalizedAllowList||0===this.normalizedAllowList.length||"listing"===t&&this.includeWalletConnect)return!0;let n=Sl.normalize(e);return this.normalizedAllowList.some((e=>n===Sl.normalize(e)))}chainMatches(e){return"ethereum-only"===this.chainFilter?"ethereum"===e:"solana-only"!==this.chainFilter||"solana"===e}connectorOk(e){return!!("null"!==e.connectorType&&this.chainMatches(e.chainType)&&(this.inAllowList(e.walletClientType,"connector")||("injected"===e.connectorType||"solana_adapter"===e.connectorType)&&("ethereum"===e.chainType&&this.detectedEth||"solana"===e.chainType&&this.detectedSol)))}listingOk(e){if(e.slug.includes("coinbase"))return!1;if("ethereum-only"===this.chainFilter){if(!this.isEth(e))return!1}else if("solana-only"===this.chainFilter&&!this.isSol(e))return!1;return!!this.inAllowList(e.slug,"listing")}getWallets(e,t){let n=new Map,r=e=>{let t=n.get(e.id);if(t){t.chainType!==e.chainType&&(t.chainType="multi");let n=new Set(t.chains);e.chains.forEach((e=>n.add(e))),t.chains=Array.from(n),!t.icon&&e.icon&&(t.icon=e.icon),!t.url&&e.url&&(t.url=e.url),!t.listing&&e.listing&&(t.listing=e.listing)}else n.set(e.id,e)};e.filter((e=>this.connectorOk(e))).forEach((e=>{let t=Sl.normalize(e.walletClientType);r({id:t,label:e.walletBranding?.name??t,source:"connector",connector:e,chainType:e.chainType,icon:e.walletBranding?.icon,url:void 0,chains:["ethereum"===e.chainType?"eip155":"solana"]})})),t.filter((e=>this.listingOk(e))).forEach((e=>{let t=this.isEth(e),n=this.isSol(e),i=Sl.normalize(e.slug),a=Al[e.slug],o=a?.image_url?.sm||e.image_url?.sm;r({id:i,label:e.name||i,source:"listing",listing:e,chainType:t&&n?"multi":t?"ethereum":"solana",icon:o,url:e.homepage,chains:e.chains})}));let i=e.find((e=>"wallet_connect_v2"===e.connectorType));this.includeWalletConnectQr&&i&&r({id:"wallet_connect_qr",label:"WalletConnect",source:"connector",connector:i,chainType:"ethereum",icon:Yn,url:void 0,chains:["ethereum"===i.chainType?"eip155":"solana"]});let a=Array.from(n.values());a.forEach((e=>{let t=Al[e.listing?.slug||e.id];t?.image_url?.sm&&(e.icon=t.image_url.sm)}));let o=new Map;return this.normalizedAllowList?.forEach(((e,t)=>{o.set(Sl.normalize(e),t)})),{wallets:a.slice().sort(((e,t)=>{let n=Sl.normalize(e.id),r=Sl.normalize(t.id);"binance-defi"===n?n="binance":"universalprofiles"===n?n="universal_profile":"cryptocom-defi"===n&&(n="cryptocom"),"binance-defi"===r?r="binance":"universalprofiles"===r?r="universal_profile":"cryptocom-defi"===r&&(r="cryptocom");let i=o.has(n),a=o.has(r);return i&&a?o.get(n)-o.get(r):i?-1:a?1:"connector"===e.source&&"listing"===t.source?-1:"listing"===e.source&&"connector"===t.source?1:e.label.toLowerCase().localeCompare(t.label.toLowerCase())})),walletCount:a.length}}constructor(e,t){this.chainFilter=e,t&&t.length>0&&(this.normalizedAllowList=t.map(String),this.normalizedAllowList.includes("binance")&&this.normalizedAllowList.push("binance-defi-wallet")),this.detectedEth=this.normalizedAllowList?.includes("detected_ethereum_wallets")??!1,this.detectedSol=this.normalizedAllowList?.includes("detected_solana_wallets")??!1,this.includeWalletConnect=this.normalizedAllowList?.includes("wallet_connect")??!1,this.includeWalletConnectQr=this.normalizedAllowList?.includes("wallet_connect_qr")??!1}}var El=t=>/*#__PURE__*/e.jsxs("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("path",{d:"m0 0h32v32h-32z",fill:"#5469d4"}),/*#__PURE__*/e.jsx("path",{d:"m15.997 5.333-.143.486v14.106l.143.143 6.548-3.87z",fill:"#c2ccf4"}),/*#__PURE__*/e.jsx("path",{d:"m15.996 5.333-6.548 10.865 6.548 3.87z",fill:"#fff"}),/*#__PURE__*/e.jsx("path",{d:"m15.997 21.306-.08.098v5.025l.08.236 6.552-9.227z",fill:"#c2ccf4"}),/*#__PURE__*/e.jsx("path",{d:"m15.996 26.665v-5.36l-6.548-3.867z",fill:"#fff"}),/*#__PURE__*/e.jsx("path",{d:"m15.995 20.07 6.548-3.87-6.548-2.976v6.847z",fill:"#8698e8"}),/*#__PURE__*/e.jsx("path",{d:"m9.448 16.2 6.548 3.87v-6.846z",fill:"#c2ccf4"})]}),Il=t=>/*#__PURE__*/e.jsxs("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsxs("linearGradient",{id:"a",gradientUnits:"userSpaceOnUse",x1:"7.233",x2:"24.766",y1:"24.766",y2:"7.234",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#9945ff"}),/*#__PURE__*/e.jsx("stop",{offset:".2",stopColor:"#7962e7"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#00d18c"})]}),/*#__PURE__*/e.jsx("path",{d:"m0 0h32v32h-32z",fill:"#10111a"}),/*#__PURE__*/e.jsx("path",{clipRule:"evenodd",d:"m9.873 20.41a.645.645 0 0 1 .476-.21l14.662.012a.323.323 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54zm15.376-2.862a.322.322 0 0 1 -.238.54l-14.662.012a.642.642 0 0 1 -.476-.21l-3.122-3.44a.323.323 0 0 1 .238-.54l14.662-.012a.644.644 0 0 1 .475.21zm-15.376-9.738a.644.644 0 0 1 .476-.21l14.662.012a.322.322 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54z",fill:"url(#a)",fillRule:"evenodd"})]});const Pl=/*#__PURE__*/a.styled.div.withConfig({displayName:"Header",componentId:"sc-9b65f2b6-0"})(["display:flex;justify-content:space-between;align-items:center;"]),Nl=/*#__PURE__*/a.styled.button.withConfig({displayName:"CloseButton",componentId:"sc-9b65f2b6-1"})(["padding:0.25rem;height:30px;width:30px;display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-full);background:var(--privy-color-background-2);"]),_l=/*#__PURE__*/a.styled.div.withConfig({displayName:"WalletIconWithActiveIndicator",componentId:"sc-9b65f2b6-2"})(["position:relative;display:inline-flex;align-items:center;&::after{content:' ';border-radius:var(--privy-border-radius-full);height:6px;width:6px;background-color:var(--privy-color-icon-success);position:absolute;right:-3px;top:-3px;}"]),Ml=/*#__PURE__*/a.styled.img.withConfig({displayName:"WalletIcon",componentId:"sc-9b65f2b6-3"})(["width:32px;height:32px;border-radius:0.25rem;object-fit:contain;"]),Fl=/*#__PURE__*/a.styled.span.withConfig({displayName:"Chip",componentId:"sc-9b65f2b6-4"})(["display:flex;gap:0.25rem;align-items:center;padding:0.25rem 0.5rem;font-size:0.75rem;font-weight:500;line-height:1.125rem;border-radius:var(--privy-border-radius-sm);background-color:var(--privy-color-background-2);svg{width:100%;max-width:1rem;max-height:1rem;stroke-width:2;}"]),Ll=/*#__PURE__*/a.styled.div.withConfig({displayName:"ScrollContainer",componentId:"sc-9b65f2b6-5"})(["display:flex;flex-direction:column;gap:0.5rem;max-height:24rem;overflow-y:scroll;&::-webkit-scrollbar{display:none;}scrollbar-gutter:stable both-edges;scrollbar-width:none;-ms-overflow-style:none;"," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;"],(e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0)),Wl=q.create((()=>({isModalOpen:!1,resolvers:null})));let Dl=q.create((()=>({})));const Rl=({address:e,client:t,appId:n})=>{let r=`${t}:${e}`;n&&Ze.put(Ol(n),r),Wl.setState({wallet:r})},Ol=e=>`privy:${e}:active-wallet-connection`;function Bl({walletList:e,walletChainType:t}){let i=qn(),{connectors:a}=r.usePrivyInternal(),o=En((e=>e.listings)),s=t??i.appearance.walletChainType,l=e??i.appearance?.walletList,c=n.useMemo((()=>new Sl(s,l)),[s,l]),{wallets:d,walletCount:u}=n.useMemo((()=>c.getWallets(a,o)),[c,a,o]),[p,h]=n.useState(""),g=n.useMemo((()=>p?d.filter((e=>e.label.toLowerCase().includes(p.toLowerCase()))):d),[p,d]),[m,y]=n.useState();return{selected:m,setSelected:y,search:p,setSearch:h,wallets:g,walletCount:u}}let Ul=e=>!e||"string"!=typeof e&&(e instanceof gn||e instanceof An);const zl=({index:t,style:n,data:r,recent:i})=>{let a=r.wallets[t],{walletChainType:o,handleWalletClick:s}=r,l={...n,boxSizing:"border-box"};return a?/*#__PURE__*/e.jsxs(ql,{style:l,onClick:()=>s(a),children:[a.icon&&(a.connector&&!Ul(a.connector)?/*#__PURE__*/e.jsx(_l,{children:"string"==typeof a.icon?/*#__PURE__*/e.jsx(Ml,{src:a.icon}):/*#__PURE__*/e.jsx(a.icon,{style:{width:"32px",height:"32px"}})}):"string"==typeof a.icon?/*#__PURE__*/e.jsx(Ml,{src:a.icon}):/*#__PURE__*/e.jsx(a.icon,{style:{width:"32px",height:"32px"}})),/*#__PURE__*/e.jsx(Zl,{children:a.label}),i?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Fl,{children:"Last used"}),/*#__PURE__*/e.jsx(Gl,{children:/*#__PURE__*/e.jsxs(e.Fragment,{children:["ethereum-only"===o&&/*#__PURE__*/e.jsx(El,{}),"solana-only"===o&&/*#__PURE__*/e.jsx(Il,{})]})})]}):/*#__PURE__*/e.jsx(Gl,{children:!("ethereum-only"===o||"solana-only"===o)&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[a.chains?.some((e=>e.startsWith("eip155")))&&/*#__PURE__*/e.jsx(El,{}),a.chains?.some((e=>e.startsWith("solana")))&&/*#__PURE__*/e.jsx(Il,{})]})})]}):null};var Hl=({className:t,customDescription:i,connectOnly:a,preSelectedWalletId:o,...s})=>{let l=qn(),{connectors:c}=r.usePrivyInternal(),u=s.walletChainType||l.appearance.walletChainType,p=s.walletList||l.appearance?.walletList,{onBack:h,onClose:g,app:m}=s,{selected:y,setSelected:f,qrUrl:x,setQrUrl:w,connecting:C,uiState:b,wallets:j,walletCount:k,handleConnect:T,handleBack:A,showSearchBar:S,isInitialConnectView:E,title:I,search:P,setSearch:N}=function({onConnect:e,onBack:t,onClose:i,onConnectError:a,walletList:o,walletChainType:s,app:l}){let c=qn(),{connectors:u}=r.usePrivyInternal(),{wallets:p,walletCount:h,search:g,setSearch:m,selected:y,setSelected:f}=Bl({walletList:o,walletChainType:s}),[x,w]=n.useState(),[C,b]=n.useState(),[j,k]=n.useState(),T=!y&&!C&&!j,A=T&&(h>6||g.length>0),S=u.find((e=>"wallet_connect_v2"===e.connectorType)),E=n.useCallback((async(t,n)=>{if(t){if(j?.connector===t)return void console.log("Already connecting to this wallet, skipping duplicate attempt");if(w("loading"),"string"==typeof t)return k({connector:t,name:n?.name??"Wallet",icon:n?.icon}),void window.open(t,"_blank");k({connector:t,name:n?.name??t.walletBranding.name??"Wallet",icon:n?.icon??t.walletBranding.icon});try{let n=await t.connect({showPrompt:!0});if(!n)return w("error"),void a?.(new d.PrivyConnectorError("Unable to connect wallet"));w("success"),Rl({address:n.address,client:n.walletClientType,appId:c.id}),setTimeout((()=>{e({connector:t,wallet:n})}),it)}catch(t){if(console.error("ERROR: ",{e:t}),t?.message?.includes("already pending for origin")||t?.message?.includes("wallet_requestPermissions"))return void console.log("Connection request already pending, maintaining loading state");w("error"),a?.(new d.PrivyConnectorError("Unable to connect wallet"))}}}),[c.id,e,j]),I=n.useCallback((()=>C?(w(void 0),k(void 0),void b(void 0)):j?(w(void 0),void k(void 0)):y?(w(void 0),k(void 0),void f(void 0)):"error"===x||"loading"===x?(w(void 0),void k(void 0)):void t?.()),[C,j,y,x,t]),P=n.useMemo((()=>j?.connector===S&&C&&v.isMobile?`Go to ${j.name} to continue`:j?.connector===S&&C?`Scan code to connect to ${j.name}`:"string"==typeof j?.connector?`Open or install ${j.name}`:y&&!j?"Select network":j?null:"Select your wallet"),[j,C,y,S]);return{selected:y,setSelected:f,qrUrl:C,setQrUrl:b,connecting:j,uiState:x,search:g,setSearch:m,wallets:p,walletCount:h,wc:S,isInitialConnectView:T,showSearchBar:A,title:P,handleConnect:E,handleBack:I,onClose:i,onConnect:e,app:l}}({...s,walletList:p,walletChainType:u}),_=c.find((e=>"wallet_connect_v2"===e.connectorType)),M=n.useRef(null),F=U.useVirtualizer({count:j.length,getScrollElement:()=>M.current,estimateSize:()=>56,overscan:6,gap:5}),L=n.useCallback((async e=>{let t,n="solana-only"!==u&&e.chains?.some((e=>e.startsWith("eip155"))),r="ethereum-only"!==u&&e.chains?.some((e=>e.startsWith("solana"))),i=vn[e.id];if(r&&i)t=i.getMobileRedirect({isSolana:!0,connectOnly:!!a,useUniversalLink:!1});else{let n=e.listing?.mobile?.native;t=e.listing?.mobile?.universal||n||e.url}if(n&&r){let n=Sl.normalize(e.id),r=c.filter((e=>Sl.normalize(e.walletClientType)===n&&!("ethereum"===e.chainType&&e instanceof gn||"solana"===e.chainType&&e instanceof An))),i=r.find((e=>"ethereum"===e.chainType)),a=r.find((e=>"solana"===e.chainType));if(!i&&e.listing){let t=Al[e.listing.slug]?{...e.listing,...Al[e.listing.slug]}:e.listing;_.setWalletEntry(t,w),await _.resetConnection(e.id),i=_}if(!a&&t&&(a=t),i||a)return void f({eth:i,sol:a,name:e.label,icon:e.icon})}if(!Ul(e.connector))return"wallet_connect_v2"===e.connector?.connectorType&&(await _.resetConnection(e.id),_.setWalletEntry({id:"wallet_connect_qr",name:"WalletConnect",rdns:"",slug:"wallet-connect",homepage:"",chains:["eip155"],mobile:{native:"",universal:void 0}},w)),void await T(e.connector,{name:e.label,icon:e.icon});if(n||r||e.url||e.listing){if(n&&e.listing){let t=Al[e.listing.slug]?{...e.listing,...Al[e.listing.slug]}:e.listing;_.setWalletEntry(t,w),await _.resetConnection(e.id)}if(n&&r)return void f({eth:_,sol:t,name:e.label,icon:e.icon});if(r)return void await T(t,{name:e.label,icon:e.icon});if(n)return void(e.listing?await T(_,{name:e.label,icon:e.icon}):e.url?await T(e.url,{name:e.label,icon:e.icon}):console.warn("Cannot connect to EVM wallet without connector or listing details:",e.label));if(e.url)return void await T(e.url,{name:e.label,icon:e.icon})}}),[_,T,f,w,A,g,m,E,I,i,l,c]),W=h||A,D=!!h||!E;return n.useEffect((()=>{if(!o)return;let e=j.find((({id:e})=>e===o));e&&L(e).catch(console.error)}),[o]),/*#__PURE__*/e.jsxs(mi,{className:t,children:[/*#__PURE__*/e.jsx(mi.Header,{icon:C&&!x||x&&v.isMobile&&C?.icon?C.icon:C?void 0:Tl,iconVariant:C&&!x||x&&v.isMobile?"loading":void 0,iconLoadingStatus:C&&!x||x&&v.isMobile?{success:"success"===b,fail:"error"===b}:void 0,title:C&&!x?`Waiting for ${C.name}`:x&&v.isMobile?`Waiting for ${C?.name??"connection"}`:I,subtitle:C&&!x&&"string"==typeof C.connector?`To connect to ${C.name}, install and open the app. Then confirm the connection when prompted.`:C&&!x&&"string"!=typeof C.connector?"error"===b?"Please try connecting again.":"For the best experience, connect only one wallet at a time.":E?i??(m?`Connect a wallet to your ${m.name} account`:null):null,showBack:D,showClose:!0,onBack:W,onClose:g}),/*#__PURE__*/e.jsxs(mi.Body,{ref:M,$colorScheme:l.appearance.palette.colorScheme,style:{marginBottom:x?"0.5rem":void 0},children:[S&&/*#__PURE__*/e.jsx(Vl,{children:/*#__PURE__*/e.jsxs(bl,{style:{background:"transparent"},children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(B.MagnifyingGlassIcon,{})}),/*#__PURE__*/e.jsx("input",{className:"login-method-button",type:"text",placeholder:"Search wallets",onChange:e=>N(e.target.value),value:P})]})}),x&&v.isMobile&&"loading"===b&&/*#__PURE__*/e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:/*#__PURE__*/e.jsx(Er,{variant:"primary",onClick:()=>window.open(x.universal??x.native,"_blank"),style:{width:"100%"},children:"Open in app"})}),x&&!v.isMobile&&"loading"===b&&/*#__PURE__*/e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:/*#__PURE__*/e.jsx(Kl,{value:x.universal??x.native,iconOnly:!0,children:"Copy link"})}),x&&!v.isMobile&&/*#__PURE__*/e.jsx(vl,{size:280,url:x.universal??x.native,squareLogoElement:C?.icon?"string"==typeof C.icon?t=>/*#__PURE__*/e.jsx("svg",{...t,children:/*#__PURE__*/e.jsx("image",{href:C.icon,height:t.height,width:t.width})}):C.icon:Gn}),/*#__PURE__*/e.jsxs($l,{children:[C&&!x&&"string"==typeof C.connector&&/*#__PURE__*/e.jsxs(ql,{onClick:()=>window.open(C.connector,"_blank"),children:[C.icon&&("string"==typeof C.icon?/*#__PURE__*/e.jsx(Ml,{src:C.icon}):/*#__PURE__*/e.jsx(C.icon,{})),/*#__PURE__*/e.jsx(Zl,{children:C.name})]}),y?.eth&&!C&&/*#__PURE__*/e.jsxs(ql,{onClick:()=>T(y.eth,{name:y.name,icon:y.icon}),children:[y.icon&&("string"==typeof y.icon?/*#__PURE__*/e.jsx(Ml,{src:y.icon}):/*#__PURE__*/e.jsx(y.icon,{})),/*#__PURE__*/e.jsx(Zl,{children:y.name}),/*#__PURE__*/e.jsx(Gl,{children:/*#__PURE__*/e.jsx(El,{})})]}),y?.sol&&!C&&/*#__PURE__*/e.jsxs(ql,{onClick:()=>T(y.sol,{name:y.name,icon:y.icon}),children:[y.icon&&("string"==typeof y.icon?/*#__PURE__*/e.jsx(Ml,{src:y.icon}):/*#__PURE__*/e.jsx(y.icon,{})),/*#__PURE__*/e.jsx(Zl,{children:y.name}),/*#__PURE__*/e.jsx(Gl,{children:/*#__PURE__*/e.jsx(Il,{})})]}),E&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[!(k>0)&&/*#__PURE__*/e.jsx(Yl,{children:"No wallets found. Try another search."}),k>0&&!x&&/*#__PURE__*/e.jsx("div",{style:{maxHeight:56*Math.min(j.length,5)+5,width:"100%"},children:/*#__PURE__*/e.jsx("div",{style:{height:`${F.getTotalSize()}px`,width:"100%",position:"relative"},children:F.getVirtualItems().map((t=>/*#__PURE__*/e.jsx(zl,{index:t.index,style:{position:"absolute",top:0,left:0,height:`${t.size}px`,transform:`translateY(${t.start}px)`},data:{wallets:j,walletChainType:u,handleWalletClick:L}},t.key)))})})]})]})]}),/*#__PURE__*/e.jsxs(mi.Footer,{children:[C&&!x&&"string"!=typeof C.connector&&"error"===b&&/*#__PURE__*/e.jsx(mi.Actions,{children:/*#__PURE__*/e.jsx(Er,{style:{width:"100%",alignItems:"center"},variant:"error",onClick:()=>T(C.connector,{name:C.name,icon:C.icon}),children:"Retry"})}),!!(m&&m.legal.privacyPolicyUrl&&m.legal.termsAndConditionsUrl)&&/*#__PURE__*/e.jsx(fr,{app:m,alwaysShowImplicitConsent:!0}),/*#__PURE__*/e.jsx(mi.Watermark,{})]})]})};let Vl=/*#__PURE__*/a.styled.div.withConfig({displayName:"StickySearchContainer",componentId:"sc-850f7dce-0"})(["position:sticky;margin-top:-3px;padding-top:3px;top:-3px;z-index:1;background:var(--privy-color-background);padding-bottom:calc(var(--screen-space) / 2);"]),$l=/*#__PURE__*/a.styled.div.withConfig({displayName:"WalletListContainer",componentId:"sc-850f7dce-1"})(["display:flex;flex-direction:column;gap:","px;"],5),ql=/*#__PURE__*/a.styled.button.withConfig({displayName:"Button",componentId:"sc-850f7dce-2"})(["&&{gap:0.5rem;align-items:center;display:flex;position:relative;text-align:left;font-weight:500;transition:background 200ms ease-in;width:calc(100% - 4px);border-radius:var(--privy-border-radius-md);padding:0.75em;border:1px solid var(--privy-color-foreground-4);justify-content:space-between;}&:hover{background:var(--privy-color-background-2);}"]),Gl=/*#__PURE__*/a.styled.span.withConfig({displayName:"ButtonBadge",componentId:"sc-850f7dce-3"})(["display:flex;align-items:center;justify-content:end;position:relative;& > svg{border-radius:var(--privy-border-radius-full);stroke-width:2.5;width:100%;max-height:1rem;max-width:1rem;flex-shrink:0;}& > svg:not(:last-child){border-radius:var(--privy-border-radius-full);margin-right:-0.375rem;}"]),Yl=/*#__PURE__*/a.styled.div.withConfig({displayName:"EmptyContainer",componentId:"sc-850f7dce-4"})(["height:60px;display:flex;align-items:center;justify-content:center;text-align:center;"]),Zl=/*#__PURE__*/a.styled.span.withConfig({displayName:"WalletName",componentId:"sc-850f7dce-5"})(["text-overflow:ellipsis;white-space:nowrap;color:var(--privy-color-foreground);font-weight:400;flex:1;"]),Kl=/*#__PURE__*/a.styled(dl).withConfig({displayName:"StyledCopyableText",componentId:"sc-850f7dce-6"})(["&&{margin:0.5rem auto 0 auto;}"]);const Ql=({...t})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...t,children:[/*#__PURE__*/e.jsxs("g",{clipPath:"url(#clip0_2856_1743)",children:[/*#__PURE__*/e.jsx("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),/*#__PURE__*/e.jsx("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2856_1743",children:/*#__PURE__*/e.jsx("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),Xl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>l.isHex(e,{strict:!0}))).map((e=>l.getAddress(e)));return!!t?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&t.includes(e.address))).length};let Jl=/*#__PURE__*/n.createContext({plugins:{current:{}}});const ec=()=>{let{plugins:e}=n.useContext(Jl);return n.useCallback((t=>e.current[t]),[e])},tc=Symbol("solana-ledger-plugin"),nc=({title:n="You don't have access to this app",subtitle:r="Have you been invited?",ctaText:i="Try another account",ctaLink:a,onCtaClick:o})=>/*#__PURE__*/e.jsx(bi,{title:n,subtitle:r,icon:t.Lock,iconVariant:"warning",primaryCta:{label:i,onClick:()=>{a?window.open(a,"_blank"):o?.()}},watermark:!0}),rc={component:()=>{let{navigate:t}=Xn(),n=qn(),r=n?.allowlistConfig.errorTitle||"You don't have access to this app",i=n?.allowlistConfig.errorDetail||"Have you been invited?",a=n?.allowlistConfig.errorCtaText||"Try another account",o=n?.allowlistConfig.errorCtaLink;/*#__PURE__*/return e.jsx(nc,{title:r,subtitle:i,ctaText:a,ctaLink:o??void 0,onCtaClick:()=>{t(cg)}})}},ic=({status:r,title:i,description:a,userIntentRequired:o,retriesRemaining:s,hasSelectedCta:l,onContinue:c,onRetry:d})=>{let u=n.useMemo((()=>{switch(r){case"loading":default:return;case"success":return o?{label:l?"Continuing...":"Continue",onClick:c,disabled:l,loading:l}:void 0;case"error":return s>0?{label:"Retry",onClick:d}:void 0}}),[r,l,c,d]),p=n.useMemo((()=>({loading:"loading",ready:"subtle",disabled:"subtle",success:"success",error:"error"}[r]||"loading")),[r]);/*#__PURE__*/return e.jsx(bi,{icon:"loading"===r||"ready"===r?void 0:"success"===r?t.CheckCircle:t.XCircle,iconVariant:p,title:i,subtitle:a,primaryCta:u,watermark:!0})},ac={component:()=>{let{lastScreen:t,data:r,navigate:i,setModalData:a}=Xn(),{status:o,token:s,waitForResult:l,reset:c,execute:d}=qt(),u=n.useRef([]),p=e=>{u.current=[e,...u.current]},[h,g]=n.useState(!0);n.useEffect((()=>(p(setTimeout(g,1e3,!1)),()=>{u.current.forEach((e=>clearTimeout(e))),u.current=[]})),[]);let[m,y]=n.useState(""),[f,x]=n.useState("Checking that you are a human..."),[v,w]=n.useState(!1),[C,b]=n.useState(3),j=r?.captchaModalData,k=async e=>{try{await(j?.callback(e)),j?.onSuccessNavigateTo&&i(j?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof $t)return;a({errorModalData:{error:e,previousScreen:t||cg}}),i(j?.onErrorNavigateTo||Rs,!1)}};n.useEffect((()=>{"success"===o?p(setTimeout((async()=>{let e=await l();!e||j?.userIntentRequired||k(e)}),1e3)):"ready"===o&&p(setTimeout((()=>{"ready"===o&&d()}),500))}),[o]),n.useEffect((()=>{if(!h)switch(o){case"success":y("Success!"),x("CAPTCHA passed successfully."),j?.userIntentRequired||setTimeout((()=>{w(!0),k(s)}),2e3);break;case"loading":y(""),x("Checking that you are a human...");break;case"error":y("Something went wrong"),x(C<=0?"If you use an adblocker or VPN, try disabling and re-attempting.":"You did not pass CAPTCHA. Please try again.")}}),[o,h,v]);/*#__PURE__*/return e.jsx(ic,{status:o,title:m,description:f,userIntentRequired:j?.userIntentRequired,retriesRemaining:C,hasSelectedCta:v,onContinue:()=>{w(!0),k(s)},onRetry:async()=>{if(C<=0)return;b((e=>e-1)),c(),d();let e=await l();!e||j?.userIntentRequired||k(e)}})}},oc=t=>/*#__PURE__*/e.jsx("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"-0.625 12.48 397.647 399.546",width:"2500",height:"674",preserveAspectRatio:"none",...t,children:/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#333745",d:"M 333.9 12.8 L 150.9 12.8 L 150.9 258.4 L 396.5 258.4 L 396.5 76.7 C 396.6 42.2 368.4 12.8 333.9 12.8 Z M 94.7 12.8 L 64 12.8 C 29.5 12.8 0 40.9 0 76.8 L 0 107.5 L 94.7 107.5 L 94.7 12.8 Z M 0 165 L 94.7 165 L 94.7 259.7 L 0 259.7 L 0 165 Z M 301.9 410.6 L 332.6 410.6 C 367.1 410.6 396.6 382.5 396.6 346.6 L 396.6 316 L 301.9 316 L 301.9 410.6 Z M 150.9 316 L 245.6 316 L 245.6 410.7 L 150.9 410.7 L 150.9 316 Z M 0 316 L 0 346.7 C 0 381.2 28.1 410.7 64 410.7 L 94.7 410.7 L 94.7 316 L 0 316 Z"})})}),sc=({onContinueWithLedger:n,onContinueWithoutLedger:r,title:i="Phantom supports Ledger",subtitle:a="Are you using a Ledger hardware wallet?\nContinue to sign with Ledger"})=>/*#__PURE__*/e.jsx(bi,{title:i,subtitle:/*#__PURE__*/e.jsx(dc,{children:a}),primaryCta:{label:"Continue with Ledger",onClick:n},secondaryCta:{label:"Continue without Ledger",onClick:r},watermark:!0,children:/*#__PURE__*/e.jsxs(cc,{children:[/*#__PURE__*/e.jsx(fn,{style:{width:"48px",height:"48px"}}),/*#__PURE__*/e.jsx(t.ArrowRightLeft,{strokeWidth:2,color:"var(--privy-color-icon-subtle)",width:22,height:22}),/*#__PURE__*/e.jsx(oc,{style:{width:"48px",height:"48px"}})]})});const lc={component:function(){let{data:t,setModalData:n,navigate:r}=Xn();/*#__PURE__*/return e.jsx(sc,{onContinueWithLedger:function(){n({...t,login:{...t?.login,isSigningInWithLedgerSolana:!0}}),r(yc)},onContinueWithoutLedger:function(){n({...t,login:{...t?.login,isSigningInWithLedgerSolana:!1}}),r(yc)}})}};let cc=/*#__PURE__*/a.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-218811f1-0"})(["display:flex;align-items:center;justify-content:center;gap:8px;margin-bottom:var(--screen-space);"]),dc=/*#__PURE__*/a.styled.span.withConfig({displayName:"SubtitleText",componentId:"sc-218811f1-1"})(["white-space:pre-wrap;"]);const uc=({style:t,...n})=>/*#__PURE__*/e.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...t},...n,children:/*#__PURE__*/e.jsx("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})}),pc=({title:t="Unable to sign in",subtitle:n="This is a test application that has reached its user limit. To allow more users, this app needs to be upgraded to production.",onGoBack:r})=>/*#__PURE__*/e.jsx(bi,{title:t,subtitle:n,icon:uc,iconVariant:"subtle",primaryCta:{label:"Go back",onClick:r},showBack:!0,onBack:r,watermark:!0}),hc={component:()=>{let{navigate:t}=Xn();/*#__PURE__*/return e.jsx(pc,{onGoBack:()=>{t(cg)}})}},gc=e=>e?.privyErrorCode===d.PrivyErrorCode.LINKED_TO_ANOTHER_USER?on.ERROR_USER_EXISTS:e instanceof an&&!e.details.default?e.details:e instanceof tn?on.ERROR_TIMED_OUT:e?.privyErrorCode===d.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE?on.ERROR_USER_LIMIT_REACHED:on.ERROR_WALLET_CONNECTION,mc=({walletLogo:t,title:n,subtitle:r,signSuccess:i,errorMessage:a,connectSuccess:o,separateConnectAndSign:s,signing:l,walletConnectRedirectUri:c,walletConnectFallbackUniversalUri:d,hasTabbedAway:u,showCoinbaseWalletResetCta:p,numRetries:h,onBack:g,onSign:m,onRetry:y,onCoinbaseReset:f,onDifferentWallet:x})=>{let v=p?{label:"Use a different wallet",onClick:f,disabled:i}:a===on.ERROR_USER_EXISTS&&g?{label:"Use a different wallet",onClick:x}:o&&!i&&s?{label:l?"Signing":"Sign with your wallet",onClick:m,disabled:l}:!i&&a?.retryable&&h<2?{label:"Retry",onClick:y,disabled:!1}:i||a?void 0:{label:"Connecting",onClick:()=>{},disabled:!0};/*#__PURE__*/return e.jsx(bi,{title:n,subtitle:r,icon:t,iconVariant:"loading",iconLoadingStatus:{success:i,fail:!!a},primaryCta:v,onBack:g,watermark:!0,children:!o&&c&&!u&&/*#__PURE__*/e.jsxs(fc,{children:["Still here?"," ",/*#__PURE__*/e.jsx(ps,{href:c,target:"_blank",variant:"underlined",size:"sm",children:"Try connecting again"}),d&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[" ","or"," ",/*#__PURE__*/e.jsx(ps,{href:d,target:"_blank",variant:"underlined",size:"sm",children:"use this different link"})]})]})})},yc={component:()=>{let t,[a,o]=n.useState(!1),[s,l]=n.useState(!1),[c,u]=n.useState(void 0),{authenticated:p,logout:h}=i.usePrivyContext(),{navigate:g,navigateBack:m,lastScreen:y,currentScreen:f,setModalData:x,data:w}=Xn(),C=qn(),{getAuthFlow:b,walletConnectionStatus:j,closePrivyModal:k,initLoginWithWallet:T,loginWithWallet:A,updateWallets:S,createAnalyticsEvent:E}=r.usePrivyInternal(),{walletConnectors:I}=i.usePrivyContext(),[P,N]=n.useState(0),{user:_}=i.usePrivyContext(),M=ec(),[F]=n.useState(_?.linkedAccounts.length||0),[L,W]=n.useState(""),[D,R]=n.useState(""),[O,B]=n.useState(!1),{hasTabbedAway:U}=function(){let[e,t]=n.useState(!1),r=n.useCallback((()=>{document.hidden&&t(!0)}),[]);return n.useEffect((()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r))),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:z,token:H}=qt(),V=Nn(j?.connector?.walletClientType||"unknown"),$=v.isMobile&&"wallet_connect_v2"===j?.connector?.connectorType||v.isMobile&&"coinbase_wallet"===j?.connector?.connectorType||v.isMobile&&"base_account"===j?.connector?.connectorType||v.isMobile&&"injected"===j?.connector?.connectorType&&"phantom"===j?.connector?.walletClientType||v.isMobile&&"solana_adapter"===j?.connector?.connectorType&&"mobile_wallet_adapter"===j.connector.walletClientType,q="connected"===j?.status,G="switching_to_supported_chain"===j?.status;n.useEffect((()=>{let e=b(),t=e instanceof Et||e instanceof Pt?e:void 0;q&&"solana"===j.connector?.chainType&&"phantom"===j.connector?.walletClientType&&M(tc)&&void 0===w?.login?.isSigningInWithLedgerSolana?g(lc,!1):(q&&!t&&(!z||H||p?T(j.connectedWallet,H,w?.login?.disableSignup,w?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{B(!0)})):(x({captchaModalData:{callback:e=>T(j.connectedWallet,e,w?.login?.disableSignup,w?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{B(!0)})),userIntentRequired:!1,onSuccessNavigateTo:yc,onErrorNavigateTo:Rs}}),g(ac,!1))),t instanceof Pt&&w?.login?.isSigningInWithLedgerSolana&&(t.messageType="transaction"),t&&$&&q&&!t.preparedMessage?t.buildMessage():t&&!$&&q&&(s||(async()=>{l(!0),u(void 0);try{"wallet_connect_v2"===j?.connector?.connectorType&&"metamask"===j?.connector?.walletClientType&&await Ot(2500),await Z()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{l(!1)}})()))}),[P,q,O]),n.useEffect((()=>{if(_&&a){let e=900;if(C?.legal.requireUsersAcceptTerms&&!_.hasAcceptedTerms){let t=setTimeout((()=>{g(nl)}),e);return()=>clearTimeout(t)}if(fs(_,C.embeddedWallets)){let t=setTimeout((()=>{x({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),E({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),h()},callAuthOnSuccessOnClose:!0}}),g(tl)}),e);return()=>clearTimeout(t)}S();let t=setTimeout((()=>k({shouldCallAuthOnSuccess:!0,isSuccess:!0})),it);return()=>clearTimeout(t)}}),[_,a]);let Y=e=>{if(e?.privyErrorCode!==d.PrivyErrorCode.ALLOWLIST_REJECTED){if(e?.privyErrorCode===d.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new d.PrivyUserLimitReachedError(e).toString()),void g(hc);if(e?.privyErrorCode!==d.PrivyErrorCode.USER_DOES_NOT_EXIST)return e?.privyErrorCode===d.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(x({accountTransfer:{nonce:e.data?.data?.nonce,account:b()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:b()?.meta.walletClientType,chainId:b()?.meta.chainId,connectorType:b()?.meta.connectorType},linkMethod:b()instanceof Et?"siwe":"siws",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void g(Qs)):void u(gc(e));g(vs)}else g(rc)};async function Z(){try{await A(),o(!0)}catch(e){Y(e)}finally{l(!1)}}n.useEffect((()=>{j?.connectError&&Y(j?.connectError)}),[j]),((e,t)=>{let r=n.useRef((()=>{}));n.useEffect((()=>{r.current=e})),n.useEffect((()=>{if(null!==t){let e=setInterval((()=>r.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===K&&j?.connector instanceof Zn?j.connector.redirectUri:void 0;e&&W(e);let t="wallet_connect_v2"===K&&j?.connector instanceof Zn?j.connector.fallbackUniversalRedirectUri:void 0;t&&R(t)}),j?.connector instanceof Zn&&!L?500:null);let K=j?.connector?.connectorType||"injected",Q=j?.connector?.walletClientType||"unknown",X=V?.metadata?.shortName||V?.name||j?.connector?.walletBranding.name||"Browser Extension",J=V?.image_url?.md||j?.connector?.walletBranding.icon||(t=>/*#__PURE__*/e.jsx(mn,{...t})),ee="Browser Extension"===X?X.toLowerCase():X;t=a?`Successfully connected with ${ee}`:c?c.message:G?"Switching networks":q?s&&$?"Signing":"Sign to verify":`Waiting for ${ee}`;let te="Don’t see your wallet? Check your other browser windows.";a?te=F===(_?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":P>=2&&c?te="Unable to connect wallet":c?te=c.detail:G?te="Switch your wallet to the requested network.":q&&$?te="Sign the message in your wallet to verify it belongs to you.":"metamask"===Q&&v.isMobile?te="Click continue to open and connect MetaMask.":"metamask"===Q?te="For the best experience, connect only one wallet at a time.":"wallet_connect"===K?te="Open your mobile wallet app to continue":"coinbase_wallet"===K?Mt()||(te=Xl(_)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Confirm in the Coinbase app/popup to continue."):w?.login?.isSigningInWithLedgerSolana&&(te="Ledger requires a transaction to verify your identity. You’ll sign a transaction that performs no onchain action.");let ne=I?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),re="coinbase_wallet"===Q&&(Xl(_)||c===on.ERROR_USER_EXISTS);/*#__PURE__*/return e.jsx(mc,{walletLogo:J,title:t,subtitle:te,signSuccess:a,errorMessage:c,connectSuccess:q,separateConnectAndSign:$,signing:s,walletConnectRedirectUri:L,walletConnectFallbackUniversalUri:D,hasTabbedAway:U,showCoinbaseWalletResetCta:re,numRetries:P,onBack:y&&f!==y?m:void 0,onSign:()=>{l(!0),Z()},onRetry:()=>{N(P+1),u(void 0),q?(l(!0),Z()):j?.connectRetry()},onCoinbaseReset:()=>{ne&&ne?.disconnect()},onDifferentWallet:m})}};let fc=/*#__PURE__*/a.styled.p.withConfig({displayName:"RedirectLinksContainer",componentId:"sc-7b4251f2-0"})(["text-align:center;color:var(--privy-color-foreground-2);font-size:14px;line-height:22px;margin:16px 0;"]);const xc={component:()=>{let{setWalletConnectionStatus:t,closePrivyModal:i,inProgressAuthFlowRef:a}=r.usePrivyInternal(),{data:o,navigate:s}=Xn(),l=qn(),c=rr(),u=o?.externalConnectWallet?.description,p=n.useRef(o?.externalConnectWallet?.walletList??l.appearance.walletList),h=n.useRef(o?.externalConnectWallet?.walletChainType??l.appearance.walletChainType),g=p.current,m=h.current,y="link"===a.current?void 0:()=>s(cg);/*#__PURE__*/return e.jsx(Hl,{walletList:g,walletChainType:m,onClose:i,onConnect:n.useCallback((({connector:e,wallet:n})=>{c("connectWallet","onSuccess",{wallet:n}),t({status:"connected",connectedWallet:n,connector:e,connectError:null,connectRetry:()=>null}),s(yc,!o?.externalConnectWallet?.preSelectedWalletId)}),[t,s,o?.login?.disableSignup,o?.externalConnectWallet?.preSelectedWalletId]),onConnectError:e=>{e instanceof d.PrivyError?(console.warn(e.cause?e.cause:e.message),c("connectWallet","onError",e.privyErrorCode||d.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),c("connectWallet","onError",d.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR))},onBack:y,customDescription:u||"",preSelectedWalletId:o?.externalConnectWallet?.preSelectedWalletId,app:l})},isUnauthenticatedScreem:!0},vc=({children:t,theme:n})=>/*#__PURE__*/e.jsxs(wc,{$theme:n,children:[/*#__PURE__*/e.jsx(ze.default,{width:"20px",height:"20px",color:"var(--privy-color-icon-subtle)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/e.jsx(Cc,{$theme:n,children:t})]});let wc=/*#__PURE__*/a.styled.div.withConfig({displayName:"Container",componentId:"sc-1b5ed8dd-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-background-2);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),Cc=/*#__PURE__*/a.styled.div.withConfig({displayName:"Content",componentId:"sc-1b5ed8dd-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const bc=/*#__PURE__*/a.styled.span.withConfig({displayName:"Subtitle",componentId:"sc-7a11f796-0"})(["margin-top:4px;color:var(--privy-color-foreground);text-align:center;font-size:0.875rem;font-weight:400;line-height:1.375rem;&& a{color:var(--privy-color-accent);}"]),jc=/*#__PURE__*/a.styled.span.withConfig({displayName:"Title",componentId:"sc-66de63c-0"})(["color:var(--privy-color-foreground);font-size:1.125rem;font-weight:600;line-height:1.875rem;text-align:center;"]),kc=/*#__PURE__*/a.styled.span.withConfig({displayName:"LabelXs",componentId:"sc-4c43f9fd-0"})(["color:var(--privy-color-foreground-3);font-size:0.75rem;font-weight:500;line-height:1.125rem;"]),Tc=/*#__PURE__*/a.css(["&&{border-width:1px;padding:0.5rem 1rem;}width:100%;text-align:left;border:solid 1px var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);display:flex;justify-content:space-between;align-items:center;",""],(e=>"error"===e.$state?"\n border-color: var(--privy-color-error);\n background: var(--privy-color-error-bg);\n ":"")),Ac=/*#__PURE__*/a.styled.div.withConfig({displayName:"Box",componentId:"sc-7252360a-0"})(["",""],Tc);let Sc=/*#__PURE__*/a.styled(Ac).withConfig({displayName:"StyledBox",componentId:"sc-4010d8f3-0"})(["&&{padding:0.75rem;height:56px;}"]),Ec=/*#__PURE__*/a.styled.div.withConfig({displayName:"WalletContent",componentId:"sc-4010d8f3-1"})(["display:flex;align-items:center;justify-content:space-between;width:100%;"]),Ic=/*#__PURE__*/a.styled.div.withConfig({displayName:"AddressContainer",componentId:"sc-4010d8f3-2"})(["display:flex;flex-direction:column;gap:0;"]),Pc=/*#__PURE__*/a.styled.div.withConfig({displayName:"BalanceText",componentId:"sc-4010d8f3-3"})(["font-size:12px;line-height:1rem;color:var(--privy-color-foreground-3);"]),Nc=/*#__PURE__*/a.styled(kc).withConfig({displayName:"TitleLabel",componentId:"sc-4010d8f3-4"})(["text-align:left;margin-bottom:0.5rem;"]),_c=/*#__PURE__*/a.styled(wl).withConfig({displayName:"StyledErrorMessage",componentId:"sc-4010d8f3-5"})(["margin-top:0.25rem;"]),Mc=/*#__PURE__*/a.styled(Fr).withConfig({displayName:"CopyButton",componentId:"sc-4010d8f3-6"})(["&&{gap:0.375rem;font-size:14px;}"]);const Fc=({errMsg:r,balance:i,address:a,className:o,title:s,showCopyButton:l=!1})=>{let[c,d]=n.useState(!1);return n.useEffect((()=>{if(c){let e=setTimeout((()=>d(!1)),3e3);return()=>clearTimeout(e)}}),[c]),/*#__PURE__*/e.jsxs("div",{children:[s&&/*#__PURE__*/e.jsx(Nc,{children:s}),/*#__PURE__*/e.jsx(Sc,{className:o,$state:r?"error":void 0,children:/*#__PURE__*/e.jsxs(Ec,{children:[/*#__PURE__*/e.jsxs(Ic,{children:[/*#__PURE__*/e.jsx(Cs,{address:a,showCopyIcon:!1}),void 0!==i&&/*#__PURE__*/e.jsx(Pc,{children:i})]}),l&&/*#__PURE__*/e.jsx(Mc,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(a).then((()=>d(!0))).catch(console.error)},size:"sm",children:c?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(t.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(t.Copy,{size:14})]})})]})}),r&&/*#__PURE__*/e.jsx(_c,{children:r})]})};function Lc({rpcConfig:e,appId:t,address:i,chain:a}){let{chains:o}=r.usePrivyInternal(),[s,c]=n.useState(0n),[d,u]=n.useState(!1),p=n.useMemo((()=>{let n=a||o[0];if(n)return l.createPublicClient({chain:a,transport:l.http(Lt(n,e,t))})}),[a,e,t]),h=n.useCallback((async()=>{if(!i||!p)return;u(!0);let e=await p.getBalance({address:i}).catch(console.error);return e?(c(e),u(!1),e):void 0}),[p,i,c]);return n.useEffect((()=>{h().catch(console.error)}),[]),{balance:s,isLoading:d,reloadBalance:h}}const Wc="sdk_fiat_on_ramp_completed_with_status";async function Dc({rpc:e,address:t}){return(await e.getBalance(t,{commitment:"confirmed"}).send()).value??0n}function Rc(e){switch(e){case"solana:mainnet":return"Solana";case"solana:devnet":return"Devnet";case"solana:testnet":return"Testnet"}}function Oc(e){let[t]=Object.entries(Li[e]).find((([e,t])=>"USDC"===t.symbol))??[];return t}const Bc=async({chain:e,address:t,appId:n,rpcConfig:r,erc20Address:i})=>{let a=l.createPublicClient({chain:e,transport:l.http(Lt(e,r,n))});return{balance:await a.readContract({address:i,abi:Uc,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}};let Uc=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];const zc={component:()=>{let{wallets:t}=Na(),{connectors:i}=r.usePrivyInternal(),a=i.filter(Sn).flatMap((e=>e.wallets)),{data:o,setModalData:s,navigate:d,lastScreen:u}=Xn(),{rpcConfig:p,appId:h,createAnalyticsEvent:g,closePrivyModal:m}=r.usePrivyInternal(),y=qn(),[f,x]=n.useState(void 0),[v,w]=n.useState(!1),C=o?.funding,{reloadBalance:b}=Lc({rpcConfig:p,appId:h,address:"ethereum"===C.chainType?C.address:void 0,chain:"ethereum"===C.chainType?C.chain:void 0}),j="solana"===C.chainType,k=j?C.isUSDC?"USDC":"SOL":C.erc20Address?C.erc20ContractInfo?.symbol:C.chain.nativeCurrency.symbol,T=j?a.find((({address:e})=>e===C.address)):t.find((({address:e})=>Dt(e)===Dt(C.address)));if(!C)return s({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:u||Vp},funding:o?.funding,solanaFundingData:o?.solanaFundingData,sendTransaction:o?.sendTransaction}),d(Rs),/*#__PURE__*/e.jsx(e.Fragment,{});n.useEffect((()=>{let e=j?async function(){if("solana"!==C.chainType)return;let e=y.solanaRpcs[C.chain];e?(C.isUSDC?async function({rpc:e,address:t,mintAddress:n}){let r=await e.getTokenAccountsByOwner(t,{mint:n},{encoding:"jsonParsed",commitment:"confirmed"}).send(),i=r.value[0]?.account;return i?BigInt(i.data.parsed.info.tokenAmount.amount):0n}({rpc:e.rpc,address:C.address,mintAddress:Oc(C.chain)}):Dc({rpc:e.rpc,address:C.address})).then((e=>{let t=BigInt(e);f&&t>f&&(w(!0),g({eventName:Wc,payload:{provider:"manual",status:"success",chainType:"solana",address:T?.address,value:C.isUSDC?l.formatUnits(t-f,6):l.formatUnits(t-f,9),token:C.isUSDC?"USDC":"SOL"}})),x(t)})):console.warn("Unable to load solana rpc, skipping balance")}:async function(){"ethereum"===C.chainType&&(async()=>{if(!C.erc20Address)return await b()??BigInt(0);{let{balance:e}=await Bc({chain:C.chain,address:C.address,erc20Address:C.erc20Address,rpcConfig:p,appId:h});return e}})().then((e=>{f&&e>f&&(w(!0),g({eventName:Wc,payload:{provider:"manual",status:"success",chainType:"ethereum",address:T?.address,chainId:C.chain.id,value:l.formatUnits(e-f,C.erc20ContractInfo?.decimals??18),token:C.erc20ContractInfo?.symbol??C.erc20Address??"ETH"}})),x(e)})).catch((()=>x(void 0)))},t=setInterval(e,2e3);return e(),()=>clearInterval(t)}),[f]);let A=n.useMemo((()=>null==f?"":C.isUSDC?c.formatTokenAmount({amount:f,decimals:6}):j?Ri(f,3,!0,!0):null!=C.erc20ContractInfo?.decimals?c.formatTokenAmount({amount:f,decimals:C.erc20ContractInfo.decimals}):c.formatWeiAmount({wei:f})),[f,j,C]),S="ethereum"===C.chainType?C.chain.name:Rc(C.chain),E=n.useMemo((()=>""===C.uiConfig?.receiveFundsTitle?null:/*#__PURE__*/e.jsx(jc,{children:C.uiConfig?.receiveFundsTitle??`Receive ${C.amount} ${k??""}`.trim()})),[C.uiConfig?.receiveFundsTitle,C.amount,k]),I=n.useMemo((()=>""===C.uiConfig?.receiveFundsSubtitle?null:/*#__PURE__*/e.jsx(bc,{children:C.uiConfig?.receiveFundsSubtitle??`Scan this code or copy your wallet address to receive funds on ${S}.`})),[C.uiConfig?.receiveFundsSubtitle,S]),P="solana"===C.chainType&&C.isUSDC&&Oc(C.chain)?`?spl-token=${Oc(C.chain)}`:"";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),E,I,/*#__PURE__*/e.jsxs(Ki,{style:{gap:"1rem",margin:E||I?"1rem 0":"0"},children:[/*#__PURE__*/e.jsx(vl,{url:`${C.chainType}:${C.address}${P}`,size:200,squareLogoElement:Hc}),/*#__PURE__*/e.jsxs(vc,{theme:y.appearance.palette.colorScheme,children:["Make sure to send funds on ",S,"."]}),/*#__PURE__*/e.jsx(Fc,{title:"Your wallet",errMsg:void 0,showCopyButton:!0,balance:`${A} ${k}`,address:C.address}),v&&/*#__PURE__*/e.jsx(Pr,{onClick:()=>m({shouldCallAuthOnSuccess:!1,isSuccess:!0}),children:"Continue"})]}),/*#__PURE__*/e.jsx(xr,{})]})}};let Hc=({...t})=>/*#__PURE__*/e.jsx(hn,{color:"black",...t});let Vc=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];const $c=async({address:e,chain:t,rpcConfig:n,privyAppId:r})=>{try{let i=l.createPublicClient({chain:t,transport:l.http(Lt(t,n,r))}),[a,o]=await Promise.all([i.readContract({abi:qc,address:e,functionName:"symbol"}),i.readContract({abi:qc,address:e,functionName:"decimals"})]);return{decimals:o,symbol:a}}catch(e){return console.log(e),null}};let qc=[{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"}],Gc=2n**256n-1n;const Yc=({amount:e,decimals:t})=>e===Gc?"Maximum":Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t);let Zc=({data:t})=>{let n=t=>"object"==typeof t&&null!==t?/*#__PURE__*/e.jsx(Qc,{children:Object.entries(t).map((([t,r])=>/*#__PURE__*/e.jsxs("li",{children:[/*#__PURE__*/e.jsxs("strong",{children:[t,":"]})," ",n(r)]},t)))}):/*#__PURE__*/e.jsx("span",{children:String(t)});/*#__PURE__*/return e.jsx("div",{children:n(t)})};const Kc=/*#__PURE__*/a.styled.div.withConfig({displayName:"Message",componentId:"sc-70ec2a4f-0"})(["margin-top:1.5rem;background-color:var(--privy-color-background-2);border-radius:var(--privy-border-radius-md);padding:12px;text-align:left;max-height:310px;overflow:scroll;white-space:pre-wrap;width:100%;font-size:0.875rem;font-weight:400;color:var(--privy-color-foreground);line-height:1.5;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]);let Qc=/*#__PURE__*/a.styled.ul.withConfig({displayName:"MessageList",componentId:"sc-70ec2a4f-1"})(["margin-left:12px !important;white-space:nowrap;&:first-child{margin-left:0 !important;}strong{font-weight:500 !important;}"]);const Xc=({data:t,className:n})=>/*#__PURE__*/e.jsx(Kc,{className:n,children:/*#__PURE__*/e.jsx(Zc,{data:t})});let Jc=/*#__PURE__*/a.styled.div.withConfig({displayName:"Container",componentId:"sc-b3a607dd-0"})(["display:flex;flex-direction:column;min-height:72px;"]);var ed=({onBack:t,details:n})=>/*#__PURE__*/e.jsxs(Jc,{children:[/*#__PURE__*/e.jsx(Hr,{backFn:t}),/*#__PURE__*/e.jsx(Xc,{data:n}),/*#__PURE__*/e.jsx(xr,{})]});const td=/*#__PURE__*/a.styled.span.withConfig({displayName:"LabelSm",componentId:"sc-6c002d6-0"})(["color:var(--privy-color-foreground-3);font-size:0.875rem;font-weight:400;line-height:1.375rem;"]),nd=/*#__PURE__*/a.styled(td).withConfig({displayName:"LabelSmPrimary",componentId:"sc-6c002d6-1"})(["color:var(--privy-color-accent);"]),rd=/*#__PURE__*/a.styled(td).withConfig({displayName:"InteractiveLabel",componentId:"sc-b57d0824-0"})(["cursor:pointer;display:inline-flex;gap:8px;align-items:center;color:var(--privy-color-accent);svg{fill:var(--privy-color-accent);}"]),id=/*#__PURE__*/a.styled.span.withConfig({displayName:"Rows",componentId:"sc-b764aab6-0"})(["display:flex;flex-direction:column;gap:0.35rem;width:100%;"]),ad=/*#__PURE__*/a.styled.span.withConfig({displayName:"Row",componentId:"sc-b764aab6-1"})(["display:flex;width:100%;justify-content:space-between;gap:0.5rem;"]);let od=/*#__PURE__*/a.keyframes(["from,to{background:var(--privy-color-foreground-4);color:var(--privy-color-foreground-4);}50%{background:var(--privy-color-foreground-accent);color:var(--privy-color-foreground-accent);}"]);const sd=/*#__PURE__*/a.css(["",""],(e=>e.$isLoading?/*#__PURE__*/a.css(["width:35%;animation:"," 2s linear infinite;border-radius:var(--privy-border-radius-sm);"],od):"")),ld=/*#__PURE__*/a.styled.span.withConfig({displayName:"Value",componentId:"sc-72aa026-0"})(["color:var(--privy-color-foreground);font-size:0.875rem;font-weight:500;line-height:1.375rem;word-break:break-all;text-align:right;",""],sd);var cd=({iconUrl:t,value:n,symbol:r,usdValue:i,nftName:a,nftCount:o,decimals:s,$isLoading:l})=>{if(l)/*#__PURE__*/return e.jsx(dd,{$isLoading:l});let c=n&&i&&s?function(e,t,n){let r=parseFloat(e),i=parseFloat(n);if(0===r||0===i||Number.isNaN(r)||Number.isNaN(i))return e;let a=Math.ceil(-Math.log10(.01/(i/r))),o=Math.pow(10,a=Math.max(a=Math.min(a,t),1)),s=+(Math.floor(r*o)/o).toFixed(a).replace(/\.?0+$/,"");return Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(s)}(n,s,i):n;/*#__PURE__*/return e.jsxs("div",{children:[/*#__PURE__*/e.jsxs(dd,{$isLoading:l,children:[t&&/*#__PURE__*/e.jsx(pd,{src:t,alt:"Token icon"}),o&&o>1?o+"x":void 0," ",a,c," ",r]}),i&&/*#__PURE__*/e.jsxs(ud,{$isLoading:l,children:["$",i]})]})};let dd=/*#__PURE__*/a.styled.span.withConfig({displayName:"Value",componentId:"sc-991db279-0"})(["color:var(--privy-color-foreground);font-size:0.875rem;font-weight:500;line-height:1.375rem;word-break:break-all;text-align:right;display:flex;justify-content:flex-end;",""],sd);const ud=/*#__PURE__*/a.styled.span.withConfig({displayName:"Subvalue",componentId:"sc-991db279-1"})(["color:var(--privy-color-foreground-2);font-size:12px;font-weight:400;line-height:18px;word-break:break-all;text-align:right;display:flex;justify-content:flex-end;",""],sd);let pd=/*#__PURE__*/a.styled.img.withConfig({displayName:"TokenIcon",componentId:"sc-991db279-2"})(["height:14px;width:14px;margin-right:4px;object-fit:contain;"]);const hd=t=>{let{chain:n,transactionDetails:r,isTokenContractInfoLoading:i,symbol:a}=t,{action:o,functionName:s}=r;/*#__PURE__*/return e.jsx(Ac,{children:/*#__PURE__*/e.jsxs(id,{children:["transaction"!==o&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Action"}),/*#__PURE__*/e.jsx(ld,{children:s})]}),"mint"===s&&"args"in r&&r.args.filter((e=>e)).map(((t,r)=>/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:`Param ${r}`}),/*#__PURE__*/e.jsx(ld,{children:"string"==typeof t&&l.isAddress(t)?/*#__PURE__*/e.jsx(Cs,{address:t,url:n?.blockExplorers?.default?.url,showCopyIcon:!1}):t?.toString()})]},r))),"setApprovalForAll"===s&&r.operator&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Operator"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r.operator,url:n?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),"setApprovalForAll"===s&&void 0!==r.approved&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Set approval to"}),/*#__PURE__*/e.jsx(ld,{children:r.approved?"true":"false"})]}),"transfer"===s||"transferFrom"===s||"safeTransferFrom"===s||"approve"===s?/*#__PURE__*/e.jsxs(e.Fragment,{children:["formattedAmount"in r&&r.formattedAmount&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsxs(ld,{$isLoading:i,children:[r.formattedAmount," ",a]})]}),"tokenId"in r&&r.tokenId&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token ID"}),/*#__PURE__*/e.jsx(ld,{children:r.tokenId.toString()})]})]}):null,"safeBatchTransferFrom"===s&&/*#__PURE__*/e.jsxs(e.Fragment,{children:["amounts"in r&&r.amounts&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Amounts"}),/*#__PURE__*/e.jsx(ld,{children:r.amounts.join(", ")})]}),"tokenIds"in r&&r.tokenIds&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token IDs"}),/*#__PURE__*/e.jsx(ld,{children:r.tokenIds.join(", ")})]})]}),"approve"===s&&r.spender&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Spender"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r.spender,url:n?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===s||"safeTransferFrom"===s||"safeBatchTransferFrom"===s)&&r.transferFrom&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Transferring from"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r.transferFrom,url:n?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===s||"safeTransferFrom"===s||"safeBatchTransferFrom"===s)&&r.transferTo&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Transferring to"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r.transferTo,url:n?.blockExplorers?.default?.url,showCopyIcon:!1})})]})]})})},gd=({children:t,theme:n})=>/*#__PURE__*/e.jsxs(md,{$theme:n,children:[/*#__PURE__*/e.jsx(we.default,{width:"20px",height:"20px",color:"var(--privy-color-icon-error)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/e.jsx(yd,{$theme:n,children:t})]});let md=/*#__PURE__*/a.styled.div.withConfig({displayName:"Container",componentId:"sc-34910fd1-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-error-bg);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),yd=/*#__PURE__*/a.styled.div.withConfig({displayName:"Content",componentId:"sc-34910fd1-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const fd=({children:t,theme:n})=>/*#__PURE__*/e.jsxs(xd,{$theme:n,children:[/*#__PURE__*/e.jsx(xe.default,{width:"20px",height:"20px",color:"var(--privy-color-icon-warning)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/e.jsx(vd,{$theme:n,children:t})]});let xd=/*#__PURE__*/a.styled.div.withConfig({displayName:"Container",componentId:"sc-a77c2854-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-warn-bg);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),vd=/*#__PURE__*/a.styled.div.withConfig({displayName:"Content",componentId:"sc-a77c2854-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const wd=({variant:t,setPreventMaliciousTransaction:n,colorScheme:r="light",preventMaliciousTransaction:i})=>"warn"===t?/*#__PURE__*/e.jsx(Cd,{children:/*#__PURE__*/e.jsxs(fd,{theme:r,children:[/*#__PURE__*/e.jsx("span",{style:{fontWeight:"500"},children:"Warning: Suspicious transaction"}),/*#__PURE__*/e.jsx("br",{}),"This has been flagged as a potentially deceptive request. Approving could put your assets or funds at risk."]})}):"error"===t?/*#__PURE__*/e.jsx(e.Fragment,{children:/*#__PURE__*/e.jsxs(Cd,{children:[/*#__PURE__*/e.jsx(gd,{theme:r,children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx("strong",{children:"This is a malicious transaction"}),/*#__PURE__*/e.jsx("br",{}),"This transaction transfers tokens to a known malicious address. Proceeding may result in the loss of valuable assets."]})}),/*#__PURE__*/e.jsxs(bd,{children:[/*#__PURE__*/e.jsx(So,{color:"var(--privy-color-error)",checked:!i,readOnly:!0,onClick:()=>n(!i)}),/*#__PURE__*/e.jsx("span",{children:"I understand and want to proceed anyways."})]})]})}):null;let Cd=/*#__PURE__*/a.styled.div.withConfig({displayName:"BannerContainer",componentId:"sc-ab8a5a0b-0"})(["margin-top:1.5rem;"]),bd=/*#__PURE__*/a.styled.div.withConfig({displayName:"CheckboxContainer",componentId:"sc-ab8a5a0b-1"})(["display:flex;align-items:center;gap:0.5rem;margin-top:0.75rem;"]);const jd=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,kd=({img:t,submitError:r,prepareError:i,onClose:a,action:o,title:s,subtitle:l,to:c,tokenAddress:d,network:u,missingFunds:p,fee:h,from:g,cta:m,disabled:y,chain:f,isSubmitting:x,isPreparing:v,isTokenPriceLoading:w,isTokenContractInfoLoading:C,isSponsored:b,symbol:j,balance:k,onClick:T,transactionDetails:A,transactionIndex:S,maxIndex:E,onBack:I,chainName:P,validation:N,hasScanDetails:_,setIsScanDetailsOpen:M,preventMaliciousTransaction:F,setPreventMaliciousTransaction:L,tokensSent:W,tokensReceived:D,isScanning:R,isCancellable:O,functionName:U})=>{let{showTransactionDetails:z,setShowTransactionDetails:H,hasMoreDetails:V,isErc20Ish:$}=(e=>{let[t,r]=n.useState(!1),i=!0,a=!1;return(!e||e.isErc20Ish||"transaction"===e.action)&&(i=!1),i&&(a=Object.entries(e||{}).some((([e,t])=>t&&!["action","isErc20Ish","isNFTIsh"].includes(e)))),{showTransactionDetails:t,setShowTransactionDetails:r,hasMoreDetails:i&&a,isErc20Ish:e?.isErc20Ish}})(A),q=qn(),G=$&&C||v||w||R;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:a,backFn:I}),t&&/*#__PURE__*/e.jsx(Ed,{children:t}),/*#__PURE__*/e.jsxs(jc,{style:{marginTop:t?"1.5rem":0},children:[s,/*#__PURE__*/e.jsx(jd,{maxIndex:E,transactionIndex:S})]}),/*#__PURE__*/e.jsx(bc,{children:l}),/*#__PURE__*/e.jsxs(id,{style:{marginTop:"2rem"},children:[(!!W[0]||G)&&/*#__PURE__*/e.jsxs(ad,{children:[D.length>0?/*#__PURE__*/e.jsx(td,{children:"Send"}):/*#__PURE__*/e.jsx(td,{children:"approve"===o?"Approval amount":"Amount"}),/*#__PURE__*/e.jsx("div",{className:"flex flex-col",children:W.map(((t,n)=>/*#__PURE__*/e.jsx(cd,{iconUrl:t.iconUrl,value:"setApprovalForAll"===U?"All":t.value,usdValue:t.usdValue,symbol:t.symbol,nftName:t.nftName,nftCount:t.nftCount,decimals:t.decimals},n)))})]}),D.length>0&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Receive"}),/*#__PURE__*/e.jsx("div",{className:"flex flex-col",children:D.map(((t,n)=>/*#__PURE__*/e.jsx(cd,{iconUrl:t.iconUrl,value:t.value,usdValue:t.usdValue,symbol:t.symbol,nftName:t.nftName,nftCount:t.nftCount,decimals:t.decimals},n)))})]}),A&&"spender"in A&&A?.spender?/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Spender"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:A.spender,url:f?.blockExplorers?.default?.url})})]}):null,c&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"To"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:c,url:f?.blockExplorers?.default?.url,showCopyIcon:!0})})]}),d&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token address"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:d,url:f?.blockExplorers?.default?.url})})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Network"}),/*#__PURE__*/e.jsx(ld,{children:u})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(ld,{$isLoading:v||w||void 0===b,children:b?/*#__PURE__*/e.jsxs(Id,{children:[/*#__PURE__*/e.jsxs(Pd,{children:["Sponsored by ",q.name]}),/*#__PURE__*/e.jsx(B.BoltIcon,{height:16,width:16})]}):h})]}),V&&!_&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(ad,{className:"cursor-pointer",onClick:()=>H(!z),children:/*#__PURE__*/e.jsxs(nd,{className:"flex items-center gap-x-1",children:["Details"," ",/*#__PURE__*/e.jsx(B.ChevronDownIcon,{style:{width:"0.75rem",marginLeft:"0.25rem",transform:z?"rotate(180deg)":void 0}})]})}),z&&A&&/*#__PURE__*/e.jsx(hd,{action:o,chain:f,transactionDetails:A,isTokenContractInfoLoading:C,symbol:j})]}),_&&/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsxs(rd,{onClick:()=>M(!0),children:[/*#__PURE__*/e.jsx("span",{className:"text-color-primary",children:"Details"}),/*#__PURE__*/e.jsx(B.ArrowRightIcon,{height:"14px",width:"14px",strokeWidth:"2"})]})})]}),/*#__PURE__*/e.jsx(ir,{}),r?/*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:r.message}):i&&0===S?
20
- /*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:i.shortMessage??Sd}):null,/*#__PURE__*/e.jsx(wd,{variant:N,preventMaliciousTransaction:F,setPreventMaliciousTransaction:L}),/*#__PURE__*/e.jsx(Td,{$useSmallMargins:!(!i&&!r&&"warn"!==N&&"error"!==N),address:g,balance:k,errMsg:v||i||r||!p?void 0:`Add funds on ${f?.name??P} to complete transaction.`}),/*#__PURE__*/e.jsx(Pr,{style:{marginTop:"1rem"},loading:x,disabled:y||v,onClick:T,children:m}),O&&/*#__PURE__*/e.jsx(Rr,{style:{marginTop:"1rem"},onClick:a,isSubmitting:!1,children:"Not now"}),/*#__PURE__*/e.jsx(xr,{})]})};let Td=/*#__PURE__*/a.styled(Fc).withConfig({displayName:"StyledWalletInfoCard",componentId:"sc-4e16a794-0"})(["",""],(e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;")),Ad=/*#__PURE__*/a.styled(id).withConfig({displayName:"InstructionRows",componentId:"sc-4e16a794-1"})(["margin-top:0.5rem;border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-sm);padding:0.5rem;"]),Sd="There was an error preparing your transaction. Your transaction request will likely fail.",Ed=/*#__PURE__*/a.styled.div.withConfig({displayName:"ImageContainer",componentId:"sc-4e16a794-2"})(["display:flex;width:100%;justify-content:center;max-height:40px;> img{object-fit:contain;border-radius:var(--privy-border-radius-sm);}"]),Id=/*#__PURE__*/a.styled.span.withConfig({displayName:"SponsoredRow",componentId:"sc-4e16a794-3"})(["display:inline-flex;align-items:center;gap:0.3rem;"]),Pd=/*#__PURE__*/a.styled.span.withConfig({displayName:"SponsoredText",componentId:"sc-4e16a794-4"})(["font-size:14px;font-weight:500;color:var(--privy-color-foreground);"]);let Nd=()=>/*#__PURE__*/e.jsxs(Wd,{children:[/*#__PURE__*/e.jsx(Rd,{}),/*#__PURE__*/e.jsx(Dd,{})]});const _d=({transactionError:t,chainId:i,onClose:a,onRetry:o,chainType:s,transactionHash:l})=>{let{chains:c}=r.usePrivyInternal(),[d,u]=n.useState(!1),{errorCode:p,errorMessage:h}=((e,t)=>{if("ethereum"===t)return{errorCode:e.details??e.message,errorMessage:e.shortMessage};let n=e.txSignature,r=e?.transactionMessage||"Something went wrong.";if(Array.isArray(e.logs)){let t=e.logs.find((e=>/insufficient (lamports|funds)/gi.test(e)));t&&(r=t)}return{transactionHash:n,errorMessage:r}})(t,s),g=(({chains:e,chainId:t,chainType:n,transactionHash:r})=>"ethereum"===n?e.find((e=>e.id===t))?.blockExplorers?.default.url??"https://etherscan.io":function(e,t){return`https://explorer.solana.com/tx/${e}?chain=${t}`}(r||"",t))({chains:c,chainId:i,chainType:s,transactionHash:l});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:a}),/*#__PURE__*/e.jsxs(Md,{children:[/*#__PURE__*/e.jsx(Nd,{}),/*#__PURE__*/e.jsx(Fd,{children:p}),/*#__PURE__*/e.jsx(Ld,{children:"Please try again."}),/*#__PURE__*/e.jsxs(Ud,{children:[/*#__PURE__*/e.jsx(Bd,{children:"Error message"}),/*#__PURE__*/e.jsx(Hd,{$clickable:!1,children:h})]}),l&&/*#__PURE__*/e.jsxs(Ud,{children:[/*#__PURE__*/e.jsx(Bd,{children:"Transaction hash"}),/*#__PURE__*/e.jsxs(zd,{children:["Copy this hash to view details about the transaction on a"," ",/*#__PURE__*/e.jsx("u",{children:/*#__PURE__*/e.jsx("a",{href:g,children:"block explorer"})}),"."]}),/*#__PURE__*/e.jsxs(Hd,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(l),u(!0)},children:[l,/*#__PURE__*/e.jsx(qd,{clicked:d})]})]}),/*#__PURE__*/e.jsx(Od,{onClick:()=>o({resetNonce:!!l}),children:"Retry transaction"})]}),/*#__PURE__*/e.jsx(wr,{})]})};let Md=/*#__PURE__*/a.styled.div.withConfig({displayName:"TransactionErrorScreenContainer",componentId:"sc-d58f10e6-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;"]),Fd=/*#__PURE__*/a.styled.span.withConfig({displayName:"ErrorCode",componentId:"sc-d58f10e6-1"})(["color:var(--privy-color-foreground);text-align:center;font-size:1.125rem;font-weight:500;line-height:1.25rem;text-align:center;margin:10px;"]),Ld=/*#__PURE__*/a.styled.span.withConfig({displayName:"Subtitle",componentId:"sc-d58f10e6-2"})(["margin-top:4px;margin-bottom:10px;color:var(--privy-color-foreground-3);text-align:center;font-size:0.875rem;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;"]),Wd=/*#__PURE__*/a.styled.div.withConfig({displayName:"CircleContainer",componentId:"sc-d58f10e6-3"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]),Dd=/*#__PURE__*/a.styled(we.default).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-d58f10e6-4"})(["position:absolute;width:35px;height:35px;color:var(--privy-color-error);"]),Rd=/*#__PURE__*/a.styled.div.withConfig({displayName:"StyledRedCircle",componentId:"sc-d58f10e6-5"})(["position:absolute;width:60px;height:60px;border-radius:50%;background-color:var(--privy-color-error);opacity:0.1;"]),Od=/*#__PURE__*/a.styled(Pr).withConfig({displayName:"RetryButton",componentId:"sc-d58f10e6-6"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]),Bd=/*#__PURE__*/a.styled.span.withConfig({displayName:"TextBoxTitle",componentId:"sc-d58f10e6-7"})(["width:100%;text-align:left;font-size:0.825rem;color:var(--privy-color-foreground);padding:4px;"]),Ud=/*#__PURE__*/a.styled.div.withConfig({displayName:"TextBoxContainer",componentId:"sc-d58f10e6-8"})(["width:100%;margin:5px;display:flex;flex-direction:column;justify-content:center;align-items:center;"]),zd=/*#__PURE__*/a.styled.text.withConfig({displayName:"HelperText",componentId:"sc-d58f10e6-9"})(["position:relative;width:100%;padding:5px;font-size:0.8rem;color:var(--privy-color-foreground-3);text-align:left;word-wrap:break-word;"]),Hd=/*#__PURE__*/a.styled.span.withConfig({displayName:"TextBox",componentId:"sc-d58f10e6-10"})(["position:relative;width:100%;background-color:var(--privy-color-background-2);padding:8px 12px;border-radius:10px;margin-top:5px;font-size:14px;color:var(--privy-color-foreground-3);text-align:left;word-wrap:break-word;",""],(e=>e.$clickable&&"cursor: pointer;\n transition: background-color 0.3s;\n padding-right: 45px;\n\n &:hover {\n background-color: var(--privy-color-foreground-4);\n }")),Vd=/*#__PURE__*/a.styled(He.default).withConfig({displayName:"StyledClipboardIcon",componentId:"sc-d58f10e6-11"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),$d=/*#__PURE__*/a.styled(_e.default).withConfig({displayName:"StyledClipboardCheckIcon",componentId:"sc-d58f10e6-12"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),qd=({clicked:t})=>t?/*#__PURE__*/e.jsx($d,{}):/*#__PURE__*/e.jsx(Vd,{}),Gd=({gasUsed:e,effectiveGasPrice:t})=>{if(e&&t)try{return l.toHex(e*t)}catch(e){return}};const Yd=({txn:t,receipt:n,transactionInfo:r,onClose:i,tokenPrice:a,tokenSymbol:o,receiptHeader:s,receiptDescription:l})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:i}),/*#__PURE__*/e.jsx(Ba,{title:s??"Transaction complete!",description:l??"You're all set."}),/*#__PURE__*/e.jsx(Ta,{tokenPrice:a,from:n.from,to:n.to,gas:Gd(n),txn:t,transactionInfo:r,tokenSymbol:o}),/*#__PURE__*/e.jsx(ir,{}),/*#__PURE__*/e.jsx(Zd,{loading:!1,onClick:i,children:"All Done"}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]});let Zd=/*#__PURE__*/a.styled(Pr).withConfig({displayName:"SubmitButton",componentId:"sc-f70d0f7a-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const Kd=[{constant:!1,inputs:[{name:"_salt",type:"bytes32"},{name:"_initializer",type:"bytes"}],name:"deployAccount",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Qd=[{name:"from",type:"address"},{name:"param2",type:"address"},{name:"param3",type:"bytes"},{name:"param4",type:"tuple",components:[]},{type:"tuple",components:[{name:"param5",type:"address"},{name:"param6",type:"uint256"},{name:"param7",type:"uint256"},{name:"encodedInitData",type:"bytes"}]}],Xd=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Jd=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],eu=[{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"payable",type:"function"}],tu=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],nu=[{constant:!1,inputs:[{name:"_operator",type:"address"},{name:"_approved",type:"bool"}],name:"setApprovalForAll",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],ru=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],iu=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenIds",type:"uint256[]"},{name:"_amounts",type:"uint256[]"},{name:"_data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],au=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"},{name:"_amount",type:"uint256"},{name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],ou=(e,t)=>{let n=su(Xd,e);if(n)return{action:"approve",functionName:"approve",isErc20Ish:!0,isNFTIsh:!1,spender:n.args[0],amount:n.args[1]};let r=su(Jd,e);if(r)return{action:"transfer",functionName:"transfer",isErc20Ish:!0,isNFTIsh:!1,transferTo:r.args[0],amount:r.args[1]};if(!t)return{action:"transaction",functionName:"",isErc20Ish:!1,isNFTIsh:!1};let i=su(Kd,e);if(i&&"string"==typeof i.args[1]){let e=lu(i.args[1]);if(e&&e[4].encodedInitData)return ou(e[4].encodedInitData,t)}let a=su(nu,e);if(a)return{action:"approve",functionName:"setApprovalForAll",isNFTIsh:!0,isErc20Ish:!1,operator:a.args[0],approved:a.args[1]};let o=su(ru,e);if(o)return{action:"transfer",functionName:"transferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:o.args[0],transferTo:o.args[1],tokenId:o.args[2]};let s=su(tu,e);if(s)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:s.args[0],transferTo:s.args[1],tokenId:s.args[2]};let l=su(au,e);if(l)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:l.args[0],transferTo:l.args[1],tokenId:l.args[2],amount:l.args[3]};let c=su(iu,e);if(c)return{action:"batch transfer",functionName:"safeBatchTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:c.args[0],transferTo:c.args[1],tokenIds:c.args[2],amounts:c.args[3]};let d=su(eu,e);return d?{action:"mint",functionName:d.functionName,isNFTIsh:!0,isErc20Ish:!1,args:d.args}:{action:"transaction",isErc20Ish:!1,isNFTIsh:!1}};let su=(e,t)=>{try{let n=l.decodeFunctionData({abi:e,data:t});return{functionName:n.functionName,args:n.args||[]}}catch(e){return null}},lu=e=>{try{if("string"==typeof e)return l.decodeAbiParameters(Qd,`0x${e.slice(10)}`)}catch(e){return null}},cu=e=>`${parseFloat(e).toFixed(2)}`;const du=(e,t,i,a)=>{let[o,s]=n.useState(null),{walletProxy:l}=r.usePrivyInternal();return n.useEffect((()=>{o&&s(null),(async()=>{if(!l||!t)return null;let n=[],r=!0,o=await _a(e,i,t,a).catch((t=>(t.message&&t.message.includes("Insufficient balance for transaction")||t.details&&t.details.includes("insufficient funds")?r=!1:n.push(t),e)));return{tx:o,totalGasEstimate:o.gas,hasFunds:r,errors:n}})().then(s)}),[e]),o};let uu=new an(new rn("There was an issue preparing your transaction",c.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),pu=(e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0;const hu={component:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:a,setModalData:o,navigate:s}=Xn(),{client:d,rpcConfig:u,chains:p,closePrivyModal:h,walletProxy:g,showFiatPrices:m}=r.usePrivyInternal(),{user:y}=i.usePrivyContext(),f=qn(),[x,v]=n.useState(0),[w,C]=n.useState(0),[b,j]=n.useState(pu(t,x)),[k,T]=n.useState(null),[A,S]=n.useState(),[E,I]=n.useState(!1),[P,N]=n.useState(null),[_,M]=n.useState(null),[F,L]=n.useState(null),[W,D]=n.useState(void 0),[R,O]=n.useState(void 0),[B,U]=n.useState(!1),[z,H]=n.useState(!1),[V,$]=n.useState([]),[q,G]=n.useState([]),[Y,Z]=n.useState("uninitiated"),[K,Q]=n.useState(void 0);if(!b||!t?.sendTransaction||!t?.sendTransaction)/*#__PURE__*/return e.jsx(Ds,{error:Error("Invalid transaction request"),allowlistConfig:f.allowlistConfig,onRetry:()=>{t?.sendTransaction?.onFailure(uu),h({shouldCallAuthOnSuccess:!1})}});let{transactingWalletAddress:X}=t.sendTransaction,J=n.useMemo((()=>p.find((e=>Number(e.id)===Number(b.chainId)))),[b.chainId]),ee=J?.nativeCurrency.symbol??"ETH",te=n.useMemo((()=>ou(b.data,!!f.embeddedWallets.extendedCalldataDecoding)),[b.data]),{action:ne,isErc20Ish:re,isNFTIsh:ie,functionName:ae}=te,{toAddress:oe,tokenAddress:se}=n.useMemo((()=>({toAddress:te.isErc20Ish?te.transferTo:b.to??void 0,tokenAddress:te.isErc20Ish?b.to:void 0})),[te]);n.useEffect((()=>{b.to&&J&&re&&$c({address:b.to,chain:J,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(T).catch(console.error)}),[b.to,J]);let{tokenPrice:le,isTokenPriceLoading:ce}=Ia(b.chainId),{balance:de}=Lc({rpcConfig:f.rpcConfig,appId:f.id,address:X,chain:J}),ue=function({rpcConfig:e,appId:t,address:i,chain:a,tokenInfo:o}){let{chains:s}=r.usePrivyInternal(),[d,u]=n.useState(null),[p,h]=n.useState(!1),g=n.useMemo((()=>{let n=a||s[0];if(n)return l.createPublicClient({chain:a,transport:l.http(c.getJsonRpcEndpointFromChain(n,e,t))})}),[a,e,t]),m=n.useCallback((async()=>{if(i&&g&&o.address)try{return h(!0),await g.readContract({address:o.address,abi:Vc,functionName:"balanceOf",args:[i]})}catch(e){console.error(e)}finally{h(!1)}}),[g,i,o?.address,a]);return n.useEffect((()=>{m().then((e=>null!=e&&u(e)))}),[m]),{balance:d,isLoading:p&&null==d,formattedBalance:c.formatTokenAmount({amount:d??BigInt(0),decimals:o.decimals})}}({rpcConfig:f.rpcConfig,appId:f.id,address:X,tokenInfo:{address:se||"",decimals:k?.decimals??18},chain:J}),pe=n.useMemo((()=>Ft(Number(b.chainId),p,u,{appId:f.id})),[b.chainId,u]),he=du(b,X,pe,t?.sendTransaction?.prepareTransactionRequest);n.useEffect((()=>{j(pu(t,x))}),[x]),n.useEffect((()=>{t.sendTransaction?.getIsSponsored?t.sendTransaction.getIsSponsored().then(S).catch(console.error):S(!1)}),[t.sendTransaction.getIsSponsored]);let ge=()=>{if(!E)return P?t?.sendTransaction?.onSuccess({hash:P}):F||he?.errors[0]?t?.sendTransaction?.onFailure(F??he?.errors[0]??uu):t?.sendTransaction?.onFailure(new an(new rn("The user rejected the request",c.ProviderErrors.E4001_USER_REJECTED_REQUEST.eipCode))),h({shouldCallAuthOnSuccess:!1})};a.current=ge;let me=!!(t.funding&&t.funding.supportedOptions.length>0),ye=Pi(BigInt(he?.totalGasEstimate??0n),ee),fe=m&&le?Ii(BigInt(he?.totalGasEstimate??0n),le):void 0,xe=Pi(de??0n,ee,void 0,!0),ve=m&&le?Ii(de??0n,le):void 0,we=k&&!ue.isLoading&&re&&"approve"!==ne?`${ue.formattedBalance} ${k.symbol}`:void 0,Ce=t.sendTransaction?.uiOptions?.transactionInfo?.title;Ce||(Ce="approve"===ne?re?"Confirm address":"Confirm action":`Approve ${ne}`);let be=n.useMemo((()=>{if(t.sendTransaction?.uiOptions?.description)return t.sendTransaction?.uiOptions?.description;if("approve"===ne&&"setApprovalForAll"===ae&&te.approved){let t=/*#__PURE__*/e.jsx(Cs,{address:te.operator||"",url:J?.blockExplorers?.default?.url});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[f.name," would like your permission for ",t," to transfer tokens on your behalf."]})}if("approve"===ne&&"setApprovalForAll"===ae&&!te.approved){let t=/*#__PURE__*/e.jsx(Cs,{address:te.operator||"",url:J?.blockExplorers?.default?.url});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[f.name," would like your permission to revoke permissions of ",t," from transferring tokens on your behalf."]})}return re&&"approve"===ne||re&&"approve"===ne?`${f.name} would like your permission for ${Dt(te.spender)} to spend tokens on your behalf.`:`${f.name} wants your permission to approve the following transaction.`}),[f.name,re,te,t.sendTransaction?.uiOptions.description,ae]),je=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,ke=!(!he||he.errors[0]||he.hasFunds||!1!==A),Te=ke&&me,Ae=Te?"Add funds":t.sendTransaction?.uiOptions?.buttonText||(x<w?"Continue":"Approve"),Se=e=>{if(!e)throw Error("Transaction scan failed");if("Success"===e.validation.status&&("Benign"===e.validation.result_type?O("safe"):"Warning"===e.validation.result_type?O("warn"):"Malicious"===e.validation.result_type&&(O("error"),H(!0))),"Success"!==e.simulation.status)throw Error("Simulation failed");{D(e.simulation.params);let{assetsIn:t,assetsOut:n}=function(e,t){let n=[],r=new Map;if(e)for(let t of e)if(t.in[0]){let e;e="ERC721"===t.asset.type||"approve_for_all"===t.in[0].value?{id:`nft:${t.asset.name}`,nftName:t.asset.name,nftCount:t.in.length}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.in[0].value,symbol:t.asset.symbol,usdValue:t.in[0].usd_price?cu(t.in[0].usd_price):void 0,decimals:t.asset.decimals},n.push(e)}else if(t.out[0]?.value){let e;e="ERC721"===t.asset.type||"approve_for_all"===t.out[0].value?{id:`nft:${t.asset.name}`,nftName:t.asset.name}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.out[0].value,symbol:t.asset.symbol,usdValue:t.out[0].usd_price?cu(t.out[0].usd_price):void 0,decimals:t.asset.decimals},r.has(e.id)||r.set(e.id,e)}for(let e of t)for(let t of Object.keys(e.spenders)){let n;n="ERC721"===e.asset.type||"approve_for_all"===e.spenders[t]?.value?{id:`nft:${e.asset.name}`,nftName:e.asset.name}:{id:`token:${e.asset.type}:${e.asset.symbol}:${e.asset.name}`,iconUrl:e.asset.logo_url,value:e.spenders[t]?.value,symbol:e.asset.symbol,usdValue:e.spenders[t]?.usd_price?cu(e.spenders[t]?.usd_price):void 0,decimals:e.asset.decimals},r.has(n.id)||r.set(n.id,n)}return{assetsIn:n,assetsOut:Array.from(r.values())}}(e.simulation.assets_diffs,e.simulation.exposures);if(0===n.length&&0===t.length)throw Error("No tokens found");$(n),G(t)}};if(n.useEffect((()=>{t.sendTransaction?.scanTransaction&&f.embeddedWallets.transactionScanning.enabled&&"uninitiated"===Y&&(Z("in progress"),t.sendTransaction.scanTransaction().then((e=>{Se(e),Z("completed")})).catch((()=>Z("failed"))))}),[!!t.sendTransaction?.scanTransaction]),n.useEffect((()=>{t.sendTransaction?.scanTransaction&&"failed"!==Y||((e,n,r)=>{if(C((e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(t)),n.isErc20Ish&&n.amount&&r){let e=Yc({amount:n.amount,decimals:r.decimals});Q(e),$([{value:e,symbol:r?.symbol,decimals:r?.decimals}])}else if(e.value){let t=BigInt(e.value),n=le?Ii(t,le):void 0;$(m&&n?[{value:n}]:[{value:Ni(t),symbol:ee,decimals:18,usdValue:n}])}else $(m?[{value:"$0"}]:[{value:"0",symbol:ee,decimals:18}])})(he?.tx??b,te,k)}),[b,he?.tx,te,k,Y]),_/*#__PURE__*/)return e.jsx(Yd,{txn:he?.tx??b,onClose:ge,receipt:_,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,tokenPrice:le,tokenSymbol:ee,receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription});if(F)/*#__PURE__*/return e.jsx(_d,{transactionError:F,transactionHash:P??void 0,chainType:"ethereum",chainId:he?.tx.chainId??b.chainId,onClose:ge,onRetry:({resetNonce:e})=>{L(null);let t={...he?.tx??b};e&&(t.nonce=void 0),j(t)}});let Ee=0!==w&&"number"==typeof x&&0!==x?()=>{v(x-1)}:void 0;return B&&W?/*#__PURE__*/e.jsx(ed,{details:W,onBack:()=>U(!1)}):/*#__PURE__*/e.jsx(kd,{transactionIndex:x,onBack:Ee,maxIndex:w,disabled:ke&&!me||z,isSubmitting:E,submitError:F,isPreparing:!he,isTokenPriceLoading:ce,isTokenContractInfoLoading:!ie&&!k,prepareError:he?.errors[0],symbol:k?.symbol,chain:J,img:je,title:Ce,subtitle:be,txValue:b.value,fee:fe??ye,isSponsored:A,from:X??"",to:oe,tokenAddress:se??void 0,network:f.chains.find((e=>e.id===b.chainId))?.name??"",transactionDetails:{...te,formattedAmount:K},cta:Ae,missingFunds:ke,action:ne,balance:we??ve??xe,onClose:ge,onClick:Te?async()=>{if(X){if(!me)throw Error("Funding wallet is not enabled");o({...t,funding:{...t.funding,methodScreen:Vp,chainType:"ethereum",amount:l.formatEther(BigInt(he?.tx.value??0)+BigInt(he?.totalGasEstimate?.toString()??0)),chain:J},solanaFundingData:t?.solanaFundingData}),s(Vp)}}:async()=>{if(x<w)v(x+1);else{I(!0);try{let e=await d.getAccessToken();if(E||!e||!g||!y)return;let n=await t.sendTransaction.onConfirm({transactionRequest:he?.tx??b});if(N(n),t.sendTransaction?.signOnly)return await new Promise((e=>setTimeout(e,it))),t?.sendTransaction?.onSuccess({hash:n}),h({shouldCallAuthOnSuccess:!1});let r=await pe.waitForTransactionReceipt({hash:n});if("reverted"===r.status)throw Error("Transaction failed");M(r)}catch(e){console.warn({transaction:he?.tx??b,error:e}),L(e)}finally{I(!1)}}},validation:R,hasScanDetails:!!W,setIsScanDetailsOpen:U,preventMaliciousTransaction:z,setPreventMaliciousTransaction:H,tokensSent:V,tokensReceived:q,isScanning:"in progress"===Y,isCancellable:t.sendTransaction?.uiOptions?.isCancellable??!1,functionName:ae})}};function gu({title:t}){let{currentScreen:n,navigateBack:r,navigate:i,data:a,setModalData:o}=Xn();/*#__PURE__*/return e.jsx(Hr,{title:t,backFn:n===zc?r:n===a?.funding?.methodScreen?a.funding.comingFromSendTransactionScreen?()=>i(hu):void 0:a?.funding?.methodScreen?()=>{let e=a.funding;e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),o({funding:e,solanaFundingData:a?.solanaFundingData}),i(e.methodScreen)}:void 0})}const mu=t=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 210.2",xmlSpace:"preserve",...t,children:/*#__PURE__*/e.jsx("path",{d:"M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9 C103.4,10,99.5,19.8,93.6,27.1 M102.3,40.9c-13.9-0.8-25.8,7.9-32.4,7.9c-6.7,0-16.8-7.5-27.8-7.3c-14.3,0.2-27.6,8.3-34.9,21.2 c-15,25.8-3.9,64,10.6,85c7.1,10.4,15.6,21.8,26.8,21.4c10.6-0.4,14.8-6.9,27.6-6.9c12.9,0,16.6,6.9,27.8,6.7 c11.6-0.2,18.9-10.4,26-20.8c8.1-11.8,11.4-23.3,11.6-23.9c-0.2-0.2-22.4-8.7-22.6-34.3c-0.2-21.4,17.5-31.6,18.3-32.2 C123.3,42.9,107.7,41.3,102.3,40.9 M182.6,11.9v155.9h24.2v-53.3h33.5c30.6,0,52.1-21,52.1-51.4c0-30.4-21.1-51.2-51.3-51.2H182.6z M206.8,32.3h27.9c21,0,33,11.2,33,30.9c0,19.7-12,31-33.1,31h-27.8V32.3z M336.6,169c15.2,0,29.3-7.7,35.7-19.9h0.5v18.7h22.4V90.2 c0-22.5-18-37-45.7-37c-25.7,0-44.7,14.7-45.4,34.9h21.8c1.8-9.6,10.7-15.9,22.9-15.9c14.8,0,23.1,6.9,23.1,19.6v8.6l-30.2,1.8 c-28.1,1.7-43.3,13.2-43.3,33.2C298.4,155.6,314.1,169,336.6,169z M343.1,150.5c-12.9,0-21.1-6.2-21.1-15.7c0-9.8,7.9-15.5,23-16.4 l26.9-1.7v8.8C371.9,140.1,359.5,150.5,343.1,150.5z M425.1,210.2c23.6,0,34.7-9,44.4-36.3L512,54.7h-24.6l-28.5,92.1h-0.5 l-28.5-92.1h-25.3l41,113.5l-2.2,6.9c-3.7,11.7-9.7,16.2-20.4,16.2c-1.9,0-5.6-0.2-7.1-0.4v18.7C417.3,210,423.3,210.2,425.1,210.2z"})}),yu=t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 38.1",xmlSpace:"preserve",...t,children:[/*#__PURE__*/e.jsx("path",{style:{fill:"#5F6368"},d:"M37.8,19.7V29h-3V6h7.8c1.9,0,3.7,0.7,5.1,2c1.4,1.2,2.1,3,2.1,4.9c0,1.9-0.7,3.6-2.1,4.9c-1.4,1.3-3.1,2-5.1,2 L37.8,19.7L37.8,19.7z M37.8,8.8v8h5c1.1,0,2.2-0.4,2.9-1.2c1.6-1.5,1.6-4,0.1-5.5c0,0-0.1-0.1-0.1-0.1c-0.8-0.8-1.8-1.3-2.9-1.2 L37.8,8.8L37.8,8.8z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#5F6368"},d:"M56.7,12.8c2.2,0,3.9,0.6,5.2,1.8s1.9,2.8,1.9,4.8V29H61v-2.2h-0.1c-1.2,1.8-2.9,2.7-4.9,2.7 c-1.7,0-3.2-0.5-4.4-1.5c-1.1-1-1.8-2.4-1.8-3.9c0-1.6,0.6-2.9,1.8-3.9c1.2-1,2.9-1.4,4.9-1.4c1.8,0,3.2,0.3,4.3,1v-0.7 c0-1-0.4-2-1.2-2.6c-0.8-0.7-1.8-1.1-2.9-1.1c-1.7,0-3,0.7-3.9,2.1l-2.6-1.6C51.8,13.8,53.9,12.8,56.7,12.8z M52.9,24.2 c0,0.8,0.4,1.5,1,1.9c0.7,0.5,1.5,0.8,2.3,0.8c1.2,0,2.4-0.5,3.3-1.4c1-0.9,1.5-2,1.5-3.2c-0.9-0.7-2.2-1.1-3.9-1.1 c-1.2,0-2.2,0.3-3,0.9C53.3,22.6,52.9,23.3,52.9,24.2z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#5F6368"},d:"M80,13.3l-9.9,22.7h-3l3.7-7.9l-6.5-14.7h3.2l4.7,11.3h0.1l4.6-11.3H80z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#4285F4"},d:"M25.9,17.7c0-0.9-0.1-1.8-0.2-2.7H13.2v5.1h7.1c-0.3,1.6-1.2,3.1-2.6,4v3.3H22C24.5,25.1,25.9,21.7,25.9,17.7z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#34A853"},d:"M13.2,30.6c3.6,0,6.6-1.2,8.8-3.2l-4.3-3.3c-1.2,0.8-2.7,1.3-4.5,1.3c-3.4,0-6.4-2.3-7.4-5.5H1.4v3.4 C3.7,27.8,8.2,30.6,13.2,30.6z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#FBBC04"},d:"M5.8,19.9c-0.6-1.6-0.6-3.4,0-5.1v-3.4H1.4c-1.9,3.7-1.9,8.1,0,11.9L5.8,19.9z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#EA4335"},d:"M13.2,9.4c1.9,0,3.7,0.7,5.1,2l0,0l3.8-3.8c-2.4-2.2-5.6-3.5-8.8-3.4c-5,0-9.6,2.8-11.8,7.3l4.4,3.4 C6.8,11.7,9.8,9.4,13.2,9.4z"})]}),fu=e=>{let[t,r]=n.useState();return n.useEffect((()=>{e().then((e=>{r(e)})).catch((()=>{}))}),[]),t},xu=({children:t,color:n,isLoading:r,isPulsing:i,...a})=>/*#__PURE__*/e.jsx(vu,{$color:n,$isLoading:r,$isPulsing:i,...a,children:t});let vu=/*#__PURE__*/a.styled.span.withConfig({displayName:"StyledSpan",componentId:"sc-80725f4-0"})(["padding:0.25rem;font-size:0.75rem;font-weight:500;line-height:1rem;border-radius:var(--privy-border-radius-xs);display:flex;align-items:center;"," ",""],(e=>{let t,n;"green"===e.$color&&(t="var(--privy-color-success-dark)",n="var(--privy-color-success-light)"),"red"===e.$color&&(t="var(--privy-color-error)",n="var(--privy-color-error-light)"),"gray"===e.$color&&(t="var(--privy-color-foreground-2)",n="var(--privy-color-background-2)");let r=/*#__PURE__*/a.keyframes(["from,to{background-color:",";}50%{background-color:rgba(",",0.8);}"],n,n);/*#__PURE__*/return a.css(["color:",";background-color:",";",";"],t,n,e.$isPulsing&&/*#__PURE__*/a.css(["animation:"," 3s linear infinite;"],r))}),sd);const wu=({onClick:n,text:r})=>/*#__PURE__*/e.jsxs(dr,{onClick:n,children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(t.Wallet,{})}),/*#__PURE__*/e.jsx(ir,{children:r})]}),Cu=({chainType:t,withPadding:n})=>{let r="";return r="ethereum-only"===t||"ethereum-and-solana"===t?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/e.jsx(hr,{$withPadding:n,children:/*#__PURE__*/e.jsxs(gr,{children:[/*#__PURE__*/e.jsx(pe.default,{style:{color:"var(--privy-color-warn)",height:48,width:48}}),/*#__PURE__*/e.jsx("h3",{children:"No wallets available"}),/*#__PURE__*/e.jsxs("p",{children:["Please download an external wallet provider, like ",r,"."]})]})},"empty-wallet-state")},bu=({icon:t,name:n})=>"string"==typeof t?/*#__PURE__*/e.jsx("img",{alt:`${n||"wallet"} logo`,src:t,style:{height:24,width:24,borderRadius:4}}):void 0===t?/*#__PURE__*/e.jsx(ve.default,{style:{height:24,width:24}}):t?/*#__PURE__*/e.jsx(t,{}):null;function ju(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const ku=({walletLogo:t,success:n,errorMessage:r,title:i,subtitle:a,onRetry:o,onUseDifferentWallet:s,onBack:l,numRetries:c,maxRetries:d})=>/*#__PURE__*/e.jsx(bi,{title:i,subtitle:a,icon:t,iconVariant:"loading",iconLoadingStatus:{success:n,fail:!!r},primaryCta:r===on.ERROR_USER_EXISTS?{label:"Use a different wallet",onClick:s}:!n&&r?.retryable&&c<d?{label:"Retry",onClick:o,disabled:!r?.retryable||c>=d}:!n&&r&&c>=d?{label:"Use a different wallet",onClick:s}:void 0,onBack:l,watermark:!0}),Tu={component:()=>{let t,{navigateBack:i,navigate:a,lastScreen:o,currentScreen:s,data:l,setModalData:c}=Xn(),{walletConnectionStatus:d,closePrivyModal:u}=r.usePrivyInternal(),[p,h]=n.useState(void 0),[g,m]=n.useState(0),y=Nn(d?.connector?.walletClientType||"unknown"),f="connected"===d?.status,x="switching_to_supported_chain"===d?.status;n.useEffect((()=>{if(f){let e;if(l?.externalConnectWallet?.onCompleteNavigateTo){let t=l.externalConnectWallet.onCompleteNavigateTo,n=d.connectedWallet?.address;e=setTimeout((()=>{l.funding&&c({...l,funding:{...l.funding,connectedWalletAddress:n}}),a(t({address:n,walletClientType:d.connector?.walletClientType,walletChainType:d.connector?.chainType}))}),it)}else e=setTimeout(u,it);return()=>clearTimeout(e)}}),[f]);n.useEffect((()=>{d?.connectError&&(e=>{h(gc(e))})(d?.connectError)}),[d]);let w=d?.connector?.connectorType||"injected",C=d?.connector?.walletClientType||"unknown",b=y?.metadata?.shortName||y?.name||d?.connector?.walletBranding.name||"Browser Extension",j=y?.image_url?.md||d?.connector?.walletBranding.icon||(t=>/*#__PURE__*/e.jsx(mn,{...t})),k="Browser Extension"===b?b.toLowerCase():b;t=f?`Successfully connected with ${k}`:p?p.message:x?"Switching networks":`Waiting for ${k}`;let T="Don’t see your wallet? Check your other browser windows.";return f?T="You’re good to go!":g>=2&&p?T="Unable to connect wallet":p?T=p.detail:x?T="Switch your wallet to the requested network.":"metamask"===C&&v.isMobile?T="Click to continue to open and connect MetaMask.":"metamask"===C?T="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===w?T="Open your mobile wallet app to continue":"coinbase_wallet"===w&&(T="Confirm in the Coinbase app/popup to continue."),/*#__PURE__*/e.jsx(ku,{walletName:b,walletLogo:j,success:f,errorMessage:p,title:t,subtitle:T,onRetry:()=>{m(g+1),h(void 0),d?.connectRetry()},onUseDifferentWallet:i,onBack:s===o?void 0:i,numRetries:g,maxRetries:2})}},Au=/*#__PURE__*/a.styled.div.withConfig({displayName:"TodoList",componentId:"sc-bcc78743-0"})(["display:flex;flex-direction:column;justify-content:flex-start;gap:10px;padding-left:8px;"]),Su=({children:n,variant:r="default",icon:i})=>{let a=()=>{switch(r){case"success":return"var(--privy-color-icon-success)";case"error":return"var(--privy-color-icon-error)";default:return"var(--privy-color-icon-muted)"}};/*#__PURE__*/return e.jsxs(Iu,{children:[/*#__PURE__*/e.jsx(Eu,{$variant:r,"data-variant":r,children:(()=>{if(i)
21
- /*#__PURE__*/return le.default.isValidElement(i)?/*#__PURE__*/le.default.cloneElement(i,{stroke:a(),strokeWidth:2}):i;switch(r){case"success":default:/*#__PURE__*/return e.jsx(t.Check,{size:12,stroke:a(),strokeWidth:3});case"error":/*#__PURE__*/return e.jsx(t.X,{size:12,stroke:a(),strokeWidth:3})}})()}),n]})};let Eu=/*#__PURE__*/a.styled.div.withConfig({displayName:"IconBackground",componentId:"sc-bcc78743-2"})(["display:flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background-color:",";flex-shrink:0;"],(({$variant:e})=>{switch(e){case"success":return"var(--privy-color-success-bg, #EAFCEF)";case"error":return"var(--privy-color-error-bg, #FEE2E2)";default:return"var(--privy-color-background-2)"}})),Iu=/*#__PURE__*/a.styled.div.withConfig({displayName:"TodoItemWrapper",componentId:"sc-bcc78743-3"})(["display:flex;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;&&{a{color:var(--privy-color-accent);}}"]);const Pu=({walletName:t,installLink:n,title:r,subtitle:i="Follow the instructions below to get started.",onReload:a,onBack:o})=>{let s=r||`Create a ${t} wallet`.replace(/wallet wallet/gi,"wallet"),l=/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("span",{children:"Still not sure? "}),/*#__PURE__*/e.jsx(ps,{size:"sm",target:"_blank",href:"https://solana.com/docs/intro/wallets",children:"Learn more"})]});/*#__PURE__*/return e.jsx(bi,{title:s,subtitle:i,onBack:o,showBack:!0,primaryCta:{label:"Reload the page to use your wallet",onClick:a},helpText:l,watermark:!0,children:/*#__PURE__*/e.jsxs(Au,{children:[/*#__PURE__*/e.jsx(Su,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx("span",{children:"Install the "})," ",/*#__PURE__*/e.jsxs(ps,{href:n,target:"_blank",children:[t," browser extension"]})]})}),/*#__PURE__*/e.jsx(Su,{children:"Set up your first wallet"}),/*#__PURE__*/e.jsx(Su,{children:"Store your recovery phrase in a safe place!"})]})})},Nu={component:()=>{let{navigateBack:t,data:n}=Xn();if(!n?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:r}=n.installWalletModalData;/*#__PURE__*/return e.jsx(Pu,{walletName:r.name,installLink:r.installLink,onReload:()=>{window.location.reload()},onBack:t})}},_u=({title:t,subtitle:n,buttonText:r,buttonHref:i,isLoading:a=!1,helpText:o,onButtonClick:s})=>/*#__PURE__*/e.jsx(bi,{title:t,subtitle:n,primaryCta:{label:r,onClick:()=>{i&&window.open(i,"_self"),s?.()},disabled:a},helpText:o,watermark:!0}),Mu={component:()=>{let{ready:t}=i.usePrivyContext(),{data:r}=Xn(),[a,o]=n.useState(!1);if(!r?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:s,connectOnly:l,chainType:c}=r.installWalletModalData,d=s.getMobileRedirect({useUniversalLink:!a,isSolana:"solana"===c,connectOnly:l}),u=s.name.replace(/ wallet/gi,""),p={title:`Redirecting to ${u} Mobile Wallet`,description:`We'll take you to the ${u} Mobile Wallet app to continue your login experience.`,footnote:""};return t&&(p.description=`For the best experience, we'll automatically log you into the ${u} Mobile Wallet in-app browser.`,p.footnote="You can always return here to login via other methods."),a&&(p.title="Still here?",p.description=`You may need to install the ${s.name} mobile app.`,p.footnote=`Once you're done, you can connect with ${s.name} wallet to complete the login.`),/*#__PURE__*/e.jsx(_u,{title:p.title,subtitle:p.description,buttonText:a?"Go to App Store":"Continue",buttonHref:d,isLoading:t&&!d,helpText:p.footnote||void 0,onButtonClick:()=>{setTimeout((()=>o(!0)),1e3)}})}},Fu=({provider:t,displayName:n,logo:i,connectOnly:a,connector:o})=>{let s,{navigate:l,setModalData:c}=Xn(),{connectWallet:d}=r.usePrivyInternal(),u=as(),p=Nn(t),h="wallet_connect_v2"===o.connectorType?t:o.walletClientType,g=window.matchMedia("(display-mode: standalone)").matches,m=wn({connectorType:o.connectorType,walletClientType:h});s=m&&m.chainTypes.includes(o.chainType)?()=>{m.isInstalled||"solana"===o.chainType&&"isInstalled"in o&&o.isInstalled?(d(o,h),l(a?Tu:yc)):v.isMobile?(c({installWalletModalData:{walletConfig:m,chainType:o.chainType,connectOnly:a}}),l(Mu)):(c({installWalletModalData:{walletConfig:m,chainType:o.chainType,connectOnly:a}}),l(Nu))}:"coinbase_wallet"!==o.connectorType||"eoaOnly"!==o.coinbaseWalletConfig.preference?.options||!v.isMobile||g||Mt()?()=>{(!ju(window.navigator.userAgent)||event?.isTrusted)&&(d(o,h),a?"wallet_connect_v2"===o.connectorType?(c((e=>({...e,externalConnectWallet:{...e?.externalConnectWallet,preSelectedWalletId:"wallet_connect_qr"}}))),l($p)):l(Tu):l(yc))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`};let y=n||p?.metadata?.shortName||p?.name||o.walletClientType;/*#__PURE__*/return e.jsxs(Lu,{onClick:s,children:[/*#__PURE__*/e.jsx(bu,{icon:i||p?.image_url?.md,name:y}),/*#__PURE__*/e.jsx("span",{children:y}),/*#__PURE__*/e.jsxs(Du,{id:"chip-container",children:[u?.walletClientType===h&&u?.chainType===o.chainType?/*#__PURE__*/e.jsx(Wu,{color:"gray",children:"Recent"}):/*#__PURE__*/e.jsx("span",{id:"connect-text",children:"Connect"}),"solana"===o.chainType&&/*#__PURE__*/e.jsx(Wu,{color:"gray",children:"Solana"})]})]})};let Lu=/*#__PURE__*/a.styled(dr).withConfig({displayName:"ConnectWalletButton",componentId:"sc-89605346-0"})(["> span{color:var(--privy-color-foreground);}> #chip-container > #connect-text{font-weight:500;color:var(--privy-color-accent);opacity:0;transition:opacity 0.1s ease-out;}:hover > #chip-container > #connect-text{opacity:1;}@media (max-width:440px){> #chip-container > #connect-text{display:none;}}"]),Wu=/*#__PURE__*/a.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-89605346-1"})(["margin-left:auto;"]),Du=/*#__PURE__*/a.styled.div.withConfig({displayName:"ChipContainer",componentId:"sc-89605346-2"})(["display:flex;flex-wrap:wrap;gap:8px;margin-left:auto;"]);const Ru=["coinbase_wallet","base_account"];let Ou=["metamask","okx_wallet","rainbow","uniswap","bybit_wallet","ronin_wallet","haha_wallet","uniswap_extension","zerion","rabby_wallet","cryptocom","binance"];const Bu=["safe"],Uu=["phantom","backpack","solflare","universal_profile"],zu=({walletList:t,walletChainType:n,connectors:r,connectOnly:i,ignore:a,walletConnectEnabled:o,forceWallet:s})=>{let l=[],c=[],d=[],u=r.filter((e=>"ethereum-only"===n?"ethereum"===e.chainType:"solana-only"!==n||"solana"===e.chainType)),p=u.find((e=>"wallet_connect_v2"===e.connectorType));for(let[r,h]of(s?[s.wallet]:t).entries()){if("detected_ethereum_wallets"===h)for(let[t,n]of u.filter((({chainType:e,connectorType:t,walletClientType:n})=>"solana"!==e&&("uniswap_wallet_extension"===n||"uniswap_extension"===n?!a.includes("uniswap"):"crypto.com_wallet_extension"===n||"crypto.com_onchain"===n?!a.includes("cryptocom"):"injected"===t&&!a.includes(n)))).entries()){let{walletClientType:a,walletBranding:o,chainType:s}=n;("unknown"===a?c:l).push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:a,logo:o.icon,displayName:o.name,connector:n},`${r}-${h}-${a}-${s}-${t}`))}if("detected_solana_wallets"===h)for(let[t,o]of u.filter((({chainType:e,walletClientType:t})=>{if("solana"===e)return"ethereum-only"!==n&&!a.includes(t)})).entries()){let{walletClientType:n,walletBranding:a,chainType:s}=o;("unknown"===n?c:l).push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:n,logo:a.icon,displayName:a.name,connector:o},`${r}-${h}-${n}-${s}-${t}`))}if(Uu.includes(h)){let t=u.find((e=>"injected"===e.connectorType&&e.walletClientType===h||e.connectorType===h));if(t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:h,connector:t},`${r}-${h}`)),"solana-only"===n||"ethereum-and-solana"===n){let t=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===h));t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:h,connector:t},`${h}-solana`))}}else if(Ou.includes(h)){let t=u.find((e=>"uniswap"===h?"uniswap_wallet_extension"===e.walletClientType||"uniswap_extension"===e.walletClientType:"cryptocom"===h?"crypto.com_wallet_extension"===e.walletClientType||"crypto.com_onchain"===e.walletClientType:"injected"===e.connectorType&&e.walletClientType===h));if(o&&!t&&(t=p),t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:h,connector:t,logo:"injected"===t.connectorType?t.walletBranding.icon:void 0,displayName:"injected"===t.connectorType?t.walletBranding.name:void 0},`${r}-${h}`)),"solana-only"===n||"ethereum-and-solana"===n){let t=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===h));t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:h,connector:t},`${h}-solana`))}}else if(Ru.includes(h)){let t=u.find((({connectorType:e})=>e===h));t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:h,connector:t,displayName:"coinbase_wallet"===t.walletClientType?"Coinbase":"Base",logo:"coinbase_wallet"===t.walletClientType?Jt:en},`${r}-${h}`))}else if(Bu.includes(h))p&&d.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:h,connector:p},`${r}-${h}`));else if("wallet_connect"===h)p&&d.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:h,connector:p,logo:p.walletBranding.icon,displayName:"WalletConnect"},`${r}-${h}`));else if(h===s?.wallet){let n="ethereum"===s.chainType&&t.includes("detected_ethereum_wallets"),a="solana"===s.chainType&&t.includes("detected_solana_wallets");if(n||a){let t=u.find((({walletClientType:e})=>e===h));t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:i,provider:h,displayName:t.walletBranding?.name,logo:t.walletBranding?.icon,connector:t},`${r}-${h}`))}}}return[...c,...l,...d]},Hu=({chains:e,appId:t,address:n,rpcConfig:r,includeUsdc:i})=>Promise.all(e.map((async e=>{let a=l.createPublicClient({chain:e,transport:l.http(Lt(e,r,t))}),o=await a.getBalance({address:n}).catch((()=>0n)),s=null,d=c.UsdcAddressMap[e.id];if(i&&d){let{balance:i}=await Bc({address:n,chain:e,rpcConfig:r,appId:t,erc20Address:d});s=i}return{balance:o,erc20Balance:s,erc20Address:d,chain:e}}))),Vu=t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 397.7 311.7",enableBackground:"new 0 0 397.7 311.7",xmlSpace:"preserve",...t,children:[/*#__PURE__*/e.jsxs("linearGradient",{id:"SVGID_1_",gradientUnits:"userSpaceOnUse",x1:"360.8791",y1:"351.4553",x2:"141.213",y2:"-69.2936",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/e.jsx("path",{d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5 c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z",fill:"url(#SVGID_1_)"}),/*#__PURE__*/e.jsxs("linearGradient",{id:"SVGID_2_",gradientUnits:"userSpaceOnUse",x1:"264.8291",y1:"401.6014",x2:"45.163",y2:"-19.1475",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/e.jsx("path",{d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5 c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z",fill:"url(#SVGID_2_)"}),/*#__PURE__*/e.jsxs("linearGradient",{id:"SVGID_3_",gradientUnits:"userSpaceOnUse",x1:"312.5484",y1:"376.688",x2:"92.8822",y2:"-44.061",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/e.jsx("path",{d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4 c5.8,0,8.7-7,4.6-11.1L333.1,120.1z",fill:"url(#SVGID_3_)"})]});let $u={[c.arbitrum.id]:t=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",version:"1.1",id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 2500 2500",xmlSpace:"preserve",...t,children:/*#__PURE__*/e.jsx("g",{id:"Layer_x0020_1",children:/*#__PURE__*/e.jsxs("g",{id:"_2405588477232",children:[/*#__PURE__*/e.jsx("rect",{fill:"none",width:"2500",height:"2500"}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsxs("g",{children:[/*#__PURE__*/e.jsx("path",{fill:"#213147",d:"M226,760v980c0,63,33,120,88,152l849,490c54,31,121,31,175,0l849-490c54-31,88-89,88-152V760 c0-63-33-120-88-152l-849-490c-54-31-121-31-175,0L314,608c-54,31-87,89-87,152H226z"}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsxs("g",{children:[/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#12AAFF",d:"M1435,1440l-121,332c-3,9-3,19,0,29l208,571l241-139l-289-793C1467,1422,1442,1422,1435,1440z"})}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#12AAFF",d:"M1678,882c-7-18-32-18-39,0l-121,332c-3,9-3,19,0,29l341,935l241-139L1678,883V882z"})})]})}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#9DCCED",d:"M1250,155c6,0,12,2,17,5l918,530c11,6,17,18,17,30v1060c0,12-7,24-17,30l-918,530c-5,3-11,5-17,5 s-12-2-17-5l-918-530c-11-6-17-18-17-30V719c0-12,7-24,17-30l918-530c5-3,11-5,17-5l0,0V155z M1250,0c-33,0-65,8-95,25L237,555 c-59,34-95,96-95,164v1060c0,68,36,130,95,164l918,530c29,17,62,25,95,25s65-8,95-25l918-530c59-34,95-96,95-164V719 c0-68-36-130-95-164L1344,25c-29-17-62-25-95-25l0,0H1250z"})}),/*#__PURE__*/e.jsx("polygon",{fill:"#213147",points:"642,2179 727,1947 897,2088 738,2234 "}),/*#__PURE__*/e.jsxs("g",{children:[/*#__PURE__*/e.jsx("path",{fill:"#FFFFFF",d:"M1172,644H939c-17,0-33,11-39,27L401,2039l241,139l550-1507c5-14-5-28-19-28L1172,644z"}),/*#__PURE__*/e.jsx("path",{fill:"#FFFFFF",d:"M1580,644h-233c-17,0-33,11-39,27L738,2233l241,139l620-1701c5-14-5-28-19-28V644z"})]})]})})]})})}),[c.avalanche.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"1503",height:"1504",viewBox:"0 0 1503 1504",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"287",y:"258",width:"928",height:"844",fill:"white"}),/*#__PURE__*/e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1502.5 752C1502.5 1166.77 1166.27 1503 751.5 1503C336.734 1503 0.5 1166.77 0.5 752C0.5 337.234 336.734 1 751.5 1C1166.27 1 1502.5 337.234 1502.5 752ZM538.688 1050.86H392.94C362.314 1050.86 347.186 1050.86 337.962 1044.96C327.999 1038.5 321.911 1027.8 321.173 1015.99C320.619 1005.11 328.184 991.822 343.312 965.255L703.182 330.935C718.495 303.999 726.243 290.531 736.021 285.55C746.537 280.2 759.083 280.2 769.599 285.55C779.377 290.531 787.126 303.999 802.438 330.935L876.42 460.079L876.797 460.738C893.336 489.635 901.723 504.289 905.385 519.669C909.443 536.458 909.443 554.169 905.385 570.958C901.695 586.455 893.393 601.215 876.604 630.549L687.573 964.702L687.084 965.558C670.436 994.693 661.999 1009.46 650.306 1020.6C637.576 1032.78 622.263 1041.63 605.474 1046.62C590.161 1050.86 573.004 1050.86 538.688 1050.86ZM906.75 1050.86H1115.59C1146.4 1050.86 1161.9 1050.86 1171.13 1044.78C1181.09 1038.32 1187.36 1027.43 1187.92 1015.63C1188.45 1005.1 1181.05 992.33 1166.55 967.307C1166.05 966.455 1165.55 965.588 1165.04 964.706L1060.43 785.75L1059.24 783.735C1044.54 758.877 1037.12 746.324 1027.59 741.472C1017.08 736.121 1004.71 736.121 994.199 741.472C984.605 746.453 976.857 759.552 961.544 785.934L857.306 964.891L856.949 965.507C841.69 991.847 834.064 1005.01 834.614 1015.81C835.352 1027.62 841.44 1038.5 851.402 1044.96C860.443 1050.86 875.94 1050.86 906.75 1050.86Z",fill:"#E84142"})]}),[c.base.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),/*#__PURE__*/e.jsx("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]}),[c.celo.id]:t=>/*#__PURE__*/e.jsxs("svg",{fill:"none",height:"400",viewBox:"0 0 400 400",width:"400",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("path",{d:"m0 0h400v400h-400z",fill:"#fcff52"}),/*#__PURE__*/e.jsx("path",{d:"m300 100h-200v200h199.996v-69.813h-33.191c-11.442 25.468-37.194 43.206-66.665 43.206-40.63 0-73.533-33.187-73.533-73.533s32.903-73.249 73.533-73.249c30.043 0 55.795 18.313 67.24 44.349h32.62z",fill:"#000"})]}),[c.linea.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"200",height:"208",viewBox:"0 0 200 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"199.4",height:"207.623",fill:"#121212"}),/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_2303_643)",children:[/*#__PURE__*/e.jsx("path",{d:"M132.369 155.99H49.7001V68.8854H68.6148V139.109H132.369V155.981V155.99Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M132.369 85.7575C141.687 85.7575 149.241 78.2036 149.241 68.8855C149.241 59.5673 141.687 52.0134 132.369 52.0134C123.05 52.0134 115.497 59.5673 115.497 68.8855C115.497 78.2036 123.05 85.7575 132.369 85.7575Z",fill:"white"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2303_643",children:/*#__PURE__*/e.jsx("rect",{width:"99.5407",height:"103.977",fill:"white",transform:"translate(49.7001 52.0134)"})})})]}),[c.mainnet.id]:t=>/*#__PURE__*/e.jsxs("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 327.5 533.3",enableBackground:"new 0 0 327.5 533.3;",xmlSpace:"preserve",...t,children:[/*#__PURE__*/e.jsx("path",{fill:"#8492B2",d:"M163.7,197.2V0L0,271.6L163.7,197.2z"}),/*#__PURE__*/e.jsx("path",{fill:"#62688F",d:"M163.7,368.4V197.2L0,271.6L163.7,368.4z M163.7,197.2l163.7,74.4L163.7,0V197.2z"}),/*#__PURE__*/e.jsx("path",{fill:"#454A75",d:"M163.7,197.2v171.2l163.7-96.8L163.7,197.2z"}),/*#__PURE__*/e.jsx("path",{fill:"#8492B2",d:"M163.7,399.4L0,302.7l163.7,230.7V399.4z"}),/*#__PURE__*/e.jsx("path",{fill:"#62688F",d:"M327.5,302.7l-163.8,96.7v134L327.5,302.7z"})]}),[c.optimism.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"500",height:"500",viewBox:"0 0 500 500",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("circle",{cx:"250",cy:"250",r:"250",fill:"#FF0420"}),/*#__PURE__*/e.jsx("path",{d:"M177.133 316.446C162.247 316.446 150.051 312.943 140.544 305.938C131.162 298.808 126.471 288.676 126.471 275.541C126.471 272.789 126.784 269.411 127.409 265.408C129.036 256.402 131.35 245.581 134.352 232.947C142.858 198.547 164.812 181.347 200.213 181.347C209.845 181.347 218.476 182.973 226.107 186.225C233.738 189.352 239.742 194.106 244.12 200.486C248.498 206.74 250.688 214.246 250.688 223.002C250.688 225.629 250.375 228.944 249.749 232.947C247.873 244.08 245.621 254.901 242.994 265.408C238.616 282.546 231.048 295.368 220.29 303.874C209.532 312.255 195.147 316.446 177.133 316.446ZM179.76 289.426C186.766 289.426 192.707 287.362 197.586 283.234C202.59 279.106 206.155 272.789 208.281 264.283C211.158 252.524 213.348 242.266 214.849 233.51C215.349 230.883 215.599 228.194 215.599 225.441C215.599 214.058 209.657 208.366 197.774 208.366C190.768 208.366 184.764 210.43 179.76 214.558C174.882 218.687 171.379 225.004 169.253 233.51C167.001 241.891 164.749 252.149 162.498 264.283C161.997 266.784 161.747 269.411 161.747 272.163C161.747 283.672 167.752 289.426 179.76 289.426Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M259.303 314.57C257.927 314.57 256.863 314.132 256.113 313.256C255.487 312.255 255.3 311.13 255.55 309.879L281.444 187.914C281.694 186.538 282.382 185.412 283.508 184.536C284.634 183.661 285.822 183.223 287.073 183.223H336.985C350.87 183.223 362.003 186.1 370.384 191.854C378.891 197.609 383.144 205.927 383.144 216.81C383.144 219.937 382.769 223.19 382.018 226.567C378.891 240.953 372.574 251.586 363.067 258.466C353.685 265.346 340.8 268.786 324.413 268.786H299.082L290.451 309.879C290.2 311.255 289.512 312.38 288.387 313.256C287.261 314.132 286.072 314.57 284.822 314.57H259.303ZM325.727 242.892C330.98 242.892 335.546 241.453 339.424 238.576C343.427 235.699 346.054 231.571 347.305 226.192C347.68 224.065 347.868 222.189 347.868 220.563C347.868 216.935 346.805 214.183 344.678 212.307C342.551 210.305 338.924 209.305 333.795 209.305H311.278L304.148 242.892H325.727Z",fill:"white"})]}),[c.polygon.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"360",height:"360",viewBox:"0 0 360 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"360",height:"360",rx:"180",fill:"#6C00F6"}),/*#__PURE__*/e.jsx("path",{d:"M157.743 154.241L141.052 144.58L90.9766 173.561V231.519L141.052 260.5L191.13 231.519V141.359L218.948 125.26L246.77 141.359V173.561L218.948 189.66L202.257 180.002V205.759L218.948 215.42L269.024 186.439V128.481L218.948 99.5L168.873 128.481V218.641L141.052 234.74L113.233 218.641V186.439L141.052 170.34L157.743 179.998V154.241Z",fill:"white"})]}),[c.zora.id]:t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",...t,children:[/*#__PURE__*/e.jsx("g",{clipPath:"url(#clip0)",children:/*#__PURE__*/e.jsx("g",{clipPath:"url(#clip1)",children:/*#__PURE__*/e.jsx("path",{d:"M14.9188 29.8373C6.67944 29.8373 0.00012207 23.1581 0.00012207 14.9187C0.00012207 6.67931 6.67944 0 14.9188 0C23.1581 0 29.8373 6.67931 29.8373 14.9187C29.8373 23.1581 23.1581 29.8373 14.9188 29.8373Z",fill:"url(#paint0)"})})}),/*#__PURE__*/e.jsxs("defs",{children:[/*#__PURE__*/e.jsxs("radialGradient",{id:"paint0",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(21.6921 8.02215) rotate(180) scale(25.2008)",children:[/*#__PURE__*/e.jsx("stop",{offset:"0.00682297",stopColor:"#F2CEFE"}),/*#__PURE__*/e.jsx("stop",{offset:"0.1913",stopColor:"#AFBAF1"}),/*#__PURE__*/e.jsx("stop",{offset:"0.4982",stopColor:"#4281D3"}),/*#__PURE__*/e.jsx("stop",{offset:"0.666667",stopColor:"#2E427D"}),/*#__PURE__*/e.jsx("stop",{offset:"0.822917",stopColor:"#230101"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#8F6B40"})]}),/*#__PURE__*/e.jsx("clipPath",{id:"clip0",children:/*#__PURE__*/e.jsx("rect",{width:"30",height:"30",fill:"white"})}),/*#__PURE__*/e.jsx("clipPath",{id:"clip1",children:/*#__PURE__*/e.jsx("rect",{width:"30",height:"30",fill:"white"})})]})]})};const qu=({chainId:t,...n})=>{if("solana"===t)/*#__PURE__*/return e.jsx(Vu,{...n});let r=$u[t];return r?/*#__PURE__*/e.jsx(r,{...n}):/*#__PURE__*/e.jsx(qe.default,{...n})},Gu=({balance:t,className:n,chain:r})=>/*#__PURE__*/e.jsx(Ac,{className:n,$state:void 0,children:/*#__PURE__*/e.jsx(Yu,{balance:t,chain:r})}),Yu=({balance:t,chain:n})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Zu,{children:[/*#__PURE__*/e.jsx(Qu,{chainId:"object"==typeof n?n.id:"solana"}),/*#__PURE__*/e.jsx(ld,{children:"object"==typeof n?n.name:Rc(n)})]}),/*#__PURE__*/e.jsxs(xu,{isLoading:!1,isPulsing:!1,color:"gray",children:[/*#__PURE__*/e.jsx(Ku,{children:/*#__PURE__*/e.jsx(ve.default,{})}),t]})]});let Zu=/*#__PURE__*/a.styled.div.withConfig({displayName:"Container",componentId:"sc-63f80cee-0"})(["display:flex;align-items:center;"]),Ku=/*#__PURE__*/a.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-63f80cee-1"})(["height:0.75rem;width:0.75rem;margin-right:0.2rem;"]),Qu=/*#__PURE__*/a.styled(qu).withConfig({displayName:"StyledNetworkIcon",componentId:"sc-63f80cee-2"})(["height:1.25rem;width:1.25rem;display:inline-block;margin-right:0.5rem;border-radius:4px;"]);const Xu=({options:t,onSelect:n,selected:r,className:i})=>/*#__PURE__*/e.jsxs(re.Menu,{as:Ju,children:[/*#__PURE__*/e.jsxs(re.MenuButton,{as:rp,children:[/*#__PURE__*/e.jsx(Yu,{balance:r.balance,chain:r.chain}),/*#__PURE__*/e.jsx(np,{height:16})]}),/*#__PURE__*/e.jsx(re.MenuItems,{as:ep,className:i,children:t.map(((t,r)=>/*#__PURE__*/e.jsx(re.MenuItem,{as:tp,onClick:()=>n(r),children:/*#__PURE__*/e.jsx(Yu,{balance:t.balance,chain:t.chain})},r)))})]});let Ju=/*#__PURE__*/a.styled.div.withConfig({displayName:"Wrapper",componentId:"sc-31c00f79-0"})(["width:100%;position:relative;"]),ep=/*#__PURE__*/a.styled.div.withConfig({displayName:"Popover",componentId:"sc-31c00f79-1"})(["width:100%;margin-top:0.5rem;position:absolute;background-color:var(--privy-color-background);border-radius:var(--privy-border-radius-md);overflow-x:hidden;overflow-y:auto;box-shadow:0px 1px 2px 0px rgba(16,24,40,0.05);max-height:11.75rem;&&{border:solid 1px var(--privy-color-foreground-4);}z-index:1;"]),tp=/*#__PURE__*/a.styled.button.withConfig({displayName:"Button",componentId:"sc-31c00f79-2"})(["width:100%;display:flex;justify-content:space-between;&&{padding:1rem;}:not(:last-child){border-bottom:solid 1px var(--privy-color-foreground-4);}:hover{background:var(--privy-color-background-2);}"]),np=/*#__PURE__*/a.styled(Ve.default).withConfig({displayName:"StyledChevronIcon",componentId:"sc-31c00f79-3"})(["height:1rem;margin-left:0.5rem;"]),rp=/*#__PURE__*/a.styled.button.withConfig({displayName:"StyledMenuButton",componentId:"sc-31c00f79-4"})([""," span{margin-left:auto;}","{transition:rotate 100ms ease-in;}&[aria-expanded='true']{","{rotate:-180deg;}}"],Tc,np,np);const ip=/*#__PURE__*/a.styled.div.withConfig({displayName:"FundingMethodContainer",componentId:"sc-eaaa12a-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),ap=/*#__PURE__*/a.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-eaaa12a-1"})(["width:24px;height:24px;display:flex;justify-content:center;align-items:center;svg{border-radius:var(--privy-border-radius-sm);}"]),op=/*#__PURE__*/a.styled.div.withConfig({displayName:"FundingQuantityWrapper",componentId:"sc-eaaa12a-2"})(["display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:8px;"]),sp=/*#__PURE__*/a.styled.div.withConfig({displayName:"FundingQuantity",componentId:"sc-eaaa12a-3"})(["display:flex;align-items:center;gap:4px;width:100%;padding:0 16px;border-width:1px !important;border-radius:12px;cursor:text;&:focus-within{border-color:var(--privy-color-accent);}"]),lp=/*#__PURE__*/a.styled.input.withConfig({displayName:"FundingAmountInput",componentId:"sc-eaaa12a-5"})(["background-color:var(--privy-color-background);width:100%;&:focus{outline:none !important;border:none !important;box-shadow:none !important;}&&{font-size:26px;}"]),cp=/*#__PURE__*/a.styled(lp).withConfig({displayName:"FundingAmountInputLarge",componentId:"sc-eaaa12a-6"})(["&&{font-size:42px;}"]),dp=/*#__PURE__*/a.styled.div.withConfig({displayName:"FundingCurrency",componentId:"sc-eaaa12a-8"})(["font-size:18px;"]),up=/*#__PURE__*/a.styled.div.withConfig({displayName:"FundingDollars",componentId:"sc-eaaa12a-9"})(["font-size:12px;color:var(--privy-color-foreground-3);height:20px;"]),pp=/*#__PURE__*/a.styled.div.withConfig({displayName:"InfoButtonText",componentId:"sc-eaaa12a-13"})([""]),hp=/*#__PURE__*/a.styled.a.withConfig({displayName:"InfoButtonLink",componentId:"sc-eaaa12a-14"})(["&&{color:var(--privy-color-accent);}cursor:pointer;"]),gp=({displayName:t,errorMessage:r,configuredFundingChain:i,formattedBalance:a,fundingAmount:o,fundingCurrency:s,fundingAmountInUsd:l,options:d,selectedOption:u,isPreparing:p,isSubmitting:h,addressToFund:g,fundingWalletAddress:m,onSubmit:y,onSelect:f,onAmountChange:x,erc20ContractInfo:v})=>{let w=n.useRef(null);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ji,{}),/*#__PURE__*/e.jsx(jc,{children:"Transfer from another network"}),/*#__PURE__*/e.jsxs(bc,{children:["You need more funds on the"," ","object"==typeof i?i.name:Rc(i)," ","network. Bridge from another blockchain network."]}),/*#__PURE__*/e.jsxs(op,{style:{marginTop:"2rem"},children:[/*#__PURE__*/e.jsxs(sp,{onClick:()=>w.current?.focus(),children:[/*#__PURE__*/e.jsx(lp,{ref:w,value:o,onChange:e=>{let t=e.target.value;if(/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1){let e=/\.$/.test(t)?".":"",n=Number(t.replace(/\.$/,"")||"0");if(Number.isNaN(n))return void x("0");x(n.toString()+e)}}}),/*#__PURE__*/e.jsx(dp,{children:s})]}),l&&/*#__PURE__*/e.jsx(up,{children:l})]}),/*#__PURE__*/e.jsxs(ad,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/e.jsx(td,{children:"From"}),/*#__PURE__*/e.jsx(td,{children:c.formatWalletAddress(m)})]}),/*#__PURE__*/e.jsx(Xu,{selected:{chain:u.chain,balance:u.isErc20Quote?Yc({amount:u.erc20Balance??0n,decimals:v?.decimals??6})+` ${v?.symbol||""}`:Pi(u.balance,u.chain.nativeCurrency.symbol,3,!0)},options:d.map((({chain:e,balance:t,isErc20Quote:n,erc20Balance:r})=>({chain:e,balance:n?Yc({amount:r??0n,decimals:v?.decimals??6})+` ${v?.symbol||""}`:Pi(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:f}),/*#__PURE__*/e.jsxs(ad,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/e.jsx(td,{children:"To"}),/*#__PURE__*/e.jsx(td,{children:c.formatWalletAddress(g)})]}),/*#__PURE__*/e.jsx(Gu,{chain:i,balance:a}),/*#__PURE__*/e.jsx(wl,{style:{marginTop:"1rem"},children:r}),/*#__PURE__*/e.jsxs(Nr,{style:{marginTop:"1rem"},loading:h||p,disabled:p||h,onClick:y,children:["Confirm with ",t]}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]})},mp=({walletClientType:t,displayName:n,addressToFund:r,chainId:i,chainName:a,isBridging:o,isErc20Flow:s,totalPriceInNativeCurrency:l,totalPriceInUsd:c,gasPriceInNativeCurrency:d,gasPriceInUsd:u})=>{let p=Nn(t);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Kr,{centerIcon:/*#__PURE__*/e.jsx(bu,{icon:p?.image_url?.md,name:t})}),/*#__PURE__*/e.jsx(Ua,{style:{marginTop:"8px",marginBottom:"12px"},title:`${o?"Bridging":"Confirming"} with ${n}`}),!o&&!s&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Total"}),/*#__PURE__*/e.jsx(ld,{children:c||l})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"To"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r,showCopyIcon:!1})})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Network"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsxs(yp,{children:[/*#__PURE__*/e.jsx(qu,{chainId:i,height:16,width:16})," ",a]})})]}),d&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(ld,{children:u||d})]})]}),/*#__PURE__*/e.jsx(ta,{height:24}),/*#__PURE__*/e.jsx(xr,{})]})};let yp=/*#__PURE__*/a.styled.div.withConfig({displayName:"NetworkColumn",componentId:"sc-5bdbf842-0"})(["display:flex;flex-direction:row;align-items:center;gap:4px;"]);const fp={component:()=>{let t=qn(),{rpcConfig:i,appId:a,closePrivyModal:o,createAnalyticsEvent:s}=r.usePrivyInternal(),{navigate:u,setModalData:p,data:h}=Xn(),g=qn(),{wallets:m}=Na(),[y,f]=n.useState(null),[x,v]=n.useState(null),[w,C]=n.useState([]),[b,j]=n.useState(0),[k,T]=n.useState(!1),[A,S]=n.useState(!1),[E,I]=n.useState(!1),[P,N]=n.useState(!1),[_,M]=n.useState(),[F,L]=n.useState();if(!h?.funding||"solana"!==h.funding.chainType)throw Error("Invalid funding data");let{address:W,chain:D,connectedWalletAddress:R}=h.funding,[O,B]=n.useState(h.funding.amount),U=R?m.find((({address:e})=>e===R)):m[0],z=Nn(U?.walletClientType||"unknown"),H=z?.name||"wallet",[V,$]=n.useState(null);n.useEffect((()=>{(async()=>{if(!U)return;let e=await U.getEthereumProvider();$(l.createWalletClient({account:U.address,transport:l.custom(e)}).extend(l.publicActions))})().catch(console.error)}),[U]);let[q,G]=n.useState(0n),Y=Ri(q);n.useEffect((()=>{let e=t.solanaRpcs[D];e?Dc({rpc:e.rpc,address:W}).then((e=>G(BigInt(e)))).catch(console.error):console.warn("Unable to load solana rpc, skipping balance")}),[]);let[Z,K]=n.useState(),{tokenPrice:Q}=Ia("solana"),{fundingAmountInBaseUnit:X,fundingAmountInUsd:J}=function({amount:e,fee:t,tokenPrice:n,isUsdc:r}){let i=BigInt(Math.floor(parseFloat(e)*10**(r?6:9))),a=r?i:i+t;return{fundingAmountInBaseUnit:i,fundingAmountInUsd:n?Wi(i,n):void 0,totalPriceInUsd:n?Wi(a,n):void 0,totalPriceInNativeCurrency:Ri(a),feePriceInNativeCurrency:Ri(t),feePriceInUsd:n?Wi(t,n):void 0}}({amount:O,fee:0n,tokenPrice:Q,isUsdc:h.funding.isUSDC});if(n.useEffect((()=>{(async()=>{if(!V||!U)return;let e=["solana:testnet","solana:devnet"].includes(D);e&&console.warn("Solana testnets are not supported for bridging");let t=c.addToDefaultChains(g.chains).filter((({testnet:t})=>!!t===e)),n=(await Hu({chains:t,address:U.address,appId:a,rpcConfig:i})).filter((e=>e.balance>0n));if(n.length<1)return void f(new d.PrivyClientError(`Wallet ${Dt(U.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));n.sort(((e,t)=>Number(t.balance-e.balance)));let r=(await Promise.allSettled(n.map((async e=>({...e,quote:await _s({isTestnet:!1,input:Is({amount:X.toString(),user:U.address,recipient:W,destinationChainId:As,destinationCurrency:Ss,originChainId:e.chain.id})})}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(r.length<1)return void f(new d.PrivyClientError(`Unable to fetch quotes for bridging. Wallet ${Dt(U.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));let o=r.map((({quote:e,balance:t,chain:n})=>({bridgeTx:Ms(e),balance:t,chain:n,isErc20Quote:!1}))).filter((({bridgeTx:e})=>!!e));if(o.length>1)return void C(o);let s=o.at(0);s?(S(!0),K({data:s.bridgeTx.data,to:s.bridgeTx.to,value:s.bridgeTx.value,chain:s.chain})):f(new d.PrivyClientError(`Unable to select bridge option from quotes. Wallet ${Dt(U.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[V]),n.useEffect((()=>{(async()=>{let e,t;if(!V||!U||k||E||!Z)return;T(!0);let n=l.createPublicClient({chain:Z.chain,transport:l.http(Lt(Z.chain,i,a))});try{e=await n.prepareTransactionRequest({account:U.address,to:Z.to,chain:Z.chain,data:Z.data,value:BigInt(Z.value??0)})}catch(e){console.error(e),w.length>1&&v(e.shortMessage??"Something went wrong")}if(e){T(!1),I(!0);try{await V.switchChain({id:Z.chain.id})}catch(e){await V.addChain({chain:Z.chain}),await V.switchChain({id:Z.chain.id})}try{t=await V.sendTransaction(e)}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(w.length<1?f(new d.PrivyClientError(e.shortMessage,void 0,d.PrivyErrorCode.TRANSACTION_FAILURE)):v(e.shortMessage??"Something went wrong"))}if(t)return await V.waitForTransactionReceipt({hash:t}),A?(L("pending"),void M(t)):(I(!1),N(!0),void s({eventName:Wc,payload:{provider:"external",status:"success",txHash:t,address:U.address,chainId:Z.chain.id,chainType:"ethereum",value:Z.value?l.formatUnits(BigInt(Z.value),18):void 0,token:"ETH",destination:W,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:l.formatUnits(X,9),destinationToken:"SOL"}}));I(!1)}else T(!1)})().catch(console.error)}),[V,Z]),Ls({transactionHash:_,isTestnet:!1,bridgingStatus:F,setBridgingStatus:L,onSuccess({transactionHash:e}){S(!1),N(!0),s({eventName:Wc,payload:{provider:"external",status:"success",txHash:e,address:U?.address,chainId:Z?.chain.id,chainType:"ethereum",value:Z?.value?l.formatUnits(BigInt(Z.value),18):void 0,token:"ETH",destination:W,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:l.formatUnits(X,9),destinationToken:"SOL"}})},onFailure({error:e}){S(!1),f(e)}}),n.useEffect((()=>{y&&(p({funding:h?.funding,solanaFundingData:h?.solanaFundingData,sendTransaction:h?.sendTransaction,errorModalData:{error:y,previousScreen:bp}}),u(Rs,!1))}),[y]),n.useEffect((()=>{if(!P)return;let e=setTimeout(o,at);return()=>clearTimeout(e)}),[P]),P/*#__PURE__*/)return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ji,{}),/*#__PURE__*/e.jsxs(Zi,{children:[/*#__PURE__*/e.jsx($e.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ua,{title:"Success!",description:`You’ve successfully added ${O} SOL to your ${g.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]});let ee=w[b];return w.length>1&&ee?/*#__PURE__*/e.jsx(gp,{displayName:H,configuredFundingChain:D,formattedBalance:Y,fundingAmount:O,fundingCurrency:"SOL",fundingAmountInUsd:J,options:w,selectedOption:ee,isPreparing:k,isSubmitting:E,addressToFund:W,fundingWalletAddress:U?.address||"",errorMessage:x,onSubmit:()=>{h.funding?.amount!==O?async function(){if(U&&ee)try{let e=await _s({isTestnet:!1,input:Is({amount:X.toString(),user:U.address,recipient:W,destinationChainId:As,destinationCurrency:Ss,originChainId:ee.chain.id})}),t=Ms(e);if(!t)throw Error("Invalid transaction request");S(!0),K({data:t.data,to:t.to,value:t.value,chain:ee.chain})}catch(e){console.error(e),f(new d.PrivyClientError("Unable to fetch quotes for bridging",e,d.PrivyErrorCode.INSUFFICIENT_BALANCE))}}().catch(console.error):K({to:ee.bridgeTx.to,data:ee.bridgeTx.data,value:ee.bridgeTx.value,chain:ee.chain})},onSelect:e=>{e!==b&&(v(null),j(e))},onAmountChange:B}):E&&U?/*#__PURE__*/e.jsx(mp,{walletClientType:U?.walletClientType||"unknown",displayName:H,addressToFund:W,isBridging:A,isErc20Flow:!1,chainId:"solana",chainName:Rc(D),totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
22
- /*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Kr,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(xr,{})]})}},xp={component:()=>{let{rpcConfig:t,appId:i,closePrivyModal:a,createAnalyticsEvent:o}=r.usePrivyInternal(),{navigate:s,setModalData:u,data:p}=Xn(),h=qn(),{wallets:g}=Na(),[m,y]=n.useState(!1),[f,x]=n.useState(0n),[v,w]=n.useState(!1),[C,b]=n.useState(null),[j,k]=n.useState(null),[T,A]=n.useState([]),[S,E]=n.useState(0),[I,P]=n.useState(!1),[N,_]=n.useState(!1),[M,F]=n.useState(!1),[L,W]=n.useState(!1),[D,R]=n.useState(),[O,B]=n.useState();if(!p?.funding||"ethereum"!==p.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:U,chain:z,connectedWalletAddress:H}=p.funding,V=p.funding.address,$=p.funding.erc20Address,[q,G]=n.useState(p.funding.amount);n.useEffect((()=>{$&&!U&&b(Error("Unable to fetch token details"))}),[]);let Y=!!$&&!!U,Z=Y?BigInt(parseFloat(q)*10**U.decimals):l.parseEther(q),K=H?g.find((({address:e})=>e===H)):g[0],Q=Nn(K?.walletClientType||"unknown"),X=Q?.name||"wallet",[J,ee]=n.useState(null);n.useEffect((()=>{(async()=>{if(!K)return;let e=await K.getEthereumProvider();ee(l.createWalletClient({account:K.address,transport:l.custom(e)}).extend(l.publicActions))})().catch(console.error)}),[K]);let[te,ne]=n.useState(0n);n.useEffect((()=>{l.createPublicClient({chain:z,transport:l.http(Lt(z,t,i))}).getBalance({address:V}).then(ne).catch(console.error)}),[]);let[re,ie]=n.useState(0n);n.useEffect((()=>{Y&&Bc({chain:z,address:V,appId:i,rpcConfig:t,erc20Address:$}).then((e=>ie(e.balance))).catch(console.error)}),[]);let{tokenPrice:ae}=Ia(z.id),[oe,se]=n.useState({to:V,chain:z,value:Z,data:void 0});n.useEffect((()=>{(async()=>{let e,n;if(!J||!K||I||M)return;P(!0);let r=l.createPublicClient({chain:oe.chain,transport:l.http(Lt(oe.chain,t,i))});if(Y&&!oe.data)return await r.simulateContract({address:$,chain:oe.chain,abi:Jd,functionName:"transfer",args:[V,Z],account:K.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(P(!1),void se({to:$,chain:oe.chain,data:l.encodeFunctionData({abi:Jd,functionName:"transfer",args:[V,Z]}),value:"0x0"})):(P(!1),void w(!0));try{e=await r.prepareTransactionRequest({account:K.address,to:oe.to,chain:oe.chain,data:oe.data,value:BigInt(oe.value??0)})}catch(e){if(console.error(e),T.length>1)k(e.shortMessage??"Something went wrong");else if(N&&0===T.length)return void b(new d.PrivyClientError(`Wallet ${Dt(K.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE))}if(!e)return P(!1),void w(!0);P(!1),F(!0),y(!0),x(e.gas);try{await J.switchChain({id:oe.chain.id})}catch(e){await J.addChain({chain:oe.chain}),await J.switchChain({id:oe.chain.id})}try{n=await J.sendTransaction(e)}catch(e){if(console.error(e),"TransactionExecutionError"===e.name)if(T.length<1){let t=e.shortMessage;(e.shortMessage.includes("rejected the request")||e.details.includes("rejected the request"))&&(t="User rejected the request."),b(new d.PrivyClientError(t,void 0,d.PrivyErrorCode.TRANSACTION_FAILURE))}else k(e.shortMessage??"Something went wrong")}if(n)return await J.waitForTransactionReceipt({hash:n}),F(!1),N?(R(n),void B("pending")):(W(!0),void o({eventName:Wc,payload:{provider:"external",status:"success",txHash:n,address:K.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?l.formatUnits(BigInt(oe.value),U?.decimals??18):void 0,token:U?.symbol??$??"ETH",destinationAddress:V,destinationChainId:z.id,destinationChainType:"ethereum",destinationValue:Z?l.formatUnits(Z,U?.decimals??18):void 0,destinationToken:U?.symbol??$??z.nativeCurrency.name}}));F(!1)})().catch(console.error)}),[J,oe]),n.useEffect((()=>{(async()=>{if(!v||!J||!K)return;let e=c.addToDefaultChains(h.chains).filter((e=>e.id!==z.id&&!!e.testnet==!!z.testnet));Y&&e.unshift(z);let n=await Hu({chains:e,address:K.address,appId:i,rpcConfig:t,includeUsdc:p.funding?.isUSDC}),r=Y?n.filter((e=>e.balance>0n)):n.filter((e=>e.balance>Z)),a=Y&&n.every((e=>0n===e.balance));if(r.length<1)return void b(a?new d.PrivyClientError(`Wallet ${Dt(K.address)} doesn't have enough funds to cover gas fees. Top up your wallet and try again.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE):new d.PrivyClientError(`Wallet ${Dt(K.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));r.sort(((e,t)=>Number(Y?(t.erc20Balance??0n)-(e.erc20Balance??0n):t.balance-e.balance)));let o=r.flatMap((e=>{let t=[{...e,isErc20Quote:!1,isTestnet:!!z.testnet,input:Is({amount:Z.toString(),user:K.address,recipient:V,destinationChainId:z.id,destinationCurrency:$,originChainId:e.chain.id})}];return Y&&$&&(e.erc20Balance??0n)>=Z&&t.push({...e,isErc20Quote:!0,isTestnet:!!z.testnet,input:Is({amount:Z.toString(),user:K.address,recipient:V,destinationChainId:z.id,destinationCurrency:$,originChainId:e.chain.id,originCurrency:e.erc20Address})}),t})),s=(await Promise.allSettled(o.map((async e=>({...e,quote:await _s(e)}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(s.length<1)return void b(new d.PrivyClientError(`Wallet ${Dt(K.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));let l=s.map((e=>({bridgeTx:Ms(e.quote),balance:e.balance,chain:e.chain,erc20Balance:e.erc20Balance,isErc20Quote:e.isErc20Quote}))).filter((e=>!!e.bridgeTx));if(l.length>1)return void A(l);let u=l[0];u?(_(!0),se({data:u.bridgeTx.data,to:u.bridgeTx.to,value:u.bridgeTx.value,chain:u.chain})):b(new d.PrivyClientError(`Wallet ${Dt(K.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[v]),Ls({transactionHash:D,isTestnet:!!z.testnet,bridgingStatus:O,setBridgingStatus:B,onSuccess({transactionHash:e}){_(!1),W(!0),o({eventName:Wc,payload:{provider:"external",status:"success",txHash:e,address:K?.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?l.formatUnits(BigInt(oe.value),U?.decimals??18):void 0,token:U?.symbol??$??"ETH",destinationAddress:V,destinationChainId:z.id,destinationChainType:"ethereum",destinationValue:Z?l.formatUnits(Z,U?.decimals??18):void 0,destinationToken:U?.symbol??$??z.nativeCurrency.name}})},onFailure({error:e}){_(!1),b(e)}}),n.useEffect((()=>{C&&(u({funding:p?.funding,solanaFundingData:p?.solanaFundingData,sendTransaction:p?.sendTransaction,errorModalData:{error:C,previousScreen:bp}}),s(Rs,!1))}),[C]);let le=!Y&&ae?Ei(q??"0",ae):void 0,ce=Y?f:_i([f,Z]),de=ce&&ae?Ii(ce,ae):void 0,ue=ce?Pi(ce,p?.funding?.erc20Address?p?.funding?.erc20ContractInfo?.symbol||"ETH":p?.funding?.chain.nativeCurrency.symbol||"ETH"):void 0,pe=f&&ae?Ii(f,ae):void 0,he=f?Pi(f,z?.nativeCurrency?.symbol||"ETH"):void 0;if(n.useEffect((()=>{if(!L)return;let e=setTimeout(a,at);return()=>clearTimeout(e)}),[L]),L/*#__PURE__*/)return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ji,{}),/*#__PURE__*/e.jsxs(Zi,{children:[/*#__PURE__*/e.jsx($e.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ua,{title:"Success!",description:`You’ve successfully added ${q} ${Y?U.symbol:z.nativeCurrency.symbol} to your ${h.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]});let ge=Y?`${Yc({amount:re,decimals:U.decimals})} ${U.symbol}`:Pi(te,z.nativeCurrency.symbol,3,!0),me=T[S];return T.length>1&&me?/*#__PURE__*/e.jsx(gp,{displayName:X,configuredFundingChain:z,erc20ContractInfo:U,formattedBalance:ge,fundingAmount:q,fundingCurrency:Y?U.symbol:z.nativeCurrency.symbol,fundingAmountInUsd:le,options:T,selectedOption:me,isPreparing:I,isSubmitting:M,addressToFund:V,fundingWalletAddress:K?.address||"",errorMessage:j,onSubmit:()=>{p.funding?.amount!==q?async function(){if(K&&me)try{let e=await _s({isTestnet:!!z.testnet,input:Is({amount:Z.toString(),user:K.address,recipient:V,destinationChainId:z.id,destinationCurrency:$,originChainId:me.chain.id})}),t=Ms(e);if(!t)throw Error("Invalid transaction request");_(!0),se({data:t.data,to:t.to,value:t.value,chain:me.chain})}catch(e){console.error(e),b(new d.PrivyClientError("Unable to fetch quotes for bridging",e,d.PrivyErrorCode.INSUFFICIENT_BALANCE))}}().catch(console.error):se({to:me.bridgeTx.to,data:me.bridgeTx.data,value:me.bridgeTx.value,chain:me.chain})},onSelect:e=>{e!==S&&(k(null),E(e))},onAmountChange:G}):m&&f&&K&&p?.funding?/*#__PURE__*/e.jsx(mp,{walletClientType:K?.walletClientType||"unknown",displayName:X,addressToFund:V,isBridging:N,isErc20Flow:Y,totalPriceInUsd:de,totalPriceInNativeCurrency:ue,gasPriceInUsd:pe,gasPriceInNativeCurrency:he,chainId:z.id,chainName:z.name}):
23
- /*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Kr,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(xr,{})]})}},vp=Symbol("solana-funding-plugin"),wp={component:function(){let t=qn(),{closePrivyModal:i,createAnalyticsEvent:a,connectors:o}=r.usePrivyInternal(),{navigate:s,setModalData:u,data:p}=Xn(),h=qn(),g=n.useRef(!1),m=ec(),[y,f]=n.useState(!1),[x,v]=n.useState(!1),[w,C]=n.useState(null),[b,j]=n.useState(),[k,T]=n.useState();if(!p?.funding||"ethereum"!==p.funding.chainType)throw Error("Invalid funding data");let{amount:A,connectedWalletAddress:S,chain:E,solanaChain:I,isUSDC:P}=p.funding,N=p.funding.address,_=p.funding.erc20Address,M=p.funding.isUSDC?"USDC":E.nativeCurrency.symbol,F=n.useMemo((()=>function({connectors:e,connectedWalletAddress:t}){let n=e.find((e=>"solana"===e.chainType&&e.wallets.some((e=>e.address===t)))),r=n?.wallet.accounts.find((e=>e.address===t));if(!n||!r)throw new d.PrivyClientError("Unable to find source wallet connector");return new c.ConnectedStandardSolanaWallet({wallet:n.wallet,account:r})}({connectors:o,connectedWalletAddress:S||""})),[o,S]),L=n.useMemo((()=>{let e=m(vp);if(!e)throw new d.PrivyClientError("Unable to load solana plugin");let n=t.solanaRpcs["solana:mainnet"];if(!n)throw new d.PrivyClientError("Unable to load mainnet RPC");return e.getSolanaRpcClient({rpc:n.rpc,rpcSubscriptions:n.rpcSubscriptions,chain:"solana:mainnet",blockExplorerUrl:n.blockExplorerUrl??"https://explorer.solana.com"})}),[]),W=Nn(kn(F?.standardWallet.name||"unknown")),D=W?.name||"wallet";return n.useEffect((()=>{(async function(){if(!F||!E||g.current)return;let e=m(vp);if(!e)return void C(new d.PrivyClientError("Unable to solana plugin"));g.current=!0,E?.testnet&&console.warn("Solana testnets are not supported for bridging");let t=P?1e6*parseFloat(A):l.parseEther(A),n=await _s({isTestnet:!!E.testnet,input:Is({amount:t.toString(),user:F.address,recipient:N,destinationChainId:E.id,originChainId:As,originCurrency:P?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":Ss,destinationCurrency:P?_:void 0})}).catch(console.error);if(!n)return void C(new d.PrivyClientError(`Unable to fetch quotes for bridging. Wallet ${Rt(F.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));let r=await e.createTransactionFromRelayQuote({quote:n,source:F.address,solanaClient:L});if(r)try{f(!0);let t=await e.simulateTransaction({solanaClient:L,tx:r});if(t.hasError)return t.hasFunds?(console.error("Transaction failed:",t.error),void C(new d.PrivyClientError("Something went wrong",void 0,d.PrivyErrorCode.TRANSACTION_FAILURE))):void C(new d.PrivyClientError(`Wallet ${Rt(F?.address)} does not have enough funds. ${n.details.currencyIn.amountFormatted} ${M} are needed to complete the transaction.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));let{signature:i}=await F.signAndSendTransaction({chain:"solana:mainnet",transaction:r}),a=e.getAddressFromBuffer(i);j(a),T("pending")}catch(e){if(console.error(e),/user rejected the request/gi.test(e.message||""))return void C(new d.PrivyClientError("Transaction was rejected by the user",void 0,d.PrivyErrorCode.TRANSACTION_FAILURE));C(new d.PrivyClientError("Something went wrong",void 0,d.PrivyErrorCode.TRANSACTION_FAILURE))}else C(new d.PrivyClientError(`Unable to select bridge option from quotes. Wallet ${Rt(F.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[]),Ls({transactionHash:b,isTestnet:!1,bridgingStatus:k,setBridgingStatus:T,onSuccess({transactionHash:e}){f(!1),v(!0),a({eventName:Wc,payload:{provider:"external",status:"success",txHash:e,address:F.address,chainType:"solana",clusterName:I,token:"SOL",destinationAddress:N,destinationChainId:E.id,destinationChainType:"ethereum",destinationValue:A,destinationToken:P?"USDC":"ETH"}})},onFailure({error:e}){f(!1),C(e)}}),n.useEffect((()=>{if(!x)return;let e=setTimeout(i,at);return()=>clearTimeout(e)}),[x]),n.useEffect((()=>{w&&(u({funding:p?.funding,solanaFundingData:p?.solanaFundingData,sendTransaction:p?.sendTransaction,errorModalData:{error:w,previousScreen:bp}}),s(Rs,!1))}),[w]),x?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ji,{}),/*#__PURE__*/e.jsxs(Zi,{children:[/*#__PURE__*/e.jsx($e.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ua,{title:"Success!",description:`You’ve successfully added ${A} ${M} to your ${h.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(ea,{}),/*#__PURE__*/e.jsx(xr,{})]}):y&&F?/*#__PURE__*/e.jsx(mp,{walletClientType:kn(F?.standardWallet.name||"unknown"),displayName:D,addressToFund:N,isBridging:y,isErc20Flow:!1,chainId:E.id,chainName:E.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
24
- /*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Kr,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(xr,{})]})}},Cp={component:()=>{let{data:t,setModalData:r}=Xn(),i=t?.funding,a="solana"===i.chainType,o=n.useRef(null),{tokenPrice:s}=Ia(a?"solana":i.chain.id),l=a?void 0:i,c=!(!l?.erc20Address||l?.erc20ContractInfo),d=a?i.isUSDC?"USDC":"SOL":i.erc20Address?i.erc20ContractInfo?.symbol:i.chain.nativeCurrency.symbol||"ETH",u=parseFloat(i.amount),p=!isNaN(u)&&u>0,h=s?Ei(i.amount,s):void 0;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(jc,{children:"Confirm or edit amount"}),/*#__PURE__*/e.jsxs(Ki,{style:{marginTop:"32px"},children:[/*#__PURE__*/e.jsx(op,{children:c?/*#__PURE__*/e.jsx(Kr,{size:"50px"}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(sp,{onClick:()=>o.current?.focus(),children:[/*#__PURE__*/e.jsx(cp,{ref:o,value:i.amount,onChange:e=>{let n=e.target.value;/^[0-9.]*$/.test(n)&&n.split(".").length-1<=1&&r({...t,funding:{...i,amount:n},solanaFundingData:t?.solanaFundingData?{...t.solanaFundingData,amount:n}:void 0})}}),/*#__PURE__*/e.jsx(dp,{children:d})]}),!l?.erc20Address&&/*#__PURE__*/e.jsx(up,{children:h&&p?`${h} USD`:""})]})}),/*#__PURE__*/e.jsx(Nr,{style:{marginTop:"1rem"},disabled:!p,onClick:i.onContinueWithExternalWallet,children:"Continue"})]}),/*#__PURE__*/e.jsx(xr,{})]})}},bp={component:()=>{let t,{connectors:i}=r.usePrivyInternal(),{setModalData:a,data:o,navigate:s}=Xn(),l=qn(),{wallets:c}=Na(),d=i.filter(Sn).flatMap((e=>e.wallets)),[u,p]=n.useState("default"),h="solana"===o?.funding?.chainType,g=!!o?.funding?.crossChainBridgingEnabled;t="ethereum"===o?.funding?.chainType?o.funding.erc20Address&&!o.funding.isUSDC?"ethereum-only":g&&!o.funding.chain.testnet?"ethereum-and-solana":"ethereum-only":g&&!o.funding?.isUSDC?"ethereum-and-solana":"solana-only";let m=c.filter((e=>"privy"!==e.walletClientType)),y=m.map((e=>e.walletClientType)),f=d.filter((e=>"privy"!==e.walletClientType)),x=f.map((e=>e.walletClientType)),v=[],w={...o.funding};w.usingDefaultFundingMethod&&(w.usingDefaultFundingMethod=!1);let C=({address:e,walletChainType:t,walletClientType:n})=>{a({...o,funding:{...w,connectedWalletAddress:e,onContinueWithExternalWallet:()=>s(j({destChainType:h?"solana":"ethereum",sourceChainType:t}))},solanaFundingData:o?.solanaFundingData?{...o.solanaFundingData,sourceWalletData:{address:e,walletClientType:n}}:void 0}),s(Cp)};"solana-only"!==t&&v.push(...m.map(((t,n)=>/*#__PURE__*/e.jsx(jp,{onClick:()=>C({address:t.address,walletChainType:"ethereum",walletClientType:t.walletClientType}),icon:t.meta.icon,name:t.meta.name,chainType:t.type},n)))),"ethereum-only"!==t&&v.push(...f.map(((t,n)=>/*#__PURE__*/e.jsx(jp,{onClick:()=>C({address:t.address,walletChainType:"solana",walletClientType:t.walletClientType}),icon:t.meta.icon,name:t.meta.name,chainType:t.type},n)))),v.push(...zu({walletList:l.appearance.walletList.filter((e=>!m.some((t=>t.walletClientType===e))&&!f.some((t=>t.walletClientType===e)))),walletChainType:t,connectors:i,connectOnly:!0,ignore:[...l.appearance.walletList,...y,...x],walletConnectEnabled:l.externalWallets.walletConnect.enabled}));let b=/*#__PURE__*/e.jsx(wu,{text:"More wallets",onClick:()=>p("overflow")}),j=({sourceChainType:e,destChainType:t})=>"ethereum"===e&&"solana"===t?fp:"ethereum"===e&&"ethereum"===t?xp:"solana"===e&&"ethereum"===t?wp:w.externalSolanaFundingScreen;return n.useEffect((()=>{a({...o,externalConnectWallet:{onCompleteNavigateTo:({address:e,walletClientType:t,walletChainType:n})=>(a({...o,funding:{...w,connectedWalletAddress:e,onContinueWithExternalWallet:()=>{s(j({destChainType:h?"solana":"ethereum",sourceChainType:n??"ethereum"}))}},solanaFundingData:o?.solanaFundingData?{...o.solanaFundingData,sourceWalletData:{address:e||"",walletClientType:t||""}}:void 0}),Cp)}})}),[]),"overflow"===u?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{backFn:()=>p("default")},"header"),/*#__PURE__*/e.jsxs(or,{children:[/*#__PURE__*/e.jsx(bc,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),v]}),/*#__PURE__*/e.jsx(xr,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ua,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),/*#__PURE__*/e.jsxs(or,{children:[v.length>4?v.slice(0,3):v,v.length>4&&b]}),/*#__PURE__*/e.jsx(xr,{})]})}};let jp=({onClick:t,icon:n,name:r,chainType:i})=>/*#__PURE__*/e.jsxs(dr,{onClick:t,children:[/*#__PURE__*/e.jsx(ap,{style:{width:20},children:/*#__PURE__*/e.jsx("img",{src:n})}),r,/*#__PURE__*/e.jsx(xu,{color:"gray",style:{marginLeft:"auto"},children:"Connected"}),"solana"===i&&/*#__PURE__*/e.jsx(xu,{color:"gray",children:"Solana"})]});const kp={component:()=>{let{data:t,setModalData:i,navigate:a,navigateBack:o}=Xn(),{closePrivyModal:s,createAnalyticsEvent:l,client:c}=r.usePrivyInternal(),[d,u]=n.useState("pending-in-flow"),p=n.useRef(0),h={...t?.funding,showAlternateFundingMethod:!0};h.usingDefaultFundingMethod&&(h.usingDefaultFundingMethod=!1);let{partnerUserId:g,popup:m}=t?.coinbaseOnrampStatus??{};return n.useEffect((()=>{if("pending-in-flow"===d||"pending-after-flow"===d){let e=setInterval((async()=>{if(g)try{let{status:e}=await c.getCoinbaseOnRampStatus({partnerUserId:g});if("success"===e)return void u("success");if("failure"===e)throw Error("There was an error completing Coinbase Onramp flow.");if(p.current>=3)return i({funding:h,solanaFundingData:t?.solanaFundingData}),void a(Vp);m?.closed&&(p.current=p.current+1,u("pending-after-flow"))}catch(e){console.error(e),u("error"),l({eventName:Wc,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),i({funding:{...h,errorMessage:"Something went wrong adding funds. Please try again or use another method."},solanaFundingData:t?.solanaFundingData}),a(Vp)}}),1500);return()=>clearInterval(e)}}),[g,m,d]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{title:"Fund account",backFn:()=>{i({funding:h,solanaFundingData:t?.solanaFundingData}),o()}},"header"),/*#__PURE__*/e.jsx(Tp,{status:d,onClickCta:s}),/*#__PURE__*/e.jsx(xr,{})]})}};let Tp=({status:t,onClickCta:r})=>{let{title:i,body:a,cta:o}=n.useMemo((()=>(e=>{switch(e){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Almost done. Retrieving transaction status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(t)),[t]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Ep,{children:[/*#__PURE__*/e.jsx(Ap,{isSucccess:"success"===t}),/*#__PURE__*/e.jsxs(Qi,{children:[/*#__PURE__*/e.jsx("h3",{children:i}),/*#__PURE__*/e.jsx(Sp,{children:a})]})]}),o&&/*#__PURE__*/e.jsx(Pr,{onClick:r,children:o})]})},Ap=({isSucccess:t})=>{if(!t){let t="var(--privy-color-foreground-4)";/*#__PURE__*/return e.jsxs("div",{style:{position:"relative"},children:[/*#__PURE__*/e.jsx(kr,{color:t,style:{position:"absolute"}}),/*#__PURE__*/e.jsx(Tr,{color:t}),/*#__PURE__*/e.jsx(Xt,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let n=(t=>t?Pe.default:()=>/*#__PURE__*/e.jsx(Ue.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),r=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(t);/*#__PURE__*/return e.jsx("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&/*#__PURE__*/e.jsx(n,{width:"4rem",height:"4rem",color:r})})},Sp=/*#__PURE__*/a.styled.p.withConfig({displayName:"StatusBody",componentId:"sc-8428a551-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),Ep=/*#__PURE__*/a.styled.div.withConfig({displayName:"ConnectContainer",componentId:"sc-8428a551-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);let Ip={[c.mainnet.id]:"ethereum",[c.base.id]:"base",[c.optimism.id]:"optimism",[c.polygon.id]:"polygon",[c.arbitrum.id]:"arbitrum"};const Pp=(e,t,n,r,i,a)=>new Promise((async(o,s)=>{let l=Ra();if(!l)return void s(Error("Unable to initialize flow"));let u="ethereum"===t.chainType?function(e){let t=Ip[e];if(!t)throw new d.PrivyClientError(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(t.chain.id):"solana",p=t.isUSDC?"USDC":"ethereum"===t.chainType?c.toCoinbaseAssetId(t.chain.id,"native-currency"):"SOL",h=await e.initCoinbaseOnRamp({addresses:[{address:t.address,blockchains:[u]}],assets:[p]}),{url:g}=c.getCoinbaseOnRampUrl({appId:e.getAppId(),input:h,amount:t.amount,blockchain:u,asset:p,experience:a});l.location=g.toString();let m={...i?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(m.usingDefaultFundingMethod=!1),n({funding:m,solanaFundingData:i?.solanaFundingData,coinbaseOnrampStatus:{popup:l}}),r(kp),e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.chain}}),setTimeout((()=>{n({funding:m,solanaFundingData:i?.solanaFundingData,coinbaseOnrampStatus:{partnerUserId:h.partner_user_id,popup:l}})}),5e3),o()})),Np="moonpay";function _p(e){return parseFloat(e)}function Mp(e,t=!1){let[i,a]=n.useState(null),{createAnalyticsEvent:o}=r.usePrivyInternal(),{data:s,navigate:l,setModalData:c}=Xn(),d=s?.funding,u=n.useRef(0);return n.useEffect((()=>{let n=setInterval((async()=>{if(e)try{let[r]=await async function(e,t){return ie.ofetch(`https://api.moonpay.com/v1/transactions/ext/${e}`,{query:{apiKey:t?"pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI":"pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL"}})}(e,t),i="waitingAuthorization"===r.status&&"credit_debit_card"===r.paymentMethod?"pending":r.status;if(["failed","completed","awaitingAuthorization"].includes(i)&&(o({eventName:Wc,payload:{status:i,provider:Np,paymentMethod:r.paymentMethod,cardPaymentType:r.cardPaymentType,currency:r.currency?.code,baseCurrencyAmount:r.baseCurrencyAmount,quoteCurrencyAmount:r.quoteCurrencyAmount,feeAmount:r.feeAmount,extraFeeAmount:r.extraFeeAmount,networkFeeAmount:r.networkFeeAmount,isSandbox:t}}),clearInterval(n)),"failed"===i||"serviceFailure"===i)return c({funding:{...d,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:s?.solanaFundingData}),void l(Vp);a(i)}catch(e){404!==e.response?.status&&(u.current+=1),u.current>=3&&(o({eventName:Wc,payload:{status:"serviceFailure",provider:Np}}),clearInterval(n),c({funding:{...d,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:s?.solanaFundingData}),l(Vp))}}),3e3);return()=>clearInterval(n)}),[e,u]),i}const Fp=({size:t=61,...n})=>/*#__PURE__*/e.jsx("svg",{width:t,height:t,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:/*#__PURE__*/e.jsxs("g",{id:"moonpay_symbol_wht 2",children:[/*#__PURE__*/e.jsx("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),/*#__PURE__*/e.jsx("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});const Lp={component:()=>{let{data:t,setModalData:n,navigateBack:i}=Xn(),a=qn(),{closePrivyModal:o}=r.usePrivyInternal(),{externalTransactionId:s}=t?.moonpayStatus,l=Mp(s||null,a.fundingMethodConfig.moonpay.useSandbox??!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{title:"Fund account",backFn:()=>{let e={...t?.funding,showAlternateFundingMethod:!0};e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),n({funding:e,solanaFundingData:t?.solanaFundingData}),i()}}),/*#__PURE__*/e.jsx(Wp,{status:l,onClickCta:o}),/*#__PURE__*/e.jsx(xr,{})]})}};let Wp=({status:t,onClickCta:r})=>{let{title:i,body:a,cta:o}=n.useMemo((()=>(e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}})(t)),[t]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Op,{children:[/*#__PURE__*/e.jsx(Dp,{status:t}),/*#__PURE__*/e.jsxs(Qi,{children:[/*#__PURE__*/e.jsx("h3",{children:i}),/*#__PURE__*/e.jsx(Rp,{children:a})]})]}),o&&/*#__PURE__*/e.jsx(Pr,{onClick:r,children:o})]})},Dp=({status:t})=>{if(!t||"pending"===t){let t="var(--privy-color-foreground-4)";/*#__PURE__*/return e.jsxs("div",{style:{position:"relative"},children:[/*#__PURE__*/e.jsx(kr,{color:t,style:{position:"absolute"}}),/*#__PURE__*/e.jsx(Tr,{color:t}),/*#__PURE__*/e.jsx(Fp,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let n=(t=>{switch(t){case"completed":return Pe.default;case"waitingAuthorization":return()=>/*#__PURE__*/e.jsx(Ue.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),r=(e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)")(t);/*#__PURE__*/return e.jsx("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&/*#__PURE__*/e.jsx(n,{width:"4rem",height:"4rem",color:r})})},Rp=/*#__PURE__*/a.styled.p.withConfig({displayName:"StatusBody",componentId:"sc-727a5a8d-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),Op=/*#__PURE__*/a.styled.div.withConfig({displayName:"ConnectContainer",componentId:"sc-727a5a8d-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);const Bp=async(e,t,n,r,i,a,o,s)=>{let l=Ra();if(!l)throw Error("Unable to initialize flow");let d="ethereum"===t.chainType?c.chainToMoonpayCurrency(t.chain.id,r):t.isUSDC?"USDC_SOL":"SOL",{signedUrl:u,externalTransactionId:p}=await e.signMoonpayOnRampUrl({address:t.address,useSandbox:n.fundingMethodConfig.moonpay.useSandbox??!1,config:{uiConfig:{accentColor:n.appearance.palette.accent,theme:n.appearance.palette.colorScheme},paymentMethod:s,currencyCode:d,quoteCurrencyAmount:_p(t.amount)}});e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"moonpay",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.chain}}),l.location=u;let h={...o?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(h.usingDefaultFundingMethod=!1),i({moonpayStatus:{},funding:h,solanaFundingData:o?.solanaFundingData}),a(Lp),setTimeout((()=>{i({moonpayStatus:{externalTransactionId:p},funding:h,solanaFundingData:o?.solanaFundingData})}),8e3)};let Up=async e=>"undefined"!=typeof window&&"PaymentRequest"in window&&await new window.PaymentRequest([{supportedMethods:e}],{id:"0",total:{label:"Item",amount:{currency:"USD",value:"1.00"}}}).canMakePayment();const zp=()=>Up("https://apple.com/apple-pay"),Hp=()=>Up("https://google.com/pay"),Vp={component:()=>{let{wallets:t}=Na(),{connectors:i}=r.usePrivyInternal(),a=i.filter(Sn).flatMap((e=>e.wallets)),{navigate:o,data:s,setModalData:l}=Xn(),{client:d}=r.usePrivyInternal(),u=qn(),p=s?.funding,h=fu(zp),g=fu(Hp),m="solana"===p.chainType,y=m?void 0:p,f=n.useMemo((()=>((e,t,n,r,i,a)=>{let o,s,l="solana"===n.chainType,d=l?void 0:n,u=n.isUSDC?"USDC":d?.erc20Address?void 0:"native-currency",p=!!l||u&&c.isSupportedChainIdForMoonpay(Number(n.chain.id),u),h=!!l||u&&c.isSupportedChainIdForCoinbaseOnramp(Number(n.chain.id),u),g=[];for(let o of(n.preferredCardProvider&&n.supportedOptions.sort((e=>e.provider===n.preferredCardProvider?-1:1)),n.supportedOptions))"card"===o.method&&"coinbase"===o.provider&&h&&g.push((()=>Pp(t,n,r,i,a,"buy"))),"card"===o.method&&"moonpay"===o.provider&&p&&u&&g.push((()=>Bp(t,n,e,u,r,i,a,"credit_debit_card")));for(let e of n.supportedOptions)"exchange"===e.method&&"coinbase"===e.provider&&h&&(o=()=>Pp(t,n,r,i,a,"buy"));for(let e of a?.funding?.supportedOptions??[])"wallets"===e.method&&(s=()=>i(bp));return{onFundWithCard:g,onFundWithExchange:o,onFundWithWallet:s}})(u,d,p,l,o,s)),[u,d,p,s,l,o]),x=m?a.find((({address:e})=>e===p.address)):t.find((({address:e})=>V.getAddress(e)===V.getAddress(p.address))),v=Nn(x?.walletClientType||"unknown"),w=v?.name||"wallet",C=x&&"privy"!==x.walletClientType?w:u.name,b=n.useMemo((()=>p.uiConfig?.landing?.title?p.uiConfig?.landing?.title:`Add funds to your ${C?.toLowerCase().endsWith("wallet")?C:C+" wallet"}`),[p.uiConfig?.landing?.title,C]);n.useEffect((()=>{if(p?.defaultFundingMethod&&p.usingDefaultFundingMethod)switch(l({funding:{...p,usingDefaultFundingMethod:!1},solanaFundingData:s?.solanaFundingData}),p?.defaultFundingMethod){case"card":f.onFundWithCard[0]&&f.onFundWithCard[0]();break;case"exchange":f.onFundWithExchange&&f.onFundWithExchange();break;case"wallet":f.onFundWithWallet&&f.onFundWithWallet();break;case"manual":o(zc)}}),[]),n.useEffect((()=>{y?.erc20Address&&!y.erc20ContractInfo&&$c({address:y.erc20Address,chain:y.chain,rpcConfig:u.rpcConfig,privyAppId:u.id}).then((e=>{l({...s,funding:{...y,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}})})).catch(console.error)}),[y?.erc20Address,y?.chain]);let j=!(!y?.erc20Address||y?.erc20ContractInfo);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx("h3",{children:b}),/*#__PURE__*/e.jsxs(ip,{children:[p.errorMessage&&/*#__PURE__*/e.jsx(gd,{theme:u.appearance.palette.colorScheme,children:p.errorMessage}),f.onFundWithCard?.[0]&&/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:f.onFundWithCard[0],children:[/*#__PURE__*/e.jsx(ap,{children:/*#__PURE__*/e.jsx(Oe.default,{style:{width:24}})}),"Pay with card",h?/*#__PURE__*/e.jsx(mu,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):g?/*#__PURE__*/e.jsx(yu,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):null]}),f.onFundWithExchange&&/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:f.onFundWithExchange,children:[/*#__PURE__*/e.jsx(ap,{children:/*#__PURE__*/e.jsx(Ue.default,{style:{width:24}})}),"Transfer from an exchange"]}),f.onFundWithWallet&&/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:f.onFundWithWallet,children:[/*#__PURE__*/e.jsx(ap,{children:/*#__PURE__*/e.jsx(Tl,{style:{width:24}})}),"Transfer from wallet"]}),/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:()=>o(zc),children:[/*#__PURE__*/e.jsx(ap,{children:/*#__PURE__*/e.jsx(Be.default,{style:{width:24}})}),"Receive funds"]}),p?.showAlternateFundingMethod&&f.onFundWithCard?.[1]&&/*#__PURE__*/e.jsx(vc,{theme:u.appearance.palette.colorScheme,children:/*#__PURE__*/e.jsxs(pp,{children:["Having trouble or facing location restrictions?"," ",/*#__PURE__*/e.jsx(hp,{onClick:f.onFundWithCard[1],children:"Try a different provider."})]})})]}),/*#__PURE__*/e.jsx(xr,{})]})}},$p={component:()=>{let{closePrivyModal:t}=r.usePrivyInternal(),{data:i,navigate:a}=Xn(),o=qn(),s=rr(),l=i?.externalConnectWallet?.description,c=n.useRef(i?.externalConnectWallet?.walletList??o.appearance.walletList),u=n.useRef(i?.externalConnectWallet?.walletChainType??o.appearance.walletChainType);/*#__PURE__*/return e.jsx(Hl,{walletList:c.current,walletChainType:u.current,preSelectedWalletId:i?.externalConnectWallet?.preSelectedWalletId,onBack:i?.funding?()=>a(Vp):void 0,onClose:()=>{s("connectWallet","onError",d.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR),t()},onConnect:({connector:e,wallet:n})=>{s("connectWallet","onSuccess",{wallet:n});let r=i?.externalConnectWallet?.onCompleteNavigateTo;r?a(r({address:n.address,walletClientType:e?.walletClientType,walletChainType:e?.chainType})):t()},onConnectError:e=>{e instanceof d.PrivyError?(console.warn(e.cause?e.cause:e.message),s("connectWallet","onError",e.privyErrorCode||d.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),s("connectWallet","onError",d.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR))},customDescription:l,app:o})},isUnauthenticatedScreem:!0},qp=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#855DCD"}),/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_1715_1960)",children:[/*#__PURE__*/e.jsx("path",{d:"M4.5 4H28.5V28H4.5V4Z",fill:"#855DCD"}),/*#__PURE__*/e.jsx("path",{d:"M11.1072 8.42105H21.6983V23.5789H20.1437V16.6357H20.1284C19.9566 14.7167 18.3542 13.2129 16.4028 13.2129C14.4514 13.2129 12.849 14.7167 12.6771 16.6357H12.6619V23.5789H11.1072V8.42105Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M8.28943 10.5725L8.92101 12.7239H9.45542V21.4275C9.1871 21.4275 8.96959 21.6464 8.96959 21.9165V22.5032H8.87242C8.60411 22.5032 8.38659 22.7221 8.38659 22.9922V23.5789H13.8279V22.9922C13.8279 22.7221 13.6104 22.5032 13.3421 22.5032H13.2449V21.9165C13.2449 21.6464 13.0274 21.4275 12.7591 21.4275H12.1761V10.5725H8.28943Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M20.2408 21.4275C19.9725 21.4275 19.755 21.6464 19.755 21.9165V22.5032H19.6579C19.3895 22.5032 19.172 22.7221 19.172 22.9922V23.5789H24.6133V22.9922C24.6133 22.7221 24.3958 22.5032 24.1275 22.5032H24.0303V21.9165C24.0303 21.6464 23.8128 21.4275 23.5445 21.4275V12.7239H24.0789L24.7105 10.5725H20.8238V21.4275H20.2408Z",fill:"white"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1715_1960",children:/*#__PURE__*/e.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(4.5 4)"})})})]}),Gp=t=>{let[r,i]=n.useState(!1);/*#__PURE__*/return e.jsx(Yp,{color:t.color,href:t.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{i(!0),setTimeout((()=>i(!1)),1500)},justOpened:r,children:t.text})};let Yp=/*#__PURE__*/a.styled.a.withConfig({displayName:"StyledOpenLinkButton",componentId:"sc-4e695c83-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.justOpened?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.justOpened?"medium":"normal"),(e=>e.justOpened?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)")),Zp=/*#__PURE__*/a.styled.div.withConfig({displayName:"Container",componentId:"sc-913deead-0"})(["width:100%;"]),Kp=/*#__PURE__*/a.styled.div.withConfig({displayName:"InputContainer",componentId:"sc-913deead-1"})(["display:flex;align-items:center;justify-content:space-between;gap:0.75rem;padding:0.75rem;height:56px;background:",";border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);&:hover{border-color:",";}"],(e=>e.$disabled?"var(--privy-color-background-2)":"var(--privy-color-background)"),(e=>e.$disabled?"var(--privy-color-foreground-4)":"var(--privy-color-foreground-3)")),Qp=/*#__PURE__*/a.styled.div.withConfig({displayName:"TextContainer",componentId:"sc-913deead-2"})(["flex:1;min-width:0;display:flex;align-items:center;"]),Xp=/*#__PURE__*/a.styled.span.withConfig({displayName:"Text",componentId:"sc-913deead-3"})(["display:block;font-size:16px;line-height:24px;color:",";overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;word-break:break-all;@media (min-width:441px){font-size:14px;line-height:20px;}"],(e=>e.$disabled?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)")),Jp=/*#__PURE__*/a.styled(Xp).withConfig({displayName:"PlaceholderText",componentId:"sc-913deead-4"})(["color:var(--privy-color-foreground-3);font-style:italic;"]),eh=/*#__PURE__*/a.styled(kc).withConfig({displayName:"TitleLabel",componentId:"sc-913deead-5"})(["margin-bottom:0.5rem;"]),th=/*#__PURE__*/a.styled(Fr).withConfig({displayName:"CopyButton",componentId:"sc-913deead-6"})(["&&{gap:0.375rem;font-size:14px;flex-shrink:0;}"]);const nh=({value:r,title:i,placeholder:a,className:o,showCopyButton:s=!0,truncate:l,maxLength:c=40,disabled:d=!1})=>{let[u,p]=n.useState(!1),h=l&&r?((e,t,n)=>{if((e=e.startsWith("https://")?e.slice(8):e).length<=n)return e;if("middle"===t){let t=Math.ceil(n/2)-2,r=Math.floor(n/2)-1;return`${e.slice(0,t)}...${e.slice(-r)}`}return`${e.slice(0,n-3)}...`})(r,l,c):r;return n.useEffect((()=>{if(u){let e=setTimeout((()=>p(!1)),3e3);return()=>clearTimeout(e)}}),[u]),/*#__PURE__*/e.jsxs(Zp,{className:o,children:[i&&/*#__PURE__*/e.jsx(eh,{children:i}),/*#__PURE__*/e.jsxs(Kp,{$disabled:d,children:[/*#__PURE__*/e.jsx(Qp,{children:r?/*#__PURE__*/e.jsx(Xp,{$disabled:d,title:r,children:h}):/*#__PURE__*/e.jsx(Jp,{$disabled:d,children:a||"No value"})}),s&&r&&/*#__PURE__*/e.jsx(th,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(r).then((()=>p(!0))).catch(console.error)},size:"sm",children:u?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(t.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(t.Copy,{size:14})]})})]})]})},rh=({connectUri:t,loading:n,success:r,errorMessage:i,onBack:a,onClose:o,onOpenFarcaster:s})=>v.isMobile||n?v.isIOS?/*#__PURE__*/e.jsx(bi,{title:i?i.message:"Sign in with Farcaster",subtitle:i?i.detail:"To sign in with Farcaster, please open the Farcaster app.",icon:qp,iconVariant:"loading",iconLoadingStatus:{success:r,fail:!!i},primaryCta:t&&s?{label:"Open Farcaster app",onClick:s}:void 0,onBack:a,onClose:o,watermark:!0}):/*#__PURE__*/e.jsx(bi,{title:i?i.message:"Signing in with Farcaster",subtitle:i?i.detail:"This should only take a moment",icon:qp,iconVariant:"loading",iconLoadingStatus:{success:r,fail:!!i},onBack:a,onClose:o,watermark:!0,children:t&&v.isMobile&&/*#__PURE__*/e.jsx(ah,{children:/*#__PURE__*/e.jsx(Gp,{text:"Take me to Farcaster",url:t,color:"#8a63d2"})})}):
25
- /*#__PURE__*/e.jsx(bi,{title:"Sign in with Farcaster",subtitle:"Scan with your phone's camera to continue.",onBack:a,onClose:o,watermark:!0,children:/*#__PURE__*/e.jsxs(oh,{children:[/*#__PURE__*/e.jsx(sh,{children:t?/*#__PURE__*/e.jsx(vl,{url:t,size:275,squareLogoElement:qp}):/*#__PURE__*/e.jsx(dh,{children:/*#__PURE__*/e.jsx(kr,{})})}),/*#__PURE__*/e.jsxs(lh,{children:[/*#__PURE__*/e.jsx(ch,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),t&&/*#__PURE__*/e.jsx(nh,{value:t,truncate:"end",maxLength:30,showCopyButton:!0,disabled:!0})]})]})}),ih={component:()=>{let{authenticated:t,logout:a,ready:o,user:s}=i.usePrivyContext(),{lastScreen:l,navigate:c,navigateBack:u,setModalData:p}=Xn(),h=qn(),{getAuthFlow:g,loginWithFarcaster:m,closePrivyModal:y,createAnalyticsEvent:f}=r.usePrivyInternal(),[x,v]=n.useState(void 0),[w,C]=n.useState(!1),[b,j]=n.useState(!1),k=n.useRef([]),T=g(),A=T?.meta.connectUri;return n.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{let n=await T.pollForReady.execute(),r=Date.now()-e;if(n){clearInterval(t),C(!0);try{await m(),j(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===d.PrivyErrorCode.ALLOWLIST_REJECTED)return void c(rc);if(e?.privyErrorCode===d.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new d.PrivyUserLimitReachedError(e).toString()),void c(hc);if(e?.privyErrorCode===d.PrivyErrorCode.USER_DOES_NOT_EXIST)return void c(vs);if(e?.privyErrorCode===d.PrivyErrorCode.LINKED_TO_ANOTHER_USER)t.detail=e.message??"This account has already been linked to another user.";else{if(e?.privyErrorCode===d.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return p({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:"farcaster",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,farcasterEmbeddedAddress:e.data?.data?.otherUser?.farcasterEmbeddedAddress}}),void c(Qs);e?.privyErrorCode===d.PrivyErrorCode.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===d.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}v(t)}}else r>12e4&&(clearInterval(t),v({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),k.current.forEach((e=>clearTimeout(e)))}}),[]),n.useEffect((()=>{if(o&&t&&b&&s){if(h?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{c(nl)}),it);return()=>clearTimeout(e)}b&&(fs(s,h.embeddedWallets)?k.current.push(setTimeout((()=>{p({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),c(tl)}),it)):k.current.push(setTimeout((()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0})),it)))}}),[b,o,t,s]),/*#__PURE__*/e.jsx(rh,{connectUri:A,loading:w,success:b,errorMessage:x,onBack:l?u:void 0,onClose:y,onOpenFarcaster:()=>{A&&(window.location.href=A)}})}};let ah=/*#__PURE__*/a.styled.div.withConfig({displayName:"MobileLinkContainer",componentId:"sc-6e4b180b-0"})(["margin-top:24px;"]),oh=/*#__PURE__*/a.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-6e4b180b-1"})(["display:flex;flex-direction:column;align-items:center;gap:24px;"]),sh=/*#__PURE__*/a.styled.div.withConfig({displayName:"QrContainer",componentId:"sc-6e4b180b-2"})(["display:flex;align-items:center;justify-content:center;min-height:275px;"]),lh=/*#__PURE__*/a.styled.div.withConfig({displayName:"InstructionsContainer",componentId:"sc-6e4b180b-3"})(["display:flex;flex-direction:column;align-items:center;gap:16px;"]),ch=/*#__PURE__*/a.styled.div.withConfig({displayName:"InstructionText",componentId:"sc-6e4b180b-4"})(["font-size:0.875rem;text-align:center;color:var(--privy-color-foreground-2);"]),dh=/*#__PURE__*/a.styled.div.withConfig({displayName:"LoaderWrapper",componentId:"sc-6e4b180b-5"})(["position:relative;width:82px;height:82px;"]);const uh=()=>{let[t,i]=n.useState(!1),{currentScreen:a,navigate:o,setModalData:s,data:l}=Xn(),{enabled:c,token:d}=qt(),{initLoginWithFarcaster:u}=r.usePrivyInternal(),{accountType:p}=as();/*#__PURE__*/return e.jsxs(dr,{onClick:async()=>{i(!0);try{c&&!d?(s({captchaModalData:{callback:e=>u(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:ih,onErrorNavigateTo:Rs}}),o(ac)):(await u(d,l?.login?.disableSignup),o(ih))}catch(e){s({errorModalData:{error:e,previousScreen:a||cg}}),o(Rs)}finally{i(!1)}},disabled:!1,children:[/*#__PURE__*/e.jsx(qp,{width:32,height:32})," Farcaster",t&&/*#__PURE__*/e.jsx(Ar,{}),"farcaster"===p&&/*#__PURE__*/e.jsx(ph,{color:"gray",children:"Recent"})]})};let ph=/*#__PURE__*/a.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-c6317ff9-0"})(["margin-left:auto;"]);const hh=({status:n,passkeySignupFlow:r=!1,error:i,onRetry:a})=>/*#__PURE__*/e.jsx(bi,{title:(()=>{switch(n){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})(),subtitle:/*#__PURE__*/e.jsx(mh,{children:(()=>{switch(n){case"loading":return r?"Please follow prompts to register your passkey.":"Please follow prompts to verify your passkey.\nYou will have to sign up with another method first to register a passkey for your account.";case"success":return"You've successfully logged in with your passkey.";case"error":if(i instanceof d.PrivyError){if(i.privyErrorCode===d.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(i.privyErrorCode===d.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()}),icon:t.FingerprintIcon,iconVariant:"loading",iconLoadingStatus:{success:"success"===n,fail:"error"===n},primaryCta:"error"===n&&a?{label:"Retry",onClick:a}:"success"===n?{label:"Continue",disabled:!0}:void 0,watermark:!0}),gh={component:()=>{let{data:t,setModalData:a,navigate:o}=Xn(),s=qn(),{loginWithPasskey:l,signupWithPasskey:c,closePrivyModal:d,createAnalyticsEvent:u}=r.usePrivyInternal(),{user:p,logout:h}=i.usePrivyContext(),{passkeySignupFlow:g}=t?.passkeyAuthModalData??{},[m,y]=n.useState("loading"),[f,x]=n.useState(null),v=n.useRef([]),w=e=>{v.current=[e,...v.current]};n.useEffect((()=>()=>{v.current.forEach((e=>clearTimeout(e))),v.current=[]}),[]);let C=async()=>{y("loading");try{g?await c():await l(),y("success")}catch(e){x(e),y("error")}};return n.useEffect((()=>{if("success"===m&&p){if(s?.legal.requireUsersAcceptTerms&&!p.hasAcceptedTerms)return void w(setTimeout((()=>{o(nl)}),900));if(!fs(p,s?.embeddedWallets))return void w(setTimeout((()=>{d({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),it));w(setTimeout((()=>{a({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"PasskeyStatusScreen"}}),h()},callAuthOnSuccessOnClose:!0}}),o(tl)}),900))}}),[p,m]),n.useEffect((()=>{C()}),[]),/*#__PURE__*/e.jsx(hh,{status:m,passkeySignupFlow:g,error:f,onRetry:C})}};let mh=/*#__PURE__*/a.styled.span.withConfig({displayName:"SubtitleText",componentId:"sc-7ff4a13e-0"})(["white-space:pre-wrap;"]);const yh=({title:n="Log in or create a new account?",subtitle:r="Create a new account with a passkey or use a passkey to log in to an existing account.",onSignup:i,onLogin:a})=>/*#__PURE__*/e.jsx(bi,{title:n,subtitle:r,icon:t.FingerprintIcon,primaryCta:{label:"Create new account",onClick:i},secondaryCta:{label:"Log in with a passkey",onClick:a},watermark:!0}),fh={component:()=>{let{enabled:t,token:n}=qt(),{navigate:i,setModalData:a}=Xn(),{initSignupWithPasskey:o,initLoginWithPasskey:s}=r.usePrivyInternal();/*#__PURE__*/return e.jsx(yh,{onSignup:async()=>{t&&!n?(a({passkeyAuthModalData:{passkeySignupFlow:!0},captchaModalData:{callback:e=>o({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:gh,onErrorNavigateTo:Rs}}),i(ac)):(await o({withPrivyUi:!0}),a({passkeyAuthModalData:{passkeySignupFlow:!0}}),i(gh))},onLogin:async()=>{t&&!n?(a({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>s({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:gh,onErrorNavigateTo:Rs}}),i(ac)):(await s({withPrivyUi:!0}),a({passkeyAuthModalData:{passkeySignupFlow:!1}}),i(gh))}})}},xh=()=>{let{enabled:t,token:i}=qt(),{navigate:a,setModalData:o,data:s}=Xn(),l=qn(),{initLoginWithPasskey:c}=r.usePrivyInternal(),d=()=>{l.loginConfig.passkeysForSignupEnabled?a(fh):(async()=>{t&&!i?(o({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>c({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:gh,onErrorNavigateTo:Rs}}),a(ac)):(await c({withPrivyUi:!0}),o({passkeyAuthModalData:{passkeySignupFlow:!1}}),a(gh))})()};return 0===n.useMemo((()=>{let e=s?.login?.loginMethods;return e?e.filter((e=>"passkey"!==e)).length:Object.entries(l.loginMethods).filter((([e,t])=>t)).filter((([e])=>"passkey"!==e)).length}),[l.loginMethods,s?.login])?/*#__PURE__*/e.jsxs(dr,{onClick:d,children:[/*#__PURE__*/e.jsx(Ge.default,{})," Continue with passkey"]}):/*#__PURE__*/e.jsx(ps,{as:"button",onClick:d,size:"sm",variant:"navigation",style:{width:"100%",justifyContent:"center"},children:"I have a passkey"})},vh=({value:t,onChange:n})=>/*#__PURE__*/e.jsx("select",{value:t,onChange:n,children:c.countryCodesAndNumbers.map((t=>/*#__PURE__*/e.jsxs("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),wh=/*#__PURE__*/n.forwardRef(((t,r)=>{let i=qn(),[a,o]=n.useState(!1),{accountType:s}=as(),[l,d]=n.useState(""),[u,p]=n.useState(i?.intl.defaultCountry??"US"),h=c.validatePhoneNumber(l,u),g=c.phoneNumberTypingFormatter(u),m=c.getPlaceholderPhoneNumber(u),y=c.getCountryCallingCode(u),f=!h,[x,v]=n.useState(!1),w=y.length,C=e=>{let n=e.target.value;p(n),d(""),t.onChange&&t.onChange({rawPhoneNumber:l,qualifiedPhoneNumber:c.formatPhoneNumber(l,n),countryCode:n,isValid:c.validatePhoneNumber(l,u)})},b=(e,n)=>{try{let r=e.replace(/\D/g,"")===l.replace(/\D/g,"")?e:g.input(e);d(r),t.onChange&&t.onChange({rawPhoneNumber:r,qualifiedPhoneNumber:c.formatPhoneNumber(e,n),countryCode:n,isValid:c.validatePhoneNumber(e,n)})}catch(e){console.error("Error processing phone number:",e)}},j=()=>{v(!0);let e=c.formatPhoneNumber(l,u);t.onSubmit({rawPhoneNumber:l,qualifiedPhoneNumber:e,countryCode:u,isValid:c.validatePhoneNumber(l,u)}).finally((()=>v(!1)))};return n.useEffect((()=>{if(t.defaultValue){let e=c.getPhoneCountryCodeAndNumber(t.defaultValue);g.reset(),C({target:{value:e.countryCode}}),b(e.phone,e.countryCode)}}),[t.defaultValue]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ch,{children:/*#__PURE__*/e.jsxs(bh,{$callingCodeLength:w,$stacked:t.stacked,children:[/*#__PURE__*/e.jsx(vh,{value:u,onChange:C}),/*#__PURE__*/e.jsx("input",{ref:r,id:"phone-number-input",className:"login-method-button",type:"tel",placeholder:m,onFocus:()=>o(!0),onChange:e=>{b(e.target.value,u)},onKeyUp:e=>{"Enter"===e.key&&j()},value:l,autoComplete:"tel"}),"phone"!==s||a||t.hideRecent?t.stacked||t.noIncludeSubmitButton?/*#__PURE__*/e.jsx("span",{}):/*#__PURE__*/e.jsx(Rr,{isSubmitting:x,onClick:j,disabled:f,children:"Submit"}):/*#__PURE__*/e.jsx(xu,{color:"gray",children:"Recent"})]})}),t.stacked&&!t.noIncludeSubmitButton?/*#__PURE__*/e.jsx(Pr,{loading:x,loadingText:null,onClick:j,disabled:f,children:"Submit"}):null]})}));let Ch=/*#__PURE__*/a.styled.div.withConfig({displayName:"InputContainer",componentId:"sc-545daacd-0"})(["width:100%;"]),bh=/*#__PURE__*/a.styled.label.withConfig({displayName:"PhoneNumberInput",componentId:"sc-545daacd-1"})(["--country-code-dropdown-width:calc(54px + calc(12 * ","px));--phone-input-extra-padding-left:calc(12px + calc(3 * ","px));display:block;position:relative;width:100%;@media (min-width:441px){--country-code-dropdown-width:calc(52px + calc(10 * ","px));}&& > select{font-size:16px;height:24px;position:absolute;margin:13px calc(var(--country-code-dropdown-width) / 4);line-height:24px;width:var(--country-code-dropdown-width);background-color:var(--privy-color-background);background-size:auto;background-position-x:right;cursor:pointer;@media (min-width:441px){font-size:14px;width:var(--country-code-dropdown-width);}:focus{outline:none;box-shadow:none;}}&& > input{font-size:16px;line-height:24px;color:var(--privy-color-foreground);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;width:calc(100% - var(--country-code-dropdown-width));padding:12px 88px 12px calc(var(--country-code-dropdown-width) + var(--phone-input-extra-padding-left));padding-right:",";flex-grow:1;background:var(--privy-color-background);border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);width:100%;:focus{outline:none;border-color:var(--privy-color-accent);}:autofill,:-webkit-autofill{background:var(--privy-color-background);}@media (min-width:441px){font-size:14px;padding-right:78px;}}&& > :last-child{right:16px;position:absolute;top:50%;transform:translate(0,-50%);}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;border-color:var(--privy-color-accent);}}&& > input::placeholder{color:var(--privy-color-foreground-3);}"],(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$stacked?"16px":"88px"));const jh=({isEditable:a,setIsEditable:o,defaultValue:s})=>{let l=n.useRef(null),{authenticated:c}=i.usePrivyContext(),{navigate:d,setModalData:u,currentScreen:p,data:h}=Xn(),{initLoginWithSms:g}=r.usePrivyInternal(),{enabled:m,token:y}=qt(),{whatsAppEnabled:f}=qn();/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(pr,{$if:!a,children:/*#__PURE__*/e.jsx(wh,{ref:l,onSubmit:async function({qualifiedPhoneNumber:e}){if(!m||y||c)try{await g({phoneNumber:e,captchaToken:y,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),d(Yh)}catch(e){u({errorModalData:{error:e,previousScreen:p||cg}}),d(Rs)}else u({captchaModalData:{callback:t=>g({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:Yh,onErrorNavigateTo:Rs}}),d(ac)},defaultValue:s})}),/*#__PURE__*/e.jsx(pr,{$if:a,children:/*#__PURE__*/e.jsxs(dr,{onClick:()=>{o(),setTimeout((()=>{l.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(t.Smartphone,{})}),"Continue with ",f?"WhatsApp":"SMS"]})})]})};let kh={apple:{logo:yt,displayName:"Apple"},discord:{logo:ft,displayName:"Discord"},github:{logo:xt,displayName:"GitHub"},google:{logo:vt,displayName:"Google"},linkedin:{logo:bt,displayName:"LinkedIn"},spotify:{logo:jt,displayName:"Spotify"},instagram:{logo:wt,displayName:"Instagram"},twitter:{logo:Tt,displayName:"Twitter"},tiktok:{logo:kt,displayName:"TikTok"},line:{logo:Ct,displayName:"LINE"}};const Th=({provider:t})=>{let{enabled:a,token:o}=qt(),{navigate:s,setModalData:l,data:c}=Xn(),[d,u]=n.useState(!1),p=qn(),{initLoginWithOAuth:h}=r.usePrivyInternal(),{accountType:g}=as(),m=n.useMemo((()=>g&&"guest"!==g&&"authorization_key"!==g&&"cross_app"!==g?es(g):null),[g]),{displayName:y,logo:f}=n.useMemo((()=>{if(i.isCustomOAuthProvider(t)){let n=p.customOAuthProviders.find((e=>e.provider===t)),r=n.provider_icon_url,i=n.provider_display_name;return{displayName:i,logo:({style:t})=>/*#__PURE__*/e.jsx("img",{alt:`${i} logo`,src:r,style:t})}}return kh[t]}),[t,p.customOAuthProviders]);/*#__PURE__*/return e.jsxs(dr,{onClick:()=>{u(!0),setTimeout((()=>{u(!1)}),2e3),a&&!o?(l({captchaModalData:{callback:e=>h(t,e,c?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Rs}}),s(ac)):h(t,void 0,c?.login?.disableSignup)},disabled:d,children:[/*#__PURE__*/e.jsx(ur,{$fullSize:!0,children:/*#__PURE__*/e.jsx(f,{style:{width:"32px",height:"32px"}})}),y,m?.loginMethod===t&&/*#__PURE__*/e.jsx(Ah,{color:"gray",children:"Recent"})]})};let Ah=/*#__PURE__*/a.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-ac19bb81-0"})(["margin-left:auto;"]);function Sh(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"512",height:"512",rx:"15%",fill:"#37aee2"}),/*#__PURE__*/e.jsx("path",{fill:"#c8daea",d:"M199 404c-11 0-10-4-13-14l-32-105 245-144"}),/*#__PURE__*/e.jsx("path",{fill:"#a9c9dd",d:"M199 404c7 0 11-4 16-8l45-43-56-34"}),/*#__PURE__*/e.jsx("path",{fill:"#f6fbfe",d:"M204 319l135 99c14 9 26 4 30-14l55-258c5-22-9-32-24-25L79 245c-21 8-21 21-4 26l83 26 190-121c9-5 17-3 11 4"})]})}const Eh=({success:t,errorMessage:n,onRetry:r})=>{let i=t?"Successfully connected with Telegram":n?n.message:"Verifying connection to Telegram";/*#__PURE__*/return e.jsx(bi,{title:i,subtitle:t?"You're good to go!":n?n.detail:"Just a few moments more",icon:Sh,iconVariant:"loading",iconLoadingStatus:{success:t,fail:!!n},secondaryCta:n?.retryable&&r?{label:"Retry",onClick:r}:void 0,watermark:!0})},Ih={component:()=>{let{authenticated:t,logout:a,ready:o,user:s}=i.usePrivyContext(),{setModalData:l,navigate:c,resetNavigation:u,data:p}=Xn(),h=qn(),{initLoginWithTelegram:g,loginWithTelegram:m,updateWallets:y,setReadyToTrue:f,closePrivyModal:x,createAnalyticsEvent:v,getAuthMeta:w}=r.usePrivyInternal(),[C,b]=n.useState(!1),[j,k]=n.useState(void 0),T=qt();async function A(){try{let e=await async function(){let e;if(!t){if(T.enabled&&"error"===T.status)throw new $t(T.error,null,d.PrivyErrorCode.CAPTCHA_FAILURE);return T.enabled&&"success"!==T.status&&(T.execute(),e=await T.waitForResult()),e}}();await m({captchaToken:e}),b(!0),f(!0)}catch(e){if(e?.privyErrorCode===d.PrivyErrorCode.ALLOWLIST_REJECTED)return k(void 0),u(),void c(rc);if(e?.privyErrorCode===d.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new d.PrivyUserLimitReachedError(e).toString()),k(void 0),u(),void c(hc);if(e?.privyErrorCode===d.PrivyErrorCode.USER_DOES_NOT_EXIST)return k(void 0),u(),void c(vs);if(e?.privyErrorCode===d.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return k(void 0),u(),l({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:w()?.telegramAuthResult,telegramWebAppData:w()?.telegramWebAppData,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void c(Qs);let{retryable:t,detail:n}=Gt(e);k({retryable:t,detail:n,message:"Authentication failed"})}}n.useEffect((()=>{A()}),[]),n.useEffect((()=>{if(!(o&&t&&C&&s))return;if(h?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{c(nl)}),it);return()=>clearTimeout(e)}if(fs(s,h.embeddedWallets)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),a()},callAuthOnSuccessOnClose:!0}}),c(tl)}),it);return()=>clearTimeout(e)}y();let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),it);return()=>clearTimeout(e)}),[o,t,C,s]);/*#__PURE__*/return e.jsx(Eh,{success:C,errorMessage:j,onRetry:j?.retryable?async()=>{try{k(void 0),p?.telegramAuthModalData?.seamlessAuth||await g(void 0,p?.login?.disableSignup),await A()}catch(e){let{retryable:t,detail:n}=Gt(e);k({retryable:t,detail:n,message:"Authentication failed"})}}:void 0})},isCaptchaRequired:!0},Ph=()=>{let{enabled:t,token:i}=qt(),{navigate:a,setModalData:o,data:s}=Xn(),[l,c]=n.useState(!1),{initLoginWithTelegram:d}=r.usePrivyInternal(),{accountType:u}=as();async function p(e){try{await d(e,s?.login?.disableSignup),o({telegramAuthModalData:{seamlessAuth:!1}}),a(Ih)}catch(e){console.error(e),c(!1)}}/*#__PURE__*/return e.jsxs(dr,{onClick:async function(){if(c(!0),t&&!i)return o({captchaModalData:{callback:p,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Rs}}),void a(ac);await p(i)},disabled:l,children:[/*#__PURE__*/e.jsx(Sh,{width:32,height:32}),"Telegram","telegram"===u&&/*#__PURE__*/e.jsx(Nh,{color:"gray",children:"Recent"})]})};let Nh=/*#__PURE__*/a.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-4b233cf1-0"})(["margin-left:auto;"]);const _h=({onClick:t,text:n,icon:r})=>/*#__PURE__*/e.jsxs(dr,{onClick:t,children:[/*#__PURE__*/e.jsx(ur,{children:r}),/*#__PURE__*/e.jsx(ir,{children:n})]}),Mh=({connectOnly:t})=>{let{closePrivyModal:a}=r.usePrivyInternal(),{data:o,setModalData:s,onUserCloseViaDialogOrKeybindRef:l,navigate:d}=Xn(),u=qn(),p=o?.login,h=u.appearance.walletList,g=p?.walletChainType??u.appearance.walletChainType,{accountType:m,walletClientType:y,chainType:f}=as(),{wallets:x}=Bl({walletList:h,walletChainType:g}),v=n.useMemo((()=>m&&"guest"!==m&&"authorization_key"!==m&&"cross_app"!==m?es(m):null),[m]),{email:w,sms:C,google:b,twitter:j,discord:k,github:T,spotify:A,instagram:S,tiktok:E,line:I,linkedin:P,apple:N,wallet:_,farcaster:M,telegram:F}=n.useMemo((()=>p?.loginMethods?c.toObjectKeys(p.loginMethods,!0):null),[p])??u.loginMethods,L=u.customOAuthProviders,{passkey:W}=u.loginMethods,D=[w&&"email",C&&"sms",b&&"google",j&&"twitter",k&&"discord",T&&"github",A&&"spotify",S&&"instagram",E&&"tiktok",I&&"line",P&&"linkedin",N&&"apple",M&&"farcaster",F&&"telegram",...L.map((e=>e.provider))].filter((e=>!!e)),R=D.length>0,O=n.useMemo((()=>_&&!R?"web3-first":_&&u?.appearance.loginGroupPriority||"web2-first"),[_,R,u?.appearance.loginGroupPriority]),B=u?.appearance.hideDirectWeb2Inputs,[U,z]=n.useState("default"),[H,V]=n.useState(Oh({mostRecentlyUsedAccountType:m,smsAvailable:C,emailAvailable:w,prefilledType:p?.prefill?.type}));n.useEffect((()=>{V(Oh({mostRecentlyUsedAccountType:m,smsAvailable:C,emailAvailable:w,prefilledType:p?.prefill?.type}))}),[w,C,m]);let $=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{z("default")}),150)};l.current=$;let q=[];y&&_?q.push(y):v?.loginMethod&&D.includes(v.loginMethod)&&q.push(v.loginMethod);let G=n=>{if("email"===n)/*#__PURE__*/return e.jsx(ag,{isEditable:"email"===H,setIsEditable:()=>{V("email")},defaultValue:"email"===p?.prefill?.type?p.prefill.value:void 0},n);if("sms"===n)/*#__PURE__*/return e.jsx(jh,{isEditable:"sms"===H,setIsEditable:()=>{V("sms")},defaultValue:"phone"===p?.prefill?.type?p.prefill.value:void 0},n);if("apple"===n)/*#__PURE__*/return e.jsx(Th,{provider:"apple"},n);if("discord"===n)/*#__PURE__*/return e.jsx(Th,{provider:"discord"},n);if("farcaster"===n)/*#__PURE__*/return e.jsx(uh,{},n);if("github"===n)/*#__PURE__*/return e.jsx(Th,{provider:"github"},n);if("google"===n)/*#__PURE__*/return e.jsx(Th,{provider:"google"},n);if("linkedin"===n)/*#__PURE__*/return e.jsx(Th,{provider:"linkedin"},n);if("tiktok"===n)/*#__PURE__*/return e.jsx(Th,{provider:"tiktok"},n);if("line"===n)/*#__PURE__*/return e.jsx(Th,{provider:"line"},n);if("spotify"===n)/*#__PURE__*/return e.jsx(Th,{provider:"spotify"},n);if("instagram"===n)/*#__PURE__*/return e.jsx(Th,{provider:"instagram"},n);if("twitter"===n)/*#__PURE__*/return e.jsx(Th,{provider:"twitter"},n);if("telegram"===n)/*#__PURE__*/return e.jsx(Ph,{},n);if(i.isCustomOAuthProvider(n))/*#__PURE__*/return e.jsx(Th,{provider:n},n);let r=x.findIndex((({id:e})=>e===Sl.normalize(n))),a="solana"===f?"solana-only":"ethereum-only";/*#__PURE__*/return e.jsx(zl,{recent:!0,index:r,data:{wallets:x,walletChainType:a,handleWalletClick(e){s((t=>({...t,externalConnectWallet:{walletList:h,walletChainType:a,preSelectedWalletId:e.id}}))),d(t?$p:xc)}}})},Y=x.filter((e=>e.id!==Sl.normalize(y||""))),Z=Y.map(((n,r)=>/*#__PURE__*/e.jsx(zl,{index:r,data:{walletChainType:g,wallets:Y,handleWalletClick(e){s((t=>({...t,externalConnectWallet:{walletList:h,walletChainType:g,preSelectedWalletId:e.id}}))),d(t?$p:xc)}}},n.id))),K=D.filter((e=>e!==v?.loginMethod)).flatMap(G),Q=q.flatMap(G);"web3-first"===O&&"default"===U?Z.unshift(...Q):"web2-first"===O&&K.unshift(...Q);let X="web2-overflow"===U?()=>z("default"):void 0,J=D.filter((e=>"email"!==e&&"sms"!==e)),ee=Wh({priority:O,email:w,sms:C,social:J}),te=Dh({priority:O,email:w,sms:C,social:J}),ne=/*#__PURE__*/e.jsx(wu,{text:Rh({priority:O}),onClick:()=>{s({...o,externalConnectWallet:{walletChainType:p?.walletChainType??u.appearance.walletChainType}}),d(t?$p:xc)}}),re=/*#__PURE__*/e.jsx(_h,{text:ee,icon:te,onClick:()=>z("web2-overflow")}),ie=B?0:1,ae=_&&Z.length>0,oe=0===K.length&&_&&0===Z.length,se=5-(ae?1:0),le="default"===U&&u?.appearance.logo,ce="default"===U&&u.appearance.loginMessage;/*#__PURE__*/return e.jsxs(bi,{title:u.appearance.landingHeader,icon:le?/*#__PURE__*/e.jsx(os,{}):void 0,iconVariant:le?"logo":void 0,onClose:$,showClose:!0,onBack:X,showBack:!!X,helpText:u||W&&"default"===U?/*#__PURE__*/e.jsxs(e.Fragment,{children:[W&&"default"===U&&/*#__PURE__*/e.jsx(xh,{}),u&&/*#__PURE__*/e.jsx(fr,{app:u})]}):void 0,watermark:!0,children:[ce&&("string"==typeof u.appearance.loginMessage?/*#__PURE__*/e.jsx(Fh,{children:u.appearance.loginMessage}):/*#__PURE__*/e.jsx(Lh,{children:u.appearance.loginMessage})),/*#__PURE__*/e.jsx(sr,{$colorScheme:u.appearance.palette.colorScheme,children:"default"===U&&"web2-first"===O?/*#__PURE__*/e.jsxs(e.Fragment,{children:[K.length>se?K.slice(0,se-1):K,K.length>se&&re,ae&&ne,oe&&/*#__PURE__*/e.jsx(Cu,{chainType:u.appearance.walletChainType})]}):"default"===U&&"web3-first"===O?/*#__PURE__*/e.jsxs(e.Fragment,{children:[_&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[Z.length>se?Z.slice(0,se-1):Z,Z.length>se&&ne]}),K.length>ie&&re,K.length===ie&&K[0],oe&&/*#__PURE__*/e.jsx(Cu,{chainType:u.appearance.walletChainType})]}):"web2-overflow"===U?/*#__PURE__*/e.jsx(e.Fragment,{children:"web3-first"===O?K:K.slice(3)}):null})]})};let Fh=/*#__PURE__*/a.styled.div.withConfig({displayName:"StyledSubtitle",componentId:"sc-16aebfe7-0"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),Lh=/*#__PURE__*/a.styled.div.withConfig({displayName:"MessageContainer",componentId:"sc-16aebfe7-1"})(["margin-bottom:24px;"]),Wh=({priority:e,email:t,sms:n,social:r})=>"web2-first"===e?"Other socials":t&&n&&r.length>0||t&&r.length>0?"Log in with email or socials":n&&r.length>0?"Log in with sms or socials":t&&n?"Continue with email or sms":t?"Continue with email":n?"Continue with sms":"Log in with a social account",Dh=({priority:n,email:r,sms:i,social:a})=>"web2-first"===n||a.length>0?/*#__PURE__*/e.jsx(t.UserCircle,{}):r&&i?/*#__PURE__*/e.jsx(Ql,{}):r?/*#__PURE__*/e.jsx(t.Mail,{}):i?/*#__PURE__*/e.jsx(t.Smartphone,{}):null,Rh=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets";const Oh=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:n,prefilledType:r})=>n&&("email"===e&&"phone"!==r||"email"===r)||!t||"phone"!==e&&"phone"!==r?"email":"sms",Bh={component:()=>{let t=qn();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/e.jsx(og,{connectOnly:!0}):/*#__PURE__*/e.jsx(Mh,{connectOnly:!0})}},Uh=({contactMethod:t,authFlow:r,appName:i="Privy",whatsAppEnabled:a=!1,onBack:o,onCodeSubmit:s,onResend:l,errorMessage:c,success:d=!1,resendCountdown:u=0,onInvalidInput:p,onClearError:h})=>{let[g,m]=n.useState(Hh);n.useEffect((()=>{c||m(Hh)}),[c]);let y="email"===r?/*#__PURE__*/e.jsxs("span",{children:["Please check ",/*#__PURE__*/e.jsx(eg,{children:t})," for an email from privy.io and enter your code below."]}):/*#__PURE__*/e.jsxs("span",{children:["Please check ",/*#__PURE__*/e.jsx(eg,{children:t})," for a",a?" WhatsApp":""," message from ",i," and enter your code below."]}),f=/*#__PURE__*/e.jsxs(Xh,{children:[/*#__PURE__*/e.jsxs("span",{children:["Didn't get ","email"===r?"an email":"a message","?"]}),u?/*#__PURE__*/e.jsxs(Jh,{children:[/*#__PURE__*/e.jsx(ge.default,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),/*#__PURE__*/e.jsx("span",{children:"Code sent"})]}):/*#__PURE__*/e.jsx(ps,{as:"button",size:"sm",onClick:l,children:"Resend code"})]}),x=async e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return void p?.("Code should be numeric");h?.();let n=Number(e.currentTarget.name?.charAt(5)),r=[...t||[""]].slice(0,zh-n),i=[...g.slice(0,n),...r,...g.slice(n+r.length)];m(i);let a=Math.min(Math.max(n+r.length,0),zh-1);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${a}]`);e?.focus()}if(i.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${a}]`);e?.blur(),await(s?.(i.join("")))}};/*#__PURE__*/return e.jsx(bi,{title:"Enter confirmation code",subtitle:y,icon:"email"===r?me.default:ye.default,onBack:o,showBack:!0,helpText:f,children:/*#__PURE__*/e.jsx(Zh,{children:/*#__PURE__*/e.jsx(Gi,{children:/*#__PURE__*/e.jsxs(Kh,{children:[/*#__PURE__*/e.jsx("div",{children:g.map(((t,n)=>/*#__PURE__*/e.jsx("input",{name:`code-${n}`,type:"text",value:g[n],onChange:x,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(h?.(),m([...g.slice(0,e),"",...g.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(n)},inputMode:"numeric",autoFocus:0===n,pattern:"[0-9]",className:`${d?"success":""} ${c?"fail":""}`,autoComplete:v.isMobile?"one-time-code":"off"},n)))}),/*#__PURE__*/e.jsx(Qh,{$fail:!!c,$success:d,children:/*#__PURE__*/e.jsx("span",{children:"Invalid or expired verification code"===c?"Incorrect code":c||(d?"Success!":"")})})]})})})})};let zh=6,Hh=Array(6).fill("");var Vh,$h,qh=((Vh=qh||{})[Vh.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",Vh[Vh.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",Vh),Gh=(($h=Gh||{})[$h.EMAIL=0]="EMAIL",$h[$h.SMS=1]="SMS",$h);const Yh={component:()=>{let{navigate:t,lastScreen:a,navigateBack:o,setModalData:s,onUserCloseViaDialogOrKeybindRef:l}=Xn(),c=qn(),{closePrivyModal:u,resendEmailCode:p,resendSmsCode:h,getAuthMeta:g,loginWithCode:m,updateWallets:y,createAnalyticsEvent:f}=r.usePrivyInternal(),{authenticated:x,logout:v,user:w}=i.usePrivyContext(),{whatsAppEnabled:C}=qn(),[b,j]=n.useState(!1),[k,T]=n.useState(null),[A,S]=n.useState(null),[E,I]=n.useState(0);l.current=()=>null;let P=g()?.email?0:1,N=0===P?g()?.email||"":g()?.phoneNumber||"";n.useEffect((()=>{if(E){let e=setTimeout((()=>{I(E-1)}),1e3);return()=>clearTimeout(e)}}),[E]),n.useEffect((()=>{if(x&&b&&w){if(c?.legal.requireUsersAcceptTerms&&!w.hasAcceptedTerms){let e=setTimeout((()=>{t(nl)}),900);return()=>clearTimeout(e)}if(fs(w,c.embeddedWallets)){let e=setTimeout((()=>{s({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),v()},callAuthOnSuccessOnClose:!0}}),t(tl)}),900);return()=>clearTimeout(e)}{y();let e=setTimeout((()=>u({shouldCallAuthOnSuccess:!0,isSuccess:!0})),it);return()=>clearTimeout(e)}}}),[x,b,w]),n.useEffect((()=>{if(k&&0===A){let e=setTimeout((()=>{T(null),S(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[k,A]);/*#__PURE__*/return e.jsx(Uh,{contactMethod:N,authFlow:0===P?"email":"sms",appName:c?.name,whatsAppEnabled:C,onBack:()=>o(),onCodeSubmit:async e=>{try{await m(e),j(!0)}catch(e){if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.INVALID_CREDENTIALS)T("Invalid or expired verification code"),S(0);else if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)T(e.message);else{if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new d.PrivyUserLimitReachedError(e).toString()),void t(hc);if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.USER_DOES_NOT_EXIST)return void t(vs);if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.LINKED_TO_ANOTHER_USER)return s({errorModalData:{error:e,previousScreen:a??Yh}}),void t(Rs,!1);if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.DISALLOWED_PLUS_EMAIL)return s({inlineError:{error:e}}),void t(Bh,!1);if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return s({accountTransfer:{nonce:e.data?.data?.nonce,account:N,displayName:e.data?.data?.account?.displayName,linkMethod:0===P?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void t(Qs);T("Issue verifying code"),S(0)}}},onResend:async()=>{I(30),0===P?await p():await h()},errorMessage:k||void 0,success:b,resendCountdown:E,onInvalidInput:e=>{T(e),S(1)},onClearError:()=>{1===A&&(T(null),S(null))}})}};let Zh=/*#__PURE__*/a.styled.div.withConfig({displayName:"PasswordlessCodeContainer",componentId:"sc-63a7dae3-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:auto;gap:16px;flex-grow:1;width:100%;"]),Kh=/*#__PURE__*/a.styled.div.withConfig({displayName:"CodeInput",componentId:"sc-63a7dae3-1"})(["display:flex;flex-direction:column;width:100%;gap:12px;> div:first-child{display:flex;justify-content:center;gap:0.5rem;width:100%;border-radius:var(--privy-border-radius-sm);> input{border:1px solid var(--privy-color-foreground-4);background:var(--privy-color-background);border-radius:var(--privy-border-radius-sm);padding:8px 10px;height:48px;width:40px;text-align:center;font-size:18px;font-weight:600;color:var(--privy-color-foreground);transition:all 0.2s ease;}> input:focus{border:1px solid var(--privy-color-foreground);box-shadow:0 0 0 1px var(--privy-color-foreground);}> input:invalid{border:1px solid var(--privy-color-error);}> input.success{border:1px solid var(--privy-color-border-success);background:var(--privy-color-success-bg);}> input.fail{border:1px solid var(--privy-color-border-error);background:var(--privy-color-error-bg);animation:shake 180ms;animation-iteration-count:2;}}@keyframes shake{0%{transform:translate(1px,0px);}33%{transform:translate(-1px,0px);}67%{transform:translate(-1px,0px);}100%{transform:translate(1px,0px);}}"]),Qh=/*#__PURE__*/a.styled.div.withConfig({displayName:"InputHelp",componentId:"sc-63a7dae3-2"})(["line-height:20px;min-height:20px;font-size:14px;font-weight:400;color:",";display:flex;justify-content:center;width:100%;text-align:center;"],(e=>e.$success?"var(--privy-color-success-dark)":e.$fail?"var(--privy-color-error-dark)":"transparent")),Xh=/*#__PURE__*/a.styled.div.withConfig({displayName:"HelpTextContainer",componentId:"sc-63a7dae3-3"})(["display:flex;gap:8px;align-items:center;justify-content:center;width:100%;color:var(--privy-color-foreground-2);"]),Jh=/*#__PURE__*/a.styled.div.withConfig({displayName:"Badge",componentId:"sc-63a7dae3-4"})(["display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-sm);padding:2px 8px;gap:4px;background:var(--privy-color-background-2);color:var(--privy-color-foreground-2);"]),eg=/*#__PURE__*/a.styled.span.withConfig({displayName:"BoldWrappingSpan",componentId:"sc-63a7dae3-5"})(["font-weight:500;word-break:break-all;color:var(--privy-color-foreground);"]);const tg=/*#__PURE__*/n.forwardRef(((a,o)=>{let[s,l]=n.useState(a.defaultValue||""),[c,u]=n.useState(""),[p,h]=n.useState(!1),{authenticated:g}=i.usePrivyContext(),{initLoginWithEmail:m}=r.usePrivyInternal(),{navigate:y,setModalData:f,currentScreen:x,data:v}=Xn(),{enabled:w,token:C}=qt(),[b,j]=n.useState(!1),{accountType:k}=as(),T=qn();n.useEffect((()=>{!s&&T.disablePlusEmails&&v?.inlineError?.error instanceof d.PrivyError&&v?.inlineError?.error.privyErrorCode===d.PrivyErrorCode.DISALLOWED_PLUS_EMAIL&&!c&&u("Please enter a valid email address without a '+'."),c&&u("")}),[s]);let A=Wt(s),S=p||!A,E=()=>{f({login:v?.login,inlineError:void 0}),!w||C||g?(e=>{h(!0),m({email:s,captchaToken:e,disableSignup:v?.login?.disableSignup,withPrivyUi:!0}).then((()=>{y(Yh)})).catch((e=>{f({errorModalData:{error:e,previousScreen:x||cg}}),y(Rs)})).finally((()=>{h(!1)}))})(C):(f({captchaModalData:{callback:e=>m({email:s,captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Yh,onErrorNavigateTo:Rs}}),y(ac))};/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(ng,{children:[c&&/*#__PURE__*/e.jsx(wl,{style:{display:"block",marginTop:"0.25rem",textAlign:"left"},children:c}),/*#__PURE__*/e.jsxs(rg,{stacked:a.stacked,$error:!!c,children:[/*#__PURE__*/e.jsx(ig,{children:/*#__PURE__*/e.jsx(t.Mail,{})}),/*#__PURE__*/e.jsx("input",{ref:o,id:"email-input",className:"login-method-button",type:"email",placeholder:"your@email.com",onFocus:()=>j(!0),onChange:e=>l(e.target.value),onKeyUp:e=>{"Enter"===e.key&&E()},value:s,autoComplete:"email"}),"email"!==k||b?a.stacked?/*#__PURE__*/e.jsx("span",{}):/*#__PURE__*/e.jsx(Rr,{isSubmitting:p,onClick:E,disabled:S,children:"Submit"}):/*#__PURE__*/e.jsx(xu,{color:"gray",children:"Recent"})]})]}),a.stacked?/*#__PURE__*/e.jsx(Pr,{loadingText:null,loading:p,disabled:S,onClick:E,style:{width:"100%"},children:"Submit"}):null]})}));let ng=kl,rg=jl,ig=/*#__PURE__*/a.styled(ur).withConfig({displayName:"StyledLoginMethodIconWrapper",componentId:"sc-e33d938a-0"})(["display:inline-flex;"]);const ag=({isEditable:r,setIsEditable:i,defaultValue:a})=>{let o=n.useRef(null);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(pr,{$if:!r,children:/*#__PURE__*/e.jsx(tg,{ref:o,defaultValue:a})}),/*#__PURE__*/e.jsx(pr,{$if:r,children:/*#__PURE__*/e.jsxs(dr,{onClick:()=>{i(),setTimeout((()=>{o.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(t.Mail,{})}),"Continue with Email"]})})]})},og=({connectOnly:t})=>{let{closePrivyModal:i,connectors:a}=r.usePrivyInternal(),{onUserCloseViaDialogOrKeybindRef:o,data:s}=Xn(),l=qn(),{appearance:{palette:{colorScheme:c}}}=qn(),{accountType:d,walletClientType:u,chainType:p}=as(),h=n.useMemo((()=>d&&"guest"!==d&&"authorization_key"!==d&&"cross_app"!==d?es(d):null),[d]),g=l.loginMethodsAndOrder?.primary??[],m=l.loginMethodsAndOrder?.overflow??[],y=n.useMemo((()=>[...g,...m]),[g,m]),f=l.loginMethods.passkey,x=s?.login,v=[];u&&y.includes(u)?v.push(u):d&&y.includes(h?.loginMethod)&&v.push(h?.loginMethod);let[w,C]=n.useState("default"),[b,j]=n.useState(Oh({mostRecentlyUsedAccountType:d,smsAvailable:y.includes("sms"),emailAvailable:y.includes("email"),prefilledType:x?.prefill?.type}));n.useEffect((()=>{j(Oh({mostRecentlyUsedAccountType:d,smsAvailable:y.includes("sms"),emailAvailable:y.includes("email"),prefilledType:x?.prefill?.type}))}),[y,d]),n.useEffect((()=>{"phone"===d&&j("sms");let e=y.indexOf("sms"),t=y.indexOf("email");e>-1&&e<t&&j("sms")}),[d,g,m]);let k=()=>{i({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{C("default")}),150)};o.current=k;let T=n=>"email"===n?/*#__PURE__*/e.jsx(ag,{isEditable:"email"===b,setIsEditable:()=>{j("email")},defaultValue:"email"===x?.prefill?.type?x.prefill.value:void 0},n):"sms"===n?/*#__PURE__*/e.jsx(jh,{isEditable:"sms"===b,setIsEditable:()=>{j("sms")},defaultValue:"phone"===x?.prefill?.type?x.prefill.value:void 0},n):"apple"===n?/*#__PURE__*/e.jsx(Th,{provider:"apple"},n):"discord"===n?/*#__PURE__*/e.jsx(Th,{provider:"discord"},n):"farcaster"===n?/*#__PURE__*/e.jsx(uh,{},n):"github"===n?/*#__PURE__*/e.jsx(Th,{provider:"github"},n):"google"===n?/*#__PURE__*/e.jsx(Th,{provider:"google"},n):"linkedin"===n?/*#__PURE__*/e.jsx(Th,{provider:"linkedin"},n):"spotify"===n?/*#__PURE__*/e.jsx(Th,{provider:"spotify"},n):"instagram"===n?/*#__PURE__*/e.jsx(Th,{provider:"instagram"},n):"tiktok"===n?/*#__PURE__*/e.jsx(Th,{provider:"tiktok"},n):"line"===n?/*#__PURE__*/e.jsx(Th,{provider:"line"},n):"twitter"===n?/*#__PURE__*/e.jsx(Th,{provider:"twitter"},n):"telegram"===n?/*#__PURE__*/e.jsx(Ph,{},n):n.startsWith("privy:")?/*#__PURE__*/e.jsx(ds,{appId:n.replace("privy:","")},n):zu({walletList:l.appearance.walletList,walletChainType:x?.walletChainType??l.appearance.walletChainType,connectors:a,connectOnly:t,ignore:y,walletConnectEnabled:l.externalWallets.walletConnect.enabled,forceWallet:{wallet:n,chainType:p??"ethereum"}}),A=v.flatMap(T),S=g.filter((e=>e!==u&&e!==h?.loginMethod)).flatMap(T),E=m.filter((e=>e!==u&&e!==h?.loginMethod)).flatMap(T),[I,P]=((e,t)=>{let n=[],r=[];for(let[i,a]of e.entries())i<t?n.push(a):r.push(a);return[n,r]})([...A,...S,...E],sg({primary:S.length+A.length,overflow:E.length}));/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{title:l.appearance.landingHeader,onClose:k,backFn:"default"===w?void 0:()=>{C("default")}}),"default"===w&&/*#__PURE__*/e.jsx(lg,{}),"default"===w&&("string"==typeof l.appearance.loginMessage?/*#__PURE__*/e.jsx(cr,{children:l.appearance.loginMessage}):l.appearance.loginMessage),/*#__PURE__*/e.jsx(ar,{style:{overflow:"hidden"},children:/*#__PURE__*/e.jsxs(sr,{$colorScheme:c,children:["default"===w&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[I,P.length>0&&/*#__PURE__*/e.jsx(_h,{text:"More options",icon:/*#__PURE__*/e.jsx(de.default,{}),onClick:()=>C("overflow")})]}),"overflow"===w&&/*#__PURE__*/e.jsx(e.Fragment,{children:P}),f&&"default"===w&&/*#__PURE__*/e.jsx(xh,{})]})}),l&&/*#__PURE__*/e.jsx(fr,{app:l}),/*#__PURE__*/e.jsx(xr,{})]})};let sg=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,lg=/*#__PURE__*/a.styled(ss).withConfig({displayName:"StyledAppLogoHeader",componentId:"sc-b478a8eb-0"})(["margin-bottom:16px;"]);const cg={component:()=>{let t=qn();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/e.jsx(og,{connectOnly:!1}):/*#__PURE__*/e.jsx(Mh,{connectOnly:!1})},isCaptchaRequired:!0,isUnauthenticatedScreem:!0},dg={component:()=>{let[t,a]=n.useState(null),[o,s]=n.useState(!1),[l,c]=n.useState(null),[u,p]=n.useState(""),{authenticated:h,user:g}=i.usePrivyContext(),{client:m,walletProxy:y,refreshSessionAndUser:f,closePrivyModal:x,createAnalyticsEvent:v}=r.usePrivyInternal(),{navigate:w,data:C,onUserCloseViaDialogOrKeybindRef:b}=Xn(),j=qn(),{onSuccess:k,onFailure:T}=C.setWalletPassword,A=i.getPrivyPrimaryWallet(g),S="user-passcode"===t?.recoveryMethod,E="user-passcode"===A?.recoveryMethod;n.useEffect((()=>{h||(w(cg),T(new d.PrivyUnauthenticatedError("User must be authenticated before setting a password on a Privy wallet")))}),[h]);let I=()=>l?(T(l),void x({shouldCallAuthOnSuccess:!1})):S?(k(t),void x({shouldCallAuthOnSuccess:!1})):(T(new d.PrivyEmbeddedWalletError("Exited before password was added to wallet")),void x({shouldCallAuthOnSuccess:!1}));b.current=I;/*#__PURE__*/return e.jsx(Xo,{appName:j?.name||"privy",config:{initiatedBy:"user",onCancel:I},error:l?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:u,isResettingPassword:E,onPasswordGenerate:()=>p(zo()),onPasswordChange:p,onSubmit:async()=>{S?(k(t),x({shouldCallAuthOnSuccess:!1})):(s(!0),c(null),await(async()=>{let e=await m.getAccessToken();if(e&&g&&A?.address&&u&&y)try{v({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E}});let{entropyId:t,entropyIdVerifier:n}=Qt(g);if(!(await y.setRecovery({accessToken:e,entropyId:t,entropyIdVerifier:n,recoveryPassword:u,recoveryMethod:"user-passcode"})).entropyId)return c(new d.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E,reason:"error setting password"}});let r=await f(),o=i.getPrivyPrimaryWallet(r);if(!o)return c(new d.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E,reason:"wallet disconnected"}});a(o),v({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E}})}catch(e){console.warn(e),c(e instanceof Error?e:Error("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:A.address,reason:e}})}})(),s(!1))},onClose:I})}},ug=({onClose:n,onProceed:r})=>/*#__PURE__*/e.jsx(bi,{title:"Secure Your Account",subtitle:/*#__PURE__*/e.jsxs(e.Fragment,{children:["Please set a password to secure your account.",/*#__PURE__*/e.jsx("br",{}),"Losing access to this password and this device will make your account inaccessible."]}),icon:t.Lock,primaryCta:{label:"Add password",onClick:r},onClose:n,watermark:!0}),pg={component:()=>{let{closePrivyModal:t}=r.usePrivyInternal(),{data:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=Xn(),{onFailure:o}=n.setWalletPassword,s=()=>{o(new d.PrivyEmbeddedWalletError("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=s,/*#__PURE__*/e.jsx(ug,{onClose:s,onProceed:()=>{i(dg)}})}},hg={component:()=>{let[t,a]=n.useState(!0),{authenticated:o,user:s}=i.usePrivyContext(),{walletProxy:l,closePrivyModal:c,createAnalyticsEvent:u,client:p}=r.usePrivyInternal(),{navigate:h,data:g,onUserCloseViaDialogOrKeybindRef:m}=Xn(),[y,f]=n.useState(void 0),[x,v]=n.useState(""),[w,C]=n.useState(!1),{entropyId:b,entropyIdVerifier:j,onCompleteNavigateTo:k,onSuccess:T,onFailure:A}=g.recoverWallet,S=(e="User exited before their wallet could be recovered")=>{c({shouldCallAuthOnSuccess:!1}),A("string"==typeof e?new d.PrivyEmbeddedWalletError(e):e)};m.current=S,n.useEffect((()=>{if(!o)return S("User must be authenticated and have a Privy wallet before it can be recovered")}),[o]);/*#__PURE__*/return e.jsxs(mi,{children:[/*#__PURE__*/e.jsx(mi.Header,{icon:Le.default,title:"Enter your password",subtitle:"Please provision your account on this new device. To continue, enter your recovery password.",showClose:!0,onClose:S}),/*#__PURE__*/e.jsx(mi.Body,{children:/*#__PURE__*/e.jsx(gg,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsxs(yo,{children:[/*#__PURE__*/e.jsx(go,{type:t?"password":"text",onChange:e=>(e=>{e&&f(e)})(e.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),/*#__PURE__*/e.jsx(Co,{style:{right:"0.75rem"},children:t?/*#__PURE__*/e.jsx(jo,{onClick:()=>a(!1)}):/*#__PURE__*/e.jsx(ko,{onClick:()=>a(!0)})})]}),!!x&&/*#__PURE__*/e.jsx(mg,{children:x})]})})}),/*#__PURE__*/e.jsxs(mi.Footer,{children:[/*#__PURE__*/e.jsx(mi.HelpText,{children:/*#__PURE__*/e.jsxs(Xi,{children:[/*#__PURE__*/e.jsx("h4",{children:"Why is this necessary?"}),/*#__PURE__*/e.jsx("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]})}),/*#__PURE__*/e.jsx(mi.Actions,{children:/*#__PURE__*/e.jsx(yg,{loading:w||!l,disabled:!y,onClick:async()=>{C(!0);let e=await p.getAccessToken(),t=i.getPrivyWalletWithAddress(s,b);if(!e||!t||null===y)return S("User must be authenticated and have a Privy wallet before it can be recovered");try{u({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t.address}}),await(l?.recover({accessToken:e,entropyId:b,entropyIdVerifier:j,recoveryPassword:y})),v(""),k?h(k):c({shouldCallAuthOnSuccess:!1}),T?.(t),u({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}})}catch(e){!function(e){return Wa(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?v("An error has occurred, please try again."):v("Invalid recovery password, please try again.")}finally{C(!1)}},$hideAnimations:!b&&w,children:"Recover your account"})}),/*#__PURE__*/e.jsx(mi.Watermark,{})]})]})}};let gg=/*#__PURE__*/a.styled.div.withConfig({displayName:"Content",componentId:"sc-f366413c-0"})(["display:flex;flex-direction:column;gap:1.5rem;"]),mg=/*#__PURE__*/a.styled.div.withConfig({displayName:"ErrorMessage",componentId:"sc-f366413c-1"})(["line-height:20px;height:20px;font-size:13px;color:var(--privy-color-error);text-align:left;margin-top:0.5rem;"]),yg=/*#__PURE__*/a.styled(Pr).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-f366413c-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/a.css(["&&{transition:none;}"])));const fg={component:()=>{let{navigate:t,data:a,onUserCloseViaDialogOrKeybindRef:o}=Xn(),s=qn(),[l,c]=n.useState(""),[u,p]=n.useState(!1),[h,g]=n.useState(),[m,y]=n.useState(null),{create:f}=Qa(),{authenticated:x,user:v}=i.usePrivyContext(),{closePrivyModal:w,isNewUserThisSession:C,initializeWalletProxy:b}=r.usePrivyInternal(),{onSuccess:j,onFailure:k,callAuthOnSuccessOnClose:T,shouldCreateEth:A,shouldCreateSol:S}=a.createWallet,[E,I]=n.useState(null),P=new rt((async()=>{try{let e;if(A&&S)e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:v}),e=await f({chainType:"solana",walletIndex:0,latestUser:e.user});else if(S)e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"solana",walletIndex:0,latestUser:v});else{if(!A)throw Error("Invalid args to create wallet");e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:v})}I(e),C?t(Ja):(j(e),w({shouldCallAuthOnSuccess:T}))}catch(e){c(e.message)}}));n.useEffect((()=>{m||b(3e4).then((e=>y(e)))}),[m]),n.useEffect((()=>{if(!x||!v)return t(cg),void k(Error("User must be authenticated before creating a Privy wallet"))}),[x]),o.current=()=>null;/*#__PURE__*/return e.jsx(Xo,{config:{initiatedBy:"automatic"},appName:s?.name||"privy",loading:!m,buttonLoading:u,buttonHideAnimations:!E&&u,isResettingPassword:!1,error:l,password:h||"",onClose:()=>{E&&"user-passcode"!==E.account.recoveryMethod?(k(new d.PrivyEmbeddedWalletError("User created a wallet but failed to set a password for it")),w({shouldCallAuthOnSuccess:!1})):E?(j(E),w({shouldCallAuthOnSuccess:T})):(k(new d.PrivyEmbeddedWalletError("User wallet creation failed")),w({shouldCallAuthOnSuccess:!1}))},onPasswordChange:g,onPasswordGenerate:()=>g(zo()),onSubmit:async()=>(p(!0),P.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>p(!1))))})}},xg=/*#__PURE__*/a.styled.div.withConfig({displayName:"WithCircleBorder",componentId:"sc-e4fc5563-0"})(["&&{border-width:4px;}display:flex;justify-content:center;align-items:center;padding:1rem;aspect-ratio:1;border-style:solid;border-color:",";border-radius:50%;"],(e=>e.$color??"var(--privy-color-accent)")),vg={component:()=>{let{user:t}=i.usePrivyContext(),{client:a,walletProxy:o,refreshSessionAndUser:s,closePrivyModal:l}=r.usePrivyInternal(),c=Xn(),{entropyId:d,entropyIdVerifier:u}=c.data?.recoverWallet,[p,h]=n.useState(!1),[g,m]=n.useState(null),[y,f]=n.useState(null);function x(){if(!p){if(y)return c.data?.setWalletPassword?.onFailure(y),void l();if(!g)return c.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void l()}}c.onUserCloseViaDialogOrKeybindRef.current=x;let v=!(!p&&!g);return y?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:x},"header"),/*#__PURE__*/e.jsx(xg,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:/*#__PURE__*/e.jsx(xe.default,{height:38,width:38,stroke:"var(--privy-color-error)"})}),/*#__PURE__*/e.jsx(jc,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),/*#__PURE__*/e.jsx(ir,{style:{minHeight:"2rem"}}),/*#__PURE__*/e.jsx(Nr,{onClick:()=>f(null),children:"Try again"}),/*#__PURE__*/e.jsx(xr,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:x},"header"),/*#__PURE__*/e.jsx(ke.default,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),/*#__PURE__*/e.jsx(jc,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),/*#__PURE__*/e.jsx(bc,{style:{marginTop:"1rem"},children:"When you log into a new device, you’ll only need to authenticate to access your account. Never get logged out if you forget your password."}),/*#__PURE__*/e.jsx(ir,{style:{minHeight:"2rem"}}),/*#__PURE__*/e.jsx(Nr,{loading:p,disabled:v,onClick:()=>async function(){h(!0);try{let e=await a.getAccessToken(),n=i.getPrivyWalletWithAddress(t,d);if(!e||!o||!n)return;if(!(await o.setRecovery({accessToken:e,entropyId:d,entropyIdVerifier:u,existingRecoveryMethod:n.recoveryMethod,recoveryMethod:"privy"})).entropyId)throw Error("Unable to set recovery on wallet");let r=await s();if(!r)throw Error("Unable to set recovery on wallet");let p=i.getPrivyWalletWithAddress(r,n.address);if(!p)throw Error("Unabled to set recovery on wallet");m(!!r),setTimeout((()=>{c.data?.setWalletPassword?.onSuccess(p),l()}),it)}catch(e){f(e)}finally{h(!1)}}(),children:g?"Success":"Confirm"}),/*#__PURE__*/e.jsx(xr,{})]})}};function wg({isCreatingWallet:e,skipSplashScreen:t}){return e?fg:t?dg:pg}function Cg({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:n,isResettingPassword:r,showAutomaticRecovery:i}){return i?vg:n||1===t.length?wg({isCreatingWallet:"create"===e,skipSplashScreen:r}):so}function bg(e){switch(e){case"user-passcode":return hg;case"google-drive":case"icloud":return ro;default:throw Error("Recovery method not supported")}}const jg=({address:t,accessToken:n,appConfigTheme:r,onClose:i,isLoading:a=!1,exportButtonProps:o})=>/*#__PURE__*/e.jsx(bi,{title:"Export wallet",subtitle:/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy either your private key or seed phrase to export your wallet."," ",/*#__PURE__*/e.jsx("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),onClose:i,watermark:!0,children:/*#__PURE__*/e.jsxs(kg,{children:[/*#__PURE__*/e.jsx(fd,{theme:r,children:"Never share your private key or seed phrase with anyone."}),/*#__PURE__*/e.jsx(Fc,{title:"Your wallet",address:t,showCopyButton:!0}),/*#__PURE__*/e.jsx("div",{style:{width:"100%"},children:a?/*#__PURE__*/e.jsx(Tg,{}):n&&o&&/*#__PURE__*/e.jsx(Eg,{accessToken:n,dimensions:{height:"44px"},...o})})]})});let kg=/*#__PURE__*/a.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-39a41d8e-0"})(["display:flex;flex-direction:column;gap:1.25rem;text-align:left;"]),Tg=()=>/*#__PURE__*/e.jsx(Ag,{children:/*#__PURE__*/e.jsx(Sg,{children:"Loading..."})}),Ag=/*#__PURE__*/a.styled.div.withConfig({displayName:"PlaceholderContainer",componentId:"sc-39a41d8e-1"})(["display:flex;gap:12px;height:44px;"]),Sg=/*#__PURE__*/a.styled.div.withConfig({displayName:"PlaceholderButton",componentId:"sc-39a41d8e-2"})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:16px;font-weight:500;border-radius:var(--privy-border-radius-md);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);"]);function Eg(t){let[r,i]=n.useState(t.dimensions.width),[a,s]=n.useState(void 0),l=n.useRef(null);n.useEffect((()=>{if(l.current&&void 0===r){let{width:e}=l.current.getBoundingClientRect();i(e)}let e=getComputedStyle(document.documentElement);s({background:e.getPropertyValue("--privy-color-background"),background2:e.getPropertyValue("--privy-color-background-2"),foreground3:e.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:e.getPropertyValue("--privy-color-foreground-accent"),accent:e.getPropertyValue("--privy-color-accent"),accentDark:e.getPropertyValue("--privy-color-accent-dark"),success:e.getPropertyValue("--privy-color-success"),colorScheme:e.getPropertyValue("color-scheme")})}),[]);let c="ethereum"===t.chainType&&!t.imported&&!t.isUnifiedWallet;/*#__PURE__*/return e.jsx("div",{ref:l,children:r&&
26
- /*#__PURE__*/e.jsxs(Pg,{children:[/*#__PURE__*/e.jsx("iframe",{style:{position:"absolute",zIndex:1},width:r,height:t.dimensions.height,allow:"clipboard-write self *",src:o.constructURL({origin:t.origin,path:`/apps/${t.appId}/embedded-wallets/export`,query:t.isUnifiedWallet?{v:"1-unified",wallet_id:t.walletId,client_id:t.appClientId,width:`${r}px`,caid:t.clientAnalyticsId,phrase_export:c,...a}:{v:"1",entropy_id:t.entropyId,entropy_id_verifier:t.entropyIdVerifier,hd_wallet_index:t.hdWalletIndex,chain_type:t.chainType,client_id:t.appClientId,width:`${r}px`,caid:t.clientAnalyticsId,phrase_export:c,...a},hash:{token:t.accessToken}})}),/*#__PURE__*/e.jsx(Ng,{children:"Loading..."}),c&&/*#__PURE__*/e.jsx(Ng,{children:"Loading..."})]})})}const Ig={component:()=>{let[t,a]=n.useState(null),{authenticated:o,user:s}=i.usePrivyContext(),{closePrivyModal:l,createAnalyticsEvent:c,clientAnalyticsId:d,client:u}=r.usePrivyInternal(),p=qn(),{data:h,onUserCloseViaDialogOrKeybindRef:g}=Xn(),{onFailure:m,onSuccess:y,origin:f,appId:x,appClientId:v,entropyId:w,entropyIdVerifier:C,walletId:b,hdWalletIndex:j,chainType:k,address:T,isUnifiedWallet:A,imported:S}=h.keyExport,E=e=>{l({shouldCallAuthOnSuccess:!1}),m("string"==typeof e?Error(e):e)},I=()=>{l({shouldCallAuthOnSuccess:!1}),y(),c({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:T}})};return n.useEffect((()=>{if(!o)return E("User must be authenticated before exporting their wallet");u.getAccessToken().then(a).catch(E)}),[o,s]),g.current=I,/*#__PURE__*/e.jsx(jg,{address:T,accessToken:t,appConfigTheme:p.appearance.palette.colorScheme,onClose:I,isLoading:!t,exportButtonProps:t?{origin:f,appId:x,appClientId:v,clientAnalyticsId:d,entropyId:w,entropyIdVerifier:C,walletId:b,hdWalletIndex:j,isUnifiedWallet:A,imported:S,chainType:k}:void 0})}};let Pg=/*#__PURE__*/a.styled.div.withConfig({displayName:"ButtonContainer",componentId:"sc-39a41d8e-3"})(["overflow:visible;position:relative;overflow:none;height:44px;display:flex;gap:12px;"]),Ng=/*#__PURE__*/a.styled.div.withConfig({displayName:"LoadingButton",componentId:"sc-39a41d8e-4"})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:16px;font-weight:500;border-radius:var(--privy-border-radius-md);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);"]);const _g=({connectionFailed:n,onClose:r})=>n?/*#__PURE__*/e.jsx(bi,{title:"Something went wrong",subtitle:"We're on it. Please try again later.",icon:t.XCircle,iconVariant:"error",primaryCta:{label:"Close",onClick:r},watermark:!0}):/*#__PURE__*/e.jsx(bi,{title:"Connecting to your wallet",subtitle:"Please wait...",iconVariant:"loading",showClose:!0,onClose:r,watermark:!1}),Mg={component:()=>{let{authenticated:t,user:a}=i.usePrivyContext(),{client:o,closePrivyModal:s,createAnalyticsEvent:l,walletProxy:c}=r.usePrivyInternal(),{navigate:d,data:u,setModalData:p,onUserCloseViaDialogOrKeybindRef:h}=Xn(),g=n.useMemo((()=>Date.now()),[]),[m,y]=n.useState(!1),{onCompleteNavigateTo:f,onFailure:x,shouldForceMFA:v,entropyId:w,entropyIdVerifier:C,recoveryMethod:b,connectingWalletAddress:j,isUnifiedWallet:k=!1}=u?.connectWallet,T=e=>{m||(y(!0),x("string"==typeof e?Error(e):e))};return n.useEffect((()=>{let e;return t?c?((async()=>{let t=await o.getAccessToken();if(!t)return T("User must be authenticated and have a Privy wallet before it can be connected");try{k||await c.connect({accessToken:t,entropyId:w,entropyIdVerifier:C}),v&&await c.verifyMfa({accessToken:t});let n=(Date.now()-g)/1e3;f===Ig&&n<1?e=setTimeout((()=>{d(f,!1)}),1e3*(1-n)):d(f,!1)}catch(e){if(Da(e)&&"privy"===b){let e=await o.getAccessToken();if(!e)return T("User must be authenticated and have a Privy wallet before it can be recovered");try{l({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:j}});let t=await(c?.recover({accessToken:e,entropyId:w,entropyIdVerifier:C}));t?.entropyId||T(Error("Unable to recover wallet")),f?d(f):s({shouldCallAuthOnSuccess:!1}),l({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:j}}),d(f)}catch(e){T("An error has occurred, please try again.")}}else Da(e)&&"privy"!==b&&"privy-v2"!==b?(p({...u,recoverWallet:{entropyId:w,entropyIdVerifier:C,onCompleteNavigateTo:f,onFailure:x},recoveryOAuthStatus:{provider:b,action:"recover",isInAccountCreateFlow:!1,shouldCreateEth:!1,shouldCreateSol:!1}}),d(bg(b))):T(e)}})(),()=>clearTimeout(e)):void 0:T("User must be authenticated and have a Privy wallet before it can be connected")}),[t,a,c]),h.current=()=>{T("User exited before wallet could be connected"),s({shouldCallAuthOnSuccess:!1})},/*#__PURE__*/e.jsx(_g,{connectionFailed:m,onClose:()=>s({shouldCallAuthOnSuccess:!1})})}},Fg=({style:t,color:n,...r})=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:n||"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...r,children:/*#__PURE__*/e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Lg=t=>{let[r,i]=n.useState(!1);/*#__PURE__*/return e.jsxs(Wg,{color:t.color,onClick:()=>{i(!0),navigator.clipboard.writeText(t.text),setTimeout((()=>i(!1)),1500)},$justCopied:r,children:[r?/*#__PURE__*/e.jsx(Fg,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):/*#__PURE__*/e.jsx(al,{style:{height:"14px",width:"14px"}}),r?"Copied":"Copy"," ",t.itemName?t.itemName:"to Clipboard"]})};let Wg=/*#__PURE__*/a.styled.button.withConfig({displayName:"StyledCopytoClipboardButton",componentId:"sc-46f4187f-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.$justCopied?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.$justCopied?"medium":"normal"),(e=>e.$justCopied?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"));const Dg=/*#__PURE__*/a.styled.img.withConfig({displayName:"StyledLogo",componentId:"sc-68c1b1ea-0"})(["&&{height:",";width:",";border-radius:16px;margin-bottom:12px;}"],(e=>"sm"===e.size?"65px":"140px"),(e=>"sm"===e.size?"65px":"140px"));let Rg=e=>{if(!l.isHex(e))return e;try{let t=l.hexToString(e);return t.includes("�")?e:t}catch{return e}},Og=e=>{try{let t=s.base64.decode(e),n=(new TextDecoder).decode(t);return n.includes("�")?e:n}catch{return e}},Bg=e=>JSON.stringify(e,null,2),Ug=t=>{let{types:n,primaryType:r,...i}=t.typedData;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(qg,{data:i}),/*#__PURE__*/e.jsx(Lg,{text:Bg(t.typedData),itemName:"full payload to clipboard"})," "]})};const zg=({method:n,messageData:r,copy:i,iconUrl:a,isLoading:o,success:s,walletProxyIsLoading:l,errorMessage:c,isCancellable:d,onSign:u,onCancel:p,onClose:h})=>/*#__PURE__*/e.jsx(bi,{title:i.title,subtitle:i.description,showClose:!0,onClose:h,icon:t.Edit,iconVariant:"subtle",helpText:c?/*#__PURE__*/e.jsx($g,{children:c}):void 0,primaryCta:{label:i.buttonText,onClick:u,disabled:o||s||l,loading:o},secondaryCta:d?{label:"Not now",onClick:p,disabled:o||s||l}:void 0,watermark:!0,children:/*#__PURE__*/e.jsxs(Qi,{children:[a?/*#__PURE__*/e.jsx(Dg,{style:{alignSelf:"center"},size:"sm",src:a,alt:"app image"}):null,/*#__PURE__*/e.jsxs(Vg,{children:["personal_sign"===n&&/*#__PURE__*/e.jsx(Gg,{children:Rg(r)}),"eth_signTypedData_v4"===n&&/*#__PURE__*/e.jsx(Ug,{typedData:r}),"solana_signMessage"===n&&/*#__PURE__*/e.jsx(Gg,{children:Og(r)})]})]})}),Hg={component:()=>{let{authenticated:t}=i.usePrivyContext(),{initializeWalletProxy:a,closePrivyModal:o}=r.usePrivyInternal(),{navigate:s,data:l,onUserCloseViaDialogOrKeybindRef:d}=Xn(),[u,p]=n.useState(!0),[h,g]=n.useState(""),[m,y]=n.useState(),[f,x]=n.useState(null),[v,w]=n.useState(!1);n.useEffect((()=>{t||s(cg)}),[t]),n.useEffect((()=>{a(3e4).then((e=>{p(!1),e||(g("An error has occurred, please try again."),y(new an(new rn(h,c.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:C,data:b,confirmAndSign:j,onSuccess:k,onFailure:T,uiOptions:A}=l.signMessage,S={title:A?.title||"Sign message",description:A?.description||"Signing this message will not cost you any fees.",buttonText:A?.buttonText||"Sign and continue"},E=e=>{e?k(e):T(m||new an(new rn("The user rejected the request.",c.ProviderErrors.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{x(null),g(""),y(void 0)}),200)};d.current=()=>{E(f)};/*#__PURE__*/return e.jsx(zg,{method:C,messageData:b,copy:S,iconUrl:A?.iconUrl&&"string"==typeof A.iconUrl?A.iconUrl:void 0,isLoading:v,success:null!==f,walletProxyIsLoading:u,errorMessage:h,isCancellable:A?.isCancellable,onSign:async()=>{w(!0),g("");try{let e=await j();x(e),w(!1),setTimeout((()=>{E(e)}),it)}catch(e){console.error(e),g("An error has occurred, please try again."),y(new an(new rn(h,c.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),w(!1)}},onCancel:()=>E(null),onClose:()=>E(f)})}};let Vg=/*#__PURE__*/a.styled.div.withConfig({displayName:"MessageContainer",componentId:"sc-e01d451f-0"})(["flex:1;display:flex;flex-direction:column;gap:16px;"]),$g=/*#__PURE__*/a.styled.p.withConfig({displayName:"ErrorText",componentId:"sc-e01d451f-1"})(["&&{margin:0;width:100%;text-align:center;color:var(--privy-color-error-dark);font-size:14px;line-height:22px;}"]),qg=/*#__PURE__*/a.styled(Xc).withConfig({displayName:"StyledDisplayJsonTree",componentId:"sc-e01d451f-2"})(["margin-top:0;"]),Gg=/*#__PURE__*/a.styled(Kc).withConfig({displayName:"StyledMessage",componentId:"sc-e01d451f-3"})(["margin-top:0;"]);exports.ASSOCIATED_TOKEN_PROGRAM_ID="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",exports.AccountNotFoundScreen=vs,exports.Address=Cs,exports.AffirmativeConsentScreen=nl,exports.AllowlistRejectionScreen=rc,exports.Apple=yt,exports.AuthenticateWithWalletScreen=xc,exports.AwaitingEvmToSolBridgingScreen=fp,exports.AwaitingExternalTransferScreen=xp,exports.AwaitingPasswordlessCodeScreen=Yh,exports.AwaitingSolToEvmBridgingScreen=wp,exports.BASE_ACCOUNT_DATA_URI=en,exports.Blobby=hn,exports.BlobbyFooter=xr,exports.BottomPusherContainer=$i,exports.Box=Ac,exports.BrowserExtensionWallet=mn,exports.ButtonLoader=Ar,exports.CLIENT_ANALYTICS_ID_KEY="privy:caid",exports.CODE_VERIFIER_KEY=st,exports.COINBASE_WALLET_DATA_URI=Jt,exports.CONNECTIONS_HISTORY_KEY=ct,exports.CUSTOMER_ACCESS_TOKEN_COOKIE_KEY="privy-token",exports.CUSTOMER_ACCESS_TOKEN_STORAGE_KEY="privy:token",exports.CaptchaError=$t,exports.CaptchaProvider=({children:t,id:r,captchaSiteKey:i,captchaEnabled:a})=>{let o=n.useRef(null),[s,l]=n.useState(),[c,u]=n.useState(),[p,h]=n.useState(!1),g=n.useMemo((()=>a?p||s||c?!p||s||c?s&&!c?{status:"success",token:s}:c?{status:"error",error:c}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[a,s,c,p]);/*#__PURE__*/return e.jsx(Vt.Provider,{value:{...g,ref:o,enabled:a,siteKey:i,appId:r,setToken:l,setError:u,setExecuting:h,remove(){a&&(o.current?.remove(),h(!1),u(void 0),l(void 0))},reset(){a&&(o.current?.reset(),h(!1),u(void 0),l(void 0))},execute(){a&&(h(!0),o.current?.execute())},async waitForResult(){if(!a)return"";try{return await function(e,{interval:t=100,timeout:n=5e3}={}){return new Promise(((r,i)=>{let a,o=0,s=()=>{o>=n?i("Max attempts reached without result"):(a=e(),o+=t,null==a?setTimeout(s,t):r(a))};s()}))}((()=>o.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new $t("Captcha failed",null,d.PrivyErrorCode.CAPTCHA_TIMEOUT)}}},children:t})},exports.CaptchaScreen=ac,exports.CenteredItem=qi,exports.CenteredItemWithGap=Zi,exports.CenteredItemWithPadding=Yi,exports.CenteredScreenHeader=Ua,exports.Chip=xu,exports.Chip$1=Fl,exports.CloseButton=Nl,exports.ConnectEmailForm=tg,exports.ConnectOnlyLandingScreen=$p,exports.ConnectOnlyStatusScreen=Tu,exports.ConnectOrCreateScreen=Bh,exports.ConnectPhoneNumberForm=wh,exports.ConnectionLoader=Cr,exports.ConnectionStatusScreen=yc,exports.CopyableText=dl,exports.CopytoClipboardButton=Lg,exports.DEFAULT_API_TIMEOUT_MS=2e4,exports.DEFAULT_PRIVY_API_URL="https://auth.privy.io",exports.DEFAULT_SUCCESS_SCREEN_DURATION_MS=it,exports.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS=at,exports.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS=2500,exports.DEFAULT_TOKENS_DATA=Li,exports.DEPRECATED_REFRESH_TOKEN="deprecated",exports.Discord=ft,exports.EmailUpdateForm=bl,exports.EmbeddedButton=Rr,exports.EmbeddedWalletConnectingScreen=Mg,exports.EmbeddedWalletKeyExportScreen=Ig,exports.EmbeddedWalletOnAccountCreateScreen=tl,exports.ErrorMessage=wl,exports.ErrorScreen=Rs,exports.ErrorScreenView=Ds,exports.EthereumNullConnector=gn,exports.EthereumWalletConnector=un,exports.Farcaster=qp,exports.FarcasterConnectStatusScreen=ih,exports.FundingMethodSelectionScreen=Vp,exports.Github=xt,exports.Google=vt,exports.Grow=ir,exports.HEADLESS_OAUTH_KEY="privy:headless_oauth",exports.Header=Pl,exports.Hide=pr,exports.IDENTITY_TOKEN_COOKIE_KEY="privy-id-token",exports.IDENTITY_TOKEN_STORAGE_KEY="privy:id_token",exports.InjectedWalletIcon=bu,exports.InputContainerForm=kl,exports.Instagram=wt,exports.JUPITER_SWAP_PROGRAM_IDS=["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"],exports.LAMPORTS_PER_SOL=Fi,exports.LabelSm=td,exports.LabelXs=kc,exports.LandingScreen=cg,exports.Line=Ct,exports.LinkConflictScreen=Qs,exports.LinkedIn=bt,exports.Loader=kr,exports.LoginMethodButton=dr,exports.LoginMethodIconWrapper=ur,exports.ManualTransferScreen=zc,exports.Metamask=yn,exports.ModalFooter=wr,exports.ModalHeader=Hr,exports.ModalProvider=t=>{let r=qn(),i=t.authenticated,[a,o]=n.useState(t.initialScreen);n.useEffect((()=>{i||!t.initialScreen||t.initialScreen.isUnauthenticatedScreem||t.setInitialScreen(null)}),[i]);let s=n.useRef(null);n.useEffect((()=>{t.open||(s.current=null)}),[t.open]),n.useEffect((()=>{s.current=null}),[t.initialScreen]);let l={data:t.data,setModalData:t.setModalData,currentScreen:t.initialScreen,lastScreen:a,navigate:(e,n=!0)=>{t.setInitialScreen(e),n&&o(t.initialScreen)},navigateBack:()=>{t.setInitialScreen(a)},resetNavigation:()=>{t.setInitialScreen(null),o(null)},onUserCloseViaDialogOrKeybindRef:s};/*#__PURE__*/return e.jsxs(Qn.Provider,{value:l,children:[("string"==typeof r.appearance.logo||"img"===r.appearance.logo?.type)&&/*#__PURE__*/e.jsx(Kn,{src:"string"==typeof r.appearance.logo?r.appearance.logo:r.appearance.logo.props.src}),t.children]})},exports.MoonpayStatusScreen=Lp,exports.NetworkIcon=qu,exports.NeutralSpinner=Kr,exports.OAUTH_DISABLE_SIGNUP_KEY="privy:oauth_disable_signup",exports.ON_RAMP_COMPLETE_ANALYTICS_EVENT=Wc,exports.OpenLinkButton=Gp,exports.PRIVY_ACCESS_TOKEN_STORAGE_KEY="privy:pat",exports.Phantom=fn,exports.PrimaryButton=Pr,exports.PrivyAppConfigProvider=({children:t,client:r,legacyClient:i,clientConfig:a,appClientId:o})=>{let[s,l]=n.useState(null),c=n.useMemo((()=>zn(s??Hn,a,!!s,"undefined"!=typeof window?window.location.origin:void 0,o)),[s,a,o]);return n.useEffect((()=>{if(!s)return;let e=function(e){if(!e)return{};let{appearance:t,supportedChains:n,defaultChain:r,externalWallets:i,...a}=e;return{...a,...n?{supportedChains:n.map((e=>e.id))}:void 0,...r?{defaultChain:r.id}:void 0,...i?{walletConnect:i.walletConnect?{enabled:i.walletConnect.enabled}:void 0,coinbaseWallet:i.coinbaseWallet,solana:{connectors:i.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0}}(a),t=function(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t,i=0;i<e.length;i++)n=Math.imul(n^(t=e.charCodeAt(i)),2654435761),r=Math.imul(r^t,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&(r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}(JSON.stringify(e)).toString(),n=`privy:sent:${s.id}:${t}`;localStorage.getItem(n)||(i.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(n,"t"))}),[a,s]),n.useEffect((()=>{s||(async()=>{try{await r.initialize();let e=r.app.getConfig();e.custom_api_url&&i.updateApiUrl(e.custom_api_url),l(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),/*#__PURE__*/e.jsx($n.Provider,{value:{appConfig:c,isServerConfigLoaded:!!s},children:t})},exports.PrivyEventsContext=Jn,exports.PrivyIframeError=La,exports.PrivyPluginProvider=({children:t})=>{let r=n.useRef({});/*#__PURE__*/return e.jsx(Jl.Provider,{value:{plugins:r},children:t})},exports.PrivyProviderRpcError=an,exports.PrivyProxyProvider=pn,exports.QrCode=vl,exports.RAYDIUM_SWAP_PROGRAM_IDS=["CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C","CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"],exports.REFRESH_TOKEN_COOKIE_KEY="privy-refresh-token",exports.REFRESH_TOKEN_STORAGE_KEY="privy:refresh_token",exports.RecentlyUsedAccountProvider=({children:t})=>{let r=qn(),[i,a]=n.useState({});return tr("login",{onComplete:({loginAccount:e})=>{e&&"passkey"!==e.type&&"cross_app"!==e.type&&("wallet"!==e.type||"privy"!==e.walletClientType)&&(Ze.put(ns(r.id),e.type),"wallet"===e.type?(Ze.put(rs(r.id),e.walletClientType),Ze.put(is(r.id),e.chainType),a({accountType:e.type,walletClientType:e.walletClientType,chainType:e.chainType})):(Ze.del(rs(r.id)),Ze.del(is(r.id)),a({accountType:e.type})))}}),n.useEffect((()=>{if(!r.id)return;let e=Ze.get(ns(r.id)),t=Ze.get(rs(r.id)),n=Ze.get(is(r.id));e&&a("wallet"===e?{accountType:e,walletClientType:t,chainType:n}:{accountType:e})}),[r.id]),/*#__PURE__*/e.jsx(ts.Provider,{value:i,children:t})},exports.RefactorSpacerBottom=ea,exports.RefactorSpacerTop=Ji,exports.Row=ad,exports.Rows=id,exports.RunEffectOnce=rt,exports.SESSION_COOKIE_KEY="privy-session",exports.SOLANA_FUNDING_PLUGIN_ID=vp,exports.SOLANA_LEDGER_PLUGIN_ID=tc,exports.STATE_CODE_KEY=ot,exports.SYSTEM_PROGRAM_ID="11111111111111111111111111111111",exports.ScreenLayout=bi,exports.ScrollContainer=Ll,exports.SecondaryButton=Fr,exports.SendSolanaTransactionScreenView=({img:t,title:r,subtitle:i,cta:a,instructions:o,network:s,blockExplorerUrl:l,isMissingFunds:d,submitError:u,parseError:p,total:h,swap:g,transactingWalletAddress:m,fee:y,balance:f,disabled:x,isSubmitting:v,isPreparing:w,isTokenPriceLoading:C,onClick:b,onClose:j,onBack:k})=>{let T=w||C,[A,S]=n.useState(!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:j,backFn:k}),t&&/*#__PURE__*/e.jsx(Ed,{children:t}),/*#__PURE__*/e.jsx(jc,{style:{marginTop:t?"1.5rem":0},children:r}),/*#__PURE__*/e.jsx(bc,{children:i}),/*#__PURE__*/e.jsxs(id,{style:{marginTop:"2rem",marginBottom:".5rem"},children:[(h||T)&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsx(ld,{$isLoading:T,children:h})]}),g&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Swap"}),/*#__PURE__*/e.jsx(ld,{children:g})]}),s&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Network"}),/*#__PURE__*/e.jsx(ld,{children:s})]}),(y||T)&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(ld,{$isLoading:T,children:y})]})]}),/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsxs(rd,{onClick:()=>S((e=>!e)),children:[/*#__PURE__*/e.jsx("span",{children:"Advanced"}),/*#__PURE__*/e.jsx(B.ChevronDownIcon,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:A?"rotate(180deg)":void 0}})]})}),A&&/*#__PURE__*/e.jsx(e.Fragment,{children:o.map(((t,n)=>"sol-transfer"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsxs(kc,{children:["Transfer ",t.withSeed?"with seed":""]})}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsxs(ld,{children:[c.formatTokenAmount({amount:t.value,decimals:t.token.decimals})," ",t.token.symbol]})]}),!!t.toAccount&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Destination"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.toAccount,url:l})})]})]},n):"spl-transfer"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsxs(kc,{children:["Transfer ",t.token.symbol]})}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsx(ld,{children:t.value.toString()})]}),!!t.fromAta&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Source"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.fromAta,url:l})})]}),!!t.toAta&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Destination"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.toAta,url:l})})]}),!!t.token.address&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.token.address,url:l})})]})]},n):"ata-creation"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsx(kc,{children:"Create token account"})}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Program ID"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.program,url:l})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Owner"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.owner,url:l})})]})]},n):"create-account"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsxs(kc,{children:["Create account ",t.withSeed?"with seed":""]})}),!!t.account&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Account"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.account,url:l})})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsxs(ld,{children:[c.formatTokenAmount({amount:t.value,decimals:9})," SOL"]})]})]},n):"spl-init-account"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsx(kc,{children:"Initialize token account"})}),!!t.account&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Account"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.account,url:l})})]}),!!t.mint&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Mint"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mint,url:l})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Owner"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.owner,url:l})})]})]},n):"spl-close-account"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsx(kc,{children:"Close token account"})}),!!t.source&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Source"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.source,url:l})})]}),!!t.destination&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Destination"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.destination,url:l})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Owner"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.owner,url:l})})]})]},n):"spl-sync-native"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsx(kc,{children:"Sync native"})}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Program ID"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.program,url:l})})]})]},n):"raydium-swap-base-input"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsxs(kc,{children:["Raydium swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount in"}),/*#__PURE__*/e.jsx(ld,{children:t.amountIn.toString()})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Minimum amount out"}),/*#__PURE__*/e.jsx(ld,{children:t.minimumAmountOut.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:l})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:l})})]})]},n):"raydium-swap-base-output"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsxs(kc,{children:["Raydium swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Max amount in"}),/*#__PURE__*/e.jsx(ld,{children:t.maxAmountIn.toString()})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount out"}),/*#__PURE__*/e.jsx(ld,{children:t.amountOut.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:l})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:l})})]})]},n):"jupiter-swap-shared-accounts-route"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsxs(kc,{children:["Jupiter swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"In amount"}),/*#__PURE__*/e.jsx(ld,{children:t.inAmount.toString()})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Quoted out amount"}),/*#__PURE__*/e.jsx(ld,{children:t.quotedOutAmount.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:l})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:l})})]})]},n):"jupiter-swap-exact-out-route"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(ad,{children:/*#__PURE__*/e.jsxs(kc,{children:["Jupiter swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Quoted in amount"}),/*#__PURE__*/e.jsx(ld,{children:t.quotedInAmount.toString()})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount out"}),/*#__PURE__*/e.jsx(ld,{children:t.outAmount.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:l})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:l})})]})]},n):/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Program ID"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.program,url:l})})]}),/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsx(td,{children:"Data"}),/*#__PURE__*/e.jsx(ld,{children:t.discriminator})]})]},n)))}),/*#__PURE__*/e.jsx(ir,{}),u?/*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:u.message}):p?/*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:Sd}):null,/*#__PURE__*/e.jsx(Td,{$useSmallMargins:!(!p&&!u),title:"Your wallet",address:m,balance:f,errMsg:w||p||u||!d?void 0:"Add funds on Solana to complete transaction."}),/*#__PURE__*/e.jsx(Pr,{style:{marginTop:"1rem"},loading:v,disabled:x||w,onClick:b,children:a}),/*#__PURE__*/e.jsx(xr,{})]})},exports.SendTransactionScreen=hu,exports.SignRequestScreen=Hg,exports.SiweFlow=Et,exports.SiwsFlow=Pt,exports.SolanaNullConnector=An,exports.SolanaPriceDisplay=({quantities:t,tokenPrice:n,tokenSymbol:r="SOL",tokenDecimals:i=9})=>{let a=t.reduce(((e,t)=>e+t),0n),o=n&&"SOL"===r&&9===i?Wi(a,n):void 0,s="SOL"===r&&9===i?Ri(a):`${l.formatUnits(a,i)} ${r}`;/*#__PURE__*/return e.jsx(Ui,{children:o?/*#__PURE__*/e.jsx(e.Fragment,{children:"<$0.01"===o?
27
- /*#__PURE__*/e.jsxs(Vi,{children:[/*#__PURE__*/e.jsx(Hi,{children:"<"}),"$0.01"]}):o}):s})},exports.SolanaWalletConnector=Tn,exports.Spotify=jt,exports.Subtitle=bc,exports.TOKEN_2022_PROGRAM_ID="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",exports.TOKEN_PROGRAM_ID="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",exports.TelegramAuthFlow=class{async authenticate(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(d.telegramAccountAuthenticatePath,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw d.formatApiError(e)}}async link(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(d.telegramAccountLinkPath,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw d.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}},exports.TelegramAuthScreen=Ih,exports.Tiktok=kt,exports.Title=jc,exports.TodoItem=Su,exports.TodoList=Au,exports.TransactionDetails=Ta,exports.TransactionErrorView=_d,exports.TransferFromWalletScreen=bp,exports.Twitter=Tt,exports.UseWalletsContext=Pa,exports.UserLimitReachedScreen=hc,exports.VERSION="3.2.0",exports.Value=ld,exports.WALLET_PROXY_TIMEOUT=3e4,exports.WalletCards=Tl,exports.WalletConnectV2WalletConnector=Zn,exports.WalletConnector=cn,exports.WalletIcon=Ml,exports.WalletInfoCard=Fc,exports.WalletLink=ja,exports.areWalletArraysEqual=ln,exports.close=()=>{let e=Wl.getState().resolvers;e||console.warn("useActiveWalletStore: Called close while modal was not open"),Wl.setState({isModalOpen:!1}),e?.resolve({wallet:Wl.getState().wallet})},exports.convertInitDataRawToTelegramWebAppData=Yt,exports.createCodeVerifier=pt,exports.createStateCode=ht,exports.createWalletAtIndex=Ka,exports.deriveCodeChallengeFromCodeVerifier=gt,exports.detectCompletingTelegramFlow=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),n=e.get("hash"),r=Number(e.get("auth_date")||""),i=e.get("first_name");if(t&&i&&r&&n)return Object.fromEntries(e.entries())}())?(Zt(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=Yt(e.replace("#tgWebAppData=","")),{user:n,auth_date:r,hash:i}=t;return n&&r&&i?t:void 0}())?(Zt(),{flowType:"web-app",authData:e}):void 0},exports.detectInjectedConnectors=async function({store:e,walletList:t,externalWalletConfig:n,walletChainType:r,timeout:i=3e3}){let a=!1,o=window;return new Promise((s=>{function l(){if(a)return;a=!0,window.removeEventListener("ethereum#initialized",l);let i=e.getProviders();console.debug("Detected injected providers:",i.map((e=>e.info)));let o=[];for(let e of i)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===r&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==r)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let n=[];if(t.providers?.length)for(let e of t.providers)e&&n.push(e);return n.push(e.ethereum),n}()){let t=Nt(e);if(!i.some((e=>e.info.name===t))){if(_t(e,!0)&&!o.find((e=>"metamask"===e.type))){o.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!o.find((e=>"phantom"===e.type))){o.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!o.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==n.coinbaseWallet?.config?.preference?.options))){o.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}o.find((e=>"unknown_browser_extension"===e.type))||o.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}s(o)}o.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout((()=>{l()}),i))}))},exports.e=mt,exports.e$1=function(){try{let e="privy:__session_storage__test",t=new Ye;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}},exports.e$2=Ma,exports.e$3=ju,exports.embeddedWalletRecoveryScreen=bg,exports.emitPrivyEvent=nr,exports.errorIndicatesMaxMfaRetries=function(e){return!!Wa(e)&&"mfa_verification_max_attempts_reached"===e.type},exports.errorIndicatesMfaCanceled=function(e){return!!function(e){let t=e.type;return"string"==typeof t&&"client_error"===t}(e)&&"MFA canceled"===e.message},exports.errorIndicatesMfaRateLimit=function(e){return!(!Wa(e)||!e.message.includes("code 429"))},exports.errorIndicatesMfaTimeout=function(e){return!!Wa(e)&&"mfa_timeout"===e.type},exports.errorIndicatesMfaVerificationFailed=function(e){return!!Wa(e)&&"missing_or_invalid_mfa"===e.type},exports.errorIndicatesRecoveryIsNeeded=Da,exports.fetchWalletBalance=Dc,exports.formatChainIdToCAIP2=zt,exports.formatConnectorError=nn,exports.formatErc20TokenAmount=Yc,exports.formatWalletAddress=Dt,exports.generateTypedDataWithDomainType=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},n=e.types.EIP712Domain??Object.entries(e.domain).map((([e,n])=>{if(null!=n&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:n}}},exports.getChainName=Rc,exports.getCodeVerifier=function(){let e=Ze.get(st);if(!e)throw new d.PrivyClientError("Authentication error.");return e},exports.getEntropyDetailsForUser=Qt,exports.getErc20Balance=Bc,exports.getErc20TokenInfo=$c,exports.getFormattedUsdFromLamports=Wi,exports.getGuestCredentialStorageKey=e=>`privy:guest:${e}`,exports.getJsonRpcEndpointFromChain=Lt,exports.getNativeCurrencyFromLamports=Ri,exports.getNativeCurrencyFromWei=Pi,exports.getPrivyWalletsWithFilter=Za,exports.getProviderAccessTokenStorageKey=e=>`privy:cross-app:${e}`,exports.getPublicClient=Ft,exports.getRpcTimeout=dn,exports.getUsdcMintAddress=Oc,exports.getWalletConfigForConnector=wn,exports.i=gu,exports.invokeUntilSettled=Bt,exports.isBaseConnectedEthereumWallet=sn,exports.isBaseConnectedSolanaWallet=function(e){return"solana"===e.type},exports.isEthereumWalletConnector=function(e){return"ethereum"===e.chainType},exports.isSolanaWalletConnector=Sn,exports.l=Hl,exports.loadConnectionHistory=bn,exports.mobileWalletsConfig=vn,exports.open=async()=>{let e,t,n=new Promise(((n,r)=>{e=n,t=r}));return Dl.setState({}),Wl.setState({isModalOpen:!0,resolvers:{resolve:e,reject:t}}),await n},exports.openHref=nt,exports.parseAdditionalSigners=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds}))),exports.prepareSiweMessageWithNonce=St,exports.prepareSiwsMessageWithNonce=It,exports.prepareTransactionRequest=_a,exports.privyEventsDefault={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},connectOrCreateWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},update:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},signTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},fundSolanaWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},exports.randomBytes=ut,exports.s=Ze,exports.setActiveWallet=Rl,exports.setExternalWalletState=In,exports.shouldCreateEmbeddedEthWallet=hs,exports.shouldCreateEmbeddedSolWallet=ms,exports.shouldProceedtoEmbeddedWalletCreationFlow=fs,exports.stripUrlOAuthParamsAndRemoveStateCode=At,exports.toActiveWalletKey=Ol,exports.toDisplayFromAccountType=es,exports.toEmbeddedWalletSetRecoveryScreen=Cg,exports.toHex=e=>"string"==typeof e?e:"0x"+e.toString(16),exports.toSolanaWalletClientType=kn,exports.triggerPopup=Ra,exports.updateBalance=(e,t,n)=>{Dl.setState((r=>({[e]:{...r[e],[t]:n}})))},exports.useActiveWalletStore=Wl,exports.useAppConfig=qn,exports.useBalance=(e,t)=>Dl((n=>n[e]?.[t])),exports.useCaptcha=qt,exports.useEmitPrivyEvent=rr,exports.useGetSolPrice=Ea,exports.useGetTokenPrice=Ia,exports.useIsModalOpen=()=>Wl((e=>e.isModalOpen)),exports.useIsServerConfigLoaded=()=>{let{isServerConfigLoaded:e}=n.useContext($n);return e},exports.usePlugins=ec,exports.usePrivyEventSubscription=tr,exports.usePrivyModal=Xn,exports.useRecentlyUsedLogin=as,exports.useRegisterPlugin=(...e)=>{let{plugins:t}=n.useContext(Jl);n.useEffect((()=>{for(let n of e)t.current[n.id]=n;return()=>{for(let n of e)delete t.current[n.id]}}),[t])},exports.useWalletBalance=Lc,exports.useWallets=Na,exports.validateEmail=Wt;
12
+ /*#__PURE__*/le.default.createElement(t,{width:32,height:32,stroke:(()=>{switch(n){case"success":return"var(--privy-color-icon-success)";case"warning":return"var(--privy-color-icon-warning)";case"error":return"var(--privy-color-icon-error)";default:return"var(--privy-color-icon-muted)"}})(),strokeWidth:2}))});let wa=/*#__PURE__*/i.styled.div.withConfig({displayName:"ActionsContainer",componentId:"sc-cc9e9a32-16"})(["width:100%;display:flex;flex-direction:column;gap:calc(var(--screen-space) / 2);"]),Ca=/*#__PURE__*/i.styled.p.withConfig({displayName:"HelpTextContainer",componentId:"sc-cc9e9a32-17"})(["&&{margin:0;width:100%;text-align:center;color:var(--privy-color-foreground-3);font-size:14px;line-height:22px;& a{color:var(--privy-color-accent);}}"]);const ba=({primaryCta:t,secondaryCta:n,helpText:r,watermark:a=!0,children:i,...o})=>{let s=t||n?/*#__PURE__*/e.jsxs(e.Fragment,{children:[t&&(()=>{let{label:n,...r}=t,a=r.variant||"primary";/*#__PURE__*/return e.jsx(Er,{...r,variant:a,style:{width:"100%",...r.style},children:n})})(),n&&(()=>{let{label:t,...r}=n,a=r.variant||"secondary";/*#__PURE__*/return e.jsx(Er,{...r,variant:a,style:{width:"100%",...r.style},children:t})})()]}):null;/*#__PURE__*/return e.jsxs(ma,{id:o.id,className:o.className,children:[/*#__PURE__*/e.jsx(ma.Header,{...o}),i?/*#__PURE__*/e.jsx(ma.Body,{children:i}):null,r||s||a?/*#__PURE__*/e.jsxs(ma.Footer,{children:[r?/*#__PURE__*/e.jsx(ma.HelpText,{children:r}):null,s?/*#__PURE__*/e.jsx(ma.Actions,{children:s}):null,a?/*#__PURE__*/e.jsx(ma.Watermark,{}):null]}):null]})},ja=({label:t,children:n,valueStyles:r})=>/*#__PURE__*/e.jsxs(ka,{children:[/*#__PURE__*/e.jsx("div",{children:t}),/*#__PURE__*/e.jsx(Ta,{style:{...r},children:n})]});let ka=/*#__PURE__*/i.styled.div.withConfig({displayName:"StyledDetailsRow",componentId:"sc-4ebfdd45-0"})(["display:flex;align-items:center;justify-content:space-between;width:100%;> :first-child{color:var(--privy-color-foreground-3);text-align:left;}> :last-child{color:var(--privy-color-foreground-2);text-align:right;}"]),Ta=/*#__PURE__*/i.styled.div.withConfig({displayName:"ValueWrapper",componentId:"sc-4ebfdd45-1"})(["font-size:14px;line-height:100%;display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-full);background-color:var(--privy-color-background-2);padding:4px 8px;"]),Aa=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),Sa=e=>Aa.format(e);const Ea=(e,t)=>{let n=Sa(t*parseFloat(e));return"$0.00"!==n?n:"<$0.01"},Ia=(e,t)=>{let n=Sa(t*parseFloat(l.formatEther(e)));return"$0.00"===n?"<$0.01":n},Pa=(e,t,n=6,r=!1)=>`${Na(e,n,r)} ${t}`,Na=(e,t=6,n=!1)=>{let r=parseFloat(l.formatEther(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return n?r:`${"0"===r?"<0.001":r}`},_a=e=>e.reduce(((e,t)=>e+t),0n),Ma=(e,t)=>{let{chains:n}=r.usePrivyInternal(),a=`https://etherscan.io/address/${t}`,i=`${((e,t)=>{let n=Number(e),r=t.find((e=>e.id===n));if(!r)throw new d.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url})(e,n)}/address/${t}`;if(!i)return a;try{new URL(i)}catch{return a}return i},Fa=1e9,La={"solana:mainnet":{EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:{symbol:"USDC",decimals:6,address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:{symbol:"USDT",decimals:6,address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},"solana:devnet":{"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU":{symbol:"USDC",decimals:6,address:"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"},EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS:{symbol:"USDT",decimals:6,address:"EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS"},So11111111111111111111111111111111111111112:{symbol:"SOL",decimals:9,address:"So11111111111111111111111111111111111111112"}},"solana:testnet":{}};function Wa(e,t){let n=parseFloat(e.toString())/Fa,r=Da.format(t*n);return"$0.00"===r?"<$0.01":r}let Da=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2});function Ra(e,t=6,n=!1,r=!1){let a=(parseFloat(e.toString())/1e9).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),i=r?"":" SOL";return n?`${a}${i}`:`${"0"===a?"<0.001":a}${i}`}const Oa=({weiQuantities:t,tokenPrice:n,tokenSymbol:r})=>{let a=_a(t),i=n?Ia(a,n):void 0,o=Pa(a,r);/*#__PURE__*/return e.jsx(Ua,{children:i||o})},Ba=({weiQuantities:t,tokenPrice:n,tokenSymbol:r})=>{let a=_a(t),i=n?Ia(a,n):void 0,o=Pa(a,r);/*#__PURE__*/return e.jsx(Ua,{children:i?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(za,{children:"USD"}),"<$0.01"===i?
13
+ /*#__PURE__*/e.jsxs(Va,{children:[/*#__PURE__*/e.jsx(Ha,{children:"<"}),"$0.01"]}):i]}):o})};let Ua=/*#__PURE__*/i.styled.span.withConfig({displayName:"StyledPriceDisplay",componentId:"sc-3cd56c8a-0"})(["font-size:14px;line-height:140%;display:flex;gap:4px;align-items:center;"]),za=/*#__PURE__*/i.styled.span.withConfig({displayName:"StyledPriceUnit",componentId:"sc-3cd56c8a-1"})(["font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);"]),Ha=/*#__PURE__*/i.styled.span.withConfig({displayName:"TinyLessThan",componentId:"sc-3cd56c8a-2"})(["font-size:10px;"]),Va=/*#__PURE__*/i.styled.span.withConfig({displayName:"FlexCenter",componentId:"sc-3cd56c8a-3"})(["display:flex;align-items:center;"]);const $a=/*#__PURE__*/i.styled.div.withConfig({displayName:"BottomPusherContainer",componentId:"sc-cb963810-0"})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;margin-top:auto;gap:16px;flex-grow:100;"]),qa=/*#__PURE__*/i.styled.div.withConfig({displayName:"CenteredItem",componentId:"sc-cb963810-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;flex-grow:1;width:100%;"]),Ga=/*#__PURE__*/i.styled.div.withConfig({displayName:"HorizontallyCenteredItem",componentId:"sc-cb963810-2"})(["display:flex;flex-direction:column;align-items:center;width:100%;"]),Ya=/*#__PURE__*/i.styled(qa).withConfig({displayName:"CenteredItemWithPadding",componentId:"sc-cb963810-3"})(["padding:20px 0;"]),Za=/*#__PURE__*/i.styled(qa).withConfig({displayName:"CenteredItemWithGap",componentId:"sc-cb963810-4"})(["gap:16px;"]),Ka=/*#__PURE__*/i.styled.div.withConfig({displayName:"FlexContainer",componentId:"sc-cb963810-5"})(["display:flex;flex-direction:column;width:100%;"]),Qa=/*#__PURE__*/i.styled.div.withConfig({displayName:"FixedGappedContainer",componentId:"sc-cb963810-6"})(["display:flex;flex-direction:column;gap:8px;"]),Xa=/*#__PURE__*/i.styled.div.withConfig({displayName:"StyledCalloutSection",componentId:"sc-cb963810-8"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;padding:16px;margin-top:16px;margin-bottom:16px;width:100%;background:var(--privy-color-background-2);border-radius:var(--privy-border-radius-md);&& h4{color:var(--privy-color-foreground-3);font-size:14px;text-decoration:underline;font-weight:medium;}&& p{color:var(--privy-color-foreground-3);font-size:14px;}"]),Ja=/*#__PURE__*/i.styled.div.withConfig({displayName:"RefactorSpacerTop",componentId:"sc-cb963810-9"})(["height:16px;"]),ei=/*#__PURE__*/i.styled.div.withConfig({displayName:"RefactorSpacerBottom",componentId:"sc-cb963810-10"})(["height:12px;"]),ti=/*#__PURE__*/i.styled.div.withConfig({displayName:"ConfigurableSpacer",componentId:"sc-cb963810-12"})(["height:","px;"],(e=>e.height??"12")),ni=({gas:t,tokenPrice:n,tokenSymbol:r})=>/*#__PURE__*/e.jsxs(Ka,{style:{paddingBottom:"12px"},children:[/*#__PURE__*/e.jsxs(ai,{children:[/*#__PURE__*/e.jsx(oi,{children:"Est. Fees"}),/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Ba,{weiQuantities:[BigInt(t)],tokenPrice:n,tokenSymbol:r})})]}),n&&/*#__PURE__*/e.jsx(ii,{children:`${Pa(BigInt(t),r)}`})]}),ri=({value:t,gas:n,tokenPrice:r,tokenSymbol:a})=>{let i=BigInt(t??0)+BigInt(n);/*#__PURE__*/return e.jsxs(Ka,{children:[/*#__PURE__*/e.jsxs(ai,{children:[/*#__PURE__*/e.jsx(oi,{children:"Total (including fees)"}),/*#__PURE__*/e.jsx("div",{children:/*#__PURE__*/e.jsx(Ba,{weiQuantities:[BigInt(t||0),BigInt(n)],tokenPrice:r,tokenSymbol:a})})]}),r&&/*#__PURE__*/e.jsx(ii,{children:Pa(i,a)})]})};let ai=/*#__PURE__*/i.styled.div.withConfig({displayName:"TransactionTotalRow",componentId:"sc-f8ef9b74-0"})(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-top:4px;"]),ii=/*#__PURE__*/i.styled.div.withConfig({displayName:"ValueConversionRow",componentId:"sc-f8ef9b74-1"})(["display:flex;flex-direction:row;height:12px;font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);font-weight:400;"]),oi=/*#__PURE__*/i.styled.div.withConfig({displayName:"TotalText",componentId:"sc-f8ef9b74-2"})(["font-size:14px;line-height:22.4px;font-weight:400;"]);const si=/*#__PURE__*/n.createContext(void 0),li=/*#__PURE__*/n.createContext(void 0),ci=({defaultValue:t,children:r})=>{let[a,i]=n.useState(t||null);/*#__PURE__*/return e.jsx(si.Provider,{value:{activePanel:a,togglePanel:e=>{i(a===e?null:e)}},children:/*#__PURE__*/e.jsx(gi,{children:r})})},di=({value:t,children:r})=>{let{activePanel:a,togglePanel:i}=n.useContext(si),o=a===t;/*#__PURE__*/return e.jsx(li.Provider,{value:{onToggle:()=>i(t),value:t},children:/*#__PURE__*/e.jsx(xi,{isActive:o?"true":"false","data-open":String(o),children:r})})},ui=({children:t})=>{let{activePanel:r}=n.useContext(si),{onToggle:a,value:i}=n.useContext(li),o=r===i;/*#__PURE__*/
14
+ return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(mi,{onClick:a,"data-open":String(o),children:[/*#__PURE__*/e.jsx(fi,{children:t}),/*#__PURE__*/e.jsx(Ci,{isactive:o?"true":"false",children:/*#__PURE__*/e.jsx(Ve.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),/*#__PURE__*/e.jsx(yi,{})]})},pi=({children:t})=>{let{activePanel:r}=n.useContext(si),{value:a}=n.useContext(li);/*#__PURE__*/return e.jsx(vi,{"data-open":String(r===a),children:/*#__PURE__*/e.jsx(wi,{children:t})})},hi=({children:t})=>{let{activePanel:r}=n.useContext(si),{value:a}=n.useContext(li);/*#__PURE__*/return e.jsx(wi,{children:"function"==typeof t?t({isActive:r===a}):t})};let gi=/*#__PURE__*/i.styled.div.withConfig({displayName:"AccordionRoot",componentId:"sc-d25f9267-0"})(["display:flex;flex-direction:column;width:100%;gap:8px;"]),mi=/*#__PURE__*/i.styled.div.withConfig({displayName:"AccordionTriggerContainer",componentId:"sc-d25f9267-1"})(["display:flex;justify-content:space-between;align-items:center;width:100%;cursor:pointer;padding-bottom:8px;"]),yi=/*#__PURE__*/i.styled.div.withConfig({displayName:"AccordionDivider",componentId:"sc-d25f9267-2"})(["width:100%;&&{border-top:1px solid;border-color:var(--privy-color-foreground-4);}padding-bottom:12px;"]),fi=/*#__PURE__*/i.styled.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-d25f9267-3"})(["font-size:14px;font-weight:500;line-height:19.6px;width:100%;padding-right:8px;"]),xi=/*#__PURE__*/i.styled.div.withConfig({displayName:"AccordionPanelContainer",componentId:"sc-d25f9267-4"})(["display:flex;flex-direction:column;width:100%;overflow:hidden;padding:12px;&&{border:1px solid;border-color:var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);}"]),vi=/*#__PURE__*/i.styled.div.withConfig({displayName:"AccordionContentContainer",componentId:"sc-d25f9267-5"})(["position:relative;overflow:hidden;transition:max-height 25ms ease-out;&[data-open='true']{max-height:700px;}&[data-open='false']{max-height:0;}"]),wi=/*#__PURE__*/i.styled.div.withConfig({displayName:"ContentWrapper",componentId:"sc-d25f9267-6"})(["display:flex;flex-direction:column;gap:12px;flex:1 1 auto;min-height:1px;"]),Ci=/*#__PURE__*/i.styled.div.withConfig({displayName:"IconWrapper",componentId:"sc-d25f9267-7"})(["transform:",";"],(e=>"true"===e.isactive?"rotate(180deg)":"rotate(0deg)"));function bi(e,t){return`https://explorer.solana.com/account/${e}?chain=${t}`}const ji=t=>/*#__PURE__*/e.jsx(ki,{href:"ethereum"===t.chainType?Ma(t.chainId,t.walletAddress):bi(t.walletAddress,t.chainId),target:"_blank",children:Dt(t.walletAddress)});let ki=/*#__PURE__*/i.styled.a.withConfig({displayName:"StyledLink",componentId:"sc-dd6c0f9f-0"})(["&:hover{text-decoration:underline;}"]);const Ti=({from:t,to:n,txn:r,transactionInfo:a,tokenPrice:i,gas:o,tokenSymbol:s})=>{let l=BigInt(r?.value||0);/*#__PURE__*/
15
+ return e.jsx(ci,{...qn().render.standalone?{defaultValue:"details"}:{},children:/*#__PURE__*/e.jsxs(di,{value:"details",children:[/*#__PURE__*/e.jsx(ui,{children:/*#__PURE__*/e.jsxs(Ai,{children:[/*#__PURE__*/e.jsx("div",{children:a?.title||"Details"}),/*#__PURE__*/e.jsx(Si,{children:/*#__PURE__*/e.jsx(Oa,{weiQuantities:[l],tokenPrice:i,tokenSymbol:s})})]})}),/*#__PURE__*/e.jsxs(pi,{children:[/*#__PURE__*/e.jsx(ja,{label:"From",children:/*#__PURE__*/e.jsx(ji,{walletAddress:t,chainId:r.chainId||1,chainType:"ethereum"})}),/*#__PURE__*/e.jsx(ja,{label:"To",children:/*#__PURE__*/e.jsx(ji,{walletAddress:n,chainId:r.chainId||1,chainType:"ethereum"})}),a&&a.action&&/*#__PURE__*/e.jsx(ja,{label:"Action",children:a.action}),o&&/*#__PURE__*/e.jsx(ni,{value:r.value,gas:o,tokenPrice:i,tokenSymbol:s})]}),/*#__PURE__*/e.jsx(hi,{children:({isActive:t})=>/*#__PURE__*/e.jsx(ri,{value:r.value,displayFee:t,gas:o||"0x0",tokenPrice:i,tokenSymbol:s})})]})})};let Ai=/*#__PURE__*/i.styled.div.withConfig({displayName:"AccordionTriggerContent",componentId:"sc-2eff9f5c-0"})(["display:flex;flex-direction:row;justify-content:space-between;"]),Si=/*#__PURE__*/i.styled.div.withConfig({displayName:"TotalText",componentId:"sc-2eff9f5c-1"})(["flex-shrink:0;padding-left:8px;"]);const Ei=({enabled:e=!0}={})=>{let{showFiatPrices:t,getUsdPriceForSol:a}=r.usePrivyInternal(),[i,o]=n.useState(!0),[s,l]=n.useState(void 0),[c,d]=n.useState(void 0);return n.useEffect((()=>{(async()=>{if(t&&e)try{o(!0);let e=await a();e?d(e):l(Error("Unable to fetch SOL price"))}catch(e){l(e)}finally{o(!1)}else o(!1)})()}),[]),{solPrice:c,isSolPriceLoading:i,solPriceError:s}};function Ii(e){let{tokenPrice:t,isTokenPriceLoading:a,tokenPriceError:i}=(e=>{let{showFiatPrices:t,getUsdTokenPrice:a,chains:i}=r.usePrivyInternal(),[o,s]=n.useState(!0),[l,d]=n.useState(void 0),[u,p]=n.useState(void 0);return n.useEffect((()=>{e||=1;let n=c.addToDefaultChains(i).find((t=>t.id===Number(e)));(async()=>{if(t){if(!n)return s(!1),void d(Error(`Unable to fetch token price on chain id ${e}`));try{s(!0);let e=await a(n);e?p(e):d(Error(`Unable to fetch token price on chain id ${n.id}`))}catch(e){d(e)}finally{s(!1)}}else s(!1)})()}),[e]),{tokenPrice:u,isTokenPriceLoading:o,tokenPriceError:l}})("solana"===e?-1:e),{solPrice:o,isSolPriceLoading:s,solPriceError:l}=Ei({enabled:"solana"===e});return"solana"===e?{tokenPrice:o,isTokenPriceLoading:s,tokenPriceError:l}:{tokenPrice:t,isTokenPriceLoading:a,tokenPriceError:i}}const Pi=/*#__PURE__*/n.createContext(null);function Ni(){let e=n.useContext(Pi);return null===e?(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1}):e}async function _i(e,t,n,r){let a=ee.toViemTransactionSerializable(e),i=await(async()=>r?await r():await t.prepareTransactionRequest({...a,account:{address:n,type:"json-rpc"}}))();return{...i,type:ee.STRING_TO_NUMBER_TXN_TYPE[i.type]}}let Mi=/*#__PURE__*/i.styled.div.withConfig({displayName:"StackedContainer",componentId:"sc-f7e7d474-0"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:82px;> div{position:relative;}> div > span{position:absolute;left:-41px;top:-41px;}> div > :last-child{position:absolute;left:-19px;top:-19px;}"]);const Fi=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];class Li extends Error{constructor(e,t){super(t),this.type=e}}function Wi(e){let t=e.type;return"string"==typeof t&&Fi.includes(t)}function Di(e){return Wi(e)&&"wallet_not_on_device"===e.type}const Ri=()=>window.open(void 0,void 0,Oi({w:440,h:680}));let Oi=({w:e,h:t})=>{let n=void 0!==window.screenLeft?window.screenLeft:window.screenX,r=void 0!==window.screenTop?window.screenTop:window.screenY,a=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(a-e)/2/(a/window.screen.availWidth)+n},top=${(i-t)/2/(i/window.screen.availHeight)+r}`};const Bi=({title:t,description:n,children:r,...a})=>
16
+ /*#__PURE__*/e.jsx(zi,{...a,children:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("h3",{children:t}),"string"==typeof n?/*#__PURE__*/e.jsx("p",{children:n}):n,r]})}),Ui=({title:t,description:n,icon:r,children:a,...i})=>/*#__PURE__*/e.jsxs(Hi,{...i,children:[r||null,/*#__PURE__*/e.jsx("h3",{children:t}),n&&"string"==typeof n?/*#__PURE__*/e.jsx("p",{children:n}):n,a]});let zi=/*#__PURE__*/i.styled.div.withConfig({displayName:"StyledSection",componentId:"sc-523a75d6-1"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;width:100%;margin-bottom:24px;&& h3{font-size:17px;color:var(--privy-color-foreground);}&& p{color:var(--privy-color-foreground-2);font-size:14px;}"]),Hi=/*#__PURE__*/i.styled(zi).withConfig({displayName:"CenteredStyledSection",componentId:"sc-523a75d6-2"})(["align-items:center;text-align:center;gap:16px;h3{margin-bottom:24px;}"]);const Vi=t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 20",...t,children:[/*#__PURE__*/e.jsx("path",{fill:"url(#icloud-gradient)",d:"M12.34 7.315a4.26 4.26 0 0 0-3.707 2.18 2.336 2.336 0 0 0-1.02-.236 2.336 2.336 0 0 0-2.3 1.963 3.217 3.217 0 0 0 1.244 6.181c.135-.001.27-.01.404-.029h8.943c.047.004.094.006.141.007.045-.001.09-.004.135-.007h.214v-.016a2.99 2.99 0 0 0 1.887-.988c.487-.55.757-1.261.757-1.998v-.006a3.017 3.017 0 0 0-.69-1.915 2.992 2.992 0 0 0-1.748-1.034 4.26 4.26 0 0 0-4.26-4.102Z"}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsxs("linearGradient",{id:"icloud-gradient",x1:19.086,x2:3.333,y1:14.38,y2:14.163,gradientUnits:"userSpaceOnUse",children:[/*#__PURE__*/e.jsx("stop",{stopColor:"#3E82F4"}),/*#__PURE__*/e.jsx("stop",{offset:1,stopColor:"#93DCF7"})]})})]}),$i=({style:t,...n})=>/*#__PURE__*/e.jsxs("svg",{width:"16",height:"14",style:t,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:[/*#__PURE__*/e.jsxs("g",{clipPath:"url(#clip0_2115_829)",children:[/*#__PURE__*/e.jsx("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),/*#__PURE__*/e.jsx("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),/*#__PURE__*/e.jsx("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),/*#__PURE__*/e.jsx("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),/*#__PURE__*/e.jsx("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),/*#__PURE__*/e.jsx("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2115_829",children:/*#__PURE__*/e.jsx("rect",{width:"16",height:"14",fill:"white"})})})]});async function qi({url:e,popup:t,provider:n}){return t.location=e,new Promise(((e,n)=>{function r(){t?.close(),window.removeEventListener("message",a)}function a(t){t.data&&("PRIVY_OAUTH_RESPONSE"===t.data.type&&t.data.stateCode&&t.data.authorizationCode&&(e(t.data),r()),"https://cdn.apple-cloudkit.com"===t.origin&&t.data.ckSession&&(e({type:"PRIVY_OAUTH_RESPONSE",ckWebAuthToken:t.data.ckSession}),r()),"PRIVY_OAUTH_ERROR"===t.data.type&&(n(t.data.error),r()))}window.addEventListener("message",a)}))}async function Gi({api:e,provider:t,stateCode:n,codeVerifier:r,authorizationCode:a}){if(!a||!n)throw new d.PrivyClientError("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===a)throw new d.PrivyClientError("User denied confirmation during OAuth flow");try{return(await e.post(d.recoveryOAuthAuthenticatePath,{authorization_code:a,state_code:n,code_verifier:r,provider:t})).access_token}catch(e){let t=d.formatApiError(e);if(t.privyErrorCode)throw new d.PrivyClientError(t.message||"Invalid code during OAuth flow.",void 0,t.privyErrorCode);if("User denied confirmation during OAuth flow"===t.message)throw new d.PrivyClientError("Invalid code during oauth flow.",void 0,d.PrivyErrorCode.OAUTH_USER_DENIED);throw new d.PrivyClientError("Invalid code during OAuth flow.",void 0,d.PrivyErrorCode.UNKNOWN_AUTH_ERROR)}}async function Yi({api:e,provider:t}){let n=pt(),r=ht(),a=await gt(n);try{return"icloud"===t?{url:(await e.post(d.recoveryOAuthInitICloudPath,{client_type:"web"})).url}:{url:(await e.post(d.recoveryOAuthInitPath,{redirect_to:window.location.href,code_challenge:a,state_code:r})).url,codeVerifier:n,stateCode:r,provider:t}}catch(e){throw d.formatApiError(e)}}const Zi=(e,{chainType:t,walletIndex:n}={})=>e?.linkedAccounts.filter((e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==n&&e.walletIndex!==n||void 0!==t&&e.chainType!==t)))??[],Ki=async({user:e,accessToken:t,proxy:n,refreshSessionAndUser:r,privy:i,appConfig:o,recoverEmbeddedWallet:s,setUser:l,walletIndex:d,chainType:u,recoveryMethod:p,recoveryPassword:h,recoveryAccessToken:g})=>{if(0===d)if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await c.create(i,{request:{chain_type:u}});else if("ethereum"===u){let r=a.getPrivySolanaWallet(e);r&&await s({address:r.address}),await n.create({accessToken:t,solanaAddress:r?.address,recoveryMethod:p,recoveryPassword:h,recoveryAccessToken:g})}else{if("solana"!==u)throw Error("Invalid input to create wallet");{let r=a.getPrivyEthereumWallet(e);r&&await s({address:r.address}),await n.createSolana({accessToken:t,ethereumAddress:r?.address,recoveryMethod:p,recoveryPassword:h,recoveryAccessToken:g})}}else if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await c.create(i,{request:{chain_type:u}});else{let{entropyId:r,entropyIdVerifier:a}=Qt(e);await s(),await n.addWallet({accessToken:t,entropyId:r,entropyIdVerifier:a,chainType:u,hdWalletIndex:d})}let m=await r(),y=Zi(m,{chainType:u,walletIndex:d})[0];return l(m),{user:m,account:y}},Qi=()=>{let{walletProxy:e,recoverEmbeddedWallet:t,setUser:n,refreshSessionAndUser:a,privy:i,client:o}=r.usePrivyInternal(),s=qn();return{create:async({walletIndex:r,chainType:l,latestUser:c,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})=>{let h=c;h||(h=await a());let g=await o.getAccessToken();if(!h||!g||!e)throw Error("User must be authenticated before creating a Privy wallet");return await Ki({appConfig:s,user:h,refreshSessionAndUser:a,privy:i,accessToken:g,proxy:e,recoverEmbeddedWallet:t,setUser:n,walletIndex:r,chainType:l,recoveryMethod:d,recoveryPassword:u,recoveryAccessToken:p})}}},Xi=({title:n,description:r,onClose:a})=>/*#__PURE__*/e.jsx(ba,{title:n,subtitle:r,icon:t.CheckCircle,iconVariant:"success",watermark:!0,onBack:a}),Ji={component:()=>{let{user:t}=a.usePrivyContext(),{closePrivyModal:i,isNewUserThisSession:o,updateWallets:s}=r.usePrivyInternal(),{data:l,onUserCloseViaDialogOrKeybindRef:c}=Xn(),d=qn(),{onSuccess:u,onFailure:p,callAuthOnSuccessOnClose:h}=l.createWallet,g=()=>{let e=a.getPrivyEthereumWallet(t)??a.getPrivySolanaWallet(t);t&&e?(s(),u({user:t,account:e})):p(Error("Failed to create wallet")),i({shouldCallAuthOnSuccess:h})};n.useEffect((()=>{let e=setTimeout(g,2500);return()=>clearTimeout(e)}),[]),c.current=g;let m=o?"Welcome"+(d?.name?` to ${d?.name}`:""):"All set!";/*#__PURE__*/return e.jsx(Xi,{title:m,description:o?"You've successfully created an account.":"Your account is secured.",onClose:g})}},eo=/*#__PURE__*/i.styled.div.withConfig({displayName:"RecoveryContainer",componentId:"sc-12b46968-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),to=/*#__PURE__*/i.styled.div.withConfig({displayName:"RecoveryExplainerContainer",componentId:"sc-12b46968-1"})(["padding-bottom:24px;"]);let no={"google-drive":{name:"Google Drive",component:$i},icloud:{name:"iCloud",component:Vi}};const ro={component:()=>{let{logout:t}=a.usePrivyContext(),{navigate:i,setModalData:o,data:s}=Xn(),{closePrivyModal:l,createAnalyticsEvent:c}=r.usePrivyInternal(),{execute:u}=(()=>{let{client:e,walletProxy:t,refreshSessionAndUser:n}=r.usePrivyInternal(),{data:i}=Xn(),{user:o}=a.usePrivyContext(),s=rr(),{create:l}=Qi();return{execute:async({provider:r,action:c,popup:u,shouldCreateEth:p,shouldCreateSol:h})=>{let g,m;if(!e)throw new d.PrivyClientError("Missing client");function y(t){if(!t&&e)throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:r}}),new d.PrivyClientError("Recovery OAuth failed")}switch(r){case"google-drive":{let t,n,{url:a,codeVerifier:i,stateCode:o}=await Yi({api:e.api,provider:r});y(a);try{let i=await qi({url:a,popup:u,provider:r});if(t=i.stateCode,n=i.authorizationCode,t!==o)throw e.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:r,storedStateCode:o??"",returnedStateCode:t??""}}),new d.PrivyClientError("Unexpected auth flow. This may be a phishing attempt.",void 0,d.PrivyErrorCode.OAUTH_UNEXPECTED)}catch(t){throw e.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:t.toString(),provider:r}}),new d.PrivyClientError("Recovery OAuth failed")}[g,m]=await Promise.all([e.getAccessToken(),Gi({api:e.api,provider:r,codeVerifier:i,stateCode:t,authorizationCode:n})]);break}case"icloud":{let{url:t}=await Yi({api:e.api,provider:r});y(t);let{ckWebAuthToken:n}=await qi({url:t,popup:u,provider:r});m=n,g=await e.getAccessToken()}}if(!t)throw new d.PrivyClientError("Cannot connect to wallet proxy");if(!g)throw new d.PrivyClientError("Unable to authorize user");switch(c){case"recover":{let n=i?.recoverWallet?.entropyId,a=i?.recoverWallet?.entropyIdVerifier;if(!n||!a)throw new d.PrivyClientError("Recovery OAuth failed");e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:n,recoveryMethod:r}}),await t.recover({accessToken:g,entropyId:n,entropyIdVerifier:a,recoveryAccessToken:m}),e.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:n,recoveryMethod:r}});break}case"create-wallet":{let t;if(e.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),p&&h)t=await l({recoveryMethod:r,recoveryAccessToken:m,chainType:"ethereum",walletIndex:0,latestUser:o}),t=await l({chainType:"solana",walletIndex:0,latestUser:t.user});else if(h)t=await l({recoveryMethod:r,recoveryAccessToken:m,chainType:"solana",walletIndex:0,latestUser:o});else{if(!p)throw Error("Invalid args to create wallet");t=await l({recoveryMethod:r,recoveryAccessToken:m,chainType:"ethereum",walletIndex:0,latestUser:o})}if(!t)throw s("createWallet","onError",d.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to create wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:t.account.address}}),s("createWallet","onSuccess",{wallet:t.account});break}case"set-recovery":{let i=a.getPrivyPrimaryWallet(o);if(!i)throw s("setWalletRecovery","onError",d.PrivyErrorCode.EMBEDDED_WALLET_NOT_FOUND),Error("Embedded wallet not found");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:i.address,existingRecoveryMethod:i.recoveryMethod,targetRecoveryMethod:r}});let{entropyId:l,entropyIdVerifier:c}=Qt(o);await t.setRecovery({accessToken:g,entropyId:l,entropyIdVerifier:c,recoveryMethod:r,recoveryAccessToken:m});let u=a.getPrivyPrimaryWallet(await n());if(!u)throw s("createWallet","onError",d.PrivyErrorCode.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to set recovery on wallet");e.createAnalyticsEvent({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:i.address,existingRecoveryMethod:i.recoveryMethod,targetRecoveryMethod:r}}),s("setWalletRecovery","onSuccess",{method:r,wallet:u});break}default:throw new d.PrivyClientError("Unsupported recovery action")}}}})(),[p,h]=n.useState(!1),{provider:g,action:m,isInAccountCreateFlow:y,shouldCreateEth:f,shouldCreateSol:x}=s?.recoveryOAuthStatus,[v,w]=n.useState(void 0),[C,b]=n.useState("create-wallet"===m);if("user-passcode"===g)throw Error("RecoveryOAuthScreen should never be called with a wallet that specifies recoveryMethod: `user-passcode`");let j=no[g].name,k=no[g].component,T=s?.recoverWallet?.onCompleteNavigateTo,A=new rt((async(e="create-wallet")=>(b(!0),new Promise(((t,n)=>{setTimeout((async()=>{try{let n=window.open();await u({provider:g,action:e,popup:n,shouldCreateEth:f,shouldCreateSol:x}),h(!0),t()}catch(t){w({message:`${"recover"===e?"Recovery":"Back up"} with ${j} unsuccessful`,detail:"recover"===m?`Please verify that you are selecting the ${j} account associated with your backup.`:"",retryable:!0}),n()}}),0)})))));n.useEffect((()=>{"recover"!==m&&A.execute(y?"create-wallet":"set-recovery")}),[]),n.useEffect((()=>{if(!p)return;let e=setTimeout((()=>{y?(o({createWallet:{onSuccess:()=>{},onFailure:e=>{c({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"RecoveryOAuthScreen"}}),t()},callAuthOnSuccessOnClose:!0,shouldCreateEth:!1,shouldCreateSol:!1}}),i(Ji)):l({shouldCallAuthOnSuccess:!1})}),at);return()=>clearTimeout(e)}),[p]);let S=n.useCallback((async()=>{await A.execute("recover"),T?i(T):h(!0)}),[]),E="google-drive"===g?"Google Drive":"Apple iCloud",I=p&&`Successfully ${"recover"===m?"recovered":"backed up"} with ${E}.`||v&&v.message||`${"recover"===m?"Recovering":"Backing up"} with ${E}...`,P=v?v.detail:"";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{}),C?/*#__PURE__*/e.jsx(e.Fragment,{children:/*#__PURE__*/e.jsxs(eo,{children:[/*#__PURE__*/e.jsx(Ui,{title:I,icon:/*#__PURE__*/e.jsx(k,{style:{width:"38px",height:"38px"}}),description:P}),v&&v?.retryable?/*#__PURE__*/e.jsx(Pr,{onClick:()=>{At(),w(void 0),"create-wallet"===m?A.execute("create-wallet"):S()},disabled:!p&&!v?.retryable,children:"Try again"}):null]})}):/*#__PURE__*/e.jsxs(eo,{children:[/*#__PURE__*/e.jsx(Ui,{title:"Confirm it's really you",icon:/*#__PURE__*/e.jsx(k,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to ${E} where your account is backed up.`}),/*#__PURE__*/e.jsxs(Pr,{onClick:S,children:["Confirm with ",E]})]}),/*#__PURE__*/e.jsx(xr,{})]})}};let ao=/*#__PURE__*/i.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-ccfae04f-0"})(["width:24px;height:24px;display:flex;justify-content:center;align-items:center;"]),io={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy","privy-v2":"Privy"},oo=({onClose:t})=>/*#__PURE__*/e.jsxs(to,{children:[/*#__PURE__*/e.jsx(Ui,{title:"Why do I need to secure my account?",icon:/*#__PURE__*/e.jsx(pe.default,{width:48}),description:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),/*#__PURE__*/e.jsx("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),/*#__PURE__*/e.jsx(Pr,{onClick:t,children:"Select backup method"})]});const so={component:()=>{let[t,i]=n.useState(!1),{navigate:o,lastScreen:s,navigateBack:l,setModalData:c,data:d,onUserCloseViaDialogOrKeybindRef:u}=Xn(),{user:p}=a.usePrivyContext(),{embeddedWallets:h}=qn(),{closePrivyModal:g}=r.usePrivyInternal(),m=a.getPrivyPrimaryWallet(p),y=null===m,{isInAccountCreateFlow:f,isResettingPassword:x,shouldCreateEth:v,shouldCreateSol:w}=d.recoverySelection,C=m&&"privy"!==m.recoveryMethod,b=C?/*#__PURE__*/e.jsxs("span",{children:["Your account is currently secured using"," ",/*#__PURE__*/e.jsx("strong",{children:io[m?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function j(e){c({recoveryOAuthStatus:{provider:e,action:y?"create-wallet":"set-recovery",isInAccountCreateFlow:f,shouldCreateEth:v,shouldCreateSol:w}}),o(ro)}function k(){d?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),g({shouldCallAuthOnSuccess:d?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return u.current=k,/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:k,backFn:t?()=>i(!1):s?l:void 0,infoFn:s||t?void 0:()=>i(!0)},"header"),t?/*#__PURE__*/e.jsx(oo,{onClose:()=>i(!1)}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ui,{title:C?"Update backup method":"Secure your account",icon:/*#__PURE__*/e.jsx(ke.default,{width:48}),description:b}),/*#__PURE__*/e.jsx(eo,{children:h.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(m?.recoveryMethod||"")||e!==m?.recoveryMethod)).sort().map((t=>{switch(t){case"google-drive":/*#__PURE__*/return e.jsxs(dr,{onClick:()=>j("google-drive"),children:[/*#__PURE__*/e.jsx(ao,{children:/*#__PURE__*/e.jsx($i,{style:{width:18}})}),"Back up to Google Drive"]},t);case"icloud":/*#__PURE__*/return e.jsxs(dr,{onClick:()=>j("icloud"),children:[/*#__PURE__*/e.jsx(ao,{children:/*#__PURE__*/e.jsx(Vi,{style:{width:24}})}),"Back up to Apple iCloud"]},t);case"user-passcode":/*#__PURE__*/return e.jsxs(dr,{onClick:()=>{o(wg({isCreatingWallet:y,skipSplashScreen:!0}))},children:[/*#__PURE__*/e.jsx(ao,{children:/*#__PURE__*/e.jsx(Te.default,{style:{width:18}})}),x?"Reset your":"Set a"," password"]},t);default:return null}}))})]}),/*#__PURE__*/e.jsx(xr,{})]})}};let lo=/*#__PURE__*/i.css(["font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;text-align:left;transition:color 0.1s ease-in;"]);const co=/*#__PURE__*/i.styled.span.withConfig({displayName:"StatusText",componentId:"sc-acac4b9-0"})([""," transition:color 0.1s ease-in;color:",";text-transform:",";&[aria-hidden='true']{visibility:hidden;}"],lo,(({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"),(({error:e})=>e?"":"capitalize")),uo=/*#__PURE__*/i.styled.div.withConfig({displayName:"EmbeddedWalletScreenContainer",componentId:"sc-acac4b9-1"})(["display:flex;flex-direction:column;justify-content:center;flex-grow:1;"]),po=/*#__PURE__*/i.styled(Pr).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-acac4b9-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/i.css(["&&{transition:none;}"])));let ho=/*#__PURE__*/i.css(["&&{width:100%;border-width:1px;border-radius:var(--privy-border-radius-md);border-color:var(--privy-color-foreground-3);background:var(--privy-color-background);color:var(--privy-color-foreground);padding:12px;font-size:16px;font-style:normal;font-weight:300;line-height:22px;}"]);const go=/*#__PURE__*/i.styled.input.withConfig({displayName:"PasswordInput",componentId:"sc-acac4b9-3"})([""," &::placeholder{color:var(--privy-color-foreground-3);font-style:italic;font-size:14px;}overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"],ho),mo=/*#__PURE__*/i.styled.div.withConfig({displayName:"PasswordDisplay",componentId:"sc-acac4b9-4"})(["",""],ho),yo=/*#__PURE__*/i.styled.div.withConfig({displayName:"PasswordContainer",componentId:"sc-acac4b9-5"})(["position:relative;width:100%;display:flex;align-items:center;justify-content:",";"],(({centered:e})=>e?"center":"space-between")),fo=/*#__PURE__*/i.styled.div.withConfig({displayName:"Header",componentId:"sc-acac4b9-6"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:32px 0;gap:4px;& h3{font-size:18px;font-style:normal;font-weight:600;line-height:24px;}& p{max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;}"]),xo=/*#__PURE__*/i.styled.div.withConfig({displayName:"Details",componentId:"sc-acac4b9-7"})(["display:flex;flex-direction:column;gap:10px;padding-bottom:1rem;"]),vo=/*#__PURE__*/i.styled.div.withConfig({displayName:"DetailItem",componentId:"sc-acac4b9-8"})(["display:flex;text-align:left;align-items:center;gap:8px;max-width:300px;font-size:14px;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;margin:0 8px;color:var(--privy-color-foreground-2);> :first-child{min-width:24px;}"]),wo=/*#__PURE__*/i.styled(Er).withConfig({displayName:"ExportButton",componentId:"sc-acac4b9-10"})(["display:flex;flex:1;gap:4px;justify-content:center;&&{background:var(--privy-color-background);border-radius:var(--privy-border-radius-md);border-color:var(--privy-color-foreground-3);border-width:1px;}"]),Co=/*#__PURE__*/i.styled.div.withConfig({displayName:"InputRightIcons",componentId:"sc-acac4b9-11"})(["position:absolute;right:0.5rem;display:flex;flex-direction:row;justify-content:space-around;align-items:center;"]),bo=/*#__PURE__*/i.styled(Ae.default).withConfig({displayName:"RegenerateIcon",componentId:"sc-acac4b9-12"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),jo=/*#__PURE__*/i.styled(Ee.default).withConfig({displayName:"HiddenIcon",componentId:"sc-acac4b9-13"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),ko=/*#__PURE__*/i.styled(Se.default).withConfig({displayName:"ShownIcon",componentId:"sc-acac4b9-14"})(["height:1.25rem;width:1.25rem;stroke:var(--privy-color-accent);cursor:pointer;:active{stroke:var(--privy-color-accent-light);}"]),To=/*#__PURE__*/i.styled.progress.withConfig({displayName:"StrengthMeter",componentId:"sc-acac4b9-15"})(["height:4px;width:100%;margin:8px 0;::-webkit-progress-bar{border-radius:8px;background:var(--privy-color-foreground-4);}::-webkit-progress-value{border-radius:8px;transition:all 0.1s ease-out;background:",";}"],(({label:e})=>("Strong"===e?"#78dca6":"Medium"===e&&"var(--privy-color-warn)")||"var(--privy-color-error)")),Ao=({buttonHideAnimations:t,buttonLoading:r,password:a,onSubmit:i,onBack:o})=>{let[s,l]=n.useState(!0),[c,d]=n.useState(!1),[u,p]=n.useState(""),h=a===u;return n.useEffect((()=>{u&&!c&&d(!0)}),[u]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{closeable:!1,backFn:o}),/*#__PURE__*/e.jsx(Ja,{}),/*#__PURE__*/e.jsxs(uo,{children:[/*#__PURE__*/e.jsxs(fo,{children:[/*#__PURE__*/e.jsx(xe.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),/*#__PURE__*/e.jsxs(yo,{children:[/*#__PURE__*/e.jsx(go,{value:u,onChange:e=>p(e.target.value),onKeyUp:e=>{"Enter"===e.key&&i()},onBlur:()=>d(!0),placeholder:"confirm your password",type:s?"password":"text",style:{paddingRight:"2.3rem"}}),/*#__PURE__*/e.jsx(Co,{style:{right:"0.75rem"},children:s?/*#__PURE__*/e.jsx(jo,{onClick:()=>l(!1)}):/*#__PURE__*/e.jsx(ko,{onClick:()=>l(!0)})})]}),
17
+ /*#__PURE__*/e.jsx(co,{"aria-hidden":!c||h,error:!0,children:"Passwords do not match"})]}),/*#__PURE__*/e.jsx(po,{onClick:i,loading:r,disabled:!h,$hideAnimations:t,children:"Continue"}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]})},So=({className:t,checked:n,color:r="var(--privy-color-accent)",...a})=>/*#__PURE__*/e.jsx("label",{children:/*#__PURE__*/e.jsxs(Eo,{className:t,children:[/*#__PURE__*/e.jsx(Po,{checked:n,...a}),/*#__PURE__*/e.jsx(No,{color:r,checked:n,children:/*#__PURE__*/e.jsx(Io,{viewBox:"0 0 24 24",children:/*#__PURE__*/e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})});let Eo=/*#__PURE__*/i.styled.div.withConfig({displayName:"CheckboxContainer",componentId:"sc-db51b935-1"})(["display:inline-block;vertical-align:middle;"]),Io=/*#__PURE__*/i.styled.svg.withConfig({displayName:"Icon",componentId:"sc-db51b935-2"})(["fill:none;stroke:white;stroke-width:3px;"]),Po=/*#__PURE__*/i.styled.input.attrs({type:"checkbox"}).withConfig({displayName:"HiddenCheckbox",componentId:"sc-db51b935-3"})(["border:0;clip:rect(0 0 0 0);clippath:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px;"]),No=/*#__PURE__*/i.styled.div.withConfig({displayName:"StyledCheckbox",componentId:"sc-db51b935-4"})(["display:inline-block;width:18px;height:18px;transition:all 150ms;cursor:pointer;border-color:",";border-radius:3px;background:",";&&{border-width:1px;}",":focus + &{box-shadow:0 0 0 1px ",";}","{visibility:",";}"],(e=>e.color),(e=>e.checked?e.color:"var(--privy-color-background)"),Po,(e=>e.color),Io,(e=>e.checked?"visible":"hidden"));const _o=({buttonHideAnimations:t,buttonLoading:r,onSubmit:a,onBack:i,config:o})=>{let[s,l]=n.useState(!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{closeable:!1,backFn:i}),/*#__PURE__*/e.jsx(Ja,{}),/*#__PURE__*/e.jsxs(uo,{children:[/*#__PURE__*/e.jsxs(fo,{children:[/*#__PURE__*/e.jsx(xe.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),/*#__PURE__*/e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),/*#__PURE__*/e.jsx(xo,{children:/*#__PURE__*/e.jsxs(vo,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:e=>{e.preventDefault(),l((e=>!e))},children:[/*#__PURE__*/e.jsx(So,{color:"var(--privy-color-error)",readOnly:!0,checked:s}),/*#__PURE__*/e.jsx(e.Fragment,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),/*#__PURE__*/e.jsxs(Mo,{children:["user"===o.initiatedBy&&/*#__PURE__*/e.jsx(Fr,{onClick:o.onCancel,disabled:r,children:"Cancel"}),/*#__PURE__*/e.jsx(po,{onClick:a,loading:r,$hideAnimations:t,disabled:!s,children:"Set Password"})]}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]})};let Mo=/*#__PURE__*/i.styled.div.withConfig({displayName:"ButtonsContainer",componentId:"sc-d1659c5f-0"})(["display:flex;gap:10px;"]),Fo=/[a-z]/,Lo=/[A-Z]/,Wo=/[0-9]/,Do="!@#$%^&*()\\-_+.",Ro=`a-zA-Z0-9${Do}`,Oo=RegExp(`[${Do}]`),Bo=RegExp(`[${Ro}]`);const Uo=RegExp(`^[${Ro}]{6,}$`),zo=()=>je.generatePassphrase(4,A.DEFAULT_WORDLIST);function Ho(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Vo(e=""){return(.3*function(e){if(e.length<8)return 0;let t=0;return Fo.test(e)&&(t+=1),Lo.test(e)&&(t+=1),Wo.test(e)&&(t+=1),Oo.test(e)&&(t+=1),Math.max(0,Math.min(1,t/3))}(e)+be.default(e)/95)/2}const $o=({buttonHideAnimations:t,buttonLoading:r,password:a="",config:i,isResettingPassword:o,onSubmit:s,onClose:l,onBack:c,onPasswordChange:d,onPasswordGenerate:u})=>{let[p,h]=n.useState(!1),[g,m]=n.useState(!1);n.useEffect((()=>{a&&!g&&m(!0)}),[a]);let y=n.useMemo((()=>g?6>(a?.length||0)?"Password must be at least 6 characters":Uo.test(a||"")?null:`Invalid characters used ( ${((e="")=>[...new Set(e.split("").filter((e=>!Bo.test(e))).map((e=>e.replace(" ","SPACE"))))])(a).join(" ")} )`:null),[a,g]),f=n.useMemo((()=>y?{value:0,label:"Weak"}:function(e=""){let t=Vo(e);return{value:t,label:Ho(t)}}(a)),[a,y]),x=n.useMemo((()=>!a?.length||!!y),[y,a]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:l,closeable:"user"===i.initiatedBy,backFn:c}),/*#__PURE__*/e.jsx(Ja,{}),/*#__PURE__*/e.jsxs(uo,{children:[/*#__PURE__*/e.jsxs(fo,{children:[/*#__PURE__*/e.jsx(Ie.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),/*#__PURE__*/e.jsxs("h3",{style:{color:"var(--privy-color-foreground)"},children:[o?"Reset":"Set"," your password"]}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),/*#__PURE__*/e.jsxs(yo,{children:[/*#__PURE__*/e.jsx(go,{value:a,onChange:e=>d(e.target.value),onKeyUp:e=>{"Enter"===e.key&&s()},placeholder:"enter or generate a strong password",type:p?"password":"text",style:{paddingRight:"3.8rem"}}),/*#__PURE__*/e.jsxs(Co,{style:{width:"3.5rem"},children:[p?/*#__PURE__*/e.jsx(jo,{onClick:()=>h(!1)}):/*#__PURE__*/e.jsx(ko,{onClick:()=>h(!0)}),/*#__PURE__*/e.jsx(bo,{onClick:u})]})]}),/*#__PURE__*/e.jsx(To,{value:0===f.value?.01:f.value,label:f.label}),/*#__PURE__*/e.jsx(co,{error:!!y,children:y||`Password Strength: ${g?f.label:"--"}`}),/*#__PURE__*/e.jsxs(Go,{children:[/*#__PURE__*/e.jsx(qo,{children:/*#__PURE__*/e.jsxs(xo,{children:[/*#__PURE__*/e.jsxs(vo,{children:[/*#__PURE__*/e.jsx(Pe.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),/*#__PURE__*/e.jsxs(vo,{children:[/*#__PURE__*/e.jsx(Pe.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),/*#__PURE__*/e.jsx(po,{onClick:s,loading:r,disabled:x,$hideAnimations:t,children:"Continue"})]})]}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]})};let qo=/*#__PURE__*/i.styled(xo).withConfig({displayName:"DetailsContainer",componentId:"sc-2da5fe90-0"})(["flex:1;padding-top:1rem;"]),Go=/*#__PURE__*/i.styled.div.withConfig({displayName:"LowerContainer",componentId:"sc-2da5fe90-1"})(["display:flex;flex-direction:column;height:100%;"]);const Yo=({buttonHideAnimations:t,buttonLoading:r,appName:a,password:i,onSubmit:o,onBack:s})=>{let[l,c]=n.useState(!1),[d,u]=n.useState(!0),p=n.useCallback((()=>{c(!0),i&&navigator.clipboard.writeText(i)}),[i]),h=n.useCallback((()=>{let e=document.createElement("a"),t=a.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),n=new Blob([Zo(a,i)],{type:"text/plain"}),r=URL.createObjectURL(n);e.href=r,e.target="_blank",e.download=`${t}-privy-wallet-recovery.txt`,document.body.appendChild(e),e.click(),setTimeout((()=>{e.remove(),URL.revokeObjectURL(r)}),5e3)}),[i]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{backFn:s,closeable:!1}),/*#__PURE__*/e.jsx(Ja,{}),/*#__PURE__*/e.jsxs(uo,{children:[/*#__PURE__*/e.jsxs(fo,{children:[/*#__PURE__*/e.jsx(xe.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),/*#__PURE__*/e.jsx("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),/*#__PURE__*/e.jsx("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),/*#__PURE__*/e.jsxs(yo,{centered:!0,children:[/*#__PURE__*/e.jsx(mo,{children:d?"•".repeat(i.length):i}),/*#__PURE__*/e.jsx(Co,{style:{right:"0.75rem"},children:d?/*#__PURE__*/e.jsx(jo,{onClick:()=>u(!1)}):/*#__PURE__*/e.jsx(ko,{onClick:()=>u(!0)})})]}),/*#__PURE__*/e.jsxs("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[/*#__PURE__*/e.jsx(wo,{onClick:p,children:l?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(_e.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Me.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),/*#__PURE__*/e.jsxs(wo,{onClick:h,children:[/*#__PURE__*/e.jsx(Ne.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),/*#__PURE__*/e.jsx(po,{onClick:o,loading:r,$hideAnimations:t,children:"Continue"}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]})};let Zo=(e,t)=>`Your wallet recovery password for ${e} is\n\n${t}\n\nYou will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;const Ko=({error:t,onClose:n})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{closeable:!1}),/*#__PURE__*/e.jsx(Ja,{}),t?/*#__PURE__*/e.jsxs(Za,{children:[/*#__PURE__*/e.jsx(Fe.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ui,{title:"Something went wrong",description:t})]}):/*#__PURE__*/e.jsxs(Za,{children:[/*#__PURE__*/e.jsx(Pe.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ui,{title:"Success"})]}),/*#__PURE__*/e.jsx(Pr,{onClick:n,children:"Close"}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]});let Qo=(e,t)=>{switch(e){case"creating":return"back"===t?e:"saving";case"saving":return"back"===t?"creating":"confirming";case"confirming":return"back"===t?"saving":"finalizing";case"finalizing":return"back"===t?"confirming":"done";default:return e}};const Xo=({onSubmit:t,...r})=>{let{lastScreen:a,navigate:i}=Xn(),{send:o,state:s}=(()=>{let[e,t]=n.useReducer(Qo,"creating");return{send:t,state:e}})(),l=n.useCallback((async()=>{"finalizing"===s&&await t(),o("next")}),[s,o,t]);n.useEffect((()=>{let e;return"done"===s&&"automatic"===r.config.initiatedBy&&(e=setTimeout((()=>r.onClose?.()),at)),()=>{e&&clearTimeout(e)}}),[s,r.config.initiatedBy,r.onClose]);let c=n.useCallback((()=>{o("back")}),[o]),d=n.useCallback((()=>{i(so)}),[a,i]);return"creating"===s?/*#__PURE__*/e.jsx($o,{...r,onSubmit:l,onBack:a===so?d:void 0}):"saving"===s?/*#__PURE__*/e.jsx(Yo,{...r,onSubmit:l,onBack:c}):"confirming"===s?/*#__PURE__*/e.jsx(Ao,{...r,onSubmit:l,onBack:c}):"finalizing"===s?/*#__PURE__*/e.jsx(_o,{...r,onSubmit:l,onBack:c}):"done"===s?/*#__PURE__*/e.jsx(Ko,{...r,onSubmit:l}):null};let Jo={apple_oauth:"apple",custom_auth:"custom",discord_oauth:"discord",email:"email",farcaster:"farcaster",github_oauth:"github",google_oauth:"google",instagram_oauth:"instagram",linkedin_oauth:"linkedin",passkey:"passkey",phone:"sms",spotify_oauth:"spotify",telegram:"telegram",tiktok_oauth:"tiktok",line_oauth:"line",twitter_oauth:"twitter",wallet:"siwe",smart_wallet:"siwe",cross_app:"privy:"};const es=e=>{if(a.isCustomOAuthProvider(e))return{displayName:e.replace("custom:",""),loginMethod:"custom"};let t=Jo[e];return"wallet"===e||"phone"===e?{displayName:e,loginMethod:t}:{displayName:t,loginMethod:t}};let ts=/*#__PURE__*/n.createContext({});let ns=e=>`privy:${e}:recent-login-method`,rs=e=>`privy:${e}:recent-login-wallet-client`,as=e=>`privy:${e}:recent-login-chain-type`;const is=()=>n.useContext(ts),os=()=>{let t=qn(),n=t?.appearance?.logo,r=`${t?.name} logo`,a={maxHeight:"90px",maxWidth:"180px"};return n?"string"==typeof n?/*#__PURE__*/e.jsx("img",{src:n,alt:r,style:a}):"svg"===n.type||"img"===n.type?/*#__PURE__*/le.default.cloneElement(n,{alt:r,style:a}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null},ss=t=>{let n=qn();return n?.appearance.logo?/*#__PURE__*/e.jsx(ls,{...t,children:/*#__PURE__*/e.jsx(os,{})}):null},ls=/*#__PURE__*/i.styled.div.withConfig({displayName:"AppLogoContainer",componentId:"sc-b210074-0"})(["display:flex;flex-direction:column;align-items:center;padding:24px 0;flex-grow:1;justify-content:center;"]),cs=({name:t,logoUrl:n,size:r="38px"})=>{let a=`${t??"Provider app"} logo`;return"string"==typeof n?/*#__PURE__*/e.jsx("img",{src:n,alt:a,style:{width:r,height:r,maxHeight:"90px",maxWidth:"180px",borderRadius:"8px"}}):
18
+ /*#__PURE__*/e.jsx("span",{})},ds=({appId:t})=>{let[i,o]=n.useState(void 0),{startCrossAppAuthFlow:s,authenticated:l}=a.usePrivyContext(),{client:c}=r.usePrivyInternal();return n.useEffect((()=>{(async()=>{c&&o(await c.getCrossAppProviderDetails(t))})()}),[c]),/*#__PURE__*/e.jsx(dr,{onClick:()=>s({appId:t,action:l?"link":"login"}),disabled:!i,children:i?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(cs,{name:i.name,logoUrl:i.icon_url||void 0,size:"24px"})," ",i.name]}):/*#__PURE__*/e.jsx(Ar,{})})};let us=/*#__PURE__*/i.styled.a.withConfig({displayName:"StyledLink",componentId:"sc-c8577138-0"})(["&&{color:",";font-weight:400;text-decoration:",";text-underline-offset:4px;text-decoration-thickness:1px;cursor:",";opacity:",";font-size:",";line-height:",";transition:color 200ms ease,text-decoration-color 200ms ease,opacity 200ms ease;&:hover{color:",";text-decoration:",";text-underline-offset:4px;}&:active{color:",";}&:focus{outline:none;box-shadow:0 0 0 3px #949df9;border-radius:2px;}}"],(({$variant:e})=>"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))"),(({$variant:e})=>"underlined"===e?"underline":"var(--privy-link-navigation-decoration, none)"),(({$disabled:e})=>e?"not-allowed":"pointer"),(({$disabled:e})=>e?.5:1),(({$size:e})=>{switch(e){case"xs":return"12px";case"sm":return"14px";default:return"16px"}}),(({$size:e})=>{switch(e){case"xs":return"18px";case"sm":return"22px";default:return"24px"}}),(({$variant:e,$disabled:t})=>"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))"),(({$disabled:e})=>e?"none":"underline"),(({$variant:e,$disabled:t})=>t?"underlined"===e?"var(--privy-color-foreground)":"var(--privy-link-navigation-color, var(--privy-color-accent))":"var(--privy-color-foreground)"));const ps=({size:t="md",variant:n="navigation",disabled:r=!1,as:a,children:i,onClick:o,...s})=>/*#__PURE__*/e.jsx(us,{as:a,$size:t,$variant:n,$disabled:r,onClick:e=>{r?e.preventDefault():o?.(e)},...s,children:i}),hs=(e,t)=>!a.getPrivyEthereumWallet(e)&&("all-users"===t||"users-without-wallets"===t&&!gs(e).length);let gs=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"ethereum"===e.chainType));const ms=(e,t)=>!a.getPrivySolanaWallet(e)&&("all-users"===t||"users-without-wallets"===t&&!ys(e).length);let ys=e=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"solana"===e.chainType));const fs=(e,t)=>hs(e,t.ethereum.createOnLogin)||ms(e,t.solana.createOnLogin),xs=({title:n="Account not found",subtitle:r,appName:a="this app",ctaText:i="Try logging in again",onRetry:o})=>/*#__PURE__*/e.jsx(ba,{title:n,subtitle:r||`Please try logging in again or go to ${a} to create an account.`,icon:t.HelpCircle,iconVariant:"warning",primaryCta:{label:i,onClick:o},watermark:!0}),vs={component:()=>{let{navigate:t,setModalData:n,data:a}=Xn(),i=qn(),{getAuthMeta:o,client:s}=r.usePrivyInternal();/*#__PURE__*/return e.jsx(xs,{appName:i?.name,onRetry:()=>{let e=o();n({...a,login:{...a?.login,...e?.disableSignup?{disableSignup:!0}:{}}}),s?.authFlow&&(s.authFlow=void 0),t(cg)}})}},ws=/*#__PURE__*/i.styled.span.withConfig({displayName:"CircleBorder",componentId:"sc-9056b8b8-0"})(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:",";border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1.2s linear infinite;transition:border-color 800ms;border-bottom-color:",";}"],(e=>e.color??"var(--privy-color-accent)"),(e=>e.color??"var(--privy-color-accent)")),Cs=({address:r,showCopyIcon:a,url:i,className:o})=>{let[s,l]=n.useState(!1);function c(e){e.stopPropagation(),navigator.clipboard.writeText(r).then((()=>l(!0))).catch(console.error)}return n.useEffect((()=>{if(s){let e=setTimeout((()=>l(!1)),3e3);return()=>clearTimeout(e)}}),[s]),i?/*#__PURE__*/e.jsxs(bs,{children:[/*#__PURE__*/e.jsx(ks,{title:r,className:o,href:`${i}/address/${r}`,target:"_blank",children:Dt(r)}),a&&/*#__PURE__*/e.jsx(Fr,{onClick:c,size:"sm",style:{gap:"0.375rem"},children:s?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(t.Check,{size:16})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(t.Copy,{size:16})]})})]}):/*#__PURE__*/e.jsxs(bs,{children:[/*#__PURE__*/e.jsx(js,{title:r,className:o,children:Dt(r)}),a&&/*#__PURE__*/e.jsx(Fr,{onClick:c,size:"sm",style:{gap:"0.375rem",fontSize:"14px"},children:s?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(t.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(t.Copy,{size:14})]})})]})};let bs=/*#__PURE__*/i.styled.span.withConfig({displayName:"AddressContainer",componentId:"sc-3a987cc8-0"})(["display:inline-flex;align-items:center;gap:0.5rem;"]),js=/*#__PURE__*/i.styled.span.withConfig({displayName:"AddressText",componentId:"sc-3a987cc8-1"})(["font-size:14px;font-weight:500;color:var(--privy-color-foreground);"]),ks=/*#__PURE__*/i.styled.a.withConfig({displayName:"AddressLink",componentId:"sc-3a987cc8-2"})(["font-size:14px;color:var(--privy-color-foreground);text-decoration:none;&:hover{text-decoration:underline;}"]);function Ts(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...t,children:[/*#__PURE__*/e.jsx("circle",{cx:"12",cy:"12",r:"10"}),/*#__PURE__*/e.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),/*#__PURE__*/e.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}const As=792703809,Ss="11111111111111111111111111111111";let Es="0x0000000000000000000000000000000000000000";const Is=({originCurrency:e,destinationCurrency:t,...n})=>({tradeType:"EXPECTED_OUTPUT",originCurrency:e??Es,destinationCurrency:t??Es,...n});let Ps="https://api.relay.link",Ns="https://api.testnets.relay.link";const _s=async({input:e,isTestnet:t})=>{let n=await fetch((t?Ns:Ps)+"/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await n.json();if(!(n.ok||"string"==typeof r.message&&r.message.startsWith("Invalid address")))throw console.error("Relay error:",r),Error(r.message??"Error fetching quote from relay");return r},Ms=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}};async function Fs({transactionHash:e,isTestnet:t}){let n=await fetch((t?Ns:Ps)+"/requests/v2?hash="+e),r=await n.json();if(!n.ok){if("message"in r&&"string"==typeof r.message)throw Error(r.message);throw Error("Error fetching request from relay")}return r.requests.at(0)?.status??"pending"}function Ls({transactionHash:e,isTestnet:t,bridgingStatus:r,setBridgingStatus:a,onSuccess:i,onFailure:o}){n.useEffect((()=>{if(e&&r){if(["delayed","waiting","pending"].includes(r)){let n=setInterval((async()=>{try{let n=await Fs({transactionHash:e,isTestnet:t});a(n)}catch(e){console.error(e)}}),1e3);return()=>clearInterval(n)}"success"===r?i({transactionHash:e}):["refund","failure"].includes(r)&&o({error:new Ws(e,t)})}}),[r,e,t])}class Ws extends d.PrivyClientError{constructor(e,t){super("We were unable to complete the bridging transaction. Funds will be refunded on your wallet.",void 0,d.PrivyErrorCode.TRANSACTION_FAILURE),this.relayLink=t?`https://testnets.relay.link/transaction/${e}`:`https://relay.link/transaction/${e}`}}const Ds=({error:n,allowlistConfig:r,onRetry:a,onCaptchaReset:i,onBack:o})=>{let s=((n,r)=>{if(n instanceof Ws)return{title:"Transaction failed",detail:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("span",{children:n.message}),/*#__PURE__*/e.jsxs("span",{children:[" ","Check the"," ",/*#__PURE__*/e.jsx(Os,{href:n.relayLink,target:"_blank",children:"refund status"}),"."]})]}),ctaText:"Try again",icon:t.AlertTriangle};if(n instanceof d.PrivyClientError)switch(n.privyErrorCode){case d.PrivyErrorCode.CLIENT_REQUEST_TIMEOUT:return{title:"Timed out",detail:n.message,ctaText:"Try again",icon:t.AlertTriangle};case d.PrivyErrorCode.INSUFFICIENT_BALANCE:return{title:"Insufficient balance",detail:n.message,ctaText:"Try again",icon:t.AlertTriangle};case d.PrivyErrorCode.TRANSACTION_FAILURE:return{title:"Transaction failure",detail:n.message,ctaText:"Try again",icon:t.AlertTriangle};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t.AlertTriangle}}else{if(n instanceof Li&&"twilio_verification_failed"===n.type)return{title:"Something went wrong",detail:n.message,ctaText:"Try again",icon:t.Phone};if(!(n instanceof d.PrivyError))return n instanceof d.PrivyApiError&&n.status&&[400,422].includes(n.status)?{title:"Something went wrong",detail:n.message,ctaText:"Try again",icon:t.AlertTriangle}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t.AlertTriangle};switch(n.privyErrorCode){case d.PrivyErrorCode.INVALID_CAPTCHA:return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t.AlertTriangle};case d.PrivyErrorCode.DISALLOWED_LOGIN_METHOD:return{title:"Not allowed",detail:n.message,ctaText:"Try another method",icon:t.AlertTriangle};case d.PrivyErrorCode.ALLOWLIST_REJECTED:return{title:r.errorTitle||"You don't have access to this app",detail:r.errorDetail||"Have you been invited?",ctaText:r.errorCtaText||"Try another account",icon:t.Lock};case d.PrivyErrorCode.CAPTCHA_FAILURE:return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:null};case d.PrivyErrorCode.CAPTCHA_TIMEOUT:return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:null};case d.PrivyErrorCode.LINKED_TO_ANOTHER_USER:return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t.AlertTriangle};case d.PrivyErrorCode.NOT_SUPPORTED:return{title:"This region is not supported",detail:"SMS authentication from this region is not available",ctaText:"Try another method",icon:t.AlertTriangle};case d.PrivyErrorCode.TOO_MANY_REQUESTS:return{title:"Request failed",detail:"Too many attempts.",ctaText:"Try again later",icon:t.AlertTriangle};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t.AlertTriangle}}}})(n,r);/*#__PURE__*/return e.jsx(ba,{title:s.title,subtitle:s.detail,icon:s.icon,onBack:o,iconVariant:"error",primaryCta:{label:s.ctaText,onClick:()=>{n instanceof d.PrivyError&&(n.privyErrorCode===d.PrivyErrorCode.INVALID_CAPTCHA&&i?.(),n.privyErrorCode===d.PrivyErrorCode.ALLOWLIST_REJECTED&&r.errorCtaLink)?window.location.href=r.errorCtaLink:a?.()},variant:"error"},watermark:!0})},Rs={component:()=>{let{navigate:t,data:n,lastScreen:r,currentScreen:a}=Xn(),i=qn(),{reset:o}=qt(),s=n?.errorModalData?.previousScreen||(r===a?void 0:r);/*#__PURE__*/return e.jsx(Ds,{error:n?.errorModalData?.error||Error(),allowlistConfig:i.allowlistConfig,onRetry:()=>{t(s||cg,!1)},onCaptchaReset:o})}};let Os=/*#__PURE__*/i.styled.a.withConfig({displayName:"Link",componentId:"sc-e29a7de8-0"})(["color:var(--privy-color-accent) !important;font-weight:600;"]);const Bs=({onTransfer:t,isTransferring:n,transferSuccess:r})=>/*#__PURE__*/e.jsx(Pr,{...r?{success:!0,children:"Success!"}:{warn:!0,loading:n,onClick:t,children:"Transfer and delete account"}}),Us=/*#__PURE__*/i.styled.div.withConfig({displayName:"ConnectContainer",componentId:"sc-3505eb4c-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;width:100%;padding-bottom:16px;"]),zs=/*#__PURE__*/i.styled.div.withConfig({displayName:"GappedContainer",componentId:"sc-3505eb4c-1"})(["display:flex;flex-direction:column;&& p{font-size:14px;}width:100%;gap:16px;"]),Hs=/*#__PURE__*/i.styled.div.withConfig({displayName:"DisclosedAccountContainer",componentId:"sc-3505eb4c-2"})(["display:flex;cursor:pointer;align-items:center;width:100%;border:1px solid var(--privy-color-foreground-4) !important;border-radius:var(--privy-border-radius-md);padding:8px 10px;font-size:14px;font-weight:500;gap:8px;"]),Vs=/*#__PURE__*/i.styled(we.default).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-3505eb4c-3"})(["position:relative;width:",";height:",";color:var(--privy-color-foreground-3);margin-left:auto;"],(({$iconSize:e})=>`${e}px`),(({$iconSize:e})=>`${e}px`)),$s=/*#__PURE__*/i.styled(Ce.default).withConfig({displayName:"StyledCopyIcon",componentId:"sc-3505eb4c-4"})(["position:relative;width:15px;height:15px;color:var(--privy-color-foreground-3);margin-left:auto;"]),qs=/*#__PURE__*/i.styled.ol.withConfig({displayName:"ListContainer",componentId:"sc-3505eb4c-5"})(["display:flex;flex-direction:column;font-size:14px;width:100%;text-align:left;"]),Gs=/*#__PURE__*/i.styled.li.withConfig({displayName:"ListItem",componentId:"sc-3505eb4c-6"})(["font-size:14px;list-style-type:auto;list-style-position:outside;margin-left:1rem;margin-bottom:0.5rem;&:last-child{margin-bottom:0;}"]),Ys=/*#__PURE__*/i.styled.div.withConfig({displayName:"CircleContainer",componentId:"sc-3505eb4c-7"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]);let Zs=()=>/*#__PURE__*/e.jsx(Ys,{children:/*#__PURE__*/e.jsx(Vs,{$iconSize:60})});const Ks=({address:t,onClose:n,onRetry:r,onTransfer:a,isTransferring:i,transferSuccess:o})=>{let{defaultChain:s}=qn(),l=s.blockExplorers?.default.url??"https://etherscan.io";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:n,backFn:r}),/*#__PURE__*/e.jsxs(Us,{children:[/*#__PURE__*/e.jsx(Zs,{}),/*#__PURE__*/e.jsxs(zs,{children:[/*#__PURE__*/e.jsx("h3",{children:"Check account assets before transferring"}),/*#__PURE__*/e.jsx("p",{children:"Before transferring, ensure there are no assets in the other account. Assets in that account will not transfer automatically and may be lost."}),/*#__PURE__*/e.jsxs(qs,{children:[/*#__PURE__*/e.jsx("p",{children:" To check your balance, you can:"}),/*#__PURE__*/e.jsx(Gs,{children:"Log out and log back into the other account, or "}),/*#__PURE__*/e.jsxs(Gs,{children:["Copy your wallet address and use a"," ",/*#__PURE__*/e.jsx("u",{children:/*#__PURE__*/e.jsx("a",{target:"_blank",href:l,children:"block explorer"})})," ","to see if the account holds any assets."]})]}),/*#__PURE__*/e.jsxs(Hs,{onClick:()=>navigator.clipboard.writeText(t).catch(console.error),children:[/*#__PURE__*/e.jsx(ve.default,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/e.jsx(Cs,{address:t,showCopyIcon:!1}),/*#__PURE__*/e.jsx($s,{})]}),/*#__PURE__*/e.jsx(Bs,{onTransfer:a,isTransferring:i,transferSuccess:o})]})]}),/*#__PURE__*/e.jsx(xr,{})]})},Qs={component:()=>{let{initiateAccountTransfer:t,closePrivyModal:a}=r.usePrivyInternal(),{data:i,navigate:o,lastScreen:s,setModalData:l}=Xn(),[c,d]=n.useState(void 0),[u,p]=n.useState(!1),[h,g]=n.useState(!1),m=async()=>{try{if(!i?.accountTransfer?.nonce||!i?.accountTransfer?.account)throw Error("missing account transfer inputs");g(!0),await t({nonce:i?.accountTransfer?.nonce,account:i?.accountTransfer?.account,accountType:i?.accountTransfer?.linkMethod,externalWalletMetadata:i?.accountTransfer?.externalWalletMetadata,telegramWebAppData:i?.accountTransfer?.telegramWebAppData,telegramAuthResult:i?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:i?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:i?.accountTransfer?.oAuthUserInfo}),p(!0),g(!1),setTimeout(a,1e3)}catch(e){l({errorModalData:{error:e,previousScreen:s||Qs}}),o(Rs,!0)}};return c?/*#__PURE__*/e.jsx(Ks,{address:c,onClose:a,onRetry:()=>d(void 0),onTransfer:m,isTransferring:h,transferSuccess:u}):/*#__PURE__*/e.jsx(Xs,{onClose:a,onInfo:()=>d(i?.accountTransfer?.embeddedWalletAddress),onContinue:()=>d(i?.accountTransfer?.embeddedWalletAddress),onTransfer:m,isTransferring:h,transferSuccess:u,data:i})}},Xs=({onClose:t,onContinue:n,onInfo:r,onTransfer:a,transferSuccess:i,isTransferring:o,data:s})=>{if(!s?.accountTransfer?.linkMethod||!s?.accountTransfer?.displayName)return;let l={method:s?.accountTransfer?.linkMethod,handle:s?.accountTransfer?.displayName,disclosedAccount:s?.accountTransfer?.embeddedWalletAddress?{type:"wallet",handle:s?.accountTransfer?.embeddedWalletAddress}:void 0};/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{closeable:!0}),/*#__PURE__*/e.jsxs(Us,{children:[/*#__PURE__*/e.jsx(Mi,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx(ws,{color:"var(--privy-color-error)"}),/*#__PURE__*/e.jsx(xe.default,{height:38,width:38,stroke:"var(--privy-color-error)"})]})}),/*#__PURE__*/e.jsxs(zs,{children:[/*#__PURE__*/e.jsxs("h3",{children:[function(e){switch(e){case"sms":return"Phone number";case"email":return"Email address";case"siwe":return"Wallet address";case"siws":return"Solana wallet address";case"linkedin":return"LinkedIn profile";case"google":case"apple":case"discord":case"github":case"instagram":case"spotify":case"tiktok":case"line":case"twitter":case"telegram":case"farcaster":return`${mt(e.replace("_oauth",""))} profile`;default:return e.startsWith("privy:")?"Cross-app account":e}}(l.method)," is associated with another account"]}),/*#__PURE__*/e.jsxs("p",{children:["Do you want to transfer",/*#__PURE__*/e.jsx("b",{children:l.handle?` ${l.handle}`:""})," to this account instead? This will delete your other account."]}),/*#__PURE__*/e.jsx(Js,{onClick:r,disclosedAccount:l.disclosedAccount})]}),/*#__PURE__*/e.jsxs(zs,{style:{gap:12,marginTop:12},children:[s?.accountTransfer?.embeddedWalletAddress?/*#__PURE__*/e.jsx(Pr,{onClick:n,children:"Continue"}):/*#__PURE__*/e.jsx(Bs,{onTransfer:a,transferSuccess:i,isTransferring:o}),/*#__PURE__*/e.jsx(Fr,{onClick:t,children:"No thanks"})]})]}),/*#__PURE__*/e.jsx(xr,{})]})};function Js({disclosedAccount:t,onClick:n}){return t?/*#__PURE__*/e.jsxs(Hs,{onClick:n,children:[/*#__PURE__*/e.jsx(ve.default,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/e.jsx(Cs,{address:t.handle,showCopyIcon:!1}),/*#__PURE__*/e.jsx(Ts,{width:15,height:15,color:"var(--privy-color-foreground-3)",style:{marginLeft:"auto"}})]}):null}const el=({errorMessage:n,onClose:r})=>n?/*#__PURE__*/e.jsx(ba,{title:"Something went wrong",subtitle:n,icon:t.XCircle,iconVariant:"error",primaryCta:{label:"Close",onClick:r},watermark:!0}):/*#__PURE__*/e.jsx(ba,{title:"Creating your wallet",subtitle:"Please wait...",iconVariant:"loading",watermark:!1}),tl={component:()=>{let{setModalData:t,navigate:i,data:o,onUserCloseViaDialogOrKeybindRef:s}=Xn(),l=qn(),[c,u]=n.useState(""),{embeddedWallets:p}=qn(),{authenticated:h,user:g}=a.usePrivyContext(),{closePrivyModal:m,walletProxy:y,client:f}=r.usePrivyInternal(),{onSuccess:x,onFailure:v,callAuthOnSuccessOnClose:w,shouldCreateEth:C,shouldCreateSol:b}=o.createWallet,j="legacy-embedded-wallets-only"===l.embeddedWallets.mode&&!0===l?.embeddedWallets.requireUserOwnedRecoveryOnCreate,[k,T]=n.useState(null),{create:A}=Qi(),S=C??(!!g&&hs(g,l.embeddedWallets.ethereum.createOnLogin)),E=b??(!!g&&ms(g,l.embeddedWallets.solana.createOnLogin)),I=new rt((async()=>{let e=await f.getAccessToken();if(g&&e&&y)try{let e;if(S&&E)e=await A({chainType:"ethereum",walletIndex:0,latestUser:g}),e=await A({chainType:"solana",walletIndex:0,latestUser:e.user});else if(E)e=await A({chainType:"solana",walletIndex:0,latestUser:g});else{if(!S)return void m({shouldCallAuthOnSuccess:w});e=await A({chainType:"ethereum",walletIndex:0,latestUser:g})}T(e),i(Ji)}catch(e){u(e.message)}}));return n.useEffect((()=>h&&g?j?(t({...o,createWallet:{...o.createWallet,shouldCreateEth:S,shouldCreateSol:E},recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0,shouldCreateEth:S,shouldCreateSol:E}}),i(Cg({walletAction:"create",showAutomaticRecovery:!1,availableRecoveryMethods:p.userOwnedRecoveryOptions,legacySetWalletPasswordFlow:!1,isResettingPassword:!1}))):void I.execute():(i(cg),void v(Error("User must be authenticated before creating a Privy wallet")))),[j,h]),s.current=()=>null/*#__PURE__*/,e.jsx(el,{errorMessage:c||void 0,onClose:()=>{k?(x(k),m({shouldCallAuthOnSuccess:w})):(v(new d.PrivyEmbeddedWalletError("User wallet creation failed")),m({shouldCallAuthOnSuccess:!1}))}})}},nl={component:()=>{let{user:t,logout:n}=a.usePrivyContext(),{onUserCloseViaDialogOrKeybindRef:i,setModalData:o,navigate:s}=Xn(),l=qn(),{acceptTerms:c,closePrivyModal:d,createAnalyticsEvent:u}=r.usePrivyInternal(),p=e=>{e?.preventDefault(),d({shouldCallAuthOnSuccess:!1}),n()};i.current=p;/*#__PURE__*/return e.jsx(rl,{termsAndConditionsUrl:l?.legal.termsAndConditionsUrl,privacyPolicyUrl:l?.legal.privacyPolicyUrl,onAccept:async e=>{e?.preventDefault(),await c(),t&&fs(t,l.embeddedWallets)?(o({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AffirmativeConsentScreen"}}),n()},callAuthOnSuccessOnClose:!0}}),s(tl)):d()},onDecline:p})}},rl=({termsAndConditionsUrl:n,privacyPolicyUrl:r,onAccept:a,onDecline:i,title:o="One last step",subtitle:s="By signing up, you agree to our terms and privacy policy."})=>/*#__PURE__*/e.jsx(ba,{title:o,subtitle:s,icon:t.FileCheck,primaryCta:{label:"Accept",onClick:a},secondaryCta:{label:"No thanks",onClick:i},watermark:!0,children:(n||r)&&/*#__PURE__*/e.jsxs(al,{children:[n&&/*#__PURE__*/e.jsxs(Er,{variant:"muted",href:n,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Terms",/*#__PURE__*/e.jsx(t.ExternalLink,{width:16,height:16,strokeWidth:2.25})]}),r&&/*#__PURE__*/e.jsxs(Er,{variant:"muted",href:r,target:"_blank",size:"lg",style:{justifyContent:"space-between"},as:"a",children:["View Privacy Policy",/*#__PURE__*/e.jsx(t.ExternalLink,{width:16,height:16,strokeWidth:2.25})]})]})});let al=/*#__PURE__*/i.styled.div.withConfig({displayName:"LinksContainer",componentId:"sc-21e1b98c-0"})(["display:flex;flex-direction:column;gap:12px;margin-top:var(--screen-space);"]);const il=({color:t,...n})=>/*#__PURE__*/e.jsx("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...n,children:/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:t||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});let ol=/*#__PURE__*/i.styled.button.withConfig({displayName:"CopyTextButton",componentId:"sc-4b0620dc-0"})(["display:flex;align-items:center;gap:0.5rem;&:hover{text-decoration:underline;}svg{width:0.875rem;height:0.875rem;}"]),sl=/*#__PURE__*/i.styled.span.withConfig({displayName:"CopiedText",componentId:"sc-4b0620dc-1"})(["display:flex;align-items:center;gap:0.25rem;font-size:0.875rem;color:var(--privy-color-foreground-2);"]),ll=/*#__PURE__*/i.styled(We.default).withConfig({displayName:"GreenCheck",componentId:"sc-4b0620dc-2"})(["color:var(--privy-color-success);"]),cl=/*#__PURE__*/i.styled(il).withConfig({displayName:"StyledCopy",componentId:"sc-4b0620dc-3"})(["color:var(--privy-color-foreground-3);opactiy:0.5;"]);function dl({children:t,iconOnly:r,value:a,hideCopyIcon:i,...o}){let[s,l]=n.useState(!1);/*#__PURE__*/return e.jsxs(ol,{...o,onClick:()=>{navigator.clipboard.writeText(a||t).catch(console.error),l(!0),setTimeout((()=>l(!1)),1500)},children:[t," ",s?/*#__PURE__*/e.jsxs(sl,{children:[/*#__PURE__*/e.jsx(ll,{})," ",!r&&"Copied"]}):!i&&/*#__PURE__*/e.jsx(cl,{})]})}const ul=()=>/*#__PURE__*/e.jsx("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:/*#__PURE__*/e.jsx("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});let pl=(e,t,n,r,a)=>{for(let i=t;i<t+r;i++)for(let t=n;t<n+a;t++){let n=e?.[t];n&&n[i]&&(n[i]=0)}return e},hl=({x:t,y:n,cellSize:r,bgColor:a,fgColor:i})=>
19
+ /*#__PURE__*/e.jsx(e.Fragment,{children:[0,1,2].map((o=>/*#__PURE__*/e.jsx("circle",{r:r*(7-2*o)/2,cx:t+7*r/2,cy:n+7*r/2,fill:o%2!=0?a:i},`finder-${t}-${n}-${o}`)))}),gl=({cellSize:t,matrixSize:n,bgColor:r,fgColor:a})=>/*#__PURE__*/e.jsx(e.Fragment,{children:[[0,0],[(n-7)*t,0],[0,(n-7)*t]].map((([n,i])=>/*#__PURE__*/e.jsx(hl,{x:n,y:i,cellSize:t,bgColor:r,fgColor:a},`finder-${n}-${i}`)))}),ml=({matrix:t,cellSize:n,color:r})=>/*#__PURE__*/e.jsx(e.Fragment,{children:t.map(((t,a)=>t.map(((t,i)=>t?/*#__PURE__*/e.jsx("rect",{height:n-.4,width:n-.4,x:a*n+.1*n,y:i*n+.1*n,rx:.5*n,ry:.5*n,fill:r},`cell-${a}-${i}`):/*#__PURE__*/e.jsx(le.default.Fragment,{},`circle-${a}-${i}`)))))}),yl=({cellSize:t,matrixSize:n,element:r,sizePercentage:a,bgColor:i})=>{if(!r)/*#__PURE__*/return e.jsx(e.Fragment,{});let o=n*(a||.14),s=Math.floor(n/2-o/2),l=Math.floor(n/2+o/2);(l-s)%2!=n%2&&(l+=1);let c=(l-s)*t,d=c-.2*c,u=s*t;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("rect",{x:s*t,y:s*t,width:c,height:c,fill:i}),/*#__PURE__*/e.jsx(r,{x:u+.1*c,y:u+.1*c,height:d,width:d})]})},fl=t=>{let n=t.outputSize,r=((e,t)=>{let n=De.default.create(e,{errorCorrectionLevel:t}).modules,r=((e,t)=>{let n=e.slice(0),r=[];for(;n.length;)r.push(n.splice(0,t));return r})(Array.from(n.data),n.size);return r=pl(r,0,0,7,7),r=pl(r,r.length-7,0,7,7),pl(r,0,r.length-7,7,7)})(t.url,t.errorCorrectionLevel),a=n/r.length,i=function(e,{min:t,max:n}){return Math.min(Math.max(e,t),n)}(2*a,{min:.025*n,max:.036*n});/*#__PURE__*/return e.jsxs("svg",{height:t.outputSize,width:t.outputSize,viewBox:`0 0 ${t.outputSize} ${t.outputSize}`,style:{height:"100%",width:"100%",padding:`${i}px`},children:[/*#__PURE__*/e.jsx(ml,{matrix:r,cellSize:a,color:t.fgColor}),/*#__PURE__*/e.jsx(gl,{cellSize:a,matrixSize:r.length,fgColor:t.fgColor,bgColor:t.bgColor}),/*#__PURE__*/e.jsx(yl,{cellSize:a,element:t.logo?.element,bgColor:t.bgColor,matrixSize:r.length})]})},xl=/*#__PURE__*/i.styled.div.attrs({className:"ph-no-capture"}).withConfig({displayName:"QrContainer",componentId:"sc-597e27f3-0"})(["display:flex;justify-content:center;align-items:center;height:",";width:",";margin:auto;background-color:",";&&{border-width:2px;border-color:",";border-radius:var(--privy-border-radius-md);}"],(e=>`${e.$size}px`),(e=>`${e.$size}px`),(e=>e.$bgColor),(e=>e.$borderColor));const vl=t=>{let{appearance:n}=qn(),r=t.bgColor||"#FFFFFF",a=t.fgColor||"#000000",i=t.size||160,o="dark"===n.palette.colorScheme?r:a;/*#__PURE__*/return e.jsx(xl,{$size:i,$bgColor:r,$fgColor:a,$borderColor:o,children:/*#__PURE__*/e.jsx(fl,{url:t.url,logo:{element:t.squareLogoElement??ul},outputSize:i,bgColor:r,fgColor:a,errorCorrectionLevel:t.errorCorrectionLevel||"Q"})})},wl=/*#__PURE__*/i.styled.span.withConfig({displayName:"ErrorMessage",componentId:"sc-fcb8cd50-0"})(["text-align:left;font-size:0.75rem;font-weight:500;line-height:1.125rem;color:var(--privy-color-error);"]);let Cl=/*#__PURE__*/i.styled.label.withConfig({displayName:"BaseEmailForm",componentId:"sc-f34af797-0"})(["display:block;position:relative;width:100%;height:56px;&& > :first-child{position:absolute;left:0.75em;top:50%;transform:translate(0,-50%);}&& > input{font-size:16px;line-height:24px;color:var(--privy-color-foreground);padding:12px 88px 12px 52px;flex-grow:1;background:var(--privy-color-background);border:1px solid ",";border-radius:var(--privy-border-radius-md);width:100%;height:100%;@media (min-width:441px){font-size:14px;padding-right:78px;}:focus{outline:none;border-color:",";box-shadow:",";}:autofill,:-webkit-autofill{background:var(--privy-color-background);}&& > input::placeholder{color:var(--privy-color-foreground-3);}&:disabled{opacity:0.4;cursor:not-allowed;}&:disabled,&:disabled:hover,&:disabled > span{color:var(--privy-color-foreground-3);}}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;}&:disabled{opacity:0.4;cursor:not-allowed;}&:disabled,&:disabled:hover,&:disabled > span{color:var(--privy-color-foreground-3);}}"],(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-foreground-4)"),(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-accent-light)"),(({$error:e})=>e?"none":"0 0 0 1px var(--privy-color-accent-light)"));const bl=/*#__PURE__*/i.styled(Cl).withConfig({displayName:"EmailUpdateForm",componentId:"sc-f34af797-1"})(["background-color:var(--privy-color-background);transition:background-color 200ms ease;&& > button{right:0;line-height:24px;position:absolute;padding:13px 17px;background-color:#090;:focus{outline:none;border-color:var(--privy-color-accent);}}"]),jl=/*#__PURE__*/i.styled(Cl).withConfig({displayName:"EmailInputForm",componentId:"sc-f34af797-2"})(["&& > input{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-right:",";border:1px solid ",";&& > input::placeholder{color:var(--privy-color-foreground-3);}}&& > :last-child{right:16px;position:absolute;top:50%;transform:translate(0,-50%);}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;}}"],(e=>e.$stacked?"16px":"88px"),(({$error:e})=>e?"var(--privy-color-error) !important":"var(--privy-color-foreground-4)")),kl=/*#__PURE__*/i.styled.div.withConfig({displayName:"InputContainerForm",componentId:"sc-f34af797-3"})(["width:100%;&& > ","{display:block;text-align:left;padding-left:var(--privy-border-radius-md);padding-bottom:5px;}"],wl),Tl=({...t})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),/*#__PURE__*/e.jsx("path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2"}),/*#__PURE__*/e.jsx("path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21"})]}),Al={phantom:{mobile:{native:"phantom://",universal:"https://phantom.app/ul/"}},solflare:{mobile:{native:void 0,universal:"https://solflare.com/ul/v1/"}},metamask:{image_url:{sm:yn,md:yn}}};class Sl{static normalize(e){return e.replace(/[-_]wallet$/,"").replace(/[-_]extension$/,"").toLowerCase()}isEth(e){return e.chains.some((e=>e.startsWith("eip155:")))}isSol(e){return e.chains.some((e=>e.startsWith("solana:")))}inAllowList(e,t){if(!this.normalizedAllowList||0===this.normalizedAllowList.length||"listing"===t&&this.includeWalletConnect)return!0;let n=Sl.normalize(e);return this.normalizedAllowList.some((e=>n===Sl.normalize(e)))}chainMatches(e){return"ethereum-only"===this.chainFilter?"ethereum"===e:"solana-only"!==this.chainFilter||"solana"===e}connectorOk(e){return!!("null"!==e.connectorType&&this.chainMatches(e.chainType)&&(this.inAllowList(e.walletClientType,"connector")||("injected"===e.connectorType||"solana_adapter"===e.connectorType)&&("ethereum"===e.chainType&&this.detectedEth||"solana"===e.chainType&&this.detectedSol)))}listingOk(e){if(e.slug.includes("coinbase"))return!1;if("ethereum-only"===this.chainFilter){if(!this.isEth(e))return!1}else if("solana-only"===this.chainFilter&&!this.isSol(e))return!1;return!!this.inAllowList(e.slug,"listing")}getWallets(e,t){let n=new Map,r=e=>{let t=n.get(e.id);if(t){t.chainType!==e.chainType&&(t.chainType="multi");let n=new Set(t.chains);e.chains.forEach((e=>n.add(e))),t.chains=Array.from(n),!t.icon&&e.icon&&(t.icon=e.icon),!t.url&&e.url&&(t.url=e.url),!t.listing&&e.listing&&(t.listing=e.listing)}else n.set(e.id,e)};e.filter((e=>this.connectorOk(e))).forEach((e=>{let t=Sl.normalize(e.walletClientType);r({id:t,label:e.walletBranding?.name??t,source:"connector",connector:e,chainType:e.chainType,icon:e.walletBranding?.icon,url:void 0,chains:["ethereum"===e.chainType?"eip155":"solana"]})})),t.filter((e=>this.listingOk(e))).forEach((e=>{let t=this.isEth(e),n=this.isSol(e),a=Sl.normalize(e.slug),i=Al[e.slug],o=i?.image_url?.sm||e.image_url?.sm;r({id:a,label:e.name||a,source:"listing",listing:e,chainType:t&&n?"multi":t?"ethereum":"solana",icon:o,url:e.homepage,chains:e.chains})}));let a=e.find((e=>"wallet_connect_v2"===e.connectorType));this.includeWalletConnectQr&&a&&r({id:"wallet_connect_qr",label:"WalletConnect",source:"connector",connector:a,chainType:"ethereum",icon:Yn,url:void 0,chains:["ethereum"===a.chainType?"eip155":"solana"]});let i=Array.from(n.values());i.forEach((e=>{let t=Al[e.listing?.slug||e.id];t?.image_url?.sm&&(e.icon=t.image_url.sm)}));let o=new Map;return this.normalizedAllowList?.forEach(((e,t)=>{o.set(Sl.normalize(e),t)})),{wallets:i.slice().sort(((e,t)=>{let n=Sl.normalize(e.id),r=Sl.normalize(t.id);"binance-defi"===n?n="binance":"universalprofiles"===n?n="universal_profile":"cryptocom-defi"===n&&(n="cryptocom"),"binance-defi"===r?r="binance":"universalprofiles"===r?r="universal_profile":"cryptocom-defi"===r&&(r="cryptocom");let a=o.has(n),i=o.has(r);return a&&i?o.get(n)-o.get(r):a?-1:i?1:"connector"===e.source&&"listing"===t.source?-1:"listing"===e.source&&"connector"===t.source?1:e.label.toLowerCase().localeCompare(t.label.toLowerCase())})),walletCount:i.length}}constructor(e,t){this.chainFilter=e,t&&t.length>0&&(this.normalizedAllowList=t.map(String),this.normalizedAllowList.includes("binance")&&this.normalizedAllowList.push("binance-defi-wallet")),this.detectedEth=this.normalizedAllowList?.includes("detected_ethereum_wallets")??!1,this.detectedSol=this.normalizedAllowList?.includes("detected_solana_wallets")??!1,this.includeWalletConnect=this.normalizedAllowList?.includes("wallet_connect")??!1,this.includeWalletConnectQr=this.normalizedAllowList?.includes("wallet_connect_qr")??!1}}var El=t=>/*#__PURE__*/e.jsxs("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("path",{d:"m0 0h32v32h-32z",fill:"#5469d4"}),/*#__PURE__*/e.jsx("path",{d:"m15.997 5.333-.143.486v14.106l.143.143 6.548-3.87z",fill:"#c2ccf4"}),/*#__PURE__*/e.jsx("path",{d:"m15.996 5.333-6.548 10.865 6.548 3.87z",fill:"#fff"}),/*#__PURE__*/e.jsx("path",{d:"m15.997 21.306-.08.098v5.025l.08.236 6.552-9.227z",fill:"#c2ccf4"}),/*#__PURE__*/e.jsx("path",{d:"m15.996 26.665v-5.36l-6.548-3.867z",fill:"#fff"}),/*#__PURE__*/e.jsx("path",{d:"m15.995 20.07 6.548-3.87-6.548-2.976v6.847z",fill:"#8698e8"}),/*#__PURE__*/e.jsx("path",{d:"m9.448 16.2 6.548 3.87v-6.846z",fill:"#c2ccf4"})]}),Il=t=>/*#__PURE__*/e.jsxs("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsxs("linearGradient",{id:"a",gradientUnits:"userSpaceOnUse",x1:"7.233",x2:"24.766",y1:"24.766",y2:"7.234",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#9945ff"}),/*#__PURE__*/e.jsx("stop",{offset:".2",stopColor:"#7962e7"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#00d18c"})]}),/*#__PURE__*/e.jsx("path",{d:"m0 0h32v32h-32z",fill:"#10111a"}),/*#__PURE__*/e.jsx("path",{clipRule:"evenodd",d:"m9.873 20.41a.645.645 0 0 1 .476-.21l14.662.012a.323.323 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54zm15.376-2.862a.322.322 0 0 1 -.238.54l-14.662.012a.642.642 0 0 1 -.476-.21l-3.122-3.44a.323.323 0 0 1 .238-.54l14.662-.012a.644.644 0 0 1 .475.21zm-15.376-9.738a.644.644 0 0 1 .476-.21l14.662.012a.322.322 0 0 1 .238.54l-3.123 3.438a.643.643 0 0 1 -.475.21l-14.662-.012a.323.323 0 0 1 -.238-.54z",fill:"url(#a)",fillRule:"evenodd"})]});const Pl=/*#__PURE__*/i.styled.div.withConfig({displayName:"Header",componentId:"sc-9b65f2b6-0"})(["display:flex;justify-content:space-between;align-items:center;"]),Nl=/*#__PURE__*/i.styled.button.withConfig({displayName:"CloseButton",componentId:"sc-9b65f2b6-1"})(["padding:0.25rem;height:30px;width:30px;display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-full);background:var(--privy-color-background-2);"]),_l=/*#__PURE__*/i.styled.div.withConfig({displayName:"WalletIconWithActiveIndicator",componentId:"sc-9b65f2b6-2"})(["position:relative;display:inline-flex;align-items:center;&::after{content:' ';border-radius:var(--privy-border-radius-full);height:6px;width:6px;background-color:var(--privy-color-icon-success);position:absolute;right:-3px;top:-3px;}"]),Ml=/*#__PURE__*/i.styled.img.withConfig({displayName:"WalletIcon",componentId:"sc-9b65f2b6-3"})(["width:32px;height:32px;border-radius:0.25rem;object-fit:contain;"]),Fl=/*#__PURE__*/i.styled.span.withConfig({displayName:"Chip",componentId:"sc-9b65f2b6-4"})(["display:flex;gap:0.25rem;align-items:center;padding:0.25rem 0.5rem;font-size:0.75rem;font-weight:500;line-height:1.125rem;border-radius:var(--privy-border-radius-sm);background-color:var(--privy-color-background-2);svg{width:100%;max-width:1rem;max-height:1rem;stroke-width:2;}"]),Ll=/*#__PURE__*/i.styled.div.withConfig({displayName:"ScrollContainer",componentId:"sc-9b65f2b6-5"})(["display:flex;flex-direction:column;gap:0.5rem;max-height:24rem;overflow-y:scroll;&::-webkit-scrollbar{display:none;}scrollbar-gutter:stable both-edges;scrollbar-width:none;-ms-overflow-style:none;"," background-repeat:no-repeat;background-size:100% 32px,100% 16px;background-attachment:local,scroll;"],(e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0)),Wl=q.create((()=>({isModalOpen:!1,resolvers:null})));let Dl=q.create((()=>({})));const Rl=({address:e,client:t,appId:n})=>{let r=`${t}:${e}`;n&&Ze.put(Ol(n),r),Wl.setState({wallet:r})},Ol=e=>`privy:${e}:active-wallet-connection`;function Bl({walletList:e,walletChainType:t}){let a=qn(),{connectors:i}=r.usePrivyInternal(),o=En((e=>e.listings)),s=t??a.appearance.walletChainType,l=e??a.appearance?.walletList,c=n.useMemo((()=>new Sl(s,l)),[s,l]),{wallets:d,walletCount:u}=n.useMemo((()=>c.getWallets(i,o)),[c,i,o]),[p,h]=n.useState(""),g=n.useMemo((()=>p?d.filter((e=>e.label.toLowerCase().includes(p.toLowerCase()))):d),[p,d]),[m,y]=n.useState();return{selected:m,setSelected:y,search:p,setSearch:h,wallets:g,walletCount:u}}let Ul=e=>!e||"string"!=typeof e&&(e instanceof gn||e instanceof An);const zl=({index:t,style:n,data:r,recent:a})=>{let i=r.wallets[t],{walletChainType:o,handleWalletClick:s}=r,l={...n,boxSizing:"border-box"};return i?/*#__PURE__*/e.jsxs(ql,{style:l,onClick:()=>s(i),children:[i.icon&&(i.connector&&!Ul(i.connector)?/*#__PURE__*/e.jsx(_l,{children:"string"==typeof i.icon?/*#__PURE__*/e.jsx(Ml,{src:i.icon}):/*#__PURE__*/e.jsx(i.icon,{style:{width:"32px",height:"32px"}})}):"string"==typeof i.icon?/*#__PURE__*/e.jsx(Ml,{src:i.icon}):/*#__PURE__*/e.jsx(i.icon,{style:{width:"32px",height:"32px"}})),/*#__PURE__*/e.jsx(Zl,{children:i.label}),a?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Fl,{children:"Last used"}),/*#__PURE__*/e.jsx(Gl,{children:/*#__PURE__*/e.jsxs(e.Fragment,{children:["ethereum-only"===o&&/*#__PURE__*/e.jsx(El,{}),"solana-only"===o&&/*#__PURE__*/e.jsx(Il,{})]})})]}):/*#__PURE__*/e.jsx(Gl,{children:!("ethereum-only"===o||"solana-only"===o)&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[i.chains?.some((e=>e.startsWith("eip155")))&&/*#__PURE__*/e.jsx(El,{}),i.chains?.some((e=>e.startsWith("solana")))&&/*#__PURE__*/e.jsx(Il,{})]})})]}):null};var Hl=({className:t,customDescription:a,connectOnly:i,preSelectedWalletId:o,...s})=>{let l=qn(),{connectors:c}=r.usePrivyInternal(),u=s.walletChainType||l.appearance.walletChainType,p=s.walletList||l.appearance?.walletList,{onBack:h,onClose:g,app:m}=s,{selected:y,setSelected:f,qrUrl:x,setQrUrl:w,connecting:C,uiState:b,wallets:j,walletCount:k,handleConnect:T,handleBack:A,showSearchBar:S,isInitialConnectView:E,title:I,search:P,setSearch:N}=function({onConnect:e,onBack:t,onClose:a,onConnectError:i,walletList:o,walletChainType:s,app:l}){let c=qn(),{connectors:u}=r.usePrivyInternal(),{wallets:p,walletCount:h,search:g,setSearch:m,selected:y,setSelected:f}=Bl({walletList:o,walletChainType:s}),[x,w]=n.useState(),[C,b]=n.useState(),[j,k]=n.useState(),T=!y&&!C&&!j,A=T&&(h>6||g.length>0),S=u.find((e=>"wallet_connect_v2"===e.connectorType)),E=n.useCallback((async(t,n)=>{if(t){if(j?.connector===t)return void console.log("Already connecting to this wallet, skipping duplicate attempt");if(w("loading"),"string"==typeof t)return k({connector:t,name:n?.name??"Wallet",icon:n?.icon}),void window.open(t,"_blank");k({connector:t,name:n?.name??t.walletBranding.name??"Wallet",icon:n?.icon??t.walletBranding.icon});try{let n=await t.connect({showPrompt:!0});if(!n)return w("error"),void i?.(new d.PrivyConnectorError("Unable to connect wallet"));w("success"),Rl({address:n.address,client:n.walletClientType,appId:c.id}),setTimeout((()=>{e({connector:t,wallet:n})}),at)}catch(t){if(console.error("ERROR: ",{e:t}),t?.message?.includes("already pending for origin")||t?.message?.includes("wallet_requestPermissions"))return void console.log("Connection request already pending, maintaining loading state");w("error"),i?.(new d.PrivyConnectorError("Unable to connect wallet"))}}}),[c.id,e,j]),I=n.useCallback((()=>C?(w(void 0),k(void 0),void b(void 0)):j?(w(void 0),void k(void 0)):y?(w(void 0),k(void 0),void f(void 0)):"error"===x||"loading"===x?(w(void 0),void k(void 0)):void t?.()),[C,j,y,x,t]),P=n.useMemo((()=>j?.connector===S&&C&&v.isMobile?`Go to ${j.name} to continue`:j?.connector===S&&C?`Scan code to connect to ${j.name}`:"string"==typeof j?.connector?`Open or install ${j.name}`:y&&!j?"Select network":j?null:"Select your wallet"),[j,C,y,S]);return{selected:y,setSelected:f,qrUrl:C,setQrUrl:b,connecting:j,uiState:x,search:g,setSearch:m,wallets:p,walletCount:h,wc:S,isInitialConnectView:T,showSearchBar:A,title:P,handleConnect:E,handleBack:I,onClose:a,onConnect:e,app:l}}({...s,walletList:p,walletChainType:u}),_=c.find((e=>"wallet_connect_v2"===e.connectorType)),M=n.useRef(null),F=U.useVirtualizer({count:j.length,getScrollElement:()=>M.current,estimateSize:()=>56,overscan:6,gap:5}),L=n.useCallback((async e=>{let t,n="solana-only"!==u&&e.chains?.some((e=>e.startsWith("eip155"))),r="ethereum-only"!==u&&e.chains?.some((e=>e.startsWith("solana"))),a=vn[e.id];if(r&&a)t=a.getMobileRedirect({isSolana:!0,connectOnly:!!i,useUniversalLink:!1});else{let n=e.listing?.mobile?.native;t=e.listing?.mobile?.universal||n||e.url}if(n&&r){let n=Sl.normalize(e.id),r=c.filter((e=>Sl.normalize(e.walletClientType)===n&&!("ethereum"===e.chainType&&e instanceof gn||"solana"===e.chainType&&e instanceof An))),a=r.find((e=>"ethereum"===e.chainType)),i=r.find((e=>"solana"===e.chainType));if(!a&&e.listing){let t=Al[e.listing.slug]?{...e.listing,...Al[e.listing.slug]}:e.listing;_.setWalletEntry(t,w),await _.resetConnection(e.id),a=_}if(!i&&t&&(i=t),a||i)return void f({eth:a,sol:i,name:e.label,icon:e.icon})}if(!Ul(e.connector))return"wallet_connect_v2"===e.connector?.connectorType&&(await _.resetConnection(e.id),_.setWalletEntry({id:"wallet_connect_qr",name:"WalletConnect",rdns:"",slug:"wallet-connect",homepage:"",chains:["eip155"],mobile:{native:"",universal:void 0}},w)),void await T(e.connector,{name:e.label,icon:e.icon});if(n||r||e.url||e.listing){if(n&&e.listing){let t=Al[e.listing.slug]?{...e.listing,...Al[e.listing.slug]}:e.listing;_.setWalletEntry(t,w),await _.resetConnection(e.id)}if(n&&r)return void f({eth:_,sol:t,name:e.label,icon:e.icon});if(r)return void await T(t,{name:e.label,icon:e.icon});if(n)return void(e.listing?await T(_,{name:e.label,icon:e.icon}):e.url?await T(e.url,{name:e.label,icon:e.icon}):console.warn("Cannot connect to EVM wallet without connector or listing details:",e.label));if(e.url)return void await T(e.url,{name:e.label,icon:e.icon})}}),[_,T,f,w,A,g,m,E,I,a,l,c]),W=h||A,D=!!h||!E;return n.useEffect((()=>{if(!o)return;let e=j.find((({id:e})=>e===o));e&&L(e).catch(console.error)}),[o]),/*#__PURE__*/e.jsxs(ma,{className:t,children:[/*#__PURE__*/e.jsx(ma.Header,{icon:C&&!x||x&&v.isMobile&&C?.icon?C.icon:C?void 0:Tl,iconVariant:C&&!x||x&&v.isMobile?"loading":void 0,iconLoadingStatus:C&&!x||x&&v.isMobile?{success:"success"===b,fail:"error"===b}:void 0,title:C&&!x?`Waiting for ${C.name}`:x&&v.isMobile?`Waiting for ${C?.name??"connection"}`:I,subtitle:C&&!x&&"string"==typeof C.connector?`To connect to ${C.name}, install and open the app. Then confirm the connection when prompted.`:C&&!x&&"string"!=typeof C.connector?"error"===b?"Please try connecting again.":"For the best experience, connect only one wallet at a time.":E?a??(m?`Connect a wallet to your ${m.name} account`:null):null,showBack:D,showClose:!0,onBack:W,onClose:g}),/*#__PURE__*/e.jsxs(ma.Body,{ref:M,$colorScheme:l.appearance.palette.colorScheme,style:{marginBottom:x?"0.5rem":void 0},children:[S&&/*#__PURE__*/e.jsx(Vl,{children:/*#__PURE__*/e.jsxs(bl,{style:{background:"transparent"},children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(B.MagnifyingGlassIcon,{})}),/*#__PURE__*/e.jsx("input",{className:"login-method-button",type:"text",placeholder:"Search wallets",onChange:e=>N(e.target.value),value:P})]})}),x&&v.isMobile&&"loading"===b&&/*#__PURE__*/e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:/*#__PURE__*/e.jsx(Er,{variant:"primary",onClick:()=>window.open(x.universal??x.native,"_blank"),style:{width:"100%"},children:"Open in app"})}),x&&!v.isMobile&&"loading"===b&&/*#__PURE__*/e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem"},children:/*#__PURE__*/e.jsx(Kl,{value:x.universal??x.native,iconOnly:!0,children:"Copy link"})}),x&&!v.isMobile&&/*#__PURE__*/e.jsx(vl,{size:280,url:x.universal??x.native,squareLogoElement:C?.icon?"string"==typeof C.icon?t=>/*#__PURE__*/e.jsx("svg",{...t,children:/*#__PURE__*/e.jsx("image",{href:C.icon,height:t.height,width:t.width})}):C.icon:Gn}),/*#__PURE__*/e.jsxs($l,{children:[C&&!x&&"string"==typeof C.connector&&/*#__PURE__*/e.jsxs(ql,{onClick:()=>window.open(C.connector,"_blank"),children:[C.icon&&("string"==typeof C.icon?/*#__PURE__*/e.jsx(Ml,{src:C.icon}):/*#__PURE__*/e.jsx(C.icon,{})),/*#__PURE__*/e.jsx(Zl,{children:C.name})]}),y?.eth&&!C&&/*#__PURE__*/e.jsxs(ql,{onClick:()=>T(y.eth,{name:y.name,icon:y.icon}),children:[y.icon&&("string"==typeof y.icon?/*#__PURE__*/e.jsx(Ml,{src:y.icon}):/*#__PURE__*/e.jsx(y.icon,{})),/*#__PURE__*/e.jsx(Zl,{children:y.name}),/*#__PURE__*/e.jsx(Gl,{children:/*#__PURE__*/e.jsx(El,{})})]}),y?.sol&&!C&&/*#__PURE__*/e.jsxs(ql,{onClick:()=>T(y.sol,{name:y.name,icon:y.icon}),children:[y.icon&&("string"==typeof y.icon?/*#__PURE__*/e.jsx(Ml,{src:y.icon}):/*#__PURE__*/e.jsx(y.icon,{})),/*#__PURE__*/e.jsx(Zl,{children:y.name}),/*#__PURE__*/e.jsx(Gl,{children:/*#__PURE__*/e.jsx(Il,{})})]}),E&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[!(k>0)&&/*#__PURE__*/e.jsx(Yl,{children:"No wallets found. Try another search."}),k>0&&!x&&/*#__PURE__*/e.jsx("div",{style:{maxHeight:56*Math.min(j.length,5)+5,width:"100%"},children:/*#__PURE__*/e.jsx("div",{style:{height:`${F.getTotalSize()}px`,width:"100%",position:"relative"},children:F.getVirtualItems().map((t=>/*#__PURE__*/e.jsx(zl,{index:t.index,style:{position:"absolute",top:0,left:0,height:`${t.size}px`,transform:`translateY(${t.start}px)`},data:{wallets:j,walletChainType:u,handleWalletClick:L}},t.key)))})})]})]})]}),/*#__PURE__*/e.jsxs(ma.Footer,{children:[C&&!x&&"string"!=typeof C.connector&&"error"===b&&/*#__PURE__*/e.jsx(ma.Actions,{children:/*#__PURE__*/e.jsx(Er,{style:{width:"100%",alignItems:"center"},variant:"error",onClick:()=>T(C.connector,{name:C.name,icon:C.icon}),children:"Retry"})}),!!(m&&m.legal.privacyPolicyUrl&&m.legal.termsAndConditionsUrl)&&/*#__PURE__*/e.jsx(fr,{app:m,alwaysShowImplicitConsent:!0}),/*#__PURE__*/e.jsx(ma.Watermark,{})]})]})};let Vl=/*#__PURE__*/i.styled.div.withConfig({displayName:"StickySearchContainer",componentId:"sc-850f7dce-0"})(["position:sticky;margin-top:-3px;padding-top:3px;top:-3px;z-index:1;background:var(--privy-color-background);padding-bottom:calc(var(--screen-space) / 2);"]),$l=/*#__PURE__*/i.styled.div.withConfig({displayName:"WalletListContainer",componentId:"sc-850f7dce-1"})(["display:flex;flex-direction:column;gap:","px;"],5),ql=/*#__PURE__*/i.styled.button.withConfig({displayName:"Button",componentId:"sc-850f7dce-2"})(["&&{gap:0.5rem;align-items:center;display:flex;position:relative;text-align:left;font-weight:500;transition:background 200ms ease-in;width:calc(100% - 4px);border-radius:var(--privy-border-radius-md);padding:0.75em;border:1px solid var(--privy-color-foreground-4);justify-content:space-between;}&:hover{background:var(--privy-color-background-2);}"]),Gl=/*#__PURE__*/i.styled.span.withConfig({displayName:"ButtonBadge",componentId:"sc-850f7dce-3"})(["display:flex;align-items:center;justify-content:end;position:relative;& > svg{border-radius:var(--privy-border-radius-full);stroke-width:2.5;width:100%;max-height:1rem;max-width:1rem;flex-shrink:0;}& > svg:not(:last-child){border-radius:var(--privy-border-radius-full);margin-right:-0.375rem;}"]),Yl=/*#__PURE__*/i.styled.div.withConfig({displayName:"EmptyContainer",componentId:"sc-850f7dce-4"})(["height:60px;display:flex;align-items:center;justify-content:center;text-align:center;"]),Zl=/*#__PURE__*/i.styled.span.withConfig({displayName:"WalletName",componentId:"sc-850f7dce-5"})(["text-overflow:ellipsis;white-space:nowrap;color:var(--privy-color-foreground);font-weight:400;flex:1;"]),Kl=/*#__PURE__*/i.styled(dl).withConfig({displayName:"StyledCopyableText",componentId:"sc-850f7dce-6"})(["&&{margin:0.5rem auto 0 auto;}"]);const Ql=({...t})=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...t,children:[/*#__PURE__*/e.jsxs("g",{clipPath:"url(#clip0_2856_1743)",children:[/*#__PURE__*/e.jsx("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),/*#__PURE__*/e.jsx("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2856_1743",children:/*#__PURE__*/e.jsx("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]}),Xl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter((e=>l.isHex(e,{strict:!0}))).map((e=>l.getAddress(e)));return!!t?.length&&!!e?.linkedAccounts.filter((e=>"wallet"==e.type&&t.includes(e.address))).length};let Jl=/*#__PURE__*/n.createContext({plugins:{current:{}}});const ec=()=>{let{plugins:e}=n.useContext(Jl);return n.useCallback((t=>e.current[t]),[e])},tc=Symbol("solana-ledger-plugin"),nc=({title:n="You don't have access to this app",subtitle:r="Have you been invited?",ctaText:a="Try another account",ctaLink:i,onCtaClick:o})=>/*#__PURE__*/e.jsx(ba,{title:n,subtitle:r,icon:t.Lock,iconVariant:"warning",primaryCta:{label:a,onClick:()=>{i?window.open(i,"_blank"):o?.()}},watermark:!0}),rc={component:()=>{let{navigate:t}=Xn(),n=qn(),r=n?.allowlistConfig.errorTitle||"You don't have access to this app",a=n?.allowlistConfig.errorDetail||"Have you been invited?",i=n?.allowlistConfig.errorCtaText||"Try another account",o=n?.allowlistConfig.errorCtaLink;/*#__PURE__*/return e.jsx(nc,{title:r,subtitle:a,ctaText:i,ctaLink:o??void 0,onCtaClick:()=>{t(cg)}})}},ac=({status:r,title:a,description:i,userIntentRequired:o,retriesRemaining:s,hasSelectedCta:l,onContinue:c,onRetry:d})=>{let u=n.useMemo((()=>{switch(r){case"loading":default:return;case"success":return o?{label:l?"Continuing...":"Continue",onClick:c,disabled:l,loading:l}:void 0;case"error":return s>0?{label:"Retry",onClick:d}:void 0}}),[r,l,c,d]),p=n.useMemo((()=>({loading:"loading",ready:"subtle",disabled:"subtle",success:"success",error:"error"}[r]||"loading")),[r]);/*#__PURE__*/return e.jsx(ba,{icon:"loading"===r||"ready"===r?void 0:"success"===r?t.CheckCircle:t.XCircle,iconVariant:p,title:a,subtitle:i,primaryCta:u,watermark:!0})},ic={component:()=>{let{lastScreen:t,data:r,navigate:a,setModalData:i}=Xn(),{status:o,token:s,waitForResult:l,reset:c,execute:d}=qt(),u=n.useRef([]),p=e=>{u.current=[e,...u.current]},[h,g]=n.useState(!0);n.useEffect((()=>(p(setTimeout(g,1e3,!1)),()=>{u.current.forEach((e=>clearTimeout(e))),u.current=[]})),[]);let[m,y]=n.useState(""),[f,x]=n.useState("Checking that you are a human..."),[v,w]=n.useState(!1),[C,b]=n.useState(3),j=r?.captchaModalData,k=async e=>{try{await(j?.callback(e)),j?.onSuccessNavigateTo&&a(j?.onSuccessNavigateTo,!1)}catch(e){if(e instanceof $t)return;i({errorModalData:{error:e,previousScreen:t||cg}}),a(j?.onErrorNavigateTo||Rs,!1)}};n.useEffect((()=>{"success"===o?p(setTimeout((async()=>{let e=await l();!e||j?.userIntentRequired||k(e)}),1e3)):"ready"===o&&p(setTimeout((()=>{"ready"===o&&d()}),500))}),[o]),n.useEffect((()=>{if(!h)switch(o){case"success":y("Success!"),x("CAPTCHA passed successfully."),j?.userIntentRequired||setTimeout((()=>{w(!0),k(s)}),2e3);break;case"loading":y(""),x("Checking that you are a human...");break;case"error":y("Something went wrong"),x(C<=0?"If you use an adblocker or VPN, try disabling and re-attempting.":"You did not pass CAPTCHA. Please try again.")}}),[o,h,v]);/*#__PURE__*/return e.jsx(ac,{status:o,title:m,description:f,userIntentRequired:j?.userIntentRequired,retriesRemaining:C,hasSelectedCta:v,onContinue:()=>{w(!0),k(s)},onRetry:async()=>{if(C<=0)return;b((e=>e-1)),c(),d();let e=await l();!e||j?.userIntentRequired||k(e)}})}},oc=t=>/*#__PURE__*/e.jsx("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"-0.625 12.48 397.647 399.546",width:"2500",height:"674",preserveAspectRatio:"none",...t,children:/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#333745",d:"M 333.9 12.8 L 150.9 12.8 L 150.9 258.4 L 396.5 258.4 L 396.5 76.7 C 396.6 42.2 368.4 12.8 333.9 12.8 Z M 94.7 12.8 L 64 12.8 C 29.5 12.8 0 40.9 0 76.8 L 0 107.5 L 94.7 107.5 L 94.7 12.8 Z M 0 165 L 94.7 165 L 94.7 259.7 L 0 259.7 L 0 165 Z M 301.9 410.6 L 332.6 410.6 C 367.1 410.6 396.6 382.5 396.6 346.6 L 396.6 316 L 301.9 316 L 301.9 410.6 Z M 150.9 316 L 245.6 316 L 245.6 410.7 L 150.9 410.7 L 150.9 316 Z M 0 316 L 0 346.7 C 0 381.2 28.1 410.7 64 410.7 L 94.7 410.7 L 94.7 316 L 0 316 Z"})})}),sc=({onContinueWithLedger:n,onContinueWithoutLedger:r,title:a="Phantom supports Ledger",subtitle:i="Are you using a Ledger hardware wallet?\nContinue to sign with Ledger"})=>/*#__PURE__*/e.jsx(ba,{title:a,subtitle:/*#__PURE__*/e.jsx(dc,{children:i}),primaryCta:{label:"Continue with Ledger",onClick:n},secondaryCta:{label:"Continue without Ledger",onClick:r},watermark:!0,children:/*#__PURE__*/e.jsxs(cc,{children:[/*#__PURE__*/e.jsx(fn,{style:{width:"48px",height:"48px"}}),/*#__PURE__*/e.jsx(t.ArrowRightLeft,{strokeWidth:2,color:"var(--privy-color-icon-subtle)",width:22,height:22}),/*#__PURE__*/e.jsx(oc,{style:{width:"48px",height:"48px"}})]})});const lc={component:function(){let{data:t,setModalData:n,navigate:r}=Xn();/*#__PURE__*/return e.jsx(sc,{onContinueWithLedger:function(){n({...t,login:{...t?.login,isSigningInWithLedgerSolana:!0}}),r(yc)},onContinueWithoutLedger:function(){n({...t,login:{...t?.login,isSigningInWithLedgerSolana:!1}}),r(yc)}})}};let cc=/*#__PURE__*/i.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-218811f1-0"})(["display:flex;align-items:center;justify-content:center;gap:8px;margin-bottom:var(--screen-space);"]),dc=/*#__PURE__*/i.styled.span.withConfig({displayName:"SubtitleText",componentId:"sc-218811f1-1"})(["white-space:pre-wrap;"]);const uc=({style:t,...n})=>/*#__PURE__*/e.jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...t},...n,children:/*#__PURE__*/e.jsx("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})}),pc=({title:t="Unable to sign in",subtitle:n="This is a test application that has reached its user limit. To allow more users, this app needs to be upgraded to production.",onGoBack:r})=>/*#__PURE__*/e.jsx(ba,{title:t,subtitle:n,icon:uc,iconVariant:"subtle",primaryCta:{label:"Go back",onClick:r},showBack:!0,onBack:r,watermark:!0}),hc={component:()=>{let{navigate:t}=Xn();/*#__PURE__*/return e.jsx(pc,{onGoBack:()=>{t(cg)}})}},gc=e=>e?.privyErrorCode===d.PrivyErrorCode.LINKED_TO_ANOTHER_USER?on.ERROR_USER_EXISTS:e instanceof an&&!e.details.default?e.details:e instanceof tn?on.ERROR_TIMED_OUT:e?.privyErrorCode===d.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE?on.ERROR_USER_LIMIT_REACHED:on.ERROR_WALLET_CONNECTION,mc=({walletLogo:t,title:n,subtitle:r,signSuccess:a,errorMessage:i,connectSuccess:o,separateConnectAndSign:s,signing:l,walletConnectRedirectUri:c,walletConnectFallbackUniversalUri:d,hasTabbedAway:u,showCoinbaseWalletResetCta:p,numRetries:h,onBack:g,onSign:m,onRetry:y,onCoinbaseReset:f,onDifferentWallet:x})=>{let v=p?{label:"Use a different wallet",onClick:f,disabled:a}:i===on.ERROR_USER_EXISTS&&g?{label:"Use a different wallet",onClick:x}:o&&!a&&s?{label:l?"Signing":"Sign with your wallet",onClick:m,disabled:l}:!a&&i?.retryable&&h<2?{label:"Retry",onClick:y,disabled:!1}:a||i?void 0:{label:"Connecting",onClick:()=>{},disabled:!0};/*#__PURE__*/return e.jsx(ba,{title:n,subtitle:r,icon:t,iconVariant:"loading",iconLoadingStatus:{success:a,fail:!!i},primaryCta:v,onBack:g,watermark:!0,children:!o&&c&&!u&&/*#__PURE__*/e.jsxs(fc,{children:["Still here?"," ",/*#__PURE__*/e.jsx(ps,{href:c,target:"_blank",variant:"underlined",size:"sm",children:"Try connecting again"}),d&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[" ","or"," ",/*#__PURE__*/e.jsx(ps,{href:d,target:"_blank",variant:"underlined",size:"sm",children:"use this different link"})]})]})})},yc={component:()=>{let t,[i,o]=n.useState(!1),[s,l]=n.useState(!1),[c,u]=n.useState(void 0),{authenticated:p,logout:h}=a.usePrivyContext(),{navigate:g,navigateBack:m,lastScreen:y,currentScreen:f,setModalData:x,data:w}=Xn(),C=qn(),{getAuthFlow:b,walletConnectionStatus:j,closePrivyModal:k,initLoginWithWallet:T,loginWithWallet:A,updateWallets:S,createAnalyticsEvent:E}=r.usePrivyInternal(),{walletConnectors:I}=a.usePrivyContext(),[P,N]=n.useState(0),{user:_}=a.usePrivyContext(),M=ec(),[F]=n.useState(_?.linkedAccounts.length||0),[L,W]=n.useState(""),[D,R]=n.useState(""),[O,B]=n.useState(!1),{hasTabbedAway:U}=function(){let[e,t]=n.useState(!1),r=n.useCallback((()=>{document.hidden&&t(!0)}),[]);return n.useEffect((()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r))),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}(),{enabled:z,token:H}=qt(),V=Nn(j?.connector?.walletClientType||"unknown"),$=v.isMobile&&"wallet_connect_v2"===j?.connector?.connectorType||v.isMobile&&"coinbase_wallet"===j?.connector?.connectorType||v.isMobile&&"base_account"===j?.connector?.connectorType||v.isMobile&&"injected"===j?.connector?.connectorType&&"phantom"===j?.connector?.walletClientType||v.isMobile&&"solana_adapter"===j?.connector?.connectorType&&"mobile_wallet_adapter"===j.connector.walletClientType,q="connected"===j?.status,G="switching_to_supported_chain"===j?.status;n.useEffect((()=>{let e=b(),t=e instanceof Et||e instanceof Pt?e:void 0;q&&"solana"===j.connector?.chainType&&"phantom"===j.connector?.walletClientType&&M(tc)&&void 0===w?.login?.isSigningInWithLedgerSolana?g(lc,!1):(q&&!t&&(!z||H||p?T(j.connectedWallet,H,w?.login?.disableSignup,w?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{B(!0)})):(x({captchaModalData:{callback:e=>T(j.connectedWallet,e,w?.login?.disableSignup,w?.login?.isSigningInWithLedgerSolana?"transaction":"plain").then((()=>{B(!0)})),userIntentRequired:!1,onSuccessNavigateTo:yc,onErrorNavigateTo:Rs}}),g(ic,!1))),t instanceof Pt&&w?.login?.isSigningInWithLedgerSolana&&(t.messageType="transaction"),t&&$&&q&&!t.preparedMessage?t.buildMessage():t&&!$&&q&&(s||(async()=>{l(!0),u(void 0);try{"wallet_connect_v2"===j?.connector?.connectorType&&"metamask"===j?.connector?.walletClientType&&await Ot(2500),await Z()}catch(e){console.warn("Auto-prompted signature failed",e)}finally{l(!1)}})()))}),[P,q,O]),n.useEffect((()=>{if(_&&i){let e=900;if(C?.legal.requireUsersAcceptTerms&&!_.hasAcceptedTerms){let t=setTimeout((()=>{g(nl)}),e);return()=>clearTimeout(t)}if(fs(_,C.embeddedWallets)){let t=setTimeout((()=>{x({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),E({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"ConnectionStatusScreen"}}),h()},callAuthOnSuccessOnClose:!0}}),g(tl)}),e);return()=>clearTimeout(t)}S();let t=setTimeout((()=>k({shouldCallAuthOnSuccess:!0,isSuccess:!0})),at);return()=>clearTimeout(t)}}),[_,i]);let Y=e=>{if(e?.privyErrorCode!==d.PrivyErrorCode.ALLOWLIST_REJECTED){if(e?.privyErrorCode===d.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new d.PrivyUserLimitReachedError(e).toString()),void g(hc);if(e?.privyErrorCode!==d.PrivyErrorCode.USER_DOES_NOT_EXIST)return e?.privyErrorCode===d.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce?(x({accountTransfer:{nonce:e.data?.data?.nonce,account:b()?.meta.address,displayName:e.data?.data?.account?.displayName,externalWalletMetadata:{walletClientType:b()?.meta.walletClientType,chainId:b()?.meta.chainId,connectorType:b()?.meta.connectorType},linkMethod:b()instanceof Et?"siwe":"siws",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void g(Qs)):void u(gc(e));g(vs)}else g(rc)};async function Z(){try{await A(),o(!0)}catch(e){Y(e)}finally{l(!1)}}n.useEffect((()=>{j?.connectError&&Y(j?.connectError)}),[j]),((e,t)=>{let r=n.useRef((()=>{}));n.useEffect((()=>{r.current=e})),n.useEffect((()=>{if(null!==t){let e=setInterval((()=>r.current()),t||0);return()=>clearInterval(e)}}),[t])})((()=>{let e="wallet_connect_v2"===K&&j?.connector instanceof Zn?j.connector.redirectUri:void 0;e&&W(e);let t="wallet_connect_v2"===K&&j?.connector instanceof Zn?j.connector.fallbackUniversalRedirectUri:void 0;t&&R(t)}),j?.connector instanceof Zn&&!L?500:null);let K=j?.connector?.connectorType||"injected",Q=j?.connector?.walletClientType||"unknown",X=V?.metadata?.shortName||V?.name||j?.connector?.walletBranding.name||"Browser Extension",J=V?.image_url?.md||j?.connector?.walletBranding.icon||(t=>/*#__PURE__*/e.jsx(mn,{...t})),ee="Browser Extension"===X?X.toLowerCase():X;t=i?`Successfully connected with ${ee}`:c?c.message:G?"Switching networks":q?s&&$?"Signing":"Sign to verify":`Waiting for ${ee}`;let te="Don’t see your wallet? Check your other browser windows.";i?te=F===(_?.linkedAccounts.length||0)?"Wallet was already linked.":"You’re good to go!":P>=2&&c?te="Unable to connect wallet":c?te=c.detail:G?te="Switch your wallet to the requested network.":q&&$?te="Sign the message in your wallet to verify it belongs to you.":"metamask"===Q&&v.isMobile?te="Click continue to open and connect MetaMask.":"metamask"===Q?te="For the best experience, connect only one wallet at a time.":"wallet_connect"===K?te="Open your mobile wallet app to continue":"coinbase_wallet"===K?Mt()||(te=Xl(_)?"Continue with the Coinbase app. Not the right wallet? Reset your connection below.":"Confirm in the Coinbase app/popup to continue."):w?.login?.isSigningInWithLedgerSolana&&(te="Ledger requires a transaction to verify your identity. You’ll sign a transaction that performs no onchain action.");let ne=I?.walletConnectors?.find((e=>"coinbase_wallet"===e.walletClientType)),re="coinbase_wallet"===Q&&(Xl(_)||c===on.ERROR_USER_EXISTS);/*#__PURE__*/return e.jsx(mc,{walletLogo:J,title:t,subtitle:te,signSuccess:i,errorMessage:c,connectSuccess:q,separateConnectAndSign:$,signing:s,walletConnectRedirectUri:L,walletConnectFallbackUniversalUri:D,hasTabbedAway:U,showCoinbaseWalletResetCta:re,numRetries:P,onBack:y&&f!==y?m:void 0,onSign:()=>{l(!0),Z()},onRetry:()=>{N(P+1),u(void 0),q?(l(!0),Z()):j?.connectRetry()},onCoinbaseReset:()=>{ne&&ne?.disconnect()},onDifferentWallet:m})}};let fc=/*#__PURE__*/i.styled.p.withConfig({displayName:"RedirectLinksContainer",componentId:"sc-7b4251f2-0"})(["text-align:center;color:var(--privy-color-foreground-2);font-size:14px;line-height:22px;margin:16px 0;"]);const xc={component:()=>{let{setWalletConnectionStatus:t,closePrivyModal:a,inProgressAuthFlowRef:i}=r.usePrivyInternal(),{data:o,navigate:s}=Xn(),l=qn(),c=rr(),u=o?.externalConnectWallet?.description,p=n.useRef(o?.externalConnectWallet?.walletList??l.appearance.walletList),h=n.useRef(o?.externalConnectWallet?.walletChainType??l.appearance.walletChainType),g=p.current,m=h.current,y="link"===i.current?void 0:()=>s(cg);/*#__PURE__*/return e.jsx(Hl,{walletList:g,walletChainType:m,onClose:a,onConnect:n.useCallback((({connector:e,wallet:n})=>{c("connectWallet","onSuccess",{wallet:n}),t({status:"connected",connectedWallet:n,connector:e,connectError:null,connectRetry:()=>null}),s(yc,!o?.externalConnectWallet?.preSelectedWalletId)}),[t,s,o?.login?.disableSignup,o?.externalConnectWallet?.preSelectedWalletId]),onConnectError:e=>{e instanceof d.PrivyError?(console.warn(e.cause?e.cause:e.message),c("connectWallet","onError",e.privyErrorCode||d.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),c("connectWallet","onError",d.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR))},onBack:y,customDescription:u||"",preSelectedWalletId:o?.externalConnectWallet?.preSelectedWalletId,app:l})},isUnauthenticatedScreem:!0},vc=({children:t,theme:n})=>/*#__PURE__*/e.jsxs(wc,{$theme:n,children:[/*#__PURE__*/e.jsx(ze.default,{width:"20px",height:"20px",color:"var(--privy-color-icon-subtle)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/e.jsx(Cc,{$theme:n,children:t})]});let wc=/*#__PURE__*/i.styled.div.withConfig({displayName:"Container",componentId:"sc-1b5ed8dd-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-background-2);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),Cc=/*#__PURE__*/i.styled.div.withConfig({displayName:"Content",componentId:"sc-1b5ed8dd-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const bc=/*#__PURE__*/i.styled.span.withConfig({displayName:"Subtitle",componentId:"sc-7a11f796-0"})(["margin-top:4px;color:var(--privy-color-foreground);text-align:center;font-size:0.875rem;font-weight:400;line-height:1.375rem;&& a{color:var(--privy-color-accent);}"]),jc=/*#__PURE__*/i.styled.span.withConfig({displayName:"Title",componentId:"sc-66de63c-0"})(["color:var(--privy-color-foreground);font-size:1.125rem;font-weight:600;line-height:1.875rem;text-align:center;"]),kc=/*#__PURE__*/i.styled.span.withConfig({displayName:"LabelXs",componentId:"sc-4c43f9fd-0"})(["color:var(--privy-color-foreground-3);font-size:0.75rem;font-weight:500;line-height:1.125rem;"]),Tc=/*#__PURE__*/i.css(["&&{border-width:1px;padding:0.5rem 1rem;}width:100%;text-align:left;border:solid 1px var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);display:flex;justify-content:space-between;align-items:center;",""],(e=>"error"===e.$state?"\n border-color: var(--privy-color-error);\n background: var(--privy-color-error-bg);\n ":"")),Ac=/*#__PURE__*/i.styled.div.withConfig({displayName:"Box",componentId:"sc-7252360a-0"})(["",""],Tc);let Sc=/*#__PURE__*/i.styled(Ac).withConfig({displayName:"StyledBox",componentId:"sc-4010d8f3-0"})(["&&{padding:0.75rem;height:56px;}"]),Ec=/*#__PURE__*/i.styled.div.withConfig({displayName:"WalletContent",componentId:"sc-4010d8f3-1"})(["display:flex;align-items:center;justify-content:space-between;width:100%;"]),Ic=/*#__PURE__*/i.styled.div.withConfig({displayName:"AddressContainer",componentId:"sc-4010d8f3-2"})(["display:flex;flex-direction:column;gap:0;"]),Pc=/*#__PURE__*/i.styled.div.withConfig({displayName:"BalanceText",componentId:"sc-4010d8f3-3"})(["font-size:12px;line-height:1rem;color:var(--privy-color-foreground-3);"]),Nc=/*#__PURE__*/i.styled(kc).withConfig({displayName:"TitleLabel",componentId:"sc-4010d8f3-4"})(["text-align:left;margin-bottom:0.5rem;"]),_c=/*#__PURE__*/i.styled(wl).withConfig({displayName:"StyledErrorMessage",componentId:"sc-4010d8f3-5"})(["margin-top:0.25rem;"]),Mc=/*#__PURE__*/i.styled(Fr).withConfig({displayName:"CopyButton",componentId:"sc-4010d8f3-6"})(["&&{gap:0.375rem;font-size:14px;}"]);const Fc=({errMsg:r,balance:a,address:i,className:o,title:s,showCopyButton:l=!1})=>{let[c,d]=n.useState(!1);return n.useEffect((()=>{if(c){let e=setTimeout((()=>d(!1)),3e3);return()=>clearTimeout(e)}}),[c]),/*#__PURE__*/e.jsxs("div",{children:[s&&/*#__PURE__*/e.jsx(Nc,{children:s}),/*#__PURE__*/e.jsx(Sc,{className:o,$state:r?"error":void 0,children:/*#__PURE__*/e.jsxs(Ec,{children:[/*#__PURE__*/e.jsxs(Ic,{children:[/*#__PURE__*/e.jsx(Cs,{address:i,showCopyIcon:!1}),void 0!==a&&/*#__PURE__*/e.jsx(Pc,{children:a})]}),l&&/*#__PURE__*/e.jsx(Mc,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(i).then((()=>d(!0))).catch(console.error)},size:"sm",children:c?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(t.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(t.Copy,{size:14})]})})]})}),r&&/*#__PURE__*/e.jsx(_c,{children:r})]})};function Lc({rpcConfig:e,appId:t,address:a,chain:i}){let{chains:o}=r.usePrivyInternal(),[s,c]=n.useState(0n),[d,u]=n.useState(!1),p=n.useMemo((()=>{let n=i||o[0];if(n)return l.createPublicClient({chain:i,transport:l.http(Lt(n,e,t))})}),[i,e,t]),h=n.useCallback((async()=>{if(!a||!p)return;u(!0);let e=await p.getBalance({address:a}).catch(console.error);return e?(c(e),u(!1),e):void 0}),[p,a,c]);return n.useEffect((()=>{h().catch(console.error)}),[]),{balance:s,isLoading:d,reloadBalance:h}}const Wc="sdk_fiat_on_ramp_completed_with_status";async function Dc({rpc:e,address:t}){return(await e.getBalance(t,{commitment:"confirmed"}).send()).value??0n}function Rc(e){switch(e){case"solana:mainnet":return"Solana";case"solana:devnet":return"Devnet";case"solana:testnet":return"Testnet"}}function Oc(e){let[t]=Object.entries(La[e]).find((([e,t])=>"USDC"===t.symbol))??[];return t}const Bc=async({chain:e,address:t,appId:n,rpcConfig:r,erc20Address:a})=>{let i=l.createPublicClient({chain:e,transport:l.http(Lt(e,r,n))});return{balance:await i.readContract({address:a,abi:Uc,functionName:"balanceOf",args:[t]}).catch((()=>0n)),chain:e}};let Uc=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];const zc={component:()=>{let{wallets:t}=Ni(),{connectors:a}=r.usePrivyInternal(),i=a.filter(Sn).flatMap((e=>e.wallets)),{data:o,setModalData:s,navigate:d,lastScreen:u}=Xn(),{rpcConfig:p,appId:h,createAnalyticsEvent:g,closePrivyModal:m}=r.usePrivyInternal(),y=qn(),[f,x]=n.useState(void 0),[v,w]=n.useState(!1),C=o?.funding,{reloadBalance:b}=Lc({rpcConfig:p,appId:h,address:"ethereum"===C.chainType?C.address:void 0,chain:"ethereum"===C.chainType?C.chain:void 0}),j="solana"===C.chainType,k=j?C.isUSDC?"USDC":"SOL":C.erc20Address?C.erc20ContractInfo?.symbol:C.chain.nativeCurrency.symbol,T=j?i.find((({address:e})=>e===C.address)):t.find((({address:e})=>Dt(e)===Dt(C.address)));if(!C)return s({errorModalData:{error:Error("Couldn't find funding config"),previousScreen:u||Vp},funding:o?.funding,solanaFundingData:o?.solanaFundingData,sendTransaction:o?.sendTransaction}),d(Rs),/*#__PURE__*/e.jsx(e.Fragment,{});n.useEffect((()=>{let e=j?async function(){if("solana"!==C.chainType)return;let e=y.solanaRpcs[C.chain];e?(C.isUSDC?async function({rpc:e,address:t,mintAddress:n}){let r=await e.getTokenAccountsByOwner(t,{mint:n},{encoding:"jsonParsed",commitment:"confirmed"}).send(),a=r.value[0]?.account;return a?BigInt(a.data.parsed.info.tokenAmount.amount):0n}({rpc:e.rpc,address:C.address,mintAddress:Oc(C.chain)}):Dc({rpc:e.rpc,address:C.address})).then((e=>{let t=BigInt(e);f&&t>f&&(w(!0),g({eventName:Wc,payload:{provider:"manual",status:"success",chainType:"solana",address:T?.address,value:C.isUSDC?l.formatUnits(t-f,6):l.formatUnits(t-f,9),token:C.isUSDC?"USDC":"SOL"}})),x(t)})):console.warn("Unable to load solana rpc, skipping balance")}:async function(){"ethereum"===C.chainType&&(async()=>{if(!C.erc20Address)return await b()??BigInt(0);{let{balance:e}=await Bc({chain:C.chain,address:C.address,erc20Address:C.erc20Address,rpcConfig:p,appId:h});return e}})().then((e=>{f&&e>f&&(w(!0),g({eventName:Wc,payload:{provider:"manual",status:"success",chainType:"ethereum",address:T?.address,chainId:C.chain.id,value:l.formatUnits(e-f,C.erc20ContractInfo?.decimals??18),token:C.erc20ContractInfo?.symbol??C.erc20Address??"ETH"}})),x(e)})).catch((()=>x(void 0)))},t=setInterval(e,2e3);return e(),()=>clearInterval(t)}),[f]);let A=n.useMemo((()=>null==f?"":C.isUSDC?c.formatTokenAmount({amount:f,decimals:6}):j?Ra(f,3,!0,!0):null!=C.erc20ContractInfo?.decimals?c.formatTokenAmount({amount:f,decimals:C.erc20ContractInfo.decimals}):c.formatWeiAmount({wei:f})),[f,j,C]),S="ethereum"===C.chainType?C.chain.name:Rc(C.chain),E=n.useMemo((()=>""===C.uiConfig?.receiveFundsTitle?null:/*#__PURE__*/e.jsx(jc,{children:C.uiConfig?.receiveFundsTitle??`Receive ${C.amount} ${k??""}`.trim()})),[C.uiConfig?.receiveFundsTitle,C.amount,k]),I=n.useMemo((()=>""===C.uiConfig?.receiveFundsSubtitle?null:/*#__PURE__*/e.jsx(bc,{children:C.uiConfig?.receiveFundsSubtitle??`Scan this code or copy your wallet address to receive funds on ${S}.`})),[C.uiConfig?.receiveFundsSubtitle,S]),P="solana"===C.chainType&&C.isUSDC&&Oc(C.chain)?`?spl-token=${Oc(C.chain)}`:"";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),E,I,/*#__PURE__*/e.jsxs(Ka,{style:{gap:"1rem",margin:E||I?"1rem 0":"0"},children:[/*#__PURE__*/e.jsx(vl,{url:`${C.chainType}:${C.address}${P}`,size:200,squareLogoElement:Hc}),/*#__PURE__*/e.jsxs(vc,{theme:y.appearance.palette.colorScheme,children:["Make sure to send funds on ",S,"."]}),/*#__PURE__*/e.jsx(Fc,{title:"Your wallet",errMsg:void 0,showCopyButton:!0,balance:`${A} ${k}`,address:C.address}),v&&/*#__PURE__*/e.jsx(Pr,{onClick:()=>m({shouldCallAuthOnSuccess:!1,isSuccess:!0}),children:"Continue"})]}),/*#__PURE__*/e.jsx(xr,{})]})}};let Hc=({...t})=>/*#__PURE__*/e.jsx(hn,{color:"black",...t});let Vc=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}];const $c=async({address:e,chain:t,rpcConfig:n,privyAppId:r})=>{try{let a=l.createPublicClient({chain:t,transport:l.http(Lt(t,n,r))}),[i,o]=await Promise.all([a.readContract({abi:qc,address:e,functionName:"symbol"}),a.readContract({abi:qc,address:e,functionName:"decimals"})]);return{decimals:o,symbol:i}}catch(e){return console.log(e),null}};let qc=[{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"}],Gc=2n**256n-1n;const Yc=({amount:e,decimals:t})=>e===Gc?"Maximum":Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(Number(e)/10**t);let Zc=({data:t})=>{let n=t=>"object"==typeof t&&null!==t?/*#__PURE__*/e.jsx(Qc,{children:Object.entries(t).map((([t,r])=>/*#__PURE__*/e.jsxs("li",{children:[/*#__PURE__*/e.jsxs("strong",{children:[t,":"]})," ",n(r)]},t)))}):/*#__PURE__*/e.jsx("span",{children:String(t)});/*#__PURE__*/return e.jsx("div",{children:n(t)})};const Kc=/*#__PURE__*/i.styled.div.withConfig({displayName:"Message",componentId:"sc-70ec2a4f-0"})(["margin-top:1.5rem;background-color:var(--privy-color-background-2);border-radius:var(--privy-border-radius-md);padding:12px;text-align:left;max-height:310px;overflow:scroll;white-space:pre-wrap;width:100%;font-size:0.875rem;font-weight:400;color:var(--privy-color-foreground);line-height:1.5;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"]);let Qc=/*#__PURE__*/i.styled.ul.withConfig({displayName:"MessageList",componentId:"sc-70ec2a4f-1"})(["margin-left:12px !important;white-space:nowrap;&:first-child{margin-left:0 !important;}strong{font-weight:500 !important;}"]);const Xc=({data:t,className:n})=>/*#__PURE__*/e.jsx(Kc,{className:n,children:/*#__PURE__*/e.jsx(Zc,{data:t})});let Jc=/*#__PURE__*/i.styled.div.withConfig({displayName:"Container",componentId:"sc-b3a607dd-0"})(["display:flex;flex-direction:column;min-height:72px;"]);var ed=({onBack:t,details:n})=>/*#__PURE__*/e.jsxs(Jc,{children:[/*#__PURE__*/e.jsx(Hr,{backFn:t}),/*#__PURE__*/e.jsx(Xc,{data:n}),/*#__PURE__*/e.jsx(xr,{})]});const td=/*#__PURE__*/i.styled.span.withConfig({displayName:"LabelSm",componentId:"sc-6c002d6-0"})(["color:var(--privy-color-foreground-3);font-size:0.875rem;font-weight:400;line-height:1.375rem;"]),nd=/*#__PURE__*/i.styled(td).withConfig({displayName:"LabelSmPrimary",componentId:"sc-6c002d6-1"})(["color:var(--privy-color-accent);"]),rd=/*#__PURE__*/i.styled(td).withConfig({displayName:"InteractiveLabel",componentId:"sc-b57d0824-0"})(["cursor:pointer;display:inline-flex;gap:8px;align-items:center;color:var(--privy-color-accent);svg{fill:var(--privy-color-accent);}"]),ad=/*#__PURE__*/i.styled.span.withConfig({displayName:"Rows",componentId:"sc-b764aab6-0"})(["display:flex;flex-direction:column;gap:0.35rem;width:100%;"]),id=/*#__PURE__*/i.styled.span.withConfig({displayName:"Row",componentId:"sc-b764aab6-1"})(["display:flex;width:100%;justify-content:space-between;gap:0.5rem;"]);let od=/*#__PURE__*/i.keyframes(["from,to{background:var(--privy-color-foreground-4);color:var(--privy-color-foreground-4);}50%{background:var(--privy-color-foreground-accent);color:var(--privy-color-foreground-accent);}"]);const sd=/*#__PURE__*/i.css(["",""],(e=>e.$isLoading?/*#__PURE__*/i.css(["width:35%;animation:"," 2s linear infinite;border-radius:var(--privy-border-radius-sm);"],od):"")),ld=/*#__PURE__*/i.styled.span.withConfig({displayName:"Value",componentId:"sc-72aa026-0"})(["color:var(--privy-color-foreground);font-size:0.875rem;font-weight:500;line-height:1.375rem;word-break:break-all;text-align:right;",""],sd);var cd=({iconUrl:t,value:n,symbol:r,usdValue:a,nftName:i,nftCount:o,decimals:s,$isLoading:l})=>{if(l)/*#__PURE__*/return e.jsx(dd,{$isLoading:l});let c=n&&a&&s?function(e,t,n){let r=parseFloat(e),a=parseFloat(n);if(0===r||0===a||Number.isNaN(r)||Number.isNaN(a))return e;let i=Math.ceil(-Math.log10(.01/(a/r))),o=Math.pow(10,i=Math.max(i=Math.min(i,t),1)),s=+(Math.floor(r*o)/o).toFixed(i).replace(/\.?0+$/,"");return Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(s)}(n,s,a):n;/*#__PURE__*/return e.jsxs("div",{children:[/*#__PURE__*/e.jsxs(dd,{$isLoading:l,children:[t&&/*#__PURE__*/e.jsx(pd,{src:t,alt:"Token icon"}),o&&o>1?o+"x":void 0," ",i,c," ",r]}),a&&/*#__PURE__*/e.jsxs(ud,{$isLoading:l,children:["$",a]})]})};let dd=/*#__PURE__*/i.styled.span.withConfig({displayName:"Value",componentId:"sc-991db279-0"})(["color:var(--privy-color-foreground);font-size:0.875rem;font-weight:500;line-height:1.375rem;word-break:break-all;text-align:right;display:flex;justify-content:flex-end;",""],sd);const ud=/*#__PURE__*/i.styled.span.withConfig({displayName:"Subvalue",componentId:"sc-991db279-1"})(["color:var(--privy-color-foreground-2);font-size:12px;font-weight:400;line-height:18px;word-break:break-all;text-align:right;display:flex;justify-content:flex-end;",""],sd);let pd=/*#__PURE__*/i.styled.img.withConfig({displayName:"TokenIcon",componentId:"sc-991db279-2"})(["height:14px;width:14px;margin-right:4px;object-fit:contain;"]);const hd=t=>{let{chain:n,transactionDetails:r,isTokenContractInfoLoading:a,symbol:i}=t,{action:o,functionName:s}=r;/*#__PURE__*/return e.jsx(Ac,{children:/*#__PURE__*/e.jsxs(ad,{children:["transaction"!==o&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Action"}),/*#__PURE__*/e.jsx(ld,{children:s})]}),"mint"===s&&"args"in r&&r.args.filter((e=>e)).map(((t,r)=>/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:`Param ${r}`}),/*#__PURE__*/e.jsx(ld,{children:"string"==typeof t&&l.isAddress(t)?/*#__PURE__*/e.jsx(Cs,{address:t,url:n?.blockExplorers?.default?.url,showCopyIcon:!1}):t?.toString()})]},r))),"setApprovalForAll"===s&&r.operator&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Operator"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r.operator,url:n?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),"setApprovalForAll"===s&&void 0!==r.approved&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Set approval to"}),/*#__PURE__*/e.jsx(ld,{children:r.approved?"true":"false"})]}),"transfer"===s||"transferFrom"===s||"safeTransferFrom"===s||"approve"===s?/*#__PURE__*/e.jsxs(e.Fragment,{children:["formattedAmount"in r&&r.formattedAmount&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsxs(ld,{$isLoading:a,children:[r.formattedAmount," ",i]})]}),"tokenId"in r&&r.tokenId&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token ID"}),/*#__PURE__*/e.jsx(ld,{children:r.tokenId.toString()})]})]}):null,"safeBatchTransferFrom"===s&&/*#__PURE__*/e.jsxs(e.Fragment,{children:["amounts"in r&&r.amounts&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amounts"}),/*#__PURE__*/e.jsx(ld,{children:r.amounts.join(", ")})]}),"tokenIds"in r&&r.tokenIds&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token IDs"}),/*#__PURE__*/e.jsx(ld,{children:r.tokenIds.join(", ")})]})]}),"approve"===s&&r.spender&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Spender"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r.spender,url:n?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===s||"safeTransferFrom"===s||"safeBatchTransferFrom"===s)&&r.transferFrom&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Transferring from"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r.transferFrom,url:n?.blockExplorers?.default?.url,showCopyIcon:!1})})]}),("transferFrom"===s||"safeTransferFrom"===s||"safeBatchTransferFrom"===s)&&r.transferTo&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Transferring to"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r.transferTo,url:n?.blockExplorers?.default?.url,showCopyIcon:!1})})]})]})})},gd=({children:t,theme:n})=>/*#__PURE__*/e.jsxs(md,{$theme:n,children:[/*#__PURE__*/e.jsx(we.default,{width:"20px",height:"20px",color:"var(--privy-color-icon-error)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/e.jsx(yd,{$theme:n,children:t})]});let md=/*#__PURE__*/i.styled.div.withConfig({displayName:"Container",componentId:"sc-34910fd1-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-error-bg);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),yd=/*#__PURE__*/i.styled.div.withConfig({displayName:"Content",componentId:"sc-34910fd1-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const fd=({children:t,theme:n})=>/*#__PURE__*/e.jsxs(xd,{$theme:n,children:[/*#__PURE__*/e.jsx(xe.default,{width:"20px",height:"20px",color:"var(--privy-color-icon-warning)",strokeWidth:2,style:{flexShrink:0}}),/*#__PURE__*/e.jsx(vd,{$theme:n,children:t})]});let xd=/*#__PURE__*/i.styled.div.withConfig({displayName:"Container",componentId:"sc-a77c2854-0"})(["display:flex;gap:0.75rem;background-color:var(--privy-color-warn-bg);align-items:flex-start;padding:1rem;border-radius:0.75rem;"]),vd=/*#__PURE__*/i.styled.div.withConfig({displayName:"Content",componentId:"sc-a77c2854-1"})(["color:",";font-size:1rem;font-weight:400;line-height:1.5;flex:1;text-align:left;"],(e=>"dark"===e.$theme?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)"));const wd=({variant:t,setPreventMaliciousTransaction:n,colorScheme:r="light",preventMaliciousTransaction:a})=>"warn"===t?/*#__PURE__*/e.jsx(Cd,{children:/*#__PURE__*/e.jsxs(fd,{theme:r,children:[/*#__PURE__*/e.jsx("span",{style:{fontWeight:"500"},children:"Warning: Suspicious transaction"}),/*#__PURE__*/e.jsx("br",{}),"This has been flagged as a potentially deceptive request. Approving could put your assets or funds at risk."]})}):"error"===t?/*#__PURE__*/e.jsx(e.Fragment,{children:/*#__PURE__*/e.jsxs(Cd,{children:[/*#__PURE__*/e.jsx(gd,{theme:r,children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx("strong",{children:"This is a malicious transaction"}),/*#__PURE__*/e.jsx("br",{}),"This transaction transfers tokens to a known malicious address. Proceeding may result in the loss of valuable assets."]})}),/*#__PURE__*/e.jsxs(bd,{children:[/*#__PURE__*/e.jsx(So,{color:"var(--privy-color-error)",checked:!a,readOnly:!0,onClick:()=>n(!a)}),/*#__PURE__*/e.jsx("span",{children:"I understand and want to proceed anyways."})]})]})}):null;let Cd=/*#__PURE__*/i.styled.div.withConfig({displayName:"BannerContainer",componentId:"sc-ab8a5a0b-0"})(["margin-top:1.5rem;"]),bd=/*#__PURE__*/i.styled.div.withConfig({displayName:"CheckboxContainer",componentId:"sc-ab8a5a0b-1"})(["display:flex;align-items:center;gap:0.5rem;margin-top:0.75rem;"]);const jd=({transactionIndex:e,maxIndex:t})=>"number"!=typeof e||0===t?"":` (${e+1} / ${t+1})`,kd=({img:t,submitError:r,prepareError:a,onClose:i,action:o,title:s,subtitle:l,to:c,tokenAddress:d,network:u,missingFunds:p,fee:h,from:g,cta:m,disabled:y,chain:f,isSubmitting:x,isPreparing:v,isTokenPriceLoading:w,isTokenContractInfoLoading:C,isSponsored:b,symbol:j,balance:k,onClick:T,transactionDetails:A,transactionIndex:S,maxIndex:E,onBack:I,chainName:P,validation:N,hasScanDetails:_,setIsScanDetailsOpen:M,preventMaliciousTransaction:F,setPreventMaliciousTransaction:L,tokensSent:W,tokensReceived:D,isScanning:R,isCancellable:O,functionName:U})=>{let{showTransactionDetails:z,setShowTransactionDetails:H,hasMoreDetails:V,isErc20Ish:$}=(e=>{let[t,r]=n.useState(!1),a=!0,i=!1;return(!e||e.isErc20Ish||"transaction"===e.action)&&(a=!1),a&&(i=Object.entries(e||{}).some((([e,t])=>t&&!["action","isErc20Ish","isNFTIsh"].includes(e)))),{showTransactionDetails:t,setShowTransactionDetails:r,hasMoreDetails:a&&i,isErc20Ish:e?.isErc20Ish}})(A),q=qn(),G=$&&C||v||w||R;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:i,backFn:I}),t&&/*#__PURE__*/e.jsx(Ed,{children:t}),/*#__PURE__*/e.jsxs(jc,{style:{marginTop:t?"1.5rem":0},children:[s,/*#__PURE__*/e.jsx(jd,{maxIndex:E,transactionIndex:S})]}),/*#__PURE__*/e.jsx(bc,{children:l}),/*#__PURE__*/e.jsxs(ad,{style:{marginTop:"2rem"},children:[(!!W[0]||G)&&/*#__PURE__*/e.jsxs(id,{children:[D.length>0?/*#__PURE__*/e.jsx(td,{children:"Send"}):/*#__PURE__*/e.jsx(td,{children:"approve"===o?"Approval amount":"Amount"}),/*#__PURE__*/e.jsx("div",{className:"flex flex-col",children:W.map(((t,n)=>/*#__PURE__*/e.jsx(cd,{iconUrl:t.iconUrl,value:"setApprovalForAll"===U?"All":t.value,usdValue:t.usdValue,symbol:t.symbol,nftName:t.nftName,nftCount:t.nftCount,decimals:t.decimals},n)))})]}),D.length>0&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Receive"}),/*#__PURE__*/e.jsx("div",{className:"flex flex-col",children:D.map(((t,n)=>/*#__PURE__*/e.jsx(cd,{iconUrl:t.iconUrl,value:t.value,usdValue:t.usdValue,symbol:t.symbol,nftName:t.nftName,nftCount:t.nftCount,decimals:t.decimals},n)))})]}),A&&"spender"in A&&A?.spender?/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Spender"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:A.spender,url:f?.blockExplorers?.default?.url})})]}):null,c&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"To"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:c,url:f?.blockExplorers?.default?.url,showCopyIcon:!0})})]}),d&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token address"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:d,url:f?.blockExplorers?.default?.url})})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Network"}),/*#__PURE__*/e.jsx(ld,{children:u})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(ld,{$isLoading:v||w||void 0===b,children:b?/*#__PURE__*/e.jsxs(Id,{children:[/*#__PURE__*/e.jsxs(Pd,{children:["Sponsored by ",q.name]}),/*#__PURE__*/e.jsx(B.BoltIcon,{height:16,width:16})]}):h})]}),V&&!_&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(id,{className:"cursor-pointer",onClick:()=>H(!z),children:/*#__PURE__*/e.jsxs(nd,{className:"flex items-center gap-x-1",children:["Details"," ",/*#__PURE__*/e.jsx(B.ChevronDownIcon,{style:{width:"0.75rem",marginLeft:"0.25rem",transform:z?"rotate(180deg)":void 0}})]})}),z&&A&&/*#__PURE__*/e.jsx(hd,{action:o,chain:f,transactionDetails:A,isTokenContractInfoLoading:C,symbol:j})]}),_&&/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(rd,{onClick:()=>M(!0),children:[/*#__PURE__*/e.jsx("span",{className:"text-color-primary",children:"Details"}),/*#__PURE__*/e.jsx(B.ArrowRightIcon,{height:"14px",width:"14px",strokeWidth:"2"})]})})]}),/*#__PURE__*/e.jsx(ar,{}),r?/*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:r.message}):a&&0===S?
20
+ /*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:a.shortMessage??Sd}):null,/*#__PURE__*/e.jsx(wd,{variant:N,preventMaliciousTransaction:F,setPreventMaliciousTransaction:L}),/*#__PURE__*/e.jsx(Td,{$useSmallMargins:!(!a&&!r&&"warn"!==N&&"error"!==N),address:g,balance:k,errMsg:v||a||r||!p?void 0:`Add funds on ${f?.name??P} to complete transaction.`}),/*#__PURE__*/e.jsx(Pr,{style:{marginTop:"1rem"},loading:x,disabled:y||v,onClick:T,children:m}),O&&/*#__PURE__*/e.jsx(Rr,{style:{marginTop:"1rem"},onClick:i,isSubmitting:!1,children:"Not now"}),/*#__PURE__*/e.jsx(xr,{})]})};let Td=/*#__PURE__*/i.styled(Fc).withConfig({displayName:"StyledWalletInfoCard",componentId:"sc-4e16a794-0"})(["",""],(e=>e.$useSmallMargins?"margin-top: 0.5rem;":"margin-top: 2rem;")),Ad=/*#__PURE__*/i.styled(ad).withConfig({displayName:"InstructionRows",componentId:"sc-4e16a794-1"})(["margin-top:0.5rem;border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-sm);padding:0.5rem;"]),Sd="There was an error preparing your transaction. Your transaction request will likely fail.",Ed=/*#__PURE__*/i.styled.div.withConfig({displayName:"ImageContainer",componentId:"sc-4e16a794-2"})(["display:flex;width:100%;justify-content:center;max-height:40px;> img{object-fit:contain;border-radius:var(--privy-border-radius-sm);}"]),Id=/*#__PURE__*/i.styled.span.withConfig({displayName:"SponsoredRow",componentId:"sc-4e16a794-3"})(["display:inline-flex;align-items:center;gap:0.3rem;"]),Pd=/*#__PURE__*/i.styled.span.withConfig({displayName:"SponsoredText",componentId:"sc-4e16a794-4"})(["font-size:14px;font-weight:500;color:var(--privy-color-foreground);"]);let Nd=()=>/*#__PURE__*/e.jsxs(Wd,{children:[/*#__PURE__*/e.jsx(Rd,{}),/*#__PURE__*/e.jsx(Dd,{})]});const _d=({transactionError:t,chainId:a,onClose:i,onRetry:o,chainType:s,transactionHash:l})=>{let{chains:c}=r.usePrivyInternal(),[d,u]=n.useState(!1),{errorCode:p,errorMessage:h}=((e,t)=>{if("ethereum"===t)return{errorCode:e.details??e.message,errorMessage:e.shortMessage};let n=e.txSignature,r=e?.transactionMessage||"Something went wrong.";if(Array.isArray(e.logs)){let t=e.logs.find((e=>/insufficient (lamports|funds)/gi.test(e)));t&&(r=t)}return{transactionHash:n,errorMessage:r}})(t,s),g=(({chains:e,chainId:t,chainType:n,transactionHash:r})=>"ethereum"===n?e.find((e=>e.id===t))?.blockExplorers?.default.url??"https://etherscan.io":function(e,t){return`https://explorer.solana.com/tx/${e}?chain=${t}`}(r||"",t))({chains:c,chainId:a,chainType:s,transactionHash:l});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:i}),/*#__PURE__*/e.jsxs(Md,{children:[/*#__PURE__*/e.jsx(Nd,{}),/*#__PURE__*/e.jsx(Fd,{children:p}),/*#__PURE__*/e.jsx(Ld,{children:"Please try again."}),/*#__PURE__*/e.jsxs(Ud,{children:[/*#__PURE__*/e.jsx(Bd,{children:"Error message"}),/*#__PURE__*/e.jsx(Hd,{$clickable:!1,children:h})]}),l&&/*#__PURE__*/e.jsxs(Ud,{children:[/*#__PURE__*/e.jsx(Bd,{children:"Transaction hash"}),/*#__PURE__*/e.jsxs(zd,{children:["Copy this hash to view details about the transaction on a"," ",/*#__PURE__*/e.jsx("u",{children:/*#__PURE__*/e.jsx("a",{href:g,children:"block explorer"})}),"."]}),/*#__PURE__*/e.jsxs(Hd,{$clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(l),u(!0)},children:[l,/*#__PURE__*/e.jsx(qd,{clicked:d})]})]}),/*#__PURE__*/e.jsx(Od,{onClick:()=>o({resetNonce:!!l}),children:"Retry transaction"})]}),/*#__PURE__*/e.jsx(wr,{})]})};let Md=/*#__PURE__*/i.styled.div.withConfig({displayName:"TransactionErrorScreenContainer",componentId:"sc-d58f10e6-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;"]),Fd=/*#__PURE__*/i.styled.span.withConfig({displayName:"ErrorCode",componentId:"sc-d58f10e6-1"})(["color:var(--privy-color-foreground);text-align:center;font-size:1.125rem;font-weight:500;line-height:1.25rem;text-align:center;margin:10px;"]),Ld=/*#__PURE__*/i.styled.span.withConfig({displayName:"Subtitle",componentId:"sc-d58f10e6-2"})(["margin-top:4px;margin-bottom:10px;color:var(--privy-color-foreground-3);text-align:center;font-size:0.875rem;font-style:normal;font-weight:400;line-height:20px;letter-spacing:-0.008px;"]),Wd=/*#__PURE__*/i.styled.div.withConfig({displayName:"CircleContainer",componentId:"sc-d58f10e6-3"})(["position:relative;width:60px;height:60px;margin:10px;display:flex;justify-content:center;align-items:center;"]),Dd=/*#__PURE__*/i.styled(we.default).withConfig({displayName:"StyledExclamationCircleIcon",componentId:"sc-d58f10e6-4"})(["position:absolute;width:35px;height:35px;color:var(--privy-color-error);"]),Rd=/*#__PURE__*/i.styled.div.withConfig({displayName:"StyledRedCircle",componentId:"sc-d58f10e6-5"})(["position:absolute;width:60px;height:60px;border-radius:50%;background-color:var(--privy-color-error);opacity:0.1;"]),Od=/*#__PURE__*/i.styled(Pr).withConfig({displayName:"RetryButton",componentId:"sc-d58f10e6-6"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]),Bd=/*#__PURE__*/i.styled.span.withConfig({displayName:"TextBoxTitle",componentId:"sc-d58f10e6-7"})(["width:100%;text-align:left;font-size:0.825rem;color:var(--privy-color-foreground);padding:4px;"]),Ud=/*#__PURE__*/i.styled.div.withConfig({displayName:"TextBoxContainer",componentId:"sc-d58f10e6-8"})(["width:100%;margin:5px;display:flex;flex-direction:column;justify-content:center;align-items:center;"]),zd=/*#__PURE__*/i.styled.text.withConfig({displayName:"HelperText",componentId:"sc-d58f10e6-9"})(["position:relative;width:100%;padding:5px;font-size:0.8rem;color:var(--privy-color-foreground-3);text-align:left;word-wrap:break-word;"]),Hd=/*#__PURE__*/i.styled.span.withConfig({displayName:"TextBox",componentId:"sc-d58f10e6-10"})(["position:relative;width:100%;background-color:var(--privy-color-background-2);padding:8px 12px;border-radius:10px;margin-top:5px;font-size:14px;color:var(--privy-color-foreground-3);text-align:left;word-wrap:break-word;",""],(e=>e.$clickable&&"cursor: pointer;\n transition: background-color 0.3s;\n padding-right: 45px;\n\n &:hover {\n background-color: var(--privy-color-foreground-4);\n }")),Vd=/*#__PURE__*/i.styled(He.default).withConfig({displayName:"StyledClipboardIcon",componentId:"sc-d58f10e6-11"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),$d=/*#__PURE__*/i.styled(_e.default).withConfig({displayName:"StyledClipboardCheckIcon",componentId:"sc-d58f10e6-12"})(["position:absolute;top:13px;right:13px;width:24px;height:24px;"]),qd=({clicked:t})=>t?/*#__PURE__*/e.jsx($d,{}):/*#__PURE__*/e.jsx(Vd,{}),Gd=({gasUsed:e,effectiveGasPrice:t})=>{if(e&&t)try{return l.toHex(e*t)}catch(e){return}};const Yd=({txn:t,receipt:n,transactionInfo:r,onClose:a,tokenPrice:i,tokenSymbol:o,receiptHeader:s,receiptDescription:l})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:a}),/*#__PURE__*/e.jsx(Bi,{title:s??"Transaction complete!",description:l??"You're all set."}),/*#__PURE__*/e.jsx(Ti,{tokenPrice:i,from:n.from,to:n.to,gas:Gd(n),txn:t,transactionInfo:r,tokenSymbol:o}),/*#__PURE__*/e.jsx(ar,{}),/*#__PURE__*/e.jsx(Zd,{loading:!1,onClick:a,children:"All Done"}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]});let Zd=/*#__PURE__*/i.styled(Pr).withConfig({displayName:"SubmitButton",componentId:"sc-f70d0f7a-0"})(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);const Kd=[{constant:!1,inputs:[{name:"_salt",type:"bytes32"},{name:"_initializer",type:"bytes"}],name:"deployAccount",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Qd=[{name:"from",type:"address"},{name:"param2",type:"address"},{name:"param3",type:"bytes"},{name:"param4",type:"tuple",components:[]},{type:"tuple",components:[{name:"param5",type:"address"},{name:"param6",type:"uint256"},{name:"param7",type:"uint256"},{name:"encodedInitData",type:"bytes"}]}],Xd=[{constant:!1,inputs:[{name:"spender",type:"address"},{name:"value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],Jd=[{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],eu=[{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"quantity",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"uint256[]",name:"quantities",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mintBatch",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"quantity",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"uri",type:"string"}],name:"safeMint",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"batchMint",outputs:[],stateMutability:"payable",type:"function"}],tu=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],nu=[{constant:!1,inputs:[{name:"_operator",type:"address"},{name:"_approved",type:"bool"}],name:"setApprovalForAll",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],ru=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],au=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenIds",type:"uint256[]"},{name:"_amounts",type:"uint256[]"},{name:"_data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],iu=[{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_tokenId",type:"uint256"},{name:"_amount",type:"uint256"},{name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"}],ou=(e,t)=>{let n=su(Xd,e);if(n)return{action:"approve",functionName:"approve",isErc20Ish:!0,isNFTIsh:!1,spender:n.args[0],amount:n.args[1]};let r=su(Jd,e);if(r)return{action:"transfer",functionName:"transfer",isErc20Ish:!0,isNFTIsh:!1,transferTo:r.args[0],amount:r.args[1]};if(!t)return{action:"transaction",functionName:"",isErc20Ish:!1,isNFTIsh:!1};let a=su(Kd,e);if(a&&"string"==typeof a.args[1]){let e=lu(a.args[1]);if(e&&e[4].encodedInitData)return ou(e[4].encodedInitData,t)}let i=su(nu,e);if(i)return{action:"approve",functionName:"setApprovalForAll",isNFTIsh:!0,isErc20Ish:!1,operator:i.args[0],approved:i.args[1]};let o=su(ru,e);if(o)return{action:"transfer",functionName:"transferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:o.args[0],transferTo:o.args[1],tokenId:o.args[2]};let s=su(tu,e);if(s)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:s.args[0],transferTo:s.args[1],tokenId:s.args[2]};let l=su(iu,e);if(l)return{action:"transfer",functionName:"safeTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:l.args[0],transferTo:l.args[1],tokenId:l.args[2],amount:l.args[3]};let c=su(au,e);if(c)return{action:"batch transfer",functionName:"safeBatchTransferFrom",isNFTIsh:!0,isErc20Ish:!1,transferFrom:c.args[0],transferTo:c.args[1],tokenIds:c.args[2],amounts:c.args[3]};let d=su(eu,e);return d?{action:"mint",functionName:d.functionName,isNFTIsh:!0,isErc20Ish:!1,args:d.args}:{action:"transaction",isErc20Ish:!1,isNFTIsh:!1}};let su=(e,t)=>{try{let n=l.decodeFunctionData({abi:e,data:t});return{functionName:n.functionName,args:n.args||[]}}catch(e){return null}},lu=e=>{try{if("string"==typeof e)return l.decodeAbiParameters(Qd,`0x${e.slice(10)}`)}catch(e){return null}},cu=e=>`${parseFloat(e).toFixed(2)}`;const du=(e,t,a,i)=>{let[o,s]=n.useState(null),{walletProxy:l}=r.usePrivyInternal();return n.useEffect((()=>{o&&s(null),(async()=>{if(!l||!t)return null;let n=[],r=!0,o=await _i(e,a,t,i).catch((t=>(t.message&&t.message.includes("Insufficient balance for transaction")||t.details&&t.details.includes("insufficient funds")?r=!1:n.push(t),e)));return{tx:o,totalGasEstimate:o.gas,hasFunds:r,errors:n}})().then(s)}),[e]),o};let uu=new an(new rn("There was an issue preparing your transaction",c.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),pu=(e,t)=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0;const hu={component:()=>{let{data:t,onUserCloseViaDialogOrKeybindRef:i,setModalData:o,navigate:s}=Xn(),{client:d,rpcConfig:u,chains:p,closePrivyModal:h,walletProxy:g,showFiatPrices:m}=r.usePrivyInternal(),{user:y}=a.usePrivyContext(),f=qn(),[x,v]=n.useState(0),[w,C]=n.useState(0),[b,j]=n.useState(pu(t,x)),[k,T]=n.useState(null),[A,S]=n.useState(),[E,I]=n.useState(!1),[P,N]=n.useState(null),[_,M]=n.useState(null),[F,L]=n.useState(null),[W,D]=n.useState(void 0),[R,O]=n.useState(void 0),[B,U]=n.useState(!1),[z,H]=n.useState(!1),[V,$]=n.useState([]),[q,G]=n.useState([]),[Y,Z]=n.useState("uninitiated"),[K,Q]=n.useState(void 0);if(!b||!t?.sendTransaction||!t?.sendTransaction)/*#__PURE__*/return e.jsx(Ds,{error:Error("Invalid transaction request"),allowlistConfig:f.allowlistConfig,onRetry:()=>{t?.sendTransaction?.onFailure(uu),h({shouldCallAuthOnSuccess:!1})}});let{transactingWalletAddress:X}=t.sendTransaction,J=n.useMemo((()=>p.find((e=>Number(e.id)===Number(b.chainId)))),[b.chainId]),ee=J?.nativeCurrency.symbol??"ETH",te=n.useMemo((()=>ou(b.data,!!f.embeddedWallets.extendedCalldataDecoding)),[b.data]),{action:ne,isErc20Ish:re,isNFTIsh:ae,functionName:ie}=te,{toAddress:oe,tokenAddress:se}=n.useMemo((()=>({toAddress:te.isErc20Ish?te.transferTo:b.to??void 0,tokenAddress:te.isErc20Ish?b.to:void 0})),[te]);n.useEffect((()=>{b.to&&J&&re&&$c({address:b.to,chain:J,rpcConfig:f.rpcConfig,privyAppId:f.id}).then(T).catch(console.error)}),[b.to,J]);let{tokenPrice:le,isTokenPriceLoading:ce}=Ii(b.chainId),{balance:de}=Lc({rpcConfig:f.rpcConfig,appId:f.id,address:X,chain:J}),ue=function({rpcConfig:e,appId:t,address:a,chain:i,tokenInfo:o}){let{chains:s}=r.usePrivyInternal(),[d,u]=n.useState(null),[p,h]=n.useState(!1),g=n.useMemo((()=>{let n=i||s[0];if(n)return l.createPublicClient({chain:i,transport:l.http(c.getJsonRpcEndpointFromChain(n,e,t))})}),[i,e,t]),m=n.useCallback((async()=>{if(a&&g&&o.address)try{return h(!0),await g.readContract({address:o.address,abi:Vc,functionName:"balanceOf",args:[a]})}catch(e){console.error(e)}finally{h(!1)}}),[g,a,o?.address,i]);return n.useEffect((()=>{m().then((e=>null!=e&&u(e)))}),[m]),{balance:d,isLoading:p&&null==d,formattedBalance:c.formatTokenAmount({amount:d??BigInt(0),decimals:o.decimals})}}({rpcConfig:f.rpcConfig,appId:f.id,address:X,tokenInfo:{address:se||"",decimals:k?.decimals??18},chain:J}),pe=n.useMemo((()=>Ft(Number(b.chainId),p,u,{appId:f.id})),[b.chainId,u]),he=du(b,X,pe,t?.sendTransaction?.prepareTransactionRequest);n.useEffect((()=>{j(pu(t,x))}),[x]),n.useEffect((()=>{t.sendTransaction?.getIsSponsored?t.sendTransaction.getIsSponsored().then(S).catch(console.error):S(!1)}),[t.sendTransaction.getIsSponsored]);let ge=()=>{if(!E)return P?t?.sendTransaction?.onSuccess({hash:P}):F||he?.errors[0]?t?.sendTransaction?.onFailure(F??he?.errors[0]??uu):t?.sendTransaction?.onFailure(new an(new rn("The user rejected the request",c.ProviderErrors.E4001_USER_REJECTED_REQUEST.eipCode))),h({shouldCallAuthOnSuccess:!1})};i.current=ge;let me=!!(t.funding&&t.funding.supportedOptions.length>0),ye=Pa(BigInt(he?.totalGasEstimate??0n),ee),fe=m&&le?Ia(BigInt(he?.totalGasEstimate??0n),le):void 0,xe=Pa(de??0n,ee,void 0,!0),ve=m&&le?Ia(de??0n,le):void 0,we=k&&!ue.isLoading&&re&&"approve"!==ne?`${ue.formattedBalance} ${k.symbol}`:void 0,Ce=t.sendTransaction?.uiOptions?.transactionInfo?.title;Ce||(Ce="approve"===ne?re?"Confirm address":"Confirm action":`Approve ${ne}`);let be=n.useMemo((()=>{if(t.sendTransaction?.uiOptions?.description)return t.sendTransaction?.uiOptions?.description;if("approve"===ne&&"setApprovalForAll"===ie&&te.approved){let t=/*#__PURE__*/e.jsx(Cs,{address:te.operator||"",url:J?.blockExplorers?.default?.url});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[f.name," would like your permission for ",t," to transfer tokens on your behalf."]})}if("approve"===ne&&"setApprovalForAll"===ie&&!te.approved){let t=/*#__PURE__*/e.jsx(Cs,{address:te.operator||"",url:J?.blockExplorers?.default?.url});/*#__PURE__*/return e.jsxs(e.Fragment,{children:[f.name," would like your permission to revoke permissions of ",t," from transferring tokens on your behalf."]})}return re&&"approve"===ne||re&&"approve"===ne?`${f.name} would like your permission for ${Dt(te.spender)} to spend tokens on your behalf.`:`${f.name} wants your permission to approve the following transaction.`}),[f.name,re,te,t.sendTransaction?.uiOptions.description,ie]),je=t.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/e.jsx("img",{src:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:t.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,ke=!(!he||he.errors[0]||he.hasFunds||!1!==A),Te=ke&&me,Ae=Te?"Add funds":t.sendTransaction?.uiOptions?.buttonText||(x<w?"Continue":"Approve"),Se=e=>{if(!e)throw Error("Transaction scan failed");if("Success"===e.validation.status&&("Benign"===e.validation.result_type?O("safe"):"Warning"===e.validation.result_type?O("warn"):"Malicious"===e.validation.result_type&&(O("error"),H(!0))),"Success"!==e.simulation.status)throw Error("Simulation failed");{D(e.simulation.params);let{assetsIn:t,assetsOut:n}=function(e,t){let n=[],r=new Map;if(e)for(let t of e)if(t.in[0]){let e;e="ERC721"===t.asset.type||"approve_for_all"===t.in[0].value?{id:`nft:${t.asset.name}`,nftName:t.asset.name,nftCount:t.in.length}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.in[0].value,symbol:t.asset.symbol,usdValue:t.in[0].usd_price?cu(t.in[0].usd_price):void 0,decimals:t.asset.decimals},n.push(e)}else if(t.out[0]?.value){let e;e="ERC721"===t.asset.type||"approve_for_all"===t.out[0].value?{id:`nft:${t.asset.name}`,nftName:t.asset.name}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.out[0].value,symbol:t.asset.symbol,usdValue:t.out[0].usd_price?cu(t.out[0].usd_price):void 0,decimals:t.asset.decimals},r.has(e.id)||r.set(e.id,e)}for(let e of t)for(let t of Object.keys(e.spenders)){let n;n="ERC721"===e.asset.type||"approve_for_all"===e.spenders[t]?.value?{id:`nft:${e.asset.name}`,nftName:e.asset.name}:{id:`token:${e.asset.type}:${e.asset.symbol}:${e.asset.name}`,iconUrl:e.asset.logo_url,value:e.spenders[t]?.value,symbol:e.asset.symbol,usdValue:e.spenders[t]?.usd_price?cu(e.spenders[t]?.usd_price):void 0,decimals:e.asset.decimals},r.has(n.id)||r.set(n.id,n)}return{assetsIn:n,assetsOut:Array.from(r.values())}}(e.simulation.assets_diffs,e.simulation.exposures);if(0===n.length&&0===t.length)throw Error("No tokens found");$(n),G(t)}};if(n.useEffect((()=>{t.sendTransaction?.scanTransaction&&f.embeddedWallets.transactionScanning.enabled&&"uninitiated"===Y&&(Z("in progress"),t.sendTransaction.scanTransaction().then((e=>{Se(e),Z("completed")})).catch((()=>Z("failed"))))}),[!!t.sendTransaction?.scanTransaction]),n.useEffect((()=>{t.sendTransaction?.scanTransaction&&"failed"!==Y||((e,n,r)=>{if(C((e=>e?.sendTransaction?"transactionRequest"in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(t)),n.isErc20Ish&&n.amount&&r){let e=Yc({amount:n.amount,decimals:r.decimals});Q(e),$([{value:e,symbol:r?.symbol,decimals:r?.decimals}])}else if(e.value){let t=BigInt(e.value),n=le?Ia(t,le):void 0;$(m&&n?[{value:n}]:[{value:Na(t),symbol:ee,decimals:18,usdValue:n}])}else $(m?[{value:"$0"}]:[{value:"0",symbol:ee,decimals:18}])})(he?.tx??b,te,k)}),[b,he?.tx,te,k,Y]),_/*#__PURE__*/)return e.jsx(Yd,{txn:he?.tx??b,onClose:ge,receipt:_,transactionInfo:t.sendTransaction?.uiOptions.transactionInfo,tokenPrice:le,tokenSymbol:ee,receiptHeader:t.sendTransaction?.uiOptions.successHeader,receiptDescription:t.sendTransaction?.uiOptions.successDescription});if(F)/*#__PURE__*/return e.jsx(_d,{transactionError:F,transactionHash:P??void 0,chainType:"ethereum",chainId:he?.tx.chainId??b.chainId,onClose:ge,onRetry:({resetNonce:e})=>{L(null);let t={...he?.tx??b};e&&(t.nonce=void 0),j(t)}});let Ee=0!==w&&"number"==typeof x&&0!==x?()=>{v(x-1)}:void 0;return B&&W?/*#__PURE__*/e.jsx(ed,{details:W,onBack:()=>U(!1)}):/*#__PURE__*/e.jsx(kd,{transactionIndex:x,onBack:Ee,maxIndex:w,disabled:ke&&!me||z,isSubmitting:E,submitError:F,isPreparing:!he,isTokenPriceLoading:ce,isTokenContractInfoLoading:!ae&&!k,prepareError:he?.errors[0],symbol:k?.symbol,chain:J,img:je,title:Ce,subtitle:be,txValue:b.value,fee:fe??ye,isSponsored:A,from:X??"",to:oe,tokenAddress:se??void 0,network:f.chains.find((e=>e.id===b.chainId))?.name??"",transactionDetails:{...te,formattedAmount:K},cta:Ae,missingFunds:ke,action:ne,balance:we??ve??xe,onClose:ge,onClick:Te?async()=>{if(X){if(!me)throw Error("Funding wallet is not enabled");o({...t,funding:{...t.funding,methodScreen:Vp,chainType:"ethereum",amount:l.formatEther(BigInt(he?.tx.value??0)+BigInt(he?.totalGasEstimate?.toString()??0)),chain:J},solanaFundingData:t?.solanaFundingData}),s(Vp)}}:async()=>{if(x<w)v(x+1);else{I(!0);try{let e=await d.getAccessToken();if(E||!e||!g||!y)return;let n=await t.sendTransaction.onConfirm({transactionRequest:he?.tx??b});if(N(n),t.sendTransaction?.signOnly)return await new Promise((e=>setTimeout(e,at))),t?.sendTransaction?.onSuccess({hash:n}),h({shouldCallAuthOnSuccess:!1});let r=await pe.waitForTransactionReceipt({hash:n});if("reverted"===r.status)throw Error("Transaction failed");M(r)}catch(e){console.warn({transaction:he?.tx??b,error:e}),L(e)}finally{I(!1)}}},validation:R,hasScanDetails:!!W,setIsScanDetailsOpen:U,preventMaliciousTransaction:z,setPreventMaliciousTransaction:H,tokensSent:V,tokensReceived:q,isScanning:"in progress"===Y,isCancellable:t.sendTransaction?.uiOptions?.isCancellable??!1,functionName:ie})}};function gu({title:t}){let{currentScreen:n,navigateBack:r,navigate:a,data:i,setModalData:o}=Xn();/*#__PURE__*/return e.jsx(Hr,{title:t,backFn:n===zc?r:n===i?.funding?.methodScreen?i.funding.comingFromSendTransactionScreen?()=>a(hu):void 0:i?.funding?.methodScreen?()=>{let e=i.funding;e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),o({funding:e,solanaFundingData:i?.solanaFundingData}),a(e.methodScreen)}:void 0})}const mu=t=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 210.2",xmlSpace:"preserve",...t,children:/*#__PURE__*/e.jsx("path",{d:"M93.6,27.1C87.6,34.2,78,39.8,68.4,39c-1.2-9.6,3.5-19.8,9-26.1c6-7.3,16.5-12.5,25-12.9 C103.4,10,99.5,19.8,93.6,27.1 M102.3,40.9c-13.9-0.8-25.8,7.9-32.4,7.9c-6.7,0-16.8-7.5-27.8-7.3c-14.3,0.2-27.6,8.3-34.9,21.2 c-15,25.8-3.9,64,10.6,85c7.1,10.4,15.6,21.8,26.8,21.4c10.6-0.4,14.8-6.9,27.6-6.9c12.9,0,16.6,6.9,27.8,6.7 c11.6-0.2,18.9-10.4,26-20.8c8.1-11.8,11.4-23.3,11.6-23.9c-0.2-0.2-22.4-8.7-22.6-34.3c-0.2-21.4,17.5-31.6,18.3-32.2 C123.3,42.9,107.7,41.3,102.3,40.9 M182.6,11.9v155.9h24.2v-53.3h33.5c30.6,0,52.1-21,52.1-51.4c0-30.4-21.1-51.2-51.3-51.2H182.6z M206.8,32.3h27.9c21,0,33,11.2,33,30.9c0,19.7-12,31-33.1,31h-27.8V32.3z M336.6,169c15.2,0,29.3-7.7,35.7-19.9h0.5v18.7h22.4V90.2 c0-22.5-18-37-45.7-37c-25.7,0-44.7,14.7-45.4,34.9h21.8c1.8-9.6,10.7-15.9,22.9-15.9c14.8,0,23.1,6.9,23.1,19.6v8.6l-30.2,1.8 c-28.1,1.7-43.3,13.2-43.3,33.2C298.4,155.6,314.1,169,336.6,169z M343.1,150.5c-12.9,0-21.1-6.2-21.1-15.7c0-9.8,7.9-15.5,23-16.4 l26.9-1.7v8.8C371.9,140.1,359.5,150.5,343.1,150.5z M425.1,210.2c23.6,0,34.7-9,44.4-36.3L512,54.7h-24.6l-28.5,92.1h-0.5 l-28.5-92.1h-25.3l41,113.5l-2.2,6.9c-3.7,11.7-9.7,16.2-20.4,16.2c-1.9,0-5.6-0.2-7.1-0.4v18.7C417.3,210,423.3,210.2,425.1,210.2z"})}),yu=t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 38.1",xmlSpace:"preserve",...t,children:[/*#__PURE__*/e.jsx("path",{style:{fill:"#5F6368"},d:"M37.8,19.7V29h-3V6h7.8c1.9,0,3.7,0.7,5.1,2c1.4,1.2,2.1,3,2.1,4.9c0,1.9-0.7,3.6-2.1,4.9c-1.4,1.3-3.1,2-5.1,2 L37.8,19.7L37.8,19.7z M37.8,8.8v8h5c1.1,0,2.2-0.4,2.9-1.2c1.6-1.5,1.6-4,0.1-5.5c0,0-0.1-0.1-0.1-0.1c-0.8-0.8-1.8-1.3-2.9-1.2 L37.8,8.8L37.8,8.8z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#5F6368"},d:"M56.7,12.8c2.2,0,3.9,0.6,5.2,1.8s1.9,2.8,1.9,4.8V29H61v-2.2h-0.1c-1.2,1.8-2.9,2.7-4.9,2.7 c-1.7,0-3.2-0.5-4.4-1.5c-1.1-1-1.8-2.4-1.8-3.9c0-1.6,0.6-2.9,1.8-3.9c1.2-1,2.9-1.4,4.9-1.4c1.8,0,3.2,0.3,4.3,1v-0.7 c0-1-0.4-2-1.2-2.6c-0.8-0.7-1.8-1.1-2.9-1.1c-1.7,0-3,0.7-3.9,2.1l-2.6-1.6C51.8,13.8,53.9,12.8,56.7,12.8z M52.9,24.2 c0,0.8,0.4,1.5,1,1.9c0.7,0.5,1.5,0.8,2.3,0.8c1.2,0,2.4-0.5,3.3-1.4c1-0.9,1.5-2,1.5-3.2c-0.9-0.7-2.2-1.1-3.9-1.1 c-1.2,0-2.2,0.3-3,0.9C53.3,22.6,52.9,23.3,52.9,24.2z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#5F6368"},d:"M80,13.3l-9.9,22.7h-3l3.7-7.9l-6.5-14.7h3.2l4.7,11.3h0.1l4.6-11.3H80z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#4285F4"},d:"M25.9,17.7c0-0.9-0.1-1.8-0.2-2.7H13.2v5.1h7.1c-0.3,1.6-1.2,3.1-2.6,4v3.3H22C24.5,25.1,25.9,21.7,25.9,17.7z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#34A853"},d:"M13.2,30.6c3.6,0,6.6-1.2,8.8-3.2l-4.3-3.3c-1.2,0.8-2.7,1.3-4.5,1.3c-3.4,0-6.4-2.3-7.4-5.5H1.4v3.4 C3.7,27.8,8.2,30.6,13.2,30.6z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#FBBC04"},d:"M5.8,19.9c-0.6-1.6-0.6-3.4,0-5.1v-3.4H1.4c-1.9,3.7-1.9,8.1,0,11.9L5.8,19.9z"}),/*#__PURE__*/e.jsx("path",{style:{fill:"#EA4335"},d:"M13.2,9.4c1.9,0,3.7,0.7,5.1,2l0,0l3.8-3.8c-2.4-2.2-5.6-3.5-8.8-3.4c-5,0-9.6,2.8-11.8,7.3l4.4,3.4 C6.8,11.7,9.8,9.4,13.2,9.4z"})]}),fu=e=>{let[t,r]=n.useState();return n.useEffect((()=>{e().then((e=>{r(e)})).catch((()=>{}))}),[]),t},xu=({children:t,color:n,isLoading:r,isPulsing:a,...i})=>/*#__PURE__*/e.jsx(vu,{$color:n,$isLoading:r,$isPulsing:a,...i,children:t});let vu=/*#__PURE__*/i.styled.span.withConfig({displayName:"StyledSpan",componentId:"sc-80725f4-0"})(["padding:0.25rem;font-size:0.75rem;font-weight:500;line-height:1rem;border-radius:var(--privy-border-radius-xs);display:flex;align-items:center;"," ",""],(e=>{let t,n;"green"===e.$color&&(t="var(--privy-color-success-dark)",n="var(--privy-color-success-light)"),"red"===e.$color&&(t="var(--privy-color-error)",n="var(--privy-color-error-light)"),"gray"===e.$color&&(t="var(--privy-color-foreground-2)",n="var(--privy-color-background-2)");let r=/*#__PURE__*/i.keyframes(["from,to{background-color:",";}50%{background-color:rgba(",",0.8);}"],n,n);/*#__PURE__*/return i.css(["color:",";background-color:",";",";"],t,n,e.$isPulsing&&/*#__PURE__*/i.css(["animation:"," 3s linear infinite;"],r))}),sd);const wu=({onClick:n,text:r})=>/*#__PURE__*/e.jsxs(dr,{onClick:n,children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(t.Wallet,{})}),/*#__PURE__*/e.jsx(ar,{children:r})]}),Cu=({chainType:t,withPadding:n})=>{let r="";return r="ethereum-only"===t||"ethereum-and-solana"===t?"Rainbow, Phantom, or Coinbase Wallet":"Phantom or Solflare",/*#__PURE__*/e.jsx(hr,{$withPadding:n,children:/*#__PURE__*/e.jsxs(gr,{children:[/*#__PURE__*/e.jsx(pe.default,{style:{color:"var(--privy-color-warn)",height:48,width:48}}),/*#__PURE__*/e.jsx("h3",{children:"No wallets available"}),/*#__PURE__*/e.jsxs("p",{children:["Please download an external wallet provider, like ",r,"."]})]})},"empty-wallet-state")},bu=({icon:t,name:n})=>"string"==typeof t?/*#__PURE__*/e.jsx("img",{alt:`${n||"wallet"} logo`,src:t,style:{height:24,width:24,borderRadius:4}}):void 0===t?/*#__PURE__*/e.jsx(ve.default,{style:{height:24,width:24}}):t?/*#__PURE__*/e.jsx(t,{}):null;function ju(e){let t=e.toLowerCase();return!!window?.webkit?.messageHandlers?.ReactNativeWebView||!!window?.ReactNativeWebView||["fbav","fban","instagram","snapchat","linkedinapp"].some((e=>t.includes(e)))}const ku=({walletLogo:t,success:n,errorMessage:r,title:a,subtitle:i,onRetry:o,onUseDifferentWallet:s,onBack:l,numRetries:c,maxRetries:d})=>/*#__PURE__*/e.jsx(ba,{title:a,subtitle:i,icon:t,iconVariant:"loading",iconLoadingStatus:{success:n,fail:!!r},primaryCta:r===on.ERROR_USER_EXISTS?{label:"Use a different wallet",onClick:s}:!n&&r?.retryable&&c<d?{label:"Retry",onClick:o,disabled:!r?.retryable||c>=d}:!n&&r&&c>=d?{label:"Use a different wallet",onClick:s}:void 0,onBack:l,watermark:!0}),Tu={component:()=>{let t,{navigateBack:a,navigate:i,lastScreen:o,currentScreen:s,data:l,setModalData:c}=Xn(),{walletConnectionStatus:d,closePrivyModal:u}=r.usePrivyInternal(),[p,h]=n.useState(void 0),[g,m]=n.useState(0),y=Nn(d?.connector?.walletClientType||"unknown"),f="connected"===d?.status,x="switching_to_supported_chain"===d?.status;n.useEffect((()=>{if(f){let e;if(l?.externalConnectWallet?.onCompleteNavigateTo){let t=l.externalConnectWallet.onCompleteNavigateTo,n=d.connectedWallet?.address;e=setTimeout((()=>{l.funding&&c({...l,funding:{...l.funding,connectedWalletAddress:n}}),i(t({address:n,walletClientType:d.connector?.walletClientType,walletChainType:d.connector?.chainType}))}),at)}else e=setTimeout(u,at);return()=>clearTimeout(e)}}),[f]);n.useEffect((()=>{d?.connectError&&(e=>{h(gc(e))})(d?.connectError)}),[d]);let w=d?.connector?.connectorType||"injected",C=d?.connector?.walletClientType||"unknown",b=y?.metadata?.shortName||y?.name||d?.connector?.walletBranding.name||"Browser Extension",j=y?.image_url?.md||d?.connector?.walletBranding.icon||(t=>/*#__PURE__*/e.jsx(mn,{...t})),k="Browser Extension"===b?b.toLowerCase():b;t=f?`Successfully connected with ${k}`:p?p.message:x?"Switching networks":`Waiting for ${k}`;let T="Don’t see your wallet? Check your other browser windows.";return f?T="You’re good to go!":g>=2&&p?T="Unable to connect wallet":p?T=p.detail:x?T="Switch your wallet to the requested network.":"metamask"===C&&v.isMobile?T="Click to continue to open and connect MetaMask.":"metamask"===C?T="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===w?T="Open your mobile wallet app to continue":"coinbase_wallet"===w&&(T="Confirm in the Coinbase app/popup to continue."),/*#__PURE__*/e.jsx(ku,{walletName:b,walletLogo:j,success:f,errorMessage:p,title:t,subtitle:T,onRetry:()=>{m(g+1),h(void 0),d?.connectRetry()},onUseDifferentWallet:a,onBack:s===o?void 0:a,numRetries:g,maxRetries:2})}},Au=/*#__PURE__*/i.styled.div.withConfig({displayName:"TodoList",componentId:"sc-bcc78743-0"})(["display:flex;flex-direction:column;justify-content:flex-start;gap:10px;padding-left:8px;"]),Su=({children:n,variant:r="default",icon:a})=>{let i=()=>{switch(r){case"success":return"var(--privy-color-icon-success)";case"error":return"var(--privy-color-icon-error)";default:return"var(--privy-color-icon-muted)"}};/*#__PURE__*/return e.jsxs(Iu,{children:[/*#__PURE__*/e.jsx(Eu,{$variant:r,"data-variant":r,children:(()=>{if(a)
21
+ /*#__PURE__*/return le.default.isValidElement(a)?/*#__PURE__*/le.default.cloneElement(a,{stroke:i(),strokeWidth:2}):a;switch(r){case"success":default:/*#__PURE__*/return e.jsx(t.Check,{size:12,stroke:i(),strokeWidth:3});case"error":/*#__PURE__*/return e.jsx(t.X,{size:12,stroke:i(),strokeWidth:3})}})()}),n]})};let Eu=/*#__PURE__*/i.styled.div.withConfig({displayName:"IconBackground",componentId:"sc-bcc78743-2"})(["display:flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background-color:",";flex-shrink:0;"],(({$variant:e})=>{switch(e){case"success":return"var(--privy-color-success-bg, #EAFCEF)";case"error":return"var(--privy-color-error-bg, #FEE2E2)";default:return"var(--privy-color-background-2)"}})),Iu=/*#__PURE__*/i.styled.div.withConfig({displayName:"TodoItemWrapper",componentId:"sc-bcc78743-3"})(["display:flex;justify-content:flex-start;align-items:flex-start;text-align:left;gap:8px;&&{a{color:var(--privy-color-accent);}}"]);const Pu=({walletName:t,installLink:n,title:r,subtitle:a="Follow the instructions below to get started.",onReload:i,onBack:o})=>{let s=r||`Create a ${t} wallet`.replace(/wallet wallet/gi,"wallet"),l=/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("span",{children:"Still not sure? "}),/*#__PURE__*/e.jsx(ps,{size:"sm",target:"_blank",href:"https://solana.com/docs/intro/wallets",children:"Learn more"})]});/*#__PURE__*/return e.jsx(ba,{title:s,subtitle:a,onBack:o,showBack:!0,primaryCta:{label:"Reload the page to use your wallet",onClick:i},helpText:l,watermark:!0,children:/*#__PURE__*/e.jsxs(Au,{children:[/*#__PURE__*/e.jsx(Su,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx("span",{children:"Install the "})," ",/*#__PURE__*/e.jsxs(ps,{href:n,target:"_blank",children:[t," browser extension"]})]})}),/*#__PURE__*/e.jsx(Su,{children:"Set up your first wallet"}),/*#__PURE__*/e.jsx(Su,{children:"Store your recovery phrase in a safe place!"})]})})},Nu={component:()=>{let{navigateBack:t,data:n}=Xn();if(!n?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:r}=n.installWalletModalData;/*#__PURE__*/return e.jsx(Pu,{walletName:r.name,installLink:r.installLink,onReload:()=>{window.location.reload()},onBack:t})}},_u=({title:t,subtitle:n,buttonText:r,buttonHref:a,isLoading:i=!1,helpText:o,onButtonClick:s})=>/*#__PURE__*/e.jsx(ba,{title:t,subtitle:n,primaryCta:{label:r,onClick:()=>{a&&window.open(a,"_self"),s?.()},disabled:i},helpText:o,watermark:!0}),Mu={component:()=>{let{ready:t}=a.usePrivyContext(),{data:r}=Xn(),[i,o]=n.useState(!1);if(!r?.installWalletModalData)throw Error("Wallet data is missing");let{walletConfig:s,connectOnly:l,chainType:c}=r.installWalletModalData,d=s.getMobileRedirect({useUniversalLink:!i,isSolana:"solana"===c,connectOnly:l}),u=s.name.replace(/ wallet/gi,""),p={title:`Redirecting to ${u} Mobile Wallet`,description:`We'll take you to the ${u} Mobile Wallet app to continue your login experience.`,footnote:""};return t&&(p.description=`For the best experience, we'll automatically log you into the ${u} Mobile Wallet in-app browser.`,p.footnote="You can always return here to login via other methods."),i&&(p.title="Still here?",p.description=`You may need to install the ${s.name} mobile app.`,p.footnote=`Once you're done, you can connect with ${s.name} wallet to complete the login.`),/*#__PURE__*/e.jsx(_u,{title:p.title,subtitle:p.description,buttonText:i?"Go to App Store":"Continue",buttonHref:d,isLoading:t&&!d,helpText:p.footnote||void 0,onButtonClick:()=>{setTimeout((()=>o(!0)),1e3)}})}},Fu=({provider:t,displayName:n,logo:a,connectOnly:i,connector:o})=>{let s,{navigate:l,setModalData:c}=Xn(),{connectWallet:d}=r.usePrivyInternal(),u=is(),p=Nn(t),h="wallet_connect_v2"===o.connectorType?t:o.walletClientType,g=window.matchMedia("(display-mode: standalone)").matches,m=wn({connectorType:o.connectorType,walletClientType:h});s=m&&m.chainTypes.includes(o.chainType)?()=>{m.isInstalled||"solana"===o.chainType&&"isInstalled"in o&&o.isInstalled?(d(o,h),l(i?Tu:yc)):v.isMobile?(c({installWalletModalData:{walletConfig:m,chainType:o.chainType,connectOnly:i}}),l(Mu)):(c({installWalletModalData:{walletConfig:m,chainType:o.chainType,connectOnly:i}}),l(Nu))}:"coinbase_wallet"!==o.connectorType||"eoaOnly"!==o.coinbaseWalletConfig.preference?.options||!v.isMobile||g||Mt()?()=>{(!ju(window.navigator.userAgent)||event?.isTrusted)&&(d(o,h),i?"wallet_connect_v2"===o.connectorType?(c((e=>({...e,externalConnectWallet:{...e?.externalConnectWallet,preSelectedWalletId:"wallet_connect_qr"}}))),l($p)):l(Tu):l(yc))}:()=>{window.location.href=`https://go.cb-w.com/dapp?cb_url=${encodeURI(window.location.href)}`};let y=n||p?.metadata?.shortName||p?.name||o.walletClientType;/*#__PURE__*/return e.jsxs(Lu,{onClick:s,children:[/*#__PURE__*/e.jsx(bu,{icon:a||p?.image_url?.md,name:y}),/*#__PURE__*/e.jsx("span",{children:y}),/*#__PURE__*/e.jsxs(Du,{id:"chip-container",children:[u?.walletClientType===h&&u?.chainType===o.chainType?/*#__PURE__*/e.jsx(Wu,{color:"gray",children:"Recent"}):/*#__PURE__*/e.jsx("span",{id:"connect-text",children:"Connect"}),"solana"===o.chainType&&/*#__PURE__*/e.jsx(Wu,{color:"gray",children:"Solana"})]})]})};let Lu=/*#__PURE__*/i.styled(dr).withConfig({displayName:"ConnectWalletButton",componentId:"sc-89605346-0"})(["> span{color:var(--privy-color-foreground);}> #chip-container > #connect-text{font-weight:500;color:var(--privy-color-accent);opacity:0;transition:opacity 0.1s ease-out;}:hover > #chip-container > #connect-text{opacity:1;}@media (max-width:440px){> #chip-container > #connect-text{display:none;}}"]),Wu=/*#__PURE__*/i.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-89605346-1"})(["margin-left:auto;"]),Du=/*#__PURE__*/i.styled.div.withConfig({displayName:"ChipContainer",componentId:"sc-89605346-2"})(["display:flex;flex-wrap:wrap;gap:8px;margin-left:auto;"]);const Ru=["coinbase_wallet","base_account"];let Ou=["metamask","okx_wallet","rainbow","uniswap","bybit_wallet","ronin_wallet","haha_wallet","uniswap_extension","zerion","rabby_wallet","cryptocom","binance"];const Bu=["safe"],Uu=["phantom","backpack","solflare","universal_profile"],zu=({walletList:t,walletChainType:n,connectors:r,connectOnly:a,ignore:i,walletConnectEnabled:o,forceWallet:s})=>{let l=[],c=[],d=[],u=r.filter((e=>"ethereum-only"===n?"ethereum"===e.chainType:"solana-only"!==n||"solana"===e.chainType)),p=u.find((e=>"wallet_connect_v2"===e.connectorType));for(let[r,h]of(s?[s.wallet]:t).entries()){if("detected_ethereum_wallets"===h)for(let[t,n]of u.filter((({chainType:e,connectorType:t,walletClientType:n})=>"solana"!==e&&("uniswap_wallet_extension"===n||"uniswap_extension"===n?!i.includes("uniswap"):"crypto.com_wallet_extension"===n||"crypto.com_onchain"===n?!i.includes("cryptocom"):"injected"===t&&!i.includes(n)))).entries()){let{walletClientType:i,walletBranding:o,chainType:s}=n;("unknown"===i?c:l).push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:i,logo:o.icon,displayName:o.name,connector:n},`${r}-${h}-${i}-${s}-${t}`))}if("detected_solana_wallets"===h)for(let[t,o]of u.filter((({chainType:e,walletClientType:t})=>{if("solana"===e)return"ethereum-only"!==n&&!i.includes(t)})).entries()){let{walletClientType:n,walletBranding:i,chainType:s}=o;("unknown"===n?c:l).push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:n,logo:i.icon,displayName:i.name,connector:o},`${r}-${h}-${n}-${s}-${t}`))}if(Uu.includes(h)){let t=u.find((e=>"injected"===e.connectorType&&e.walletClientType===h||e.connectorType===h));if(t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:h,connector:t},`${r}-${h}`)),"solana-only"===n||"ethereum-and-solana"===n){let t=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===h));t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:h,connector:t},`${h}-solana`))}}else if(Ou.includes(h)){let t=u.find((e=>"uniswap"===h?"uniswap_wallet_extension"===e.walletClientType||"uniswap_extension"===e.walletClientType:"cryptocom"===h?"crypto.com_wallet_extension"===e.walletClientType||"crypto.com_onchain"===e.walletClientType:"injected"===e.connectorType&&e.walletClientType===h));if(o&&!t&&(t=p),t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:h,connector:t,logo:"injected"===t.connectorType?t.walletBranding.icon:void 0,displayName:"injected"===t.connectorType?t.walletBranding.name:void 0},`${r}-${h}`)),"solana-only"===n||"ethereum-and-solana"===n){let t=u.find((({chainType:e,walletClientType:t})=>"solana"===e&&t===h));t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:h,connector:t},`${h}-solana`))}}else if(Ru.includes(h)){let t=u.find((({connectorType:e})=>e===h));t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:h,connector:t,displayName:"coinbase_wallet"===t.walletClientType?"Coinbase":"Base",logo:"coinbase_wallet"===t.walletClientType?Jt:en},`${r}-${h}`))}else if(Bu.includes(h))p&&d.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:h,connector:p},`${r}-${h}`));else if("wallet_connect"===h)p&&d.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:h,connector:p,logo:p.walletBranding.icon,displayName:"WalletConnect"},`${r}-${h}`));else if(h===s?.wallet){let n="ethereum"===s.chainType&&t.includes("detected_ethereum_wallets"),i="solana"===s.chainType&&t.includes("detected_solana_wallets");if(n||i){let t=u.find((({walletClientType:e})=>e===h));t&&l.push(/*#__PURE__*/e.jsx(Fu,{connectOnly:a,provider:h,displayName:t.walletBranding?.name,logo:t.walletBranding?.icon,connector:t},`${r}-${h}`))}}}return[...c,...l,...d]},Hu=({chains:e,appId:t,address:n,rpcConfig:r,includeUsdc:a})=>Promise.all(e.map((async e=>{let i=l.createPublicClient({chain:e,transport:l.http(Lt(e,r,t))}),o=await i.getBalance({address:n}).catch((()=>0n)),s=null,d=c.UsdcAddressMap[e.id];if(a&&d){let{balance:a}=await Bc({address:n,chain:e,rpcConfig:r,appId:t,erc20Address:d});s=a}return{balance:o,erc20Balance:s,erc20Address:d,chain:e}}))),Vu=t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 397.7 311.7",enableBackground:"new 0 0 397.7 311.7",xmlSpace:"preserve",...t,children:[/*#__PURE__*/e.jsxs("linearGradient",{id:"SVGID_1_",gradientUnits:"userSpaceOnUse",x1:"360.8791",y1:"351.4553",x2:"141.213",y2:"-69.2936",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/e.jsx("path",{d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5 c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z",fill:"url(#SVGID_1_)"}),/*#__PURE__*/e.jsxs("linearGradient",{id:"SVGID_2_",gradientUnits:"userSpaceOnUse",x1:"264.8291",y1:"401.6014",x2:"45.163",y2:"-19.1475",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/e.jsx("path",{d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5 c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z",fill:"url(#SVGID_2_)"}),/*#__PURE__*/e.jsxs("linearGradient",{id:"SVGID_3_",gradientUnits:"userSpaceOnUse",x1:"312.5484",y1:"376.688",x2:"92.8822",y2:"-44.061",gradientTransform:"matrix(1 0 0 -1 0 314)",children:[/*#__PURE__*/e.jsx("stop",{offset:"0",stopColor:"#00FFA3"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#DC1FFF"})]}),/*#__PURE__*/e.jsx("path",{d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4 c5.8,0,8.7-7,4.6-11.1L333.1,120.1z",fill:"url(#SVGID_3_)"})]});let $u={[c.arbitrum.id]:t=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",version:"1.1",id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 2500 2500",xmlSpace:"preserve",...t,children:/*#__PURE__*/e.jsx("g",{id:"Layer_x0020_1",children:/*#__PURE__*/e.jsxs("g",{id:"_2405588477232",children:[/*#__PURE__*/e.jsx("rect",{fill:"none",width:"2500",height:"2500"}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsxs("g",{children:[/*#__PURE__*/e.jsx("path",{fill:"#213147",d:"M226,760v980c0,63,33,120,88,152l849,490c54,31,121,31,175,0l849-490c54-31,88-89,88-152V760 c0-63-33-120-88-152l-849-490c-54-31-121-31-175,0L314,608c-54,31-87,89-87,152H226z"}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsxs("g",{children:[/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#12AAFF",d:"M1435,1440l-121,332c-3,9-3,19,0,29l208,571l241-139l-289-793C1467,1422,1442,1422,1435,1440z"})}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#12AAFF",d:"M1678,882c-7-18-32-18-39,0l-121,332c-3,9-3,19,0,29l341,935l241-139L1678,883V882z"})})]})}),/*#__PURE__*/e.jsx("g",{children:/*#__PURE__*/e.jsx("path",{fill:"#9DCCED",d:"M1250,155c6,0,12,2,17,5l918,530c11,6,17,18,17,30v1060c0,12-7,24-17,30l-918,530c-5,3-11,5-17,5 s-12-2-17-5l-918-530c-11-6-17-18-17-30V719c0-12,7-24,17-30l918-530c5-3,11-5,17-5l0,0V155z M1250,0c-33,0-65,8-95,25L237,555 c-59,34-95,96-95,164v1060c0,68,36,130,95,164l918,530c29,17,62,25,95,25s65-8,95-25l918-530c59-34,95-96,95-164V719 c0-68-36-130-95-164L1344,25c-29-17-62-25-95-25l0,0H1250z"})}),/*#__PURE__*/e.jsx("polygon",{fill:"#213147",points:"642,2179 727,1947 897,2088 738,2234 "}),/*#__PURE__*/e.jsxs("g",{children:[/*#__PURE__*/e.jsx("path",{fill:"#FFFFFF",d:"M1172,644H939c-17,0-33,11-39,27L401,2039l241,139l550-1507c5-14-5-28-19-28L1172,644z"}),/*#__PURE__*/e.jsx("path",{fill:"#FFFFFF",d:"M1580,644h-233c-17,0-33,11-39,27L738,2233l241,139l620-1701c5-14-5-28-19-28V644z"})]})]})})]})})}),[c.avalanche.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"1503",height:"1504",viewBox:"0 0 1503 1504",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"287",y:"258",width:"928",height:"844",fill:"white"}),/*#__PURE__*/e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1502.5 752C1502.5 1166.77 1166.27 1503 751.5 1503C336.734 1503 0.5 1166.77 0.5 752C0.5 337.234 336.734 1 751.5 1C1166.27 1 1502.5 337.234 1502.5 752ZM538.688 1050.86H392.94C362.314 1050.86 347.186 1050.86 337.962 1044.96C327.999 1038.5 321.911 1027.8 321.173 1015.99C320.619 1005.11 328.184 991.822 343.312 965.255L703.182 330.935C718.495 303.999 726.243 290.531 736.021 285.55C746.537 280.2 759.083 280.2 769.599 285.55C779.377 290.531 787.126 303.999 802.438 330.935L876.42 460.079L876.797 460.738C893.336 489.635 901.723 504.289 905.385 519.669C909.443 536.458 909.443 554.169 905.385 570.958C901.695 586.455 893.393 601.215 876.604 630.549L687.573 964.702L687.084 965.558C670.436 994.693 661.999 1009.46 650.306 1020.6C637.576 1032.78 622.263 1041.63 605.474 1046.62C590.161 1050.86 573.004 1050.86 538.688 1050.86ZM906.75 1050.86H1115.59C1146.4 1050.86 1161.9 1050.86 1171.13 1044.78C1181.09 1038.32 1187.36 1027.43 1187.92 1015.63C1188.45 1005.1 1181.05 992.33 1166.55 967.307C1166.05 966.455 1165.55 965.588 1165.04 964.706L1060.43 785.75L1059.24 783.735C1044.54 758.877 1037.12 746.324 1027.59 741.472C1017.08 736.121 1004.71 736.121 994.199 741.472C984.605 746.453 976.857 759.552 961.544 785.934L857.306 964.891L856.949 965.507C841.69 991.847 834.064 1005.01 834.614 1015.81C835.352 1027.62 841.44 1038.5 851.402 1044.96C860.443 1050.86 875.94 1050.86 906.75 1050.86Z",fill:"#E84142"})]}),[c.base.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"146",height:"146",viewBox:"0 0 146 146",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("circle",{cx:"73",cy:"73",r:"73",fill:"#0052FF"}),/*#__PURE__*/e.jsx("path",{d:"M73.323 123.729C101.617 123.729 124.553 100.832 124.553 72.5875C124.553 44.343 101.617 21.4463 73.323 21.4463C46.4795 21.4463 24.4581 42.0558 22.271 68.2887H89.9859V76.8864H22.271C24.4581 103.119 46.4795 123.729 73.323 123.729Z",fill:"white"})]}),[c.celo.id]:t=>/*#__PURE__*/e.jsxs("svg",{fill:"none",height:"400",viewBox:"0 0 400 400",width:"400",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("path",{d:"m0 0h400v400h-400z",fill:"#fcff52"}),/*#__PURE__*/e.jsx("path",{d:"m300 100h-200v200h199.996v-69.813h-33.191c-11.442 25.468-37.194 43.206-66.665 43.206-40.63 0-73.533-33.187-73.533-73.533s32.903-73.249 73.533-73.249c30.043 0 55.795 18.313 67.24 44.349h32.62z",fill:"#000"})]}),[c.linea.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"200",height:"208",viewBox:"0 0 200 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"199.4",height:"207.623",fill:"#121212"}),/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_2303_643)",children:[/*#__PURE__*/e.jsx("path",{d:"M132.369 155.99H49.7001V68.8854H68.6148V139.109H132.369V155.981V155.99Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M132.369 85.7575C141.687 85.7575 149.241 78.2036 149.241 68.8855C149.241 59.5673 141.687 52.0134 132.369 52.0134C123.05 52.0134 115.497 59.5673 115.497 68.8855C115.497 78.2036 123.05 85.7575 132.369 85.7575Z",fill:"white"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_2303_643",children:/*#__PURE__*/e.jsx("rect",{width:"99.5407",height:"103.977",fill:"white",transform:"translate(49.7001 52.0134)"})})})]}),[c.mainnet.id]:t=>/*#__PURE__*/e.jsxs("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 327.5 533.3",enableBackground:"new 0 0 327.5 533.3;",xmlSpace:"preserve",...t,children:[/*#__PURE__*/e.jsx("path",{fill:"#8492B2",d:"M163.7,197.2V0L0,271.6L163.7,197.2z"}),/*#__PURE__*/e.jsx("path",{fill:"#62688F",d:"M163.7,368.4V197.2L0,271.6L163.7,368.4z M163.7,197.2l163.7,74.4L163.7,0V197.2z"}),/*#__PURE__*/e.jsx("path",{fill:"#454A75",d:"M163.7,197.2v171.2l163.7-96.8L163.7,197.2z"}),/*#__PURE__*/e.jsx("path",{fill:"#8492B2",d:"M163.7,399.4L0,302.7l163.7,230.7V399.4z"}),/*#__PURE__*/e.jsx("path",{fill:"#62688F",d:"M327.5,302.7l-163.8,96.7v134L327.5,302.7z"})]}),[c.optimism.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"500",height:"500",viewBox:"0 0 500 500",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("circle",{cx:"250",cy:"250",r:"250",fill:"#FF0420"}),/*#__PURE__*/e.jsx("path",{d:"M177.133 316.446C162.247 316.446 150.051 312.943 140.544 305.938C131.162 298.808 126.471 288.676 126.471 275.541C126.471 272.789 126.784 269.411 127.409 265.408C129.036 256.402 131.35 245.581 134.352 232.947C142.858 198.547 164.812 181.347 200.213 181.347C209.845 181.347 218.476 182.973 226.107 186.225C233.738 189.352 239.742 194.106 244.12 200.486C248.498 206.74 250.688 214.246 250.688 223.002C250.688 225.629 250.375 228.944 249.749 232.947C247.873 244.08 245.621 254.901 242.994 265.408C238.616 282.546 231.048 295.368 220.29 303.874C209.532 312.255 195.147 316.446 177.133 316.446ZM179.76 289.426C186.766 289.426 192.707 287.362 197.586 283.234C202.59 279.106 206.155 272.789 208.281 264.283C211.158 252.524 213.348 242.266 214.849 233.51C215.349 230.883 215.599 228.194 215.599 225.441C215.599 214.058 209.657 208.366 197.774 208.366C190.768 208.366 184.764 210.43 179.76 214.558C174.882 218.687 171.379 225.004 169.253 233.51C167.001 241.891 164.749 252.149 162.498 264.283C161.997 266.784 161.747 269.411 161.747 272.163C161.747 283.672 167.752 289.426 179.76 289.426Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M259.303 314.57C257.927 314.57 256.863 314.132 256.113 313.256C255.487 312.255 255.3 311.13 255.55 309.879L281.444 187.914C281.694 186.538 282.382 185.412 283.508 184.536C284.634 183.661 285.822 183.223 287.073 183.223H336.985C350.87 183.223 362.003 186.1 370.384 191.854C378.891 197.609 383.144 205.927 383.144 216.81C383.144 219.937 382.769 223.19 382.018 226.567C378.891 240.953 372.574 251.586 363.067 258.466C353.685 265.346 340.8 268.786 324.413 268.786H299.082L290.451 309.879C290.2 311.255 289.512 312.38 288.387 313.256C287.261 314.132 286.072 314.57 284.822 314.57H259.303ZM325.727 242.892C330.98 242.892 335.546 241.453 339.424 238.576C343.427 235.699 346.054 231.571 347.305 226.192C347.68 224.065 347.868 222.189 347.868 220.563C347.868 216.935 346.805 214.183 344.678 212.307C342.551 210.305 338.924 209.305 333.795 209.305H311.278L304.148 242.892H325.727Z",fill:"white"})]}),[c.polygon.id]:t=>/*#__PURE__*/e.jsxs("svg",{width:"360",height:"360",viewBox:"0 0 360 360",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"360",height:"360",rx:"180",fill:"#6C00F6"}),/*#__PURE__*/e.jsx("path",{d:"M157.743 154.241L141.052 144.58L90.9766 173.561V231.519L141.052 260.5L191.13 231.519V141.359L218.948 125.26L246.77 141.359V173.561L218.948 189.66L202.257 180.002V205.759L218.948 215.42L269.024 186.439V128.481L218.948 99.5L168.873 128.481V218.641L141.052 234.74L113.233 218.641V186.439L141.052 170.34L157.743 179.998V154.241Z",fill:"white"})]}),[c.zora.id]:t=>/*#__PURE__*/e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",...t,children:[/*#__PURE__*/e.jsx("g",{clipPath:"url(#clip0)",children:/*#__PURE__*/e.jsx("g",{clipPath:"url(#clip1)",children:/*#__PURE__*/e.jsx("path",{d:"M14.9188 29.8373C6.67944 29.8373 0.00012207 23.1581 0.00012207 14.9187C0.00012207 6.67931 6.67944 0 14.9188 0C23.1581 0 29.8373 6.67931 29.8373 14.9187C29.8373 23.1581 23.1581 29.8373 14.9188 29.8373Z",fill:"url(#paint0)"})})}),/*#__PURE__*/e.jsxs("defs",{children:[/*#__PURE__*/e.jsxs("radialGradient",{id:"paint0",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(21.6921 8.02215) rotate(180) scale(25.2008)",children:[/*#__PURE__*/e.jsx("stop",{offset:"0.00682297",stopColor:"#F2CEFE"}),/*#__PURE__*/e.jsx("stop",{offset:"0.1913",stopColor:"#AFBAF1"}),/*#__PURE__*/e.jsx("stop",{offset:"0.4982",stopColor:"#4281D3"}),/*#__PURE__*/e.jsx("stop",{offset:"0.666667",stopColor:"#2E427D"}),/*#__PURE__*/e.jsx("stop",{offset:"0.822917",stopColor:"#230101"}),/*#__PURE__*/e.jsx("stop",{offset:"1",stopColor:"#8F6B40"})]}),/*#__PURE__*/e.jsx("clipPath",{id:"clip0",children:/*#__PURE__*/e.jsx("rect",{width:"30",height:"30",fill:"white"})}),/*#__PURE__*/e.jsx("clipPath",{id:"clip1",children:/*#__PURE__*/e.jsx("rect",{width:"30",height:"30",fill:"white"})})]})]})};const qu=({chainId:t,...n})=>{if("solana"===t)/*#__PURE__*/return e.jsx(Vu,{...n});let r=$u[t];return r?/*#__PURE__*/e.jsx(r,{...n}):/*#__PURE__*/e.jsx(qe.default,{...n})},Gu=({balance:t,className:n,chain:r})=>/*#__PURE__*/e.jsx(Ac,{className:n,$state:void 0,children:/*#__PURE__*/e.jsx(Yu,{balance:t,chain:r})}),Yu=({balance:t,chain:n})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Zu,{children:[/*#__PURE__*/e.jsx(Qu,{chainId:"object"==typeof n?n.id:"solana"}),/*#__PURE__*/e.jsx(ld,{children:"object"==typeof n?n.name:Rc(n)})]}),/*#__PURE__*/e.jsxs(xu,{isLoading:!1,isPulsing:!1,color:"gray",children:[/*#__PURE__*/e.jsx(Ku,{children:/*#__PURE__*/e.jsx(ve.default,{})}),t]})]});let Zu=/*#__PURE__*/i.styled.div.withConfig({displayName:"Container",componentId:"sc-63f80cee-0"})(["display:flex;align-items:center;"]),Ku=/*#__PURE__*/i.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-63f80cee-1"})(["height:0.75rem;width:0.75rem;margin-right:0.2rem;"]),Qu=/*#__PURE__*/i.styled(qu).withConfig({displayName:"StyledNetworkIcon",componentId:"sc-63f80cee-2"})(["height:1.25rem;width:1.25rem;display:inline-block;margin-right:0.5rem;border-radius:4px;"]);const Xu=({options:t,onSelect:n,selected:r,className:a})=>/*#__PURE__*/e.jsxs(re.Menu,{as:Ju,children:[/*#__PURE__*/e.jsxs(re.MenuButton,{as:rp,children:[/*#__PURE__*/e.jsx(Yu,{balance:r.balance,chain:r.chain}),/*#__PURE__*/e.jsx(np,{height:16})]}),/*#__PURE__*/e.jsx(re.MenuItems,{as:ep,className:a,children:t.map(((t,r)=>/*#__PURE__*/e.jsx(re.MenuItem,{as:tp,onClick:()=>n(r),children:/*#__PURE__*/e.jsx(Yu,{balance:t.balance,chain:t.chain})},r)))})]});let Ju=/*#__PURE__*/i.styled.div.withConfig({displayName:"Wrapper",componentId:"sc-31c00f79-0"})(["width:100%;position:relative;"]),ep=/*#__PURE__*/i.styled.div.withConfig({displayName:"Popover",componentId:"sc-31c00f79-1"})(["width:100%;margin-top:0.5rem;position:absolute;background-color:var(--privy-color-background);border-radius:var(--privy-border-radius-md);overflow-x:hidden;overflow-y:auto;box-shadow:0px 1px 2px 0px rgba(16,24,40,0.05);max-height:11.75rem;&&{border:solid 1px var(--privy-color-foreground-4);}z-index:1;"]),tp=/*#__PURE__*/i.styled.button.withConfig({displayName:"Button",componentId:"sc-31c00f79-2"})(["width:100%;display:flex;justify-content:space-between;&&{padding:1rem;}:not(:last-child){border-bottom:solid 1px var(--privy-color-foreground-4);}:hover{background:var(--privy-color-background-2);}"]),np=/*#__PURE__*/i.styled(Ve.default).withConfig({displayName:"StyledChevronIcon",componentId:"sc-31c00f79-3"})(["height:1rem;margin-left:0.5rem;"]),rp=/*#__PURE__*/i.styled.button.withConfig({displayName:"StyledMenuButton",componentId:"sc-31c00f79-4"})([""," span{margin-left:auto;}","{transition:rotate 100ms ease-in;}&[aria-expanded='true']{","{rotate:-180deg;}}"],Tc,np,np);const ap=/*#__PURE__*/i.styled.div.withConfig({displayName:"FundingMethodContainer",componentId:"sc-eaaa12a-0"})(["display:flex;flex-direction:column;gap:12px;padding-top:24px;padding-bottom:24px;"]),ip=/*#__PURE__*/i.styled.div.withConfig({displayName:"IconContainer",componentId:"sc-eaaa12a-1"})(["width:24px;height:24px;display:flex;justify-content:center;align-items:center;svg{border-radius:var(--privy-border-radius-sm);}"]),op=/*#__PURE__*/i.styled.div.withConfig({displayName:"FundingQuantityWrapper",componentId:"sc-eaaa12a-2"})(["display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:8px;"]),sp=/*#__PURE__*/i.styled.div.withConfig({displayName:"FundingQuantity",componentId:"sc-eaaa12a-3"})(["display:flex;align-items:center;gap:4px;width:100%;padding:0 16px;border-width:1px !important;border-radius:12px;cursor:text;&:focus-within{border-color:var(--privy-color-accent);}"]),lp=/*#__PURE__*/i.styled.input.withConfig({displayName:"FundingAmountInput",componentId:"sc-eaaa12a-5"})(["background-color:var(--privy-color-background);width:100%;&:focus{outline:none !important;border:none !important;box-shadow:none !important;}&&{font-size:26px;}"]),cp=/*#__PURE__*/i.styled(lp).withConfig({displayName:"FundingAmountInputLarge",componentId:"sc-eaaa12a-6"})(["&&{font-size:42px;}"]),dp=/*#__PURE__*/i.styled.div.withConfig({displayName:"FundingCurrency",componentId:"sc-eaaa12a-8"})(["font-size:18px;"]),up=/*#__PURE__*/i.styled.div.withConfig({displayName:"FundingDollars",componentId:"sc-eaaa12a-9"})(["font-size:12px;color:var(--privy-color-foreground-3);height:20px;"]),pp=/*#__PURE__*/i.styled.div.withConfig({displayName:"InfoButtonText",componentId:"sc-eaaa12a-13"})([""]),hp=/*#__PURE__*/i.styled.a.withConfig({displayName:"InfoButtonLink",componentId:"sc-eaaa12a-14"})(["&&{color:var(--privy-color-accent);}cursor:pointer;"]),gp=({displayName:t,errorMessage:r,configuredFundingChain:a,formattedBalance:i,fundingAmount:o,fundingCurrency:s,fundingAmountInUsd:l,options:d,selectedOption:u,isPreparing:p,isSubmitting:h,addressToFund:g,fundingWalletAddress:m,onSubmit:y,onSelect:f,onAmountChange:x,erc20ContractInfo:v})=>{let w=n.useRef(null);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ja,{}),/*#__PURE__*/e.jsx(jc,{children:"Transfer from another network"}),/*#__PURE__*/e.jsxs(bc,{children:["You need more funds on the"," ","object"==typeof a?a.name:Rc(a)," ","network. Bridge from another blockchain network."]}),/*#__PURE__*/e.jsxs(op,{style:{marginTop:"2rem"},children:[/*#__PURE__*/e.jsxs(sp,{onClick:()=>w.current?.focus(),children:[/*#__PURE__*/e.jsx(lp,{ref:w,value:o,onChange:e=>{let t=e.target.value;if(/^[0-9.]*$/.test(t)&&t.split(".").length-1<=1){let e=/\.$/.test(t)?".":"",n=Number(t.replace(/\.$/,"")||"0");if(Number.isNaN(n))return void x("0");x(n.toString()+e)}}}),/*#__PURE__*/e.jsx(dp,{children:s})]}),l&&/*#__PURE__*/e.jsx(up,{children:l})]}),/*#__PURE__*/e.jsxs(id,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/e.jsx(td,{children:"From"}),/*#__PURE__*/e.jsx(td,{children:c.formatWalletAddress(m)})]}),/*#__PURE__*/e.jsx(Xu,{selected:{chain:u.chain,balance:u.isErc20Quote?Yc({amount:u.erc20Balance??0n,decimals:v?.decimals??6})+` ${v?.symbol||""}`:Pa(u.balance,u.chain.nativeCurrency.symbol,3,!0)},options:d.map((({chain:e,balance:t,isErc20Quote:n,erc20Balance:r})=>({chain:e,balance:n?Yc({amount:r??0n,decimals:v?.decimals??6})+` ${v?.symbol||""}`:Pa(t,e.nativeCurrency.symbol,3,!0)}))),onSelect:f}),/*#__PURE__*/e.jsxs(id,{style:{marginTop:"1.5rem"},children:[/*#__PURE__*/e.jsx(td,{children:"To"}),/*#__PURE__*/e.jsx(td,{children:c.formatWalletAddress(g)})]}),/*#__PURE__*/e.jsx(Gu,{chain:a,balance:i}),/*#__PURE__*/e.jsx(wl,{style:{marginTop:"1rem"},children:r}),/*#__PURE__*/e.jsxs(Nr,{style:{marginTop:"1rem"},loading:h||p,disabled:p||h,onClick:y,children:["Confirm with ",t]}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]})},mp=({walletClientType:t,displayName:n,addressToFund:r,chainId:a,chainName:i,isBridging:o,isErc20Flow:s,totalPriceInNativeCurrency:l,totalPriceInUsd:c,gasPriceInNativeCurrency:d,gasPriceInUsd:u})=>{let p=Nn(t);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Kr,{centerIcon:/*#__PURE__*/e.jsx(bu,{icon:p?.image_url?.md,name:t})}),/*#__PURE__*/e.jsx(Ui,{style:{marginTop:"8px",marginBottom:"12px"},title:`${o?"Bridging":"Confirming"} with ${n}`}),!o&&!s&&/*#__PURE__*/e.jsxs(ad,{children:[/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Total"}),/*#__PURE__*/e.jsx(ld,{children:c||l})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"To"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:r,showCopyIcon:!1})})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Network"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsxs(yp,{children:[/*#__PURE__*/e.jsx(qu,{chainId:a,height:16,width:16})," ",i]})})]}),d&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(ld,{children:u||d})]})]}),/*#__PURE__*/e.jsx(ti,{height:24}),/*#__PURE__*/e.jsx(xr,{})]})};let yp=/*#__PURE__*/i.styled.div.withConfig({displayName:"NetworkColumn",componentId:"sc-5bdbf842-0"})(["display:flex;flex-direction:row;align-items:center;gap:4px;"]);const fp={component:()=>{let t=qn(),{rpcConfig:a,appId:i,closePrivyModal:o,createAnalyticsEvent:s}=r.usePrivyInternal(),{navigate:u,setModalData:p,data:h}=Xn(),g=qn(),{wallets:m}=Ni(),[y,f]=n.useState(null),[x,v]=n.useState(null),[w,C]=n.useState([]),[b,j]=n.useState(0),[k,T]=n.useState(!1),[A,S]=n.useState(!1),[E,I]=n.useState(!1),[P,N]=n.useState(!1),[_,M]=n.useState(),[F,L]=n.useState();if(!h?.funding||"solana"!==h.funding.chainType)throw Error("Invalid funding data");let{address:W,chain:D,connectedWalletAddress:R}=h.funding,[O,B]=n.useState(h.funding.amount),U=R?m.find((({address:e})=>e===R)):m[0],z=Nn(U?.walletClientType||"unknown"),H=z?.name||"wallet",[V,$]=n.useState(null);n.useEffect((()=>{(async()=>{if(!U)return;let e=await U.getEthereumProvider();$(l.createWalletClient({account:U.address,transport:l.custom(e)}).extend(l.publicActions))})().catch(console.error)}),[U]);let[q,G]=n.useState(0n),Y=Ra(q);n.useEffect((()=>{let e=t.solanaRpcs[D];e?Dc({rpc:e.rpc,address:W}).then((e=>G(BigInt(e)))).catch(console.error):console.warn("Unable to load solana rpc, skipping balance")}),[]);let[Z,K]=n.useState(),{tokenPrice:Q}=Ii("solana"),{fundingAmountInBaseUnit:X,fundingAmountInUsd:J}=function({amount:e,fee:t,tokenPrice:n,isUsdc:r}){let a=BigInt(Math.floor(parseFloat(e)*10**(r?6:9))),i=r?a:a+t;return{fundingAmountInBaseUnit:a,fundingAmountInUsd:n?Wa(a,n):void 0,totalPriceInUsd:n?Wa(i,n):void 0,totalPriceInNativeCurrency:Ra(i),feePriceInNativeCurrency:Ra(t),feePriceInUsd:n?Wa(t,n):void 0}}({amount:O,fee:0n,tokenPrice:Q,isUsdc:h.funding.isUSDC});if(n.useEffect((()=>{(async()=>{if(!V||!U)return;let e=["solana:testnet","solana:devnet"].includes(D);e&&console.warn("Solana testnets are not supported for bridging");let t=c.addToDefaultChains(g.chains).filter((({testnet:t})=>!!t===e)),n=(await Hu({chains:t,address:U.address,appId:i,rpcConfig:a})).filter((e=>e.balance>0n));if(n.length<1)return void f(new d.PrivyClientError(`Wallet ${Dt(U.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));n.sort(((e,t)=>Number(t.balance-e.balance)));let r=(await Promise.allSettled(n.map((async e=>({...e,quote:await _s({isTestnet:!1,input:Is({amount:X.toString(),user:U.address,recipient:W,destinationChainId:As,destinationCurrency:Ss,originChainId:e.chain.id})})}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(r.length<1)return void f(new d.PrivyClientError(`Unable to fetch quotes for bridging. Wallet ${Dt(U.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));let o=r.map((({quote:e,balance:t,chain:n})=>({bridgeTx:Ms(e),balance:t,chain:n,isErc20Quote:!1}))).filter((({bridgeTx:e})=>!!e));if(o.length>1)return void C(o);let s=o.at(0);s?(S(!0),K({data:s.bridgeTx.data,to:s.bridgeTx.to,value:s.bridgeTx.value,chain:s.chain})):f(new d.PrivyClientError(`Unable to select bridge option from quotes. Wallet ${Dt(U.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[V]),n.useEffect((()=>{(async()=>{let e,t;if(!V||!U||k||E||!Z)return;T(!0);let n=l.createPublicClient({chain:Z.chain,transport:l.http(Lt(Z.chain,a,i))});try{e=await n.prepareTransactionRequest({account:U.address,to:Z.to,chain:Z.chain,data:Z.data,value:BigInt(Z.value??0)})}catch(e){console.error(e),w.length>1&&v(e.shortMessage??"Something went wrong")}if(e){T(!1),I(!0);try{await V.switchChain({id:Z.chain.id})}catch(e){await V.addChain({chain:Z.chain}),await V.switchChain({id:Z.chain.id})}try{t=await V.sendTransaction(e)}catch(e){console.error(e),"TransactionExecutionError"===e.name&&(w.length<1?f(new d.PrivyClientError(e.shortMessage,void 0,d.PrivyErrorCode.TRANSACTION_FAILURE)):v(e.shortMessage??"Something went wrong"))}if(t)return await V.waitForTransactionReceipt({hash:t}),A?(L("pending"),void M(t)):(I(!1),N(!0),void s({eventName:Wc,payload:{provider:"external",status:"success",txHash:t,address:U.address,chainId:Z.chain.id,chainType:"ethereum",value:Z.value?l.formatUnits(BigInt(Z.value),18):void 0,token:"ETH",destination:W,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:l.formatUnits(X,9),destinationToken:"SOL"}}));I(!1)}else T(!1)})().catch(console.error)}),[V,Z]),Ls({transactionHash:_,isTestnet:!1,bridgingStatus:F,setBridgingStatus:L,onSuccess({transactionHash:e}){S(!1),N(!0),s({eventName:Wc,payload:{provider:"external",status:"success",txHash:e,address:U?.address,chainId:Z?.chain.id,chainType:"ethereum",value:Z?.value?l.formatUnits(BigInt(Z.value),18):void 0,token:"ETH",destination:W,destinationClusterName:"mainnet-beta",destinationChainType:"solana",destinationValue:l.formatUnits(X,9),destinationToken:"SOL"}})},onFailure({error:e}){S(!1),f(e)}}),n.useEffect((()=>{y&&(p({funding:h?.funding,solanaFundingData:h?.solanaFundingData,sendTransaction:h?.sendTransaction,errorModalData:{error:y,previousScreen:bp}}),u(Rs,!1))}),[y]),n.useEffect((()=>{if(!P)return;let e=setTimeout(o,it);return()=>clearTimeout(e)}),[P]),P/*#__PURE__*/)return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ja,{}),/*#__PURE__*/e.jsxs(Za,{children:[/*#__PURE__*/e.jsx($e.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ui,{title:"Success!",description:`You’ve successfully added ${O} SOL to your ${g.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]});let ee=w[b];return w.length>1&&ee?/*#__PURE__*/e.jsx(gp,{displayName:H,configuredFundingChain:D,formattedBalance:Y,fundingAmount:O,fundingCurrency:"SOL",fundingAmountInUsd:J,options:w,selectedOption:ee,isPreparing:k,isSubmitting:E,addressToFund:W,fundingWalletAddress:U?.address||"",errorMessage:x,onSubmit:()=>{h.funding?.amount!==O?async function(){if(U&&ee)try{let e=await _s({isTestnet:!1,input:Is({amount:X.toString(),user:U.address,recipient:W,destinationChainId:As,destinationCurrency:Ss,originChainId:ee.chain.id})}),t=Ms(e);if(!t)throw Error("Invalid transaction request");S(!0),K({data:t.data,to:t.to,value:t.value,chain:ee.chain})}catch(e){console.error(e),f(new d.PrivyClientError("Unable to fetch quotes for bridging",e,d.PrivyErrorCode.INSUFFICIENT_BALANCE))}}().catch(console.error):K({to:ee.bridgeTx.to,data:ee.bridgeTx.data,value:ee.bridgeTx.value,chain:ee.chain})},onSelect:e=>{e!==b&&(v(null),j(e))},onAmountChange:B}):E&&U?/*#__PURE__*/e.jsx(mp,{walletClientType:U?.walletClientType||"unknown",displayName:H,addressToFund:W,isBridging:A,isErc20Flow:!1,chainId:"solana",chainName:Rc(D),totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
22
+ /*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Kr,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(xr,{})]})}},xp={component:()=>{let{rpcConfig:t,appId:a,closePrivyModal:i,createAnalyticsEvent:o}=r.usePrivyInternal(),{navigate:s,setModalData:u,data:p}=Xn(),h=qn(),{wallets:g}=Ni(),[m,y]=n.useState(!1),[f,x]=n.useState(0n),[v,w]=n.useState(!1),[C,b]=n.useState(null),[j,k]=n.useState(null),[T,A]=n.useState([]),[S,E]=n.useState(0),[I,P]=n.useState(!1),[N,_]=n.useState(!1),[M,F]=n.useState(!1),[L,W]=n.useState(!1),[D,R]=n.useState(),[O,B]=n.useState();if(!p?.funding||"ethereum"!==p.funding.chainType)throw Error("Invalid funding data");let{erc20ContractInfo:U,chain:z,connectedWalletAddress:H}=p.funding,V=p.funding.address,$=p.funding.erc20Address,[q,G]=n.useState(p.funding.amount);n.useEffect((()=>{$&&!U&&b(Error("Unable to fetch token details"))}),[]);let Y=!!$&&!!U,Z=Y?BigInt(parseFloat(q)*10**U.decimals):l.parseEther(q),K=H?g.find((({address:e})=>e===H)):g[0],Q=Nn(K?.walletClientType||"unknown"),X=Q?.name||"wallet",[J,ee]=n.useState(null);n.useEffect((()=>{(async()=>{if(!K)return;let e=await K.getEthereumProvider();ee(l.createWalletClient({account:K.address,transport:l.custom(e)}).extend(l.publicActions))})().catch(console.error)}),[K]);let[te,ne]=n.useState(0n);n.useEffect((()=>{l.createPublicClient({chain:z,transport:l.http(Lt(z,t,a))}).getBalance({address:V}).then(ne).catch(console.error)}),[]);let[re,ae]=n.useState(0n);n.useEffect((()=>{Y&&Bc({chain:z,address:V,appId:a,rpcConfig:t,erc20Address:$}).then((e=>ae(e.balance))).catch(console.error)}),[]);let{tokenPrice:ie}=Ii(z.id),[oe,se]=n.useState({to:V,chain:z,value:Z,data:void 0});n.useEffect((()=>{(async()=>{let e,n;if(!J||!K||I||M)return;P(!0);let r=l.createPublicClient({chain:oe.chain,transport:l.http(Lt(oe.chain,t,a))});if(Y&&!oe.data)return await r.simulateContract({address:$,chain:oe.chain,abi:Jd,functionName:"transfer",args:[V,Z],account:K.address}).catch((e=>{console.warn("Simulated token transfer failed with error, fetching bridge options.",e)}))?(P(!1),void se({to:$,chain:oe.chain,data:l.encodeFunctionData({abi:Jd,functionName:"transfer",args:[V,Z]}),value:"0x0"})):(P(!1),void w(!0));try{e=await r.prepareTransactionRequest({account:K.address,to:oe.to,chain:oe.chain,data:oe.data,value:BigInt(oe.value??0)})}catch(e){if(console.error(e),T.length>1)k(e.shortMessage??"Something went wrong");else if(N&&0===T.length)return void b(new d.PrivyClientError(`Wallet ${Dt(K.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE))}if(!e)return P(!1),void w(!0);P(!1),F(!0),y(!0),x(e.gas);try{await J.switchChain({id:oe.chain.id})}catch(e){await J.addChain({chain:oe.chain}),await J.switchChain({id:oe.chain.id})}try{n=await J.sendTransaction(e)}catch(e){if(console.error(e),"TransactionExecutionError"===e.name)if(T.length<1){let t=e.shortMessage;(e.shortMessage.includes("rejected the request")||e.details.includes("rejected the request"))&&(t="User rejected the request."),b(new d.PrivyClientError(t,void 0,d.PrivyErrorCode.TRANSACTION_FAILURE))}else k(e.shortMessage??"Something went wrong")}if(n)return await J.waitForTransactionReceipt({hash:n}),F(!1),N?(R(n),void B("pending")):(W(!0),void o({eventName:Wc,payload:{provider:"external",status:"success",txHash:n,address:K.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?l.formatUnits(BigInt(oe.value),U?.decimals??18):void 0,token:U?.symbol??$??"ETH",destinationAddress:V,destinationChainId:z.id,destinationChainType:"ethereum",destinationValue:Z?l.formatUnits(Z,U?.decimals??18):void 0,destinationToken:U?.symbol??$??z.nativeCurrency.name}}));F(!1)})().catch(console.error)}),[J,oe]),n.useEffect((()=>{(async()=>{if(!v||!J||!K)return;let e=c.addToDefaultChains(h.chains).filter((e=>e.id!==z.id&&!!e.testnet==!!z.testnet));Y&&e.unshift(z);let n=await Hu({chains:e,address:K.address,appId:a,rpcConfig:t,includeUsdc:p.funding?.isUSDC}),r=Y?n.filter((e=>e.balance>0n)):n.filter((e=>e.balance>Z)),i=Y&&n.every((e=>0n===e.balance));if(r.length<1)return void b(i?new d.PrivyClientError(`Wallet ${Dt(K.address)} doesn't have enough funds to cover gas fees. Top up your wallet and try again.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE):new d.PrivyClientError(`Wallet ${Dt(K.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));r.sort(((e,t)=>Number(Y?(t.erc20Balance??0n)-(e.erc20Balance??0n):t.balance-e.balance)));let o=r.flatMap((e=>{let t=[{...e,isErc20Quote:!1,isTestnet:!!z.testnet,input:Is({amount:Z.toString(),user:K.address,recipient:V,destinationChainId:z.id,destinationCurrency:$,originChainId:e.chain.id})}];return Y&&$&&(e.erc20Balance??0n)>=Z&&t.push({...e,isErc20Quote:!0,isTestnet:!!z.testnet,input:Is({amount:Z.toString(),user:K.address,recipient:V,destinationChainId:z.id,destinationCurrency:$,originChainId:e.chain.id,originCurrency:e.erc20Address})}),t})),s=(await Promise.allSettled(o.map((async e=>({...e,quote:await _s(e)}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value));if(s.length<1)return void b(new d.PrivyClientError(`Wallet ${Dt(K.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));let l=s.map((e=>({bridgeTx:Ms(e.quote),balance:e.balance,chain:e.chain,erc20Balance:e.erc20Balance,isErc20Quote:e.isErc20Quote}))).filter((e=>!!e.bridgeTx));if(l.length>1)return void A(l);let u=l[0];u?(_(!0),se({data:u.bridgeTx.data,to:u.bridgeTx.to,value:u.bridgeTx.value,chain:u.chain})):b(new d.PrivyClientError(`Wallet ${Dt(K.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[v]),Ls({transactionHash:D,isTestnet:!!z.testnet,bridgingStatus:O,setBridgingStatus:B,onSuccess({transactionHash:e}){_(!1),W(!0),o({eventName:Wc,payload:{provider:"external",status:"success",txHash:e,address:K?.address,chainId:oe.chain.id,chainType:"ethereum",value:oe.value?l.formatUnits(BigInt(oe.value),U?.decimals??18):void 0,token:U?.symbol??$??"ETH",destinationAddress:V,destinationChainId:z.id,destinationChainType:"ethereum",destinationValue:Z?l.formatUnits(Z,U?.decimals??18):void 0,destinationToken:U?.symbol??$??z.nativeCurrency.name}})},onFailure({error:e}){_(!1),b(e)}}),n.useEffect((()=>{C&&(u({funding:p?.funding,solanaFundingData:p?.solanaFundingData,sendTransaction:p?.sendTransaction,errorModalData:{error:C,previousScreen:bp}}),s(Rs,!1))}),[C]);let le=!Y&&ie?Ea(q??"0",ie):void 0,ce=Y?f:_a([f,Z]),de=ce&&ie?Ia(ce,ie):void 0,ue=ce?Pa(ce,p?.funding?.erc20Address?p?.funding?.erc20ContractInfo?.symbol||"ETH":p?.funding?.chain.nativeCurrency.symbol||"ETH"):void 0,pe=f&&ie?Ia(f,ie):void 0,he=f?Pa(f,z?.nativeCurrency?.symbol||"ETH"):void 0;if(n.useEffect((()=>{if(!L)return;let e=setTimeout(i,it);return()=>clearTimeout(e)}),[L]),L/*#__PURE__*/)return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ja,{}),/*#__PURE__*/e.jsxs(Za,{children:[/*#__PURE__*/e.jsx($e.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ui,{title:"Success!",description:`You’ve successfully added ${q} ${Y?U.symbol:z.nativeCurrency.symbol} to your ${h.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]});let ge=Y?`${Yc({amount:re,decimals:U.decimals})} ${U.symbol}`:Pa(te,z.nativeCurrency.symbol,3,!0),me=T[S];return T.length>1&&me?/*#__PURE__*/e.jsx(gp,{displayName:X,configuredFundingChain:z,erc20ContractInfo:U,formattedBalance:ge,fundingAmount:q,fundingCurrency:Y?U.symbol:z.nativeCurrency.symbol,fundingAmountInUsd:le,options:T,selectedOption:me,isPreparing:I,isSubmitting:M,addressToFund:V,fundingWalletAddress:K?.address||"",errorMessage:j,onSubmit:()=>{p.funding?.amount!==q?async function(){if(K&&me)try{let e=await _s({isTestnet:!!z.testnet,input:Is({amount:Z.toString(),user:K.address,recipient:V,destinationChainId:z.id,destinationCurrency:$,originChainId:me.chain.id})}),t=Ms(e);if(!t)throw Error("Invalid transaction request");_(!0),se({data:t.data,to:t.to,value:t.value,chain:me.chain})}catch(e){console.error(e),b(new d.PrivyClientError("Unable to fetch quotes for bridging",e,d.PrivyErrorCode.INSUFFICIENT_BALANCE))}}().catch(console.error):se({to:me.bridgeTx.to,data:me.bridgeTx.data,value:me.bridgeTx.value,chain:me.chain})},onSelect:e=>{e!==S&&(k(null),E(e))},onAmountChange:G}):m&&f&&K&&p?.funding?/*#__PURE__*/e.jsx(mp,{walletClientType:K?.walletClientType||"unknown",displayName:X,addressToFund:V,isBridging:N,isErc20Flow:Y,totalPriceInUsd:de,totalPriceInNativeCurrency:ue,gasPriceInUsd:pe,gasPriceInNativeCurrency:he,chainId:z.id,chainName:z.name}):
23
+ /*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Kr,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(xr,{})]})}},vp=Symbol("solana-funding-plugin"),wp={component:function(){let t=qn(),{closePrivyModal:a,createAnalyticsEvent:i,connectors:o}=r.usePrivyInternal(),{navigate:s,setModalData:u,data:p}=Xn(),h=qn(),g=n.useRef(!1),m=ec(),[y,f]=n.useState(!1),[x,v]=n.useState(!1),[w,C]=n.useState(null),[b,j]=n.useState(),[k,T]=n.useState();if(!p?.funding||"ethereum"!==p.funding.chainType)throw Error("Invalid funding data");let{amount:A,connectedWalletAddress:S,chain:E,solanaChain:I,isUSDC:P}=p.funding,N=p.funding.address,_=p.funding.erc20Address,M=p.funding.isUSDC?"USDC":E.nativeCurrency.symbol,F=n.useMemo((()=>function({connectors:e,connectedWalletAddress:t}){let n=e.find((e=>"solana"===e.chainType&&e.wallets.some((e=>e.address===t)))),r=n?.wallet.accounts.find((e=>e.address===t));if(!n||!r)throw new d.PrivyClientError("Unable to find source wallet connector");return new c.ConnectedStandardSolanaWallet({wallet:n.wallet,account:r})}({connectors:o,connectedWalletAddress:S||""})),[o,S]),L=n.useMemo((()=>{let e=m(vp);if(!e)throw new d.PrivyClientError("Unable to load solana plugin");let n=t.solanaRpcs["solana:mainnet"];if(!n)throw new d.PrivyClientError("Unable to load mainnet RPC");return e.getSolanaRpcClient({rpc:n.rpc,rpcSubscriptions:n.rpcSubscriptions,chain:"solana:mainnet",blockExplorerUrl:n.blockExplorerUrl??"https://explorer.solana.com"})}),[]),W=Nn(kn(F?.standardWallet.name||"unknown")),D=W?.name||"wallet";return n.useEffect((()=>{(async function(){if(!F||!E||g.current)return;let e=m(vp);if(!e)return void C(new d.PrivyClientError("Unable to solana plugin"));g.current=!0,E?.testnet&&console.warn("Solana testnets are not supported for bridging");let t=P?1e6*parseFloat(A):l.parseEther(A),n=await _s({isTestnet:!!E.testnet,input:Is({amount:t.toString(),user:F.address,recipient:N,destinationChainId:E.id,originChainId:As,originCurrency:P?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":Ss,destinationCurrency:P?_:void 0})}).catch(console.error);if(!n)return void C(new d.PrivyClientError(`Unable to fetch quotes for bridging. Wallet ${Rt(F.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));let r=await e.createTransactionFromRelayQuote({quote:n,source:F.address,solanaClient:L});if(r)try{f(!0);let t=await e.simulateTransaction({solanaClient:L,tx:r});if(t.hasError)return t.hasFunds?(console.error("Transaction failed:",t.error),void C(new d.PrivyClientError("Something went wrong",void 0,d.PrivyErrorCode.TRANSACTION_FAILURE))):void C(new d.PrivyClientError(`Wallet ${Rt(F?.address)} does not have enough funds. ${n.details.currencyIn.amountFormatted} ${M} are needed to complete the transaction.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE));let{signature:a}=await F.signAndSendTransaction({chain:"solana:mainnet",transaction:r}),i=e.getAddressFromBuffer(a);j(i),T("pending")}catch(e){if(console.error(e),/user rejected the request/gi.test(e.message||""))return void C(new d.PrivyClientError("Transaction was rejected by the user",void 0,d.PrivyErrorCode.TRANSACTION_FAILURE));C(new d.PrivyClientError("Something went wrong",void 0,d.PrivyErrorCode.TRANSACTION_FAILURE))}else C(new d.PrivyClientError(`Unable to select bridge option from quotes. Wallet ${Rt(F.address)} does not have enough funds.`,void 0,d.PrivyErrorCode.INSUFFICIENT_BALANCE))})().catch(console.error)}),[]),Ls({transactionHash:b,isTestnet:!1,bridgingStatus:k,setBridgingStatus:T,onSuccess({transactionHash:e}){f(!1),v(!0),i({eventName:Wc,payload:{provider:"external",status:"success",txHash:e,address:F.address,chainType:"solana",clusterName:I,token:"SOL",destinationAddress:N,destinationChainId:E.id,destinationChainType:"ethereum",destinationValue:A,destinationToken:P?"USDC":"ETH"}})},onFailure({error:e}){f(!1),C(e)}}),n.useEffect((()=>{if(!x)return;let e=setTimeout(a,it);return()=>clearTimeout(e)}),[x]),n.useEffect((()=>{w&&(u({funding:p?.funding,solanaFundingData:p?.solanaFundingData,sendTransaction:p?.sendTransaction,errorModalData:{error:w,previousScreen:bp}}),s(Rs,!1))}),[w]),x?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ja,{}),/*#__PURE__*/e.jsxs(Za,{children:[/*#__PURE__*/e.jsx($e.default,{color:"var(--privy-color-success)",width:"64px",height:"64px"}),/*#__PURE__*/e.jsx(Ui,{title:"Success!",description:`You’ve successfully added ${A} ${M} to your ${h.name} wallet. It may take a minute before the funds are available to use.`})]}),/*#__PURE__*/e.jsx(ei,{}),/*#__PURE__*/e.jsx(xr,{})]}):y&&F?/*#__PURE__*/e.jsx(mp,{walletClientType:kn(F?.standardWallet.name||"unknown"),displayName:D,addressToFund:N,isBridging:y,isErc20Flow:!1,chainId:E.id,chainName:E.name,totalPriceInUsd:void 0,totalPriceInNativeCurrency:void 0,gasPriceInUsd:void 0,gasPriceInNativeCurrency:void 0}):
24
+ /*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Kr,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(xr,{})]})}},Cp={component:()=>{let{data:t,setModalData:r}=Xn(),a=t?.funding,i="solana"===a.chainType,o=n.useRef(null),{tokenPrice:s}=Ii(i?"solana":a.chain.id),l=i?void 0:a,c=!(!l?.erc20Address||l?.erc20ContractInfo),d=i?a.isUSDC?"USDC":"SOL":a.erc20Address?a.erc20ContractInfo?.symbol:a.chain.nativeCurrency.symbol||"ETH",u=parseFloat(a.amount),p=!isNaN(u)&&u>0,h=s?Ea(a.amount,s):void 0;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(jc,{children:"Confirm or edit amount"}),/*#__PURE__*/e.jsxs(Ka,{style:{marginTop:"32px"},children:[/*#__PURE__*/e.jsx(op,{children:c?/*#__PURE__*/e.jsx(Kr,{size:"50px"}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(sp,{onClick:()=>o.current?.focus(),children:[/*#__PURE__*/e.jsx(cp,{ref:o,value:a.amount,onChange:e=>{let n=e.target.value;/^[0-9.]*$/.test(n)&&n.split(".").length-1<=1&&r({...t,funding:{...a,amount:n},solanaFundingData:t?.solanaFundingData?{...t.solanaFundingData,amount:n}:void 0})}}),/*#__PURE__*/e.jsx(dp,{children:d})]}),!l?.erc20Address&&/*#__PURE__*/e.jsx(up,{children:h&&p?`${h} USD`:""})]})}),/*#__PURE__*/e.jsx(Nr,{style:{marginTop:"1rem"},disabled:!p,onClick:a.onContinueWithExternalWallet,children:"Continue"})]}),/*#__PURE__*/e.jsx(xr,{})]})}},bp={component:()=>{let t,{connectors:a}=r.usePrivyInternal(),{setModalData:i,data:o,navigate:s}=Xn(),l=qn(),{wallets:c}=Ni(),d=a.filter(Sn).flatMap((e=>e.wallets)),[u,p]=n.useState("default"),h="solana"===o?.funding?.chainType,g=!!o?.funding?.crossChainBridgingEnabled;t="ethereum"===o?.funding?.chainType?o.funding.erc20Address&&!o.funding.isUSDC?"ethereum-only":g&&!o.funding.chain.testnet?"ethereum-and-solana":"ethereum-only":g&&!o.funding?.isUSDC?"ethereum-and-solana":"solana-only";let m=c.filter((e=>"privy"!==e.walletClientType)),y=m.map((e=>e.walletClientType)),f=d.filter((e=>"privy"!==e.walletClientType)),x=f.map((e=>e.walletClientType)),v=[],w={...o.funding};w.usingDefaultFundingMethod&&(w.usingDefaultFundingMethod=!1);let C=({address:e,walletChainType:t,walletClientType:n})=>{i({...o,funding:{...w,connectedWalletAddress:e,onContinueWithExternalWallet:()=>s(j({destChainType:h?"solana":"ethereum",sourceChainType:t}))},solanaFundingData:o?.solanaFundingData?{...o.solanaFundingData,sourceWalletData:{address:e,walletClientType:n}}:void 0}),s(Cp)};"solana-only"!==t&&v.push(...m.map(((t,n)=>/*#__PURE__*/e.jsx(jp,{onClick:()=>C({address:t.address,walletChainType:"ethereum",walletClientType:t.walletClientType}),icon:t.meta.icon,name:t.meta.name,chainType:t.type},n)))),"ethereum-only"!==t&&v.push(...f.map(((t,n)=>/*#__PURE__*/e.jsx(jp,{onClick:()=>C({address:t.address,walletChainType:"solana",walletClientType:t.walletClientType}),icon:t.meta.icon,name:t.meta.name,chainType:t.type},n)))),v.push(...zu({walletList:l.appearance.walletList.filter((e=>!m.some((t=>t.walletClientType===e))&&!f.some((t=>t.walletClientType===e)))),walletChainType:t,connectors:a,connectOnly:!0,ignore:[...l.appearance.walletList,...y,...x],walletConnectEnabled:l.externalWallets.walletConnect.enabled}));let b=/*#__PURE__*/e.jsx(wu,{text:"More wallets",onClick:()=>p("overflow")}),j=({sourceChainType:e,destChainType:t})=>"ethereum"===e&&"solana"===t?fp:"ethereum"===e&&"ethereum"===t?xp:"solana"===e&&"ethereum"===t?wp:w.externalSolanaFundingScreen;return n.useEffect((()=>{i({...o,externalConnectWallet:{onCompleteNavigateTo:({address:e,walletClientType:t,walletChainType:n})=>(i({...o,funding:{...w,connectedWalletAddress:e,onContinueWithExternalWallet:()=>{s(j({destChainType:h?"solana":"ethereum",sourceChainType:n??"ethereum"}))}},solanaFundingData:o?.solanaFundingData?{...o.solanaFundingData,sourceWalletData:{address:e||"",walletClientType:t||""}}:void 0}),Cp)}})}),[]),"overflow"===u?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{backFn:()=>p("default")},"header"),/*#__PURE__*/e.jsxs(or,{children:[/*#__PURE__*/e.jsx(bc,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),v]}),/*#__PURE__*/e.jsx(xr,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ui,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),/*#__PURE__*/e.jsxs(or,{children:[v.length>4?v.slice(0,3):v,v.length>4&&b]}),/*#__PURE__*/e.jsx(xr,{})]})}};let jp=({onClick:t,icon:n,name:r,chainType:a})=>/*#__PURE__*/e.jsxs(dr,{onClick:t,children:[/*#__PURE__*/e.jsx(ip,{style:{width:20},children:/*#__PURE__*/e.jsx("img",{src:n})}),r,/*#__PURE__*/e.jsx(xu,{color:"gray",style:{marginLeft:"auto"},children:"Connected"}),"solana"===a&&/*#__PURE__*/e.jsx(xu,{color:"gray",children:"Solana"})]});const kp={component:()=>{let{data:t,setModalData:a,navigate:i,navigateBack:o}=Xn(),{closePrivyModal:s,createAnalyticsEvent:l,client:c}=r.usePrivyInternal(),[d,u]=n.useState("pending-in-flow"),p=n.useRef(0),h={...t?.funding,showAlternateFundingMethod:!0};h.usingDefaultFundingMethod&&(h.usingDefaultFundingMethod=!1);let{partnerUserId:g,popup:m}=t?.coinbaseOnrampStatus??{};return n.useEffect((()=>{if("pending-in-flow"===d||"pending-after-flow"===d){let e=setInterval((async()=>{if(g)try{let{status:e}=await c.getCoinbaseOnRampStatus({partnerUserId:g});if("success"===e)return void u("success");if("failure"===e)throw Error("There was an error completing Coinbase Onramp flow.");if(p.current>=3)return a({funding:h,solanaFundingData:t?.solanaFundingData}),void i(Vp);m?.closed&&(p.current=p.current+1,u("pending-after-flow"))}catch(e){console.error(e),u("error"),l({eventName:Wc,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),a({funding:{...h,errorMessage:"Something went wrong adding funds. Please try again or use another method."},solanaFundingData:t?.solanaFundingData}),i(Vp)}}),1500);return()=>clearInterval(e)}}),[g,m,d]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{title:"Fund account",backFn:()=>{a({funding:h,solanaFundingData:t?.solanaFundingData}),o()}},"header"),/*#__PURE__*/e.jsx(Tp,{status:d,onClickCta:s}),/*#__PURE__*/e.jsx(xr,{})]})}};let Tp=({status:t,onClickCta:r})=>{let{title:a,body:i,cta:o}=n.useMemo((()=>(e=>{switch(e){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Almost done. Retrieving transaction status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(t)),[t]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Ep,{children:[/*#__PURE__*/e.jsx(Ap,{isSucccess:"success"===t}),/*#__PURE__*/e.jsxs(Qa,{children:[/*#__PURE__*/e.jsx("h3",{children:a}),/*#__PURE__*/e.jsx(Sp,{children:i})]})]}),o&&/*#__PURE__*/e.jsx(Pr,{onClick:r,children:o})]})},Ap=({isSucccess:t})=>{if(!t){let t="var(--privy-color-foreground-4)";/*#__PURE__*/return e.jsxs("div",{style:{position:"relative"},children:[/*#__PURE__*/e.jsx(kr,{color:t,style:{position:"absolute"}}),/*#__PURE__*/e.jsx(Tr,{color:t}),/*#__PURE__*/e.jsx(Xt,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let n=(t=>t?Pe.default:()=>/*#__PURE__*/e.jsx(Ue.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),r=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(t);/*#__PURE__*/return e.jsx("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&/*#__PURE__*/e.jsx(n,{width:"4rem",height:"4rem",color:r})})},Sp=/*#__PURE__*/i.styled.p.withConfig({displayName:"StatusBody",componentId:"sc-8428a551-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),Ep=/*#__PURE__*/i.styled.div.withConfig({displayName:"ConnectContainer",componentId:"sc-8428a551-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);let Ip={[c.mainnet.id]:"ethereum",[c.base.id]:"base",[c.optimism.id]:"optimism",[c.polygon.id]:"polygon",[c.arbitrum.id]:"arbitrum",[c.avalanche.id]:"avacchain"};const Pp=(e,t,n,r,a,i)=>new Promise((async(o,s)=>{let l=Ri();if(!l)return void s(Error("Unable to initialize flow"));let u="ethereum"===t.chainType?function(e){let t=Ip[e];if(!t)throw new d.PrivyClientError(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(t.chain.id):"solana",p=t.isUSDC?"USDC":"ethereum"===t.chainType?c.toCoinbaseAssetId(t.chain.id,"native-currency"):"SOL",h=await e.initCoinbaseOnRamp({addresses:[{address:t.address,blockchains:[u]}],assets:[p]}),{url:g}=c.getCoinbaseOnRampUrl({appId:e.getAppId(),input:h,amount:t.amount,blockchain:u,asset:p,experience:i});l.location=g.toString();let m={...a?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(m.usingDefaultFundingMethod=!1),n({funding:m,solanaFundingData:a?.solanaFundingData,coinbaseOnrampStatus:{popup:l}}),r(kp),e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.chain}}),setTimeout((()=>{n({funding:m,solanaFundingData:a?.solanaFundingData,coinbaseOnrampStatus:{partnerUserId:h.partner_user_id,popup:l}})}),5e3),o()})),Np="moonpay";function _p(e){return parseFloat(e)}function Mp(e,t=!1){let[a,i]=n.useState(null),{createAnalyticsEvent:o}=r.usePrivyInternal(),{data:s,navigate:l,setModalData:c}=Xn(),d=s?.funding,u=n.useRef(0);return n.useEffect((()=>{let n=setInterval((async()=>{if(e)try{let[r]=await async function(e,t){return ae.ofetch(`https://api.moonpay.com/v1/transactions/ext/${e}`,{query:{apiKey:t?"pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI":"pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL"}})}(e,t),a="waitingAuthorization"===r.status&&"credit_debit_card"===r.paymentMethod?"pending":r.status;if(["failed","completed","awaitingAuthorization"].includes(a)&&(o({eventName:Wc,payload:{status:a,provider:Np,paymentMethod:r.paymentMethod,cardPaymentType:r.cardPaymentType,currency:r.currency?.code,baseCurrencyAmount:r.baseCurrencyAmount,quoteCurrencyAmount:r.quoteCurrencyAmount,feeAmount:r.feeAmount,extraFeeAmount:r.extraFeeAmount,networkFeeAmount:r.networkFeeAmount,isSandbox:t}}),clearInterval(n)),"failed"===a||"serviceFailure"===a)return c({funding:{...d,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:s?.solanaFundingData}),void l(Vp);i(a)}catch(e){404!==e.response?.status&&(u.current+=1),u.current>=3&&(o({eventName:Wc,payload:{status:"serviceFailure",provider:Np}}),clearInterval(n),c({funding:{...d,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:s?.solanaFundingData}),l(Vp))}}),3e3);return()=>clearInterval(n)}),[e,u]),a}const Fp=({size:t=61,...n})=>/*#__PURE__*/e.jsx("svg",{width:t,height:t,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:/*#__PURE__*/e.jsxs("g",{id:"moonpay_symbol_wht 2",children:[/*#__PURE__*/e.jsx("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),/*#__PURE__*/e.jsx("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});const Lp={component:()=>{let{data:t,setModalData:n,navigateBack:a}=Xn(),i=qn(),{closePrivyModal:o}=r.usePrivyInternal(),{externalTransactionId:s}=t?.moonpayStatus,l=Mp(s||null,i.fundingMethodConfig.moonpay.useSandbox??!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{title:"Fund account",backFn:()=>{let e={...t?.funding,showAlternateFundingMethod:!0};e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),n({funding:e,solanaFundingData:t?.solanaFundingData}),a()}}),/*#__PURE__*/e.jsx(Wp,{status:l,onClickCta:o}),/*#__PURE__*/e.jsx(xr,{})]})}};let Wp=({status:t,onClickCta:r})=>{let{title:a,body:i,cta:o}=n.useMemo((()=>(e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}})(t)),[t]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Op,{children:[/*#__PURE__*/e.jsx(Dp,{status:t}),/*#__PURE__*/e.jsxs(Qa,{children:[/*#__PURE__*/e.jsx("h3",{children:a}),/*#__PURE__*/e.jsx(Rp,{children:i})]})]}),o&&/*#__PURE__*/e.jsx(Pr,{onClick:r,children:o})]})},Dp=({status:t})=>{if(!t||"pending"===t){let t="var(--privy-color-foreground-4)";/*#__PURE__*/return e.jsxs("div",{style:{position:"relative"},children:[/*#__PURE__*/e.jsx(kr,{color:t,style:{position:"absolute"}}),/*#__PURE__*/e.jsx(Tr,{color:t}),/*#__PURE__*/e.jsx(Fp,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let n=(t=>{switch(t){case"completed":return Pe.default;case"waitingAuthorization":return()=>/*#__PURE__*/e.jsx(Ue.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),r=(e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)")(t);/*#__PURE__*/return e.jsx("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&/*#__PURE__*/e.jsx(n,{width:"4rem",height:"4rem",color:r})})},Rp=/*#__PURE__*/i.styled.p.withConfig({displayName:"StatusBody",componentId:"sc-727a5a8d-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),Op=/*#__PURE__*/i.styled.div.withConfig({displayName:"ConnectContainer",componentId:"sc-727a5a8d-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);const Bp=async(e,t,n,r,a,i,o,s)=>{let l=Ri();if(!l)throw Error("Unable to initialize flow");let d="ethereum"===t.chainType?c.chainToMoonpayCurrency(t.chain.id,r):t.isUSDC?"USDC_SOL":"SOL",{signedUrl:u,externalTransactionId:p}=await e.signMoonpayOnRampUrl({address:t.address,useSandbox:n.fundingMethodConfig.moonpay.useSandbox??!1,config:{uiConfig:{accentColor:n.appearance.palette.accent,theme:n.appearance.palette.colorScheme},paymentMethod:s,currencyCode:d,quoteCurrencyAmount:_p(t.amount)}});e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"moonpay",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.chain}}),l.location=u;let h={...o?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(h.usingDefaultFundingMethod=!1),a({moonpayStatus:{},funding:h,solanaFundingData:o?.solanaFundingData}),i(Lp),setTimeout((()=>{a({moonpayStatus:{externalTransactionId:p},funding:h,solanaFundingData:o?.solanaFundingData})}),8e3)};let Up=async e=>"undefined"!=typeof window&&"PaymentRequest"in window&&await new window.PaymentRequest([{supportedMethods:e}],{id:"0",total:{label:"Item",amount:{currency:"USD",value:"1.00"}}}).canMakePayment();const zp=()=>Up("https://apple.com/apple-pay"),Hp=()=>Up("https://google.com/pay"),Vp={component:()=>{let{wallets:t}=Ni(),{connectors:a}=r.usePrivyInternal(),i=a.filter(Sn).flatMap((e=>e.wallets)),{navigate:o,data:s,setModalData:l}=Xn(),{client:d}=r.usePrivyInternal(),u=qn(),p=s?.funding,h=fu(zp),g=fu(Hp),m="solana"===p.chainType,y=m?void 0:p,f=n.useMemo((()=>((e,t,n,r,a,i)=>{let o,s,l="solana"===n.chainType,d=l?void 0:n,u=n.isUSDC?"USDC":d?.erc20Address?void 0:"native-currency",p=!!l||u&&c.isSupportedChainIdForMoonpay(Number(n.chain.id),u),h=!!l||u&&c.isSupportedChainIdForCoinbaseOnramp(Number(n.chain.id),u),g=[];for(let o of(n.preferredCardProvider&&n.supportedOptions.sort((e=>e.provider===n.preferredCardProvider?-1:1)),n.supportedOptions))"card"===o.method&&"coinbase"===o.provider&&h&&g.push((()=>Pp(t,n,r,a,i,"buy"))),"card"===o.method&&"moonpay"===o.provider&&p&&u&&g.push((()=>Bp(t,n,e,u,r,a,i,"credit_debit_card")));for(let e of n.supportedOptions)"exchange"===e.method&&"coinbase"===e.provider&&h&&(o=()=>Pp(t,n,r,a,i,"buy"));for(let e of i?.funding?.supportedOptions??[])"wallets"===e.method&&(s=()=>a(bp));return{onFundWithCard:g,onFundWithExchange:o,onFundWithWallet:s}})(u,d,p,l,o,s)),[u,d,p,s,l,o]),x=m?i.find((({address:e})=>e===p.address)):t.find((({address:e})=>V.getAddress(e)===V.getAddress(p.address))),v=Nn(x?.walletClientType||"unknown"),w=v?.name||"wallet",C=x&&"privy"!==x.walletClientType?w:u.name,b=n.useMemo((()=>p.uiConfig?.landing?.title?p.uiConfig?.landing?.title:`Add funds to your ${C?.toLowerCase().endsWith("wallet")?C:C+" wallet"}`),[p.uiConfig?.landing?.title,C]);n.useEffect((()=>{if(p?.defaultFundingMethod&&p.usingDefaultFundingMethod)switch(l({funding:{...p,usingDefaultFundingMethod:!1},solanaFundingData:s?.solanaFundingData}),p?.defaultFundingMethod){case"card":f.onFundWithCard[0]&&f.onFundWithCard[0]();break;case"exchange":f.onFundWithExchange&&f.onFundWithExchange();break;case"wallet":f.onFundWithWallet&&f.onFundWithWallet();break;case"manual":o(zc)}}),[]),n.useEffect((()=>{y?.erc20Address&&!y.erc20ContractInfo&&$c({address:y.erc20Address,chain:y.chain,rpcConfig:u.rpcConfig,privyAppId:u.id}).then((e=>{l({...s,funding:{...y,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}})})).catch(console.error)}),[y?.erc20Address,y?.chain]);let j=!(!y?.erc20Address||y?.erc20ContractInfo);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx("h3",{children:b}),/*#__PURE__*/e.jsxs(ap,{children:[p.errorMessage&&/*#__PURE__*/e.jsx(gd,{theme:u.appearance.palette.colorScheme,children:p.errorMessage}),f.onFundWithCard?.[0]&&/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:f.onFundWithCard[0],children:[/*#__PURE__*/e.jsx(ip,{children:/*#__PURE__*/e.jsx(Oe.default,{style:{width:24}})}),"Pay with card",h?/*#__PURE__*/e.jsx(mu,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):g?/*#__PURE__*/e.jsx(yu,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):null]}),f.onFundWithExchange&&/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:f.onFundWithExchange,children:[/*#__PURE__*/e.jsx(ip,{children:/*#__PURE__*/e.jsx(Ue.default,{style:{width:24}})}),"Transfer from an exchange"]}),f.onFundWithWallet&&/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:f.onFundWithWallet,children:[/*#__PURE__*/e.jsx(ip,{children:/*#__PURE__*/e.jsx(Tl,{style:{width:24}})}),"Transfer from wallet"]}),/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:()=>o(zc),children:[/*#__PURE__*/e.jsx(ip,{children:/*#__PURE__*/e.jsx(Be.default,{style:{width:24}})}),"Receive funds"]}),p?.showAlternateFundingMethod&&f.onFundWithCard?.[1]&&/*#__PURE__*/e.jsx(vc,{theme:u.appearance.palette.colorScheme,children:/*#__PURE__*/e.jsxs(pp,{children:["Having trouble or facing location restrictions?"," ",/*#__PURE__*/e.jsx(hp,{onClick:f.onFundWithCard[1],children:"Try a different provider."})]})})]}),/*#__PURE__*/e.jsx(xr,{})]})}},$p={component:()=>{let{closePrivyModal:t}=r.usePrivyInternal(),{data:a,navigate:i}=Xn(),o=qn(),s=rr(),l=a?.externalConnectWallet?.description,c=n.useRef(a?.externalConnectWallet?.walletList??o.appearance.walletList),u=n.useRef(a?.externalConnectWallet?.walletChainType??o.appearance.walletChainType);/*#__PURE__*/return e.jsx(Hl,{walletList:c.current,walletChainType:u.current,preSelectedWalletId:a?.externalConnectWallet?.preSelectedWalletId,onBack:a?.funding?()=>i(Vp):void 0,onClose:()=>{s("connectWallet","onError",d.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR),t()},onConnect:({connector:e,wallet:n})=>{s("connectWallet","onSuccess",{wallet:n});let r=a?.externalConnectWallet?.onCompleteNavigateTo;r?i(r({address:n.address,walletClientType:e?.walletClientType,walletChainType:e?.chainType})):t()},onConnectError:e=>{e instanceof d.PrivyError?(console.warn(e.cause?e.cause:e.message),s("connectWallet","onError",e.privyErrorCode||d.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),s("connectWallet","onError",d.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR))},customDescription:l,app:o})},isUnauthenticatedScreem:!0},qp=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#855DCD"}),/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_1715_1960)",children:[/*#__PURE__*/e.jsx("path",{d:"M4.5 4H28.5V28H4.5V4Z",fill:"#855DCD"}),/*#__PURE__*/e.jsx("path",{d:"M11.1072 8.42105H21.6983V23.5789H20.1437V16.6357H20.1284C19.9566 14.7167 18.3542 13.2129 16.4028 13.2129C14.4514 13.2129 12.849 14.7167 12.6771 16.6357H12.6619V23.5789H11.1072V8.42105Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M8.28943 10.5725L8.92101 12.7239H9.45542V21.4275C9.1871 21.4275 8.96959 21.6464 8.96959 21.9165V22.5032H8.87242C8.60411 22.5032 8.38659 22.7221 8.38659 22.9922V23.5789H13.8279V22.9922C13.8279 22.7221 13.6104 22.5032 13.3421 22.5032H13.2449V21.9165C13.2449 21.6464 13.0274 21.4275 12.7591 21.4275H12.1761V10.5725H8.28943Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M20.2408 21.4275C19.9725 21.4275 19.755 21.6464 19.755 21.9165V22.5032H19.6579C19.3895 22.5032 19.172 22.7221 19.172 22.9922V23.5789H24.6133V22.9922C24.6133 22.7221 24.3958 22.5032 24.1275 22.5032H24.0303V21.9165C24.0303 21.6464 23.8128 21.4275 23.5445 21.4275V12.7239H24.0789L24.7105 10.5725H20.8238V21.4275H20.2408Z",fill:"white"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1715_1960",children:/*#__PURE__*/e.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(4.5 4)"})})})]}),Gp=t=>{let[r,a]=n.useState(!1);/*#__PURE__*/return e.jsx(Yp,{color:t.color,href:t.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{a(!0),setTimeout((()=>a(!1)),1500)},justOpened:r,children:t.text})};let Yp=/*#__PURE__*/i.styled.a.withConfig({displayName:"StyledOpenLinkButton",componentId:"sc-4e695c83-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.justOpened?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.justOpened?"medium":"normal"),(e=>e.justOpened?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)")),Zp=/*#__PURE__*/i.styled.div.withConfig({displayName:"Container",componentId:"sc-913deead-0"})(["width:100%;"]),Kp=/*#__PURE__*/i.styled.div.withConfig({displayName:"InputContainer",componentId:"sc-913deead-1"})(["display:flex;align-items:center;justify-content:space-between;gap:0.75rem;padding:0.75rem;height:56px;background:",";border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);&:hover{border-color:",";}"],(e=>e.$disabled?"var(--privy-color-background-2)":"var(--privy-color-background)"),(e=>e.$disabled?"var(--privy-color-foreground-4)":"var(--privy-color-foreground-3)")),Qp=/*#__PURE__*/i.styled.div.withConfig({displayName:"TextContainer",componentId:"sc-913deead-2"})(["flex:1;min-width:0;display:flex;align-items:center;"]),Xp=/*#__PURE__*/i.styled.span.withConfig({displayName:"Text",componentId:"sc-913deead-3"})(["display:block;font-size:16px;line-height:24px;color:",";overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;word-break:break-all;@media (min-width:441px){font-size:14px;line-height:20px;}"],(e=>e.$disabled?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)")),Jp=/*#__PURE__*/i.styled(Xp).withConfig({displayName:"PlaceholderText",componentId:"sc-913deead-4"})(["color:var(--privy-color-foreground-3);font-style:italic;"]),eh=/*#__PURE__*/i.styled(kc).withConfig({displayName:"TitleLabel",componentId:"sc-913deead-5"})(["margin-bottom:0.5rem;"]),th=/*#__PURE__*/i.styled(Fr).withConfig({displayName:"CopyButton",componentId:"sc-913deead-6"})(["&&{gap:0.375rem;font-size:14px;flex-shrink:0;}"]);const nh=({value:r,title:a,placeholder:i,className:o,showCopyButton:s=!0,truncate:l,maxLength:c=40,disabled:d=!1})=>{let[u,p]=n.useState(!1),h=l&&r?((e,t,n)=>{if((e=e.startsWith("https://")?e.slice(8):e).length<=n)return e;if("middle"===t){let t=Math.ceil(n/2)-2,r=Math.floor(n/2)-1;return`${e.slice(0,t)}...${e.slice(-r)}`}return`${e.slice(0,n-3)}...`})(r,l,c):r;return n.useEffect((()=>{if(u){let e=setTimeout((()=>p(!1)),3e3);return()=>clearTimeout(e)}}),[u]),/*#__PURE__*/e.jsxs(Zp,{className:o,children:[a&&/*#__PURE__*/e.jsx(eh,{children:a}),/*#__PURE__*/e.jsxs(Kp,{$disabled:d,children:[/*#__PURE__*/e.jsx(Qp,{children:r?/*#__PURE__*/e.jsx(Xp,{$disabled:d,title:r,children:h}):/*#__PURE__*/e.jsx(Jp,{$disabled:d,children:i||"No value"})}),s&&r&&/*#__PURE__*/e.jsx(th,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(r).then((()=>p(!0))).catch(console.error)},size:"sm",children:u?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(t.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(t.Copy,{size:14})]})})]})]})},rh=({connectUri:t,loading:n,success:r,errorMessage:a,onBack:i,onClose:o,onOpenFarcaster:s})=>v.isMobile||n?v.isIOS?/*#__PURE__*/e.jsx(ba,{title:a?a.message:"Sign in with Farcaster",subtitle:a?a.detail:"To sign in with Farcaster, please open the Farcaster app.",icon:qp,iconVariant:"loading",iconLoadingStatus:{success:r,fail:!!a},primaryCta:t&&s?{label:"Open Farcaster app",onClick:s}:void 0,onBack:i,onClose:o,watermark:!0}):/*#__PURE__*/e.jsx(ba,{title:a?a.message:"Signing in with Farcaster",subtitle:a?a.detail:"This should only take a moment",icon:qp,iconVariant:"loading",iconLoadingStatus:{success:r,fail:!!a},onBack:i,onClose:o,watermark:!0,children:t&&v.isMobile&&/*#__PURE__*/e.jsx(ih,{children:/*#__PURE__*/e.jsx(Gp,{text:"Take me to Farcaster",url:t,color:"#8a63d2"})})}):
25
+ /*#__PURE__*/e.jsx(ba,{title:"Sign in with Farcaster",subtitle:"Scan with your phone's camera to continue.",onBack:i,onClose:o,watermark:!0,children:/*#__PURE__*/e.jsxs(oh,{children:[/*#__PURE__*/e.jsx(sh,{children:t?/*#__PURE__*/e.jsx(vl,{url:t,size:275,squareLogoElement:qp}):/*#__PURE__*/e.jsx(dh,{children:/*#__PURE__*/e.jsx(kr,{})})}),/*#__PURE__*/e.jsxs(lh,{children:[/*#__PURE__*/e.jsx(ch,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),t&&/*#__PURE__*/e.jsx(nh,{value:t,truncate:"end",maxLength:30,showCopyButton:!0,disabled:!0})]})]})}),ah={component:()=>{let{authenticated:t,logout:i,ready:o,user:s}=a.usePrivyContext(),{lastScreen:l,navigate:c,navigateBack:u,setModalData:p}=Xn(),h=qn(),{getAuthFlow:g,loginWithFarcaster:m,closePrivyModal:y,createAnalyticsEvent:f}=r.usePrivyInternal(),[x,v]=n.useState(void 0),[w,C]=n.useState(!1),[b,j]=n.useState(!1),k=n.useRef([]),T=g(),A=T?.meta.connectUri;return n.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{let n=await T.pollForReady.execute(),r=Date.now()-e;if(n){clearInterval(t),C(!0);try{await m(),j(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===d.PrivyErrorCode.ALLOWLIST_REJECTED)return void c(rc);if(e?.privyErrorCode===d.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new d.PrivyUserLimitReachedError(e).toString()),void c(hc);if(e?.privyErrorCode===d.PrivyErrorCode.USER_DOES_NOT_EXIST)return void c(vs);if(e?.privyErrorCode===d.PrivyErrorCode.LINKED_TO_ANOTHER_USER)t.detail=e.message??"This account has already been linked to another user.";else{if(e?.privyErrorCode===d.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return p({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:"farcaster",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,farcasterEmbeddedAddress:e.data?.data?.otherUser?.farcasterEmbeddedAddress}}),void c(Qs);e?.privyErrorCode===d.PrivyErrorCode.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===d.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}v(t)}}else r>12e4&&(clearInterval(t),v({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),k.current.forEach((e=>clearTimeout(e)))}}),[]),n.useEffect((()=>{if(o&&t&&b&&s){if(h?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{c(nl)}),at);return()=>clearTimeout(e)}b&&(fs(s,h.embeddedWallets)?k.current.push(setTimeout((()=>{p({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),i()},callAuthOnSuccessOnClose:!0}}),c(tl)}),at)):k.current.push(setTimeout((()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0})),at)))}}),[b,o,t,s]),/*#__PURE__*/e.jsx(rh,{connectUri:A,loading:w,success:b,errorMessage:x,onBack:l?u:void 0,onClose:y,onOpenFarcaster:()=>{A&&(window.location.href=A)}})}};let ih=/*#__PURE__*/i.styled.div.withConfig({displayName:"MobileLinkContainer",componentId:"sc-6e4b180b-0"})(["margin-top:24px;"]),oh=/*#__PURE__*/i.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-6e4b180b-1"})(["display:flex;flex-direction:column;align-items:center;gap:24px;"]),sh=/*#__PURE__*/i.styled.div.withConfig({displayName:"QrContainer",componentId:"sc-6e4b180b-2"})(["display:flex;align-items:center;justify-content:center;min-height:275px;"]),lh=/*#__PURE__*/i.styled.div.withConfig({displayName:"InstructionsContainer",componentId:"sc-6e4b180b-3"})(["display:flex;flex-direction:column;align-items:center;gap:16px;"]),ch=/*#__PURE__*/i.styled.div.withConfig({displayName:"InstructionText",componentId:"sc-6e4b180b-4"})(["font-size:0.875rem;text-align:center;color:var(--privy-color-foreground-2);"]),dh=/*#__PURE__*/i.styled.div.withConfig({displayName:"LoaderWrapper",componentId:"sc-6e4b180b-5"})(["position:relative;width:82px;height:82px;"]);const uh=()=>{let[t,a]=n.useState(!1),{currentScreen:i,navigate:o,setModalData:s,data:l}=Xn(),{enabled:c,token:d}=qt(),{initLoginWithFarcaster:u}=r.usePrivyInternal(),{accountType:p}=is();/*#__PURE__*/return e.jsxs(dr,{onClick:async()=>{a(!0);try{c&&!d?(s({captchaModalData:{callback:e=>u(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:ah,onErrorNavigateTo:Rs}}),o(ic)):(await u(d,l?.login?.disableSignup),o(ah))}catch(e){s({errorModalData:{error:e,previousScreen:i||cg}}),o(Rs)}finally{a(!1)}},disabled:!1,children:[/*#__PURE__*/e.jsx(qp,{width:32,height:32})," Farcaster",t&&/*#__PURE__*/e.jsx(Ar,{}),"farcaster"===p&&/*#__PURE__*/e.jsx(ph,{color:"gray",children:"Recent"})]})};let ph=/*#__PURE__*/i.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-c6317ff9-0"})(["margin-left:auto;"]);const hh=({status:n,passkeySignupFlow:r=!1,error:a,onRetry:i})=>/*#__PURE__*/e.jsx(ba,{title:(()=>{switch(n){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})(),subtitle:/*#__PURE__*/e.jsx(mh,{children:(()=>{switch(n){case"loading":return r?"Please follow prompts to register your passkey.":"Please follow prompts to verify your passkey.\nYou will have to sign up with another method first to register a passkey for your account.";case"success":return"You've successfully logged in with your passkey.";case"error":if(a instanceof d.PrivyError){if(a.privyErrorCode===d.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(a.privyErrorCode===d.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()}),icon:t.FingerprintIcon,iconVariant:"loading",iconLoadingStatus:{success:"success"===n,fail:"error"===n},primaryCta:"error"===n&&i?{label:"Retry",onClick:i}:"success"===n?{label:"Continue",disabled:!0}:void 0,watermark:!0}),gh={component:()=>{let{data:t,setModalData:i,navigate:o}=Xn(),s=qn(),{loginWithPasskey:l,signupWithPasskey:c,closePrivyModal:d,createAnalyticsEvent:u}=r.usePrivyInternal(),{user:p,logout:h}=a.usePrivyContext(),{passkeySignupFlow:g}=t?.passkeyAuthModalData??{},[m,y]=n.useState("loading"),[f,x]=n.useState(null),v=n.useRef([]),w=e=>{v.current=[e,...v.current]};n.useEffect((()=>()=>{v.current.forEach((e=>clearTimeout(e))),v.current=[]}),[]);let C=async()=>{y("loading");try{g?await c():await l(),y("success")}catch(e){x(e),y("error")}};return n.useEffect((()=>{if("success"===m&&p){if(s?.legal.requireUsersAcceptTerms&&!p.hasAcceptedTerms)return void w(setTimeout((()=>{o(nl)}),900));if(!fs(p,s?.embeddedWallets))return void w(setTimeout((()=>{d({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),at));w(setTimeout((()=>{i({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"PasskeyStatusScreen"}}),h()},callAuthOnSuccessOnClose:!0}}),o(tl)}),900))}}),[p,m]),n.useEffect((()=>{C()}),[]),/*#__PURE__*/e.jsx(hh,{status:m,passkeySignupFlow:g,error:f,onRetry:C})}};let mh=/*#__PURE__*/i.styled.span.withConfig({displayName:"SubtitleText",componentId:"sc-7ff4a13e-0"})(["white-space:pre-wrap;"]);const yh=({title:n="Log in or create a new account?",subtitle:r="Create a new account with a passkey or use a passkey to log in to an existing account.",onSignup:a,onLogin:i})=>/*#__PURE__*/e.jsx(ba,{title:n,subtitle:r,icon:t.FingerprintIcon,primaryCta:{label:"Create new account",onClick:a},secondaryCta:{label:"Log in with a passkey",onClick:i},watermark:!0}),fh={component:()=>{let{enabled:t,token:n}=qt(),{navigate:a,setModalData:i}=Xn(),{initSignupWithPasskey:o,initLoginWithPasskey:s}=r.usePrivyInternal();/*#__PURE__*/return e.jsx(yh,{onSignup:async()=>{t&&!n?(i({passkeyAuthModalData:{passkeySignupFlow:!0},captchaModalData:{callback:e=>o({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:gh,onErrorNavigateTo:Rs}}),a(ic)):(await o({withPrivyUi:!0}),i({passkeyAuthModalData:{passkeySignupFlow:!0}}),a(gh))},onLogin:async()=>{t&&!n?(i({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>s({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:gh,onErrorNavigateTo:Rs}}),a(ic)):(await s({withPrivyUi:!0}),i({passkeyAuthModalData:{passkeySignupFlow:!1}}),a(gh))}})}},xh=()=>{let{enabled:t,token:a}=qt(),{navigate:i,setModalData:o,data:s}=Xn(),l=qn(),{initLoginWithPasskey:c}=r.usePrivyInternal(),d=()=>{l.loginConfig.passkeysForSignupEnabled?i(fh):(async()=>{t&&!a?(o({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>c({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:gh,onErrorNavigateTo:Rs}}),i(ic)):(await c({withPrivyUi:!0}),o({passkeyAuthModalData:{passkeySignupFlow:!1}}),i(gh))})()};return 0===n.useMemo((()=>{let e=s?.login?.loginMethods;return e?e.filter((e=>"passkey"!==e)).length:Object.entries(l.loginMethods).filter((([e,t])=>t)).filter((([e])=>"passkey"!==e)).length}),[l.loginMethods,s?.login])?/*#__PURE__*/e.jsxs(dr,{onClick:d,children:[/*#__PURE__*/e.jsx(Ge.default,{})," Continue with passkey"]}):/*#__PURE__*/e.jsx(ps,{as:"button",onClick:d,size:"sm",variant:"navigation",style:{width:"100%",justifyContent:"center"},children:"I have a passkey"})},vh=({value:t,onChange:n})=>/*#__PURE__*/e.jsx("select",{value:t,onChange:n,children:c.countryCodesAndNumbers.map((t=>/*#__PURE__*/e.jsxs("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),wh=/*#__PURE__*/n.forwardRef(((t,r)=>{let a=qn(),[i,o]=n.useState(!1),{accountType:s}=is(),[l,d]=n.useState(""),[u,p]=n.useState(a?.intl.defaultCountry??"US"),h=c.validatePhoneNumber(l,u),g=c.phoneNumberTypingFormatter(u),m=c.getPlaceholderPhoneNumber(u),y=c.getCountryCallingCode(u),f=!h,[x,v]=n.useState(!1),w=y.length,C=e=>{let n=e.target.value;p(n),d(""),t.onChange&&t.onChange({rawPhoneNumber:l,qualifiedPhoneNumber:c.formatPhoneNumber(l,n),countryCode:n,isValid:c.validatePhoneNumber(l,u)})},b=(e,n)=>{try{let r=e.replace(/\D/g,"")===l.replace(/\D/g,"")?e:g.input(e);d(r),t.onChange&&t.onChange({rawPhoneNumber:r,qualifiedPhoneNumber:c.formatPhoneNumber(e,n),countryCode:n,isValid:c.validatePhoneNumber(e,n)})}catch(e){console.error("Error processing phone number:",e)}},j=()=>{v(!0);let e=c.formatPhoneNumber(l,u);t.onSubmit({rawPhoneNumber:l,qualifiedPhoneNumber:e,countryCode:u,isValid:c.validatePhoneNumber(l,u)}).finally((()=>v(!1)))};return n.useEffect((()=>{if(t.defaultValue){let e=c.getPhoneCountryCodeAndNumber(t.defaultValue);g.reset(),C({target:{value:e.countryCode}}),b(e.phone,e.countryCode)}}),[t.defaultValue]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ch,{children:/*#__PURE__*/e.jsxs(bh,{$callingCodeLength:w,$stacked:t.stacked,children:[/*#__PURE__*/e.jsx(vh,{value:u,onChange:C}),/*#__PURE__*/e.jsx("input",{ref:r,id:"phone-number-input",className:"login-method-button",type:"tel",placeholder:m,onFocus:()=>o(!0),onChange:e=>{b(e.target.value,u)},onKeyUp:e=>{"Enter"===e.key&&j()},value:l,autoComplete:"tel"}),"phone"!==s||i||t.hideRecent?t.stacked||t.noIncludeSubmitButton?/*#__PURE__*/e.jsx("span",{}):/*#__PURE__*/e.jsx(Rr,{isSubmitting:x,onClick:j,disabled:f,children:"Submit"}):/*#__PURE__*/e.jsx(xu,{color:"gray",children:"Recent"})]})}),t.stacked&&!t.noIncludeSubmitButton?/*#__PURE__*/e.jsx(Pr,{loading:x,loadingText:null,onClick:j,disabled:f,children:"Submit"}):null]})}));let Ch=/*#__PURE__*/i.styled.div.withConfig({displayName:"InputContainer",componentId:"sc-545daacd-0"})(["width:100%;"]),bh=/*#__PURE__*/i.styled.label.withConfig({displayName:"PhoneNumberInput",componentId:"sc-545daacd-1"})(["--country-code-dropdown-width:calc(54px + calc(12 * ","px));--phone-input-extra-padding-left:calc(12px + calc(3 * ","px));display:block;position:relative;width:100%;@media (min-width:441px){--country-code-dropdown-width:calc(52px + calc(10 * ","px));}&& > select{font-size:16px;height:24px;position:absolute;margin:13px calc(var(--country-code-dropdown-width) / 4);line-height:24px;width:var(--country-code-dropdown-width);background-color:var(--privy-color-background);background-size:auto;background-position-x:right;cursor:pointer;@media (min-width:441px){font-size:14px;width:var(--country-code-dropdown-width);}:focus{outline:none;box-shadow:none;}}&& > input{font-size:16px;line-height:24px;color:var(--privy-color-foreground);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;width:calc(100% - var(--country-code-dropdown-width));padding:12px 88px 12px calc(var(--country-code-dropdown-width) + var(--phone-input-extra-padding-left));padding-right:",";flex-grow:1;background:var(--privy-color-background);border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);width:100%;:focus{outline:none;border-color:var(--privy-color-accent);}:autofill,:-webkit-autofill{background:var(--privy-color-background);}@media (min-width:441px){font-size:14px;padding-right:78px;}}&& > :last-child{right:16px;position:absolute;top:50%;transform:translate(0,-50%);}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;border-color:var(--privy-color-accent);}}&& > input::placeholder{color:var(--privy-color-foreground-3);}"],(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$stacked?"16px":"88px"));const jh=({isEditable:i,setIsEditable:o,defaultValue:s})=>{let l=n.useRef(null),{authenticated:c}=a.usePrivyContext(),{navigate:d,setModalData:u,currentScreen:p,data:h}=Xn(),{initLoginWithSms:g}=r.usePrivyInternal(),{enabled:m,token:y}=qt(),{whatsAppEnabled:f}=qn();/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(pr,{$if:!i,children:/*#__PURE__*/e.jsx(wh,{ref:l,onSubmit:async function({qualifiedPhoneNumber:e}){if(!m||y||c)try{await g({phoneNumber:e,captchaToken:y,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),d(Yh)}catch(e){u({errorModalData:{error:e,previousScreen:p||cg}}),d(Rs)}else u({captchaModalData:{callback:t=>g({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:Yh,onErrorNavigateTo:Rs}}),d(ic)},defaultValue:s})}),/*#__PURE__*/e.jsx(pr,{$if:i,children:/*#__PURE__*/e.jsxs(dr,{onClick:()=>{o(),setTimeout((()=>{l.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(t.Smartphone,{})}),"Continue with ",f?"WhatsApp":"SMS"]})})]})};let kh={apple:{logo:yt,displayName:"Apple"},discord:{logo:ft,displayName:"Discord"},github:{logo:xt,displayName:"GitHub"},google:{logo:vt,displayName:"Google"},linkedin:{logo:bt,displayName:"LinkedIn"},spotify:{logo:jt,displayName:"Spotify"},instagram:{logo:wt,displayName:"Instagram"},twitter:{logo:Tt,displayName:"Twitter"},tiktok:{logo:kt,displayName:"TikTok"},line:{logo:Ct,displayName:"LINE"}};const Th=({provider:t})=>{let{enabled:i,token:o}=qt(),{navigate:s,setModalData:l,data:c}=Xn(),[d,u]=n.useState(!1),p=qn(),{initLoginWithOAuth:h}=r.usePrivyInternal(),{accountType:g}=is(),m=n.useMemo((()=>g&&"guest"!==g&&"authorization_key"!==g&&"cross_app"!==g?es(g):null),[g]),{displayName:y,logo:f}=n.useMemo((()=>{if(a.isCustomOAuthProvider(t)){let n=p.customOAuthProviders.find((e=>e.provider===t)),r=n.provider_icon_url,a=n.provider_display_name;return{displayName:a,logo:({style:t})=>/*#__PURE__*/e.jsx("img",{alt:`${a} logo`,src:r,style:t})}}return kh[t]}),[t,p.customOAuthProviders]);/*#__PURE__*/return e.jsxs(dr,{onClick:()=>{u(!0),setTimeout((()=>{u(!1)}),2e3),i&&!o?(l({captchaModalData:{callback:e=>h(t,e,c?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Rs}}),s(ic)):h(t,void 0,c?.login?.disableSignup)},disabled:d,children:[/*#__PURE__*/e.jsx(ur,{$fullSize:!0,children:/*#__PURE__*/e.jsx(f,{style:{width:"32px",height:"32px"}})}),y,m?.loginMethod===t&&/*#__PURE__*/e.jsx(Ah,{color:"gray",children:"Recent"})]})};let Ah=/*#__PURE__*/i.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-ac19bb81-0"})(["margin-left:auto;"]);function Sh(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"512",height:"512",rx:"15%",fill:"#37aee2"}),/*#__PURE__*/e.jsx("path",{fill:"#c8daea",d:"M199 404c-11 0-10-4-13-14l-32-105 245-144"}),/*#__PURE__*/e.jsx("path",{fill:"#a9c9dd",d:"M199 404c7 0 11-4 16-8l45-43-56-34"}),/*#__PURE__*/e.jsx("path",{fill:"#f6fbfe",d:"M204 319l135 99c14 9 26 4 30-14l55-258c5-22-9-32-24-25L79 245c-21 8-21 21-4 26l83 26 190-121c9-5 17-3 11 4"})]})}const Eh=({success:t,errorMessage:n,onRetry:r})=>{let a=t?"Successfully connected with Telegram":n?n.message:"Verifying connection to Telegram";/*#__PURE__*/return e.jsx(ba,{title:a,subtitle:t?"You're good to go!":n?n.detail:"Just a few moments more",icon:Sh,iconVariant:"loading",iconLoadingStatus:{success:t,fail:!!n},secondaryCta:n?.retryable&&r?{label:"Retry",onClick:r}:void 0,watermark:!0})},Ih={component:()=>{let{authenticated:t,logout:i,ready:o,user:s}=a.usePrivyContext(),{setModalData:l,navigate:c,resetNavigation:u,data:p}=Xn(),h=qn(),{initLoginWithTelegram:g,loginWithTelegram:m,updateWallets:y,setReadyToTrue:f,closePrivyModal:x,createAnalyticsEvent:v,getAuthMeta:w}=r.usePrivyInternal(),[C,b]=n.useState(!1),[j,k]=n.useState(void 0),T=qt();async function A(){try{let e=await async function(){let e;if(!t){if(T.enabled&&"error"===T.status)throw new $t(T.error,null,d.PrivyErrorCode.CAPTCHA_FAILURE);return T.enabled&&"success"!==T.status&&(T.execute(),e=await T.waitForResult()),e}}();await m({captchaToken:e}),b(!0),f(!0)}catch(e){if(e?.privyErrorCode===d.PrivyErrorCode.ALLOWLIST_REJECTED)return k(void 0),u(),void c(rc);if(e?.privyErrorCode===d.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new d.PrivyUserLimitReachedError(e).toString()),k(void 0),u(),void c(hc);if(e?.privyErrorCode===d.PrivyErrorCode.USER_DOES_NOT_EXIST)return k(void 0),u(),void c(vs);if(e?.privyErrorCode===d.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return k(void 0),u(),l({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:w()?.telegramAuthResult,telegramWebAppData:w()?.telegramWebAppData,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void c(Qs);let{retryable:t,detail:n}=Gt(e);k({retryable:t,detail:n,message:"Authentication failed"})}}n.useEffect((()=>{A()}),[]),n.useEffect((()=>{if(!(o&&t&&C&&s))return;if(h?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{c(nl)}),at);return()=>clearTimeout(e)}if(fs(s,h.embeddedWallets)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),i()},callAuthOnSuccessOnClose:!0}}),c(tl)}),at);return()=>clearTimeout(e)}y();let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),at);return()=>clearTimeout(e)}),[o,t,C,s]);/*#__PURE__*/return e.jsx(Eh,{success:C,errorMessage:j,onRetry:j?.retryable?async()=>{try{k(void 0),p?.telegramAuthModalData?.seamlessAuth||await g(void 0,p?.login?.disableSignup),await A()}catch(e){let{retryable:t,detail:n}=Gt(e);k({retryable:t,detail:n,message:"Authentication failed"})}}:void 0})},isCaptchaRequired:!0},Ph=()=>{let{enabled:t,token:a}=qt(),{navigate:i,setModalData:o,data:s}=Xn(),[l,c]=n.useState(!1),{initLoginWithTelegram:d}=r.usePrivyInternal(),{accountType:u}=is();async function p(e){try{await d(e,s?.login?.disableSignup),o({telegramAuthModalData:{seamlessAuth:!1}}),i(Ih)}catch(e){console.error(e),c(!1)}}/*#__PURE__*/return e.jsxs(dr,{onClick:async function(){if(c(!0),t&&!a)return o({captchaModalData:{callback:p,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Rs}}),void i(ic);await p(a)},disabled:l,children:[/*#__PURE__*/e.jsx(Sh,{width:32,height:32}),"Telegram","telegram"===u&&/*#__PURE__*/e.jsx(Nh,{color:"gray",children:"Recent"})]})};let Nh=/*#__PURE__*/i.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-4b233cf1-0"})(["margin-left:auto;"]);const _h=({onClick:t,text:n,icon:r})=>/*#__PURE__*/e.jsxs(dr,{onClick:t,children:[/*#__PURE__*/e.jsx(ur,{children:r}),/*#__PURE__*/e.jsx(ar,{children:n})]}),Mh=({connectOnly:t})=>{let{closePrivyModal:i}=r.usePrivyInternal(),{data:o,setModalData:s,onUserCloseViaDialogOrKeybindRef:l,navigate:d}=Xn(),u=qn(),p=o?.login,h=u.appearance.walletList,g=p?.walletChainType??u.appearance.walletChainType,{accountType:m,walletClientType:y,chainType:f}=is(),{wallets:x}=Bl({walletList:h,walletChainType:g}),v=n.useMemo((()=>m&&"guest"!==m&&"authorization_key"!==m&&"cross_app"!==m?es(m):null),[m]),{email:w,sms:C,google:b,twitter:j,discord:k,github:T,spotify:A,instagram:S,tiktok:E,line:I,linkedin:P,apple:N,wallet:_,farcaster:M,telegram:F}=n.useMemo((()=>p?.loginMethods?c.toObjectKeys(p.loginMethods,!0):null),[p])??u.loginMethods,L=u.customOAuthProviders,{passkey:W}=u.loginMethods,D=[w&&"email",C&&"sms",b&&"google",j&&"twitter",k&&"discord",T&&"github",A&&"spotify",S&&"instagram",E&&"tiktok",I&&"line",P&&"linkedin",N&&"apple",M&&"farcaster",F&&"telegram",...L.map((e=>e.provider))].filter((e=>!!e)),R=D.length>0,O=n.useMemo((()=>_&&!R?"web3-first":_&&u?.appearance.loginGroupPriority||"web2-first"),[_,R,u?.appearance.loginGroupPriority]),B=u?.appearance.hideDirectWeb2Inputs,[U,z]=n.useState("default"),[H,V]=n.useState(Oh({mostRecentlyUsedAccountType:m,smsAvailable:C,emailAvailable:w,prefilledType:p?.prefill?.type}));n.useEffect((()=>{V(Oh({mostRecentlyUsedAccountType:m,smsAvailable:C,emailAvailable:w,prefilledType:p?.prefill?.type}))}),[w,C,m]);let $=()=>{i({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{z("default")}),150)};l.current=$;let q=[];y&&_?q.push(y):v?.loginMethod&&D.includes(v.loginMethod)&&q.push(v.loginMethod);let G=n=>{if("email"===n)/*#__PURE__*/return e.jsx(ig,{isEditable:"email"===H,setIsEditable:()=>{V("email")},defaultValue:"email"===p?.prefill?.type?p.prefill.value:void 0},n);if("sms"===n)/*#__PURE__*/return e.jsx(jh,{isEditable:"sms"===H,setIsEditable:()=>{V("sms")},defaultValue:"phone"===p?.prefill?.type?p.prefill.value:void 0},n);if("apple"===n)/*#__PURE__*/return e.jsx(Th,{provider:"apple"},n);if("discord"===n)/*#__PURE__*/return e.jsx(Th,{provider:"discord"},n);if("farcaster"===n)/*#__PURE__*/return e.jsx(uh,{},n);if("github"===n)/*#__PURE__*/return e.jsx(Th,{provider:"github"},n);if("google"===n)/*#__PURE__*/return e.jsx(Th,{provider:"google"},n);if("linkedin"===n)/*#__PURE__*/return e.jsx(Th,{provider:"linkedin"},n);if("tiktok"===n)/*#__PURE__*/return e.jsx(Th,{provider:"tiktok"},n);if("line"===n)/*#__PURE__*/return e.jsx(Th,{provider:"line"},n);if("spotify"===n)/*#__PURE__*/return e.jsx(Th,{provider:"spotify"},n);if("instagram"===n)/*#__PURE__*/return e.jsx(Th,{provider:"instagram"},n);if("twitter"===n)/*#__PURE__*/return e.jsx(Th,{provider:"twitter"},n);if("telegram"===n)/*#__PURE__*/return e.jsx(Ph,{},n);if(a.isCustomOAuthProvider(n))/*#__PURE__*/return e.jsx(Th,{provider:n},n);let r=x.findIndex((({id:e})=>e===Sl.normalize(n))),i="solana"===f?"solana-only":"ethereum-only";/*#__PURE__*/return e.jsx(zl,{recent:!0,index:r,data:{wallets:x,walletChainType:i,handleWalletClick(e){s((t=>({...t,externalConnectWallet:{walletList:h,walletChainType:i,preSelectedWalletId:e.id}}))),d(t?$p:xc)}}})},Y=x.filter((e=>e.id!==Sl.normalize(y||""))),Z=Y.map(((n,r)=>/*#__PURE__*/e.jsx(zl,{index:r,data:{walletChainType:g,wallets:Y,handleWalletClick(e){s((t=>({...t,externalConnectWallet:{walletList:h,walletChainType:g,preSelectedWalletId:e.id}}))),d(t?$p:xc)}}},n.id))),K=D.filter((e=>e!==v?.loginMethod)).flatMap(G),Q=q.flatMap(G);"web3-first"===O&&"default"===U?Z.unshift(...Q):"web2-first"===O&&K.unshift(...Q);let X="web2-overflow"===U?()=>z("default"):void 0,J=D.filter((e=>"email"!==e&&"sms"!==e)),ee=Wh({priority:O,email:w,sms:C,social:J}),te=Dh({priority:O,email:w,sms:C,social:J}),ne=/*#__PURE__*/e.jsx(wu,{text:Rh({priority:O}),onClick:()=>{s({...o,externalConnectWallet:{walletChainType:p?.walletChainType??u.appearance.walletChainType}}),d(t?$p:xc)}}),re=/*#__PURE__*/e.jsx(_h,{text:ee,icon:te,onClick:()=>z("web2-overflow")}),ae=B?0:1,ie=_&&Z.length>0,oe=0===K.length&&_&&0===Z.length,se=5-(ie?1:0),le="default"===U&&u?.appearance.logo,ce="default"===U&&u.appearance.loginMessage;/*#__PURE__*/return e.jsxs(ba,{title:u.appearance.landingHeader,icon:le?/*#__PURE__*/e.jsx(os,{}):void 0,iconVariant:le?"logo":void 0,onClose:$,showClose:!0,onBack:X,showBack:!!X,helpText:u||W&&"default"===U?/*#__PURE__*/e.jsxs(e.Fragment,{children:[W&&"default"===U&&/*#__PURE__*/e.jsx(xh,{}),u&&/*#__PURE__*/e.jsx(fr,{app:u})]}):void 0,watermark:!0,children:[ce&&("string"==typeof u.appearance.loginMessage?/*#__PURE__*/e.jsx(Fh,{children:u.appearance.loginMessage}):/*#__PURE__*/e.jsx(Lh,{children:u.appearance.loginMessage})),/*#__PURE__*/e.jsx(sr,{$colorScheme:u.appearance.palette.colorScheme,children:"default"===U&&"web2-first"===O?/*#__PURE__*/e.jsxs(e.Fragment,{children:[K.length>se?K.slice(0,se-1):K,K.length>se&&re,ie&&ne,oe&&/*#__PURE__*/e.jsx(Cu,{chainType:u.appearance.walletChainType})]}):"default"===U&&"web3-first"===O?/*#__PURE__*/e.jsxs(e.Fragment,{children:[_&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[Z.length>se?Z.slice(0,se-1):Z,Z.length>se&&ne]}),K.length>ae&&re,K.length===ae&&K[0],oe&&/*#__PURE__*/e.jsx(Cu,{chainType:u.appearance.walletChainType})]}):"web2-overflow"===U?/*#__PURE__*/e.jsx(e.Fragment,{children:"web3-first"===O?K:K.slice(3)}):null})]})};let Fh=/*#__PURE__*/i.styled.div.withConfig({displayName:"StyledSubtitle",componentId:"sc-16aebfe7-0"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),Lh=/*#__PURE__*/i.styled.div.withConfig({displayName:"MessageContainer",componentId:"sc-16aebfe7-1"})(["margin-bottom:24px;"]),Wh=({priority:e,email:t,sms:n,social:r})=>"web2-first"===e?"Other socials":t&&n&&r.length>0||t&&r.length>0?"Log in with email or socials":n&&r.length>0?"Log in with sms or socials":t&&n?"Continue with email or sms":t?"Continue with email":n?"Continue with sms":"Log in with a social account",Dh=({priority:n,email:r,sms:a,social:i})=>"web2-first"===n||i.length>0?/*#__PURE__*/e.jsx(t.UserCircle,{}):r&&a?/*#__PURE__*/e.jsx(Ql,{}):r?/*#__PURE__*/e.jsx(t.Mail,{}):a?/*#__PURE__*/e.jsx(t.Smartphone,{}):null,Rh=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets";const Oh=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:n,prefilledType:r})=>n&&("email"===e&&"phone"!==r||"email"===r)||!t||"phone"!==e&&"phone"!==r?"email":"sms",Bh={component:()=>{let t=qn();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/e.jsx(og,{connectOnly:!0}):/*#__PURE__*/e.jsx(Mh,{connectOnly:!0})}},Uh=({contactMethod:t,authFlow:r,appName:a="Privy",whatsAppEnabled:i=!1,onBack:o,onCodeSubmit:s,onResend:l,errorMessage:c,success:d=!1,resendCountdown:u=0,onInvalidInput:p,onClearError:h})=>{let[g,m]=n.useState(Hh);n.useEffect((()=>{c||m(Hh)}),[c]);let y="email"===r?/*#__PURE__*/e.jsxs("span",{children:["Please check ",/*#__PURE__*/e.jsx(eg,{children:t})," for an email from privy.io and enter your code below."]}):/*#__PURE__*/e.jsxs("span",{children:["Please check ",/*#__PURE__*/e.jsx(eg,{children:t})," for a",i?" WhatsApp":""," message from ",a," and enter your code below."]}),f=/*#__PURE__*/e.jsxs(Xh,{children:[/*#__PURE__*/e.jsxs("span",{children:["Didn't get ","email"===r?"an email":"a message","?"]}),u?/*#__PURE__*/e.jsxs(Jh,{children:[/*#__PURE__*/e.jsx(ge.default,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),/*#__PURE__*/e.jsx("span",{children:"Code sent"})]}):/*#__PURE__*/e.jsx(ps,{as:"button",size:"sm",onClick:l,children:"Resend code"})]}),x=async e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return void p?.("Code should be numeric");h?.();let n=Number(e.currentTarget.name?.charAt(5)),r=[...t||[""]].slice(0,zh-n),a=[...g.slice(0,n),...r,...g.slice(n+r.length)];m(a);let i=Math.min(Math.max(n+r.length,0),zh-1);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${i}]`);e?.focus()}if(a.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${i}]`);e?.blur(),await(s?.(a.join("")))}};/*#__PURE__*/return e.jsx(ba,{title:"Enter confirmation code",subtitle:y,icon:"email"===r?me.default:ye.default,onBack:o,showBack:!0,helpText:f,children:/*#__PURE__*/e.jsx(Zh,{children:/*#__PURE__*/e.jsx(Ga,{children:/*#__PURE__*/e.jsxs(Kh,{children:[/*#__PURE__*/e.jsx("div",{children:g.map(((t,n)=>/*#__PURE__*/e.jsx("input",{name:`code-${n}`,type:"text",value:g[n],onChange:x,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(h?.(),m([...g.slice(0,e),"",...g.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(n)},inputMode:"numeric",autoFocus:0===n,pattern:"[0-9]",className:`${d?"success":""} ${c?"fail":""}`,autoComplete:v.isMobile?"one-time-code":"off"},n)))}),/*#__PURE__*/e.jsx(Qh,{$fail:!!c,$success:d,children:/*#__PURE__*/e.jsx("span",{children:"Invalid or expired verification code"===c?"Incorrect code":c||(d?"Success!":"")})})]})})})})};let zh=6,Hh=Array(6).fill("");var Vh,$h,qh=((Vh=qh||{})[Vh.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",Vh[Vh.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",Vh),Gh=(($h=Gh||{})[$h.EMAIL=0]="EMAIL",$h[$h.SMS=1]="SMS",$h);const Yh={component:()=>{let{navigate:t,lastScreen:i,navigateBack:o,setModalData:s,onUserCloseViaDialogOrKeybindRef:l}=Xn(),c=qn(),{closePrivyModal:u,resendEmailCode:p,resendSmsCode:h,getAuthMeta:g,loginWithCode:m,updateWallets:y,createAnalyticsEvent:f}=r.usePrivyInternal(),{authenticated:x,logout:v,user:w}=a.usePrivyContext(),{whatsAppEnabled:C}=qn(),[b,j]=n.useState(!1),[k,T]=n.useState(null),[A,S]=n.useState(null),[E,I]=n.useState(0);l.current=()=>null;let P=g()?.email?0:1,N=0===P?g()?.email||"":g()?.phoneNumber||"";n.useEffect((()=>{if(E){let e=setTimeout((()=>{I(E-1)}),1e3);return()=>clearTimeout(e)}}),[E]),n.useEffect((()=>{if(x&&b&&w){if(c?.legal.requireUsersAcceptTerms&&!w.hasAcceptedTerms){let e=setTimeout((()=>{t(nl)}),900);return()=>clearTimeout(e)}if(fs(w,c.embeddedWallets)){let e=setTimeout((()=>{s({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),v()},callAuthOnSuccessOnClose:!0}}),t(tl)}),900);return()=>clearTimeout(e)}{y();let e=setTimeout((()=>u({shouldCallAuthOnSuccess:!0,isSuccess:!0})),at);return()=>clearTimeout(e)}}}),[x,b,w]),n.useEffect((()=>{if(k&&0===A){let e=setTimeout((()=>{T(null),S(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[k,A]);/*#__PURE__*/return e.jsx(Uh,{contactMethod:N,authFlow:0===P?"email":"sms",appName:c?.name,whatsAppEnabled:C,onBack:()=>o(),onCodeSubmit:async e=>{try{await m(e),j(!0)}catch(e){if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.INVALID_CREDENTIALS)T("Invalid or expired verification code"),S(0);else if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)T(e.message);else{if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new d.PrivyUserLimitReachedError(e).toString()),void t(hc);if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.USER_DOES_NOT_EXIST)return void t(vs);if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.LINKED_TO_ANOTHER_USER)return s({errorModalData:{error:e,previousScreen:i??Yh}}),void t(Rs,!1);if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.DISALLOWED_PLUS_EMAIL)return s({inlineError:{error:e}}),void t(Bh,!1);if(e instanceof d.PrivyApiError&&e.privyErrorCode===d.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return s({accountTransfer:{nonce:e.data?.data?.nonce,account:N,displayName:e.data?.data?.account?.displayName,linkMethod:0===P?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void t(Qs);T("Issue verifying code"),S(0)}}},onResend:async()=>{I(30),0===P?await p():await h()},errorMessage:k||void 0,success:b,resendCountdown:E,onInvalidInput:e=>{T(e),S(1)},onClearError:()=>{1===A&&(T(null),S(null))}})}};let Zh=/*#__PURE__*/i.styled.div.withConfig({displayName:"PasswordlessCodeContainer",componentId:"sc-63a7dae3-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:auto;gap:16px;flex-grow:1;width:100%;"]),Kh=/*#__PURE__*/i.styled.div.withConfig({displayName:"CodeInput",componentId:"sc-63a7dae3-1"})(["display:flex;flex-direction:column;width:100%;gap:12px;> div:first-child{display:flex;justify-content:center;gap:0.5rem;width:100%;border-radius:var(--privy-border-radius-sm);> input{border:1px solid var(--privy-color-foreground-4);background:var(--privy-color-background);border-radius:var(--privy-border-radius-sm);padding:8px 10px;height:48px;width:40px;text-align:center;font-size:18px;font-weight:600;color:var(--privy-color-foreground);transition:all 0.2s ease;}> input:focus{border:1px solid var(--privy-color-foreground);box-shadow:0 0 0 1px var(--privy-color-foreground);}> input:invalid{border:1px solid var(--privy-color-error);}> input.success{border:1px solid var(--privy-color-border-success);background:var(--privy-color-success-bg);}> input.fail{border:1px solid var(--privy-color-border-error);background:var(--privy-color-error-bg);animation:shake 180ms;animation-iteration-count:2;}}@keyframes shake{0%{transform:translate(1px,0px);}33%{transform:translate(-1px,0px);}67%{transform:translate(-1px,0px);}100%{transform:translate(1px,0px);}}"]),Qh=/*#__PURE__*/i.styled.div.withConfig({displayName:"InputHelp",componentId:"sc-63a7dae3-2"})(["line-height:20px;min-height:20px;font-size:14px;font-weight:400;color:",";display:flex;justify-content:center;width:100%;text-align:center;"],(e=>e.$success?"var(--privy-color-success-dark)":e.$fail?"var(--privy-color-error-dark)":"transparent")),Xh=/*#__PURE__*/i.styled.div.withConfig({displayName:"HelpTextContainer",componentId:"sc-63a7dae3-3"})(["display:flex;gap:8px;align-items:center;justify-content:center;width:100%;color:var(--privy-color-foreground-2);"]),Jh=/*#__PURE__*/i.styled.div.withConfig({displayName:"Badge",componentId:"sc-63a7dae3-4"})(["display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-sm);padding:2px 8px;gap:4px;background:var(--privy-color-background-2);color:var(--privy-color-foreground-2);"]),eg=/*#__PURE__*/i.styled.span.withConfig({displayName:"BoldWrappingSpan",componentId:"sc-63a7dae3-5"})(["font-weight:500;word-break:break-all;color:var(--privy-color-foreground);"]);const tg=/*#__PURE__*/n.forwardRef(((i,o)=>{let[s,l]=n.useState(i.defaultValue||""),[c,u]=n.useState(""),[p,h]=n.useState(!1),{authenticated:g}=a.usePrivyContext(),{initLoginWithEmail:m}=r.usePrivyInternal(),{navigate:y,setModalData:f,currentScreen:x,data:v}=Xn(),{enabled:w,token:C}=qt(),[b,j]=n.useState(!1),{accountType:k}=is(),T=qn();n.useEffect((()=>{!s&&T.disablePlusEmails&&v?.inlineError?.error instanceof d.PrivyError&&v?.inlineError?.error.privyErrorCode===d.PrivyErrorCode.DISALLOWED_PLUS_EMAIL&&!c&&u("Please enter a valid email address without a '+'."),c&&u("")}),[s]);let A=Wt(s),S=p||!A,E=()=>{f({login:v?.login,inlineError:void 0}),!w||C||g?(e=>{h(!0),m({email:s,captchaToken:e,disableSignup:v?.login?.disableSignup,withPrivyUi:!0}).then((()=>{y(Yh)})).catch((e=>{f({errorModalData:{error:e,previousScreen:x||cg}}),y(Rs)})).finally((()=>{h(!1)}))})(C):(f({captchaModalData:{callback:e=>m({email:s,captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Yh,onErrorNavigateTo:Rs}}),y(ic))};/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(ng,{children:[c&&/*#__PURE__*/e.jsx(wl,{style:{display:"block",marginTop:"0.25rem",textAlign:"left"},children:c}),/*#__PURE__*/e.jsxs(rg,{stacked:i.stacked,$error:!!c,children:[/*#__PURE__*/e.jsx(ag,{children:/*#__PURE__*/e.jsx(t.Mail,{})}),/*#__PURE__*/e.jsx("input",{ref:o,id:"email-input",className:"login-method-button",type:"email",placeholder:"your@email.com",onFocus:()=>j(!0),onChange:e=>l(e.target.value),onKeyUp:e=>{"Enter"===e.key&&E()},value:s,autoComplete:"email"}),"email"!==k||b?i.stacked?/*#__PURE__*/e.jsx("span",{}):/*#__PURE__*/e.jsx(Rr,{isSubmitting:p,onClick:E,disabled:S,children:"Submit"}):/*#__PURE__*/e.jsx(xu,{color:"gray",children:"Recent"})]})]}),i.stacked?/*#__PURE__*/e.jsx(Pr,{loadingText:null,loading:p,disabled:S,onClick:E,style:{width:"100%"},children:"Submit"}):null]})}));let ng=kl,rg=jl,ag=/*#__PURE__*/i.styled(ur).withConfig({displayName:"StyledLoginMethodIconWrapper",componentId:"sc-e33d938a-0"})(["display:inline-flex;"]);const ig=({isEditable:r,setIsEditable:a,defaultValue:i})=>{let o=n.useRef(null);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(pr,{$if:!r,children:/*#__PURE__*/e.jsx(tg,{ref:o,defaultValue:i})}),/*#__PURE__*/e.jsx(pr,{$if:r,children:/*#__PURE__*/e.jsxs(dr,{onClick:()=>{a(),setTimeout((()=>{o.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(t.Mail,{})}),"Continue with Email"]})})]})},og=({connectOnly:t})=>{let{closePrivyModal:a,connectors:i}=r.usePrivyInternal(),{onUserCloseViaDialogOrKeybindRef:o,data:s}=Xn(),l=qn(),{appearance:{palette:{colorScheme:c}}}=qn(),{accountType:d,walletClientType:u,chainType:p}=is(),h=n.useMemo((()=>d&&"guest"!==d&&"authorization_key"!==d&&"cross_app"!==d?es(d):null),[d]),g=l.loginMethodsAndOrder?.primary??[],m=l.loginMethodsAndOrder?.overflow??[],y=n.useMemo((()=>[...g,...m]),[g,m]),f=l.loginMethods.passkey,x=s?.login,v=[];u&&y.includes(u)?v.push(u):d&&y.includes(h?.loginMethod)&&v.push(h?.loginMethod);let[w,C]=n.useState("default"),[b,j]=n.useState(Oh({mostRecentlyUsedAccountType:d,smsAvailable:y.includes("sms"),emailAvailable:y.includes("email"),prefilledType:x?.prefill?.type}));n.useEffect((()=>{j(Oh({mostRecentlyUsedAccountType:d,smsAvailable:y.includes("sms"),emailAvailable:y.includes("email"),prefilledType:x?.prefill?.type}))}),[y,d]),n.useEffect((()=>{"phone"===d&&j("sms");let e=y.indexOf("sms"),t=y.indexOf("email");e>-1&&e<t&&j("sms")}),[d,g,m]);let k=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{C("default")}),150)};o.current=k;let T=n=>"email"===n?/*#__PURE__*/e.jsx(ig,{isEditable:"email"===b,setIsEditable:()=>{j("email")},defaultValue:"email"===x?.prefill?.type?x.prefill.value:void 0},n):"sms"===n?/*#__PURE__*/e.jsx(jh,{isEditable:"sms"===b,setIsEditable:()=>{j("sms")},defaultValue:"phone"===x?.prefill?.type?x.prefill.value:void 0},n):"apple"===n?/*#__PURE__*/e.jsx(Th,{provider:"apple"},n):"discord"===n?/*#__PURE__*/e.jsx(Th,{provider:"discord"},n):"farcaster"===n?/*#__PURE__*/e.jsx(uh,{},n):"github"===n?/*#__PURE__*/e.jsx(Th,{provider:"github"},n):"google"===n?/*#__PURE__*/e.jsx(Th,{provider:"google"},n):"linkedin"===n?/*#__PURE__*/e.jsx(Th,{provider:"linkedin"},n):"spotify"===n?/*#__PURE__*/e.jsx(Th,{provider:"spotify"},n):"instagram"===n?/*#__PURE__*/e.jsx(Th,{provider:"instagram"},n):"tiktok"===n?/*#__PURE__*/e.jsx(Th,{provider:"tiktok"},n):"line"===n?/*#__PURE__*/e.jsx(Th,{provider:"line"},n):"twitter"===n?/*#__PURE__*/e.jsx(Th,{provider:"twitter"},n):"telegram"===n?/*#__PURE__*/e.jsx(Ph,{},n):n.startsWith("privy:")?/*#__PURE__*/e.jsx(ds,{appId:n.replace("privy:","")},n):zu({walletList:l.appearance.walletList,walletChainType:x?.walletChainType??l.appearance.walletChainType,connectors:i,connectOnly:t,ignore:y,walletConnectEnabled:l.externalWallets.walletConnect.enabled,forceWallet:{wallet:n,chainType:p??"ethereum"}}),A=v.flatMap(T),S=g.filter((e=>e!==u&&e!==h?.loginMethod)).flatMap(T),E=m.filter((e=>e!==u&&e!==h?.loginMethod)).flatMap(T),[I,P]=((e,t)=>{let n=[],r=[];for(let[a,i]of e.entries())a<t?n.push(i):r.push(i);return[n,r]})([...A,...S,...E],sg({primary:S.length+A.length,overflow:E.length}));/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{title:l.appearance.landingHeader,onClose:k,backFn:"default"===w?void 0:()=>{C("default")}}),"default"===w&&/*#__PURE__*/e.jsx(lg,{}),"default"===w&&("string"==typeof l.appearance.loginMessage?/*#__PURE__*/e.jsx(cr,{children:l.appearance.loginMessage}):l.appearance.loginMessage),/*#__PURE__*/e.jsx(ir,{style:{overflow:"hidden"},children:/*#__PURE__*/e.jsxs(sr,{$colorScheme:c,children:["default"===w&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[I,P.length>0&&/*#__PURE__*/e.jsx(_h,{text:"More options",icon:/*#__PURE__*/e.jsx(de.default,{}),onClick:()=>C("overflow")})]}),"overflow"===w&&/*#__PURE__*/e.jsx(e.Fragment,{children:P}),f&&"default"===w&&/*#__PURE__*/e.jsx(xh,{})]})}),l&&/*#__PURE__*/e.jsx(fr,{app:l}),/*#__PURE__*/e.jsx(xr,{})]})};let sg=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,lg=/*#__PURE__*/i.styled(ss).withConfig({displayName:"StyledAppLogoHeader",componentId:"sc-b478a8eb-0"})(["margin-bottom:16px;"]);const cg={component:()=>{let t=qn();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/e.jsx(og,{connectOnly:!1}):/*#__PURE__*/e.jsx(Mh,{connectOnly:!1})},isCaptchaRequired:!0,isUnauthenticatedScreem:!0},dg={component:()=>{let[t,i]=n.useState(null),[o,s]=n.useState(!1),[l,c]=n.useState(null),[u,p]=n.useState(""),{authenticated:h,user:g}=a.usePrivyContext(),{client:m,walletProxy:y,refreshSessionAndUser:f,closePrivyModal:x,createAnalyticsEvent:v}=r.usePrivyInternal(),{navigate:w,data:C,onUserCloseViaDialogOrKeybindRef:b}=Xn(),j=qn(),{onSuccess:k,onFailure:T}=C.setWalletPassword,A=a.getPrivyPrimaryWallet(g),S="user-passcode"===t?.recoveryMethod,E="user-passcode"===A?.recoveryMethod;n.useEffect((()=>{h||(w(cg),T(new d.PrivyUnauthenticatedError("User must be authenticated before setting a password on a Privy wallet")))}),[h]);let I=()=>l?(T(l),void x({shouldCallAuthOnSuccess:!1})):S?(k(t),void x({shouldCallAuthOnSuccess:!1})):(T(new d.PrivyEmbeddedWalletError("Exited before password was added to wallet")),void x({shouldCallAuthOnSuccess:!1}));b.current=I;/*#__PURE__*/return e.jsx(Xo,{appName:j?.name||"privy",config:{initiatedBy:"user",onCancel:I},error:l?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:u,isResettingPassword:E,onPasswordGenerate:()=>p(zo()),onPasswordChange:p,onSubmit:async()=>{S?(k(t),x({shouldCallAuthOnSuccess:!1})):(s(!0),c(null),await(async()=>{let e=await m.getAccessToken();if(e&&g&&A?.address&&u&&y)try{v({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E}});let{entropyId:t,entropyIdVerifier:n}=Qt(g);if(!(await y.setRecovery({accessToken:e,entropyId:t,entropyIdVerifier:n,recoveryPassword:u,recoveryMethod:"user-passcode"})).entropyId)return c(new d.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E,reason:"error setting password"}});let r=await f(),o=a.getPrivyPrimaryWallet(r);if(!o)return c(new d.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E,reason:"wallet disconnected"}});i(o),v({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E}})}catch(e){console.warn(e),c(e instanceof Error?e:Error("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:A.address,reason:e}})}})(),s(!1))},onClose:I})}},ug=({onClose:n,onProceed:r})=>/*#__PURE__*/e.jsx(ba,{title:"Secure Your Account",subtitle:/*#__PURE__*/e.jsxs(e.Fragment,{children:["Please set a password to secure your account.",/*#__PURE__*/e.jsx("br",{}),"Losing access to this password and this device will make your account inaccessible."]}),icon:t.Lock,primaryCta:{label:"Add password",onClick:r},onClose:n,watermark:!0}),pg={component:()=>{let{closePrivyModal:t}=r.usePrivyInternal(),{data:n,navigate:a,onUserCloseViaDialogOrKeybindRef:i}=Xn(),{onFailure:o}=n.setWalletPassword,s=()=>{o(new d.PrivyEmbeddedWalletError("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=s,/*#__PURE__*/e.jsx(ug,{onClose:s,onProceed:()=>{a(dg)}})}},hg={component:()=>{let[t,i]=n.useState(!0),{authenticated:o,user:s}=a.usePrivyContext(),{walletProxy:l,closePrivyModal:c,createAnalyticsEvent:u,client:p}=r.usePrivyInternal(),{navigate:h,data:g,onUserCloseViaDialogOrKeybindRef:m}=Xn(),[y,f]=n.useState(void 0),[x,v]=n.useState(""),[w,C]=n.useState(!1),{entropyId:b,entropyIdVerifier:j,onCompleteNavigateTo:k,onSuccess:T,onFailure:A}=g.recoverWallet,S=(e="User exited before their wallet could be recovered")=>{c({shouldCallAuthOnSuccess:!1}),A("string"==typeof e?new d.PrivyEmbeddedWalletError(e):e)};m.current=S,n.useEffect((()=>{if(!o)return S("User must be authenticated and have a Privy wallet before it can be recovered")}),[o]);/*#__PURE__*/return e.jsxs(ma,{children:[/*#__PURE__*/e.jsx(ma.Header,{icon:Le.default,title:"Enter your password",subtitle:"Please provision your account on this new device. To continue, enter your recovery password.",showClose:!0,onClose:S}),/*#__PURE__*/e.jsx(ma.Body,{children:/*#__PURE__*/e.jsx(gg,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsxs(yo,{children:[/*#__PURE__*/e.jsx(go,{type:t?"password":"text",onChange:e=>(e=>{e&&f(e)})(e.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),/*#__PURE__*/e.jsx(Co,{style:{right:"0.75rem"},children:t?/*#__PURE__*/e.jsx(jo,{onClick:()=>i(!1)}):/*#__PURE__*/e.jsx(ko,{onClick:()=>i(!0)})})]}),!!x&&/*#__PURE__*/e.jsx(mg,{children:x})]})})}),/*#__PURE__*/e.jsxs(ma.Footer,{children:[/*#__PURE__*/e.jsx(ma.HelpText,{children:/*#__PURE__*/e.jsxs(Xa,{children:[/*#__PURE__*/e.jsx("h4",{children:"Why is this necessary?"}),/*#__PURE__*/e.jsx("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]})}),/*#__PURE__*/e.jsx(ma.Actions,{children:/*#__PURE__*/e.jsx(yg,{loading:w||!l,disabled:!y,onClick:async()=>{C(!0);let e=await p.getAccessToken(),t=a.getPrivyWalletWithAddress(s,b);if(!e||!t||null===y)return S("User must be authenticated and have a Privy wallet before it can be recovered");try{u({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t.address}}),await(l?.recover({accessToken:e,entropyId:b,entropyIdVerifier:j,recoveryPassword:y})),v(""),k?h(k):c({shouldCallAuthOnSuccess:!1}),T?.(t),u({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}})}catch(e){!function(e){return Wi(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?v("An error has occurred, please try again."):v("Invalid recovery password, please try again.")}finally{C(!1)}},$hideAnimations:!b&&w,children:"Recover your account"})}),/*#__PURE__*/e.jsx(ma.Watermark,{})]})]})}};let gg=/*#__PURE__*/i.styled.div.withConfig({displayName:"Content",componentId:"sc-f366413c-0"})(["display:flex;flex-direction:column;gap:1.5rem;"]),mg=/*#__PURE__*/i.styled.div.withConfig({displayName:"ErrorMessage",componentId:"sc-f366413c-1"})(["line-height:20px;height:20px;font-size:13px;color:var(--privy-color-error);text-align:left;margin-top:0.5rem;"]),yg=/*#__PURE__*/i.styled(Pr).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-f366413c-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/i.css(["&&{transition:none;}"])));const fg={component:()=>{let{navigate:t,data:i,onUserCloseViaDialogOrKeybindRef:o}=Xn(),s=qn(),[l,c]=n.useState(""),[u,p]=n.useState(!1),[h,g]=n.useState(),[m,y]=n.useState(null),{create:f}=Qi(),{authenticated:x,user:v}=a.usePrivyContext(),{closePrivyModal:w,isNewUserThisSession:C,initializeWalletProxy:b}=r.usePrivyInternal(),{onSuccess:j,onFailure:k,callAuthOnSuccessOnClose:T,shouldCreateEth:A,shouldCreateSol:S}=i.createWallet,[E,I]=n.useState(null),P=new rt((async()=>{try{let e;if(A&&S)e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:v}),e=await f({chainType:"solana",walletIndex:0,latestUser:e.user});else if(S)e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"solana",walletIndex:0,latestUser:v});else{if(!A)throw Error("Invalid args to create wallet");e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:v})}I(e),C?t(Ji):(j(e),w({shouldCallAuthOnSuccess:T}))}catch(e){c(e.message)}}));n.useEffect((()=>{m||b(3e4).then((e=>y(e)))}),[m]),n.useEffect((()=>{if(!x||!v)return t(cg),void k(Error("User must be authenticated before creating a Privy wallet"))}),[x]),o.current=()=>null;/*#__PURE__*/return e.jsx(Xo,{config:{initiatedBy:"automatic"},appName:s?.name||"privy",loading:!m,buttonLoading:u,buttonHideAnimations:!E&&u,isResettingPassword:!1,error:l,password:h||"",onClose:()=>{E&&"user-passcode"!==E.account.recoveryMethod?(k(new d.PrivyEmbeddedWalletError("User created a wallet but failed to set a password for it")),w({shouldCallAuthOnSuccess:!1})):E?(j(E),w({shouldCallAuthOnSuccess:T})):(k(new d.PrivyEmbeddedWalletError("User wallet creation failed")),w({shouldCallAuthOnSuccess:!1}))},onPasswordChange:g,onPasswordGenerate:()=>g(zo()),onSubmit:async()=>(p(!0),P.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>p(!1))))})}},xg=/*#__PURE__*/i.styled.div.withConfig({displayName:"WithCircleBorder",componentId:"sc-e4fc5563-0"})(["&&{border-width:4px;}display:flex;justify-content:center;align-items:center;padding:1rem;aspect-ratio:1;border-style:solid;border-color:",";border-radius:50%;"],(e=>e.$color??"var(--privy-color-accent)")),vg={component:()=>{let{user:t}=a.usePrivyContext(),{client:i,walletProxy:o,refreshSessionAndUser:s,closePrivyModal:l}=r.usePrivyInternal(),c=Xn(),{entropyId:d,entropyIdVerifier:u}=c.data?.recoverWallet,[p,h]=n.useState(!1),[g,m]=n.useState(null),[y,f]=n.useState(null);function x(){if(!p){if(y)return c.data?.setWalletPassword?.onFailure(y),void l();if(!g)return c.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void l()}}c.onUserCloseViaDialogOrKeybindRef.current=x;let v=!(!p&&!g);return y?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:x},"header"),/*#__PURE__*/e.jsx(xg,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:/*#__PURE__*/e.jsx(xe.default,{height:38,width:38,stroke:"var(--privy-color-error)"})}),/*#__PURE__*/e.jsx(jc,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),/*#__PURE__*/e.jsx(ar,{style:{minHeight:"2rem"}}),/*#__PURE__*/e.jsx(Nr,{onClick:()=>f(null),children:"Try again"}),/*#__PURE__*/e.jsx(xr,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:x},"header"),/*#__PURE__*/e.jsx(ke.default,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),/*#__PURE__*/e.jsx(jc,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),/*#__PURE__*/e.jsx(bc,{style:{marginTop:"1rem"},children:"When you log into a new device, you’ll only need to authenticate to access your account. Never get logged out if you forget your password."}),/*#__PURE__*/e.jsx(ar,{style:{minHeight:"2rem"}}),/*#__PURE__*/e.jsx(Nr,{loading:p,disabled:v,onClick:()=>async function(){h(!0);try{let e=await i.getAccessToken(),n=a.getPrivyWalletWithAddress(t,d);if(!e||!o||!n)return;if(!(await o.setRecovery({accessToken:e,entropyId:d,entropyIdVerifier:u,existingRecoveryMethod:n.recoveryMethod,recoveryMethod:"privy"})).entropyId)throw Error("Unable to set recovery on wallet");let r=await s();if(!r)throw Error("Unable to set recovery on wallet");let p=a.getPrivyWalletWithAddress(r,n.address);if(!p)throw Error("Unabled to set recovery on wallet");m(!!r),setTimeout((()=>{c.data?.setWalletPassword?.onSuccess(p),l()}),at)}catch(e){f(e)}finally{h(!1)}}(),children:g?"Success":"Confirm"}),/*#__PURE__*/e.jsx(xr,{})]})}};function wg({isCreatingWallet:e,skipSplashScreen:t}){return e?fg:t?dg:pg}function Cg({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:n,isResettingPassword:r,showAutomaticRecovery:a}){return a?vg:n||1===t.length?wg({isCreatingWallet:"create"===e,skipSplashScreen:r}):so}function bg(e){switch(e){case"user-passcode":return hg;case"google-drive":case"icloud":return ro;default:throw Error("Recovery method not supported")}}const jg=({address:t,accessToken:n,appConfigTheme:r,onClose:a,isLoading:i=!1,exportButtonProps:o})=>/*#__PURE__*/e.jsx(ba,{title:"Export wallet",subtitle:/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy either your private key or seed phrase to export your wallet."," ",/*#__PURE__*/e.jsx("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),onClose:a,watermark:!0,children:/*#__PURE__*/e.jsxs(kg,{children:[/*#__PURE__*/e.jsx(fd,{theme:r,children:"Never share your private key or seed phrase with anyone."}),/*#__PURE__*/e.jsx(Fc,{title:"Your wallet",address:t,showCopyButton:!0}),/*#__PURE__*/e.jsx("div",{style:{width:"100%"},children:i?/*#__PURE__*/e.jsx(Tg,{}):n&&o&&/*#__PURE__*/e.jsx(Eg,{accessToken:n,dimensions:{height:"44px"},...o})})]})});let kg=/*#__PURE__*/i.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-39a41d8e-0"})(["display:flex;flex-direction:column;gap:1.25rem;text-align:left;"]),Tg=()=>/*#__PURE__*/e.jsx(Ag,{children:/*#__PURE__*/e.jsx(Sg,{children:"Loading..."})}),Ag=/*#__PURE__*/i.styled.div.withConfig({displayName:"PlaceholderContainer",componentId:"sc-39a41d8e-1"})(["display:flex;gap:12px;height:44px;"]),Sg=/*#__PURE__*/i.styled.div.withConfig({displayName:"PlaceholderButton",componentId:"sc-39a41d8e-2"})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:16px;font-weight:500;border-radius:var(--privy-border-radius-md);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);"]);function Eg(t){let[r,a]=n.useState(t.dimensions.width),[i,s]=n.useState(void 0),l=n.useRef(null);n.useEffect((()=>{if(l.current&&void 0===r){let{width:e}=l.current.getBoundingClientRect();a(e)}let e=getComputedStyle(document.documentElement);s({background:e.getPropertyValue("--privy-color-background"),background2:e.getPropertyValue("--privy-color-background-2"),foreground3:e.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:e.getPropertyValue("--privy-color-foreground-accent"),accent:e.getPropertyValue("--privy-color-accent"),accentDark:e.getPropertyValue("--privy-color-accent-dark"),success:e.getPropertyValue("--privy-color-success"),colorScheme:e.getPropertyValue("color-scheme")})}),[]);let c="ethereum"===t.chainType&&!t.imported&&!t.isUnifiedWallet;/*#__PURE__*/return e.jsx("div",{ref:l,children:r&&
26
+ /*#__PURE__*/e.jsxs(Pg,{children:[/*#__PURE__*/e.jsx("iframe",{style:{position:"absolute",zIndex:1},width:r,height:t.dimensions.height,allow:"clipboard-write self *",src:o.constructURL({origin:t.origin,path:`/apps/${t.appId}/embedded-wallets/export`,query:t.isUnifiedWallet?{v:"1-unified",wallet_id:t.walletId,client_id:t.appClientId,width:`${r}px`,caid:t.clientAnalyticsId,phrase_export:c,...i}:{v:"1",entropy_id:t.entropyId,entropy_id_verifier:t.entropyIdVerifier,hd_wallet_index:t.hdWalletIndex,chain_type:t.chainType,client_id:t.appClientId,width:`${r}px`,caid:t.clientAnalyticsId,phrase_export:c,...i},hash:{token:t.accessToken}})}),/*#__PURE__*/e.jsx(Ng,{children:"Loading..."}),c&&/*#__PURE__*/e.jsx(Ng,{children:"Loading..."})]})})}const Ig={component:()=>{let[t,i]=n.useState(null),{authenticated:o,user:s}=a.usePrivyContext(),{closePrivyModal:l,createAnalyticsEvent:c,clientAnalyticsId:d,client:u}=r.usePrivyInternal(),p=qn(),{data:h,onUserCloseViaDialogOrKeybindRef:g}=Xn(),{onFailure:m,onSuccess:y,origin:f,appId:x,appClientId:v,entropyId:w,entropyIdVerifier:C,walletId:b,hdWalletIndex:j,chainType:k,address:T,isUnifiedWallet:A,imported:S}=h.keyExport,E=e=>{l({shouldCallAuthOnSuccess:!1}),m("string"==typeof e?Error(e):e)},I=()=>{l({shouldCallAuthOnSuccess:!1}),y(),c({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:T}})};return n.useEffect((()=>{if(!o)return E("User must be authenticated before exporting their wallet");u.getAccessToken().then(i).catch(E)}),[o,s]),g.current=I,/*#__PURE__*/e.jsx(jg,{address:T,accessToken:t,appConfigTheme:p.appearance.palette.colorScheme,onClose:I,isLoading:!t,exportButtonProps:t?{origin:f,appId:x,appClientId:v,clientAnalyticsId:d,entropyId:w,entropyIdVerifier:C,walletId:b,hdWalletIndex:j,isUnifiedWallet:A,imported:S,chainType:k}:void 0})}};let Pg=/*#__PURE__*/i.styled.div.withConfig({displayName:"ButtonContainer",componentId:"sc-39a41d8e-3"})(["overflow:visible;position:relative;overflow:none;height:44px;display:flex;gap:12px;"]),Ng=/*#__PURE__*/i.styled.div.withConfig({displayName:"LoadingButton",componentId:"sc-39a41d8e-4"})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:16px;font-weight:500;border-radius:var(--privy-border-radius-md);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);"]);const _g=({connectionFailed:n,onClose:r})=>n?/*#__PURE__*/e.jsx(ba,{title:"Something went wrong",subtitle:"We're on it. Please try again later.",icon:t.XCircle,iconVariant:"error",primaryCta:{label:"Close",onClick:r},watermark:!0}):/*#__PURE__*/e.jsx(ba,{title:"Connecting to your wallet",subtitle:"Please wait...",iconVariant:"loading",showClose:!0,onClose:r,watermark:!1}),Mg={component:()=>{let{authenticated:t,user:i}=a.usePrivyContext(),{client:o,closePrivyModal:s,createAnalyticsEvent:l,walletProxy:c}=r.usePrivyInternal(),{navigate:d,data:u,setModalData:p,onUserCloseViaDialogOrKeybindRef:h}=Xn(),g=n.useMemo((()=>Date.now()),[]),[m,y]=n.useState(!1),{onCompleteNavigateTo:f,onFailure:x,shouldForceMFA:v,entropyId:w,entropyIdVerifier:C,recoveryMethod:b,connectingWalletAddress:j,isUnifiedWallet:k=!1}=u?.connectWallet,T=e=>{m||(y(!0),x("string"==typeof e?Error(e):e))};return n.useEffect((()=>{let e;return t?c?((async()=>{let t=await o.getAccessToken();if(!t)return T("User must be authenticated and have a Privy wallet before it can be connected");try{k||await c.connect({accessToken:t,entropyId:w,entropyIdVerifier:C}),v&&await c.verifyMfa({accessToken:t});let n=(Date.now()-g)/1e3;f===Ig&&n<1?e=setTimeout((()=>{d(f,!1)}),1e3*(1-n)):d(f,!1)}catch(e){if(Di(e)&&"privy"===b){let e=await o.getAccessToken();if(!e)return T("User must be authenticated and have a Privy wallet before it can be recovered");try{l({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:j}});let t=await(c?.recover({accessToken:e,entropyId:w,entropyIdVerifier:C}));t?.entropyId||T(Error("Unable to recover wallet")),f?d(f):s({shouldCallAuthOnSuccess:!1}),l({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:j}}),d(f)}catch(e){T("An error has occurred, please try again.")}}else Di(e)&&"privy"!==b&&"privy-v2"!==b?(p({...u,recoverWallet:{entropyId:w,entropyIdVerifier:C,onCompleteNavigateTo:f,onFailure:x},recoveryOAuthStatus:{provider:b,action:"recover",isInAccountCreateFlow:!1,shouldCreateEth:!1,shouldCreateSol:!1}}),d(bg(b))):T(e)}})(),()=>clearTimeout(e)):void 0:T("User must be authenticated and have a Privy wallet before it can be connected")}),[t,i,c]),h.current=()=>{T("User exited before wallet could be connected"),s({shouldCallAuthOnSuccess:!1})},/*#__PURE__*/e.jsx(_g,{connectionFailed:m,onClose:()=>s({shouldCallAuthOnSuccess:!1})})}},Fg=({style:t,color:n,...r})=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:n||"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...r,children:/*#__PURE__*/e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Lg=t=>{let[r,a]=n.useState(!1);/*#__PURE__*/return e.jsxs(Wg,{color:t.color,onClick:()=>{a(!0),navigator.clipboard.writeText(t.text),setTimeout((()=>a(!1)),1500)},$justCopied:r,children:[r?/*#__PURE__*/e.jsx(Fg,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):/*#__PURE__*/e.jsx(il,{style:{height:"14px",width:"14px"}}),r?"Copied":"Copy"," ",t.itemName?t.itemName:"to Clipboard"]})};let Wg=/*#__PURE__*/i.styled.button.withConfig({displayName:"StyledCopytoClipboardButton",componentId:"sc-46f4187f-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.$justCopied?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.$justCopied?"medium":"normal"),(e=>e.$justCopied?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"));const Dg=/*#__PURE__*/i.styled.img.withConfig({displayName:"StyledLogo",componentId:"sc-68c1b1ea-0"})(["&&{height:",";width:",";border-radius:16px;margin-bottom:12px;}"],(e=>"sm"===e.size?"65px":"140px"),(e=>"sm"===e.size?"65px":"140px"));let Rg=e=>{if(!l.isHex(e))return e;try{let t=l.hexToString(e);return t.includes("�")?e:t}catch{return e}},Og=e=>{try{let t=s.base64.decode(e),n=(new TextDecoder).decode(t);return n.includes("�")?e:n}catch{return e}},Bg=e=>JSON.stringify(e,null,2),Ug=t=>{let{types:n,primaryType:r,...a}=t.typedData;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(qg,{data:a}),/*#__PURE__*/e.jsx(Lg,{text:Bg(t.typedData),itemName:"full payload to clipboard"})," "]})};const zg=({method:n,messageData:r,copy:a,iconUrl:i,isLoading:o,success:s,walletProxyIsLoading:l,errorMessage:c,isCancellable:d,onSign:u,onCancel:p,onClose:h})=>/*#__PURE__*/e.jsx(ba,{title:a.title,subtitle:a.description,showClose:!0,onClose:h,icon:t.Edit,iconVariant:"subtle",helpText:c?/*#__PURE__*/e.jsx($g,{children:c}):void 0,primaryCta:{label:a.buttonText,onClick:u,disabled:o||s||l,loading:o},secondaryCta:d?{label:"Not now",onClick:p,disabled:o||s||l}:void 0,watermark:!0,children:/*#__PURE__*/e.jsxs(Qa,{children:[i?/*#__PURE__*/e.jsx(Dg,{style:{alignSelf:"center"},size:"sm",src:i,alt:"app image"}):null,/*#__PURE__*/e.jsxs(Vg,{children:["personal_sign"===n&&/*#__PURE__*/e.jsx(Gg,{children:Rg(r)}),"eth_signTypedData_v4"===n&&/*#__PURE__*/e.jsx(Ug,{typedData:r}),"solana_signMessage"===n&&/*#__PURE__*/e.jsx(Gg,{children:Og(r)})]})]})}),Hg={component:()=>{let{authenticated:t}=a.usePrivyContext(),{initializeWalletProxy:i,closePrivyModal:o}=r.usePrivyInternal(),{navigate:s,data:l,onUserCloseViaDialogOrKeybindRef:d}=Xn(),[u,p]=n.useState(!0),[h,g]=n.useState(""),[m,y]=n.useState(),[f,x]=n.useState(null),[v,w]=n.useState(!1);n.useEffect((()=>{t||s(cg)}),[t]),n.useEffect((()=>{i(3e4).then((e=>{p(!1),e||(g("An error has occurred, please try again."),y(new an(new rn(h,c.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:C,data:b,confirmAndSign:j,onSuccess:k,onFailure:T,uiOptions:A}=l.signMessage,S={title:A?.title||"Sign message",description:A?.description||"Signing this message will not cost you any fees.",buttonText:A?.buttonText||"Sign and continue"},E=e=>{e?k(e):T(m||new an(new rn("The user rejected the request.",c.ProviderErrors.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{x(null),g(""),y(void 0)}),200)};d.current=()=>{E(f)};/*#__PURE__*/return e.jsx(zg,{method:C,messageData:b,copy:S,iconUrl:A?.iconUrl&&"string"==typeof A.iconUrl?A.iconUrl:void 0,isLoading:v,success:null!==f,walletProxyIsLoading:u,errorMessage:h,isCancellable:A?.isCancellable,onSign:async()=>{w(!0),g("");try{let e=await j();x(e),w(!1),setTimeout((()=>{E(e)}),at)}catch(e){console.error(e),g("An error has occurred, please try again."),y(new an(new rn(h,c.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),w(!1)}},onCancel:()=>E(null),onClose:()=>E(f)})}};let Vg=/*#__PURE__*/i.styled.div.withConfig({displayName:"MessageContainer",componentId:"sc-e01d451f-0"})(["flex:1;display:flex;flex-direction:column;gap:16px;"]),$g=/*#__PURE__*/i.styled.p.withConfig({displayName:"ErrorText",componentId:"sc-e01d451f-1"})(["&&{margin:0;width:100%;text-align:center;color:var(--privy-color-error-dark);font-size:14px;line-height:22px;}"]),qg=/*#__PURE__*/i.styled(Xc).withConfig({displayName:"StyledDisplayJsonTree",componentId:"sc-e01d451f-2"})(["margin-top:0;"]),Gg=/*#__PURE__*/i.styled(Kc).withConfig({displayName:"StyledMessage",componentId:"sc-e01d451f-3"})(["margin-top:0;"]);exports.ASSOCIATED_TOKEN_PROGRAM_ID="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",exports.AccountNotFoundScreen=vs,exports.Address=Cs,exports.AffirmativeConsentScreen=nl,exports.AllowlistRejectionScreen=rc,exports.Apple=yt,exports.AuthenticateWithWalletScreen=xc,exports.AwaitingEvmToSolBridgingScreen=fp,exports.AwaitingExternalTransferScreen=xp,exports.AwaitingPasswordlessCodeScreen=Yh,exports.AwaitingSolToEvmBridgingScreen=wp,exports.BASE_ACCOUNT_DATA_URI=en,exports.Blobby=hn,exports.BlobbyFooter=xr,exports.BottomPusherContainer=$a,exports.Box=Ac,exports.BrowserExtensionWallet=mn,exports.ButtonLoader=Ar,exports.CLIENT_ANALYTICS_ID_KEY="privy:caid",exports.CODE_VERIFIER_KEY=st,exports.COINBASE_WALLET_DATA_URI=Jt,exports.CONNECTIONS_HISTORY_KEY=ct,exports.CUSTOMER_ACCESS_TOKEN_COOKIE_KEY="privy-token",exports.CUSTOMER_ACCESS_TOKEN_STORAGE_KEY="privy:token",exports.CaptchaError=$t,exports.CaptchaProvider=({children:t,id:r,captchaSiteKey:a,captchaEnabled:i})=>{let o=n.useRef(null),[s,l]=n.useState(),[c,u]=n.useState(),[p,h]=n.useState(!1),g=n.useMemo((()=>i?p||s||c?!p||s||c?s&&!c?{status:"success",token:s}:c?{status:"error",error:c}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[i,s,c,p]);/*#__PURE__*/return e.jsx(Vt.Provider,{value:{...g,ref:o,enabled:i,siteKey:a,appId:r,setToken:l,setError:u,setExecuting:h,remove(){i&&(o.current?.remove(),h(!1),u(void 0),l(void 0))},reset(){i&&(o.current?.reset(),h(!1),u(void 0),l(void 0))},execute(){i&&(h(!0),o.current?.execute())},async waitForResult(){if(!i)return"";try{return await function(e,{interval:t=100,timeout:n=5e3}={}){return new Promise(((r,a)=>{let i,o=0,s=()=>{o>=n?a("Max attempts reached without result"):(i=e(),o+=t,null==i?setTimeout(s,t):r(i))};s()}))}((()=>o.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new $t("Captcha failed",null,d.PrivyErrorCode.CAPTCHA_TIMEOUT)}}},children:t})},exports.CaptchaScreen=ic,exports.CenteredItem=qa,exports.CenteredItemWithGap=Za,exports.CenteredItemWithPadding=Ya,exports.CenteredScreenHeader=Ui,exports.Chip=xu,exports.Chip$1=Fl,exports.CloseButton=Nl,exports.ConnectEmailForm=tg,exports.ConnectOnlyLandingScreen=$p,exports.ConnectOnlyStatusScreen=Tu,exports.ConnectOrCreateScreen=Bh,exports.ConnectPhoneNumberForm=wh,exports.ConnectionLoader=Cr,exports.ConnectionStatusScreen=yc,exports.CopyableText=dl,exports.CopytoClipboardButton=Lg,exports.DEFAULT_API_TIMEOUT_MS=2e4,exports.DEFAULT_PRIVY_API_URL="https://auth.privy.io",exports.DEFAULT_SUCCESS_SCREEN_DURATION_MS=at,exports.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS=it,exports.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS=2500,exports.DEFAULT_TOKENS_DATA=La,exports.DEPRECATED_REFRESH_TOKEN="deprecated",exports.Discord=ft,exports.EmailUpdateForm=bl,exports.EmbeddedButton=Rr,exports.EmbeddedWalletConnectingScreen=Mg,exports.EmbeddedWalletKeyExportScreen=Ig,exports.EmbeddedWalletOnAccountCreateScreen=tl,exports.ErrorMessage=wl,exports.ErrorScreen=Rs,exports.ErrorScreenView=Ds,exports.EthereumNullConnector=gn,exports.EthereumWalletConnector=un,exports.Farcaster=qp,exports.FarcasterConnectStatusScreen=ah,exports.FundingMethodSelectionScreen=Vp,exports.Github=xt,exports.Google=vt,exports.Grow=ar,exports.HEADLESS_OAUTH_KEY="privy:headless_oauth",exports.Header=Pl,exports.Hide=pr,exports.IDENTITY_TOKEN_COOKIE_KEY="privy-id-token",exports.IDENTITY_TOKEN_STORAGE_KEY="privy:id_token",exports.InjectedWalletIcon=bu,exports.InputContainerForm=kl,exports.Instagram=wt,exports.JUPITER_SWAP_PROGRAM_IDS=["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"],exports.LAMPORTS_PER_SOL=Fa,exports.LabelSm=td,exports.LabelXs=kc,exports.LandingScreen=cg,exports.Line=Ct,exports.LinkConflictScreen=Qs,exports.LinkedIn=bt,exports.Loader=kr,exports.LoginMethodButton=dr,exports.LoginMethodIconWrapper=ur,exports.ManualTransferScreen=zc,exports.Metamask=yn,exports.ModalFooter=wr,exports.ModalHeader=Hr,exports.ModalProvider=t=>{let r=qn(),a=t.authenticated,[i,o]=n.useState(t.initialScreen);n.useEffect((()=>{a||!t.initialScreen||t.initialScreen.isUnauthenticatedScreem||t.setInitialScreen(null)}),[a]);let s=n.useRef(null);n.useEffect((()=>{t.open||(s.current=null)}),[t.open]),n.useEffect((()=>{s.current=null}),[t.initialScreen]);let l={data:t.data,setModalData:t.setModalData,currentScreen:t.initialScreen,lastScreen:i,navigate:(e,n=!0)=>{t.setInitialScreen(e),n&&o(t.initialScreen)},navigateBack:()=>{t.setInitialScreen(i)},resetNavigation:()=>{t.setInitialScreen(null),o(null)},onUserCloseViaDialogOrKeybindRef:s};/*#__PURE__*/return e.jsxs(Qn.Provider,{value:l,children:[("string"==typeof r.appearance.logo||"img"===r.appearance.logo?.type)&&/*#__PURE__*/e.jsx(Kn,{src:"string"==typeof r.appearance.logo?r.appearance.logo:r.appearance.logo.props.src}),t.children]})},exports.MoonpayStatusScreen=Lp,exports.NetworkIcon=qu,exports.NeutralSpinner=Kr,exports.OAUTH_DISABLE_SIGNUP_KEY="privy:oauth_disable_signup",exports.ON_RAMP_COMPLETE_ANALYTICS_EVENT=Wc,exports.OpenLinkButton=Gp,exports.PRIVY_ACCESS_TOKEN_STORAGE_KEY="privy:pat",exports.Phantom=fn,exports.PrimaryButton=Pr,exports.PrivyAppConfigProvider=({children:t,client:r,legacyClient:a,clientConfig:i,appClientId:o})=>{let[s,l]=n.useState(null),c=n.useMemo((()=>zn(s??Hn,i,!!s,"undefined"!=typeof window?window.location.origin:void 0,o)),[s,i,o]);return n.useEffect((()=>{if(!s)return;let e=function(e){if(!e)return{};let{appearance:t,supportedChains:n,defaultChain:r,externalWallets:a,...i}=e;return{...i,...n?{supportedChains:n.map((e=>e.id))}:void 0,...r?{defaultChain:r.id}:void 0,...a?{walletConnect:a.walletConnect?{enabled:a.walletConnect.enabled}:void 0,coinbaseWallet:a.coinbaseWallet,solana:{connectors:a.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0}}(i),t=function(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t,a=0;a<e.length;a++)n=Math.imul(n^(t=e.charCodeAt(a)),2654435761),r=Math.imul(r^t,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&(r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}(JSON.stringify(e)).toString(),n=`privy:sent:${s.id}:${t}`;localStorage.getItem(n)||(a.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(n,"t"))}),[i,s]),n.useEffect((()=>{s||(async()=>{try{await r.initialize();let e=r.app.getConfig();e.custom_api_url&&a.updateApiUrl(e.custom_api_url),l(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),/*#__PURE__*/e.jsx($n.Provider,{value:{appConfig:c,isServerConfigLoaded:!!s},children:t})},exports.PrivyEventsContext=Jn,exports.PrivyIframeError=Li,exports.PrivyPluginProvider=({children:t})=>{let r=n.useRef({});/*#__PURE__*/return e.jsx(Jl.Provider,{value:{plugins:r},children:t})},exports.PrivyProviderRpcError=an,exports.PrivyProxyProvider=pn,exports.QrCode=vl,exports.RAYDIUM_SWAP_PROGRAM_IDS=["CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C","CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"],exports.REFRESH_TOKEN_COOKIE_KEY="privy-refresh-token",exports.REFRESH_TOKEN_STORAGE_KEY="privy:refresh_token",exports.RecentlyUsedAccountProvider=({children:t})=>{let r=qn(),[a,i]=n.useState({});return tr("login",{onComplete:({loginAccount:e})=>{e&&"passkey"!==e.type&&"cross_app"!==e.type&&("wallet"!==e.type||"privy"!==e.walletClientType)&&(Ze.put(ns(r.id),e.type),"wallet"===e.type?(Ze.put(rs(r.id),e.walletClientType),Ze.put(as(r.id),e.chainType),i({accountType:e.type,walletClientType:e.walletClientType,chainType:e.chainType})):(Ze.del(rs(r.id)),Ze.del(as(r.id)),i({accountType:e.type})))}}),n.useEffect((()=>{if(!r.id)return;let e=Ze.get(ns(r.id)),t=Ze.get(rs(r.id)),n=Ze.get(as(r.id));e&&i("wallet"===e?{accountType:e,walletClientType:t,chainType:n}:{accountType:e})}),[r.id]),/*#__PURE__*/e.jsx(ts.Provider,{value:a,children:t})},exports.RefactorSpacerBottom=ei,exports.RefactorSpacerTop=Ja,exports.Row=id,exports.Rows=ad,exports.RunEffectOnce=rt,exports.SESSION_COOKIE_KEY="privy-session",exports.SOLANA_FUNDING_PLUGIN_ID=vp,exports.SOLANA_LEDGER_PLUGIN_ID=tc,exports.STATE_CODE_KEY=ot,exports.SYSTEM_PROGRAM_ID="11111111111111111111111111111111",exports.ScreenLayout=ba,exports.ScrollContainer=Ll,exports.SecondaryButton=Fr,exports.SendSolanaTransactionScreenView=({img:t,title:r,subtitle:a,cta:i,instructions:o,network:s,blockExplorerUrl:l,isMissingFunds:d,submitError:u,parseError:p,total:h,swap:g,transactingWalletAddress:m,fee:y,balance:f,disabled:x,isSubmitting:v,isPreparing:w,isTokenPriceLoading:C,onClick:b,onClose:j,onBack:k})=>{let T=w||C,[A,S]=n.useState(!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:j,backFn:k}),t&&/*#__PURE__*/e.jsx(Ed,{children:t}),/*#__PURE__*/e.jsx(jc,{style:{marginTop:t?"1.5rem":0},children:r}),/*#__PURE__*/e.jsx(bc,{children:a}),/*#__PURE__*/e.jsxs(ad,{style:{marginTop:"2rem",marginBottom:".5rem"},children:[(h||T)&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsx(ld,{$isLoading:T,children:h})]}),g&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Swap"}),/*#__PURE__*/e.jsx(ld,{children:g})]}),s&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Network"}),/*#__PURE__*/e.jsx(ld,{children:s})]}),(y||T)&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(ld,{$isLoading:T,children:y})]})]}),/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(rd,{onClick:()=>S((e=>!e)),children:[/*#__PURE__*/e.jsx("span",{children:"Advanced"}),/*#__PURE__*/e.jsx(B.ChevronDownIcon,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:A?"rotate(180deg)":void 0}})]})}),A&&/*#__PURE__*/e.jsx(e.Fragment,{children:o.map(((t,n)=>"sol-transfer"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Transfer ",t.withSeed?"with seed":""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsxs(ld,{children:[c.formatTokenAmount({amount:t.value,decimals:t.token.decimals})," ",t.token.symbol]})]}),!!t.toAccount&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Destination"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.toAccount,url:l})})]})]},n):"spl-transfer"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Transfer ",t.token.symbol]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsx(ld,{children:t.value.toString()})]}),!!t.fromAta&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Source"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.fromAta,url:l})})]}),!!t.toAta&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Destination"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.toAta,url:l})})]}),!!t.token.address&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.token.address,url:l})})]})]},n):"ata-creation"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsx(kc,{children:"Create token account"})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Program ID"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.program,url:l})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Owner"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.owner,url:l})})]})]},n):"create-account"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Create account ",t.withSeed?"with seed":""]})}),!!t.account&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Account"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.account,url:l})})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsxs(ld,{children:[c.formatTokenAmount({amount:t.value,decimals:9})," SOL"]})]})]},n):"spl-init-account"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsx(kc,{children:"Initialize token account"})}),!!t.account&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Account"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.account,url:l})})]}),!!t.mint&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Mint"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mint,url:l})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Owner"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.owner,url:l})})]})]},n):"spl-close-account"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsx(kc,{children:"Close token account"})}),!!t.source&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Source"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.source,url:l})})]}),!!t.destination&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Destination"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.destination,url:l})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Owner"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.owner,url:l})})]})]},n):"spl-sync-native"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsx(kc,{children:"Sync native"})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Program ID"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.program,url:l})})]})]},n):"raydium-swap-base-input"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Raydium swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount in"}),/*#__PURE__*/e.jsx(ld,{children:t.amountIn.toString()})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Minimum amount out"}),/*#__PURE__*/e.jsx(ld,{children:t.minimumAmountOut.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:l})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:l})})]})]},n):"raydium-swap-base-output"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Raydium swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Max amount in"}),/*#__PURE__*/e.jsx(ld,{children:t.maxAmountIn.toString()})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount out"}),/*#__PURE__*/e.jsx(ld,{children:t.amountOut.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:l})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:l})})]})]},n):"jupiter-swap-shared-accounts-route"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Jupiter swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"In amount"}),/*#__PURE__*/e.jsx(ld,{children:t.inAmount.toString()})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Quoted out amount"}),/*#__PURE__*/e.jsx(ld,{children:t.quotedOutAmount.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:l})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:l})})]})]},n):"jupiter-swap-exact-out-route"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Jupiter swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Quoted in amount"}),/*#__PURE__*/e.jsx(ld,{children:t.quotedInAmount.toString()})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount out"}),/*#__PURE__*/e.jsx(ld,{children:t.outAmount.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:l})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:l})})]})]},n):/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Program ID"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.program,url:l})})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Data"}),/*#__PURE__*/e.jsx(ld,{children:t.discriminator})]})]},n)))}),/*#__PURE__*/e.jsx(ar,{}),u?/*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:u.message}):p?/*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:Sd}):null,/*#__PURE__*/e.jsx(Td,{$useSmallMargins:!(!p&&!u),title:"Your wallet",address:m,balance:f,errMsg:w||p||u||!d?void 0:"Add funds on Solana to complete transaction."}),/*#__PURE__*/e.jsx(Pr,{style:{marginTop:"1rem"},loading:v,disabled:x||w,onClick:b,children:i}),/*#__PURE__*/e.jsx(xr,{})]})},exports.SendTransactionScreen=hu,exports.SignRequestScreen=Hg,exports.SiweFlow=Et,exports.SiwsFlow=Pt,exports.SolanaNullConnector=An,exports.SolanaPriceDisplay=({quantities:t,tokenPrice:n,tokenSymbol:r="SOL",tokenDecimals:a=9})=>{let i=t.reduce(((e,t)=>e+t),0n),o=n&&"SOL"===r&&9===a?Wa(i,n):void 0,s="SOL"===r&&9===a?Ra(i):`${l.formatUnits(i,a)} ${r}`;/*#__PURE__*/return e.jsx(Ua,{children:o?/*#__PURE__*/e.jsx(e.Fragment,{children:"<$0.01"===o?
27
+ /*#__PURE__*/e.jsxs(Va,{children:[/*#__PURE__*/e.jsx(Ha,{children:"<"}),"$0.01"]}):o}):s})},exports.SolanaWalletConnector=Tn,exports.Spotify=jt,exports.Subtitle=bc,exports.TOKEN_2022_PROGRAM_ID="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",exports.TOKEN_PROGRAM_ID="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",exports.TelegramAuthFlow=class{async authenticate(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(d.telegramAccountAuthenticatePath,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw d.formatApiError(e)}}async link(){if(!this.api)throw new d.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(d.telegramAccountLinkPath,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw d.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}},exports.TelegramAuthScreen=Ih,exports.Tiktok=kt,exports.Title=jc,exports.TodoItem=Su,exports.TodoList=Au,exports.TransactionDetails=Ti,exports.TransactionErrorView=_d,exports.TransferFromWalletScreen=bp,exports.Twitter=Tt,exports.UseWalletsContext=Pi,exports.UserLimitReachedScreen=hc,exports.VERSION="3.2.1",exports.Value=ld,exports.WALLET_PROXY_TIMEOUT=3e4,exports.WalletCards=Tl,exports.WalletConnectV2WalletConnector=Zn,exports.WalletConnector=cn,exports.WalletIcon=Ml,exports.WalletInfoCard=Fc,exports.WalletLink=ji,exports.areWalletArraysEqual=ln,exports.close=()=>{let e=Wl.getState().resolvers;e||console.warn("useActiveWalletStore: Called close while modal was not open"),Wl.setState({isModalOpen:!1}),e?.resolve({wallet:Wl.getState().wallet})},exports.convertInitDataRawToTelegramWebAppData=Yt,exports.createCodeVerifier=pt,exports.createStateCode=ht,exports.createWalletAtIndex=Ki,exports.deriveCodeChallengeFromCodeVerifier=gt,exports.detectCompletingTelegramFlow=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),n=e.get("hash"),r=Number(e.get("auth_date")||""),a=e.get("first_name");if(t&&a&&r&&n)return Object.fromEntries(e.entries())}())?(Zt(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=Yt(e.replace("#tgWebAppData=","")),{user:n,auth_date:r,hash:a}=t;return n&&r&&a?t:void 0}())?(Zt(),{flowType:"web-app",authData:e}):void 0},exports.detectInjectedConnectors=async function({store:e,walletList:t,externalWalletConfig:n,walletChainType:r,timeout:a=3e3}){let i=!1,o=window;return new Promise((s=>{function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);let a=e.getProviders();console.debug("Detected injected providers:",a.map((e=>e.info)));let o=[];for(let e of a)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===r&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==r)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let n=[];if(t.providers?.length)for(let e of t.providers)e&&n.push(e);return n.push(e.ethereum),n}()){let t=Nt(e);if(!a.some((e=>e.info.name===t))){if(_t(e,!0)&&!o.find((e=>"metamask"===e.type))){o.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!o.find((e=>"phantom"===e.type))){o.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!o.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==n.coinbaseWallet?.config?.preference?.options))){o.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}o.find((e=>"unknown_browser_extension"===e.type))||o.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}s(o)}o.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout((()=>{l()}),a))}))},exports.e=mt,exports.e$1=function(){try{let e="privy:__session_storage__test",t=new Ye;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}},exports.e$2=Mi,exports.e$3=ju,exports.embeddedWalletRecoveryScreen=bg,exports.emitPrivyEvent=nr,exports.errorIndicatesMaxMfaRetries=function(e){return!!Wi(e)&&"mfa_verification_max_attempts_reached"===e.type},exports.errorIndicatesMfaCanceled=function(e){return!!function(e){let t=e.type;return"string"==typeof t&&"client_error"===t}(e)&&"MFA canceled"===e.message},exports.errorIndicatesMfaRateLimit=function(e){return!(!Wi(e)||!e.message.includes("code 429"))},exports.errorIndicatesMfaTimeout=function(e){return!!Wi(e)&&"mfa_timeout"===e.type},exports.errorIndicatesMfaVerificationFailed=function(e){return!!Wi(e)&&"missing_or_invalid_mfa"===e.type},exports.errorIndicatesRecoveryIsNeeded=Di,exports.fetchWalletBalance=Dc,exports.formatChainIdToCAIP2=zt,exports.formatConnectorError=nn,exports.formatErc20TokenAmount=Yc,exports.formatWalletAddress=Dt,exports.generateTypedDataWithDomainType=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},n=e.types.EIP712Domain??Object.entries(e.domain).map((([e,n])=>{if(null!=n&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:n}}},exports.getChainName=Rc,exports.getCodeVerifier=function(){let e=Ze.get(st);if(!e)throw new d.PrivyClientError("Authentication error.");return e},exports.getEntropyDetailsForUser=Qt,exports.getErc20Balance=Bc,exports.getErc20TokenInfo=$c,exports.getFormattedUsdFromLamports=Wa,exports.getGuestCredentialStorageKey=e=>`privy:guest:${e}`,exports.getJsonRpcEndpointFromChain=Lt,exports.getNativeCurrencyFromLamports=Ra,exports.getNativeCurrencyFromWei=Pa,exports.getPrivyWalletsWithFilter=Zi,exports.getProviderAccessTokenStorageKey=e=>`privy:cross-app:${e}`,exports.getPublicClient=Ft,exports.getRpcTimeout=dn,exports.getUsdcMintAddress=Oc,exports.getWalletConfigForConnector=wn,exports.i=gu,exports.invokeUntilSettled=Bt,exports.isBaseConnectedEthereumWallet=sn,exports.isBaseConnectedSolanaWallet=function(e){return"solana"===e.type},exports.isEthereumWalletConnector=function(e){return"ethereum"===e.chainType},exports.isSolanaWalletConnector=Sn,exports.l=Hl,exports.loadConnectionHistory=bn,exports.mobileWalletsConfig=vn,exports.open=async()=>{let e,t,n=new Promise(((n,r)=>{e=n,t=r}));return Dl.setState({}),Wl.setState({isModalOpen:!0,resolvers:{resolve:e,reject:t}}),await n},exports.openHref=nt,exports.parseAdditionalSigners=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds}))),exports.prepareSiweMessageWithNonce=St,exports.prepareSiwsMessageWithNonce=It,exports.prepareTransactionRequest=_i,exports.privyEventsDefault={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},connectOrCreateWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},update:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},signTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},fundSolanaWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},exports.randomBytes=ut,exports.s=Ze,exports.setActiveWallet=Rl,exports.setExternalWalletState=In,exports.shouldCreateEmbeddedEthWallet=hs,exports.shouldCreateEmbeddedSolWallet=ms,exports.shouldProceedtoEmbeddedWalletCreationFlow=fs,exports.stripUrlOAuthParamsAndRemoveStateCode=At,exports.toActiveWalletKey=Ol,exports.toDisplayFromAccountType=es,exports.toEmbeddedWalletSetRecoveryScreen=Cg,exports.toHex=e=>"string"==typeof e?e:"0x"+e.toString(16),exports.toSolanaWalletClientType=kn,exports.triggerPopup=Ri,exports.updateBalance=(e,t,n)=>{Dl.setState((r=>({[e]:{...r[e],[t]:n}})))},exports.useActiveWalletStore=Wl,exports.useAppConfig=qn,exports.useBalance=(e,t)=>Dl((n=>n[e]?.[t])),exports.useCaptcha=qt,exports.useEmitPrivyEvent=rr,exports.useGetSolPrice=Ei,exports.useGetTokenPrice=Ii,exports.useIsModalOpen=()=>Wl((e=>e.isModalOpen)),exports.useIsServerConfigLoaded=()=>{let{isServerConfigLoaded:e}=n.useContext($n);return e},exports.usePlugins=ec,exports.usePrivyEventSubscription=tr,exports.usePrivyModal=Xn,exports.useRecentlyUsedLogin=is,exports.useRegisterPlugin=(...e)=>{let{plugins:t}=n.useContext(Jl);n.useEffect((()=>{for(let n of e)t.current[n.id]=n;return()=>{for(let n of e)delete t.current[n.id]}}),[t])},exports.useWalletBalance=Lc,exports.useWallets=Ni,exports.validateEmail=Wt;