UNPKG

@blacksmithgu/datacore

Version:

Reactive data engine for Obsidian.md.

1,171 lines (1,169 loc) 401 kB
/* Datacore: Autogenerated ESBuild file. See https://github.com/blacksmithgu/datacore for source. */ var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/parsimmon/build/parsimmon.umd.min.js var require_parsimmon_umd_min = __commonJS({ "node_modules/parsimmon/build/parsimmon.umd.min.js"(exports, module2) { !function(n2, t) { "object" == typeof exports && "object" == typeof module2 ? module2.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.Parsimmon = t() : n2.Parsimmon = t(); }("undefined" != typeof self ? self : exports, function() { return function(n2) { var t = {}; function r(e) { if (t[e]) return t[e].exports; var u = t[e] = { i: e, l: false, exports: {} }; return n2[e].call(u.exports, u, u.exports, r), u.l = true, u.exports; } return r.m = n2, r.c = t, r.d = function(n3, t2, e) { r.o(n3, t2) || Object.defineProperty(n3, t2, { configurable: false, enumerable: true, get: e }); }, r.r = function(n3) { Object.defineProperty(n3, "__esModule", { value: true }); }, r.n = function(n3) { var t2 = n3 && n3.__esModule ? function() { return n3.default; } : function() { return n3; }; return r.d(t2, "a", t2), t2; }, r.o = function(n3, t2) { return Object.prototype.hasOwnProperty.call(n3, t2); }, r.p = "", r(r.s = 0); }([function(n2, t, r) { "use strict"; function e(n3) { if (!(this instanceof e)) return new e(n3); this._ = n3; } var u = e.prototype; function o(n3, t2) { for (var r2 = 0; r2 < n3; r2++) t2(r2); } function i(n3, t2, r2) { return function(n4, t3) { o(t3.length, function(r3) { n4(t3[r3], r3, t3); }); }(function(r3, e2, u2) { t2 = n3(t2, r3, e2, u2); }, r2), t2; } function a(n3, t2) { return i(function(t3, r2, e2, u2) { return t3.concat([n3(r2, e2, u2)]); }, [], t2); } function f(n3, t2) { var r2 = { v: 0, buf: t2 }; return o(n3, function() { var n4; r2 = { v: r2.v << 1 | (n4 = r2.buf, n4[0] >> 7), buf: function(n5) { var t3 = i(function(n6, t4, r3, e2) { return n6.concat(r3 === e2.length - 1 ? Buffer.from([t4, 0]).readUInt16BE(0) : e2.readUInt16BE(r3)); }, [], n5); return Buffer.from(a(function(n6) { return (n6 << 1 & 65535) >> 8; }, t3)); }(r2.buf) }; }), r2; } function c() { return "undefined" != typeof Buffer; } function s2() { if (!c()) throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser."); } function l2(n3) { s2(); var t2 = i(function(n4, t3) { return n4 + t3; }, 0, n3); if (t2 % 8 != 0) throw new Error("The bits [" + n3.join(", ") + "] add up to " + t2 + " which is not an even number of bytes; the total should be divisible by 8"); var r2, u2 = t2 / 8, o2 = (r2 = function(n4) { return n4 > 48; }, i(function(n4, t3) { return n4 || (r2(t3) ? t3 : n4); }, null, n3)); if (o2) throw new Error(o2 + " bit range requested exceeds 48 bit (6 byte) Number max."); return new e(function(t3, r3) { var e2 = u2 + r3; return e2 > t3.length ? x(r3, u2.toString() + " bytes") : b(e2, i(function(n4, t4) { var r4 = f(t4, n4.buf); return { coll: n4.coll.concat(r4.v), buf: r4.buf }; }, { coll: [], buf: t3.slice(r3, e2) }, n3).coll); }); } function h(n3, t2) { return new e(function(r2, e2) { return s2(), e2 + t2 > r2.length ? x(e2, t2 + " bytes for " + n3) : b(e2 + t2, r2.slice(e2, e2 + t2)); }); } function p(n3, t2) { if ("number" != typeof (r2 = t2) || Math.floor(r2) !== r2 || t2 < 0 || t2 > 6) throw new Error(n3 + " requires integer length in range [0, 6]."); var r2; } function d(n3) { return p("uintBE", n3), h("uintBE(" + n3 + ")", n3).map(function(t2) { return t2.readUIntBE(0, n3); }); } function v(n3) { return p("uintLE", n3), h("uintLE(" + n3 + ")", n3).map(function(t2) { return t2.readUIntLE(0, n3); }); } function g(n3) { return p("intBE", n3), h("intBE(" + n3 + ")", n3).map(function(t2) { return t2.readIntBE(0, n3); }); } function m(n3) { return p("intLE", n3), h("intLE(" + n3 + ")", n3).map(function(t2) { return t2.readIntLE(0, n3); }); } function y(n3) { return n3 instanceof e; } function E(n3) { return "[object Array]" === {}.toString.call(n3); } function w(n3) { return c() && Buffer.isBuffer(n3); } function b(n3, t2) { return { status: true, index: n3, value: t2, furthest: -1, expected: [] }; } function x(n3, t2) { return E(t2) || (t2 = [t2]), { status: false, index: -1, value: null, furthest: n3, expected: t2 }; } function B(n3, t2) { if (!t2) return n3; if (n3.furthest > t2.furthest) return n3; var r2 = n3.furthest === t2.furthest ? function(n4, t3) { if (function() { if (void 0 !== e._supportsSet) return e._supportsSet; var n5 = "undefined" != typeof Set; return e._supportsSet = n5, n5; }() && Array.from) { for (var r3 = new Set(n4), u2 = 0; u2 < t3.length; u2++) r3.add(t3[u2]); var o2 = Array.from(r3); return o2.sort(), o2; } for (var i2 = {}, a2 = 0; a2 < n4.length; a2++) i2[n4[a2]] = true; for (var f2 = 0; f2 < t3.length; f2++) i2[t3[f2]] = true; var c2 = []; for (var s3 in i2) ({}).hasOwnProperty.call(i2, s3) && c2.push(s3); return c2.sort(), c2; }(n3.expected, t2.expected) : t2.expected; return { status: n3.status, index: n3.index, value: n3.value, furthest: t2.furthest, expected: r2 }; } var j = {}; function S(n3, t2) { if (w(n3)) return { offset: t2, line: -1, column: -1 }; n3 in j || (j[n3] = {}); for (var r2 = j[n3], e2 = 0, u2 = 0, o2 = 0, i2 = t2; i2 >= 0; ) { if (i2 in r2) { e2 = r2[i2].line, 0 === o2 && (o2 = r2[i2].lineStart); break; } ("\n" === n3.charAt(i2) || "\r" === n3.charAt(i2) && "\n" !== n3.charAt(i2 + 1)) && (u2++, 0 === o2 && (o2 = i2 + 1)), i2--; } var a2 = e2 + u2, f2 = t2 - o2; return r2[t2] = { line: a2, lineStart: o2 }, { offset: t2, line: a2 + 1, column: f2 + 1 }; } function _(n3) { if (!y(n3)) throw new Error("not a parser: " + n3); } function L(n3, t2) { return "string" == typeof n3 ? n3.charAt(t2) : n3[t2]; } function O(n3) { if ("number" != typeof n3) throw new Error("not a number: " + n3); } function k(n3) { if ("function" != typeof n3) throw new Error("not a function: " + n3); } function P4(n3) { if ("string" != typeof n3) throw new Error("not a string: " + n3); } var q = 2, A = 3, I = 8, F = 5 * I, M = 4 * I, z = " "; function R(n3, t2) { return new Array(t2 + 1).join(n3); } function U(n3, t2, r2) { var e2 = t2 - n3.length; return e2 <= 0 ? n3 : R(r2, e2) + n3; } function W(n3, t2, r2, e2) { return { from: n3 - t2 > 0 ? n3 - t2 : 0, to: n3 + r2 > e2 ? e2 : n3 + r2 }; } function D(n3, t2) { var r2, e2, u2, o2, f2, c2 = t2.index, s3 = c2.offset, l3 = 1; if (s3 === n3.length) return "Got the end of the input"; if (w(n3)) { var h2 = s3 - s3 % I, p2 = s3 - h2, d2 = W(h2, F, M + I, n3.length), v2 = a(function(n4) { return a(function(n5) { return U(n5.toString(16), 2, "0"); }, n4); }, function(n4, t3) { var r3 = n4.length, e3 = [], u3 = 0; if (r3 <= t3) return [n4.slice()]; for (var o3 = 0; o3 < r3; o3++) e3[u3] || e3.push([]), e3[u3].push(n4[o3]), (o3 + 1) % t3 == 0 && u3++; return e3; }(n3.slice(d2.from, d2.to).toJSON().data, I)); o2 = function(n4) { return 0 === n4.from && 1 === n4.to ? { from: n4.from, to: n4.to } : { from: n4.from / I, to: Math.floor(n4.to / I) }; }(d2), e2 = h2 / I, r2 = 3 * p2, p2 >= 4 && (r2 += 1), l3 = 2, u2 = a(function(n4) { return n4.length <= 4 ? n4.join(" ") : n4.slice(0, 4).join(" ") + " " + n4.slice(4).join(" "); }, v2), (f2 = (8 * (o2.to > 0 ? o2.to - 1 : o2.to)).toString(16).length) < 2 && (f2 = 2); } else { var g2 = n3.split(/\r\n|[\n\r\u2028\u2029]/); r2 = c2.column - 1, e2 = c2.line - 1, o2 = W(e2, q, A, g2.length), u2 = g2.slice(o2.from, o2.to), f2 = o2.to.toString().length; } var m2 = e2 - o2.from; return w(n3) && (f2 = (8 * (o2.to > 0 ? o2.to - 1 : o2.to)).toString(16).length) < 2 && (f2 = 2), i(function(t3, e3, u3) { var i2, a2 = u3 === m2, c3 = a2 ? "> " : z; return i2 = w(n3) ? U((8 * (o2.from + u3)).toString(16), f2, "0") : U((o2.from + u3 + 1).toString(), f2, " "), [].concat(t3, [c3 + i2 + " | " + e3], a2 ? [z + R(" ", f2) + " | " + U("", r2, " ") + R("^", l3)] : []); }, [], u2).join("\n"); } function N(n3, t2) { return ["\n", "-- PARSING FAILED " + R("-", 50), "\n\n", D(n3, t2), "\n\n", (r2 = t2.expected, 1 === r2.length ? "Expected:\n\n" + r2[0] : "Expected one of the following: \n\n" + r2.join(", ")), "\n"].join(""); var r2; } function G(n3) { return void 0 !== n3.flags ? n3.flags : [n3.global ? "g" : "", n3.ignoreCase ? "i" : "", n3.multiline ? "m" : "", n3.unicode ? "u" : "", n3.sticky ? "y" : ""].join(""); } function C() { for (var n3 = [].slice.call(arguments), t2 = n3.length, r2 = 0; r2 < t2; r2 += 1) _(n3[r2]); return e(function(r3, e2) { for (var u2, o2 = new Array(t2), i2 = 0; i2 < t2; i2 += 1) { if (!(u2 = B(n3[i2]._(r3, e2), u2)).status) return u2; o2[i2] = u2.value, e2 = u2.index; } return B(b(e2, o2), u2); }); } function J() { var n3 = [].slice.call(arguments); if (0 === n3.length) throw new Error("seqMap needs at least one argument"); var t2 = n3.pop(); return k(t2), C.apply(null, n3).map(function(n4) { return t2.apply(null, n4); }); } function T() { var n3 = [].slice.call(arguments), t2 = n3.length; if (0 === t2) return Y("zero alternates"); for (var r2 = 0; r2 < t2; r2 += 1) _(n3[r2]); return e(function(t3, r3) { for (var e2, u2 = 0; u2 < n3.length; u2 += 1) if ((e2 = B(n3[u2]._(t3, r3), e2)).status) return e2; return e2; }); } function V(n3, t2) { return H(n3, t2).or(X([])); } function H(n3, t2) { return _(n3), _(t2), J(n3, t2.then(n3).many(), function(n4, t3) { return [n4].concat(t3); }); } function K(n3) { P4(n3); var t2 = "'" + n3 + "'"; return e(function(r2, e2) { var u2 = e2 + n3.length, o2 = r2.slice(e2, u2); return o2 === n3 ? b(u2, o2) : x(e2, t2); }); } function Q(n3, t2) { !function(n4) { if (!(n4 instanceof RegExp)) throw new Error("not a regexp: " + n4); for (var t3 = G(n4), r3 = 0; r3 < t3.length; r3++) { var e2 = t3.charAt(r3); if ("i" !== e2 && "m" !== e2 && "u" !== e2 && "s" !== e2) throw new Error('unsupported regexp flag "' + e2 + '": ' + n4); } }(n3), arguments.length >= 2 ? O(t2) : t2 = 0; var r2 = function(n4) { return RegExp("^(?:" + n4.source + ")", G(n4)); }(n3), u2 = "" + n3; return e(function(n4, e2) { var o2 = r2.exec(n4.slice(e2)); if (o2) { if (0 <= t2 && t2 <= o2.length) { var i2 = o2[0], a2 = o2[t2]; return b(e2 + i2.length, a2); } return x(e2, "valid match group (0 to " + o2.length + ") in " + u2); } return x(e2, u2); }); } function X(n3) { return e(function(t2, r2) { return b(r2, n3); }); } function Y(n3) { return e(function(t2, r2) { return x(r2, n3); }); } function Z(n3) { if (y(n3)) return e(function(t2, r2) { var e2 = n3._(t2, r2); return e2.index = r2, e2.value = "", e2; }); if ("string" == typeof n3) return Z(K(n3)); if (n3 instanceof RegExp) return Z(Q(n3)); throw new Error("not a string, regexp, or parser: " + n3); } function $(n3) { return _(n3), e(function(t2, r2) { var e2 = n3._(t2, r2), u2 = t2.slice(r2, e2.index); return e2.status ? x(r2, 'not "' + u2 + '"') : b(r2, null); }); } function nn(n3) { return k(n3), e(function(t2, r2) { var e2 = L(t2, r2); return r2 < t2.length && n3(e2) ? b(r2 + 1, e2) : x(r2, "a character/byte matching " + n3); }); } function tn(n3, t2) { arguments.length < 2 && (t2 = n3, n3 = void 0); var r2 = e(function(n4, e2) { return r2._ = t2()._, r2._(n4, e2); }); return n3 ? r2.desc(n3) : r2; } function rn() { return Y("fantasy-land/empty"); } u.parse = function(n3) { if ("string" != typeof n3 && !w(n3)) throw new Error(".parse must be called with a string or Buffer as its argument"); var t2, r2 = this.skip(an)._(n3, 0); return t2 = r2.status ? { status: true, value: r2.value } : { status: false, index: S(n3, r2.furthest), expected: r2.expected }, delete j[n3], t2; }, u.tryParse = function(n3) { var t2 = this.parse(n3); if (t2.status) return t2.value; var r2 = N(n3, t2), e2 = new Error(r2); throw e2.type = "ParsimmonError", e2.result = t2, e2; }, u.assert = function(n3, t2) { return this.chain(function(r2) { return n3(r2) ? X(r2) : Y(t2); }); }, u.or = function(n3) { return T(this, n3); }, u.trim = function(n3) { return this.wrap(n3, n3); }, u.wrap = function(n3, t2) { return J(n3, this, t2, function(n4, t3) { return t3; }); }, u.thru = function(n3) { return n3(this); }, u.then = function(n3) { return _(n3), C(this, n3).map(function(n4) { return n4[1]; }); }, u.many = function() { var n3 = this; return e(function(t2, r2) { for (var e2 = [], u2 = void 0; ; ) { if (!(u2 = B(n3._(t2, r2), u2)).status) return B(b(r2, e2), u2); if (r2 === u2.index) throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause"); r2 = u2.index, e2.push(u2.value); } }); }, u.tieWith = function(n3) { return P4(n3), this.map(function(t2) { if (function(n4) { if (!E(n4)) throw new Error("not an array: " + n4); }(t2), t2.length) { P4(t2[0]); for (var r2 = t2[0], e2 = 1; e2 < t2.length; e2++) P4(t2[e2]), r2 += n3 + t2[e2]; return r2; } return ""; }); }, u.tie = function() { return this.tieWith(""); }, u.times = function(n3, t2) { var r2 = this; return arguments.length < 2 && (t2 = n3), O(n3), O(t2), e(function(e2, u2) { for (var o2 = [], i2 = void 0, a2 = void 0, f2 = 0; f2 < n3; f2 += 1) { if (a2 = B(i2 = r2._(e2, u2), a2), !i2.status) return a2; u2 = i2.index, o2.push(i2.value); } for (; f2 < t2 && (a2 = B(i2 = r2._(e2, u2), a2), i2.status); f2 += 1) u2 = i2.index, o2.push(i2.value); return B(b(u2, o2), a2); }); }, u.result = function(n3) { return this.map(function() { return n3; }); }, u.atMost = function(n3) { return this.times(0, n3); }, u.atLeast = function(n3) { return J(this.times(n3), this.many(), function(n4, t2) { return n4.concat(t2); }); }, u.map = function(n3) { k(n3); var t2 = this; return e(function(r2, e2) { var u2 = t2._(r2, e2); return u2.status ? B(b(u2.index, n3(u2.value)), u2) : u2; }); }, u.contramap = function(n3) { k(n3); var t2 = this; return e(function(r2, e2) { var u2 = t2.parse(n3(r2.slice(e2))); return u2.status ? b(e2 + r2.length, u2.value) : u2; }); }, u.promap = function(n3, t2) { return k(n3), k(t2), this.contramap(n3).map(t2); }, u.skip = function(n3) { return C(this, n3).map(function(n4) { return n4[0]; }); }, u.mark = function() { return J(en, this, en, function(n3, t2, r2) { return { start: n3, value: t2, end: r2 }; }); }, u.node = function(n3) { return J(en, this, en, function(t2, r2, e2) { return { name: n3, value: r2, start: t2, end: e2 }; }); }, u.sepBy = function(n3) { return V(this, n3); }, u.sepBy1 = function(n3) { return H(this, n3); }, u.lookahead = function(n3) { return this.skip(Z(n3)); }, u.notFollowedBy = function(n3) { return this.skip($(n3)); }, u.desc = function(n3) { E(n3) || (n3 = [n3]); var t2 = this; return e(function(r2, e2) { var u2 = t2._(r2, e2); return u2.status || (u2.expected = n3), u2; }); }, u.fallback = function(n3) { return this.or(X(n3)); }, u.ap = function(n3) { return J(n3, this, function(n4, t2) { return n4(t2); }); }, u.chain = function(n3) { var t2 = this; return e(function(r2, e2) { var u2 = t2._(r2, e2); return u2.status ? B(n3(u2.value)._(r2, u2.index), u2) : u2; }); }, u.concat = u.or, u.empty = rn, u.of = X, u["fantasy-land/ap"] = u.ap, u["fantasy-land/chain"] = u.chain, u["fantasy-land/concat"] = u.concat, u["fantasy-land/empty"] = u.empty, u["fantasy-land/of"] = u.of, u["fantasy-land/map"] = u.map; var en = e(function(n3, t2) { return b(t2, S(n3, t2)); }), un = e(function(n3, t2) { return t2 >= n3.length ? x(t2, "any character/byte") : b(t2 + 1, L(n3, t2)); }), on = e(function(n3, t2) { return b(n3.length, n3.slice(t2)); }), an = e(function(n3, t2) { return t2 < n3.length ? x(t2, "EOF") : b(t2, null); }), fn = Q(/[0-9]/).desc("a digit"), cn = Q(/[0-9]*/).desc("optional digits"), sn = Q(/[a-z]/i).desc("a letter"), ln = Q(/[a-z]*/i).desc("optional letters"), hn = Q(/\s*/).desc("optional whitespace"), pn = Q(/\s+/).desc("whitespace"), dn = K("\r"), vn = K("\n"), gn = K("\r\n"), mn = T(gn, vn, dn).desc("newline"), yn = T(mn, an); e.all = on, e.alt = T, e.any = un, e.cr = dn, e.createLanguage = function(n3) { var t2 = {}; for (var r2 in n3) ({}).hasOwnProperty.call(n3, r2) && function(r3) { t2[r3] = tn(function() { return n3[r3](t2); }); }(r2); return t2; }, e.crlf = gn, e.custom = function(n3) { return e(n3(b, x)); }, e.digit = fn, e.digits = cn, e.empty = rn, e.end = yn, e.eof = an, e.fail = Y, e.formatError = N, e.index = en, e.isParser = y, e.lazy = tn, e.letter = sn, e.letters = ln, e.lf = vn, e.lookahead = Z, e.makeFailure = x, e.makeSuccess = b, e.newline = mn, e.noneOf = function(n3) { return nn(function(t2) { return n3.indexOf(t2) < 0; }).desc("none of '" + n3 + "'"); }, e.notFollowedBy = $, e.of = X, e.oneOf = function(n3) { for (var t2 = n3.split(""), r2 = 0; r2 < t2.length; r2++) t2[r2] = "'" + t2[r2] + "'"; return nn(function(t3) { return n3.indexOf(t3) >= 0; }).desc(t2); }, e.optWhitespace = hn, e.Parser = e, e.range = function(n3, t2) { return nn(function(r2) { return n3 <= r2 && r2 <= t2; }).desc(n3 + "-" + t2); }, e.regex = Q, e.regexp = Q, e.sepBy = V, e.sepBy1 = H, e.seq = C, e.seqMap = J, e.seqObj = function() { for (var n3, t2 = {}, r2 = 0, u2 = (n3 = arguments, Array.prototype.slice.call(n3)), o2 = u2.length, i2 = 0; i2 < o2; i2 += 1) { var a2 = u2[i2]; if (!y(a2)) { if (E(a2) && 2 === a2.length && "string" == typeof a2[0] && y(a2[1])) { var f2 = a2[0]; if (Object.prototype.hasOwnProperty.call(t2, f2)) throw new Error("seqObj: duplicate key " + f2); t2[f2] = true, r2++; continue; } throw new Error("seqObj arguments must be parsers or [string, parser] array pairs."); } } if (0 === r2) throw new Error("seqObj expects at least one named parser, found zero"); return e(function(n4, t3) { for (var r3, e2 = {}, i3 = 0; i3 < o2; i3 += 1) { var a3, f3; if (E(u2[i3]) ? (a3 = u2[i3][0], f3 = u2[i3][1]) : (a3 = null, f3 = u2[i3]), !(r3 = B(f3._(n4, t3), r3)).status) return r3; a3 && (e2[a3] = r3.value), t3 = r3.index; } return B(b(t3, e2), r3); }); }, e.string = K, e.succeed = X, e.takeWhile = function(n3) { return k(n3), e(function(t2, r2) { for (var e2 = r2; e2 < t2.length && n3(L(t2, e2)); ) e2++; return b(e2, t2.slice(r2, e2)); }); }, e.test = nn, e.whitespace = pn, e["fantasy-land/empty"] = rn, e["fantasy-land/of"] = X, e.Binary = { bitSeq: l2, bitSeqObj: function(n3) { s2(); var t2 = {}, r2 = 0, e2 = a(function(n4) { if (E(n4)) { var e3 = n4; if (2 !== e3.length) throw new Error("[" + e3.join(", ") + "] should be length 2, got length " + e3.length); if (P4(e3[0]), O(e3[1]), Object.prototype.hasOwnProperty.call(t2, e3[0])) throw new Error("duplicate key in bitSeqObj: " + e3[0]); return t2[e3[0]] = true, r2++, e3; } return O(n4), [null, n4]; }, n3); if (r2 < 1) throw new Error("bitSeqObj expects at least one named pair, got [" + n3.join(", ") + "]"); var u2 = a(function(n4) { return n4[0]; }, e2); return l2(a(function(n4) { return n4[1]; }, e2)).map(function(n4) { return i(function(n5, t3) { return null !== t3[0] && (n5[t3[0]] = t3[1]), n5; }, {}, a(function(t3, r3) { return [t3, n4[r3]]; }, u2)); }); }, byte: function(n3) { if (s2(), O(n3), n3 > 255) throw new Error("Value specified to byte constructor (" + n3 + "=0x" + n3.toString(16) + ") is larger in value than a single byte."); var t2 = (n3 > 15 ? "0x" : "0x0") + n3.toString(16); return e(function(r2, e2) { var u2 = L(r2, e2); return u2 === n3 ? b(e2 + 1, u2) : x(e2, t2); }); }, buffer: function(n3) { return h("buffer", n3).map(function(n4) { return Buffer.from(n4); }); }, encodedString: function(n3, t2) { return h("string", t2).map(function(t3) { return t3.toString(n3); }); }, uintBE: d, uint8BE: d(1), uint16BE: d(2), uint32BE: d(4), uintLE: v, uint8LE: v(1), uint16LE: v(2), uint32LE: v(4), intBE: g, int8BE: g(1), int16BE: g(2), int32BE: g(4), intLE: m, int8LE: m(1), int16LE: m(2), int32LE: m(4), floatBE: h("floatBE", 4).map(function(n3) { return n3.readFloatBE(0); }), floatLE: h("floatLE", 4).map(function(n3) { return n3.readFloatLE(0); }), doubleBE: h("doubleBE", 8).map(function(n3) { return n3.readDoubleBE(0); }), doubleLE: h("doubleLE", 8).map(function(n3) { return n3.readDoubleLE(0); }) }, n2.exports = e; }]); }); } }); // node_modules/sorted-btree/b+tree.js var require_b_tree = __commonJS({ "node_modules/sorted-btree/b+tree.js"(exports) { "use strict"; var __extends = exports && exports.__extends || function() { var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { d2.__proto__ = b2; } || function(d2, b2) { for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; }; return extendStatics(d, b); }; return function(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); exports.EmptyBTree = exports.asSet = exports.simpleComparator = exports.defaultComparator = void 0; function defaultComparator(a, b) { if (Number.isFinite(a) && Number.isFinite(b)) { return a - b; } var ta = typeof a; var tb = typeof b; if (ta !== tb) { return ta < tb ? -1 : 1; } if (ta === "object") { if (a === null) return b === null ? 0 : -1; else if (b === null) return 1; a = a.valueOf(); b = b.valueOf(); ta = typeof a; tb = typeof b; if (ta !== tb) { return ta < tb ? -1 : 1; } } if (a < b) return -1; if (a > b) return 1; if (a === b) return 0; if (Number.isNaN(a)) return Number.isNaN(b) ? 0 : -1; else if (Number.isNaN(b)) return 1; return Array.isArray(a) ? 0 : Number.NaN; } exports.defaultComparator = defaultComparator; function simpleComparator(a, b) { return a > b ? 1 : a < b ? -1 : 0; } exports.simpleComparator = simpleComparator; var BTree2 = ( /** @class */ function() { function BTree3(entries, compare, maxNodeSize) { this._root = EmptyLeaf; this._size = 0; this._maxNodeSize = maxNodeSize >= 4 ? Math.min(maxNodeSize, 256) : 32; this._compare = compare || defaultComparator; if (entries) this.setPairs(entries); } Object.defineProperty(BTree3.prototype, "size", { ///////////////////////////////////////////////////////////////////////////// // ES6 Map<K,V> methods ///////////////////////////////////////////////////// /** Gets the number of key-value pairs in the tree. */ get: function() { return this._size; }, enumerable: false, configurable: true }); Object.defineProperty(BTree3.prototype, "length", { /** Gets the number of key-value pairs in the tree. */ get: function() { return this._size; }, enumerable: false, configurable: true }); Object.defineProperty(BTree3.prototype, "isEmpty", { /** Returns true iff the tree contains no key-value pairs. */ get: function() { return this._size === 0; }, enumerable: false, configurable: true }); BTree3.prototype.clear = function() { this._root = EmptyLeaf; this._size = 0; }; BTree3.prototype.forEach = function(callback, thisArg) { var _this = this; if (thisArg !== void 0) callback = callback.bind(thisArg); return this.forEachPair(function(k, v) { return callback(v, k, _this); }); }; BTree3.prototype.forEachPair = function(callback, initialCounter) { var low = this.minKey(), high = this.maxKey(); return this.forRange(low, high, true, callback, initialCounter); }; BTree3.prototype.get = function(key, defaultValue) { return this._root.get(key, defaultValue, this); }; BTree3.prototype.set = function(key, value, overwrite) { if (this._root.isShared) this._root = this._root.clone(); var result = this._root.set(key, value, overwrite, this); if (result === true || result === false) return result; this._root = new BNodeInternal([this._root, result]); return true; }; BTree3.prototype.has = function(key) { return this.forRange(key, key, true, void 0) !== 0; }; BTree3.prototype.delete = function(key) { return this.editRange(key, key, true, DeleteRange) !== 0; }; BTree3.prototype.with = function(key, value, overwrite) { var nu = this.clone(); return nu.set(key, value, overwrite) || overwrite ? nu : this; }; BTree3.prototype.withPairs = function(pairs, overwrite) { var nu = this.clone(); return nu.setPairs(pairs, overwrite) !== 0 || overwrite ? nu : this; }; BTree3.prototype.withKeys = function(keys, returnThisIfUnchanged) { var nu = this.clone(), changed = false; for (var i = 0; i < keys.length; i++) changed = nu.set(keys[i], void 0, false) || changed; return returnThisIfUnchanged && !changed ? this : nu; }; BTree3.prototype.without = function(key, returnThisIfUnchanged) { return this.withoutRange(key, key, true, returnThisIfUnchanged); }; BTree3.prototype.withoutKeys = function(keys, returnThisIfUnchanged) { var nu = this.clone(); return nu.deleteKeys(keys) || !returnThisIfUnchanged ? nu : this; }; BTree3.prototype.withoutRange = function(low, high, includeHigh, returnThisIfUnchanged) { var nu = this.clone(); if (nu.deleteRange(low, high, includeHigh) === 0 && returnThisIfUnchanged) return this; return nu; }; BTree3.prototype.filter = function(callback, returnThisIfUnchanged) { var nu = this.greedyClone(); var del; nu.editAll(function(k, v, i) { if (!callback(k, v, i)) return del = Delete; }); if (!del && returnThisIfUnchanged) return this; return nu; }; BTree3.prototype.mapValues = function(callback) { var tmp = {}; var nu = this.greedyClone(); nu.editAll(function(k, v, i) { return tmp.value = callback(v, k, i), tmp; }); return nu; }; BTree3.prototype.reduce = function(callback, initialValue) { var i = 0, p = initialValue; var it = this.entries(this.minKey(), ReusedArray), next; while (!(next = it.next()).done) p = callback(p, next.value, i++, this); return p; }; BTree3.prototype.entries = function(lowestKey, reusedArray) { var info = this.findPath(lowestKey); if (info === void 0) return iterator(); var nodequeue = info.nodequeue, nodeindex = info.nodeindex, leaf = info.leaf; var state = reusedArray !== void 0 ? 1 : 0; var i = lowestKey === void 0 ? -1 : leaf.indexOf(lowestKey, 0, this._compare) - 1; return iterator(function() { jump: for (; ; ) { switch (state) { case 0: if (++i < leaf.keys.length) return { done: false, value: [leaf.keys[i], leaf.values[i]] }; state = 2; continue; case 1: if (++i < leaf.keys.length) { reusedArray[0] = leaf.keys[i], reusedArray[1] = leaf.values[i]; return { done: false, value: reusedArray }; } state = 2; case 2: for (var level = -1; ; ) { if (++level >= nodequeue.length) { state = 3; continue jump; } if (++nodeindex[level] < nodequeue[level].length) break; } for (; level > 0; level--) { nodequeue[level - 1] = nodequeue[level][nodeindex[level]].children; nodeindex[level - 1] = 0; } leaf = nodequeue[0][nodeindex[0]]; i = -1; state = reusedArray !== void 0 ? 1 : 0; continue; case 3: return { done: true, value: void 0 }; } } }); }; BTree3.prototype.entriesReversed = function(highestKey, reusedArray, skipHighest) { if (highestKey === void 0) { highestKey = this.maxKey(); skipHighest = void 0; if (highestKey === void 0) return iterator(); } var _a = this.findPath(highestKey) || this.findPath(this.maxKey()), nodequeue = _a.nodequeue, nodeindex = _a.nodeindex, leaf = _a.leaf; check(!nodequeue[0] || leaf === nodequeue[0][nodeindex[0]], "wat!"); var i = leaf.indexOf(highestKey, 0, this._compare); if (!skipHighest && i < leaf.keys.length && this._compare(leaf.keys[i], highestKey) <= 0) i++; var state = reusedArray !== void 0 ? 1 : 0; return iterator(function() { jump: for (; ; ) { switch (state) { case 0: if (--i >= 0) return { done: false, value: [leaf.keys[i], leaf.values[i]] }; state = 2; continue; case 1: if (--i >= 0) { reusedArray[0] = leaf.keys[i], reusedArray[1] = leaf.values[i]; return { done: false, value: reusedArray }; } state = 2; case 2: for (var level = -1; ; ) { if (++level >= nodequeue.length) { state = 3; continue jump; } if (--nodeindex[level] >= 0) break; } for (; level > 0; level--) { nodequeue[level - 1] = nodequeue[level][nodeindex[level]].children; nodeindex[level - 1] = nodequeue[level - 1].length - 1; } leaf = nodequeue[0][nodeindex[0]]; i = leaf.keys.length; state = reusedArray !== void 0 ? 1 : 0; continue; case 3: return { done: true, value: void 0 }; } } }); }; BTree3.prototype.findPath = function(key) { var nextnode = this._root; var nodequeue, nodeindex; if (nextnode.isLeaf) { nodequeue = EmptyArray, nodeindex = EmptyArray; } else { nodequeue = [], nodeindex = []; for (var d = 0; !nextnode.isLeaf; d++) { nodequeue[d] = nextnode.children; nodeindex[d] = key === void 0 ? 0 : nextnode.indexOf(key, 0, this._compare); if (nodeindex[d] >= nodequeue[d].length) return; nextnode = nodequeue[d][nodeindex[d]]; } nodequeue.reverse(); nodeindex.reverse(); } return { nodequeue, nodeindex, leaf: nextnode }; }; BTree3.prototype.diffAgainst = function(other, onlyThis, onlyOther, different) { if (other._compare !== this._compare) { throw new Error("Tree comparators are not the same."); } if (this.isEmpty || other.isEmpty) { if (this.isEmpty && other.isEmpty) return void 0; if (this.isEmpty) return onlyOther === void 0 ? void 0 : BTree3.stepToEnd(BTree3.makeDiffCursor(other), onlyOther); return onlyThis === void 0 ? void 0 : BTree3.stepToEnd(BTree3.makeDiffCursor(this), onlyThis); } var _compare = this._compare; var thisCursor = BTree3.makeDiffCursor(this); var otherCursor = BTree3.makeDiffCursor(other); var thisSuccess = true, otherSuccess = true, prevCursorOrder = BTree3.compare(thisCursor, otherCursor, _compare); while (thisSuccess && otherSuccess) { var cursorOrder = BTree3.compare(thisCursor, otherCursor, _compare); var thisLeaf = thisCursor.leaf, thisInternalSpine = thisCursor.internalSpine, thisLevelIndices = thisCursor.levelIndices; var otherLeaf = otherCursor.leaf, otherInternalSpine = otherCursor.internalSpine, otherLevelIndices = otherCursor.levelIndices; if (thisLeaf || otherLeaf) { if (prevCursorOrder !== 0) { if (cursorOrder === 0) { if (thisLeaf && otherLeaf && different) { var valThis = thisLeaf.values[thisLevelIndices[thisLevelIndices.length - 1]]; var valOther = otherLeaf.values[otherLevelIndices[otherLevelIndices.length - 1]]; if (!Object.is(valThis, valOther)) { var result = different(thisCursor.currentKey, valThis, valOther); if (result && result.break) return result.break; } } } else if (cursorOrder > 0) { if (otherLeaf && onlyOther) { var otherVal = otherLeaf.values[otherLevelIndices[otherLevelIndices.length - 1]]; var result = onlyOther(otherCursor.currentKey, otherVal); if (result && result.break) return result.break; } } else if (onlyThis) { if (thisLeaf && prevCursorOrder !== 0) { var valThis = thisLeaf.values[thisLevelIndices[thisLevelIndices.length - 1]]; var result = onlyThis(thisCursor.currentKey, valThis); if (result && result.break) return result.break; } } } } else if (!thisLeaf && !otherLeaf && cursorOrder === 0) { var lastThis = thisInternalSpine.length - 1; var lastOther = otherInternalSpine.length - 1; var nodeThis = thisInternalSpine[lastThis][thisLevelIndices[lastThis]]; var nodeOther = otherInternalSpine[lastOther][otherLevelIndices[lastOther]]; if (nodeOther === nodeThis) { prevCursorOrder = 0; thisSuccess = BTree3.step(thisCursor, true); otherSuccess = BTree3.step(otherCursor, true); continue; } } prevCursorOrder = cursorOrder; if (cursorOrder < 0) { thisSuccess = BTree3.step(thisCursor); } else { otherSuccess = BTree3.step(otherCursor); } } if (thisSuccess && onlyThis) return BTree3.finishCursorWalk(thisCursor, otherCursor, _compare, onlyThis); if (otherSuccess && onlyOther) return BTree3.finishCursorWalk(otherCursor, thisCursor, _compare, onlyOther); }; BTree3.finishCursorWalk = function(cursor, cursorFinished, compareKeys, callback) { var compared = BTree3.compare(cursor, cursorFinished, compareKeys); if (compared === 0) { if (!BTree3.step(cursor)) return void 0; } else if (compared < 0) { check(false, "cursor walk terminated early"); } return BTree3.stepToEnd(cursor, callback); }; BTree3.stepToEnd = function(cursor, callback) { var canStep = true; while (canStep) { var leaf = cursor.leaf, levelIndices = cursor.levelIndices, currentKey = cursor.currentKey; if (leaf) { var value = leaf.values[levelIndices[levelIndices.length - 1]]; var result = callback(currentKey, value); if (result && result.break) return result.break; } canStep = BTree3.step(cursor); } return void 0; }; BTree3.makeDiffCursor = function(tree) { var _root = tree._root, height = tree.height; return { height, internalSpine: [[_root]], levelIndices: [0], leaf: void 0, currentKey: _root.maxKey() }; }; BTree3.step = function(cursor, stepToNode) { var internalSpine = cursor.internalSpine, levelIndices = cursor.levelIndices, leaf = cursor.leaf; if (stepToNode === true || leaf) { var levelsLength = levelIndices.length; if (stepToNode === true || levelIndices[levelsLength - 1] === 0) { var spineLength = internalSpine.length; if (spineLength === 0) return false; var nodeLevelIndex = spineLength - 1; var levelIndexWalkBack = nodeLevelIndex; while (levelIndexWalkBack >= 0) { if (levelIndices[levelIndexWalkBack] > 0) { if (levelIndexWalkBack < levelsLength - 1) { cursor.leaf = void 0; levelIndices.pop(); } if (levelIndexWalkBack < nodeLevelIndex) cursor.internalSpine = internalSpine.slice(0, levelIndexWalkBack + 1); cursor.currentKey = internalSpine[levelIndexWalkBack][--levelIndices[levelIndexWalkBack]].maxKey(); return true; } levelIndexWalkBack--; } return false; } else { var valueIndex = --levelIndices[levelsLength - 1]; cursor.currentKey = leaf.keys[valueIndex]; return true; } } else { var nextLevel = internalSpine.length; var currentLevel = nextLevel - 1; var node = internalSpine[currentLevel][levelIndices[currentLevel]]; if (node.isLeaf) { cursor.leaf = node; var valueIndex = levelIndices[nextLevel] = node.values.length - 1; cursor.currentKey = node.keys[valueIndex]; } else { var children = node.children; internalSpine[nextLevel] = children; var childIndex = children.length - 1; levelIndices[nextLevel] = childIndex; cursor.currentKey = children[childIndex].maxKey(); } return true; } }; BTree3.compare = function(cursorA, cursorB, compareKeys) { var heightA = cursorA.height, currentKeyA = cursorA.currentKey, levelIndicesA = cursorA.levelIndices; var heightB = cursorB.height, currentKeyB = cursorB.currentKey, levelIndicesB = cursorB.levelIndices; var keyComparison = compareKeys(currentKeyB, currentKeyA); if (keyComparison !== 0) { return keyComparison; } var heightMin = heightA < heightB ? heightA : heightB; var depthANormalized = levelIndicesA.length - (heightA - heightMin); var depthBNormalized = levelIndicesB.length - (heightB - heightMin); return depthANormalized - depthBNormalized; }; BTree3.prototype.keys = function(firstKey) { var it = this.entries(firstKey, ReusedArray); return iterator(function() { var n2 = it.next(); if (n2.value) n2.value = n2.value[0]; return n2; }); }; BTree3.prototype.values = function(firstKey) { var it = this.entries(firstKey, ReusedArray); return iterator(function() { var n2 = it.next(); if (n2.value) n2.value = n2.value[1]; return n2; }); }; Object.defineProperty(BTree3.prototype, "maxNodeSize", { ///////////////////////////////////////////////////////////////////////////// // Additional methods /////////////////////////////////////////////////////// /** Returns the maximum number of children/values before nodes will split. */ get: function() { return this._maxNodeSize; }, enumerable: false, configurable: true }); BTree3.prototype.minKey = function() { return this._root.minKey(); }; BTree3.prototype.maxKey = function() { return this._root.maxKey(); }; BTree3.prototype.clone = function() { this._root.isShared = true; var result = new BTree3(void 0, this._compare, this._maxNodeSize); result._root = this._root; result._size = this._size; return result; }; BTree3.prototype.greedyClone = function(force) { var result = new BTree3(void 0, this._compare, this._maxNodeSize); result._root = this._root.greedyClone(force); result._size = this._size; return result; }; BTree3.prototype.toAr