gogo-movement-starter
Version:
GOGO Movement Network React Starter Template - Complete React + Vite + Move contracts setup
1,458 lines • 2.39 MB
JavaScript
import * as q from "react";
import wi, { createContext as sv, useState as jt, useContext as ov, useEffect as JA, useCallback as Ms } from "react";
import * as av from "react-dom";
import cp from "react-dom";
function cv(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var Eu = { exports: {} }, Oo = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var OA;
function uv() {
if (OA) return Oo;
OA = 1;
var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
function r(n, i, s) {
var o = null;
if (s !== void 0 && (o = "" + s), i.key !== void 0 && (o = "" + i.key), "key" in i) {
s = {};
for (var a in i)
a !== "key" && (s[a] = i[a]);
} else s = i;
return i = s.ref, {
$$typeof: t,
type: n,
key: o,
ref: i !== void 0 ? i : null,
props: s
};
}
return Oo.Fragment = e, Oo.jsx = r, Oo.jsxs = r, Oo;
}
var Ro = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var RA;
function lv() {
return RA || (RA = 1, process.env.NODE_ENV !== "production" && function() {
function t(k) {
if (k == null) return null;
if (typeof k == "function")
return k.$$typeof === H ? null : k.displayName || k.name || null;
if (typeof k == "string") return k;
switch (k) {
case A:
return "Fragment";
case C:
return "Profiler";
case w:
return "StrictMode";
case B:
return "Suspense";
case T:
return "SuspenseList";
case D:
return "Activity";
}
if (typeof k == "object")
switch (typeof k.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), k.$$typeof) {
case g:
return "Portal";
case U:
return (k.displayName || "Context") + ".Provider";
case v:
return (k._context.displayName || "Context") + ".Consumer";
case L:
var Y = k.render;
return k = k.displayName, k || (k = Y.displayName || Y.name || "", k = k !== "" ? "ForwardRef(" + k + ")" : "ForwardRef"), k;
case N:
return Y = k.displayName || null, Y !== null ? Y : t(k.type) || "Memo";
case Q:
Y = k._payload, k = k._init;
try {
return t(k(Y));
} catch {
}
}
return null;
}
function e(k) {
return "" + k;
}
function r(k) {
try {
e(k);
var Y = !1;
} catch {
Y = !0;
}
if (Y) {
Y = console;
var R = Y.error, ee = typeof Symbol == "function" && Symbol.toStringTag && k[Symbol.toStringTag] || k.constructor.name || "Object";
return R.call(
Y,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
ee
), e(k);
}
}
function n(k) {
if (k === A) return "<>";
if (typeof k == "object" && k !== null && k.$$typeof === Q)
return "<...>";
try {
var Y = t(k);
return Y ? "<" + Y + ">" : "<...>";
} catch {
return "<...>";
}
}
function i() {
var k = K.A;
return k === null ? null : k.getOwner();
}
function s() {
return Error("react-stack-top-frame");
}
function o(k) {
if (S.call(k, "key")) {
var Y = Object.getOwnPropertyDescriptor(k, "key").get;
if (Y && Y.isReactWarning) return !1;
}
return k.key !== void 0;
}
function a(k, Y) {
function R() {
m || (m = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
Y
));
}
R.isReactWarning = !0, Object.defineProperty(k, "key", {
get: R,
configurable: !0
});
}
function c() {
var k = t(this.type);
return M[k] || (M[k] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), k = this.props.ref, k !== void 0 ? k : null;
}
function u(k, Y, R, ee, re, $, se, V) {
return R = $.ref, k = {
$$typeof: p,
type: k,
key: Y,
props: $,
_owner: re
}, (R !== void 0 ? R : null) !== null ? Object.defineProperty(k, "ref", {
enumerable: !1,
get: c
}) : Object.defineProperty(k, "ref", { enumerable: !1, value: null }), k._store = {}, Object.defineProperty(k._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(k, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(k, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: se
}), Object.defineProperty(k, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: V
}), Object.freeze && (Object.freeze(k.props), Object.freeze(k)), k;
}
function l(k, Y, R, ee, re, $, se, V) {
var X = Y.children;
if (X !== void 0)
if (ee)
if (E(X)) {
for (ee = 0; ee < X.length; ee++)
f(X[ee]);
Object.freeze && Object.freeze(X);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else f(X);
if (S.call(Y, "key")) {
X = t(k);
var Z = Object.keys(Y).filter(function(ie) {
return ie !== "key";
});
ee = 0 < Z.length ? "{key: someKey, " + Z.join(": ..., ") + ": ...}" : "{key: someKey}", J[X + ee] || (Z = 0 < Z.length ? "{" + Z.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
ee,
X,
Z,
X
), J[X + ee] = !0);
}
if (X = null, R !== void 0 && (r(R), X = "" + R), o(Y) && (r(Y.key), X = "" + Y.key), "key" in Y) {
R = {};
for (var te in Y)
te !== "key" && (R[te] = Y[te]);
} else R = Y;
return X && a(
R,
typeof k == "function" ? k.displayName || k.name || "Unknown" : k
), u(
k,
X,
$,
re,
i(),
R,
se,
V
);
}
function f(k) {
typeof k == "object" && k !== null && k.$$typeof === p && k._store && (k._store.validated = 1);
}
var d = wi, p = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), w = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), v = Symbol.for("react.consumer"), U = Symbol.for("react.context"), L = Symbol.for("react.forward_ref"), B = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), N = Symbol.for("react.memo"), Q = Symbol.for("react.lazy"), D = Symbol.for("react.activity"), H = Symbol.for("react.client.reference"), K = d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, S = Object.prototype.hasOwnProperty, E = Array.isArray, b = console.createTask ? console.createTask : function() {
return null;
};
d = {
react_stack_bottom_frame: function(k) {
return k();
}
};
var m, M = {}, G = d.react_stack_bottom_frame.bind(
d,
s
)(), F = b(n(s)), J = {};
Ro.Fragment = A, Ro.jsx = function(k, Y, R, ee, re) {
var $ = 1e4 > K.recentlyCreatedOwnerStacks++;
return l(
k,
Y,
R,
!1,
ee,
re,
$ ? Error("react-stack-top-frame") : G,
$ ? b(n(k)) : F
);
}, Ro.jsxs = function(k, Y, R, ee, re) {
var $ = 1e4 > K.recentlyCreatedOwnerStacks++;
return l(
k,
Y,
R,
!0,
ee,
re,
$ ? Error("react-stack-top-frame") : G,
$ ? b(n(k)) : F
);
};
}()), Ro;
}
var PA;
function fv() {
return PA || (PA = 1, process.env.NODE_ENV === "production" ? Eu.exports = uv() : Eu.exports = lv()), Eu.exports;
}
var z = fv(), e0 = {
color: void 0,
size: void 0,
className: void 0,
style: void 0,
attr: void 0
}, jA = wi.createContext && /* @__PURE__ */ wi.createContext(e0), dv = ["attr", "size", "title"];
function hv(t, e) {
if (t == null) return {};
var r = gv(t, e), n, i;
if (Object.getOwnPropertySymbols) {
var s = Object.getOwnPropertySymbols(t);
for (i = 0; i < s.length; i++)
n = s[i], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(t, n) && (r[n] = t[n]);
}
return r;
}
function gv(t, e) {
if (t == null) return {};
var r = {};
for (var n in t)
if (Object.prototype.hasOwnProperty.call(t, n)) {
if (e.indexOf(n) >= 0) continue;
r[n] = t[n];
}
return r;
}
function ff() {
return ff = Object.assign ? Object.assign.bind() : function(t) {
for (var e = 1; e < arguments.length; e++) {
var r = arguments[e];
for (var n in r)
Object.prototype.hasOwnProperty.call(r, n) && (t[n] = r[n]);
}
return t;
}, ff.apply(this, arguments);
}
function qA(t, e) {
var r = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(t);
e && (n = n.filter(function(i) {
return Object.getOwnPropertyDescriptor(t, i).enumerable;
})), r.push.apply(r, n);
}
return r;
}
function df(t) {
for (var e = 1; e < arguments.length; e++) {
var r = arguments[e] != null ? arguments[e] : {};
e % 2 ? qA(Object(r), !0).forEach(function(n) {
pv(t, n, r[n]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : qA(Object(r)).forEach(function(n) {
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
});
}
return t;
}
function pv(t, e, r) {
return e = Av(e), e in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
}
function Av(t) {
var e = yv(t, "string");
return typeof e == "symbol" ? e : e + "";
}
function yv(t, e) {
if (typeof t != "object" || !t) return t;
var r = t[Symbol.toPrimitive];
if (r !== void 0) {
var n = r.call(t, e);
if (typeof n != "object") return n;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (e === "string" ? String : Number)(t);
}
function t0(t) {
return t && t.map((e, r) => /* @__PURE__ */ wi.createElement(e.tag, df({
key: r
}, e.attr), t0(e.child)));
}
function Co(t) {
return (e) => /* @__PURE__ */ wi.createElement(wv, ff({
attr: df({}, t.attr)
}, e), t0(t.child));
}
function wv(t) {
var e = (r) => {
var {
attr: n,
size: i,
title: s
} = t, o = hv(t, dv), a = i || r.size || "1em", c;
return r.className && (c = r.className), t.className && (c = (c ? c + " " : "") + t.className), /* @__PURE__ */ wi.createElement("svg", ff({
stroke: "currentColor",
fill: "currentColor",
strokeWidth: "0"
}, r.attr, n, o, {
className: c,
style: df(df({
color: t.color || r.color
}, r.style), t.style),
height: a,
width: a,
xmlns: "http://www.w3.org/2000/svg"
}), s && /* @__PURE__ */ wi.createElement("title", null, s), t.children);
};
return jA !== void 0 ? /* @__PURE__ */ wi.createElement(jA.Consumer, null, (r) => e(r)) : e(e0);
}
function r0(t) {
return Co({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z" }, child: [] }] })(t);
}
function Ev(t) {
return Co({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z" }, child: [] }] })(t);
}
function mv(t) {
return Co({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z" }, child: [] }] })(t);
}
function Iv(t) {
return Co({ attr: { viewBox: "0 0 352 512" }, child: [{ tag: "path", attr: { d: "M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" }, child: [] }] })(t);
}
function n0(t) {
return Co({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z" }, child: [] }] })(t);
}
function bv(t) {
return Co({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M461.2 128H80c-8.84 0-16-7.16-16-16s7.16-16 16-16h384c8.84 0 16-7.16 16-16 0-26.51-21.49-48-48-48H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h397.2c28.02 0 50.8-21.53 50.8-48V176c0-26.47-22.78-48-50.8-48zM416 336c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z" }, child: [] }] })(t);
}
var Bv = Object.defineProperty, i0 = (t) => {
throw TypeError(t);
}, Cv = (t, e, r) => e in t ? Bv(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Gh = (t, e, r) => Cv(t, typeof e != "symbol" ? e + "" : e, r), s0 = (t, e, r) => e.has(t) || i0("Cannot " + r), ir = (t, e, r) => (s0(t, e, "read from private field"), r ? r.call(t) : e.get(t)), to = (t, e, r) => e.has(t) ? i0("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), Vr = (t, e, r, n) => (s0(t, e, "write to private field"), e.set(t, r), r), o0 = class {
constructor() {
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
}
subscribe(e) {
return this.listeners.add(e), this.onSubscribe(), () => {
this.listeners.delete(e), this.onUnsubscribe();
};
}
hasListeners() {
return this.listeners.size > 0;
}
onSubscribe() {
}
onUnsubscribe() {
}
}, a0 = typeof window > "u" || "Deno" in globalThis, Ds, Ti, Po, WA, Uv = (WA = class extends o0 {
constructor() {
super(), to(this, Ds), to(this, Ti), to(this, Po), Vr(this, Po, (t) => {
if (!a0 && window.addEventListener) {
const e = () => t();
return window.addEventListener("visibilitychange", e, !1), () => {
window.removeEventListener("visibilitychange", e);
};
}
});
}
onSubscribe() {
ir(this, Ti) || this.setEventListener(ir(this, Po));
}
onUnsubscribe() {
var t;
this.hasListeners() || ((t = ir(this, Ti)) == null || t.call(this), Vr(this, Ti, void 0));
}
setEventListener(t) {
var e;
Vr(this, Po, t), (e = ir(this, Ti)) == null || e.call(this), Vr(this, Ti, t((r) => {
typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
}));
}
setFocused(t) {
ir(this, Ds) !== t && (Vr(this, Ds, t), this.onFocus());
}
onFocus() {
const t = this.isFocused();
this.listeners.forEach((e) => {
e(t);
});
}
isFocused() {
return typeof ir(this, Ds) == "boolean" ? ir(this, Ds) : globalThis.document?.visibilityState !== "hidden";
}
}, Ds = /* @__PURE__ */ new WeakMap(), Ti = /* @__PURE__ */ new WeakMap(), Po = /* @__PURE__ */ new WeakMap(), WA);
new Uv();
var jo, zi, qo, VA, vv = (VA = class extends o0 {
constructor() {
super(), to(this, jo, !0), to(this, zi), to(this, qo), Vr(this, qo, (t) => {
if (!a0 && window.addEventListener) {
const e = () => t(!0), r = () => t(!1);
return window.addEventListener("online", e, !1), window.addEventListener("offline", r, !1), () => {
window.removeEventListener("online", e), window.removeEventListener("offline", r);
};
}
});
}
onSubscribe() {
ir(this, zi) || this.setEventListener(ir(this, qo));
}
onUnsubscribe() {
var t;
this.hasListeners() || ((t = ir(this, zi)) == null || t.call(this), Vr(this, zi, void 0));
}
setEventListener(t) {
var e;
Vr(this, qo, t), (e = ir(this, zi)) == null || e.call(this), Vr(this, zi, t(this.setOnline.bind(this)));
}
setOnline(t) {
ir(this, jo) !== t && (Vr(this, jo, t), this.listeners.forEach((e) => {
e(t);
}));
}
isOnline() {
return ir(this, jo);
}
}, jo = /* @__PURE__ */ new WeakMap(), zi = /* @__PURE__ */ new WeakMap(), qo = /* @__PURE__ */ new WeakMap(), VA);
new vv();
q.createContext(
void 0
);
var Mv = q.createContext(!1);
Mv.Provider;
function Dv() {
let t = !1;
return {
clearReset: () => {
t = !1;
},
reset: () => {
t = !0;
},
isReset: () => t
};
}
q.createContext(Dv());
var dr = class extends Error {
constructor(t, e) {
super(t), this.invalidReason = e;
}
};
const Ls = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
function qf(t) {
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
}
function oc(t) {
if (!Number.isSafeInteger(t) || t < 0)
throw new Error("positive integer expected, got " + t);
}
function at(t, ...e) {
if (!qf(t))
throw new Error("Uint8Array expected");
if (e.length > 0 && !e.includes(t.length))
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
}
function Lv(t) {
if (typeof t != "function" || typeof t.create != "function")
throw new Error("Hash should be wrapped by utils.createHasher");
oc(t.outputLen), oc(t.blockLen);
}
function so(t, e = !0) {
if (t.destroyed)
throw new Error("Hash instance has been destroyed");
if (e && t.finished)
throw new Error("Hash#digest() has already been called");
}
function c0(t, e) {
at(t);
const r = e.outputLen;
if (t.length < r)
throw new Error("digestInto() expects output buffer of length at least " + r);
}
function kv(t) {
return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
}
function Ui(...t) {
for (let e = 0; e < t.length; e++)
t[e].fill(0);
}
function vd(t) {
return new DataView(t.buffer, t.byteOffset, t.byteLength);
}
function Nr(t, e) {
return t << 32 - e | t >>> e;
}
const Gv = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
function Kv(t) {
return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
}
function Fv(t) {
for (let e = 0; e < t.length; e++)
t[e] = Kv(t[e]);
return t;
}
const XA = Gv ? (t) => t : Fv, u0 = (
/* @ts-ignore */
typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function"
), Sv = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
function $r(t) {
if (at(t), u0)
return t.toHex();
let e = "";
for (let r = 0; r < t.length; r++)
e += Sv[t[r]];
return e;
}
const dn = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
function ZA(t) {
if (t >= dn._0 && t <= dn._9)
return t - dn._0;
if (t >= dn.A && t <= dn.F)
return t - (dn.A - 10);
if (t >= dn.a && t <= dn.f)
return t - (dn.a - 10);
}
function xc(t) {
if (typeof t != "string")
throw new Error("hex string expected, got " + typeof t);
if (u0)
return Uint8Array.fromHex(t);
const e = t.length, r = e / 2;
if (e % 2)
throw new Error("hex string expected, got unpadded hex of length " + e);
const n = new Uint8Array(r);
for (let i = 0, s = 0; i < r; i++, s += 2) {
const o = ZA(t.charCodeAt(s)), a = ZA(t.charCodeAt(s + 1));
if (o === void 0 || a === void 0) {
const c = t[s] + t[s + 1];
throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + s);
}
n[i] = o * 16 + a;
}
return n;
}
function Wf(t) {
if (typeof t != "string")
throw new Error("string expected");
return new Uint8Array(new TextEncoder().encode(t));
}
function Vf(t) {
return typeof t == "string" && (t = Wf(t)), at(t), t;
}
function st(...t) {
let e = 0;
for (let n = 0; n < t.length; n++) {
const i = t[n];
at(i), e += i.length;
}
const r = new Uint8Array(e);
for (let n = 0, i = 0; n < t.length; n++) {
const s = t[n];
r.set(s, i), i += s.length;
}
return r;
}
let up = class {
};
function lp(t) {
const e = (n) => t().update(Vf(n)).digest(), r = t();
return e.outputLen = r.outputLen, e.blockLen = r.blockLen, e.create = () => t(), e;
}
function Xf(t = 32) {
if (Ls && typeof Ls.getRandomValues == "function")
return Ls.getRandomValues(new Uint8Array(t));
if (Ls && typeof Ls.randomBytes == "function")
return Uint8Array.from(Ls.randomBytes(t));
throw new Error("crypto.getRandomValues must be defined");
}
var xv = ((t) => (t.TOO_SHORT = "too_short", t.INVALID_LENGTH = "invalid_length", t.INVALID_HEX_CHARS = "invalid_hex_chars", t))(xv || {}), oe = class ni {
constructor(e) {
this.data = e;
}
toUint8Array() {
return this.data;
}
toStringWithoutPrefix() {
return $r(this.data);
}
toString() {
return `0x${this.toStringWithoutPrefix()}`;
}
static fromHexString(e) {
let r = e;
if (r.startsWith("0x") && (r = r.slice(2)), r.length === 0) throw new dr("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.", "too_short");
if (r.length % 2 !== 0) throw new dr("Hex string must be an even number of hex characters.", "invalid_length");
try {
return new ni(xc(r));
} catch (n) {
throw new dr(`Hex string contains invalid hex characters: ${n?.message}`, "invalid_hex_chars");
}
}
static fromHexInput(e) {
return e instanceof Uint8Array ? new ni(e) : ni.fromHexString(e);
}
static hexInputToUint8Array(e) {
return e instanceof Uint8Array ? e : ni.fromHexString(e).toUint8Array();
}
static hexInputToString(e) {
return ni.fromHexInput(e).toString();
}
static hexInputToStringWithoutPrefix(e) {
return ni.fromHexInput(e).toStringWithoutPrefix();
}
static isValid(e) {
try {
return ni.fromHexString(e), { valid: !0 };
} catch (r) {
return { valid: !1, invalidReason: r?.invalidReason, invalidReasonMessage: r?.message };
}
}
equals(e) {
return this.data.length !== e.data.length ? !1 : this.data.every((r, n) => r === e.data[n]);
}
}, Hv = (t) => new TextDecoder().decode(oe.fromHexInput(t).toUint8Array()), l0 = 255, f0 = 65535, oo = 4294967295, Zf = 18446744073709551615n, fp = 340282366920938463463374607431768211455n, d0 = 115792089237316195423570985008687907853269984665640564039457584007913129639935n, Nv = Object.defineProperty, Tv = Object.getOwnPropertyDescriptor, Mr = (t, e, r, n) => {
for (var i = Tv(e, r), s = t.length - 1, o; s >= 0; s--) (o = t[s]) && (i = o(e, r, i) || i);
return i && Nv(e, r, i), i;
}, fe = class {
bcsToBytes() {
let e = new ht();
return this.serialize(e), e.toUint8Array();
}
bcsToHex() {
let e = this.bcsToBytes();
return oe.fromHexInput(e);
}
toStringWithoutPrefix() {
return this.bcsToHex().toStringWithoutPrefix();
}
toString() {
return `0x${this.toStringWithoutPrefix()}`;
}
}, ht = class {
constructor(t = 64) {
if (t <= 0) throw new Error("Length needs to be greater than 0");
this.buffer = new ArrayBuffer(t), this.offset = 0;
}
ensureBufferWillHandleSize(t) {
for (; this.buffer.byteLength < this.offset + t; ) {
let e = new ArrayBuffer(this.buffer.byteLength * 2);
new Uint8Array(e).set(new Uint8Array(this.buffer)), this.buffer = e;
}
}
appendToBuffer(t) {
this.ensureBufferWillHandleSize(t.length), new Uint8Array(this.buffer, this.offset).set(t), this.offset += t.length;
}
serializeWithFunction(t, e, r) {
this.ensureBufferWillHandleSize(e);
let n = new DataView(this.buffer, this.offset);
t.apply(n, [0, r, !0]), this.offset += e;
}
serializeStr(t) {
let e = new TextEncoder();
this.serializeBytes(e.encode(t));
}
serializeBytes(t) {
this.serializeU32AsUleb128(t.length), this.appendToBuffer(t);
}
serializeFixedBytes(t) {
this.appendToBuffer(t);
}
serializeBool(t) {
h0(t);
let e = t ? 1 : 0;
this.appendToBuffer(new Uint8Array([e]));
}
serializeU8(t) {
this.appendToBuffer(new Uint8Array([t]));
}
serializeU16(t) {
this.serializeWithFunction(DataView.prototype.setUint16, 2, t);
}
serializeU32(t) {
this.serializeWithFunction(DataView.prototype.setUint32, 4, t);
}
serializeU64(t) {
let e = BigInt(t) & BigInt(oo), r = BigInt(t) >> BigInt(32);
this.serializeU32(Number(e)), this.serializeU32(Number(r));
}
serializeU128(t) {
let e = BigInt(t) & Zf, r = BigInt(t) >> BigInt(64);
this.serializeU64(e), this.serializeU64(r);
}
serializeU256(t) {
let e = BigInt(t) & fp, r = BigInt(t) >> BigInt(128);
this.serializeU128(e), this.serializeU128(r);
}
serializeU32AsUleb128(t) {
let e = t, r = [];
for (; e >>> 7; ) r.push(e & 127 | 128), e >>>= 7;
r.push(e), this.appendToBuffer(new Uint8Array(r));
}
toUint8Array() {
return new Uint8Array(this.buffer).slice(0, this.offset);
}
serialize(t) {
t.serialize(this);
}
serializeVector(t) {
this.serializeU32AsUleb128(t.length), t.forEach((e) => {
e.serialize(this);
});
}
serializeOption(t, e) {
let r = t !== void 0;
this.serializeBool(r), r && (typeof t == "string" ? this.serializeStr(t) : t instanceof Uint8Array ? e !== void 0 ? this.serializeFixedBytes(t) : this.serializeBytes(t) : t.serialize(this));
}
serializeOptionStr(t) {
t === void 0 ? this.serializeU32AsUleb128(0) : (this.serializeU32AsUleb128(1), this.serializeStr(t));
}
};
Mr([Qi(0, l0)], ht.prototype, "serializeU8"), Mr([Qi(0, f0)], ht.prototype, "serializeU16"), Mr([Qi(0, oo)], ht.prototype, "serializeU32"), Mr([Qi(BigInt(0), Zf)], ht.prototype, "serializeU64"), Mr([Qi(BigInt(0), fp)], ht.prototype, "serializeU128"), Mr([Qi(BigInt(0), d0)], ht.prototype, "serializeU256"), Mr([Qi(0, oo)], ht.prototype, "serializeU32AsUleb128");
function h0(t) {
if (typeof t != "boolean") throw new Error(`${t} is not a boolean value`);
}
var zv = (t, e, r) => `${t} is out of range: [${e}, ${r}]`;
function bs(t, e, r) {
let n = BigInt(t);
if (n > BigInt(r) || n < BigInt(e)) throw new Error(zv(t, e, r));
}
function Qi(t, e) {
return (r, n, i) => {
let s = i.value;
return i.value = function(o) {
return bs(o, t, e), s.apply(this, [o]);
}, i;
};
}
var Qv = ((t) => (t.INCORRECT_NUMBER_OF_BYTES = "incorrect_number_of_bytes", t.INVALID_HEX_CHARS = "invalid_hex_chars", t.TOO_SHORT = "too_short", t.TOO_LONG = "too_long", t.LEADING_ZERO_X_REQUIRED = "leading_zero_x_required", t.LONG_FORM_REQUIRED_UNLESS_SPECIAL = "long_form_required_unless_special", t.INVALID_PADDING_ZEROES = "INVALID_PADDING_ZEROES", t.INVALID_PADDING_STRICTNESS = "INVALID_PADDING_STRICTNESS", t))(Qv || {}), Nt = class rr extends fe {
constructor(e) {
if (super(), e.length !== rr.LENGTH) throw new dr("AccountAddress data should be exactly 32 bytes long", "incorrect_number_of_bytes");
this.data = e;
}
isSpecial() {
return this.data.slice(0, this.data.length - 1).every((e) => e === 0) && this.data[this.data.length - 1] < 16;
}
toString() {
return `0x${this.toStringWithoutPrefix()}`;
}
toStringWithoutPrefix() {
let e = $r(this.data);
return this.isSpecial() && (e = e[e.length - 1]), e;
}
toStringLong() {
return `0x${this.toStringLongWithoutPrefix()}`;
}
toStringLongWithoutPrefix() {
return $r(this.data);
}
toStringShort() {
return `0x${this.toStringShortWithoutPrefix()}`;
}
toStringShortWithoutPrefix() {
let e = $r(this.data).replace(/^0+/, "");
return e === "" ? "0" : e;
}
toUint8Array() {
return this.data;
}
serialize(e) {
e.serializeFixedBytes(this.data);
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
e.serializeU32AsUleb128(3), e.serialize(this);
}
static deserialize(e) {
let r = e.deserializeFixedBytes(rr.LENGTH);
return new rr(r);
}
static fromStringStrict(e) {
if (!e.startsWith("0x")) throw new dr("Hex string must start with a leading 0x.", "leading_zero_x_required");
let r = rr.fromString(e);
if (e.length !== rr.LONG_STRING_LENGTH + 2) if (r.isSpecial()) {
if (e.length !== 3) throw new dr(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`, "INVALID_PADDING_ZEROES");
} else throw new dr(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`, "long_form_required_unless_special");
return r;
}
static fromString(e, { maxMissingChars: r = 4 } = {}) {
let n = e;
if (e.startsWith("0x") && (n = e.slice(2)), n.length === 0) throw new dr("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.", "too_short");
if (n.length > 64) throw new dr("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.", "too_long");
if (r > 63 || r < 0) throw new dr(`maxMissingChars must be between or equal to 0 and 63. Received ${r}`, "INVALID_PADDING_STRICTNESS");
let i;
try {
i = xc(n.padStart(64, "0"));
} catch (o) {
throw new dr(`Hex characters are invalid: ${o?.message}`, "invalid_hex_chars");
}
let s = new rr(i);
if (n.length < 64 - r && !s.isSpecial()) throw new dr(`Hex string is too short, must be ${64 - r} to 64 chars long, excluding the leading 0x. You may need to fix
the addresss by padding it with 0s before passing it to \`fromString\` (e.g. <addressString>.padStart(64, '0')).
Received ${e}`, "too_short");
return s;
}
static from(e, { maxMissingChars: r = 4 } = {}) {
return typeof e == "string" ? rr.fromString(e, { maxMissingChars: r }) : e instanceof Uint8Array ? new rr(e) : e;
}
static fromStrict(e) {
return typeof e == "string" ? rr.fromStringStrict(e) : e instanceof Uint8Array ? new rr(e) : e;
}
static isValid(e) {
try {
return e.strict ? rr.fromStrict(e.input) : rr.from(e.input), { valid: !0 };
} catch (r) {
return { valid: !1, invalidReason: r?.invalidReason, invalidReasonMessage: r?.message };
}
}
equals(e) {
return this.data.length !== e.data.length ? !1 : this.data.every((r, n) => r === e.data[n]);
}
};
Nt.LENGTH = 32, Nt.LONG_STRING_LENGTH = 64, Nt.ZERO = Nt.from("0x0"), Nt.ONE = Nt.from("0x1"), Nt.TWO = Nt.from("0x2"), Nt.THREE = Nt.from("0x3"), Nt.FOUR = Nt.from("0x4"), Nt.A = Nt.from("0xA");
var P = Nt, Bt = class g0 extends fe {
constructor(e) {
super(), h0(e), this.value = e;
}
serialize(e) {
e.serializeBool(this.value);
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
e.serializeU32AsUleb128(5), e.serialize(this);
}
deserialize(e) {
return new Uo(e.deserializeU256());
}
static deserialize(e) {
return new g0(e.deserializeBool());
}
}, xn = class p0 extends fe {
constructor(e) {
super(), bs(e, 0, l0), this.value = e;
}
serialize(e) {
e.serializeU8(this.value);
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
e.serializeU32AsUleb128(0), e.serialize(this);
}
static deserialize(e) {
return new p0(e.deserializeU8());
}
}, Hc = class A0 extends fe {
constructor(e) {
super(), bs(e, 0, f0), this.value = e;
}
serialize(e) {
e.serializeU16(this.value);
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
e.serializeU32AsUleb128(6), e.serialize(this);
}
static deserialize(e) {
return new A0(e.deserializeU16());
}
}, Nc = class y0 extends fe {
constructor(e) {
super(), bs(e, 0, oo), this.value = e;
}
serialize(e) {
e.serializeU32(this.value);
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
e.serializeU32AsUleb128(7), e.serialize(this);
}
static deserialize(e) {
return new y0(e.deserializeU32());
}
}, Gr = class w0 extends fe {
constructor(e) {
super(), bs(e, BigInt(0), Zf), this.value = BigInt(e);
}
serialize(e) {
e.serializeU64(this.value);
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
e.serializeU32AsUleb128(1), e.serialize(this);
}
static deserialize(e) {
return new w0(e.deserializeU64());
}
}, Tc = class E0 extends fe {
constructor(e) {
super(), bs(e, BigInt(0), fp), this.value = BigInt(e);
}
serialize(e) {
e.serializeU128(this.value);
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
e.serializeU32AsUleb128(2), e.serialize(this);
}
static deserialize(e) {
return new E0(e.deserializeU128());
}
}, Uo = class m0 extends fe {
constructor(e) {
super(), bs(e, BigInt(0), d0), this.value = BigInt(e);
}
serialize(e) {
e.serializeU256(this.value);
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
e.serializeU32AsUleb128(8), e.serialize(this);
}
static deserialize(e) {
return new m0(e.deserializeU256());
}
}, Sr = class I0 {
constructor(e) {
this.buffer = new ArrayBuffer(e.length), new Uint8Array(this.buffer).set(e, 0), this.offset = 0;
}
static fromHex(e) {
let r = oe.hexInputToUint8Array(e);
return new I0(r);
}
read(e) {
if (this.offset + e > this.buffer.byteLength) throw new Error("Reached to the end of buffer");
let r = this.buffer.slice(this.offset, this.offset + e);
return this.offset += e, r;
}
remaining() {
return this.buffer.byteLength - this.offset;
}
assertFinished() {
if (this.remaining() !== 0) throw new Error("Buffer has remaining bytes");
}
deserializeStr() {
let e = this.deserializeBytes();
return new TextDecoder().decode(e);
}
deserializeOptionStr() {
return this.deserializeOption("string");
}
deserializeOption(e, r) {
if (this.deserializeBool()) {
if (e === "string") return this.deserializeStr();
if (e === "bytes") return this.deserializeBytes();
if (e === "fixedBytes") {
if (r === void 0) throw new Error("Fixed bytes length not provided");
return this.deserializeFixedBytes(r);
}
return this.deserialize(e);
}
}
deserializeBytes() {
let e = this.deserializeUleb128AsU32();
return new Uint8Array(this.read(e));
}
deserializeFixedBytes(e) {
return new Uint8Array(this.read(e));
}
deserializeBool() {
let e = new Uint8Array(this.read(1))[0];
if (e !== 1 && e !== 0) throw new Error("Invalid boolean value");
return e === 1;
}
deserializeU8() {
return new DataView(this.read(1)).getUint8(0);
}
deserializeU16() {
return new DataView(this.read(2)).getUint16(0, !0);
}
deserializeU32() {
return new DataView(this.read(4)).getUint32(0, !0);
}
deserializeU64() {
let e = this.deserializeU32(), r = this.deserializeU32();
return BigInt(BigInt(r) << BigInt(32) | BigInt(e));
}
deserializeU128() {
let e = this.deserializeU64(), r = this.deserializeU64();
return BigInt(r << BigInt(64) | e);
}
deserializeU256() {
let e = this.deserializeU128(), r = this.deserializeU128();
return BigInt(r << BigInt(128) | e);
}
deserializeUleb128AsU32() {
let e = BigInt(0), r = 0;
for (; e < oo; ) {
let n = this.deserializeU8();
if (e |= BigInt(n & 127) << BigInt(r), (n & 128) === 0) break;
r += 7;
}
if (e > oo) throw new Error("Overflow while parsing uleb128-encoded uint32 value");
return Number(e);
}
deserialize(e) {
return e.deserialize(this);
}
deserializeVector(e) {
let r = this.deserializeUleb128AsU32(), n = new Array();
for (let i = 0; i < r; i += 1) n.push(this.deserialize(e));
return n;
}
}, ve = class Qr extends fe {
constructor(e) {
super(), this.values = e;
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
if (this.values[0] !== void 0 && !(this.values[0] instanceof xn)) {
new b0(this.bcsToBytes()).serializeForScriptFunction(e);
return;
}
e.serializeU32AsUleb128(4), e.serialize(this);
}
static U8(e) {
let r;
if (Array.isArray(e) && e.length === 0) r = [];
else if (Array.isArray(e) && typeof e[0] == "number") r = e;
else if (typeof e == "string") {
let n = oe.fromHexInput(e);
r = Array.from(n.toUint8Array());
} else if (e instanceof Uint8Array) r = Array.from(e);
else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");
return new Qr(r.map((n) => new xn(n)));
}
static U16(e) {
return new Qr(e.map((r) => new Hc(r)));
}
static U32(e) {
return new Qr(e.map((r) => new Nc(r)));
}
static U64(e) {
return new Qr(e.map((r) => new Gr(r)));
}
static U128(e) {
return new Qr(e.map((r) => new Tc(r)));
}
static U256(e) {
return new Qr(e.map((r) => new Uo(r)));
}
static Bool(e) {
return new Qr(e.map((r) => new Bt(r)));
}
static MoveString(e) {
return new Qr(e.map((r) => new Ye(r)));
}
serialize(e) {
e.serializeVector(this.values);
}
static deserialize(e, r) {
let n = e.deserializeUleb128AsU32(), i = new Array();
for (let s = 0; s < n; s += 1) i.push(r.deserialize(e));
return new Qr(i);
}
}, b0 = class B0 extends fe {
constructor(e) {
super(), this.value = oe.fromHexInput(e).toUint8Array();
}
serialize(e) {
e.serializeBytes(this.value);
}
serializeForEntryFunction(e) {
this.serialize(e);
}
serializeForScriptFunction(e) {
e.serializeU32AsUleb128(9), this.serialize(e);
}
static deserialize(e) {
return new B0(e.deserializeBytes());
}
toMoveVector(e) {
let r = new Sr(this.bcsToBytes());
r.deserializeUleb128AsU32();
let n = r.deserializeVector(e);
return new ve(n);
}
}, Ye = class C0 extends fe {
constructor(e) {
super(), this.value = e;
}
serialize(e) {
e.serializeStr(this.value);
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
serializeForScriptFunction(e) {
let r = new TextEncoder().encode(this.value);
ve.U8(r).serializeForScriptFunction(e);
}
static deserialize(e) {
return new C0(e.deserializeStr());
}
}, lr = class Yr extends fe {
constructor(e) {
super(), typeof e < "u" && e !== null ? this.vec = new ve([e]) : this.vec = new ve([]), [this.value] = this.vec.values;
}
serializeForEntryFunction(e) {
let r = this.bcsToBytes();
e.serializeBytes(r);
}
unwrap() {
if (this.isSome()) return this.vec.values[0];
throw new Error("Called unwrap on a MoveOption with no value");
}
isSome() {
return this.vec.values.length === 1;
}
serialize(e) {
this.vec.serialize(e);
}
static U8(e) {
return new Yr(e != null ? new xn(e) : void 0);
}
static U16(e) {
return new Yr(e != null ? new Hc(e) : void 0);
}
static U32(e) {
return new Yr(e != null ? new Nc(e) : void 0);
}
static U64(e) {
return new Yr(e != null ? new Gr(e) : void 0);
}
static U128(e) {
return new Yr(e != null ? new Tc(e) : void 0);
}
static U256(e) {
return new Yr(e != null ? new Uo(e) : void 0);
}
static Bool(e) {
return new Yr(e != null ? new Bt(e) : void 0);
}
static MoveString(e) {
return new Yr(e != null ? new Ye(e) : void 0);
}
static deserialize(e, r) {
let n = ve.deserialize(e, r);
return new Yr(n.values[0]);
}
}, Yv = class extends fe {
constructor(t) {
super(), this.accountAddress = P.ONE, this.moduleName = new Ye("account"), this.structName = new Ye("RotationProofChallenge"), this.sequenceNumber = new Gr(t.sequenceNumber), this.originator = t.originator, this.currentAuthKey = t.currentAuthKey, this.newPublicKey = ve.U8(t.newPublicKey.toUint8Array());
}
serialize(t) {
t.serialize(this.accountAddress), t.serialize(this.moduleName), t.serialize(this.structName), t.serialize(this.sequenceNumber), t.serialize(this.originator), t.serialize(this.currentAuthKey), t.serialize(this.newPublicKey);
}
}, Md = class {
constructor() {
this.queue = [], this.pendingDequeue = [], this.cancelled = !1;
}
enqueue(e) {
if (this.cancelled = !1, this.pendingDequeue.length > 0) {
this.pendingDequeue.shift()?.resolve(e);
return;
}
this.queue.push(e);
}
async dequeue() {
return this.queue.length > 0 ? Promise.resolve(this.queue.shift()) : new Promise((e, r) => {
this.pendingDequeue.push({ resolve: e, reject: r });
});
}
isEmpty() {
return this.queue.length === 0;
}
cancel() {
this.cancelled = !0, this.pendingDequeue.forEach(async ({ reject: e }) => {
e(new Kh("Task cancelled"));
}), this.pendingDequeue = [], this.queue.length = 0;
}
isCancelled() {
return this.cancelled;
}
pendingDequeueLength() {
return this.pendingDequeue.length;
}
}, Kh = class extends Error {
}, U0 = class v0 extends fe {
constructor(e) {
super(), this.chainId = e;
}
serialize(e) {
e.serializeU8(this.chainId);
}
static deserialize(e) {
let r = e.deserializeU8();
return new v0(r);
}
}, Vt = class M0 extends fe {
constructor(e) {
super(), this.identifier = e;
}
serialize(e) {
e.serializeStr(this.identifier);
}
static deserialize(e) {
let r = e.deserializeStr();
return new M0(r);
}
}, _f = (t) => typeof t == "string" ? oe.isValid(t).valid ? t : new TextEncoder().encode(t) : t;
let D0 = class extends up {
constructor(t, e) {
super(), this.finished = !1, this.destroyed = !1, Lv(t);
const r = Vf(e);
if (this.iHash = t.create(), typeof this.iHash.update != "function")
throw new Error("Expected instance of class which extends utils.Hash");
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
const n = this.blockLen, i = new Uint8Array(n);
i.set(r.length > n ? t.create().update(r).digest() : r);
for (let s = 0; s < i.length; s++)
i[s] ^= 54;
this.iHash.update(i), this.oHash = t.create();
for (let s = 0; s < i.length; s++)
i[s] ^= 106;
this.oHash.update(i), Ui(i);
}
update(t) {
return so(this), this.iHash.update(t), this;
}
digestInto(t) {
so(this), at(t, this.outputLen), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
}
digest() {
const t = new Uint8Array(this.oHash.outputLen);
return this.digestInto(t), t;
}
_cloneInto(t) {
t || (t = Object.create(Object.getPrototypeOf(this), {}));
const { oHash: e, iHash: r, finished: n, destroyed: i, blockLen: s, outputLen: o } = this;
return t = t, t.finished = n, t.destroyed = i, t.blockLen = s, t.outputLen = o, t.oHash = e._cloneInto(t.oHash), t.iHash = r._cloneInto(t.iHash), t;
}
clone() {
return this._cloneInto();
}
destroy() {
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
}
};
const dp = (t, e, r) => new D0(t, e).update(r).digest();
dp.create = (t, e) => new D0(t, e);
function Jv(t, e, r, n) {
if (typeof t.setBigUint64 == "function")
return t.setBigUint64(e, r, n);
const i = BigInt(32), s = BigInt(4294967295), o = Number(r >> i & s), a = Number(r & s), c = n ? 4 : 0, u = n ? 0 : 4;
t.setUint32(e + c, o, n), t.setUint32(e + u, a, n);
}
function Ov(t, e, r) {
return t & e ^ ~t & r;
}
function Rv(t, e, r) {
return t & e ^ t & r ^ e & r;
}
let L0 = class extends up {
constructor(t, e, r, n) {
super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = e, this.padOffset = r, this.isLE = n, this.buffer = new Uint8Array(t), this.view = vd(this.buffer);
}
update(t) {
so(this), t = Vf(t), at(t);
const { view: e, buffer: r, blockLen: n } = this, i = t.length;
for (let s = 0; s < i; ) {
const o = Math.min(n - this.pos, i - s);
if (o === n) {
const a = vd(t);
for (; n <= i - s; s += n)
this.process(a, s);
continue;
}
r.set(t.subarray(s, s + o), this.pos), this.pos += o, s += o, this.pos === n && (this.process(e, 0), this.pos = 0);
}
return this.length += t.length, this.roundClean(), this;
}
digestInto(t) {
so(this), c0(t, this), this.finished = !0;
const { buffer: e, view: r, blockLen: n, isLE: i } = this;
let { pos: s } = this;
e[s++] = 128, Ui(this.buffer.subarray(s)), this.padOffset > n - s && (this.process(r, 0), s = 0);
for (let l = s; l < n; l++)
e[l] = 0;
Jv(r, n - 8, BigInt(this.length * 8), i), this.process(r, 0);
const o = vd(t), a = this.outputLen;
if (a % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const c = a / 4, u = this.get();
if (c > u.length)
throw new Error("_sha2: outputLen bigger than state");
for (let l = 0; l < c; l++)
o.setUint32(4 * l, u[l], i);
}
digest() {
const { buffer: t, outputLen: e } = this;
this.digestInto(t);
const r = t.slice(0, e);
return this.destroy(), r;
}
_cloneInto(t) {
t || (t = new this.constructor()), t.set(...this.get());
const { blockLen: e, buffer: r, length: n, finished: i, destroyed: s, pos: o } = this;
return t.destroyed = s, t.finished = i, t.length = n, t.pos = o, n % e && t.buffer.set(r), t;
}
clone() {
return this._cloneInto();
}
};
const Rn = /* @__PURE__ */ Uint32Array.from([
1779033703,
3144134277,
1013904242,
2773480762,
1359893119,
2600822924,
528734635,
1541459225
]), Et = /* @__PURE__ */ Uint32Array.from([
1779033703,
4089235720,
3144134277,
2227873595,
1013904242,
4271175723,
2773480762,
1595750129,
1359893119,
2917565137,
2600822924,
725511199,
528734635,
4215389547,
1541459225,
327033209
]), mu = /* @__PURE__ */ BigInt(2 ** 32 - 1), _A = /* @__PURE__ */ BigInt(32);
function Pv(t, e = !1) {
return e ? { h: Number(t & mu), l: Number(t >> _A & mu) } : { h: Number(t >> _A & mu) | 0, l: Number(t & mu) | 0 };
}
function k0(t, e = !1) {
const r = t.length;
let n = new Uint32Array(r), i = new Uint32Array(r);
for (let s = 0; s < r; s++) {
const { h: o, l: a } = Pv(t[s], e);
[n[s], i[s]] = [o, a];
}
return [n, i];
}
const $A = (t, e, r) => t >>> r, ey = (t, e, r) => t << 32 - r | e >>> r, ks = (t, e, r) => t >>> r | e << 32 - r, Gs = (t, e, r) => t << 32 - r | e >>> r, Iu = (t, e, r) => t << 64 - r | e >>> r - 32, bu = (t, e, r) => t >>> r - 32 | e << 64 - r, jv = (t, e, r) => t << r | e >>> 32 - r, qv = (t, e, r) => e << r | t >>> 32 - r, Wv = (t, e, r) => e << r - 32 | t >>> 64 - r, Vv = (t, e, r) => t << r - 32 | e >>> 64 - r;
function hn(t, e, r, n) {
const i = (e >>> 0) + (n >>> 0);
return { h: t + r + (i / 2 ** 32 | 0) | 0, l: i | 0 };
}
const Xv = (t, e, r) => (t >>> 0) + (e >>> 0) + (r >>> 0), Zv = (t, e, r, n) => e + r + n + (t / 2 ** 32 | 0) | 0, _v = (t, e, r, n) => (t >>> 0) + (e >>> 0) + (r >>> 0) + (n >>> 0), $v = (t, e, r, n, i) => e + r + n + i + (t / 2 ** 32 | 0) | 0, eM = (t, e, r, n, i) => (t >>> 0) + (e >>> 0) + (r >>> 0) + (n >>> 0) + (i >>> 0), tM = (t, e, r, n, i, s) => e + r + n + i + s + (t / 2 ** 32 | 0) | 0, rM = /* @__PURE__ *