import { Q as Lt, R as Dt, S as N, U as T, V as b, X as Rt, Y as kt, Z as Bt, $ as Pt, a0 as Ut, a1 as qt, a2 as Ft, a3 as Wt, a4 as Nt, a5 as Qt, a6 as He, a7 as Ke, a8 as Zt, a9 as Ht, aa as ge, ab as Kt, ac as zt, ad as Xt, ae as Gt, af as Jt, ag as Yt, ah as jt, ai as ze, aj as Fe, ak as en, al as Xe, am as An, __tla as __tla_0 } from "./App-CBFr3ZEW.js";
import { an as mr, ao as yr, ap as dr, aq as hr, ar as Sr, as as vr, at as wr, au as Vr, av as Cr, aw as Tr, ax as $r, ay as Ir, az as Er, aA as br, aB as Or, aC as Ar, aD as Mr, aE as _r, aF as xr, aG as Lr, aH as Dr, aI as Rr, aJ as kr, aK as Br, aL as Pr, aM as Ur, aN as qr, aO as Fr, aP as Wr, aQ as Nr, aR as Qr, aS as Zr, aT as Hr, aU as Kr, aV as zr, __tla as __tla_1 } from "./App-CBFr3ZEW.js";
import "./Logo1am-CSacEOt-.js";
let m, g, x, fn, Rn, Ge, se, Dn, sn, E, Bn, kn, ln, un, fe, le, Qe, Ze, ue, Pn, Jn, _n, Ln, fr, jn, er, Yn, cr, ir, ur, nr, rr, gn, tr, Zn, zn, Xn, Gn, sr, Je, pn, mn, or, Kn, qn, ar, Qn, Nn, lr, Un, Wn, Fn, xn, Hn, Ne;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    const tn = {}, nn = Object.freeze(Object.defineProperty({
        __proto__: null,
        default: tn
    }, Symbol.toStringTag, {
        value: "Module"
    })), rn = Lt(nn);
    var ce, We;
    function an() {
        if (We) return ce;
        We = 1;
        var e = typeof Map == "function" && Map.prototype, t = Object.getOwnPropertyDescriptor && e ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, a = e && t && typeof t.get == "function" ? t.get : null, o = e && Map.prototype.forEach, i = typeof Set == "function" && Set.prototype, l = Object.getOwnPropertyDescriptor && i ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, u = i && l && typeof l.get == "function" ? l.get : null, U = i && Set.prototype.forEach, O = typeof WeakMap == "function" && WeakMap.prototype, D = O ? WeakMap.prototype.has : null, at = typeof WeakSet == "function" && WeakSet.prototype, R = at ? WeakSet.prototype.has : null, ot = typeof WeakRef == "function" && WeakRef.prototype, de = ot ? WeakRef.prototype.deref : null, it = Boolean.prototype.valueOf, ct = Object.prototype.toString, st = Function.prototype.toString, lt = String.prototype.match, H = String.prototype.slice, v = String.prototype.replace, ut = String.prototype.toUpperCase, he = String.prototype.toLowerCase, Se = RegExp.prototype.test, ve = Array.prototype.concat, h = Array.prototype.join, ft = Array.prototype.slice, we = Math.floor, K = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, z = Object.getOwnPropertySymbols, X = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, A = typeof Symbol == "function" && typeof Symbol.iterator == "object", k = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === A || !0) ? Symbol.toStringTag : null, Ve = Object.prototype.propertyIsEnumerable, Ce = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(n) {
            return n.__proto__;
        } : null);
        function Te(n, r) {
            if (n === 1 / 0 || n === -1 / 0 || n !== n || n && n > -1e3 && n < 1e3 || Se.call(/e/, r)) return r;
            var s = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
            if (typeof n == "number") {
                var f = n < 0 ? -we(-n) : we(n);
                if (f !== n) {
                    var p = String(f), c = H.call(r, p.length + 1);
                    return v.call(p, s, "$&_") + "." + v.call(v.call(c, /([0-9]{3})/g, "$&_"), /_$/, "");
                }
            }
            return v.call(r, s, "$&_");
        }
        var G = rn, $e = G.custom, Ie = Ae($e) ? $e : null, Ee = {
            __proto__: null,
            double: '"',
            single: "'"
        }, pt = {
            __proto__: null,
            double: /(["\\])/g,
            single: /(['\\])/g
        };
        ce = function n(r, s, f, p) {
            var c = s || {};
            if (S(c, "quoteStyle") && !S(Ee, c.quoteStyle)) throw new TypeError('option "quoteStyle" must be "single" or "double"');
            if (S(c, "maxStringLength") && (typeof c.maxStringLength == "number" ? c.maxStringLength < 0 && c.maxStringLength !== 1 / 0 : c.maxStringLength !== null)) throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
            var V = S(c, "customInspect") ? c.customInspect : !0;
            if (typeof V != "boolean" && V !== "symbol") throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
            if (S(c, "indent") && c.indent !== null && c.indent !== "	" && !(parseInt(c.indent, 10) === c.indent && c.indent > 0)) throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
            if (S(c, "numericSeparator") && typeof c.numericSeparator != "boolean") throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
            var I = c.numericSeparator;
            if (typeof r > "u") return "undefined";
            if (r === null) return "null";
            if (typeof r == "boolean") return r ? "true" : "false";
            if (typeof r == "string") return _e(r, c);
            if (typeof r == "number") {
                if (r === 0) return 1 / 0 / r > 0 ? "0" : "-0";
                var y = String(r);
                return I ? Te(r, y) : y;
            }
            if (typeof r == "bigint") {
                var C = String(r) + "n";
                return I ? Te(r, C) : C;
            }
            var ee = typeof c.depth > "u" ? 5 : c.depth;
            if (typeof f > "u" && (f = 0), f >= ee && ee > 0 && typeof r == "object") return J(r) ? "[Array]" : "[Object]";
            var M = Mt(c, f);
            if (typeof p > "u") p = [];
            else if (Me(p, r) >= 0) return "[Circular]";
            function d(_, W, xt) {
                if (W && (p = ft.call(p), p.push(W)), xt) {
                    var qe = {
                        depth: c.depth
                    };
                    return S(c, "quoteStyle") && (qe.quoteStyle = c.quoteStyle), n(_, qe, f + 1, p);
                }
                return n(_, c, f + 1, p);
            }
            if (typeof r == "function" && !Oe(r)) {
                var Le = Vt(r), De = q(r, d);
                return "[Function" + (Le ? ": " + Le : " (anonymous)") + "]" + (De.length > 0 ? " { " + h.call(De, ", ") + " }" : "");
            }
            if (Ae(r)) {
                var Re = A ? v.call(String(r), /^(Symbol\(.*\))_[^)]*$/, "$1") : X.call(r);
                return typeof r == "object" && !A ? B(Re) : Re;
            }
            if (bt(r)) {
                for(var P = "<" + he.call(String(r.nodeName)), te = r.attributes || [], F = 0; F < te.length; F++)P += " " + te[F].name + "=" + be(gt(te[F].value), "double", c);
                return P += ">", r.childNodes && r.childNodes.length && (P += "..."), P += "</" + he.call(String(r.nodeName)) + ">", P;
            }
            if (J(r)) {
                if (r.length === 0) return "[]";
                var ne = q(r, d);
                return M && !At(ne) ? "[" + j(ne, M) + "]" : "[ " + h.call(ne, ", ") + " ]";
            }
            if (yt(r)) {
                var re = q(r, d);
                return !("cause" in Error.prototype) && "cause" in r && !Ve.call(r, "cause") ? "{ [" + String(r) + "] " + h.call(ve.call("[cause]: " + d(r.cause), re), ", ") + " }" : re.length === 0 ? "[" + String(r) + "]" : "{ [" + String(r) + "] " + h.call(re, ", ") + " }";
            }
            if (typeof r == "object" && V) {
                if (Ie && typeof r[Ie] == "function" && G) return G(r, {
                    depth: ee - f
                });
                if (V !== "symbol" && typeof r.inspect == "function") return r.inspect();
            }
            if (Ct(r)) {
                var ke = [];
                return o && o.call(r, function(_, W) {
                    ke.push(d(W, r, !0) + " => " + d(_, r));
                }), xe("Map", a.call(r), ke, M);
            }
            if (It(r)) {
                var Be = [];
                return U && U.call(r, function(_) {
                    Be.push(d(_, r));
                }), xe("Set", u.call(r), Be, M);
            }
            if (Tt(r)) return Y("WeakMap");
            if (Et(r)) return Y("WeakSet");
            if ($t(r)) return Y("WeakRef");
            if (ht(r)) return B(d(Number(r)));
            if (vt(r)) return B(d(K.call(r)));
            if (St(r)) return B(it.call(r));
            if (dt(r)) return B(d(String(r)));
            if (typeof window < "u" && r === window) return "{ [object Window] }";
            if (typeof globalThis < "u" && r === globalThis || typeof globalThis < "u" && r === globalThis) return "{ [object globalThis] }";
            if (!mt(r) && !Oe(r)) {
                var ae = q(r, d), Pe = Ce ? Ce(r) === Object.prototype : r instanceof Object || r.constructor === Object, oe = r instanceof Object ? "" : "null prototype", Ue = !Pe && k && Object(r) === r && k in r ? H.call(w(r), 8, -1) : oe ? "Object" : "", _t = Pe || typeof r.constructor != "function" ? "" : r.constructor.name ? r.constructor.name + " " : "", ie = _t + (Ue || oe ? "[" + h.call(ve.call([], Ue || [], oe || []), ": ") + "] " : "");
                return ae.length === 0 ? ie + "{}" : M ? ie + "{" + j(ae, M) + "}" : ie + "{ " + h.call(ae, ", ") + " }";
            }
            return String(r);
        };
        function be(n, r, s) {
            var f = s.quoteStyle || r, p = Ee[f];
            return p + n + p;
        }
        function gt(n) {
            return v.call(String(n), /"/g, "&quot;");
        }
        function $(n) {
            return !k || !(typeof n == "object" && (k in n || typeof n[k] < "u"));
        }
        function J(n) {
            return w(n) === "[object Array]" && $(n);
        }
        function mt(n) {
            return w(n) === "[object Date]" && $(n);
        }
        function Oe(n) {
            return w(n) === "[object RegExp]" && $(n);
        }
        function yt(n) {
            return w(n) === "[object Error]" && $(n);
        }
        function dt(n) {
            return w(n) === "[object String]" && $(n);
        }
        function ht(n) {
            return w(n) === "[object Number]" && $(n);
        }
        function St(n) {
            return w(n) === "[object Boolean]" && $(n);
        }
        function Ae(n) {
            if (A) return n && typeof n == "object" && n instanceof Symbol;
            if (typeof n == "symbol") return !0;
            if (!n || typeof n != "object" || !X) return !1;
            try {
                return X.call(n), !0;
            } catch  {}
            return !1;
        }
        function vt(n) {
            if (!n || typeof n != "object" || !K) return !1;
            try {
                return K.call(n), !0;
            } catch  {}
            return !1;
        }
        var wt = Object.prototype.hasOwnProperty || function(n) {
            return n in this;
        };
        function S(n, r) {
            return wt.call(n, r);
        }
        function w(n) {
            return ct.call(n);
        }
        function Vt(n) {
            if (n.name) return n.name;
            var r = lt.call(st.call(n), /^function\s*([\w$]+)/);
            return r ? r[1] : null;
        }
        function Me(n, r) {
            if (n.indexOf) return n.indexOf(r);
            for(var s = 0, f = n.length; s < f; s++)if (n[s] === r) return s;
            return -1;
        }
        function Ct(n) {
            if (!a || !n || typeof n != "object") return !1;
            try {
                a.call(n);
                try {
                    u.call(n);
                } catch  {
                    return !0;
                }
                return n instanceof Map;
            } catch  {}
            return !1;
        }
        function Tt(n) {
            if (!D || !n || typeof n != "object") return !1;
            try {
                D.call(n, D);
                try {
                    R.call(n, R);
                } catch  {
                    return !0;
                }
                return n instanceof WeakMap;
            } catch  {}
            return !1;
        }
        function $t(n) {
            if (!de || !n || typeof n != "object") return !1;
            try {
                return de.call(n), !0;
            } catch  {}
            return !1;
        }
        function It(n) {
            if (!u || !n || typeof n != "object") return !1;
            try {
                u.call(n);
                try {
                    a.call(n);
                } catch  {
                    return !0;
                }
                return n instanceof Set;
            } catch  {}
            return !1;
        }
        function Et(n) {
            if (!R || !n || typeof n != "object") return !1;
            try {
                R.call(n, R);
                try {
                    D.call(n, D);
                } catch  {
                    return !0;
                }
                return n instanceof WeakSet;
            } catch  {}
            return !1;
        }
        function bt(n) {
            return !n || typeof n != "object" ? !1 : typeof HTMLElement < "u" && n instanceof HTMLElement ? !0 : typeof n.nodeName == "string" && typeof n.getAttribute == "function";
        }
        function _e(n, r) {
            if (n.length > r.maxStringLength) {
                var s = n.length - r.maxStringLength, f = "... " + s + " more character" + (s > 1 ? "s" : "");
                return _e(H.call(n, 0, r.maxStringLength), r) + f;
            }
            var p = pt[r.quoteStyle || "single"];
            p.lastIndex = 0;
            var c = v.call(v.call(n, p, "\\$1"), /[\x00-\x1f]/g, Ot);
            return be(c, "single", r);
        }
        function Ot(n) {
            var r = n.charCodeAt(0), s = {
                8: "b",
                9: "t",
                10: "n",
                12: "f",
                13: "r"
            }[r];
            return s ? "\\" + s : "\\x" + (r < 16 ? "0" : "") + ut.call(r.toString(16));
        }
        function B(n) {
            return "Object(" + n + ")";
        }
        function Y(n) {
            return n + " { ? }";
        }
        function xe(n, r, s, f) {
            var p = f ? j(s, f) : h.call(s, ", ");
            return n + " (" + r + ") {" + p + "}";
        }
        function At(n) {
            for(var r = 0; r < n.length; r++)if (Me(n[r], `
`) >= 0) return !1;
            return !0;
        }
        function Mt(n, r) {
            var s;
            if (n.indent === "	") s = "	";
            else if (typeof n.indent == "number" && n.indent > 0) s = h.call(Array(n.indent + 1), " ");
            else return null;
            return {
                base: s,
                prev: h.call(Array(r + 1), s)
            };
        }
        function j(n, r) {
            if (n.length === 0) return "";
            var s = `
` + r.prev + r.base;
            return s + h.call(n, "," + s) + `
` + r.prev;
        }
        function q(n, r) {
            var s = J(n), f = [];
            if (s) {
                f.length = n.length;
                for(var p = 0; p < n.length; p++)f[p] = S(n, p) ? r(n[p], n) : "";
            }
            var c = typeof z == "function" ? z(n) : [], V;
            if (A) {
                V = {};
                for(var I = 0; I < c.length; I++)V["$" + c[I]] = c[I];
            }
            for(var y in n)S(n, y) && (s && String(Number(y)) === y && y < n.length || A && V["$" + y] instanceof Symbol || (Se.call(/[^\w$]/, y) ? f.push(r(y, n) + ": " + r(n[y], n)) : f.push(y + ": " + r(n[y], n))));
            if (typeof z == "function") for(var C = 0; C < c.length; C++)Ve.call(n, c[C]) && f.push("[" + r(c[C]) + "]: " + r(n[c[C]], n));
            return f;
        }
        return ce;
    }
    var on = an();
    const cn = Dt(on);
    g = class extends Error {
        constructor(t){
            super(t), this.name = "CompactError";
        }
    };
    _n = function(e, t) {
        if (!e) {
            const a = `failed assert: ${t}`;
            throw new g(a);
        }
    };
    xn = function(e, t, a, o, i) {
        const l = `type error: ${e} ${t} at ${a}; expected value of type ${o} but received ${cn(i)}`;
        throw new g(l);
    };
    Ne = "0.14.0";
    Ln = (e)=>{
        const t = e.split("-")[0].split(".").map(Number), a = Ne.split("-")[0].split(".").map(Number);
        if (t[0] !== a[0] || a[0] === 0 && t[1] !== a[1] || t[1] > a[1] || t[1] === a[1] && t[2] > a[2]) throw new g(`Version mismatch: compiled code expects ${e}, runtime is ${Ne}`);
        const o = 52435875175126190479447740508185965837690552500527637822603658699938581184512n;
        if (o !== N) throw new g(`Maximum field mismatch: compiled code uses ${o}, runtime uses ${N}`);
    };
    E = {
        alignment () {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "field"
                    }
                },
                {
                    tag: "atom",
                    value: {
                        tag: "field"
                    }
                }
            ];
        },
        fromValue (e) {
            const t = e.shift(), a = e.shift();
            if (t == null || a == null) throw new g("expected NativePoint");
            return {
                x: b([
                    t
                ]),
                y: b([
                    a
                ])
            };
        },
        toValue (e) {
            return T(e.x).concat(T(e.y));
        }
    };
    se = {
        alignment () {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "field"
                    }
                }
            ];
        },
        fromValue (e) {
            const t = e.shift();
            if (t == null) throw new g("expected MerkleTreeDigest");
            return {
                field: b([
                    t
                ])
            };
        },
        toValue (e) {
            return T(e.field);
        }
    };
    sn = {
        alignment () {
            return se.alignment().concat(x.alignment());
        },
        fromValue (e) {
            const t = se.fromValue(e), a = x.fromValue(e);
            return {
                sibling: t,
                goes_left: a
            };
        },
        toValue (e) {
            return se.toValue(e.sibling).concat(x.toValue(e.goes_left));
        }
    };
    Dn = class {
        leaf;
        path;
        constructor(t, a){
            this.leaf = a, this.path = new un(t, sn);
        }
        alignment() {
            return this.leaf.alignment().concat(this.path.alignment());
        }
        fromValue(t) {
            const a = this.leaf.fromValue(t), o = this.path.fromValue(t);
            return {
                leaf: a,
                path: o
            };
        }
        toValue(t) {
            return this.leaf.toValue(t.leaf).concat(this.path.toValue(t.path));
        }
    };
    Ge = {
        alignment () {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "field"
                    }
                }
            ];
        },
        fromValue (e) {
            const t = e.shift();
            if (t == null) throw new g("expected Field");
            return b([
                t
            ]);
        },
        toValue (e) {
            return T(e);
        }
    };
    Rn = class {
        maxValue;
        length;
        constructor(t, a){
            this.maxValue = t, this.length = a;
        }
        alignment() {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "bytes",
                        length: this.length
                    }
                }
            ];
        }
        fromValue(t) {
            const a = t.shift();
            if (a == null) throw new g(`expected Enum[<=${this.maxValue}]`);
            {
                let o = 0;
                for(let i = 0; i < a.length; i++)o += (1 << 8 * i) * a[i];
                if (o > this.maxValue) throw new g(`expected UnsignedInteger[<=${this.maxValue}]`);
                return o;
            }
        }
        toValue(t) {
            return Ge.toValue(BigInt(t));
        }
    };
    ln = class {
        maxValue;
        length;
        constructor(t, a){
            this.maxValue = t, this.length = a;
        }
        alignment() {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "bytes",
                        length: this.length
                    }
                }
            ];
        }
        fromValue(t) {
            const a = t.shift();
            if (a == null) throw new g(`expected UnsignedInteger[<=${this.maxValue}]`);
            {
                let o = 0n;
                for(let i = 0; i < a.length; i++)o += (1n << 8n * BigInt(i)) * BigInt(a[i]);
                if (o > this.maxValue) throw new g(`expected UnsignedInteger[<=${this.maxValue}]`);
                return o;
            }
        }
        toValue(t) {
            return Ge.toValue(t);
        }
    };
    un = class {
        length;
        type;
        constructor(t, a){
            this.length = t, this.type = a;
        }
        alignment() {
            const t = this.type.alignment();
            let a = [];
            for(let o = 0; o < this.length; o++)a = a.concat(t);
            return a;
        }
        fromValue(t) {
            const a = [];
            for(let o = 0; o < this.length; o++)a.push(this.type.fromValue(t));
            return a;
        }
        toValue(t) {
            if (t.length != this.length) throw new g(`expected ${this.length}-element array`);
            let a = [];
            for(let o = 0; o < this.length; o++)a = a.concat(this.type.toValue(t[o]));
            return a;
        }
    };
    x = {
        alignment () {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "bytes",
                        length: 1
                    }
                }
            ];
        },
        fromValue (e) {
            const t = e.shift();
            if (t == null || t.length > 1 || t.length == 1 && t[0] != 1) throw new g("expected Boolean");
            return t.length == 1;
        },
        toValue (e) {
            return e ? [
                new Uint8Array([
                    1
                ])
            ] : [
                new Uint8Array(0)
            ];
        }
    };
    fn = class {
        length;
        constructor(t){
            this.length = t;
        }
        alignment() {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "bytes",
                        length: this.length
                    }
                }
            ];
        }
        fromValue(t) {
            const a = t.shift();
            if (a == null || a.length > this.length) throw new g(`expected Bytes[${this.length}]`);
            if (a.length == this.length) return a;
            const o = new Uint8Array(this.length);
            return o.set(a, 0), o;
        }
        toValue(t) {
            let a = t.length;
            for(; a > 0 && t[a - 1] == 0;)a -= 1;
            return [
                t.slice(0, a)
            ];
        }
    };
    let Q;
    kn = {
        alignment () {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "compress"
                    }
                }
            ];
        },
        fromValue (e) {
            return e.shift();
        },
        toValue (e) {
            return [
                e
            ];
        }
    };
    Bn = {
        alignment () {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "compress"
                    }
                }
            ];
        },
        fromValue (e) {
            return new TextDecoder("utf-8").decode(e.shift());
        },
        toValue (e) {
            return [
                new TextEncoder().encode(e)
            ];
        }
    };
    m = new fn(32);
    le = new ln(18446744073709551615n, 8);
    Qe = {
        alignment () {
            return m.alignment().concat(m.alignment().concat(le.alignment()));
        },
        fromValue (e) {
            return {
                nonce: m.fromValue(e),
                color: m.fromValue(e),
                value: le.fromValue(e)
            };
        },
        toValue (e) {
            return m.toValue(e.nonce).concat(m.toValue(e.color).concat(le.toValue(e.value)));
        }
    };
    ue = {
        alignment () {
            return m.alignment();
        },
        fromValue (e) {
            return {
                bytes: m.fromValue(e)
            };
        },
        toValue (e) {
            return m.toValue(e.bytes);
        }
    };
    fe = {
        alignment () {
            return m.alignment();
        },
        fromValue (e) {
            return {
                bytes: m.fromValue(e)
            };
        },
        toValue (e) {
            return m.toValue(e.bytes);
        }
    };
    Ze = {
        alignment () {
            return x.alignment().concat(ue.alignment().concat(fe.alignment()));
        },
        fromValue (e) {
            return {
                is_left: x.fromValue(e),
                left: ue.fromValue(e),
                right: fe.fromValue(e)
            };
        },
        toValue (e) {
            return x.toValue(e.is_left).concat(ue.toValue(e.left).concat(fe.toValue(e.right)));
        }
    };
    Q = N + 1n;
    Pn = function(e, t) {
        const a = e + t;
        return a < Q ? a : a - Q;
    };
    Un = function(e, t) {
        const a = e - t;
        return a >= 0 ? a : a + Q;
    };
    qn = function(e, t) {
        return e * t % Q;
    };
    Fn = function(e, t) {
        return b(Nt(e.alignment(), e.toValue(t)));
    };
    Wn = function(e, t, a) {
        return b(Wt(e.alignment(), e.toValue(t), T(a)));
    };
    Nn = function(e, t) {
        const a = Ft(e.alignment(), e.toValue(t))[0], o = new Uint8Array(32);
        return o.set(a, 0), o;
    };
    Qn = function(e, t, a) {
        if (a.length != 32) throw new g("Expected 32-byte string");
        const o = qt(e.alignment(), e.toValue(t), [
            a
        ])[0], i = new Uint8Array(32);
        return i.set(o, 0), i;
    };
    Zn = function(e) {
        if (e.length != 32) throw new g("Expected 32-byte string");
        return b(Rt([
            e
        ]));
    };
    Hn = function(e) {
        const t = Qt(T(e))[0], a = new Uint8Array(32);
        return a.set(t, 0), a;
    };
    Kn = function(e, t) {
        return E.fromValue(Ut(e.alignment(), e.toValue(t)));
    };
    zn = function(e, t) {
        return E.fromValue(kt(E.toValue(e), E.toValue(t)));
    };
    Xn = function(e, t) {
        return E.fromValue(Bt(E.toValue(e), T(t)));
    };
    Gn = function(e) {
        return E.fromValue(Pt(T(e)));
    };
    Jn = function(...e) {
        const t = {
            value: [],
            alignment: []
        };
        for (const a of e)t.value = t.value.concat(a.value), t.alignment = t.alignment.concat(a.alignment);
        return t;
    };
    Yn = function(e, t, a) {
        const o = t, i = new Uint8Array(e);
        for(let u = 0; u < e; u++)if (i[u] = Number(t & 0xffn), t = t / 0x100n, t == 0n) return i;
        const l = `range error at ${a}: Field or Uint value ${o} does not fit into ${e} bytes`;
        throw new g(l);
    };
    jn = function(e, t, a) {
        let o = 0n;
        for(let i = e - 1; i >= 0; i -= 1)if (o = o * 0x100n + BigInt(t[i]), o > N) {
            const l = `range error at ${a}: the integer value of ${t} is greater than the maximum value of a Field`;
            throw new g(l);
        }
        return o;
    };
    er = function(e, t, a, o) {
        let i = 0n;
        for(let l = t - 1; l >= 0; l -= 1)if (i = i * 0x100n + BigInt(a[l]), i > e) {
            const u = `range error at ${o}: the integer value of ${a} is greater than the maximum value of Uint<0..${e + 1}>`;
            throw new g(u);
        }
        return i;
    };
    Je = (e)=>({
            coinPublicKey: typeof e == "string" ? {
                bytes: ge(e)
            } : e,
            currentIndex: 0n,
            inputs: [],
            outputs: []
        });
    pn = ({ is_left: e, left: t, right: a })=>({
            is_left: e,
            left: {
                bytes: ge(t)
            },
            right: {
                bytes: Kt(a)
            }
        });
    gn = ({ is_left: e, left: t, right: a })=>({
            is_left: e,
            left: Ke(t.bytes),
            right: He(a.bytes)
        });
    mn = (e)=>({
            coinPublicKey: {
                bytes: ge(e.coinPublicKey)
            },
            currentIndex: e.currentIndex,
            inputs: e.inputs.map(Xt),
            outputs: e.outputs.map(({ coinInfo: t, recipient: a })=>({
                    coinInfo: zt(t),
                    recipient: pn(a)
                }))
        });
    tr = (e)=>({
            coinPublicKey: Ke(e.coinPublicKey.bytes),
            currentIndex: e.currentIndex,
            inputs: e.inputs.map(Ht),
            outputs: e.outputs.map(({ coinInfo: t, recipient: a })=>({
                    coinInfo: Zt(t),
                    recipient: gn(a)
                }))
        });
    nr = function(e, t) {
        return e.currentZswapLocalState = {
            ...e.currentZswapLocalState,
            inputs: e.currentZswapLocalState.inputs.concat(t)
        }, [];
    };
    function Ye(e, t) {
        return Jt({
            value: Qe.toValue(e),
            alignment: Qe.alignment()
        }, {
            value: Ze.toValue(t),
            alignment: Ze.alignment()
        });
    }
    rr = function(e, t, a) {
        return e.currentQueryContext = e.currentQueryContext.insertCommitment(Buffer.from(m.fromValue(Ye(t, a).value)).toString("hex"), e.currentZswapLocalState.currentIndex), e.currentZswapLocalState = {
            ...e.currentZswapLocalState,
            currentIndex: e.currentZswapLocalState.currentIndex + 1n,
            outputs: e.currentZswapLocalState.outputs.concat({
                coinInfo: t,
                recipient: a
            })
        }, [];
    };
    ar = function(e) {
        return e.currentZswapLocalState.coinPublicKey;
    };
    let yn, dn, hn, Sn;
    or = (e, t, a)=>e.currentQueryContext.comIndices.has(Gt(m.fromValue(Ye(t, a).value)));
    ir = (e, t)=>({
            initialPrivateState: e,
            initialZswapLocalState: Je(t)
        });
    yn = (e)=>{
        let t;
        if (e instanceof Fe) t = e;
        else if (e instanceof ze) t = e.data;
        else if (e instanceof en) t = new Fe(e);
        else throw new g(`'contractState' parameter ${e} has unexpected type`);
        return t;
    };
    dn = (e, t, a)=>{
        const o = new jt(yn(e), t), i = e instanceof ze ? e.balance : new Map;
        return o.block = {
            ...o.block,
            balance: i,
            ownAddress: t,
            secondsSinceEpoch: BigInt(a ?? Math.floor(Date.now() / 1e3))
        }, o;
    };
    hn = (e)=>typeof e == "object" && e !== null && "coinPublicKey" in e && typeof e.coinPublicKey == "string" && "currentIndex" in e && "inputs" in e && "outputs" in e;
    Sn = (e)=>typeof e == "object" && e !== null && "coinPublicKey" in e && typeof e.coinPublicKey == "object" && e.coinPublicKey !== null && "bytes" in e.coinPublicKey && "currentIndex" in e && "inputs" in e && "outputs" in e;
    cr = (e, t, a, o, i, l, u)=>{
        const U = dn(a, e, u);
        let O;
        return hn(t) ? O = mn(t) : Sn(t) ? O = t : O = Je(t), {
            currentPrivateState: o,
            currentZswapLocalState: O,
            currentQueryContext: U,
            costModel: l ?? Yt.initialCostModel(),
            gasLimit: i
        };
    };
    sr = ()=>({
            readTime: 0n,
            computeTime: 0n,
            bytesWritten: 0n,
            bytesDeleted: 0n
        });
    lr = (e, t, a)=>{
        try {
            const o = e.currentQueryContext.query(a, e.costModel, e.gasLimit);
            e.currentQueryContext = o.context, e.gasCost = o.gasCost;
            const i = o.events.filter((u)=>u.tag === "read");
            let l = 0;
            if (t.publicTranscript = t.publicTranscript.concat(a.map((u)=>typeof u == "object" && "popeq" in u ? {
                    popeq: {
                        ...u.popeq,
                        result: i[l++].content
                    }
                } : u)), o.events.length === 1) {
                const u = o.events[0];
                if (u.tag === "read") return u.content;
            }
            return o.events;
        } catch (o) {
            throw o instanceof Error ? new g(o.toString()) : o;
        }
    };
    ur = function(e, t, a) {
        return {
            ledger: e,
            privateState: t,
            contractAddress: a
        };
    };
    function je(e) {
        return Array.isArray(e) && e.every((t)=>me(t));
    }
    function et(e) {
        return typeof e == "object" && e !== null && e !== void 0 && Object.entries(e).every(([t, a])=>typeof t == "string" && me(a));
    }
    function me(e) {
        return Xe(e) || je(e) || et(e);
    }
    const Z = (e, t)=>{
        throw new g(`Expected ${e} but received ${JSON.stringify(t)}`);
    };
    function vn(e) {
        Xe(e) || Z("contract address", e);
    }
    function wn(e) {
        je(e) || Z("vector", e);
    }
    function Vn(e) {
        et(e) || Z("struct", e);
    }
    function Cn(e) {
        me(e) || Z("Compact value", e);
    }
    function Tn(e) {
        return Cn(e), e;
    }
    const L = (e, t, a)=>{
        e.tag == "contractAddress" ? (vn(t), a.add(He(t.bytes))) : e.tag == "struct" ? (Vn(t), Object.keys(t).forEach((o)=>L(e.elements[o], t[o], a))) : (wn(t), t.forEach((o)=>L(e.sparseType, o, a)));
    }, tt = (e, { value: t })=>Tn(e.fromValue(t)), ye = (e, t)=>tt(e, t.asCell()), $n = (e, t, a)=>{
        const { sparseType: o, descriptor: i } = e.valueType;
        L(o, ye(i, t), a);
    }, In = (e, t, a)=>{
        const { sparseType: o, descriptor: i } = e.valueType;
        t.forEach((l)=>L(o, ye(i, l), a));
    }, En = (e, t, a)=>{
        const { keyType: o, valueType: i } = e;
        t.keys().forEach((l)=>{
            if (o && L(o.sparseType, tt(o.descriptor, l), a), i) {
                const u = t.get(l);
                if (!u) throw new g(`State map ${t.toString(!1)} contains key without corresponding value`);
                i.tag == "compactValue" ? L(i.sparseType, ye(i.descriptor, u), a) : nt(i, u, a);
            }
        });
    };
    function pe(e, t, a) {
        if (!e) throw new g(`State ${t.toString(!1)} cannot be cast to a ${a}`);
    }
    let nt, bn, rt;
    nt = (e, t, a)=>{
        if (e.tag == "cell") $n(e, t, a);
        else if (e.tag == "map") {
            const o = t.asMap();
            pe(o, t, "map"), En(e, o, a);
        } else if (e.tag == "list" || e.tag == "set") {
            const o = t.asArray();
            pe(o, t, "array"), In(e, o, a);
        }
    };
    bn = (e)=>{
        const t = e.asArray();
        return pe(t, e, "array"), t;
    };
    rt = (e, t, a)=>{
        const o = bn(t);
        Object.keys(e.indices).map(parseInt).forEach((i)=>{
            const l = e.indices[i];
            "tag" in l && l.tag === "publicLedgerArray" ? rt(l, o[i], a) : nt(l, o[i], a);
        });
    };
    fr = (e, t)=>{
        const a = new Set;
        return e.indices && rt(e, t, a), [
            ...a
        ];
    };
});
export { m as Bytes32Descriptor, mr as CONTRACT_ADDRESS_BYTE_LENGTH, Fe as ChargedState, g as CompactError, x as CompactTypeBoolean, fn as CompactTypeBytes, Rn as CompactTypeEnum, Ge as CompactTypeField, se as CompactTypeMerkleTreeDigest, Dn as CompactTypeMerkleTreePath, sn as CompactTypeMerkleTreePathEntry, E as CompactTypeNativePoint, Bn as CompactTypeOpaqueString, kn as CompactTypeOpaqueUint8Array, ln as CompactTypeUnsignedInteger, un as CompactTypeVector, fe as ContractAddressDescriptor, yr as ContractMaintenanceAuthority, dr as ContractOperation, ze as ContractState, Yt as CostModel, hr as DUMMY_ADDRESS, Sr as HEX_REGEX_NO_PREFIX, N as MAX_FIELD, le as MaxUint8Descriptor, jt as QueryContext, vr as QueryResults, Qe as ShieldedCoinInfoDescriptor, Ze as ShieldedCoinRecipientDescriptor, wr as StateBoundedMerkleTree, Vr as StateMap, en as StateValue, Cr as VmResults, Tr as VmStack, ue as ZswapCoinPublicKeyDescriptor, Pn as addField, Jn as alignedConcat, _n as assert, $r as bigIntModFr, T as bigIntToValue, Ln as checkRuntimeVersion, Ir as communicationCommitment, Er as communicationCommitmentRandomness, fr as contractDependencies, jn as convertBytesToField, er as convertBytesToUint, Yn as convertFieldToBytes, cr as createCircuitContext, ir as createConstructorContext, ur as createWitnessContext, nr as createZswapInput, rr as createZswapOutput, Ke as decodeCoinPublicKey, He as decodeContractAddress, Ht as decodeQualifiedShieldedCoinInfo, br as decodeRawTokenType, gn as decodeRecipient, Zt as decodeShieldedCoinInfo, Or as decodeUserAddress, tr as decodeZswapLocalState, Zn as degradeToTransient, Ar as dummyContractAddress, Mr as dummyUserAddress, zn as ecAdd, Xn as ecMul, Gn as ecMulGenerator, sr as emptyRunningCost, Je as emptyZswapLocalState, ge as encodeCoinPublicKey, Kt as encodeContractAddress, Xt as encodeQualifiedShieldedCoinInfo, _r as encodeRawTokenType, pn as encodeRecipient, zt as encodeShieldedCoinInfo, xr as encodeUserAddress, mn as encodeZswapLocalState, Lr as entryPointHash, An as fromHex, or as hasCoinCommitment, Kn as hashToCurve, Dr as isContractAddress, Xe as isEncodedContractAddress, Rr as leafHash, kr as maxAlignedSize, Br as maxField, qn as mulField, ar as ownPublicKey, Qn as persistentCommit, Nn as persistentHash, Pr as proofDataIntoSerializedPreimage, lr as queryLedgerState, Ur as rawTokenType, qr as runProgram, Jt as runtimeCoinCommitment, Fr as sampleContractAddress, Wr as sampleRawTokenType, Nr as sampleSigningKey, Qr as sampleUserAddress, Zr as signData, Hr as signatureVerifyingKey, Kr as signingKeyFromBip340, Un as subField, Gt as toHex, Wn as transientCommit, Fn as transientHash, xn as typeError, Hn as upgradeFromTransient, b as valueToBigInt, zr as verifySignature, Ne as versionString, __tla };
