@dcl/auth-site 4.21.1-30282291998.commit-7741200 → 4.21.1-30289583460.commit-46bdbdf

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 (127) hide show
  1. package/assets/{ConstantsUtil-B_1wG5vR.js → ConstantsUtil-Cw4CyveW.js} +1 -1
  2. package/assets/{ContentfulRichText-CVKevVe4.js → ContentfulRichText-BT96-A7w.js} +1 -1
  3. package/assets/{ExchangeController-DCZepsks.js → ExchangeController-BIE70uXJ.js} +1 -1
  4. package/assets/{HelpersUtil-D4gwnK8D.js → HelpersUtil-COH6r2kA.js} +1 -1
  5. package/assets/{LoginPage-huBKWGlx.js → LoginPage-fSUgfU4P.js} +1 -1
  6. package/assets/{NetworkUtil-CBP75VjE.js → NetworkUtil-BGKHKoaf.js} +1 -1
  7. package/assets/{SwapController-DbOnmtjm.js → SwapController-CYoV1KaM.js} +1 -1
  8. package/assets/{W3MFrameProviderSingleton-6cmMN1JV.js → W3MFrameProviderSingleton-BKmP_oxD.js} +3 -3
  9. package/assets/{biconomy-D1EXxA7F.js → biconomy-C7o8zrOF.js} +1 -1
  10. package/assets/{browser-wIrNP8-L.js → browser-jyTXFcNa.js} +1 -1
  11. package/assets/browser-ponyfill-DoK0rGNS.js +1 -0
  12. package/assets/{ccip-bk9Msknv.js → ccip-0sHJmZED.js} +1 -1
  13. package/assets/{ccip-DVeSiGJW.js → ccip-_D3P6GZf.js} +1 -1
  14. package/assets/{chains-YJh_kwoG.js → chains-DPTnBL64.js} +1 -1
  15. package/assets/{common-DAd2b35c.js → common-CHSeSCWT.js} +1 -1
  16. package/assets/controller-C64KTqP4.js +2 -0
  17. package/assets/{data-capture-B8eCUIcE.js → data-capture-Cx4b9vYS.js} +1 -1
  18. package/assets/{email-KCXiMYF3.js → email-BQdM1ASh.js} +1 -1
  19. package/assets/{embedded-wallet-B_wovPbN.js → embedded-wallet-CXUgkaij.js} +1 -1
  20. package/assets/{engine-osc-auGv.js → engine-DN05o7om.js} +1 -1
  21. package/assets/{estimate-l1-fee-D12BfRq0.js → estimate-l1-fee--u86zfdZ.js} +1 -1
  22. package/assets/{ethereum-CuwXPURS.js → ethereum-CJbf5HCu.js} +1 -1
  23. package/assets/extractIPFS-DJBAzpfR.js +1 -0
  24. package/assets/{features-cMphHD0m.js → features-BaQq55bG.js} +1 -1
  25. package/assets/{fetchTokenMetadata-CzzqUD_C.js → fetchTokenMetadata-C1ngO7HU.js} +1 -1
  26. package/assets/{fortmatic-BtfrNeKp.js → fortmatic-CM-36WpK.js} +1 -1
  27. package/assets/get-ecosystem-wallet-info-D3mZ828S.js +1 -0
  28. package/assets/getBalance-DMdDUfLy.js +1 -0
  29. package/assets/{getInstalledModules-B-RsE287.js → getInstalledModules-DOdq5s84.js} +1 -1
  30. package/assets/{getNFT-BqbjDGbh.js → getNFT-B8132wTr.js} +2 -2
  31. package/assets/{getNFT-ClUfSxlO.js → getNFT-Df4p3NnO.js} +1 -1
  32. package/assets/{if-defined-Dwq8XpDA.js → if-defined-Bl8a4ab-.js} +1 -1
  33. package/assets/in-app-DOg1gcN6.js +2 -0
  34. package/assets/{in-app-wallet-calls-CwwQ0VDY.js → in-app-wallet-calls-C3XXM2uK.js} +1 -1
  35. package/assets/{index-Cd2xcopx.js → index--khZ3g0E.js} +2 -2
  36. package/assets/{index-CdCvLGtn.js → index-456fp1SV.js} +1 -1
  37. package/assets/{index-BYtVMjMf.js → index-5JpvePdb.js} +1 -1
  38. package/assets/{index-Ccb5UGcf.js → index-B1wz7Owl.js} +1 -1
  39. package/assets/{index-h6jcLaB2.js → index-BCq7sn5F.js} +1 -1
  40. package/assets/{index-DSJjx9ay.js → index-BKdNzTPl.js} +3 -3
  41. package/assets/{index-BsZyT53i.js → index-BMLKyv2l.js} +4 -4
  42. package/assets/{index-C9_jeDSj.js → index-BX3tZejP.js} +1 -1
  43. package/assets/{index-D8Nn1xAf.js → index-BazvSf0U.js} +1 -1
  44. package/assets/{index-DfgJOosn.js → index-Bc52X0iQ.js} +1 -1
  45. package/assets/{index-DYa4iVZE.js → index-Bk62IJ7q.js} +1 -1
  46. package/assets/{index-BobruL3O.js → index-BtsxTU_X.js} +1 -1
  47. package/assets/{index-BruZTjHN.js → index-Bx5a0Vg2.js} +1 -1
  48. package/assets/{index-Ba0jOwXj.js → index-C8c8VNHR.js} +1 -1
  49. package/assets/{index-CXiI9rXS.js → index-CB0KMBUn.js} +1 -1
  50. package/assets/{index-BJ89t_bW.js → index-CBS6SUOD.js} +1 -1
  51. package/assets/{index-V_1m0BwN.js → index-CMn1rqzs.js} +1 -1
  52. package/assets/{index-DEq1ZWKa.js → index-CPSrsrPD.js} +1 -1
  53. package/assets/{index-uKJ0cyDb.js → index-CT312b_h.js} +1 -1
  54. package/assets/{index-BsreR9g6.js → index-CTYL6USa.js} +1 -1
  55. package/assets/{index-BU6y379O.js → index-CZmexbhB.js} +1 -1
  56. package/assets/{index-DBw0yfGw.js → index-CfMamdHz.js} +1 -1
  57. package/assets/{index-D5fxp13X.js → index-CjOKquSH.js} +1 -1
  58. package/assets/{index-DbZ3_lNw.js → index-Cuhzd-33.js} +1 -1
  59. package/assets/{index-C9iDQul-.css → index-CujiQKjN.css} +1 -1
  60. package/assets/{index-BF1p7C7k.js → index-CwCHLbKJ.js} +1 -1
  61. package/assets/{index-CoAewCyo.js → index-D2phLp5f.js} +1 -1
  62. package/assets/index-D3gAQcpU.js +2 -0
  63. package/assets/{index-FZIobYEj.js → index-D3ndDNzn.js} +1 -1
  64. package/assets/index-DAclPpwc.js +4 -0
  65. package/assets/{index-D_t2cwDH.js → index-DAoXeY-7.js} +1 -1
  66. package/assets/{index-B3SuCFE2.js → index-DDa27cxc.js} +1 -1
  67. package/assets/{index-CcViJ9mC.js → index-DK67hOZb.js} +1 -1
  68. package/assets/{index-K0isSq0K.js → index-DKNEknrt.js} +1 -1
  69. package/assets/{index-CDvT4Q_g.js → index-DLDBtSCZ.js} +1 -1
  70. package/assets/{index-9l0HFt0G.js → index-DPWHpwh1.js} +13 -13
  71. package/assets/{index-CSX8lAoJ.js → index-DYaEHsOY.js} +1 -1
  72. package/assets/{index-DPQoS-8z.js → index-Dhjx38e5.js} +1 -1
  73. package/assets/{index-G5i3_Lok.js → index-Di_Hl_iK.js} +1 -1
  74. package/assets/{index-IxWsvkDr.js → index-Dk7lZXfn.js} +1 -1
  75. package/assets/{index-BITcR_1M.js → index-DkXO_kZj.js} +1 -1
  76. package/assets/{index-rfFvOinV.js → index-Z08B4dd3.js} +1 -1
  77. package/assets/{index-BVcKuMWZ.js → index-ZGp_PUF2.js} +1 -1
  78. package/assets/{index-BD9BBG_e.js → index-aZ_z0i3j.js} +1 -1
  79. package/assets/{index-Bf_ty5ez.js → index-bW418N1D.js} +1 -1
  80. package/assets/{index-BqWHQlqc.js → index-n7PJcE82.js} +1 -1
  81. package/assets/{index-CrfS5O-x.js → index-r-swI_-s.js} +1 -1
  82. package/assets/{index-BYN2eN-f.js → index-tF1SLBXL.js} +1 -1
  83. package/assets/{index-BdHhENX2.js → index-wL64_peq.js} +1 -1
  84. package/assets/{index.es-CB-yvhhh.js → index.es-BOYbQise.js} +1 -1
  85. package/assets/index.es-DRRWBSJv.js +1 -0
  86. package/assets/linkAccount-C5bSjc1T.js +1 -0
  87. package/assets/{native-DjcSPn6B.js → native-CV5tv0TG.js} +1 -1
  88. package/assets/{networks-CwDBKQsQ.js → networks-C86eT1TG.js} +3 -3
  89. package/assets/{onramp-DCE_9jgB.js → onramp-BOODe8UW.js} +1 -1
  90. package/assets/{openzeppelin-DXl3mu84.js → openzeppelin-D68EAkgg.js} +1 -1
  91. package/assets/{ownerOf-DShKXZbk.js → ownerOf-CursHafI.js} +1 -1
  92. package/assets/{parseNft-BszEZh2L.js → parseNft-n7ZvU0Fd.js} +2 -2
  93. package/assets/{pay-with-exchange-BWZMELae.js → pay-with-exchange-WgJKv9uo.js} +1 -1
  94. package/assets/{qr-overlay-Def5vMYS.js → qr-overlay-D8U0fVP-.js} +3 -3
  95. package/assets/{receive-B4cKA7x5.js → receive-BqvjZCLR.js} +1 -1
  96. package/assets/{ref-jo_MQhC5.js → ref-kgQxGa5I.js} +1 -1
  97. package/assets/{resolveImplementation-uCCZnkqv.js → resolveImplementation-B4GM10am.js} +1 -1
  98. package/assets/secp256k1-CpwTLmAw.js +1 -0
  99. package/assets/{send-Cpin8S8F.js → send-BL378Uzh.js} +1 -1
  100. package/assets/{send-eip712-transaction-fuVr-0Wu.js → send-eip712-transaction-u41VUUSa.js} +1 -1
  101. package/assets/{send-gasless-transaction-U_MTNGJG.js → send-gasless-transaction-Bv-SeN6V.js} +2 -2
  102. package/assets/session-proposal-C8n_HnVT.js +1 -0
  103. package/assets/session-request-CObMtvdb.js +2 -0
  104. package/assets/{socials-DHfbWrjU.js → socials-D4dvlXCA.js} +1 -1
  105. package/assets/{swaps-DcK0ETDM.js → swaps-V4FJcglk.js} +1 -1
  106. package/assets/{thirdweb-CS6G_ZNe.js → thirdweb-129NE2Ul.js} +6 -6
  107. package/assets/{totalSupply-CrDdlqEX.js → totalSupply-DO_2zgMa.js} +1 -1
  108. package/assets/{transactions-vDZ5yeRz.js → transactions-Bmdan2s3.js} +1 -1
  109. package/assets/types-DC0Zmj1B.js +1 -0
  110. package/assets/{ui-Bc2xTSCT.js → ui-C5Ow-sF2.js} +5 -5
  111. package/assets/{vendor-DgCFzUFU.js → vendor-DTjic7dc.js} +1 -1
  112. package/assets/{w3m-modal-w4bBHHnI.js → w3m-modal-CfVCaJKp.js} +1 -1
  113. package/assets/wallets-B4VDiGHH.js +12 -0
  114. package/assets/{web-connector-B_ZD1CLE.js → web-connector-DNU9LISy.js} +3 -3
  115. package/index.html +5 -5
  116. package/package.json +3 -3
  117. package/assets/browser-ponyfill-CfapXlLj.js +0 -1
  118. package/assets/controller-BL5ery_A.js +0 -2
  119. package/assets/extractIPFS-JSayXYon.js +0 -1
  120. package/assets/get-ecosystem-wallet-info-Cm-kfk0m.js +0 -1
  121. package/assets/getBalance-CwsaSxen.js +0 -1
  122. package/assets/index-DmH4eVyc.js +0 -2
  123. package/assets/index.es-B3Gbdgyi.js +0 -1
  124. package/assets/secp256k1-CKK4gwjJ.js +0 -1
  125. package/assets/session-proposal-BCeFOzD0.js +0 -1
  126. package/assets/session-request-CSPRWfOh.js +0 -2
  127. package/assets/wallets-CUOtYiA7.js +0 -14
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/in-app-wallet-calls-CwwQ0VDY.js","assets/thirdweb-CS6G_ZNe.js","assets/passkeys-C1wTOzLk.js","assets/uint8-array-DZKEMhA1.js"])))=>i.map(i=>d[i]);
2
- import{ab as p,as as g,s as w,o as q,b as I,f as y,_ as b,at as Q,l as P,P as D,t as F,N as A,F as H,au as k,av as O,aw as J}from"./thirdweb-CS6G_ZNe.js";import{a0 as Y,p as U,a1 as N,a2 as B,a3 as Z,a4 as K,a5 as X,a6 as ee,a7 as te}from"./wallets-CUOtYiA7.js";import"./store-CraP4F4Y.js";import"./ui-Bc2xTSCT.js";import"./vendor-DgCFzUFU.js";import"./index-9l0HFt0G.js";import"./index-V_1m0BwN.js";import"./index-C9_jeDSj.js";import"./index-nibyPLVP.js";import"./ethereum-CuwXPURS.js";const T=new Map,ie={getItem:async i=>T.get(i)??null,removeItem:async i=>{T.delete(i)},setItem:async(i,e)=>{T.set(i,e)}};async function W({authToken:i,client:e,ecosystem:t}){const r=await p(e,t)(`${g("inAppWallet")}/api/2024-05-05/accounts`,{headers:{Authorization:`Bearer embedded-wallet-token:${i}`,"Content-Type":"application/json"},method:"GET"});if(!r.ok){const l=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to get user info: ${l}`)}return await r.json()}const ae=g("inAppWallet"),ne=`${ae}/`,R=`${ne}api/2023-10-20`,re=`${R}/embedded-wallet/validate-custom-jwt`,se=`${R}/embedded-wallet/validate-custom-auth-endpoint`,M=(i,e)=>e instanceof Error?`${i}: ${e.message}`:`${i}: ${w(e)}`;async function oe(i){const t=await p(i.client,i.ecosystem)(se,{body:w({developerClientId:i.client.clientId,payload:i.payload}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`Custom auth endpoint authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post auth_endpoint authentication",a))}}const z=i=>{if(!Y.includes(i))throw new Error(`Unknown auth option ${i}`);switch(i){case"wallet":return"siwe";default:return i}},v=({authOption:i,client:e,ecosystem:t,mode:a="popup",redirectUrl:r,authFlow:l})=>{if(a==="popup"&&r)throw new Error("Redirect URL is not supported for popup mode");if(a==="window"&&!r)throw new Error("Redirect URL is required for window mode");const c=z(i);let n=`${g("inAppWallet")}/api/2024-05-05/login/${c}?clientId=${e.clientId}`;if(t!=null&&t.partnerId?n=`${n}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(n=`${n}&ecosystemId=${t.id}`),a!=="popup"){const o=new URL(r||window.location.href);o.searchParams.set("walletId",(t==null?void 0:t.id)||"inApp"),o.searchParams.set("authProvider",i),l&&o.searchParams.set("authFlow",l),n=`${n}&redirectUrl=${encodeURIComponent(o.toString())}`}return n},S=({authOption:i,client:e,ecosystem:t})=>{const a=z(i);let r=`${g("inAppWallet")}/api/2024-05-05/login/${a}/callback?clientId=${e.clientId}`;return t!=null&&t.partnerId?r=`${r}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(r=`${r}&ecosystemId=${t.id}`),r};async function ce(i){const e=p(i.client,i.ecosystem),t=v({authOption:"backend",client:i.client,ecosystem:i.ecosystem}),a=await e(`${t}`,{body:w({walletSecret:i.walletSecret}),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok){const r=await a.text();throw new Error(`Failed to generate backend account: ${r}`)}return await a.json()}async function le(i){let e=await i.storage.getGuestSessionId();e||(e=q(32),i.storage.saveGuestSessionId(e));const t=p(i.client,i.ecosystem),a=S({authOption:"guest",client:i.client,ecosystem:i.ecosystem}),r=await t(`${a}`,{body:w({sessionId:e}),headers:{"Content-Type":"application/json"},method:"POST"});if(!r.ok){const l=await r.text();throw new Error(`Failed to generate guest account: ${r.status} ${r.statusText} ${l}`)}return await r.json()}async function de(i){const t=await p(i.client,i.ecosystem)(re,{body:w({developerClientId:i.client.clientId,jwt:i.jwt}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`JWT authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post jwt authentication",a))}}function x(){return`${g("inAppWallet")}/api/2024-05-05/login/passkey/callback`}function G(i,e){return`${g("inAppWallet")}/api/2024-05-05/login/passkey?type=${i}${e?`&username=${e}`:""}`}async function ue(i){var d,u,h;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=p(i.client,i.ecosystem),t=i.username??we(i.ecosystem),r=await(await e(G("sign-up",t))).json();if(!r.challenge)throw new Error("No challenge received");const l=r.challenge,c=await i.passkeyClient.register({challenge:l,name:t,rp:i.rp}),n={};(d=i.ecosystem)!=null&&d.partnerId&&(n["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(u=i.ecosystem)!=null&&u.id&&(n["x-ecosystem-id"]=i.ecosystem.id);const s=await(await e(x(),{body:w({authenticatorData:c.authenticatorData,clientData:c.clientData,credential:{algorithm:c.credential.algorithm,publicKey:c.credential.publicKey},credentialId:c.credentialId,origin:c.origin,rpId:i.rp.id,serverVerificationId:r.serverVerificationId,type:"sign-up",username:t}),headers:{"Content-Type":"application/json",...n},method:"POST"})).json();if(!s||!s.storedToken)throw new Error(`Error verifying passkey: ${s.message??"unknown error"}`);return await((h=i.storage)==null?void 0:h.savePasskeyCredentialId(c.credentialId)),s}async function he(i){var s,d,u,h;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=p(i.client,i.ecosystem),[t,a]=await Promise.all([e(G("sign-in")).then(f=>f.json()),(s=i.storage)==null?void 0:s.getPasskeyCredentialId()]);if(!t.challenge)throw new Error("No challenge received");const r=t.challenge,l=await i.passkeyClient.authenticate({challenge:r,credentialId:a??void 0,rp:i.rp}),c={};(d=i.ecosystem)!=null&&d.partnerId&&(c["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(u=i.ecosystem)!=null&&u.id&&(c["x-ecosystem-id"]=i.ecosystem.id);const o=await(await e(x(),{body:w({authenticatorData:l.authenticatorData,clientData:l.clientData,credentialId:l.credentialId,origin:l.origin,rpId:i.rp.id,serverVerificationId:t.serverVerificationId,signature:l.signature,type:"sign-in"}),headers:{"Content-Type":"application/json",...c},method:"POST"})).json();if(!o||!o.storedToken)throw new Error(`Error verifying passkey: ${o.message??"unknown error"}`);return await((h=i.storage)==null?void 0:h.savePasskeyCredentialId(l.credentialId)),o}function we(i){return`${(i==null?void 0:i.id)??"wallet"}-${new Date().toISOString()}`}function pe(i){let a=[`${i.domain} wants you to sign in with your Ethereum account:`,i.address].join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/in-app-wallet-calls-C3XXM2uK.js","assets/thirdweb-129NE2Ul.js","assets/passkeys-C1wTOzLk.js","assets/uint8-array-DZKEMhA1.js"])))=>i.map(i=>d[i]);
2
+ import{a0 as p,$ as g,s as w,o as q,b as I,f as y,_ as b,az as Q,l as P,P as D,t as F,N as A,F as H,aA as k,aB as O,aC as J}from"./thirdweb-129NE2Ul.js";import{p as U,C as N,w as B,I as Y,l as Z,u as K,g as X}from"./linkAccount-C5bSjc1T.js";import{a as ee,s as te}from"./types-DC0Zmj1B.js";const T=new Map,ie={getItem:async i=>T.get(i)??null,removeItem:async i=>{T.delete(i)},setItem:async(i,e)=>{T.set(i,e)}};async function W({authToken:i,client:e,ecosystem:t}){const r=await p(e,t)(`${g("inAppWallet")}/api/2024-05-05/accounts`,{headers:{Authorization:`Bearer embedded-wallet-token:${i}`,"Content-Type":"application/json"},method:"GET"});if(!r.ok){const l=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to get user info: ${l}`)}return await r.json()}const ae=g("inAppWallet"),ne=`${ae}/`,R=`${ne}api/2023-10-20`,re=`${R}/embedded-wallet/validate-custom-jwt`,se=`${R}/embedded-wallet/validate-custom-auth-endpoint`,M=(i,e)=>e instanceof Error?`${i}: ${e.message}`:`${i}: ${w(e)}`;async function oe(i){const t=await p(i.client,i.ecosystem)(se,{body:w({developerClientId:i.client.clientId,payload:i.payload}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`Custom auth endpoint authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post auth_endpoint authentication",a))}}const z=i=>{if(!ee.includes(i))throw new Error(`Unknown auth option ${i}`);switch(i){case"wallet":return"siwe";default:return i}},v=({authOption:i,client:e,ecosystem:t,mode:a="popup",redirectUrl:r,authFlow:l})=>{if(a==="popup"&&r)throw new Error("Redirect URL is not supported for popup mode");if(a==="window"&&!r)throw new Error("Redirect URL is required for window mode");const c=z(i);let n=`${g("inAppWallet")}/api/2024-05-05/login/${c}?clientId=${e.clientId}`;if(t!=null&&t.partnerId?n=`${n}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(n=`${n}&ecosystemId=${t.id}`),a!=="popup"){const o=new URL(r||window.location.href);o.searchParams.set("walletId",(t==null?void 0:t.id)||"inApp"),o.searchParams.set("authProvider",i),l&&o.searchParams.set("authFlow",l),n=`${n}&redirectUrl=${encodeURIComponent(o.toString())}`}return n},S=({authOption:i,client:e,ecosystem:t})=>{const a=z(i);let r=`${g("inAppWallet")}/api/2024-05-05/login/${a}/callback?clientId=${e.clientId}`;return t!=null&&t.partnerId?r=`${r}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(r=`${r}&ecosystemId=${t.id}`),r};async function ce(i){const e=p(i.client,i.ecosystem),t=v({authOption:"backend",client:i.client,ecosystem:i.ecosystem}),a=await e(`${t}`,{body:w({walletSecret:i.walletSecret}),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok){const r=await a.text();throw new Error(`Failed to generate backend account: ${r}`)}return await a.json()}async function le(i){let e=await i.storage.getGuestSessionId();e||(e=q(32),i.storage.saveGuestSessionId(e));const t=p(i.client,i.ecosystem),a=S({authOption:"guest",client:i.client,ecosystem:i.ecosystem}),r=await t(`${a}`,{body:w({sessionId:e}),headers:{"Content-Type":"application/json"},method:"POST"});if(!r.ok){const l=await r.text();throw new Error(`Failed to generate guest account: ${r.status} ${r.statusText} ${l}`)}return await r.json()}async function de(i){const t=await p(i.client,i.ecosystem)(re,{body:w({developerClientId:i.client.clientId,jwt:i.jwt}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`JWT authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post jwt authentication",a))}}function x(){return`${g("inAppWallet")}/api/2024-05-05/login/passkey/callback`}function G(i,e){return`${g("inAppWallet")}/api/2024-05-05/login/passkey?type=${i}${e?`&username=${e}`:""}`}async function ue(i){var d,u,h;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=p(i.client,i.ecosystem),t=i.username??we(i.ecosystem),r=await(await e(G("sign-up",t))).json();if(!r.challenge)throw new Error("No challenge received");const l=r.challenge,c=await i.passkeyClient.register({challenge:l,name:t,rp:i.rp}),n={};(d=i.ecosystem)!=null&&d.partnerId&&(n["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(u=i.ecosystem)!=null&&u.id&&(n["x-ecosystem-id"]=i.ecosystem.id);const s=await(await e(x(),{body:w({authenticatorData:c.authenticatorData,clientData:c.clientData,credential:{algorithm:c.credential.algorithm,publicKey:c.credential.publicKey},credentialId:c.credentialId,origin:c.origin,rpId:i.rp.id,serverVerificationId:r.serverVerificationId,type:"sign-up",username:t}),headers:{"Content-Type":"application/json",...n},method:"POST"})).json();if(!s||!s.storedToken)throw new Error(`Error verifying passkey: ${s.message??"unknown error"}`);return await((h=i.storage)==null?void 0:h.savePasskeyCredentialId(c.credentialId)),s}async function he(i){var s,d,u,h;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=p(i.client,i.ecosystem),[t,a]=await Promise.all([e(G("sign-in")).then(f=>f.json()),(s=i.storage)==null?void 0:s.getPasskeyCredentialId()]);if(!t.challenge)throw new Error("No challenge received");const r=t.challenge,l=await i.passkeyClient.authenticate({challenge:r,credentialId:a??void 0,rp:i.rp}),c={};(d=i.ecosystem)!=null&&d.partnerId&&(c["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(u=i.ecosystem)!=null&&u.id&&(c["x-ecosystem-id"]=i.ecosystem.id);const o=await(await e(x(),{body:w({authenticatorData:l.authenticatorData,clientData:l.clientData,credentialId:l.credentialId,origin:l.origin,rpId:i.rp.id,serverVerificationId:t.serverVerificationId,signature:l.signature,type:"sign-in"}),headers:{"Content-Type":"application/json",...c},method:"POST"})).json();if(!o||!o.storedToken)throw new Error(`Error verifying passkey: ${o.message??"unknown error"}`);return await((h=i.storage)==null?void 0:h.savePasskeyCredentialId(l.credentialId)),o}function we(i){return`${(i==null?void 0:i.id)??"wallet"}-${new Date().toISOString()}`}function pe(i){let a=[`${i.domain} wants you to sign in with your Ethereum account:`,i.address].join(`
3
3
  `);a=[a,i.statement].join(`
4
4
 
5
5
  `),i.statement&&(a+=`
6
6
  `);const r=[];if(i.uri){const d=`URI: ${i.uri}`;r.push(d)}const l=`Version: ${i.version}`;if(r.push(l),i.chain_id){const d=`Chain ID: ${i.chain_id}`||"1";r.push(d)}const c=`Nonce: ${i.nonce}`;r.push(c);const n=`Issued At: ${i.issued_at}`;r.push(n);const o=`Expiration Time: ${i.expiration_time}`;if(r.push(o),i.invalid_before){const d=`Not Before: ${i.invalid_before}`;r.push(d)}i.resources&&r.push(["Resources:",...i.resources.map(d=>`- ${d}`)].join(`
7
7
  `));const s=r.join(`
8
8
  `);return[a,s].join(`
9
- `)}async function ge(i){const{payload:e,account:t}=i,a=await t.signMessage({message:pe(e)});return{payload:e,signature:a}}const me=["xyz.abs"];async function fe(i){const{wallet:e,client:t,ecosystem:a,chain:r}=i,l=me.includes(e.id)?r||I(1):I(1),c=e.getAccount()||await e.connect({chain:l,client:t}),n=p(t,a),o=await(async()=>{const u=v({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),h=await n(`${u}&address=${c.address}&chainId=${l.id}`);if(!h.ok)throw new Error("Failed to generate SIWE login payload");return await h.json()})(),{signature:s}=await ge({account:c,payload:o});return await(async()=>{const u=S({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),h=await n(`${u}&signature=${s}&payload=${encodeURIComponent(o)}`,{body:w({payload:o,signature:s}),headers:{"Content-Type":"application/json"},method:"POST"});if(!h.ok)throw new Error("Failed to verify SIWE signature");return await h.json()})()}async function ye({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing message");const c={address:e.address,chainId:e.chainId,nonce:Number(e.nonce)},n=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-authorization`,{body:w(c),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!n.ok)throw new Error(`Failed to sign message - ${n.status} ${n.statusText}`);return await n.json()}async function be({client:i,payload:{message:e,isRaw:t,originalMessage:a,chainId:r},storage:l}){const c=await l.getAuthCookie(),n=l.ecosystem,o=p(i,n);if(!c)throw new Error("No auth token found when signing message");const s=await o(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-message`,{body:w({messagePayload:{chainId:r,isRaw:t,message:e,originalMessage:a}}),headers:{Authorization:`Bearer embedded-wallet-token:${c}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!s.ok)throw new Error(`Failed to sign message - ${s.status} ${s.statusText}`);return await s.json()}async function Ie({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing transaction");const c=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-transaction`,{body:w({transactionPayload:e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign transaction - ${c.status} ${c.statusText}`);return(await c.json()).signature}async function ve({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing typed data");const c=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-typed-data`,{body:w({...e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign typed data - ${c.status} ${c.statusText}`);return await c.json()}class ke{constructor({client:e,ecosystem:t,address:a,storage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"address",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.address=a,this.localStorage=r}async postWalletSetUp(e){await this.localStorage.saveAuthCookie(e.storedToken.cookieString)}async getUserWalletStatus(){var l,c;const e=await this.localStorage.getAuthCookie();if(!e)return{status:"Logged Out"};const t=await W({authToken:e,client:this.client,ecosystem:this.ecosystem});if(!t)return{status:"Logged Out"};const a=t.wallets[0],r={email:(l=t.linkedAccounts.find(n=>n.details.email!==void 0))==null?void 0:l.details.email,phoneNumber:(c=t.linkedAccounts.find(n=>n.details.phone!==void 0))==null?void 0:c.details.phone,recoveryShareManagement:"ENCLAVE",userWalletId:t.id||""};return a?{account:await this.getAccount(),authDetails:r,status:"Logged In, Wallet Initialized",walletAddress:a.address}:{authDetails:r,status:"Logged In, Wallet Uninitialized"}}async getAccount(){const e=this.client,t=this.localStorage,a=this.address,r=this.ecosystem,l=async n=>{const o=P({chain:I(n.chainId),client:e}),s={chainId:A(n.chainId),data:n.data,gas:m(n.gas),nonce:m(n.nonce)||A(await b(async()=>{const{eth_getTransactionCount:d}=await import("./thirdweb-CS6G_ZNe.js").then(u=>u.cl);return{eth_getTransactionCount:d}},[]).then(({eth_getTransactionCount:d})=>d(o,{address:y(this.address),blockTag:"pending"}))),to:n.to?y(n.to):void 0,value:m(n.value)};return n.authorizationList&&n.authorizationList.length>0?(s.type=4,s.authorizationList=n.authorizationList,s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas)):m(n.maxFeePerGas)?(s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas),s.type=2):(s.gasPrice=m(n.gasPrice),s.type=0),Ie({client:e,payload:s,storage:t})},c={address:y(a),async sendTransaction(n){const o=P({chain:I(n.chainId),client:e}),s=await l(n),d=await D(o,s);return F({chainId:n.chainId,client:e,contractAddress:n.to??void 0,ecosystem:r,gasPrice:n.gasPrice,transactionHash:d,walletAddress:a,walletType:"inApp"}),{transactionHash:d}},async signAuthorization(n){const o=await ye({client:e,payload:n,storage:t});return{address:y(o.address),chainId:Number.parseInt(o.chainId),nonce:BigInt(o.nonce),r:BigInt(o.r),s:BigInt(o.s),yParity:Number.parseInt(o.yParity)}},async signMessage({message:n,originalMessage:o,chainId:s}){const d=typeof n=="string"?{chainId:s,isRaw:!1,message:n,originalMessage:o}:{chainId:s,isRaw:!0,message:typeof n.raw=="string"?n.raw:Q(n.raw),originalMessage:o},{signature:u}=await be({client:e,payload:d,storage:t});return u},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({chainId:n.chainId,...n})},async signTypedData(n){const o=U(n),{signature:s}=await ve({client:e,payload:o,storage:t});return s},sendCalls:async n=>{const{inAppWalletSendCalls:o}=await b(async()=>{const{inAppWalletSendCalls:f}=await import("./in-app-wallet-calls-CwwQ0VDY.js");return{inAppWalletSendCalls:f}},__vite__mapDeps([0,1])),s=n.calls[0];if(!s)throw new Error("No calls to send");const d=s.client,u=s.chain||n.chain,h=await o({account:c,calls:n.calls,chain:u});return{chain:u,client:d,id:h}},getCallsStatus:async n=>{const{inAppWalletGetCallsStatus:o}=await b(async()=>{const{inAppWalletGetCallsStatus:s}=await import("./in-app-wallet-calls-CwwQ0VDY.js");return{inAppWalletGetCallsStatus:s}},__vite__mapDeps([0,1]));return o(n)},getCallsStatusRaw:async n=>{const{inAppWalletGetCallsStatusRaw:o}=await b(async()=>{const{inAppWalletGetCallsStatusRaw:s}=await import("./in-app-wallet-calls-CwwQ0VDY.js");return{inAppWalletGetCallsStatusRaw:s}},__vite__mapDeps([0,1]));return o(n)},getCapabilities:async n=>({[n.chainId??1]:{atomic:{status:"unsupported"},paymasterService:{supported:!1}}})};return c}}function m(i){return i===void 0||H(i)?i:A(i)}const Te={backgroundColor:"transparent",border:"none",colorScheme:"light",display:"none",height:"100%",pointerEvents:"all",position:"fixed",right:"0px",top:"0px",width:"100%",zIndex:"2147483646"},L=new Map;class Le{constructor({link:e,baseUrl:t,iframeId:a,container:r,onIframeInitialize:l,localStorage:c,clientId:n,ecosystem:o}){if(Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"POLLING_INTERVAL_SECONDS",{enumerable:!0,configurable:!0,writable:!0,value:1.4}),Object.defineProperty(this,"iframeBaseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.localStorage=c,this.clientId=n,this.ecosystem=o,this.iframeBaseUrl=t,typeof document>"u")return;r=r??document.body;let s=document.getElementById(a);const d=new URL(e);if(!s||s.src!==d.href){s=document.createElement("iframe");const u={...Te};Object.assign(s.style,u),s.setAttribute("id",a),s.setAttribute("fetchpriority","high"),r.appendChild(s),s.src=d.href;const h=f=>{if(f.data.eventType==="ewsIframeLoaded"){if(window.removeEventListener("message",h),!s){console.warn("thirdweb iFrame not found");return}this.onIframeLoadHandler(s,l)()}};window.addEventListener("message",h)}this.iframe=s}async onIframeLoadedInitVariables(){var e,t;return{authCookie:await this.localStorage.getAuthCookie(),clientId:this.clientId,deviceShareStored:await this.localStorage.getDeviceShare(),ecosystemId:(e=this.ecosystem)==null?void 0:e.id,partnerId:(t=this.ecosystem)==null?void 0:t.partnerId,walletUserId:await this.localStorage.getWalletUserId()}}onIframeLoadHandler(e,t){return async()=>{var l;const a=new MessageChannel,r=new Promise((c,n)=>{a.port1.onmessage=o=>{const{data:s}=o;a.port1.close(),s.success||n(new Error(s.error)),L.set(e.src,!0),t&&t(),c(!0)}});(l=e==null?void 0:e.contentWindow)==null||l.postMessage({data:await this.onIframeLoadedInitVariables(),eventType:"initIframe"},this.iframeBaseUrl,[a.port2]),await r}}async call({procedureName:e,params:t,showIframe:a=!1}){var c;if(!this.iframe)throw new Error("Iframe not found. You are likely calling this from the backend where the DOM is not available.");for(;!L.get(this.iframe.src);)await k(this.POLLING_INTERVAL_SECONDS*1e3);a&&(this.iframe.style.display="block",await k(.005*1e3));const r=new MessageChannel,l=new Promise((n,o)=>{r.port1.onmessage=async s=>{const{data:d}=s;r.port1.close(),a&&(await k(.1*1e3),this.iframe&&(this.iframe.style.display="none")),d.success?n(d.data):o(new Error(d.error))}});return(c=this.iframe.contentWindow)==null||c.postMessage({data:{...t,...await this.onIframeLoadedInitVariables()},eventType:e},this.iframeBaseUrl,[r.port2]),l}destroy(){this.iframe&&L.delete(this.iframe.src)}}class Pe extends Le{constructor({clientId:e,baseUrl:t,ecosystem:a}){super({baseUrl:t,clientId:e,container:typeof document>"u"?void 0:document.body,ecosystem:a,iframeId:We+((a==null?void 0:a.id)||""),link:Ae({baseUrl:t,clientId:e,ecosystem:a,path:Z}).href,localStorage:new N({clientId:e,ecosystem:a,storage:B})}),this.clientId=e,this.ecosystem=a}}function Ae({clientId:i,baseUrl:e,path:t,ecosystem:a,queryParams:r}){var c;const l=new URL(`${t}`,e);if(r)for(const n of Object.keys(r))l.searchParams.set(n,((c=r[n])==null?void 0:c.toString())||"");return l.searchParams.set("clientId",i),(a==null?void 0:a.partnerId)!==void 0&&l.searchParams.set("partnerId",a.partnerId),(a==null?void 0:a.id)!==void 0&&l.searchParams.set("ecosystemId",a.id),l}const We="thirdweb-in-app-wallet-iframe";async function Se({client:i,ecosystem:e,authToken:t}){const r=await p(i,e)(`${g("inAppWallet")}/api/v1/enclave-wallet/generate`,{headers:{Authorization:`Bearer embedded-wallet-token:${t}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!r.ok)throw new Error(`Failed to generate wallet - ${r.status} ${r.statusText}`);const{wallet:l}=await r.json();return l}class Ee{constructor({baseUrl:e,querier:t,preLogin:a,postLogin:r,client:l,ecosystem:c}){Object.defineProperty(this,"LoginQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"postLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseUrl=e,this.LoginQuerier=t,this.preLogin=a,this.postLogin=r,this.client=l,this.ecosystem=c}async sendEmailLoginOtp({email:e}){return await this.LoginQuerier.call({params:{email:e},procedureName:"sendThirdwebEmailLoginOtp"})}async sendSmsLoginOtp({phoneNumber:e}){return await this.LoginQuerier.call({params:{phoneNumber:e},procedureName:"sendThirdwebSmsLoginOtp"})}}class Oe extends Ee{async authenticateWithModal(){return this.LoginQuerier.call({params:void 0,procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithModal(){await this.preLogin();const e=await this.authenticateWithModal();return this.postLogin(e)}async authenticateWithIframe({email:e}){return this.LoginQuerier.call({params:{email:e},procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithIframe({email:e}){await this.preLogin();const t=await this.authenticateWithIframe({email:e});return this.postLogin(t)}async authenticateWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");return this.LoginQuerier.call({params:{encryptionKey:e,jwt:t},procedureName:"loginWithCustomJwt"})}async loginWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");await this.preLogin();const a=await this.authenticateWithCustomJwt({encryptionKey:e,jwt:t});return this.postLogin(a)}async authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t}){return this.LoginQuerier.call({params:{encryptionKey:e,payload:t},procedureName:"loginWithCustomAuthEndpoint"})}async loginWithCustomAuthEndpoint({encryptionKey:e,payload:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom auth");await this.preLogin();const a=await this.authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t});return this.postLogin(a)}async authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{email:e,otp:t,recoveryCode:a},procedureName:"verifyThirdwebEmailLoginOtp"})}async loginWithEmailOtp({email:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a});return this.postLogin(r)}async authenticateWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{otp:t,phoneNumber:e,recoveryCode:a},procedureName:"verifyThirdwebSmsLoginOtp"})}async loginWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithSmsOtp({otp:t,phoneNumber:e,recoveryCode:a});return this.postLogin(r)}}class Ce{constructor({client:e,querier:t,onAuthSuccess:a,ecosystem:r,baseUrl:l,localStorage:c}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"AuthQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onAuthSuccess",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BaseLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=r,this.AuthQuerier=t,this.localStorage=c,this.onAuthSuccess=a,this.BaseLogin=new Oe({baseUrl:l,client:e,ecosystem:r,postLogin:async n=>this.postLogin(n),preLogin:async()=>{await this.preLogin()},querier:t})}async preLogin(){await this.logout()}async postLogin({storedToken:e,walletDetails:t}){return e.shouldStoreCookieString&&await this.localStorage.saveAuthCookie(e.cookieString),await this.onAuthSuccess({storedToken:e,walletDetails:t})}async loginWithAuthToken(e,t){var l;e.storedToken.authProvider!=="Backend"&&await this.preLogin();const a=await W({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot login, no user found for auth token");if(a.wallets.length>0&&((l=a.wallets[0])==null?void 0:l.type)==="enclave")return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:a.wallets[0].address}});if(a.wallets.length===0){const c=await Se({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:c.address}})}const r=await this.AuthQuerier.call({params:{recoveryCode:t,storedToken:e.storedToken},procedureName:"loginWithStoredTokenDetails"});return this.postLogin(r)}async loginWithModal(){return this.BaseLogin.loginWithModal()}async authenticateWithModal(){return this.BaseLogin.authenticateWithModal()}async loginWithIframe(e){return this.BaseLogin.loginWithIframe(e)}async authenticateWithIframe(e){return this.BaseLogin.authenticateWithIframe(e)}async loginWithCustomJwt(e){return this.BaseLogin.loginWithCustomJwt(e)}async authenticateWithCustomJwt(e){return this.BaseLogin.authenticateWithCustomJwt(e)}async loginWithCustomAuthEndpoint(e){return this.BaseLogin.loginWithCustomAuthEndpoint(e)}async authenticateWithCustomAuthEndpoint(e){return this.BaseLogin.authenticateWithCustomAuthEndpoint(e)}async sendEmailLoginOtp({email:e}){return this.BaseLogin.sendEmailLoginOtp({email:e})}async sendSmsLoginOtp({phoneNumber:e}){return this.BaseLogin.sendSmsLoginOtp({phoneNumber:e})}async loginWithEmailOtp(e){return await this.preLogin(),this.BaseLogin.loginWithEmailOtp(e)}async authenticateWithEmailOtp(e){return this.BaseLogin.authenticateWithEmailOtp(e)}async loginWithSmsOtp(e){return await this.preLogin(),this.BaseLogin.loginWithSmsOtp(e)}async authenticateWithSmsOtp(e){return this.BaseLogin.authenticateWithSmsOtp(e)}async logout(){const e=await this.localStorage.removeAuthCookie(),t=await this.localStorage.removeWalletUserId();return{success:e||t}}}const $e="width=350, height=500",C=({isWindowOpenedByFn:i,win:e,closeOpenedWindow:t})=>{i?e==null||e.close():e&&t?t(e):e&&e.close()};async function $(i){const e=v({...i,mode:i.mode||"redirect",authFlow:i.authFlow});i.mode==="redirect"?window.location.href=e:window.open(e),await new Promise(t=>setTimeout(t,5e3))}const je=async i=>{let e=i.openedWindow,t=!1;if(e||(e=window.open(v({...i,mode:"popup"}),`Login to ${i.authOption}`,$e),t=!0),!e)throw new Error("Something went wrong opening pop-up");return await new Promise((r,l)=>{const c=window.setInterval(async()=>{e.closed&&(clearInterval(c),window.removeEventListener("message",n),l(new Error("User closed login window")))},1e3),n=async o=>{if(o.origin===g("inAppWallet")){if(typeof o.data!="object"){l(new Error("Invalid event data"));return}switch(o.data.eventType){case"oauthSuccessResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),o.data.authResult&&r(o.data.authResult);break}case"oauthFailureResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),l(new Error(o.data.errorString));break}}}};window.addEventListener("message",n)})},_e=async i=>{const{client:e,ecosystem:t}=i,a=v({authOption:i.strategy,client:e,ecosystem:t}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{email:i.email};case"phone":return{phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok){const n=await c.text();let o;try{const s=JSON.parse(n);s&&typeof s.message=="string"&&(o=s.message)}catch{}throw new Error(o||"Failed to send verification code")}return await c.json()},j=async i=>{const{client:e,ecosystem:t}=i,a=S({authOption:i.strategy,client:i.client,ecosystem:i.ecosystem}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{code:i.verificationCode,email:i.email};case"phone":return{code:i.verificationCode,phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok)throw new Error("Failed to verify verification code");return await c.json()};class _{constructor({client:e,ecosystem:t,querier:a,localStorage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"walletManagerQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.walletManagerQuerier=a,this.localStorage=r}async postWalletSetUp(e){e.deviceShareStored&&await this.localStorage.saveDeviceShare(e.deviceShareStored,e.storedToken.authDetails.userWalletId)}async getUserWalletStatus(){const e=await this.walletManagerQuerier.call({params:void 0,procedureName:"getUserStatus"});return e.status==="Logged In, Wallet Initialized"?{status:"Logged In, Wallet Initialized",...e.user,account:await this.getAccount()}:e.status==="Logged In, New Device"?{status:"Logged In, New Device",...e.user}:e.status==="Logged In, Wallet Uninitialized"?{status:"Logged In, Wallet Uninitialized",...e.user}:{status:e.status}}async getAccount(){var c;const e=this.walletManagerQuerier,t=this.client,a=(c=this.ecosystem)==null?void 0:c.partnerId,{address:r}=await e.call({params:void 0,procedureName:"getAddress"}),l=async n=>{const o={chainId:n.chainId,data:n.data,gasLimit:n.gas,nonce:n.nonce,to:n.to??void 0,value:n.value};n.maxFeePerGas?(o.accessList=n.accessList,o.maxFeePerGas=n.maxFeePerGas,o.maxPriorityFeePerGas=n.maxPriorityFeePerGas,o.type=2):(o.gasPrice=n.gasPrice,o.type=0);const s=O().rpc,{signedTransaction:d}=await e.call({params:{chainId:n.chainId,partnerId:a,rpcEndpoint:`https://${n.chainId}.${s}`,transaction:o},procedureName:"signTransaction"});return d};return{address:y(r),async sendTransaction(n){const o=P({chain:I(n.chainId),client:t}),s=await l(n),d=await D(o,s);return F({chainId:n.chainId,client:t,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:d,walletAddress:r,walletType:"inApp"}),{transactionHash:d}},async signMessage({message:n}){const o=typeof n=="string"?n:n.raw instanceof Uint8Array?n.raw:J(n.raw),{signedMessage:s}=await e.call({params:{chainId:1,message:o,partnerId:a},procedureName:"signMessage"});return s},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({...n,chainId:n.chainId})},async signTypedData(n){var E;const o=U(n);(E=o.types)!=null&&E.EIP712Domain&&(o.types.EIP712Domain=void 0);const s=o.domain,d=s==null?void 0:s.chainId,h={...s!=null&&s.verifyingContract?{verifyingContract:s==null?void 0:s.verifyingContract}:{},name:s==null?void 0:s.name,version:s==null?void 0:s.version};d&&(h.chainId=d);const f=O().rpc,{signedTypedData:V}=await e.call({params:{chainId:Number.parseInt(BigInt(d||1).toString()),domain:h,message:o.message,partnerId:a,rpcEndpoint:`https://${d}.${f}`,types:o.types},procedureName:"signTypedDataV4"});return V}}}}class Qe{isClientIdLegacyPaper(e){return e.indexOf("-")>0&&e.length===36}constructor({client:e,onAuthSuccess:t,ecosystem:a,passkeyDomain:r,storage:l}){if(Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"querier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"wallet",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"auth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"passkeyDomain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isClientIdLegacyPaper(e.clientId))throw new Error("You are using a legacy clientId. Please use the clientId found on the thirdweb dashboard settings page");const c=g("inAppWallet");this.client=e,this.ecosystem=a,this.passkeyDomain=r,this.storage=new N({clientId:e.clientId,ecosystem:a,storage:l??Fe()}),this.querier=new Pe({baseUrl:c,clientId:e.clientId,ecosystem:a}),this.auth=new Ce({baseUrl:c,client:e,ecosystem:a,localStorage:this.storage,onAuthSuccess:async n=>{if(t==null||t(n),n.storedToken.authDetails.walletType==="sharded"&&(await this.querier.call({params:{storedToken:n.storedToken},procedureName:"migrateFromShardToEnclave"})||console.warn("Failed to migrate from sharded to enclave wallet, continuing with sharded wallet")),this.wallet=await this.initializeWallet(n.storedToken.cookieString),!this.wallet)throw new Error("Failed to initialize wallet");const o="deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:void 0;return await this.wallet.postWalletSetUp({deviceShareStored:o,storedToken:n.storedToken}),this.wallet instanceof _&&await this.querier.call({params:{authCookie:n.storedToken.cookieString,clientId:this.client.clientId,deviceShareStored:"deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:null,ecosystemId:a==null?void 0:a.id,partnerId:a==null?void 0:a.partnerId,walletUserId:n.storedToken.authDetails.userWalletId},procedureName:"initIframe"}),{user:{account:await this.wallet.getAccount(),authDetails:n.storedToken.authDetails,status:"Logged In, Wallet Initialized",walletAddress:n.walletDetails.walletAddress}}},querier:this.querier})}async initializeWallet(e){var r;const t=await this.storage.getAuthCookie();if(!e&&t===null)throw new Error("No auth token provided and no stored auth token found to initialize the wallet");const a=await W({authToken:e||t,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot initialize wallet, no user logged in");if(a.wallets.length===0)throw new Error("Cannot initialize wallet, this user does not have a wallet generated yet");return((r=a.wallets[0])==null?void 0:r.type)==="enclave"?new ke({address:a.wallets[0].address,client:this.client,ecosystem:this.ecosystem,storage:this.storage}):new _({client:this.client,ecosystem:this.ecosystem,localStorage:this.storage,querier:this.querier})}async getUser(){if(!this.wallet){const e=await this.storage.getAuthCookie();if(!e)return{status:"Logged Out"};this.wallet=await this.initializeWallet(e)}if(!this.wallet)throw new Error("Wallet not initialized");return await this.wallet.getUserWalletStatus()}getAccount(){if(!this.wallet)throw new Error("Wallet not initialized");return this.wallet.getAccount()}async preAuthenticate(e){return _e({...e,client:this.client,ecosystem:this.ecosystem})}async authenticateWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a})}async loginWithAuthToken(e,t){return this.auth.loginWithAuthToken(e,t)}async authenticate(e){const t=e.strategy;switch(t){case"email":return j({...e,client:this.client,ecosystem:this.ecosystem});case"phone":return j({...e,client:this.client,ecosystem:this.ecosystem});case"auth_endpoint":return oe({client:this.client,ecosystem:this.ecosystem,payload:e.payload});case"jwt":return de({client:this.client,ecosystem:this.ecosystem,jwt:e.jwt});case"passkey":return this.passkeyAuth(e);case"iframe_email_verification":return this.auth.authenticateWithIframe({email:e.email});case"iframe":return this.auth.authenticateWithModal();case"apple":case"facebook":case"google":case"telegram":case"github":case"twitch":case"farcaster":case"line":case"x":case"tiktok":case"epic":case"steam":case"coinbase":case"discord":return je({authOption:t,client:this.client,closeOpenedWindow:e.closeOpenedWindow,ecosystem:this.ecosystem,openedWindow:e.openedWindow});case"guest":return le({client:this.client,ecosystem:this.ecosystem,storage:this.storage});case"backend":return ce({client:this.client,ecosystem:this.ecosystem,walletSecret:e.walletSecret});case"wallet":return fe({client:this.client,ecosystem:this.ecosystem,wallet:e.wallet,chain:e.chain})}}async connect(e){const t=e.strategy;switch(t){case"auth_endpoint":case"jwt":{const a=await this.authenticate(e);return await this.loginWithAuthToken(a,e.encryptionKey)}case"iframe_email_verification":return this.auth.loginWithIframe({email:e.email});case"iframe":return this.auth.loginWithModal();case"passkey":{const a=await this.passkeyAuth(e);return this.loginWithAuthToken(a)}case"backend":case"phone":case"email":case"wallet":case"apple":case"facebook":case"google":case"farcaster":case"telegram":case"github":case"line":case"x":case"tiktok":case"epic":case"guest":case"coinbase":case"twitch":case"steam":case"discord":{const a=await this.authenticate(e);return await this.auth.loginWithAuthToken(a)}default:De(t)}}async logout(){return await this.auth.logout()}async passkeyAuth(e){const{PasskeyWebClient:t}=await b(async()=>{const{PasskeyWebClient:n}=await import("./passkeys-C1wTOzLk.js");return{PasskeyWebClient:n}},__vite__mapDeps([2,3])),{passkeyName:a,storeLastUsedPasskey:r=!0}=e,l=new t,c=this.storage;return e.type==="sign-up"?ue({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0,username:a}):he({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0})}async linkProfileWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a,authFlow:"link"})}async linkProfile(e){if("strategy"in e&&K.includes(e.strategy)&&"mode"in e&&e.mode!=="popup"&&e.mode!==void 0)return await this.linkProfileWithRedirect(e.strategy,e.mode,"redirectUrl"in e?e.redirectUrl:void 0),[];const{storedToken:t}=await this.authenticate(e);return await X({client:e.client,ecosystem:e.ecosystem||this.ecosystem,storage:this.storage,tokenToLink:t.cookieString})}async unlinkProfile(e,t){return await ee({allowAccountDeletion:t,client:this.client,ecosystem:this.ecosystem,profileToUnlink:e,storage:this.storage})}async getProfiles(){return te({client:this.client,ecosystem:this.ecosystem,storage:this.storage})}}function De(i,e){throw new Error(`Invalid param: ${i}`)}function Fe(){return typeof window<"u"&&window.localStorage?B:ie}export{Qe as InAppWebConnector};
9
+ `)}async function ge(i){const{payload:e,account:t}=i,a=await t.signMessage({message:pe(e)});return{payload:e,signature:a}}const me=["xyz.abs"];async function fe(i){const{wallet:e,client:t,ecosystem:a,chain:r}=i,l=me.includes(e.id)?r||I(1):I(1),c=e.getAccount()||await e.connect({chain:l,client:t}),n=p(t,a),o=await(async()=>{const u=v({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),h=await n(`${u}&address=${c.address}&chainId=${l.id}`);if(!h.ok)throw new Error("Failed to generate SIWE login payload");return await h.json()})(),{signature:s}=await ge({account:c,payload:o});return await(async()=>{const u=S({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),h=await n(`${u}&signature=${s}&payload=${encodeURIComponent(o)}`,{body:w({payload:o,signature:s}),headers:{"Content-Type":"application/json"},method:"POST"});if(!h.ok)throw new Error("Failed to verify SIWE signature");return await h.json()})()}async function ye({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing message");const c={address:e.address,chainId:e.chainId,nonce:Number(e.nonce)},n=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-authorization`,{body:w(c),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!n.ok)throw new Error(`Failed to sign message - ${n.status} ${n.statusText}`);return await n.json()}async function be({client:i,payload:{message:e,isRaw:t,originalMessage:a,chainId:r},storage:l}){const c=await l.getAuthCookie(),n=l.ecosystem,o=p(i,n);if(!c)throw new Error("No auth token found when signing message");const s=await o(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-message`,{body:w({messagePayload:{chainId:r,isRaw:t,message:e,originalMessage:a}}),headers:{Authorization:`Bearer embedded-wallet-token:${c}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!s.ok)throw new Error(`Failed to sign message - ${s.status} ${s.statusText}`);return await s.json()}async function Ie({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing transaction");const c=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-transaction`,{body:w({transactionPayload:e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign transaction - ${c.status} ${c.statusText}`);return(await c.json()).signature}async function ve({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing typed data");const c=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-typed-data`,{body:w({...e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign typed data - ${c.status} ${c.statusText}`);return await c.json()}class ke{constructor({client:e,ecosystem:t,address:a,storage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"address",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.address=a,this.localStorage=r}async postWalletSetUp(e){await this.localStorage.saveAuthCookie(e.storedToken.cookieString)}async getUserWalletStatus(){var l,c;const e=await this.localStorage.getAuthCookie();if(!e)return{status:"Logged Out"};const t=await W({authToken:e,client:this.client,ecosystem:this.ecosystem});if(!t)return{status:"Logged Out"};const a=t.wallets[0],r={email:(l=t.linkedAccounts.find(n=>n.details.email!==void 0))==null?void 0:l.details.email,phoneNumber:(c=t.linkedAccounts.find(n=>n.details.phone!==void 0))==null?void 0:c.details.phone,recoveryShareManagement:"ENCLAVE",userWalletId:t.id||""};return a?{account:await this.getAccount(),authDetails:r,status:"Logged In, Wallet Initialized",walletAddress:a.address}:{authDetails:r,status:"Logged In, Wallet Uninitialized"}}async getAccount(){const e=this.client,t=this.localStorage,a=this.address,r=this.ecosystem,l=async n=>{const o=P({chain:I(n.chainId),client:e}),s={chainId:A(n.chainId),data:n.data,gas:m(n.gas),nonce:m(n.nonce)||A(await b(async()=>{const{eth_getTransactionCount:d}=await import("./thirdweb-129NE2Ul.js").then(u=>u.cl);return{eth_getTransactionCount:d}},[]).then(({eth_getTransactionCount:d})=>d(o,{address:y(this.address),blockTag:"pending"}))),to:n.to?y(n.to):void 0,value:m(n.value)};return n.authorizationList&&n.authorizationList.length>0?(s.type=4,s.authorizationList=n.authorizationList,s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas)):m(n.maxFeePerGas)?(s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas),s.type=2):(s.gasPrice=m(n.gasPrice),s.type=0),Ie({client:e,payload:s,storage:t})},c={address:y(a),async sendTransaction(n){const o=P({chain:I(n.chainId),client:e}),s=await l(n),d=await D(o,s);return F({chainId:n.chainId,client:e,contractAddress:n.to??void 0,ecosystem:r,gasPrice:n.gasPrice,transactionHash:d,walletAddress:a,walletType:"inApp"}),{transactionHash:d}},async signAuthorization(n){const o=await ye({client:e,payload:n,storage:t});return{address:y(o.address),chainId:Number.parseInt(o.chainId),nonce:BigInt(o.nonce),r:BigInt(o.r),s:BigInt(o.s),yParity:Number.parseInt(o.yParity)}},async signMessage({message:n,originalMessage:o,chainId:s}){const d=typeof n=="string"?{chainId:s,isRaw:!1,message:n,originalMessage:o}:{chainId:s,isRaw:!0,message:typeof n.raw=="string"?n.raw:Q(n.raw),originalMessage:o},{signature:u}=await be({client:e,payload:d,storage:t});return u},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({chainId:n.chainId,...n})},async signTypedData(n){const o=U(n),{signature:s}=await ve({client:e,payload:o,storage:t});return s},sendCalls:async n=>{const{inAppWalletSendCalls:o}=await b(async()=>{const{inAppWalletSendCalls:f}=await import("./in-app-wallet-calls-C3XXM2uK.js");return{inAppWalletSendCalls:f}},__vite__mapDeps([0,1])),s=n.calls[0];if(!s)throw new Error("No calls to send");const d=s.client,u=s.chain||n.chain,h=await o({account:c,calls:n.calls,chain:u});return{chain:u,client:d,id:h}},getCallsStatus:async n=>{const{inAppWalletGetCallsStatus:o}=await b(async()=>{const{inAppWalletGetCallsStatus:s}=await import("./in-app-wallet-calls-C3XXM2uK.js");return{inAppWalletGetCallsStatus:s}},__vite__mapDeps([0,1]));return o(n)},getCallsStatusRaw:async n=>{const{inAppWalletGetCallsStatusRaw:o}=await b(async()=>{const{inAppWalletGetCallsStatusRaw:s}=await import("./in-app-wallet-calls-C3XXM2uK.js");return{inAppWalletGetCallsStatusRaw:s}},__vite__mapDeps([0,1]));return o(n)},getCapabilities:async n=>({[n.chainId??1]:{atomic:{status:"unsupported"},paymasterService:{supported:!1}}})};return c}}function m(i){return i===void 0||H(i)?i:A(i)}const Te={backgroundColor:"transparent",border:"none",colorScheme:"light",display:"none",height:"100%",pointerEvents:"all",position:"fixed",right:"0px",top:"0px",width:"100%",zIndex:"2147483646"},L=new Map;class Le{constructor({link:e,baseUrl:t,iframeId:a,container:r,onIframeInitialize:l,localStorage:c,clientId:n,ecosystem:o}){if(Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"POLLING_INTERVAL_SECONDS",{enumerable:!0,configurable:!0,writable:!0,value:1.4}),Object.defineProperty(this,"iframeBaseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.localStorage=c,this.clientId=n,this.ecosystem=o,this.iframeBaseUrl=t,typeof document>"u")return;r=r??document.body;let s=document.getElementById(a);const d=new URL(e);if(!s||s.src!==d.href){s=document.createElement("iframe");const u={...Te};Object.assign(s.style,u),s.setAttribute("id",a),s.setAttribute("fetchpriority","high"),r.appendChild(s),s.src=d.href;const h=f=>{if(f.data.eventType==="ewsIframeLoaded"){if(window.removeEventListener("message",h),!s){console.warn("thirdweb iFrame not found");return}this.onIframeLoadHandler(s,l)()}};window.addEventListener("message",h)}this.iframe=s}async onIframeLoadedInitVariables(){var e,t;return{authCookie:await this.localStorage.getAuthCookie(),clientId:this.clientId,deviceShareStored:await this.localStorage.getDeviceShare(),ecosystemId:(e=this.ecosystem)==null?void 0:e.id,partnerId:(t=this.ecosystem)==null?void 0:t.partnerId,walletUserId:await this.localStorage.getWalletUserId()}}onIframeLoadHandler(e,t){return async()=>{var l;const a=new MessageChannel,r=new Promise((c,n)=>{a.port1.onmessage=o=>{const{data:s}=o;a.port1.close(),s.success||n(new Error(s.error)),L.set(e.src,!0),t&&t(),c(!0)}});(l=e==null?void 0:e.contentWindow)==null||l.postMessage({data:await this.onIframeLoadedInitVariables(),eventType:"initIframe"},this.iframeBaseUrl,[a.port2]),await r}}async call({procedureName:e,params:t,showIframe:a=!1}){var c;if(!this.iframe)throw new Error("Iframe not found. You are likely calling this from the backend where the DOM is not available.");for(;!L.get(this.iframe.src);)await k(this.POLLING_INTERVAL_SECONDS*1e3);a&&(this.iframe.style.display="block",await k(.005*1e3));const r=new MessageChannel,l=new Promise((n,o)=>{r.port1.onmessage=async s=>{const{data:d}=s;r.port1.close(),a&&(await k(.1*1e3),this.iframe&&(this.iframe.style.display="none")),d.success?n(d.data):o(new Error(d.error))}});return(c=this.iframe.contentWindow)==null||c.postMessage({data:{...t,...await this.onIframeLoadedInitVariables()},eventType:e},this.iframeBaseUrl,[r.port2]),l}destroy(){this.iframe&&L.delete(this.iframe.src)}}class Pe extends Le{constructor({clientId:e,baseUrl:t,ecosystem:a}){super({baseUrl:t,clientId:e,container:typeof document>"u"?void 0:document.body,ecosystem:a,iframeId:We+((a==null?void 0:a.id)||""),link:Ae({baseUrl:t,clientId:e,ecosystem:a,path:Y}).href,localStorage:new N({clientId:e,ecosystem:a,storage:B})}),this.clientId=e,this.ecosystem=a}}function Ae({clientId:i,baseUrl:e,path:t,ecosystem:a,queryParams:r}){var c;const l=new URL(`${t}`,e);if(r)for(const n of Object.keys(r))l.searchParams.set(n,((c=r[n])==null?void 0:c.toString())||"");return l.searchParams.set("clientId",i),(a==null?void 0:a.partnerId)!==void 0&&l.searchParams.set("partnerId",a.partnerId),(a==null?void 0:a.id)!==void 0&&l.searchParams.set("ecosystemId",a.id),l}const We="thirdweb-in-app-wallet-iframe";async function Se({client:i,ecosystem:e,authToken:t}){const r=await p(i,e)(`${g("inAppWallet")}/api/v1/enclave-wallet/generate`,{headers:{Authorization:`Bearer embedded-wallet-token:${t}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!r.ok)throw new Error(`Failed to generate wallet - ${r.status} ${r.statusText}`);const{wallet:l}=await r.json();return l}class Ee{constructor({baseUrl:e,querier:t,preLogin:a,postLogin:r,client:l,ecosystem:c}){Object.defineProperty(this,"LoginQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"postLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseUrl=e,this.LoginQuerier=t,this.preLogin=a,this.postLogin=r,this.client=l,this.ecosystem=c}async sendEmailLoginOtp({email:e}){return await this.LoginQuerier.call({params:{email:e},procedureName:"sendThirdwebEmailLoginOtp"})}async sendSmsLoginOtp({phoneNumber:e}){return await this.LoginQuerier.call({params:{phoneNumber:e},procedureName:"sendThirdwebSmsLoginOtp"})}}class Oe extends Ee{async authenticateWithModal(){return this.LoginQuerier.call({params:void 0,procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithModal(){await this.preLogin();const e=await this.authenticateWithModal();return this.postLogin(e)}async authenticateWithIframe({email:e}){return this.LoginQuerier.call({params:{email:e},procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithIframe({email:e}){await this.preLogin();const t=await this.authenticateWithIframe({email:e});return this.postLogin(t)}async authenticateWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");return this.LoginQuerier.call({params:{encryptionKey:e,jwt:t},procedureName:"loginWithCustomJwt"})}async loginWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");await this.preLogin();const a=await this.authenticateWithCustomJwt({encryptionKey:e,jwt:t});return this.postLogin(a)}async authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t}){return this.LoginQuerier.call({params:{encryptionKey:e,payload:t},procedureName:"loginWithCustomAuthEndpoint"})}async loginWithCustomAuthEndpoint({encryptionKey:e,payload:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom auth");await this.preLogin();const a=await this.authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t});return this.postLogin(a)}async authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{email:e,otp:t,recoveryCode:a},procedureName:"verifyThirdwebEmailLoginOtp"})}async loginWithEmailOtp({email:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a});return this.postLogin(r)}async authenticateWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{otp:t,phoneNumber:e,recoveryCode:a},procedureName:"verifyThirdwebSmsLoginOtp"})}async loginWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithSmsOtp({otp:t,phoneNumber:e,recoveryCode:a});return this.postLogin(r)}}class Ce{constructor({client:e,querier:t,onAuthSuccess:a,ecosystem:r,baseUrl:l,localStorage:c}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"AuthQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onAuthSuccess",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BaseLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=r,this.AuthQuerier=t,this.localStorage=c,this.onAuthSuccess=a,this.BaseLogin=new Oe({baseUrl:l,client:e,ecosystem:r,postLogin:async n=>this.postLogin(n),preLogin:async()=>{await this.preLogin()},querier:t})}async preLogin(){await this.logout()}async postLogin({storedToken:e,walletDetails:t}){return e.shouldStoreCookieString&&await this.localStorage.saveAuthCookie(e.cookieString),await this.onAuthSuccess({storedToken:e,walletDetails:t})}async loginWithAuthToken(e,t){var l;e.storedToken.authProvider!=="Backend"&&await this.preLogin();const a=await W({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot login, no user found for auth token");if(a.wallets.length>0&&((l=a.wallets[0])==null?void 0:l.type)==="enclave")return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:a.wallets[0].address}});if(a.wallets.length===0){const c=await Se({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:c.address}})}const r=await this.AuthQuerier.call({params:{recoveryCode:t,storedToken:e.storedToken},procedureName:"loginWithStoredTokenDetails"});return this.postLogin(r)}async loginWithModal(){return this.BaseLogin.loginWithModal()}async authenticateWithModal(){return this.BaseLogin.authenticateWithModal()}async loginWithIframe(e){return this.BaseLogin.loginWithIframe(e)}async authenticateWithIframe(e){return this.BaseLogin.authenticateWithIframe(e)}async loginWithCustomJwt(e){return this.BaseLogin.loginWithCustomJwt(e)}async authenticateWithCustomJwt(e){return this.BaseLogin.authenticateWithCustomJwt(e)}async loginWithCustomAuthEndpoint(e){return this.BaseLogin.loginWithCustomAuthEndpoint(e)}async authenticateWithCustomAuthEndpoint(e){return this.BaseLogin.authenticateWithCustomAuthEndpoint(e)}async sendEmailLoginOtp({email:e}){return this.BaseLogin.sendEmailLoginOtp({email:e})}async sendSmsLoginOtp({phoneNumber:e}){return this.BaseLogin.sendSmsLoginOtp({phoneNumber:e})}async loginWithEmailOtp(e){return await this.preLogin(),this.BaseLogin.loginWithEmailOtp(e)}async authenticateWithEmailOtp(e){return this.BaseLogin.authenticateWithEmailOtp(e)}async loginWithSmsOtp(e){return await this.preLogin(),this.BaseLogin.loginWithSmsOtp(e)}async authenticateWithSmsOtp(e){return this.BaseLogin.authenticateWithSmsOtp(e)}async logout(){const e=await this.localStorage.removeAuthCookie(),t=await this.localStorage.removeWalletUserId();return{success:e||t}}}const $e="width=350, height=500",C=({isWindowOpenedByFn:i,win:e,closeOpenedWindow:t})=>{i?e==null||e.close():e&&t?t(e):e&&e.close()};async function $(i){const e=v({...i,mode:i.mode||"redirect",authFlow:i.authFlow});i.mode==="redirect"?window.location.href=e:window.open(e),await new Promise(t=>setTimeout(t,5e3))}const je=async i=>{let e=i.openedWindow,t=!1;if(e||(e=window.open(v({...i,mode:"popup"}),`Login to ${i.authOption}`,$e),t=!0),!e)throw new Error("Something went wrong opening pop-up");return await new Promise((r,l)=>{const c=window.setInterval(async()=>{e.closed&&(clearInterval(c),window.removeEventListener("message",n),l(new Error("User closed login window")))},1e3),n=async o=>{if(o.origin===g("inAppWallet")){if(typeof o.data!="object"){l(new Error("Invalid event data"));return}switch(o.data.eventType){case"oauthSuccessResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),o.data.authResult&&r(o.data.authResult);break}case"oauthFailureResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),l(new Error(o.data.errorString));break}}}};window.addEventListener("message",n)})},_e=async i=>{const{client:e,ecosystem:t}=i,a=v({authOption:i.strategy,client:e,ecosystem:t}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{email:i.email};case"phone":return{phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok){const n=await c.text();let o;try{const s=JSON.parse(n);s&&typeof s.message=="string"&&(o=s.message)}catch{}throw new Error(o||"Failed to send verification code")}return await c.json()},j=async i=>{const{client:e,ecosystem:t}=i,a=S({authOption:i.strategy,client:i.client,ecosystem:i.ecosystem}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{code:i.verificationCode,email:i.email};case"phone":return{code:i.verificationCode,phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok)throw new Error("Failed to verify verification code");return await c.json()};class _{constructor({client:e,ecosystem:t,querier:a,localStorage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"walletManagerQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.walletManagerQuerier=a,this.localStorage=r}async postWalletSetUp(e){e.deviceShareStored&&await this.localStorage.saveDeviceShare(e.deviceShareStored,e.storedToken.authDetails.userWalletId)}async getUserWalletStatus(){const e=await this.walletManagerQuerier.call({params:void 0,procedureName:"getUserStatus"});return e.status==="Logged In, Wallet Initialized"?{status:"Logged In, Wallet Initialized",...e.user,account:await this.getAccount()}:e.status==="Logged In, New Device"?{status:"Logged In, New Device",...e.user}:e.status==="Logged In, Wallet Uninitialized"?{status:"Logged In, Wallet Uninitialized",...e.user}:{status:e.status}}async getAccount(){var c;const e=this.walletManagerQuerier,t=this.client,a=(c=this.ecosystem)==null?void 0:c.partnerId,{address:r}=await e.call({params:void 0,procedureName:"getAddress"}),l=async n=>{const o={chainId:n.chainId,data:n.data,gasLimit:n.gas,nonce:n.nonce,to:n.to??void 0,value:n.value};n.maxFeePerGas?(o.accessList=n.accessList,o.maxFeePerGas=n.maxFeePerGas,o.maxPriorityFeePerGas=n.maxPriorityFeePerGas,o.type=2):(o.gasPrice=n.gasPrice,o.type=0);const s=O().rpc,{signedTransaction:d}=await e.call({params:{chainId:n.chainId,partnerId:a,rpcEndpoint:`https://${n.chainId}.${s}`,transaction:o},procedureName:"signTransaction"});return d};return{address:y(r),async sendTransaction(n){const o=P({chain:I(n.chainId),client:t}),s=await l(n),d=await D(o,s);return F({chainId:n.chainId,client:t,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:d,walletAddress:r,walletType:"inApp"}),{transactionHash:d}},async signMessage({message:n}){const o=typeof n=="string"?n:n.raw instanceof Uint8Array?n.raw:J(n.raw),{signedMessage:s}=await e.call({params:{chainId:1,message:o,partnerId:a},procedureName:"signMessage"});return s},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({...n,chainId:n.chainId})},async signTypedData(n){var E;const o=U(n);(E=o.types)!=null&&E.EIP712Domain&&(o.types.EIP712Domain=void 0);const s=o.domain,d=s==null?void 0:s.chainId,h={...s!=null&&s.verifyingContract?{verifyingContract:s==null?void 0:s.verifyingContract}:{},name:s==null?void 0:s.name,version:s==null?void 0:s.version};d&&(h.chainId=d);const f=O().rpc,{signedTypedData:V}=await e.call({params:{chainId:Number.parseInt(BigInt(d||1).toString()),domain:h,message:o.message,partnerId:a,rpcEndpoint:`https://${d}.${f}`,types:o.types},procedureName:"signTypedDataV4"});return V}}}}class Re{isClientIdLegacyPaper(e){return e.indexOf("-")>0&&e.length===36}constructor({client:e,onAuthSuccess:t,ecosystem:a,passkeyDomain:r,storage:l}){if(Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"querier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"wallet",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"auth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"passkeyDomain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isClientIdLegacyPaper(e.clientId))throw new Error("You are using a legacy clientId. Please use the clientId found on the thirdweb dashboard settings page");const c=g("inAppWallet");this.client=e,this.ecosystem=a,this.passkeyDomain=r,this.storage=new N({clientId:e.clientId,ecosystem:a,storage:l??Fe()}),this.querier=new Pe({baseUrl:c,clientId:e.clientId,ecosystem:a}),this.auth=new Ce({baseUrl:c,client:e,ecosystem:a,localStorage:this.storage,onAuthSuccess:async n=>{if(t==null||t(n),n.storedToken.authDetails.walletType==="sharded"&&(await this.querier.call({params:{storedToken:n.storedToken},procedureName:"migrateFromShardToEnclave"})||console.warn("Failed to migrate from sharded to enclave wallet, continuing with sharded wallet")),this.wallet=await this.initializeWallet(n.storedToken.cookieString),!this.wallet)throw new Error("Failed to initialize wallet");const o="deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:void 0;return await this.wallet.postWalletSetUp({deviceShareStored:o,storedToken:n.storedToken}),this.wallet instanceof _&&await this.querier.call({params:{authCookie:n.storedToken.cookieString,clientId:this.client.clientId,deviceShareStored:"deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:null,ecosystemId:a==null?void 0:a.id,partnerId:a==null?void 0:a.partnerId,walletUserId:n.storedToken.authDetails.userWalletId},procedureName:"initIframe"}),{user:{account:await this.wallet.getAccount(),authDetails:n.storedToken.authDetails,status:"Logged In, Wallet Initialized",walletAddress:n.walletDetails.walletAddress}}},querier:this.querier})}async initializeWallet(e){var r;const t=await this.storage.getAuthCookie();if(!e&&t===null)throw new Error("No auth token provided and no stored auth token found to initialize the wallet");const a=await W({authToken:e||t,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot initialize wallet, no user logged in");if(a.wallets.length===0)throw new Error("Cannot initialize wallet, this user does not have a wallet generated yet");return((r=a.wallets[0])==null?void 0:r.type)==="enclave"?new ke({address:a.wallets[0].address,client:this.client,ecosystem:this.ecosystem,storage:this.storage}):new _({client:this.client,ecosystem:this.ecosystem,localStorage:this.storage,querier:this.querier})}async getUser(){if(!this.wallet){const e=await this.storage.getAuthCookie();if(!e)return{status:"Logged Out"};this.wallet=await this.initializeWallet(e)}if(!this.wallet)throw new Error("Wallet not initialized");return await this.wallet.getUserWalletStatus()}getAccount(){if(!this.wallet)throw new Error("Wallet not initialized");return this.wallet.getAccount()}async preAuthenticate(e){return _e({...e,client:this.client,ecosystem:this.ecosystem})}async authenticateWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a})}async loginWithAuthToken(e,t){return this.auth.loginWithAuthToken(e,t)}async authenticate(e){const t=e.strategy;switch(t){case"email":return j({...e,client:this.client,ecosystem:this.ecosystem});case"phone":return j({...e,client:this.client,ecosystem:this.ecosystem});case"auth_endpoint":return oe({client:this.client,ecosystem:this.ecosystem,payload:e.payload});case"jwt":return de({client:this.client,ecosystem:this.ecosystem,jwt:e.jwt});case"passkey":return this.passkeyAuth(e);case"iframe_email_verification":return this.auth.authenticateWithIframe({email:e.email});case"iframe":return this.auth.authenticateWithModal();case"apple":case"facebook":case"google":case"telegram":case"github":case"twitch":case"farcaster":case"line":case"x":case"tiktok":case"epic":case"steam":case"coinbase":case"discord":return je({authOption:t,client:this.client,closeOpenedWindow:e.closeOpenedWindow,ecosystem:this.ecosystem,openedWindow:e.openedWindow});case"guest":return le({client:this.client,ecosystem:this.ecosystem,storage:this.storage});case"backend":return ce({client:this.client,ecosystem:this.ecosystem,walletSecret:e.walletSecret});case"wallet":return fe({client:this.client,ecosystem:this.ecosystem,wallet:e.wallet,chain:e.chain})}}async connect(e){const t=e.strategy;switch(t){case"auth_endpoint":case"jwt":{const a=await this.authenticate(e);return await this.loginWithAuthToken(a,e.encryptionKey)}case"iframe_email_verification":return this.auth.loginWithIframe({email:e.email});case"iframe":return this.auth.loginWithModal();case"passkey":{const a=await this.passkeyAuth(e);return this.loginWithAuthToken(a)}case"backend":case"phone":case"email":case"wallet":case"apple":case"facebook":case"google":case"farcaster":case"telegram":case"github":case"line":case"x":case"tiktok":case"epic":case"guest":case"coinbase":case"twitch":case"steam":case"discord":{const a=await this.authenticate(e);return await this.auth.loginWithAuthToken(a)}default:De(t)}}async logout(){return await this.auth.logout()}async passkeyAuth(e){const{PasskeyWebClient:t}=await b(async()=>{const{PasskeyWebClient:n}=await import("./passkeys-C1wTOzLk.js");return{PasskeyWebClient:n}},__vite__mapDeps([2,3])),{passkeyName:a,storeLastUsedPasskey:r=!0}=e,l=new t,c=this.storage;return e.type==="sign-up"?ue({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0,username:a}):he({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0})}async linkProfileWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a,authFlow:"link"})}async linkProfile(e){if("strategy"in e&&te.includes(e.strategy)&&"mode"in e&&e.mode!=="popup"&&e.mode!==void 0)return await this.linkProfileWithRedirect(e.strategy,e.mode,"redirectUrl"in e?e.redirectUrl:void 0),[];const{storedToken:t}=await this.authenticate(e);return await Z({client:e.client,ecosystem:e.ecosystem||this.ecosystem,storage:this.storage,tokenToLink:t.cookieString})}async unlinkProfile(e,t){return await K({allowAccountDeletion:t,client:this.client,ecosystem:this.ecosystem,profileToUnlink:e,storage:this.storage})}async getProfiles(){return X({client:this.client,ecosystem:this.ecosystem,storage:this.storage})}}function De(i,e){throw new Error(`Invalid param: ${i}`)}function Fe(){return typeof window<"u"&&window.localStorage?B:ie}export{Re as InAppWebConnector};
package/index.html CHANGED
@@ -5,11 +5,11 @@
5
5
  <link rel="shortcut icon" type="image/x-icon" href="https://decentraland.org/images/icons/favicon-32x32.png" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Decentraland | Authorization</title>
