import { Q as _t, a4 as N, a5 as T, a6 as b, a7 as Dt, a8 as Rt, a9 as kt, aa as Bt, ab as Pt, ac as Ut, ad as qt, ae as Ft, af as Wt, ag as Nt, ah as He, ai as Ke, aj as Qt, ak as Zt, al as ge, am as Ht, an as Kt, ao as zt, ap as Xt, aq as Gt, ar as Jt, as as Yt, at as ze, au as Fe, av as jt, aw as Xe, a3 as En, __tla as __tla_0 } from "./App-BLnEEK_h.js";
import { ax as dr, ay as hr, az as Sr, aA as vr, aB as wr, aC as Vr, aD as Cr, aE as Tr, aF as $r, aG as Ir, aH as Er, aI as br, aJ as Ar, aK as Mr, aL as Or, aM as xr, aN as Lr, aO as _r, aP as Dr, aQ as Rr, aR as kr, aS as Br, aT as Pr, aU as Ur, aV as qr, aW as Fr, aX as Wr, aY as Nr, aZ as Qr, a_ as Zr, a$ as Hr, b0 as Kr, b1 as zr, b2 as Xr, b3 as Gr, __tla as __tla_1 } from "./App-BLnEEK_h.js";
import { r as en, __tla as __tla_2 } from "./___vite-browser-external_commonjs-proxy-DIugEvg0.js";
import "./request-fingerprint-BANtRL63.js";
import "./Logo1am-CaBWyNpM.js";
import "./_virtual_wxt-plugins-CDnz5Vh6.js";
import "./__vite-plugin-wasm-helper-D7K_KhUE.js";
import { __tla as __tla_3 } from "./cardano-e2kMgYtl.js";
let m, g, L, sn, Bn, Ge, se, kn, an, E, Un, Pn, on, cn, fe, le, Qe, Ze, ue, qn, jn, _n, Rn, gr, tr, nr, er, lr, sr, pr, ar, or, un, rr, Kn, Gn, Jn, Yn, ur, Je, ln, fn, cr, Xn, Wn, ir, Hn, Zn, fr, Fn, Qn, Nn, Dn, zn, Ne;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })()
]).then(async ()=>{
    var ce, We;
    function tn() {
        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, A = typeof WeakMap == "function" && WeakMap.prototype, D = A ? 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, M = typeof Symbol == "function" && typeof Symbol.iterator == "object", k = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === M || !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 = en, $e = G.custom, Ie = Me($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 xe(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 O = Ot(c, f);
            if (typeof p > "u") p = [];
            else if (Oe(p, r) >= 0) return "[Circular]";
            function d(x, W, Lt) {
                if (W && (p = ft.call(p), p.push(W)), Lt) {
                    var qe = {
                        depth: c.depth
                    };
                    return S(c, "quoteStyle") && (qe.quoteStyle = c.quoteStyle), n(x, qe, f + 1, p);
                }
                return n(x, c, f + 1, p);
            }
            if (typeof r == "function" && !Ae(r)) {
                var _e = Vt(r), De = q(r, d);
                return "[Function" + (_e ? ": " + _e : " (anonymous)") + "]" + (De.length > 0 ? " { " + h.call(De, ", ") + " }" : "");
            }
            if (Me(r)) {
                var Re = M ? v.call(String(r), /^(Symbol\(.*\))_[^)]*$/, "$1") : X.call(r);
                return typeof r == "object" && !M ? 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 O && !Mt(ne) ? "[" + j(ne, O) + "]" : "[ " + 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(x, W) {
                    ke.push(d(W, r, !0) + " => " + d(x, r));
                }), Le("Map", a.call(r), ke, O);
            }
            if (It(r)) {
                var Be = [];
                return U && U.call(r, function(x) {
                    Be.push(d(x, r));
                }), Le("Set", u.call(r), Be, O);
            }
            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) && !Ae(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" : "", xt = Pe || typeof r.constructor != "function" ? "" : r.constructor.name ? r.constructor.name + " " : "", ie = xt + (Ue || oe ? "[" + h.call(ve.call([], Ue || [], oe || []), ": ") + "] " : "");
                return ae.length === 0 ? ie + "{}" : O ? ie + "{" + j(ae, O) + "}" : 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 Ae(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 Me(n) {
            if (M) 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 Oe(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 xe(n, r) {
            if (n.length > r.maxStringLength) {
                var s = n.length - r.maxStringLength, f = "... " + s + " more character" + (s > 1 ? "s" : "");
                return xe(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, At);
            return be(c, "single", r);
        }
        function At(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 Le(n, r, s, f) {
            var p = f ? j(s, f) : h.call(s, ", ");
            return n + " (" + r + ") {" + p + "}";
        }
        function Mt(n) {
            for(var r = 0; r < n.length; r++)if (Oe(n[r], `
`) >= 0) return !1;
            return !0;
        }
        function Ot(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 (M) {
                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 || M && 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 nn = tn();
    const rn = _t(nn);
    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);
        }
    };
    Dn = function(e, t, a, o, i) {
        const l = `type error: ${e} ${t} at ${a}; expected value of type ${o} but received ${rn(i)}`;
        throw new g(l);
    };
    Ne = "0.14.0";
    Rn = (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);
        }
    };
    an = {
        alignment () {
            return se.alignment().concat(L.alignment());
        },
        fromValue (e) {
            const t = se.fromValue(e), a = L.fromValue(e);
            return {
                sibling: t,
                goes_left: a
            };
        },
        toValue (e) {
            return se.toValue(e.sibling).concat(L.toValue(e.goes_left));
        }
    };
    kn = class {
        leaf;
        path;
        constructor(t, a){
            this.leaf = a, this.path = new cn(t, an);
        }
        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);
        }
    };
    Bn = 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));
        }
    };
    on = 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);
        }
    };
    cn = 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;
        }
    };
    L = {
        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)
            ];
        }
    };
    sn = 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;
    Pn = {
        alignment () {
            return [
                {
                    tag: "atom",
                    value: {
                        tag: "compress"
                    }
                }
            ];
        },
        fromValue (e) {
            return e.shift();
        },
        toValue (e) {
            return [
                e
            ];
        }
    };
    Un = {
        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 sn(32);
    le = new on(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 L.alignment().concat(ue.alignment().concat(fe.alignment()));
        },
        fromValue (e) {
            return {
                is_left: L.fromValue(e),
                left: ue.fromValue(e),
                right: fe.fromValue(e)
            };
        },
        toValue (e) {
            return L.toValue(e.is_left).concat(ue.toValue(e.left).concat(fe.toValue(e.right)));
        }
    };
    Q = N + 1n;
    qn = function(e, t) {
        const a = e + t;
        return a < Q ? a : a - Q;
    };
    Fn = function(e, t) {
        const a = e - t;
        return a >= 0 ? a : a + Q;
    };
    Wn = function(e, t) {
        return e * t % Q;
    };
    Nn = function(e, t) {
        return b(Wt(e.alignment(), e.toValue(t)));
    };
    Qn = function(e, t, a) {
        return b(Ft(e.alignment(), e.toValue(t), T(a)));
    };
    Zn = function(e, t) {
        const a = qt(e.alignment(), e.toValue(t))[0], o = new Uint8Array(32);
        return o.set(a, 0), o;
    };
    Hn = function(e, t, a) {
        if (a.length != 32) throw new g("Expected 32-byte string");
        const o = Ut(e.alignment(), e.toValue(t), [
            a
        ])[0], i = new Uint8Array(32);
        return i.set(o, 0), i;
    };
    Kn = function(e) {
        if (e.length != 32) throw new g("Expected 32-byte string");
        return b(Dt([
            e
        ]));
    };
    zn = function(e) {
        const t = Nt(T(e))[0], a = new Uint8Array(32);
        return a.set(t, 0), a;
    };
    Xn = function(e, t) {
        return E.fromValue(Pt(e.alignment(), e.toValue(t)));
    };
    Gn = function(e, t) {
        return E.fromValue(Rt(E.toValue(e), E.toValue(t)));
    };
    Jn = function(e, t) {
        return E.fromValue(kt(E.toValue(e), T(t)));
    };
    Yn = function(e) {
        return E.fromValue(Bt(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;
    };
    er = 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);
    };
    tr = 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;
    };
    nr = 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: []
        });
    ln = ({ is_left: e, left: t, right: a })=>({
            is_left: e,
            left: {
                bytes: ge(t)
            },
            right: {
                bytes: Ht(a)
            }
        });
    un = ({ is_left: e, left: t, right: a })=>({
            is_left: e,
            left: Ke(t.bytes),
            right: He(a.bytes)
        });
    fn = (e)=>({
            coinPublicKey: {
                bytes: ge(e.coinPublicKey)
            },
            currentIndex: e.currentIndex,
            inputs: e.inputs.map(zt),
            outputs: e.outputs.map(({ coinInfo: t, recipient: a })=>({
                    coinInfo: Kt(t),
                    recipient: ln(a)
                }))
        });
    rr = (e)=>({
            coinPublicKey: Ke(e.coinPublicKey.bytes),
            currentIndex: e.currentIndex,
            inputs: e.inputs.map(Zt),
            outputs: e.outputs.map(({ coinInfo: t, recipient: a })=>({
                    coinInfo: Qt(t),
                    recipient: un(a)
                }))
        });
    ar = function(e, t) {
        return e.currentZswapLocalState = {
            ...e.currentZswapLocalState,
            inputs: e.currentZswapLocalState.inputs.concat(t)
        }, [];
    };
    function Ye(e, t) {
        return Gt({
            value: Qe.toValue(e),
            alignment: Qe.alignment()
        }, {
            value: Ze.toValue(t),
            alignment: Ze.alignment()
        });
    }
    or = 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
            })
        }, [];
    };
    ir = function(e) {
        return e.currentZswapLocalState.coinPublicKey;
    };
    let pn, gn, mn, yn;
    cr = (e, t, a)=>e.currentQueryContext.comIndices.has(Xt(m.fromValue(Ye(t, a).value)));
    sr = (e, t)=>({
            initialPrivateState: e,
            initialZswapLocalState: Je(t)
        });
    pn = (e)=>{
        let t;
        if (e instanceof Fe) t = e;
        else if (e instanceof ze) t = e.data;
        else if (e instanceof jt) t = new Fe(e);
        else throw new g(`'contractState' parameter ${e} has unexpected type`);
        return t;
    };
    gn = (e, t, a)=>{
        const o = new Yt(pn(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;
    };
    mn = (e)=>typeof e == "object" && e !== null && "coinPublicKey" in e && typeof e.coinPublicKey == "string" && "currentIndex" in e && "inputs" in e && "outputs" in e;
    yn = (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;
    lr = (e, t, a, o, i, l, u)=>{
        const U = gn(a, e, u);
        let A;
        return mn(t) ? A = fn(t) : yn(t) ? A = t : A = Je(t), {
            currentPrivateState: o,
            currentZswapLocalState: A,
            currentQueryContext: U,
            costModel: l ?? Jt.initialCostModel(),
            gasLimit: i
        };
    };
    ur = ()=>({
            readTime: 0n,
            computeTime: 0n,
            bytesWritten: 0n,
            bytesDeleted: 0n
        });
    fr = (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;
        }
    };
    pr = 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 dn(e) {
        Xe(e) || Z("contract address", e);
    }
    function hn(e) {
        je(e) || Z("vector", e);
    }
    function Sn(e) {
        et(e) || Z("struct", e);
    }
    function vn(e) {
        me(e) || Z("Compact value", e);
    }
    function wn(e) {
        return vn(e), e;
    }
    const _ = (e, t, a)=>{
        e.tag == "contractAddress" ? (dn(t), a.add(He(t.bytes))) : e.tag == "struct" ? (Sn(t), Object.keys(t).forEach((o)=>_(e.elements[o], t[o], a))) : (hn(t), t.forEach((o)=>_(e.sparseType, o, a)));
    }, tt = (e, { value: t })=>wn(e.fromValue(t)), ye = (e, t)=>tt(e, t.asCell()), Vn = (e, t, a)=>{
        const { sparseType: o, descriptor: i } = e.valueType;
        _(o, ye(i, t), a);
    }, Cn = (e, t, a)=>{
        const { sparseType: o, descriptor: i } = e.valueType;
        t.forEach((l)=>_(o, ye(i, l), a));
    }, Tn = (e, t, a)=>{
        const { keyType: o, valueType: i } = e;
        t.keys().forEach((l)=>{
            if (o && _(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" ? _(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, $n, rt;
    nt = (e, t, a)=>{
        if (e.tag == "cell") Vn(e, t, a);
        else if (e.tag == "map") {
            const o = t.asMap();
            pe(o, t, "map"), Tn(e, o, a);
        } else if (e.tag == "list" || e.tag == "set") {
            const o = t.asArray();
            pe(o, t, "array"), Cn(e, o, a);
        }
    };
    $n = (e)=>{
        const t = e.asArray();
        return pe(t, e, "array"), t;
    };
    rt = (e, t, a)=>{
        const o = $n(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);
        });
    };
    gr = (e, t)=>{
        const a = new Set;
        return e.indices && rt(e, t, a), [
            ...a
        ];
    };
});
export { m as Bytes32Descriptor, dr as CONTRACT_ADDRESS_BYTE_LENGTH, Fe as ChargedState, g as CompactError, L as CompactTypeBoolean, sn as CompactTypeBytes, Bn as CompactTypeEnum, Ge as CompactTypeField, se as CompactTypeMerkleTreeDigest, kn as CompactTypeMerkleTreePath, an as CompactTypeMerkleTreePathEntry, E as CompactTypeNativePoint, Un as CompactTypeOpaqueString, Pn as CompactTypeOpaqueUint8Array, on as CompactTypeUnsignedInteger, cn as CompactTypeVector, fe as ContractAddressDescriptor, hr as ContractMaintenanceAuthority, Sr as ContractOperation, ze as ContractState, Jt as CostModel, vr as DUMMY_ADDRESS, wr as HEX_REGEX_NO_PREFIX, N as MAX_FIELD, le as MaxUint8Descriptor, Yt as QueryContext, Vr as QueryResults, Qe as ShieldedCoinInfoDescriptor, Ze as ShieldedCoinRecipientDescriptor, Cr as StateBoundedMerkleTree, Tr as StateMap, jt as StateValue, $r as VmResults, Ir as VmStack, ue as ZswapCoinPublicKeyDescriptor, qn as addField, jn as alignedConcat, _n as assert, Er as bigIntModFr, T as bigIntToValue, Rn as checkRuntimeVersion, br as communicationCommitment, Ar as communicationCommitmentRandomness, gr as contractDependencies, tr as convertBytesToField, nr as convertBytesToUint, er as convertFieldToBytes, lr as createCircuitContext, sr as createConstructorContext, pr as createWitnessContext, ar as createZswapInput, or as createZswapOutput, Ke as decodeCoinPublicKey, He as decodeContractAddress, Zt as decodeQualifiedShieldedCoinInfo, Mr as decodeRawTokenType, un as decodeRecipient, Qt as decodeShieldedCoinInfo, Or as decodeUserAddress, rr as decodeZswapLocalState, Kn as degradeToTransient, xr as dummyContractAddress, Lr as dummyUserAddress, Gn as ecAdd, Jn as ecMul, Yn as ecMulGenerator, ur as emptyRunningCost, Je as emptyZswapLocalState, ge as encodeCoinPublicKey, Ht as encodeContractAddress, zt as encodeQualifiedShieldedCoinInfo, _r as encodeRawTokenType, ln as encodeRecipient, Kt as encodeShieldedCoinInfo, Dr as encodeUserAddress, fn as encodeZswapLocalState, Rr as entryPointHash, En as fromHex, cr as hasCoinCommitment, Xn as hashToCurve, kr as isContractAddress, Xe as isEncodedContractAddress, Br as leafHash, Pr as maxAlignedSize, Ur as maxField, Wn as mulField, ir as ownPublicKey, Hn as persistentCommit, Zn as persistentHash, qr as proofDataIntoSerializedPreimage, fr as queryLedgerState, Fr as rawTokenType, Wr as runProgram, Gt as runtimeCoinCommitment, Nr as sampleContractAddress, Qr as sampleRawTokenType, Zr as sampleSigningKey, Hr as sampleUserAddress, Kr as signData, zr as signatureVerifyingKey, Xr as signingKeyFromBip340, Fn as subField, Xt as toHex, Qn as transientCommit, Nn as transientHash, Dn as typeError, zn as upgradeFromTransient, b as valueToBigInt, Gr as verifySignature, Ne as versionString, __tla };
