@wormhole-foundation/wormhole-connect 1.0.0-beta.3-development → 1.0.0-beta.4-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ccip-YN27M9dL.js → ccip-Dn5z57Cx.js} +1 -1
- package/dist/assets/{evm-wKiUiV3-.js → evm-Ci-t-8ei.js} +4 -4
- package/dist/assets/{index-8fbGA94c.js → index-Da59NFoY.js} +1 -1
- package/dist/assets/{index-B9_Snb-C.js → index-DlyJ6Tua.js} +2 -2
- package/dist/assets/{index-BBy_QGBB.js → index-yInQCZK6.js} +1 -1
- package/dist/assets/{index.es-BY7lrdO_.js → index.es-DUffrgf3.js} +2 -2
- package/dist/main.js +115 -62
- package/dist/src/components/v2/Button.d.ts +1 -1
- package/dist/src/components/v2/Button.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +17 -3
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/hooks/useTransactionHistory.d.ts +1 -1
- package/dist/src/hooks/useTransactionHistory.d.ts.map +1 -1
- package/dist/src/hooks/useTransactionHistoryMayan.d.ts.map +1 -1
- package/dist/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
- package/dist/src/icons/TxReadyForClaim.d.ts +2 -2
- package/dist/src/icons/TxReadyForClaim.d.ts.map +1 -1
- package/dist/src/utils/inProgressTxCache.d.ts +5 -0
- package/dist/src/utils/inProgressTxCache.d.ts.map +1 -0
- package/dist/src/utils/polling.d.ts +5 -0
- package/dist/src/utils/polling.d.ts.map +1 -0
- package/dist/src/utils/sdkv2.d.ts +3 -2
- package/dist/src/utils/sdkv2.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
- package/dist/src/views/v2/Redeem/index.d.ts.map +1 -1
- package/dist/src/views/v2/TxHistory/Widget/Item.d.ts +8 -0
- package/dist/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -0
- package/dist/src/views/v2/TxHistory/Widget/index.d.ts +4 -0
- package/dist/src/views/v2/TxHistory/Widget/index.d.ts.map +1 -0
- package/dist/src/views/v2/TxHistory/index.d.ts.map +1 -1
- package/lib/{algorand-BZLSulqp.mjs → algorand-B9ai7AKk.mjs} +3 -3
- package/lib/{algorand-DIrI8hux.js → algorand-BZfir-Gt.js} +1 -1
- package/lib/{aptos-BXyptrTk.mjs → aptos-BiWZASIH.mjs} +3 -3
- package/lib/{aptos-B61S9Mku.js → aptos-CX7jOv1y.js} +1 -1
- package/lib/{aptos-poOCeL-e.js → aptos-D_w5IEUK.js} +2 -2
- package/lib/{aptos-ClFQX748.mjs → aptos-ZpPdNMHJ.mjs} +1 -1
- package/lib/{ccip-CROSeCCn.js → ccip-CLMQ2RsP.js} +1 -1
- package/lib/{ccip-BcLqF-ov.mjs → ccip-lVzudYcQ.mjs} +1 -1
- package/lib/{cosmos-D-fRtzTz.js → cosmos-6rjmrhY_.js} +1 -1
- package/lib/{cosmos-B7IowZE9.mjs → cosmos-B3YMB-qs.mjs} +6 -6
- package/lib/{cosmwasm-BU28GqyN.js → cosmwasm-DMVssDjU.js} +2 -2
- package/lib/{cosmwasm-i8-2LBd4.mjs → cosmwasm-SnVdtN68.mjs} +7 -7
- package/lib/{events-BIfEV615.mjs → events-pgsgrP1S.mjs} +1 -1
- package/lib/{events-CG085uVS.js → events-t6i_QSEn.js} +1 -1
- package/lib/{evm-BG4p6wWc.mjs → evm-Bd3DzKCY.mjs} +7 -7
- package/lib/{evm-DSo1klm4.js → evm-D7GRIPdg.js} +4 -4
- package/lib/{evm-z72BQwjo.js → evm-DFJuxSg1.js} +1 -1
- package/lib/{evm-DqVh4NBz.mjs → evm-DiQodX72.mjs} +5 -5
- package/lib/{index-BrFyHtHO.js → index-048e7Uvl.js} +1 -1
- package/lib/{index-Bn9MsO0e.mjs → index-0QJFchou.mjs} +2 -2
- package/lib/{index-DjSK9SdK.mjs → index-0YCaekiF.mjs} +2 -2
- package/lib/{index-GyFHGs5Z.js → index-2LZtNZ5P.js} +1 -1
- package/lib/{index-C1XMdJFH.js → index-B2aC_g_3.js} +1 -1
- package/lib/{index-Cf-xLfst.js → index-B5TmFc4M.js} +1 -1
- package/lib/{index-l3VuXtv4.mjs → index-B64jLBfI.mjs} +2 -2
- package/lib/{index-CkrE6mmF.js → index-BAqClXT6.js} +1 -1
- package/lib/{index--orPBbEs.mjs → index-BT7_dDgl.mjs} +3 -3
- package/lib/{index-DTj0BYI6.mjs → index-BYv5Tbwe.mjs} +1 -1
- package/lib/{index-ByG9EJHX.js → index-BZ7LatAr.js} +137 -84
- package/lib/{index-BhfoV5RZ.js → index-B_FxM4qi.js} +1 -1
- package/lib/{index-B3uNul6-.mjs → index-BcbPoWss.mjs} +3 -3
- package/lib/{index-C262JAz4.mjs → index-Bd6ExIDW.mjs} +4 -4
- package/lib/{index-C2ZrCXVv.mjs → index-BhrO8yNx.mjs} +2 -2
- package/lib/{index--kQS0wX-.js → index-BjpzXqrL.js} +1 -1
- package/lib/{index-2u6Q9y32.js → index-BkyCouQJ.js} +1 -1
- package/lib/{index-DGI2tbSC.mjs → index-C4NKqUWK.mjs} +1 -1
- package/lib/{index-3CEBQmCn.mjs → index-C9xfXphF.mjs} +2 -2
- package/lib/{index-CdnXAZl6.js → index-CE4mRmPN.js} +1 -1
- package/lib/{index-CJJaUncM.js → index-CFVJznfe.js} +1 -1
- package/lib/{index-Coqx-ZYc.js → index-C_JBf5AE.js} +1 -1
- package/lib/{index-9Ifk_2V6.js → index-CcKxlhe-.js} +1 -1
- package/lib/{index-C3Ztf7te.mjs → index-CdFX-OBR.mjs} +4 -4
- package/lib/{index-BUcxdUpo.mjs → index-CkyGUP8I.mjs} +2 -2
- package/lib/{index-eY_q88kc.js → index-Cl110Yt1.js} +1 -1
- package/lib/{index-C8UyzBg3.mjs → index-CpM8O4af.mjs} +4 -4
- package/lib/{index-CytdQ1id.js → index-CvRFH7pa.js} +1 -1
- package/lib/{index-DkmEXbbA.js → index-D4-zCm-j.js} +1 -1
- package/lib/{index-B-bMfv9J.mjs → index-DG5KwGj7.mjs} +3 -3
- package/lib/{index-Cfu2mlWW.mjs → index-DJgWkkqj.mjs} +2 -2
- package/lib/{index-xrevpHY6.js → index-DLXjX60f.js} +1 -1
- package/lib/{index-B51snNHX.mjs → index-DPq8nS1b.mjs} +1 -1
- package/lib/{index-DTtBAHqC.mjs → index-DUn9bDrk.mjs} +2 -2
- package/lib/{index-C8tIBuyM.mjs → index-DVnPDtFx.mjs} +1 -1
- package/lib/{index-DEfagu36.js → index-DWmEAYa2.js} +1 -1
- package/lib/{index-DTLOaiZ5.mjs → index-DZbeM9gY.mjs} +2 -2
- package/lib/{index-CLiemfL3.js → index-Dk2OkATw.js} +1 -1
- package/lib/{index-x3yNXPc-.js → index-DllSkb9h.js} +1 -1
- package/lib/{index-CQ_e_FtW.js → index-EPcXyhD3.js} +1 -1
- package/lib/{index-BDhzG0Bz.mjs → index-EhUlCH18.mjs} +5312 -4798
- package/lib/{index-CYfEuKEC.js → index-QqzqKjF9.js} +1 -1
- package/lib/{index-D1GFc9u_.js → index-VI9qDjx0.js} +1 -1
- package/lib/{index-C1t8_dYP.mjs → index-bpVbPzFG.mjs} +1 -1
- package/lib/{index-BM3TrHYu.mjs → index-fD6yeQDw.mjs} +7 -7
- package/lib/{index-C1fq1xT0.mjs → index-fPs98C_X.mjs} +2 -2
- package/lib/{index-Xxsx46yX.mjs → index-hiGmsL0b.mjs} +1 -1
- package/lib/{index-CGmv-GLf.js → index-mAuqp4GD.js} +1 -1
- package/lib/{index.es-zlUSra_a.mjs → index.es-B4wQLKJO.mjs} +5 -5
- package/lib/{index.es-CTYy3A6V.js → index.es-WCp4WrVw.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{libsodium-wrappers-_Sv3nUjE.js → libsodium-wrappers-BdZeVEOK.js} +1 -1
- package/lib/{libsodium-wrappers-BL6m46dv.mjs → libsodium-wrappers-DnY3rBzj.mjs} +1 -1
- package/lib/{pako.esm-CEjOh_1P.js → pako.esm-CpOVp0Fg.js} +1 -1
- package/lib/{pako.esm-Bf33_673.mjs → pako.esm-doGHPq3v.mjs} +3 -3
- package/lib/{pbkdf2-C3vdgkb4.mjs → pbkdf2-CR1mMO6P.mjs} +1 -1
- package/lib/{pbkdf2-BJ3CFykt.js → pbkdf2-DRrUaAek.js} +1 -1
- package/lib/{sei-LGYYUG8M.js → sei-BHskcl2R.js} +1 -1
- package/lib/{sei-BXWrZef6.mjs → sei-ReMraEM4.mjs} +4 -4
- package/lib/{signer-DaJj3hCp.mjs → signer-BwkEV8NR.mjs} +1 -1
- package/lib/{signer-BQ4T60Nz.js → signer-C5udfQih.js} +1 -1
- package/lib/{solana-AQlZomQ6.js → solana-BWRzXH9-.js} +1 -1
- package/lib/solana-ci1dqiv5.mjs +16 -0
- package/lib/solana-gFEm46ZS.js +1 -0
- package/lib/{solana-Cl4jwD2F.mjs → solana-kr2Et-_M.mjs} +4 -4
- package/lib/{solanaEmbed.esm-B_5axZif.js → solanaEmbed.esm-8hegnauD.js} +1 -1
- package/lib/{solanaEmbed.esm-DEMxZG02.mjs → solanaEmbed.esm-HLygiesN.mjs} +4 -4
- package/lib/src/components/v2/Button.d.ts +1 -1
- package/lib/src/components/v2/Button.d.ts.map +1 -1
- package/lib/src/config/types.d.ts +17 -3
- package/lib/src/config/types.d.ts.map +1 -1
- package/lib/src/hooks/useTransactionHistory.d.ts +1 -1
- package/lib/src/hooks/useTransactionHistory.d.ts.map +1 -1
- package/lib/src/hooks/useTransactionHistoryMayan.d.ts.map +1 -1
- package/lib/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
- package/lib/src/icons/TxReadyForClaim.d.ts +2 -2
- package/lib/src/icons/TxReadyForClaim.d.ts.map +1 -1
- package/lib/src/utils/inProgressTxCache.d.ts +5 -0
- package/lib/src/utils/inProgressTxCache.d.ts.map +1 -0
- package/lib/src/utils/polling.d.ts +5 -0
- package/lib/src/utils/polling.d.ts.map +1 -0
- package/lib/src/utils/sdkv2.d.ts +3 -2
- package/lib/src/utils/sdkv2.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
- package/lib/src/views/v2/Redeem/index.d.ts.map +1 -1
- package/lib/src/views/v2/TxHistory/Widget/Item.d.ts +8 -0
- package/lib/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -0
- package/lib/src/views/v2/TxHistory/Widget/index.d.ts +4 -0
- package/lib/src/views/v2/TxHistory/Widget/index.d.ts.map +1 -0
- package/lib/src/views/v2/TxHistory/index.d.ts.map +1 -1
- package/lib/{sui-DfdFzATl.mjs → sui-B6XCpe1d.mjs} +1 -1
- package/lib/{sui-IAt2YxVB.js → sui-BWRqoTdl.js} +2 -2
- package/lib/{sui-tX-807Bw.js → sui-BocrppL0.js} +1 -1
- package/lib/{sui-BpKCqOiX.mjs → sui-BuZPAcI0.mjs} +4 -4
- package/lib/{unsignedTransaction-BzNQ2WFS.js → unsignedTransaction-DSuqsGgb.js} +1 -1
- package/lib/{unsignedTransaction-B1rzGa0o.mjs → unsignedTransaction-oXk8lD5s.mjs} +2 -2
- package/lib/{utils-DZZcQv7V.js → utils-SML27G4C.js} +1 -1
- package/lib/{utils-Xa6ErDQY.mjs → utils-fI-uXUZk.mjs} +2 -2
- package/package.json +1 -1
- package/lib/solana-6EZacoKb.js +0 -1
- package/lib/solana-CbB3tRah.mjs +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as $, cF as J5, ds as Y5, ac as V1, dt as K4, h as X5 } from "./index-
|
|
2
|
-
import { h as e7, e as t7 } from "./evm-
|
|
1
|
+
import { Z as $, cF as J5, ds as Y5, ac as V1, dt as K4, h as X5 } from "./index-EhUlCH18.mjs";
|
|
2
|
+
import { h as e7, e as t7 } from "./evm-Bd3DzKCY.mjs";
|
|
3
3
|
import * as C3 from "react";
|
|
4
4
|
import w, { createContext as n7, useState as o3, useEffect as j0, useCallback as r7, useContext as i7 } from "react";
|
|
5
5
|
import o7 from "react-dom";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var w=(i,e,t)=>e in i?m(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var s=(i,e,t)=>w(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-
|
|
1
|
+
"use strict";var m=Object.defineProperty;var w=(i,e,t)=>e in i?m(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var s=(i,e,t)=>w(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-BZ7LatAr.js"),g=require("./aptos-D_w5IEUK.js");class d{constructor(e,t,r,o){s(this,"network");s(this,"chain");s(this,"connection");s(this,"contracts");s(this,"chainId");s(this,"coreBridge");this.network=e,this.chain=t,this.connection=r,this.contracts=o,this.chainId=c.toChainId(t);const n=o.coreBridge;if(!n)throw new Error(`CoreBridge contract Address for chain ${t} not found`);this.coreBridge=n}getGuardianSet(e){throw new Error("Method not implemented.")}getGuardianSetIndex(){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,t){const[r,o]=await g.AptosPlatform.chainFromRpc(e),n=t[o];if(n.network!==r)throw new Error(`Network mismatch: ${n.network} !== ${r}`);return new d(r,o,e,n.contracts)}async*publishMessage(e,t){throw new Error("Method not implemented.")}async*verifyMessage(e,t){throw new Error("Not implemented.")}async parseTransaction(e){return(await this.parseMessages(e)).map(r=>({chain:r.emitterChain,emitter:r.emitterAddress,sequence:r.sequence}))}async parseMessages(e){const t=await this.connection.getTransactionByHash(e);if(t.type!=="user_transaction")throw new Error(`${e} is not a user_transaction`);const o=t.events.filter(n=>n.type.endsWith("WormholeMessage"));if(!o||o.length===0)throw new Error(`WormholeMessage not found for ${e}`);return o.map(n=>{const a=n.data,h=new c.UniversalAddress(BigInt(a.sender).toString(16).padStart(64,"0"));return c.createVAA("Uint8Array",{guardianSet:0,emitterChain:this.chain,emitterAddress:h,sequence:BigInt(a.sequence),timestamp:Number(a.timestamp),consistencyLevel:a.consistency_level,nonce:Number(a.nonce),signatures:[],payload:c.hex.decode(a.payload)})})}}c.registerProtocol("Aptos","WormholeCore",d);exports.AptosWormholeCore=d;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bw as f, bx as s, by as t, bz as c, bA as d, bB as A, aX as o, bC as O, bD as b } from "./index-
|
|
1
|
+
import { bw as f, bx as s, by as t, bz as c, bA as d, bB as A, aX as o, bC as O, bD as b } from "./index-EhUlCH18.mjs";
|
|
2
2
|
class p extends Error {
|
|
3
3
|
constructor(r) {
|
|
4
4
|
super(r);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var h = Object.defineProperty;
|
|
2
2
|
var m = (i, e, t) => e in i ? h(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var o = (i, e, t) => m(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { a8 as w, c9 as g, cL as p, u, bR as l } from "./index-
|
|
5
|
-
import { A as f } from "./aptos-
|
|
4
|
+
import { a8 as w, c9 as g, cL as p, u, bR as l } from "./index-EhUlCH18.mjs";
|
|
5
|
+
import { A as f } from "./aptos-BiWZASIH.mjs";
|
|
6
6
|
class c {
|
|
7
7
|
constructor(e, t, r, s) {
|
|
8
8
|
o(this, "network");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var $ = Object.defineProperty;
|
|
2
2
|
var V = (i, e, b) => e in i ? $(i, e, { enumerable: !0, configurable: !0, writable: !0, value: b }) : i[e] = b;
|
|
3
3
|
var d = (i, e, b) => V(i, typeof e != "symbol" ? e + "" : e, b);
|
|
4
|
-
import { aj as E, E as o, c7 as x, a8 as l, c8 as z, c9 as L, a as c, p as k, ca as j, cb as Q, bM as g, cc as W, cd as T, bL as s, ce as _, bP as P, bQ as N, c6 as F, bE as q, aA as D, bR as H, _ as O } from "./index-
|
|
4
|
+
import { aj as E, E as o, c7 as x, a8 as l, c8 as z, c9 as L, a as c, p as k, ca as j, cb as Q, bM as g, cc as W, cd as T, bL as s, ce as _, bP as P, bQ as N, c6 as F, bE as q, aA as D, bR as H, _ as O } from "./index-EhUlCH18.mjs";
|
|
5
5
|
class B {
|
|
6
6
|
constructor(e, b, a, t) {
|
|
7
7
|
d(this, "network");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const Lt=require("./index-ByG9EJHX.js");var ye={},Rt={},M={},pe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function r(u,o){var s=u>>>16&65535,_=u&65535,w=o>>>16&65535,d=o&65535;return _*d+(s*d+_*w<<16>>>0)|0}t.mul=Math.imul||r;function n(u,o){return u+o|0}t.add=n;function i(u,o){return u-o|0}t.sub=i;function h(u,o){return u<<o|u>>>32-o}t.rotl=h;function f(u,o){return u<<32-o|u>>>o}t.rotr=f;function E(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}t.isInteger=Number.isInteger||E,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(u){return t.isInteger(u)&&u>=-t.MAX_SAFE_INTEGER&&u<=t.MAX_SAFE_INTEGER}})(pe);Object.defineProperty(M,"__esModule",{value:!0});var Se=pe;function Ke(t,r){return r===void 0&&(r=0),(t[r+0]<<8|t[r+1])<<16>>16}M.readInt16BE=Ke;function ze(t,r){return r===void 0&&(r=0),(t[r+0]<<8|t[r+1])>>>0}M.readUint16BE=ze;function Ye(t,r){return r===void 0&&(r=0),(t[r+1]<<8|t[r])<<16>>16}M.readInt16LE=Ye;function We(t,r){return r===void 0&&(r=0),(t[r+1]<<8|t[r])>>>0}M.readUint16LE=We;function me(t,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=t>>>8,r[n+1]=t>>>0,r}M.writeUint16BE=me;M.writeInt16BE=me;function Ce(t,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=t>>>0,r[n+1]=t>>>8,r}M.writeUint16LE=Ce;M.writeInt16LE=Ce;function Vt(t,r){return r===void 0&&(r=0),t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]}M.readInt32BE=Vt;function Xt(t,r){return r===void 0&&(r=0),(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3])>>>0}M.readUint32BE=Xt;function Jt(t,r){return r===void 0&&(r=0),t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r]}M.readInt32LE=Jt;function Zt(t,r){return r===void 0&&(r=0),(t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r])>>>0}M.readUint32LE=Zt;function xt(t,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=t>>>24,r[n+1]=t>>>16,r[n+2]=t>>>8,r[n+3]=t>>>0,r}M.writeUint32BE=xt;M.writeInt32BE=xt;function Bt(t,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=t>>>0,r[n+1]=t>>>8,r[n+2]=t>>>16,r[n+3]=t>>>24,r}M.writeUint32LE=Bt;M.writeInt32LE=Bt;function qe(t,r){r===void 0&&(r=0);var n=Vt(t,r),i=Vt(t,r+4);return n*4294967296+i-(i>>31)*4294967296}M.readInt64BE=qe;function Ge(t,r){r===void 0&&(r=0);var n=Xt(t,r),i=Xt(t,r+4);return n*4294967296+i}M.readUint64BE=Ge;function $e(t,r){r===void 0&&(r=0);var n=Jt(t,r),i=Jt(t,r+4);return i*4294967296+n-(n>>31)*4294967296}M.readInt64LE=$e;function Ve(t,r){r===void 0&&(r=0);var n=Zt(t,r),i=Zt(t,r+4);return i*4294967296+n}M.readUint64LE=Ve;function Oe(t,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),xt(t/4294967296>>>0,r,n),xt(t>>>0,r,n+4),r}M.writeUint64BE=Oe;M.writeInt64BE=Oe;function Ue(t,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Bt(t>>>0,r,n),Bt(t/4294967296>>>0,r,n+4),r}M.writeUint64LE=Ue;M.writeInt64LE=Ue;function Xe(t,r,n){if(n===void 0&&(n=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>r.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,h=1,f=t/8+n-1;f>=n;f--)i+=r[f]*h,h*=256;return i}M.readUintBE=Xe;function Je(t,r,n){if(n===void 0&&(n=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>r.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,h=1,f=n;f<n+t/8;f++)i+=r[f]*h,h*=256;return i}M.readUintLE=Je;function Ze(t,r,n,i){if(n===void 0&&(n=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Se.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var h=1,f=t/8+i-1;f>=i;f--)n[f]=r/h&255,h*=256;return n}M.writeUintBE=Ze;function Qe(t,r,n,i){if(n===void 0&&(n=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Se.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var h=1,f=i;f<i+t/8;f++)n[f]=r/h&255,h*=256;return n}M.writeUintLE=Qe;function ke(t,r){r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat32(r)}M.readFloat32BE=ke;function tr(t,r){r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat32(r,!0)}M.readFloat32LE=tr;function er(t,r){r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat64(r)}M.readFloat64BE=er;function rr(t,r){r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat64(r,!0)}M.readFloat64LE=rr;function nr(t,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat32(n,t),r}M.writeFloat32BE=nr;function ir(t,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat32(n,t,!0),r}M.writeFloat32LE=ir;function ar(t,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat64(n,t),r}M.writeFloat64BE=ar;function ur(t,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat64(n,t,!0),r}M.writeFloat64LE=ur;var Et={};Object.defineProperty(Et,"__esModule",{value:!0});function or(t){for(var r=0;r<t.length;r++)t[r]=0;return t}Et.wipe=or;Object.defineProperty(Rt,"__esModule",{value:!0});var dt=M,Qt=Et,fr=20;function hr(t,r,n){for(var i=1634760805,h=857760878,f=2036477234,E=1797285236,u=n[3]<<24|n[2]<<16|n[1]<<8|n[0],o=n[7]<<24|n[6]<<16|n[5]<<8|n[4],s=n[11]<<24|n[10]<<16|n[9]<<8|n[8],_=n[15]<<24|n[14]<<16|n[13]<<8|n[12],w=n[19]<<24|n[18]<<16|n[17]<<8|n[16],d=n[23]<<24|n[22]<<16|n[21]<<8|n[20],l=n[27]<<24|n[26]<<16|n[25]<<8|n[24],v=n[31]<<24|n[30]<<16|n[29]<<8|n[28],S=r[3]<<24|r[2]<<16|r[1]<<8|r[0],g=r[7]<<24|r[6]<<16|r[5]<<8|r[4],O=r[11]<<24|r[10]<<16|r[9]<<8|r[8],j=r[15]<<24|r[14]<<16|r[13]<<8|r[12],U=i,c=h,b=f,D=E,e=u,a=o,y=s,m=_,A=w,L=d,B=l,x=v,F=S,N=g,p=O,T=j,$=0;$<fr;$+=2)U=U+e|0,F^=U,F=F>>>16|F<<16,A=A+F|0,e^=A,e=e>>>20|e<<12,c=c+a|0,N^=c,N=N>>>16|N<<16,L=L+N|0,a^=L,a=a>>>20|a<<12,b=b+y|0,p^=b,p=p>>>16|p<<16,B=B+p|0,y^=B,y=y>>>20|y<<12,D=D+m|0,T^=D,T=T>>>16|T<<16,x=x+T|0,m^=x,m=m>>>20|m<<12,b=b+y|0,p^=b,p=p>>>24|p<<8,B=B+p|0,y^=B,y=y>>>25|y<<7,D=D+m|0,T^=D,T=T>>>24|T<<8,x=x+T|0,m^=x,m=m>>>25|m<<7,c=c+a|0,N^=c,N=N>>>24|N<<8,L=L+N|0,a^=L,a=a>>>25|a<<7,U=U+e|0,F^=U,F=F>>>24|F<<8,A=A+F|0,e^=A,e=e>>>25|e<<7,U=U+a|0,T^=U,T=T>>>16|T<<16,B=B+T|0,a^=B,a=a>>>20|a<<12,c=c+y|0,F^=c,F=F>>>16|F<<16,x=x+F|0,y^=x,y=y>>>20|y<<12,b=b+m|0,N^=b,N=N>>>16|N<<16,A=A+N|0,m^=A,m=m>>>20|m<<12,D=D+e|0,p^=D,p=p>>>16|p<<16,L=L+p|0,e^=L,e=e>>>20|e<<12,b=b+m|0,N^=b,N=N>>>24|N<<8,A=A+N|0,m^=A,m=m>>>25|m<<7,D=D+e|0,p^=D,p=p>>>24|p<<8,L=L+p|0,e^=L,e=e>>>25|e<<7,c=c+y|0,F^=c,F=F>>>24|F<<8,x=x+F|0,y^=x,y=y>>>25|y<<7,U=U+a|0,T^=U,T=T>>>24|T<<8,B=B+T|0,a^=B,a=a>>>25|a<<7;dt.writeUint32LE(U+i|0,t,0),dt.writeUint32LE(c+h|0,t,4),dt.writeUint32LE(b+f|0,t,8),dt.writeUint32LE(D+E|0,t,12),dt.writeUint32LE(e+u|0,t,16),dt.writeUint32LE(a+o|0,t,20),dt.writeUint32LE(y+s|0,t,24),dt.writeUint32LE(m+_|0,t,28),dt.writeUint32LE(A+w|0,t,32),dt.writeUint32LE(L+d|0,t,36),dt.writeUint32LE(B+l|0,t,40),dt.writeUint32LE(x+v|0,t,44),dt.writeUint32LE(F+S|0,t,48),dt.writeUint32LE(N+g|0,t,52),dt.writeUint32LE(p+O|0,t,56),dt.writeUint32LE(T+j|0,t,60)}function Ae(t,r,n,i,h){if(h===void 0&&(h=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<n.length)throw new Error("ChaCha: destination is shorter than source");var f,E;if(h===0){if(r.length!==8&&r.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");f=new Uint8Array(16),E=f.length-r.length,f.set(r,E)}else{if(r.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");f=r,E=h}for(var u=new Uint8Array(64),o=0;o<n.length;o+=64){hr(u,f,t);for(var s=o;s<o+64&&s<n.length;s++)i[s]=n[s]^u[s-o];cr(f,0,E)}return Qt.wipe(u),h===0&&Qt.wipe(f),i}Rt.streamXOR=Ae;function sr(t,r,n,i){return i===void 0&&(i=0),Qt.wipe(n),Ae(t,r,n,n,i)}Rt.stream=sr;function cr(t,r,n){for(var i=1;n--;)i=i+(t[r]&255)|0,t[r]=i&255,i>>>=8,r++;if(i>0)throw new Error("ChaCha: counter overflow")}var Te={},vt={};Object.defineProperty(vt,"__esModule",{value:!0});function lr(t,r,n){return~(t-1)&r|t-1&n}vt.select=lr;function Dr(t,r){return(t|0)-(r|0)-1>>>31&1}vt.lessOrEqual=Dr;function Fe(t,r){if(t.length!==r.length)return 0;for(var n=0,i=0;i<t.length;i++)n|=t[i]^r[i];return 1&n-1>>>8}vt.compare=Fe;function _r(t,r){return t.length===0||r.length===0?!1:Fe(t,r)!==0}vt.equal=_r;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=vt,n=Et;t.DIGEST_LENGTH=16;var i=function(){function E(u){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var o=u[0]|u[1]<<8;this._r[0]=o&8191;var s=u[2]|u[3]<<8;this._r[1]=(o>>>13|s<<3)&8191;var _=u[4]|u[5]<<8;this._r[2]=(s>>>10|_<<6)&7939;var w=u[6]|u[7]<<8;this._r[3]=(_>>>7|w<<9)&8191;var d=u[8]|u[9]<<8;this._r[4]=(w>>>4|d<<12)&255,this._r[5]=d>>>1&8190;var l=u[10]|u[11]<<8;this._r[6]=(d>>>14|l<<2)&8191;var v=u[12]|u[13]<<8;this._r[7]=(l>>>11|v<<5)&8065;var S=u[14]|u[15]<<8;this._r[8]=(v>>>8|S<<8)&8191,this._r[9]=S>>>5&127,this._pad[0]=u[16]|u[17]<<8,this._pad[1]=u[18]|u[19]<<8,this._pad[2]=u[20]|u[21]<<8,this._pad[3]=u[22]|u[23]<<8,this._pad[4]=u[24]|u[25]<<8,this._pad[5]=u[26]|u[27]<<8,this._pad[6]=u[28]|u[29]<<8,this._pad[7]=u[30]|u[31]<<8}return E.prototype._blocks=function(u,o,s){for(var _=this._fin?0:2048,w=this._h[0],d=this._h[1],l=this._h[2],v=this._h[3],S=this._h[4],g=this._h[5],O=this._h[6],j=this._h[7],U=this._h[8],c=this._h[9],b=this._r[0],D=this._r[1],e=this._r[2],a=this._r[3],y=this._r[4],m=this._r[5],A=this._r[6],L=this._r[7],B=this._r[8],x=this._r[9];s>=16;){var F=u[o+0]|u[o+1]<<8;w+=F&8191;var N=u[o+2]|u[o+3]<<8;d+=(F>>>13|N<<3)&8191;var p=u[o+4]|u[o+5]<<8;l+=(N>>>10|p<<6)&8191;var T=u[o+6]|u[o+7]<<8;v+=(p>>>7|T<<9)&8191;var $=u[o+8]|u[o+9]<<8;S+=(T>>>4|$<<12)&8191,g+=$>>>1&8191;var Z=u[o+10]|u[o+11]<<8;O+=($>>>14|Z<<2)&8191;var J=u[o+12]|u[o+13]<<8;j+=(Z>>>11|J<<5)&8191;var X=u[o+14]|u[o+15]<<8;U+=(J>>>8|X<<8)&8191,c+=X>>>5|_;var C=0,R=C;R+=w*b,R+=d*(5*x),R+=l*(5*B),R+=v*(5*L),R+=S*(5*A),C=R>>>13,R&=8191,R+=g*(5*m),R+=O*(5*y),R+=j*(5*a),R+=U*(5*e),R+=c*(5*D),C+=R>>>13,R&=8191;var P=C;P+=w*D,P+=d*b,P+=l*(5*x),P+=v*(5*B),P+=S*(5*L),C=P>>>13,P&=8191,P+=g*(5*A),P+=O*(5*m),P+=j*(5*y),P+=U*(5*a),P+=c*(5*e),C+=P>>>13,P&=8191;var I=C;I+=w*e,I+=d*D,I+=l*b,I+=v*(5*x),I+=S*(5*B),C=I>>>13,I&=8191,I+=g*(5*L),I+=O*(5*A),I+=j*(5*m),I+=U*(5*y),I+=c*(5*a),C+=I>>>13,I&=8191;var H=C;H+=w*a,H+=d*e,H+=l*D,H+=v*b,H+=S*(5*x),C=H>>>13,H&=8191,H+=g*(5*B),H+=O*(5*L),H+=j*(5*A),H+=U*(5*m),H+=c*(5*y),C+=H>>>13,H&=8191;var K=C;K+=w*y,K+=d*a,K+=l*e,K+=v*D,K+=S*b,C=K>>>13,K&=8191,K+=g*(5*x),K+=O*(5*B),K+=j*(5*L),K+=U*(5*A),K+=c*(5*m),C+=K>>>13,K&=8191;var z=C;z+=w*m,z+=d*y,z+=l*a,z+=v*e,z+=S*D,C=z>>>13,z&=8191,z+=g*b,z+=O*(5*x),z+=j*(5*B),z+=U*(5*L),z+=c*(5*A),C+=z>>>13,z&=8191;var Y=C;Y+=w*A,Y+=d*m,Y+=l*y,Y+=v*a,Y+=S*e,C=Y>>>13,Y&=8191,Y+=g*D,Y+=O*b,Y+=j*(5*x),Y+=U*(5*B),Y+=c*(5*L),C+=Y>>>13,Y&=8191;var W=C;W+=w*L,W+=d*A,W+=l*m,W+=v*y,W+=S*a,C=W>>>13,W&=8191,W+=g*e,W+=O*D,W+=j*b,W+=U*(5*x),W+=c*(5*B),C+=W>>>13,W&=8191;var G=C;G+=w*B,G+=d*L,G+=l*A,G+=v*m,G+=S*y,C=G>>>13,G&=8191,G+=g*a,G+=O*e,G+=j*D,G+=U*b,G+=c*(5*x),C+=G>>>13,G&=8191;var V=C;V+=w*x,V+=d*B,V+=l*L,V+=v*A,V+=S*m,C=V>>>13,V&=8191,V+=g*y,V+=O*a,V+=j*e,V+=U*D,V+=c*b,C+=V>>>13,V&=8191,C=(C<<2)+C|0,C=C+R|0,R=C&8191,C=C>>>13,P+=C,w=R,d=P,l=I,v=H,S=K,g=z,O=Y,j=W,U=G,c=V,o+=16,s-=16}this._h[0]=w,this._h[1]=d,this._h[2]=l,this._h[3]=v,this._h[4]=S,this._h[5]=g,this._h[6]=O,this._h[7]=j,this._h[8]=U,this._h[9]=c},E.prototype.finish=function(u,o){o===void 0&&(o=0);var s=new Uint16Array(10),_,w,d,l;if(this._leftover){for(l=this._leftover,this._buffer[l++]=1;l<16;l++)this._buffer[l]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(_=this._h[1]>>>13,this._h[1]&=8191,l=2;l<10;l++)this._h[l]+=_,_=this._h[l]>>>13,this._h[l]&=8191;for(this._h[0]+=_*5,_=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=_,_=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=_,s[0]=this._h[0]+5,_=s[0]>>>13,s[0]&=8191,l=1;l<10;l++)s[l]=this._h[l]+_,_=s[l]>>>13,s[l]&=8191;for(s[9]-=8192,w=(_^1)-1,l=0;l<10;l++)s[l]&=w;for(w=~w,l=0;l<10;l++)this._h[l]=this._h[l]&w|s[l];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,d=this._h[0]+this._pad[0],this._h[0]=d&65535,l=1;l<8;l++)d=(this._h[l]+this._pad[l]|0)+(d>>>16)|0,this._h[l]=d&65535;return u[o+0]=this._h[0]>>>0,u[o+1]=this._h[0]>>>8,u[o+2]=this._h[1]>>>0,u[o+3]=this._h[1]>>>8,u[o+4]=this._h[2]>>>0,u[o+5]=this._h[2]>>>8,u[o+6]=this._h[3]>>>0,u[o+7]=this._h[3]>>>8,u[o+8]=this._h[4]>>>0,u[o+9]=this._h[4]>>>8,u[o+10]=this._h[5]>>>0,u[o+11]=this._h[5]>>>8,u[o+12]=this._h[6]>>>0,u[o+13]=this._h[6]>>>8,u[o+14]=this._h[7]>>>0,u[o+15]=this._h[7]>>>8,this._finished=!0,this},E.prototype.update=function(u){var o=0,s=u.length,_;if(this._leftover){_=16-this._leftover,_>s&&(_=s);for(var w=0;w<_;w++)this._buffer[this._leftover+w]=u[o+w];if(s-=_,o+=_,this._leftover+=_,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(s>=16&&(_=s-s%16,this._blocks(u,o,_),o+=_,s-=_),s){for(var w=0;w<s;w++)this._buffer[this._leftover+w]=u[o+w];this._leftover+=s}return this},E.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var u=new Uint8Array(16);return this.finish(u),u},E.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},E}();t.Poly1305=i;function h(E,u){var o=new i(E);o.update(u);var s=o.digest();return o.clean(),s}t.oneTimeAuth=h;function f(E,u){return E.length!==t.DIGEST_LENGTH||u.length!==t.DIGEST_LENGTH?!1:r.equal(E,u)}t.equal=f})(Te);(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=Rt,n=Te,i=Et,h=M,f=vt;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var E=new Uint8Array(16),u=function(){function o(s){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,s.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(s)}return o.prototype.seal=function(s,_,w,d){if(s.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var l=new Uint8Array(16);l.set(s,l.length-s.length);var v=new Uint8Array(32);r.stream(this._key,l,v,4);var S=_.length+this.tagLength,g;if(d){if(d.length!==S)throw new Error("ChaCha20Poly1305: incorrect destination length");g=d}else g=new Uint8Array(S);return r.streamXOR(this._key,l,_,g,4),this._authenticate(g.subarray(g.length-this.tagLength,g.length),v,g.subarray(0,g.length-this.tagLength),w),i.wipe(l),g},o.prototype.open=function(s,_,w,d){if(s.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(_.length<this.tagLength)return null;var l=new Uint8Array(16);l.set(s,l.length-s.length);var v=new Uint8Array(32);r.stream(this._key,l,v,4);var S=new Uint8Array(this.tagLength);if(this._authenticate(S,v,_.subarray(0,_.length-this.tagLength),w),!f.equal(S,_.subarray(_.length-this.tagLength,_.length)))return null;var g=_.length-this.tagLength,O;if(d){if(d.length!==g)throw new Error("ChaCha20Poly1305: incorrect destination length");O=d}else O=new Uint8Array(g);return r.streamXOR(this._key,l,_.subarray(0,_.length-this.tagLength),O,4),i.wipe(l),O},o.prototype.clean=function(){return i.wipe(this._key),this},o.prototype._authenticate=function(s,_,w,d){var l=new n.Poly1305(_);d&&(l.update(d),d.length%16>0&&l.update(E.subarray(d.length%16))),l.update(w),w.length%16>0&&l.update(E.subarray(w.length%16));var v=new Uint8Array(8);d&&h.writeUint64LE(d.length,v),l.update(v),h.writeUint64LE(w.length,v),l.update(v);for(var S=l.digest(),g=0;g<S.length;g++)s[g]=S[g];l.clean(),i.wipe(S),i.wipe(v)},o}();t.ChaCha20Poly1305=u})(ye);var Ne={},Ft={},ne={};Object.defineProperty(ne,"__esModule",{value:!0});function dr(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}ne.isSerializableHash=dr;Object.defineProperty(Ft,"__esModule",{value:!0});var bt=ne,Er=vt,br=Et,Me=function(){function t(r,n){this._finished=!1,this._inner=new r,this._outer=new r,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);n.length>this.blockSize?this._inner.update(n).finish(i).clean():i.set(n);for(var h=0;h<i.length;h++)i[h]^=54;this._inner.update(i);for(var h=0;h<i.length;h++)i[h]^=106;this._outer.update(i),bt.isSerializableHash(this._inner)&&bt.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),br.wipe(i)}return t.prototype.reset=function(){if(!bt.isSerializableHash(this._inner)||!bt.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){bt.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),bt.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(r){return this._inner.update(r),this},t.prototype.finish=function(r){return this._finished?(this._outer.finish(r),this):(this._inner.finish(r),this._outer.update(r.subarray(0,this.digestLength)).finish(r),this._finished=!0,this)},t.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},t.prototype.saveState=function(){if(!bt.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(r){if(!bt.isSerializableHash(this._inner)||!bt.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(r),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(r){if(!bt.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(r)},t}();Ft.HMAC=Me;function vr(t,r,n){var i=new Me(t,r);i.update(n);var h=i.digest();return i.clean(),h}Ft.hmac=vr;Ft.equal=Er.equal;Object.defineProperty(Ne,"__esModule",{value:!0});var ue=Ft,oe=Et,wr=function(){function t(r,n,i,h){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=r,this._info=h;var f=ue.hmac(this._hash,i,n);this._hmac=new ue.HMAC(r,f),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var r=this._counter[0];if(r===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),r>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(r){for(var n=new Uint8Array(r),i=0;i<n.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),n[i]=this._buffer[this._bufpos++];return n},t.prototype.clean=function(){this._hmac.clean(),oe.wipe(this._buffer),oe.wipe(this._counter),this._bufpos=0},t}(),gr=Ne.HKDF=wr,jt={},Pt={},It={};Object.defineProperty(It,"__esModule",{value:!0});It.BrowserRandomSource=void 0;const fe=65536;class yr{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const r=typeof self<"u"?self.crypto||self.msCrypto:null;r&&r.getRandomValues!==void 0&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const n=new Uint8Array(r);for(let i=0;i<n.length;i+=fe)this._crypto.getRandomValues(n.subarray(i,i+Math.min(n.length-i,fe)));return n}}It.BrowserRandomSource=yr;var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.NodeRandomSource=void 0;const pr=Et;class Sr{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Lt.commonjsRequire<"u"){const r=Lt.requireCryptoBrowserify();r&&r.randomBytes&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let n=this._crypto.randomBytes(r);if(n.length!==r)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(r);for(let h=0;h<i.length;h++)i[h]=n[h];return(0,pr.wipe)(n),i}}Ht.NodeRandomSource=Sr;Object.defineProperty(Pt,"__esModule",{value:!0});Pt.SystemRandomSource=void 0;const mr=It,Cr=Ht;class Or{constructor(){if(this.isAvailable=!1,this.name="",this._source=new mr.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Cr.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(r){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(r)}}Pt.SystemRandomSource=Or;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const r=Pt,n=M,i=Et;t.defaultRandomSource=new r.SystemRandomSource;function h(s,_=t.defaultRandomSource){return _.randomBytes(s)}t.randomBytes=h;function f(s=t.defaultRandomSource){const _=h(4,s),w=(0,n.readUint32LE)(_);return(0,i.wipe)(_),w}t.randomUint32=f;const E="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(s,_=E,w=t.defaultRandomSource){if(_.length<2)throw new Error("randomString charset is too short");if(_.length>256)throw new Error("randomString charset is too long");let d="";const l=_.length,v=256-256%l;for(;s>0;){const S=h(Math.ceil(s*256/v),w);for(let g=0;g<S.length&&s>0;g++){const O=S[g];O<v&&(d+=_.charAt(O%l),s--)}(0,i.wipe)(S)}return d}t.randomString=u;function o(s,_=E,w=t.defaultRandomSource){const d=Math.ceil(s/(Math.log(_.length)/Math.LN2));return u(d,_,w)}t.randomStringForEntropy=o})(jt);const Ur=Lt.getDefaultExportFromCjs(jt);var Le={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=M,n=Et;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var i=function(){function u(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},u.prototype.update=function(o,s){if(s===void 0&&(s=o.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var _=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&s>0;)this._buffer[this._bufferLength++]=o[_++],s--;this._bufferLength===this.blockSize&&(f(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(_=f(this._temp,this._state,o,_,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=o[_++],s--;return this},u.prototype.finish=function(o){if(!this._finished){var s=this._bytesHashed,_=this._bufferLength,w=s/536870912|0,d=s<<3,l=s%64<56?64:128;this._buffer[_]=128;for(var v=_+1;v<l-8;v++)this._buffer[v]=0;r.writeUint32BE(w,this._buffer,l-8),r.writeUint32BE(d,this._buffer,l-4),f(this._temp,this._state,this._buffer,0,l),this._finished=!0}for(var v=0;v<this.digestLength/4;v++)r.writeUint32BE(this._state[v],o,v*4);return this},u.prototype.digest=function(){var o=new Uint8Array(this.digestLength);return this.finish(o),o},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(o){return this._state.set(o.state),this._bufferLength=o.bufferLength,o.buffer&&this._buffer.set(o.buffer),this._bytesHashed=o.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(o){n.wipe(o.state),o.buffer&&n.wipe(o.buffer),o.bufferLength=0,o.bytesHashed=0},u}();t.SHA256=i;var h=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function f(u,o,s,_,w){for(;w>=64;){for(var d=o[0],l=o[1],v=o[2],S=o[3],g=o[4],O=o[5],j=o[6],U=o[7],c=0;c<16;c++){var b=_+c*4;u[c]=r.readUint32BE(s,b)}for(var c=16;c<64;c++){var D=u[c-2],e=(D>>>17|D<<15)^(D>>>19|D<<13)^D>>>10;D=u[c-15];var a=(D>>>7|D<<25)^(D>>>18|D<<14)^D>>>3;u[c]=(e+u[c-7]|0)+(a+u[c-16]|0)}for(var c=0;c<64;c++){var e=(((g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&O^~g&j)|0)+(U+(h[c]+u[c]|0)|0)|0,a=((d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10))+(d&l^d&v^l&v)|0;U=j,j=O,O=g,g=S+e|0,S=v,v=l,l=d,d=e+a|0}o[0]+=d,o[1]+=l,o[2]+=v,o[3]+=S,o[4]+=g,o[5]+=O,o[6]+=j,o[7]+=U,_+=64,w-=64}return _}function E(u){var o=new i;o.update(u);var s=o.digest();return o.clean(),s}t.hash=E})(Le);var xe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const r=jt,n=Et;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function i(c){const b=new Float64Array(16);if(c)for(let D=0;D<c.length;D++)b[D]=c[D];return b}const h=new Uint8Array(32);h[0]=9;const f=i([56129,1]);function E(c){let b=1;for(let D=0;D<16;D++){let e=c[D]+b+65535;b=Math.floor(e/65536),c[D]=e-b*65536}c[0]+=b-1+37*(b-1)}function u(c,b,D){const e=~(D-1);for(let a=0;a<16;a++){const y=e&(c[a]^b[a]);c[a]^=y,b[a]^=y}}function o(c,b){const D=i(),e=i();for(let a=0;a<16;a++)e[a]=b[a];E(e),E(e),E(e);for(let a=0;a<2;a++){D[0]=e[0]-65517;for(let m=1;m<15;m++)D[m]=e[m]-65535-(D[m-1]>>16&1),D[m-1]&=65535;D[15]=e[15]-32767-(D[14]>>16&1);const y=D[15]>>16&1;D[14]&=65535,u(e,D,1-y)}for(let a=0;a<16;a++)c[2*a]=e[a]&255,c[2*a+1]=e[a]>>8}function s(c,b){for(let D=0;D<16;D++)c[D]=b[2*D]+(b[2*D+1]<<8);c[15]&=32767}function _(c,b,D){for(let e=0;e<16;e++)c[e]=b[e]+D[e]}function w(c,b,D){for(let e=0;e<16;e++)c[e]=b[e]-D[e]}function d(c,b,D){let e,a,y=0,m=0,A=0,L=0,B=0,x=0,F=0,N=0,p=0,T=0,$=0,Z=0,J=0,X=0,C=0,R=0,P=0,I=0,H=0,K=0,z=0,Y=0,W=0,G=0,V=0,wt=0,St=0,Ot=0,Mt=0,Yt=0,ae=0,k=D[0],tt=D[1],et=D[2],rt=D[3],nt=D[4],it=D[5],at=D[6],ut=D[7],ot=D[8],ft=D[9],ht=D[10],st=D[11],ct=D[12],lt=D[13],Dt=D[14],_t=D[15];e=b[0],y+=e*k,m+=e*tt,A+=e*et,L+=e*rt,B+=e*nt,x+=e*it,F+=e*at,N+=e*ut,p+=e*ot,T+=e*ft,$+=e*ht,Z+=e*st,J+=e*ct,X+=e*lt,C+=e*Dt,R+=e*_t,e=b[1],m+=e*k,A+=e*tt,L+=e*et,B+=e*rt,x+=e*nt,F+=e*it,N+=e*at,p+=e*ut,T+=e*ot,$+=e*ft,Z+=e*ht,J+=e*st,X+=e*ct,C+=e*lt,R+=e*Dt,P+=e*_t,e=b[2],A+=e*k,L+=e*tt,B+=e*et,x+=e*rt,F+=e*nt,N+=e*it,p+=e*at,T+=e*ut,$+=e*ot,Z+=e*ft,J+=e*ht,X+=e*st,C+=e*ct,R+=e*lt,P+=e*Dt,I+=e*_t,e=b[3],L+=e*k,B+=e*tt,x+=e*et,F+=e*rt,N+=e*nt,p+=e*it,T+=e*at,$+=e*ut,Z+=e*ot,J+=e*ft,X+=e*ht,C+=e*st,R+=e*ct,P+=e*lt,I+=e*Dt,H+=e*_t,e=b[4],B+=e*k,x+=e*tt,F+=e*et,N+=e*rt,p+=e*nt,T+=e*it,$+=e*at,Z+=e*ut,J+=e*ot,X+=e*ft,C+=e*ht,R+=e*st,P+=e*ct,I+=e*lt,H+=e*Dt,K+=e*_t,e=b[5],x+=e*k,F+=e*tt,N+=e*et,p+=e*rt,T+=e*nt,$+=e*it,Z+=e*at,J+=e*ut,X+=e*ot,C+=e*ft,R+=e*ht,P+=e*st,I+=e*ct,H+=e*lt,K+=e*Dt,z+=e*_t,e=b[6],F+=e*k,N+=e*tt,p+=e*et,T+=e*rt,$+=e*nt,Z+=e*it,J+=e*at,X+=e*ut,C+=e*ot,R+=e*ft,P+=e*ht,I+=e*st,H+=e*ct,K+=e*lt,z+=e*Dt,Y+=e*_t,e=b[7],N+=e*k,p+=e*tt,T+=e*et,$+=e*rt,Z+=e*nt,J+=e*it,X+=e*at,C+=e*ut,R+=e*ot,P+=e*ft,I+=e*ht,H+=e*st,K+=e*ct,z+=e*lt,Y+=e*Dt,W+=e*_t,e=b[8],p+=e*k,T+=e*tt,$+=e*et,Z+=e*rt,J+=e*nt,X+=e*it,C+=e*at,R+=e*ut,P+=e*ot,I+=e*ft,H+=e*ht,K+=e*st,z+=e*ct,Y+=e*lt,W+=e*Dt,G+=e*_t,e=b[9],T+=e*k,$+=e*tt,Z+=e*et,J+=e*rt,X+=e*nt,C+=e*it,R+=e*at,P+=e*ut,I+=e*ot,H+=e*ft,K+=e*ht,z+=e*st,Y+=e*ct,W+=e*lt,G+=e*Dt,V+=e*_t,e=b[10],$+=e*k,Z+=e*tt,J+=e*et,X+=e*rt,C+=e*nt,R+=e*it,P+=e*at,I+=e*ut,H+=e*ot,K+=e*ft,z+=e*ht,Y+=e*st,W+=e*ct,G+=e*lt,V+=e*Dt,wt+=e*_t,e=b[11],Z+=e*k,J+=e*tt,X+=e*et,C+=e*rt,R+=e*nt,P+=e*it,I+=e*at,H+=e*ut,K+=e*ot,z+=e*ft,Y+=e*ht,W+=e*st,G+=e*ct,V+=e*lt,wt+=e*Dt,St+=e*_t,e=b[12],J+=e*k,X+=e*tt,C+=e*et,R+=e*rt,P+=e*nt,I+=e*it,H+=e*at,K+=e*ut,z+=e*ot,Y+=e*ft,W+=e*ht,G+=e*st,V+=e*ct,wt+=e*lt,St+=e*Dt,Ot+=e*_t,e=b[13],X+=e*k,C+=e*tt,R+=e*et,P+=e*rt,I+=e*nt,H+=e*it,K+=e*at,z+=e*ut,Y+=e*ot,W+=e*ft,G+=e*ht,V+=e*st,wt+=e*ct,St+=e*lt,Ot+=e*Dt,Mt+=e*_t,e=b[14],C+=e*k,R+=e*tt,P+=e*et,I+=e*rt,H+=e*nt,K+=e*it,z+=e*at,Y+=e*ut,W+=e*ot,G+=e*ft,V+=e*ht,wt+=e*st,St+=e*ct,Ot+=e*lt,Mt+=e*Dt,Yt+=e*_t,e=b[15],R+=e*k,P+=e*tt,I+=e*et,H+=e*rt,K+=e*nt,z+=e*it,Y+=e*at,W+=e*ut,G+=e*ot,V+=e*ft,wt+=e*ht,St+=e*st,Ot+=e*ct,Mt+=e*lt,Yt+=e*Dt,ae+=e*_t,y+=38*P,m+=38*I,A+=38*H,L+=38*K,B+=38*z,x+=38*Y,F+=38*W,N+=38*G,p+=38*V,T+=38*wt,$+=38*St,Z+=38*Ot,J+=38*Mt,X+=38*Yt,C+=38*ae,a=1,e=y+a+65535,a=Math.floor(e/65536),y=e-a*65536,e=m+a+65535,a=Math.floor(e/65536),m=e-a*65536,e=A+a+65535,a=Math.floor(e/65536),A=e-a*65536,e=L+a+65535,a=Math.floor(e/65536),L=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=x+a+65535,a=Math.floor(e/65536),x=e-a*65536,e=F+a+65535,a=Math.floor(e/65536),F=e-a*65536,e=N+a+65535,a=Math.floor(e/65536),N=e-a*65536,e=p+a+65535,a=Math.floor(e/65536),p=e-a*65536,e=T+a+65535,a=Math.floor(e/65536),T=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=e-a*65536,e=Z+a+65535,a=Math.floor(e/65536),Z=e-a*65536,e=J+a+65535,a=Math.floor(e/65536),J=e-a*65536,e=X+a+65535,a=Math.floor(e/65536),X=e-a*65536,e=C+a+65535,a=Math.floor(e/65536),C=e-a*65536,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,y+=a-1+37*(a-1),a=1,e=y+a+65535,a=Math.floor(e/65536),y=e-a*65536,e=m+a+65535,a=Math.floor(e/65536),m=e-a*65536,e=A+a+65535,a=Math.floor(e/65536),A=e-a*65536,e=L+a+65535,a=Math.floor(e/65536),L=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=x+a+65535,a=Math.floor(e/65536),x=e-a*65536,e=F+a+65535,a=Math.floor(e/65536),F=e-a*65536,e=N+a+65535,a=Math.floor(e/65536),N=e-a*65536,e=p+a+65535,a=Math.floor(e/65536),p=e-a*65536,e=T+a+65535,a=Math.floor(e/65536),T=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=e-a*65536,e=Z+a+65535,a=Math.floor(e/65536),Z=e-a*65536,e=J+a+65535,a=Math.floor(e/65536),J=e-a*65536,e=X+a+65535,a=Math.floor(e/65536),X=e-a*65536,e=C+a+65535,a=Math.floor(e/65536),C=e-a*65536,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,y+=a-1+37*(a-1),c[0]=y,c[1]=m,c[2]=A,c[3]=L,c[4]=B,c[5]=x,c[6]=F,c[7]=N,c[8]=p,c[9]=T,c[10]=$,c[11]=Z,c[12]=J,c[13]=X,c[14]=C,c[15]=R}function l(c,b){d(c,b,b)}function v(c,b){const D=i();for(let e=0;e<16;e++)D[e]=b[e];for(let e=253;e>=0;e--)l(D,D),e!==2&&e!==4&&d(D,D,b);for(let e=0;e<16;e++)c[e]=D[e]}function S(c,b){const D=new Uint8Array(32),e=new Float64Array(80),a=i(),y=i(),m=i(),A=i(),L=i(),B=i();for(let p=0;p<31;p++)D[p]=c[p];D[31]=c[31]&127|64,D[0]&=248,s(e,b);for(let p=0;p<16;p++)y[p]=e[p];a[0]=A[0]=1;for(let p=254;p>=0;--p){const T=D[p>>>3]>>>(p&7)&1;u(a,y,T),u(m,A,T),_(L,a,m),w(a,a,m),_(m,y,A),w(y,y,A),l(A,L),l(B,a),d(a,m,a),d(m,y,L),_(L,a,m),w(a,a,m),l(y,a),w(m,A,B),d(a,m,f),_(a,a,A),d(m,m,a),d(a,A,B),d(A,y,e),l(y,L),u(a,y,T),u(m,A,T)}for(let p=0;p<16;p++)e[p+16]=a[p],e[p+32]=m[p],e[p+48]=y[p],e[p+64]=A[p];const x=e.subarray(32),F=e.subarray(16);v(x,x),d(F,F,x);const N=new Uint8Array(32);return o(N,F),N}t.scalarMult=S;function g(c){return S(c,h)}t.scalarMultBase=g;function O(c){if(c.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const b=new Uint8Array(c);return{publicKey:g(b),secretKey:b}}t.generateKeyPairFromSeed=O;function j(c){const b=(0,r.randomBytes)(32,c),D=O(b);return(0,n.wipe)(b),D}t.generateKeyPair=j;function U(c,b,D=!1){if(c.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(b.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const e=S(c,b);if(D){let a=0;for(let y=0;y<e.length;y++)a|=e[y];if(a===0)throw new Error("X25519: invalid shared key")}return e}t.sharedKey=U})(xe);function Ar(t,r){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),i=0;i<n.length;i++)n[i]=255;for(var h=0;h<t.length;h++){var f=t.charAt(h),E=f.charCodeAt(0);if(n[E]!==255)throw new TypeError(f+" is ambiguous");n[E]=h}var u=t.length,o=t.charAt(0),s=Math.log(u)/Math.log(256),_=Math.log(256)/Math.log(u);function w(v){if(v instanceof Uint8Array||(ArrayBuffer.isView(v)?v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength):Array.isArray(v)&&(v=Uint8Array.from(v))),!(v instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(v.length===0)return"";for(var S=0,g=0,O=0,j=v.length;O!==j&&v[O]===0;)O++,S++;for(var U=(j-O)*_+1>>>0,c=new Uint8Array(U);O!==j;){for(var b=v[O],D=0,e=U-1;(b!==0||D<g)&&e!==-1;e--,D++)b+=256*c[e]>>>0,c[e]=b%u>>>0,b=b/u>>>0;if(b!==0)throw new Error("Non-zero carry");g=D,O++}for(var a=U-g;a!==U&&c[a]===0;)a++;for(var y=o.repeat(S);a<U;++a)y+=t.charAt(c[a]);return y}function d(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return new Uint8Array;var S=0;if(v[S]!==" "){for(var g=0,O=0;v[S]===o;)g++,S++;for(var j=(v.length-S)*s+1>>>0,U=new Uint8Array(j);v[S];){var c=n[v.charCodeAt(S)];if(c===255)return;for(var b=0,D=j-1;(c!==0||b<O)&&D!==-1;D--,b++)c+=u*U[D]>>>0,U[D]=c%256>>>0,c=c/256>>>0;if(c!==0)throw new Error("Non-zero carry");O=b,S++}if(v[S]!==" "){for(var e=j-O;e!==j&&U[e]===0;)e++;for(var a=new Uint8Array(g+(j-e)),y=g;e!==j;)a[y++]=U[e++];return a}}}function l(v){var S=d(v);if(S)return S;throw new Error(`Non-${r} character`)}return{encode:w,decodeUnsafe:d,decode:l}}var Tr=Ar,Fr=Tr;const Nr=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Mr=t=>new TextEncoder().encode(t),Lr=t=>new TextDecoder().decode(t);class xr{constructor(r,n,i){this.name=r,this.prefix=n,this.baseEncode=i}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Br{constructor(r,n,i){if(this.name=r,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=i}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return Be(this,r)}}class Rr{constructor(r){this.decoders=r}or(r){return Be(this,r)}decode(r){const n=r[0],i=this.decoders[n];if(i)return i.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Be=(t,r)=>new Rr({...t.decoders||{[t.prefix]:t},...r.decoders||{[r.prefix]:r}});class jr{constructor(r,n,i,h){this.name=r,this.prefix=n,this.baseEncode=i,this.baseDecode=h,this.encoder=new xr(r,n,i),this.decoder=new Br(r,n,h)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const Kt=({name:t,prefix:r,encode:n,decode:i})=>new jr(t,r,n,i),Nt=({prefix:t,name:r,alphabet:n})=>{const{encode:i,decode:h}=Fr(n,r);return Kt({prefix:t,name:r,encode:i,decode:f=>Nr(h(f))})},Pr=(t,r,n,i)=>{const h={};for(let _=0;_<r.length;++_)h[r[_]]=_;let f=t.length;for(;t[f-1]==="=";)--f;const E=new Uint8Array(f*n/8|0);let u=0,o=0,s=0;for(let _=0;_<f;++_){const w=h[t[_]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);o=o<<n|w,u+=n,u>=8&&(u-=8,E[s++]=255&o>>u)}if(u>=n||255&o<<8-u)throw new SyntaxError("Unexpected end of data");return E},Ir=(t,r,n)=>{const i=r[r.length-1]==="=",h=(1<<n)-1;let f="",E=0,u=0;for(let o=0;o<t.length;++o)for(u=u<<8|t[o],E+=8;E>n;)E-=n,f+=r[h&u>>E];if(E&&(f+=r[h&u<<n-E]),i)for(;f.length*n&7;)f+="=";return f},Q=({name:t,prefix:r,bitsPerChar:n,alphabet:i})=>Kt({prefix:r,name:t,encode(h){return Ir(h,i,n)},decode(h){return Pr(h,i,n,t)}}),Hr=Kt({prefix:"\0",name:"identity",encode:t=>Lr(t),decode:t=>Mr(t)}),Kr=Object.freeze(Object.defineProperty({__proto__:null,identity:Hr},Symbol.toStringTag,{value:"Module"})),zr=Q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Yr=Object.freeze(Object.defineProperty({__proto__:null,base2:zr},Symbol.toStringTag,{value:"Module"})),Wr=Q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),qr=Object.freeze(Object.defineProperty({__proto__:null,base8:Wr},Symbol.toStringTag,{value:"Module"})),Gr=Nt({prefix:"9",name:"base10",alphabet:"0123456789"}),$r=Object.freeze(Object.defineProperty({__proto__:null,base10:Gr},Symbol.toStringTag,{value:"Module"})),Vr=Q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Xr=Q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Jr=Object.freeze(Object.defineProperty({__proto__:null,base16:Vr,base16upper:Xr},Symbol.toStringTag,{value:"Module"})),Zr=Q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Qr=Q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),kr=Q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),tn=Q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),en=Q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rn=Q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nn=Q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),an=Q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),un=Q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),on=Object.freeze(Object.defineProperty({__proto__:null,base32:Zr,base32hex:en,base32hexpad:nn,base32hexpadupper:an,base32hexupper:rn,base32pad:kr,base32padupper:tn,base32upper:Qr,base32z:un},Symbol.toStringTag,{value:"Module"})),fn=Nt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hn=Nt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),sn=Object.freeze(Object.defineProperty({__proto__:null,base36:fn,base36upper:hn},Symbol.toStringTag,{value:"Module"})),cn=Nt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ln=Nt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Dn=Object.freeze(Object.defineProperty({__proto__:null,base58btc:cn,base58flickr:ln},Symbol.toStringTag,{value:"Module"})),_n=Q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dn=Q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),En=Q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),bn=Q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),vn=Object.freeze(Object.defineProperty({__proto__:null,base64:_n,base64pad:dn,base64url:En,base64urlpad:bn},Symbol.toStringTag,{value:"Module"})),Re=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),wn=Re.reduce((t,r,n)=>(t[n]=r,t),[]),gn=Re.reduce((t,r,n)=>(t[r.codePointAt(0)]=n,t),[]);function yn(t){return t.reduce((r,n)=>(r+=wn[n],r),"")}function pn(t){const r=[];for(const n of t){const i=gn[n.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${n}`);r.push(i)}return new Uint8Array(r)}const Sn=Kt({prefix:"🚀",name:"base256emoji",encode:yn,decode:pn}),mn=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:Sn},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var je={};/*! *****************************************************************************
|
|
1
|
+
"use strict";const Lt=require("./index-BZ7LatAr.js");var ye={},Rt={},M={},pe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function r(u,o){var s=u>>>16&65535,_=u&65535,w=o>>>16&65535,d=o&65535;return _*d+(s*d+_*w<<16>>>0)|0}t.mul=Math.imul||r;function n(u,o){return u+o|0}t.add=n;function i(u,o){return u-o|0}t.sub=i;function h(u,o){return u<<o|u>>>32-o}t.rotl=h;function f(u,o){return u<<32-o|u>>>o}t.rotr=f;function E(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}t.isInteger=Number.isInteger||E,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(u){return t.isInteger(u)&&u>=-t.MAX_SAFE_INTEGER&&u<=t.MAX_SAFE_INTEGER}})(pe);Object.defineProperty(M,"__esModule",{value:!0});var Se=pe;function Ke(t,r){return r===void 0&&(r=0),(t[r+0]<<8|t[r+1])<<16>>16}M.readInt16BE=Ke;function ze(t,r){return r===void 0&&(r=0),(t[r+0]<<8|t[r+1])>>>0}M.readUint16BE=ze;function Ye(t,r){return r===void 0&&(r=0),(t[r+1]<<8|t[r])<<16>>16}M.readInt16LE=Ye;function We(t,r){return r===void 0&&(r=0),(t[r+1]<<8|t[r])>>>0}M.readUint16LE=We;function me(t,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=t>>>8,r[n+1]=t>>>0,r}M.writeUint16BE=me;M.writeInt16BE=me;function Ce(t,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=t>>>0,r[n+1]=t>>>8,r}M.writeUint16LE=Ce;M.writeInt16LE=Ce;function Vt(t,r){return r===void 0&&(r=0),t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3]}M.readInt32BE=Vt;function Xt(t,r){return r===void 0&&(r=0),(t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3])>>>0}M.readUint32BE=Xt;function Jt(t,r){return r===void 0&&(r=0),t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r]}M.readInt32LE=Jt;function Zt(t,r){return r===void 0&&(r=0),(t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r])>>>0}M.readUint32LE=Zt;function xt(t,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=t>>>24,r[n+1]=t>>>16,r[n+2]=t>>>8,r[n+3]=t>>>0,r}M.writeUint32BE=xt;M.writeInt32BE=xt;function Bt(t,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=t>>>0,r[n+1]=t>>>8,r[n+2]=t>>>16,r[n+3]=t>>>24,r}M.writeUint32LE=Bt;M.writeInt32LE=Bt;function qe(t,r){r===void 0&&(r=0);var n=Vt(t,r),i=Vt(t,r+4);return n*4294967296+i-(i>>31)*4294967296}M.readInt64BE=qe;function Ge(t,r){r===void 0&&(r=0);var n=Xt(t,r),i=Xt(t,r+4);return n*4294967296+i}M.readUint64BE=Ge;function $e(t,r){r===void 0&&(r=0);var n=Jt(t,r),i=Jt(t,r+4);return i*4294967296+n-(n>>31)*4294967296}M.readInt64LE=$e;function Ve(t,r){r===void 0&&(r=0);var n=Zt(t,r),i=Zt(t,r+4);return i*4294967296+n}M.readUint64LE=Ve;function Oe(t,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),xt(t/4294967296>>>0,r,n),xt(t>>>0,r,n+4),r}M.writeUint64BE=Oe;M.writeInt64BE=Oe;function Ue(t,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Bt(t>>>0,r,n),Bt(t/4294967296>>>0,r,n+4),r}M.writeUint64LE=Ue;M.writeInt64LE=Ue;function Xe(t,r,n){if(n===void 0&&(n=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>r.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,h=1,f=t/8+n-1;f>=n;f--)i+=r[f]*h,h*=256;return i}M.readUintBE=Xe;function Je(t,r,n){if(n===void 0&&(n=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>r.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,h=1,f=n;f<n+t/8;f++)i+=r[f]*h,h*=256;return i}M.readUintLE=Je;function Ze(t,r,n,i){if(n===void 0&&(n=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Se.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var h=1,f=t/8+i-1;f>=i;f--)n[f]=r/h&255,h*=256;return n}M.writeUintBE=Ze;function Qe(t,r,n,i){if(n===void 0&&(n=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Se.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var h=1,f=i;f<i+t/8;f++)n[f]=r/h&255,h*=256;return n}M.writeUintLE=Qe;function ke(t,r){r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat32(r)}M.readFloat32BE=ke;function tr(t,r){r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat32(r,!0)}M.readFloat32LE=tr;function er(t,r){r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat64(r)}M.readFloat64BE=er;function rr(t,r){r===void 0&&(r=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getFloat64(r,!0)}M.readFloat64LE=rr;function nr(t,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat32(n,t),r}M.writeFloat32BE=nr;function ir(t,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat32(n,t,!0),r}M.writeFloat32LE=ir;function ar(t,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat64(n,t),r}M.writeFloat64BE=ar;function ur(t,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var i=new DataView(r.buffer,r.byteOffset,r.byteLength);return i.setFloat64(n,t,!0),r}M.writeFloat64LE=ur;var Et={};Object.defineProperty(Et,"__esModule",{value:!0});function or(t){for(var r=0;r<t.length;r++)t[r]=0;return t}Et.wipe=or;Object.defineProperty(Rt,"__esModule",{value:!0});var dt=M,Qt=Et,fr=20;function hr(t,r,n){for(var i=1634760805,h=857760878,f=2036477234,E=1797285236,u=n[3]<<24|n[2]<<16|n[1]<<8|n[0],o=n[7]<<24|n[6]<<16|n[5]<<8|n[4],s=n[11]<<24|n[10]<<16|n[9]<<8|n[8],_=n[15]<<24|n[14]<<16|n[13]<<8|n[12],w=n[19]<<24|n[18]<<16|n[17]<<8|n[16],d=n[23]<<24|n[22]<<16|n[21]<<8|n[20],l=n[27]<<24|n[26]<<16|n[25]<<8|n[24],v=n[31]<<24|n[30]<<16|n[29]<<8|n[28],S=r[3]<<24|r[2]<<16|r[1]<<8|r[0],g=r[7]<<24|r[6]<<16|r[5]<<8|r[4],O=r[11]<<24|r[10]<<16|r[9]<<8|r[8],j=r[15]<<24|r[14]<<16|r[13]<<8|r[12],U=i,c=h,b=f,D=E,e=u,a=o,y=s,m=_,A=w,L=d,B=l,x=v,F=S,N=g,p=O,T=j,$=0;$<fr;$+=2)U=U+e|0,F^=U,F=F>>>16|F<<16,A=A+F|0,e^=A,e=e>>>20|e<<12,c=c+a|0,N^=c,N=N>>>16|N<<16,L=L+N|0,a^=L,a=a>>>20|a<<12,b=b+y|0,p^=b,p=p>>>16|p<<16,B=B+p|0,y^=B,y=y>>>20|y<<12,D=D+m|0,T^=D,T=T>>>16|T<<16,x=x+T|0,m^=x,m=m>>>20|m<<12,b=b+y|0,p^=b,p=p>>>24|p<<8,B=B+p|0,y^=B,y=y>>>25|y<<7,D=D+m|0,T^=D,T=T>>>24|T<<8,x=x+T|0,m^=x,m=m>>>25|m<<7,c=c+a|0,N^=c,N=N>>>24|N<<8,L=L+N|0,a^=L,a=a>>>25|a<<7,U=U+e|0,F^=U,F=F>>>24|F<<8,A=A+F|0,e^=A,e=e>>>25|e<<7,U=U+a|0,T^=U,T=T>>>16|T<<16,B=B+T|0,a^=B,a=a>>>20|a<<12,c=c+y|0,F^=c,F=F>>>16|F<<16,x=x+F|0,y^=x,y=y>>>20|y<<12,b=b+m|0,N^=b,N=N>>>16|N<<16,A=A+N|0,m^=A,m=m>>>20|m<<12,D=D+e|0,p^=D,p=p>>>16|p<<16,L=L+p|0,e^=L,e=e>>>20|e<<12,b=b+m|0,N^=b,N=N>>>24|N<<8,A=A+N|0,m^=A,m=m>>>25|m<<7,D=D+e|0,p^=D,p=p>>>24|p<<8,L=L+p|0,e^=L,e=e>>>25|e<<7,c=c+y|0,F^=c,F=F>>>24|F<<8,x=x+F|0,y^=x,y=y>>>25|y<<7,U=U+a|0,T^=U,T=T>>>24|T<<8,B=B+T|0,a^=B,a=a>>>25|a<<7;dt.writeUint32LE(U+i|0,t,0),dt.writeUint32LE(c+h|0,t,4),dt.writeUint32LE(b+f|0,t,8),dt.writeUint32LE(D+E|0,t,12),dt.writeUint32LE(e+u|0,t,16),dt.writeUint32LE(a+o|0,t,20),dt.writeUint32LE(y+s|0,t,24),dt.writeUint32LE(m+_|0,t,28),dt.writeUint32LE(A+w|0,t,32),dt.writeUint32LE(L+d|0,t,36),dt.writeUint32LE(B+l|0,t,40),dt.writeUint32LE(x+v|0,t,44),dt.writeUint32LE(F+S|0,t,48),dt.writeUint32LE(N+g|0,t,52),dt.writeUint32LE(p+O|0,t,56),dt.writeUint32LE(T+j|0,t,60)}function Ae(t,r,n,i,h){if(h===void 0&&(h=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<n.length)throw new Error("ChaCha: destination is shorter than source");var f,E;if(h===0){if(r.length!==8&&r.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");f=new Uint8Array(16),E=f.length-r.length,f.set(r,E)}else{if(r.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");f=r,E=h}for(var u=new Uint8Array(64),o=0;o<n.length;o+=64){hr(u,f,t);for(var s=o;s<o+64&&s<n.length;s++)i[s]=n[s]^u[s-o];cr(f,0,E)}return Qt.wipe(u),h===0&&Qt.wipe(f),i}Rt.streamXOR=Ae;function sr(t,r,n,i){return i===void 0&&(i=0),Qt.wipe(n),Ae(t,r,n,n,i)}Rt.stream=sr;function cr(t,r,n){for(var i=1;n--;)i=i+(t[r]&255)|0,t[r]=i&255,i>>>=8,r++;if(i>0)throw new Error("ChaCha: counter overflow")}var Te={},vt={};Object.defineProperty(vt,"__esModule",{value:!0});function lr(t,r,n){return~(t-1)&r|t-1&n}vt.select=lr;function Dr(t,r){return(t|0)-(r|0)-1>>>31&1}vt.lessOrEqual=Dr;function Fe(t,r){if(t.length!==r.length)return 0;for(var n=0,i=0;i<t.length;i++)n|=t[i]^r[i];return 1&n-1>>>8}vt.compare=Fe;function _r(t,r){return t.length===0||r.length===0?!1:Fe(t,r)!==0}vt.equal=_r;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=vt,n=Et;t.DIGEST_LENGTH=16;var i=function(){function E(u){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var o=u[0]|u[1]<<8;this._r[0]=o&8191;var s=u[2]|u[3]<<8;this._r[1]=(o>>>13|s<<3)&8191;var _=u[4]|u[5]<<8;this._r[2]=(s>>>10|_<<6)&7939;var w=u[6]|u[7]<<8;this._r[3]=(_>>>7|w<<9)&8191;var d=u[8]|u[9]<<8;this._r[4]=(w>>>4|d<<12)&255,this._r[5]=d>>>1&8190;var l=u[10]|u[11]<<8;this._r[6]=(d>>>14|l<<2)&8191;var v=u[12]|u[13]<<8;this._r[7]=(l>>>11|v<<5)&8065;var S=u[14]|u[15]<<8;this._r[8]=(v>>>8|S<<8)&8191,this._r[9]=S>>>5&127,this._pad[0]=u[16]|u[17]<<8,this._pad[1]=u[18]|u[19]<<8,this._pad[2]=u[20]|u[21]<<8,this._pad[3]=u[22]|u[23]<<8,this._pad[4]=u[24]|u[25]<<8,this._pad[5]=u[26]|u[27]<<8,this._pad[6]=u[28]|u[29]<<8,this._pad[7]=u[30]|u[31]<<8}return E.prototype._blocks=function(u,o,s){for(var _=this._fin?0:2048,w=this._h[0],d=this._h[1],l=this._h[2],v=this._h[3],S=this._h[4],g=this._h[5],O=this._h[6],j=this._h[7],U=this._h[8],c=this._h[9],b=this._r[0],D=this._r[1],e=this._r[2],a=this._r[3],y=this._r[4],m=this._r[5],A=this._r[6],L=this._r[7],B=this._r[8],x=this._r[9];s>=16;){var F=u[o+0]|u[o+1]<<8;w+=F&8191;var N=u[o+2]|u[o+3]<<8;d+=(F>>>13|N<<3)&8191;var p=u[o+4]|u[o+5]<<8;l+=(N>>>10|p<<6)&8191;var T=u[o+6]|u[o+7]<<8;v+=(p>>>7|T<<9)&8191;var $=u[o+8]|u[o+9]<<8;S+=(T>>>4|$<<12)&8191,g+=$>>>1&8191;var Z=u[o+10]|u[o+11]<<8;O+=($>>>14|Z<<2)&8191;var J=u[o+12]|u[o+13]<<8;j+=(Z>>>11|J<<5)&8191;var X=u[o+14]|u[o+15]<<8;U+=(J>>>8|X<<8)&8191,c+=X>>>5|_;var C=0,R=C;R+=w*b,R+=d*(5*x),R+=l*(5*B),R+=v*(5*L),R+=S*(5*A),C=R>>>13,R&=8191,R+=g*(5*m),R+=O*(5*y),R+=j*(5*a),R+=U*(5*e),R+=c*(5*D),C+=R>>>13,R&=8191;var P=C;P+=w*D,P+=d*b,P+=l*(5*x),P+=v*(5*B),P+=S*(5*L),C=P>>>13,P&=8191,P+=g*(5*A),P+=O*(5*m),P+=j*(5*y),P+=U*(5*a),P+=c*(5*e),C+=P>>>13,P&=8191;var I=C;I+=w*e,I+=d*D,I+=l*b,I+=v*(5*x),I+=S*(5*B),C=I>>>13,I&=8191,I+=g*(5*L),I+=O*(5*A),I+=j*(5*m),I+=U*(5*y),I+=c*(5*a),C+=I>>>13,I&=8191;var H=C;H+=w*a,H+=d*e,H+=l*D,H+=v*b,H+=S*(5*x),C=H>>>13,H&=8191,H+=g*(5*B),H+=O*(5*L),H+=j*(5*A),H+=U*(5*m),H+=c*(5*y),C+=H>>>13,H&=8191;var K=C;K+=w*y,K+=d*a,K+=l*e,K+=v*D,K+=S*b,C=K>>>13,K&=8191,K+=g*(5*x),K+=O*(5*B),K+=j*(5*L),K+=U*(5*A),K+=c*(5*m),C+=K>>>13,K&=8191;var z=C;z+=w*m,z+=d*y,z+=l*a,z+=v*e,z+=S*D,C=z>>>13,z&=8191,z+=g*b,z+=O*(5*x),z+=j*(5*B),z+=U*(5*L),z+=c*(5*A),C+=z>>>13,z&=8191;var Y=C;Y+=w*A,Y+=d*m,Y+=l*y,Y+=v*a,Y+=S*e,C=Y>>>13,Y&=8191,Y+=g*D,Y+=O*b,Y+=j*(5*x),Y+=U*(5*B),Y+=c*(5*L),C+=Y>>>13,Y&=8191;var W=C;W+=w*L,W+=d*A,W+=l*m,W+=v*y,W+=S*a,C=W>>>13,W&=8191,W+=g*e,W+=O*D,W+=j*b,W+=U*(5*x),W+=c*(5*B),C+=W>>>13,W&=8191;var G=C;G+=w*B,G+=d*L,G+=l*A,G+=v*m,G+=S*y,C=G>>>13,G&=8191,G+=g*a,G+=O*e,G+=j*D,G+=U*b,G+=c*(5*x),C+=G>>>13,G&=8191;var V=C;V+=w*x,V+=d*B,V+=l*L,V+=v*A,V+=S*m,C=V>>>13,V&=8191,V+=g*y,V+=O*a,V+=j*e,V+=U*D,V+=c*b,C+=V>>>13,V&=8191,C=(C<<2)+C|0,C=C+R|0,R=C&8191,C=C>>>13,P+=C,w=R,d=P,l=I,v=H,S=K,g=z,O=Y,j=W,U=G,c=V,o+=16,s-=16}this._h[0]=w,this._h[1]=d,this._h[2]=l,this._h[3]=v,this._h[4]=S,this._h[5]=g,this._h[6]=O,this._h[7]=j,this._h[8]=U,this._h[9]=c},E.prototype.finish=function(u,o){o===void 0&&(o=0);var s=new Uint16Array(10),_,w,d,l;if(this._leftover){for(l=this._leftover,this._buffer[l++]=1;l<16;l++)this._buffer[l]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(_=this._h[1]>>>13,this._h[1]&=8191,l=2;l<10;l++)this._h[l]+=_,_=this._h[l]>>>13,this._h[l]&=8191;for(this._h[0]+=_*5,_=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=_,_=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=_,s[0]=this._h[0]+5,_=s[0]>>>13,s[0]&=8191,l=1;l<10;l++)s[l]=this._h[l]+_,_=s[l]>>>13,s[l]&=8191;for(s[9]-=8192,w=(_^1)-1,l=0;l<10;l++)s[l]&=w;for(w=~w,l=0;l<10;l++)this._h[l]=this._h[l]&w|s[l];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,d=this._h[0]+this._pad[0],this._h[0]=d&65535,l=1;l<8;l++)d=(this._h[l]+this._pad[l]|0)+(d>>>16)|0,this._h[l]=d&65535;return u[o+0]=this._h[0]>>>0,u[o+1]=this._h[0]>>>8,u[o+2]=this._h[1]>>>0,u[o+3]=this._h[1]>>>8,u[o+4]=this._h[2]>>>0,u[o+5]=this._h[2]>>>8,u[o+6]=this._h[3]>>>0,u[o+7]=this._h[3]>>>8,u[o+8]=this._h[4]>>>0,u[o+9]=this._h[4]>>>8,u[o+10]=this._h[5]>>>0,u[o+11]=this._h[5]>>>8,u[o+12]=this._h[6]>>>0,u[o+13]=this._h[6]>>>8,u[o+14]=this._h[7]>>>0,u[o+15]=this._h[7]>>>8,this._finished=!0,this},E.prototype.update=function(u){var o=0,s=u.length,_;if(this._leftover){_=16-this._leftover,_>s&&(_=s);for(var w=0;w<_;w++)this._buffer[this._leftover+w]=u[o+w];if(s-=_,o+=_,this._leftover+=_,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(s>=16&&(_=s-s%16,this._blocks(u,o,_),o+=_,s-=_),s){for(var w=0;w<s;w++)this._buffer[this._leftover+w]=u[o+w];this._leftover+=s}return this},E.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var u=new Uint8Array(16);return this.finish(u),u},E.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},E}();t.Poly1305=i;function h(E,u){var o=new i(E);o.update(u);var s=o.digest();return o.clean(),s}t.oneTimeAuth=h;function f(E,u){return E.length!==t.DIGEST_LENGTH||u.length!==t.DIGEST_LENGTH?!1:r.equal(E,u)}t.equal=f})(Te);(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=Rt,n=Te,i=Et,h=M,f=vt;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var E=new Uint8Array(16),u=function(){function o(s){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,s.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(s)}return o.prototype.seal=function(s,_,w,d){if(s.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var l=new Uint8Array(16);l.set(s,l.length-s.length);var v=new Uint8Array(32);r.stream(this._key,l,v,4);var S=_.length+this.tagLength,g;if(d){if(d.length!==S)throw new Error("ChaCha20Poly1305: incorrect destination length");g=d}else g=new Uint8Array(S);return r.streamXOR(this._key,l,_,g,4),this._authenticate(g.subarray(g.length-this.tagLength,g.length),v,g.subarray(0,g.length-this.tagLength),w),i.wipe(l),g},o.prototype.open=function(s,_,w,d){if(s.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(_.length<this.tagLength)return null;var l=new Uint8Array(16);l.set(s,l.length-s.length);var v=new Uint8Array(32);r.stream(this._key,l,v,4);var S=new Uint8Array(this.tagLength);if(this._authenticate(S,v,_.subarray(0,_.length-this.tagLength),w),!f.equal(S,_.subarray(_.length-this.tagLength,_.length)))return null;var g=_.length-this.tagLength,O;if(d){if(d.length!==g)throw new Error("ChaCha20Poly1305: incorrect destination length");O=d}else O=new Uint8Array(g);return r.streamXOR(this._key,l,_.subarray(0,_.length-this.tagLength),O,4),i.wipe(l),O},o.prototype.clean=function(){return i.wipe(this._key),this},o.prototype._authenticate=function(s,_,w,d){var l=new n.Poly1305(_);d&&(l.update(d),d.length%16>0&&l.update(E.subarray(d.length%16))),l.update(w),w.length%16>0&&l.update(E.subarray(w.length%16));var v=new Uint8Array(8);d&&h.writeUint64LE(d.length,v),l.update(v),h.writeUint64LE(w.length,v),l.update(v);for(var S=l.digest(),g=0;g<S.length;g++)s[g]=S[g];l.clean(),i.wipe(S),i.wipe(v)},o}();t.ChaCha20Poly1305=u})(ye);var Ne={},Ft={},ne={};Object.defineProperty(ne,"__esModule",{value:!0});function dr(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}ne.isSerializableHash=dr;Object.defineProperty(Ft,"__esModule",{value:!0});var bt=ne,Er=vt,br=Et,Me=function(){function t(r,n){this._finished=!1,this._inner=new r,this._outer=new r,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);n.length>this.blockSize?this._inner.update(n).finish(i).clean():i.set(n);for(var h=0;h<i.length;h++)i[h]^=54;this._inner.update(i);for(var h=0;h<i.length;h++)i[h]^=106;this._outer.update(i),bt.isSerializableHash(this._inner)&&bt.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),br.wipe(i)}return t.prototype.reset=function(){if(!bt.isSerializableHash(this._inner)||!bt.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){bt.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),bt.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(r){return this._inner.update(r),this},t.prototype.finish=function(r){return this._finished?(this._outer.finish(r),this):(this._inner.finish(r),this._outer.update(r.subarray(0,this.digestLength)).finish(r),this._finished=!0,this)},t.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},t.prototype.saveState=function(){if(!bt.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(r){if(!bt.isSerializableHash(this._inner)||!bt.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(r),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(r){if(!bt.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(r)},t}();Ft.HMAC=Me;function vr(t,r,n){var i=new Me(t,r);i.update(n);var h=i.digest();return i.clean(),h}Ft.hmac=vr;Ft.equal=Er.equal;Object.defineProperty(Ne,"__esModule",{value:!0});var ue=Ft,oe=Et,wr=function(){function t(r,n,i,h){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=r,this._info=h;var f=ue.hmac(this._hash,i,n);this._hmac=new ue.HMAC(r,f),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var r=this._counter[0];if(r===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),r>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(r){for(var n=new Uint8Array(r),i=0;i<n.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),n[i]=this._buffer[this._bufpos++];return n},t.prototype.clean=function(){this._hmac.clean(),oe.wipe(this._buffer),oe.wipe(this._counter),this._bufpos=0},t}(),gr=Ne.HKDF=wr,jt={},Pt={},It={};Object.defineProperty(It,"__esModule",{value:!0});It.BrowserRandomSource=void 0;const fe=65536;class yr{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const r=typeof self<"u"?self.crypto||self.msCrypto:null;r&&r.getRandomValues!==void 0&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const n=new Uint8Array(r);for(let i=0;i<n.length;i+=fe)this._crypto.getRandomValues(n.subarray(i,i+Math.min(n.length-i,fe)));return n}}It.BrowserRandomSource=yr;var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.NodeRandomSource=void 0;const pr=Et;class Sr{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Lt.commonjsRequire<"u"){const r=Lt.requireCryptoBrowserify();r&&r.randomBytes&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let n=this._crypto.randomBytes(r);if(n.length!==r)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(r);for(let h=0;h<i.length;h++)i[h]=n[h];return(0,pr.wipe)(n),i}}Ht.NodeRandomSource=Sr;Object.defineProperty(Pt,"__esModule",{value:!0});Pt.SystemRandomSource=void 0;const mr=It,Cr=Ht;class Or{constructor(){if(this.isAvailable=!1,this.name="",this._source=new mr.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Cr.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(r){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(r)}}Pt.SystemRandomSource=Or;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const r=Pt,n=M,i=Et;t.defaultRandomSource=new r.SystemRandomSource;function h(s,_=t.defaultRandomSource){return _.randomBytes(s)}t.randomBytes=h;function f(s=t.defaultRandomSource){const _=h(4,s),w=(0,n.readUint32LE)(_);return(0,i.wipe)(_),w}t.randomUint32=f;const E="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(s,_=E,w=t.defaultRandomSource){if(_.length<2)throw new Error("randomString charset is too short");if(_.length>256)throw new Error("randomString charset is too long");let d="";const l=_.length,v=256-256%l;for(;s>0;){const S=h(Math.ceil(s*256/v),w);for(let g=0;g<S.length&&s>0;g++){const O=S[g];O<v&&(d+=_.charAt(O%l),s--)}(0,i.wipe)(S)}return d}t.randomString=u;function o(s,_=E,w=t.defaultRandomSource){const d=Math.ceil(s/(Math.log(_.length)/Math.LN2));return u(d,_,w)}t.randomStringForEntropy=o})(jt);const Ur=Lt.getDefaultExportFromCjs(jt);var Le={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=M,n=Et;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var i=function(){function u(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},u.prototype.update=function(o,s){if(s===void 0&&(s=o.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var _=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&s>0;)this._buffer[this._bufferLength++]=o[_++],s--;this._bufferLength===this.blockSize&&(f(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(_=f(this._temp,this._state,o,_,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=o[_++],s--;return this},u.prototype.finish=function(o){if(!this._finished){var s=this._bytesHashed,_=this._bufferLength,w=s/536870912|0,d=s<<3,l=s%64<56?64:128;this._buffer[_]=128;for(var v=_+1;v<l-8;v++)this._buffer[v]=0;r.writeUint32BE(w,this._buffer,l-8),r.writeUint32BE(d,this._buffer,l-4),f(this._temp,this._state,this._buffer,0,l),this._finished=!0}for(var v=0;v<this.digestLength/4;v++)r.writeUint32BE(this._state[v],o,v*4);return this},u.prototype.digest=function(){var o=new Uint8Array(this.digestLength);return this.finish(o),o},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(o){return this._state.set(o.state),this._bufferLength=o.bufferLength,o.buffer&&this._buffer.set(o.buffer),this._bytesHashed=o.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(o){n.wipe(o.state),o.buffer&&n.wipe(o.buffer),o.bufferLength=0,o.bytesHashed=0},u}();t.SHA256=i;var h=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function f(u,o,s,_,w){for(;w>=64;){for(var d=o[0],l=o[1],v=o[2],S=o[3],g=o[4],O=o[5],j=o[6],U=o[7],c=0;c<16;c++){var b=_+c*4;u[c]=r.readUint32BE(s,b)}for(var c=16;c<64;c++){var D=u[c-2],e=(D>>>17|D<<15)^(D>>>19|D<<13)^D>>>10;D=u[c-15];var a=(D>>>7|D<<25)^(D>>>18|D<<14)^D>>>3;u[c]=(e+u[c-7]|0)+(a+u[c-16]|0)}for(var c=0;c<64;c++){var e=(((g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&O^~g&j)|0)+(U+(h[c]+u[c]|0)|0)|0,a=((d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10))+(d&l^d&v^l&v)|0;U=j,j=O,O=g,g=S+e|0,S=v,v=l,l=d,d=e+a|0}o[0]+=d,o[1]+=l,o[2]+=v,o[3]+=S,o[4]+=g,o[5]+=O,o[6]+=j,o[7]+=U,_+=64,w-=64}return _}function E(u){var o=new i;o.update(u);var s=o.digest();return o.clean(),s}t.hash=E})(Le);var xe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const r=jt,n=Et;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function i(c){const b=new Float64Array(16);if(c)for(let D=0;D<c.length;D++)b[D]=c[D];return b}const h=new Uint8Array(32);h[0]=9;const f=i([56129,1]);function E(c){let b=1;for(let D=0;D<16;D++){let e=c[D]+b+65535;b=Math.floor(e/65536),c[D]=e-b*65536}c[0]+=b-1+37*(b-1)}function u(c,b,D){const e=~(D-1);for(let a=0;a<16;a++){const y=e&(c[a]^b[a]);c[a]^=y,b[a]^=y}}function o(c,b){const D=i(),e=i();for(let a=0;a<16;a++)e[a]=b[a];E(e),E(e),E(e);for(let a=0;a<2;a++){D[0]=e[0]-65517;for(let m=1;m<15;m++)D[m]=e[m]-65535-(D[m-1]>>16&1),D[m-1]&=65535;D[15]=e[15]-32767-(D[14]>>16&1);const y=D[15]>>16&1;D[14]&=65535,u(e,D,1-y)}for(let a=0;a<16;a++)c[2*a]=e[a]&255,c[2*a+1]=e[a]>>8}function s(c,b){for(let D=0;D<16;D++)c[D]=b[2*D]+(b[2*D+1]<<8);c[15]&=32767}function _(c,b,D){for(let e=0;e<16;e++)c[e]=b[e]+D[e]}function w(c,b,D){for(let e=0;e<16;e++)c[e]=b[e]-D[e]}function d(c,b,D){let e,a,y=0,m=0,A=0,L=0,B=0,x=0,F=0,N=0,p=0,T=0,$=0,Z=0,J=0,X=0,C=0,R=0,P=0,I=0,H=0,K=0,z=0,Y=0,W=0,G=0,V=0,wt=0,St=0,Ot=0,Mt=0,Yt=0,ae=0,k=D[0],tt=D[1],et=D[2],rt=D[3],nt=D[4],it=D[5],at=D[6],ut=D[7],ot=D[8],ft=D[9],ht=D[10],st=D[11],ct=D[12],lt=D[13],Dt=D[14],_t=D[15];e=b[0],y+=e*k,m+=e*tt,A+=e*et,L+=e*rt,B+=e*nt,x+=e*it,F+=e*at,N+=e*ut,p+=e*ot,T+=e*ft,$+=e*ht,Z+=e*st,J+=e*ct,X+=e*lt,C+=e*Dt,R+=e*_t,e=b[1],m+=e*k,A+=e*tt,L+=e*et,B+=e*rt,x+=e*nt,F+=e*it,N+=e*at,p+=e*ut,T+=e*ot,$+=e*ft,Z+=e*ht,J+=e*st,X+=e*ct,C+=e*lt,R+=e*Dt,P+=e*_t,e=b[2],A+=e*k,L+=e*tt,B+=e*et,x+=e*rt,F+=e*nt,N+=e*it,p+=e*at,T+=e*ut,$+=e*ot,Z+=e*ft,J+=e*ht,X+=e*st,C+=e*ct,R+=e*lt,P+=e*Dt,I+=e*_t,e=b[3],L+=e*k,B+=e*tt,x+=e*et,F+=e*rt,N+=e*nt,p+=e*it,T+=e*at,$+=e*ut,Z+=e*ot,J+=e*ft,X+=e*ht,C+=e*st,R+=e*ct,P+=e*lt,I+=e*Dt,H+=e*_t,e=b[4],B+=e*k,x+=e*tt,F+=e*et,N+=e*rt,p+=e*nt,T+=e*it,$+=e*at,Z+=e*ut,J+=e*ot,X+=e*ft,C+=e*ht,R+=e*st,P+=e*ct,I+=e*lt,H+=e*Dt,K+=e*_t,e=b[5],x+=e*k,F+=e*tt,N+=e*et,p+=e*rt,T+=e*nt,$+=e*it,Z+=e*at,J+=e*ut,X+=e*ot,C+=e*ft,R+=e*ht,P+=e*st,I+=e*ct,H+=e*lt,K+=e*Dt,z+=e*_t,e=b[6],F+=e*k,N+=e*tt,p+=e*et,T+=e*rt,$+=e*nt,Z+=e*it,J+=e*at,X+=e*ut,C+=e*ot,R+=e*ft,P+=e*ht,I+=e*st,H+=e*ct,K+=e*lt,z+=e*Dt,Y+=e*_t,e=b[7],N+=e*k,p+=e*tt,T+=e*et,$+=e*rt,Z+=e*nt,J+=e*it,X+=e*at,C+=e*ut,R+=e*ot,P+=e*ft,I+=e*ht,H+=e*st,K+=e*ct,z+=e*lt,Y+=e*Dt,W+=e*_t,e=b[8],p+=e*k,T+=e*tt,$+=e*et,Z+=e*rt,J+=e*nt,X+=e*it,C+=e*at,R+=e*ut,P+=e*ot,I+=e*ft,H+=e*ht,K+=e*st,z+=e*ct,Y+=e*lt,W+=e*Dt,G+=e*_t,e=b[9],T+=e*k,$+=e*tt,Z+=e*et,J+=e*rt,X+=e*nt,C+=e*it,R+=e*at,P+=e*ut,I+=e*ot,H+=e*ft,K+=e*ht,z+=e*st,Y+=e*ct,W+=e*lt,G+=e*Dt,V+=e*_t,e=b[10],$+=e*k,Z+=e*tt,J+=e*et,X+=e*rt,C+=e*nt,R+=e*it,P+=e*at,I+=e*ut,H+=e*ot,K+=e*ft,z+=e*ht,Y+=e*st,W+=e*ct,G+=e*lt,V+=e*Dt,wt+=e*_t,e=b[11],Z+=e*k,J+=e*tt,X+=e*et,C+=e*rt,R+=e*nt,P+=e*it,I+=e*at,H+=e*ut,K+=e*ot,z+=e*ft,Y+=e*ht,W+=e*st,G+=e*ct,V+=e*lt,wt+=e*Dt,St+=e*_t,e=b[12],J+=e*k,X+=e*tt,C+=e*et,R+=e*rt,P+=e*nt,I+=e*it,H+=e*at,K+=e*ut,z+=e*ot,Y+=e*ft,W+=e*ht,G+=e*st,V+=e*ct,wt+=e*lt,St+=e*Dt,Ot+=e*_t,e=b[13],X+=e*k,C+=e*tt,R+=e*et,P+=e*rt,I+=e*nt,H+=e*it,K+=e*at,z+=e*ut,Y+=e*ot,W+=e*ft,G+=e*ht,V+=e*st,wt+=e*ct,St+=e*lt,Ot+=e*Dt,Mt+=e*_t,e=b[14],C+=e*k,R+=e*tt,P+=e*et,I+=e*rt,H+=e*nt,K+=e*it,z+=e*at,Y+=e*ut,W+=e*ot,G+=e*ft,V+=e*ht,wt+=e*st,St+=e*ct,Ot+=e*lt,Mt+=e*Dt,Yt+=e*_t,e=b[15],R+=e*k,P+=e*tt,I+=e*et,H+=e*rt,K+=e*nt,z+=e*it,Y+=e*at,W+=e*ut,G+=e*ot,V+=e*ft,wt+=e*ht,St+=e*st,Ot+=e*ct,Mt+=e*lt,Yt+=e*Dt,ae+=e*_t,y+=38*P,m+=38*I,A+=38*H,L+=38*K,B+=38*z,x+=38*Y,F+=38*W,N+=38*G,p+=38*V,T+=38*wt,$+=38*St,Z+=38*Ot,J+=38*Mt,X+=38*Yt,C+=38*ae,a=1,e=y+a+65535,a=Math.floor(e/65536),y=e-a*65536,e=m+a+65535,a=Math.floor(e/65536),m=e-a*65536,e=A+a+65535,a=Math.floor(e/65536),A=e-a*65536,e=L+a+65535,a=Math.floor(e/65536),L=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=x+a+65535,a=Math.floor(e/65536),x=e-a*65536,e=F+a+65535,a=Math.floor(e/65536),F=e-a*65536,e=N+a+65535,a=Math.floor(e/65536),N=e-a*65536,e=p+a+65535,a=Math.floor(e/65536),p=e-a*65536,e=T+a+65535,a=Math.floor(e/65536),T=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=e-a*65536,e=Z+a+65535,a=Math.floor(e/65536),Z=e-a*65536,e=J+a+65535,a=Math.floor(e/65536),J=e-a*65536,e=X+a+65535,a=Math.floor(e/65536),X=e-a*65536,e=C+a+65535,a=Math.floor(e/65536),C=e-a*65536,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,y+=a-1+37*(a-1),a=1,e=y+a+65535,a=Math.floor(e/65536),y=e-a*65536,e=m+a+65535,a=Math.floor(e/65536),m=e-a*65536,e=A+a+65535,a=Math.floor(e/65536),A=e-a*65536,e=L+a+65535,a=Math.floor(e/65536),L=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=x+a+65535,a=Math.floor(e/65536),x=e-a*65536,e=F+a+65535,a=Math.floor(e/65536),F=e-a*65536,e=N+a+65535,a=Math.floor(e/65536),N=e-a*65536,e=p+a+65535,a=Math.floor(e/65536),p=e-a*65536,e=T+a+65535,a=Math.floor(e/65536),T=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=e-a*65536,e=Z+a+65535,a=Math.floor(e/65536),Z=e-a*65536,e=J+a+65535,a=Math.floor(e/65536),J=e-a*65536,e=X+a+65535,a=Math.floor(e/65536),X=e-a*65536,e=C+a+65535,a=Math.floor(e/65536),C=e-a*65536,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,y+=a-1+37*(a-1),c[0]=y,c[1]=m,c[2]=A,c[3]=L,c[4]=B,c[5]=x,c[6]=F,c[7]=N,c[8]=p,c[9]=T,c[10]=$,c[11]=Z,c[12]=J,c[13]=X,c[14]=C,c[15]=R}function l(c,b){d(c,b,b)}function v(c,b){const D=i();for(let e=0;e<16;e++)D[e]=b[e];for(let e=253;e>=0;e--)l(D,D),e!==2&&e!==4&&d(D,D,b);for(let e=0;e<16;e++)c[e]=D[e]}function S(c,b){const D=new Uint8Array(32),e=new Float64Array(80),a=i(),y=i(),m=i(),A=i(),L=i(),B=i();for(let p=0;p<31;p++)D[p]=c[p];D[31]=c[31]&127|64,D[0]&=248,s(e,b);for(let p=0;p<16;p++)y[p]=e[p];a[0]=A[0]=1;for(let p=254;p>=0;--p){const T=D[p>>>3]>>>(p&7)&1;u(a,y,T),u(m,A,T),_(L,a,m),w(a,a,m),_(m,y,A),w(y,y,A),l(A,L),l(B,a),d(a,m,a),d(m,y,L),_(L,a,m),w(a,a,m),l(y,a),w(m,A,B),d(a,m,f),_(a,a,A),d(m,m,a),d(a,A,B),d(A,y,e),l(y,L),u(a,y,T),u(m,A,T)}for(let p=0;p<16;p++)e[p+16]=a[p],e[p+32]=m[p],e[p+48]=y[p],e[p+64]=A[p];const x=e.subarray(32),F=e.subarray(16);v(x,x),d(F,F,x);const N=new Uint8Array(32);return o(N,F),N}t.scalarMult=S;function g(c){return S(c,h)}t.scalarMultBase=g;function O(c){if(c.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const b=new Uint8Array(c);return{publicKey:g(b),secretKey:b}}t.generateKeyPairFromSeed=O;function j(c){const b=(0,r.randomBytes)(32,c),D=O(b);return(0,n.wipe)(b),D}t.generateKeyPair=j;function U(c,b,D=!1){if(c.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(b.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const e=S(c,b);if(D){let a=0;for(let y=0;y<e.length;y++)a|=e[y];if(a===0)throw new Error("X25519: invalid shared key")}return e}t.sharedKey=U})(xe);function Ar(t,r){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),i=0;i<n.length;i++)n[i]=255;for(var h=0;h<t.length;h++){var f=t.charAt(h),E=f.charCodeAt(0);if(n[E]!==255)throw new TypeError(f+" is ambiguous");n[E]=h}var u=t.length,o=t.charAt(0),s=Math.log(u)/Math.log(256),_=Math.log(256)/Math.log(u);function w(v){if(v instanceof Uint8Array||(ArrayBuffer.isView(v)?v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength):Array.isArray(v)&&(v=Uint8Array.from(v))),!(v instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(v.length===0)return"";for(var S=0,g=0,O=0,j=v.length;O!==j&&v[O]===0;)O++,S++;for(var U=(j-O)*_+1>>>0,c=new Uint8Array(U);O!==j;){for(var b=v[O],D=0,e=U-1;(b!==0||D<g)&&e!==-1;e--,D++)b+=256*c[e]>>>0,c[e]=b%u>>>0,b=b/u>>>0;if(b!==0)throw new Error("Non-zero carry");g=D,O++}for(var a=U-g;a!==U&&c[a]===0;)a++;for(var y=o.repeat(S);a<U;++a)y+=t.charAt(c[a]);return y}function d(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return new Uint8Array;var S=0;if(v[S]!==" "){for(var g=0,O=0;v[S]===o;)g++,S++;for(var j=(v.length-S)*s+1>>>0,U=new Uint8Array(j);v[S];){var c=n[v.charCodeAt(S)];if(c===255)return;for(var b=0,D=j-1;(c!==0||b<O)&&D!==-1;D--,b++)c+=u*U[D]>>>0,U[D]=c%256>>>0,c=c/256>>>0;if(c!==0)throw new Error("Non-zero carry");O=b,S++}if(v[S]!==" "){for(var e=j-O;e!==j&&U[e]===0;)e++;for(var a=new Uint8Array(g+(j-e)),y=g;e!==j;)a[y++]=U[e++];return a}}}function l(v){var S=d(v);if(S)return S;throw new Error(`Non-${r} character`)}return{encode:w,decodeUnsafe:d,decode:l}}var Tr=Ar,Fr=Tr;const Nr=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},Mr=t=>new TextEncoder().encode(t),Lr=t=>new TextDecoder().decode(t);class xr{constructor(r,n,i){this.name=r,this.prefix=n,this.baseEncode=i}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Br{constructor(r,n,i){if(this.name=r,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=i}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return Be(this,r)}}class Rr{constructor(r){this.decoders=r}or(r){return Be(this,r)}decode(r){const n=r[0],i=this.decoders[n];if(i)return i.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Be=(t,r)=>new Rr({...t.decoders||{[t.prefix]:t},...r.decoders||{[r.prefix]:r}});class jr{constructor(r,n,i,h){this.name=r,this.prefix=n,this.baseEncode=i,this.baseDecode=h,this.encoder=new xr(r,n,i),this.decoder=new Br(r,n,h)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const Kt=({name:t,prefix:r,encode:n,decode:i})=>new jr(t,r,n,i),Nt=({prefix:t,name:r,alphabet:n})=>{const{encode:i,decode:h}=Fr(n,r);return Kt({prefix:t,name:r,encode:i,decode:f=>Nr(h(f))})},Pr=(t,r,n,i)=>{const h={};for(let _=0;_<r.length;++_)h[r[_]]=_;let f=t.length;for(;t[f-1]==="=";)--f;const E=new Uint8Array(f*n/8|0);let u=0,o=0,s=0;for(let _=0;_<f;++_){const w=h[t[_]];if(w===void 0)throw new SyntaxError(`Non-${i} character`);o=o<<n|w,u+=n,u>=8&&(u-=8,E[s++]=255&o>>u)}if(u>=n||255&o<<8-u)throw new SyntaxError("Unexpected end of data");return E},Ir=(t,r,n)=>{const i=r[r.length-1]==="=",h=(1<<n)-1;let f="",E=0,u=0;for(let o=0;o<t.length;++o)for(u=u<<8|t[o],E+=8;E>n;)E-=n,f+=r[h&u>>E];if(E&&(f+=r[h&u<<n-E]),i)for(;f.length*n&7;)f+="=";return f},Q=({name:t,prefix:r,bitsPerChar:n,alphabet:i})=>Kt({prefix:r,name:t,encode(h){return Ir(h,i,n)},decode(h){return Pr(h,i,n,t)}}),Hr=Kt({prefix:"\0",name:"identity",encode:t=>Lr(t),decode:t=>Mr(t)}),Kr=Object.freeze(Object.defineProperty({__proto__:null,identity:Hr},Symbol.toStringTag,{value:"Module"})),zr=Q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Yr=Object.freeze(Object.defineProperty({__proto__:null,base2:zr},Symbol.toStringTag,{value:"Module"})),Wr=Q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),qr=Object.freeze(Object.defineProperty({__proto__:null,base8:Wr},Symbol.toStringTag,{value:"Module"})),Gr=Nt({prefix:"9",name:"base10",alphabet:"0123456789"}),$r=Object.freeze(Object.defineProperty({__proto__:null,base10:Gr},Symbol.toStringTag,{value:"Module"})),Vr=Q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Xr=Q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Jr=Object.freeze(Object.defineProperty({__proto__:null,base16:Vr,base16upper:Xr},Symbol.toStringTag,{value:"Module"})),Zr=Q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Qr=Q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),kr=Q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),tn=Q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),en=Q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rn=Q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nn=Q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),an=Q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),un=Q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),on=Object.freeze(Object.defineProperty({__proto__:null,base32:Zr,base32hex:en,base32hexpad:nn,base32hexpadupper:an,base32hexupper:rn,base32pad:kr,base32padupper:tn,base32upper:Qr,base32z:un},Symbol.toStringTag,{value:"Module"})),fn=Nt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hn=Nt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),sn=Object.freeze(Object.defineProperty({__proto__:null,base36:fn,base36upper:hn},Symbol.toStringTag,{value:"Module"})),cn=Nt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ln=Nt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Dn=Object.freeze(Object.defineProperty({__proto__:null,base58btc:cn,base58flickr:ln},Symbol.toStringTag,{value:"Module"})),_n=Q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dn=Q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),En=Q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),bn=Q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),vn=Object.freeze(Object.defineProperty({__proto__:null,base64:_n,base64pad:dn,base64url:En,base64urlpad:bn},Symbol.toStringTag,{value:"Module"})),Re=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),wn=Re.reduce((t,r,n)=>(t[n]=r,t),[]),gn=Re.reduce((t,r,n)=>(t[r.codePointAt(0)]=n,t),[]);function yn(t){return t.reduce((r,n)=>(r+=wn[n],r),"")}function pn(t){const r=[];for(const n of t){const i=gn[n.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${n}`);r.push(i)}return new Uint8Array(r)}const Sn=Kt({prefix:"🚀",name:"base256emoji",encode:yn,decode:pn}),mn=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:Sn},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var je={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
2
|
var h = (i, e, r) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
|
|
3
3
|
var o = (i, e, r) => h(i, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { a8 as m, cL as w, Q as g, bR as p } from "./index-
|
|
5
|
-
import { S as u } from "./sui-
|
|
4
|
+
import { a8 as m, cL as w, Q as g, bR as p } from "./index-EhUlCH18.mjs";
|
|
5
|
+
import { S as u } from "./sui-BuZPAcI0.mjs";
|
|
6
6
|
class c {
|
|
7
7
|
constructor(e, r, t, n) {
|
|
8
8
|
o(this, "network");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var xr=Object.defineProperty;var Br=(t,e,r)=>e in t?xr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var U=(t,e,r)=>Br(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index-ByG9EJHX.js"),b=require("./sui-IAt2YxVB.js");require("./index-Cf-xLfst.js");class qt{constructor(e,r,n,i,s=!1){U(this,"transaction");U(this,"network");U(this,"chain");U(this,"description");U(this,"parallelizable");this.transaction=e,this.network=r,this.chain=n,this.description=i,this.parallelizable=s}}class Cr extends TypeError{constructor(e,r){let n;const{message:i,explanation:s,...c}=e,{path:a}=e,o=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??o),s!=null&&(this.cause=o),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function $r(t){return K(t)&&typeof t[Symbol.iterator]=="function"}function K(t){return typeof t=="object"&&t!=null}function J(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Ur(t){const{done:e,value:r}=t.next();return e?void 0:r}function Pr(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:s}=e,{type:c}=r,{refinement:a,message:o=`Expected a value of type \`${c}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=t;return{value:n,type:c,refinement:a,key:i[i.length-1],path:i,branch:s,...t,message:o}}function*Lt(t,e,r,n){$r(t)||(t=[t]);for(const i of t){const s=Pr(i,e,r,n);s&&(yield s)}}function*lt(t,e,r={}){const{path:n=[],branch:i=[t],coerce:s=!1,mask:c=!1}=r,a={path:n,branch:i};if(s&&(t=e.coercer(t,a),c&&e.type!=="type"&&K(e.schema)&&K(t)&&!Array.isArray(t)))for(const d in t)e.schema[d]===void 0&&delete t[d];let o="valid";for(const d of e.validator(t,a))d.explanation=r.message,o="not_valid",yield[d,void 0];for(let[d,u,g]of e.entries(t,a)){const m=lt(u,g,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,u],coerce:s,mask:c,message:r.message});for(const y of m)y[0]?(o=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(u=y[1],d===void 0?t=u:t instanceof Map?t.set(d,u):t instanceof Set?t.add(u):K(t)&&(u!==void 0||d in t)&&(t[d]=u))}if(o!=="not_valid")for(const d of e.refiner(t,a))d.explanation=r.message,o="not_refined",yield[d,void 0];o==="valid"&&(yield[void 0,t])}class te{constructor(e){const{type:r,schema:n,validator:i,refiner:s,coercer:c=o=>o,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=c,i?this.validator=(o,d)=>{const u=i(o,d);return Lt(u,d,this,o)}:this.validator=()=>[],s?this.refiner=(o,d)=>{const u=s(o,d);return Lt(u,d,this,o)}:this.refiner=()=>[]}assert(e,r){return nt(e,this,r)}create(e,r){return Xt(e,this,r)}is(e){return L(e,this)}mask(e,r){return Zt(e,this,r)}validate(e,r={}){return _e(e,this,r)}}function nt(t,e,r){const n=_e(t,e,{message:r});if(n[0])throw n[0]}function Xt(t,e,r){const n=_e(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Zt(t,e,r){const n=_e(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(t,e){return!_e(t,e)[0]}function _e(t,e,r={}){const n=lt(t,e,r),i=Ur(n);return i[0]?[new Cr(i[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,i[1]]}function je(...t){const e=t[0].type==="type",r=t.map(i=>i.schema),n=Object.assign({},...r);return e?Rr(n):p(n)}function W(t,e){return new te({type:t,schema:null,validator:e})}function it(){return W("any",()=>!0)}function E(t){return new te({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${J(e)}`}})}function Mr(){return W("bigint",t=>typeof t=="bigint")}function z(){return W("boolean",t=>typeof t=="boolean")}function ee(){return W("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${J(t)}`)}function k(t){const e=J(t),r=typeof t;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${J(n)}`}})}function Yt(){return W("never",()=>!1)}function $(t){return new te({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function he(){return W("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${J(t)}`)}function p(t){const e=t?Object.keys(t):[],r=Yt();return new te({type:"object",schema:t||null,*entries(n){if(t&&K(n)){const i=new Set(Object.keys(n));for(const s of e)i.delete(s),yield[s,n[s],t[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function v(t){return new te({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function Q(t,e){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function h(){return W("string",t=>typeof t=="string"||`Expected a string, but received: ${J(t)}`)}function Qt(t){const e=Yt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(t){const e=Object.keys(t);return new te({type:"type",schema:t,*entries(r){if(K(r))for(const n of e)yield[n,r[n],t[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function P(t){const e=t.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of t){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of t){const[...c]=lt(r,s,n),[a]=c;if(a[0])for(const[o]of c)o&&i.push(o);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${J(r)}`,...i]}})}function er(){return W("unknown",()=>!0)}const ft=P([p({AddressOwner:h()}),p({ObjectOwner:h()}),p({Shared:p({initial_shared_version:$(h())})}),k("Immutable")]);W("SuiJsonValue",()=>!0);const Nr=P([p({u32:h()}),p({u64:h()}),p({f64:h()})]);p({attributes:Q(h(),$(Nr)),featureFlags:Q(h(),z()),maxSupportedProtocolVersion:h(),minSupportedProtocolVersion:h(),protocolVersion:h()});P([h(),k("package")]);const ce=p({digest:h(),objectId:h(),version:P([he(),h(),Mr()])});p({owner:ft,reference:ce});p({objectId:h(),sequenceNumber:h()});p({payment:E(ce),owner:h(),price:h(),budget:h()});const Dr=je(ce,p({type:h(),owner:ft,previousTransaction:h()})),Vr=Q(h(),it()),zr=Q(h(),er()),Fr=p({type:h(),fields:Vr,hasPublicTransfer:z()}),Gr=p({disassembled:zr}),Lr=P([je(Fr,p({dataType:k("moveObject")})),je(Gr,p({dataType:k("package")}))]),Wr=p({type:h(),hasPublicTransfer:z(),version:h(),bcsBytes:h()}),Kr=p({id:h(),moduleMap:Q(h(),h())}),Jr=P([je(Wr,p({dataType:k("moveObject")})),je(Kr,p({dataType:k("package")}))]);BigInt(1e9);const tr=p({code:h(),error:v(h()),object_id:v(h()),parent_object_id:v(h()),version:v(h()),digest:v(h())}),Hr=p({data:$(v(Q(h(),h()))),error:$(v(tr))}),qr=P([Hr,v(Q(h(),h()))]),rr=p({objectId:h(),version:h(),digest:h(),type:$(v(h())),content:$(v(Lr)),bcs:$(v(Jr)),owner:$(v(ft)),previousTransaction:$(v(h())),storageRebate:$(v(h())),display:$(v(qr))});p({showType:$(v(z())),showContent:$(v(z())),showBcs:$(v(z())),showOwner:$(v(z())),showPreviousTransaction:$(v(z())),showStorageRebate:$(v(z())),showDisplay:$(v(z()))});P([k("Exists"),k("notExists"),k("Deleted")]);E(Dr);const Xr=p({data:$(v(rr)),error:$(v(tr))});function Zr(t){return t.data}function Yr(t){if(t.error&&"object_id"in t.error&&"version"in t.error&&"digest"in t.error){const e=t.error;return{objectId:e.object_id,version:e.version,digest:e.digest}}}function Wt(t){if("reference"in t)return t.reference;const e=Zr(t);return e?{objectId:e.objectId,version:e.version,digest:e.digest}:Yr(t)}p({objectId:h(),atCheckpoint:v(he())});p({data:E(Xr),nextCursor:v($(h())),hasNextPage:z()});P([p({details:rr,status:k("VersionFound")}),p({details:h(),status:k("ObjectNotExists")}),p({details:ce,status:k("ObjectDeleted")}),p({details:Qt([h(),he()]),status:k("VersionNotFound")}),p({details:p({asked_version:he(),latest_version:he(),object_id:h()}),status:k("VersionTooHigh")})]);const Qr=P([h(),p({Object:h()})]);E(Qr);const en=p({address:h(),name:h()}),tn=P([k("Private"),k("Public"),k("Friend")]),ht=p({abilities:E(h())}),rn=p({constraints:ht,isPhantom:z()}),nn=p({TypeParameter:he()}),Xe=Qt([p({module:h(),package:h(),function:h()}),h()]);p({rank3Days:E(Xe),rank7Days:E(Xe),rank30Days:E(Xe)});function nr(t){if(!t)return!1;if(typeof t=="string"||L(t,nn)||ir(t))return!0;if(typeof t!="object")return!1;const e=t;return!!(L(e.Reference,me)||L(e.MutableReference,me)||L(e.Vector,me))}const me=W("SuiMoveNormalizedType",nr);function ir(t){if(!t||typeof t!="object")return!1;const e=t;if(!e.Struct||typeof e.Struct!="object")return!1;const r=e.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>nr(n)))}W("SuiMoveNormalizedStructType",ir);const sn=p({visibility:tn,isEntry:z(),typeParameters:E(ht),parameters:E(me),return:E(me)}),an=p({name:h(),type:me}),on=p({abilities:ht,typeParameters:E(rn),fields:E(an)}),cn=p({fileFormatVersion:he(),address:h(),name:h(),friends:E(en),structs:Q(h(),on),exposedFunctions:Q(h(),sn)});Q(h(),cn);function st(t){return typeof t=="object"&&"MutableReference"in t?t.MutableReference:void 0}function sr(t){return typeof t=="object"&&"Reference"in t?t.Reference:void 0}function gt(t){if(typeof t=="object"&&"Struct"in t)return t;const e=sr(t),r=st(t);if(typeof e=="object"&&"Struct"in e)return e;if(typeof r=="object"&&"Struct"in r)return r}function un(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var c=t.length,a=t.charAt(0),o=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function u(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var S=0,T=0,f=0,O=y.length;f!==O&&y[f]===0;)f++,S++;for(var B=(O-f)*d+1>>>0,M=new Uint8Array(B);f!==O;){for(var A=y[f],j=0,R=B-1;(A!==0||j<T)&&R!==-1;R--,j++)A+=256*M[R]>>>0,M[R]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");T=j,f++}for(var H=B-T;H!==B&&M[H]===0;)H++;for(var pe=a.repeat(S);H<B;++H)pe+=t.charAt(M[H]);return pe}function g(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var S=0,T=0,f=0;y[S]===a;)T++,S++;for(var O=(y.length-S)*o+1>>>0,B=new Uint8Array(O);y[S];){var M=e[y.charCodeAt(S)];if(M===255)return;for(var A=0,j=O-1;(M!==0||A<f)&&j!==-1;j--,A++)M+=c*B[j]>>>0,B[j]=M%256>>>0,M=M/256>>>0;if(M!==0)throw new Error("Non-zero carry");f=A,S++}for(var R=O-f;R!==O&&B[R]===0;)R++;for(var H=new Uint8Array(T+(O-R)),pe=T;R!==O;)H[pe++]=B[R++];return H}function m(y){var S=g(y);if(S)return S;throw new Error("Non-base"+c+" character")}return{encode:u,decodeUnsafe:g,decode:m}}var dn=un;const ln=dn,fn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var hn=ln(fn);const ar=w.getDefaultExportFromCjs(hn),xe=t=>ar.encode(t),pt=t=>ar.decode(t);function ue(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}const Ze=8192;function Be(t){if(t.length<Ze)return btoa(String.fromCharCode(...t));let e="";for(var r=0;r<t.length;r+=Ze){const n=t.slice(r,r+Ze);e+=String.fromCharCode(...n)}return btoa(e)}function Je(t){var i;const e=t.startsWith("0x")?t.slice(2):t,n=((i=(e.length%2===0?e:`0${e}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function Ce(t){return t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}function yt(t){let e=[],r=0;if(t===0)return[0];for(;t>0;)e[r]=t&127,(t>>=7)&&(e[r]|=128),r+=1;return e}function gn(t){let e=0,r=0,n=0;for(;;){let i=t[n];if(n+=1,e|=(i&127)<<r,!(i&128))break;r+=7}return{value:e,length:n}}class or{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),n=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let e=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let e=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(e){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,e);return this.shift(e),n}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,e),{value:n,length:i}=gn(r);return this.shift(i),n}readVec(e){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(e(this,i,r));return n}}function pn(t,e){switch(e){case"base58":return xe(t);case"base64":return Be(t);case"hex":return Ce(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function yn(t,e){switch(e){case"base58":return pt(t);case"base64":return ue(t);case"hex":return Je(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function mt(t,e=["<",">"]){const[r,n]=e,i=[];let s="",c=0;for(let a=0;a<t.length;a++){const o=t[a];if(o===r&&c++,o===n&&c--,c===0&&o===","){i.push(s.trim()),s="";continue}s+=o}return i.push(s.trim()),i}class cr{constructor({size:e=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=r||e,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const r=this.bytePosition+e;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Ye(BigInt(e),8).forEach(r=>this.write8(r)),this}write128(e){return Ye(BigInt(e),16).forEach(r=>this.write8(r)),this}write256(e){return Ye(BigInt(e),32).forEach(r=>this.write8(r)),this}writeULEB(e){return yt(e).forEach(r=>this.write8(r)),this}writeVec(e,r){return this.writeULEB(e.length),Array.from(e).forEach((n,i)=>r(this,n,i,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return pn(this.toBytes(),e)}}function Ye(t,e){let r=new Uint8Array(e),n=0;for(;t>0;)r[n]=Number(t%BigInt(256)),t=t/BigInt(256),n+=1;return r}var ur=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},X=(t,e,r)=>(ur(t,e,"read from private field"),r?r.call(t):e.get(t)),ze=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Fe=(t,e,r,n)=>(ur(t,e,"write to private field"),e.set(t,r),r),ye,Se,Me,ae;const dr=class{constructor(t){ze(this,ye,void 0),ze(this,Se,void 0),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Fe(this,ye,t.write),Fe(this,Se,t.serialize??((e,r)=>{const n=new cr({size:this.serializedSize(e)??void 0,...r});return X(this,ye).call(this,e,n),n.toBytes()})),this.validate=t.validate??(()=>{})}write(t,e){this.validate(t),X(this,ye).call(this,t,e)}serialize(t,e){return this.validate(t),new mn(this,X(this,Se).call(this,t,e))}parse(t){const e=new or(t);return this.read(e)}transform({name:t,input:e,output:r}){return new dr({name:t??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ye).call(this,e(n),i),serializedSize:n=>this.serializedSize(e(n)),serialize:(n,i)=>X(this,Se).call(this,e(n),i),validate:n=>this.validate(e(n))})}};let Z=dr;ye=new WeakMap;Se=new WeakMap;const lr=Symbol.for("@mysten/serialized-bcs");function wt(t){return!!t&&typeof t=="object"&&t[lr]===!0}class mn{constructor(e,r){ze(this,Me,void 0),ze(this,ae,void 0),Fe(this,Me,e),Fe(this,ae,r)}get[lr](){return!0}toBytes(){return X(this,ae)}toHex(){return Ce(X(this,ae))}toBase64(){return Be(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Ge({size:t,...e}){return new Z({...e,serializedSize:()=>t})}function Qe({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function et({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function wn({serialize:t,...e}){const r=new Z({...e,serialize:t,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function bn({toBytes:t,fromBytes:e,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return e(s)},write:(n,i)=>{const s=t(n);i.writeULEB(s.length);for(let c=0;c<s.length;c++)i.write8(s[c])},serialize:n=>{const i=t(n),s=yt(i.length),c=new Uint8Array(s.length+i.length);return c.set(s,0),c.set(i,s.length),c},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function Sn(t){let e=null;function r(){return e||(e=t()),e}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const l={u8(t){return Qe({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...t})},u16(t){return Qe({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...t})},u32(t){return Qe({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...t})},u64(t){return et({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...t})},u128(t){return et({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...t})},u256(t){return et({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...t})},bool(t){return Ge({name:"bool",size:1,read:e=>e.read8()===1,write:(e,r)=>r.write8(e?1:0),...t,validate:e=>{var r;if((r=t==null?void 0:t.validate)==null||r.call(t,e),typeof e!="boolean")throw new TypeError(`Expected boolean, found ${typeof e}`)}})},uleb128(t){return wn({name:"uleb128",read:e=>e.readULEB(),serialize:e=>Uint8Array.from(yt(e)),...t})},bytes(t,e){return Ge({name:`bytes[${t}]`,size:t,read:r=>r.readBytes(t),write:(r,n)=>{for(let i=0;i<t;i++)n.write8(r[i]??0)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t)throw new TypeError(`Expected array of length ${t}, found ${r.length}`)}})},string(t){return bn({name:"string",toBytes:e=>new TextEncoder().encode(e),fromBytes:e=>new TextDecoder().decode(e),...t})},fixedArray(t,e,r){return new Z({name:`${e.name}[${t}]`,read:n=>{const i=new Array(t);for(let s=0;s<t;s++)i[s]=e.read(n);return i},write:(n,i)=>{for(const s of n)e.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==t)throw new TypeError(`Expected array of length ${t}, found ${n.length}`)}})},option(t){return l.enum(`Option<${t.name}>`,{None:null,Some:t}).transform({input:e=>e==null?{None:!0}:{Some:e},output:e=>"Some"in e?e.Some:null})},vector(t,e){return new Z({name:`vector<${t.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=t.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)t.write(i,n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(t,e){return new Z({name:`(${t.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<t.length;i++){const s=t[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of t)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<t.length;i++)t[i].write(r[i],n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t.length)throw new TypeError(`Expected array of length ${t.length}, found ${r.length}`)}})},struct(t,e,r){const n=Object.entries(e);return new Z({name:t,serializedSize:i=>{let s=0;for(const[c,a]of n){const o=a.serializedSize(i[c]);if(o==null)return null;s+=o}return s},read:i=>{const s={};for(const[c,a]of n)s[c]=a.read(i);return s},write:(i,s)=>{for(const[c,a]of n)a.write(i[c],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(t,e,r){const n=Object.entries(e);return new Z({name:t,read:i=>{const s=i.readULEB(),[c,a]=n[s];return{[c]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[c,a]=Object.entries(i)[0];for(let o=0;o<n.length;o++){const[d,u]=n[o];if(d===c){s.writeULEB(o),u==null||u.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[c]=s;if(!Object.hasOwn(e,c))throw new TypeError(`Invalid enum variant ${c}`)}})},map(t,e){return l.vector(l.tuple([t,e])).transform({name:`Map<${t.name}, ${e.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(t,e){return(...r)=>e(...r).transform({name:`${e.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(t){return Sn(t)}},Tn=32,Te=class{constructor(t){if(this.types=new Map,this.counter=0,t instanceof Te){this.schema=t.schema,this.types=new Map(t.types);return}if(this.schema=t,this.registerAddressType(Te.ADDRESS,t.addressLength,t.addressEncoding),this.registerVectorType(t.vectorType),t.types&&t.types.structs)for(let e of Object.keys(t.types.structs))this.registerStructType(e,t.types.structs[e]);if(t.types&&t.types.enums)for(let e of Object.keys(t.types.enums))this.registerEnumType(e,t.types.enums[e]);if(t.types&&t.types.aliases)for(let e of Object.keys(t.types.aliases))this.registerAlias(e,t.types.aliases[e]);t.withPrimitives!==!1&&vn(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(t,e,r){if(typeof t=="string"||Array.isArray(t)){const{name:n,params:i}=this.parseTypeName(t);return this.getTypeInterface(n).encode(this,e,r,i)}if(typeof t=="object"){const n=this.tempKey();return new Te(this).registerStructType(n,t).ser(n,e,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
|
|
1
|
+
"use strict";var xr=Object.defineProperty;var Br=(t,e,r)=>e in t?xr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var U=(t,e,r)=>Br(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index-BZ7LatAr.js"),b=require("./sui-BWRqoTdl.js");require("./index-B5TmFc4M.js");class qt{constructor(e,r,n,i,s=!1){U(this,"transaction");U(this,"network");U(this,"chain");U(this,"description");U(this,"parallelizable");this.transaction=e,this.network=r,this.chain=n,this.description=i,this.parallelizable=s}}class Cr extends TypeError{constructor(e,r){let n;const{message:i,explanation:s,...c}=e,{path:a}=e,o=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??o),s!=null&&(this.cause=o),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function $r(t){return K(t)&&typeof t[Symbol.iterator]=="function"}function K(t){return typeof t=="object"&&t!=null}function J(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Ur(t){const{done:e,value:r}=t.next();return e?void 0:r}function Pr(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:s}=e,{type:c}=r,{refinement:a,message:o=`Expected a value of type \`${c}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=t;return{value:n,type:c,refinement:a,key:i[i.length-1],path:i,branch:s,...t,message:o}}function*Lt(t,e,r,n){$r(t)||(t=[t]);for(const i of t){const s=Pr(i,e,r,n);s&&(yield s)}}function*lt(t,e,r={}){const{path:n=[],branch:i=[t],coerce:s=!1,mask:c=!1}=r,a={path:n,branch:i};if(s&&(t=e.coercer(t,a),c&&e.type!=="type"&&K(e.schema)&&K(t)&&!Array.isArray(t)))for(const d in t)e.schema[d]===void 0&&delete t[d];let o="valid";for(const d of e.validator(t,a))d.explanation=r.message,o="not_valid",yield[d,void 0];for(let[d,u,g]of e.entries(t,a)){const m=lt(u,g,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,u],coerce:s,mask:c,message:r.message});for(const y of m)y[0]?(o=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(u=y[1],d===void 0?t=u:t instanceof Map?t.set(d,u):t instanceof Set?t.add(u):K(t)&&(u!==void 0||d in t)&&(t[d]=u))}if(o!=="not_valid")for(const d of e.refiner(t,a))d.explanation=r.message,o="not_refined",yield[d,void 0];o==="valid"&&(yield[void 0,t])}class te{constructor(e){const{type:r,schema:n,validator:i,refiner:s,coercer:c=o=>o,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=c,i?this.validator=(o,d)=>{const u=i(o,d);return Lt(u,d,this,o)}:this.validator=()=>[],s?this.refiner=(o,d)=>{const u=s(o,d);return Lt(u,d,this,o)}:this.refiner=()=>[]}assert(e,r){return nt(e,this,r)}create(e,r){return Xt(e,this,r)}is(e){return L(e,this)}mask(e,r){return Zt(e,this,r)}validate(e,r={}){return _e(e,this,r)}}function nt(t,e,r){const n=_e(t,e,{message:r});if(n[0])throw n[0]}function Xt(t,e,r){const n=_e(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Zt(t,e,r){const n=_e(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(t,e){return!_e(t,e)[0]}function _e(t,e,r={}){const n=lt(t,e,r),i=Ur(n);return i[0]?[new Cr(i[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,i[1]]}function je(...t){const e=t[0].type==="type",r=t.map(i=>i.schema),n=Object.assign({},...r);return e?Rr(n):p(n)}function W(t,e){return new te({type:t,schema:null,validator:e})}function it(){return W("any",()=>!0)}function E(t){return new te({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${J(e)}`}})}function Mr(){return W("bigint",t=>typeof t=="bigint")}function z(){return W("boolean",t=>typeof t=="boolean")}function ee(){return W("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${J(t)}`)}function k(t){const e=J(t),r=typeof t;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${J(n)}`}})}function Yt(){return W("never",()=>!1)}function $(t){return new te({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function he(){return W("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${J(t)}`)}function p(t){const e=t?Object.keys(t):[],r=Yt();return new te({type:"object",schema:t||null,*entries(n){if(t&&K(n)){const i=new Set(Object.keys(n));for(const s of e)i.delete(s),yield[s,n[s],t[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function v(t){return new te({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function Q(t,e){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function h(){return W("string",t=>typeof t=="string"||`Expected a string, but received: ${J(t)}`)}function Qt(t){const e=Yt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(t){const e=Object.keys(t);return new te({type:"type",schema:t,*entries(r){if(K(r))for(const n of e)yield[n,r[n],t[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function P(t){const e=t.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of t){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of t){const[...c]=lt(r,s,n),[a]=c;if(a[0])for(const[o]of c)o&&i.push(o);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${J(r)}`,...i]}})}function er(){return W("unknown",()=>!0)}const ft=P([p({AddressOwner:h()}),p({ObjectOwner:h()}),p({Shared:p({initial_shared_version:$(h())})}),k("Immutable")]);W("SuiJsonValue",()=>!0);const Nr=P([p({u32:h()}),p({u64:h()}),p({f64:h()})]);p({attributes:Q(h(),$(Nr)),featureFlags:Q(h(),z()),maxSupportedProtocolVersion:h(),minSupportedProtocolVersion:h(),protocolVersion:h()});P([h(),k("package")]);const ce=p({digest:h(),objectId:h(),version:P([he(),h(),Mr()])});p({owner:ft,reference:ce});p({objectId:h(),sequenceNumber:h()});p({payment:E(ce),owner:h(),price:h(),budget:h()});const Dr=je(ce,p({type:h(),owner:ft,previousTransaction:h()})),Vr=Q(h(),it()),zr=Q(h(),er()),Fr=p({type:h(),fields:Vr,hasPublicTransfer:z()}),Gr=p({disassembled:zr}),Lr=P([je(Fr,p({dataType:k("moveObject")})),je(Gr,p({dataType:k("package")}))]),Wr=p({type:h(),hasPublicTransfer:z(),version:h(),bcsBytes:h()}),Kr=p({id:h(),moduleMap:Q(h(),h())}),Jr=P([je(Wr,p({dataType:k("moveObject")})),je(Kr,p({dataType:k("package")}))]);BigInt(1e9);const tr=p({code:h(),error:v(h()),object_id:v(h()),parent_object_id:v(h()),version:v(h()),digest:v(h())}),Hr=p({data:$(v(Q(h(),h()))),error:$(v(tr))}),qr=P([Hr,v(Q(h(),h()))]),rr=p({objectId:h(),version:h(),digest:h(),type:$(v(h())),content:$(v(Lr)),bcs:$(v(Jr)),owner:$(v(ft)),previousTransaction:$(v(h())),storageRebate:$(v(h())),display:$(v(qr))});p({showType:$(v(z())),showContent:$(v(z())),showBcs:$(v(z())),showOwner:$(v(z())),showPreviousTransaction:$(v(z())),showStorageRebate:$(v(z())),showDisplay:$(v(z()))});P([k("Exists"),k("notExists"),k("Deleted")]);E(Dr);const Xr=p({data:$(v(rr)),error:$(v(tr))});function Zr(t){return t.data}function Yr(t){if(t.error&&"object_id"in t.error&&"version"in t.error&&"digest"in t.error){const e=t.error;return{objectId:e.object_id,version:e.version,digest:e.digest}}}function Wt(t){if("reference"in t)return t.reference;const e=Zr(t);return e?{objectId:e.objectId,version:e.version,digest:e.digest}:Yr(t)}p({objectId:h(),atCheckpoint:v(he())});p({data:E(Xr),nextCursor:v($(h())),hasNextPage:z()});P([p({details:rr,status:k("VersionFound")}),p({details:h(),status:k("ObjectNotExists")}),p({details:ce,status:k("ObjectDeleted")}),p({details:Qt([h(),he()]),status:k("VersionNotFound")}),p({details:p({asked_version:he(),latest_version:he(),object_id:h()}),status:k("VersionTooHigh")})]);const Qr=P([h(),p({Object:h()})]);E(Qr);const en=p({address:h(),name:h()}),tn=P([k("Private"),k("Public"),k("Friend")]),ht=p({abilities:E(h())}),rn=p({constraints:ht,isPhantom:z()}),nn=p({TypeParameter:he()}),Xe=Qt([p({module:h(),package:h(),function:h()}),h()]);p({rank3Days:E(Xe),rank7Days:E(Xe),rank30Days:E(Xe)});function nr(t){if(!t)return!1;if(typeof t=="string"||L(t,nn)||ir(t))return!0;if(typeof t!="object")return!1;const e=t;return!!(L(e.Reference,me)||L(e.MutableReference,me)||L(e.Vector,me))}const me=W("SuiMoveNormalizedType",nr);function ir(t){if(!t||typeof t!="object")return!1;const e=t;if(!e.Struct||typeof e.Struct!="object")return!1;const r=e.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>nr(n)))}W("SuiMoveNormalizedStructType",ir);const sn=p({visibility:tn,isEntry:z(),typeParameters:E(ht),parameters:E(me),return:E(me)}),an=p({name:h(),type:me}),on=p({abilities:ht,typeParameters:E(rn),fields:E(an)}),cn=p({fileFormatVersion:he(),address:h(),name:h(),friends:E(en),structs:Q(h(),on),exposedFunctions:Q(h(),sn)});Q(h(),cn);function st(t){return typeof t=="object"&&"MutableReference"in t?t.MutableReference:void 0}function sr(t){return typeof t=="object"&&"Reference"in t?t.Reference:void 0}function gt(t){if(typeof t=="object"&&"Struct"in t)return t;const e=sr(t),r=st(t);if(typeof e=="object"&&"Struct"in e)return e;if(typeof r=="object"&&"Struct"in r)return r}function un(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var c=t.length,a=t.charAt(0),o=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function u(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var S=0,T=0,f=0,O=y.length;f!==O&&y[f]===0;)f++,S++;for(var B=(O-f)*d+1>>>0,M=new Uint8Array(B);f!==O;){for(var A=y[f],j=0,R=B-1;(A!==0||j<T)&&R!==-1;R--,j++)A+=256*M[R]>>>0,M[R]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");T=j,f++}for(var H=B-T;H!==B&&M[H]===0;)H++;for(var pe=a.repeat(S);H<B;++H)pe+=t.charAt(M[H]);return pe}function g(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var S=0,T=0,f=0;y[S]===a;)T++,S++;for(var O=(y.length-S)*o+1>>>0,B=new Uint8Array(O);y[S];){var M=e[y.charCodeAt(S)];if(M===255)return;for(var A=0,j=O-1;(M!==0||A<f)&&j!==-1;j--,A++)M+=c*B[j]>>>0,B[j]=M%256>>>0,M=M/256>>>0;if(M!==0)throw new Error("Non-zero carry");f=A,S++}for(var R=O-f;R!==O&&B[R]===0;)R++;for(var H=new Uint8Array(T+(O-R)),pe=T;R!==O;)H[pe++]=B[R++];return H}function m(y){var S=g(y);if(S)return S;throw new Error("Non-base"+c+" character")}return{encode:u,decodeUnsafe:g,decode:m}}var dn=un;const ln=dn,fn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var hn=ln(fn);const ar=w.getDefaultExportFromCjs(hn),xe=t=>ar.encode(t),pt=t=>ar.decode(t);function ue(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}const Ze=8192;function Be(t){if(t.length<Ze)return btoa(String.fromCharCode(...t));let e="";for(var r=0;r<t.length;r+=Ze){const n=t.slice(r,r+Ze);e+=String.fromCharCode(...n)}return btoa(e)}function Je(t){var i;const e=t.startsWith("0x")?t.slice(2):t,n=((i=(e.length%2===0?e:`0${e}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function Ce(t){return t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}function yt(t){let e=[],r=0;if(t===0)return[0];for(;t>0;)e[r]=t&127,(t>>=7)&&(e[r]|=128),r+=1;return e}function gn(t){let e=0,r=0,n=0;for(;;){let i=t[n];if(n+=1,e|=(i&127)<<r,!(i&128))break;r+=7}return{value:e,length:n}}class or{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),n=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let e=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let e=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(e){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,e);return this.shift(e),n}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,e),{value:n,length:i}=gn(r);return this.shift(i),n}readVec(e){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(e(this,i,r));return n}}function pn(t,e){switch(e){case"base58":return xe(t);case"base64":return Be(t);case"hex":return Ce(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function yn(t,e){switch(e){case"base58":return pt(t);case"base64":return ue(t);case"hex":return Je(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function mt(t,e=["<",">"]){const[r,n]=e,i=[];let s="",c=0;for(let a=0;a<t.length;a++){const o=t[a];if(o===r&&c++,o===n&&c--,c===0&&o===","){i.push(s.trim()),s="";continue}s+=o}return i.push(s.trim()),i}class cr{constructor({size:e=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=r||e,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const r=this.bytePosition+e;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Ye(BigInt(e),8).forEach(r=>this.write8(r)),this}write128(e){return Ye(BigInt(e),16).forEach(r=>this.write8(r)),this}write256(e){return Ye(BigInt(e),32).forEach(r=>this.write8(r)),this}writeULEB(e){return yt(e).forEach(r=>this.write8(r)),this}writeVec(e,r){return this.writeULEB(e.length),Array.from(e).forEach((n,i)=>r(this,n,i,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return pn(this.toBytes(),e)}}function Ye(t,e){let r=new Uint8Array(e),n=0;for(;t>0;)r[n]=Number(t%BigInt(256)),t=t/BigInt(256),n+=1;return r}var ur=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},X=(t,e,r)=>(ur(t,e,"read from private field"),r?r.call(t):e.get(t)),ze=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Fe=(t,e,r,n)=>(ur(t,e,"write to private field"),e.set(t,r),r),ye,Se,Me,ae;const dr=class{constructor(t){ze(this,ye,void 0),ze(this,Se,void 0),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Fe(this,ye,t.write),Fe(this,Se,t.serialize??((e,r)=>{const n=new cr({size:this.serializedSize(e)??void 0,...r});return X(this,ye).call(this,e,n),n.toBytes()})),this.validate=t.validate??(()=>{})}write(t,e){this.validate(t),X(this,ye).call(this,t,e)}serialize(t,e){return this.validate(t),new mn(this,X(this,Se).call(this,t,e))}parse(t){const e=new or(t);return this.read(e)}transform({name:t,input:e,output:r}){return new dr({name:t??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ye).call(this,e(n),i),serializedSize:n=>this.serializedSize(e(n)),serialize:(n,i)=>X(this,Se).call(this,e(n),i),validate:n=>this.validate(e(n))})}};let Z=dr;ye=new WeakMap;Se=new WeakMap;const lr=Symbol.for("@mysten/serialized-bcs");function wt(t){return!!t&&typeof t=="object"&&t[lr]===!0}class mn{constructor(e,r){ze(this,Me,void 0),ze(this,ae,void 0),Fe(this,Me,e),Fe(this,ae,r)}get[lr](){return!0}toBytes(){return X(this,ae)}toHex(){return Ce(X(this,ae))}toBase64(){return Be(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Ge({size:t,...e}){return new Z({...e,serializedSize:()=>t})}function Qe({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function et({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function wn({serialize:t,...e}){const r=new Z({...e,serialize:t,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function bn({toBytes:t,fromBytes:e,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return e(s)},write:(n,i)=>{const s=t(n);i.writeULEB(s.length);for(let c=0;c<s.length;c++)i.write8(s[c])},serialize:n=>{const i=t(n),s=yt(i.length),c=new Uint8Array(s.length+i.length);return c.set(s,0),c.set(i,s.length),c},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function Sn(t){let e=null;function r(){return e||(e=t()),e}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const l={u8(t){return Qe({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...t})},u16(t){return Qe({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...t})},u32(t){return Qe({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...t})},u64(t){return et({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...t})},u128(t){return et({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...t})},u256(t){return et({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...t})},bool(t){return Ge({name:"bool",size:1,read:e=>e.read8()===1,write:(e,r)=>r.write8(e?1:0),...t,validate:e=>{var r;if((r=t==null?void 0:t.validate)==null||r.call(t,e),typeof e!="boolean")throw new TypeError(`Expected boolean, found ${typeof e}`)}})},uleb128(t){return wn({name:"uleb128",read:e=>e.readULEB(),serialize:e=>Uint8Array.from(yt(e)),...t})},bytes(t,e){return Ge({name:`bytes[${t}]`,size:t,read:r=>r.readBytes(t),write:(r,n)=>{for(let i=0;i<t;i++)n.write8(r[i]??0)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t)throw new TypeError(`Expected array of length ${t}, found ${r.length}`)}})},string(t){return bn({name:"string",toBytes:e=>new TextEncoder().encode(e),fromBytes:e=>new TextDecoder().decode(e),...t})},fixedArray(t,e,r){return new Z({name:`${e.name}[${t}]`,read:n=>{const i=new Array(t);for(let s=0;s<t;s++)i[s]=e.read(n);return i},write:(n,i)=>{for(const s of n)e.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==t)throw new TypeError(`Expected array of length ${t}, found ${n.length}`)}})},option(t){return l.enum(`Option<${t.name}>`,{None:null,Some:t}).transform({input:e=>e==null?{None:!0}:{Some:e},output:e=>"Some"in e?e.Some:null})},vector(t,e){return new Z({name:`vector<${t.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=t.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)t.write(i,n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(t,e){return new Z({name:`(${t.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<t.length;i++){const s=t[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of t)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<t.length;i++)t[i].write(r[i],n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t.length)throw new TypeError(`Expected array of length ${t.length}, found ${r.length}`)}})},struct(t,e,r){const n=Object.entries(e);return new Z({name:t,serializedSize:i=>{let s=0;for(const[c,a]of n){const o=a.serializedSize(i[c]);if(o==null)return null;s+=o}return s},read:i=>{const s={};for(const[c,a]of n)s[c]=a.read(i);return s},write:(i,s)=>{for(const[c,a]of n)a.write(i[c],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(t,e,r){const n=Object.entries(e);return new Z({name:t,read:i=>{const s=i.readULEB(),[c,a]=n[s];return{[c]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[c,a]=Object.entries(i)[0];for(let o=0;o<n.length;o++){const[d,u]=n[o];if(d===c){s.writeULEB(o),u==null||u.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[c]=s;if(!Object.hasOwn(e,c))throw new TypeError(`Invalid enum variant ${c}`)}})},map(t,e){return l.vector(l.tuple([t,e])).transform({name:`Map<${t.name}, ${e.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(t,e){return(...r)=>e(...r).transform({name:`${e.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(t){return Sn(t)}},Tn=32,Te=class{constructor(t){if(this.types=new Map,this.counter=0,t instanceof Te){this.schema=t.schema,this.types=new Map(t.types);return}if(this.schema=t,this.registerAddressType(Te.ADDRESS,t.addressLength,t.addressEncoding),this.registerVectorType(t.vectorType),t.types&&t.types.structs)for(let e of Object.keys(t.types.structs))this.registerStructType(e,t.types.structs[e]);if(t.types&&t.types.enums)for(let e of Object.keys(t.types.enums))this.registerEnumType(e,t.types.enums[e]);if(t.types&&t.types.aliases)for(let e of Object.keys(t.types.aliases))this.registerAlias(e,t.types.aliases[e]);t.withPrimitives!==!1&&vn(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(t,e,r){if(typeof t=="string"||Array.isArray(t)){const{name:n,params:i}=this.parseTypeName(t);return this.getTypeInterface(n).encode(this,e,r,i)}if(typeof t=="object"){const n=this.tempKey();return new Te(this).registerStructType(n,t).ser(n,e,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
|
|
2
2
|
${JSON.stringify(t)}`)}de(t,e,r){if(typeof e=="string")if(r)e=yn(e,r);else throw new Error("To pass a string to `bcs.de`, specify encoding");if(typeof t=="string"||Array.isArray(t)){const{name:n,params:i}=this.parseTypeName(t);return this.getTypeInterface(n).decode(this,e,i)}if(typeof t=="object"){const n=new Te(this),i=this.tempKey();return n.registerStructType(i,t).de(i,e,r)}throw new Error(`Incorrect type passed into the '.de()' function.
|
|
3
3
|
${JSON.stringify(t)}`)}hasType(t){return this.types.has(t)}registerAlias(t,e){return this.types.set(t,e),this}registerType(t,e,r,n=()=>!0){const{name:i,params:s}=this.parseTypeName(t);return this.types.set(i,{encode(c,a,o,d){const u=s.reduce((g,m,y)=>Object.assign(g,{[m]:d[y]}),{});return this._encodeRaw.call(c,new cr(o),a,d,u)},decode(c,a,o){const d=s.reduce((u,g,m)=>Object.assign(u,{[g]:o[m]}),{});return this._decodeRaw.call(c,new or(a),o,d)},_encodeRaw(c,a,o,d){if(n(a))return e.call(this,c,a,o,d);throw new Error(`Validation failed for type ${i}, data: ${a}`)},_decodeRaw(c,a,o){return r.call(this,c,a,o)}}),this}registerBcsType(t,e){return this.registerType(t,(r,n,i)=>{const s=i.map(c=>new Z({name:String(c),write:(a,o)=>{const{name:d,params:u}=this.parseTypeName(c),g=this.getTypeInterface(d),m=u.reduce((y,S,T)=>Object.assign(y,{[S]:i[T]}),{});return g._encodeRaw.call(this,o,a,u,m)},read:()=>{throw new Error("Not implemented")}}));return e(...s).write(n,r),r},(r,n)=>{const i=n.map(s=>new Z({name:String(s),write:(c,a)=>{throw new Error("Not implemented")},read:c=>{const{name:a,params:o}=this.parseTypeName(s),d=this.getTypeInterface(a),u=o.reduce((g,m,y)=>Object.assign(g,{[m]:n[y]}),{});return d._decodeRaw.call(this,c,o,u)}}));return e(...i).read(r)}),this}registerAddressType(t,e,r="hex"){switch(r){case"base64":return this.registerType(t,function(i,s){return ue(s).reduce((c,a)=>c.write8(a),i)},function(i){return Be(i.readBytes(e))});case"hex":return this.registerType(t,function(i,s){return Je(s).reduce((c,a)=>c.write8(a),i)},function(i){return Ce(i.readBytes(e))});default:throw new Error("Unsupported encoding! Use either hex or base64")}}registerVectorType(t){let{name:e,params:r}=this.parseTypeName(t);if(r.length>1)throw new Error("Vector can have only one type parameter; got "+e);return this.registerType(t,function(i,s,c,a){return i.writeVec(s,(o,d)=>{let u=c[0];if(!u)throw new Error(`Incorrect number of type parameters passed a to vector '${t}'`);let{name:g,params:m}=this.parseTypeName(u);if(this.hasType(g))return this.getTypeInterface(g)._encodeRaw.call(this,o,d,m,a);if(!(g in a))throw new Error(`Unable to find a matching type definition for ${g} in vector; make sure you passed a generic`);let{name:y,params:S}=this.parseTypeName(a[g]);return this.getTypeInterface(y)._encodeRaw.call(this,o,d,S,a)})},function(i,s,c){return i.readVec(a=>{let o=s[0];if(!o)throw new Error(`Incorrect number of type parameters passed to a vector '${t}'`);let{name:d,params:u}=this.parseTypeName(o);if(this.hasType(d))return this.getTypeInterface(d)._decodeRaw.call(this,a,u,c);if(!(d in c))throw new Error(`Unable to find a matching type definition for ${d} in vector; make sure you passed a generic`);let{name:g,params:m}=this.parseTypeName(c[d]);return this.getTypeInterface(g)._decodeRaw.call(this,a,m,c)})})}registerStructType(t,e){for(let c in e){let a=this.tempKey(),o=e[c];!Array.isArray(o)&&typeof o!="string"&&(e[c]=a,this.registerStructType(a,o))}let r=Object.freeze(e),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(t);return this.registerType(t,function(a,o,d,u){if(!o||o.constructor!==Object)throw new Error(`Expected ${i} to be an Object, got: ${o}`);if(d.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${d.length}`);for(let g of n){if(!(g in o))throw new Error(`Struct ${i} requires field ${g}:${r[g]}`);const{name:m,params:y}=this.parseTypeName(r[g]);if(!s.includes(m))this.getTypeInterface(m)._encodeRaw.call(this,a,o[g],y,u);else{const S=s.indexOf(m);let{name:T,params:f}=this.parseTypeName(d[S]);if(this.hasType(T)){this.getTypeInterface(T)._encodeRaw.call(this,a,o[g],f,u);continue}if(!(T in u))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:O,params:B}=this.parseTypeName(u[T]);this.getTypeInterface(O)._encodeRaw.call(this,a,o[g],B,u)}}return a},function(a,o,d){if(o.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${o.length}`);let u={};for(let g of n){const{name:m,params:y}=this.parseTypeName(r[g]);if(!s.includes(m))u[g]=this.getTypeInterface(m)._decodeRaw.call(this,a,y,d);else{const S=s.indexOf(m);let{name:T,params:f}=this.parseTypeName(o[S]);if(this.hasType(T)){u[g]=this.getTypeInterface(T)._decodeRaw.call(this,a,f,d);continue}if(!(T in d))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:O,params:B}=this.parseTypeName(d[T]);u[g]=this.getTypeInterface(O)._decodeRaw.call(this,a,B,d)}}return u})}registerEnumType(t,e){for(let c in e){let a=this.tempKey(),o=e[c];o!==null&&!Array.isArray(o)&&typeof o!="string"&&(e[c]=a,this.registerStructType(a,o))}let r=Object.freeze(e),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(t);return this.registerType(t,function(a,o,d,u){if(!o)throw new Error(`Unable to write enum "${i}", missing data.
|
|
4
4
|
Received: "${o}"`);if(typeof o!="object")throw new Error(`Incorrect data passed into enum "${i}", expected object with properties: "${n.join(" | ")}".
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var P=Object.defineProperty;var U=(k,o,t)=>o in k?P(k,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):k[o]=t;var g=(k,o,t)=>U(k,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-CGmv-GLf.js"),e=require("./index-ByG9EJHX.js"),v=require("./algorand-DIrI8hux.js"),j=e.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),p=class p{constructor(o,t,r,s){g(this,"network");g(this,"chain");g(this,"connection");g(this,"contracts");g(this,"chainId");g(this,"coreBridge");g(this,"coreAppId");g(this,"coreAppAddress");g(this,"tokenBridgeAppId");g(this,"tokenBridgeAddress");if(this.network=o,this.chain=t,this.connection=r,this.contracts=s,this.chainId=e.toChainId(t),!s.coreBridge)throw new Error(`Core contract address for chain ${t} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=e.getApplicationAddress(i),this.coreBridge=new d.AlgorandWormholeCore(o,t,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${t} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=e.getApplicationAddress(a)}static async fromRpc(o,t){const[r,s]=await v.AlgorandPlatform.chainFromRpc(o),i=t[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new p(r,s,o,i.contracts)}async isWrappedAsset(o){const t=new e.AlgorandAddress(o).toInt();if(t===0)return!1;const r=await this.connection.getAssetByID(t).do(),i=e.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),n=e.Account.from_obj_for_encoding(a);return(n==null?void 0:n.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(o){const t=new e.AlgorandAddress(o).toInt(),r=await this.connection.getAssetByID(t).do(),s=e.Asset.from_obj_for_encoding(r),i=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),n=e.toChain(e.bignum.decode(a)),A=new e.UniversalAddress(i.slice(60,92));return{chain:n,address:A}}async getTokenUniversalAddress(o){return new e.AlgorandAddress(o).toUniversalAddress()}async getTokenNativeAddress(o,t){return new e.AlgorandAddress(t).toNative()}async getWrappedAsset(o){if(e.isNative(o.address))throw new Error("native asset cannot be a wrapped asset");const t=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o),r=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,t.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return e.toNative(this.chain,e.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(o){try{return await this.getWrappedAsset(o),!0}catch{}return!1}async getWrappedNative(){return e.toNative(this.chain,"0")}async isTransferCompleted(o){const t=d.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:o.sequence,chain:o.emitterChain,emitter:o.emitterAddress});try{return await d.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,t.address(),o.sequence)}catch{}return!1}async*createAttestation(o,t){if(!t)throw new Error("Payer required to create attestation");const r=new e.AlgorandAddress(t).toString(),s=new e.AlgorandAddress(o).toInt(),i=[],a=await this.connection.getTransactionParams().do(),n=d.StorageLogicSig.forEmitter(this.coreAppId,new e.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[A],txs:I}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,n,a);i.push(...I);let h="",c;if(s!==0){const u=await this.connection.getAssetByID(s).do(),b=e.Asset.from_obj_for_encoding(u),S=await this.connection.accountInformation(b.params.creator).do();if(c=e.Account.from_obj_for_encoding(S),c.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const B=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),w=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,B);h=w.accounts[0],i.push(...w.txs);const m=e.makeApplicationCallTxnFromObject({from:r,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:a});i.push({tx:m});const f=await this.coreBridge.getMessageFee();if(f>BigInt(0)){const u=e.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:f});i.push({tx:u})}let y=[A,h,this.coreAppAddress];c&&y.push(c.address);let l=e.makeApplicationCallTxnFromObject({appArgs:[p.attestToken,e.bignum.toBytes(s,8)],accounts:y,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:a});f>BigInt(0)?l.fee*=3:l.fee*=2,i.push({tx:l});for(const u of i)yield this.createUnsignedTx(u,"TokenBridge.createAttestation",!0)}async*submitAttestation(o,t,r){if(!t)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=t.toString(),a=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o.payload.token).address(),n=[],A=[],I=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);I.length>8&&A.push(new e.AlgorandAddress(I.slice(0,8)).toInt()),n.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let h=new Uint8Array(1);h[0]=1,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),h=new Uint8Array(1),h[0]=2,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n.push({tx:e.makeApplicationCallTxnFromObject({accounts:[],appArgs:[p.receiveAttest,e.serialize(o)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:A,from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*2;for(const c of n)yield this.createUnsignedTx(c,"TokenBridge.submitAttestation",!0)}async*transfer(o,t,r,s,i){const a=o.toString(),n=e.isNative(r)?0:new e.AlgorandAddress(r).toInt(),A=s,I=e.toChainId(t.chain),h=t.address.toUniversalAddress().toUint8Array(),c=await this.connection.getTransactionParams().do(),B=BigInt(0),w=d.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:e.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:e.decodeAddress(this.tokenBridgeAddress).publicKey}),m=[],{accounts:[f],txs:y}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,w,c);m.push(...y);let l="",u,b=!1;if(n!==0){const x=await this.connection.getAssetByID(n).do();l=e.Asset.from_obj_for_encoding(x).params.creator;const C=await this.connection.accountInformation(l).do();u=e.Account.from_obj_for_encoding(C),b=u.authAddr===this.tokenBridgeAddress.toString()}const S=await this.coreBridge.getMessageFee();if(S>0&&m.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:S,suggestedParams:c})}),!b){const x=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(n)),{accounts:[T],txs:C}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,x,c);l=T,C.push(...C)}if(n!==0&&!await p.isOptedInToAsset(this.connection,l,n)){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:1e5,suggestedParams:c});let T=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.optIn,e.bigIntToBytes(n,8)],foreignAssets:[n],accounts:[l],suggestedParams:c});T.fee*=2,m.unshift({tx:x},{tx:T})}const L=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:c});m.push({tx:L});let N=[];if(n===0){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,suggestedParams:c});m.push({tx:x}),N=[f,l,l]}else{const x=e.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,assetIndex:n,suggestedParams:c});m.push({tx:x}),N=u!=null&&u.address?[f,l,u.address]:[f,l]}const W=[p.sendTransfer,e.bignum.toBytes(n,8),e.bignum.toBytes(A,8),h,e.bignum.toBytes(I,8),e.bignum.toBytes(B,8)];i&&W.push(i);const F=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:W,foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[n],accounts:N,suggestedParams:c});F.fee*=2,m.push({tx:F});for(const x of m)yield this.createUnsignedTx(x,"TokenBridge.transfer",!0)}async*redeem(o,t,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new e.AlgorandAddress(o).toString(),{accounts:a,txs:n}=await d.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,t,i);let A,I="",h=[],c=0;if(t.payload.token.chain!==this.chain){A=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,t.payload.token),I=A.address();const f=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,I);c=new e.AlgorandAddress(f.slice(0,8)).toInt()}else{const f=new e.AlgorandAddress(t.payload.token.address).toBigInt();A=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,f),I=A.address(),c=e.safeBigIntToNumber(f)}a.push(I);let B=0,w="";if(t.payloadName==="TransferWithPayload"?(B=new e.AlgorandAddress(t.payload.to.address).toInt(),w=e.getApplicationAddress(B)):w=new e.AlgorandAddress(t.payload.to.address.toUint8Array()).toString(),a.push(w),c!==0&&(h.push(c),!await p.isOptedInToAsset(this.connection,w,c))){if(i!=w)throw new Error("Cannot ASA optin for somebody else (asset "+c.toString()+")");n.unshift({tx:e.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:c,from:i,suggestedParams:s,to:i})})}const m={accounts:a,appArgs:[p.completeTransfer,e.serialize(t)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s};n.push({tx:e.makeApplicationCallTxnFromObject(m)}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*(t.payloadName==="Transfer"&&t.payload.fee!==void 0&&t.payload.fee===0n?2:3),t.payloadName==="TransferWithPayload"&&(n[n.length-1].tx.appForeignApps=[B],n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[j.getSelector(),j.args[0].type.encode(e.serialize(t))],appIndex:B,foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const f of n)yield this.createUnsignedTx(f,"TokenBridge.redeem",!0)}static async isOptedInToAsset(o,t,r){var s;try{const i=await o.accountAssetInformation(t,r).do();return(((s=e.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(o,t,r=!0){return new d.AlgorandUnsignedTransaction(o,this.network,this.chain,t,r)}};g(p,"sendTransfer",e.bytes.encode("sendTransfer")),g(p,"attestToken",e.bytes.encode("attestToken")),g(p,"noop",e.bytes.encode("nop")),g(p,"optIn",e.bytes.encode("optin")),g(p,"completeTransfer",e.bytes.encode("completeTransfer")),g(p,"receiveAttest",e.bytes.encode("receiveAttest"));let O=p;e.registerProtocol(e._platform$4,"TokenBridge",O);exports.AlgorandTokenBridge=O;exports.TransferMethodSelector=j;
|
|
1
|
+
"use strict";var P=Object.defineProperty;var U=(k,o,t)=>o in k?P(k,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):k[o]=t;var g=(k,o,t)=>U(k,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-mAuqp4GD.js"),e=require("./index-BZ7LatAr.js"),v=require("./algorand-BZfir-Gt.js"),j=e.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),p=class p{constructor(o,t,r,s){g(this,"network");g(this,"chain");g(this,"connection");g(this,"contracts");g(this,"chainId");g(this,"coreBridge");g(this,"coreAppId");g(this,"coreAppAddress");g(this,"tokenBridgeAppId");g(this,"tokenBridgeAddress");if(this.network=o,this.chain=t,this.connection=r,this.contracts=s,this.chainId=e.toChainId(t),!s.coreBridge)throw new Error(`Core contract address for chain ${t} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=e.getApplicationAddress(i),this.coreBridge=new d.AlgorandWormholeCore(o,t,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${t} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=e.getApplicationAddress(a)}static async fromRpc(o,t){const[r,s]=await v.AlgorandPlatform.chainFromRpc(o),i=t[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new p(r,s,o,i.contracts)}async isWrappedAsset(o){const t=new e.AlgorandAddress(o).toInt();if(t===0)return!1;const r=await this.connection.getAssetByID(t).do(),i=e.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),n=e.Account.from_obj_for_encoding(a);return(n==null?void 0:n.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(o){const t=new e.AlgorandAddress(o).toInt(),r=await this.connection.getAssetByID(t).do(),s=e.Asset.from_obj_for_encoding(r),i=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),n=e.toChain(e.bignum.decode(a)),A=new e.UniversalAddress(i.slice(60,92));return{chain:n,address:A}}async getTokenUniversalAddress(o){return new e.AlgorandAddress(o).toUniversalAddress()}async getTokenNativeAddress(o,t){return new e.AlgorandAddress(t).toNative()}async getWrappedAsset(o){if(e.isNative(o.address))throw new Error("native asset cannot be a wrapped asset");const t=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o),r=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,t.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return e.toNative(this.chain,e.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(o){try{return await this.getWrappedAsset(o),!0}catch{}return!1}async getWrappedNative(){return e.toNative(this.chain,"0")}async isTransferCompleted(o){const t=d.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:o.sequence,chain:o.emitterChain,emitter:o.emitterAddress});try{return await d.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,t.address(),o.sequence)}catch{}return!1}async*createAttestation(o,t){if(!t)throw new Error("Payer required to create attestation");const r=new e.AlgorandAddress(t).toString(),s=new e.AlgorandAddress(o).toInt(),i=[],a=await this.connection.getTransactionParams().do(),n=d.StorageLogicSig.forEmitter(this.coreAppId,new e.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[A],txs:I}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,n,a);i.push(...I);let h="",c;if(s!==0){const u=await this.connection.getAssetByID(s).do(),b=e.Asset.from_obj_for_encoding(u),S=await this.connection.accountInformation(b.params.creator).do();if(c=e.Account.from_obj_for_encoding(S),c.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const B=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),w=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,B);h=w.accounts[0],i.push(...w.txs);const m=e.makeApplicationCallTxnFromObject({from:r,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:a});i.push({tx:m});const f=await this.coreBridge.getMessageFee();if(f>BigInt(0)){const u=e.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:f});i.push({tx:u})}let y=[A,h,this.coreAppAddress];c&&y.push(c.address);let l=e.makeApplicationCallTxnFromObject({appArgs:[p.attestToken,e.bignum.toBytes(s,8)],accounts:y,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:a});f>BigInt(0)?l.fee*=3:l.fee*=2,i.push({tx:l});for(const u of i)yield this.createUnsignedTx(u,"TokenBridge.createAttestation",!0)}async*submitAttestation(o,t,r){if(!t)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=t.toString(),a=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o.payload.token).address(),n=[],A=[],I=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);I.length>8&&A.push(new e.AlgorandAddress(I.slice(0,8)).toInt()),n.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let h=new Uint8Array(1);h[0]=1,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),h=new Uint8Array(1),h[0]=2,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n.push({tx:e.makeApplicationCallTxnFromObject({accounts:[],appArgs:[p.receiveAttest,e.serialize(o)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:A,from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*2;for(const c of n)yield this.createUnsignedTx(c,"TokenBridge.submitAttestation",!0)}async*transfer(o,t,r,s,i){const a=o.toString(),n=e.isNative(r)?0:new e.AlgorandAddress(r).toInt(),A=s,I=e.toChainId(t.chain),h=t.address.toUniversalAddress().toUint8Array(),c=await this.connection.getTransactionParams().do(),B=BigInt(0),w=d.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:e.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:e.decodeAddress(this.tokenBridgeAddress).publicKey}),m=[],{accounts:[f],txs:y}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,w,c);m.push(...y);let l="",u,b=!1;if(n!==0){const x=await this.connection.getAssetByID(n).do();l=e.Asset.from_obj_for_encoding(x).params.creator;const C=await this.connection.accountInformation(l).do();u=e.Account.from_obj_for_encoding(C),b=u.authAddr===this.tokenBridgeAddress.toString()}const S=await this.coreBridge.getMessageFee();if(S>0&&m.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:S,suggestedParams:c})}),!b){const x=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(n)),{accounts:[T],txs:C}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,x,c);l=T,C.push(...C)}if(n!==0&&!await p.isOptedInToAsset(this.connection,l,n)){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:1e5,suggestedParams:c});let T=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.optIn,e.bigIntToBytes(n,8)],foreignAssets:[n],accounts:[l],suggestedParams:c});T.fee*=2,m.unshift({tx:x},{tx:T})}const L=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:c});m.push({tx:L});let N=[];if(n===0){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,suggestedParams:c});m.push({tx:x}),N=[f,l,l]}else{const x=e.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,assetIndex:n,suggestedParams:c});m.push({tx:x}),N=u!=null&&u.address?[f,l,u.address]:[f,l]}const W=[p.sendTransfer,e.bignum.toBytes(n,8),e.bignum.toBytes(A,8),h,e.bignum.toBytes(I,8),e.bignum.toBytes(B,8)];i&&W.push(i);const F=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:W,foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[n],accounts:N,suggestedParams:c});F.fee*=2,m.push({tx:F});for(const x of m)yield this.createUnsignedTx(x,"TokenBridge.transfer",!0)}async*redeem(o,t,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new e.AlgorandAddress(o).toString(),{accounts:a,txs:n}=await d.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,t,i);let A,I="",h=[],c=0;if(t.payload.token.chain!==this.chain){A=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,t.payload.token),I=A.address();const f=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,I);c=new e.AlgorandAddress(f.slice(0,8)).toInt()}else{const f=new e.AlgorandAddress(t.payload.token.address).toBigInt();A=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,f),I=A.address(),c=e.safeBigIntToNumber(f)}a.push(I);let B=0,w="";if(t.payloadName==="TransferWithPayload"?(B=new e.AlgorandAddress(t.payload.to.address).toInt(),w=e.getApplicationAddress(B)):w=new e.AlgorandAddress(t.payload.to.address.toUint8Array()).toString(),a.push(w),c!==0&&(h.push(c),!await p.isOptedInToAsset(this.connection,w,c))){if(i!=w)throw new Error("Cannot ASA optin for somebody else (asset "+c.toString()+")");n.unshift({tx:e.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:c,from:i,suggestedParams:s,to:i})})}const m={accounts:a,appArgs:[p.completeTransfer,e.serialize(t)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s};n.push({tx:e.makeApplicationCallTxnFromObject(m)}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*(t.payloadName==="Transfer"&&t.payload.fee!==void 0&&t.payload.fee===0n?2:3),t.payloadName==="TransferWithPayload"&&(n[n.length-1].tx.appForeignApps=[B],n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[j.getSelector(),j.args[0].type.encode(e.serialize(t))],appIndex:B,foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const f of n)yield this.createUnsignedTx(f,"TokenBridge.redeem",!0)}static async isOptedInToAsset(o,t,r){var s;try{const i=await o.accountAssetInformation(t,r).do();return(((s=e.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(o,t,r=!0){return new d.AlgorandUnsignedTransaction(o,this.network,this.chain,t,r)}};g(p,"sendTransfer",e.bytes.encode("sendTransfer")),g(p,"attestToken",e.bytes.encode("attestToken")),g(p,"noop",e.bytes.encode("nop")),g(p,"optIn",e.bytes.encode("optin")),g(p,"completeTransfer",e.bytes.encode("completeTransfer")),g(p,"receiveAttest",e.bytes.encode("receiveAttest"));let O=p;e.registerProtocol(e._platform$4,"TokenBridge",O);exports.AlgorandTokenBridge=O;exports.TransferMethodSelector=j;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const me=Symbol(),se=Object.getPrototypeOf,G=new WeakMap,he=e=>e&&(G.has(e)?G.get(e):se(e)===Object.prototype||se(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,ne=(e,t=!0)=>{G.set(e,t)},H={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,REACT_APP_CONNECT_GIT_HASH:"fc2a96e4359518a639ba7372d0241e367a8bbed6",REACT_APP_CONNECT_VERSION:"1.0.0-beta.3-development",SSR:!1},F=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,g)=>new Proxy(n,g),s=n=>F(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,g,I=r)=>{const v=l.get(n);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return ne(w,!0),l.set(n,[g,w]),Reflect.ownKeys(n).forEach(_=>{if(Object.getOwnPropertyDescriptor(w,_))return;const L=Reflect.get(n,_),M={value:L,enumerable:!0,configurable:!0};if(x.has(L))ne(L,!1);else if(L instanceof Promise)delete M.value,M.get=()=>I(L);else if(A.has(L)){const[b,q]=A.get(L);M.value=c(b,q(),I)}Object.defineProperty(w,_,M)}),Object.preventExtensions(w)},m=new WeakMap,f=[1,1],W=n=>{if(!F(n))throw new Error("object required");const g=m.get(n);if(g)return g;let I=f[0];const v=new Set,w=(a,i=++f[0])=>{I!==i&&(I=i,v.forEach(o=>o(a,i)))};let _=f[1];const L=(a=++f[1])=>(_!==a&&!v.size&&(_=a,b.forEach(([i])=>{const o=i[1](a);o>I&&(I=o)})),I),M=a=>(i,o)=>{const h=[...i];h[1]=[a,...h[1]],w(h,o)},b=new Map,q=(a,i)=>{if((H?"production":void 0)!=="production"&&b.has(a))throw new Error("prop listener already exists");if(v.size){const o=i[3](M(a));b.set(a,[i,o])}else b.set(a,[i])},te=a=>{var i;const o=b.get(a);o&&(b.delete(a),(i=o[1])==null||i.call(o))},pe=a=>(v.add(a),v.size===1&&b.forEach(([o,h],k)=>{if((H?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const T=o[3](M(k));b.set(k,[o,T])}),()=>{v.delete(a),v.size===0&&b.forEach(([o,h],k)=>{h&&(h(),b.set(k,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(a,i){const o=Reflect.get(a,i);te(i);const h=Reflect.deleteProperty(a,i);return h&&w(["delete",[i],o]),h},set(a,i,o,h){const k=Reflect.has(a,i),T=Reflect.get(a,i,h);if(k&&(e(T,o)||m.has(o)&&e(T,m.get(o))))return!0;te(i),F(o)&&(o=ge(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,w(["resolve",[i],C])}).catch(C=>{o.status="rejected",o.reason=C,w(["reject",[i],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&q(i,C)}return Reflect.set(a,i,V,h),w(["set",[i],o,T]),!0}});m.set(n,$);const fe=[J,L,c,pe];return A.set($,fe),Reflect.ownKeys(n).forEach(a=>{const i=Object.getOwnPropertyDescriptor(n,a);"value"in i&&($[a]=n[a],delete i.value,delete i.writable),Object.defineProperty(J,a,i)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(H?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(H?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ee={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},u={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return u.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return u.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(u.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!u.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(u.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(u.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ee.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),ue={state:p,subscribe(e){return D(p.events,()=>e(ve(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},E=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),y={state:E,subscribe(e){return D(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),U={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;ue.initialize(),y.setChains(e.chains),y.setIsAuth(!!e.enableAuthMode),y.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),y.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),u.setModalVersionInStorage(),Object.assign(B,e)}};var Ie=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Le=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Oe.call(t,s)&&re(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=Le({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",U.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const P={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${U.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${U.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var We=Object.defineProperty,ie=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,ae=(e,t,s)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&ae(e,s,t[s]);if(ie)for(var s of ie(t))Ae.call(t,s)&&ae(e,s,t[s]);return e};const le=u.isMobile(),O=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Me={state:O,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=U.state;if(e==="NONE"||t==="ALL"&&!e)return O.recomendedWallets;if(u.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await P.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),O.recomendedWallets=l}else{const{chains:s,isAuth:r}=y.state,l=s==null?void 0:s.join(","),c=u.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:u.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=le?await P.getMobileListings(m):await P.getDesktopListings(m);O.recomendedWallets=Object.values(f)}return O.recomendedWallets},async getWallets(e){const t=je({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=U.state,{recomendedWallets:l}=O;if(r==="ALL")return O.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):u.isArray(s)&&(t.excludedIds=s.join(",")),u.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),y.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=le?await P.getMobileListings(t):await P.getDesktopListings(t),n=Object.values(f),g=m?"search":"wallets";return O[g]={listings:[...O[g].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return P.getWalletImageUrl(e)},getAssetImageUrl(e){return P.getAssetImageUrl(e)},resetSearch(){O.search={listings:[],total:0,page:1}}},N=j({open:!1}),z={state:N,subscribe(e){return D(N,()=>e(N))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=y.state;if(u.removeWalletConnectDeepLink(),y.setWalletConnectUri(e==null?void 0:e.uri),y.setChains(e==null?void 0:e.chains),ee.reset("ConnectWallet"),s&&r)N.open=!0,t();else{const l=setInterval(()=>{const c=y.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),N.open=!0,t())},200)}})},close(){N.open=!1}};var Pe=Object.defineProperty,ce=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,de=(e,t,s)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&de(e,s,t[s]);if(ce)for(var s of ce(t))Ue.call(t,s)&&de(e,s,t[s]);return e};function _e(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const R=j({themeMode:_e()?"dark":"light"}),Z={state:R,subscribe(e){return D(R,()=>e(R))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(R.themeMode=t),s&&(R.themeVariables=De({},s))}},S=j({open:!1,message:"",variant:"success"}),ke={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Ne{constructor(t){this.openModal=z.open,this.closeModal=z.close,this.subscribeModal=z.subscribe,this.setTheme=Z.setThemeConfig,Z.setThemeConfig(t),U.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(()=>require("./index-Coqx-ZYc.js"));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),y.setIsUiLoaded(!0)}}}const Te=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ne},Symbol.toStringTag,{value:"Module"}));exports.R=ue;exports.T=ee;exports.a=u;exports.index=Te;exports.ne=Z;exports.oe=ke;exports.p=y;exports.se=z;exports.te=Me;exports.y=U;
|
|
1
|
+
"use strict";const me=Symbol(),se=Object.getPrototypeOf,G=new WeakMap,he=e=>e&&(G.has(e)?G.get(e):se(e)===Object.prototype||se(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,ne=(e,t=!0)=>{G.set(e,t)},H={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,REACT_APP_CONNECT_GIT_HASH:"a9b55ee355e1e6aea197683969dec20272e1f8d2",REACT_APP_CONNECT_VERSION:"1.0.0-beta.4-development",SSR:!1},F=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,g)=>new Proxy(n,g),s=n=>F(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,g,I=r)=>{const v=l.get(n);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return ne(w,!0),l.set(n,[g,w]),Reflect.ownKeys(n).forEach(_=>{if(Object.getOwnPropertyDescriptor(w,_))return;const L=Reflect.get(n,_),M={value:L,enumerable:!0,configurable:!0};if(x.has(L))ne(L,!1);else if(L instanceof Promise)delete M.value,M.get=()=>I(L);else if(A.has(L)){const[b,q]=A.get(L);M.value=c(b,q(),I)}Object.defineProperty(w,_,M)}),Object.preventExtensions(w)},m=new WeakMap,f=[1,1],W=n=>{if(!F(n))throw new Error("object required");const g=m.get(n);if(g)return g;let I=f[0];const v=new Set,w=(a,i=++f[0])=>{I!==i&&(I=i,v.forEach(o=>o(a,i)))};let _=f[1];const L=(a=++f[1])=>(_!==a&&!v.size&&(_=a,b.forEach(([i])=>{const o=i[1](a);o>I&&(I=o)})),I),M=a=>(i,o)=>{const h=[...i];h[1]=[a,...h[1]],w(h,o)},b=new Map,q=(a,i)=>{if((H?"production":void 0)!=="production"&&b.has(a))throw new Error("prop listener already exists");if(v.size){const o=i[3](M(a));b.set(a,[i,o])}else b.set(a,[i])},te=a=>{var i;const o=b.get(a);o&&(b.delete(a),(i=o[1])==null||i.call(o))},pe=a=>(v.add(a),v.size===1&&b.forEach(([o,h],k)=>{if((H?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const T=o[3](M(k));b.set(k,[o,T])}),()=>{v.delete(a),v.size===0&&b.forEach(([o,h],k)=>{h&&(h(),b.set(k,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(a,i){const o=Reflect.get(a,i);te(i);const h=Reflect.deleteProperty(a,i);return h&&w(["delete",[i],o]),h},set(a,i,o,h){const k=Reflect.has(a,i),T=Reflect.get(a,i,h);if(k&&(e(T,o)||m.has(o)&&e(T,m.get(o))))return!0;te(i),F(o)&&(o=ge(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,w(["resolve",[i],C])}).catch(C=>{o.status="rejected",o.reason=C,w(["reject",[i],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&q(i,C)}return Reflect.set(a,i,V,h),w(["set",[i],o,T]),!0}});m.set(n,$);const fe=[J,L,c,pe];return A.set($,fe),Reflect.ownKeys(n).forEach(a=>{const i=Object.getOwnPropertyDescriptor(n,a);"value"in i&&($[a]=n[a],delete i.value,delete i.writable),Object.defineProperty(J,a,i)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(H?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(H?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ee={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},u={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return u.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return u.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(u.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!u.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(u.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(u.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ee.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),ue={state:p,subscribe(e){return D(p.events,()=>e(ve(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},E=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),y={state:E,subscribe(e){return D(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),U={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;ue.initialize(),y.setChains(e.chains),y.setIsAuth(!!e.enableAuthMode),y.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),y.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),u.setModalVersionInStorage(),Object.assign(B,e)}};var Ie=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Le=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Oe.call(t,s)&&re(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=Le({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",U.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const P={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${U.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${U.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var We=Object.defineProperty,ie=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,ae=(e,t,s)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&ae(e,s,t[s]);if(ie)for(var s of ie(t))Ae.call(t,s)&&ae(e,s,t[s]);return e};const le=u.isMobile(),O=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Me={state:O,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=U.state;if(e==="NONE"||t==="ALL"&&!e)return O.recomendedWallets;if(u.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await P.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),O.recomendedWallets=l}else{const{chains:s,isAuth:r}=y.state,l=s==null?void 0:s.join(","),c=u.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:u.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=le?await P.getMobileListings(m):await P.getDesktopListings(m);O.recomendedWallets=Object.values(f)}return O.recomendedWallets},async getWallets(e){const t=je({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=U.state,{recomendedWallets:l}=O;if(r==="ALL")return O.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):u.isArray(s)&&(t.excludedIds=s.join(",")),u.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),y.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=le?await P.getMobileListings(t):await P.getDesktopListings(t),n=Object.values(f),g=m?"search":"wallets";return O[g]={listings:[...O[g].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return P.getWalletImageUrl(e)},getAssetImageUrl(e){return P.getAssetImageUrl(e)},resetSearch(){O.search={listings:[],total:0,page:1}}},N=j({open:!1}),z={state:N,subscribe(e){return D(N,()=>e(N))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=y.state;if(u.removeWalletConnectDeepLink(),y.setWalletConnectUri(e==null?void 0:e.uri),y.setChains(e==null?void 0:e.chains),ee.reset("ConnectWallet"),s&&r)N.open=!0,t();else{const l=setInterval(()=>{const c=y.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),N.open=!0,t())},200)}})},close(){N.open=!1}};var Pe=Object.defineProperty,ce=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,de=(e,t,s)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&de(e,s,t[s]);if(ce)for(var s of ce(t))Ue.call(t,s)&&de(e,s,t[s]);return e};function _e(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const R=j({themeMode:_e()?"dark":"light"}),Z={state:R,subscribe(e){return D(R,()=>e(R))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(R.themeMode=t),s&&(R.themeVariables=De({},s))}},S=j({open:!1,message:"",variant:"success"}),ke={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Ne{constructor(t){this.openModal=z.open,this.closeModal=z.close,this.subscribeModal=z.subscribe,this.setTheme=Z.setThemeConfig,Z.setThemeConfig(t),U.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(()=>require("./index-C_JBf5AE.js"));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),y.setIsUiLoaded(!0)}}}const Te=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ne},Symbol.toStringTag,{value:"Module"}));exports.R=ue;exports.T=ee;exports.a=u;exports.index=Te;exports.ne=Z;exports.oe=ke;exports.p=y;exports.se=z;exports.te=Me;exports.y=U;
|