8
- <script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30282291998.commit-7741200/assets/index-9l0HFt0G.js"></script>
9
- <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30282291998.commit-7741200/assets/thirdweb-CS6G_ZNe.js">
10
- <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30282291998.commit-7741200/assets/vendor-DgCFzUFU.js">
11
- <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30282291998.commit-7741200/assets/ui-Bc2xTSCT.js">
12
- <link rel="stylesheet" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30282291998.commit-7741200/assets/index-C9iDQul-.css">
8
+ <script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/index-DPWHpwh1.js"></script>
9
+ <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/thirdweb-129NE2Ul.js">
10
+ <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/vendor-DTjic7dc.js">
11
+ <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/ui-C5Ow-sF2.js">
12
+ <link rel="stylesheet" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/index-CujiQKjN.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl/auth-site",
3
- "version": "4.21.1-30282291998.commit-7741200",
3
+ "version": "4.21.1-30289583460.commit-46bdbdf",
4
4
  "description": "Auth website",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,6 +17,6 @@
17
17
  ],
18
18
  "author": "Decentraland",
19
19
  "license": "Apache-2.0",
20
- "homepage": "https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30282291998.commit-7741200",
21
- "commit": "77412001002adf6d53e553ae1f4dbfbb4527898f"
20
+ "homepage": "https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf",
21
+ "commit": "46bdbdfc07985e76e84c2c47d0153f5347747bd9"
22
22
  }
