@dcl/auth-site 4.12.1-23163781102.commit-d076ec4 → 4.12.1-23257944198.commit-ff61dae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{ConstantsUtil-BQ63uoWQ.js → ConstantsUtil-CsWrbhBj.js} +1 -1
- package/assets/{ContentfulRichText-nBV1oHt0.js → ContentfulRichText-CfVQKsN1.js} +1 -1
- package/assets/{ExchangeController-CX1x6f4U.js → ExchangeController-XmAY8XeL.js} +1 -1
- package/assets/{HelpersUtil-DrsoWh5m.js → HelpersUtil-Cj2yf5QP.js} +1 -1
- package/assets/{NetworkUtil-DPSnNTlP.js → NetworkUtil-DBeijgfn.js} +1 -1
- package/assets/{SwapController-B30Z8BNo.js → SwapController-CT0UN224.js} +1 -1
- package/assets/{biconomy-Cy_pDzxs.js → biconomy-BjfscVZe.js} +1 -1
- package/assets/{browser-BD_6gr0F.js → browser-B4XJQjXm.js} +1 -1
- package/assets/{ccip-Btd3tRS-.js → ccip-vcVyGlxX.js} +1 -1
- package/assets/{chains-jeFfBqjN.js → chains-Ci2vHbpf.js} +1 -1
- package/assets/{common-D3dFH_ot.js → common-wq8TIhvK.js} +1 -1
- package/assets/{controller-I5QMw9df.js → controller-DG3kSk97.js} +2 -2
- package/assets/{data-capture-DVPsaF6a.js → data-capture-He_-je8j.js} +1 -1
- package/assets/{email-DWG_EhO7.js → email-CAoZJRn0.js} +1 -1
- package/assets/{embedded-wallet-C5pk1K_K.js → embedded-wallet-BO_DoCme.js} +1 -1
- package/assets/{engine-COMugpcp.js → engine-rzi1TOwn.js} +1 -1
- package/assets/{estimate-l1-fee-BCrK05RR.js → estimate-l1-fee-BQQ9aJff.js} +1 -1
- package/assets/{ethereum-BqpKWPRR.js → ethereum-CnR6Yg67.js} +1 -1
- package/assets/{extractIPFS-cDHJhNiL.js → extractIPFS-C1ch1qy6.js} +1 -1
- package/assets/{features-D1f4Agnd.js → features-C_D_atNW.js} +1 -1
- package/assets/{fetchTokenMetadata-B6Tqdr9K.js → fetchTokenMetadata-CgDTzKKE.js} +1 -1
- package/assets/{fortmatic-BbOfthXf.js → fortmatic-usCFzoU7.js} +1 -1
- package/assets/{get-ecosystem-wallet-info-CkKLe32n.js → get-ecosystem-wallet-info-L6ZulwYb.js} +1 -1
- package/assets/{getBalance-CuvkDVN6.js → getBalance-CFOYyEyS.js} +1 -1
- package/assets/{getInstalledModules-4OgVttri.js → getInstalledModules-DCtBaHQK.js} +1 -1
- package/assets/{getNFT-eFw9UmUv.js → getNFT-DCQOaiup.js} +1 -1
- package/assets/{getNFT-CIeLLVO9.js → getNFT-cgys5jzo.js} +2 -2
- package/assets/{if-defined-DLgjRjyB.js → if-defined-Czd_haVH.js} +1 -1
- package/assets/{in-app-wallet-calls-CqTFuaJi.js → in-app-wallet-calls-Bcq34XJb.js} +1 -1
- package/assets/{index-ChuSvoze.js → index-5j-fDX9M.js} +1 -1
- package/assets/{index-YgDqx0fX.js → index-B6yBNEp8.js} +1 -1
- package/assets/{index-BXHZtYVx.js → index-BAZrfb76.js} +1 -1
- package/assets/{index-dKD5NCXD.js → index-BDxBylVB.js} +9 -9
- package/assets/{index-BtcZnehB.js → index-BJJ7T0Wq.js} +1 -1
- package/assets/{index-CNZmOs7B.js → index-BL0oG1py.js} +1 -1
- package/assets/{index-D2crcFXx.js → index-BcHqr8Zw.js} +1 -1
- package/assets/{index-CzH4RkTs.js → index-Bddp-UDg.js} +1 -1
- package/assets/{index-BSfNX0sX.js → index-BdwBWVSo.js} +1 -1
- package/assets/{index-DJqF8Jw0.js → index-Bjl_PxkS.js} +1 -1
- package/assets/{index-gFVNsMUE.js → index-BnFIH3po.js} +1 -1
- package/assets/{index-CyesZNLq.js → index-BsYdSbfc.js} +1 -1
- package/assets/{index-BBOx8WZG.js → index-BwF7u4So.js} +1 -1
- package/assets/{index-HZVWuXk_.js → index-C1AfkeMm.js} +4 -4
- package/assets/{index-B6nmQr3q.js → index-C3Goz62A.js} +1 -1
- package/assets/{index-BWBLjOqp.js → index-C6UybIW-.js} +1 -1
- package/assets/{index-ZIoGS9z2.js → index-CAl5bUL4.js} +1 -1
- package/assets/{index-CgLHQmYm.js → index-CNP9Lp1F.js} +2 -2
- package/assets/{index-Y9rMlSzV.js → index-CT5nzidz.js} +1 -1
- package/assets/{index-CZlVKT2_.js → index-CYy5MW9v.js} +1 -1
- package/assets/{index-CH_gaiOk.js → index-CeC6OH9Y.js} +1 -1
- package/assets/{index-BRZexvk3.js → index-CpOo0L9a.js} +1 -1
- package/assets/{index-yQ62SH7E.js → index-CrKjhXqn.js} +1 -1
- package/assets/{index-J1MnrsTf.js → index-CukJXVRG.js} +1 -1
- package/assets/{index-BmGd89Go.js → index-D856ImgP.js} +1 -1
- package/assets/{index-BgVmrVm_.js → index-DCqkhW2t.js} +1 -1
- package/assets/{index-P1GBa5w-.js → index-DI6gJ2v4.js} +1 -1
- package/assets/{index-Ds43GBHr.js → index-DQyN7x8A.js} +1 -1
- package/assets/{index-DGF8od3a.js → index-DTA8Yh0D.js} +1 -1
- package/assets/{index-DMsn7HfO.js → index-DgQP3jhF.js} +1 -1
- package/assets/{index-B3KiPTUt.js → index-DpV5R5CA.js} +1 -1
- package/assets/{index-54O9Lolo.js → index-DwEKubQW.js} +1 -1
- package/assets/{index--opCKBXr.js → index-DwfYRkB-.js} +1 -1
- package/assets/{index-DERCjCgY.js → index-KgfieA6a.js} +1 -1
- package/assets/{index-DVpjJupl.js → index-LEvK9BU-.js} +1 -1
- package/assets/{index-XboUxXRw.js → index-LdlmJTcM.js} +1 -1
- package/assets/{index-ClKGadHO.js → index-U79AZIOz.js} +1 -1
- package/assets/{index-CcCQF8VJ.js → index-Z-14hzsn.js} +1 -1
- package/assets/{index-Bxazww-H.js → index-Zx8zCmRJ.js} +1 -1
- package/assets/index-a40oMP56.js +20 -0
- package/assets/{index-CESgV-Vz.js → index-hdFvl29W.js} +1 -1
- package/assets/{index-BqyIM8wV.js → index-jADOhOQL.js} +1 -1
- package/assets/{index-BXPTUhbb.js → index-p0uSUt9a.js} +1 -1
- package/assets/{index-LL0dERAZ.css → index-q4olpBIa.css} +1 -1
- package/assets/{index.es-afcbeOfR.js → index.es-2HttMq4T.js} +1 -1
- package/assets/{index.es-DFi-oroo.js → index.es-CnrfOh3G.js} +1 -1
- package/assets/{index.es-B62AYjVf.js → index.es-D4T1maSz.js} +1 -1
- package/assets/{native-m94RFKzT.js → native-BB396vM9.js} +1 -1
- package/assets/{networks-uNtTSrWF.js → networks-CojxvI0C.js} +1 -1
- package/assets/{onramp-CiHiZCFz.js → onramp-BtUd5Jsr.js} +1 -1
- package/assets/{openzeppelin-CVYlc-np.js → openzeppelin-y3ywJ5E_.js} +1 -1
- package/assets/{ownerOf-FUXusPAE.js → ownerOf-CRJjHjfh.js} +1 -1
- package/assets/{parseNft-D3grVecl.js → parseNft-DZ0pXt7e.js} +2 -2
- package/assets/{pay-with-exchange-CcJDjYd4.js → pay-with-exchange-DgS0cZtf.js} +1 -1
- package/assets/{qr-overlay-B8OHxUAd.js → qr-overlay-DXCE8ST0.js} +3 -3
- package/assets/{receive-Dbnerft8.js → receive-hUZItkSJ.js} +1 -1
- package/assets/{ref-BC1zkz1a.js → ref-kZaE5B0T.js} +1 -1
- package/assets/{resolveImplementation-Cgs81HY1.js → resolveImplementation-Bn5mPN3x.js} +1 -1
- package/assets/{secp256k1-CPQrkyls.js → secp256k1-BUIg71XZ.js} +1 -1
- package/assets/{send-CP5I4Eww.js → send-BT_IdOS0.js} +1 -1
- package/assets/{send-eip712-transaction-CUQjMws-.js → send-eip712-transaction-D9Do4PFb.js} +1 -1
- package/assets/{send-gasless-transaction-Bn8nOYFQ.js → send-gasless-transaction-CqOFvAWj.js} +2 -2
- package/assets/{session-proposal-C5wZfYvC.js → session-proposal-BhxOm69W.js} +1 -1
- package/assets/{session-request-C24wacW5.js → session-request-B2kobJ26.js} +2 -2
- package/assets/{socials-OIAkRL9P.js → socials-DSc4GDDT.js} +1 -1
- package/assets/{swaps-CaRL-AU2.js → swaps-BLvsC89P.js} +1 -1
- package/assets/{thirdweb-DEy9Ra1E.js → thirdweb-BIaoCVl0.js} +5 -5
- package/assets/{totalSupply-DZxpfkIM.js → totalSupply-kVUutRUL.js} +1 -1
- package/assets/{transactions-CJwDKGtL.js → transactions-Vj_6nEoQ.js} +1 -1
- package/assets/{ui-CKtPrzWC.js → ui-BdRidUCc.js} +5 -5
- package/assets/{vendor-Cw9y_SOP.js → vendor-BgApJLuV.js} +1 -1
- package/assets/{w3m-modal-CTvMDjFw.js → w3m-modal-D6SyVt6p.js} +1 -1
- package/assets/{wallets-C4p1A2-h.js → wallets-CN-4x-BR.js} +5 -5
- package/assets/{web-connector-BR3__8f3.js → web-connector-CH10dfXt.js} +3 -3
- package/index.html +5 -5
- package/package.json +3 -3
- package/assets/index-BF2VhKyb.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-
|
|
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-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/in-app-wallet-calls-Bcq34XJb.js","assets/thirdweb-BIaoCVl0.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-BIaoCVl0.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-CN-4x-BR.js";import"./ui-BdRidUCc.js";import"./vendor-BgApJLuV.js";import"./index-BDxBylVB.js";import"./index.es-CnrfOh3G.js";import"./ethereum-CnR6Yg67.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(`
|
|
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-DEy9Ra1E.js").then(u=>u.ck);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-CqTFuaJi.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-CqTFuaJi.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-CqTFuaJi.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 Ge{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{Ge 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-BIaoCVl0.js").then(u=>u.ck);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-Bcq34XJb.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-Bcq34XJb.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-Bcq34XJb.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 Ge{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{Ge 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.12.1-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.12.1-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.12.1-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.12.1-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.12.1-
|
|
8
|
+
<script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/auth-site/4.12.1-23257944198.commit-ff61dae/assets/index-BDxBylVB.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.12.1-23257944198.commit-ff61dae/assets/thirdweb-BIaoCVl0.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.12.1-23257944198.commit-ff61dae/assets/vendor-BgApJLuV.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.12.1-23257944198.commit-ff61dae/assets/ui-BdRidUCc.js">
|
|
12
|
+
<link rel="stylesheet" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.12.1-23257944198.commit-ff61dae/assets/index-q4olpBIa.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.12.1-
|
|
3
|
+
"version": "4.12.1-23257944198.commit-ff61dae",
|
|
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.12.1-
|
|
21
|
-
"commit": "
|
|
20
|
+
"homepage": "https://cdn.decentraland.org/@dcl/auth-site/4.12.1-23257944198.commit-ff61dae",
|
|
21
|
+
"commit": "ff61dae7e3220ba7d504086686e2378583f68d1e"
|
|
22
22
|
}
|
package/assets/index-BF2VhKyb.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var _e=Object.defineProperty;var De=(r,H,l)=>H in r?_e(r,H,{enumerable:!0,configurable:!0,writable:!0,value:l}):r[H]=l;var B0=(r,H,l)=>De(r,typeof H!="symbol"?H+"":H,l);import{a as Fe,j as ge}from"./index-gFVNsMUE.js";import{c as ir,g as ye}from"./thirdweb-DEy9Ra1E.js";import{c as me,r as be}from"./ui-CKtPrzWC.js";import"./vendor-Cw9y_SOP.js";var A0={exports:{}},_0={exports:{}},Re=_0.exports,_r;function N(){return _r||(_r=1,function(r,H){(function(l,t){r.exports=t()})(Re,function(){var l=l||function(t,C){var B;if(typeof window<"u"&&window.crypto&&(B=window.crypto),typeof self<"u"&&self.crypto&&(B=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(B=globalThis.crypto),!B&&typeof window<"u"&&window.msCrypto&&(B=window.msCrypto),!B&&typeof ir<"u"&&ir.crypto&&(B=ir.crypto),!B&&typeof me=="function")try{B=be()}catch{}var y=function(){if(B){if(typeof B.getRandomValues=="function")try{return B.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof B.randomBytes=="function")try{return B.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},v=Object.create||function(){function i(){}return function(n){var c;return i.prototype=n,c=new i,i.prototype=null,c}}(),h={},e=h.lib={},x=e.Base=function(){return{extend:function(i){var n=v(this);return i&&n.mixIn(i),(!n.hasOwnProperty("init")||this.init===n.init)&&(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var n in i)i.hasOwnProperty(n)&&(this[n]=i[n]);i.hasOwnProperty("toString")&&(this.toString=i.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),u=e.WordArray=x.extend({init:function(i,n){i=this.words=i||[],n!=C?this.sigBytes=n:this.sigBytes=i.length*4},toString:function(i){return(i||s).stringify(this)},concat:function(i){var n=this.words,c=i.words,_=this.sigBytes,A=i.sigBytes;if(this.clamp(),_%4)for(var D=0;D<A;D++){var g=c[D>>>2]>>>24-D%4*8&255;n[_+D>>>2]|=g<<24-(_+D)%4*8}else for(var I=0;I<A;I+=4)n[_+I>>>2]=c[I>>>2];return this.sigBytes+=A,this},clamp:function(){var i=this.words,n=this.sigBytes;i[n>>>2]&=4294967295<<32-n%4*8,i.length=t.ceil(n/4)},clone:function(){var i=x.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var n=[],c=0;c<i;c+=4)n.push(y());return new u.init(n,i)}}),a=h.enc={},s=a.Hex={stringify:function(i){for(var n=i.words,c=i.sigBytes,_=[],A=0;A<c;A++){var D=n[A>>>2]>>>24-A%4*8&255;_.push((D>>>4).toString(16)),_.push((D&15).toString(16))}return _.join("")},parse:function(i){for(var n=i.length,c=[],_=0;_<n;_+=2)c[_>>>3]|=parseInt(i.substr(_,2),16)<<24-_%8*4;return new u.init(c,n/2)}},o=a.Latin1={stringify:function(i){for(var n=i.words,c=i.sigBytes,_=[],A=0;A<c;A++){var D=n[A>>>2]>>>24-A%4*8&255;_.push(String.fromCharCode(D))}return _.join("")},parse:function(i){for(var n=i.length,c=[],_=0;_<n;_++)c[_>>>2]|=(i.charCodeAt(_)&255)<<24-_%4*8;return new u.init(c,n)}},d=a.Utf8={stringify:function(i){try{return decodeURIComponent(escape(o.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return o.parse(unescape(encodeURIComponent(i)))}},f=e.BufferedBlockAlgorithm=x.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(i){typeof i=="string"&&(i=d.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes},_process:function(i){var n,c=this._data,_=c.words,A=c.sigBytes,D=this.blockSize,g=D*4,I=A/g;i?I=t.ceil(I):I=t.max((I|0)-this._minBufferSize,0);var p=I*D,F=t.min(p*4,A);if(p){for(var b=0;b<p;b+=D)this._doProcessBlock(_,b);n=_.splice(0,p),c.sigBytes-=F}return new u.init(n,F)},clone:function(){var i=x.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});e.Hasher=f.extend({cfg:x.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var n=this._doFinalize();return n},blockSize:16,_createHelper:function(i){return function(n,c){return new i.init(c).finalize(n)}},_createHmacHelper:function(i){return function(n,c){return new E.HMAC.init(i,c).finalize(n)}}});var E=h.algo={};return h}(Math);return l})}(_0)),_0.exports}var D0={exports:{}},we=D0.exports,Dr;function xr(){return Dr||(Dr=1,function(r,H){(function(l,t){r.exports=t(N())})(we,function(l){return function(t){var C=l,B=C.lib,y=B.Base,v=B.WordArray,h=C.x64={};h.Word=y.extend({init:function(e,x){this.high=e,this.low=x}}),h.WordArray=y.extend({init:function(e,x){e=this.words=e||[],x!=t?this.sigBytes=x:this.sigBytes=e.length*8},toX32:function(){for(var e=this.words,x=e.length,u=[],a=0;a<x;a++){var s=e[a];u.push(s.high),u.push(s.low)}return v.create(u,this.sigBytes)},clone:function(){for(var e=y.clone.call(this),x=e.words=this.words.slice(0),u=x.length,a=0;a<u;a++)x[a]=x[a].clone();return e}})}(),l})}(D0)),D0.exports}var F0={exports:{}},ke=F0.exports,Fr;function Se(){return Fr||(Fr=1,function(r,H){(function(l,t){r.exports=t(N())})(ke,function(l){return function(){if(typeof ArrayBuffer=="function"){var t=l,C=t.lib,B=C.WordArray,y=B.init,v=B.init=function(h){if(h instanceof ArrayBuffer&&(h=new Uint8Array(h)),(h instanceof Int8Array||typeof Uint8ClampedArray<"u"&&h instanceof Uint8ClampedArray||h instanceof Int16Array||h instanceof Uint16Array||h instanceof Int32Array||h instanceof Uint32Array||h instanceof Float32Array||h instanceof Float64Array)&&(h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength)),h instanceof Uint8Array){for(var e=h.byteLength,x=[],u=0;u<e;u++)x[u>>>2]|=h[u]<<24-u%4*8;y.call(this,x,e)}else y.apply(this,arguments)};v.prototype=B}}(),l.lib.WordArray})}(F0)),F0.exports}var g0={exports:{}},Ie=g0.exports,gr;function He(){return gr||(gr=1,function(r,H){(function(l,t){r.exports=t(N())})(Ie,function(l){return function(){var t=l,C=t.lib,B=C.WordArray,y=t.enc;y.Utf16=y.Utf16BE={stringify:function(h){for(var e=h.words,x=h.sigBytes,u=[],a=0;a<x;a+=2){var s=e[a>>>2]>>>16-a%4*8&65535;u.push(String.fromCharCode(s))}return u.join("")},parse:function(h){for(var e=h.length,x=[],u=0;u<e;u++)x[u>>>1]|=h.charCodeAt(u)<<16-u%2*16;return B.create(x,e*2)}},y.Utf16LE={stringify:function(h){for(var e=h.words,x=h.sigBytes,u=[],a=0;a<x;a+=2){var s=v(e[a>>>2]>>>16-a%4*8&65535);u.push(String.fromCharCode(s))}return u.join("")},parse:function(h){for(var e=h.length,x=[],u=0;u<e;u++)x[u>>>1]|=v(h.charCodeAt(u)<<16-u%2*16);return B.create(x,e*2)}};function v(h){return h<<8&4278255360|h>>>8&16711935}}(),l.enc.Utf16})}(g0)),g0.exports}var y0={exports:{}},Pe=y0.exports,yr;function t0(){return yr||(yr=1,function(r,H){(function(l,t){r.exports=t(N())})(Pe,function(l){return function(){var t=l,C=t.lib,B=C.WordArray,y=t.enc;y.Base64={stringify:function(h){var e=h.words,x=h.sigBytes,u=this._map;h.clamp();for(var a=[],s=0;s<x;s+=3)for(var o=e[s>>>2]>>>24-s%4*8&255,d=e[s+1>>>2]>>>24-(s+1)%4*8&255,f=e[s+2>>>2]>>>24-(s+2)%4*8&255,E=o<<16|d<<8|f,i=0;i<4&&s+i*.75<x;i++)a.push(u.charAt(E>>>6*(3-i)&63));var n=u.charAt(64);if(n)for(;a.length%4;)a.push(n);return a.join("")},parse:function(h){var e=h.length,x=this._map,u=this._reverseMap;if(!u){u=this._reverseMap=[];for(var a=0;a<x.length;a++)u[x.charCodeAt(a)]=a}var s=x.charAt(64);if(s){var o=h.indexOf(s);o!==-1&&(e=o)}return v(h,e,u)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function v(h,e,x){for(var u=[],a=0,s=0;s<e;s++)if(s%4){var o=x[h.charCodeAt(s-1)]<<s%4*2,d=x[h.charCodeAt(s)]>>>6-s%4*2,f=o|d;u[a>>>2]|=f<<24-a%4*8,a++}return B.create(u,a)}}(),l.enc.Base64})}(y0)),y0.exports}var m0={exports:{}},Te=m0.exports,mr;function Me(){return mr||(mr=1,function(r,H){(function(l,t){r.exports=t(N())})(Te,function(l){return function(){var t=l,C=t.lib,B=C.WordArray,y=t.enc;y.Base64url={stringify:function(h,e){e===void 0&&(e=!0);var x=h.words,u=h.sigBytes,a=e?this._safe_map:this._map;h.clamp();for(var s=[],o=0;o<u;o+=3)for(var d=x[o>>>2]>>>24-o%4*8&255,f=x[o+1>>>2]>>>24-(o+1)%4*8&255,E=x[o+2>>>2]>>>24-(o+2)%4*8&255,i=d<<16|f<<8|E,n=0;n<4&&o+n*.75<u;n++)s.push(a.charAt(i>>>6*(3-n)&63));var c=a.charAt(64);if(c)for(;s.length%4;)s.push(c);return s.join("")},parse:function(h,e){e===void 0&&(e=!0);var x=h.length,u=e?this._safe_map:this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var s=0;s<u.length;s++)a[u.charCodeAt(s)]=s}var o=u.charAt(64);if(o){var d=h.indexOf(o);d!==-1&&(x=d)}return v(h,x,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function v(h,e,x){for(var u=[],a=0,s=0;s<e;s++)if(s%4){var o=x[h.charCodeAt(s-1)]<<s%4*2,d=x[h.charCodeAt(s)]>>>6-s%4*2,f=o|d;u[a>>>2]|=f<<24-a%4*8,a++}return B.create(u,a)}}(),l.enc.Base64url})}(m0)),m0.exports}var b0={exports:{}},Le=b0.exports,br;function a0(){return br||(br=1,function(r,H){(function(l,t){r.exports=t(N())})(Le,function(l){return function(t){var C=l,B=C.lib,y=B.WordArray,v=B.Hasher,h=C.algo,e=[];(function(){for(var d=0;d<64;d++)e[d]=t.abs(t.sin(d+1))*4294967296|0})();var x=h.MD5=v.extend({_doReset:function(){this._hash=new y.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(d,f){for(var E=0;E<16;E++){var i=f+E,n=d[i];d[i]=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360}var c=this._hash.words,_=d[f+0],A=d[f+1],D=d[f+2],g=d[f+3],I=d[f+4],p=d[f+5],F=d[f+6],b=d[f+7],R=d[f+8],P=d[f+9],T=d[f+10],M=d[f+11],W=d[f+12],z=d[f+13],q=d[f+14],O=d[f+15],m=c[0],k=c[1],S=c[2],w=c[3];m=u(m,k,S,w,_,7,e[0]),w=u(w,m,k,S,A,12,e[1]),S=u(S,w,m,k,D,17,e[2]),k=u(k,S,w,m,g,22,e[3]),m=u(m,k,S,w,I,7,e[4]),w=u(w,m,k,S,p,12,e[5]),S=u(S,w,m,k,F,17,e[6]),k=u(k,S,w,m,b,22,e[7]),m=u(m,k,S,w,R,7,e[8]),w=u(w,m,k,S,P,12,e[9]),S=u(S,w,m,k,T,17,e[10]),k=u(k,S,w,m,M,22,e[11]),m=u(m,k,S,w,W,7,e[12]),w=u(w,m,k,S,z,12,e[13]),S=u(S,w,m,k,q,17,e[14]),k=u(k,S,w,m,O,22,e[15]),m=a(m,k,S,w,A,5,e[16]),w=a(w,m,k,S,F,9,e[17]),S=a(S,w,m,k,M,14,e[18]),k=a(k,S,w,m,_,20,e[19]),m=a(m,k,S,w,p,5,e[20]),w=a(w,m,k,S,T,9,e[21]),S=a(S,w,m,k,O,14,e[22]),k=a(k,S,w,m,I,20,e[23]),m=a(m,k,S,w,P,5,e[24]),w=a(w,m,k,S,q,9,e[25]),S=a(S,w,m,k,g,14,e[26]),k=a(k,S,w,m,R,20,e[27]),m=a(m,k,S,w,z,5,e[28]),w=a(w,m,k,S,D,9,e[29]),S=a(S,w,m,k,b,14,e[30]),k=a(k,S,w,m,W,20,e[31]),m=s(m,k,S,w,p,4,e[32]),w=s(w,m,k,S,R,11,e[33]),S=s(S,w,m,k,M,16,e[34]),k=s(k,S,w,m,q,23,e[35]),m=s(m,k,S,w,A,4,e[36]),w=s(w,m,k,S,I,11,e[37]),S=s(S,w,m,k,b,16,e[38]),k=s(k,S,w,m,T,23,e[39]),m=s(m,k,S,w,z,4,e[40]),w=s(w,m,k,S,_,11,e[41]),S=s(S,w,m,k,g,16,e[42]),k=s(k,S,w,m,F,23,e[43]),m=s(m,k,S,w,P,4,e[44]),w=s(w,m,k,S,W,11,e[45]),S=s(S,w,m,k,O,16,e[46]),k=s(k,S,w,m,D,23,e[47]),m=o(m,k,S,w,_,6,e[48]),w=o(w,m,k,S,b,10,e[49]),S=o(S,w,m,k,q,15,e[50]),k=o(k,S,w,m,p,21,e[51]),m=o(m,k,S,w,W,6,e[52]),w=o(w,m,k,S,g,10,e[53]),S=o(S,w,m,k,T,15,e[54]),k=o(k,S,w,m,A,21,e[55]),m=o(m,k,S,w,R,6,e[56]),w=o(w,m,k,S,O,10,e[57]),S=o(S,w,m,k,F,15,e[58]),k=o(k,S,w,m,z,21,e[59]),m=o(m,k,S,w,I,6,e[60]),w=o(w,m,k,S,M,10,e[61]),S=o(S,w,m,k,D,15,e[62]),k=o(k,S,w,m,P,21,e[63]),c[0]=c[0]+m|0,c[1]=c[1]+k|0,c[2]=c[2]+S|0,c[3]=c[3]+w|0},_doFinalize:function(){var d=this._data,f=d.words,E=this._nDataBytes*8,i=d.sigBytes*8;f[i>>>5]|=128<<24-i%32;var n=t.floor(E/4294967296),c=E;f[(i+64>>>9<<4)+15]=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,f[(i+64>>>9<<4)+14]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,d.sigBytes=(f.length+1)*4,this._process();for(var _=this._hash,A=_.words,D=0;D<4;D++){var g=A[D];A[D]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}return _},clone:function(){var d=v.clone.call(this);return d._hash=this._hash.clone(),d}});function u(d,f,E,i,n,c,_){var A=d+(f&E|~f&i)+n+_;return(A<<c|A>>>32-c)+f}function a(d,f,E,i,n,c,_){var A=d+(f&i|E&~i)+n+_;return(A<<c|A>>>32-c)+f}function s(d,f,E,i,n,c,_){var A=d+(f^E^i)+n+_;return(A<<c|A>>>32-c)+f}function o(d,f,E,i,n,c,_){var A=d+(E^(f|~i))+n+_;return(A<<c|A>>>32-c)+f}C.MD5=v._createHelper(x),C.HmacMD5=v._createHmacHelper(x)}(Math),l.MD5})}(b0)),b0.exports}var R0={exports:{}},Ne=R0.exports,Rr;function ae(){return Rr||(Rr=1,function(r,H){(function(l,t){r.exports=t(N())})(Ne,function(l){return function(){var t=l,C=t.lib,B=C.WordArray,y=C.Hasher,v=t.algo,h=[],e=v.SHA1=y.extend({_doReset:function(){this._hash=new B.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(x,u){for(var a=this._hash.words,s=a[0],o=a[1],d=a[2],f=a[3],E=a[4],i=0;i<80;i++){if(i<16)h[i]=x[u+i]|0;else{var n=h[i-3]^h[i-8]^h[i-14]^h[i-16];h[i]=n<<1|n>>>31}var c=(s<<5|s>>>27)+E+h[i];i<20?c+=(o&d|~o&f)+1518500249:i<40?c+=(o^d^f)+1859775393:i<60?c+=(o&d|o&f|d&f)-1894007588:c+=(o^d^f)-899497514,E=f,f=d,d=o<<30|o>>>2,o=s,s=c}a[0]=a[0]+s|0,a[1]=a[1]+o|0,a[2]=a[2]+d|0,a[3]=a[3]+f|0,a[4]=a[4]+E|0},_doFinalize:function(){var x=this._data,u=x.words,a=this._nDataBytes*8,s=x.sigBytes*8;return u[s>>>5]|=128<<24-s%32,u[(s+64>>>9<<4)+14]=Math.floor(a/4294967296),u[(s+64>>>9<<4)+15]=a,x.sigBytes=u.length*4,this._process(),this._hash},clone:function(){var x=y.clone.call(this);return x._hash=this._hash.clone(),x}});t.SHA1=y._createHelper(e),t.HmacSHA1=y._createHmacHelper(e)}(),l.SHA1})}(R0)),R0.exports}var w0={exports:{}},ze=w0.exports,wr;function or(){return wr||(wr=1,function(r,H){(function(l,t){r.exports=t(N())})(ze,function(l){return function(t){var C=l,B=C.lib,y=B.WordArray,v=B.Hasher,h=C.algo,e=[],x=[];(function(){function s(E){for(var i=t.sqrt(E),n=2;n<=i;n++)if(!(E%n))return!1;return!0}function o(E){return(E-(E|0))*4294967296|0}for(var d=2,f=0;f<64;)s(d)&&(f<8&&(e[f]=o(t.pow(d,1/2))),x[f]=o(t.pow(d,1/3)),f++),d++})();var u=[],a=h.SHA256=v.extend({_doReset:function(){this._hash=new y.init(e.slice(0))},_doProcessBlock:function(s,o){for(var d=this._hash.words,f=d[0],E=d[1],i=d[2],n=d[3],c=d[4],_=d[5],A=d[6],D=d[7],g=0;g<64;g++){if(g<16)u[g]=s[o+g]|0;else{var I=u[g-15],p=(I<<25|I>>>7)^(I<<14|I>>>18)^I>>>3,F=u[g-2],b=(F<<15|F>>>17)^(F<<13|F>>>19)^F>>>10;u[g]=p+u[g-7]+b+u[g-16]}var R=c&_^~c&A,P=f&E^f&i^E&i,T=(f<<30|f>>>2)^(f<<19|f>>>13)^(f<<10|f>>>22),M=(c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25),W=D+M+R+x[g]+u[g],z=T+P;D=A,A=_,_=c,c=n+W|0,n=i,i=E,E=f,f=W+z|0}d[0]=d[0]+f|0,d[1]=d[1]+E|0,d[2]=d[2]+i|0,d[3]=d[3]+n|0,d[4]=d[4]+c|0,d[5]=d[5]+_|0,d[6]=d[6]+A|0,d[7]=d[7]+D|0},_doFinalize:function(){var s=this._data,o=s.words,d=this._nDataBytes*8,f=s.sigBytes*8;return o[f>>>5]|=128<<24-f%32,o[(f+64>>>9<<4)+14]=t.floor(d/4294967296),o[(f+64>>>9<<4)+15]=d,s.sigBytes=o.length*4,this._process(),this._hash},clone:function(){var s=v.clone.call(this);return s._hash=this._hash.clone(),s}});C.SHA256=v._createHelper(a),C.HmacSHA256=v._createHmacHelper(a)}(Math),l.SHA256})}(w0)),w0.exports}var k0={exports:{}},Oe=k0.exports,kr;function qe(){return kr||(kr=1,function(r,H){(function(l,t,C){r.exports=t(N(),or())})(Oe,function(l){return function(){var t=l,C=t.lib,B=C.WordArray,y=t.algo,v=y.SHA256,h=y.SHA224=v.extend({_doReset:function(){this._hash=new B.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=v._doFinalize.call(this);return e.sigBytes-=4,e}});t.SHA224=v._createHelper(h),t.HmacSHA224=v._createHmacHelper(h)}(),l.SHA224})}(k0)),k0.exports}var S0={exports:{}},Ue=S0.exports,Sr;function ie(){return Sr||(Sr=1,function(r,H){(function(l,t,C){r.exports=t(N(),xr())})(Ue,function(l){return function(){var t=l,C=t.lib,B=C.Hasher,y=t.x64,v=y.Word,h=y.WordArray,e=t.algo;function x(){return v.create.apply(v,arguments)}var u=[x(1116352408,3609767458),x(1899447441,602891725),x(3049323471,3964484399),x(3921009573,2173295548),x(961987163,4081628472),x(1508970993,3053834265),x(2453635748,2937671579),x(2870763221,3664609560),x(3624381080,2734883394),x(310598401,1164996542),x(607225278,1323610764),x(1426881987,3590304994),x(1925078388,4068182383),x(2162078206,991336113),x(2614888103,633803317),x(3248222580,3479774868),x(3835390401,2666613458),x(4022224774,944711139),x(264347078,2341262773),x(604807628,2007800933),x(770255983,1495990901),x(1249150122,1856431235),x(1555081692,3175218132),x(1996064986,2198950837),x(2554220882,3999719339),x(2821834349,766784016),x(2952996808,2566594879),x(3210313671,3203337956),x(3336571891,1034457026),x(3584528711,2466948901),x(113926993,3758326383),x(338241895,168717936),x(666307205,1188179964),x(773529912,1546045734),x(1294757372,1522805485),x(1396182291,2643833823),x(1695183700,2343527390),x(1986661051,1014477480),x(2177026350,1206759142),x(2456956037,344077627),x(2730485921,1290863460),x(2820302411,3158454273),x(3259730800,3505952657),x(3345764771,106217008),x(3516065817,3606008344),x(3600352804,1432725776),x(4094571909,1467031594),x(275423344,851169720),x(430227734,3100823752),x(506948616,1363258195),x(659060556,3750685593),x(883997877,3785050280),x(958139571,3318307427),x(1322822218,3812723403),x(1537002063,2003034995),x(1747873779,3602036899),x(1955562222,1575990012),x(2024104815,1125592928),x(2227730452,2716904306),x(2361852424,442776044),x(2428436474,593698344),x(2756734187,3733110249),x(3204031479,2999351573),x(3329325298,3815920427),x(3391569614,3928383900),x(3515267271,566280711),x(3940187606,3454069534),x(4118630271,4000239992),x(116418474,1914138554),x(174292421,2731055270),x(289380356,3203993006),x(460393269,320620315),x(685471733,587496836),x(852142971,1086792851),x(1017036298,365543100),x(1126000580,2618297676),x(1288033470,3409855158),x(1501505948,4234509866),x(1607167915,987167468),x(1816402316,1246189591)],a=[];(function(){for(var o=0;o<80;o++)a[o]=x()})();var s=e.SHA512=B.extend({_doReset:function(){this._hash=new h.init([new v.init(1779033703,4089235720),new v.init(3144134277,2227873595),new v.init(1013904242,4271175723),new v.init(2773480762,1595750129),new v.init(1359893119,2917565137),new v.init(2600822924,725511199),new v.init(528734635,4215389547),new v.init(1541459225,327033209)])},_doProcessBlock:function(o,d){for(var f=this._hash.words,E=f[0],i=f[1],n=f[2],c=f[3],_=f[4],A=f[5],D=f[6],g=f[7],I=E.high,p=E.low,F=i.high,b=i.low,R=n.high,P=n.low,T=c.high,M=c.low,W=_.high,z=_.low,q=A.high,O=A.low,m=D.high,k=D.low,S=g.high,w=g.low,$=I,U=p,X=F,L=b,c0=R,i0=P,tr=T,f0=M,j=W,Y=z,p0=q,v0=O,E0=m,d0=k,ar=S,l0=w,J=0;J<80;J++){var Q,r0,C0=a[J];if(J<16)r0=C0.high=o[d+J*2]|0,Q=C0.low=o[d+J*2+1]|0;else{var cr=a[J-15],n0=cr.high,u0=cr.low,se=(n0>>>1|u0<<31)^(n0>>>8|u0<<24)^n0>>>7,fr=(u0>>>1|n0<<31)^(u0>>>8|n0<<24)^(u0>>>7|n0<<25),vr=a[J-2],o0=vr.high,h0=vr.low,ce=(o0>>>19|h0<<13)^(o0<<3|h0>>>29)^o0>>>6,dr=(h0>>>19|o0<<13)^(h0<<3|o0>>>29)^(h0>>>6|o0<<26),lr=a[J-7],fe=lr.high,ve=lr.low,ur=a[J-16],de=ur.high,hr=ur.low;Q=fr+ve,r0=se+fe+(Q>>>0<fr>>>0?1:0),Q=Q+dr,r0=r0+ce+(Q>>>0<dr>>>0?1:0),Q=Q+hr,r0=r0+de+(Q>>>0<hr>>>0?1:0),C0.high=r0,C0.low=Q}var le=j&p0^~j&E0,pr=Y&v0^~Y&d0,ue=$&X^$&c0^X&c0,he=U&L^U&i0^L&i0,pe=($>>>28|U<<4)^($<<30|U>>>2)^($<<25|U>>>7),Er=(U>>>28|$<<4)^(U<<30|$>>>2)^(U<<25|$>>>7),Ee=(j>>>14|Y<<18)^(j>>>18|Y<<14)^(j<<23|Y>>>9),Ce=(Y>>>14|j<<18)^(Y>>>18|j<<14)^(Y<<23|j>>>9),Cr=u[J],Be=Cr.high,Br=Cr.low,Z=l0+Ce,e0=ar+Ee+(Z>>>0<l0>>>0?1:0),Z=Z+pr,e0=e0+le+(Z>>>0<pr>>>0?1:0),Z=Z+Br,e0=e0+Be+(Z>>>0<Br>>>0?1:0),Z=Z+Q,e0=e0+r0+(Z>>>0<Q>>>0?1:0),Ar=Er+he,Ae=pe+ue+(Ar>>>0<Er>>>0?1:0);ar=E0,l0=d0,E0=p0,d0=v0,p0=j,v0=Y,Y=f0+Z|0,j=tr+e0+(Y>>>0<f0>>>0?1:0)|0,tr=c0,f0=i0,c0=X,i0=L,X=$,L=U,U=Z+Ar|0,$=e0+Ae+(U>>>0<Z>>>0?1:0)|0}p=E.low=p+U,E.high=I+$+(p>>>0<U>>>0?1:0),b=i.low=b+L,i.high=F+X+(b>>>0<L>>>0?1:0),P=n.low=P+i0,n.high=R+c0+(P>>>0<i0>>>0?1:0),M=c.low=M+f0,c.high=T+tr+(M>>>0<f0>>>0?1:0),z=_.low=z+Y,_.high=W+j+(z>>>0<Y>>>0?1:0),O=A.low=O+v0,A.high=q+p0+(O>>>0<v0>>>0?1:0),k=D.low=k+d0,D.high=m+E0+(k>>>0<d0>>>0?1:0),w=g.low=w+l0,g.high=S+ar+(w>>>0<l0>>>0?1:0)},_doFinalize:function(){var o=this._data,d=o.words,f=this._nDataBytes*8,E=o.sigBytes*8;d[E>>>5]|=128<<24-E%32,d[(E+128>>>10<<5)+30]=Math.floor(f/4294967296),d[(E+128>>>10<<5)+31]=f,o.sigBytes=d.length*4,this._process();var i=this._hash.toX32();return i},clone:function(){var o=B.clone.call(this);return o._hash=this._hash.clone(),o},blockSize:1024/32});t.SHA512=B._createHelper(s),t.HmacSHA512=B._createHmacHelper(s)}(),l.SHA512})}(S0)),S0.exports}var I0={exports:{}},We=I0.exports,Ir;function $e(){return Ir||(Ir=1,function(r,H){(function(l,t,C){r.exports=t(N(),xr(),ie())})(We,function(l){return function(){var t=l,C=t.x64,B=C.Word,y=C.WordArray,v=t.algo,h=v.SHA512,e=v.SHA384=h.extend({_doReset:function(){this._hash=new y.init([new B.init(3418070365,3238371032),new B.init(1654270250,914150663),new B.init(2438529370,812702999),new B.init(355462360,4144912697),new B.init(1731405415,4290775857),new B.init(2394180231,1750603025),new B.init(3675008525,1694076839),new B.init(1203062813,3204075428)])},_doFinalize:function(){var x=h._doFinalize.call(this);return x.sigBytes-=16,x}});t.SHA384=h._createHelper(e),t.HmacSHA384=h._createHmacHelper(e)}(),l.SHA384})}(I0)),I0.exports}var H0={exports:{}},Ge=H0.exports,Hr;function Ve(){return Hr||(Hr=1,function(r,H){(function(l,t,C){r.exports=t(N(),xr())})(Ge,function(l){return function(t){var C=l,B=C.lib,y=B.WordArray,v=B.Hasher,h=C.x64,e=h.Word,x=C.algo,u=[],a=[],s=[];(function(){for(var f=1,E=0,i=0;i<24;i++){u[f+5*E]=(i+1)*(i+2)/2%64;var n=E%5,c=(2*f+3*E)%5;f=n,E=c}for(var f=0;f<5;f++)for(var E=0;E<5;E++)a[f+5*E]=E+(2*f+3*E)%5*5;for(var _=1,A=0;A<24;A++){for(var D=0,g=0,I=0;I<7;I++){if(_&1){var p=(1<<I)-1;p<32?g^=1<<p:D^=1<<p-32}_&128?_=_<<1^113:_<<=1}s[A]=e.create(D,g)}})();var o=[];(function(){for(var f=0;f<25;f++)o[f]=e.create()})();var d=x.SHA3=v.extend({cfg:v.cfg.extend({outputLength:512}),_doReset:function(){for(var f=this._state=[],E=0;E<25;E++)f[E]=new e.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(f,E){for(var i=this._state,n=this.blockSize/2,c=0;c<n;c++){var _=f[E+2*c],A=f[E+2*c+1];_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360;var D=i[c];D.high^=A,D.low^=_}for(var g=0;g<24;g++){for(var I=0;I<5;I++){for(var p=0,F=0,b=0;b<5;b++){var D=i[I+5*b];p^=D.high,F^=D.low}var R=o[I];R.high=p,R.low=F}for(var I=0;I<5;I++)for(var P=o[(I+4)%5],T=o[(I+1)%5],M=T.high,W=T.low,p=P.high^(M<<1|W>>>31),F=P.low^(W<<1|M>>>31),b=0;b<5;b++){var D=i[I+5*b];D.high^=p,D.low^=F}for(var z=1;z<25;z++){var p,F,D=i[z],q=D.high,O=D.low,m=u[z];m<32?(p=q<<m|O>>>32-m,F=O<<m|q>>>32-m):(p=O<<m-32|q>>>64-m,F=q<<m-32|O>>>64-m);var k=o[a[z]];k.high=p,k.low=F}var S=o[0],w=i[0];S.high=w.high,S.low=w.low;for(var I=0;I<5;I++)for(var b=0;b<5;b++){var z=I+5*b,D=i[z],$=o[z],U=o[(I+1)%5+5*b],X=o[(I+2)%5+5*b];D.high=$.high^~U.high&X.high,D.low=$.low^~U.low&X.low}var D=i[0],L=s[g];D.high^=L.high,D.low^=L.low}},_doFinalize:function(){var f=this._data,E=f.words;this._nDataBytes*8;var i=f.sigBytes*8,n=this.blockSize*32;E[i>>>5]|=1<<24-i%32,E[(t.ceil((i+1)/n)*n>>>5)-1]|=128,f.sigBytes=E.length*4,this._process();for(var c=this._state,_=this.cfg.outputLength/8,A=_/8,D=[],g=0;g<A;g++){var I=c[g],p=I.high,F=I.low;p=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,F=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,D.push(F),D.push(p)}return new y.init(D,_)},clone:function(){for(var f=v.clone.call(this),E=f._state=this._state.slice(0),i=0;i<25;i++)E[i]=E[i].clone();return f}});C.SHA3=v._createHelper(d),C.HmacSHA3=v._createHmacHelper(d)}(Math),l.SHA3})}(H0)),H0.exports}var P0={exports:{}},Ke=P0.exports,Pr;function Xe(){return Pr||(Pr=1,function(r,H){(function(l,t){r.exports=t(N())})(Ke,function(l){/** @preserve
|
|
2
|
-
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
-
|
|
6
|
-
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
-
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
10
|
-
*/return function(t){var C=l,B=C.lib,y=B.WordArray,v=B.Hasher,h=C.algo,e=y.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),x=y.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),u=y.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),a=y.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),s=y.create([0,1518500249,1859775393,2400959708,2840853838]),o=y.create([1352829926,1548603684,1836072691,2053994217,0]),d=h.RIPEMD160=v.extend({_doReset:function(){this._hash=y.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(A,D){for(var g=0;g<16;g++){var I=D+g,p=A[I];A[I]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}var F=this._hash.words,b=s.words,R=o.words,P=e.words,T=x.words,M=u.words,W=a.words,z,q,O,m,k,S,w,$,U,X;S=z=F[0],w=q=F[1],$=O=F[2],U=m=F[3],X=k=F[4];for(var L,g=0;g<80;g+=1)L=z+A[D+P[g]]|0,g<16?L+=f(q,O,m)+b[0]:g<32?L+=E(q,O,m)+b[1]:g<48?L+=i(q,O,m)+b[2]:g<64?L+=n(q,O,m)+b[3]:L+=c(q,O,m)+b[4],L=L|0,L=_(L,M[g]),L=L+k|0,z=k,k=m,m=_(O,10),O=q,q=L,L=S+A[D+T[g]]|0,g<16?L+=c(w,$,U)+R[0]:g<32?L+=n(w,$,U)+R[1]:g<48?L+=i(w,$,U)+R[2]:g<64?L+=E(w,$,U)+R[3]:L+=f(w,$,U)+R[4],L=L|0,L=_(L,W[g]),L=L+X|0,S=X,X=U,U=_($,10),$=w,w=L;L=F[1]+O+U|0,F[1]=F[2]+m+X|0,F[2]=F[3]+k+S|0,F[3]=F[4]+z+w|0,F[4]=F[0]+q+$|0,F[0]=L},_doFinalize:function(){var A=this._data,D=A.words,g=this._nDataBytes*8,I=A.sigBytes*8;D[I>>>5]|=128<<24-I%32,D[(I+64>>>9<<4)+14]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,A.sigBytes=(D.length+1)*4,this._process();for(var p=this._hash,F=p.words,b=0;b<5;b++){var R=F[b];F[b]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360}return p},clone:function(){var A=v.clone.call(this);return A._hash=this._hash.clone(),A}});function f(A,D,g){return A^D^g}function E(A,D,g){return A&D|~A&g}function i(A,D,g){return(A|~D)^g}function n(A,D,g){return A&g|D&~g}function c(A,D,g){return A^(D|~g)}function _(A,D){return A<<D|A>>>32-D}C.RIPEMD160=v._createHelper(d),C.HmacRIPEMD160=v._createHmacHelper(d)}(),l.RIPEMD160})}(P0)),P0.exports}var T0={exports:{}},Ye=T0.exports,Tr;function sr(){return Tr||(Tr=1,function(r,H){(function(l,t){r.exports=t(N())})(Ye,function(l){(function(){var t=l,C=t.lib,B=C.Base,y=t.enc,v=y.Utf8,h=t.algo;h.HMAC=B.extend({init:function(e,x){e=this._hasher=new e.init,typeof x=="string"&&(x=v.parse(x));var u=e.blockSize,a=u*4;x.sigBytes>a&&(x=e.finalize(x)),x.clamp();for(var s=this._oKey=x.clone(),o=this._iKey=x.clone(),d=s.words,f=o.words,E=0;E<u;E++)d[E]^=1549556828,f[E]^=909522486;s.sigBytes=o.sigBytes=a,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var x=this._hasher,u=x.finalize(e);x.reset();var a=x.finalize(this._oKey.clone().concat(u));return a}})})()})}(T0)),T0.exports}var M0={exports:{}},Ze=M0.exports,Mr;function Qe(){return Mr||(Mr=1,function(r,H){(function(l,t,C){r.exports=t(N(),or(),sr())})(Ze,function(l){return function(){var t=l,C=t.lib,B=C.Base,y=C.WordArray,v=t.algo,h=v.SHA256,e=v.HMAC,x=v.PBKDF2=B.extend({cfg:B.extend({keySize:128/32,hasher:h,iterations:25e4}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,a){for(var s=this.cfg,o=e.create(s.hasher,u),d=y.create(),f=y.create([1]),E=d.words,i=f.words,n=s.keySize,c=s.iterations;E.length<n;){var _=o.update(a).finalize(f);o.reset();for(var A=_.words,D=A.length,g=_,I=1;I<c;I++){g=o.finalize(g),o.reset();for(var p=g.words,F=0;F<D;F++)A[F]^=p[F]}d.concat(_),i[0]++}return d.sigBytes=n*4,d}});t.PBKDF2=function(u,a,s){return x.create(s).compute(u,a)}}(),l.PBKDF2})}(M0)),M0.exports}var L0={exports:{}},je=L0.exports,Lr;function x0(){return Lr||(Lr=1,function(r,H){(function(l,t,C){r.exports=t(N(),ae(),sr())})(je,function(l){return function(){var t=l,C=t.lib,B=C.Base,y=C.WordArray,v=t.algo,h=v.MD5,e=v.EvpKDF=B.extend({cfg:B.extend({keySize:128/32,hasher:h,iterations:1}),init:function(x){this.cfg=this.cfg.extend(x)},compute:function(x,u){for(var a,s=this.cfg,o=s.hasher.create(),d=y.create(),f=d.words,E=s.keySize,i=s.iterations;f.length<E;){a&&o.update(a),a=o.update(x).finalize(u),o.reset();for(var n=1;n<i;n++)a=o.finalize(a),o.reset();d.concat(a)}return d.sigBytes=E*4,d}});t.EvpKDF=function(x,u,a){return e.create(a).compute(x,u)}}(),l.EvpKDF})}(L0)),L0.exports}var N0={exports:{}},Je=N0.exports,Nr;function V(){return Nr||(Nr=1,function(r,H){(function(l,t,C){r.exports=t(N(),x0())})(Je,function(l){l.lib.Cipher||function(t){var C=l,B=C.lib,y=B.Base,v=B.WordArray,h=B.BufferedBlockAlgorithm,e=C.enc;e.Utf8;var x=e.Base64,u=C.algo,a=u.EvpKDF,s=B.Cipher=h.extend({cfg:y.extend(),createEncryptor:function(p,F){return this.create(this._ENC_XFORM_MODE,p,F)},createDecryptor:function(p,F){return this.create(this._DEC_XFORM_MODE,p,F)},init:function(p,F,b){this.cfg=this.cfg.extend(b),this._xformMode=p,this._key=F,this.reset()},reset:function(){h.reset.call(this),this._doReset()},process:function(p){return this._append(p),this._process()},finalize:function(p){p&&this._append(p);var F=this._doFinalize();return F},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function p(F){return typeof F=="string"?I:A}return function(F){return{encrypt:function(b,R,P){return p(R).encrypt(F,b,R,P)},decrypt:function(b,R,P){return p(R).decrypt(F,b,R,P)}}}}()});B.StreamCipher=s.extend({_doFinalize:function(){var p=this._process(!0);return p},blockSize:1});var o=C.mode={},d=B.BlockCipherMode=y.extend({createEncryptor:function(p,F){return this.Encryptor.create(p,F)},createDecryptor:function(p,F){return this.Decryptor.create(p,F)},init:function(p,F){this._cipher=p,this._iv=F}}),f=o.CBC=function(){var p=d.extend();p.Encryptor=p.extend({processBlock:function(b,R){var P=this._cipher,T=P.blockSize;F.call(this,b,R,T),P.encryptBlock(b,R),this._prevBlock=b.slice(R,R+T)}}),p.Decryptor=p.extend({processBlock:function(b,R){var P=this._cipher,T=P.blockSize,M=b.slice(R,R+T);P.decryptBlock(b,R),F.call(this,b,R,T),this._prevBlock=M}});function F(b,R,P){var T,M=this._iv;M?(T=M,this._iv=t):T=this._prevBlock;for(var W=0;W<P;W++)b[R+W]^=T[W]}return p}(),E=C.pad={},i=E.Pkcs7={pad:function(p,F){for(var b=F*4,R=b-p.sigBytes%b,P=R<<24|R<<16|R<<8|R,T=[],M=0;M<R;M+=4)T.push(P);var W=v.create(T,R);p.concat(W)},unpad:function(p){var F=p.words[p.sigBytes-1>>>2]&255;p.sigBytes-=F}};B.BlockCipher=s.extend({cfg:s.cfg.extend({mode:f,padding:i}),reset:function(){var p;s.reset.call(this);var F=this.cfg,b=F.iv,R=F.mode;this._xformMode==this._ENC_XFORM_MODE?p=R.createEncryptor:(p=R.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==p?this._mode.init(this,b&&b.words):(this._mode=p.call(R,this,b&&b.words),this._mode.__creator=p)},_doProcessBlock:function(p,F){this._mode.processBlock(p,F)},_doFinalize:function(){var p,F=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(F.pad(this._data,this.blockSize),p=this._process(!0)):(p=this._process(!0),F.unpad(p)),p},blockSize:128/32});var n=B.CipherParams=y.extend({init:function(p){this.mixIn(p)},toString:function(p){return(p||this.formatter).stringify(this)}}),c=C.format={},_=c.OpenSSL={stringify:function(p){var F,b=p.ciphertext,R=p.salt;return R?F=v.create([1398893684,1701076831]).concat(R).concat(b):F=b,F.toString(x)},parse:function(p){var F,b=x.parse(p),R=b.words;return R[0]==1398893684&&R[1]==1701076831&&(F=v.create(R.slice(2,4)),R.splice(0,4),b.sigBytes-=16),n.create({ciphertext:b,salt:F})}},A=B.SerializableCipher=y.extend({cfg:y.extend({format:_}),encrypt:function(p,F,b,R){R=this.cfg.extend(R);var P=p.createEncryptor(b,R),T=P.finalize(F),M=P.cfg;return n.create({ciphertext:T,key:b,iv:M.iv,algorithm:p,mode:M.mode,padding:M.padding,blockSize:p.blockSize,formatter:R.format})},decrypt:function(p,F,b,R){R=this.cfg.extend(R),F=this._parse(F,R.format);var P=p.createDecryptor(b,R).finalize(F.ciphertext);return P},_parse:function(p,F){return typeof p=="string"?F.parse(p,this):p}}),D=C.kdf={},g=D.OpenSSL={execute:function(p,F,b,R,P){if(R||(R=v.random(64/8)),P)var T=a.create({keySize:F+b,hasher:P}).compute(p,R);else var T=a.create({keySize:F+b}).compute(p,R);var M=v.create(T.words.slice(F),b*4);return T.sigBytes=F*4,n.create({key:T,iv:M,salt:R})}},I=B.PasswordBasedCipher=A.extend({cfg:A.cfg.extend({kdf:g}),encrypt:function(p,F,b,R){R=this.cfg.extend(R);var P=R.kdf.execute(b,p.keySize,p.ivSize,R.salt,R.hasher);R.iv=P.iv;var T=A.encrypt.call(this,p,F,P.key,R);return T.mixIn(P),T},decrypt:function(p,F,b,R){R=this.cfg.extend(R),F=this._parse(F,R.format);var P=R.kdf.execute(b,p.keySize,p.ivSize,F.salt,R.hasher);R.iv=P.iv;var T=A.decrypt.call(this,p,F,P.key,R);return T}})}()})}(N0)),N0.exports}var z0={exports:{}},rx=z0.exports,zr;function ex(){return zr||(zr=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(rx,function(l){return l.mode.CFB=function(){var t=l.lib.BlockCipherMode.extend();t.Encryptor=t.extend({processBlock:function(B,y){var v=this._cipher,h=v.blockSize;C.call(this,B,y,h,v),this._prevBlock=B.slice(y,y+h)}}),t.Decryptor=t.extend({processBlock:function(B,y){var v=this._cipher,h=v.blockSize,e=B.slice(y,y+h);C.call(this,B,y,h,v),this._prevBlock=e}});function C(B,y,v,h){var e,x=this._iv;x?(e=x.slice(0),this._iv=void 0):e=this._prevBlock,h.encryptBlock(e,0);for(var u=0;u<v;u++)B[y+u]^=e[u]}return t}(),l.mode.CFB})}(z0)),z0.exports}var O0={exports:{}},xx=O0.exports,Or;function tx(){return Or||(Or=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(xx,function(l){return l.mode.CTR=function(){var t=l.lib.BlockCipherMode.extend(),C=t.Encryptor=t.extend({processBlock:function(B,y){var v=this._cipher,h=v.blockSize,e=this._iv,x=this._counter;e&&(x=this._counter=e.slice(0),this._iv=void 0);var u=x.slice(0);v.encryptBlock(u,0),x[h-1]=x[h-1]+1|0;for(var a=0;a<h;a++)B[y+a]^=u[a]}});return t.Decryptor=C,t}(),l.mode.CTR})}(O0)),O0.exports}var q0={exports:{}},ax=q0.exports,qr;function ix(){return qr||(qr=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(ax,function(l){/** @preserve
|
|
11
|
-
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
12
|
-
* derived from CryptoJS.mode.CTR
|
|
13
|
-
* Jan Hruby jhruby.web@gmail.com
|
|
14
|
-
*/return l.mode.CTRGladman=function(){var t=l.lib.BlockCipherMode.extend();function C(v){if((v>>24&255)===255){var h=v>>16&255,e=v>>8&255,x=v&255;h===255?(h=0,e===255?(e=0,x===255?x=0:++x):++e):++h,v=0,v+=h<<16,v+=e<<8,v+=x}else v+=1<<24;return v}function B(v){return(v[0]=C(v[0]))===0&&(v[1]=C(v[1])),v}var y=t.Encryptor=t.extend({processBlock:function(v,h){var e=this._cipher,x=e.blockSize,u=this._iv,a=this._counter;u&&(a=this._counter=u.slice(0),this._iv=void 0),B(a);var s=a.slice(0);e.encryptBlock(s,0);for(var o=0;o<x;o++)v[h+o]^=s[o]}});return t.Decryptor=y,t}(),l.mode.CTRGladman})}(q0)),q0.exports}var U0={exports:{}},nx=U0.exports,Ur;function ox(){return Ur||(Ur=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(nx,function(l){return l.mode.OFB=function(){var t=l.lib.BlockCipherMode.extend(),C=t.Encryptor=t.extend({processBlock:function(B,y){var v=this._cipher,h=v.blockSize,e=this._iv,x=this._keystream;e&&(x=this._keystream=e.slice(0),this._iv=void 0),v.encryptBlock(x,0);for(var u=0;u<h;u++)B[y+u]^=x[u]}});return t.Decryptor=C,t}(),l.mode.OFB})}(U0)),U0.exports}var W0={exports:{}},sx=W0.exports,Wr;function cx(){return Wr||(Wr=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(sx,function(l){return l.mode.ECB=function(){var t=l.lib.BlockCipherMode.extend();return t.Encryptor=t.extend({processBlock:function(C,B){this._cipher.encryptBlock(C,B)}}),t.Decryptor=t.extend({processBlock:function(C,B){this._cipher.decryptBlock(C,B)}}),t}(),l.mode.ECB})}(W0)),W0.exports}var $0={exports:{}},fx=$0.exports,$r;function vx(){return $r||($r=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(fx,function(l){return l.pad.AnsiX923={pad:function(t,C){var B=t.sigBytes,y=C*4,v=y-B%y,h=B+v-1;t.clamp(),t.words[h>>>2]|=v<<24-h%4*8,t.sigBytes+=v},unpad:function(t){var C=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=C}},l.pad.Ansix923})}($0)),$0.exports}var G0={exports:{}},dx=G0.exports,Gr;function lx(){return Gr||(Gr=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(dx,function(l){return l.pad.Iso10126={pad:function(t,C){var B=C*4,y=B-t.sigBytes%B;t.concat(l.lib.WordArray.random(y-1)).concat(l.lib.WordArray.create([y<<24],1))},unpad:function(t){var C=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=C}},l.pad.Iso10126})}(G0)),G0.exports}var V0={exports:{}},ux=V0.exports,Vr;function hx(){return Vr||(Vr=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(ux,function(l){return l.pad.Iso97971={pad:function(t,C){t.concat(l.lib.WordArray.create([2147483648],1)),l.pad.ZeroPadding.pad(t,C)},unpad:function(t){l.pad.ZeroPadding.unpad(t),t.sigBytes--}},l.pad.Iso97971})}(V0)),V0.exports}var K0={exports:{}},px=K0.exports,Kr;function Ex(){return Kr||(Kr=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(px,function(l){return l.pad.ZeroPadding={pad:function(t,C){var B=C*4;t.clamp(),t.sigBytes+=B-(t.sigBytes%B||B)},unpad:function(t){for(var C=t.words,B=t.sigBytes-1,B=t.sigBytes-1;B>=0;B--)if(C[B>>>2]>>>24-B%4*8&255){t.sigBytes=B+1;break}}},l.pad.ZeroPadding})}(K0)),K0.exports}var X0={exports:{}},Cx=X0.exports,Xr;function Bx(){return Xr||(Xr=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(Cx,function(l){return l.pad.NoPadding={pad:function(){},unpad:function(){}},l.pad.NoPadding})}(X0)),X0.exports}var Y0={exports:{}},Ax=Y0.exports,Yr;function _x(){return Yr||(Yr=1,function(r,H){(function(l,t,C){r.exports=t(N(),V())})(Ax,function(l){return function(t){var C=l,B=C.lib,y=B.CipherParams,v=C.enc,h=v.Hex,e=C.format;e.Hex={stringify:function(x){return x.ciphertext.toString(h)},parse:function(x){var u=h.parse(x);return y.create({ciphertext:u})}}}(),l.format.Hex})}(Y0)),Y0.exports}var Z0={exports:{}},Dx=Z0.exports,Zr;function Fx(){return Zr||(Zr=1,function(r,H){(function(l,t,C){r.exports=t(N(),t0(),a0(),x0(),V())})(Dx,function(l){return function(){var t=l,C=t.lib,B=C.BlockCipher,y=t.algo,v=[],h=[],e=[],x=[],u=[],a=[],s=[],o=[],d=[],f=[];(function(){for(var n=[],c=0;c<256;c++)c<128?n[c]=c<<1:n[c]=c<<1^283;for(var _=0,A=0,c=0;c<256;c++){var D=A^A<<1^A<<2^A<<3^A<<4;D=D>>>8^D&255^99,v[_]=D,h[D]=_;var g=n[_],I=n[g],p=n[I],F=n[D]*257^D*16843008;e[_]=F<<24|F>>>8,x[_]=F<<16|F>>>16,u[_]=F<<8|F>>>24,a[_]=F;var F=p*16843009^I*65537^g*257^_*16843008;s[D]=F<<24|F>>>8,o[D]=F<<16|F>>>16,d[D]=F<<8|F>>>24,f[D]=F,_?(_=g^n[n[n[p^g]]],A^=n[n[A]]):_=A=1}})();var E=[0,1,2,4,8,16,32,64,128,27,54],i=y.AES=B.extend({_doReset:function(){var n;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var c=this._keyPriorReset=this._key,_=c.words,A=c.sigBytes/4,D=this._nRounds=A+6,g=(D+1)*4,I=this._keySchedule=[],p=0;p<g;p++)p<A?I[p]=_[p]:(n=I[p-1],p%A?A>6&&p%A==4&&(n=v[n>>>24]<<24|v[n>>>16&255]<<16|v[n>>>8&255]<<8|v[n&255]):(n=n<<8|n>>>24,n=v[n>>>24]<<24|v[n>>>16&255]<<16|v[n>>>8&255]<<8|v[n&255],n^=E[p/A|0]<<24),I[p]=I[p-A]^n);for(var F=this._invKeySchedule=[],b=0;b<g;b++){var p=g-b;if(b%4)var n=I[p];else var n=I[p-4];b<4||p<=4?F[b]=n:F[b]=s[v[n>>>24]]^o[v[n>>>16&255]]^d[v[n>>>8&255]]^f[v[n&255]]}}},encryptBlock:function(n,c){this._doCryptBlock(n,c,this._keySchedule,e,x,u,a,v)},decryptBlock:function(n,c){var _=n[c+1];n[c+1]=n[c+3],n[c+3]=_,this._doCryptBlock(n,c,this._invKeySchedule,s,o,d,f,h);var _=n[c+1];n[c+1]=n[c+3],n[c+3]=_},_doCryptBlock:function(n,c,_,A,D,g,I,p){for(var F=this._nRounds,b=n[c]^_[0],R=n[c+1]^_[1],P=n[c+2]^_[2],T=n[c+3]^_[3],M=4,W=1;W<F;W++){var z=A[b>>>24]^D[R>>>16&255]^g[P>>>8&255]^I[T&255]^_[M++],q=A[R>>>24]^D[P>>>16&255]^g[T>>>8&255]^I[b&255]^_[M++],O=A[P>>>24]^D[T>>>16&255]^g[b>>>8&255]^I[R&255]^_[M++],m=A[T>>>24]^D[b>>>16&255]^g[R>>>8&255]^I[P&255]^_[M++];b=z,R=q,P=O,T=m}var z=(p[b>>>24]<<24|p[R>>>16&255]<<16|p[P>>>8&255]<<8|p[T&255])^_[M++],q=(p[R>>>24]<<24|p[P>>>16&255]<<16|p[T>>>8&255]<<8|p[b&255])^_[M++],O=(p[P>>>24]<<24|p[T>>>16&255]<<16|p[b>>>8&255]<<8|p[R&255])^_[M++],m=(p[T>>>24]<<24|p[b>>>16&255]<<16|p[R>>>8&255]<<8|p[P&255])^_[M++];n[c]=z,n[c+1]=q,n[c+2]=O,n[c+3]=m},keySize:256/32});t.AES=B._createHelper(i)}(),l.AES})}(Z0)),Z0.exports}var Q0={exports:{}},gx=Q0.exports,Qr;function yx(){return Qr||(Qr=1,function(r,H){(function(l,t,C){r.exports=t(N(),t0(),a0(),x0(),V())})(gx,function(l){return function(){var t=l,C=t.lib,B=C.WordArray,y=C.BlockCipher,v=t.algo,h=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],e=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],x=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],a=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],s=v.DES=y.extend({_doReset:function(){for(var E=this._key,i=E.words,n=[],c=0;c<56;c++){var _=h[c]-1;n[c]=i[_>>>5]>>>31-_%32&1}for(var A=this._subKeys=[],D=0;D<16;D++){for(var g=A[D]=[],I=x[D],c=0;c<24;c++)g[c/6|0]|=n[(e[c]-1+I)%28]<<31-c%6,g[4+(c/6|0)]|=n[28+(e[c+24]-1+I)%28]<<31-c%6;g[0]=g[0]<<1|g[0]>>>31;for(var c=1;c<7;c++)g[c]=g[c]>>>(c-1)*4+3;g[7]=g[7]<<5|g[7]>>>27}for(var p=this._invSubKeys=[],c=0;c<16;c++)p[c]=A[15-c]},encryptBlock:function(E,i){this._doCryptBlock(E,i,this._subKeys)},decryptBlock:function(E,i){this._doCryptBlock(E,i,this._invSubKeys)},_doCryptBlock:function(E,i,n){this._lBlock=E[i],this._rBlock=E[i+1],o.call(this,4,252645135),o.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),o.call(this,1,1431655765);for(var c=0;c<16;c++){for(var _=n[c],A=this._lBlock,D=this._rBlock,g=0,I=0;I<8;I++)g|=u[I][((D^_[I])&a[I])>>>0];this._lBlock=D,this._rBlock=A^g}var p=this._lBlock;this._lBlock=this._rBlock,this._rBlock=p,o.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),o.call(this,16,65535),o.call(this,4,252645135),E[i]=this._lBlock,E[i+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function o(E,i){var n=(this._lBlock>>>E^this._rBlock)&i;this._rBlock^=n,this._lBlock^=n<<E}function d(E,i){var n=(this._rBlock>>>E^this._lBlock)&i;this._lBlock^=n,this._rBlock^=n<<E}t.DES=y._createHelper(s);var f=v.TripleDES=y.extend({_doReset:function(){var E=this._key,i=E.words;if(i.length!==2&&i.length!==4&&i.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var n=i.slice(0,2),c=i.length<4?i.slice(0,2):i.slice(2,4),_=i.length<6?i.slice(0,2):i.slice(4,6);this._des1=s.createEncryptor(B.create(n)),this._des2=s.createEncryptor(B.create(c)),this._des3=s.createEncryptor(B.create(_))},encryptBlock:function(E,i){this._des1.encryptBlock(E,i),this._des2.decryptBlock(E,i),this._des3.encryptBlock(E,i)},decryptBlock:function(E,i){this._des3.decryptBlock(E,i),this._des2.encryptBlock(E,i),this._des1.decryptBlock(E,i)},keySize:192/32,ivSize:64/32,blockSize:64/32});t.TripleDES=y._createHelper(f)}(),l.TripleDES})}(Q0)),Q0.exports}var j0={exports:{}},mx=j0.exports,jr;function bx(){return jr||(jr=1,function(r,H){(function(l,t,C){r.exports=t(N(),t0(),a0(),x0(),V())})(mx,function(l){return function(){var t=l,C=t.lib,B=C.StreamCipher,y=t.algo,v=y.RC4=B.extend({_doReset:function(){for(var x=this._key,u=x.words,a=x.sigBytes,s=this._S=[],o=0;o<256;o++)s[o]=o;for(var o=0,d=0;o<256;o++){var f=o%a,E=u[f>>>2]>>>24-f%4*8&255;d=(d+s[o]+E)%256;var i=s[o];s[o]=s[d],s[d]=i}this._i=this._j=0},_doProcessBlock:function(x,u){x[u]^=h.call(this)},keySize:256/32,ivSize:0});function h(){for(var x=this._S,u=this._i,a=this._j,s=0,o=0;o<4;o++){u=(u+1)%256,a=(a+x[u])%256;var d=x[u];x[u]=x[a],x[a]=d,s|=x[(x[u]+x[a])%256]<<24-o*8}return this._i=u,this._j=a,s}t.RC4=B._createHelper(v);var e=y.RC4Drop=v.extend({cfg:v.cfg.extend({drop:192}),_doReset:function(){v._doReset.call(this);for(var x=this.cfg.drop;x>0;x--)h.call(this)}});t.RC4Drop=B._createHelper(e)}(),l.RC4})}(j0)),j0.exports}var J0={exports:{}},Rx=J0.exports,Jr;function wx(){return Jr||(Jr=1,function(r,H){(function(l,t,C){r.exports=t(N(),t0(),a0(),x0(),V())})(Rx,function(l){return function(){var t=l,C=t.lib,B=C.StreamCipher,y=t.algo,v=[],h=[],e=[],x=y.Rabbit=B.extend({_doReset:function(){for(var a=this._key.words,s=this.cfg.iv,o=0;o<4;o++)a[o]=(a[o]<<8|a[o]>>>24)&16711935|(a[o]<<24|a[o]>>>8)&4278255360;var d=this._X=[a[0],a[3]<<16|a[2]>>>16,a[1],a[0]<<16|a[3]>>>16,a[2],a[1]<<16|a[0]>>>16,a[3],a[2]<<16|a[1]>>>16],f=this._C=[a[2]<<16|a[2]>>>16,a[0]&4294901760|a[1]&65535,a[3]<<16|a[3]>>>16,a[1]&4294901760|a[2]&65535,a[0]<<16|a[0]>>>16,a[2]&4294901760|a[3]&65535,a[1]<<16|a[1]>>>16,a[3]&4294901760|a[0]&65535];this._b=0;for(var o=0;o<4;o++)u.call(this);for(var o=0;o<8;o++)f[o]^=d[o+4&7];if(s){var E=s.words,i=E[0],n=E[1],c=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360,_=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,A=c>>>16|_&4294901760,D=_<<16|c&65535;f[0]^=c,f[1]^=A,f[2]^=_,f[3]^=D,f[4]^=c,f[5]^=A,f[6]^=_,f[7]^=D;for(var o=0;o<4;o++)u.call(this)}},_doProcessBlock:function(a,s){var o=this._X;u.call(this),v[0]=o[0]^o[5]>>>16^o[3]<<16,v[1]=o[2]^o[7]>>>16^o[5]<<16,v[2]=o[4]^o[1]>>>16^o[7]<<16,v[3]=o[6]^o[3]>>>16^o[1]<<16;for(var d=0;d<4;d++)v[d]=(v[d]<<8|v[d]>>>24)&16711935|(v[d]<<24|v[d]>>>8)&4278255360,a[s+d]^=v[d]},blockSize:128/32,ivSize:64/32});function u(){for(var a=this._X,s=this._C,o=0;o<8;o++)h[o]=s[o];s[0]=s[0]+1295307597+this._b|0,s[1]=s[1]+3545052371+(s[0]>>>0<h[0]>>>0?1:0)|0,s[2]=s[2]+886263092+(s[1]>>>0<h[1]>>>0?1:0)|0,s[3]=s[3]+1295307597+(s[2]>>>0<h[2]>>>0?1:0)|0,s[4]=s[4]+3545052371+(s[3]>>>0<h[3]>>>0?1:0)|0,s[5]=s[5]+886263092+(s[4]>>>0<h[4]>>>0?1:0)|0,s[6]=s[6]+1295307597+(s[5]>>>0<h[5]>>>0?1:0)|0,s[7]=s[7]+3545052371+(s[6]>>>0<h[6]>>>0?1:0)|0,this._b=s[7]>>>0<h[7]>>>0?1:0;for(var o=0;o<8;o++){var d=a[o]+s[o],f=d&65535,E=d>>>16,i=((f*f>>>17)+f*E>>>15)+E*E,n=((d&4294901760)*d|0)+((d&65535)*d|0);e[o]=i^n}a[0]=e[0]+(e[7]<<16|e[7]>>>16)+(e[6]<<16|e[6]>>>16)|0,a[1]=e[1]+(e[0]<<8|e[0]>>>24)+e[7]|0,a[2]=e[2]+(e[1]<<16|e[1]>>>16)+(e[0]<<16|e[0]>>>16)|0,a[3]=e[3]+(e[2]<<8|e[2]>>>24)+e[1]|0,a[4]=e[4]+(e[3]<<16|e[3]>>>16)+(e[2]<<16|e[2]>>>16)|0,a[5]=e[5]+(e[4]<<8|e[4]>>>24)+e[3]|0,a[6]=e[6]+(e[5]<<16|e[5]>>>16)+(e[4]<<16|e[4]>>>16)|0,a[7]=e[7]+(e[6]<<8|e[6]>>>24)+e[5]|0}t.Rabbit=B._createHelper(x)}(),l.Rabbit})}(J0)),J0.exports}var rr={exports:{}},kx=rr.exports,re;function Sx(){return re||(re=1,function(r,H){(function(l,t,C){r.exports=t(N(),t0(),a0(),x0(),V())})(kx,function(l){return function(){var t=l,C=t.lib,B=C.StreamCipher,y=t.algo,v=[],h=[],e=[],x=y.RabbitLegacy=B.extend({_doReset:function(){var a=this._key.words,s=this.cfg.iv,o=this._X=[a[0],a[3]<<16|a[2]>>>16,a[1],a[0]<<16|a[3]>>>16,a[2],a[1]<<16|a[0]>>>16,a[3],a[2]<<16|a[1]>>>16],d=this._C=[a[2]<<16|a[2]>>>16,a[0]&4294901760|a[1]&65535,a[3]<<16|a[3]>>>16,a[1]&4294901760|a[2]&65535,a[0]<<16|a[0]>>>16,a[2]&4294901760|a[3]&65535,a[1]<<16|a[1]>>>16,a[3]&4294901760|a[0]&65535];this._b=0;for(var f=0;f<4;f++)u.call(this);for(var f=0;f<8;f++)d[f]^=o[f+4&7];if(s){var E=s.words,i=E[0],n=E[1],c=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360,_=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,A=c>>>16|_&4294901760,D=_<<16|c&65535;d[0]^=c,d[1]^=A,d[2]^=_,d[3]^=D,d[4]^=c,d[5]^=A,d[6]^=_,d[7]^=D;for(var f=0;f<4;f++)u.call(this)}},_doProcessBlock:function(a,s){var o=this._X;u.call(this),v[0]=o[0]^o[5]>>>16^o[3]<<16,v[1]=o[2]^o[7]>>>16^o[5]<<16,v[2]=o[4]^o[1]>>>16^o[7]<<16,v[3]=o[6]^o[3]>>>16^o[1]<<16;for(var d=0;d<4;d++)v[d]=(v[d]<<8|v[d]>>>24)&16711935|(v[d]<<24|v[d]>>>8)&4278255360,a[s+d]^=v[d]},blockSize:128/32,ivSize:64/32});function u(){for(var a=this._X,s=this._C,o=0;o<8;o++)h[o]=s[o];s[0]=s[0]+1295307597+this._b|0,s[1]=s[1]+3545052371+(s[0]>>>0<h[0]>>>0?1:0)|0,s[2]=s[2]+886263092+(s[1]>>>0<h[1]>>>0?1:0)|0,s[3]=s[3]+1295307597+(s[2]>>>0<h[2]>>>0?1:0)|0,s[4]=s[4]+3545052371+(s[3]>>>0<h[3]>>>0?1:0)|0,s[5]=s[5]+886263092+(s[4]>>>0<h[4]>>>0?1:0)|0,s[6]=s[6]+1295307597+(s[5]>>>0<h[5]>>>0?1:0)|0,s[7]=s[7]+3545052371+(s[6]>>>0<h[6]>>>0?1:0)|0,this._b=s[7]>>>0<h[7]>>>0?1:0;for(var o=0;o<8;o++){var d=a[o]+s[o],f=d&65535,E=d>>>16,i=((f*f>>>17)+f*E>>>15)+E*E,n=((d&4294901760)*d|0)+((d&65535)*d|0);e[o]=i^n}a[0]=e[0]+(e[7]<<16|e[7]>>>16)+(e[6]<<16|e[6]>>>16)|0,a[1]=e[1]+(e[0]<<8|e[0]>>>24)+e[7]|0,a[2]=e[2]+(e[1]<<16|e[1]>>>16)+(e[0]<<16|e[0]>>>16)|0,a[3]=e[3]+(e[2]<<8|e[2]>>>24)+e[1]|0,a[4]=e[4]+(e[3]<<16|e[3]>>>16)+(e[2]<<16|e[2]>>>16)|0,a[5]=e[5]+(e[4]<<8|e[4]>>>24)+e[3]|0,a[6]=e[6]+(e[5]<<16|e[5]>>>16)+(e[4]<<16|e[4]>>>16)|0,a[7]=e[7]+(e[6]<<8|e[6]>>>24)+e[5]|0}t.RabbitLegacy=B._createHelper(x)}(),l.RabbitLegacy})}(rr)),rr.exports}var er={exports:{}},Ix=er.exports,ee;function Hx(){return ee||(ee=1,function(r,H){(function(l,t,C){r.exports=t(N(),t0(),a0(),x0(),V())})(Ix,function(l){return function(){var t=l,C=t.lib,B=C.BlockCipher,y=t.algo;const v=16,h=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],e=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var x={pbox:[],sbox:[]};function u(f,E){let i=E>>24&255,n=E>>16&255,c=E>>8&255,_=E&255,A=f.sbox[0][i]+f.sbox[1][n];return A=A^f.sbox[2][c],A=A+f.sbox[3][_],A}function a(f,E,i){let n=E,c=i,_;for(let A=0;A<v;++A)n=n^f.pbox[A],c=u(f,n)^c,_=n,n=c,c=_;return _=n,n=c,c=_,c=c^f.pbox[v],n=n^f.pbox[v+1],{left:n,right:c}}function s(f,E,i){let n=E,c=i,_;for(let A=v+1;A>1;--A)n=n^f.pbox[A],c=u(f,n)^c,_=n,n=c,c=_;return _=n,n=c,c=_,c=c^f.pbox[1],n=n^f.pbox[0],{left:n,right:c}}function o(f,E,i){for(let D=0;D<4;D++){f.sbox[D]=[];for(let g=0;g<256;g++)f.sbox[D][g]=e[D][g]}let n=0;for(let D=0;D<v+2;D++)f.pbox[D]=h[D]^E[n],n++,n>=i&&(n=0);let c=0,_=0,A=0;for(let D=0;D<v+2;D+=2)A=a(f,c,_),c=A.left,_=A.right,f.pbox[D]=c,f.pbox[D+1]=_;for(let D=0;D<4;D++)for(let g=0;g<256;g+=2)A=a(f,c,_),c=A.left,_=A.right,f.sbox[D][g]=c,f.sbox[D][g+1]=_;return!0}var d=y.Blowfish=B.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var f=this._keyPriorReset=this._key,E=f.words,i=f.sigBytes/4;o(x,E,i)}},encryptBlock:function(f,E){var i=a(x,f[E],f[E+1]);f[E]=i.left,f[E+1]=i.right},decryptBlock:function(f,E){var i=s(x,f[E],f[E+1]);f[E]=i.left,f[E+1]=i.right},blockSize:64/32,keySize:128/32,ivSize:64/32});t.Blowfish=B._createHelper(d)}(),l.Blowfish})}(er)),er.exports}var Px=A0.exports,xe;function Tx(){return xe||(xe=1,function(r,H){(function(l,t,C){r.exports=t(N(),xr(),Se(),He(),t0(),Me(),a0(),ae(),or(),qe(),ie(),$e(),Ve(),Xe(),sr(),Qe(),x0(),V(),ex(),tx(),ix(),ox(),cx(),vx(),lx(),hx(),Ex(),Bx(),_x(),Fx(),yx(),bx(),wx(),Sx(),Hx())})(Px,function(l){return l})}(A0)),A0.exports}var Mx=Tx();const ne=ye(Mx);var Lx=(r=>(r.Start="magic_oauth_login_with_redirect_start",r.Verify="magic_oauth_login_with_redirect_verify",r.Popup="magic_oauth_login_with_popup",r.VerifyTelegramData="magic_oauth_verify_telegram_data",r))(Lx||{}),Nx=(r=>(r.InvalidRequest="invalid_request",r.InvalidClient="invalid_client",r.InvalidScope="invalid_scope",r.InvalidGrant="invalid_grant",r.UnauthorizedClient="unauthorized_client",r.UnsupportedResponseType="unsupported_response_type",r.UnsupportedGrantType="unsupported_grant_type",r.UnsupportedTokenType="unsupported_token_type",r.AccessDenied="access_denied",r.ServerError="server_error",r.TemporarilyUnavailable="temporarily_unavailable",r))(Nx||{}),zx=(r=>(r.MissingApiKey="MISSING_API_KEY",r.ModalNotReady="MODAL_NOT_READY",r.ConnectionLost="CONNECTION_WAS_LOST",r.MalformedResponse="MALFORMED_RESPONSE",r.InvalidArgument="INVALID_ARGUMENT",r.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",r.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",r))(zx||{}),Ox=(r=>(r.SyncWeb3Method="SYNC_WEB3_METHOD",r.DuplicateIframe="DUPLICATE_IFRAME",r.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",r.DeprecationNotice="DEPRECATION_NOTICE",r.ProductAnnouncement="ANNOUNCEMENT",r))(Ox||{}),qx=(r=>(r[r.ParseError=-32700]="ParseError",r[r.InvalidRequest=-32600]="InvalidRequest",r[r.MethodNotFound=-32601]="MethodNotFound",r[r.InvalidParams=-32602]="InvalidParams",r[r.InternalError=-32603]="InternalError",r[r.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",r[r.MagicLinkExpired=-10001]="MagicLinkExpired",r[r.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",r[r.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",r[r.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",r[r.UpdateEmailFailed=-10004]="UpdateEmailFailed",r[r.UserRequestEditEmail=-10005]="UserRequestEditEmail",r[r.InactiveRecipient=-10010]="InactiveRecipient",r[r.AccessDeniedToUser=-10011]="AccessDeniedToUser",r[r.RedirectLoginComplete=-10015]="RedirectLoginComplete",r[r.DpopInvalidated=-10019]="DpopInvalidated",r))(qx||{}),Ux=(r=>(r.PROVIDER="magic_3pw_provider",r.ADDRESS="magic_3pw_address",r.CHAIN_ID="magic_3pw_chainId",r))(Ux||{}),Wx=(r=>(r.WalletConnected="wallet_connected",r.WalletRejected="wallet_rejected",r.Web3ModalSelected="web3modal_selected",r))(Wx||{}),$x=(r=>(r.LoginWithSms="magic_auth_login_with_sms",r.LoginWithEmailOTP="magic_auth_login_with_email_otp",r.LoginWithMagicLink="magic_auth_login_with_magic_link",r.LoginWithCredential="magic_auth_login_with_credential",r.SetAuthorizationToken="magic_auth_set_authorization_token",r.GetIdToken="magic_auth_get_id_token",r.GenerateIdToken="magic_auth_generate_id_token",r.GetMetadata="magic_auth_get_metadata",r.IsLoggedIn="magic_is_logged_in",r.Logout="magic_auth_logout",r.UpdateEmail="magic_auth_update_email",r.UserSettings="magic_auth_settings",r.UserSettingsTestMode="magic_auth_settings_testing_mode",r.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",r.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",r.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",r.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",r.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",r.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",r.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",r.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",r.LogoutTestMode="magic_auth_logout_testing_mode",r.UpdateEmailTestMode="magic_auth_update_email_testing_mode",r.IntermediaryEvent="magic_intermediary_event",r.RequestAccounts="eth_requestAccounts",r.GetInfo="magic_get_info",r.ShowUI="magic_wallet",r.NFTPurchase="magic_nft_purchase",r.NFTCheckout="magic_nft_checkout",r.NFTTransfer="magic_nft_transfer",r.RequestUserInfoWithUI="mc_request_user_info",r.Disconnect="mc_disconnect",r.RecoverAccount="magic_auth_recover_account",r.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",r.MagicBoxHeartBeat="magic_box_heart_beat",r.AutoConnect="mc_auto_connect",r.Login="mc_login",r.EncryptV1="magic_auth_encrypt_v1",r.DecryptV1="magic_auth_decrypt_v1",r.ShowNFTs="magic_show_nfts",r.ShowOnRamp="magic_show_fiat_onramp",r.ShowSendTokensUI="magic_show_send_tokens_ui",r.ShowAddress="magic_show_address",r.ShowBalances="magic_show_balances",r.RevealPK="magic_reveal_key",r.EnableMFA="magic_auth_enable_mfa_flow",r.DisableMFA="magic_auth_disable_mfa_flow",r.GetMultichainPublicAddress="magic_get_multichain_public_address",r.Sign7702Authorization="magic_wallet_sign_7702_authorization",r.Send7702Transaction="eth_send7702Transaction",r))($x||{}),Gx=(r=>(r.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",r.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",r.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",r.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",r.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",r.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",r.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",r.MAGIC_PONG="MAGIC_PONG",r.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",r.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",r.MAGIC_THIRD_PARTY_WALLET_REQUEST="MAGIC_THIRD_PARTY_WALLET_REQUEST",r))(Gx||{}),Vx=(r=>(r.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",r.MAGIC_THIRD_PARTY_WALLET_RESPONSE="MAGIC_THIRD_PARTY_WALLET_RESPONSE",r.MAGIC_THIRD_PARTY_WALLET_UPDATE="MAGIC_THIRD_PARTY_WALLET_EVENT",r.MAGIC_PING="MAGIC_PING",r))(Vx||{}),Kx=(r=>(r.UpdateEmail="update-email",r.MFA="mfa",r.Recovery="recovery",r))(Kx||{}),Xx=(r=>(r.Retry="retry",r))(Xx||{}),Yx=(r=>(r.EmailSent="email-sent",r.EmailNotDeliverable="email-not-deliverable",r))(Yx||{}),Zx=(r=>(r.VerifyEmailOtp="verify-email-otp",r.VerifyMFACode="verify-mfa-code",r.LostDevice="lost-device",r.VerifyRecoveryCode="verify-recovery-code",r.Cancel="cancel",r))(Zx||{}),Qx=(r=>(r.VerifySmsOtp="verify-sms-otp",r.Cancel="cancel",r.Retry="retry",r))(Qx||{}),jx=(r=>(r.SmsOTPSent="sms-otp-sent",r.InvalidSmsOtp="invalid-sms-otp",r.ExpiredSmsOtp="expired-sms-otp",r))(jx||{}),Jx=(r=>(r.EmailOTPSent="email-otp-sent",r.InvalidEmailOtp="invalid-email-otp",r.InvalidMfaOtp="invalid-mfa-otp",r.ExpiredEmailOtp="expired-email-otp",r.MfaSentHandle="mfa-sent-handle",r.RecoveryCodeSentHandle="recovery-code-sent-handle",r.InvalidRecoveryCode="invalid-recovery-code",r.RecoveryCodeSuccess="recovery-code-success",r.LoginThrottled="login-throttled",r.MaxAttemptsReached="max-attempts-reached",r))(Jx||{}),rt=(r=>(r.Retry="device-retry",r))(rt||{}),et=(r=>(r.DeviceApproved="device-approved",r.DeviceNeedsApproval="device-needs-approval",r.DeviceVerificationLinkExpired="device-verification-link-expired",r.DeviceVerificationEmailSent="device-verification-email-sent",r))(et||{}),xt=(r=>(r.Retry="Recency/auth-factor-retry",r.Cancel="Recency/auth-factor-verification-cancel",r.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",r.VerifyMFACode="Recency/verify-mfa-code",r))(xt||{}),tt=(r=>(r.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",r.PrimaryAuthFactorVerified="Recency/auth-factor-verified",r.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",r.EmailExpired="Recency/auth-factor-verification-email-expired",r.EmailSent="Recency/auth-factor-verification-email-sent",r.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",r))(tt||{}),at=(r=>(r.RetryWithNewEmail="UpdateEmail/retry-with-new-email",r.Cancel="UpdateEmail/new-email-verification-cancel",r.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",r))(at||{}),it=(r=>(r.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",r.EmailUpdated="UpdateEmail/email-updated",r.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",r.EmailExpired="UpdateEmail/new-email-verification-email-expired",r.EmailSent="UpdateEmail/new-email-verification-email-sent",r.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",r.InvalidEmail="UpdateEmail/new-email-invalid",r.EmailAlreadyExists="UpdateEmail/new-email-already-exists",r))(it||{}),nt=(r=>(r.IDTokenCreated="Auth/id-token-created",r))(nt||{}),ot=(r=>(r.Cancel="Farcaster/cancel",r))(ot||{}),st=(r=>(r.MFASecretGenerated="mfa-secret-generated",r.InvalidMFAOtp="invalid-mfa-otp",r.MFARecoveryCodes="mfa-recovery-codes",r))(st||{}),ct=(r=>(r.VerifyMFACode="verify-mfa-code",r.Cancel="cancel-mfa-setup",r))(ct||{}),ft=(r=>(r.MFACodeRequested="mfa-code-requested",r.InvalidMFAOtp="invalid-mfa-otp",r.InvalidRecoveryCode="invalid-recovery-code",r))(ft||{}),vt=(r=>(r.VerifyMFACode="verify-mfa-code",r.LostDevice="lost-device",r.Cancel="cancel-mfa-disable",r))(vt||{}),dt=(r=>(r.Harmony="HARMONY",r))(dt||{}),lt=(r=>(r.ClosedByUser="closed-by-user",r))(lt||{}),ut=(r=>(r.ClosedByUser="closed-by-user-on-received",r))(ut||{}),ht=(r=>(r.EnterNewPhoneNumber="enter-new-phone-number",r.EnterOtpCode="enter-otp-code",r.RecoveryFactorAlreadyExists="recovery-factor-already-exists",r.MalformedPhoneNumber="malformed-phone-number",r.InvalidOtpCode="invalid-otp-code",r.RecoveryFactorUpdated="recovery-factor-updated",r.RecoveryFactorDeleted="recovery-factor-deleted",r))(ht||{}),pt=(r=>(r.SendNewPhoneNumber="send-new-phone-number",r.SendOtpCode="send-otp-code",r.Cancel="cancel",r.StartEditPhoneNumber="start-edit-phone-number",r))(pt||{}),Et=(r=>(r.PhoneNumber="phone_number",r))(Et||{}),Ct=(r=>(r.SmsOtpSent="sms-otp-sent",r.LoginThrottled="login-throttled",r.InvalidSmsOtp="invalid-sms-otp",r.SmsVerified="sms-verified",r.AccountRecovered="account-recovered",r.UpdateEmailRequired="update-email-required",r))(Ct||{}),Bt=(r=>(r.Cancel="cancel",r.VerifyOtp="verify-otp-code",r.ResendSms="resend-sms-otp",r.UpdateEmail="update-email",r))(Bt||{}),At=(r=>(r.Success="nft-checkout-success",r.Failure="nft-checkout-failure",r.Initiated="nft-checkout-initiated",r.Disconnect="disconnect",r))(At||{}),_t=(r=>(r.WalletInfoFetched="Wallet/wallet-info-fetched",r))(_t||{}),Dt=(r=>(r.CloseMagicWindow="close-magic-window",r))(Dt||{}),K=(r=>(r.Cancel="cancel",r.VerifyMFACode="verify-mfa-code",r.LostDevice="lost-device",r.VerifyRecoveryCode="verify-recovery-code",r))(K||{}),G=(r=>(r.MfaSentHandle="mfa-sent-handle",r.InvalidMfaOtp="invalid-mfa-otp",r.RecoveryCodeSentHandle="recovery-code-sent-handle",r.InvalidRecoveryCode="invalid-recovery-code",r.RecoveryCodeSuccess="recovery-code-success",r))(G||{}),nr=(r=>(r.PopupUrl="popup-url",r))(nr||{}),oe=(r=>(r.PopupEvent="popup-event",r))(oe||{}),Ft=typeof window<"u"&&!!window.crypto;function gt(r){let H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";return Array.from(r).map(l=>H[l%H.length]).join("")}function te(r){if(!Ft)throw new Error("Secure random number generation is not available in this environment. PKCE requires crypto.getRandomValues.");let H=new Uint8Array(r);return window.crypto.getRandomValues(H),gt(H)}function yt(r){return r.toString(ne.enc.Base64).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function mt(){let r=te(128),H=te(128),l=yt(ne.SHA256(H));return{codeVerifier:H,codeChallenge:l,cryptoChallengeState:r}}var s0="magic_oauth_pkce_verifier",It=class extends Fe.Internal{constructor(){super();B0(this,"name","oauth2");B0(this,"config",{});B0(this,"compat",{"magic-sdk":">=2.4.6","@magic-sdk/react-native":!1,"@magic-sdk/react-native-bare":!1,"@magic-sdk/react-native-expo":!1});this.seamlessTelegramLogin()}loginWithRedirect(H){return this.utils.createPromiEvent(async(l,t)=>{let{codeVerifier:C,codeChallenge:B,cryptoChallengeState:y}=mt(),v=this.utils.createJsonRpcRequestPayload("magic_oauth_login_with_redirect_start",[{...H,apiKey:this.sdk.apiKey,platform:"web",codeChallenge:B,cryptoChallengeState:y}]),h=await this.request(v),e=h,x=h;if(x.error&&t(this.createError(x.error,x.error_description??"An error occurred.",{errorURI:x.error_uri,provider:x.provider})),e!=null&&e.pkceMetadata&&(sessionStorage.setItem(s0,JSON.stringify({codeVerifier:C,...e.pkceMetadata})),localStorage.setItem(s0,JSON.stringify({codeVerifier:C,...e.pkceMetadata}))),e==null?void 0:e.oauthAuthoriationURI){let u=e.useMagicServerCallback?new URL(e.oauthAuthoriationURI,this.sdk.endpoint).href:e.oauthAuthoriationURI;e!=null&&e.shouldReturnURI?l(u):window.location.href=u}l(null)})}getRedirectResult(H={}){let l=(H==null?void 0:H.optionalQueryString)||window.location.search,t=window.location.origin+window.location.pathname;return window.history.replaceState(null,"",t),this.getResult(H,l)}loginWithPopup(H){let{showMfaModal:l}=H,t=this.utils.createJsonRpcRequestPayload("magic_oauth_login_with_popup",[{...H,showUI:l,returnTo:window.location.href,apiKey:this.sdk.apiKey,platform:"web"}]),C=ge(async(B,y)=>{try{let v=this.request(t),h=a=>{this.createIntermediaryEvent(oe.PopupEvent,t.id)(a.data)};H.shouldReturnURI&&v&&v.on(nr.PopupUrl,a=>{window.addEventListener("message",h),C.emit(nr.PopupUrl,a)}),l||(v.on(G.MfaSentHandle,()=>{C.emit(G.MfaSentHandle)}),v.on(G.InvalidMfaOtp,()=>{C.emit(G.InvalidMfaOtp)}),v.on(G.RecoveryCodeSentHandle,()=>{C.emit(G.RecoveryCodeSentHandle)}),v.on(G.InvalidRecoveryCode,()=>{C.emit(G.InvalidRecoveryCode)}),v.on(G.RecoveryCodeSuccess,()=>{C.emit(G.RecoveryCodeSuccess)}));let e=await v;window.removeEventListener("message",h);let x=e,u=e;u.error?y(this.createError(u.error,u.error_description??"An error occurred.",{errorURI:u.error_uri,provider:u.provider})):B(x)}catch(v){y(v)}});return!l&&C&&(C.on(K.VerifyMFACode,B=>{this.createIntermediaryEvent(K.VerifyMFACode,t.id)(B)}),C.on(K.LostDevice,()=>{this.createIntermediaryEvent(K.LostDevice,t.id)()}),C.on(K.VerifyRecoveryCode,B=>{this.createIntermediaryEvent(K.VerifyRecoveryCode,t.id)(B)}),C.on(K.Cancel,()=>{this.createIntermediaryEvent(K.Cancel,t.id)()})),C}getResult(H,l){let{showMfaModal:t}=H,{hasStateMismatch:C,clientMetadata:B}=this.retrievePKCEMetadata(l),y=this.utils.createJsonRpcRequestPayload("magic_oauth_login_with_redirect_verify",[{authorizationResponseParams:l,magicApiKey:this.sdk.apiKey,platform:"web",showUI:t,...H,...B?{clientMetadata:B}:{}}]),v=this.utils.createPromiEvent(async(h,e)=>{if(!B)return e(this.createError("MISSING_PKCE_METADATA","OAuth session metadata not found — the session may have expired or storage was cleared",{}));if(C)return e(this.createError("STATE_MISMATCH","OAuth state parameter mismatch — request may have been tampered with",{}));let x=this.request(y);t||(x.on(G.MfaSentHandle,()=>{v.emit(G.MfaSentHandle)}),x.on(G.InvalidMfaOtp,()=>{v.emit(G.InvalidMfaOtp)}),x.on(G.RecoveryCodeSentHandle,()=>{v.emit(G.RecoveryCodeSentHandle)}),x.on(G.InvalidRecoveryCode,()=>{v.emit(G.InvalidRecoveryCode)}),x.on(G.RecoveryCodeSuccess,()=>{v.emit(G.RecoveryCodeSuccess)}));let u=await x,a=u,s=u;s.error&&e(this.createError(s.error,s.error_description??"An error occurred.",{errorURI:s.error_uri,provider:s.provider})),h(a)});return!t&&v&&(v.on(K.VerifyMFACode,h=>{this.createIntermediaryEvent(K.VerifyMFACode,y.id)(h)}),v.on(K.LostDevice,()=>{this.createIntermediaryEvent(K.LostDevice,y.id)()}),v.on(K.VerifyRecoveryCode,h=>{this.createIntermediaryEvent(K.VerifyRecoveryCode,y.id)(h)}),v.on(K.Cancel,()=>{this.createIntermediaryEvent(K.Cancel,y.id)()})),v}seamlessTelegramLogin(){try{if(!window.location.hash.toString().includes("#tgWebAppData"))return;let H=document.createElement("script");H.src="https://telegram.org/js/telegram-web-app.js",document.head.prepend(H),H.onload=async()=>{var l;try{let t=(l=window.Telegram)==null?void 0:l.WebApp.initData,C=this.utils.createJsonRpcRequestPayload("magic_oauth_verify_telegram_data",[{userData:t,isMiniApp:!0}]);await this.request(C)}catch(t){console.log("Error while verifying telegram data",t)}}}catch(H){console.log("Error while loading telegram-web-app script",H)}}retrievePKCEMetadata(H){let l=!1,t=sessionStorage.getItem(s0),C=localStorage.getItem(s0);sessionStorage.removeItem(s0),localStorage.removeItem(s0);let B=t?JSON.parse(t):C?JSON.parse(C):void 0;if(B){let y=new URLSearchParams(H).get("state");(!y||y!==B.state)&&(l=!0)}return{clientMetadata:B,hasStateMismatch:l}}};export{Nx as OAuthErrorCode,It as OAuthExtension,Lx as OAuthPayloadMethods};
|