@@ -1 +0,0 @@
1
- import{g as r}from"./thirdweb-CS6G_ZNe.js";import{r as o}from"./index-9l0HFt0G.js";var t=o();const f=r(t);export{f as o};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-B3Gbdgyi.js","assets/ui-Bc2xTSCT.js","assets/vendor-DgCFzUFU.js","assets/thirdweb-CS6G_ZNe.js","assets/wallets-CUOtYiA7.js","assets/store-CraP4F4Y.js","assets/index-9l0HFt0G.js","assets/index-C9iDQul-.css","assets/index-V_1m0BwN.js","assets/index-C9_jeDSj.js","assets/index-nibyPLVP.js","assets/ethereum-CuwXPURS.js","assets/index.es-CB-yvhhh.js","assets/browser-ponyfill-CfapXlLj.js"])))=>i.map(i=>d[i]);
2
- import{b as T,_ as G,e as R,s as V,f as v,U as J,S as K,h as X,v as Y,i as B,j as Q,u as Z,n as I,t as H}from"./thirdweb-CS6G_ZNe.js";import{a as x,b as U,N as W,n as D,s as O,D as nn,c as E,f as an,p as en}from"./wallets-CUOtYiA7.js";import"./store-CraP4F4Y.js";import"./ui-Bc2xTSCT.js";import"./vendor-DgCFzUFU.js";import"./index-9l0HFt0G.js";import"./index-V_1m0BwN.js";import"./index-C9_jeDSj.js";import"./index-nibyPLVP.js";import"./ethereum-CuwXPURS.js";let y=null;const b={lastUsedChainId:"tw.wc.lastUsedChainId",requestedChains:"tw.wc.requestedChains"};async function gn(n,i,e,t,a){var A,N,S;const s=await $(n,e,a),o=n.walletConnect;let{onDisplayUri:c}=o||{};const d=await U(e);!c&&a&&(c=q=>{const L=d.mobile.native||d.mobile.universal;if(!L){a(q);return}const z=an(L,q).redirect;a(z)}),c&&s.events.addListener("display_uri",c);let l=o==null?void 0:o.optionalChains;const u=n.chain;e==="global.safe"&&(l=dn.map(T));const{chains:h,rpcMap:r}=rn({chain:u,client:n.client,optionalChains:l});await s.connect({...o!=null&&o.pairingTopic?{pairingTopic:o==null?void 0:o.pairingTopic}:{},optionalNamespaces:{[W]:{chains:h,events:["chainChanged","accountsChanged"],methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData","eth_signTypedData_v4","wallet_switchEthereumChain","wallet_addEthereumChain"],rpcMap:r}}}),F(h.map(_=>Number(_.split(":")[1])),t);const m=((A=h[0])==null?void 0:A.split(":")[1])||1,f=D(m),C=cn(s.session,"eip155:1");if(!C)throw new Error("No accounts found on provider.");const g=n.chain&&n.chain.id===f?n.chain:T(f);if(n){const _={chain:n.chain,optionalChains:(N=n.walletConnect)==null?void 0:N.optionalChains,pairingTopic:(S=n.walletConnect)==null?void 0:S.pairingTopic};t&&O(t,e,_)}return c&&s.events.removeListener("display_uri",c),k(C,g,s,i,t,n.client,d,a)}async function tn(n,i,e){var o,c,d,l,u,h;if(!n.session)throw new Error("No session found on provider.");const t=`eip155:${i.id}`,a=I(i.id);if(M(n.session,t)){n.setDefaultChain(t);return}try{await w({provider:n,payload:{method:"wallet_switchEthereumChain",params:[{chainId:a}]},chain:t,walletInfo:e}),n.setDefaultChain(t);return}catch(r){if(((r==null?void 0:r.code)??((c=(o=r==null?void 0:r.data)==null?void 0:o.originalError)==null?void 0:c.code))===4001)throw new Error("User rejected chain switch")}const s=sn(n.session);if(!s)throw new Error("No routable chain to send wallet_addEthereumChain");try{await w({provider:n,payload:{method:"wallet_addEthereumChain",params:[{chainId:a,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:[i.rpc],blockExplorerUrls:[((l=(d=i.blockExplorers)==null?void 0:d[0])==null?void 0:l.url)??""]}]},chain:s,walletInfo:e})}catch(r){throw((r==null?void 0:r.code)??((h=(u=r==null?void 0:r.data)==null?void 0:u.originalError)==null?void 0:h.code))===4001?new Error("User rejected add chain"):new Error(`Add chain failed: ${(r==null?void 0:r.message)||String(r)}`)}if(await w({provider:n,payload:{method:"wallet_switchEthereumChain",params:[{chainId:a}]},chain:t,walletInfo:e}),n.setDefaultChain(t),!M(n.session,t))throw new Error("Target chain still not enabled by wallet")}function P(n){var i;return(i=n==null?void 0:n.namespaces)==null?void 0:i.eip155}function M(n,i){var t;const e=P(n);return!!((t=e==null?void 0:e.accounts)!=null&&t.some(a=>a.startsWith(`${i}:`)))}function cn(n,i){var a;const e=P(n),t=((a=e==null?void 0:e.accounts)==null?void 0:a.find(s=>s.startsWith(`${i}:`)))||(e==null?void 0:e.accounts[0]);return t?t.split(":")[2]??null:null}function sn(n){var e,t,a,s;const i=P(n);return((s=(a=(t=(e=i==null?void 0:i.accounts)==null?void 0:e[0])==null?void 0:t.split(":"))==null?void 0:a.slice(0,2))==null?void 0:s.join(":"))??null}async function _n(n,i,e,t,a){var m,f,p,C,g;const s=t?await x(t,e):null,o=await U(e),c=await $(s?{chain:s.chain,client:n.client,walletConnect:{optionalChains:s.optionalChains,pairingTopic:s.pairingTopic}}:{client:n.client,walletConnect:{}},e,a);if(!c.session)throw await c.disconnect(),new Error("No wallet connect session found on provider.");const d=(p=(f=(m=c.session)==null?void 0:m.namespaces)==null?void 0:f[W])==null?void 0:p.accounts,l=(C=d==null?void 0:d[0])==null?void 0:C.split(":")[2];if(!l)throw new Error("No accounts found on provider.");const u=((g=n.chain)==null?void 0:g.id)||1,h=D(u),r=n.chain&&n.chain.id===h?n.chain:T(h);return k(l,r,c,i,t,n.client,o,a)}async function $(n,i,e){var c,d,l,u;if(y)return y;const t=await U(i),a=n.walletConnect,{UniversalProvider:s}=await G(async()=>{const{UniversalProvider:h}=await import("./index.es-B3Gbdgyi.js");return{UniversalProvider:h}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),o=await s.init({metadata:{description:((c=a==null?void 0:a.appMetadata)==null?void 0:c.description)||E().description,icons:[((d=a==null?void 0:a.appMetadata)==null?void 0:d.logoUrl)||E().logoUrl],name:((l=a==null?void 0:a.appMetadata)==null?void 0:l.name)||E().name,url:((u=a==null?void 0:a.appMetadata)==null?void 0:u.url)||E().url,redirect:{native:t.mobile.native||void 0,universal:t.mobile.universal||void 0}},projectId:(a==null?void 0:a.projectId)||nn});if(o.events.setMaxListeners(Number.POSITIVE_INFINITY),i!=="walletConnect"){async function h(){var m,f,p,C;const r=((C=(p=(f=(m=o.session)==null?void 0:m.peer)==null?void 0:f.metadata)==null?void 0:p.redirect)==null?void 0:C.native)||t.mobile.native||t.mobile.universal;e&&r&&await e(r)}o.on("session_request_sent",h),o.events.addListener("disconnect",()=>{o.off("session_request_sent",h),y=null})}return y=o,o}function j({provider:n,address:i,client:e,chain:t,sessionRequestHandler:a,walletInfo:s}){return{address:v(i),async sendTransaction(c){const d=await w({provider:n,payload:{method:"eth_sendTransaction",params:[{data:c.data,from:v(i),gas:c.gas?I(c.gas):void 0,to:c.to,value:c.value?I(c.value):void 0}]},chain:`eip155:${c.chainId}`,walletInfo:s,sessionRequestHandler:a});return H({chainId:c.chainId,client:e,contractAddress:c.to??void 0,gasPrice:c.gasPrice,transactionHash:d,walletAddress:v(i),walletType:"walletConnect"}),{transactionHash:d}},async signMessage({message:c}){const d=typeof c=="string"?Q(c):c.raw instanceof Uint8Array?Z(c.raw):c.raw;return w({provider:n,payload:{method:"personal_sign",params:[d,this.address]},chain:`eip155:${t.id}`,walletInfo:s,sessionRequestHandler:a})},async signTypedData(c){const d=en(c),{domain:l,message:u,primaryType:h}=d,r={EIP712Domain:X({domain:l}),...d.types};Y({domain:l,message:u,primaryType:h,types:r});const m=B({domain:l??{},message:u,primaryType:h,types:r});return await w({provider:n,payload:{method:"eth_signTypedData_v4",params:[this.address,m]},chain:`eip155:${t.id}`,walletInfo:s,sessionRequestHandler:a})}}}async function w(n){var d,l,u,h;const{provider:i,payload:e,chain:t,walletInfo:a,sessionRequestHandler:s}=n,o=i.request(e,t),c=((h=(u=(l=(d=i.session)==null?void 0:d.peer)==null?void 0:l.metadata)==null?void 0:u.redirect)==null?void 0:h.native)||a.mobile.native||a.mobile.universal;return s&&c&&await s(c),o}function k(n,i,e,t,a,s,o,c){const d=j({address:n,chain:i,client:s,provider:e,sessionRequestHandler:c,walletInfo:o});async function l(){e.removeListener("accountsChanged",h),e.removeListener("chainChanged",r),e.removeListener("disconnect",u),await e.disconnect(),y=null}function u(){F([],a),a==null||a.removeItem(b.lastUsedChainId),l(),t.emit("disconnect",void 0)}function h(m){if(m[0]){const f=j({address:v(m[0]),chain:i,client:s,provider:e,sessionRequestHandler:c,walletInfo:o});t.emit("accountChanged",f),t.emit("accountsChanged",m)}else u()}function r(m){const f=T(D(m));t.emit("chainChanged",f),a==null||a.setItem(b.lastUsedChainId,String(m))}return e.on("accountsChanged",h),e.on("chainChanged",r),e.on("disconnect",u),e.on("session_delete",u),[d,i,l,m=>on(e,m,o)]}async function on(n,i,e){try{await tn(n,i,e)}catch(t){const a=typeof t=="string"?t:t==null?void 0:t.message;throw/user rejected request/i.test(a)?new J(t):new K(t)}}function F(n,i){i==null||i.setItem(b.requestedChains,V(n))}function rn(n){const i={},e=[];n.chain&&(i[n.chain.id]=R({chain:n.chain,client:n.client}),e.push(n.chain.id));const t=((n==null?void 0:n.optionalChains)||[]).slice(0,10);for(const a of t)i[a.id]=R({chain:a,client:n.client}),e.push(a.id);return e.includes(1)||(i[1]=T(1).rpc,e.push(1)),{chains:e.map(a=>`eip155:${a}`),rpcMap:i}}const dn=[1,11155111,42161,43114,8453,1313161554,84532,56,42220,100,10,137,1101,324,534352,80094];export{_n as autoConnectWC,gn as connectWC};
@@ -1 +0,0 @@
1
- import{F as _,X as F}from"./thirdweb-CS6G_ZNe.js";const V="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",U=V.length,L=V.charAt(0),M=Math.log(256)/Math.log(U);function z(t){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length===0)return"";let e=0,i=0,n=0;const s=t.length;for(;n!==s&&t[n]===0;)n++,e++;const c=(s-n)*M+1>>>0,a=new Uint8Array(c);for(;n!==s;){let d=t[n]||0,w=0;for(let h=c-1;(d!==0||w<i)&&h!==-1;h--,w++)d+=256*(a[h]||0)>>>0,a[h]=d%U>>>0,d=d/U>>>0;if(d!==0)throw new Error("Non-zero carry");i=w,n++}let l=c-i;for(;l!==c&&a[l]===0;)l++;let u=L.repeat(e);for(;l<c;++l)u+=V.charAt(a[l]||0);return u}let o,E,r=0,j={},b,N;const D=0;let C=0,S,R,I;const $={mapsAsObjects:!0,useRecords:!1};function v(t){let e;if(t<16&&(e=T(t)))return e;if(t>64&&decoder)return decoder.decode(o.subarray(r,r+=t));const i=r+t,n=[];for(e="";r<i;){const s=o[r++];if(!(s&128))n.push(s);else if((s&224)===192){const c=o[r++]&63;n.push((s&31)<<6|c)}else if((s&240)===224){const c=o[r++]&63,a=o[r++]&63;n.push((s&31)<<12|c<<6|a)}else if((s&248)===240){const c=o[r++]&63,a=o[r++]&63,l=o[r++]&63;let u=(s&7)<<18|c<<12|a<<6|l;u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u)}else n.push(s);n.length>=4096&&(e+=x.apply(String,n),n.length=0)}return n.length>0&&(e+=x.apply(String,n)),e}class O{constructor(){Object.assign(this,$)}decodeKey(e){return e}decode(e,i=-1){E=i>-1?i:e.length,r=0,C=0,N=null,S=null,o=e;try{I=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw o=null,e instanceof Uint8Array?n:new Error(`Source must be a Uint8Array or Buffer but was a ${e&&typeof e=="object"?e.constructor.name:typeof e}`)}return this instanceof O?(j=this,this.sharedValues&&(this.pack?new Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),(!b||b.length>0)&&(b=[])):(j=$,(!b||b.length>0)&&(b=[])),H()}}function H(){try{const t=g();if(S){if(r>=S.postBundlePosition){const e=new Error("Unexpected bundle position");throw e.incomplete=!0,e}r=S.postBundlePosition,S=null}if(r===E)b=null,o=null,R&&(R=null);else if(r>E){const e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}else throw new Error("Data read, but end of buffer not reached");return t}catch(t){throw X(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer"))&&(t.incomplete=!0),t}}function g(){let t=o[r++];const e=t>>5;if(t=t&31,t>23)switch(t){case 24:t=o[r++];break;default:throw new Error(`Unknown token ${t}`)}switch(e){case 0:return t;case 1:return~t;case 2:return W(t);case 3:if(C>=r)return N.slice(r-D,(r+=t)-D);if(C===0&&E<140&&t<32){const i=t<16?T(t):K(t);if(i!==null)return i}return v(t);case 4:{const i=new Array(t);for(let n=0;n<t;n++)i[n]=g();return i}case 5:{const i={};for(let n=0;n<t;n++)i[J(g())]=g();return i}default:if(Number.isNaN(t)){const i=new Error("Unexpected end of CBOR data");throw i.incomplete=!0,i}throw new Error(`Unknown CBOR token ${t}`)}}function J(t){if(typeof t=="string")return t==="__proto__"?"__proto_":t;if(typeof t!="object")return t.toString();throw new Error(`Invalid property name type ${typeof t}`)}const x=String.fromCharCode;function K(t){const e=r,i=new Array(t);for(let n=0;n<t;n++){const s=o[r++];if((s&128)>0){r=e;return}i[n]=s}return x.apply(String,i)}function T(t){if(t<4){if(t<2){if(t===0)return"";const k=o[r++];if((k&128)>1){r-=1;return}return x(k)}const f=o[r++],p=o[r++];if((f&128)>0||(p&128)>0){r-=2;return}if(t<3)return x(f,p);const y=o[r++];if((y&128)>0){r-=3;return}return x(f,p,y)}const e=o[r++],i=o[r++],n=o[r++],s=o[r++];if((e&128)>0||(i&128)>0||(n&128)>0||(s&128)>0){r-=4;return}if(t<6){if(t===4)return x(e,i,n,s);const f=o[r++];if((f&128)>0){r-=5;return}return x(e,i,n,s,f)}if(t<8){const f=o[r++],p=o[r++];if((f&128)>0||(p&128)>0){r-=6;return}if(t<7)return x(e,i,n,s,f,p);const y=o[r++];if((y&128)>0){r-=7;return}return x(e,i,n,s,f,p,y)}const c=o[r++],a=o[r++],l=o[r++],u=o[r++];if((c&128)>0||(a&128)>0||(l&128)>0||(u&128)>0){r-=8;return}if(t<10){if(t===8)return x(e,i,n,s,c,a,l,u);const f=o[r++];if((f&128)>0){r-=9;return}return x(e,i,n,s,c,a,l,u,f)}if(t<12){const f=o[r++],p=o[r++];if((f&128)>0||(p&128)>0){r-=10;return}if(t<11)return x(e,i,n,s,c,a,l,u,f,p);const y=o[r++];if((y&128)>0){r-=11;return}return x(e,i,n,s,c,a,l,u,f,p,y)}const d=o[r++],w=o[r++],h=o[r++],m=o[r++];if((d&128)>0||(w&128)>0||(h&128)>0||(m&128)>0){r-=12;return}if(t<14){if(t===12)return x(e,i,n,s,c,a,l,u,d,w,h,m);const f=o[r++];if((f&128)>0){r-=13;return}return x(e,i,n,s,c,a,l,u,d,w,h,m,f)}const A=o[r++],B=o[r++];if((A&128)>0||(B&128)>0){r-=14;return}if(t<15)return x(e,i,n,s,c,a,l,u,d,w,h,m,A,B);const P=o[r++];if((P&128)>0){r-=15;return}return x(e,i,n,s,c,a,l,u,d,w,h,m,A,B,P)}function W(t){return j.copyBuffers?Uint8Array.prototype.slice.call(o,r,r+=t):o.subarray(r,r+=t)}function X(){o=null,R=null,b=null}const q=new Array(147);for(let t=0;t<256;t++)q[t]=+`1e${Math.floor(45.15-t*.30103)}`;const G=new O,Q=G.decode;function Y(t){return _(t,{strict:!1})?t:`0x${t}`}function tt(t){const e=F(Y(t)),i=e[e.length-2]*256+e[e.length-1],n=e.length-2-i;if(n<0||n>e.length)return;const s=e.slice(n,-2),c=Q(s);if("ipfs"in c)return`ipfs://${z(c.ipfs)}`}export{tt as extractIPFSUri};
@@ -1 +0,0 @@
1
- import{g as o}from"./wallets-CUOtYiA7.js";import"./thirdweb-CS6G_ZNe.js";import"./store-CraP4F4Y.js";import"./ui-Bc2xTSCT.js";import"./vendor-DgCFzUFU.js";import"./index-9l0HFt0G.js";import"./index-V_1m0BwN.js";import"./index-C9_jeDSj.js";import"./index-nibyPLVP.js";import"./ethereum-CuwXPURS.js";async function g(n){const l=await o(n);return{app:{android:null,browser:null,chrome:null,edge:null,firefox:null,ios:null,linux:null,mac:null,opera:null,safari:null,windows:null},desktop:{native:null,universal:null},homepage:l.homepage||"",id:n,image_id:l.imageUrl||"",mobile:{native:null,universal:null},name:l.name,rdns:null}}export{g as getEcosystemWalletInfo};
@@ -1 +0,0 @@
1
- import{r as X,Y as ge,$ as we,_ as Ce,a0 as Te,a1 as Ne}from"./thirdweb-CS6G_ZNe.js";const Oe="0x70a08231",Se=[{name:"_address",type:"address"}],Ae=[{type:"uint256"}];async function Ze(r){return X({contract:r.contract,method:[Oe,Se,Ae],params:[r.address]})}var g;(function(r){r.assertEqual=a=>{};function e(a){}r.assertIs=e;function t(a){throw new Error}r.assertNever=t,r.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},r.getValidEnumValues=a=>{const n=r.objectKeys(a).filter(d=>typeof a[a[d]]!="number"),i={};for(const d of n)i[d]=a[d];return r.objectValues(i)},r.objectValues=a=>r.objectKeys(a).map(function(n){return a[n]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},r.find=(a,n)=>{for(const i of a)if(n(i))return i},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}r.joinValues=s,r.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(g||(g={}));var ee;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ee||(ee={}));const u=g.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),T=r=>{switch(typeof r){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(r)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(r)?u.array:r===null?u.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?u.promise:typeof Map<"u"&&r instanceof Map?u.map:typeof Set<"u"&&r instanceof Set?u.set:typeof Date<"u"&&r instanceof Date?u.date:u.object;default:return u.unknown}},c=g.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class C extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(n){return n.message},s={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let d=s,h=0;for(;h<i.path.length;){const f=i.path[h];h===i.path.length-1?(d[f]=d[f]||{_errors:[]},d[f]._errors.push(t(i))):d[f]=d[f]||{_errors:[]},d=d[f],h++}}};return a(this),s}static assert(e){if(!(e instanceof C))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,g.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}C.create=r=>new C(r);const Y=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===u.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,g.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${g.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${g.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${g.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:g.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,g.assertNever(r)}return{message:t}};let Re=Y;function Ie(){return Re}const Ee=r=>{const{data:e,path:t,errorMaps:s,issueData:a}=r,n=[...t,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let d="";const h=s.filter(f=>!!f).slice().reverse();for(const f of h)d=f(i,{data:e,defaultError:d}).message;return{...a,path:n,message:d}};function o(r,e){const t=Ie(),s=Ee({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Y?void 0:Y].filter(a=>!!a)});r.common.issues.push(s)}class k{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if(a.status==="aborted")return m;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const a of t){const n=await a.key,i=await a.value;s.push({key:n,value:i})}return k.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return m;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}}const m=Object.freeze({status:"aborted"}),M=r=>({status:"dirty",value:r}),b=r=>({status:"valid",value:r}),te=r=>r.status==="aborted",re=r=>r.status==="dirty",I=r=>r.status==="valid",D=r=>typeof Promise<"u"&&r instanceof Promise;var l;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(l||(l={}));class S{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const se=(r,e)=>{if(I(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new C(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,d)=>{const{message:h}=r;return i.code==="invalid_enum_value"?{message:h??d.defaultError}:typeof d.data>"u"?{message:h??s??d.defaultError}:i.code!=="invalid_type"?{message:d.defaultError}:{message:h??t??d.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return T(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(D(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(e)},a=this._parseSync({data:e,path:s.path,parent:s});return se(s,a)}"~validate"(e){var s,a;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return I(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(a=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>I(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(D(a)?a:Promise.resolve(a));return se(s,n)}refine(e,t){const s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const i=e(a),d=()=>n.addIssue({code:c.custom,...s(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(h=>h?!0:(d(),!1)):i?!0:(d(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new $({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return O.create(this,this._def)}nullable(){return V.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return w.create(this)}promise(){return W.create(this,this._def)}or(e){return F.create([this,e],this._def)}and(e){return B.create(this,e,this._def)}transform(e){return new $({..._(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new J({..._(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new rt({typeName:p.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new G({..._(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return K.create(this,e)}readonly(){return Q.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const je=/^c[^\s-]{8,}$/i,$e=/^[0-9a-z]+$/,Ve=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Pe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Me=/^[a-z0-9_-]{21}$/i,Le=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ze=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,De=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ue="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let q;const Fe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Be=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,We=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,qe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ye=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,He=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ve="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Je=new RegExp(`^${ve}$`);function xe(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Ge(r){return new RegExp(`^${xe(r)}$`)}function Qe(r){let e=`${ve}T${xe(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Xe(r,e){return!!((e==="v4"||!e)&&Fe.test(r)||(e==="v6"||!e)&&We.test(r))}function Ke(r,e){if(!Le.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function et(r,e){return!!((e==="v4"||!e)&&Be.test(r)||(e==="v6"||!e)&&qe.test(r))}class N extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const n=this._getOrReturnCtx(e);return o(n,{code:c.invalid_type,expected:u.string,received:n.parsedType}),m}const s=new k;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),o(a,{code:c.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),o(a,{code:c.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,d=e.data.length<n.value;(i||d)&&(a=this._getOrReturnCtx(e,a),i?o(a,{code:c.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):d&&o(a,{code:c.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")De.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"email",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")q||(q=new RegExp(Ue,"u")),q.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"emoji",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Pe.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"uuid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Me.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"nanoid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")je.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"cuid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")$e.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"cuid2",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Ve.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"ulid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),o(a,{validation:"url",code:c.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"regex",code:c.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Qe(n).test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Je.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Ge(n).test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?ze.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"duration",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Xe(e.data,n.version)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"ip",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Ke(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"jwt",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?et(e.data,n.version)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"cidr",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Ye.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"base64",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?He.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"base64url",code:c.invalid_string,message:n.message}),s.dirty()):g.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:c.invalid_string,...l.errToObj(s)})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...l.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...l.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...l.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new N({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}N.create=r=>new N({checks:[],typeName:p.ZodString,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});function tt(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,n=Number.parseInt(r.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class E extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==u.number){const n=this._getOrReturnCtx(e);return o(n,{code:c.invalid_type,expected:u.number,received:n.parsedType}),m}let s;const a=new k;for(const n of this._def.checks)n.kind==="int"?g.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),o(s,{code:c.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?tt(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),o(s,{code:c.not_finite,message:n.message}),a.dirty()):g.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,a){return new E({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(a)}]})}_addCheck(e){return new E({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&g.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}E.create=r=>new E({checks:[],typeName:p.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class L extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.bigint)return this._getInvalidInput(e);let s;const a=new k;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):g.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return o(t,{code:c.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,a){return new L({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(a)}]})}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}L.create=r=>new L({checks:[],typeName:p.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});class ae extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.boolean,received:s.parsedType}),m}return b(e.data)}}ae.create=r=>new ae({typeName:p.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class U extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const n=this._getOrReturnCtx(e);return o(n,{code:c.invalid_type,expected:u.date,received:n.parsedType}),m}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return o(n,{code:c.invalid_date}),m}const s=new k;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),o(a,{code:c.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),o(a,{code:c.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):g.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}U.create=r=>new U({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:p.ZodDate,..._(r)});class ne extends y{_parse(e){if(this._getType(e)!==u.symbol){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.symbol,received:s.parsedType}),m}return b(e.data)}}ne.create=r=>new ne({typeName:p.ZodSymbol,..._(r)});class ie extends y{_parse(e){if(this._getType(e)!==u.undefined){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.undefined,received:s.parsedType}),m}return b(e.data)}}ie.create=r=>new ie({typeName:p.ZodUndefined,..._(r)});class de extends y{_parse(e){if(this._getType(e)!==u.null){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.null,received:s.parsedType}),m}return b(e.data)}}de.create=r=>new de({typeName:p.ZodNull,..._(r)});class ce extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return b(e.data)}}ce.create=r=>new ce({typeName:p.ZodAny,..._(r)});class oe extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return b(e.data)}}oe.create=r=>new oe({typeName:p.ZodUnknown,..._(r)});class A extends y{_parse(e){const t=this._getOrReturnCtx(e);return o(t,{code:c.invalid_type,expected:u.never,received:t.parsedType}),m}}A.create=r=>new A({typeName:p.ZodNever,..._(r)});class ue extends y{_parse(e){if(this._getType(e)!==u.undefined){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.void,received:s.parsedType}),m}return b(e.data)}}ue.create=r=>new ue({typeName:p.ZodVoid,..._(r)});class w extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.array)return o(t,{code:c.invalid_type,expected:u.array,received:t.parsedType}),m;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,d=t.data.length<a.exactLength.value;(i||d)&&(o(t,{code:i?c.too_big:c.too_small,minimum:d?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(o(t,{code:c.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(o(t,{code:c.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,d)=>a.type._parseAsync(new S(t,i,t.path,d)))).then(i=>k.mergeArray(s,i));const n=[...t.data].map((i,d)=>a.type._parseSync(new S(t,i,t.path,d)));return k.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new w({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new w({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new w({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}w.create=(r,e)=>new w({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,..._(e)});function R(r){if(r instanceof x){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=O.create(R(s))}return new x({...r._def,shape:()=>e})}else return r instanceof w?new w({...r._def,type:R(r.element)}):r instanceof O?O.create(R(r.unwrap())):r instanceof V?V.create(R(r.unwrap())):r instanceof Z?Z.create(r.items.map(e=>R(e))):r}class x extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=g.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const f=this._getOrReturnCtx(e);return o(f,{code:c.invalid_type,expected:u.object,received:f.parsedType}),m}const{status:s,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),d=[];if(!(this._def.catchall instanceof A&&this._def.unknownKeys==="strip"))for(const f in a.data)i.includes(f)||d.push(f);const h=[];for(const f of i){const v=n[f],P=a.data[f];h.push({key:{status:"valid",value:f},value:v._parse(new S(a,P,a.path,f)),alwaysSet:f in a.data})}if(this._def.catchall instanceof A){const f=this._def.unknownKeys;if(f==="passthrough")for(const v of d)h.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(f==="strict")d.length>0&&(o(a,{code:c.unrecognized_keys,keys:d}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const v of d){const P=a.data[v];h.push({key:{status:"valid",value:v},value:f._parse(new S(a,P,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const f=[];for(const v of h){const P=await v.key,be=await v.value;f.push({key:P,value:be,alwaysSet:v.alwaysSet})}return f}).then(f=>k.mergeObjectSync(s,f)):k.mergeObjectSync(s,h)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,i;const a=((i=(n=this._def).errorMap)==null?void 0:i.call(n,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(e){return new x({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new x({...this._def,catchall:e})}pick(e){const t={};for(const s of g.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}omit(e){const t={};for(const s of g.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}deepPartial(){return R(this)}partial(e){const t={};for(const s of g.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new x({...this._def,shape:()=>t})}required(e){const t={};for(const s of g.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof O;)n=n._def.innerType;t[s]=n}return new x({...this._def,shape:()=>t})}keyof(){return ke(g.objectKeys(this.shape))}}x.create=(r,e)=>new x({shape:()=>r,unknownKeys:"strip",catchall:A.create(),typeName:p.ZodObject,..._(e)});x.strictCreate=(r,e)=>new x({shape:()=>r,unknownKeys:"strict",catchall:A.create(),typeName:p.ZodObject,..._(e)});x.lazycreate=(r,e)=>new x({shape:r,unknownKeys:"strip",catchall:A.create(),typeName:p.ZodObject,..._(e)});class F extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function a(n){for(const d of n)if(d.result.status==="valid")return d.result;for(const d of n)if(d.result.status==="dirty")return t.common.issues.push(...d.ctx.common.issues),d.result;const i=n.map(d=>new C(d.ctx.common.issues));return o(t,{code:c.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(s.map(async n=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const h of s){const f={...t,common:{...t.common,issues:[]},parent:null},v=h._parseSync({data:t.data,path:t.path,parent:f});if(v.status==="valid")return v;v.status==="dirty"&&!n&&(n={result:v,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const d=i.map(h=>new C(h));return o(t,{code:c.invalid_union,unionErrors:d}),m}}get options(){return this._def.options}}F.create=(r,e)=>new F({options:r,typeName:p.ZodUnion,..._(e)});function H(r,e){const t=T(r),s=T(e);if(r===e)return{valid:!0,data:r};if(t===u.object&&s===u.object){const a=g.objectKeys(e),n=g.objectKeys(r).filter(d=>a.indexOf(d)!==-1),i={...r,...e};for(const d of n){const h=H(r[d],e[d]);if(!h.valid)return{valid:!1};i[d]=h.data}return{valid:!0,data:i}}else if(t===u.array&&s===u.array){if(r.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<r.length;n++){const i=r[n],d=e[n],h=H(i,d);if(!h.valid)return{valid:!1};a.push(h.data)}return{valid:!0,data:a}}else return t===u.date&&s===u.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class B extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(n,i)=>{if(te(n)||te(i))return m;const d=H(n.value,i.value);return d.valid?((re(n)||re(i))&&t.dirty(),{status:t.value,value:d.data}):(o(s,{code:c.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}B.create=(r,e,t)=>new B({left:r,right:e,typeName:p.ZodIntersection,..._(t)});class Z extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.array)return o(s,{code:c.invalid_type,expected:u.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return o(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(o(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((i,d)=>{const h=this._def.items[d]||this._def.rest;return h?h._parse(new S(s,i,s.path,d)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>k.mergeArray(t,i)):k.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Z({...this._def,rest:e})}}Z.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Z({items:r,typeName:p.ZodTuple,rest:null,..._(e)})};class le extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.map)return o(s,{code:c.invalid_type,expected:u.map,received:s.parsedType}),m;const a=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([d,h],f)=>({key:a._parse(new S(s,d,s.path,[f,"key"])),value:n._parse(new S(s,h,s.path,[f,"value"]))}));if(s.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const h of i){const f=await h.key,v=await h.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),d.set(f.value,v.value)}return{status:t.value,value:d}})}else{const d=new Map;for(const h of i){const f=h.key,v=h.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),d.set(f.value,v.value)}return{status:t.value,value:d}}}}le.create=(r,e,t)=>new le({valueType:e,keyType:r,typeName:p.ZodMap,..._(t)});class z extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.set)return o(s,{code:c.invalid_type,expected:u.set,received:s.parsedType}),m;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(o(s,{code:c.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(o(s,{code:c.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(h){const f=new Set;for(const v of h){if(v.status==="aborted")return m;v.status==="dirty"&&t.dirty(),f.add(v.value)}return{status:t.value,value:f}}const d=[...s.data.values()].map((h,f)=>n._parse(new S(s,h,s.path,f)));return s.common.async?Promise.all(d).then(h=>i(h)):i(d)}min(e,t){return new z({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new z({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}z.create=(r,e)=>new z({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,..._(e)});class he extends y{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}he.create=(r,e)=>new he({getter:r,typeName:p.ZodLazy,..._(e)});class fe extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return o(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}fe.create=(r,e)=>new fe({value:r,typeName:p.ZodLiteral,..._(e)});function ke(r,e){return new j({values:r,typeName:p.ZodEnum,..._(e)})}class j extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return o(t,{expected:g.joinValues(s),received:t.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return o(t,{received:t.data,code:c.invalid_enum_value,options:s}),m}return b(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return j.create(e,{...this._def,...t})}exclude(e,t=this._def){return j.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}j.create=ke;class me extends y{_parse(e){const t=g.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==u.string&&s.parsedType!==u.number){const a=g.objectValues(t);return o(s,{expected:g.joinValues(a),received:s.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(g.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=g.objectValues(t);return o(s,{received:s.data,code:c.invalid_enum_value,options:a}),m}return b(e.data)}get enum(){return this._def.values}}me.create=(r,e)=>new me({values:r,typeName:p.ZodNativeEnum,..._(e)});class W extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return o(t,{code:c.invalid_type,expected:u.promise,received:t.parsedType}),m;const s=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return b(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}W.create=(r,e)=>new W({type:r,typeName:p.ZodPromise,..._(e)});class $ extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{o(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async d=>{if(t.value==="aborted")return m;const h=await this._def.schema._parseAsync({data:d,path:s.path,parent:s});return h.status==="aborted"?m:h.status==="dirty"||t.value==="dirty"?M(h.value):h});{if(t.value==="aborted")return m;const d=this._def.schema._parseSync({data:i,path:s.path,parent:s});return d.status==="aborted"?m:d.status==="dirty"||t.value==="dirty"?M(d.value):d}}if(a.type==="refinement"){const i=d=>{const h=a.refinement(d,n);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(s.common.async===!1){const d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return d.status==="aborted"?m:(d.status==="dirty"&&t.dirty(),i(d.value),{status:t.value,value:d.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>d.status==="aborted"?m:(d.status==="dirty"&&t.dirty(),i(d.value).then(()=>({status:t.value,value:d.value}))))}if(a.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!I(i))return m;const d=a.transform(i.value,n);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:d}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>I(i)?Promise.resolve(a.transform(i.value,n)).then(d=>({status:t.value,value:d})):m);g.assertNever(a)}}$.create=(r,e,t)=>new $({schema:r,typeName:p.ZodEffects,effect:e,..._(t)});$.createWithPreprocess=(r,e,t)=>new $({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,..._(t)});class O extends y{_parse(e){return this._getType(e)===u.undefined?b(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}O.create=(r,e)=>new O({innerType:r,typeName:p.ZodOptional,..._(e)});class V extends y{_parse(e){return this._getType(e)===u.null?b(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}V.create=(r,e)=>new V({innerType:r,typeName:p.ZodNullable,..._(e)});class J extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===u.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}J.create=(r,e)=>new J({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class G extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return D(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}G.create=(r,e)=>new G({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class pe extends y{_parse(e){if(this._getType(e)!==u.nan){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}}pe.create=r=>new pe({typeName:p.ZodNaN,..._(r)});class rt extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class K extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),M(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new K({in:e,out:t,typeName:p.ZodPipeline})}}class Q extends y{_parse(e){const t=this._def.innerType._parse(e),s=a=>(I(a)&&(a.value=Object.freeze(a.value)),a);return D(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}}Q.create=(r,e)=>new Q({innerType:r,typeName:p.ZodReadonly,..._(e)});var p;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(p||(p={}));const _e=N.create,st=E.create;A.create;w.create;const at=x.create;F.create;B.create;Z.create;j.create;W.create;O.create;V.create;const nt="0x06fdde03",it=[],dt=[{type:"string"}];async function ct(r){return X({contract:r.contract,method:[nt,it,dt],params:[]})}async function ot(r){return ge(()=>ct(r),{cacheKey:`${r.contract.chain.id}:${r.contract.address}:name`,cacheTime:Number.POSITIVE_INFINITY})}const ut="0x95d89b41",lt=[],ht=[{type:"string"}];async function ft(r){return X({contract:r.contract,method:[ut,lt,ht],params:[]})}async function mt(r){return ge(()=>ft(r),{cacheKey:`${r.contract.chain.id}:${r.contract.address}:symbol`,cacheTime:Number.POSITIVE_INFINITY})}const ye=at({name:_e().default("Ether"),symbol:_e().default("ETH"),decimals:st().default(18)}).default({name:"Ether",symbol:"ETH",decimals:18});async function pt(r){if(we(r.contract.address)){if(!r.contract.chain.nativeCurrency||!r.contract.chain.nativeCurrency.name||!r.contract.chain.nativeCurrency.symbol||!r.contract.chain.nativeCurrency.decimals)try{const{getChainMetadata:e}=await Ce(async()=>{const{getChainMetadata:s}=await import("./thirdweb-CS6G_ZNe.js").then(a=>a.ch);return{getChainMetadata:s}},[]),t=await e(r.contract.chain);return ye.parse({...t.nativeCurrency,...r.contract.chain.nativeCurrency})}catch{}return ye.parse(r.contract.chain.nativeCurrency)}try{const[e,t,s]=await Promise.all([ot(r).catch(()=>""),mt(r),Te(r)]);return{decimals:s,name:e,symbol:t}}catch(e){throw new Error(`Invalid currency token: ${e}`)}}async function yt(r){const[e,t]=await Promise.all([Ze(r),pt(r)]);return{...t,chainId:r.contract.chain.id,displayValue:Ne(e,t.decimals),tokenAddress:r.contract.address,value:e}}export{yt as getBalance};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/in-app-wallet-calls-CwwQ0VDY.js","assets/thirdweb-CS6G_ZNe.js"])))=>i.map(i=>d[i]);
2
- import{r as C,a2 as q,_ as T,a3 as ct,o as ot,a4 as B,Z as z,a5 as K,a6 as E,a7 as O,a8 as x,a9 as Z,aa as S,ab as dt,s as j,ac as _,ad as $,R as k,Q as D,X as pt,ae as mt,af as ut,x as L,ag as Y,H as yt,D as lt,N as ft,ah as wt,ai as Q,aj as X,ak as At,al as Gt,am as gt,an as ht,f as J,b as F,t as V,ao as tt,ap as Tt,y as Pt,aq as vt,ar as Lt}from"./thirdweb-CS6G_ZNe.js";import{Q as at,R as Dt,S as Ot,T as xt,U as St,W as U,p as Ct,X as _t,Z as Et,_ as Ft}from"./wallets-CUOtYiA7.js";import{$ as Qa}from"./wallets-CUOtYiA7.js";import{t as Vt,p as Ut,s as It}from"./send-eip712-transaction-fuVr-0Wu.js";import"./store-CraP4F4Y.js";import"./ui-Bc2xTSCT.js";import"./vendor-DgCFzUFU.js";import"./index-9l0HFt0G.js";import"./index-V_1m0BwN.js";import"./index-C9_jeDSj.js";import"./index-nibyPLVP.js";import"./ethereum-CuwXPURS.js";const bt="0xdd62ed3e",Rt=[{name:"owner",type:"address"},{name:"spender",type:"address"}],Nt=[{type:"uint256"}];async function $t(a){return C({contract:a.contract,method:[bt,Rt,Nt],params:[a.owner,a.spender]})}const kt="0x095ea7b3",Ht=[{name:"spender",type:"address"},{name:"value",type:"uint256"}],Mt=[{type:"bool"}];function Wt(a){const e=at(async()=>"asyncParams"in a?await a.asyncParams():a);return q({accessList:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.accessList},authorizationList:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.authorizationList},contract:a.contract,erc20Value:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.erc20Value},extraGas:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.extraGas},gas:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.gas},gasPrice:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.gasPrice},maxFeePerGas:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.maxFeePerGas},maxPriorityFeePerGas:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.maxPriorityFeePerGas},method:[kt,Ht,Mt],nonce:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.nonce},params:async()=>{const t=await e();return[t.spender,t.value]},value:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.value}})}function qt(a){return Wt({asyncParams:async()=>{let e;if("amount"in a){const{decimals:t}=await T(async()=>{const{decimals:r}=await import("./thirdweb-CS6G_ZNe.js").then(n=>n.cm);return{decimals:r}},[]),i=await t(a).catch(()=>18);e=ct(a.amount.toString(),i)}else e=a.amountWei;return{overrides:{erc20Value:{amountWei:e,tokenAddress:a.contract.address},...a.overrides},spender:a.spender,value:e}},contract:a.contract})}const Bt="0xf15d424e",zt=[{name:"signer",type:"address"}],Kt=[{components:[{name:"signer",type:"address"},{name:"approvedTargets",type:"address[]"},{name:"nativeTokenLimitPerTransaction",type:"uint256"},{name:"startTimestamp",type:"uint128"},{name:"endTimestamp",type:"uint128"}],name:"permissions",type:"tuple"}];async function Zt(a){return C({contract:a.contract,method:[Bt,zt,Kt],params:[a.signer]})}const jt="0x5892e236",Yt=[{components:[{name:"signer",type:"address"},{name:"isAdmin",type:"uint8"},{name:"approvedTargets",type:"address[]"},{name:"nativeTokenLimitPerTransaction",type:"uint256"},{name:"permissionStartTimestamp",type:"uint128"},{name:"permissionEndTimestamp",type:"uint128"},{name:"reqValidityStartTimestamp",type:"uint128"},{name:"reqValidityEndTimestamp",type:"uint128"},{name:"uid",type:"bytes32"}],name:"req",type:"tuple"},{name:"signature",type:"bytes"}],Qt=[];function Xt(a){const e=at(async()=>"asyncParams"in a?await a.asyncParams():a);return q({accessList:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.accessList},authorizationList:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.authorizationList},contract:a.contract,erc20Value:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.erc20Value},extraGas:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.extraGas},gas:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.gas},gasPrice:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.gasPrice},maxFeePerGas:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.maxFeePerGas},maxPriorityFeePerGas:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.maxPriorityFeePerGas},method:[jt,Yt,Qt],nonce:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.nonce},params:async()=>{const t=await e();return[t.req,t.signature]},value:async()=>{var t;return(t=(await e()).overrides)==null?void 0:t.value}})}function W(){return new Date(Date.now()+1e3*60*60*24*365*10)}function b(a){return Vt(Math.floor(a.getTime()/1e3))}const Jt=[{name:"signer",type:"address"},{name:"isAdmin",type:"uint8"},{name:"approvedTargets",type:"address[]"},{name:"nativeTokenLimitPerTransaction",type:"uint256"},{name:"permissionStartTimestamp",type:"uint128"},{name:"permissionEndTimestamp",type:"uint128"},{name:"reqValidityStartTimestamp",type:"uint128"},{name:"reqValidityEndTimestamp",type:"uint128"},{name:"uid",type:"bytes32"}];async function ta(a){const{account:e,contract:t,req:i}=a,r=await e.signTypedData({domain:{chainId:t.chain.id,name:"Account",verifyingContract:t.address,version:"1"},message:i,primaryType:"SignerPermissionRequest",types:{SignerPermissionRequest:Jt}});return{req:i,signature:r}}async function aa(a){var i;const{target:e,permissions:t}=a;return{approvedTargets:t.approvedTargets==="*"?[z]:t.approvedTargets,isAdmin:0,nativeTokenLimitPerTransaction:B(((i=t.nativeTokenLimitPerTransaction)==null?void 0:i.toString())||"0"),permissionEndTimestamp:b(t.permissionEndTimestamp||W()),permissionStartTimestamp:b(t.permissionStartTimestamp||new Date(0)),reqValidityEndTimestamp:b(W()),reqValidityStartTimestamp:0n,signer:e,uid:await ot()}}function ea(a){const{contract:e,sessionKeyAddress:t,account:i,permissions:r}=a;return Xt({async asyncParams(){const{req:n,signature:c}=await ta({account:i,contract:e,req:await aa({permissions:r,target:t})});return{req:n,signature:c}},contract:e})}async function sa(a){var c;const{accountContract:e,sessionKeyAddress:t,newPermissions:i}=a;if(!await K(e))return!0;const n=await Zt({contract:e,signer:t});return!!(n.endTimestamp&&n.endTimestamp<Math.floor(Date.now()/1e3)||!na(n.approvedTargets,i.approvedTargets)||B(((c=i.nativeTokenLimitPerTransaction)==null?void 0:c.toString())??"0")>n.nativeTokenLimitPerTransaction)}function na(a,e){return e==="*"&&a.length===1&&a[0]===z?!0:e!=="*"?e.map(t=>t.toLowerCase()).every(t=>a.map(i=>i.toLowerCase()).includes(t)):!1}const ra=2n**96n-1n,ia="0x35567e1a",ca=[{name:"sender",type:"address"},{name:"key",type:"uint192"}],oa=[{name:"nonce",type:"uint256"}];async function da(a){return C({contract:a.contract,method:[ia,ca,oa],params:[a.sender,a.key]})}const pa="0xa6193531",ma=[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],ua=[{type:"bytes32"}];async function ya(a){return C({contract:a.contract,method:[pa,ma,ua],params:[a.userOp]})}const la="0x22cdde4c",fa=[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"accountGasLimits",type:"bytes32"},{name:"preVerificationGas",type:"uint256"},{name:"gasFees",type:"bytes32"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],wa=[{type:"bytes32"}];async function Aa(a){return C({contract:a.contract,method:[la,fa,wa],params:[a.userOp]})}function Ga(a){return a.factory?E([a.factory,a.factoryData||"0x"]):"0x"}function ga(a){return E([O(x(BigInt(a.verificationGasLimit)),{size:16}),O(x(BigInt(a.callGasLimit)),{size:16})])}function ha(a){return E([O(x(BigInt(a.maxPriorityFeePerGas)),{size:16}),O(x(BigInt(a.maxFeePerGas)),{size:16})])}function Ta(a){return a.paymaster?E([a.paymaster,O(x(BigInt(a.paymasterVerificationGasLimit||0)),{size:16}),O(x(BigInt(a.paymasterPostOpGasLimit||0)),{size:16}),a.paymasterData||"0x"]):"0x"}const Pa=a=>({accountGasLimits:ga(a),callData:a.callData,gasFees:ha(a),initCode:Ga(a),nonce:BigInt(a.nonce),paymasterAndData:Ta(a),preVerificationGas:BigInt(a.preVerificationGas),sender:a.sender,signature:a.signature});async function I(a){var A;const{userOp:e,paymasterOverride:t,client:i,chain:r,entrypointAddress:n}=a;if(t)return t(e);const c={"Content-Type":"application/json"},s=n??S,o=Z(r),d={id:1,jsonrpc:"2.0",method:"pm_sponsorUserOperation",params:[Dt(e),s]},l=await dt(i)(o,{body:j(d),headers:c,method:"POST"});if(!l.ok){const G=await l.text()||l.statusText;throw new Error(`Paymaster error: ${l.status} - ${G}`)}const m=await l.json();if(m.result)return typeof m.result=="string"?{paymasterAndData:m.result}:(m.result.reason&&console.warn(`Paymaster policy rejected this transaction with reason: ${m.result.reason} ${m.result.policyId?`(policyId: ${m.result.policyId})`:""}`),{callGasLimit:m.result.callGasLimit?_(m.result.callGasLimit):void 0,paymaster:m.result.paymaster,paymasterAndData:m.result.paymasterAndData,paymasterData:m.result.paymasterData,paymasterPostOpGasLimit:m.result.paymasterPostOpGasLimit?_(m.result.paymasterPostOpGasLimit):void 0,paymasterVerificationGasLimit:m.result.paymasterVerificationGasLimit?_(m.result.paymasterVerificationGasLimit):void 0,preVerificationGas:m.result.preVerificationGas?_(m.result.preVerificationGas):void 0,verificationGasLimit:m.result.verificationGasLimit?_(m.result.verificationGasLimit):void 0});const w=((A=m.error)==null?void 0:A.message)||m.error||l.statusText||"unknown error";throw new Error(`Paymaster error from ${o}: ${w}`)}const H=new Set,M=a=>`${a.chain.id}:${a.address}`,et=a=>{H.add(M(a))},st=a=>{H.delete(M(a))},nt=a=>H.has(M(a));async function va(a){const e=a.timeoutMs||12e4,t=a.intervalMs||1e3,i=Date.now()+e;for(;Date.now()<i;){const r=await Ot(a);if(r)return r;await new Promise(n=>setTimeout(n,t))}throw new Error(`Timeout waiting for userOp to be mined on chain ${a.chain.id} with UserOp hash: ${a.userOpHash}`)}async function La(a){var P;const{transaction:e,accountContract:t,factoryContract:i,adminAddress:r,overrides:n,sponsorGas:c,waitForDeployment:s=!0,isDeployedOverride:o}=a,d=e.chain,y=e.client,l={bundlerUrl:n==null?void 0:n.bundlerUrl,chain:d,client:y,entrypointAddress:n==null?void 0:n.entrypointAddress},m=$(((P=a.overrides)==null?void 0:P.entrypointAddress)||S),[w,A,G,g,f]=await Promise.all([typeof o=="boolean"?o:K(t).then(h=>h||nt(t)),k(e),D(e.gas),Da({bundlerOptions:l,chain:d,client:y,executeTx:e}),Ea({accountContract:t,chain:d,client:y,entrypointAddress:n==null?void 0:n.entrypointAddress,getNonceOverride:n==null?void 0:n.getAccountNonce})]),{maxFeePerGas:p,maxPriorityFeePerGas:u}=g;return m==="v0.7"?Oa({accountContract:t,adminAddress:r,bundlerOptions:l,callData:A,callGasLimit:G,factoryContract:i,isDeployed:w,maxFeePerGas:p,maxPriorityFeePerGas:u,nonce:f,overrides:n,sponsorGas:c,waitForDeployment:s}):xa({accountContract:t,adminAddress:r,bundlerOptions:l,callData:A,callGasLimit:G,factoryContract:i,isDeployed:w,maxFeePerGas:p,maxPriorityFeePerGas:u,nonce:f,overrides:n,sponsorGas:c,waitForDeployment:s})}async function Da(a){const{executeTx:e,bundlerOptions:t,chain:i,client:r}=a;let{maxFeePerGas:n,maxPriorityFeePerGas:c}=e;const s=(t==null?void 0:t.bundlerUrl)??Z(i);if(mt(s)){const o=await xt({options:t});n=o.maxFeePerGas,c=o.maxPriorityFeePerGas}else{const[o,d]=await Promise.all([D(n),D(c)]);if(o&&d)n=o,c=d;else{const y=await ut(r,i);c=d??y.maxPriorityFeePerGas??0n,n=o??y.maxFeePerGas??0n}}return{maxFeePerGas:n,maxPriorityFeePerGas:c}}async function Oa(a){const{bundlerOptions:e,isDeployed:t,factoryContract:i,accountContract:r,adminAddress:n,sponsorGas:c,overrides:s,nonce:o,callData:d,callGasLimit:y,maxFeePerGas:l,maxPriorityFeePerGas:m,waitForDeployment:w}=a,{chain:A,client:G}=e;let g,f;t?(f="0x",w&&await rt(r)):(g=i.address,f=await k(Y({accountSalt:s==null?void 0:s.accountSalt,adminAddress:n,createAccountOverride:s==null?void 0:s.createAccount,factoryContract:i})),w&&et(r));const p={callData:d,callGasLimit:y??0n,factory:g,factoryData:f,maxFeePerGas:l,maxPriorityFeePerGas:m,nonce:o,paymaster:void 0,paymasterData:"0x",paymasterPostOpGasLimit:0n,paymasterVerificationGasLimit:0n,preVerificationGas:0n,sender:r.address,signature:Q,verificationGasLimit:0n};if(c){const u=await I({chain:A,client:G,entrypointAddress:s==null?void 0:s.entrypointAddress,paymasterOverride:s==null?void 0:s.paymaster,userOp:p});if(u.paymaster&&u.paymasterData&&(p.paymaster=u.paymaster,p.paymasterData=u.paymasterData),u.callGasLimit&&u.verificationGasLimit&&u.preVerificationGas&&u.paymasterPostOpGasLimit&&u.paymasterVerificationGasLimit)p.callGasLimit=u.callGasLimit,p.verificationGasLimit=u.verificationGasLimit,p.preVerificationGas=u.preVerificationGas,p.paymasterPostOpGasLimit=u.paymasterPostOpGasLimit,p.paymasterVerificationGasLimit=u.paymasterVerificationGasLimit;else{const P=s!=null&&s.tokenPaymaster?{[s.tokenPaymaster.tokenAddress]:{stateDiff:{[yt(lt([{type:"address"},{type:"uint256"}],[r.address,s.tokenPaymaster.balanceStorageSlot]))]:ft(wt,{size:32})}}}:void 0,h=await U({options:e,userOp:p},P);p.callGasLimit=h.callGasLimit,p.verificationGasLimit=h.verificationGasLimit,p.preVerificationGas=h.preVerificationGas,p.paymasterPostOpGasLimit=s!=null&&s.tokenPaymaster?500000n:h.paymasterPostOpGasLimit||0n,p.paymasterVerificationGasLimit=h.paymasterVerificationGasLimit||0n;const v=await I({chain:A,client:G,entrypointAddress:s==null?void 0:s.entrypointAddress,paymasterOverride:s==null?void 0:s.paymaster,userOp:p});v.paymaster&&v.paymasterData&&(p.paymaster=v.paymaster,p.paymasterData=v.paymasterData)}}else{const u=await U({options:e,userOp:p});p.callGasLimit=u.callGasLimit,p.verificationGasLimit=u.verificationGasLimit,p.preVerificationGas=u.preVerificationGas,p.paymasterPostOpGasLimit=u.paymasterPostOpGasLimit||0n,p.paymasterVerificationGasLimit=u.paymasterVerificationGasLimit||0n}return{...p,signature:"0x"}}async function xa(a){const{bundlerOptions:e,isDeployed:t,factoryContract:i,accountContract:r,adminAddress:n,sponsorGas:c,overrides:s,nonce:o,callData:d,callGasLimit:y,maxFeePerGas:l,maxPriorityFeePerGas:m,waitForDeployment:w}=a,{chain:A,client:G}=e;let g;t?(g="0x",w&&await rt(r)):(g=await _a({accountSalt:s==null?void 0:s.accountSalt,adminAddress:n,createAccountOverride:s==null?void 0:s.createAccount,factoryContract:i}),w&&et(r));const f={callData:d,callGasLimit:y??0n,initCode:g,maxFeePerGas:l,maxPriorityFeePerGas:m,nonce:o,paymasterAndData:"0x",preVerificationGas:0n,sender:r.address,signature:Q,verificationGasLimit:0n};if(c){const p=await I({chain:A,client:G,entrypointAddress:s==null?void 0:s.entrypointAddress,paymasterOverride:s==null?void 0:s.paymaster,userOp:f}),u="paymasterAndData"in p?p.paymasterAndData:"0x";if(u&&u!=="0x"&&(f.paymasterAndData=u),p.callGasLimit&&p.verificationGasLimit&&p.preVerificationGas)f.callGasLimit=p.callGasLimit,f.verificationGasLimit=p.verificationGasLimit,f.preVerificationGas=p.preVerificationGas;else{const P=await U({options:e,userOp:f});if(f.callGasLimit=P.callGasLimit,f.verificationGasLimit=P.verificationGasLimit,f.preVerificationGas=P.preVerificationGas,u&&u!=="0x"){const h=await I({chain:A,client:G,entrypointAddress:s==null?void 0:s.entrypointAddress,paymasterOverride:s==null?void 0:s.paymaster,userOp:f}),v="paymasterAndData"in h?h.paymasterAndData:"0x";v&&v!=="0x"&&(f.paymasterAndData=v)}}}else{const p=await U({options:e,userOp:f});f.callGasLimit=p.callGasLimit,f.verificationGasLimit=p.verificationGasLimit,f.preVerificationGas=p.preVerificationGas}return{...f,signature:"0x"}}async function Sa(a){const{userOp:e,chain:t,entrypointAddress:i,adminAccount:r}=a,n=await Ca({chain:t,client:a.client,entrypointAddress:i,userOp:e});if(r.signMessage){const c=await r.signMessage({chainId:t.id,message:{raw:pt(n)},originalMessage:j(e)});return{...e,signature:c}}throw new Error("signMessage not implemented in signingAccount")}async function Ca(a){const{userOp:e,chain:t,entrypointAddress:i}=a,r=$(i||S);let n;if(r==="v0.7"){const c=Pa(e);n=await Aa({contract:L({address:i||X,chain:t,client:a.client}),userOp:c})}else n=await ya({contract:L({address:i||S,chain:t,client:a.client}),userOp:e});return n}async function _a(a){const{factoryContract:e,adminAddress:t,accountSalt:i,createAccountOverride:r}=a,n=Y({accountSalt:i,adminAddress:t,createAccountOverride:r,factoryContract:e});return E([e.address,await k(n)])}async function Ea(a){const{accountContract:e,chain:t,client:i,entrypointAddress:r,getNonceOverride:n}=a;return n?n(e):await da({contract:L({address:r||S,chain:t,client:i}),key:St(),sender:e.address})}async function rt(a){const e=Date.now();for(;nt(a);){if(Date.now()-e>6e4)throw st(a),new Error("Account deployment is taking too long (over 1 minute). Please try again.");await new Promise(t=>setTimeout(t,500))}}const it=new WeakMap,R=new WeakMap;async function Ka(a,e){var m,w,A,G,g,f,p;const{personalAccount:t,client:i}=a;if(!t)throw new Error("No personal account provided for smart account connection");const r=e,n=e.chain,c="gasless"in r?r.gasless:r.sponsorGas;if(await At(n))return[Ua({chain:n,connectionOptions:a,creationOptions:e,sponsorGas:c}),n];if(r.factoryAddress&&!((m=r.overrides)!=null&&m.entrypointAddress)){const u=await Ia(r.factoryAddress,i,n);u&&(r.overrides={...r.overrides,entrypointAddress:u})}(w=r.overrides)!=null&&w.tokenPaymaster&&!((A=r.overrides)!=null&&A.entrypointAddress)&&(r.overrides={...r.overrides,entrypointAddress:X});const s=r.factoryAddress??Gt((G=r.overrides)==null?void 0:G.entrypointAddress),o=L({address:s,chain:n,client:i}),d=await gt({accountAddress:(g=r.overrides)==null?void 0:g.accountAddress,accountSalt:(f=r.overrides)==null?void 0:f.accountSalt,adminAddress:t.address,factoryContract:o,predictAddressOverride:(p=r.overrides)==null?void 0:p.predictAddress}).then(u=>u).catch(u=>{throw new Error(`Failed to get account address with factory contract ${o.address} on chain ID ${n.id}: ${(u==null?void 0:u.message)||"unknown error"}`,{cause:u})}),y=L({address:d,chain:n,client:i}),l=await Fa({...r,accountContract:y,chain:n,client:i,factoryContract:o,personalAccount:t,sponsorGas:c});if(it.set(t,l),R.set(l,t),r.sessionKey&&await sa({accountContract:y,newPermissions:r.sessionKey.permissions,sessionKeyAddress:r.sessionKey.address})){const u=ea({account:t,contract:y,permissions:r.sessionKey.permissions,sessionKeyAddress:r.sessionKey.address});await ht({account:l,transaction:u})}return[l,n]}async function Za(a){const e=R.get(a);e&&(it.delete(e),R.delete(a))}async function Fa(a){var n,c;const e=(n=a.overrides)==null?void 0:n.tokenPaymaster;if(e&&$(((c=a.overrides)==null?void 0:c.entrypointAddress)||S)!=="v0.7")throw new Error("Token paymaster is only supported for entrypoint version v0.7");const t=a.sponsorGas;let i=a.accountContract;const r={address:J(i.address),async onTransactionRequested(s){var o,d;return(d=(o=a.personalAccount).onTransactionRequested)==null?void 0:d.call(o,s)},async sendBatchTransaction(s){var m,w;const o=Tt({accountContract:i,executeBatchOverride:(m=a.overrides)==null?void 0:m.executeBatch,transactions:s});if(s.length===0)throw new Error("No transactions to send");const d=s[0];if(!d)throw new Error("No transactions to send");const y=F(d.chainId),l=await N({executeTx:o,options:{...a,accountContract:i,chain:y}});return V({chainId:y.id,client:a.client,contractAddress:((w=s[0])==null?void 0:w.to)??void 0,transactionHash:l.transactionHash,walletAddress:a.accountContract.address,walletType:"smart"}),l},async sendTransaction(s){var m,w,A;let o;if(e){await Va({accountContract:i,erc20Paymaster:e,options:a});const G=async()=>({paymaster:e.paymasterAddress,paymasterData:"0x"});o=((m=a.overrides)==null?void 0:m.paymaster)||G}else o=(w=a.overrides)==null?void 0:w.paymaster;s.chainId!==i.chain.id&&(i=L({address:r.address,chain:F(s.chainId),client:a.client}));const d=tt({accountContract:i,executeOverride:(A=a.overrides)==null?void 0:A.execute,transaction:s}),y=F(s.chainId),l=await N({executeTx:d,options:{...a,accountContract:i,chain:y,overrides:{...a.overrides,paymaster:o}}});return V({chainId:y.id,client:a.client,contractAddress:s.to??void 0,transactionHash:l.transactionHash,walletAddress:a.accountContract.address,walletType:"smart"}),l},async signMessage({message:s}){var d;if((d=a.overrides)!=null&&d.signMessage)return a.overrides.signMessage({accountContract:i,adminAccount:a.personalAccount,factoryContract:a.factoryContract,message:s});const{smartAccountSignMessage:o}=await T(async()=>{const{smartAccountSignMessage:y}=await import("./thirdweb-CS6G_ZNe.js").then(l=>l.cn);return{smartAccountSignMessage:y}},[]);return o({accountContract:i,factoryContract:a.factoryContract,message:s,options:a})},async signTypedData(s){var d;if((d=a.overrides)!=null&&d.signTypedData)return a.overrides.signTypedData({accountContract:i,adminAccount:a.personalAccount,factoryContract:a.factoryContract,typedData:s});const{smartAccountSignTypedData:o}=await T(async()=>{const{smartAccountSignTypedData:y}=await import("./thirdweb-CS6G_ZNe.js").then(l=>l.cn);return{smartAccountSignTypedData:y}},[]);return o({accountContract:i,factoryContract:a.factoryContract,options:a,typedData:s})},sendCalls:async s=>{const{inAppWalletSendCalls:o}=await T(async()=>{const{inAppWalletSendCalls:w}=await import("./in-app-wallet-calls-CwwQ0VDY.js");return{inAppWalletSendCalls:w}},__vite__mapDeps([0,1])),d=s.calls[0];if(!d)throw new Error("No calls to send");const y=d.client,l=d.chain||s.chain,m=await o({account:r,calls:s.calls,chain:l});return{chain:l,client:y,id:m}},getCallsStatus:async s=>{const{inAppWalletGetCallsStatus:o}=await T(async()=>{const{inAppWalletGetCallsStatus:d}=await import("./in-app-wallet-calls-CwwQ0VDY.js");return{inAppWalletGetCallsStatus:d}},__vite__mapDeps([0,1]));return o(s)},getCallsStatusRaw:async s=>{const{inAppWalletGetCallsStatusRaw:o}=await T(async()=>{const{inAppWalletGetCallsStatusRaw:d}=await import("./in-app-wallet-calls-CwwQ0VDY.js");return{inAppWalletGetCallsStatusRaw:d}},__vite__mapDeps([0,1]));return o(s)},getCapabilities:async s=>({[s.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:t??!1}}})};return r}async function Va(a){var y;const{accountContract:e,erc20Paymaster:t,options:i}=a,r=t.tokenAddress,n=L({address:r,chain:e.chain,client:e.client});if(await $t({contract:n,owner:e.address,spender:t.paymasterAddress})>0n)return;const s=qt({amountWei:ra-1n,contract:n,spender:t.paymasterAddress}),o=await Pt({from:e.address,transaction:s}),d=tt({accountContract:e,executeOverride:(y=i.overrides)==null?void 0:y.execute,transaction:o});await N({executeTx:d,options:{...i,overrides:{...i.overrides,tokenPaymaster:void 0}}})}function Ua(a){const{creationOptions:e,connectionOptions:t,chain:i}=a,r={address:J(t.personalAccount.address),async onTransactionRequested(n){var c,s;return(s=(c=t.personalAccount).onTransactionRequested)==null?void 0:s.call(c,n)},async sendTransaction(n){var y,l,m,w;const c={chain:F(n.chainId),client:t.client,data:n.data,eip712:n.eip712,to:n.to??void 0,value:n.value??0n};let s=await Ut({account:r,transaction:c});if(a.sponsorGas&&!s.paymaster){const A=await _t({options:{bundlerUrl:(y=e.overrides)==null?void 0:y.bundlerUrl,chain:i,client:t.client,entrypointAddress:(l=e.overrides)==null?void 0:l.entrypointAddress},transaction:s});s={...s,...A}}const o=await It({account:r,chainId:i.id,eip712Transaction:s}),d=await Et({options:{bundlerUrl:(m=e.overrides)==null?void 0:m.bundlerUrl,chain:i,client:t.client,entrypointAddress:(w=e.overrides)==null?void 0:w.entrypointAddress},signedTransaction:o,transaction:s});return V({chainId:i.id,client:t.client,contractAddress:n.to??void 0,transactionHash:d.transactionHash,walletAddress:r.address,walletType:"smart"}),{chain:i,client:t.client,transactionHash:d.transactionHash}},async signMessage({message:n}){return t.personalAccount.signMessage({message:n})},async signTypedData(n){const c=Ct(n);return t.personalAccount.signTypedData(c)},sendCalls:async n=>{const{inAppWalletSendCalls:c}=await T(async()=>{const{inAppWalletSendCalls:l}=await import("./in-app-wallet-calls-CwwQ0VDY.js");return{inAppWalletSendCalls:l}},__vite__mapDeps([0,1])),s=n.calls[0];if(!s)throw new Error("No calls to send");const o=s.client,d=s.chain||n.chain,y=await c({account:r,calls:n.calls,chain:d});return{chain:d,client:o,id:y}},getCallsStatus:async n=>{const{inAppWalletGetCallsStatus:c}=await T(async()=>{const{inAppWalletGetCallsStatus:s}=await import("./in-app-wallet-calls-CwwQ0VDY.js");return{inAppWalletGetCallsStatus:s}},__vite__mapDeps([0,1]));return c(n)},getCallsStatusRaw:async n=>{const{inAppWalletGetCallsStatusRaw:c}=await T(async()=>{const{inAppWalletGetCallsStatusRaw:s}=await import("./in-app-wallet-calls-CwwQ0VDY.js");return{inAppWalletGetCallsStatusRaw:s}},__vite__mapDeps([0,1]));return c(n)},getCapabilities:async n=>({[n.chainId??1]:{atomic:{status:"unsupported"},paymasterService:{supported:a.sponsorGas??!1}}})};return r}async function N(a){var i,r,n;const{executeTx:e,options:t}=a;try{const c=await La({accountContract:t.accountContract,adminAddress:t.personalAccount.address,factoryContract:t.factoryContract,overrides:t.overrides,sponsorGas:t.sponsorGas,transaction:e}),s=await Sa({adminAccount:t.personalAccount,chain:t.chain,client:t.client,entrypointAddress:(i=t.overrides)==null?void 0:i.entrypointAddress,userOp:c}),o={bundlerUrl:(r=t.overrides)==null?void 0:r.bundlerUrl,chain:t.chain,client:t.client,entrypointAddress:(n=t.overrides)==null?void 0:n.entrypointAddress},d=await Ft({options:o,userOp:s}),y=await va({...o,userOpHash:d});return V({chainId:t.chain.id,client:t.client,contractAddress:await D(e.to??void 0),transactionHash:y.transactionHash,walletAddress:t.accountContract.address,walletType:"smart"}),{chain:t.chain,client:t.client,transactionHash:y.transactionHash}}catch(c){throw vt(c)&&Lt({chainId:t.chain.id,client:t.client,contractAddress:await D(e.to??void 0),error:c,transactionValue:await D(e.value),walletAddress:t.accountContract.address}),c}finally{st(t.accountContract)}}async function Ia(a,e,t){const i=L({address:a,chain:t,client:e});try{return await C({contract:i,method:"function entrypoint() public view returns (address)"})}catch{return}}export{Ka as connectSmartAccount,Za as disconnectSmartAccount,Ia as getEntrypointFromFactory,Qa as isSmartWallet};