From 3bdab3cdd7a74a049e1efeefe961bcd820f39dc3 Mon Sep 17 00:00:00 2001 From: JP Cen Date: Thu, 19 Oct 2023 02:55:28 -0400 Subject: [PATCH] 0.8.2 See release notes --- main.js | 28460 +++++++++++++++++++++++++++++------------------- manifest.json | 2 +- styles.css | 1381 +-- 3 files changed, 17868 insertions(+), 11975 deletions(-) diff --git a/main.js b/main.js index 6ecf14f..fbc4df9 100644 --- a/main.js +++ b/main.js @@ -16,8 +16,8 @@ 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 }); + for (var name2 in all) + __defProp(target, name2, { get: all[name2], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { @@ -34,13 +34,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __toBinary = /* @__PURE__ */ (() => { var table = new Uint8Array(128); - for (var i4 = 0; i4 < 64; i4++) - table[i4 < 26 ? i4 + 65 : i4 < 52 ? i4 + 71 : i4 < 62 ? i4 - 4 : i4 * 4 - 205] = i4; + for (var i5 = 0; i5 < 64; i5++) + table[i5 < 26 ? i5 + 65 : i5 < 52 ? i5 + 71 : i5 < 62 ? i5 - 4 : i5 * 4 - 205] = i5; return (base64) => { var n2 = base64.length, bytes = new Uint8Array((n2 - (base64[n2 - 1] == "=") - (base64[n2 - 2] == "=")) * 3 / 4 | 0); - for (var i5 = 0, j4 = 0; i5 < n2; ) { - var c0 = table[base64.charCodeAt(i5++)], c1 = table[base64.charCodeAt(i5++)]; - var c22 = table[base64.charCodeAt(i5++)], c32 = table[base64.charCodeAt(i5++)]; + for (var i6 = 0, j4 = 0; i6 < n2; ) { + var c0 = table[base64.charCodeAt(i6++)], c1 = table[base64.charCodeAt(i6++)]; + var c22 = table[base64.charCodeAt(i6++)], c32 = table[base64.charCodeAt(i6++)]; bytes[j4++] = c0 << 2 | c1 >> 4; bytes[j4++] = c1 << 4 | c22 >> 2; bytes[j4++] = c22 << 6 | c32; @@ -59,17 +59,17 @@ function v(n2) { var l3 = n2.parentNode; l3 && l3.removeChild(n2); } -function y(l3, u4, i4) { - var t4, r3, o3, f4 = {}; +function y(l3, u4, i5) { + var t5, r3, o3, f4 = {}; for (o3 in u4) - "key" == o3 ? t4 = u4[o3] : "ref" == o3 ? r3 = u4[o3] : f4[o3] = u4[o3]; - if (arguments.length > 2 && (f4.children = arguments.length > 3 ? n.call(arguments, 2) : i4), "function" == typeof l3 && null != l3.defaultProps) + "key" == o3 ? t5 = u4[o3] : "ref" == o3 ? r3 = u4[o3] : f4[o3] = u4[o3]; + if (arguments.length > 2 && (f4.children = arguments.length > 3 ? n.call(arguments, 2) : i5), "function" == typeof l3 && null != l3.defaultProps) for (o3 in l3.defaultProps) void 0 === f4[o3] && (f4[o3] = l3.defaultProps[o3]); - return p(l3, f4, t4, r3, null); + return p(l3, f4, t5, r3, null); } -function p(n2, i4, t4, r3, o3) { - var f4 = { type: n2, props: i4, key: t4, ref: r3, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: null == o3 ? ++u : o3 }; +function p(n2, i5, t5, r3, o3) { + var f4 = { type: n2, props: i5, key: t5, ref: r3, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: null == o3 ? ++u : o3 }; return null == o3 && null != l.vnode && l.vnode(f4), f4; } function d() { @@ -104,36 +104,36 @@ function m(n2) { (!n2.__d && (n2.__d = true) && t.push(n2) && !w.__r++ || r !== l.debounceRendering) && ((r = l.debounceRendering) || o)(w); } function w() { - var n2, l3, u4, i4, r3, o3, e4, c4; + var n2, l3, u4, i5, r3, o3, e4, c4; for (t.sort(f); n2 = t.shift(); ) - n2.__d && (l3 = t.length, i4 = void 0, r3 = void 0, e4 = (o3 = (u4 = n2).__v).__e, (c4 = u4.__P) && (i4 = [], (r3 = h({}, o3)).__v = o3.__v + 1, L(c4, o3, r3, u4.__n, void 0 !== c4.ownerSVGElement, null != o3.__h ? [e4] : null, i4, null == e4 ? b(o3) : e4, o3.__h), M(i4, o3), o3.__e != e4 && g(o3)), t.length > l3 && t.sort(f)); + n2.__d && (l3 = t.length, i5 = void 0, r3 = void 0, e4 = (o3 = (u4 = n2).__v).__e, (c4 = u4.__P) && (i5 = [], (r3 = h({}, o3)).__v = o3.__v + 1, L(c4, o3, r3, u4.__n, void 0 !== c4.ownerSVGElement, null != o3.__h ? [e4] : null, i5, null == e4 ? b(o3) : e4, o3.__h), M(i5, o3), o3.__e != e4 && g(o3)), t.length > l3 && t.sort(f)); w.__r = 0; } -function x(n2, l3, u4, i4, t4, r3, o3, f4, e4, a5) { - var h5, v3, y5, d5, k5, g4, m5, w5 = i4 && i4.__k || s, x5 = w5.length; +function x(n2, l3, u4, i5, t5, r3, o3, f4, e4, a6) { + var h5, v4, y5, d6, k5, g4, m6, w5 = i5 && i5.__k || s, x5 = w5.length; for (u4.__k = [], h5 = 0; h5 < l3.length; h5++) - if (null != (d5 = u4.__k[h5] = null == (d5 = l3[h5]) || "boolean" == typeof d5 || "function" == typeof d5 ? null : "string" == typeof d5 || "number" == typeof d5 || "bigint" == typeof d5 ? p(null, d5, null, null, d5) : Array.isArray(d5) ? p(_, { children: d5 }, null, null, null) : d5.__b > 0 ? p(d5.type, d5.props, d5.key, d5.ref ? d5.ref : null, d5.__v) : d5)) { - if (d5.__ = u4, d5.__b = u4.__b + 1, null === (y5 = w5[h5]) || y5 && d5.key == y5.key && d5.type === y5.type) + if (null != (d6 = u4.__k[h5] = null == (d6 = l3[h5]) || "boolean" == typeof d6 || "function" == typeof d6 ? null : "string" == typeof d6 || "number" == typeof d6 || "bigint" == typeof d6 ? p(null, d6, null, null, d6) : Array.isArray(d6) ? p(_, { children: d6 }, null, null, null) : d6.__b > 0 ? p(d6.type, d6.props, d6.key, d6.ref ? d6.ref : null, d6.__v) : d6)) { + if (d6.__ = u4, d6.__b = u4.__b + 1, null === (y5 = w5[h5]) || y5 && d6.key == y5.key && d6.type === y5.type) w5[h5] = void 0; else - for (v3 = 0; v3 < x5; v3++) { - if ((y5 = w5[v3]) && d5.key == y5.key && d5.type === y5.type) { - w5[v3] = void 0; + for (v4 = 0; v4 < x5; v4++) { + if ((y5 = w5[v4]) && d6.key == y5.key && d6.type === y5.type) { + w5[v4] = void 0; break; } y5 = null; } - L(n2, d5, y5 = y5 || c, t4, r3, o3, f4, e4, a5), k5 = d5.__e, (v3 = d5.ref) && y5.ref != v3 && (m5 || (m5 = []), y5.ref && m5.push(y5.ref, null, d5), m5.push(v3, d5.__c || k5, d5)), null != k5 ? (null == g4 && (g4 = k5), "function" == typeof d5.type && d5.__k === y5.__k ? d5.__d = e4 = A(d5, e4, n2) : e4 = C(n2, d5, y5, w5, k5, e4), "function" == typeof u4.type && (u4.__d = e4)) : e4 && y5.__e == e4 && e4.parentNode != n2 && (e4 = b(y5)); + L(n2, d6, y5 = y5 || c, t5, r3, o3, f4, e4, a6), k5 = d6.__e, (v4 = d6.ref) && y5.ref != v4 && (m6 || (m6 = []), y5.ref && m6.push(y5.ref, null, d6), m6.push(v4, d6.__c || k5, d6)), null != k5 ? (null == g4 && (g4 = k5), "function" == typeof d6.type && d6.__k === y5.__k ? d6.__d = e4 = A(d6, e4, n2) : e4 = C(n2, d6, y5, w5, k5, e4), "function" == typeof u4.type && (u4.__d = e4)) : e4 && y5.__e == e4 && e4.parentNode != n2 && (e4 = b(y5)); } for (u4.__e = g4, h5 = x5; h5--; ) - null != w5[h5] && ("function" == typeof u4.type && null != w5[h5].__e && w5[h5].__e == u4.__d && (u4.__d = $(i4).nextSibling), S(w5[h5], w5[h5])); - if (m5) - for (h5 = 0; h5 < m5.length; h5++) - O(m5[h5], m5[++h5], m5[++h5]); + null != w5[h5] && ("function" == typeof u4.type && null != w5[h5].__e && w5[h5].__e == u4.__d && (u4.__d = $(i5).nextSibling), S(w5[h5], w5[h5])); + if (m6) + for (h5 = 0; h5 < m6.length; h5++) + O(m6[h5], m6[++h5], m6[++h5]); } function A(n2, l3, u4) { - for (var i4, t4 = n2.__k, r3 = 0; t4 && r3 < t4.length; r3++) - (i4 = t4[r3]) && (i4.__ = n2, l3 = "function" == typeof i4.type ? A(i4, l3, u4) : C(u4, i4, i4, t4, i4.__e, l3)); + for (var i5, t5 = n2.__k, r3 = 0; t5 && r3 < t5.length; r3++) + (i5 = t5[r3]) && (i5.__ = n2, l3 = "function" == typeof i5.type ? A(i5, l3, u4) : C(u4, i5, i5, t5, i5.__e, l3)); return l3; } function P(n2, l3) { @@ -141,61 +141,61 @@ function P(n2, l3) { P(n3, l3); }) : l3.push(n2)), l3; } -function C(n2, l3, u4, i4, t4, r3) { +function C(n2, l3, u4, i5, t5, r3) { var o3, f4, e4; if (void 0 !== l3.__d) o3 = l3.__d, l3.__d = void 0; - else if (null == u4 || t4 != r3 || null == t4.parentNode) + else if (null == u4 || t5 != r3 || null == t5.parentNode) n: if (null == r3 || r3.parentNode !== n2) - n2.appendChild(t4), o3 = null; + n2.appendChild(t5), o3 = null; else { - for (f4 = r3, e4 = 0; (f4 = f4.nextSibling) && e4 < i4.length; e4 += 1) - if (f4 == t4) + for (f4 = r3, e4 = 0; (f4 = f4.nextSibling) && e4 < i5.length; e4 += 1) + if (f4 == t5) break n; - n2.insertBefore(t4, r3), o3 = r3; + n2.insertBefore(t5, r3), o3 = r3; } - return void 0 !== o3 ? o3 : t4.nextSibling; + return void 0 !== o3 ? o3 : t5.nextSibling; } function $(n2) { - var l3, u4, i4; + var l3, u4, i5; if (null == n2.type || "string" == typeof n2.type) return n2.__e; if (n2.__k) { for (l3 = n2.__k.length - 1; l3 >= 0; l3--) - if ((u4 = n2.__k[l3]) && (i4 = $(u4))) - return i4; + if ((u4 = n2.__k[l3]) && (i5 = $(u4))) + return i5; } return null; } -function H(n2, l3, u4, i4, t4) { +function H(n2, l3, u4, i5, t5) { var r3; for (r3 in u4) - "children" === r3 || "key" === r3 || r3 in l3 || T(n2, r3, null, u4[r3], i4); + "children" === r3 || "key" === r3 || r3 in l3 || T(n2, r3, null, u4[r3], i5); for (r3 in l3) - t4 && "function" != typeof l3[r3] || "children" === r3 || "key" === r3 || "value" === r3 || "checked" === r3 || u4[r3] === l3[r3] || T(n2, r3, l3[r3], u4[r3], i4); + t5 && "function" != typeof l3[r3] || "children" === r3 || "key" === r3 || "value" === r3 || "checked" === r3 || u4[r3] === l3[r3] || T(n2, r3, l3[r3], u4[r3], i5); } function I(n2, l3, u4) { "-" === l3[0] ? n2.setProperty(l3, null == u4 ? "" : u4) : n2[l3] = null == u4 ? "" : "number" != typeof u4 || a.test(l3) ? u4 : u4 + "px"; } -function T(n2, l3, u4, i4, t4) { +function T(n2, l3, u4, i5, t5) { var r3; n: if ("style" === l3) if ("string" == typeof u4) n2.style.cssText = u4; else { - if ("string" == typeof i4 && (n2.style.cssText = i4 = ""), i4) - for (l3 in i4) + if ("string" == typeof i5 && (n2.style.cssText = i5 = ""), i5) + for (l3 in i5) u4 && l3 in u4 || I(n2.style, l3, ""); if (u4) for (l3 in u4) - i4 && u4[l3] === i4[l3] || I(n2.style, l3, u4[l3]); + i5 && u4[l3] === i5[l3] || I(n2.style, l3, u4[l3]); } else if ("o" === l3[0] && "n" === l3[1]) - r3 = l3 !== (l3 = l3.replace(/Capture$/, "")), l3 = l3.toLowerCase() in n2 ? l3.toLowerCase().slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + r3] = u4, u4 ? i4 || n2.addEventListener(l3, r3 ? z : j, r3) : n2.removeEventListener(l3, r3 ? z : j, r3); + r3 = l3 !== (l3 = l3.replace(/Capture$/, "")), l3 = l3.toLowerCase() in n2 ? l3.toLowerCase().slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + r3] = u4, u4 ? i5 || n2.addEventListener(l3, r3 ? z : j, r3) : n2.removeEventListener(l3, r3 ? z : j, r3); else if ("dangerouslySetInnerHTML" !== l3) { - if (t4) + if (t5) l3 = l3.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if ("width" !== l3 && "height" !== l3 && "href" !== l3 && "list" !== l3 && "form" !== l3 && "tabIndex" !== l3 && "download" !== l3 && l3 in n2) try { @@ -212,43 +212,43 @@ function j(n2) { function z(n2) { return this.l[n2.type + true](l.event ? l.event(n2) : n2); } -function L(n2, u4, i4, t4, r3, o3, f4, e4, c4) { - var s5, a5, v3, y5, p3, d5, b4, g4, m5, w5, A4, P4, C3, $3, H5, I4 = u4.type; +function L(n2, u4, i5, t5, r3, o3, f4, e4, c4) { + var s6, a6, v4, y5, p3, d6, b4, g4, m6, w5, A4, P4, C3, $3, H5, I4 = u4.type; if (void 0 !== u4.constructor) return null; - null != i4.__h && (c4 = i4.__h, e4 = u4.__e = i4.__e, u4.__h = null, o3 = [e4]), (s5 = l.__b) && s5(u4); + null != i5.__h && (c4 = i5.__h, e4 = u4.__e = i5.__e, u4.__h = null, o3 = [e4]), (s6 = l.__b) && s6(u4); try { n: if ("function" == typeof I4) { - if (g4 = u4.props, m5 = (s5 = I4.contextType) && t4[s5.__c], w5 = s5 ? m5 ? m5.props.value : s5.__ : t4, i4.__c ? b4 = (a5 = u4.__c = i4.__c).__ = a5.__E : ("prototype" in I4 && I4.prototype.render ? u4.__c = a5 = new I4(g4, w5) : (u4.__c = a5 = new k(g4, w5), a5.constructor = I4, a5.render = q), m5 && m5.sub(a5), a5.props = g4, a5.state || (a5.state = {}), a5.context = w5, a5.__n = t4, v3 = a5.__d = true, a5.__h = [], a5._sb = []), null == a5.__s && (a5.__s = a5.state), null != I4.getDerivedStateFromProps && (a5.__s == a5.state && (a5.__s = h({}, a5.__s)), h(a5.__s, I4.getDerivedStateFromProps(g4, a5.__s))), y5 = a5.props, p3 = a5.state, a5.__v = u4, v3) - null == I4.getDerivedStateFromProps && null != a5.componentWillMount && a5.componentWillMount(), null != a5.componentDidMount && a5.__h.push(a5.componentDidMount); + if (g4 = u4.props, m6 = (s6 = I4.contextType) && t5[s6.__c], w5 = s6 ? m6 ? m6.props.value : s6.__ : t5, i5.__c ? b4 = (a6 = u4.__c = i5.__c).__ = a6.__E : ("prototype" in I4 && I4.prototype.render ? u4.__c = a6 = new I4(g4, w5) : (u4.__c = a6 = new k(g4, w5), a6.constructor = I4, a6.render = q), m6 && m6.sub(a6), a6.props = g4, a6.state || (a6.state = {}), a6.context = w5, a6.__n = t5, v4 = a6.__d = true, a6.__h = [], a6._sb = []), null == a6.__s && (a6.__s = a6.state), null != I4.getDerivedStateFromProps && (a6.__s == a6.state && (a6.__s = h({}, a6.__s)), h(a6.__s, I4.getDerivedStateFromProps(g4, a6.__s))), y5 = a6.props, p3 = a6.state, a6.__v = u4, v4) + null == I4.getDerivedStateFromProps && null != a6.componentWillMount && a6.componentWillMount(), null != a6.componentDidMount && a6.__h.push(a6.componentDidMount); else { - if (null == I4.getDerivedStateFromProps && g4 !== y5 && null != a5.componentWillReceiveProps && a5.componentWillReceiveProps(g4, w5), !a5.__e && null != a5.shouldComponentUpdate && false === a5.shouldComponentUpdate(g4, a5.__s, w5) || u4.__v === i4.__v) { - for (u4.__v !== i4.__v && (a5.props = g4, a5.state = a5.__s, a5.__d = false), a5.__e = false, u4.__e = i4.__e, u4.__k = i4.__k, u4.__k.forEach(function(n3) { + if (null == I4.getDerivedStateFromProps && g4 !== y5 && null != a6.componentWillReceiveProps && a6.componentWillReceiveProps(g4, w5), !a6.__e && null != a6.shouldComponentUpdate && false === a6.shouldComponentUpdate(g4, a6.__s, w5) || u4.__v === i5.__v) { + for (u4.__v !== i5.__v && (a6.props = g4, a6.state = a6.__s, a6.__d = false), a6.__e = false, u4.__e = i5.__e, u4.__k = i5.__k, u4.__k.forEach(function(n3) { n3 && (n3.__ = u4); - }), A4 = 0; A4 < a5._sb.length; A4++) - a5.__h.push(a5._sb[A4]); - a5._sb = [], a5.__h.length && f4.push(a5); + }), A4 = 0; A4 < a6._sb.length; A4++) + a6.__h.push(a6._sb[A4]); + a6._sb = [], a6.__h.length && f4.push(a6); break n; } - null != a5.componentWillUpdate && a5.componentWillUpdate(g4, a5.__s, w5), null != a5.componentDidUpdate && a5.__h.push(function() { - a5.componentDidUpdate(y5, p3, d5); + null != a6.componentWillUpdate && a6.componentWillUpdate(g4, a6.__s, w5), null != a6.componentDidUpdate && a6.__h.push(function() { + a6.componentDidUpdate(y5, p3, d6); }); } - if (a5.context = w5, a5.props = g4, a5.__P = n2, P4 = l.__r, C3 = 0, "prototype" in I4 && I4.prototype.render) { - for (a5.state = a5.__s, a5.__d = false, P4 && P4(u4), s5 = a5.render(a5.props, a5.state, a5.context), $3 = 0; $3 < a5._sb.length; $3++) - a5.__h.push(a5._sb[$3]); - a5._sb = []; + if (a6.context = w5, a6.props = g4, a6.__P = n2, P4 = l.__r, C3 = 0, "prototype" in I4 && I4.prototype.render) { + for (a6.state = a6.__s, a6.__d = false, P4 && P4(u4), s6 = a6.render(a6.props, a6.state, a6.context), $3 = 0; $3 < a6._sb.length; $3++) + a6.__h.push(a6._sb[$3]); + a6._sb = []; } else do { - a5.__d = false, P4 && P4(u4), s5 = a5.render(a5.props, a5.state, a5.context), a5.state = a5.__s; - } while (a5.__d && ++C3 < 25); - a5.state = a5.__s, null != a5.getChildContext && (t4 = h(h({}, t4), a5.getChildContext())), v3 || null == a5.getSnapshotBeforeUpdate || (d5 = a5.getSnapshotBeforeUpdate(y5, p3)), H5 = null != s5 && s5.type === _ && null == s5.key ? s5.props.children : s5, x(n2, Array.isArray(H5) ? H5 : [H5], u4, i4, t4, r3, o3, f4, e4, c4), a5.base = u4.__e, u4.__h = null, a5.__h.length && f4.push(a5), b4 && (a5.__E = a5.__ = null), a5.__e = false; + a6.__d = false, P4 && P4(u4), s6 = a6.render(a6.props, a6.state, a6.context), a6.state = a6.__s; + } while (a6.__d && ++C3 < 25); + a6.state = a6.__s, null != a6.getChildContext && (t5 = h(h({}, t5), a6.getChildContext())), v4 || null == a6.getSnapshotBeforeUpdate || (d6 = a6.getSnapshotBeforeUpdate(y5, p3)), H5 = null != s6 && s6.type === _ && null == s6.key ? s6.props.children : s6, x(n2, Array.isArray(H5) ? H5 : [H5], u4, i5, t5, r3, o3, f4, e4, c4), a6.base = u4.__e, u4.__h = null, a6.__h.length && f4.push(a6), b4 && (a6.__E = a6.__ = null), a6.__e = false; } else - null == o3 && u4.__v === i4.__v ? (u4.__k = i4.__k, u4.__e = i4.__e) : u4.__e = N(i4.__e, u4, i4, t4, r3, o3, f4, c4); - (s5 = l.diffed) && s5(u4); + null == o3 && u4.__v === i5.__v ? (u4.__k = i5.__k, u4.__e = i5.__e) : u4.__e = N(i5.__e, u4, i5, t5, r3, o3, f4, c4); + (s6 = l.diffed) && s6(u4); } catch (n3) { - u4.__v = null, (c4 || null != o3) && (u4.__e = e4, u4.__h = !!c4, o3[o3.indexOf(e4)] = null), l.__e(n3, u4, i4); + u4.__v = null, (c4 || null != o3) && (u4.__e = e4, u4.__h = !!c4, o3[o3.indexOf(e4)] = null), l.__e(n3, u4, i5); } } function M(n2, u4) { @@ -262,84 +262,84 @@ function M(n2, u4) { } }); } -function N(l3, u4, i4, t4, r3, o3, f4, e4) { - var s5, a5, h5, y5 = i4.props, p3 = u4.props, d5 = u4.type, _12 = 0; - if ("svg" === d5 && (r3 = true), null != o3) { +function N(l3, u4, i5, t5, r3, o3, f4, e4) { + var s6, a6, h5, y5 = i5.props, p3 = u4.props, d6 = u4.type, _12 = 0; + if ("svg" === d6 && (r3 = true), null != o3) { for (; _12 < o3.length; _12++) - if ((s5 = o3[_12]) && "setAttribute" in s5 == !!d5 && (d5 ? s5.localName === d5 : 3 === s5.nodeType)) { - l3 = s5, o3[_12] = null; + if ((s6 = o3[_12]) && "setAttribute" in s6 == !!d6 && (d6 ? s6.localName === d6 : 3 === s6.nodeType)) { + l3 = s6, o3[_12] = null; break; } } if (null == l3) { - if (null === d5) + if (null === d6) return document.createTextNode(p3); - l3 = r3 ? document.createElementNS("http://www.w3.org/2000/svg", d5) : document.createElement(d5, p3.is && p3), o3 = null, e4 = false; + l3 = r3 ? document.createElementNS("http://www.w3.org/2000/svg", d6) : document.createElement(d6, p3.is && p3), o3 = null, e4 = false; } - if (null === d5) + if (null === d6) y5 === p3 || e4 && l3.data === p3 || (l3.data = p3); else { - if (o3 = o3 && n.call(l3.childNodes), a5 = (y5 = i4.props || c).dangerouslySetInnerHTML, h5 = p3.dangerouslySetInnerHTML, !e4) { + if (o3 = o3 && n.call(l3.childNodes), a6 = (y5 = i5.props || c).dangerouslySetInnerHTML, h5 = p3.dangerouslySetInnerHTML, !e4) { if (null != o3) for (y5 = {}, _12 = 0; _12 < l3.attributes.length; _12++) y5[l3.attributes[_12].name] = l3.attributes[_12].value; - (h5 || a5) && (h5 && (a5 && h5.__html == a5.__html || h5.__html === l3.innerHTML) || (l3.innerHTML = h5 && h5.__html || "")); + (h5 || a6) && (h5 && (a6 && h5.__html == a6.__html || h5.__html === l3.innerHTML) || (l3.innerHTML = h5 && h5.__html || "")); } if (H(l3, p3, y5, r3, e4), h5) u4.__k = []; - else if (_12 = u4.props.children, x(l3, Array.isArray(_12) ? _12 : [_12], u4, i4, t4, r3 && "foreignObject" !== d5, o3, f4, o3 ? o3[0] : i4.__k && b(i4, 0), e4), null != o3) + else if (_12 = u4.props.children, x(l3, Array.isArray(_12) ? _12 : [_12], u4, i5, t5, r3 && "foreignObject" !== d6, o3, f4, o3 ? o3[0] : i5.__k && b(i5, 0), e4), null != o3) for (_12 = o3.length; _12--; ) null != o3[_12] && v(o3[_12]); - e4 || ("value" in p3 && void 0 !== (_12 = p3.value) && (_12 !== l3.value || "progress" === d5 && !_12 || "option" === d5 && _12 !== y5.value) && T(l3, "value", _12, y5.value, false), "checked" in p3 && void 0 !== (_12 = p3.checked) && _12 !== l3.checked && T(l3, "checked", _12, y5.checked, false)); + e4 || ("value" in p3 && void 0 !== (_12 = p3.value) && (_12 !== l3.value || "progress" === d6 && !_12 || "option" === d6 && _12 !== y5.value) && T(l3, "value", _12, y5.value, false), "checked" in p3 && void 0 !== (_12 = p3.checked) && _12 !== l3.checked && T(l3, "checked", _12, y5.checked, false)); } return l3; } -function O(n2, u4, i4) { +function O(n2, u4, i5) { try { "function" == typeof n2 ? n2(u4) : n2.current = u4; } catch (n3) { - l.__e(n3, i4); + l.__e(n3, i5); } } -function S(n2, u4, i4) { - var t4, r3; - if (l.unmount && l.unmount(n2), (t4 = n2.ref) && (t4.current && t4.current !== n2.__e || O(t4, null, u4)), null != (t4 = n2.__c)) { - if (t4.componentWillUnmount) +function S(n2, u4, i5) { + var t5, r3; + if (l.unmount && l.unmount(n2), (t5 = n2.ref) && (t5.current && t5.current !== n2.__e || O(t5, null, u4)), null != (t5 = n2.__c)) { + if (t5.componentWillUnmount) try { - t4.componentWillUnmount(); + t5.componentWillUnmount(); } catch (n3) { l.__e(n3, u4); } - t4.base = t4.__P = null, n2.__c = void 0; + t5.base = t5.__P = null, n2.__c = void 0; } - if (t4 = n2.__k) - for (r3 = 0; r3 < t4.length; r3++) - t4[r3] && S(t4[r3], u4, i4 || "function" != typeof n2.type); - i4 || null == n2.__e || v(n2.__e), n2.__ = n2.__e = n2.__d = void 0; + if (t5 = n2.__k) + for (r3 = 0; r3 < t5.length; r3++) + t5[r3] && S(t5[r3], u4, i5 || "function" != typeof n2.type); + i5 || null == n2.__e || v(n2.__e), n2.__ = n2.__e = n2.__d = void 0; } function q(n2, l3, u4) { return this.constructor(n2, u4); } -function B(u4, i4, t4) { +function B(u4, i5, t5) { var r3, o3, f4; - l.__ && l.__(u4, i4), o3 = (r3 = "function" == typeof t4) ? null : t4 && t4.__k || i4.__k, f4 = [], L(i4, u4 = (!r3 && t4 || i4).__k = y(_, null, [u4]), o3 || c, c, void 0 !== i4.ownerSVGElement, !r3 && t4 ? [t4] : o3 ? null : i4.firstChild ? n.call(i4.childNodes) : null, f4, !r3 && t4 ? t4 : o3 ? o3.__e : i4.firstChild, r3), M(f4, u4); + l.__ && l.__(u4, i5), o3 = (r3 = "function" == typeof t5) ? null : t5 && t5.__k || i5.__k, f4 = [], L(i5, u4 = (!r3 && t5 || i5).__k = y(_, null, [u4]), o3 || c, c, void 0 !== i5.ownerSVGElement, !r3 && t5 ? [t5] : o3 ? null : i5.firstChild ? n.call(i5.childNodes) : null, f4, !r3 && t5 ? t5 : o3 ? o3.__e : i5.firstChild, r3), M(f4, u4); } function D(n2, l3) { B(n2, l3, D); } -function E(l3, u4, i4) { - var t4, r3, o3, f4 = h({}, l3.props); +function E(l3, u4, i5) { + var t5, r3, o3, f4 = h({}, l3.props); for (o3 in u4) - "key" == o3 ? t4 = u4[o3] : "ref" == o3 ? r3 = u4[o3] : f4[o3] = u4[o3]; - return arguments.length > 2 && (f4.children = arguments.length > 3 ? n.call(arguments, 2) : i4), p(l3.type, f4, t4 || l3.key, r3 || l3.ref, null); + "key" == o3 ? t5 = u4[o3] : "ref" == o3 ? r3 = u4[o3] : f4[o3] = u4[o3]; + return arguments.length > 2 && (f4.children = arguments.length > 3 ? n.call(arguments, 2) : i5), p(l3.type, f4, t5 || l3.key, r3 || l3.ref, null); } function F(n2, l3) { var u4 = { __c: l3 = "__cC" + e++, __: n2, Consumer: function(n3, l4) { return n3.children(l4); }, Provider: function(n3) { - var u5, i4; - return this.getChildContext || (u5 = [], (i4 = {})[l3] = this, this.getChildContext = function() { - return i4; + var u5, i5; + return this.getChildContext || (u5 = [], (i5 = {})[l3] = this, this.getChildContext = function() { + return i5; }, this.shouldComponentUpdate = function(n4) { this.props.value !== n4.value && u5.some(function(n5) { n5.__e = true, m(n5); @@ -360,12 +360,12 @@ var init_preact_module = __esm({ c = {}; s = []; a = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i; - n = s.slice, l = { __e: function(n2, l3, u4, i4) { - for (var t4, r3, o3; l3 = l3.__; ) - if ((t4 = l3.__c) && !t4.__) + n = s.slice, l = { __e: function(n2, l3, u4, i5) { + for (var t5, r3, o3; l3 = l3.__; ) + if ((t5 = l3.__c) && !t5.__) try { - if ((r3 = t4.constructor) && null != r3.getDerivedStateFromError && (t4.setState(r3.getDerivedStateFromError(n2)), o3 = t4.__d), null != t4.componentDidCatch && (t4.componentDidCatch(n2, i4 || {}), o3 = t4.__d), o3) - return t4.__E = t4; + if ((r3 = t5.constructor) && null != r3.getDerivedStateFromError && (t5.setState(r3.getDerivedStateFromError(n2)), o3 = t5.__d), null != t5.componentDidCatch && (t5.componentDidCatch(n2, i5 || {}), o3 = t5.__d), o3) + return t5.__E = t5; } catch (l4) { n2 = l4; } @@ -384,21 +384,21 @@ var init_preact_module = __esm({ }); // node_modules/preact/hooks/dist/hooks.module.js -function d2(t4, u4) { - l.__h && l.__h(r2, t4, o2 || u4), o2 = 0; - var i4 = r2.__H || (r2.__H = { __: [], __h: [] }); - return t4 >= i4.__.length && i4.__.push({ __V: c2 }), i4.__[t4]; +function d2(t5, u4) { + l.__h && l.__h(r2, t5, o2 || u4), o2 = 0; + var i5 = r2.__H || (r2.__H = { __: [], __h: [] }); + return t5 >= i5.__.length && i5.__.push({ __V: c2 }), i5.__[t5]; } function h2(n2) { return o2 = 1, s2(B2, n2); } -function s2(n2, u4, i4) { +function s2(n2, u4, i5) { var o3 = d2(t2++, 2); - if (o3.t = n2, !o3.__c && (o3.__ = [i4 ? i4(u4) : B2(void 0, u4), function(n3) { - var t4 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t4, n3); - t4 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({})); + if (o3.t = n2, !o3.__c && (o3.__ = [i5 ? i5(u4) : B2(void 0, u4), function(n3) { + var t5 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t5, n3); + t5 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({})); }], o3.__c = r2, !r2.u)) { - var f4 = function(n3, t4, r3) { + var f4 = function(n3, t5, r3) { if (!o3.__c.__H) return true; var u5 = o3.__c.__H.__.filter(function(n4) { @@ -407,45 +407,45 @@ function s2(n2, u4, i4) { if (u5.every(function(n4) { return !n4.__N; })) - return !c4 || c4.call(this, n3, t4, r3); - var i5 = false; + return !c4 || c4.call(this, n3, t5, r3); + var i6 = false; return u5.forEach(function(n4) { if (n4.__N) { - var t5 = n4.__[0]; - n4.__ = n4.__N, n4.__N = void 0, t5 !== n4.__[0] && (i5 = true); + var t6 = n4.__[0]; + n4.__ = n4.__N, n4.__N = void 0, t6 !== n4.__[0] && (i6 = true); } - }), !(!i5 && o3.__c.props === n3) && (!c4 || c4.call(this, n3, t4, r3)); + }), !(!i6 && o3.__c.props === n3) && (!c4 || c4.call(this, n3, t5, r3)); }; r2.u = true; var c4 = r2.shouldComponentUpdate, e4 = r2.componentWillUpdate; - r2.componentWillUpdate = function(n3, t4, r3) { + r2.componentWillUpdate = function(n3, t5, r3) { if (this.__e) { var u5 = c4; - c4 = void 0, f4(n3, t4, r3), c4 = u5; + c4 = void 0, f4(n3, t5, r3), c4 = u5; } - e4 && e4.call(this, n3, t4, r3); + e4 && e4.call(this, n3, t5, r3); }, r2.shouldComponentUpdate = f4; } return o3.__N || o3.__; } -function p2(u4, i4) { +function p2(u4, i5) { var o3 = d2(t2++, 3); - !l.__s && z2(o3.__H, i4) && (o3.__ = u4, o3.i = i4, r2.__H.__h.push(o3)); + !l.__s && z2(o3.__H, i5) && (o3.__ = u4, o3.i = i5, r2.__H.__h.push(o3)); } -function y2(u4, i4) { +function y2(u4, i5) { var o3 = d2(t2++, 4); - !l.__s && z2(o3.__H, i4) && (o3.__ = u4, o3.i = i4, r2.__h.push(o3)); + !l.__s && z2(o3.__H, i5) && (o3.__ = u4, o3.i = i5, r2.__h.push(o3)); } function _2(n2) { return o2 = 5, F2(function() { return { current: n2 }; }, []); } -function A2(n2, t4, r3) { +function A2(n2, t5, r3) { o2 = 6, y2(function() { - return "function" == typeof n2 ? (n2(t4()), function() { + return "function" == typeof n2 ? (n2(t5()), function() { return n2(null); - }) : n2 ? (n2.current = t4(), function() { + }) : n2 ? (n2.current = t5(), function() { return n2.current = null; }) : void 0; }, null == r3 ? r3 : r3.concat(n2)); @@ -454,24 +454,24 @@ function F2(n2, r3) { var u4 = d2(t2++, 7); return z2(u4.__H, r3) ? (u4.__V = n2(), u4.i = r3, u4.__h = n2, u4.__V) : u4.__; } -function T2(n2, t4) { +function T2(n2, t5) { return o2 = 8, F2(function() { return n2; - }, t4); + }, t5); } function q2(n2) { - var u4 = r2.context[n2.__c], i4 = d2(t2++, 9); - return i4.c = n2, u4 ? (null == i4.__ && (i4.__ = true, u4.sub(r2)), u4.props.value) : n2.__; + var u4 = r2.context[n2.__c], i5 = d2(t2++, 9); + return i5.c = n2, u4 ? (null == i5.__ && (i5.__ = true, u4.sub(r2)), u4.props.value) : n2.__; } -function x2(t4, r3) { - l.useDebugValue && l.useDebugValue(r3 ? r3(t4) : t4); +function x2(t5, r3) { + l.useDebugValue && l.useDebugValue(r3 ? r3(t5) : t5); } function P2(n2) { - var u4 = d2(t2++, 10), i4 = h2(); - return u4.__ = n2, r2.componentDidCatch || (r2.componentDidCatch = function(n3, t4) { - u4.__ && u4.__(n3, t4), i4[1](n3); - }), [i4[0], function() { - i4[1](void 0); + var u4 = d2(t2++, 10), i5 = h2(); + return u4.__ = n2, r2.componentDidCatch || (r2.componentDidCatch = function(n3, t5) { + u4.__ && u4.__(n3, t5), i5[1](n3); + }), [i5[0], function() { + i5[1](void 0); }]; } function V() { @@ -479,41 +479,41 @@ function V() { if (!n2.__) { for (var u4 = r2.__v; null !== u4 && !u4.__m && null !== u4.__; ) u4 = u4.__; - var i4 = u4.__m || (u4.__m = [0, 0]); - n2.__ = "P" + i4[0] + "-" + i4[1]++; + var i5 = u4.__m || (u4.__m = [0, 0]); + n2.__ = "P" + i5[0] + "-" + i5[1]++; } return n2.__; } function b2() { - for (var t4; t4 = f2.shift(); ) - if (t4.__P && t4.__H) + for (var t5; t5 = f2.shift(); ) + if (t5.__P && t5.__H) try { - t4.__H.__h.forEach(k2), t4.__H.__h.forEach(w2), t4.__H.__h = []; + t5.__H.__h.forEach(k2), t5.__H.__h.forEach(w2), t5.__H.__h = []; } catch (r3) { - t4.__H.__h = [], l.__e(r3, t4.__v); + t5.__H.__h = [], l.__e(r3, t5.__v); } } function j2(n2) { - var t4, r3 = function() { - clearTimeout(u4), g2 && cancelAnimationFrame(t4), setTimeout(n2); + var t5, r3 = function() { + clearTimeout(u4), g2 && cancelAnimationFrame(t5), setTimeout(n2); }, u4 = setTimeout(r3, 100); - g2 && (t4 = requestAnimationFrame(r3)); + g2 && (t5 = requestAnimationFrame(r3)); } function k2(n2) { - var t4 = r2, u4 = n2.__c; - "function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t4; + var t5 = r2, u4 = n2.__c; + "function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t5; } function w2(n2) { - var t4 = r2; - n2.__c = n2.__(), r2 = t4; + var t5 = r2; + n2.__c = n2.__(), r2 = t5; } -function z2(n2, t4) { - return !n2 || n2.length !== t4.length || t4.some(function(t5, r3) { - return t5 !== n2[r3]; +function z2(n2, t5) { + return !n2 || n2.length !== t5.length || t5.some(function(t6, r3) { + return t6 !== n2[r3]; }); } -function B2(n2, t4) { - return "function" == typeof t4 ? t4(n2) : t4; +function B2(n2, t5) { + return "function" == typeof t5 ? t5(n2) : t5; } var t2, r2, u2, i2, o2, f2, c2, e2, a2, v2, l2, m2, g2; var init_hooks_module = __esm({ @@ -531,31 +531,31 @@ var init_hooks_module = __esm({ r2 = null, e2 && e2(n2); }, l.__r = function(n2) { a2 && a2(n2), t2 = 0; - var i4 = (r2 = n2.__c).__H; - i4 && (u2 === r2 ? (i4.__h = [], r2.__h = [], i4.__.forEach(function(n3) { + var i5 = (r2 = n2.__c).__H; + i5 && (u2 === r2 ? (i5.__h = [], r2.__h = [], i5.__.forEach(function(n3) { n3.__N && (n3.__ = n3.__N), n3.__V = c2, n3.__N = n3.i = void 0; - })) : (i4.__h.forEach(k2), i4.__h.forEach(w2), i4.__h = [])), u2 = r2; - }, l.diffed = function(t4) { - v2 && v2(t4); - var o3 = t4.__c; + })) : (i5.__h.forEach(k2), i5.__h.forEach(w2), i5.__h = [])), u2 = r2; + }, l.diffed = function(t5) { + v2 && v2(t5); + var o3 = t5.__c; o3 && o3.__H && (o3.__H.__h.length && (1 !== f2.push(o3) && i2 === l.requestAnimationFrame || ((i2 = l.requestAnimationFrame) || j2)(b2)), o3.__H.__.forEach(function(n2) { n2.i && (n2.__H = n2.i), n2.__V !== c2 && (n2.__ = n2.__V), n2.i = void 0, n2.__V = c2; })), u2 = r2 = null; - }, l.__c = function(t4, r3) { - r3.some(function(t5) { + }, l.__c = function(t5, r3) { + r3.some(function(t6) { try { - t5.__h.forEach(k2), t5.__h = t5.__h.filter(function(n2) { + t6.__h.forEach(k2), t6.__h = t6.__h.filter(function(n2) { return !n2.__ || w2(n2); }); } catch (u4) { r3.some(function(n2) { n2.__h && (n2.__h = []); - }), r3 = [], l.__e(u4, t5.__v); + }), r3 = [], l.__e(u4, t6.__v); } - }), l2 && l2(t4, r3); - }, l.unmount = function(t4) { - m2 && m2(t4); - var r3, u4 = t4.__c; + }), l2 && l2(t5, r3); + }, l.unmount = function(t5) { + m2 && m2(t5); + var r3, u4 = t5.__c; u4 && u4.__H && (u4.__H.__.forEach(function(n2) { try { k2(n2); @@ -615,30 +615,30 @@ __export(compat_module_exports, { useTransition: () => bn, version: () => cn }); -function g3(n2, t4) { - for (var e4 in t4) - n2[e4] = t4[e4]; +function g3(n2, t5) { + for (var e4 in t5) + n2[e4] = t5[e4]; return n2; } -function C2(n2, t4) { +function C2(n2, t5) { for (var e4 in n2) - if ("__source" !== e4 && !(e4 in t4)) + if ("__source" !== e4 && !(e4 in t5)) return true; - for (var r3 in t4) - if ("__source" !== r3 && n2[r3] !== t4[r3]) + for (var r3 in t5) + if ("__source" !== r3 && n2[r3] !== t5[r3]) return true; return false; } -function E2(n2, t4) { - return n2 === t4 && (0 !== n2 || 1 / n2 == 1 / t4) || n2 != n2 && t4 != t4; +function E2(n2, t5) { + return n2 === t5 && (0 !== n2 || 1 / n2 == 1 / t5) || n2 != n2 && t5 != t5; } function w3(n2) { this.props = n2; } function x3(n2, e4) { function r3(n3) { - var t4 = this.props.ref, r4 = t4 == n3.ref; - return !r4 && t4 && (t4.call ? t4(null) : t4.current = null), e4 ? !e4(this.props, n3) || !r4 : C2(this.props, n3); + var t5 = this.props.ref, r4 = t5 == n3.ref; + return !r4 && t5 && (t5.call ? t5(null) : t5.current = null), e4 ? !e4(this.props, n3) || !r4 : C2(this.props, n3); } function u4(e5) { return this.shouldComponentUpdate = r3, y(n2, e5); @@ -646,30 +646,30 @@ function x3(n2, e4) { return u4.displayName = "Memo(" + (n2.displayName || n2.name) + ")", u4.prototype.isReactComponent = true, u4.__f = true, u4; } function k3(n2) { - function t4(t5) { - var e4 = g3({}, t5); - return delete e4.ref, n2(e4, t5.ref || null); + function t5(t6) { + var e4 = g3({}, t6); + return delete e4.ref, n2(e4, t6.ref || null); } - return t4.$$typeof = N2, t4.render = t4, t4.prototype.isReactComponent = t4.__f = true, t4.displayName = "ForwardRef(" + (n2.displayName || n2.name) + ")", t4; + return t5.$$typeof = N2, t5.render = t5, t5.prototype.isReactComponent = t5.__f = true, t5.displayName = "ForwardRef(" + (n2.displayName || n2.name) + ")", t5; } -function L2(n2, t4, e4) { +function L2(n2, t5, e4) { return n2 && (n2.__c && n2.__c.__H && (n2.__c.__H.__.forEach(function(n3) { "function" == typeof n3.__c && n3.__c(); - }), n2.__c.__H = null), null != (n2 = g3({}, n2)).__c && (n2.__c.__P === e4 && (n2.__c.__P = t4), n2.__c = null), n2.__k = n2.__k && n2.__k.map(function(n3) { - return L2(n3, t4, e4); + }), n2.__c.__H = null), null != (n2 = g3({}, n2)).__c && (n2.__c.__P === e4 && (n2.__c.__P = t5), n2.__c = null), n2.__k = n2.__k && n2.__k.map(function(n3) { + return L2(n3, t5, e4); })), n2; } -function U(n2, t4, e4) { +function U(n2, t5, e4) { return n2 && (n2.__v = null, n2.__k = n2.__k && n2.__k.map(function(n3) { - return U(n3, t4, e4); - }), n2.__c && n2.__c.__P === t4 && (n2.__e && e4.insertBefore(n2.__e, n2.__d), n2.__c.__e = true, n2.__c.__P = e4)), n2; + return U(n3, t5, e4); + }), n2.__c && n2.__c.__P === t5 && (n2.__e && e4.insertBefore(n2.__e, n2.__d), n2.__c.__e = true, n2.__c.__P = e4)), n2; } function D2() { this.__u = 0, this.t = null, this.__b = null; } function F3(n2) { - var t4 = n2.__.__c; - return t4 && t4.__a && t4.__a(n2); + var t5 = n2.__.__c; + return t5 && t5.__a && t5.__a(n2); } function M2(n2) { var e4, r3, u4; @@ -700,7 +700,7 @@ function j3(n2) { B(null, e4.l), e4.l = null, e4.i = null; }, e4.i && e4.i !== r3 && e4.componentWillUnmount(), n2.__v ? (e4.l || (e4.i = r3, e4.l = { nodeType: 1, parentNode: r3, childNodes: [], appendChild: function(n3) { this.childNodes.push(n3), e4.i.appendChild(n3); - }, insertBefore: function(n3, t4) { + }, insertBefore: function(n3, t5) { this.childNodes.push(n3), e4.i.appendChild(n3); }, removeChild: function(n3) { this.childNodes.splice(this.childNodes.indexOf(n3) >>> 1, 1), e4.i.removeChild(n3); @@ -710,11 +710,11 @@ function z3(n2, e4) { var r3 = y(j3, { __v: n2, i: e4 }); return r3.containerInfo = e4, r3; } -function G(n2, t4, e4) { - return null == t4.__k && (t4.textContent = ""), B(n2, t4), "function" == typeof e4 && e4(), n2 ? n2.__c : null; +function G(n2, t5, e4) { + return null == t5.__k && (t5.textContent = ""), B(n2, t5), "function" == typeof e4 && e4(), n2 ? n2.__c : null; } -function J(n2, t4, e4) { - return D(n2, t4), "function" == typeof e4 && e4(), n2 ? n2.__c : null; +function J(n2, t5, e4) { + return D(n2, t5), "function" == typeof e4 && e4(), n2 ? n2.__c : null; } function Q() { } @@ -748,11 +748,11 @@ function _n(n2) { function bn() { return [false, yn]; } -function gn(n2, t4) { - var e4 = t4(), r3 = h2({ h: { __: e4, v: t4 } }), u4 = r3[0].h, o3 = r3[1]; +function gn(n2, t5) { + var e4 = t5(), r3 = h2({ h: { __: e4, v: t5 } }), u4 = r3[0].h, o3 = r3[1]; return y2(function() { - u4.__ = e4, u4.v = t4, E2(u4.__, t4()) || o3({ h: u4 }); - }, [n2, e4, t4]), p2(function() { + u4.__ = e4, u4.v = t5, E2(u4.__, t5()) || o3({ h: u4 }); + }, [n2, e4, t5]), p2(function() { return E2(u4.__, u4.v()) || o3({ h: u4 }), n2(function() { E2(u4.__, u4.v()) || o3({ h: u4 }); }); @@ -765,57 +765,57 @@ var init_compat_module = __esm({ init_preact_module(); init_hooks_module(); init_hooks_module(); - (w3.prototype = new k()).isPureReactComponent = true, w3.prototype.shouldComponentUpdate = function(n2, t4) { - return C2(this.props, n2) || C2(this.state, t4); + (w3.prototype = new k()).isPureReactComponent = true, w3.prototype.shouldComponentUpdate = function(n2, t5) { + return C2(this.props, n2) || C2(this.state, t5); }; R = l.__b; l.__b = function(n2) { n2.type && n2.type.__f && n2.ref && (n2.props.ref = n2.ref, n2.ref = null), R && R(n2); }; N2 = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.forward_ref") || 3911; - A3 = function(n2, t4) { - return null == n2 ? null : P(P(n2).map(t4)); + A3 = function(n2, t5) { + return null == n2 ? null : P(P(n2).map(t5)); }; O2 = { map: A3, forEach: A3, count: function(n2) { return n2 ? P(n2).length : 0; }, only: function(n2) { - var t4 = P(n2); - if (1 !== t4.length) + var t5 = P(n2); + if (1 !== t5.length) throw "Children.only"; - return t4[0]; + return t5[0]; }, toArray: P }; T3 = l.__e; - l.__e = function(n2, t4, e4, r3) { + l.__e = function(n2, t5, e4, r3) { if (n2.then) { - for (var u4, o3 = t4; o3 = o3.__; ) + for (var u4, o3 = t5; o3 = o3.__; ) if ((u4 = o3.__c) && u4.__c) - return null == t4.__e && (t4.__e = e4.__e, t4.__k = e4.__k), u4.__c(n2, t4); + return null == t5.__e && (t5.__e = e4.__e, t5.__k = e4.__k), u4.__c(n2, t5); } - T3(n2, t4, e4, r3); + T3(n2, t5, e4, r3); }; I2 = l.unmount; l.unmount = function(n2) { - var t4 = n2.__c; - t4 && t4.__R && t4.__R(), t4 && true === n2.__h && (n2.type = null), I2 && I2(n2); - }, (D2.prototype = new k()).__c = function(n2, t4) { - var e4 = t4.__c, r3 = this; + var t5 = n2.__c; + t5 && t5.__R && t5.__R(), t5 && true === n2.__h && (n2.type = null), I2 && I2(n2); + }, (D2.prototype = new k()).__c = function(n2, t5) { + var e4 = t5.__c, r3 = this; null == r3.t && (r3.t = []), r3.t.push(e4); - var u4 = F3(r3.__v), o3 = false, i4 = function() { + var u4 = F3(r3.__v), o3 = false, i5 = function() { o3 || (o3 = true, e4.__R = null, u4 ? u4(l3) : l3()); }; - e4.__R = i4; + e4.__R = i5; var l3 = function() { if (!--r3.__u) { if (r3.state.__a) { var n3 = r3.state.__a; r3.__v.__k[0] = U(n3, n3.__c.__P, n3.__c.__O); } - var t5; - for (r3.setState({ __a: r3.__b = null }); t5 = r3.t.pop(); ) - t5.forceUpdate(); + var t6; + for (r3.setState({ __a: r3.__b = null }); t6 = r3.t.pop(); ) + t6.forceUpdate(); } - }, c4 = true === t4.__h; - r3.__u++ || c4 || r3.setState({ __a: r3.__b = r3.__v.__k[0] }), n2.then(i4, i4); + }, c4 = true === t5.__h; + r3.__u++ || c4 || r3.setState({ __a: r3.__b = r3.__v.__k[0] }), n2.then(i5, i5); }, D2.prototype.componentWillUnmount = function() { this.t = []; }, D2.prototype.render = function(n2, e4) { @@ -826,11 +826,11 @@ var init_compat_module = __esm({ } this.__b = null; } - var i4 = e4.__a && y(_, null, n2.fallback); - return i4 && (i4.__h = null), [y(_, null, e4.__a ? null : n2.children), i4]; + var i5 = e4.__a && y(_, null, n2.fallback); + return i5 && (i5.__h = null), [y(_, null, e4.__a ? null : n2.children), i5]; }; - W = function(n2, t4, e4) { - if (++e4[1] === e4[0] && n2.o.delete(t4), n2.props.revealOrder && ("t" !== n2.props.revealOrder[0] || !n2.o.size)) + W = function(n2, t5, e4) { + if (++e4[1] === e4[0] && n2.o.delete(t5), n2.props.revealOrder && ("t" !== n2.props.revealOrder[0] || !n2.o.size)) for (e4 = n2.u; e4; ) { for (; e4.length > 3; ) e4.pop()(); @@ -840,24 +840,24 @@ var init_compat_module = __esm({ } }; (V2.prototype = new k()).__a = function(n2) { - var t4 = this, e4 = F3(t4.__v), r3 = t4.o.get(n2); + var t5 = this, e4 = F3(t5.__v), r3 = t5.o.get(n2); return r3[0]++, function(u4) { var o3 = function() { - t4.props.revealOrder ? (r3.push(u4), W(t4, n2, r3)) : u4(); + t5.props.revealOrder ? (r3.push(u4), W(t5, n2, r3)) : u4(); }; e4 ? e4(o3) : o3(); }; }, V2.prototype.render = function(n2) { this.u = null, this.o = /* @__PURE__ */ new Map(); - var t4 = P(n2.children); - n2.revealOrder && "b" === n2.revealOrder[0] && t4.reverse(); - for (var e4 = t4.length; e4--; ) - this.o.set(t4[e4], this.u = [1, 0, this.u]); + var t5 = P(n2.children); + n2.revealOrder && "b" === n2.revealOrder[0] && t5.reverse(); + for (var e4 = t5.length; e4--; ) + this.o.set(t5[e4], this.u = [1, 0, this.u]); return n2.children; }, V2.prototype.componentDidUpdate = V2.prototype.componentDidMount = function() { var n2 = this; - this.o.forEach(function(t4, e4) { - W(n2, e4, t4); + this.o.forEach(function(t5, e4) { + W(n2, e4, t5); }); }; B3 = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103; @@ -868,11 +868,11 @@ var init_compat_module = __esm({ q3 = function(n2) { return ("undefined" != typeof Symbol && "symbol" == typeof Symbol() ? /fil|che|rad/ : /fil|che|ra/).test(n2); }; - k.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(t4) { - Object.defineProperty(k.prototype, t4, { configurable: true, get: function() { - return this["UNSAFE_" + t4]; + k.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(t5) { + Object.defineProperty(k.prototype, t5, { configurable: true, get: function() { + return this["UNSAFE_" + t5]; }, set: function(n2) { - Object.defineProperty(this, t4, { configurable: true, writable: true, value: n2 }); + Object.defineProperty(this, t5, { configurable: true, writable: true, value: n2 }); } }); }); K = l.event; @@ -884,18 +884,18 @@ var init_compat_module = __esm({ } }; rn = l.vnode; l.vnode = function(n2) { - var t4 = n2.type, e4 = n2.props, u4 = e4; - if ("string" == typeof t4) { + var t5 = n2.type, e4 = n2.props, u4 = e4; + if ("string" == typeof t5) { for (var o3 in u4 = {}, e4) { - var i4 = e4[o3]; - if (!("value" === o3 && "defaultValue" in e4 && null == i4 || $2 && "children" === o3 && "noscript" === t4)) { + var i5 = e4[o3]; + if (!("value" === o3 && "defaultValue" in e4 && null == i5 || $2 && "children" === o3 && "noscript" === t5)) { var l3 = o3.toLowerCase(); - "defaultValue" === o3 && "value" in e4 && null == e4.value ? o3 = "value" : "download" === o3 && true === i4 ? i4 = "" : "ondoubleclick" === l3 ? o3 = "ondblclick" : "onchange" !== l3 || "input" !== t4 && "textarea" !== t4 || q3(e4.type) ? "onfocus" === l3 ? o3 = "onfocusin" : "onblur" === l3 ? o3 = "onfocusout" : Z.test(o3) ? o3 = l3 : -1 === t4.indexOf("-") && H2.test(o3) ? o3 = o3.replace(Y, "-$&").toLowerCase() : null === i4 && (i4 = void 0) : l3 = o3 = "oninput", "oninput" === l3 && u4[o3 = l3] && (o3 = "oninputCapture"), u4[o3] = i4; + "defaultValue" === o3 && "value" in e4 && null == e4.value ? o3 = "value" : "download" === o3 && true === i5 ? i5 = "" : "ondoubleclick" === l3 ? o3 = "ondblclick" : "onchange" !== l3 || "input" !== t5 && "textarea" !== t5 || q3(e4.type) ? "onfocus" === l3 ? o3 = "onfocusin" : "onblur" === l3 ? o3 = "onfocusout" : Z.test(o3) ? o3 = l3 : -1 === t5.indexOf("-") && H2.test(o3) ? o3 = o3.replace(Y, "-$&").toLowerCase() : null === i5 && (i5 = void 0) : l3 = o3 = "oninput", "oninput" === l3 && u4[o3 = l3] && (o3 = "oninputCapture"), u4[o3] = i5; } } - "select" == t4 && u4.multiple && Array.isArray(u4.value) && (u4.value = P(e4.children).forEach(function(n3) { + "select" == t5 && u4.multiple && Array.isArray(u4.value) && (u4.value = P(e4.children).forEach(function(n3) { n3.props.selected = -1 != u4.value.indexOf(n3.props.value); - })), "select" == t4 && null != u4.defaultValue && (u4.value = P(e4.children).forEach(function(n3) { + })), "select" == t5 && null != u4.defaultValue && (u4.value = P(e4.children).forEach(function(n3) { n3.props.selected = u4.multiple ? -1 != u4.defaultValue.indexOf(n3.props.value) : u4.defaultValue == n3.props.value; })), n2.props = u4, e4.class != e4.className && (en.enumerable = "className" in e4, null != e4.className && (u4.class = e4.className), Object.defineProperty(u4, "className", en)); } @@ -908,18 +908,18 @@ var init_compat_module = __esm({ on = l.diffed; l.diffed = function(n2) { on && on(n2); - var t4 = n2.props, e4 = n2.__e; - null != e4 && "textarea" === n2.type && "value" in t4 && t4.value !== e4.value && (e4.value = null == t4.value ? "" : t4.value), tn = null; + var t5 = n2.props, e4 = n2.__e; + null != e4 && "textarea" === n2.type && "value" in t5 && t5.value !== e4.value && (e4.value = null == t5.value ? "" : t5.value), tn = null; }; ln = { ReactCurrentDispatcher: { current: { readContext: function(n2) { return tn.__n[n2.__c].props.value; } } } }; cn = "17.0.2"; - dn = function(n2, t4) { - return n2(t4); + dn = function(n2, t5) { + return n2(t5); }; - pn = function(n2, t4) { - return n2(t4); + pn = function(n2, t5) { + return n2(t5); }; mn = _; Sn = y2; @@ -927,6 +927,147 @@ var init_compat_module = __esm({ } }); +// node_modules/react-style-object-to-css/lib/CSSProperty.js +var require_CSSProperty = __commonJS({ + "node_modules/react-style-object-to-css/lib/CSSProperty.js"(exports2, module2) { + "use strict"; + var isUnitlessNumber = { + boxFlex: true, + boxFlexGroup: true, + columnCount: true, + flex: true, + flexGrow: true, + flexPositive: true, + flexShrink: true, + flexNegative: true, + fontWeight: true, + lineClamp: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + widows: true, + zIndex: true, + zoom: true, + fillOpacity: true, + strokeDashoffset: true, + strokeOpacity: true, + strokeWidth: true + }; + function prefixKey(prefix, key2) { + return prefix + key2.charAt(0).toUpperCase() + key2.substring(1); + } + var prefixes = ["Webkit", "ms", "Moz", "O"]; + Object.keys(isUnitlessNumber).forEach(function(prop) { + prefixes.forEach(function(prefix) { + isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; + }); + }); + var shorthandPropertyExpansions = { + background: { + backgroundImage: true, + backgroundPosition: true, + backgroundRepeat: true, + backgroundColor: true + }, + border: { + borderWidth: true, + borderStyle: true, + borderColor: true + }, + borderBottom: { + borderBottomWidth: true, + borderBottomStyle: true, + borderBottomColor: true + }, + borderLeft: { + borderLeftWidth: true, + borderLeftStyle: true, + borderLeftColor: true + }, + borderRight: { + borderRightWidth: true, + borderRightStyle: true, + borderRightColor: true + }, + borderTop: { + borderTopWidth: true, + borderTopStyle: true, + borderTopColor: true + }, + font: { + fontStyle: true, + fontVariant: true, + fontWeight: true, + fontSize: true, + lineHeight: true, + fontFamily: true + } + }; + var CSSProperty = { + isUnitlessNumber, + shorthandPropertyExpansions + }; + module2.exports = CSSProperty; + } +}); + +// node_modules/react-style-object-to-css/lib/hyphenateStyleName.js +var require_hyphenateStyleName = __commonJS({ + "node_modules/react-style-object-to-css/lib/hyphenateStyleName.js"(exports2, module2) { + "use strict"; + var msPattern = /^ms-/; + var _uppercasePattern = /([A-Z])/g; + function hyphenate(string2) { + return string2.replace(_uppercasePattern, "-$1").toLowerCase(); + } + function hyphenateStyleName(string2) { + return hyphenate(string2).replace(msPattern, "-ms-"); + } + module2.exports = hyphenateStyleName; + } +}); + +// node_modules/react-style-object-to-css/index.js +var require_react_style_object_to_css = __commonJS({ + "node_modules/react-style-object-to-css/index.js"(exports2, module2) { + "use strict"; + var isUnitlessNumber = require_CSSProperty().isUnitlessNumber; + var hyphenateStyleName = require_hyphenateStyleName(); + var isArray3 = Array.isArray; + var keys2 = Object.keys; + var unquotedContentValueRegex = /^(normal|none|(\b(url\([^)]*\)|chapter_counter|attr\([^)]*\)|(no-)?(open|close)-quote|inherit)((\b\s*)|$|\s+))+)$/; + function buildRule(key2, value) { + if (!isUnitlessNumber[key2] && typeof value === "number") { + value = "" + value + "px"; + } else if (key2 === "content" && !unquotedContentValueRegex.test(value)) { + value = "'" + value.replace(/'/g, "\\'") + "'"; + } + return hyphenateStyleName(key2) + ": " + value + "; "; + } + function styleToCssString(rules) { + var result = ""; + if (!rules || keys2(rules).length === 0) { + return result; + } + var styleKeys = keys2(rules); + for (var j4 = 0, l3 = styleKeys.length; j4 < l3; j4++) { + var styleKey = styleKeys[j4]; + var value = rules[styleKey]; + if (isArray3(value)) { + for (var i5 = 0, len = value.length; i5 < len; i5++) { + result += buildRule(styleKey, value[i5]); + } + } else { + result += buildRule(styleKey, value); + } + } + return result; + } + module2.exports = styleToCssString; + } +}); + // node_modules/lodash/lodash.js var require_lodash = __commonJS({ "node_modules/lodash/lodash.js"(exports2, module2) { @@ -1385,11 +1526,11 @@ var require_lodash = __commonJS({ return false; } var asciiSize = baseProperty2("length"); - function asciiToArray(string) { - return string.split(""); + function asciiToArray(string2) { + return string2.split(""); } - function asciiWords(string) { - return string.match(reAsciiWord) || []; + function asciiWords(string2) { + return string2.match(reAsciiWord) || []; } function baseFindKey(collection, predicate, eachFunc) { var result; @@ -1475,8 +1616,8 @@ var require_lodash = __commonJS({ return [key2, object[key2]]; }); } - function baseTrim2(string) { - return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string; + function baseTrim2(string2) { + return string2 ? string2.slice(0, trimmedEndIndex2(string2) + 1).replace(reTrimStart2, "") : string2; } function baseUnary2(func) { return function(value) { @@ -1488,8 +1629,8 @@ var require_lodash = __commonJS({ return object[key2]; }); } - function cacheHas2(cache, key2) { - return cache.has(key2); + function cacheHas2(cache2, key2) { + return cache2.has(key2); } function charsStartIndex(strSymbols, chrSymbols) { var index = -1, length = strSymbols.length; @@ -1520,11 +1661,11 @@ var require_lodash = __commonJS({ function getValue2(object, key2) { return object == null ? undefined2 : object[key2]; } - function hasUnicode(string) { - return reHasUnicode.test(string); + function hasUnicode(string2) { + return reHasUnicode.test(string2); } - function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); + function hasUnicodeWord(string2) { + return reHasUnicodeWord.test(string2); } function iteratorToArray(iterator) { var data2, result = []; @@ -1588,31 +1729,31 @@ var require_lodash = __commonJS({ } return index; } - function stringSize(string) { - return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); + function stringSize(string2) { + return hasUnicode(string2) ? unicodeSize(string2) : asciiSize(string2); } - function stringToArray(string) { - return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); + function stringToArray(string2) { + return hasUnicode(string2) ? unicodeToArray(string2) : asciiToArray(string2); } - function trimmedEndIndex2(string) { - var index = string.length; - while (index-- && reWhitespace2.test(string.charAt(index))) { + function trimmedEndIndex2(string2) { + var index = string2.length; + while (index-- && reWhitespace2.test(string2.charAt(index))) { } return index; } var unescapeHtmlChar = basePropertyOf(htmlUnescapes); - function unicodeSize(string) { + function unicodeSize(string2) { var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string)) { + while (reUnicode.test(string2)) { ++result; } return result; } - function unicodeToArray(string) { - return string.match(reUnicode) || []; + function unicodeToArray(string2) { + return string2.match(reUnicode) || []; } - function unicodeWords(string) { - return string.match(reUnicodeWord) || []; + function unicodeWords(string2) { + return string2.match(reUnicodeWord) || []; } var runInContext = function runInContext2(context) { context = context == null ? root2 : _12.defaults(root2.Object(), context, _12.pick(root2, contextProps)); @@ -1897,7 +2038,7 @@ var require_lodash = __commonJS({ } SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2; SetCache2.prototype.has = setCacheHas2; - function Stack2(entries) { + function Stack3(entries) { var data2 = this.__data__ = new ListCache2(entries); this.size = data2.size; } @@ -1931,11 +2072,11 @@ var require_lodash = __commonJS({ this.size = data2.size; return this; } - Stack2.prototype.clear = stackClear2; - Stack2.prototype["delete"] = stackDelete2; - Stack2.prototype.get = stackGet2; - Stack2.prototype.has = stackHas2; - Stack2.prototype.set = stackSet2; + Stack3.prototype.clear = stackClear2; + Stack3.prototype["delete"] = stackDelete2; + Stack3.prototype.get = stackGet2; + Stack3.prototype.has = stackHas2; + Stack3.prototype.set = stackSet2; function arrayLikeKeys2(value, inherited) { var isArr = isArray3(value), isArg = !isArr && isArguments2(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray2(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value.length, String2) : [], length = result2.length; for (var key2 in value) { @@ -2006,16 +2147,16 @@ var require_lodash = __commonJS({ } return result2; } - function baseClamp(number, lower, upper) { - if (number === number) { + function baseClamp(number2, lower, upper) { + if (number2 === number2) { if (upper !== undefined2) { - number = number <= upper ? number : upper; + number2 = number2 <= upper ? number2 : upper; } if (lower !== undefined2) { - number = number >= lower ? number : lower; + number2 = number2 >= lower ? number2 : lower; } } - return number; + return number2; } function baseClone(value, bitmask, customizer, key2, object, stack) { var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; @@ -2051,7 +2192,7 @@ var require_lodash = __commonJS({ result2 = initCloneByTag(value, tag, isDeep); } } - stack || (stack = new Stack2()); + stack || (stack = new Stack3()); var stacked = stack.get(value); if (stacked) { return stacked; @@ -2242,8 +2383,8 @@ var require_lodash = __commonJS({ function baseHasIn2(object, key2) { return object != null && key2 in Object2(object); } - function baseInRange(number, start, end) { - return number >= nativeMin2(start, end) && number < nativeMax3(start, end); + function baseInRange(number2, start, end) { + return number2 >= nativeMin2(start, end) && number2 < nativeMax3(start, end); } function baseIntersection(arrays, iteratee2, comparator) { var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = []; @@ -2264,8 +2405,8 @@ var require_lodash = __commonJS({ if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) { othIndex = othLength; while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) { + var cache2 = caches[othIndex]; + if (!(cache2 ? cacheHas2(cache2, computed) : includes2(arrays[othIndex], computed, comparator))) { continue outer; } } @@ -2320,21 +2461,21 @@ var require_lodash = __commonJS({ objIsObj = false; } if (isSameTag && !objIsObj) { - stack || (stack = new Stack2()); + stack || (stack = new Stack3()); return objIsArr || isTypedArray2(object) ? equalArrays2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG7)) { var objIsWrapped = objIsObj && hasOwnProperty14.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty14.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; - stack || (stack = new Stack2()); + stack || (stack = new Stack3()); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } - stack || (stack = new Stack2()); + stack || (stack = new Stack3()); return equalObjects2(object, other, bitmask, customizer, equalFunc, stack); } function baseIsMap(value) { @@ -2360,7 +2501,7 @@ var require_lodash = __commonJS({ return false; } } else { - var stack = new Stack2(); + var stack = new Stack3(); if (customizer) { var result2 = customizer(objValue, srcValue, key2, object, source, stack); } @@ -2456,7 +2597,7 @@ var require_lodash = __commonJS({ return; } baseFor2(source, function(srcValue, key2) { - stack || (stack = new Stack2()); + stack || (stack = new Stack3()); if (isObject3(srcValue)) { baseMergeDeep2(object, source, key2, srcIndex, baseMerge2, customizer, stack); } else { @@ -2609,18 +2750,18 @@ var require_lodash = __commonJS({ } return result2; } - function baseRepeat(string, n2) { + function baseRepeat(string2, n2) { var result2 = ""; - if (!string || n2 < 1 || n2 > MAX_SAFE_INTEGER3) { + if (!string2 || n2 < 1 || n2 > MAX_SAFE_INTEGER3) { return result2; } do { if (n2 % 2) { - result2 += string; + result2 += string2; } n2 = nativeFloor(n2 / 2); if (n2) { - string += string; + string2 += string2; } } while (n2); return result2; @@ -2662,11 +2803,11 @@ var require_lodash = __commonJS({ metaMap.set(func, data2); return func; }; - var baseSetToString2 = !defineProperty2 ? identity2 : function(func, string) { + var baseSetToString2 = !defineProperty2 ? identity2 : function(func, string2) { return defineProperty2(func, "toString", { "configurable": true, "enumerable": false, - "value": constant2(string), + "value": constant2(string2), "writable": true }); }; @@ -2881,8 +3022,8 @@ var require_lodash = __commonJS({ end = end === undefined2 ? length : end; return !start && end >= length ? array : baseSlice(array, start, end); } - var clearTimeout2 = ctxClearTimeout || function(id2) { - return root2.clearTimeout(id2); + var clearTimeout2 = ctxClearTimeout || function(id3) { + return root2.clearTimeout(id3); }; function cloneBuffer2(buffer, isDeep) { if (isDeep) { @@ -3065,17 +3206,17 @@ var require_lodash = __commonJS({ return wrapper; } function createCaseFirst(methodName) { - return function(string) { - string = toString5(string); - var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2; - var chr = strSymbols ? strSymbols[0] : string.charAt(0); - var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1); + return function(string2) { + string2 = toString5(string2); + var strSymbols = hasUnicode(string2) ? stringToArray(string2) : undefined2; + var chr = strSymbols ? strSymbols[0] : string2.charAt(0); + var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string2.slice(1); return chr[methodName]() + trailing; }; } function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string).replace(reApos, "")), callback, ""); + return function(string2) { + return arrayReduce(words(deburr(string2).replace(reApos, "")), callback, ""); }; } function createCtor(Ctor) { @@ -3237,7 +3378,7 @@ var require_lodash = __commonJS({ return baseInverter(object, setter, toIteratee(iteratee2), {}); }; } - function createMathOperation(operator, defaultValue2) { + function createMathOperation(operator2, defaultValue2) { return function(value, other) { var result2; if (value === undefined2 && other === undefined2) { @@ -3257,7 +3398,7 @@ var require_lodash = __commonJS({ value = baseToNumber(value); other = baseToNumber(other); } - result2 = operator(value, other); + result2 = operator2(value, other); } return result2; }; @@ -3312,13 +3453,13 @@ var require_lodash = __commonJS({ return baseRange(start, end, step, fromRight); }; } - function createRelationalOperation(operator) { + function createRelationalOperation(operator2) { return function(value, other) { if (!(typeof value == "string" && typeof other == "string")) { value = toNumber2(value); other = toNumber2(other); } - return operator(value, other); + return operator2(value, other); }; } function createRecurry(func, bitmask, wrapFunc, placeholder2, thisArg, partials, holders, argPos, ary2, arity) { @@ -3349,15 +3490,15 @@ var require_lodash = __commonJS({ } function createRound(methodName) { var func = Math2[methodName]; - return function(number, precision) { - number = toNumber2(number); + return function(number2, precision) { + number2 = toNumber2(number2); precision = precision == null ? 0 : nativeMin2(toInteger2(precision), 292); - if (precision && nativeIsFinite(number)) { - var pair = (toString5(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision)); - pair = (toString5(value) + "e").split("e"); - return +(pair[0] + "e" + (+pair[1] - precision)); + if (precision && nativeIsFinite(number2)) { + var pair2 = (toString5(number2) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision)); + pair2 = (toString5(value) + "e").split("e"); + return +(pair2[0] + "e" + (+pair2[1] - precision)); } - return func(number); + return func(number2); }; } var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY3) ? noop3 : function(values2) { @@ -3839,12 +3980,12 @@ var require_lodash = __commonJS({ } function memoizeCapped2(func) { var result2 = memoize2(func, function(key2) { - if (cache.size === MAX_MEMOIZE_SIZE2) { - cache.clear(); + if (cache2.size === MAX_MEMOIZE_SIZE2) { + cache2.clear(); } return key2; }); - var cache = result2.cache; + var cache2 = result2.cache; return result2; } function mergeData(data2, source) { @@ -3966,13 +4107,13 @@ var require_lodash = __commonJS({ array.length = size2; return array; } - var stringToPath2 = memoizeCapped2(function(string) { + var stringToPath2 = memoizeCapped2(function(string2) { var result2 = []; - if (string.charCodeAt(0) === 46) { + if (string2.charCodeAt(0) === 46) { result2.push(""); } - string.replace(rePropName2, function(match2, number, quote, subString) { - result2.push(quote ? subString.replace(reEscapeChar2, "$1") : number || match2); + string2.replace(rePropName2, function(match2, number2, quote, subString) { + result2.push(quote ? subString.replace(reEscapeChar2, "$1") : number2 || match2); }); return result2; }); @@ -3997,9 +4138,9 @@ var require_lodash = __commonJS({ return ""; } function updateWrapDetails(details, bitmask) { - arrayEach2(wrapFlags, function(pair) { - var value = "_." + pair[0]; - if (bitmask & pair[1] && !arrayIncludes(details, value)) { + arrayEach2(wrapFlags, function(pair2) { + var value = "_." + pair2[0]; + if (bitmask & pair2[1] && !arrayIncludes(details, value)) { details.push(value); } }); @@ -4145,8 +4286,8 @@ var require_lodash = __commonJS({ function fromPairs(pairs) { var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; while (++index < length) { - var pair = pairs[index]; - result2[pair[0]] = pair[1]; + var pair2 = pairs[index]; + result2[pair2[0]] = pair2[1]; } return result2; } @@ -4798,12 +4939,12 @@ var require_lodash = __commonJS({ throw new TypeError2(FUNC_ERROR_TEXT4); } var memoized = function() { - var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; - if (cache.has(key2)) { - return cache.get(key2); + var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache; + if (cache2.has(key2)) { + return cache2.get(key2); } var result2 = func.apply(this, args); - memoized.cache = cache.set(key2, result2) || cache; + memoized.cache = cache2.set(key2, result2) || cache2; return result2; }; memoized.cache = new (memoize2.Cache || MapCache2)(); @@ -5356,7 +5497,7 @@ var require_lodash = __commonJS({ function valuesIn(object) { return object == null ? [] : baseValues(object, keysIn2(object)); } - function clamp2(number, lower, upper) { + function clamp2(number2, lower, upper) { if (upper === undefined2) { upper = lower; lower = undefined2; @@ -5369,9 +5510,9 @@ var require_lodash = __commonJS({ lower = toNumber2(lower); lower = lower === lower ? lower : 0; } - return baseClamp(toNumber2(number), lower, upper); + return baseClamp(toNumber2(number2), lower, upper); } - function inRange(number, start, end) { + function inRange(number2, start, end) { start = toFinite(start); if (end === undefined2) { end = start; @@ -5379,8 +5520,8 @@ var require_lodash = __commonJS({ } else { end = toFinite(end); } - number = toNumber2(number); - return baseInRange(number, start, end); + number2 = toNumber2(number2); + return baseInRange(number2, start, end); } function random(lower, upper, floating) { if (floating && typeof floating != "boolean" && isIterateeCall2(lower, upper, floating)) { @@ -5422,29 +5563,29 @@ var require_lodash = __commonJS({ word = word.toLowerCase(); return result2 + (index ? capitalize(word) : word); }); - function capitalize(string) { - return upperFirst(toString5(string).toLowerCase()); + function capitalize(string2) { + return upperFirst(toString5(string2).toLowerCase()); } - function deburr(string) { - string = toString5(string); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ""); + function deburr(string2) { + string2 = toString5(string2); + return string2 && string2.replace(reLatin, deburrLetter).replace(reComboMark, ""); } - function endsWith(string, target, position) { - string = toString5(string); + function endsWith(string2, target, position) { + string2 = toString5(string2); target = baseToString2(target); - var length = string.length; + var length = string2.length; position = position === undefined2 ? length : baseClamp(toInteger2(position), 0, length); var end = position; position -= target.length; - return position >= 0 && string.slice(position, end) == target; + return position >= 0 && string2.slice(position, end) == target; } - function escape(string) { - string = toString5(string); - return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; + function escape(string2) { + string2 = toString5(string2); + return string2 && reHasUnescapedHtml.test(string2) ? string2.replace(reUnescapedHtml, escapeHtmlChar) : string2; } - function escapeRegExp(string) { - string = toString5(string); - return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string; + function escapeRegExp(string2) { + string2 = toString5(string2); + return string2 && reHasRegExpChar.test(string2) ? string2.replace(reRegExpChar2, "\\$&") : string2; } var kebabCase = createCompounder(function(result2, word, index) { return result2 + (index ? "-" : "") + word.toLowerCase(); @@ -5453,83 +5594,83 @@ var require_lodash = __commonJS({ return result2 + (index ? " " : "") + word.toLowerCase(); }); var lowerFirst = createCaseFirst("toLowerCase"); - function pad(string, length, chars) { - string = toString5(string); + function pad(string2, length, chars) { + string2 = toString5(string2); length = toInteger2(length); - var strLength = length ? stringSize(string) : 0; + var strLength = length ? stringSize(string2) : 0; if (!length || strLength >= length) { - return string; + return string2; } var mid = (length - strLength) / 2; - return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars); + return createPadding(nativeFloor(mid), chars) + string2 + createPadding(nativeCeil(mid), chars); } - function padEnd(string, length, chars) { - string = toString5(string); + function padEnd(string2, length, chars) { + string2 = toString5(string2); length = toInteger2(length); - var strLength = length ? stringSize(string) : 0; - return length && strLength < length ? string + createPadding(length - strLength, chars) : string; + var strLength = length ? stringSize(string2) : 0; + return length && strLength < length ? string2 + createPadding(length - strLength, chars) : string2; } - function padStart(string, length, chars) { - string = toString5(string); + function padStart(string2, length, chars) { + string2 = toString5(string2); length = toInteger2(length); - var strLength = length ? stringSize(string) : 0; - return length && strLength < length ? createPadding(length - strLength, chars) + string : string; + var strLength = length ? stringSize(string2) : 0; + return length && strLength < length ? createPadding(length - strLength, chars) + string2 : string2; } - function parseInt2(string, radix, guard) { + function parseInt2(string2, radix, guard) { if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } - return nativeParseInt(toString5(string).replace(reTrimStart2, ""), radix || 0); + return nativeParseInt(toString5(string2).replace(reTrimStart2, ""), radix || 0); } - function repeat(string, n2, guard) { - if (guard ? isIterateeCall2(string, n2, guard) : n2 === undefined2) { + function repeat(string2, n2, guard) { + if (guard ? isIterateeCall2(string2, n2, guard) : n2 === undefined2) { n2 = 1; } else { n2 = toInteger2(n2); } - return baseRepeat(toString5(string), n2); + return baseRepeat(toString5(string2), n2); } function replace() { - var args = arguments, string = toString5(args[0]); - return args.length < 3 ? string : string.replace(args[1], args[2]); + var args = arguments, string2 = toString5(args[0]); + return args.length < 3 ? string2 : string2.replace(args[1], args[2]); } var snakeCase = createCompounder(function(result2, word, index) { return result2 + (index ? "_" : "") + word.toLowerCase(); }); - function split(string, separator, limit) { - if (limit && typeof limit != "number" && isIterateeCall2(string, separator, limit)) { + function split(string2, separator, limit) { + if (limit && typeof limit != "number" && isIterateeCall2(string2, separator, limit)) { separator = limit = undefined2; } limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0; if (!limit) { return []; } - string = toString5(string); - if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) { + string2 = toString5(string2); + if (string2 && (typeof separator == "string" || separator != null && !isRegExp(separator))) { separator = baseToString2(separator); - if (!separator && hasUnicode(string)) { - return castSlice(stringToArray(string), 0, limit); + if (!separator && hasUnicode(string2)) { + return castSlice(stringToArray(string2), 0, limit); } } - return string.split(separator, limit); + return string2.split(separator, limit); } var startCase = createCompounder(function(result2, word, index) { return result2 + (index ? " " : "") + upperFirst(word); }); - function startsWith(string, target, position) { - string = toString5(string); - position = position == null ? 0 : baseClamp(toInteger2(position), 0, string.length); + function startsWith(string2, target, position) { + string2 = toString5(string2); + position = position == null ? 0 : baseClamp(toInteger2(position), 0, string2.length); target = baseToString2(target); - return string.slice(position, position + target.length) == target; + return string2.slice(position, position + target.length) == target; } - function template(string, options, guard) { + function template(string2, options, guard) { var settings = lodash.templateSettings; - if (guard && isIterateeCall2(string, options, guard)) { + if (guard && isIterateeCall2(string2, options, guard)) { options = undefined2; } - string = toString5(string); + string2 = toString5(string2); options = assignInWith({}, options, settings, customDefaultsAssignIn); var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys); var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; @@ -5538,9 +5679,9 @@ var require_lodash = __commonJS({ "g" ); var sourceURL = "//# sourceURL=" + (hasOwnProperty14.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; - string.replace(reDelimiters, function(match2, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) { + string2.replace(reDelimiters, function(match2, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) { interpolateValue || (interpolateValue = esTemplateValue); - source += string.slice(index, offset2).replace(reUnescapedString, escapeStringChar); + source += string2.slice(index, offset2).replace(reUnescapedString, escapeStringChar); if (escapeValue) { isEscaping = true; source += "' +\n__e(" + escapeValue + ") +\n'"; @@ -5579,60 +5720,60 @@ var require_lodash = __commonJS({ function toUpper(value) { return toString5(value).toUpperCase(); } - function trim(string, chars, guard) { - string = toString5(string); - if (string && (guard || chars === undefined2)) { - return baseTrim2(string); + function trim(string2, chars, guard) { + string2 = toString5(string2); + if (string2 && (guard || chars === undefined2)) { + return baseTrim2(string2); } - if (!string || !(chars = baseToString2(chars))) { - return string; + if (!string2 || !(chars = baseToString2(chars))) { + return string2; } - var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; + var strSymbols = stringToArray(string2), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; return castSlice(strSymbols, start, end).join(""); } - function trimEnd(string, chars, guard) { - string = toString5(string); - if (string && (guard || chars === undefined2)) { - return string.slice(0, trimmedEndIndex2(string) + 1); + function trimEnd(string2, chars, guard) { + string2 = toString5(string2); + if (string2 && (guard || chars === undefined2)) { + return string2.slice(0, trimmedEndIndex2(string2) + 1); } - if (!string || !(chars = baseToString2(chars))) { - return string; + if (!string2 || !(chars = baseToString2(chars))) { + return string2; } - var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; + var strSymbols = stringToArray(string2), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; return castSlice(strSymbols, 0, end).join(""); } - function trimStart(string, chars, guard) { - string = toString5(string); - if (string && (guard || chars === undefined2)) { - return string.replace(reTrimStart2, ""); + function trimStart(string2, chars, guard) { + string2 = toString5(string2); + if (string2 && (guard || chars === undefined2)) { + return string2.replace(reTrimStart2, ""); } - if (!string || !(chars = baseToString2(chars))) { - return string; + if (!string2 || !(chars = baseToString2(chars))) { + return string2; } - var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars)); + var strSymbols = stringToArray(string2), start = charsStartIndex(strSymbols, stringToArray(chars)); return castSlice(strSymbols, start).join(""); } - function truncate(string, options) { + function truncate(string2, options) { var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; if (isObject3(options)) { var separator = "separator" in options ? options.separator : separator; length = "length" in options ? toInteger2(options.length) : length; omission = "omission" in options ? baseToString2(options.omission) : omission; } - string = toString5(string); - var strLength = string.length; - if (hasUnicode(string)) { - var strSymbols = stringToArray(string); + string2 = toString5(string2); + var strLength = string2.length; + if (hasUnicode(string2)) { + var strSymbols = stringToArray(string2); strLength = strSymbols.length; } if (length >= strLength) { - return string; + return string2; } var end = length - stringSize(omission); if (end < 1) { return omission; } - var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end); + var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string2.slice(0, end); if (separator === undefined2) { return result2 + omission; } @@ -5640,7 +5781,7 @@ var require_lodash = __commonJS({ end += result2.length - end; } if (isRegExp(separator)) { - if (string.slice(end).search(separator)) { + if (string2.slice(end).search(separator)) { var match2, substring = result2; if (!separator.global) { separator = RegExp2(separator.source, toString5(reFlags.exec(separator)) + "g"); @@ -5651,7 +5792,7 @@ var require_lodash = __commonJS({ } result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd); } - } else if (string.indexOf(baseToString2(separator), end) != end) { + } else if (string2.indexOf(baseToString2(separator), end) != end) { var index = result2.lastIndexOf(separator); if (index > -1) { result2 = result2.slice(0, index); @@ -5659,21 +5800,21 @@ var require_lodash = __commonJS({ } return result2 + omission; } - function unescape(string) { - string = toString5(string); - return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; + function unescape(string2) { + string2 = toString5(string2); + return string2 && reHasEscapedHtml.test(string2) ? string2.replace(reEscapedHtml, unescapeHtmlChar) : string2; } var upperCase = createCompounder(function(result2, word, index) { return result2 + (index ? " " : "") + word.toUpperCase(); }); var upperFirst = createCaseFirst("toUpperCase"); - function words(string, pattern, guard) { - string = toString5(string); + function words(string2, pattern, guard) { + string2 = toString5(string2); pattern = guard ? undefined2 : pattern; if (pattern === undefined2) { - return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); + return hasUnicodeWord(string2) ? unicodeWords(string2) : asciiWords(string2); } - return string.match(pattern) || []; + return string2.match(pattern) || []; } var attempt = baseRest2(function(func, args) { try { @@ -5691,18 +5832,18 @@ var require_lodash = __commonJS({ }); function cond(pairs) { var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee(); - pairs = !length ? [] : arrayMap2(pairs, function(pair) { - if (typeof pair[1] != "function") { + pairs = !length ? [] : arrayMap2(pairs, function(pair2) { + if (typeof pair2[1] != "function") { throw new TypeError2(FUNC_ERROR_TEXT4); } - return [toIteratee(pair[0]), pair[1]]; + return [toIteratee(pair2[0]), pair2[1]]; }); return baseRest2(function(args) { var index = -1; while (++index < length) { - var pair = pairs[index]; - if (apply2(pair[0], this, args)) { - return apply2(pair[1], this, args); + var pair2 = pairs[index]; + if (apply2(pair2[0], this, args)) { + return apply2(pair2[1], this, args); } } }); @@ -5832,8 +5973,8 @@ var require_lodash = __commonJS({ return isSymbol2(value) ? [value] : copyArray2(stringToPath2(toString5(value))); } function uniqueId3(prefix) { - var id2 = ++idCounter2; - return toString5(prefix) + id2; + var id3 = ++idCounter2; + return toString5(prefix) + id3; } var add2 = createMathOperation(function(augend, addend) { return augend + addend; @@ -6405,8 +6546,8 @@ var require_fuzzysort = __commonJS({ var targetsLen = targets.length; if (options && options.key) { var key2 = options.key; - for (var i4 = 0; i4 < targetsLen; ++i4) { - var obj = targets[i4]; + for (var i5 = 0; i5 < targetsLen; ++i5) { + var obj = targets[i5]; var target = getValue2(obj, key2); if (!target) continue; @@ -6433,8 +6574,8 @@ var require_fuzzysort = __commonJS({ var scoreFn = options["scoreFn"] || defaultScoreFn; var keys2 = options.keys; var keysLen = keys2.length; - for (var i4 = 0; i4 < targetsLen; ++i4) { - var obj = targets[i4]; + for (var i5 = 0; i5 < targetsLen; ++i5) { + var obj = targets[i5]; var objResults = new Array(keysLen); for (var keyI = 0; keyI < keysLen; ++keyI) { var key2 = keys2[keyI]; @@ -6467,8 +6608,8 @@ var require_fuzzysort = __commonJS({ } } } else { - for (var i4 = 0; i4 < targetsLen; ++i4) { - var target = targets[i4]; + for (var i5 = 0; i5 < targetsLen; ++i5) { + var target = targets[i5]; if (!target) continue; if (!isObj(target)) @@ -6493,8 +6634,8 @@ var require_fuzzysort = __commonJS({ if (resultsLen === 0) return noResults; var results = new Array(resultsLen); - for (var i4 = resultsLen - 1; i4 >= 0; --i4) - results[i4] = q5.poll(); + for (var i5 = resultsLen - 1; i5 >= 0; --i5) + results[i5] = q5.poll(); results.total = resultsLen + limitedCount; return results; }; @@ -6513,17 +6654,17 @@ var require_fuzzysort = __commonJS({ var target = result.target; var targetLen = target.length; var indexes2 = result._indexes; - indexes2 = indexes2.slice(0, indexes2.len).sort((a5, b4) => a5 - b4); - for (var i4 = 0; i4 < targetLen; ++i4) { - var char = target[i4]; - if (indexes2[matchesIndex] === i4) { + indexes2 = indexes2.slice(0, indexes2.len).sort((a6, b4) => a6 - b4); + for (var i5 = 0; i5 < targetLen; ++i5) { + var char = target[i5]; + if (indexes2[matchesIndex] === i5) { ++matchesIndex; if (!opened) { opened = true; highlighted += hOpen; } if (matchesIndex === indexes2.length) { - highlighted += char + hClose + target.substr(i4 + 1); + highlighted += char + hClose + target.substr(i5 + 1); break; } } else { @@ -6542,15 +6683,15 @@ var require_fuzzysort = __commonJS({ var target = result.target; var targetLen = target.length; var indexes2 = result._indexes; - indexes2 = indexes2.slice(0, indexes2.len).sort((a5, b4) => a5 - b4); + indexes2 = indexes2.slice(0, indexes2.len).sort((a6, b4) => a6 - b4); var highlighted = ""; var matchI = 0; var indexesI = 0; var opened = false; var result = []; - for (var i4 = 0; i4 < targetLen; ++i4) { - var char = target[i4]; - if (indexes2[indexesI] === i4) { + for (var i5 = 0; i5 < targetLen; ++i5) { + var char = target[i5]; + if (indexes2[indexesI] === i5) { ++indexesI; if (!opened) { opened = true; @@ -6561,7 +6702,7 @@ var require_fuzzysort = __commonJS({ highlighted += char; result.push(cb(highlighted, matchI++)); highlighted = ""; - result.push(target.substr(i4 + 1)); + result.push(target.substr(i5 + 1)); break; } } else { @@ -6575,7 +6716,7 @@ var require_fuzzysort = __commonJS({ } return result; }; - var indexes = (result) => result._indexes.slice(0, result._indexes.len).sort((a5, b4) => a5 - b4); + var indexes = (result) => result._indexes.slice(0, result._indexes.len).sort((a6, b4) => a6 - b4); var prepare = (target) => { if (typeof target !== "string") target = ""; @@ -6591,11 +6732,11 @@ var require_fuzzysort = __commonJS({ if (info.containsSpace) { var searches = search.split(/\s+/); searches = [...new Set(searches)]; - for (var i4 = 0; i4 < searches.length; i4++) { - if (searches[i4] === "") + for (var i5 = 0; i5 < searches.length; i5++) { + if (searches[i5] === "") continue; - var _info = prepareLowerInfo(searches[i4]); - spaceSearches.push({ lowerCodes: _info.lowerCodes, _lower: searches[i4].toLowerCase(), containsSpace: false }); + var _info = prepareLowerInfo(searches[i5]); + spaceSearches.push({ lowerCodes: _info.lowerCodes, _lower: searches[i5].toLowerCase(), containsSpace: false }); } } return { lowerCodes: info.lowerCodes, bitflags: info.bitflags, containsSpace: info.containsSpace, _lower: info._lower, spaceSearches }; @@ -6625,8 +6766,8 @@ var require_fuzzysort = __commonJS({ results.total = targets.length; var limit = options && options.limit || INT_MAX; if (options && options.key) { - for (var i4 = 0; i4 < targets.length; i4++) { - var obj = targets[i4]; + for (var i5 = 0; i5 < targets.length; i5++) { + var obj = targets[i5]; var target = getValue2(obj, options.key); if (!target) continue; @@ -6641,8 +6782,8 @@ var require_fuzzysort = __commonJS({ return results; } } else if (options && options.keys) { - for (var i4 = 0; i4 < targets.length; i4++) { - var obj = targets[i4]; + for (var i5 = 0; i5 < targets.length; i5++) { + var obj = targets[i5]; var objResults = new Array(options.keys.length); for (var keyI = options.keys.length - 1; keyI >= 0; --keyI) { var target = getValue2(obj, options.keys[keyI]); @@ -6663,8 +6804,8 @@ var require_fuzzysort = __commonJS({ return results; } } else { - for (var i4 = 0; i4 < targets.length; i4++) { - var target = targets[i4]; + for (var i5 = 0; i5 < targets.length; i5++) { + var target = targets[i5]; if (!target) continue; if (!isObj(target)) @@ -6740,8 +6881,8 @@ var require_fuzzysort = __commonJS({ var substringIndex = prepared._targetLower.indexOf(searchLower, matchesSimple[0]); var isSubstring = ~substringIndex; if (isSubstring && !successStrict) { - for (var i4 = 0; i4 < matchesSimpleLen; ++i4) - matchesSimple[i4] = substringIndex + i4; + for (var i5 = 0; i5 < matchesSimpleLen; ++i5) + matchesSimple[i5] = substringIndex + i5; } var isSubstringBeginning = false; if (isSubstring) { @@ -6757,9 +6898,9 @@ var require_fuzzysort = __commonJS({ } var score = 0; var extraMatchGroupCount = 0; - for (var i4 = 1; i4 < searchLen; ++i4) { - if (matchesBest[i4] - matchesBest[i4 - 1] !== 1) { - score -= matchesBest[i4]; + for (var i5 = 1; i5 < searchLen; ++i5) { + if (matchesBest[i5] - matchesBest[i5 - 1] !== 1) { + score -= matchesBest[i5]; ++extraMatchGroupCount; } } @@ -6771,7 +6912,7 @@ var require_fuzzysort = __commonJS({ score *= 1e3; } else { var uniqueBeginningIndexes = 1; - for (var i4 = nextBeginningIndexes[0]; i4 < targetLen; i4 = nextBeginningIndexes[i4]) + for (var i5 = nextBeginningIndexes[0]; i5 < targetLen; i5 = nextBeginningIndexes[i5]) ++uniqueBeginningIndexes; if (uniqueBeginningIndexes > 24) score *= (uniqueBeginningIndexes - 24) * 10; @@ -6782,8 +6923,8 @@ var require_fuzzysort = __commonJS({ score /= 1 + searchLen * searchLen * 1; score -= targetLen - searchLen; prepared.score = score; - for (var i4 = 0; i4 < matchesBestLen; ++i4) - prepared._indexes[i4] = matchesBest[i4]; + for (var i5 = 0; i5 < matchesBestLen; ++i5) + prepared._indexes[i5] = matchesBest[i5]; prepared._indexes.len = matchesBestLen; return prepared; } @@ -6794,8 +6935,8 @@ var require_fuzzysort = __commonJS({ var result = NULL; var first_seen_index_last_search = 0; var searches = preparedSearch.spaceSearches; - for (var i4 = 0; i4 < searches.length; ++i4) { - var search = searches[i4]; + for (var i5 = 0; i5 < searches.length; ++i5) { + var search = searches[i5]; result = algorithm(search, target); if (result === NULL) return NULL; @@ -6812,10 +6953,10 @@ var require_fuzzysort = __commonJS({ return allowSpacesResult; } result.score = score; - var i4 = 0; + var i5 = 0; for (let index of seen_indexes) - result._indexes[i4++] = index; - result._indexes.len = i4; + result._indexes[i5++] = index; + result._indexes.len = i5; return result; }; var prepareLowerInfo = (str) => { @@ -6824,8 +6965,8 @@ var require_fuzzysort = __commonJS({ var lowerCodes = []; var bitflags = 0; var containsSpace = false; - for (var i4 = 0; i4 < strLen; ++i4) { - var lowerCode = lowerCodes[i4] = lower.charCodeAt(i4); + for (var i5 = 0; i5 < strLen; ++i5) { + var lowerCode = lowerCodes[i5] = lower.charCodeAt(i5); if (lowerCode === 32) { containsSpace = true; continue; @@ -6841,15 +6982,15 @@ var require_fuzzysort = __commonJS({ var beginningIndexesLen = 0; var wasUpper = false; var wasAlphanum = false; - for (var i4 = 0; i4 < targetLen; ++i4) { - var targetCode = target.charCodeAt(i4); + for (var i5 = 0; i5 < targetLen; ++i5) { + var targetCode = target.charCodeAt(i5); var isUpper = targetCode >= 65 && targetCode <= 90; var isAlphanum = isUpper || targetCode >= 97 && targetCode <= 122 || targetCode >= 48 && targetCode <= 57; var isBeginning = isUpper && !wasUpper || !wasAlphanum || !isAlphanum; wasUpper = isUpper; wasAlphanum = isAlphanum; if (isBeginning) - beginningIndexes[beginningIndexesLen++] = i4; + beginningIndexes[beginningIndexesLen++] = i5; } return beginningIndexes; }; @@ -6859,12 +7000,12 @@ var require_fuzzysort = __commonJS({ var nextBeginningIndexes = []; var lastIsBeginning = beginningIndexes[0]; var lastIsBeginningI = 0; - for (var i4 = 0; i4 < targetLen; ++i4) { - if (lastIsBeginning > i4) { - nextBeginningIndexes[i4] = lastIsBeginning; + for (var i5 = 0; i5 < targetLen; ++i5) { + if (lastIsBeginning > i5) { + nextBeginningIndexes[i5] = lastIsBeginning; } else { lastIsBeginning = beginningIndexes[++lastIsBeginningI]; - nextBeginningIndexes[i4] = lastIsBeginning === void 0 ? targetLen : lastIsBeginning; + nextBeginningIndexes[i5] = lastIsBeginning === void 0 ? targetLen : lastIsBeginning; } } return nextBeginningIndexes; @@ -6879,11 +7020,11 @@ var require_fuzzysort = __commonJS({ var preparedSearchCache = /* @__PURE__ */ new Map(); var matchesSimple = []; var matchesStrict = []; - var defaultScoreFn = (a5) => { + var defaultScoreFn = (a6) => { var max3 = INT_MIN; - var len = a5.length; - for (var i4 = 0; i4 < len; ++i4) { - var result = a5[i4]; + var len = a6.length; + for (var i5 = 0; i5 < len; ++i5) { + var result = a6[i5]; if (result === NULL) continue; var score = result.score; @@ -6902,9 +7043,9 @@ var require_fuzzysort = __commonJS({ if (!Array.isArray(prop)) segs = prop.split("."); var len = segs.length; - var i4 = -1; - while (obj && ++i4 < len) - obj = obj[segs[i4]]; + var i5 = -1; + while (obj && ++i5 < len) + obj = obj[segs[i5]]; return obj; }; var isObj = (x5) => { @@ -6916,32 +7057,32 @@ var require_fuzzysort = __commonJS({ noResults.total = 0; var NULL = null; var fastpriorityqueue = (r3) => { - var e4 = [], o3 = 0, a5 = {}, v3 = (r4) => { - for (var a6 = 0, v4 = e4[a6], c4 = 1; c4 < o3; ) { - var s5 = c4 + 1; - a6 = c4, s5 < o3 && e4[s5].score < e4[c4].score && (a6 = s5), e4[a6 - 1 >> 1] = e4[a6], c4 = 1 + (a6 << 1); - } - for (var f4 = a6 - 1 >> 1; a6 > 0 && v4.score < e4[f4].score; f4 = (a6 = f4) - 1 >> 1) - e4[a6] = e4[f4]; - e4[a6] = v4; + var e4 = [], o3 = 0, a6 = {}, v4 = (r4) => { + for (var a7 = 0, v5 = e4[a7], c4 = 1; c4 < o3; ) { + var s6 = c4 + 1; + a7 = c4, s6 < o3 && e4[s6].score < e4[c4].score && (a7 = s6), e4[a7 - 1 >> 1] = e4[a7], c4 = 1 + (a7 << 1); + } + for (var f4 = a7 - 1 >> 1; a7 > 0 && v5.score < e4[f4].score; f4 = (a7 = f4) - 1 >> 1) + e4[a7] = e4[f4]; + e4[a7] = v5; }; - return a5.add = (r4) => { - var a6 = o3; + return a6.add = (r4) => { + var a7 = o3; e4[o3++] = r4; - for (var v4 = a6 - 1 >> 1; a6 > 0 && r4.score < e4[v4].score; v4 = (a6 = v4) - 1 >> 1) - e4[a6] = e4[v4]; - e4[a6] = r4; - }, a5.poll = (r4) => { + for (var v5 = a7 - 1 >> 1; a7 > 0 && r4.score < e4[v5].score; v5 = (a7 = v5) - 1 >> 1) + e4[a7] = e4[v5]; + e4[a7] = r4; + }, a6.poll = (r4) => { if (0 !== o3) { - var a6 = e4[0]; - return e4[0] = e4[--o3], v3(), a6; + var a7 = e4[0]; + return e4[0] = e4[--o3], v4(), a7; } - }, a5.peek = (r4) => { + }, a6.peek = (r4) => { if (0 !== o3) return e4[0]; - }, a5.replaceTop = (r4) => { - e4[0] = r4, v3(); - }, a5; + }, a6.replaceTop = (r4) => { + e4[0] = r4, v4(); + }, a6; }; var q5 = fastpriorityqueue(); return { "single": single, "go": go, "highlight": highlight, "prepare": prepare, "indexes": indexes, "cleanup": cleanup }; @@ -6983,8 +7124,8 @@ var require_he = __commonJS({ var stringFromCharCode = String.fromCharCode; var object = {}; var hasOwnProperty14 = object.hasOwnProperty; - var has = function(object2, propertyName) { - return hasOwnProperty14.call(object2, propertyName); + var has = function(object2, propertyName2) { + return hasOwnProperty14.call(object2, propertyName2); }; var contains = function(array, value) { var index = -1; @@ -7041,10 +7182,10 @@ var require_he = __commonJS({ var parseError = function(message) { throw Error("Parse error: " + message); }; - var encode = function(string, options) { + var encode = function(string2, options) { options = merge2(options, encode.options); var strict = options.strict; - if (strict && regexInvalidRawCodePoint.test(string)) { + if (strict && regexInvalidRawCodePoint.test(string2)) { parseError("forbidden code point"); } var encodeEverything = options.encodeEverything; @@ -7055,34 +7196,34 @@ var require_he = __commonJS({ return escapeCodePoint(symbol.charCodeAt(0)); }; if (encodeEverything) { - string = string.replace(regexAsciiWhitelist, function(symbol) { + string2 = string2.replace(regexAsciiWhitelist, function(symbol) { if (useNamedReferences && has(encodeMap, symbol)) { return "&" + encodeMap[symbol] + ";"; } return escapeBmpSymbol(symbol); }); if (useNamedReferences) { - string = string.replace(/>\u20D2/g, ">⃒").replace(/<\u20D2/g, "<⃒").replace(/fj/g, "fj"); + string2 = string2.replace(/>\u20D2/g, ">⃒").replace(/<\u20D2/g, "<⃒").replace(/fj/g, "fj"); } if (useNamedReferences) { - string = string.replace(regexEncodeNonAscii, function(string2) { - return "&" + encodeMap[string2] + ";"; + string2 = string2.replace(regexEncodeNonAscii, function(string3) { + return "&" + encodeMap[string3] + ";"; }); } } else if (useNamedReferences) { if (!allowUnsafeSymbols) { - string = string.replace(regexEscape, function(string2) { - return "&" + encodeMap[string2] + ";"; + string2 = string2.replace(regexEscape, function(string3) { + return "&" + encodeMap[string3] + ";"; }); } - string = string.replace(/>\u20D2/g, ">⃒").replace(/<\u20D2/g, "<⃒"); - string = string.replace(regexEncodeNonAscii, function(string2) { - return "&" + encodeMap[string2] + ";"; + string2 = string2.replace(/>\u20D2/g, ">⃒").replace(/<\u20D2/g, "<⃒"); + string2 = string2.replace(regexEncodeNonAscii, function(string3) { + return "&" + encodeMap[string3] + ";"; }); } else if (!allowUnsafeSymbols) { - string = string.replace(regexEscape, escapeBmpSymbol); + string2 = string2.replace(regexEscape, escapeBmpSymbol); } - return string.replace(regexAstralSymbols, function($0) { + return string2.replace(regexAstralSymbols, function($0) { var high = $0.charCodeAt(0); var low = $0.charCodeAt(1); var codePoint = (high - 55296) * 1024 + low - 56320 + 65536; @@ -7104,7 +7245,7 @@ var require_he = __commonJS({ } return html.replace(regexDecode, function($0, $1, $22, $3, $4, $5, $6, $7, $8) { var codePoint; - var semicolon; + var semicolon2; var decDigits; var hexDigits; var reference; @@ -7132,8 +7273,8 @@ var require_he = __commonJS({ } if ($4) { decDigits = $4; - semicolon = $5; - if (strict && !semicolon) { + semicolon2 = $5; + if (strict && !semicolon2) { parseError("character reference was not terminated by a semicolon"); } codePoint = parseInt(decDigits, 10); @@ -7141,8 +7282,8 @@ var require_he = __commonJS({ } if ($6) { hexDigits = $6; - semicolon = $7; - if (strict && !semicolon) { + semicolon2 = $7; + if (strict && !semicolon2) { parseError("character reference was not terminated by a semicolon"); } codePoint = parseInt(hexDigits, 16); @@ -7160,8 +7301,8 @@ var require_he = __commonJS({ "isAttributeValue": false, "strict": false }; - var escape = function(string) { - return string.replace(regexEscape, function($0) { + var escape = function(string2) { + return string2.replace(regexEscape, function($0) { return escapeMap[$0]; }); }; @@ -7191,6 +7332,57 @@ var require_he = __commonJS({ } }); +// node_modules/classnames/index.js +var require_classnames = __commonJS({ + "node_modules/classnames/index.js"(exports2, module2) { + (function() { + "use strict"; + var hasOwn2 = {}.hasOwnProperty; + var nativeCodeString = "[native code]"; + function classNames9() { + var classes = []; + for (var i5 = 0; i5 < arguments.length; i5++) { + var arg = arguments[i5]; + if (!arg) + continue; + var argType = typeof arg; + if (argType === "string" || argType === "number") { + classes.push(arg); + } else if (Array.isArray(arg)) { + if (arg.length) { + var inner = classNames9.apply(null, arg); + if (inner) { + classes.push(inner); + } + } + } else if (argType === "object") { + if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) { + classes.push(arg.toString()); + continue; + } + for (var key2 in arg) { + if (hasOwn2.call(arg, key2) && arg[key2]) { + classes.push(key2); + } + } + } + } + return classes.join(" "); + } + if (typeof module2 !== "undefined" && module2.exports) { + classNames9.default = classNames9; + module2.exports = classNames9; + } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) { + define("classnames", [], function() { + return classNames9; + }); + } else { + window.classNames = classNames9; + } + })(); + } +}); + // node_modules/tslib/tslib.js var require_tslib = __commonJS({ "node_modules/tslib/tslib.js"(exports2, module2) { @@ -7242,56 +7434,56 @@ var require_tslib = __commonJS({ exports3.__esModule = true; } } - return function(id2, v3) { - return exports3[id2] = previous ? previous(id2, v3) : v3; + return function(id3, v4) { + return exports3[id3] = previous ? previous(id3, v4) : v4; }; } })(function(exporter) { - var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d5, b4) { - d5.__proto__ = b4; - } || function(d5, b4) { + var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d6, b4) { + d6.__proto__ = b4; + } || function(d6, b4) { for (var p3 in b4) if (Object.prototype.hasOwnProperty.call(b4, p3)) - d5[p3] = b4[p3]; + d6[p3] = b4[p3]; }; - __extends4 = function(d5, b4) { + __extends4 = function(d6, b4) { if (typeof b4 !== "function" && b4 !== null) throw new TypeError("Class extends value " + String(b4) + " is not a constructor or null"); - extendStatics(d5, b4); + extendStatics(d6, b4); function __() { - this.constructor = d5; + this.constructor = d6; } - d5.prototype = b4 === null ? Object.create(b4) : (__.prototype = b4.prototype, new __()); + d6.prototype = b4 === null ? Object.create(b4) : (__.prototype = b4.prototype, new __()); }; - __assign5 = Object.assign || function(t4) { - for (var s5, i4 = 1, n2 = arguments.length; i4 < n2; i4++) { - s5 = arguments[i4]; - for (var p3 in s5) - if (Object.prototype.hasOwnProperty.call(s5, p3)) - t4[p3] = s5[p3]; - } - return t4; + __assign5 = Object.assign || function(t5) { + for (var s6, i5 = 1, n2 = arguments.length; i5 < n2; i5++) { + s6 = arguments[i5]; + for (var p3 in s6) + if (Object.prototype.hasOwnProperty.call(s6, p3)) + t5[p3] = s6[p3]; + } + return t5; }; - __rest3 = function(s5, e4) { - var t4 = {}; - for (var p3 in s5) - if (Object.prototype.hasOwnProperty.call(s5, p3) && e4.indexOf(p3) < 0) - t4[p3] = s5[p3]; - if (s5 != null && typeof Object.getOwnPropertySymbols === "function") - for (var i4 = 0, p3 = Object.getOwnPropertySymbols(s5); i4 < p3.length; i4++) { - if (e4.indexOf(p3[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s5, p3[i4])) - t4[p3[i4]] = s5[p3[i4]]; - } - return t4; + __rest3 = function(s6, e4) { + var t5 = {}; + for (var p3 in s6) + if (Object.prototype.hasOwnProperty.call(s6, p3) && e4.indexOf(p3) < 0) + t5[p3] = s6[p3]; + if (s6 != null && typeof Object.getOwnPropertySymbols === "function") + for (var i5 = 0, p3 = Object.getOwnPropertySymbols(s6); i5 < p3.length; i5++) { + if (e4.indexOf(p3[i5]) < 0 && Object.prototype.propertyIsEnumerable.call(s6, p3[i5])) + t5[p3[i5]] = s6[p3[i5]]; + } + return t5; }; __decorate2 = function(decorators, target, key2, desc) { - var c4 = arguments.length, r3 = c4 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d5; + var c4 = arguments.length, r3 = c4 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d6; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key2, desc); else - for (var i4 = decorators.length - 1; i4 >= 0; i4--) - if (d5 = decorators[i4]) - r3 = (c4 < 3 ? d5(r3) : c4 > 3 ? d5(target, key2, r3) : d5(target, key2)) || r3; + for (var i5 = decorators.length - 1; i5 >= 0; i5--) + if (d6 = decorators[i5]) + r3 = (c4 < 3 ? d6(r3) : c4 > 3 ? d6(target, key2, r3) : d6(target, key2)) || r3; return c4 > 3 && r3 && Object.defineProperty(target, key2, r3), r3; }; __param2 = function(paramIndex, decorator) { @@ -7309,7 +7501,7 @@ var require_tslib = __commonJS({ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _12, done = false; - for (var i4 = decorators.length - 1; i4 >= 0; i4--) { + for (var i5 = decorators.length - 1; i5 >= 0; i5--) { var context = {}; for (var p3 in contextIn) context[p3] = p3 === "access" ? {} : contextIn[p3]; @@ -7320,7 +7512,7 @@ var require_tslib = __commonJS({ throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f4 || null)); }; - var result = (0, decorators[i4])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key2], context); + var result = (0, decorators[i5])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key2], context); if (kind === "accessor") { if (result === void 0) continue; @@ -7345,18 +7537,18 @@ var require_tslib = __commonJS({ }; __runInitializers2 = function(thisArg, initializers, value) { var useValue = arguments.length > 2; - for (var i4 = 0; i4 < initializers.length; i4++) { - value = useValue ? initializers[i4].call(thisArg, value) : initializers[i4].call(thisArg); + for (var i5 = 0; i5 < initializers.length; i5++) { + value = useValue ? initializers[i5].call(thisArg, value) : initializers[i5].call(thisArg); } return useValue ? value : void 0; }; __propKey2 = function(x5) { return typeof x5 === "symbol" ? x5 : "".concat(x5); }; - __setFunctionName2 = function(f4, name, prefix) { - if (typeof name === "symbol") - name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f4, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + __setFunctionName2 = function(f4, name2, prefix) { + if (typeof name2 === "symbol") + name2 = name2.description ? "[".concat(name2.description, "]") : ""; + return Object.defineProperty(f4, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name2) : name2 }); }; __metadata2 = function(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") @@ -7391,16 +7583,16 @@ var require_tslib = __commonJS({ }; __generator2 = function(thisArg, body) { var _12 = { label: 0, sent: function() { - if (t4[0] & 1) - throw t4[1]; - return t4[1]; - }, trys: [], ops: [] }, f4, y5, t4, g4; + if (t5[0] & 1) + throw t5[1]; + return t5[1]; + }, trys: [], ops: [] }, f4, y5, t5, g4; return g4 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g4[Symbol.iterator] = function() { return this; }), g4; function verb(n2) { - return function(v3) { - return step([n2, v3]); + return function(v4) { + return step([n2, v4]); }; } function step(op) { @@ -7408,14 +7600,14 @@ var require_tslib = __commonJS({ throw new TypeError("Generator is already executing."); while (g4 && (g4 = 0, op[0] && (_12 = 0)), _12) try { - if (f4 = 1, y5 && (t4 = op[0] & 2 ? y5["return"] : op[0] ? y5["throw"] || ((t4 = y5["return"]) && t4.call(y5), 0) : y5.next) && !(t4 = t4.call(y5, op[1])).done) - return t4; - if (y5 = 0, t4) - op = [op[0] & 2, t4.value]; + if (f4 = 1, y5 && (t5 = op[0] & 2 ? y5["return"] : op[0] ? y5["throw"] || ((t5 = y5["return"]) && t5.call(y5), 0) : y5.next) && !(t5 = t5.call(y5, op[1])).done) + return t5; + if (y5 = 0, t5) + op = [op[0] & 2, t5.value]; switch (op[0]) { case 0: case 1: - t4 = op; + t5 = op; break; case 4: _12.label++; @@ -7430,25 +7622,25 @@ var require_tslib = __commonJS({ _12.trys.pop(); continue; default: - if (!(t4 = _12.trys, t4 = t4.length > 0 && t4[t4.length - 1]) && (op[0] === 6 || op[0] === 2)) { + if (!(t5 = _12.trys, t5 = t5.length > 0 && t5[t5.length - 1]) && (op[0] === 6 || op[0] === 2)) { _12 = 0; continue; } - if (op[0] === 3 && (!t4 || op[1] > t4[0] && op[1] < t4[3])) { + if (op[0] === 3 && (!t5 || op[1] > t5[0] && op[1] < t5[3])) { _12.label = op[1]; break; } - if (op[0] === 6 && _12.label < t4[1]) { - _12.label = t4[1]; - t4 = op; + if (op[0] === 6 && _12.label < t5[1]) { + _12.label = t5[1]; + t5 = op; break; } - if (t4 && _12.label < t4[2]) { - _12.label = t4[2]; + if (t5 && _12.label < t5[2]) { + _12.label = t5[2]; _12.ops.push(op); break; } - if (t4[2]) + if (t5[2]) _12.ops.pop(); _12.trys.pop(); continue; @@ -7458,61 +7650,61 @@ var require_tslib = __commonJS({ op = [6, e4]; y5 = 0; } finally { - f4 = t4 = 0; + f4 = t5 = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; - __exportStar2 = function(m5, o3) { - for (var p3 in m5) + __exportStar2 = function(m6, o3) { + for (var p3 in m6) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(o3, p3)) - __createBinding2(o3, m5, p3); + __createBinding2(o3, m6, p3); }; - __createBinding2 = Object.create ? function(o3, m5, k5, k22) { + __createBinding2 = Object.create ? function(o3, m6, k5, k22) { if (k22 === void 0) k22 = k5; - var desc = Object.getOwnPropertyDescriptor(m5, k5); - if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) { + var desc = Object.getOwnPropertyDescriptor(m6, k5); + if (!desc || ("get" in desc ? !m6.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m5[k5]; + return m6[k5]; } }; } Object.defineProperty(o3, k22, desc); - } : function(o3, m5, k5, k22) { + } : function(o3, m6, k5, k22) { if (k22 === void 0) k22 = k5; - o3[k22] = m5[k5]; + o3[k22] = m6[k5]; }; __values2 = function(o3) { - var s5 = typeof Symbol === "function" && Symbol.iterator, m5 = s5 && o3[s5], i4 = 0; - if (m5) - return m5.call(o3); + var s6 = typeof Symbol === "function" && Symbol.iterator, m6 = s6 && o3[s6], i5 = 0; + if (m6) + return m6.call(o3); if (o3 && typeof o3.length === "number") return { next: function() { - if (o3 && i4 >= o3.length) + if (o3 && i5 >= o3.length) o3 = void 0; - return { value: o3 && o3[i4++], done: !o3 }; + return { value: o3 && o3[i5++], done: !o3 }; } }; - throw new TypeError(s5 ? "Object is not iterable." : "Symbol.iterator is not defined."); + throw new TypeError(s6 ? "Object is not iterable." : "Symbol.iterator is not defined."); }; __read2 = function(o3, n2) { - var m5 = typeof Symbol === "function" && o3[Symbol.iterator]; - if (!m5) + var m6 = typeof Symbol === "function" && o3[Symbol.iterator]; + if (!m6) return o3; - var i4 = m5.call(o3), r3, ar = [], e4; + var i5 = m6.call(o3), r3, ar = [], e4; try { - while ((n2 === void 0 || n2-- > 0) && !(r3 = i4.next()).done) + while ((n2 === void 0 || n2-- > 0) && !(r3 = i5.next()).done) ar.push(r3.value); } catch (error) { e4 = { error }; } finally { try { - if (r3 && !r3.done && (m5 = i4["return"])) - m5.call(i4); + if (r3 && !r3.done && (m6 = i5["return"])) + m6.call(i5); } finally { if (e4) throw e4.error; @@ -7521,50 +7713,50 @@ var require_tslib = __commonJS({ return ar; }; __spread2 = function() { - for (var ar = [], i4 = 0; i4 < arguments.length; i4++) - ar = ar.concat(__read2(arguments[i4])); + for (var ar = [], i5 = 0; i5 < arguments.length; i5++) + ar = ar.concat(__read2(arguments[i5])); return ar; }; __spreadArrays2 = function() { - for (var s5 = 0, i4 = 0, il = arguments.length; i4 < il; i4++) - s5 += arguments[i4].length; - for (var r3 = Array(s5), k5 = 0, i4 = 0; i4 < il; i4++) - for (var a5 = arguments[i4], j4 = 0, jl = a5.length; j4 < jl; j4++, k5++) - r3[k5] = a5[j4]; + for (var s6 = 0, i5 = 0, il = arguments.length; i5 < il; i5++) + s6 += arguments[i5].length; + for (var r3 = Array(s6), k5 = 0, i5 = 0; i5 < il; i5++) + for (var a6 = arguments[i5], j4 = 0, jl = a6.length; j4 < jl; j4++, k5++) + r3[k5] = a6[j4]; return r3; }; __spreadArray3 = function(to, from, pack) { if (pack || arguments.length === 2) - for (var i4 = 0, l3 = from.length, ar; i4 < l3; i4++) { - if (ar || !(i4 in from)) { + for (var i5 = 0, l3 = from.length, ar; i5 < l3; i5++) { + if (ar || !(i5 in from)) { if (!ar) - ar = Array.prototype.slice.call(from, 0, i4); - ar[i4] = from[i4]; + ar = Array.prototype.slice.call(from, 0, i5); + ar[i5] = from[i5]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; - __await2 = function(v3) { - return this instanceof __await2 ? (this.v = v3, this) : new __await2(v3); + __await2 = function(v4) { + return this instanceof __await2 ? (this.v = v4, this) : new __await2(v4); }; __asyncGenerator2 = function(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g4 = generator.apply(thisArg, _arguments || []), i4, q5 = []; - return i4 = {}, verb("next"), verb("throw"), verb("return"), i4[Symbol.asyncIterator] = function() { + var g4 = generator.apply(thisArg, _arguments || []), i5, q5 = []; + return i5 = {}, verb("next"), verb("throw"), verb("return"), i5[Symbol.asyncIterator] = function() { return this; - }, i4; + }, i5; function verb(n2) { if (g4[n2]) - i4[n2] = function(v3) { - return new Promise(function(a5, b4) { - q5.push([n2, v3, a5, b4]) > 1 || resume(n2, v3); + i5[n2] = function(v4) { + return new Promise(function(a6, b4) { + q5.push([n2, v4, a6, b4]) > 1 || resume(n2, v4); }); }; } - function resume(n2, v3) { + function resume(n2, v4) { try { - step(g4[n2](v3)); + step(g4[n2](v4)); } catch (e4) { settle(q5[0][3], e4); } @@ -7578,41 +7770,41 @@ var require_tslib = __commonJS({ function reject(value) { resume("throw", value); } - function settle(f4, v3) { - if (f4(v3), q5.shift(), q5.length) + function settle(f4, v4) { + if (f4(v4), q5.shift(), q5.length) resume(q5[0][0], q5[0][1]); } }; __asyncDelegator2 = function(o3) { - var i4, p3; - return i4 = {}, verb("next"), verb("throw", function(e4) { + var i5, p3; + return i5 = {}, verb("next"), verb("throw", function(e4) { throw e4; - }), verb("return"), i4[Symbol.iterator] = function() { + }), verb("return"), i5[Symbol.iterator] = function() { return this; - }, i4; + }, i5; function verb(n2, f4) { - i4[n2] = o3[n2] ? function(v3) { - return (p3 = !p3) ? { value: __await2(o3[n2](v3)), done: false } : f4 ? f4(v3) : v3; + i5[n2] = o3[n2] ? function(v4) { + return (p3 = !p3) ? { value: __await2(o3[n2](v4)), done: false } : f4 ? f4(v4) : v4; } : f4; } }; __asyncValues2 = function(o3) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m5 = o3[Symbol.asyncIterator], i4; - return m5 ? m5.call(o3) : (o3 = typeof __values2 === "function" ? __values2(o3) : o3[Symbol.iterator](), i4 = {}, verb("next"), verb("throw"), verb("return"), i4[Symbol.asyncIterator] = function() { + var m6 = o3[Symbol.asyncIterator], i5; + return m6 ? m6.call(o3) : (o3 = typeof __values2 === "function" ? __values2(o3) : o3[Symbol.iterator](), i5 = {}, verb("next"), verb("throw"), verb("return"), i5[Symbol.asyncIterator] = function() { return this; - }, i4); + }, i5); function verb(n2) { - i4[n2] = o3[n2] && function(v3) { + i5[n2] = o3[n2] && function(v4) { return new Promise(function(resolve, reject) { - v3 = o3[n2](v3), settle(resolve, reject, v3.done, v3.value); + v4 = o3[n2](v4), settle(resolve, reject, v4.done, v4.value); }); }; } - function settle(resolve, reject, d5, v3) { - Promise.resolve(v3).then(function(v4) { - resolve({ value: v4, done: d5 }); + function settle(resolve, reject, d6, v4) { + Promise.resolve(v4).then(function(v5) { + resolve({ value: v5, done: d6 }); }, reject); } }; @@ -7624,10 +7816,10 @@ var require_tslib = __commonJS({ } return cooked; }; - var __setModuleDefault = Object.create ? function(o3, v3) { - Object.defineProperty(o3, "default", { enumerable: true, value: v3 }); - } : function(o3, v3) { - o3["default"] = v3; + var __setModuleDefault = Object.create ? function(o3, v4) { + Object.defineProperty(o3, "default", { enumerable: true, value: v4 }); + } : function(o3, v4) { + o3["default"] = v4; }; __importStar2 = function(mod) { if (mod && mod.__esModule) @@ -7698,57 +7890,6 @@ var require_tslib = __commonJS({ } }); -// node_modules/classnames/index.js -var require_classnames = __commonJS({ - "node_modules/classnames/index.js"(exports2, module2) { - (function() { - "use strict"; - var hasOwn2 = {}.hasOwnProperty; - var nativeCodeString = "[native code]"; - function classNames9() { - var classes = []; - for (var i4 = 0; i4 < arguments.length; i4++) { - var arg = arguments[i4]; - if (!arg) - continue; - var argType = typeof arg; - if (argType === "string" || argType === "number") { - classes.push(arg); - } else if (Array.isArray(arg)) { - if (arg.length) { - var inner = classNames9.apply(null, arg); - if (inner) { - classes.push(inner); - } - } - } else if (argType === "object") { - if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) { - classes.push(arg.toString()); - continue; - } - for (var key2 in arg) { - if (hasOwn2.call(arg, key2) && arg[key2]) { - classes.push(key2); - } - } - } - } - return classes.join(" "); - } - if (typeof module2 !== "undefined" && module2.exports) { - classNames9.default = classNames9; - module2.exports = classNames9; - } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) { - define("classnames", [], function() { - return classNames9; - }); - } else { - window.classNames = classNames9; - } - })(); - } -}); - // node_modules/lodash/_freeGlobal.js var require_freeGlobal = __commonJS({ "node_modules/lodash/_freeGlobal.js"(exports2, module2) { @@ -8841,16 +8982,16 @@ var require_Stack = __commonJS({ var stackGet2 = require_stackGet(); var stackHas2 = require_stackHas(); var stackSet2 = require_stackSet(); - function Stack2(entries) { + function Stack3(entries) { var data2 = this.__data__ = new ListCache2(entries); this.size = data2.size; } - Stack2.prototype.clear = stackClear2; - Stack2.prototype["delete"] = stackDelete2; - Stack2.prototype.get = stackGet2; - Stack2.prototype.has = stackHas2; - Stack2.prototype.set = stackSet2; - module2.exports = Stack2; + Stack3.prototype.clear = stackClear2; + Stack3.prototype["delete"] = stackDelete2; + Stack3.prototype.get = stackGet2; + Stack3.prototype.has = stackHas2; + Stack3.prototype.set = stackSet2; + module2.exports = Stack3; } }); @@ -8914,8 +9055,8 @@ var require_arraySome = __commonJS({ // node_modules/lodash/_cacheHas.js var require_cacheHas = __commonJS({ "node_modules/lodash/_cacheHas.js"(exports2, module2) { - function cacheHas2(cache, key2) { - return cache.has(key2); + function cacheHas2(cache2, key2) { + return cache2.has(key2); } module2.exports = cacheHas2; } @@ -9318,7 +9459,7 @@ var require_getTag = __commonJS({ // node_modules/lodash/_baseIsEqualDeep.js var require_baseIsEqualDeep = __commonJS({ "node_modules/lodash/_baseIsEqualDeep.js"(exports2, module2) { - var Stack2 = require_Stack(); + var Stack3 = require_Stack(); var equalArrays2 = require_equalArrays(); var equalByTag2 = require_equalByTag(); var equalObjects2 = require_equalObjects(); @@ -9345,21 +9486,21 @@ var require_baseIsEqualDeep = __commonJS({ objIsObj = false; } if (isSameTag && !objIsObj) { - stack || (stack = new Stack2()); + stack || (stack = new Stack3()); return objIsArr || isTypedArray2(object) ? equalArrays2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG7)) { var objIsWrapped = objIsObj && hasOwnProperty14.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty14.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; - stack || (stack = new Stack2()); + stack || (stack = new Stack3()); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } - stack || (stack = new Stack2()); + stack || (stack = new Stack3()); return equalObjects2(object, other, bitmask, customizer, equalFunc, stack); } module2.exports = baseIsEqualDeep2; @@ -9387,7 +9528,7 @@ var require_baseIsEqual = __commonJS({ // node_modules/lodash/_baseIsMatch.js var require_baseIsMatch = __commonJS({ "node_modules/lodash/_baseIsMatch.js"(exports2, module2) { - var Stack2 = require_Stack(); + var Stack3 = require_Stack(); var baseIsEqual2 = require_baseIsEqual(); var COMPARE_PARTIAL_FLAG7 = 1; var COMPARE_UNORDERED_FLAG5 = 2; @@ -9411,7 +9552,7 @@ var require_baseIsMatch = __commonJS({ return false; } } else { - var stack = new Stack2(); + var stack = new Stack3(); if (customizer) { var result = customizer(objValue, srcValue, key2, object, source, stack); } @@ -9532,12 +9673,12 @@ var require_memoize = __commonJS({ throw new TypeError(FUNC_ERROR_TEXT4); } var memoized = function() { - var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; - if (cache.has(key2)) { - return cache.get(key2); + var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache; + if (cache2.has(key2)) { + return cache2.get(key2); } var result = func.apply(this, args); - memoized.cache = cache.set(key2, result) || cache; + memoized.cache = cache2.set(key2, result) || cache2; return result; }; memoized.cache = new (memoize2.Cache || MapCache2)(); @@ -9555,12 +9696,12 @@ var require_memoizeCapped = __commonJS({ var MAX_MEMOIZE_SIZE2 = 500; function memoizeCapped2(func) { var result = memoize2(func, function(key2) { - if (cache.size === MAX_MEMOIZE_SIZE2) { - cache.clear(); + if (cache2.size === MAX_MEMOIZE_SIZE2) { + cache2.clear(); } return key2; }); - var cache = result.cache; + var cache2 = result.cache; return result; } module2.exports = memoizeCapped2; @@ -9573,13 +9714,13 @@ var require_stringToPath = __commonJS({ var memoizeCapped2 = require_memoizeCapped(); var rePropName2 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; var reEscapeChar2 = /\\(\\)?/g; - var stringToPath2 = memoizeCapped2(function(string) { + var stringToPath2 = memoizeCapped2(function(string2) { var result = []; - if (string.charCodeAt(0) === 46) { + if (string2.charCodeAt(0) === 46) { result.push(""); } - string.replace(rePropName2, function(match2, number, quote, subString) { - result.push(quote ? subString.replace(reEscapeChar2, "$1") : number || match2); + string2.replace(rePropName2, function(match2, number2, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar2, "$1") : number2 || match2); }); return result; }); @@ -9916,8 +10057,8 @@ var require_flattenNames = __commonJS({ var names2 = []; (0, _map3.default)(things, function(thing) { if (Array.isArray(thing)) { - flattenNames2(thing).map(function(name) { - return names2.push(name); + flattenNames2(thing).map(function(name2) { + return names2.push(name2); }); } else if ((0, _isPlainObject3.default)(thing)) { (0, _forOwn3.default)(thing, function(value, key2) { @@ -10435,7 +10576,7 @@ var require_isSet = __commonJS({ // node_modules/lodash/_baseClone.js var require_baseClone = __commonJS({ "node_modules/lodash/_baseClone.js"(exports2, module2) { - var Stack2 = require_Stack(); + var Stack3 = require_Stack(); var arrayEach2 = require_arrayEach(); var assignValue2 = require_assignValue(); var baseAssign = require_baseAssign(); @@ -10523,7 +10664,7 @@ var require_baseClone = __commonJS({ result = initCloneByTag(value, tag, isDeep); } } - stack || (stack = new Stack2()); + stack || (stack = new Stack3()); var stacked = stack.get(value); if (stacked) { return stacked; @@ -10579,8 +10720,8 @@ var require_mergeClasses = __commonJS({ var _cloneDeep2 = require_cloneDeep(); var _cloneDeep3 = _interopRequireDefault(_cloneDeep2); var _extends11 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -10595,8 +10736,8 @@ var require_mergeClasses = __commonJS({ var mergeClasses = exports2.mergeClasses = function mergeClasses2(classes) { var activeNames = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; var styles2 = classes.default && (0, _cloneDeep3.default)(classes.default) || {}; - activeNames.map(function(name) { - var toMerge = classes[name]; + activeNames.map(function(name2) { + var toMerge = classes[name2]; if (toMerge) { (0, _forOwn3.default)(toMerge, function(value, key2) { if (!styles2[key2]) { @@ -10605,7 +10746,7 @@ var require_mergeClasses = __commonJS({ styles2[key2] = _extends11({}, styles2[key2], toMerge[key2]); }); } - return name; + return name2; }); return styles2; }; @@ -10624,8 +10765,8 @@ var require_autoprefix = __commonJS({ var _forOwn2 = require_forOwn(); var _forOwn3 = _interopRequireDefault(_forOwn2); var _extends11 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -10715,13 +10856,13 @@ var require_autoprefix = __commonJS({ left: direction && direction[3] }; }, - extend: function extend2(name, otherElementStyles) { - var otherStyle = otherElementStyles[name]; + extend: function extend2(name2, otherElementStyles) { + var otherStyle = otherElementStyles[name2]; if (otherStyle) { return otherStyle; } return { - "extend": name + "extend": name2 }; } }; @@ -10754,8 +10895,8 @@ var require_hover = __commonJS({ }); exports2.hover = void 0; var _extends11 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -10827,8 +10968,8 @@ var require_active = __commonJS({ }); exports2.active = void 0; var _extends11 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -10898,17 +11039,17 @@ var require_loop = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); - var loopable = function loopable2(i4, length) { + var loopable = function loopable2(i5, length) { var props2 = {}; - var setProp = function setProp2(name) { + var setProp = function setProp2(name2) { var value = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; - props2[name] = value; + props2[name2] = value; }; - i4 === 0 && setProp("first-child"); - i4 === length - 1 && setProp("last-child"); - (i4 === 0 || i4 % 2 === 0) && setProp("even"); - Math.abs(i4 % 2) === 1 && setProp("odd"); - setProp("nth-child", i4); + i5 === 0 && setProp("first-child"); + i5 === length - 1 && setProp("last-child"); + (i5 === 0 || i5 % 2 === 0) && setProp("even"); + Math.abs(i5 % 2) === 1 && setProp("odd"); + setProp("nth-child", i5); return props2; }; exports2.default = loopable; @@ -11144,8 +11285,8 @@ var require_object_assign = __commonJS({ return false; } var test2 = {}; - for (var i4 = 0; i4 < 10; i4++) { - test2["_" + String.fromCharCode(i4)] = i4; + for (var i5 = 0; i5 < 10; i5++) { + test2["_" + String.fromCharCode(i5)] = i5; } var order2 = Object.getOwnPropertyNames(test2).map(function(n2) { return test2[n2]; @@ -11169,8 +11310,8 @@ var require_object_assign = __commonJS({ var from; var to = toObject(target); var symbols; - for (var s5 = 1; s5 < arguments.length; s5++) { - from = Object(arguments[s5]); + for (var s6 = 1; s6 < arguments.length; s6++) { + from = Object(arguments[s6]); for (var key2 in from) { if (hasOwnProperty14.call(from, key2)) { to[key2] = from[key2]; @@ -11178,9 +11319,9 @@ var require_object_assign = __commonJS({ } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); - for (var i4 = 0; i4 < symbols.length; i4++) { - if (propIsEnumerable.call(from, symbols[i4])) { - to[symbols[i4]] = from[symbols[i4]]; + for (var i5 = 0; i5 < symbols.length; i5++) { + if (propIsEnumerable.call(from, symbols[i5])) { + to[symbols[i5]] = from[symbols[i5]]; } } } @@ -11412,8 +11553,8 @@ var require_factoryWithTypeCheckers = __commonJS({ var propType = getPropType(propValue); return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")); } - for (var i4 = 0; i4 < propValue.length; i4++) { - var error = typeChecker(propValue, i4, componentName, location, propFullName + "[" + i4 + "]", ReactPropTypesSecret); + for (var i5 = 0; i5 < propValue.length; i5++) { + var error = typeChecker(propValue, i5, componentName, location, propFullName + "[" + i5 + "]", ReactPropTypesSecret); if (error instanceof Error) { return error; } @@ -11470,8 +11611,8 @@ var require_factoryWithTypeCheckers = __commonJS({ } function validate(props2, propName, componentName, location, propFullName) { var propValue = props2[propName]; - for (var i4 = 0; i4 < expectedValues.length; i4++) { - if (is(propValue, expectedValues[i4])) { + for (var i5 = 0; i5 < expectedValues.length; i5++) { + if (is(propValue, expectedValues[i5])) { return null; } } @@ -11513,19 +11654,19 @@ var require_factoryWithTypeCheckers = __commonJS({ true ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0; return emptyFunctionThatReturnsNull; } - for (var i4 = 0; i4 < arrayOfTypeCheckers.length; i4++) { - var checker = arrayOfTypeCheckers[i4]; + for (var i5 = 0; i5 < arrayOfTypeCheckers.length; i5++) { + var checker = arrayOfTypeCheckers[i5]; if (typeof checker !== "function") { printWarning( - "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i4 + "." + "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i5 + "." ); return emptyFunctionThatReturnsNull; } } function validate(props2, propName, componentName, location, propFullName) { var expectedTypes = []; - for (var i5 = 0; i5 < arrayOfTypeCheckers.length; i5++) { - var checker2 = arrayOfTypeCheckers[i5]; + for (var i6 = 0; i6 < arrayOfTypeCheckers.length; i6++) { + var checker2 = arrayOfTypeCheckers[i6]; var checkerResult = checker2(props2, propName, componentName, location, propFullName, ReactPropTypesSecret); if (checkerResult == null) { return null; @@ -11737,8 +11878,8 @@ var require_UnfoldMoreHorizontalIcon = __commonJS({ value: true }); var _extends11 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -11754,12 +11895,12 @@ var require_UnfoldMoreHorizontalIcon = __commonJS({ } function _objectWithoutProperties2(obj, keys2) { var target = {}; - for (var i4 in obj) { - if (keys2.indexOf(i4) >= 0) + for (var i5 in obj) { + if (keys2.indexOf(i5) >= 0) continue; - if (!Object.prototype.hasOwnProperty.call(obj, i4)) + if (!Object.prototype.hasOwnProperty.call(obj, i5)) continue; - target[i4] = obj[i4]; + target[i5] = obj[i5]; } return target; } @@ -11786,8 +11927,8 @@ var require_CheckIcon = __commonJS({ value: true }); var _extends11 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -11803,12 +11944,12 @@ var require_CheckIcon = __commonJS({ } function _objectWithoutProperties2(obj, keys2) { var target = {}; - for (var i4 in obj) { - if (keys2.indexOf(i4) >= 0) + for (var i5 in obj) { + if (keys2.indexOf(i5) >= 0) continue; - if (!Object.prototype.hasOwnProperty.call(obj, i4)) + if (!Object.prototype.hasOwnProperty.call(obj, i5)) continue; - target[i4] = obj[i4]; + target[i5] = obj[i5]; } return target; } @@ -11895,30 +12036,30 @@ var require_localforage = __commonJS({ } })(function() { var define2, module3, exports3; - return function e4(t4, n2, r3) { - function s5(o4, u4) { + return function e4(t5, n2, r3) { + function s6(o4, u4) { if (!n2[o4]) { - if (!t4[o4]) { - var a5 = typeof require == "function" && require; - if (!u4 && a5) - return a5(o4, true); - if (i4) - return i4(o4, true); + if (!t5[o4]) { + var a6 = typeof require == "function" && require; + if (!u4 && a6) + return a6(o4, true); + if (i5) + return i5(o4, true); var f4 = new Error("Cannot find module '" + o4 + "'"); throw f4.code = "MODULE_NOT_FOUND", f4; } var l3 = n2[o4] = { exports: {} }; - t4[o4][0].call(l3.exports, function(e5) { - var n3 = t4[o4][1][e5]; - return s5(n3 ? n3 : e5); - }, l3, l3.exports, e4, t4, n2, r3); + t5[o4][0].call(l3.exports, function(e5) { + var n3 = t5[o4][1][e5]; + return s6(n3 ? n3 : e5); + }, l3, l3.exports, e4, t5, n2, r3); } return n2[o4].exports; } - var i4 = typeof require == "function" && require; + var i5 = typeof require == "function" && require; for (var o3 = 0; o3 < r3.length; o3++) - s5(r3[o3]); - return s5; + s6(r3[o3]); + return s6; }({ 1: [function(_dereq_, module4, exports4) { (function(global2) { "use strict"; @@ -11962,14 +12103,14 @@ var require_localforage = __commonJS({ var queue = []; function nextTick() { draining = true; - var i4, oldQueue; + var i5, oldQueue; var len = queue.length; while (len) { oldQueue = queue; queue = []; - i4 = -1; - while (++i4 < len) { - oldQueue[i4](); + i5 = -1; + while (++i5 < len) { + oldQueue[i5](); } len = queue.length; } @@ -12068,10 +12209,10 @@ var require_localforage = __commonJS({ } else { self2.state = FULFILLED; self2.outcome = value; - var i4 = -1; + var i5 = -1; var len = self2.queue.length; - while (++i4 < len) { - self2.queue[i4].callFulfilled(value); + while (++i5 < len) { + self2.queue[i5].callFulfilled(value); } } return self2; @@ -12079,10 +12220,10 @@ var require_localforage = __commonJS({ handlers.reject = function(self2, error) { self2.state = REJECTED; self2.outcome = error; - var i4 = -1; + var i5 = -1; var len = self2.queue.length; - while (++i4 < len) { - self2.queue[i4].callRejected(error); + while (++i5 < len) { + self2.queue[i5].callRejected(error); } return self2; }; @@ -12154,13 +12295,13 @@ var require_localforage = __commonJS({ } var values = new Array(len); var resolved = 0; - var i4 = -1; + var i5 = -1; var promise = new this(INTERNAL); - while (++i4 < len) { - allResolver(iterable[i4], i4); + while (++i5 < len) { + allResolver(iterable[i5], i5); } return promise; - function allResolver(value, i5) { + function allResolver(value, i6) { self2.resolve(value).then(resolveFromAll, function(error) { if (!called) { called = true; @@ -12168,7 +12309,7 @@ var require_localforage = __commonJS({ } }); function resolveFromAll(outValue) { - values[i5] = outValue; + values[i6] = outValue; if (++resolved === len && !called) { called = true; handlers.resolve(promise, values); @@ -12187,10 +12328,10 @@ var require_localforage = __commonJS({ if (!len) { return this.resolve([]); } - var i4 = -1; + var i5 = -1; var promise = new this(INTERNAL); - while (++i4 < len) { - resolver(iterable[i4]); + while (++i5 < len) { + resolver(iterable[i5]); } return promise; function resolver(value) { @@ -12271,8 +12412,8 @@ var require_localforage = __commonJS({ } var Builder = typeof BlobBuilder !== "undefined" ? BlobBuilder : typeof MSBlobBuilder !== "undefined" ? MSBlobBuilder : typeof MozBlobBuilder !== "undefined" ? MozBlobBuilder : WebKitBlobBuilder; var builder = new Builder(); - for (var i4 = 0; i4 < parts.length; i4 += 1) { - builder.append(parts[i4]); + for (var i5 = 0; i5 < parts.length; i5 += 1) { + builder.append(parts[i5]); } return builder.getBlob(properties2.type); } @@ -12320,8 +12461,8 @@ var require_localforage = __commonJS({ var length2 = bin.length; var buf = new ArrayBuffer(length2); var arr = new Uint8Array(buf); - for (var i4 = 0; i4 < length2; i4++) { - arr[i4] = bin.charCodeAt(i4); + for (var i5 = 0; i5 < length2; i5++) { + arr[i5] = bin.charCodeAt(i5); } return buf; } @@ -12499,8 +12640,8 @@ var require_localforage = __commonJS({ _deferReadiness(dbInfo); var dbContext = dbContexts[dbInfo.name]; var forages = dbContext.forages; - for (var i4 = 0; i4 < forages.length; i4++) { - var forage = forages[i4]; + for (var i5 = 0; i5 < forages.length; i5++) { + var forage = forages[i5]; if (forage._dbInfo.db) { forage._dbInfo.db.close(); forage._dbInfo.db = null; @@ -12515,8 +12656,8 @@ var require_localforage = __commonJS({ return db; }).then(function(db) { dbInfo.db = dbContext.db = db; - for (var i5 = 0; i5 < forages.length; i5++) { - forages[i5]._dbInfo.db = db; + for (var i6 = 0; i6 < forages.length; i6++) { + forages[i6]._dbInfo.db = db; } })["catch"](function(err) { _rejectReadiness(dbInfo, err); @@ -12562,8 +12703,8 @@ var require_localforage = __commonJS({ db: null }; if (options) { - for (var i4 in options) { - dbInfo[i4] = options[i4]; + for (var i5 in options) { + dbInfo[i5] = options[i5]; } } var dbContext = dbContexts[dbInfo.name]; @@ -12909,8 +13050,8 @@ var require_localforage = __commonJS({ var dbContext = dbContexts[options.name]; var forages = dbContext.forages; dbContext.db = db; - for (var i4 = 0; i4 < forages.length; i4++) { - forages[i4]._dbInfo.db = db; + for (var i5 = 0; i5 < forages.length; i5++) { + forages[i5]._dbInfo.db = db; } return db; }); @@ -12920,8 +13061,8 @@ var require_localforage = __commonJS({ var dbContext = dbContexts[options.name]; var forages = dbContext.forages; db.close(); - for (var i4 = 0; i4 < forages.length; i4++) { - var forage = forages[i4]; + for (var i5 = 0; i5 < forages.length; i5++) { + var forage = forages[i5]; forage._dbInfo.db = null; } var dropDBPromise = new Promise$1(function(resolve, reject) { @@ -12946,8 +13087,8 @@ var require_localforage = __commonJS({ }); return dropDBPromise.then(function(db2) { dbContext.db = db2; - for (var i5 = 0; i5 < forages.length; i5++) { - var _forage = forages[i5]; + for (var i6 = 0; i6 < forages.length; i6++) { + var _forage = forages[i6]; _advanceReadiness(_forage._dbInfo); } })["catch"](function(err) { @@ -12966,8 +13107,8 @@ var require_localforage = __commonJS({ var dbContext = dbContexts[options.name]; var forages = dbContext.forages; db.close(); - for (var i4 = 0; i4 < forages.length; i4++) { - var forage = forages[i4]; + for (var i5 = 0; i5 < forages.length; i5++) { + var forage = forages[i5]; forage._dbInfo.db = null; forage._dbInfo.version = newVersion; } @@ -13044,7 +13185,7 @@ var require_localforage = __commonJS({ function stringToBuffer(serializedString) { var bufferLength = serializedString.length * 0.75; var len = serializedString.length; - var i4; + var i5; var p3 = 0; var encoded1, encoded2, encoded3, encoded4; if (serializedString[serializedString.length - 1] === "=") { @@ -13055,11 +13196,11 @@ var require_localforage = __commonJS({ } var buffer = new ArrayBuffer(bufferLength); var bytes = new Uint8Array(buffer); - for (i4 = 0; i4 < len; i4 += 4) { - encoded1 = BASE_CHARS.indexOf(serializedString[i4]); - encoded2 = BASE_CHARS.indexOf(serializedString[i4 + 1]); - encoded3 = BASE_CHARS.indexOf(serializedString[i4 + 2]); - encoded4 = BASE_CHARS.indexOf(serializedString[i4 + 3]); + for (i5 = 0; i5 < len; i5 += 4) { + encoded1 = BASE_CHARS.indexOf(serializedString[i5]); + encoded2 = BASE_CHARS.indexOf(serializedString[i5 + 1]); + encoded3 = BASE_CHARS.indexOf(serializedString[i5 + 2]); + encoded4 = BASE_CHARS.indexOf(serializedString[i5 + 3]); bytes[p3++] = encoded1 << 2 | encoded2 >> 4; bytes[p3++] = (encoded2 & 15) << 4 | encoded3 >> 2; bytes[p3++] = (encoded3 & 3) << 6 | encoded4 & 63; @@ -13069,12 +13210,12 @@ var require_localforage = __commonJS({ function bufferToString(buffer) { var bytes = new Uint8Array(buffer); var base64String = ""; - var i4; - for (i4 = 0; i4 < bytes.length; i4 += 3) { - base64String += BASE_CHARS[bytes[i4] >> 2]; - base64String += BASE_CHARS[(bytes[i4] & 3) << 4 | bytes[i4 + 1] >> 4]; - base64String += BASE_CHARS[(bytes[i4 + 1] & 15) << 2 | bytes[i4 + 2] >> 6]; - base64String += BASE_CHARS[bytes[i4 + 2] & 63]; + var i5; + for (i5 = 0; i5 < bytes.length; i5 += 3) { + base64String += BASE_CHARS[bytes[i5] >> 2]; + base64String += BASE_CHARS[(bytes[i5] & 3) << 4 | bytes[i5 + 1] >> 4]; + base64String += BASE_CHARS[(bytes[i5 + 1] & 15) << 2 | bytes[i5 + 2] >> 6]; + base64String += BASE_CHARS[bytes[i5 + 2] & 63]; } if (bytes.length % 3 === 2) { base64String = base64String.substring(0, base64String.length - 1) + "="; @@ -13181,8 +13322,8 @@ var require_localforage = __commonJS({ stringToBuffer, bufferToString }; - function createDbTable(t4, dbInfo, callback, errorCallback) { - t4.executeSql("CREATE TABLE IF NOT EXISTS " + dbInfo.storeName + " (id INTEGER PRIMARY KEY, key unique, value)", [], callback, errorCallback); + function createDbTable(t5, dbInfo, callback, errorCallback) { + t5.executeSql("CREATE TABLE IF NOT EXISTS " + dbInfo.storeName + " (id INTEGER PRIMARY KEY, key unique, value)", [], callback, errorCallback); } function _initStorage$1(options) { var self2 = this; @@ -13190,8 +13331,8 @@ var require_localforage = __commonJS({ db: null }; if (options) { - for (var i4 in options) { - dbInfo[i4] = typeof options[i4] !== "string" ? options[i4].toString() : options[i4]; + for (var i5 in options) { + dbInfo[i5] = typeof options[i5] !== "string" ? options[i5].toString() : options[i5]; } } var dbInfoPromise = new Promise$1(function(resolve, reject) { @@ -13200,11 +13341,11 @@ var require_localforage = __commonJS({ } catch (e4) { return reject(e4); } - dbInfo.db.transaction(function(t4) { - createDbTable(t4, dbInfo, function() { + dbInfo.db.transaction(function(t5) { + createDbTable(t5, dbInfo, function() { self2._dbInfo = dbInfo; resolve(); - }, function(t5, error) { + }, function(t6, error) { reject(error); }); }, reject); @@ -13212,20 +13353,20 @@ var require_localforage = __commonJS({ dbInfo.serializer = localforageSerializer; return dbInfoPromise; } - function tryExecuteSql(t4, dbInfo, sqlStatement, args, callback, errorCallback) { - t4.executeSql(sqlStatement, args, callback, function(t5, error) { + function tryExecuteSql(t5, dbInfo, sqlStatement, args, callback, errorCallback) { + t5.executeSql(sqlStatement, args, callback, function(t6, error) { if (error.code === error.SYNTAX_ERR) { - t5.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?", [dbInfo.storeName], function(t6, results) { + t6.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?", [dbInfo.storeName], function(t7, results) { if (!results.rows.length) { - createDbTable(t6, dbInfo, function() { - t6.executeSql(sqlStatement, args, callback, errorCallback); + createDbTable(t7, dbInfo, function() { + t7.executeSql(sqlStatement, args, callback, errorCallback); }, errorCallback); } else { - errorCallback(t6, error); + errorCallback(t7, error); } }, errorCallback); } else { - errorCallback(t5, error); + errorCallback(t6, error); } }, errorCallback); } @@ -13235,14 +13376,14 @@ var require_localforage = __commonJS({ var promise = new Promise$1(function(resolve, reject) { self2.ready().then(function() { var dbInfo = self2._dbInfo; - dbInfo.db.transaction(function(t4) { - tryExecuteSql(t4, dbInfo, "SELECT * FROM " + dbInfo.storeName + " WHERE key = ? LIMIT 1", [key3], function(t5, results) { + dbInfo.db.transaction(function(t5) { + tryExecuteSql(t5, dbInfo, "SELECT * FROM " + dbInfo.storeName + " WHERE key = ? LIMIT 1", [key3], function(t6, results) { var result = results.rows.length ? results.rows.item(0).value : null; if (result) { result = dbInfo.serializer.deserialize(result); } resolve(result); - }, function(t5, error) { + }, function(t6, error) { reject(error); }); }); @@ -13256,24 +13397,24 @@ var require_localforage = __commonJS({ var promise = new Promise$1(function(resolve, reject) { self2.ready().then(function() { var dbInfo = self2._dbInfo; - dbInfo.db.transaction(function(t4) { - tryExecuteSql(t4, dbInfo, "SELECT * FROM " + dbInfo.storeName, [], function(t5, results) { + dbInfo.db.transaction(function(t5) { + tryExecuteSql(t5, dbInfo, "SELECT * FROM " + dbInfo.storeName, [], function(t6, results) { var rows = results.rows; var length2 = rows.length; - for (var i4 = 0; i4 < length2; i4++) { - var item = rows.item(i4); + for (var i5 = 0; i5 < length2; i5++) { + var item = rows.item(i5); var result = item.value; if (result) { result = dbInfo.serializer.deserialize(result); } - result = iterator(result, item.key, i4 + 1); + result = iterator(result, item.key, i5 + 1); if (result !== void 0) { resolve(result); return; } } resolve(); - }, function(t5, error) { + }, function(t6, error) { reject(error); }); }); @@ -13296,10 +13437,10 @@ var require_localforage = __commonJS({ if (error) { reject(error); } else { - dbInfo.db.transaction(function(t4) { - tryExecuteSql(t4, dbInfo, "INSERT OR REPLACE INTO " + dbInfo.storeName + " (key, value) VALUES (?, ?)", [key3, value2], function() { + dbInfo.db.transaction(function(t5) { + tryExecuteSql(t5, dbInfo, "INSERT OR REPLACE INTO " + dbInfo.storeName + " (key, value) VALUES (?, ?)", [key3, value2], function() { resolve(originalValue); - }, function(t5, error2) { + }, function(t6, error2) { reject(error2); }); }, function(sqlError) { @@ -13327,10 +13468,10 @@ var require_localforage = __commonJS({ var promise = new Promise$1(function(resolve, reject) { self2.ready().then(function() { var dbInfo = self2._dbInfo; - dbInfo.db.transaction(function(t4) { - tryExecuteSql(t4, dbInfo, "DELETE FROM " + dbInfo.storeName + " WHERE key = ?", [key3], function() { + dbInfo.db.transaction(function(t5) { + tryExecuteSql(t5, dbInfo, "DELETE FROM " + dbInfo.storeName + " WHERE key = ?", [key3], function() { resolve(); - }, function(t5, error) { + }, function(t6, error) { reject(error); }); }); @@ -13344,10 +13485,10 @@ var require_localforage = __commonJS({ var promise = new Promise$1(function(resolve, reject) { self2.ready().then(function() { var dbInfo = self2._dbInfo; - dbInfo.db.transaction(function(t4) { - tryExecuteSql(t4, dbInfo, "DELETE FROM " + dbInfo.storeName, [], function() { + dbInfo.db.transaction(function(t5) { + tryExecuteSql(t5, dbInfo, "DELETE FROM " + dbInfo.storeName, [], function() { resolve(); - }, function(t5, error) { + }, function(t6, error) { reject(error); }); }); @@ -13361,11 +13502,11 @@ var require_localforage = __commonJS({ var promise = new Promise$1(function(resolve, reject) { self2.ready().then(function() { var dbInfo = self2._dbInfo; - dbInfo.db.transaction(function(t4) { - tryExecuteSql(t4, dbInfo, "SELECT COUNT(key) as c FROM " + dbInfo.storeName, [], function(t5, results) { + dbInfo.db.transaction(function(t5) { + tryExecuteSql(t5, dbInfo, "SELECT COUNT(key) as c FROM " + dbInfo.storeName, [], function(t6, results) { var result = results.rows.item(0).c; resolve(result); - }, function(t5, error) { + }, function(t6, error) { reject(error); }); }); @@ -13379,11 +13520,11 @@ var require_localforage = __commonJS({ var promise = new Promise$1(function(resolve, reject) { self2.ready().then(function() { var dbInfo = self2._dbInfo; - dbInfo.db.transaction(function(t4) { - tryExecuteSql(t4, dbInfo, "SELECT key FROM " + dbInfo.storeName + " WHERE id = ? LIMIT 1", [n2 + 1], function(t5, results) { + dbInfo.db.transaction(function(t5) { + tryExecuteSql(t5, dbInfo, "SELECT key FROM " + dbInfo.storeName + " WHERE id = ? LIMIT 1", [n2 + 1], function(t6, results) { var result = results.rows.length ? results.rows.item(0).key : null; resolve(result); - }, function(t5, error) { + }, function(t6, error) { reject(error); }); }); @@ -13397,14 +13538,14 @@ var require_localforage = __commonJS({ var promise = new Promise$1(function(resolve, reject) { self2.ready().then(function() { var dbInfo = self2._dbInfo; - dbInfo.db.transaction(function(t4) { - tryExecuteSql(t4, dbInfo, "SELECT key FROM " + dbInfo.storeName, [], function(t5, results) { + dbInfo.db.transaction(function(t5) { + tryExecuteSql(t5, dbInfo, "SELECT key FROM " + dbInfo.storeName, [], function(t6, results) { var keys3 = []; - for (var i4 = 0; i4 < results.rows.length; i4++) { - keys3.push(results.rows.item(i4).key); + for (var i5 = 0; i5 < results.rows.length; i5++) { + keys3.push(results.rows.item(i5).key); } resolve(keys3); - }, function(t5, error) { + }, function(t6, error) { reject(error); }); }); @@ -13415,17 +13556,17 @@ var require_localforage = __commonJS({ } function getAllStoreNames(db) { return new Promise$1(function(resolve, reject) { - db.transaction(function(t4) { - t4.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'", [], function(t5, results) { + db.transaction(function(t5) { + t5.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'", [], function(t6, results) { var storeNames = []; - for (var i4 = 0; i4 < results.rows.length; i4++) { - storeNames.push(results.rows.item(i4).name); + for (var i5 = 0; i5 < results.rows.length; i5++) { + storeNames.push(results.rows.item(i5).name); } resolve({ db, storeNames }); - }, function(t5, error) { + }, function(t6, error) { reject(error); }); }, function(sqlError) { @@ -13463,19 +13604,19 @@ var require_localforage = __commonJS({ } }).then(function(operationInfo) { return new Promise$1(function(resolve, reject) { - operationInfo.db.transaction(function(t4) { + operationInfo.db.transaction(function(t5) { function dropTable2(storeName) { return new Promise$1(function(resolve2, reject2) { - t4.executeSql("DROP TABLE IF EXISTS " + storeName, [], function() { + t5.executeSql("DROP TABLE IF EXISTS " + storeName, [], function() { resolve2(); - }, function(t5, error) { + }, function(t6, error) { reject2(error); }); }); } var operations = []; - for (var i4 = 0, len = operationInfo.storeNames.length; i4 < len; i4++) { - operations.push(dropTable2(operationInfo.storeNames[i4])); + for (var i5 = 0, len = operationInfo.storeNames.length; i5 < len; i5++) { + operations.push(dropTable2(operationInfo.storeNames[i5])); } Promise$1.all(operations).then(function() { resolve(); @@ -13536,8 +13677,8 @@ var require_localforage = __commonJS({ var self2 = this; var dbInfo = {}; if (options) { - for (var i4 in options) { - dbInfo[i4] = options[i4]; + for (var i5 in options) { + dbInfo[i5] = options[i5]; } } dbInfo.keyPrefix = _getKeyPrefix(options, self2._defaultConfig); @@ -13552,8 +13693,8 @@ var require_localforage = __commonJS({ var self2 = this; var promise = self2.ready().then(function() { var keyPrefix = self2._dbInfo.keyPrefix; - for (var i4 = localStorage.length - 1; i4 >= 0; i4--) { - var key3 = localStorage.key(i4); + for (var i5 = localStorage.length - 1; i5 >= 0; i5--) { + var key3 = localStorage.key(i5); if (key3.indexOf(keyPrefix) === 0) { localStorage.removeItem(key3); } @@ -13584,8 +13725,8 @@ var require_localforage = __commonJS({ var keyPrefixLength = keyPrefix.length; var length2 = localStorage.length; var iterationNumber = 1; - for (var i4 = 0; i4 < length2; i4++) { - var key3 = localStorage.key(i4); + for (var i5 = 0; i5 < length2; i5++) { + var key3 = localStorage.key(i5); if (key3.indexOf(keyPrefix) !== 0) { continue; } @@ -13626,8 +13767,8 @@ var require_localforage = __commonJS({ var dbInfo = self2._dbInfo; var length2 = localStorage.length; var keys3 = []; - for (var i4 = 0; i4 < length2; i4++) { - var itemKey = localStorage.key(i4); + for (var i5 = 0; i5 < length2; i5++) { + var itemKey = localStorage.key(i5); if (itemKey.indexOf(dbInfo.keyPrefix) === 0) { keys3.push(itemKey.substring(dbInfo.keyPrefix.length)); } @@ -13705,8 +13846,8 @@ var require_localforage = __commonJS({ resolve(_getKeyPrefix(options, self2._defaultConfig)); } }).then(function(keyPrefix) { - for (var i4 = localStorage.length - 1; i4 >= 0; i4--) { - var key3 = localStorage.key(i4); + for (var i5 = localStorage.length - 1; i5 >= 0; i5--) { + var key3 = localStorage.key(i5); if (key3.indexOf(keyPrefix) === 0) { localStorage.removeItem(key3); } @@ -13735,12 +13876,12 @@ var require_localforage = __commonJS({ }; var includes = function includes2(array, searchElement) { var len = array.length; - var i4 = 0; - while (i4 < len) { - if (sameValue(array[i4], searchElement)) { + var i5 = 0; + while (i5 < len) { + if (sameValue(array[i5], searchElement)) { return true; } - i4++; + i5++; } return false; }; @@ -13774,8 +13915,8 @@ var require_localforage = __commonJS({ }; } function extend2() { - for (var i4 = 1; i4 < arguments.length; i4++) { - var arg = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var arg = arguments[i5]; if (arg) { for (var _key in arg) { if (arg.hasOwnProperty(_key)) { @@ -13818,14 +13959,14 @@ var require_localforage = __commonJS({ if (this._ready) { return new Error("Can't call config() after localforage has been used."); } - for (var i4 in options) { - if (i4 === "storeName") { - options[i4] = options[i4].replace(/\W/g, "_"); + for (var i5 in options) { + if (i5 === "storeName") { + options[i5] = options[i5].replace(/\W/g, "_"); } - if (i4 === "version" && typeof options[i4] !== "number") { + if (i5 === "version" && typeof options[i5] !== "number") { return new Error("Database version must be a number."); } - this._config[i4] = options[i4]; + this._config[i5] = options[i5]; } if ("driver" in options && options.driver) { return this.setDriver(this._config.driver); @@ -13847,8 +13988,8 @@ var require_localforage = __commonJS({ return; } var driverMethods = LibraryMethods.concat("_initStorage"); - for (var i4 = 0, len = driverMethods.length; i4 < len; i4++) { - var driverMethodName = driverMethods[i4]; + for (var i5 = 0, len = driverMethods.length; i5 < len; i5++) { + var driverMethodName = driverMethods[i5]; var isRequired = !includes(OptionalDriverMethods, driverMethodName); if ((isRequired || driverObject[driverMethodName]) && typeof driverObject[driverMethodName] !== "function") { reject(complianceError); @@ -13984,8 +14125,8 @@ var require_localforage = __commonJS({ }; LocalForage2.prototype._getSupportedDrivers = function _getSupportedDrivers(drivers) { var supportedDrivers = []; - for (var i4 = 0, len = drivers.length; i4 < len; i4++) { - var driverName = drivers[i4]; + for (var i5 = 0, len = drivers.length; i5 < len; i5++) { + var driverName = drivers[i5]; if (this.supports(driverName)) { supportedDrivers.push(driverName); } @@ -13993,8 +14134,8 @@ var require_localforage = __commonJS({ return supportedDrivers; }; LocalForage2.prototype._wrapLibraryMethodsWithReady = function _wrapLibraryMethodsWithReady() { - for (var i4 = 0, len = LibraryMethods.length; i4 < len; i4++) { - callWhenReady(this, LibraryMethods[i4]); + for (var i5 = 0, len = LibraryMethods.length; i5 < len; i5++) { + callWhenReady(this, LibraryMethods[i5]); } }; LocalForage2.prototype.createInstance = function createInstance(options) { @@ -14035,89 +14176,89 @@ var require_sql_wasm = __commonJS({ e4 || (e4 = typeof Module !== "undefined" ? Module : {}); null; e4.onRuntimeInitialized = function() { - function a5(g4, m5) { - switch (typeof m5) { + function a6(g4, m6) { + switch (typeof m6) { case "boolean": - gc(g4, m5 ? 1 : 0); + gc(g4, m6 ? 1 : 0); break; case "number": - hc(g4, m5); + hc(g4, m6); break; case "string": - ic(g4, m5, -1, -1); + ic(g4, m6, -1, -1); break; case "object": - if (null === m5) + if (null === m6) kb(g4); - else if (null != m5.length) { - var n2 = aa(m5); - jc(g4, n2, m5.length, -1); + else if (null != m6.length) { + var n2 = aa(m6); + jc(g4, n2, m6.length, -1); ba(n2); } else - xa(g4, "Wrong API use : tried to return a value of an unknown type (" + m5 + ").", -1); + xa(g4, "Wrong API use : tried to return a value of an unknown type (" + m6 + ").", -1); break; default: kb(g4); } } - function b4(g4, m5) { + function b4(g4, m6) { for (var n2 = [], p3 = 0; p3 < g4; p3 += 1) { - var v3 = l3(m5 + 4 * p3, "i32"), y5 = kc(v3); + var v4 = l3(m6 + 4 * p3, "i32"), y5 = kc(v4); if (1 === y5 || 2 === y5) - v3 = lc(v3); + v4 = lc(v4); else if (3 === y5) - v3 = mc(v3); + v4 = mc(v4); else if (4 === y5) { - y5 = v3; - v3 = nc(y5); + y5 = v4; + v4 = nc(y5); y5 = oc(y5); - for (var L4 = new Uint8Array(v3), G3 = 0; G3 < v3; G3 += 1) + for (var L4 = new Uint8Array(v4), G3 = 0; G3 < v4; G3 += 1) L4[G3] = r3[y5 + G3]; - v3 = L4; + v4 = L4; } else - v3 = null; - n2.push(v3); + v4 = null; + n2.push(v4); } return n2; } - function c4(g4, m5) { + function c4(g4, m6) { this.La = g4; - this.db = m5; + this.db = m6; this.Ja = 1; this.fb = []; } - function d5(g4, m5) { - this.db = m5; - m5 = ca(g4) + 1; - this.Ya = da(m5); + function d6(g4, m6) { + this.db = m6; + m6 = ca(g4) + 1; + this.Ya = da(m6); if (null === this.Ya) throw Error("Unable to allocate memory for the SQL string"); - t4(g4, u4, this.Ya, m5); + t5(g4, u4, this.Ya, m6); this.eb = this.Ya; this.Ua = this.ib = null; } function f4(g4) { this.filename = "dbfile_" + (4294967295 * Math.random() >>> 0); if (null != g4) { - var m5 = this.filename, n2 = "/", p3 = m5; - n2 && (n2 = "string" == typeof n2 ? n2 : ea(n2), p3 = m5 ? z5(n2 + "/" + m5) : n2); - m5 = fa( + var m6 = this.filename, n2 = "/", p3 = m6; + n2 && (n2 = "string" == typeof n2 ? n2 : ea(n2), p3 = m6 ? z5(n2 + "/" + m6) : n2); + m6 = fa( true, true ); - p3 = ha(p3, (void 0 !== m5 ? m5 : 438) & 4095 | 32768, 0); + p3 = ha(p3, (void 0 !== m6 ? m6 : 438) & 4095 | 32768, 0); if (g4) { if ("string" == typeof g4) { n2 = Array(g4.length); - for (var v3 = 0, y5 = g4.length; v3 < y5; ++v3) - n2[v3] = g4.charCodeAt(v3); + for (var v4 = 0, y5 = g4.length; v4 < y5; ++v4) + n2[v4] = g4.charCodeAt(v4); g4 = n2; } - ia(p3, m5 | 146); + ia(p3, m6 | 146); n2 = ja(p3, 577); ka(n2, g4, 0, g4.length, 0); la(n2); - ia(p3, m5); + ia(p3, m6); } } this.handleError(q5(this.filename, h5)); @@ -14180,21 +14321,21 @@ var require_sql_wasm = __commonJS({ }; c4.prototype.getBlob = function(g4) { null == g4 && (g4 = this.Ja, this.Ja += 1); - var m5 = Bc(this.La, g4); + var m6 = Bc(this.La, g4); g4 = Ac(this.La, g4); - for (var n2 = new Uint8Array(m5), p3 = 0; p3 < m5; p3 += 1) + for (var n2 = new Uint8Array(m6), p3 = 0; p3 < m6; p3 += 1) n2[p3] = r3[g4 + p3]; return n2; }; - c4.prototype.get = function(g4, m5) { - m5 = m5 || {}; + c4.prototype.get = function(g4, m6) { + m6 = m6 || {}; null != g4 && this.bind(g4) && this.step(); g4 = []; for (var n2 = yc(this.La), p3 = 0; p3 < n2; p3 += 1) switch (Cc(this.La, p3)) { case 1: - var v3 = m5.useBigInt ? this.Cb(p3) : this.sb(p3); - g4.push(v3); + var v4 = m6.useBigInt ? this.Cb(p3) : this.sb(p3); + g4.push(v4); break; case 2: g4.push(this.sb(p3)); @@ -14211,15 +14352,15 @@ var require_sql_wasm = __commonJS({ return g4; }; c4.prototype.getColumnNames = function() { - for (var g4 = [], m5 = xc(this.La), n2 = 0; n2 < m5; n2 += 1) + for (var g4 = [], m6 = xc(this.La), n2 = 0; n2 < m6; n2 += 1) g4.push(Dc(this.La, n2)); return g4; }; - c4.prototype.getAsObject = function(g4, m5) { - g4 = this.get(g4, m5); - m5 = this.getColumnNames(); - for (var n2 = {}, p3 = 0; p3 < m5.length; p3 += 1) - n2[m5[p3]] = g4[p3]; + c4.prototype.getAsObject = function(g4, m6) { + g4 = this.get(g4, m6); + m6 = this.getColumnNames(); + for (var n2 = {}, p3 = 0; p3 < m6.length; p3 += 1) + n2[m6[p3]] = g4[p3]; return n2; }; c4.prototype.getSQL = function() { @@ -14233,65 +14374,65 @@ var require_sql_wasm = __commonJS({ this.step(); return this.reset(); }; - c4.prototype.nb = function(g4, m5) { - null == m5 && (m5 = this.Ja, this.Ja += 1); + c4.prototype.nb = function(g4, m6) { + null == m6 && (m6 = this.Ja, this.Ja += 1); g4 = ma(g4); var n2 = aa(g4); this.fb.push(n2); - this.db.handleError(rc(this.La, m5, n2, g4.length - 1, 0)); + this.db.handleError(rc(this.La, m6, n2, g4.length - 1, 0)); }; - c4.prototype.wb = function(g4, m5) { - null == m5 && (m5 = this.Ja, this.Ja += 1); + c4.prototype.wb = function(g4, m6) { + null == m6 && (m6 = this.Ja, this.Ja += 1); var n2 = aa(g4); this.fb.push(n2); - this.db.handleError(pb(this.La, m5, n2, g4.length, 0)); + this.db.handleError(pb(this.La, m6, n2, g4.length, 0)); }; - c4.prototype.mb = function(g4, m5) { - null == m5 && (m5 = this.Ja, this.Ja += 1); - this.db.handleError((g4 === (g4 | 0) ? tc : sc)(this.La, m5, g4)); + c4.prototype.mb = function(g4, m6) { + null == m6 && (m6 = this.Ja, this.Ja += 1); + this.db.handleError((g4 === (g4 | 0) ? tc : sc)(this.La, m6, g4)); }; c4.prototype.zb = function(g4) { null == g4 && (g4 = this.Ja, this.Ja += 1); pb(this.La, g4, 0, 0, 0); }; - c4.prototype.ob = function(g4, m5) { - null == m5 && (m5 = this.Ja, this.Ja += 1); + c4.prototype.ob = function(g4, m6) { + null == m6 && (m6 = this.Ja, this.Ja += 1); switch (typeof g4) { case "string": - this.nb(g4, m5); + this.nb(g4, m6); return; case "number": - this.mb(g4, m5); + this.mb(g4, m6); return; case "bigint": - this.nb(g4.toString(), m5); + this.nb(g4.toString(), m6); return; case "boolean": - this.mb(g4 + 0, m5); + this.mb(g4 + 0, m6); return; case "object": if (null === g4) { - this.zb(m5); + this.zb(m6); return; } if (null != g4.length) { - this.wb(g4, m5); + this.wb(g4, m6); return; } } throw "Wrong API use : tried to bind a value of an unknown type (" + g4 + ")."; }; c4.prototype.yb = function(g4) { - var m5 = this; + var m6 = this; Object.keys(g4).forEach(function(n2) { - var p3 = uc(m5.La, n2); - 0 !== p3 && m5.ob(g4[n2], p3); + var p3 = uc(m6.La, n2); + 0 !== p3 && m6.ob(g4[n2], p3); }); return true; }; c4.prototype.xb = function(g4) { - for (var m5 = 0; m5 < g4.length; m5 += 1) - this.ob(g4[m5], m5 + 1); + for (var m6 = 0; m6 < g4.length; m6 += 1) + this.ob(g4[m6], m6 + 1); return true; }; c4.prototype.reset = function() { @@ -14309,18 +14450,18 @@ var require_sql_wasm = __commonJS({ this.La = 0; return g4; }; - d5.prototype.next = function() { + d6.prototype.next = function() { if (null === this.Ya) return { done: true }; null !== this.Ua && (this.Ua.free(), this.Ua = null); if (!this.db.db) throw this.gb(), Error("Database closed"); - var g4 = oa(), m5 = B5(4); + var g4 = oa(), m6 = B5(4); pa(h5); - pa(m5); + pa(m6); try { - this.db.handleError(ob(this.db.db, this.eb, -1, h5, m5)); - this.eb = l3(m5, "i32"); + this.db.handleError(ob(this.db.db, this.eb, -1, h5, m6)); + this.eb = l3(m6, "i32"); var n2 = l3(h5, "i32"); if (0 === n2) return this.gb(), { done: true }; @@ -14333,21 +14474,21 @@ var require_sql_wasm = __commonJS({ qa(g4); } }; - d5.prototype.gb = function() { + d6.prototype.gb = function() { ba(this.Ya); this.Ya = null; }; - d5.prototype.getRemainingSQL = function() { + d6.prototype.getRemainingSQL = function() { return null !== this.ib ? this.ib : C3(this.eb); }; - "function" === typeof Symbol && "symbol" === typeof Symbol.iterator && (d5.prototype[Symbol.iterator] = function() { + "function" === typeof Symbol && "symbol" === typeof Symbol.iterator && (d6.prototype[Symbol.iterator] = function() { return this; }); - f4.prototype.run = function(g4, m5) { + f4.prototype.run = function(g4, m6) { if (!this.db) throw "Database closed"; - if (m5) { - g4 = this.prepare(g4, m5); + if (m6) { + g4 = this.prepare(g4, m6); try { g4.step(); } finally { @@ -14357,13 +14498,13 @@ var require_sql_wasm = __commonJS({ this.handleError(w5(this.db, g4, 0, 0, h5)); return this; }; - f4.prototype.exec = function(g4, m5, n2) { + f4.prototype.exec = function(g4, m6, n2) { if (!this.db) throw "Database closed"; - var p3 = oa(), v3 = null; + var p3 = oa(), v4 = null; try { var y5 = ca(g4) + 1, L4 = B5(y5); - t4(g4, r3, L4, y5); + t5(g4, r3, L4, y5); var G3 = L4; var H5 = B5(4); for (g4 = []; 0 !== l3(G3, "i8"); ) { @@ -14374,47 +14515,47 @@ var require_sql_wasm = __commonJS({ G3 = l3(H5, "i32"); if (0 !== I4) { y5 = null; - v3 = new c4(I4, this); - for (null != m5 && v3.bind(m5); v3.step(); ) - null === y5 && (y5 = { columns: v3.getColumnNames(), values: [] }, g4.push(y5)), y5.values.push(v3.get(null, n2)); - v3.free(); + v4 = new c4(I4, this); + for (null != m6 && v4.bind(m6); v4.step(); ) + null === y5 && (y5 = { columns: v4.getColumnNames(), values: [] }, g4.push(y5)), y5.values.push(v4.get(null, n2)); + v4.free(); } } return g4; } catch (na) { - throw v3 && v3.free(), na; + throw v4 && v4.free(), na; } finally { qa(p3); } }; - f4.prototype.each = function(g4, m5, n2, p3, v3) { - "function" === typeof m5 && (p3 = n2, n2 = m5, m5 = void 0); - g4 = this.prepare(g4, m5); + f4.prototype.each = function(g4, m6, n2, p3, v4) { + "function" === typeof m6 && (p3 = n2, n2 = m6, m6 = void 0); + g4 = this.prepare(g4, m6); try { for (; g4.step(); ) - n2(g4.getAsObject(null, v3)); + n2(g4.getAsObject(null, v4)); } finally { g4.free(); } if ("function" === typeof p3) return p3(); }; - f4.prototype.prepare = function(g4, m5) { + f4.prototype.prepare = function(g4, m6) { pa(h5); this.handleError(S4(this.db, g4, -1, h5, 0)); g4 = l3(h5, "i32"); if (0 === g4) throw "Nothing to prepare"; var n2 = new c4(g4, this); - null != m5 && n2.bind(m5); + null != m6 && n2.bind(m6); return this.Za[g4] = n2; }; f4.prototype.iterateStatements = function(g4) { - return new d5(g4, this); + return new d6(g4, this); }; f4.prototype["export"] = function() { - Object.values(this.Za).forEach(function(m5) { - m5.free(); + Object.values(this.Za).forEach(function(m6) { + m6.free(); }); Object.values(this.Na).forEach(ra); this.Na = {}; @@ -14438,41 +14579,41 @@ var require_sql_wasm = __commonJS({ f4.prototype.getRowsModified = function() { return A4(this.db); }; - f4.prototype.create_function = function(g4, m5) { + f4.prototype.create_function = function(g4, m6) { Object.prototype.hasOwnProperty.call(this.Na, g4) && (ra(this.Na[g4]), delete this.Na[g4]); - var n2 = ua(function(p3, v3, y5) { - v3 = b4(v3, y5); + var n2 = ua(function(p3, v4, y5) { + v4 = b4(v4, y5); try { - var L4 = m5.apply(null, v3); + var L4 = m6.apply(null, v4); } catch (G3) { xa(p3, G3, -1); return; } - a5(p3, L4); + a6(p3, L4); }, "viii"); this.Na[g4] = n2; - this.handleError(rb(this.db, g4, m5.length, 1, 0, n2, 0, 0, 0)); + this.handleError(rb(this.db, g4, m6.length, 1, 0, n2, 0, 0, 0)); return this; }; - f4.prototype.create_aggregate = function(g4, m5) { - var n2 = m5.init || function() { + f4.prototype.create_aggregate = function(g4, m6) { + var n2 = m6.init || function() { return null; - }, p3 = m5.finalize || function(H5) { + }, p3 = m6.finalize || function(H5) { return H5; - }, v3 = m5.step; - if (!v3) + }, v4 = m6.step; + if (!v4) throw "An aggregate function must have a step function in " + g4; var y5 = {}; Object.hasOwnProperty.call(this.Na, g4) && (ra(this.Na[g4]), delete this.Na[g4]); - m5 = g4 + "__finalize"; - Object.hasOwnProperty.call(this.Na, m5) && (ra(this.Na[m5]), delete this.Na[m5]); + m6 = g4 + "__finalize"; + Object.hasOwnProperty.call(this.Na, m6) && (ra(this.Na[m6]), delete this.Na[m6]); var L4 = ua(function(H5, I4, na) { var Z2 = sb(H5, 1); Object.hasOwnProperty.call(y5, Z2) || (y5[Z2] = n2()); I4 = b4(I4, na); I4 = [y5[Z2]].concat(I4); try { - y5[Z2] = v3.apply(null, I4); + y5[Z2] = v4.apply(null, I4); } catch (Ic) { delete y5[Z2], xa(H5, Ic, -1); } @@ -14485,12 +14626,12 @@ var require_sql_wasm = __commonJS({ xa(H5, Z2, -1); return; } - a5(H5, na); + a6(H5, na); delete y5[I4]; }, "vi"); this.Na[g4] = L4; - this.Na[m5] = G3; - this.handleError(rb(this.db, g4, v3.length - 1, 1, 0, 0, L4, G3, 0)); + this.Na[m6] = G3; + this.handleError(rb(this.db, g4, v4.length - 1, 1, 0, 0, L4, G3, 0)); return this; }; e4.Database = f4; @@ -14499,44 +14640,44 @@ var require_sql_wasm = __commonJS({ if (Aa) D4 = za ? require("path").dirname(D4) + "/" : __dirname + "/", Fa = () => { Ea || (fs = require("fs"), Ea = require("path")); - }, Ba = function(a5, b4) { + }, Ba = function(a6, b4) { Fa(); - a5 = Ea.normalize(a5); - return fs.readFileSync(a5, b4 ? void 0 : "utf8"); - }, Da = (a5) => { - a5 = Ba(a5, true); - a5.buffer || (a5 = new Uint8Array(a5)); - return a5; - }, Ca = (a5, b4, c4) => { + a6 = Ea.normalize(a6); + return fs.readFileSync(a6, b4 ? void 0 : "utf8"); + }, Da = (a6) => { + a6 = Ba(a6, true); + a6.buffer || (a6 = new Uint8Array(a6)); + return a6; + }, Ca = (a6, b4, c4) => { Fa(); - a5 = Ea.normalize(a5); - fs.readFile(a5, function(d5, f4) { - d5 ? c4(d5) : b4(f4.buffer); + a6 = Ea.normalize(a6); + fs.readFile(a6, function(d6, f4) { + d6 ? c4(d6) : b4(f4.buffer); }); }, 1 < process.argv.length && (wa = process.argv[1].replace(/\\/g, "/")), process.argv.slice(2), "undefined" != typeof module2 && (module2.exports = e4), e4.inspect = function() { return "[Emscripten Module object]"; }; else if (ya || za) - za ? D4 = self.location.href : "undefined" != typeof document && document.currentScript && (D4 = document.currentScript.src), D4 = 0 !== D4.indexOf("blob:") ? D4.substr(0, D4.replace(/[?#].*/, "").lastIndexOf("/") + 1) : "", Ba = (a5) => { + za ? D4 = self.location.href : "undefined" != typeof document && document.currentScript && (D4 = document.currentScript.src), D4 = 0 !== D4.indexOf("blob:") ? D4.substr(0, D4.replace(/[?#].*/, "").lastIndexOf("/") + 1) : "", Ba = (a6) => { var b4 = new XMLHttpRequest(); - b4.open("GET", a5, false); + b4.open("GET", a6, false); b4.send(null); return b4.responseText; - }, za && (Da = (a5) => { + }, za && (Da = (a6) => { var b4 = new XMLHttpRequest(); - b4.open("GET", a5, false); + b4.open("GET", a6, false); b4.responseType = "arraybuffer"; b4.send(null); return new Uint8Array(b4.response); - }), Ca = (a5, b4, c4) => { - var d5 = new XMLHttpRequest(); - d5.open("GET", a5, true); - d5.responseType = "arraybuffer"; - d5.onload = () => { - 200 == d5.status || 0 == d5.status && d5.response ? b4(d5.response) : c4(); + }), Ca = (a6, b4, c4) => { + var d6 = new XMLHttpRequest(); + d6.open("GET", a6, true); + d6.responseType = "arraybuffer"; + d6.onload = () => { + 200 == d6.status || 0 == d6.status && d6.response ? b4(d6.response) : c4(); }; - d5.onerror = c4; - d5.send(null); + d6.onerror = c4; + d6.send(null); }; var Ga = e4.print || console.log.bind(console), Ha = e4.printErr || console.warn.bind(console); Object.assign(e4, va); @@ -14547,58 +14688,58 @@ var require_sql_wasm = __commonJS({ var noExitRuntime = e4.noExitRuntime || true; "object" != typeof WebAssembly && E4("no native wasm support detected"); var Ja, Ka = false, La = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0; - function Ma(a5, b4, c4) { - var d5 = b4 + c4; - for (c4 = b4; a5[c4] && !(c4 >= d5); ) + function Ma(a6, b4, c4) { + var d6 = b4 + c4; + for (c4 = b4; a6[c4] && !(c4 >= d6); ) ++c4; - if (16 < c4 - b4 && a5.buffer && La) - return La.decode(a5.subarray(b4, c4)); - for (d5 = ""; b4 < c4; ) { - var f4 = a5[b4++]; + if (16 < c4 - b4 && a6.buffer && La) + return La.decode(a6.subarray(b4, c4)); + for (d6 = ""; b4 < c4; ) { + var f4 = a6[b4++]; if (f4 & 128) { - var h5 = a5[b4++] & 63; + var h5 = a6[b4++] & 63; if (192 == (f4 & 224)) - d5 += String.fromCharCode((f4 & 31) << 6 | h5); + d6 += String.fromCharCode((f4 & 31) << 6 | h5); else { - var k5 = a5[b4++] & 63; - f4 = 224 == (f4 & 240) ? (f4 & 15) << 12 | h5 << 6 | k5 : (f4 & 7) << 18 | h5 << 12 | k5 << 6 | a5[b4++] & 63; - 65536 > f4 ? d5 += String.fromCharCode(f4) : (f4 -= 65536, d5 += String.fromCharCode(55296 | f4 >> 10, 56320 | f4 & 1023)); + var k5 = a6[b4++] & 63; + f4 = 224 == (f4 & 240) ? (f4 & 15) << 12 | h5 << 6 | k5 : (f4 & 7) << 18 | h5 << 12 | k5 << 6 | a6[b4++] & 63; + 65536 > f4 ? d6 += String.fromCharCode(f4) : (f4 -= 65536, d6 += String.fromCharCode(55296 | f4 >> 10, 56320 | f4 & 1023)); } } else - d5 += String.fromCharCode(f4); + d6 += String.fromCharCode(f4); } - return d5; + return d6; } - function C3(a5, b4) { - return a5 ? Ma(u4, a5, b4) : ""; + function C3(a6, b4) { + return a6 ? Ma(u4, a6, b4) : ""; } - function t4(a5, b4, c4, d5) { - if (!(0 < d5)) + function t5(a6, b4, c4, d6) { + if (!(0 < d6)) return 0; var f4 = c4; - d5 = c4 + d5 - 1; - for (var h5 = 0; h5 < a5.length; ++h5) { - var k5 = a5.charCodeAt(h5); + d6 = c4 + d6 - 1; + for (var h5 = 0; h5 < a6.length; ++h5) { + var k5 = a6.charCodeAt(h5); if (55296 <= k5 && 57343 >= k5) { - var q5 = a5.charCodeAt(++h5); + var q5 = a6.charCodeAt(++h5); k5 = 65536 + ((k5 & 1023) << 10) | q5 & 1023; } if (127 >= k5) { - if (c4 >= d5) + if (c4 >= d6) break; b4[c4++] = k5; } else { if (2047 >= k5) { - if (c4 + 1 >= d5) + if (c4 + 1 >= d6) break; b4[c4++] = 192 | k5 >> 6; } else { if (65535 >= k5) { - if (c4 + 2 >= d5) + if (c4 + 2 >= d6) break; b4[c4++] = 224 | k5 >> 12; } else { - if (c4 + 3 >= d5) + if (c4 + 3 >= d6) break; b4[c4++] = 240 | k5 >> 18; b4[c4++] = 128 | k5 >> 12 & 63; @@ -14611,39 +14752,39 @@ var require_sql_wasm = __commonJS({ b4[c4] = 0; return c4 - f4; } - function ca(a5) { - for (var b4 = 0, c4 = 0; c4 < a5.length; ++c4) { - var d5 = a5.charCodeAt(c4); - 127 >= d5 ? b4++ : 2047 >= d5 ? b4 += 2 : 55296 <= d5 && 57343 >= d5 ? (b4 += 4, ++c4) : b4 += 3; + function ca(a6) { + for (var b4 = 0, c4 = 0; c4 < a6.length; ++c4) { + var d6 = a6.charCodeAt(c4); + 127 >= d6 ? b4++ : 2047 >= d6 ? b4 += 2 : 55296 <= d6 && 57343 >= d6 ? (b4 += 4, ++c4) : b4 += 3; } return b4; } var Na, r3, u4, Oa, F4, J2, Pa, Qa; function Ra() { - var a5 = Ja.buffer; - Na = a5; - e4.HEAP8 = r3 = new Int8Array(a5); - e4.HEAP16 = Oa = new Int16Array(a5); - e4.HEAP32 = F4 = new Int32Array(a5); - e4.HEAPU8 = u4 = new Uint8Array(a5); - e4.HEAPU16 = new Uint16Array(a5); - e4.HEAPU32 = J2 = new Uint32Array(a5); - e4.HEAPF32 = Pa = new Float32Array(a5); - e4.HEAPF64 = Qa = new Float64Array(a5); + var a6 = Ja.buffer; + Na = a6; + e4.HEAP8 = r3 = new Int8Array(a6); + e4.HEAP16 = Oa = new Int16Array(a6); + e4.HEAP32 = F4 = new Int32Array(a6); + e4.HEAPU8 = u4 = new Uint8Array(a6); + e4.HEAPU16 = new Uint16Array(a6); + e4.HEAPU32 = J2 = new Uint32Array(a6); + e4.HEAPF32 = Pa = new Float32Array(a6); + e4.HEAPF64 = Qa = new Float64Array(a6); } var K3, Sa = [], Ta = [], Ua = []; function Va() { - var a5 = e4.preRun.shift(); - Sa.unshift(a5); + var a6 = e4.preRun.shift(); + Sa.unshift(a6); } var Wa = 0, Xa = null, Ya = null; - function E4(a5) { + function E4(a6) { if (e4.onAbort) - e4.onAbort(a5); - a5 = "Aborted(" + a5 + ")"; - Ha(a5); + e4.onAbort(a6); + a6 = "Aborted(" + a6 + ")"; + Ha(a6); Ka = true; - throw new WebAssembly.RuntimeError(a5 + ". Build with -sASSERTIONS for more info."); + throw new WebAssembly.RuntimeError(a6 + ". Build with -sASSERTIONS for more info."); } function Za() { return M5.startsWith("data:application/octet-stream;base64,"); @@ -14655,12 +14796,12 @@ var require_sql_wasm = __commonJS({ M5 = e4.locateFile ? e4.locateFile($a, D4) : D4 + $a; } function ab() { - var a5 = M5; + var a6 = M5; try { - if (a5 == M5 && Ia) + if (a6 == M5 && Ia) return new Uint8Array(Ia); if (Da) - return Da(a5); + return Da(a6); throw "both async and sync fetching of the wasm failed"; } catch (b4) { E4(b4); @@ -14669,17 +14810,17 @@ var require_sql_wasm = __commonJS({ function bb() { if (!Ia && (ya || za)) { if ("function" == typeof fetch && !M5.startsWith("file://")) - return fetch(M5, { credentials: "same-origin" }).then(function(a5) { - if (!a5.ok) + return fetch(M5, { credentials: "same-origin" }).then(function(a6) { + if (!a6.ok) throw "failed to load wasm binary file at '" + M5 + "'"; - return a5.arrayBuffer(); + return a6.arrayBuffer(); }).catch(function() { return ab(); }); if (Ca) - return new Promise(function(a5, b4) { + return new Promise(function(a6, b4) { Ca(M5, function(c4) { - a5(new Uint8Array(c4)); + a6(new Uint8Array(c4)); }, b4); }); } @@ -14688,104 +14829,104 @@ var require_sql_wasm = __commonJS({ }); } var N3, O4; - function cb(a5) { - for (; 0 < a5.length; ) - a5.shift()(e4); + function cb(a6) { + for (; 0 < a6.length; ) + a6.shift()(e4); } - function l3(a5, b4 = "i8") { + function l3(a6, b4 = "i8") { b4.endsWith("*") && (b4 = "*"); switch (b4) { case "i1": - return r3[a5 >> 0]; + return r3[a6 >> 0]; case "i8": - return r3[a5 >> 0]; + return r3[a6 >> 0]; case "i16": - return Oa[a5 >> 1]; + return Oa[a6 >> 1]; case "i32": - return F4[a5 >> 2]; + return F4[a6 >> 2]; case "i64": - return F4[a5 >> 2]; + return F4[a6 >> 2]; case "float": - return Pa[a5 >> 2]; + return Pa[a6 >> 2]; case "double": - return Qa[a5 >> 3]; + return Qa[a6 >> 3]; case "*": - return J2[a5 >> 2]; + return J2[a6 >> 2]; default: E4("invalid type for getValue: " + b4); } return null; } - function pa(a5) { + function pa(a6) { var b4 = "i32"; b4.endsWith("*") && (b4 = "*"); switch (b4) { case "i1": - r3[a5 >> 0] = 0; + r3[a6 >> 0] = 0; break; case "i8": - r3[a5 >> 0] = 0; + r3[a6 >> 0] = 0; break; case "i16": - Oa[a5 >> 1] = 0; + Oa[a6 >> 1] = 0; break; case "i32": - F4[a5 >> 2] = 0; + F4[a6 >> 2] = 0; break; case "i64": O4 = [0, (N3 = 0, 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; - F4[a5 >> 2] = O4[0]; - F4[a5 + 4 >> 2] = O4[1]; + F4[a6 >> 2] = O4[0]; + F4[a6 + 4 >> 2] = O4[1]; break; case "float": - Pa[a5 >> 2] = 0; + Pa[a6 >> 2] = 0; break; case "double": - Qa[a5 >> 3] = 0; + Qa[a6 >> 3] = 0; break; case "*": - J2[a5 >> 2] = 0; + J2[a6 >> 2] = 0; break; default: E4("invalid type for setValue: " + b4); } } - var db = (a5, b4) => { - for (var c4 = 0, d5 = a5.length - 1; 0 <= d5; d5--) { - var f4 = a5[d5]; - "." === f4 ? a5.splice(d5, 1) : ".." === f4 ? (a5.splice(d5, 1), c4++) : c4 && (a5.splice(d5, 1), c4--); + var db = (a6, b4) => { + for (var c4 = 0, d6 = a6.length - 1; 0 <= d6; d6--) { + var f4 = a6[d6]; + "." === f4 ? a6.splice(d6, 1) : ".." === f4 ? (a6.splice(d6, 1), c4++) : c4 && (a6.splice(d6, 1), c4--); } if (b4) for (; c4; c4--) - a5.unshift(".."); - return a5; - }, z5 = (a5) => { - var b4 = "/" === a5.charAt(0), c4 = "/" === a5.substr(-1); - (a5 = db(a5.split("/").filter((d5) => !!d5), !b4).join("/")) || b4 || (a5 = "."); - a5 && c4 && (a5 += "/"); - return (b4 ? "/" : "") + a5; - }, eb = (a5) => { - var b4 = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a5).slice(1); - a5 = b4[0]; + a6.unshift(".."); + return a6; + }, z5 = (a6) => { + var b4 = "/" === a6.charAt(0), c4 = "/" === a6.substr(-1); + (a6 = db(a6.split("/").filter((d6) => !!d6), !b4).join("/")) || b4 || (a6 = "."); + a6 && c4 && (a6 += "/"); + return (b4 ? "/" : "") + a6; + }, eb = (a6) => { + var b4 = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a6).slice(1); + a6 = b4[0]; b4 = b4[1]; - if (!a5 && !b4) + if (!a6 && !b4) return "."; b4 && (b4 = b4.substr(0, b4.length - 1)); - return a5 + b4; - }, fb = (a5) => { - if ("/" === a5) + return a6 + b4; + }, fb = (a6) => { + if ("/" === a6) return "/"; - a5 = z5(a5); - a5 = a5.replace(/\/$/, ""); - var b4 = a5.lastIndexOf("/"); - return -1 === b4 ? a5 : a5.substr(b4 + 1); + a6 = z5(a6); + a6 = a6.replace(/\/$/, ""); + var b4 = a6.lastIndexOf("/"); + return -1 === b4 ? a6 : a6.substr(b4 + 1); }; function gb() { if ("object" == typeof crypto && "function" == typeof crypto.getRandomValues) { - var a5 = new Uint8Array(1); + var a6 = new Uint8Array(1); return () => { - crypto.getRandomValues(a5); - return a5[0]; + crypto.getRandomValues(a6); + return a6[0]; }; } if (Aa) @@ -14797,45 +14938,45 @@ var require_sql_wasm = __commonJS({ return () => E4("randomDevice"); } function hb() { - for (var a5 = "", b4 = false, c4 = arguments.length - 1; -1 <= c4 && !b4; c4--) { + for (var a6 = "", b4 = false, c4 = arguments.length - 1; -1 <= c4 && !b4; c4--) { b4 = 0 <= c4 ? arguments[c4] : "/"; if ("string" != typeof b4) throw new TypeError("Arguments to path.resolve must be strings"); if (!b4) return ""; - a5 = b4 + "/" + a5; + a6 = b4 + "/" + a6; b4 = "/" === b4.charAt(0); } - a5 = db(a5.split("/").filter((d5) => !!d5), !b4).join("/"); - return (b4 ? "/" : "") + a5 || "."; + a6 = db(a6.split("/").filter((d6) => !!d6), !b4).join("/"); + return (b4 ? "/" : "") + a6 || "."; } - function ma(a5, b4) { - var c4 = Array(ca(a5) + 1); - a5 = t4(a5, c4, 0, c4.length); - b4 && (c4.length = a5); + function ma(a6, b4) { + var c4 = Array(ca(a6) + 1); + a6 = t5(a6, c4, 0, c4.length); + b4 && (c4.length = a6); return c4; } var ib = []; - function jb(a5, b4) { - ib[a5] = { input: [], output: [], Xa: b4 }; - lb(a5, mb); + function jb(a6, b4) { + ib[a6] = { input: [], output: [], Xa: b4 }; + lb(a6, mb); } - var mb = { open: function(a5) { - var b4 = ib[a5.node.rdev]; + var mb = { open: function(a6) { + var b4 = ib[a6.node.rdev]; if (!b4) throw new P4(43); - a5.tty = b4; - a5.seekable = false; - }, close: function(a5) { - a5.tty.Xa.fsync(a5.tty); - }, fsync: function(a5) { - a5.tty.Xa.fsync(a5.tty); - }, read: function(a5, b4, c4, d5) { - if (!a5.tty || !a5.tty.Xa.tb) + a6.tty = b4; + a6.seekable = false; + }, close: function(a6) { + a6.tty.Xa.fsync(a6.tty); + }, fsync: function(a6) { + a6.tty.Xa.fsync(a6.tty); + }, read: function(a6, b4, c4, d6) { + if (!a6.tty || !a6.tty.Xa.tb) throw new P4(60); - for (var f4 = 0, h5 = 0; h5 < d5; h5++) { + for (var f4 = 0, h5 = 0; h5 < d6; h5++) { try { - var k5 = a5.tty.Xa.tb(a5.tty); + var k5 = a6.tty.Xa.tb(a6.tty); } catch (q5) { throw new P4(29); } @@ -14846,48 +14987,48 @@ var require_sql_wasm = __commonJS({ f4++; b4[c4 + h5] = k5; } - f4 && (a5.node.timestamp = Date.now()); + f4 && (a6.node.timestamp = Date.now()); return f4; - }, write: function(a5, b4, c4, d5) { - if (!a5.tty || !a5.tty.Xa.jb) + }, write: function(a6, b4, c4, d6) { + if (!a6.tty || !a6.tty.Xa.jb) throw new P4(60); try { - for (var f4 = 0; f4 < d5; f4++) - a5.tty.Xa.jb(a5.tty, b4[c4 + f4]); + for (var f4 = 0; f4 < d6; f4++) + a6.tty.Xa.jb(a6.tty, b4[c4 + f4]); } catch (h5) { throw new P4(29); } - d5 && (a5.node.timestamp = Date.now()); + d6 && (a6.node.timestamp = Date.now()); return f4; - } }, tb = { tb: function(a5) { - if (!a5.input.length) { + } }, tb = { tb: function(a6) { + if (!a6.input.length) { var b4 = null; if (Aa) { - var c4 = Buffer.alloc(256), d5 = 0; + var c4 = Buffer.alloc(256), d6 = 0; try { - d5 = fs.readSync(process.stdin.fd, c4, 0, 256, -1); + d6 = fs.readSync(process.stdin.fd, c4, 0, 256, -1); } catch (f4) { if (f4.toString().includes("EOF")) - d5 = 0; + d6 = 0; else throw f4; } - 0 < d5 ? b4 = c4.slice(0, d5).toString("utf-8") : b4 = null; + 0 < d6 ? b4 = c4.slice(0, d6).toString("utf-8") : b4 = null; } else "undefined" != typeof window && "function" == typeof window.prompt ? (b4 = window.prompt("Input: "), null !== b4 && (b4 += "\n")) : "function" == typeof readline && (b4 = readline(), null !== b4 && (b4 += "\n")); if (!b4) return null; - a5.input = ma(b4, true); - } - return a5.input.shift(); - }, jb: function(a5, b4) { - null === b4 || 10 === b4 ? (Ga(Ma(a5.output, 0)), a5.output = []) : 0 != b4 && a5.output.push(b4); - }, fsync: function(a5) { - a5.output && 0 < a5.output.length && (Ga(Ma(a5.output, 0)), a5.output = []); - } }, ub = { jb: function(a5, b4) { - null === b4 || 10 === b4 ? (Ha(Ma(a5.output, 0)), a5.output = []) : 0 != b4 && a5.output.push(b4); - }, fsync: function(a5) { - a5.output && 0 < a5.output.length && (Ha(Ma(a5.output, 0)), a5.output = []); + a6.input = ma(b4, true); + } + return a6.input.shift(); + }, jb: function(a6, b4) { + null === b4 || 10 === b4 ? (Ga(Ma(a6.output, 0)), a6.output = []) : 0 != b4 && a6.output.push(b4); + }, fsync: function(a6) { + a6.output && 0 < a6.output.length && (Ga(Ma(a6.output, 0)), a6.output = []); + } }, ub = { jb: function(a6, b4) { + null === b4 || 10 === b4 ? (Ha(Ma(a6.output, 0)), a6.output = []) : 0 != b4 && a6.output.push(b4); + }, fsync: function(a6) { + a6.output && 0 < a6.output.length && (Ha(Ma(a6.output, 0)), a6.output = []); } }, Q3 = { Qa: null, Ra: function() { return Q3.createNode( null, @@ -14895,144 +15036,144 @@ var require_sql_wasm = __commonJS({ 16895, 0 ); - }, createNode: function(a5, b4, c4, d5) { + }, createNode: function(a6, b4, c4, d6) { if (24576 === (c4 & 61440) || 4096 === (c4 & 61440)) throw new P4(63); Q3.Qa || (Q3.Qa = { dir: { node: { Pa: Q3.Ga.Pa, Oa: Q3.Ga.Oa, lookup: Q3.Ga.lookup, ab: Q3.Ga.ab, rename: Q3.Ga.rename, unlink: Q3.Ga.unlink, rmdir: Q3.Ga.rmdir, readdir: Q3.Ga.readdir, symlink: Q3.Ga.symlink }, stream: { Ta: Q3.Ha.Ta } }, file: { node: { Pa: Q3.Ga.Pa, Oa: Q3.Ga.Oa }, stream: { Ta: Q3.Ha.Ta, read: Q3.Ha.read, write: Q3.Ha.write, lb: Q3.Ha.lb, bb: Q3.Ha.bb, cb: Q3.Ha.cb } }, link: { node: { Pa: Q3.Ga.Pa, Oa: Q3.Ga.Oa, readlink: Q3.Ga.readlink }, stream: {} }, pb: { node: { Pa: Q3.Ga.Pa, Oa: Q3.Ga.Oa }, stream: vb } }); - c4 = wb(a5, b4, c4, d5); + c4 = wb(a6, b4, c4, d6); 16384 === (c4.mode & 61440) ? (c4.Ga = Q3.Qa.dir.node, c4.Ha = Q3.Qa.dir.stream, c4.Ia = {}) : 32768 === (c4.mode & 61440) ? (c4.Ga = Q3.Qa.file.node, c4.Ha = Q3.Qa.file.stream, c4.Ma = 0, c4.Ia = null) : 40960 === (c4.mode & 61440) ? (c4.Ga = Q3.Qa.link.node, c4.Ha = Q3.Qa.link.stream) : 8192 === (c4.mode & 61440) && (c4.Ga = Q3.Qa.pb.node, c4.Ha = Q3.Qa.pb.stream); c4.timestamp = Date.now(); - a5 && (a5.Ia[b4] = c4, a5.timestamp = c4.timestamp); + a6 && (a6.Ia[b4] = c4, a6.timestamp = c4.timestamp); return c4; - }, Jb: function(a5) { - return a5.Ia ? a5.Ia.subarray ? a5.Ia.subarray(0, a5.Ma) : new Uint8Array(a5.Ia) : new Uint8Array(0); - }, qb: function(a5, b4) { - var c4 = a5.Ia ? a5.Ia.length : 0; - c4 >= b4 || (b4 = Math.max(b4, c4 * (1048576 > c4 ? 2 : 1.125) >>> 0), 0 != c4 && (b4 = Math.max(b4, 256)), c4 = a5.Ia, a5.Ia = new Uint8Array(b4), 0 < a5.Ma && a5.Ia.set(c4.subarray(0, a5.Ma), 0)); - }, Gb: function(a5, b4) { - if (a5.Ma != b4) + }, Jb: function(a6) { + return a6.Ia ? a6.Ia.subarray ? a6.Ia.subarray(0, a6.Ma) : new Uint8Array(a6.Ia) : new Uint8Array(0); + }, qb: function(a6, b4) { + var c4 = a6.Ia ? a6.Ia.length : 0; + c4 >= b4 || (b4 = Math.max(b4, c4 * (1048576 > c4 ? 2 : 1.125) >>> 0), 0 != c4 && (b4 = Math.max(b4, 256)), c4 = a6.Ia, a6.Ia = new Uint8Array(b4), 0 < a6.Ma && a6.Ia.set(c4.subarray(0, a6.Ma), 0)); + }, Gb: function(a6, b4) { + if (a6.Ma != b4) if (0 == b4) - a5.Ia = null, a5.Ma = 0; + a6.Ia = null, a6.Ma = 0; else { - var c4 = a5.Ia; - a5.Ia = new Uint8Array(b4); - c4 && a5.Ia.set(c4.subarray(0, Math.min(b4, a5.Ma))); - a5.Ma = b4; + var c4 = a6.Ia; + a6.Ia = new Uint8Array(b4); + c4 && a6.Ia.set(c4.subarray(0, Math.min(b4, a6.Ma))); + a6.Ma = b4; } - }, Ga: { Pa: function(a5) { + }, Ga: { Pa: function(a6) { var b4 = {}; - b4.dev = 8192 === (a5.mode & 61440) ? a5.id : 1; - b4.ino = a5.id; - b4.mode = a5.mode; + b4.dev = 8192 === (a6.mode & 61440) ? a6.id : 1; + b4.ino = a6.id; + b4.mode = a6.mode; b4.nlink = 1; b4.uid = 0; b4.gid = 0; - b4.rdev = a5.rdev; - 16384 === (a5.mode & 61440) ? b4.size = 4096 : 32768 === (a5.mode & 61440) ? b4.size = a5.Ma : 40960 === (a5.mode & 61440) ? b4.size = a5.link.length : b4.size = 0; - b4.atime = new Date(a5.timestamp); - b4.mtime = new Date(a5.timestamp); - b4.ctime = new Date(a5.timestamp); + b4.rdev = a6.rdev; + 16384 === (a6.mode & 61440) ? b4.size = 4096 : 32768 === (a6.mode & 61440) ? b4.size = a6.Ma : 40960 === (a6.mode & 61440) ? b4.size = a6.link.length : b4.size = 0; + b4.atime = new Date(a6.timestamp); + b4.mtime = new Date(a6.timestamp); + b4.ctime = new Date(a6.timestamp); b4.Ab = 4096; b4.blocks = Math.ceil(b4.size / b4.Ab); return b4; - }, Oa: function(a5, b4) { - void 0 !== b4.mode && (a5.mode = b4.mode); - void 0 !== b4.timestamp && (a5.timestamp = b4.timestamp); - void 0 !== b4.size && Q3.Gb(a5, b4.size); + }, Oa: function(a6, b4) { + void 0 !== b4.mode && (a6.mode = b4.mode); + void 0 !== b4.timestamp && (a6.timestamp = b4.timestamp); + void 0 !== b4.size && Q3.Gb(a6, b4.size); }, lookup: function() { throw xb[44]; - }, ab: function(a5, b4, c4, d5) { - return Q3.createNode(a5, b4, c4, d5); - }, rename: function(a5, b4, c4) { - if (16384 === (a5.mode & 61440)) { + }, ab: function(a6, b4, c4, d6) { + return Q3.createNode(a6, b4, c4, d6); + }, rename: function(a6, b4, c4) { + if (16384 === (a6.mode & 61440)) { try { - var d5 = yb(b4, c4); + var d6 = yb(b4, c4); } catch (h5) { } - if (d5) - for (var f4 in d5.Ia) + if (d6) + for (var f4 in d6.Ia) throw new P4(55); } - delete a5.parent.Ia[a5.name]; - a5.parent.timestamp = Date.now(); - a5.name = c4; - b4.Ia[c4] = a5; - b4.timestamp = a5.parent.timestamp; - a5.parent = b4; - }, unlink: function(a5, b4) { - delete a5.Ia[b4]; - a5.timestamp = Date.now(); - }, rmdir: function(a5, b4) { - var c4 = yb(a5, b4), d5; - for (d5 in c4.Ia) + delete a6.parent.Ia[a6.name]; + a6.parent.timestamp = Date.now(); + a6.name = c4; + b4.Ia[c4] = a6; + b4.timestamp = a6.parent.timestamp; + a6.parent = b4; + }, unlink: function(a6, b4) { + delete a6.Ia[b4]; + a6.timestamp = Date.now(); + }, rmdir: function(a6, b4) { + var c4 = yb(a6, b4), d6; + for (d6 in c4.Ia) throw new P4(55); - delete a5.Ia[b4]; - a5.timestamp = Date.now(); - }, readdir: function(a5) { + delete a6.Ia[b4]; + a6.timestamp = Date.now(); + }, readdir: function(a6) { var b4 = [".", ".."], c4; - for (c4 in a5.Ia) - a5.Ia.hasOwnProperty(c4) && b4.push(c4); + for (c4 in a6.Ia) + a6.Ia.hasOwnProperty(c4) && b4.push(c4); return b4; - }, symlink: function(a5, b4, c4) { - a5 = Q3.createNode(a5, b4, 41471, 0); - a5.link = c4; - return a5; - }, readlink: function(a5) { - if (40960 !== (a5.mode & 61440)) + }, symlink: function(a6, b4, c4) { + a6 = Q3.createNode(a6, b4, 41471, 0); + a6.link = c4; + return a6; + }, readlink: function(a6) { + if (40960 !== (a6.mode & 61440)) throw new P4(28); - return a5.link; - } }, Ha: { read: function(a5, b4, c4, d5, f4) { - var h5 = a5.node.Ia; - if (f4 >= a5.node.Ma) + return a6.link; + } }, Ha: { read: function(a6, b4, c4, d6, f4) { + var h5 = a6.node.Ia; + if (f4 >= a6.node.Ma) return 0; - a5 = Math.min(a5.node.Ma - f4, d5); - if (8 < a5 && h5.subarray) - b4.set(h5.subarray(f4, f4 + a5), c4); + a6 = Math.min(a6.node.Ma - f4, d6); + if (8 < a6 && h5.subarray) + b4.set(h5.subarray(f4, f4 + a6), c4); else - for (d5 = 0; d5 < a5; d5++) - b4[c4 + d5] = h5[f4 + d5]; - return a5; - }, write: function(a5, b4, c4, d5, f4, h5) { + for (d6 = 0; d6 < a6; d6++) + b4[c4 + d6] = h5[f4 + d6]; + return a6; + }, write: function(a6, b4, c4, d6, f4, h5) { b4.buffer === r3.buffer && (h5 = false); - if (!d5) + if (!d6) return 0; - a5 = a5.node; - a5.timestamp = Date.now(); - if (b4.subarray && (!a5.Ia || a5.Ia.subarray)) { + a6 = a6.node; + a6.timestamp = Date.now(); + if (b4.subarray && (!a6.Ia || a6.Ia.subarray)) { if (h5) - return a5.Ia = b4.subarray(c4, c4 + d5), a5.Ma = d5; - if (0 === a5.Ma && 0 === f4) - return a5.Ia = b4.slice(c4, c4 + d5), a5.Ma = d5; - if (f4 + d5 <= a5.Ma) - return a5.Ia.set(b4.subarray(c4, c4 + d5), f4), d5; - } - Q3.qb(a5, f4 + d5); - if (a5.Ia.subarray && b4.subarray) - a5.Ia.set(b4.subarray(c4, c4 + d5), f4); + return a6.Ia = b4.subarray(c4, c4 + d6), a6.Ma = d6; + if (0 === a6.Ma && 0 === f4) + return a6.Ia = b4.slice(c4, c4 + d6), a6.Ma = d6; + if (f4 + d6 <= a6.Ma) + return a6.Ia.set(b4.subarray(c4, c4 + d6), f4), d6; + } + Q3.qb(a6, f4 + d6); + if (a6.Ia.subarray && b4.subarray) + a6.Ia.set(b4.subarray(c4, c4 + d6), f4); else - for (h5 = 0; h5 < d5; h5++) - a5.Ia[f4 + h5] = b4[c4 + h5]; - a5.Ma = Math.max(a5.Ma, f4 + d5); - return d5; - }, Ta: function(a5, b4, c4) { - 1 === c4 ? b4 += a5.position : 2 === c4 && 32768 === (a5.node.mode & 61440) && (b4 += a5.node.Ma); + for (h5 = 0; h5 < d6; h5++) + a6.Ia[f4 + h5] = b4[c4 + h5]; + a6.Ma = Math.max(a6.Ma, f4 + d6); + return d6; + }, Ta: function(a6, b4, c4) { + 1 === c4 ? b4 += a6.position : 2 === c4 && 32768 === (a6.node.mode & 61440) && (b4 += a6.node.Ma); if (0 > b4) throw new P4(28); return b4; - }, lb: function(a5, b4, c4) { - Q3.qb(a5.node, b4 + c4); - a5.node.Ma = Math.max(a5.node.Ma, b4 + c4); - }, bb: function(a5, b4, c4, d5, f4) { - if (32768 !== (a5.node.mode & 61440)) + }, lb: function(a6, b4, c4) { + Q3.qb(a6.node, b4 + c4); + a6.node.Ma = Math.max(a6.node.Ma, b4 + c4); + }, bb: function(a6, b4, c4, d6, f4) { + if (32768 !== (a6.node.mode & 61440)) throw new P4(43); - a5 = a5.node.Ia; - if (f4 & 2 || a5.buffer !== Na) { - if (0 < c4 || c4 + b4 < a5.length) - a5.subarray ? a5 = a5.subarray(c4, c4 + b4) : a5 = Array.prototype.slice.call( - a5, + a6 = a6.node.Ia; + if (f4 & 2 || a6.buffer !== Na) { + if (0 < c4 || c4 + b4 < a6.length) + a6.subarray ? a6 = a6.subarray(c4, c4 + b4) : a6 = Array.prototype.slice.call( + a6, c4, c4 + b4 ); @@ -15041,118 +15182,118 @@ var require_sql_wasm = __commonJS({ (f4 = zb(65536, b4)) ? (u4.fill(0, f4, f4 + b4), b4 = f4) : b4 = 0; if (!b4) throw new P4(48); - r3.set(a5, b4); + r3.set(a6, b4); } else - c4 = false, b4 = a5.byteOffset; + c4 = false, b4 = a6.byteOffset; return { Fb: b4, vb: c4 }; - }, cb: function(a5, b4, c4, d5, f4) { - if (32768 !== (a5.node.mode & 61440)) + }, cb: function(a6, b4, c4, d6, f4) { + if (32768 !== (a6.node.mode & 61440)) throw new P4(43); if (f4 & 2) return 0; - Q3.Ha.write(a5, b4, 0, d5, c4, false); + Q3.Ha.write(a6, b4, 0, d6, c4, false); return 0; - } } }, Ab = null, Bb = {}, R3 = [], Cb = 1, T6 = null, Db = true, P4 = null, xb = {}, U2 = (a5, b4 = {}) => { - a5 = hb("/", a5); - if (!a5) + } } }, Ab = null, Bb = {}, R3 = [], Cb = 1, T6 = null, Db = true, P4 = null, xb = {}, U2 = (a6, b4 = {}) => { + a6 = hb("/", a6); + if (!a6) return { path: "", node: null }; b4 = Object.assign({ rb: true, kb: 0 }, b4); if (8 < b4.kb) throw new P4(32); - a5 = db(a5.split("/").filter((k5) => !!k5), false); - for (var c4 = Ab, d5 = "/", f4 = 0; f4 < a5.length; f4++) { - var h5 = f4 === a5.length - 1; + a6 = db(a6.split("/").filter((k5) => !!k5), false); + for (var c4 = Ab, d6 = "/", f4 = 0; f4 < a6.length; f4++) { + var h5 = f4 === a6.length - 1; if (h5 && b4.parent) break; - c4 = yb(c4, a5[f4]); - d5 = z5(d5 + "/" + a5[f4]); + c4 = yb(c4, a6[f4]); + d6 = z5(d6 + "/" + a6[f4]); c4.Va && (!h5 || h5 && b4.rb) && (c4 = c4.Va.root); if (!h5 || b4.Sa) { for (h5 = 0; 40960 === (c4.mode & 61440); ) - if (c4 = Eb(d5), d5 = hb(eb(d5), c4), c4 = U2(d5, { kb: b4.kb + 1 }).node, 40 < h5++) + if (c4 = Eb(d6), d6 = hb(eb(d6), c4), c4 = U2(d6, { kb: b4.kb + 1 }).node, 40 < h5++) throw new P4(32); } } - return { path: d5, node: c4 }; - }, ea = (a5) => { + return { path: d6, node: c4 }; + }, ea = (a6) => { for (var b4; ; ) { - if (a5 === a5.parent) - return a5 = a5.Ra.ub, b4 ? "/" !== a5[a5.length - 1] ? a5 + "/" + b4 : a5 + b4 : a5; - b4 = b4 ? a5.name + "/" + b4 : a5.name; - a5 = a5.parent; - } - }, Fb = (a5, b4) => { - for (var c4 = 0, d5 = 0; d5 < b4.length; d5++) - c4 = (c4 << 5) - c4 + b4.charCodeAt(d5) | 0; - return (a5 + c4 >>> 0) % T6.length; - }, Gb = (a5) => { - var b4 = Fb(a5.parent.id, a5.name); - if (T6[b4] === a5) - T6[b4] = a5.Wa; + if (a6 === a6.parent) + return a6 = a6.Ra.ub, b4 ? "/" !== a6[a6.length - 1] ? a6 + "/" + b4 : a6 + b4 : a6; + b4 = b4 ? a6.name + "/" + b4 : a6.name; + a6 = a6.parent; + } + }, Fb = (a6, b4) => { + for (var c4 = 0, d6 = 0; d6 < b4.length; d6++) + c4 = (c4 << 5) - c4 + b4.charCodeAt(d6) | 0; + return (a6 + c4 >>> 0) % T6.length; + }, Gb = (a6) => { + var b4 = Fb(a6.parent.id, a6.name); + if (T6[b4] === a6) + T6[b4] = a6.Wa; else for (b4 = T6[b4]; b4; ) { - if (b4.Wa === a5) { - b4.Wa = a5.Wa; + if (b4.Wa === a6) { + b4.Wa = a6.Wa; break; } b4 = b4.Wa; } - }, yb = (a5, b4) => { + }, yb = (a6, b4) => { var c4; - if (c4 = (c4 = Hb(a5, "x")) ? c4 : a5.Ga.lookup ? 0 : 2) - throw new P4(c4, a5); - for (c4 = T6[Fb(a5.id, b4)]; c4; c4 = c4.Wa) { - var d5 = c4.name; - if (c4.parent.id === a5.id && d5 === b4) + if (c4 = (c4 = Hb(a6, "x")) ? c4 : a6.Ga.lookup ? 0 : 2) + throw new P4(c4, a6); + for (c4 = T6[Fb(a6.id, b4)]; c4; c4 = c4.Wa) { + var d6 = c4.name; + if (c4.parent.id === a6.id && d6 === b4) return c4; } - return a5.Ga.lookup(a5, b4); - }, wb = (a5, b4, c4, d5) => { - a5 = new Ib(a5, b4, c4, d5); - b4 = Fb(a5.parent.id, a5.name); - a5.Wa = T6[b4]; - return T6[b4] = a5; - }, Jb = { r: 0, "r+": 2, w: 577, "w+": 578, a: 1089, "a+": 1090 }, Kb = (a5) => { - var b4 = ["r", "w", "rw"][a5 & 3]; - a5 & 512 && (b4 += "w"); + return a6.Ga.lookup(a6, b4); + }, wb = (a6, b4, c4, d6) => { + a6 = new Ib(a6, b4, c4, d6); + b4 = Fb(a6.parent.id, a6.name); + a6.Wa = T6[b4]; + return T6[b4] = a6; + }, Jb = { r: 0, "r+": 2, w: 577, "w+": 578, a: 1089, "a+": 1090 }, Kb = (a6) => { + var b4 = ["r", "w", "rw"][a6 & 3]; + a6 & 512 && (b4 += "w"); return b4; - }, Hb = (a5, b4) => { + }, Hb = (a6, b4) => { if (Db) return 0; - if (!b4.includes("r") || a5.mode & 292) { - if (b4.includes("w") && !(a5.mode & 146) || b4.includes("x") && !(a5.mode & 73)) + if (!b4.includes("r") || a6.mode & 292) { + if (b4.includes("w") && !(a6.mode & 146) || b4.includes("x") && !(a6.mode & 73)) return 2; } else return 2; return 0; - }, Lb = (a5, b4) => { + }, Lb = (a6, b4) => { try { - return yb(a5, b4), 20; + return yb(a6, b4), 20; } catch (c4) { } - return Hb(a5, "wx"); - }, Mb = (a5, b4, c4) => { + return Hb(a6, "wx"); + }, Mb = (a6, b4, c4) => { try { - var d5 = yb(a5, b4); + var d6 = yb(a6, b4); } catch (f4) { return f4.Ka; } - if (a5 = Hb(a5, "wx")) - return a5; + if (a6 = Hb(a6, "wx")) + return a6; if (c4) { - if (16384 !== (d5.mode & 61440)) + if (16384 !== (d6.mode & 61440)) return 54; - if (d5 === d5.parent || "/" === ea(d5)) + if (d6 === d6.parent || "/" === ea(d6)) return 10; - } else if (16384 === (d5.mode & 61440)) + } else if (16384 === (d6.mode & 61440)) return 31; return 0; - }, Nb = (a5 = 0) => { - for (; 4096 >= a5; a5++) - if (!R3[a5]) - return a5; + }, Nb = (a6 = 0) => { + for (; 4096 >= a6; a6++) + if (!R3[a6]) + return a6; throw new P4(33); - }, Pb = (a5, b4) => { + }, Pb = (a6, b4) => { Ob || (Ob = function() { this.$a = {}; }, Ob.prototype = {}, Object.defineProperties(Ob.prototype, { object: { get: function() { @@ -15168,22 +15309,22 @@ var require_sql_wasm = __commonJS({ }, set: function(c4) { this.$a.position = c4; } } })); - a5 = Object.assign(new Ob(), a5); + a6 = Object.assign(new Ob(), a6); b4 = Nb(b4); - a5.fd = b4; - return R3[b4] = a5; - }, vb = { open: (a5) => { - a5.Ha = Bb[a5.node.rdev].Ha; - a5.Ha.open && a5.Ha.open(a5); + a6.fd = b4; + return R3[b4] = a6; + }, vb = { open: (a6) => { + a6.Ha = Bb[a6.node.rdev].Ha; + a6.Ha.open && a6.Ha.open(a6); }, Ta: () => { throw new P4(70); - } }, lb = (a5, b4) => { - Bb[a5] = { Ha: b4 }; - }, Qb = (a5, b4) => { - var c4 = "/" === b4, d5 = !b4; + } }, lb = (a6, b4) => { + Bb[a6] = { Ha: b4 }; + }, Qb = (a6, b4) => { + var c4 = "/" === b4, d6 = !b4; if (c4 && Ab) throw new P4(10); - if (!c4 && !d5) { + if (!c4 && !d6) { var f4 = U2(b4, { rb: false }); b4 = f4.path; f4 = f4.node; @@ -15192,228 +15333,228 @@ var require_sql_wasm = __commonJS({ if (16384 !== (f4.mode & 61440)) throw new P4(54); } - b4 = { type: a5, Kb: {}, ub: b4, Eb: [] }; - a5 = a5.Ra(b4); - a5.Ra = b4; - b4.root = a5; - c4 ? Ab = a5 : f4 && (f4.Va = b4, f4.Ra && f4.Ra.Eb.push(b4)); - }, ha = (a5, b4, c4) => { - var d5 = U2(a5, { parent: true }).node; - a5 = fb(a5); - if (!a5 || "." === a5 || ".." === a5) + b4 = { type: a6, Kb: {}, ub: b4, Eb: [] }; + a6 = a6.Ra(b4); + a6.Ra = b4; + b4.root = a6; + c4 ? Ab = a6 : f4 && (f4.Va = b4, f4.Ra && f4.Ra.Eb.push(b4)); + }, ha = (a6, b4, c4) => { + var d6 = U2(a6, { parent: true }).node; + a6 = fb(a6); + if (!a6 || "." === a6 || ".." === a6) throw new P4(28); - var f4 = Lb(d5, a5); + var f4 = Lb(d6, a6); if (f4) throw new P4(f4); - if (!d5.Ga.ab) + if (!d6.Ga.ab) throw new P4(63); - return d5.Ga.ab(d5, a5, b4, c4); - }, V3 = (a5, b4) => ha(a5, (void 0 !== b4 ? b4 : 511) & 1023 | 16384, 0), Rb = (a5, b4, c4) => { + return d6.Ga.ab(d6, a6, b4, c4); + }, V3 = (a6, b4) => ha(a6, (void 0 !== b4 ? b4 : 511) & 1023 | 16384, 0), Rb = (a6, b4, c4) => { "undefined" == typeof c4 && (c4 = b4, b4 = 438); - ha(a5, b4 | 8192, c4); - }, Sb = (a5, b4) => { - if (!hb(a5)) + ha(a6, b4 | 8192, c4); + }, Sb = (a6, b4) => { + if (!hb(a6)) throw new P4(44); var c4 = U2(b4, { parent: true }).node; if (!c4) throw new P4(44); b4 = fb(b4); - var d5 = Lb(c4, b4); - if (d5) - throw new P4(d5); + var d6 = Lb(c4, b4); + if (d6) + throw new P4(d6); if (!c4.Ga.symlink) throw new P4(63); - c4.Ga.symlink(c4, b4, a5); - }, Tb = (a5) => { - var b4 = U2(a5, { parent: true }).node; - a5 = fb(a5); - var c4 = yb(b4, a5), d5 = Mb(b4, a5, true); - if (d5) - throw new P4(d5); + c4.Ga.symlink(c4, b4, a6); + }, Tb = (a6) => { + var b4 = U2(a6, { parent: true }).node; + a6 = fb(a6); + var c4 = yb(b4, a6), d6 = Mb(b4, a6, true); + if (d6) + throw new P4(d6); if (!b4.Ga.rmdir) throw new P4(63); if (c4.Va) throw new P4(10); - b4.Ga.rmdir(b4, a5); + b4.Ga.rmdir(b4, a6); Gb(c4); - }, ta = (a5) => { - var b4 = U2(a5, { parent: true }).node; + }, ta = (a6) => { + var b4 = U2(a6, { parent: true }).node; if (!b4) throw new P4(44); - a5 = fb(a5); - var c4 = yb(b4, a5), d5 = Mb(b4, a5, false); - if (d5) - throw new P4(d5); + a6 = fb(a6); + var c4 = yb(b4, a6), d6 = Mb(b4, a6, false); + if (d6) + throw new P4(d6); if (!b4.Ga.unlink) throw new P4(63); if (c4.Va) throw new P4(10); - b4.Ga.unlink(b4, a5); + b4.Ga.unlink(b4, a6); Gb(c4); - }, Eb = (a5) => { - a5 = U2(a5).node; - if (!a5) + }, Eb = (a6) => { + a6 = U2(a6).node; + if (!a6) throw new P4(44); - if (!a5.Ga.readlink) + if (!a6.Ga.readlink) throw new P4(28); - return hb(ea(a5.parent), a5.Ga.readlink(a5)); - }, Ub = (a5, b4) => { - a5 = U2(a5, { Sa: !b4 }).node; - if (!a5) + return hb(ea(a6.parent), a6.Ga.readlink(a6)); + }, Ub = (a6, b4) => { + a6 = U2(a6, { Sa: !b4 }).node; + if (!a6) throw new P4(44); - if (!a5.Ga.Pa) + if (!a6.Ga.Pa) throw new P4(63); - return a5.Ga.Pa(a5); - }, Vb = (a5) => Ub(a5, true), ia = (a5, b4) => { - a5 = "string" == typeof a5 ? U2(a5, { Sa: true }).node : a5; - if (!a5.Ga.Oa) + return a6.Ga.Pa(a6); + }, Vb = (a6) => Ub(a6, true), ia = (a6, b4) => { + a6 = "string" == typeof a6 ? U2(a6, { Sa: true }).node : a6; + if (!a6.Ga.Oa) throw new P4(63); - a5.Ga.Oa(a5, { mode: b4 & 4095 | a5.mode & -4096, timestamp: Date.now() }); - }, Wb = (a5, b4) => { + a6.Ga.Oa(a6, { mode: b4 & 4095 | a6.mode & -4096, timestamp: Date.now() }); + }, Wb = (a6, b4) => { if (0 > b4) throw new P4(28); - a5 = "string" == typeof a5 ? U2(a5, { Sa: true }).node : a5; - if (!a5.Ga.Oa) + a6 = "string" == typeof a6 ? U2(a6, { Sa: true }).node : a6; + if (!a6.Ga.Oa) throw new P4(63); - if (16384 === (a5.mode & 61440)) + if (16384 === (a6.mode & 61440)) throw new P4(31); - if (32768 !== (a5.mode & 61440)) + if (32768 !== (a6.mode & 61440)) throw new P4(28); - var c4 = Hb(a5, "w"); + var c4 = Hb(a6, "w"); if (c4) throw new P4(c4); - a5.Ga.Oa(a5, { size: b4, timestamp: Date.now() }); - }, ja = (a5, b4, c4) => { - if ("" === a5) + a6.Ga.Oa(a6, { size: b4, timestamp: Date.now() }); + }, ja = (a6, b4, c4) => { + if ("" === a6) throw new P4(44); if ("string" == typeof b4) { - var d5 = Jb[b4]; - if ("undefined" == typeof d5) + var d6 = Jb[b4]; + if ("undefined" == typeof d6) throw Error("Unknown file open mode: " + b4); - b4 = d5; + b4 = d6; } c4 = b4 & 64 ? ("undefined" == typeof c4 ? 438 : c4) & 4095 | 32768 : 0; - if ("object" == typeof a5) - var f4 = a5; + if ("object" == typeof a6) + var f4 = a6; else { - a5 = z5(a5); + a6 = z5(a6); try { - f4 = U2(a5, { Sa: !(b4 & 131072) }).node; + f4 = U2(a6, { Sa: !(b4 & 131072) }).node; } catch (h5) { } } - d5 = false; + d6 = false; if (b4 & 64) if (f4) { if (b4 & 128) throw new P4(20); } else - f4 = ha(a5, c4, 0), d5 = true; + f4 = ha(a6, c4, 0), d6 = true; if (!f4) throw new P4(44); 8192 === (f4.mode & 61440) && (b4 &= -513); if (b4 & 65536 && 16384 !== (f4.mode & 61440)) throw new P4(54); - if (!d5 && (c4 = f4 ? 40960 === (f4.mode & 61440) ? 32 : 16384 === (f4.mode & 61440) && ("r" !== Kb(b4) || b4 & 512) ? 31 : Hb(f4, Kb(b4)) : 44)) + if (!d6 && (c4 = f4 ? 40960 === (f4.mode & 61440) ? 32 : 16384 === (f4.mode & 61440) && ("r" !== Kb(b4) || b4 & 512) ? 31 : Hb(f4, Kb(b4)) : 44)) throw new P4(c4); - b4 & 512 && !d5 && Wb(f4, 0); + b4 & 512 && !d6 && Wb(f4, 0); b4 &= -131713; f4 = Pb({ node: f4, path: ea(f4), flags: b4, seekable: true, position: 0, Ha: f4.Ha, Ib: [], error: false }); f4.Ha.open && f4.Ha.open(f4); - !e4.logReadFiles || b4 & 1 || (Xb || (Xb = {}), a5 in Xb || (Xb[a5] = 1)); + !e4.logReadFiles || b4 & 1 || (Xb || (Xb = {}), a6 in Xb || (Xb[a6] = 1)); return f4; - }, la = (a5) => { - if (null === a5.fd) + }, la = (a6) => { + if (null === a6.fd) throw new P4(8); - a5.hb && (a5.hb = null); + a6.hb && (a6.hb = null); try { - a5.Ha.close && a5.Ha.close(a5); + a6.Ha.close && a6.Ha.close(a6); } catch (b4) { throw b4; } finally { - R3[a5.fd] = null; + R3[a6.fd] = null; } - a5.fd = null; - }, Yb = (a5, b4, c4) => { - if (null === a5.fd) + a6.fd = null; + }, Yb = (a6, b4, c4) => { + if (null === a6.fd) throw new P4(8); - if (!a5.seekable || !a5.Ha.Ta) + if (!a6.seekable || !a6.Ha.Ta) throw new P4(70); if (0 != c4 && 1 != c4 && 2 != c4) throw new P4(28); - a5.position = a5.Ha.Ta(a5, b4, c4); - a5.Ib = []; - }, Zb = (a5, b4, c4, d5, f4) => { - if (0 > d5 || 0 > f4) + a6.position = a6.Ha.Ta(a6, b4, c4); + a6.Ib = []; + }, Zb = (a6, b4, c4, d6, f4) => { + if (0 > d6 || 0 > f4) throw new P4(28); - if (null === a5.fd) + if (null === a6.fd) throw new P4(8); - if (1 === (a5.flags & 2097155)) + if (1 === (a6.flags & 2097155)) throw new P4(8); - if (16384 === (a5.node.mode & 61440)) + if (16384 === (a6.node.mode & 61440)) throw new P4(31); - if (!a5.Ha.read) + if (!a6.Ha.read) throw new P4(28); var h5 = "undefined" != typeof f4; if (!h5) - f4 = a5.position; - else if (!a5.seekable) + f4 = a6.position; + else if (!a6.seekable) throw new P4(70); - b4 = a5.Ha.read(a5, b4, c4, d5, f4); - h5 || (a5.position += b4); + b4 = a6.Ha.read(a6, b4, c4, d6, f4); + h5 || (a6.position += b4); return b4; - }, ka = (a5, b4, c4, d5, f4) => { - if (0 > d5 || 0 > f4) + }, ka = (a6, b4, c4, d6, f4) => { + if (0 > d6 || 0 > f4) throw new P4(28); - if (null === a5.fd) + if (null === a6.fd) throw new P4(8); - if (0 === (a5.flags & 2097155)) + if (0 === (a6.flags & 2097155)) throw new P4(8); - if (16384 === (a5.node.mode & 61440)) + if (16384 === (a6.node.mode & 61440)) throw new P4(31); - if (!a5.Ha.write) + if (!a6.Ha.write) throw new P4(28); - a5.seekable && a5.flags & 1024 && Yb(a5, 0, 2); + a6.seekable && a6.flags & 1024 && Yb(a6, 0, 2); var h5 = "undefined" != typeof f4; if (!h5) - f4 = a5.position; - else if (!a5.seekable) + f4 = a6.position; + else if (!a6.seekable) throw new P4(70); - b4 = a5.Ha.write(a5, b4, c4, d5, f4, void 0); - h5 || (a5.position += b4); + b4 = a6.Ha.write(a6, b4, c4, d6, f4, void 0); + h5 || (a6.position += b4); return b4; - }, sa = (a5) => { + }, sa = (a6) => { var b4 = "binary"; if ("utf8" !== b4 && "binary" !== b4) throw Error('Invalid encoding type "' + b4 + '"'); var c4; - var d5 = ja(a5, d5 || 0); - a5 = Ub(a5).size; - var f4 = new Uint8Array(a5); - Zb(d5, f4, 0, a5, 0); + var d6 = ja(a6, d6 || 0); + a6 = Ub(a6).size; + var f4 = new Uint8Array(a6); + Zb(d6, f4, 0, a6, 0); "utf8" === b4 ? c4 = Ma(f4, 0) : "binary" === b4 && (c4 = f4); - la(d5); + la(d6); return c4; }, $b = () => { - P4 || (P4 = function(a5, b4) { + P4 || (P4 = function(a6, b4) { this.node = b4; this.Hb = function(c4) { this.Ka = c4; }; - this.Hb(a5); + this.Hb(a6); this.message = "FS error"; - }, P4.prototype = Error(), P4.prototype.constructor = P4, [44].forEach((a5) => { - xb[a5] = new P4(a5); - xb[a5].stack = ""; + }, P4.prototype = Error(), P4.prototype.constructor = P4, [44].forEach((a6) => { + xb[a6] = new P4(a6); + xb[a6].stack = ""; })); - }, ac, fa = (a5, b4) => { + }, ac, fa = (a6, b4) => { var c4 = 0; - a5 && (c4 |= 365); + a6 && (c4 |= 365); b4 && (c4 |= 146); return c4; - }, cc = (a5, b4, c4) => { - a5 = z5("/dev/" + a5); - var d5 = fa(!!b4, !!c4); + }, cc = (a6, b4, c4) => { + a6 = z5("/dev/" + a6); + var d6 = fa(!!b4, !!c4); bc || (bc = 64); var f4 = bc++ << 8 | 0; lb(f4, { open: (h5) => { @@ -15446,52 +15587,52 @@ var require_sql_wasm = __commonJS({ x5 && (h5.node.timestamp = Date.now()); return w5; } }); - Rb(a5, d5, f4); + Rb(a6, d6, f4); }, bc, W2 = {}, Ob, Xb; - function dc(a5, b4, c4) { + function dc(a6, b4, c4) { if ("/" === b4.charAt(0)) return b4; - a5 = -100 === a5 ? "/" : X3(a5).path; + a6 = -100 === a6 ? "/" : X3(a6).path; if (0 == b4.length) { if (!c4) throw new P4(44); - return a5; + return a6; } - return z5(a5 + "/" + b4); + return z5(a6 + "/" + b4); } - function ec(a5, b4, c4) { + function ec(a6, b4, c4) { try { - var d5 = a5(b4); + var d6 = a6(b4); } catch (f4) { if (f4 && f4.node && z5(b4) !== z5(ea(f4.node))) return -54; throw f4; } - F4[c4 >> 2] = d5.dev; - F4[c4 + 8 >> 2] = d5.ino; - F4[c4 + 12 >> 2] = d5.mode; - J2[c4 + 16 >> 2] = d5.nlink; - F4[c4 + 20 >> 2] = d5.uid; - F4[c4 + 24 >> 2] = d5.gid; - F4[c4 + 28 >> 2] = d5.rdev; - O4 = [d5.size >>> 0, (N3 = d5.size, 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; + F4[c4 >> 2] = d6.dev; + F4[c4 + 8 >> 2] = d6.ino; + F4[c4 + 12 >> 2] = d6.mode; + J2[c4 + 16 >> 2] = d6.nlink; + F4[c4 + 20 >> 2] = d6.uid; + F4[c4 + 24 >> 2] = d6.gid; + F4[c4 + 28 >> 2] = d6.rdev; + O4 = [d6.size >>> 0, (N3 = d6.size, 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; F4[c4 + 40 >> 2] = O4[0]; F4[c4 + 44 >> 2] = O4[1]; F4[c4 + 48 >> 2] = 4096; - F4[c4 + 52 >> 2] = d5.blocks; - O4 = [Math.floor(d5.atime.getTime() / 1e3) >>> 0, (N3 = Math.floor(d5.atime.getTime() / 1e3), 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; + F4[c4 + 52 >> 2] = d6.blocks; + O4 = [Math.floor(d6.atime.getTime() / 1e3) >>> 0, (N3 = Math.floor(d6.atime.getTime() / 1e3), 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; F4[c4 + 56 >> 2] = O4[0]; F4[c4 + 60 >> 2] = O4[1]; J2[c4 + 64 >> 2] = 0; - O4 = [Math.floor(d5.mtime.getTime() / 1e3) >>> 0, (N3 = Math.floor(d5.mtime.getTime() / 1e3), 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; + O4 = [Math.floor(d6.mtime.getTime() / 1e3) >>> 0, (N3 = Math.floor(d6.mtime.getTime() / 1e3), 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; F4[c4 + 72 >> 2] = O4[0]; F4[c4 + 76 >> 2] = O4[1]; J2[c4 + 80 >> 2] = 0; - O4 = [Math.floor(d5.ctime.getTime() / 1e3) >>> 0, (N3 = Math.floor(d5.ctime.getTime() / 1e3), 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; + O4 = [Math.floor(d6.ctime.getTime() / 1e3) >>> 0, (N3 = Math.floor(d6.ctime.getTime() / 1e3), 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; F4[c4 + 88 >> 2] = O4[0]; F4[c4 + 92 >> 2] = O4[1]; J2[c4 + 96 >> 2] = 0; - O4 = [d5.ino >>> 0, (N3 = d5.ino, 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; + O4 = [d6.ino >>> 0, (N3 = d6.ino, 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; F4[c4 + 104 >> 2] = O4[0]; F4[c4 + 108 >> 2] = O4[1]; return 0; @@ -15501,69 +15642,69 @@ var require_sql_wasm = __commonJS({ fc += 4; return F4[fc - 4 >> 2]; } - function X3(a5) { - a5 = R3[a5]; - if (!a5) + function X3(a6) { + a6 = R3[a6]; + if (!a6) throw new P4(8); - return a5; + return a6; } - function Jc(a5) { - return J2[a5 >> 2] + 4294967296 * F4[a5 + 4 >> 2]; + function Jc(a6) { + return J2[a6 >> 2] + 4294967296 * F4[a6 + 4 >> 2]; } - function Kc(a5) { - var b4 = ca(a5) + 1, c4 = da(b4); - c4 && t4(a5, r3, c4, b4); + function Kc(a6) { + var b4 = ca(a6) + 1, c4 = da(b4); + c4 && t5(a6, r3, c4, b4); return c4; } - function Lc(a5, b4, c4) { - function d5(x5) { + function Lc(a6, b4, c4) { + function d6(x5) { return (x5 = x5.toTimeString().match(/\(([A-Za-z ]+)\)$/)) ? x5[1] : "GMT"; } var f4 = new Date().getFullYear(), h5 = new Date(f4, 0, 1), k5 = new Date(f4, 6, 1); f4 = h5.getTimezoneOffset(); var q5 = k5.getTimezoneOffset(); - F4[a5 >> 2] = 60 * Math.max(f4, q5); + F4[a6 >> 2] = 60 * Math.max(f4, q5); F4[b4 >> 2] = Number(f4 != q5); - a5 = d5(h5); - b4 = d5(k5); - a5 = Kc(a5); + a6 = d6(h5); + b4 = d6(k5); + a6 = Kc(a6); b4 = Kc(b4); - q5 < f4 ? (J2[c4 >> 2] = a5, J2[c4 + 4 >> 2] = b4) : (J2[c4 >> 2] = b4, J2[c4 + 4 >> 2] = a5); + q5 < f4 ? (J2[c4 >> 2] = a6, J2[c4 + 4 >> 2] = b4) : (J2[c4 >> 2] = b4, J2[c4 + 4 >> 2] = a6); } - function Mc(a5, b4, c4) { - Mc.Bb || (Mc.Bb = true, Lc(a5, b4, c4)); + function Mc(a6, b4, c4) { + Mc.Bb || (Mc.Bb = true, Lc(a6, b4, c4)); } var Nc; Nc = Aa ? () => { - var a5 = process.hrtime(); - return 1e3 * a5[0] + a5[1] / 1e6; + var a6 = process.hrtime(); + return 1e3 * a6[0] + a6[1] / 1e6; } : () => performance.now(); var Oc = {}; function Pc() { if (!Qc) { - var a5 = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: ("object" == typeof navigator && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", _: wa || "./this.program" }, b4; + var a6 = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: ("object" == typeof navigator && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", _: wa || "./this.program" }, b4; for (b4 in Oc) - void 0 === Oc[b4] ? delete a5[b4] : a5[b4] = Oc[b4]; + void 0 === Oc[b4] ? delete a6[b4] : a6[b4] = Oc[b4]; var c4 = []; - for (b4 in a5) - c4.push(b4 + "=" + a5[b4]); + for (b4 in a6) + c4.push(b4 + "=" + a6[b4]); Qc = c4; } return Qc; } var Qc, Y3 = void 0, Rc = []; - function ua(a5, b4) { + function ua(a6, b4) { if (!Y3) { Y3 = /* @__PURE__ */ new WeakMap(); var c4 = K3.length; if (Y3) - for (var d5 = 0; d5 < 0 + c4; d5++) { - var f4 = K3.get(d5); - f4 && Y3.set(f4, d5); + for (var d6 = 0; d6 < 0 + c4; d6++) { + var f4 = K3.get(d6); + f4 && Y3.set(f4, d6); } } - if (Y3.has(a5)) - return Y3.get(a5); + if (Y3.has(a6)) + return Y3.get(a6); if (Rc.length) c4 = Rc.pop(); else { @@ -15577,60 +15718,60 @@ var require_sql_wasm = __commonJS({ c4 = K3.length - 1; } try { - K3.set(c4, a5); + K3.set(c4, a6); } catch (q5) { if (!(q5 instanceof TypeError)) throw q5; if ("function" == typeof WebAssembly.Function) { - d5 = WebAssembly.Function; + d6 = WebAssembly.Function; f4 = { i: "i32", j: "i64", f: "f32", d: "f64", p: "i32" }; for (var h5 = { parameters: [], results: "v" == b4[0] ? [] : [f4[b4[0]]] }, k5 = 1; k5 < b4.length; ++k5) h5.parameters.push(f4[b4[k5]]); - b4 = new d5(h5, a5); + b4 = new d6(h5, a6); } else { - d5 = [1, 96]; + d6 = [1, 96]; f4 = b4.slice(0, 1); b4 = b4.slice(1); h5 = { i: 127, p: 127, j: 126, f: 125, d: 124 }; k5 = b4.length; - 128 > k5 ? d5.push(k5) : d5.push(k5 % 128 | 128, k5 >> 7); + 128 > k5 ? d6.push(k5) : d6.push(k5 % 128 | 128, k5 >> 7); for (k5 = 0; k5 < b4.length; ++k5) - d5.push(h5[b4[k5]]); - "v" == f4 ? d5.push(0) : d5.push(1, h5[f4]); + d6.push(h5[b4[k5]]); + "v" == f4 ? d6.push(0) : d6.push(1, h5[f4]); b4 = [0, 97, 115, 109, 1, 0, 0, 0, 1]; - f4 = d5.length; + f4 = d6.length; 128 > f4 ? b4.push(f4) : b4.push(f4 % 128 | 128, f4 >> 7); - b4.push.apply(b4, d5); + b4.push.apply(b4, d6); b4.push(2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0); b4 = new WebAssembly.Module(new Uint8Array(b4)); - b4 = new WebAssembly.Instance(b4, { e: { f: a5 } }).exports.f; + b4 = new WebAssembly.Instance(b4, { e: { f: a6 } }).exports.f; } K3.set( c4, b4 ); } - Y3.set(a5, c4); + Y3.set(a6, c4); return c4; } - function ra(a5) { - Y3.delete(K3.get(a5)); - Rc.push(a5); + function ra(a6) { + Y3.delete(K3.get(a6)); + Rc.push(a6); } var Sc = 0, Tc = 1; - function aa(a5) { - var b4 = Sc == Tc ? B5(a5.length) : da(a5.length); - a5.subarray || a5.slice || (a5 = new Uint8Array(a5)); - u4.set(a5, b4); + function aa(a6) { + var b4 = Sc == Tc ? B5(a6.length) : da(a6.length); + a6.subarray || a6.slice || (a6 = new Uint8Array(a6)); + u4.set(a6, b4); return b4; } - function Uc(a5, b4, c4, d5) { + function Uc(a6, b4, c4, d6) { var f4 = { string: (w5) => { var A4 = 0; if (null !== w5 && void 0 !== w5 && 0 !== w5) { var S4 = (w5.length << 2) + 1; A4 = B5(S4); - t4(w5, u4, A4, S4); + t5(w5, u4, A4, S4); } return A4; }, array: (w5) => { @@ -15638,39 +15779,39 @@ var require_sql_wasm = __commonJS({ r3.set(w5, A4); return A4; } }; - a5 = e4["_" + a5]; + a6 = e4["_" + a6]; var h5 = [], k5 = 0; - if (d5) - for (var q5 = 0; q5 < d5.length; q5++) { + if (d6) + for (var q5 = 0; q5 < d6.length; q5++) { var x5 = f4[c4[q5]]; - x5 ? (0 === k5 && (k5 = oa()), h5[q5] = x5(d5[q5])) : h5[q5] = d5[q5]; + x5 ? (0 === k5 && (k5 = oa()), h5[q5] = x5(d6[q5])) : h5[q5] = d6[q5]; } - c4 = a5.apply(null, h5); + c4 = a6.apply(null, h5); return c4 = function(w5) { 0 !== k5 && qa(k5); return "string" === b4 ? C3(w5) : "boolean" === b4 ? !!w5 : w5; }(c4); } - function Ib(a5, b4, c4, d5) { - a5 || (a5 = this); - this.parent = a5; - this.Ra = a5.Ra; + function Ib(a6, b4, c4, d6) { + a6 || (a6 = this); + this.parent = a6; + this.Ra = a6.Ra; this.Va = null; this.id = Cb++; this.name = b4; this.mode = c4; this.Ga = {}; this.Ha = {}; - this.rdev = d5; + this.rdev = d6; } Object.defineProperties(Ib.prototype, { read: { get: function() { return 365 === (this.mode & 365); - }, set: function(a5) { - a5 ? this.mode |= 365 : this.mode &= -366; + }, set: function(a6) { + a6 ? this.mode |= 365 : this.mode &= -366; } }, write: { get: function() { return 146 === (this.mode & 146); - }, set: function(a5) { - a5 ? this.mode |= 146 : this.mode &= -147; + }, set: function(a6) { + a6 ? this.mode |= 146 : this.mode &= -147; } } }); $b(); T6 = Array(4096); @@ -15680,26 +15821,26 @@ var require_sql_wasm = __commonJS({ V3("/home/web_user"); (() => { V3("/dev"); - lb(259, { read: () => 0, write: (b4, c4, d5, f4) => f4 }); + lb(259, { read: () => 0, write: (b4, c4, d6, f4) => f4 }); Rb("/dev/null", 259); jb(1280, tb); jb(1536, ub); Rb("/dev/tty", 1280); Rb("/dev/tty1", 1536); - var a5 = gb(); - cc("random", a5); - cc("urandom", a5); + var a6 = gb(); + cc("random", a6); + cc("urandom", a6); V3("/dev/shm"); V3("/dev/shm/tmp"); })(); (() => { V3("/proc"); - var a5 = V3("/proc/self"); + var a6 = V3("/proc/self"); V3("/proc/self/fd"); Qb({ Ra: () => { - var b4 = wb(a5, "fd", 16895, 73); - b4.Ga = { lookup: (c4, d5) => { - var f4 = R3[+d5]; + var b4 = wb(a6, "fd", 16895, 73); + b4.Ga = { lookup: (c4, d6) => { + var f4 = R3[+d6]; if (!f4) throw new P4(8); c4 = { parent: null, Ra: { ub: "fake" }, Ga: { readlink: () => f4.path } }; @@ -15708,78 +15849,78 @@ var require_sql_wasm = __commonJS({ return b4; } }, "/proc/self/fd"); })(); - var Wc = { a: function(a5, b4, c4, d5) { - E4("Assertion failed: " + C3(a5) + ", at: " + [b4 ? C3(b4) : "unknown filename", c4, d5 ? C3(d5) : "unknown function"]); - }, h: function(a5, b4) { + var Wc = { a: function(a6, b4, c4, d6) { + E4("Assertion failed: " + C3(a6) + ", at: " + [b4 ? C3(b4) : "unknown filename", c4, d6 ? C3(d6) : "unknown function"]); + }, h: function(a6, b4) { try { - return a5 = C3(a5), ia(a5, b4), 0; + return a6 = C3(a6), ia(a6, b4), 0; } catch (c4) { if ("undefined" == typeof W2 || !(c4 instanceof P4)) throw c4; return -c4.Ka; } - }, H: function(a5, b4, c4) { + }, H: function(a6, b4, c4) { try { b4 = C3(b4); - b4 = dc(a5, b4); + b4 = dc(a6, b4); if (c4 & -8) return -28; - var d5 = U2(b4, { Sa: true }).node; - if (!d5) + var d6 = U2(b4, { Sa: true }).node; + if (!d6) return -44; - a5 = ""; - c4 & 4 && (a5 += "r"); - c4 & 2 && (a5 += "w"); - c4 & 1 && (a5 += "x"); - return a5 && Hb(d5, a5) ? -2 : 0; + a6 = ""; + c4 & 4 && (a6 += "r"); + c4 & 2 && (a6 += "w"); + c4 & 1 && (a6 += "x"); + return a6 && Hb(d6, a6) ? -2 : 0; } catch (f4) { if ("undefined" == typeof W2 || !(f4 instanceof P4)) throw f4; return -f4.Ka; } - }, i: function(a5, b4) { + }, i: function(a6, b4) { try { - var c4 = R3[a5]; + var c4 = R3[a6]; if (!c4) throw new P4(8); ia(c4.node, b4); return 0; - } catch (d5) { - if ("undefined" == typeof W2 || !(d5 instanceof P4)) - throw d5; - return -d5.Ka; + } catch (d6) { + if ("undefined" == typeof W2 || !(d6 instanceof P4)) + throw d6; + return -d6.Ka; } - }, g: function(a5) { + }, g: function(a6) { try { - var b4 = R3[a5]; + var b4 = R3[a6]; if (!b4) throw new P4(8); var c4 = b4.node; - var d5 = "string" == typeof c4 ? U2(c4, { Sa: true }).node : c4; - if (!d5.Ga.Oa) + var d6 = "string" == typeof c4 ? U2(c4, { Sa: true }).node : c4; + if (!d6.Ga.Oa) throw new P4(63); - d5.Ga.Oa(d5, { timestamp: Date.now() }); + d6.Ga.Oa(d6, { timestamp: Date.now() }); return 0; } catch (f4) { if ("undefined" == typeof W2 || !(f4 instanceof P4)) throw f4; return -f4.Ka; } - }, b: function(a5, b4, c4) { + }, b: function(a6, b4, c4) { fc = c4; try { - var d5 = X3(a5); + var d6 = X3(a6); switch (b4) { case 0: var f4 = Hc(); - return 0 > f4 ? -28 : Pb(d5, f4).fd; + return 0 > f4 ? -28 : Pb(d6, f4).fd; case 1: case 2: return 0; case 3: - return d5.flags; + return d6.flags; case 4: - return f4 = Hc(), d5.flags |= f4, 0; + return f4 = Hc(), d6.flags |= f4, 0; case 5: return f4 = Hc(), Oa[f4 + 0 >> 1] = 2, 0; case 6: @@ -15798,96 +15939,96 @@ var require_sql_wasm = __commonJS({ throw h5; return -h5.Ka; } - }, G: function(a5, b4) { + }, G: function(a6, b4) { try { - var c4 = X3(a5); + var c4 = X3(a6); return ec(Ub, c4.path, b4); - } catch (d5) { - if ("undefined" == typeof W2 || !(d5 instanceof P4)) - throw d5; - return -d5.Ka; + } catch (d6) { + if ("undefined" == typeof W2 || !(d6 instanceof P4)) + throw d6; + return -d6.Ka; } - }, l: function(a5, b4, c4) { + }, l: function(a6, b4, c4) { try { b4 = c4 + 2097152 >>> 0 < 4194305 - !!b4 ? (b4 >>> 0) + 4294967296 * c4 : NaN; if (isNaN(b4)) return -61; - var d5 = R3[a5]; - if (!d5) + var d6 = R3[a6]; + if (!d6) throw new P4(8); - if (0 === (d5.flags & 2097155)) + if (0 === (d6.flags & 2097155)) throw new P4(28); - Wb(d5.node, b4); + Wb(d6.node, b4); return 0; } catch (f4) { if ("undefined" == typeof W2 || !(f4 instanceof P4)) throw f4; return -f4.Ka; } - }, B: function(a5, b4) { + }, B: function(a6, b4) { try { if (0 === b4) return -28; var c4 = ca("/") + 1; if (b4 < c4) return -68; - t4("/", u4, a5, b4); + t5("/", u4, a6, b4); return c4; - } catch (d5) { - if ("undefined" == typeof W2 || !(d5 instanceof P4)) - throw d5; - return -d5.Ka; + } catch (d6) { + if ("undefined" == typeof W2 || !(d6 instanceof P4)) + throw d6; + return -d6.Ka; } - }, E: function(a5, b4) { + }, E: function(a6, b4) { try { - return a5 = C3(a5), ec(Vb, a5, b4); + return a6 = C3(a6), ec(Vb, a6, b4); } catch (c4) { if ("undefined" == typeof W2 || !(c4 instanceof P4)) throw c4; return -c4.Ka; } - }, y: function(a5, b4, c4) { + }, y: function(a6, b4, c4) { try { - return b4 = C3(b4), b4 = dc(a5, b4), b4 = z5(b4), "/" === b4[b4.length - 1] && (b4 = b4.substr(0, b4.length - 1)), V3(b4, c4), 0; - } catch (d5) { - if ("undefined" == typeof W2 || !(d5 instanceof P4)) - throw d5; - return -d5.Ka; + return b4 = C3(b4), b4 = dc(a6, b4), b4 = z5(b4), "/" === b4[b4.length - 1] && (b4 = b4.substr(0, b4.length - 1)), V3(b4, c4), 0; + } catch (d6) { + if ("undefined" == typeof W2 || !(d6 instanceof P4)) + throw d6; + return -d6.Ka; } - }, D: function(a5, b4, c4, d5) { + }, D: function(a6, b4, c4, d6) { try { b4 = C3(b4); - var f4 = d5 & 256; - b4 = dc(a5, b4, d5 & 4096); + var f4 = d6 & 256; + b4 = dc(a6, b4, d6 & 4096); return ec(f4 ? Vb : Ub, b4, c4); } catch (h5) { if ("undefined" == typeof W2 || !(h5 instanceof P4)) throw h5; return -h5.Ka; } - }, v: function(a5, b4, c4, d5) { - fc = d5; + }, v: function(a6, b4, c4, d6) { + fc = d6; try { b4 = C3(b4); - b4 = dc(a5, b4); - var f4 = d5 ? Hc() : 0; + b4 = dc(a6, b4); + var f4 = d6 ? Hc() : 0; return ja(b4, c4, f4).fd; } catch (h5) { if ("undefined" == typeof W2 || !(h5 instanceof P4)) throw h5; return -h5.Ka; } - }, t: function(a5, b4, c4, d5) { + }, t: function(a6, b4, c4, d6) { try { b4 = C3(b4); - b4 = dc(a5, b4); - if (0 >= d5) + b4 = dc(a6, b4); + if (0 >= d6) return -28; var f4 = Eb(b4), h5 = Math.min( - d5, + d6, ca(f4) ), k5 = r3[c4 + h5]; - t4(f4, u4, c4, d5 + 1); + t5(f4, u4, c4, d6 + 1); r3[c4 + h5] = k5; return h5; } catch (q5) { @@ -15895,46 +16036,46 @@ var require_sql_wasm = __commonJS({ throw q5; return -q5.Ka; } - }, s: function(a5) { + }, s: function(a6) { try { - return a5 = C3(a5), Tb(a5), 0; + return a6 = C3(a6), Tb(a6), 0; } catch (b4) { if ("undefined" == typeof W2 || !(b4 instanceof P4)) throw b4; return -b4.Ka; } - }, F: function(a5, b4) { + }, F: function(a6, b4) { try { - return a5 = C3(a5), ec(Ub, a5, b4); + return a6 = C3(a6), ec(Ub, a6, b4); } catch (c4) { if ("undefined" == typeof W2 || !(c4 instanceof P4)) throw c4; return -c4.Ka; } - }, p: function(a5, b4, c4) { + }, p: function(a6, b4, c4) { try { - return b4 = C3(b4), b4 = dc(a5, b4), 0 === c4 ? ta(b4) : 512 === c4 ? Tb(b4) : E4("Invalid flags passed to unlinkat"), 0; - } catch (d5) { - if ("undefined" == typeof W2 || !(d5 instanceof P4)) - throw d5; - return -d5.Ka; + return b4 = C3(b4), b4 = dc(a6, b4), 0 === c4 ? ta(b4) : 512 === c4 ? Tb(b4) : E4("Invalid flags passed to unlinkat"), 0; + } catch (d6) { + if ("undefined" == typeof W2 || !(d6 instanceof P4)) + throw d6; + return -d6.Ka; } - }, o: function(a5, b4, c4) { + }, o: function(a6, b4, c4) { try { b4 = C3(b4); - b4 = dc(a5, b4, true); + b4 = dc(a6, b4, true); if (c4) { - var d5 = Jc(c4), f4 = F4[c4 + 8 >> 2]; - h5 = 1e3 * d5 + f4 / 1e6; + var d6 = Jc(c4), f4 = F4[c4 + 8 >> 2]; + h5 = 1e3 * d6 + f4 / 1e6; c4 += 16; - d5 = Jc(c4); + d6 = Jc(c4); f4 = F4[c4 + 8 >> 2]; - k5 = 1e3 * d5 + f4 / 1e6; + k5 = 1e3 * d6 + f4 / 1e6; } else var h5 = Date.now(), k5 = h5; - a5 = h5; + a6 = h5; var q5 = U2(b4, { Sa: true }).node; - q5.Ga.Oa(q5, { timestamp: Math.max(a5, k5) }); + q5.Ga.Oa(q5, { timestamp: Math.max(a6, k5) }); return 0; } catch (x5) { if ("undefined" == typeof W2 || !(x5 instanceof P4)) @@ -15943,31 +16084,31 @@ var require_sql_wasm = __commonJS({ } }, e: function() { return Date.now(); - }, j: function(a5, b4) { - a5 = new Date(1e3 * Jc(a5)); - F4[b4 >> 2] = a5.getSeconds(); - F4[b4 + 4 >> 2] = a5.getMinutes(); - F4[b4 + 8 >> 2] = a5.getHours(); - F4[b4 + 12 >> 2] = a5.getDate(); - F4[b4 + 16 >> 2] = a5.getMonth(); - F4[b4 + 20 >> 2] = a5.getFullYear() - 1900; - F4[b4 + 24 >> 2] = a5.getDay(); - var c4 = new Date(a5.getFullYear(), 0, 1); - F4[b4 + 28 >> 2] = (a5.getTime() - c4.getTime()) / 864e5 | 0; - F4[b4 + 36 >> 2] = -(60 * a5.getTimezoneOffset()); - var d5 = new Date(a5.getFullYear(), 6, 1).getTimezoneOffset(); + }, j: function(a6, b4) { + a6 = new Date(1e3 * Jc(a6)); + F4[b4 >> 2] = a6.getSeconds(); + F4[b4 + 4 >> 2] = a6.getMinutes(); + F4[b4 + 8 >> 2] = a6.getHours(); + F4[b4 + 12 >> 2] = a6.getDate(); + F4[b4 + 16 >> 2] = a6.getMonth(); + F4[b4 + 20 >> 2] = a6.getFullYear() - 1900; + F4[b4 + 24 >> 2] = a6.getDay(); + var c4 = new Date(a6.getFullYear(), 0, 1); + F4[b4 + 28 >> 2] = (a6.getTime() - c4.getTime()) / 864e5 | 0; + F4[b4 + 36 >> 2] = -(60 * a6.getTimezoneOffset()); + var d6 = new Date(a6.getFullYear(), 6, 1).getTimezoneOffset(); c4 = c4.getTimezoneOffset(); - F4[b4 + 32 >> 2] = (d5 != c4 && a5.getTimezoneOffset() == Math.min(c4, d5)) | 0; - }, w: function(a5, b4, c4, d5, f4, h5) { + F4[b4 + 32 >> 2] = (d6 != c4 && a6.getTimezoneOffset() == Math.min(c4, d6)) | 0; + }, w: function(a6, b4, c4, d6, f4, h5) { try { - var k5 = X3(d5); + var k5 = X3(d6); if (0 !== (b4 & 2) && 0 === (c4 & 2) && 2 !== (k5.flags & 2097155)) throw new P4(2); if (1 === (k5.flags & 2097155)) throw new P4(2); if (!k5.Ha.bb) throw new P4(43); - var q5 = k5.Ha.bb(k5, a5, f4, b4, c4); + var q5 = k5.Ha.bb(k5, a6, f4, b4, c4); var x5 = q5.Fb; F4[h5 >> 2] = q5.vb; return x5; @@ -15976,12 +16117,12 @@ var require_sql_wasm = __commonJS({ throw w5; return -w5.Ka; } - }, x: function(a5, b4, c4, d5, f4, h5) { + }, x: function(a6, b4, c4, d6, f4, h5) { try { var k5 = X3(f4); if (c4 & 2) { - var q5 = u4.slice(a5, a5 + b4); - k5 && k5.Ha.cb && k5.Ha.cb(k5, q5, h5, b4, d5); + var q5 = u4.slice(a6, a6 + b4); + k5 && k5.Ha.cb && k5.Ha.cb(k5, q5, h5, b4, d6); } } catch (x5) { if ("undefined" == typeof W2 || !(x5 instanceof P4)) @@ -15990,20 +16131,20 @@ var require_sql_wasm = __commonJS({ } }, n: Mc, q: function() { return 2147483648; - }, d: Nc, c: function(a5) { + }, d: Nc, c: function(a6) { var b4 = u4.length; - a5 >>>= 0; - if (2147483648 < a5) + a6 >>>= 0; + if (2147483648 < a6) return false; for (var c4 = 1; 4 >= c4; c4 *= 2) { - var d5 = b4 * (1 + 0.2 / c4); - d5 = Math.min(d5, a5 + 100663296); + var d6 = b4 * (1 + 0.2 / c4); + d6 = Math.min(d6, a6 + 100663296); var f4 = Math; - d5 = Math.max( - a5, - d5 + d6 = Math.max( + a6, + d6 ); - f4 = f4.min.call(f4, 2147483648, d5 + (65536 - d5 % 65536) % 65536); + f4 = f4.min.call(f4, 2147483648, d6 + (65536 - d6 % 65536) % 65536); a: { try { Ja.grow(f4 - Na.byteLength + 65535 >>> 16); @@ -16018,29 +16159,29 @@ var require_sql_wasm = __commonJS({ return true; } return false; - }, z: function(a5, b4) { + }, z: function(a6, b4) { var c4 = 0; - Pc().forEach(function(d5, f4) { + Pc().forEach(function(d6, f4) { var h5 = b4 + c4; - f4 = J2[a5 + 4 * f4 >> 2] = h5; - for (h5 = 0; h5 < d5.length; ++h5) - r3[f4++ >> 0] = d5.charCodeAt(h5); + f4 = J2[a6 + 4 * f4 >> 2] = h5; + for (h5 = 0; h5 < d6.length; ++h5) + r3[f4++ >> 0] = d6.charCodeAt(h5); r3[f4 >> 0] = 0; - c4 += d5.length + 1; + c4 += d6.length + 1; }); return 0; - }, A: function(a5, b4) { + }, A: function(a6, b4) { var c4 = Pc(); - J2[a5 >> 2] = c4.length; - var d5 = 0; + J2[a6 >> 2] = c4.length; + var d6 = 0; c4.forEach(function(f4) { - d5 += f4.length + 1; + d6 += f4.length + 1; }); - J2[b4 >> 2] = d5; + J2[b4 >> 2] = d6; return 0; - }, f: function(a5) { + }, f: function(a6) { try { - var b4 = X3(a5); + var b4 = X3(a6); la(b4); return 0; } catch (c4) { @@ -16048,24 +16189,24 @@ var require_sql_wasm = __commonJS({ throw c4; return c4.Ka; } - }, m: function(a5, b4) { + }, m: function(a6, b4) { try { - var c4 = X3(a5); + var c4 = X3(a6); r3[b4 >> 0] = c4.tty ? 2 : 16384 === (c4.mode & 61440) ? 3 : 40960 === (c4.mode & 61440) ? 7 : 4; return 0; - } catch (d5) { - if ("undefined" == typeof W2 || !(d5 instanceof P4)) - throw d5; - return d5.Ka; + } catch (d6) { + if ("undefined" == typeof W2 || !(d6 instanceof P4)) + throw d6; + return d6.Ka; } - }, u: function(a5, b4, c4, d5) { + }, u: function(a6, b4, c4, d6) { try { a: { - var f4 = X3(a5); - a5 = b4; + var f4 = X3(a6); + a6 = b4; for (var h5 = b4 = 0; h5 < c4; h5++) { - var k5 = J2[a5 >> 2], q5 = J2[a5 + 4 >> 2]; - a5 += 8; + var k5 = J2[a6 >> 2], q5 = J2[a6 + 4 >> 2]; + a6 += 8; var x5 = Zb(f4, r3, k5, q5); if (0 > x5) { var w5 = -1; @@ -16077,47 +16218,47 @@ var require_sql_wasm = __commonJS({ } w5 = b4; } - J2[d5 >> 2] = w5; + J2[d6 >> 2] = w5; return 0; } catch (A4) { if ("undefined" == typeof W2 || !(A4 instanceof P4)) throw A4; return A4.Ka; } - }, k: function(a5, b4, c4, d5, f4) { + }, k: function(a6, b4, c4, d6, f4) { try { b4 = c4 + 2097152 >>> 0 < 4194305 - !!b4 ? (b4 >>> 0) + 4294967296 * c4 : NaN; if (isNaN(b4)) return 61; - var h5 = X3(a5); - Yb(h5, b4, d5); + var h5 = X3(a6); + Yb(h5, b4, d6); O4 = [h5.position >>> 0, (N3 = h5.position, 1 <= +Math.abs(N3) ? 0 < N3 ? (Math.min(+Math.floor(N3 / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((N3 - +(~~N3 >>> 0)) / 4294967296) >>> 0 : 0)]; F4[f4 >> 2] = O4[0]; F4[f4 + 4 >> 2] = O4[1]; - h5.hb && 0 === b4 && 0 === d5 && (h5.hb = null); + h5.hb && 0 === b4 && 0 === d6 && (h5.hb = null); return 0; } catch (k5) { if ("undefined" == typeof W2 || !(k5 instanceof P4)) throw k5; return k5.Ka; } - }, C: function(a5) { + }, C: function(a6) { try { - var b4 = X3(a5); + var b4 = X3(a6); return b4.Ha && b4.Ha.fsync ? b4.Ha.fsync(b4) : 0; } catch (c4) { if ("undefined" == typeof W2 || !(c4 instanceof P4)) throw c4; return c4.Ka; } - }, r: function(a5, b4, c4, d5) { + }, r: function(a6, b4, c4, d6) { try { a: { - var f4 = X3(a5); - a5 = b4; + var f4 = X3(a6); + a6 = b4; for (var h5 = b4 = 0; h5 < c4; h5++) { - var k5 = J2[a5 >> 2], q5 = J2[a5 + 4 >> 2]; - a5 += 8; + var k5 = J2[a6 >> 2], q5 = J2[a6 + 4 >> 2]; + a6 += 8; var x5 = ka(f4, r3, k5, q5); if (0 > x5) { var w5 = -1; @@ -16127,7 +16268,7 @@ var require_sql_wasm = __commonJS({ } w5 = b4; } - J2[d5 >> 2] = w5; + J2[d6 >> 2] = w5; return 0; } catch (A4) { if ("undefined" == typeof W2 || !(A4 instanceof P4)) @@ -16136,7 +16277,7 @@ var require_sql_wasm = __commonJS({ } } }; (function() { - function a5(f4) { + function a6(f4) { e4.asm = f4.exports; Ja = e4.asm.I; Ra(); @@ -16147,11 +16288,11 @@ var require_sql_wasm = __commonJS({ 0 == Wa && (null !== Xa && (clearInterval(Xa), Xa = null), Ya && (f4 = Ya, Ya = null, f4())); } function b4(f4) { - a5(f4.instance); + a6(f4.instance); } function c4(f4) { return bb().then(function(h5) { - return WebAssembly.instantiate(h5, d5); + return WebAssembly.instantiate(h5, d6); }).then(function(h5) { return h5; }).then(f4, function(h5) { @@ -16159,18 +16300,18 @@ var require_sql_wasm = __commonJS({ E4(h5); }); } - var d5 = { a: Wc }; + var d6 = { a: Wc }; Wa++; e4.monitorRunDependencies && e4.monitorRunDependencies(Wa); if (e4.instantiateWasm) try { - return e4.instantiateWasm(d5, a5); + return e4.instantiateWasm(d6, a6); } catch (f4) { return Ha("Module.instantiateWasm callback failed with error: " + f4), false; } (function() { return Ia || "function" != typeof WebAssembly.instantiateStreaming || Za() || M5.startsWith("file://") || Aa || "function" != typeof fetch ? c4(b4) : fetch(M5, { credentials: "same-origin" }).then(function(f4) { - return WebAssembly.instantiateStreaming(f4, d5).then(b4, function(h5) { + return WebAssembly.instantiateStreaming(f4, d6).then(b4, function(h5) { Ha("wasm streaming compile failed: " + h5); Ha("falling back to ArrayBuffer instantiation"); return c4(b4); @@ -16329,11 +16470,11 @@ var require_sql_wasm = __commonJS({ e4.stackAlloc = B5; e4.stackSave = oa; e4.stackRestore = qa; - e4.cwrap = function(a5, b4, c4, d5) { + e4.cwrap = function(a6, b4, c4, d6) { c4 = c4 || []; var f4 = c4.every((h5) => "number" === h5 || "boolean" === h5); - return "string" !== b4 && f4 && !d5 ? e4["_" + a5] : function() { - return Uc(a5, b4, c4, arguments); + return "string" !== b4 && f4 && !d6 ? e4["_" + a6] : function() { + return Uc(a6, b4, c4, arguments); }; }; var Xc; @@ -16342,7 +16483,7 @@ var require_sql_wasm = __commonJS({ Xc || (Ya = Yc); }; function Zc() { - function a5() { + function a6() { if (!Xc && (Xc = true, e4.calledRun = true, !Ka)) { e4.noFSInit || ac || (ac = true, $b(), e4.stdin = e4.stdin, e4.stdout = e4.stdout, e4.stderr = e4.stderr, e4.stdin ? cc("stdin", e4.stdin) : Sb("/dev/tty", "/dev/stdin"), e4.stdout ? cc("stdout", null, e4.stdout) : Sb("/dev/tty", "/dev/stdout"), e4.stderr ? cc("stderr", null, e4.stderr) : Sb("/dev/tty1", "/dev/stderr"), ja("/dev/stdin", 0), ja("/dev/stdout", 1), ja("/dev/stderr", 1)); Db = false; @@ -16366,8 +16507,8 @@ var require_sql_wasm = __commonJS({ setTimeout(function() { e4.setStatus(""); }, 1); - a5(); - }, 1)) : a5()); + a6(); + }, 1)) : a6()); } } if (e4.preInit) @@ -16412,14 +16553,14 @@ var TooltipViewManager = class { this.facet = facet; this.createTooltipView = createTooltipView; this.input = view.state.facet(facet); - this.tooltips = this.input.filter((t4) => t4); + this.tooltips = this.input.filter((t5) => t5); this.tooltipViews = this.tooltips.map(createTooltipView); } update(update) { if (update.focusChanged && !update.view.hasFocus) { const input2 = update.state.facet(this.facet); - for (const t4 of this.tooltipViews) - t4.dom.remove(); + for (const t5 of this.tooltipViews) + t5.dom.remove(); this.input = input2; this.tooltips = []; this.tooltipViews = []; @@ -16428,33 +16569,33 @@ var TooltipViewManager = class { const input = update.state.facet(this.facet); const tooltips2 = input.filter((x5) => x5); if (input === this.input) { - for (const t4 of this.tooltipViews) - if (t4.update) - t4.update(update); + for (const t5 of this.tooltipViews) + if (t5.update) + t5.update(update); return false; } const tooltipViews = []; - for (let i4 = 0; i4 < tooltips2.length; i4++) { - const tip = tooltips2[i4]; + for (let i5 = 0; i5 < tooltips2.length; i5++) { + const tip = tooltips2[i5]; let known = -1; if (!tip) continue; - for (let i5 = 0; i5 < this.tooltips.length; i5++) { - const other = this.tooltips[i5]; + for (let i6 = 0; i6 < this.tooltips.length; i6++) { + const other = this.tooltips[i6]; if (other && other.create == tip.create) - known = i5; + known = i6; } if (known < 0) { - tooltipViews[i4] = this.createTooltipView(tip); + tooltipViews[i5] = this.createTooltipView(tip); } else { - const tooltipView = tooltipViews[i4] = this.tooltipViews[known]; + const tooltipView = tooltipViews[i5] = this.tooltipViews[known]; if (tooltipView.update) tooltipView.update(update); } } - for (const t4 of this.tooltipViews) - if (tooltipViews.indexOf(t4) < 0) - t4.dom.remove(); + for (const t5 of this.tooltipViews) + if (tooltipViews.indexOf(t5) < 0) + t5.dom.remove(); this.input = input; this.tooltips = tooltips2; this.tooltipViews = tooltipViews; @@ -16498,7 +16639,7 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass( this.manager = new TooltipViewManager( view, showTooltip, - (t4) => this.createTooltip(t4) + (t5) => this.createTooltip(t5) ); this.intersectionObserver = typeof IntersectionObserver == "function" ? new IntersectionObserver( (entries) => { @@ -16548,8 +16689,8 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass( const newConfig = update.state.facet(tooltipConfig); if (newConfig.position != this.position) { this.position = newConfig.position; - for (const t4 of this.manager.tooltipViews) - t4.dom.style.position = this.position; + for (const t5 of this.manager.tooltipViews) + t5.dom.style.position = this.position; shouldMeasure = true; } if (newConfig.parent != this.parent) { @@ -16557,8 +16698,8 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass( this.container.remove(); this.parent = newConfig.parent; this.createContainer(); - for (const t4 of this.manager.tooltipViews) - this.container.appendChild(t4.dom); + for (const t5 of this.manager.tooltipViews) + this.container.appendChild(t5.dom); shouldMeasure = true; } else if (this.parent && this.view.themeClasses != this.classes) { this.classes = this.container.className = this.view.themeClasses; @@ -16597,9 +16738,9 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass( return { editor, parent: this.parent ? this.container.getBoundingClientRect() : editor, - pos: this.manager.tooltips.map((t4, i4) => { - const tv = this.manager.tooltipViews[i4]; - return tv.getCoords ? tv.getCoords(t4.pos) : this.view.coordsAtPos(t4.pos); + pos: this.manager.tooltips.map((t5, i5) => { + const tv = this.manager.tooltipViews[i5]; + return tv.getCoords ? tv.getCoords(t5.pos) : this.view.coordsAtPos(t5.pos); }), size: this.manager.tooltipViews.map( ({ dom }) => { @@ -16611,12 +16752,12 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass( }; } writeMeasure(measured) { - const { editor, space } = measured; + const { editor, space: space2 } = measured; const others = []; - for (let i4 = 0; i4 < this.manager.tooltips.length; i4++) { - const tooltip = this.manager.tooltips[i4], tView = this.manager.tooltipViews[i4], { dom } = tView; - const pos = measured.pos[i4], size = measured.size[i4]; - if (!pos || pos.bottom <= Math.max(editor.top, space.top) || pos.top >= Math.min(editor.bottom, space.bottom) || pos.right < Math.max(editor.left, space.left) - 0.1 || pos.left > Math.min(editor.right, space.right) + 0.1) { + for (let i5 = 0; i5 < this.manager.tooltips.length; i5++) { + const tooltip = this.manager.tooltips[i5], tView = this.manager.tooltipViews[i5], { dom } = tView; + const pos = measured.pos[i5], size = measured.size[i5]; + if (!pos || pos.bottom <= Math.max(editor.top, space2.top) || pos.top >= Math.min(editor.bottom, space2.bottom) || pos.right < Math.max(editor.left, space2.left) - 0.1 || pos.left > Math.min(editor.right, space2.right) + 0.1) { dom.style.top = Outside; continue; } @@ -16624,15 +16765,15 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass( const arrowHeight = arrow ? 7 /* Size */ : 0; const width = size.right - size.left, height = size.bottom - size.top; const offset2 = tView.offset || noOffset, ltr = this.view.textDirection == import_view.Direction.LTR; - const left = size.width > space.right - space.left ? ltr ? space.left : space.right - size.width : ltr ? Math.min( + const left = size.width > space2.right - space2.left ? ltr ? space2.left : space2.right - size.width : ltr ? Math.min( pos.left - (arrow ? 14 /* Offset */ : 0) + offset2.x, - space.right - width + space2.right - width ) : Math.max( - space.left, + space2.left, pos.left - width + (arrow ? 14 /* Offset */ : 0) - offset2.x ); let above = !!tooltip.above; - if (!tooltip.strictSide && (above ? pos.top - (size.bottom - size.top) - offset2.y < space.top : pos.bottom + (size.bottom - size.top) + offset2.y > space.bottom) && above == space.bottom - pos.bottom > pos.top - space.top) + if (!tooltip.strictSide && (above ? pos.top - (size.bottom - size.top) - offset2.y < space2.top : pos.bottom + (size.bottom - size.top) + offset2.y > space2.bottom) && above == space2.bottom - pos.bottom > pos.top - space2.top) above = !above; let top = above ? pos.top - height - arrowHeight - offset2.y : pos.bottom + arrowHeight + offset2.y; const right = left + width; @@ -16650,8 +16791,8 @@ var tooltipPlugin = import_view.ViewPlugin.fromClass( const frames2 = win.parent.document.getElementsByTagName("iframe"); let frame; let found = false; - for (let i5 = 0, len = frames2.length; i5 < len; i5++) { - frame = frames2[i5]; + for (let i6 = 0, len = frames2.length; i6 < len; i6++) { + frame = frames2[i6]; if (frame.contentWindow == win) { found = true; break; @@ -16783,7 +16924,7 @@ var HoverTooltipHost = class { this.manager = new TooltipViewManager( view, showHoverTooltip, - (t4) => this.createHostedView(t4) + (t5) => this.createHostedView(t5) ); } static create(view) { @@ -16817,17 +16958,17 @@ var HoverTooltipHost = class { var showHoverTooltipHost = showTooltip.compute( [showHoverTooltip], (state) => { - const tooltips2 = state.facet(showHoverTooltip).filter((t4) => t4); + const tooltips2 = state.facet(showHoverTooltip).filter((t5) => t5); if (tooltips2.length === 0) return null; return { - pos: Math.min(...tooltips2.map((t4) => t4.pos)), + pos: Math.min(...tooltips2.map((t5) => t5.pos)), end: Math.max( - ...tooltips2.filter((t4) => t4.end != null).map((t4) => t4.end) + ...tooltips2.filter((t5) => t5.end != null).map((t5) => t5.end) ), create: HoverTooltipHost.create, above: tooltips2[0].above, - arrow: tooltips2.some((t4) => t4.arrow) + arrow: tooltips2.some((t5) => t5.arrow) }; } ); @@ -16881,7 +17022,7 @@ var HoverPlugin = class { const posCoords = this.view.coordsAtPos(pos); if (posCoords == null || lastMove.y < posCoords.top || lastMove.y > posCoords.bottom || lastMove.x < posCoords.left - this.view.defaultCharacterWidth || lastMove.x > posCoords.right + this.view.defaultCharacterWidth) return; - const bidi = this.view.bidiSpans(this.view.state.doc.lineAt(pos)).find((s5) => s5.from <= pos && s5.to >= pos); + const bidi = this.view.bidiSpans(this.view.state.doc.lineAt(pos)).find((s6) => s6.from <= pos && s6.to >= pos); const rtl = bidi && bidi.dir == import_view.Direction.RTL ? -1 : 1; const open = this.source( this.view, @@ -16955,8 +17096,8 @@ function isOverRange(view, from, to, x5, y5, margin) { range.setStart(fromDOM.node, fromDOM.offset); const rects = range.getClientRects(); range.detach(); - for (let i4 = 0; i4 < rects.length; i4++) { - const rect = rects[i4]; + for (let i5 = 0; i5 < rects.length; i5++) { + const rect = rects[i5]; const dist = Math.max( rect.top - y5, y5 - rect.bottom, @@ -17114,8 +17255,8 @@ var calloutField = import_state2.StateField.define({ const builder = new import_state2.RangeSetBuilder(); const nodes = []; (0, import_language2.syntaxTree)(tr.state).iterate({ - enter: ({ name, from, to }) => { - nodes.push({ name, from, to }); + enter: ({ name: name2, from, to }) => { + nodes.push({ name: name2, from, to }); } }); const nextQuote = (ns, to) => { @@ -17134,8 +17275,8 @@ var calloutField = import_state2.StateField.define({ previous.next(); } let index = 0; - nodes.map(({ name, from, to }) => { - if (name.contains("HyperMD-callout")) { + nodes.map(({ name: name2, from, to }) => { + if (name2.contains("HyperMD-callout")) { const existingCallout = previousSpecs[index]; const endQuote = nextQuote(nodes, to); const lineStart = tr.state.doc.lineAt(from).number; @@ -17204,8 +17345,8 @@ var CalloutWidget = class extends import_view2.WidgetType { return div; } }; -var calloutBlock = (range, text2, id2) => import_view2.Decoration.widget({ - widget: new CalloutWidget({ range, text: text2, id: id2 }), +var calloutBlock = (range, text2, id3) => import_view2.Decoration.widget({ + widget: new CalloutWidget({ range, text: text2, id: id3 }), block: true }); @@ -17232,27 +17373,27 @@ var eventTypes = { }; // src/dispatch/flowDispatch.ts -var createFlowEditorInElement = (id2, leaf, source, el, type, path, from, to) => { +var createFlowEditorInElement = (id3, leaf, source, el, type, path, from, to) => { const evt = new CustomEvent(eventTypes.spawnPortal, { - detail: { id: id2, leaf, source, el, path, from, to, type } + detail: { id: id3, leaf, source, el, path, from, to, type } }); activeWindow.dispatchEvent(evt); }; -var loadFlowEditorByDOM = (el, view, id2) => { +var loadFlowEditorByDOM = (el, view, id3) => { const evt = new CustomEvent(eventTypes.loadPortal, { - detail: { id: id2, el, view } + detail: { id: id3, el, view } }); activeWindow.dispatchEvent(evt); }; -var focusFlowEditor = (id2, top) => { +var focusFlowEditor = (id3, top) => { const evt = new CustomEvent(eventTypes.focusPortal, { - detail: { id: id2, parent: false, top } + detail: { id: id3, parent: false, top } }); activeWindow.dispatchEvent(evt); }; -var focusFlowEditorParent = (id2, top) => { +var focusFlowEditorParent = (id3, top) => { const evt = new CustomEvent(eventTypes.focusPortal, { - detail: { id: id2, parent: true, top } + detail: { id: id3, parent: true, top } }); activeWindow.dispatchEvent(evt); }; @@ -17478,8 +17619,11 @@ var T4 = class { tag: { label: "Tag" }, + object: { + label: "Object" + }, context: { - label: "Context" + label: "Relation" }, image: { label: "Image" @@ -17487,6 +17631,9 @@ var T4 = class { color: { label: "Color" }, + space: { + label: "Space" + }, icon: { label: "Icon" }, @@ -17530,7 +17677,8 @@ var T4 = class { syncFrontmatterProperty: "Sync Frontmatter Property", newProperty: "New Property", propertyType: "Type", - propertyContext: "Context", + propertyValueSpace: "Space", + propertyValueProperty: "Property", dateFormat: "Date Format", propertyFileProp: "Property", multiple: "Multiple", @@ -17789,23 +17937,31 @@ var insert = (arr, index, newItem) => !index || index <= 0 ? [ newItem, ...arr.slice(index) ]; -var uniq = (a5) => [...new Set(a5)]; -var uniqCaseInsensitive = (a5) => [ - ...new Map(a5.map((s5) => [s5.toLowerCase(), s5])).values() +var insertMulti = (arr, index, newItem) => !index || index <= 0 ? [ + ...newItem, + ...arr +] : [ + ...arr.slice(0, index), + ...newItem, + ...arr.slice(index) +]; +var uniq = (a6) => [...new Set(a6)]; +var uniqCaseInsensitive = (a6) => [ + ...new Map(a6.map((s6) => [s6.toLowerCase(), s6])).values() ]; -var uniqueNameFromString = (name, cols) => { - let newName = name; +var uniqueNameFromString = (name2, cols) => { + let newName = name2; if (cols.includes(newName)) { let append = 1; while (cols.includes(newName)) { - newName = name + append.toString(); + newName = name2 + append.toString(); append += 1; } } return newName; }; var onlyUniqueProp = (prop) => (value, index, self2) => { - return self2.findIndex((v3) => value[prop] == v3[prop]) === index; + return self2.findIndex((v4) => value[prop] == v4[prop]) === index; }; // src/utils/json.ts @@ -17867,23 +18023,26 @@ var indexOfCharElseEOS = (char, str) => { return str.indexOf(char); return str.length; }; -var spaceNameFromContextPath = (contextPath) => contextPath; +var spaceNameFromSpacePath = (contextPath, plugin) => { + var _a2, _b2; + return (_b2 = (_a2 = plugin.index.spacesIndex.get(contextPath)) == null ? void 0 : _a2.name) != null ? _b2 : contextPath; +}; var spacePathFromName = (spaceName) => "spaces://" + spaceName.replace(/\//g, "+"); var tagSpacePathFromTag = (tag) => "spaces://" + tag; -var wrapQuotes = (s5) => `"${s5}"`; -var removeQuotes = (s5) => { - if (!s5) - return s5; - const singleQuoteWithSemicolon = s5.startsWith("'") && (s5.endsWith("';") || s5.endsWith("'")); - const doubleQuoteWithSemicolon = s5.startsWith('"') && (s5.endsWith('";') || s5.endsWith('"')); +var wrapQuotes = (s6) => `"${s6}"`; +var removeQuotes = (s6) => { + if (!s6) + return s6; + const singleQuoteWithSemicolon = s6.startsWith("'") && (s6.endsWith("';") || s6.endsWith("'")); + const doubleQuoteWithSemicolon = s6.startsWith('"') && (s6.endsWith('";') || s6.endsWith('"')); if (singleQuoteWithSemicolon || doubleQuoteWithSemicolon) { - s5 = s5.substring(1, s5.length - 1); - if (s5.endsWith('"') || s5.endsWith("'")) { - s5 = s5.substring(0, s5.length - 1); + s6 = s6.substring(1, s6.length - 1); + if (s6.endsWith('"') || s6.endsWith("'")) { + s6 = s6.substring(0, s6.length - 1); } - return s5; + return s6; } else { - return s5; + return s6; } }; var filePathToString = (filename) => { @@ -17902,19 +18061,19 @@ var filePathToString = (filename) => { } return filename; }; -var stringFromTag = (string) => { - if (string.charAt(0) == "#") { - if (string.charAt(1) == "#") { - return string.substring(2, string.length); +var stringFromTag = (string2) => { + if (string2.charAt(0) == "#") { + if (string2.charAt(1) == "#") { + return string2.substring(2, string2.length); } - return string.substring(1, string.length); + return string2.substring(1, string2.length); } - return string; + return string2; }; var fileNameToString = (filename) => filename.substring(0, filename.lastIndexOf(".")) || filename; var removeLeadingSlash = (path) => path.charAt(0) == "/" ? path.substring(1) : path; var folderPathToString = (filename) => removeLeadingSlash(filename.substring(filename.lastIndexOf("/"))) || filename; -var pathDisplayName = (path) => { +var pathDisplayName = (path, plugin) => { if (!path) return ""; if ((path == null ? void 0 : path.type) == "folder") { @@ -17925,49 +18084,49 @@ var pathDisplayName = (path) => { if ((path == null ? void 0 : path.type) == "tag") return stringFromTag(path.space); if ((path == null ? void 0 : path.type) == "space") - return spaceNameFromContextPath(path.space); + return spaceNameFromSpacePath(path.space, plugin); if (path.isRemote) { return folderPathToString(path.path); } return path.path; }; -var contextDisplayName = (space) => { - if (!space) +var contextDisplayName = (space2, plugin) => { + if (!space2) return ""; - if ((space == null ? void 0 : space.uri.type) == "folder") - return folderPathToString(space.uri.path); - if ((space == null ? void 0 : space.uri.type) == "tag") - return stringFromTag(space.uri.space); - if ((space == null ? void 0 : space.uri.type) == "space") - return spaceNameFromContextPath(space.uri.space); - if (space.isRemote) { - return folderPathToString(space.uri.path); + if ((space2 == null ? void 0 : space2.uri.type) == "folder") + return folderPathToString(space2.uri.path); + if ((space2 == null ? void 0 : space2.uri.type) == "tag") + return stringFromTag(space2.uri.space); + if ((space2 == null ? void 0 : space2.uri.type) == "space") + return spaceNameFromSpacePath(space2.uri.space, plugin); + if (space2.isRemote) { + return folderPathToString(space2.uri.path); } - return space.uri.path; + return space2.uri.path; }; var folderNotePathFromAFile = (settings, aFile) => !aFile ? null : settings.folderNoteInsideFolder ? `${aFile.path}/${aFile.name}.md` : aFile.parent == "/" ? `${aFile.name}.md` : `${aFile.parent}/${aFile.name}.md`; var folderPathFromFolderNoteFile = (settings, aFile) => !aFile ? null : settings.folderNoteInsideFolder ? aFile.parent : aFile.parent == "/" ? aFile.name : `${aFile.parent}/${aFile.name}`; // src/utils/parser.tsx var parseSortStrat = (str) => { - const [a5, b4] = str.split("_"); - return [a5, b4 == "asc"]; + const [a6, b4] = str.split("_"); + return [a6, b4 == "asc"]; }; var parseMultiString = (str) => { var _a2; return (_a2 = str == null ? void 0 : str.match(/(\\.|[^,])+/g)) != null ? _a2 : []; }; -var parseLinkString = (string) => { - if (!string) +var parseLinkString = (string2) => { + if (!string2) return ""; - const match2 = /\[\[(.*?)\]\]/g.exec(string); - const stringValue = (match2 == null ? void 0 : match2.length) > 1 ? match2[1].substring(0, indexOfCharElseEOS("|", match2[1])) : string; + const match2 = /\[\[(.*?)\]\]/g.exec(string2); + const stringValue = (match2 == null ? void 0 : match2.length) > 1 ? match2[1].substring(0, indexOfCharElseEOS("|", match2[1])) : string2; if (stringValue) return stringValue; - return string; + return string2; }; -var parseLinkDisplayString = (string) => { - return filePathToString(parseLinkString(string)); +var parseLinkDisplayString = (string2) => { + return filePathToString(parseLinkString(string2)); }; // src/utils/serializer.ts @@ -18062,6 +18221,10 @@ var FileLinkView = class extends import_obsidian2.ItemView { }; // src/utils/objects.ts +var removeKey = (object, key2) => { + delete object[key2]; + return object; +}; var replaceKeys = (object1, object2) => { const newObject = {}; for (const key2 in object1) { @@ -18168,7 +18331,7 @@ function uriByString(uri, source) { return "frame"; return null; }; - let space = null; + let space2 = null; let path = null; let alias = null; let reference = null; @@ -18176,7 +18339,7 @@ function uriByString(uri, source) { let query = null; if (uri.startsWith("spaces://")) { const spaceParts = uri.slice("spaces://".length).split("/"); - space = spaceParts[0]; + space2 = spaceParts[0]; uri = "/" + (spaceParts.slice(1).join("/") || ""); } const lastSlashIndex = uri.lastIndexOf("/"); @@ -18202,9 +18365,9 @@ function uriByString(uri, source) { } path = removeTrailingSlashFromFolder(uri); return { - basePath: `${space ? `spaces://${space}` : path}`, - type: uriTypeByString(space, path, source), - space, + basePath: `${space2 ? `spaces://${space2}` : path}`, + type: uriTypeByString(space2, path, source), + space: space2, fullPath, path, alias, @@ -18214,11 +18377,11 @@ function uriByString(uri, source) { query }; } -var uriTypeByString = (space, file, source) => { - if ((space == null ? void 0 : space.charAt(0)) == "#") { +var uriTypeByString = (space2, file, source) => { + if ((space2 == null ? void 0 : space2.charAt(0)) == "#") { return "tag"; } - if ((space == null ? void 0 : space.length) > 0) { + if ((space2 == null ? void 0 : space2.length) > 0) { return "space"; } if (file.charAt(file.length - 1) == "/") { @@ -18266,12 +18429,12 @@ var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "] var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); function isInAstralSet(code, set) { var pos = 65536; - for (var i4 = 0; i4 < set.length; i4 += 2) { - pos += set[i4]; + for (var i5 = 0; i5 < set.length; i5 += 2) { + pos += set[i5]; if (pos > code) { return false; } - pos += set[i4 + 1]; + pos += set[i5 + 1]; if (pos >= code) { return true; } @@ -18340,17 +18503,17 @@ var TokenType = function TokenType2(label, conf) { this.binop = conf.binop || null; this.updateContext = null; }; -function binop(name, prec) { - return new TokenType(name, { beforeExpr: true, binop: prec }); +function binop(name2, prec) { + return new TokenType(name2, { beforeExpr: true, binop: prec }); } var beforeExpr = { beforeExpr: true }; var startsExpr = { startsExpr: true }; var keywords = {}; -function kw(name, options) { +function kw(name2, options) { if (options === void 0) options = {}; - options.keyword = name; - return keywords[name] = new TokenType(name, options); + options.keyword = name2; + return keywords[name2] = new TokenType(name2, options); } var types$1 = { num: new TokenType("num", startsExpr), @@ -18439,10 +18602,10 @@ function isNewLine(code) { function nextLineBreak(code, from, end) { if (end === void 0) end = code.length; - for (var i4 = from; i4 < end; i4++) { - var next = code.charCodeAt(i4); + for (var i5 = from; i5 < end; i5++) { + var next = code.charCodeAt(i5); if (isNewLine(next)) { - return i4 < end - 1 && next === 13 && code.charCodeAt(i4 + 1) === 10 ? i4 + 2 : i4 + 1; + return i5 < end - 1 && next === 13 && code.charCodeAt(i5 + 1) === 10 ? i5 + 2 : i5 + 1; } } return -1; @@ -18549,19 +18712,19 @@ function getOptions(opts) { } function pushComment(options, array) { return function(block, text2, start, end, startLoc, endLoc) { - var comment = { + var comment2 = { type: block ? "Block" : "Line", value: text2, start, end }; if (options.locations) { - comment.loc = new SourceLocation(this, startLoc, endLoc); + comment2.loc = new SourceLocation(this, startLoc, endLoc); } if (options.ranges) { - comment.range = [start, end]; + comment2.range = [start, end]; } - array.push(comment); + array.push(comment2); }; } var SCOPE_TOP = 1; @@ -18647,8 +18810,8 @@ prototypeAccessors.inAsync.get = function() { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit; }; prototypeAccessors.canAwait.get = function() { - for (var i4 = this.scopeStack.length - 1; i4 >= 0; i4--) { - var scope = this.scopeStack[i4]; + for (var i5 = this.scopeStack.length - 1; i5 >= 0; i5--) { + var scope = this.scopeStack[i5]; if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { return false; } @@ -18684,8 +18847,8 @@ Parser.extend = function extend() { while (len--) plugins[len] = arguments[len]; var cls = this; - for (var i4 = 0; i4 < plugins.length; i4++) { - cls = plugins[i4](cls); + for (var i5 = 0; i5 < plugins.length; i5++) { + cls = plugins[i5](cls); } return cls; }; @@ -18693,9 +18856,9 @@ Parser.parse = function parse2(input, options) { return new this(options, input).parse(); }; Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) { - var parser = new this(options, input, pos); - parser.nextToken(); - return parser.parseExpression(); + var parser2 = new this(options, input, pos); + parser2.nextToken(); + return parser2.parseExpression(); }; Parser.tokenizer = function tokenizer(input, options) { return new this(options, input); @@ -18736,18 +18899,18 @@ pp$9.eat = function(type) { return false; } }; -pp$9.isContextual = function(name) { - return this.type === types$1.name && this.value === name && !this.containsEsc; +pp$9.isContextual = function(name2) { + return this.type === types$1.name && this.value === name2 && !this.containsEsc; }; -pp$9.eatContextual = function(name) { - if (!this.isContextual(name)) { +pp$9.eatContextual = function(name2) { + if (!this.isContextual(name2)) { return false; } this.next(); return true; }; -pp$9.expectContextual = function(name) { - if (!this.eatContextual(name)) { +pp$9.expectContextual = function(name2) { + if (!this.eatContextual(name2)) { this.unexpected(); } }; @@ -18840,9 +19003,9 @@ pp$8.parseTopLevel = function(node) { node.body.push(stmt); } if (this.inModule) { - for (var i4 = 0, list = Object.keys(this.undefinedExports); i4 < list.length; i4 += 1) { - var name = list[i4]; - this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined"); + for (var i5 = 0, list = Object.keys(this.undefinedExports); i5 < list.length; i5 += 1) { + var name2 = list[i5]; + this.raiseRecoverable(this.undefinedExports[name2].start, "Export '" + name2 + "' is not defined"); } } this.adaptDirectivePrologue(node.body); @@ -18978,8 +19141,8 @@ pp$8.parseStatement = function(context, topLevel, exports2) { } } }; -pp$8.parseBreakContinueStatement = function(node, keyword) { - var isBreak = keyword === "break"; +pp$8.parseBreakContinueStatement = function(node, keyword2) { + var isBreak = keyword2 === "break"; this.next(); if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; @@ -18989,9 +19152,9 @@ pp$8.parseBreakContinueStatement = function(node, keyword) { node.label = this.parseIdent(); this.semicolon(); } - var i4 = 0; - for (; i4 < this.labels.length; ++i4) { - var lab = this.labels[i4]; + var i5 = 0; + for (; i5 < this.labels.length; ++i5) { + var lab = this.labels[i5]; if (node.label == null || lab.name === node.label.name) { if (lab.kind != null && (isBreak || lab.kind === "loop")) { break; @@ -19001,8 +19164,8 @@ pp$8.parseBreakContinueStatement = function(node, keyword) { } } } - if (i4 === this.labels.length) { - this.raise(node.start, "Unsyntactic " + keyword); + if (i5 === this.labels.length) { + this.raise(node.start, "Unsyntactic " + keyword2); } return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); }; @@ -19228,8 +19391,8 @@ pp$8.parseLabeledStatement = function(node, maybeName, expr, context) { } } var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null; - for (var i4 = this.labels.length - 1; i4 >= 0; i4--) { - var label$1 = this.labels[i4]; + for (var i5 = this.labels.length - 1; i5 >= 0; i5--) { + var label$1 = this.labels[i5]; if (label$1.statementStart === node.start) { label$1.statementStart = this.start; label$1.kind = kind; @@ -19558,38 +19721,38 @@ pp$8.exitClassBody = function() { var used = ref2.used; var len = this.privateNameStack.length; var parent = len === 0 ? null : this.privateNameStack[len - 1]; - for (var i4 = 0; i4 < used.length; ++i4) { - var id2 = used[i4]; - if (!hasOwn(declared, id2.name)) { + for (var i5 = 0; i5 < used.length; ++i5) { + var id3 = used[i5]; + if (!hasOwn(declared, id3.name)) { if (parent) { - parent.used.push(id2); + parent.used.push(id3); } else { - this.raiseRecoverable(id2.start, "Private field '#" + id2.name + "' must be declared in an enclosing class"); + this.raiseRecoverable(id3.start, "Private field '#" + id3.name + "' must be declared in an enclosing class"); } } } }; function isPrivateNameConflicted(privateNameMap, element) { - var name = element.key.name; - var curr = privateNameMap[name]; + var name2 = element.key.name; + var curr = privateNameMap[name2]; var next = "true"; if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) { next = (element.static ? "s" : "i") + element.kind; } if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") { - privateNameMap[name] = "true"; + privateNameMap[name2] = "true"; return false; } else if (!curr) { - privateNameMap[name] = next; + privateNameMap[name2] = next; return false; } else { return true; } } -function checkKeyName(node, name) { +function checkKeyName(node, name2) { var computed = node.computed; var key2 = node.key; - return !computed && (key2.type === "Identifier" && key2.name === name || key2.type === "Literal" && key2.value === name); + return !computed && (key2.type === "Identifier" && key2.name === name2 || key2.type === "Literal" && key2.value === name2); } pp$8.parseExport = function(node, exports2) { this.next(); @@ -19647,8 +19810,8 @@ pp$8.parseExport = function(node, exports2) { } node.source = this.parseExprAtom(); } else { - for (var i4 = 0, list = node.specifiers; i4 < list.length; i4 += 1) { - var spec = list[i4]; + for (var i5 = 0, list = node.specifiers; i5 < list.length; i5 += 1) { + var spec = list[i5]; this.checkUnreserved(spec.local); this.checkLocalExport(spec.local); if (spec.local.type === "Literal") { @@ -19661,25 +19824,25 @@ pp$8.parseExport = function(node, exports2) { } return this.finishNode(node, "ExportNamedDeclaration"); }; -pp$8.checkExport = function(exports2, name, pos) { +pp$8.checkExport = function(exports2, name2, pos) { if (!exports2) { return; } - if (typeof name !== "string") { - name = name.type === "Identifier" ? name.name : name.value; + if (typeof name2 !== "string") { + name2 = name2.type === "Identifier" ? name2.name : name2.value; } - if (hasOwn(exports2, name)) { - this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); + if (hasOwn(exports2, name2)) { + this.raiseRecoverable(pos, "Duplicate export '" + name2 + "'"); } - exports2[name] = true; + exports2[name2] = true; }; pp$8.checkPatternExport = function(exports2, pat) { var type = pat.type; if (type === "Identifier") { this.checkExport(exports2, pat, pat.start); } else if (type === "ObjectPattern") { - for (var i4 = 0, list = pat.properties; i4 < list.length; i4 += 1) { - var prop = list[i4]; + for (var i5 = 0, list = pat.properties; i5 < list.length; i5 += 1) { + var prop = list[i5]; this.checkPatternExport(exports2, prop); } } else if (type === "ArrayPattern") { @@ -19703,8 +19866,8 @@ pp$8.checkVariableExport = function(exports2, decls) { if (!exports2) { return; } - for (var i4 = 0, list = decls; i4 < list.length; i4 += 1) { - var decl = list[i4]; + for (var i5 = 0, list = decls; i5 < list.length; i5 += 1) { + var decl = list[i5]; this.checkPatternExport(exports2, decl.id); } }; @@ -19802,8 +19965,8 @@ pp$8.parseModuleExportName = function() { return this.parseIdent(true); }; pp$8.adaptDirectivePrologue = function(statements) { - for (var i4 = 0; i4 < statements.length && this.isDirectiveCandidate(statements[i4]); ++i4) { - statements[i4].directive = statements[i4].expression.raw.slice(1, -1); + for (var i5 = 0; i5 < statements.length && this.isDirectiveCandidate(statements[i5]); ++i5) { + statements[i5].directive = statements[i5].expression.raw.slice(1, -1); } }; pp$8.isDirectiveCandidate = function(statement) { @@ -19828,8 +19991,8 @@ pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); } - for (var i4 = 0, list = node.properties; i4 < list.length; i4 += 1) { - var prop = list[i4]; + for (var i5 = 0, list = node.properties; i5 < list.length; i5 += 1) { + var prop = list[i5]; this.toAssignable(prop, isBinding); if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) { this.raise(prop.argument.start, "Unexpected token"); @@ -19884,8 +20047,8 @@ pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) { }; pp$7.toAssignableList = function(exprList, isBinding) { var end = exprList.length; - for (var i4 = 0; i4 < end; i4++) { - var elt = exprList[i4]; + for (var i5 = 0; i5 < end; i5++) { + var elt = exprList[i5]; if (elt) { this.toAssignable(elt, isBinding); } @@ -20015,8 +20178,8 @@ pp$7.checkLValPattern = function(expr, bindingType, checkClashes) { bindingType = BIND_NONE; switch (expr.type) { case "ObjectPattern": - for (var i4 = 0, list = expr.properties; i4 < list.length; i4 += 1) { - var prop = list[i4]; + for (var i5 = 0, list = expr.properties; i5 < list.length; i5 += 1) { + var prop = list[i5]; this.checkLValInnerPattern(prop, bindingType, checkClashes); } break; @@ -20100,8 +20263,8 @@ pp$6.braceIsBlock = function(prevType) { return !this.exprAllowed; }; pp$6.inGeneratorContext = function() { - for (var i4 = this.context.length - 1; i4 >= 1; i4--) { - var context = this.context[i4]; + for (var i5 = this.context.length - 1; i5 >= 1; i5--) { + var context = this.context[i5]; if (context.token === "function") { return context.generator; } @@ -20194,20 +20357,20 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) { return; } var key2 = prop.key; - var name; + var name2; switch (key2.type) { case "Identifier": - name = key2.name; + name2 = key2.name; break; case "Literal": - name = String(key2.value); + name2 = String(key2.value); break; default: return; } var kind = prop.kind; if (this.options.ecmaVersion >= 6) { - if (name === "__proto__" && kind === "init") { + if (name2 === "__proto__" && kind === "init") { if (propHash.proto) { if (refDestructuringErrors) { if (refDestructuringErrors.doubleProto < 0) { @@ -20221,8 +20384,8 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) { } return; } - name = "$" + name; - var other = propHash[name]; + name2 = "$" + name2; + var other = propHash[name2]; if (other) { var redefinition; if (kind === "init") { @@ -20234,7 +20397,7 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) { this.raiseRecoverable(key2.start, "Redefinition of property"); } } else { - other = propHash[name] = { + other = propHash[name2] = { init: false, get: false, set: false @@ -20559,24 +20722,24 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit) { return this.finishNode(node, "ThisExpression"); case types$1.name: var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; - var id2 = this.parseIdent(false); - if (this.options.ecmaVersion >= 8 && !containsEsc && id2.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { + var id3 = this.parseIdent(false); + if (this.options.ecmaVersion >= 8 && !containsEsc && id3.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { this.overrideContext(types.f_expr); return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit); } if (canBeArrow && !this.canInsertSemicolon()) { if (this.eat(types$1.arrow)) { - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id2], false, forInit); + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id3], false, forInit); } - if (this.options.ecmaVersion >= 8 && id2.name === "async" && this.type === types$1.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { - id2 = this.parseIdent(false); + if (this.options.ecmaVersion >= 8 && id3.name === "async" && this.type === types$1.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { + id3 = this.parseIdent(false); if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) { this.unexpected(); } - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id2], true, forInit); + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id3], true, forInit); } } - return id2; + return id3; case types$1.regexp: var value = this.value; node = this.parseLiteral(value.value); @@ -20637,12 +20800,12 @@ pp$5.parseExprImport = function() { if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); } - var meta = this.parseIdent(true); + var meta2 = this.parseIdent(true); switch (this.type) { case types$1.parenL: return this.parseDynamicImport(node); case types$1.dot: - node.meta = meta; + node.meta = meta2; return this.parseImportMeta(node); default: this.unexpected(); @@ -20765,9 +20928,9 @@ pp$5.parseNew = function() { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } var node = this.startNode(); - var meta = this.parseIdent(true); + var meta2 = this.parseIdent(true); if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) { - node.meta = meta; + node.meta = meta2; var containsEsc = this.containsEsc; node.property = this.parseIdent(true); if (node.property.name !== "target") { @@ -21051,8 +21214,8 @@ pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) { this.exitScope(); }; pp$5.isSimpleParamList = function(params) { - for (var i4 = 0, list = params; i4 < list.length; i4 += 1) { - var param = list[i4]; + for (var i5 = 0, list = params; i5 < list.length; i5 += 1) { + var param = list[i5]; if (param.type !== "Identifier") { return false; } @@ -21061,8 +21224,8 @@ pp$5.isSimpleParamList = function(params) { }; pp$5.checkParams = function(node, allowDuplicates) { var nameHash = /* @__PURE__ */ Object.create(null); - for (var i4 = 0, list = node.params; i4 < list.length; i4 += 1) { - var param = list[i4]; + for (var i5 = 0, list = node.params; i5 < list.length; i5 += 1) { + var param = list[i5]; this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash); } }; @@ -21095,31 +21258,31 @@ pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct pp$5.checkUnreserved = function(ref2) { var start = ref2.start; var end = ref2.end; - var name = ref2.name; - if (this.inGenerator && name === "yield") { + var name2 = ref2.name; + if (this.inGenerator && name2 === "yield") { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); } - if (this.inAsync && name === "await") { + if (this.inAsync && name2 === "await") { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); } - if (this.currentThisScope().inClassFieldInit && name === "arguments") { + if (this.currentThisScope().inClassFieldInit && name2 === "arguments") { this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); } - if (this.inClassStaticBlock && (name === "arguments" || name === "await")) { - this.raise(start, "Cannot use " + name + " in class static initialization block"); + if (this.inClassStaticBlock && (name2 === "arguments" || name2 === "await")) { + this.raise(start, "Cannot use " + name2 + " in class static initialization block"); } - if (this.keywords.test(name)) { - this.raise(start, "Unexpected keyword '" + name + "'"); + if (this.keywords.test(name2)) { + this.raise(start, "Unexpected keyword '" + name2 + "'"); } if (this.options.ecmaVersion < 6 && this.input.slice(start, end).indexOf("\\") !== -1) { return; } var re = this.strict ? this.reservedWordsStrict : this.reservedWords; - if (re.test(name)) { - if (!this.inAsync && name === "await") { + if (re.test(name2)) { + if (!this.inAsync && name2 === "await") { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); } - this.raiseRecoverable(start, "The keyword '" + name + "' is reserved"); + this.raiseRecoverable(start, "The keyword '" + name2 + "' is reserved"); } }; pp$5.parseIdent = function(liberal) { @@ -21217,36 +21380,36 @@ pp$3.exitScope = function() { pp$3.treatFunctionsAsVarInScope = function(scope) { return scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_TOP; }; -pp$3.declareName = function(name, bindingType, pos) { +pp$3.declareName = function(name2, bindingType, pos) { var redeclared = false; if (bindingType === BIND_LEXICAL) { var scope = this.currentScope(); - redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1; - scope.lexical.push(name); + redeclared = scope.lexical.indexOf(name2) > -1 || scope.functions.indexOf(name2) > -1 || scope.var.indexOf(name2) > -1; + scope.lexical.push(name2); if (this.inModule && scope.flags & SCOPE_TOP) { - delete this.undefinedExports[name]; + delete this.undefinedExports[name2]; } } else if (bindingType === BIND_SIMPLE_CATCH) { var scope$1 = this.currentScope(); - scope$1.lexical.push(name); + scope$1.lexical.push(name2); } else if (bindingType === BIND_FUNCTION) { var scope$2 = this.currentScope(); if (this.treatFunctionsAsVar) { - redeclared = scope$2.lexical.indexOf(name) > -1; + redeclared = scope$2.lexical.indexOf(name2) > -1; } else { - redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; + redeclared = scope$2.lexical.indexOf(name2) > -1 || scope$2.var.indexOf(name2) > -1; } - scope$2.functions.push(name); + scope$2.functions.push(name2); } else { - for (var i4 = this.scopeStack.length - 1; i4 >= 0; --i4) { - var scope$3 = this.scopeStack[i4]; - if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { + for (var i5 = this.scopeStack.length - 1; i5 >= 0; --i5) { + var scope$3 = this.scopeStack[i5]; + if (scope$3.lexical.indexOf(name2) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name2) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name2) > -1) { redeclared = true; break; } - scope$3.var.push(name); + scope$3.var.push(name2); if (this.inModule && scope$3.flags & SCOPE_TOP) { - delete this.undefinedExports[name]; + delete this.undefinedExports[name2]; } if (scope$3.flags & SCOPE_VAR) { break; @@ -21254,44 +21417,44 @@ pp$3.declareName = function(name, bindingType, pos) { } } if (redeclared) { - this.raiseRecoverable(pos, "Identifier '" + name + "' has already been declared"); + this.raiseRecoverable(pos, "Identifier '" + name2 + "' has already been declared"); } }; -pp$3.checkLocalExport = function(id2) { - if (this.scopeStack[0].lexical.indexOf(id2.name) === -1 && this.scopeStack[0].var.indexOf(id2.name) === -1) { - this.undefinedExports[id2.name] = id2; +pp$3.checkLocalExport = function(id3) { + if (this.scopeStack[0].lexical.indexOf(id3.name) === -1 && this.scopeStack[0].var.indexOf(id3.name) === -1) { + this.undefinedExports[id3.name] = id3; } }; pp$3.currentScope = function() { return this.scopeStack[this.scopeStack.length - 1]; }; pp$3.currentVarScope = function() { - for (var i4 = this.scopeStack.length - 1; ; i4--) { - var scope = this.scopeStack[i4]; + for (var i5 = this.scopeStack.length - 1; ; i5--) { + var scope = this.scopeStack[i5]; if (scope.flags & SCOPE_VAR) { return scope; } } }; pp$3.currentThisScope = function() { - for (var i4 = this.scopeStack.length - 1; ; i4--) { - var scope = this.scopeStack[i4]; + for (var i5 = this.scopeStack.length - 1; ; i5--) { + var scope = this.scopeStack[i5]; if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope; } } }; -var Node = function Node2(parser, pos, loc) { +var Node = function Node2(parser2, pos, loc) { this.type = ""; this.start = pos; this.end = 0; - if (parser.options.locations) { - this.loc = new SourceLocation(parser, loc); + if (parser2.options.locations) { + this.loc = new SourceLocation(parser2, loc); } - if (parser.options.directSourceFile) { - this.sourceFile = parser.options.directSourceFile; + if (parser2.options.directSourceFile) { + this.sourceFile = parser2.options.directSourceFile; } - if (parser.options.ranges) { + if (parser2.options.ranges) { this.range = [pos, 0]; } }; @@ -21357,30 +21520,30 @@ var unicodeScriptValues = { }; var data = {}; function buildUnicodeData(ecmaVersion) { - var d5 = data[ecmaVersion] = { + var d6 = data[ecmaVersion] = { binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), nonBinary: { General_Category: wordsRegexp(unicodeGeneralCategoryValues), Script: wordsRegexp(unicodeScriptValues[ecmaVersion]) } }; - d5.nonBinary.Script_Extensions = d5.nonBinary.Script; - d5.nonBinary.gc = d5.nonBinary.General_Category; - d5.nonBinary.sc = d5.nonBinary.Script; - d5.nonBinary.scx = d5.nonBinary.Script_Extensions; + d6.nonBinary.Script_Extensions = d6.nonBinary.Script; + d6.nonBinary.gc = d6.nonBinary.General_Category; + d6.nonBinary.sc = d6.nonBinary.Script; + d6.nonBinary.scx = d6.nonBinary.Script_Extensions; } -for (i4 = 0, list = [9, 10, 11, 12, 13, 14]; i4 < list.length; i4 += 1) { - ecmaVersion = list[i4]; +for (i5 = 0, list = [9, 10, 11, 12, 13, 14]; i5 < list.length; i5 += 1) { + ecmaVersion = list[i5]; buildUnicodeData(ecmaVersion); } var ecmaVersion; -var i4; +var i5; var list; var pp$1 = Parser.prototype; -var RegExpValidationState = function RegExpValidationState2(parser) { - this.parser = parser; - this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : ""); - this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion]; +var RegExpValidationState = function RegExpValidationState2(parser2) { + this.parser = parser2; + this.validFlags = "gim" + (parser2.options.ecmaVersion >= 6 ? "uy" : "") + (parser2.options.ecmaVersion >= 9 ? "s" : "") + (parser2.options.ecmaVersion >= 13 ? "d" : ""); + this.unicodeProperties = data[parser2.options.ecmaVersion >= 14 ? 14 : parser2.options.ecmaVersion]; this.source = ""; this.flags = ""; this.start = 0; @@ -21406,34 +21569,34 @@ RegExpValidationState.prototype.reset = function reset(start, pattern, flags) { RegExpValidationState.prototype.raise = function raise(message) { this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message); }; -RegExpValidationState.prototype.at = function at(i4, forceU) { +RegExpValidationState.prototype.at = function at(i5, forceU) { if (forceU === void 0) forceU = false; - var s5 = this.source; - var l3 = s5.length; - if (i4 >= l3) { + var s6 = this.source; + var l3 = s6.length; + if (i5 >= l3) { return -1; } - var c4 = s5.charCodeAt(i4); - if (!(forceU || this.switchU) || c4 <= 55295 || c4 >= 57344 || i4 + 1 >= l3) { + var c4 = s6.charCodeAt(i5); + if (!(forceU || this.switchU) || c4 <= 55295 || c4 >= 57344 || i5 + 1 >= l3) { return c4; } - var next = s5.charCodeAt(i4 + 1); + var next = s6.charCodeAt(i5 + 1); return next >= 56320 && next <= 57343 ? (c4 << 10) + next - 56613888 : c4; }; -RegExpValidationState.prototype.nextIndex = function nextIndex(i4, forceU) { +RegExpValidationState.prototype.nextIndex = function nextIndex(i5, forceU) { if (forceU === void 0) forceU = false; - var s5 = this.source; - var l3 = s5.length; - if (i4 >= l3) { + var s6 = this.source; + var l3 = s6.length; + if (i5 >= l3) { return l3; } - var c4 = s5.charCodeAt(i4), next; - if (!(forceU || this.switchU) || c4 <= 55295 || c4 >= 57344 || i4 + 1 >= l3 || (next = s5.charCodeAt(i4 + 1)) < 56320 || next > 57343) { - return i4 + 1; + var c4 = s6.charCodeAt(i5), next; + if (!(forceU || this.switchU) || c4 <= 55295 || c4 >= 57344 || i5 + 1 >= l3 || (next = s6.charCodeAt(i5 + 1)) < 56320 || next > 57343) { + return i5 + 1; } - return i4 + 2; + return i5 + 2; }; RegExpValidationState.prototype.current = function current(forceU) { if (forceU === void 0) @@ -21462,12 +21625,12 @@ RegExpValidationState.prototype.eat = function eat(ch, forceU) { pp$1.validateRegExpFlags = function(state) { var validFlags = state.validFlags; var flags = state.flags; - for (var i4 = 0; i4 < flags.length; i4++) { - var flag = flags.charAt(i4); + for (var i5 = 0; i5 < flags.length; i5++) { + var flag = flags.charAt(i5); if (validFlags.indexOf(flag) === -1) { this.raise(state.start, "Invalid regular expression flag"); } - if (flags.indexOf(flag, i4 + 1) > -1) { + if (flags.indexOf(flag, i5 + 1) > -1) { this.raise(state.start, "Duplicate regular expression flag"); } } @@ -21500,9 +21663,9 @@ pp$1.regexp_pattern = function(state) { if (state.maxBackReference > state.numCapturingParens) { state.raise("Invalid escape"); } - for (var i4 = 0, list = state.backReferenceNames; i4 < list.length; i4 += 1) { - var name = list[i4]; - if (state.groupNames.indexOf(name) === -1) { + for (var i5 = 0, list = state.backReferenceNames; i5 < list.length; i5 += 1) { + var name2 = list[i5]; + if (state.groupNames.indexOf(name2) === -1) { state.raise("Invalid named capture referenced"); } } @@ -21941,10 +22104,10 @@ function isCharacterClassEscape(ch) { pp$1.regexp_eatUnicodePropertyValueExpression = function(state) { var start = state.pos; if (this.regexp_eatUnicodePropertyName(state) && state.eat(61)) { - var name = state.lastStringValue; + var name2 = state.lastStringValue; if (this.regexp_eatUnicodePropertyValue(state)) { var value = state.lastStringValue; - this.regexp_validateUnicodePropertyNameAndValue(state, name, value); + this.regexp_validateUnicodePropertyNameAndValue(state, name2, value); return true; } } @@ -21956,11 +22119,11 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) { } return false; }; -pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) { - if (!hasOwn(state.unicodeProperties.nonBinary, name)) { +pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name2, value) { + if (!hasOwn(state.unicodeProperties.nonBinary, name2)) { state.raise("Invalid property name"); } - if (!state.unicodeProperties.nonBinary[name].test(value)) { + if (!state.unicodeProperties.nonBinary[name2].test(value)) { state.raise("Invalid property value"); } }; @@ -22152,7 +22315,7 @@ function isOctalDigit(ch) { pp$1.regexp_eatFixedHexDigits = function(state, length) { var start = state.pos; state.lastIntValue = 0; - for (var i4 = 0; i4 < length; ++i4) { + for (var i5 = 0; i5 < length; ++i5) { var ch = state.current(); if (!isHexDigit(ch)) { state.pos = start; @@ -22618,7 +22781,7 @@ pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { var allowSeparators = this.options.ecmaVersion >= 12 && len === void 0; var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48; var start = this.pos, total = 0, lastCode = 0; - for (var i4 = 0, e4 = len == null ? Infinity : len; i4 < e4; ++i4, ++this.pos) { + for (var i5 = 0, e4 = len == null ? Infinity : len; i5 < e4; ++i5, ++this.pos) { var code = this.input.charCodeAt(this.pos), val = void 0; if (allowSeparators && code === 95) { if (isLegacyOctalNumericLiteral) { @@ -22627,7 +22790,7 @@ pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) { if (lastCode === 95) { this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"); } - if (i4 === 0) { + if (i5 === 0) { this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"); } lastCode = code; @@ -23028,8 +23191,8 @@ function ignore(_node, _st, _c2) { } var base = {}; base.Program = base.BlockStatement = base.StaticBlock = function(node, st, c4) { - for (var i4 = 0, list = node.body; i4 < list.length; i4 += 1) { - var stmt = list[i4]; + for (var i5 = 0, list = node.body; i5 < list.length; i5 += 1) { + var stmt = list[i5]; c4(stmt, st, "Statement"); } }; @@ -23060,8 +23223,8 @@ base.SwitchStatement = function(node, st, c4) { if (cs.test) { c4(cs.test, st, "Expression"); } - for (var i4 = 0, list = cs.consequent; i4 < list.length; i4 += 1) { - var cons = list[i4]; + for (var i5 = 0, list = cs.consequent; i5 < list.length; i5 += 1) { + var cons = list[i5]; c4(cons, st, "Statement"); } } @@ -23070,8 +23233,8 @@ base.SwitchCase = function(node, st, c4) { if (node.test) { c4(node.test, st, "Expression"); } - for (var i4 = 0, list = node.consequent; i4 < list.length; i4 += 1) { - var cons = list[i4]; + for (var i5 = 0, list = node.consequent; i5 < list.length; i5 += 1) { + var cons = list[i5]; c4(cons, st, "Statement"); } }; @@ -23131,8 +23294,8 @@ base.FunctionDeclaration = function(node, st, c4) { return c4(node, st, "Function"); }; base.VariableDeclaration = function(node, st, c4) { - for (var i4 = 0, list = node.declarations; i4 < list.length; i4 += 1) { - var decl = list[i4]; + for (var i5 = 0, list = node.declarations; i5 < list.length; i5 += 1) { + var decl = list[i5]; c4(decl, st); } }; @@ -23146,8 +23309,8 @@ base.Function = function(node, st, c4) { if (node.id) { c4(node.id, st, "Pattern"); } - for (var i4 = 0, list = node.params; i4 < list.length; i4 += 1) { - var param = list[i4]; + for (var i5 = 0, list = node.params; i5 < list.length; i5 += 1) { + var param = list[i5]; c4(param, st, "Pattern"); } c4(node.body, st, node.expression ? "Expression" : "Statement"); @@ -23167,16 +23330,16 @@ base.RestElement = function(node, st, c4) { return c4(node.argument, st, "Pattern"); }; base.ArrayPattern = function(node, st, c4) { - for (var i4 = 0, list = node.elements; i4 < list.length; i4 += 1) { - var elt = list[i4]; + for (var i5 = 0, list = node.elements; i5 < list.length; i5 += 1) { + var elt = list[i5]; if (elt) { c4(elt, st, "Pattern"); } } }; base.ObjectPattern = function(node, st, c4) { - for (var i4 = 0, list = node.properties; i4 < list.length; i4 += 1) { - var prop = list[i4]; + for (var i5 = 0, list = node.properties; i5 < list.length; i5 += 1) { + var prop = list[i5]; if (prop.type === "Property") { if (prop.computed) { c4(prop.key, st, "Expression"); @@ -23190,29 +23353,29 @@ base.ObjectPattern = function(node, st, c4) { base.Expression = skipThrough; base.ThisExpression = base.Super = base.MetaProperty = ignore; base.ArrayExpression = function(node, st, c4) { - for (var i4 = 0, list = node.elements; i4 < list.length; i4 += 1) { - var elt = list[i4]; + for (var i5 = 0, list = node.elements; i5 < list.length; i5 += 1) { + var elt = list[i5]; if (elt) { c4(elt, st, "Expression"); } } }; base.ObjectExpression = function(node, st, c4) { - for (var i4 = 0, list = node.properties; i4 < list.length; i4 += 1) { - var prop = list[i4]; + for (var i5 = 0, list = node.properties; i5 < list.length; i5 += 1) { + var prop = list[i5]; c4(prop, st); } }; base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration; base.SequenceExpression = function(node, st, c4) { - for (var i4 = 0, list = node.expressions; i4 < list.length; i4 += 1) { - var expr = list[i4]; + for (var i5 = 0, list = node.expressions; i5 < list.length; i5 += 1) { + var expr = list[i5]; c4(expr, st, "Expression"); } }; base.TemplateLiteral = function(node, st, c4) { - for (var i4 = 0, list = node.quasis; i4 < list.length; i4 += 1) { - var quasi = list[i4]; + for (var i5 = 0, list = node.quasis; i5 < list.length; i5 += 1) { + var quasi = list[i5]; c4(quasi, st); } for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1) { @@ -23240,8 +23403,8 @@ base.ConditionalExpression = function(node, st, c4) { base.NewExpression = base.CallExpression = function(node, st, c4) { c4(node.callee, st, "Expression"); if (node.arguments) { - for (var i4 = 0, list = node.arguments; i4 < list.length; i4 += 1) { - var arg = list[i4]; + for (var i5 = 0, list = node.arguments; i5 < list.length; i5 += 1) { + var arg = list[i5]; c4(arg, st, "Expression"); } } @@ -23267,8 +23430,8 @@ base.ExportAllDeclaration = function(node, st, c4) { c4(node.source, st, "Expression"); }; base.ImportDeclaration = function(node, st, c4) { - for (var i4 = 0, list = node.specifiers; i4 < list.length; i4 += 1) { - var spec = list[i4]; + for (var i5 = 0, list = node.specifiers; i5 < list.length; i5 += 1) { + var spec = list[i5]; c4(spec, st); } c4(node.source, st, "Expression"); @@ -23294,8 +23457,8 @@ base.Class = function(node, st, c4) { c4(node.body, st); }; base.ClassBody = function(node, st, c4) { - for (var i4 = 0, list = node.body; i4 < list.length; i4 += 1) { - var elt = list[i4]; + for (var i5 = 0, list = node.body; i5 < list.length; i5 += 1) { + var elt = list[i5]; c4(elt, st); } }; @@ -23382,8 +23545,8 @@ function formatSequence(state, nodes) { if (nodes != null && nodes.length > 0) { generator[nodes[0].type](nodes[0], state); const { length } = nodes; - for (let i4 = 1; i4 < length; i4++) { - const param = nodes[i4]; + for (let i5 = 1; i5 < length; i5++) { + const param = nodes[i5]; state.write(", "); generator[param.type](param, state); } @@ -23426,22 +23589,22 @@ function reindent(state, text2, indent, lineEnd) { state.write(lines[0].trim()); if (end > 0) { state.write(lineEnd); - for (let i4 = 1; i4 < end; i4++) { - state.write(indent + lines[i4].trim() + lineEnd); + for (let i5 = 1; i5 < end; i5++) { + state.write(indent + lines[i5].trim() + lineEnd); } state.write(indent + lines[end].trim()); } } function formatComments(state, comments, indent, lineEnd) { const { length } = comments; - for (let i4 = 0; i4 < length; i4++) { - const comment = comments[i4]; + for (let i5 = 0; i5 < length; i5++) { + const comment2 = comments[i5]; state.write(indent); - if (comment.type[0] === "L") { - state.write("// " + comment.value.trim() + "\n", comment); + if (comment2.type[0] === "L") { + state.write("// " + comment2.value.trim() + "\n", comment2); } else { state.write("/*"); - reindent(state, comment.value, indent, lineEnd); + reindent(state, comment2.value, indent, lineEnd); state.write("*/" + lineEnd); } } @@ -23466,9 +23629,9 @@ function formatVariableDeclaration(state, node) { const { length } = declarations; if (length > 0) { generator.VariableDeclarator(declarations[0], state); - for (let i4 = 1; i4 < length; i4++) { + for (let i5 = 1; i5 < length; i5++) { state.write(", "); - generator.VariableDeclarator(declarations[i4], state); + generator.VariableDeclarator(declarations[i5], state); } } } @@ -23487,8 +23650,8 @@ var GENERATOR = { } const statements = node.body; const { length } = statements; - for (let i4 = 0; i4 < length; i4++) { - const statement = statements[i4]; + for (let i5 = 0; i5 < length; i5++) { + const statement = statements[i5]; if (writeComments && statement.comments != null) { formatComments(state, statement.comments, indent, lineEnd); } @@ -23512,8 +23675,8 @@ var GENERATOR = { formatComments(state, node.comments, statementIndent, lineEnd); } const { length } = statements; - for (let i4 = 0; i4 < length; i4++) { - const statement = statements[i4]; + for (let i5 = 0; i5 < length; i5++) { + const statement = statements[i5]; if (writeComments && statement.comments != null) { formatComments(state, statement.comments, statementIndent, lineEnd); } @@ -23602,8 +23765,8 @@ var GENERATOR = { state.write(") {" + lineEnd); const { cases: occurences } = node; const { length: occurencesCount } = occurences; - for (let i4 = 0; i4 < occurencesCount; i4++) { - const occurence = occurences[i4]; + for (let i5 = 0; i5 < occurencesCount; i5++) { + const occurence = occurences[i5]; if (writeComments && occurence.comments != null) { formatComments(state, occurence.comments, caseIndent, lineEnd); } @@ -23616,8 +23779,8 @@ var GENERATOR = { } const { consequent } = occurence; const { length: consequentCount } = consequent; - for (let i5 = 0; i5 < consequentCount; i5++) { - const statement = consequent[i5]; + for (let i6 = 0; i6 < consequentCount; i6++) { + const statement = consequent[i6]; if (writeComments && statement.comments != null) { formatComments(state, statement.comments, statementIndent, lineEnd); } @@ -23755,34 +23918,34 @@ var GENERATOR = { state.write("import "); const { specifiers } = node; const { length } = specifiers; - let i4 = 0; + let i5 = 0; if (length > 0) { - for (; i4 < length; ) { - if (i4 > 0) { + for (; i5 < length; ) { + if (i5 > 0) { state.write(", "); } - const specifier = specifiers[i4]; + const specifier = specifiers[i5]; const type = specifier.type[6]; if (type === "D") { state.write(specifier.local.name, specifier); - i4++; + i5++; } else if (type === "N") { state.write("* as " + specifier.local.name, specifier); - i4++; + i5++; } else { break; } } - if (i4 < length) { + if (i5 < length) { state.write("{"); for (; ; ) { - const specifier = specifiers[i4]; - const { name } = specifier.imported; - state.write(name, specifier); - if (name !== specifier.local.name) { + const specifier = specifiers[i5]; + const { name: name2 } = specifier.imported; + state.write(name2, specifier); + if (name2 !== specifier.local.name) { state.write(" as " + specifier.local.name); } - if (++i4 < length) { + if (++i5 < length) { state.write(", "); } else { break; @@ -23815,14 +23978,14 @@ var GENERATOR = { state.write("{"); const { specifiers } = node, { length } = specifiers; if (length > 0) { - for (let i4 = 0; ; ) { - const specifier = specifiers[i4]; - const { name } = specifier.local; - state.write(name, specifier); - if (name !== specifier.exported.name) { + for (let i5 = 0; ; ) { + const specifier = specifiers[i5]; + const { name: name2 } = specifier.local; + state.write(name2, specifier); + if (name2 !== specifier.exported.name) { state.write(" as " + specifier.exported.name); } - if (++i4 < length) { + if (++i5 < length) { state.write(", "); } else { break; @@ -23919,9 +24082,9 @@ var GENERATOR = { const { quasis, expressions } = node; state.write("`"); const { length } = expressions; - for (let i4 = 0; i4 < length; i4++) { - const expression = expressions[i4]; - const quasi2 = quasis[i4]; + for (let i5 = 0; i5 < length; i5++) { + const expression = expressions[i5]; + const quasi2 = quasis[i5]; state.write(quasi2.value.raw, quasi2); state.write("${"); this[expression.type](expression, state); @@ -23942,12 +24105,12 @@ var GENERATOR = { state.write("["); if (node.elements.length > 0) { const { elements } = node, { length } = elements; - for (let i4 = 0; ; ) { - const element = elements[i4]; + for (let i5 = 0; ; ) { + const element = elements[i5]; if (element != null) { this[element.type](element, state); } - if (++i4 < length) { + if (++i5 < length) { state.write(", "); } else { if (element == null) { @@ -23972,14 +24135,14 @@ var GENERATOR = { } const comma = "," + lineEnd; const { properties: properties2 } = node, { length } = properties2; - for (let i4 = 0; ; ) { - const property2 = properties2[i4]; + for (let i5 = 0; ; ) { + const property2 = properties2[i5]; if (writeComments && property2.comments != null) { formatComments(state, property2.comments, propertyIndent, lineEnd); } state.write(propertyIndent); this[property2.type](property2, state); - if (++i4 < length) { + if (++i5 < length) { state.write(comma); } else { break; @@ -24052,9 +24215,9 @@ var GENERATOR = { state.write("{"); if (node.properties.length > 0) { const { properties: properties2 } = node, { length } = properties2; - for (let i4 = 0; ; ) { - this[properties2[i4].type](properties2[i4], state); - if (++i4 < length) { + for (let i5 = 0; ; ) { + this[properties2[i5].type](properties2[i5], state); + if (++i5 < length) { state.write(", "); } else { break; @@ -24069,17 +24232,17 @@ var GENERATOR = { UnaryExpression(node, state) { if (node.prefix) { const { - operator, + operator: operator2, argument, argument: { type } } = node; - state.write(operator); + state.write(operator2); const needsParentheses = expressionNeedsParenthesis(state, argument, node); - if (!needsParentheses && (operator.length > 1 || type[0] === "U" && (type[1] === "n" || type[1] === "p") && argument.prefix && argument.operator[0] === operator && (operator === "+" || operator === "-"))) { + if (!needsParentheses && (operator2.length > 1 || type[0] === "U" && (type[1] === "n" || type[1] === "p") && argument.prefix && argument.operator[0] === operator2 && (operator2 === "+" || operator2 === "-"))) { state.write(" "); } if (needsParentheses) { - state.write(operator.length > 1 ? " (" : "("); + state.write(operator2.length > 1 ? " (" : "("); this[type](argument, state); state.write(")"); } else { @@ -24278,8 +24441,8 @@ var State = class { if (type[0] === "T" && type[8] === "E" || type[0] === "L" && type[1] === "i" && typeof node.value === "string") { const { length: length2 } = code; let { column, line } = this; - for (let i4 = 0; i4 < length2; i4++) { - if (code[i4] === "\n") { + for (let i5 = 0; i5 < length2; i5++) { + if (code[i5] === "\n") { column = 0; line++; } else { @@ -24314,7 +24477,7 @@ function generate(node, options) { // src/utils/frames/linker.ts var preprocessCode = (code, oldName, newName) => { - let string; + let string2; let codeBlock2 = ensureString(code); const isMultiLine = codeBlock2.includes("\n"); if (isMultiLine) { @@ -24334,17 +24497,17 @@ var preprocessCode = (code, oldName, newName) => { } } }); - string = generate(ast).trimEnd(); + string2 = generate(ast).trimEnd(); } catch (e4) { console.log(e4); - string = `"error"`; + string2 = `"error"`; } if (isMultiLine) { - const lines = string.split("\n").filter((line) => line.trim() !== ""); + const lines = string2.split("\n").filter((line) => line.trim() !== ""); lines[lines.length - 1] = `return ${lines[lines.length - 1]}`; - string = lines.join("\n"); + string2 = lines.join("\n"); } - return string; + return string2; }; var linkNodes = (parent, schemaId, props2, flattenedTree, uniqueID) => { const relinkProps = (oldParent, newParent2, props3, node) => { @@ -24382,15 +24545,16 @@ var linkNodes = (parent, schemaId, props2, flattenedTree, uniqueID) => { }; }; const assignIDs = (parent2, nodes) => { - const [newNodes, newID] = nodes.reduce((p3, c4, i4) => { - const [oldNodes, id2] = p3; - const newNodeID = c4.parentId ? c4.id + id2 : parent2.id; + const [newNodes, newID] = nodes.reduce((p3, c4, i5) => { + const [oldNodes, id3] = p3; + const newNodeID = c4.parentId ? c4.id + id3 : parent2.id; const newNode = { - ...oldNodes[i4], + ...c4.parentId == "" ? parent2 : oldNodes[i5], + type: oldNodes[i5].type, id: newNodeID }; const returnNodes = oldNodes.map((f4) => f4.id != c4.id ? relinkProps(c4.id, newNodeID, props2, f4) : relinkProps(c4.id, newNodeID, props2, newNode)); - return [returnNodes, id2 + 1]; + return [returnNodes, id3 + 1]; }, [nodes, uniqueID]); return [newNodes, newID]; }; @@ -24442,23 +24606,23 @@ var linkTreeNodes = (parent, uniqueID) => { }; }; const assignIDs = (parent2, node, uniqueID2) => { - const assignIDToTree = (parent3, node2, id2) => { - const newNodeID = node2.node.parentId ? node2.id + id2 : parent3.id; + const assignIDToTree = (parent3, node2, id3) => { + const newNodeID = node2.node.parentId ? node2.id + id3 : parent3.id; let newNode = { ...node2, node: { ...node2.node, id: newNodeID }, id: newNodeID }; newNode = relinkProps(node2.id, newNodeID, newNode); if (newNode.children) { const [newChildren, newID] = newNode.children.reduce( - (acc, child, i4) => { - const [newChild, nextID] = assignIDToTree(newNode, child, id2 + i4 + 1); + (acc, child, i5) => { + const [newChild, nextID] = assignIDToTree(newNode, child, id3 + i5 + 1); acc[0].push(newChild); return [acc[0], nextID]; }, - [[], id2] + [[], id3] ); newNode.children = newChildren; - id2 = newID; + id3 = newID; } - return [newNode, id2 + 1]; + return [newNode, id3 + 1]; }; return assignIDToTree(parent2, node, uniqueID2); }; @@ -24503,6 +24667,15 @@ var nodeToFrame = (node) => { props: JSON.stringify(props2) }; }; +var mergePropObjects = (obj1, obj2) => { + const mergedObject = { ...obj1, ...obj2 }; + for (const key2 in obj2) { + if (obj2[key2] === null) { + delete mergedObject[key2]; + } + } + return mergedObject; +}; // src/utils/frames/ast.ts function replaceSubtree(tree, subtree) { @@ -24510,10 +24683,10 @@ function replaceSubtree(tree, subtree) { return subtree; } if (tree.children) { - for (let i4 = 0; i4 < tree.children.length; i4++) { - const replacedChild = replaceSubtree(tree.children[i4], subtree); - if (replacedChild !== tree.children[i4]) { - tree.children[i4] = replacedChild; + for (let i5 = 0; i5 < tree.children.length; i5++) { + const replacedChild = replaceSubtree(tree.children[i5], subtree); + if (replacedChild !== tree.children[i5]) { + tree.children[i5] = replacedChild; } } } @@ -24521,6 +24694,8 @@ function replaceSubtree(tree, subtree) { } var getFrameNodesByPath = (plugin, ref2) => { const path = uriByString(ref2); + if (!path) + return; if (path.space == "$kit") { return kit.find((f4) => f4.schema.id == path.ref); } @@ -24551,39 +24726,40 @@ function insertFrameChildren(root2, newChildren) { const newRoot = traverseAndInsert(root2); return newRoot; } -var expandNode = (treeNode, id2, plugin) => { +var expandNode = (treeNode, id3, plugin) => { if (treeNode.node.type == "frame") { const mdbFrame = getFrameNodesByPath(plugin, treeNode.node.ref); if (treeNode.node.schemaId == (mdbFrame == null ? void 0 : mdbFrame.schema.id)) - return [treeNode, id2]; + return [treeNode, id3]; if (!mdbFrame || mdbFrame.rows.length == 0) { - return [treeNode, id2]; + return [treeNode, id3]; } + const linkedNode = linkProps(mdbFrame.cols, treeNode); const [linkedNodes, newUniqueID] = linkNodes( - treeNode.node, + linkedNode.node, mdbFrame.schema.id, - treeNode.node.props, + linkedNode.node.props, mdbFrame.rows.map((f4) => frameToNode(f4)), - id2 + id3 ); const [newTreeNode, newID] = buildFrameTree( - treeNode.node, + linkedNode.node, linkedNodes, plugin, newUniqueID, true ); if (!newTreeNode) { - return [treeNode, newID]; + return [linkedNode, newID]; } - return [insertFrameChildren(linkProps(mdbFrame.cols, { ...newTreeNode, isRef: false, node: { ...treeNode.node, type: "frame", styles: { ...newTreeNode.node.styles, ...treeNode.node.styles }, props: { ...newTreeNode.node.props, ...treeNode.node.props }, actions: { ...newTreeNode.node.actions, ...treeNode.node.actions }, id: newTreeNode.id } }), treeNode.children), newID]; + return [insertFrameChildren({ ...newTreeNode, isRef: false, node: { ...newTreeNode.node, schemaId: linkedNode.node.schemaId, ref: linkedNode.node.ref, types: linkedNode.node.types, propsAttrs: linkedNode.node.propsAttrs, propsValue: linkedNode.node.propsValue, parentId: linkedNode.node.parentId, type: "frame", id: newTreeNode.id } }, treeNode.children), newID]; } - return [treeNode, id2]; + return [treeNode, id3]; }; var expandFrame = (node, plugin, uniqueID = 0, parentType) => { const [children, lastID] = node.children.reduce((f4, c4) => { - const [nodes, id2] = f4; - const [newNode2, fid] = expandFrame(c4, plugin, id2 + 1, node.node.type); + const [nodes, id3] = f4; + const [newNode2, fid] = expandFrame(c4, plugin, id3 + 1, node.node.type); return [[...nodes, newNode2], fid + 1]; }, [[], uniqueID]); const [newNode, newID] = expandNode({ ...node, children, parentType }, lastID, plugin); @@ -24595,10 +24771,14 @@ var expandFrame = (node, plugin, uniqueID = 0, parentType) => { var linkProps = (fields, root2) => { const props2 = fields.reduce((p3, c4) => ({ ...p3, [c4.name]: "" }), {}); const types2 = fields.reduce((p3, c4) => ({ ...p3, [c4.name]: c4.type }), {}); + const propsValue = fields.reduce((p3, c4) => ({ ...p3, [c4.name]: c4.value }), {}); + const propsAttrs = fields.reduce((p3, c4) => ({ ...p3, [c4.name]: c4.attrs }), {}); return { ...root2, node: { ...root2.node, props: { ...props2, ...root2.node.props }, - types: { ...types2, ...root2.node.types } + types: { ...types2, ...root2.node.types }, + propsValue: { ...propsValue, ...root2.node.propsValue }, + propsAttrs: { ...propsAttrs, ...root2.node.propsAttrs } } }; }; var applyPropsToRoot = (root2, props2) => ({ @@ -24638,11 +24818,16 @@ var buildRoot = (schema, fields, nodes, plugin) => { const root2 = buildFrameTree(rootNode, nodes, plugin, nodes.length, false)[0]; return root2 && linkProps(fields, root2); }; -var propertiesForNode = (node) => Object.keys(node.types).map((f4) => ({ - type: node.types[f4], - name: f4, - schemaId: f4 -})); +var propertiesForNode = (node) => Object.keys(node.types).map((f4) => { + var _a2, _b2; + return { + type: node.types[f4], + name: f4, + schemaId: f4, + value: (_a2 = node.propsValue) == null ? void 0 : _a2[f4], + attrs: (_b2 = node.propsAttrs) == null ? void 0 : _b2[f4] + }; +}); var buildFrameTree = (root2, nodes, plugin, uniqueID = 0, isRef) => { const rootNode = { node: root2, id: root2.id, children: [], isRef }; const idToNodeMap = { [root2.id]: rootNode }; @@ -24654,7 +24839,7 @@ var buildFrameTree = (root2, nodes, plugin, uniqueID = 0, isRef) => { const parentNode = idToNodeMap[node.parentId]; if (parentNode) { parentNode.children.push({ ...idToNodeMap[node.id], parentType: parentNode.node.type }); - parentNode.children.sort((a5, b4) => a5.node.rank - b4.node.rank); + parentNode.children.sort((a6, b4) => a6.node.rank - b4.node.rank); } } else { if (node.id == root2.id) @@ -24698,7 +24883,7 @@ var defaultFrameSchema = { ] }; var nodeToTypes = (type) => { - return type == "flow" ? { value: "link" } : type == "group" || type == "content" || type == "frame" ? {} : { + return type == "flow" ? { value: "link" } : type == "container" || type == "group" || type == "content" || type == "frame" ? {} : { value: type }; }; @@ -24724,9 +24909,9 @@ var columnsNode = { icon: "lucide//columns" }, node: { - id: "group", - schemaId: "group", - name: "Group", + id: "container", + schemaId: "container", + name: "Columns", rank: 0, parentId: "", styles: { @@ -24734,7 +24919,7 @@ var columnsNode = { width: `'100%'`, gap: `'24px'` }, - type: "group" + type: "container" } }; var columnNode = { @@ -24758,7 +24943,7 @@ var columnNode = { type: "column" } }; -var groupableTypes = ["content", "group", "column", "list"]; +var groupableTypes = ["content", "group", "container", "column", "list"]; var flowNode = { def: { icon: "lucide//file-text" @@ -24886,11 +25071,29 @@ var buttonNode = { types: { icon: "icon", label: "text", - action: "text", - actionValue: "text" + action: "option", + actionValue: "super" + }, + propsAttrs: { + action: JSON.stringify({ + name: "When Clicked", + icon: "lucide//mouse-pointer-click" + }), + actionValue: JSON.stringify({ + name: "Perform Action" + }) + }, + propsValue: { + action: JSON.stringify({ + options: [{ name: "Run Command", value: "$commands" }, { name: "Open Link", value: "$links" }] + }), + actionValue: JSON.stringify({ + dynamic: true, + field: "action" + }) }, actions: { - onClick: `(a,b,c,api) => {api.buttonCommand(button.props.action, button.props.actionValue)}` + onClick: `(a,b,c,api) => api.buttonCommand(button.props.action, button.props.actionValue)` }, styles: { class: `'mk-button'`, @@ -25016,10 +25219,13 @@ var rootToFrame = (root2) => { return { schema: { id: root2.id, name: root2.node.name, type: "frame" }, cols: Object.keys(root2.node.types).map((f4) => { + var _a2, _b2; return { name: f4, schemaId: root2.id, - type: root2.node.types[f4] + type: root2.node.types[f4], + value: (_a2 = root2.node.propsValue) == null ? void 0 : _a2[f4], + attrs: (_b2 = root2.node.propsAttrs) == null ? void 0 : _b2[f4] }; }), rows: flattenToFrameNodes(root2).map((f4) => nodeToFrame(f4)) @@ -25043,7 +25249,51 @@ var parsePropString = (str) => { }; // src/schemas/mdb.ts -var fieldTypeForType = (type) => fieldTypes.find((t4) => type == t4.type) || fieldTypes.find((t4) => type == t4.multiType); +var parseFieldValue = (value, type) => { + let valueProp = safelyParseJSON(value); + if (!type) + return {}; + if (!valueProp) { + if (type == "context") { + if ((value == null ? void 0 : value.length) > 0) { + valueProp = { + space: value + }; + } else { + valueProp = {}; + } + } else if (type.startsWith("date")) { + if ((value == null ? void 0 : value.length) > 0) { + valueProp = { + format: value + }; + } else { + valueProp = {}; + } + } else if (type.startsWith("fileprop")) { + if ((value == null ? void 0 : value.length) > 0) { + const [field, val] = value.split("."); + valueProp = { + field, + value: val + }; + } else { + valueProp = {}; + } + } else if (type.startsWith("option")) { + if ((value == null ? void 0 : value.length) > 0) { + const options = parseMultiString(value).map((f4) => ({ name: f4, value: f4 })); + valueProp = { + options + }; + } else { + valueProp = {}; + } + } + } + return valueProp != null ? valueProp : {}; +}; +var fieldTypeForType = (type) => fieldTypes.find((t5) => type == t5.type) || fieldTypes.find((t5) => type == t5.multiType); var fieldTypes = [ { type: "unknown", @@ -25051,11 +25301,6 @@ var fieldTypes = [ restricted: true, icon: "lucide//file-question" }, - { - type: "preview", - label: i18n_default.properties.preview.label, - restricted: true - }, { type: "text", label: i18n_default.properties.text.label, @@ -25104,20 +25349,22 @@ var fieldTypes = [ multi: true, multiType: "link-multi", metadata: true, - icon: "ui//mk-make-note" + icon: "lucide//file-text" }, { type: "context", label: i18n_default.properties.context.label, + icon: "ui//mk-make-note", multi: true, - multiType: "context-multi", - icon: "ui//mk-make-note" + multiType: "context-multi" }, { type: "object", - label: i18n_default.properties.context.label, - restricted: true, - metadata: true + label: i18n_default.properties.object.label, + multi: true, + multiType: "object-multi", + metadata: true, + icon: "lucide//list-tree" }, { type: "icon", @@ -25143,9 +25390,15 @@ var fieldTypes = [ }, { type: "space", - label: i18n_default.properties.color.label, + label: i18n_default.properties.space.label, metadata: true, - icon: "ui//mk-ui-spaces" + icon: "lucide//layout-grid" + }, + { + type: "super", + label: "Super Property", + icon: "lucide//zap", + restricted: true } ]; var defaultFileDBSchema = { @@ -25161,7 +25414,7 @@ var defaultFileListSchema = { def: { db: "files" } }; var mainFrameID = "main"; -var defaultMainFrameSchema = (id2) => ({ id: id2, name: id2, type: "frame", def: "", predicate: "", primary: "true" }); +var defaultMainFrameSchema = (id3) => ({ id: id3, name: id3, type: "frame", def: "", predicate: "", primary: "true" }); var defaultFramesSchema = { uniques: [], cols: ["id", "name", "type", "def", "predicate", "primary"], @@ -25188,16 +25441,6 @@ var fieldSchema = { var defaultFolderFields = { ...fieldSchema, rows: [ - { - name: i18n_default.properties.preview.label, - schemaId: "files", - type: "preview", - hidden: "", - unique: "", - attrs: "", - value: "", - primary: "" - }, { name: FilePropertyName, schemaId: "files", @@ -25220,10 +25463,10 @@ var defaultFolderFields = { } ] }; -var defaultFieldsForContext = (space) => { - if (space.uri.type == "tag") { +var defaultFieldsForContext = (space2) => { + if (space2.uri.type == "tag") { return defaultTagFields; - } else if (space.uri.type == "folder") { + } else if (space2.uri.type == "folder") { return defaultFolderFields; } return defaultFolderFields; @@ -25250,7 +25493,7 @@ var defaultTagFields = { } ] }; -var defaultMDBTableForContext = (space) => { +var defaultMDBTableForContext = (space2) => { return defaultFolderMDBTable; }; var defaultFolderMDBTable = { @@ -25269,7 +25512,7 @@ var defaultTagMDBTable = { rows: [] }; var fieldsToTable = (fields, schemas) => { - return fields.filter((s5) => schemas.find((g4) => g4.id == s5.schemaId && g4.type == "db")).reduce((p3, c4) => { + return fields.filter((s6) => schemas.find((g4) => g4.id == s6.schemaId && g4.type == "db")).reduce((p3, c4) => { return { ...p3, ...p3[c4.schemaId] ? { @@ -25288,10 +25531,10 @@ var fieldsToTable = (fields, schemas) => { }; }, {}); }; -var defaultTablesForContext = (space) => { - if (space.uri.type == "tag") { +var defaultTablesForContext = (space2) => { + if (space2.uri.type == "tag") { return defaultTagTables; - } else if (space.uri.type == "folder") { + } else if (space2.uri.type == "folder") { return defaultFolderTables; } return defaultFolderTables; @@ -25370,30 +25613,30 @@ var import_obsidian5 = require("obsidian"); init_compat_module(); // src/utils/sanitize.ts -var sanitizeTableName = (name) => { - return name == null ? void 0 : name.replace(/[^a-z0-9+]+/gi, ""); +var sanitizeTableName = (name2) => { + return name2 == null ? void 0 : name2.replace(/[^a-z0-9+]+/gi, ""); }; -var sanitizeColumnName = (name) => { - if ((name == null ? void 0 : name.charAt(0)) == "_") { - return sanitizeColumnName(name.substring(1)); +var sanitizeColumnName = (name2) => { + if ((name2 == null ? void 0 : name2.charAt(0)) == "_") { + return sanitizeColumnName(name2.substring(1)); } - return name == null ? void 0 : name.replace(/"/g, ``); + return name2 == null ? void 0 : name2.replace(/"/g, ``); }; var folderReservedRe = /^[+\$#^]+/; var illegalRe = /[\/\?<>\\:\*\|":]/g; var controlRe = /[\x00-\x1f\x80-\x9f]/g; var reservedRe = /^\.+$/; var windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i; -var sanitizeFolderName = (name) => { +var sanitizeFolderName = (name2) => { const replacement = ""; - return name.replace(folderReservedRe, replacement).replace(illegalRe, replacement).replace(controlRe, replacement).replace(reservedRe, replacement).replace(windowsReservedRe, replacement); + return name2.replace(folderReservedRe, replacement).replace(illegalRe, replacement).replace(controlRe, replacement).replace(reservedRe, replacement).replace(windowsReservedRe, replacement); }; -var sanitizeFileName = (name) => { +var sanitizeFileName = (name2) => { const replacement = ""; - return name.replace(illegalRe, replacement).replace(controlRe, replacement).replace(reservedRe, replacement).replace(windowsReservedRe, replacement); + return name2.replace(illegalRe, replacement).replace(controlRe, replacement).replace(reservedRe, replacement).replace(windowsReservedRe, replacement); }; -var sanitizeSQLStatement = (name) => { - return name == null ? void 0 : name.replace(/'/g, `''`); +var sanitizeSQLStatement = (name2) => { + return name2 == null ? void 0 : name2.replace(/'/g, `''`); }; // src/utils/db/db.ts @@ -25453,7 +25696,7 @@ var schemasAndFields = (tables) => { }; var dbResultsToDBTables = (res) => { return res.reduce( - (p3, c4, i4) => [ + (p3, c4, i5) => [ ...p3, { cols: c4.columns, @@ -25498,23 +25741,23 @@ var dropTable = (db, table) => { } }; var replaceDB = (db, tables) => { - const sqlstr = serializeSQLStatements(Object.keys(tables).map((t4) => { - const tableFields = tables[t4].cols; + const sqlstr = serializeSQLStatements(Object.keys(tables).map((t5) => { + const tableFields = tables[t5].cols; const fieldQuery = serializeSQLFieldNames(uniq(tableFields).filter((f4) => f4).map((f4) => `'${sanitizeSQLStatement(f4)}' char`)); - const rowsQuery = tables[t4].rows.reduce((prev, curr) => { - return `${prev} REPLACE INTO "${t4}" VALUES (${serializeSQLValues(tableFields.map((c4) => { + const rowsQuery = tables[t5].rows.reduce((prev, curr) => { + return `${prev} REPLACE INTO "${t5}" VALUES (${serializeSQLValues(tableFields.map((c4) => { var _a2; return `'${sanitizeSQLStatement((_a2 = curr == null ? void 0 : curr[c4]) != null ? _a2 : "")}'`; }))});`; }, ""); - const idxQuery = tables[t4].uniques.filter((f4) => f4).reduce((p3, c4) => { - return `${p3} CREATE UNIQUE INDEX IF NOT EXISTS "idx_${t4}_${c4.replace( + const idxQuery = tables[t5].uniques.filter((f4) => f4).reduce((p3, c4) => { + return `${p3} CREATE UNIQUE INDEX IF NOT EXISTS "idx_${t5}_${c4.replace( /,/g, "_" - )}" ON "${t4}"(${c4});`; + )}" ON "${t5}"(${c4});`; }, ""); - const insertQuery = `CREATE TABLE IF NOT EXISTS "${t4}" (${fieldQuery}); ${idxQuery} BEGIN TRANSACTION; ${rowsQuery} COMMIT;`; - return `DROP INDEX IF EXISTS "idx_${t4}__id"; DROP TABLE IF EXISTS "${t4}"; ${fieldQuery.length > 0 ? insertQuery : ""}`; + const insertQuery = `CREATE TABLE IF NOT EXISTS "${t5}" (${fieldQuery}); ${idxQuery} BEGIN TRANSACTION; ${rowsQuery} COMMIT;`; + return `DROP INDEX IF EXISTS "idx_${t5}__id"; DROP TABLE IF EXISTS "${t5}"; ${fieldQuery.length > 0 ? insertQuery : ""}`; })); try { db.exec(sqlstr); @@ -25553,8 +25796,8 @@ var dbTableToMDBTable = (table, schema, fields) => { rows: (_a2 = table == null ? void 0 : table.rows) != null ? _a2 : [] }; }; -var updateFieldsToSchema = (fields, space) => { - const defaultFields = defaultFieldsForContext(space); +var updateFieldsToSchema = (fields, space2) => { + const defaultFields = defaultFieldsForContext(space2); return [ ...fields, ...defaultFields.rows.filter( @@ -25562,16 +25805,16 @@ var updateFieldsToSchema = (fields, space) => { ) ]; }; -var getContextMDB = async (plugin, space) => { - if (!space) +var getContextMDB = async (plugin, space2) => { + if (!space2) return null; const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(space.dbPath, space.isRemote); + const buf = await getDBFile(space2.dbPath, space2.isRemote); if (!buf) { return null; } const db = new sqlJS.Database(new Uint8Array(buf)); - await sanitizeTableSchema(plugin, db, space, "context"); + await sanitizeTableSchema(plugin, db, space2, "context"); let fields; let schemas; try { @@ -25603,12 +25846,12 @@ var getContextMDB = async (plugin, space) => { tables: dbTable }; }; -var getFramesMDB = async (plugin, space) => { +var getFramesMDB = async (plugin, space2) => { var _a2, _b2, _c2, _d2; - if (!space) + if (!space2) return null; const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(space.framePath, space.isRemote); + const buf = await getDBFile(space2.framePath, space2.isRemote); if (!buf) { return null; } @@ -25647,16 +25890,16 @@ var getFramesMDB = async (plugin, space) => { }; }; var dbPathForSpaceInfo = (spaceInfo, type) => type == "context" ? spaceInfo.dbPath : type == "frames" ? spaceInfo.framePath : null; -var getMDBTable = async (plugin, space, table, dbType) => { - if (!space) +var getMDBTable = async (plugin, space2, table, dbType) => { + if (!space2) return null; const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(space.dbPath, space.isRemote); + const buf = await getDBFile(space2.dbPath, space2.isRemote); if (!buf) { return null; } const db = new sqlJS.Database(new Uint8Array(buf)); - await sanitizeTableSchema(plugin, db, space, dbType); + await sanitizeTableSchema(plugin, db, space2, dbType); let fieldsTables; let schema; try { @@ -25692,14 +25935,14 @@ var getMDBTable = async (plugin, space, table, dbType) => { return dbTableToMDBTable( dbTable[0], schema, - schema.primary ? updateFieldsToSchema(fields, space) : fields + schema.primary ? updateFieldsToSchema(fields, space2) : fields ); }; -var deleteMDBTable = async (plugin, space, table, dbPath) => { - if (space.readOnly) +var deleteMDBTable = async (plugin, space2, table, dbPath) => { + if (space2.readOnly) return false; const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(dbPath, space.isRemote); + const buf = await getDBFile(dbPath, space2.isRemote); if (!buf) { return false; } @@ -25712,20 +25955,20 @@ var deleteMDBTable = async (plugin, space, table, dbPath) => { db.close(); return true; }; -var getMDBTableSchemas = async (plugin, space, dbType) => { +var getMDBTableSchemas = async (plugin, space2, dbType) => { var _a2, _b2; const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(dbPathForSpaceInfo(space, dbType), space.isRemote); + const buf = await getDBFile(dbPathForSpaceInfo(space2, dbType), space2.isRemote); if (!buf) { return null; } const db = new sqlJS.Database(new Uint8Array(buf)); - await sanitizeTableSchema(plugin, db, space, dbType); + await sanitizeTableSchema(plugin, db, space2, dbType); const tables = db.exec(`SELECT * FROM m_schema`); db.close(); return ((_b2 = (_a2 = tables[0]) == null ? void 0 : _a2.values) != null ? _b2 : []).map((f4) => { - const [id2, name, type, def, predicate, primary] = f4; - return { id: id2, name, type, def, predicate, primary }; + const [id3, name2, type, def, predicate, primary] = f4; + return { id: id3, name: name2, type, def, predicate, primary }; }); }; var saveMDBToPath = async (plugin, context, mdb) => { @@ -25769,14 +26012,14 @@ var optionValuesForColumn = (column, table) => { }, [])) != null ? _a2 : [] ); }; -var defaultTableDataForContext = (plugin, space) => { - const files = [...plugin.index.spacesMap.getInverse(space.path)]; +var defaultTableDataForContext = (plugin, space2) => { + const files = [...plugin.index.spacesMap.getInverse(space2.path)]; return { - ...defaultMDBTableForContext(space), + ...defaultMDBTableForContext(space2), rows: files.map((f4) => ({ File: f4 })) }; }; -var createFramesMDB = async (plugin, space) => { +var createFramesMDB = async (plugin, space2) => { const dbField = { m_schema: defaultFramesSchema, m_fields: { @@ -25785,19 +26028,19 @@ var createFramesMDB = async (plugin, space) => { rows: [] } }; - const result = await saveDBToPath(plugin, space.framePath, dbField); + const result = await saveDBToPath(plugin, space2.framePath, dbField); if (result) { - await plugin.index.reloadFrames(space); + await plugin.index.reloadFrames(space2); return true; } return false; }; -var createContextMDB = async (plugin, space) => { +var createContextMDB = async (plugin, space2) => { var _a2; - const table = defaultTableDataForContext(plugin, space); + const table = defaultTableDataForContext(plugin, space2); if (table) { - const defaultFields = defaultFieldsForContext(space); - const defaultTable = defaultTablesForContext(space); + const defaultFields = defaultFieldsForContext(space2); + const defaultTable = defaultTablesForContext(space2); const dbField = { ...defaultTable, m_fields: { @@ -25811,9 +26054,9 @@ var createContextMDB = async (plugin, space) => { rows: table.rows } }; - const result = await saveDBToPath(plugin, space.dbPath, dbField); + const result = await saveDBToPath(plugin, space2.dbPath, dbField); if (result) { - await plugin.index.reloadContext(space); + await plugin.index.reloadContext(space2); table.rows.map((f4) => getAbstractFileAtPath(app, f4.File)).forEach((f4) => f4 && plugin.index.reloadFile(f4, true)); return true; } @@ -25821,18 +26064,18 @@ var createContextMDB = async (plugin, space) => { } return false; }; -var sanitizeTableSchema = async (plugin, db, space, dbType) => { +var sanitizeTableSchema = async (plugin, db, space2, dbType) => { const sqlJS = await plugin.sqlJS(); const tableRes = db.exec( `SELECT name FROM sqlite_master WHERE type='table';` ); if (dbType == "context") { if (!tableRes[0] || !tableRes[0].values.some((f4) => f4[0] == "m_schema") || !tableRes[0].values.some((f4) => f4[0] == "m_fields") || !tableRes[0].values.some((f4) => f4[0] == "files")) { - await createContextMDB(plugin, space); + await createContextMDB(plugin, space2); } } else { if (!tableRes[0] || !tableRes[0].values.some((f4) => f4[0] == "m_schema") || !tableRes[0].values.some((f4) => f4[0] == "m_fields")) { - await createFramesMDB(plugin, space); + await createFramesMDB(plugin, space2); } } }; @@ -25848,21 +26091,21 @@ var createNewRow = (mdb, row, index) => { rows: [...mdb.rows, row] }; }; -var deleteSpaceFolder = async (plugin, space) => { - const spacePath = folderForSpace(space, plugin); +var deleteSpaceFolder = async (plugin, space2) => { + const spacePath = folderForSpace(space2, plugin); if (getAbstractFileAtPath(app, spacePath)) { await deleteFile(plugin, getAbstractFileAtPath(app, spacePath)); } }; -var spaceFolderDelete = (space) => { +var spaceFolderDelete = (space2) => { app.workspace.iterateLeaves((leaf) => { - if (leaf.view.getViewType() == SPACE_VIEW_TYPE && leaf.view.getState().path == space) { + if (leaf.view.getViewType() == SPACE_VIEW_TYPE && leaf.view.getState().path == space2) { leaf.setViewState({ type: "empty" }); } }, app.workspace["rootSplit"]); }; -var renameSpaceFolder = async (plugin, space, newSpace) => { - const spacePath = folderForSpace(space, plugin); +var renameSpaceFolder = async (plugin, space2, newSpace) => { + const spacePath = folderForSpace(space2, plugin); if (getAbstractFileAtPath(app, spacePath)) { if (!getAbstractFileAtPath( app, @@ -25880,11 +26123,47 @@ var renameSpaceFolder = async (plugin, space, newSpace) => { }; // src/utils/frames/mdb.ts -var getMFrameTables = async (plugin, space) => { +var getMFrameTable = async (plugin, space2, table) => { + var _a2, _b2; + if (!space2) + return null; + const sqlJS = await plugin.sqlJS(); + const buf = await getDBFile(space2.framePath, space2.isRemote); + if (!buf) { + return null; + } + const db = new sqlJS.Database(new Uint8Array(buf)); + let fieldsTables; + let schema; + try { + fieldsTables = dbResultsToDBTables( + db.exec(`SELECT * FROM m_fields WHERE schemaId = '${table}'`) + ); + schema = dbResultsToDBTables( + db.exec(`SELECT * FROM m_schema WHERE id = '${table}'`) + )[0].rows[0]; + } catch (e4) { + db.close(); + return null; + } + if (!schema) + return null; + const fields = ((_b2 = (_a2 = fieldsTables == null ? void 0 : fieldsTables[0]) == null ? void 0 : _a2.rows) != null ? _b2 : []).filter( + (f4) => f4.name.length > 0 + ); + const dbTable = dbResultsToDBTables(db.exec(`SELECT * FROM "${table}"`)); + db.close(); + return dbTableToMDBTable( + dbTable[0], + schema, + fields + ); +}; +var getMFrameTables = async (plugin, space2) => { if (!frames) return null; const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(space.framePath, space.isRemote); + const buf = await getDBFile(space2.framePath, space2.isRemote); if (!buf) { return null; } @@ -25926,12 +26205,12 @@ var getMFrameTables = async (plugin, space) => { db.close(); return mdbTables; }; -var saveMFramesToPath = async (plugin, space, mdb) => { +var saveMFramesToPath = async (plugin, space2, mdb) => { var _a2, _b2, _c2; - if (space.readOnly) + if (space2.readOnly) return; const sqlJS = await plugin.sqlJS(); - const buf = await getDBFile(space.framePath, space.isRemote); + const buf = await getDBFile(space2.framePath, space2.isRemote); if (!buf) { return null; } @@ -25957,7 +26236,7 @@ var saveMFramesToPath = async (plugin, space, mdb) => { } }; db.close(); - return saveDBToPath(plugin, space.framePath, tables); + return saveDBToPath(plugin, space2.framePath, tables); }; // src/context/SpaceContext.tsx @@ -26257,6 +26536,101 @@ var FramesMDBProvider = (props2) => { var import_obsidian46 = require("obsidian"); init_compat_module(); +// node_modules/@air/react-drag-to-select/dist/index.modern.js +init_compat_module(); +init_compat_module(); +var import_react_style_object_to_css = __toESM(require_react_style_object_to_css(), 1); +function a3() { + return a3 = Object.assign ? Object.assign.bind() : function(e4) { + for (var t5 = 1; t5 < arguments.length; t5++) { + var n2 = arguments[t5]; + for (var r3 in n2) + Object.prototype.hasOwnProperty.call(n2, r3) && (e4[r3] = n2[r3]); + } + return e4; + }, a3.apply(this, arguments); +} +var s3 = ["style"]; +var d3 = k3((t5, u4) => { + let { style: d6 = {} } = t5, m6 = function(e4, t6) { + if (null == e4) + return {}; + var n2, r3, o3 = {}, l3 = Object.keys(e4); + for (r3 = 0; r3 < l3.length; r3++) + t6.indexOf(n2 = l3[r3]) >= 0 || (o3[n2] = e4[n2]); + return o3; + }(t5, s3); + const v4 = _2(null), f4 = _2(null), [, p3] = h2(0); + return A2(u4, () => ({ getBoundingClientRect: () => { + var e4; + return null == (e4 = v4.current) ? void 0 : e4.getBoundingClientRect(); + }, getParentBoundingClientRect: () => { + var e4, t6; + return null == v4 || null == (e4 = v4.current) || null == (t6 = e4.parentElement) ? void 0 : t6.getBoundingClientRect(); + }, drawSelectionBox: (e4) => { + requestAnimationFrame(() => { + if (f4.current) { + const t6 = a3({ border: "1px solid #4C85D8", background: "rgba(155, 193, 239, 0.4)", position: "absolute", pointerEvents: "none" }, d6, { top: e4.top, left: e4.left, width: e4.width, height: e4.height }); + f4.current.style.cssText = (0, import_react_style_object_to_css.default)(t6); + } + }); + }, clearSelectionBox: () => { + requestAnimationFrame(() => { + f4.current && (f4.current.style.cssText = (0, import_react_style_object_to_css.default)({ top: 0, left: 0, width: 0, height: 0 })); + }); + } })), p2(() => { + p3((e4) => e4 + 1); + }, []), Cn.createElement("div", { ref: v4 }, v4.current ? Cn.createPortal(Cn.createElement("div", a3({ ref: f4 }, m6)), v4.current) : null); +}); +var m3 = (e4, t5) => e4.left <= t5.left + t5.width && e4.left + e4.width >= t5.left && e4.top <= t5.top + t5.height && e4.top + e4.height >= t5.top; +function v3(t5) { + const { onSelectionChange: r3, onSelectionEnd: o3, onSelectionStart: c4, isEnabled: i5 = true, selectionProps: s6 = {}, eventsElement: m6, shouldStartSelecting: v4 } = t5 || {}, f4 = _2(null), { cancelCurrentSelection: p3 } = function({ containerRef: e4, onSelectionChange: t6, onSelectionStart: r4, onSelectionEnd: o4, isEnabled: c5 = true, eventsElement: i6, shouldStartSelecting: s7 }) { + const d6 = _2(null), m7 = _2(null), v5 = _2(false), f5 = _2(t6), p4 = _2(r4), h5 = _2(o4), g4 = _2(), y5 = _2(c5); + f5.current = T2((e5) => { + g4.current = t6 ? requestAnimationFrame(() => { + t6(e5); + }) : void 0; + }, [t6]), p4.current = r4, h5.current = o4, y5.current = c5; + const b4 = T2(() => { + var t7; + d6.current = null, m7.current = null, v5.current = false, null == (t7 = e4.current) || t7.clearSelectionBox(), "number" == typeof g4.current && cancelAnimationFrame(g4.current); + }, [e4]), S4 = T2((t7, n2) => { + var r5, o5, l3; + return n2 || (n2 = null == (l3 = e4.current) ? void 0 : l3.getParentBoundingClientRect()), { x: t7.clientX - ("number" == typeof (null == (r5 = n2) ? void 0 : r5.left) ? n2.left : 0), y: t7.clientY - ("number" == typeof (null == (o5 = n2) ? void 0 : o5.top) ? n2.top : 0) }; + }, [e4]), E4 = T2((t7, n2) => { + if (d6.current && m7.current) { + if (!n2) + return; + const l3 = (({ startPoint: e5, endPoint: t8 }) => ({ left: Math.min(e5.x, t8.x), top: Math.min(e5.y, t8.y), width: Math.abs(e5.x - t8.x), height: Math.abs(e5.y - t8.y) }))({ startPoint: d6.current, endPoint: m7.current }), u4 = a3({}, l3, { top: l3.top + ((null == n2 ? void 0 : n2.top) || 0), left: l3.left + ((null == n2 ? void 0 : n2.left) || 0) }); + var r5; + (o5 = l3).width * o5.height > 10 ? (v5.current || (null != p4 && p4.current && p4.current(t7), v5.current = true), null == (r5 = e4.current) || r5.drawSelectionBox(l3), null == f5.current || f5.current(u4)) : v5.current && (null == f5.current || f5.current(u4)); + } else + b4(); + var o5; + }, [b4, e4]), w5 = T2((t7) => { + var n2; + if (!d6.current) + return; + const r5 = null == (n2 = e4.current) ? void 0 : n2.getParentBoundingClientRect(); + m7.current = S4(t7, r5), E4(t7, r5); + }, [E4, S4, e4]), x5 = T2((e5) => { + var t7; + 0 === e5.button && (m7.current && (null == h5.current || h5.current(e5)), b4(), document.body.style.removeProperty("user-select"), document.body.style.removeProperty("-webkit-user-select"), (i6 || document.body).removeEventListener("mousemove", w5), null == (t7 = window) || t7.removeEventListener("mouseup", x5)); + }, [i6, b4, w5]), C3 = T2((e5) => { + if (0 === e5.button && y5.current) { + var t7; + if ("function" == typeof s7 && !s7(e5.target)) + return; + document.body.style.userSelect = "none", document.body.style.webkitUserSelect = "none", d6.current = S4(e5), (i6 || document.body).addEventListener("mousemove", w5), null == (t7 = window) || t7.addEventListener("mouseup", x5); + } + }, [i6, S4, w5, x5]); + return p2(() => ((i6 || document.body).addEventListener("mousedown", C3), () => { + (i6 || document.body).removeEventListener("mousedown", C3), (i6 || document.body).removeEventListener("mousemove", w5), window.removeEventListener("mouseup", x5); + }), [i6, C3, w5, x5]), { cancelCurrentSelection: b4 }; + }({ containerRef: f4, onSelectionEnd: o3, onSelectionStart: c4, onSelectionChange: r3, isEnabled: i5, eventsElement: m6, shouldStartSelecting: v4 }); + return { cancelCurrentSelection: p3, DragSelection: T2(() => Cn.createElement(d3, a3({ ref: f4 }, s6)), []) }; +} + // node_modules/@dnd-kit/core/dist/core.esm.js init_compat_module(); init_compat_module(); @@ -26404,9 +26778,9 @@ function useUniqueId(prefix, value) { if (value) { return value; } - const id2 = ids[prefix] == null ? 0 : ids[prefix] + 1; - ids[prefix] = id2; - return prefix + "-" + id2; + const id3 = ids[prefix] == null ? 0 : ids[prefix] + 1; + ids[prefix] = id3; + return prefix + "-" + id3; }, [prefix, value]); } function createAdjustmentFn(modifier) { @@ -26540,11 +26914,11 @@ var hiddenStyles = { }; function HiddenText(_ref) { let { - id: id2, + id: id3, value } = _ref; return Cn.createElement("div", { - id: id2, + id: id3, style: hiddenStyles }, value); } @@ -26562,11 +26936,11 @@ var visuallyHidden = { }; function LiveRegion(_ref) { let { - id: id2, + id: id3, announcement } = _ref; return Cn.createElement("div", { - id: id2, + id: id3, style: visuallyHidden, role: "status", "aria-live": "assertive", @@ -26785,7 +27159,7 @@ function getRelativeTransformOrigin(event, rect) { function sortCollisionsAsc(_ref, _ref2) { let { data: { - value: a5 + value: a6 } } = _ref; let { @@ -26793,12 +27167,12 @@ function sortCollisionsAsc(_ref, _ref2) { value: b4 } } = _ref2; - return a5 - b4; + return a6 - b4; } function sortCollisionsDesc(_ref3, _ref4) { let { data: { - value: a5 + value: a6 } } = _ref3; let { @@ -26806,7 +27180,7 @@ function sortCollisionsDesc(_ref3, _ref4) { value: b4 } } = _ref4; - return b4 - a5; + return b4 - a6; } function cornersOfRectangle(_ref5) { let { @@ -26858,13 +27232,13 @@ var closestCenter = (_ref) => { const collisions = []; for (const droppableContainer of droppableContainers) { const { - id: id2 + id: id3 } = droppableContainer; - const rect = droppableRects.get(id2); + const rect = droppableRects.get(id3); if (rect) { const distBetween = distanceBetween(centerOfRectangle(rect), centerRect); collisions.push({ - id: id2, + id: id3, data: { droppableContainer, value: distBetween @@ -26884,9 +27258,9 @@ var closestCorners = (_ref) => { const collisions = []; for (const droppableContainer of droppableContainers) { const { - id: id2 + id: id3 } = droppableContainer; - const rect = droppableRects.get(id2); + const rect = droppableRects.get(id3); if (rect) { const rectCorners = cornersOfRectangle(rect); const distances = corners.reduce((accumulator, corner, index) => { @@ -26894,7 +27268,7 @@ var closestCorners = (_ref) => { }, 0); const effectiveDistance = Number((distances / 4).toFixed(4)); collisions.push({ - id: id2, + id: id3, data: { droppableContainer, value: effectiveDistance @@ -26929,14 +27303,14 @@ var rectIntersection = (_ref) => { const collisions = []; for (const droppableContainer of droppableContainers) { const { - id: id2 + id: id3 } = droppableContainer; - const rect = droppableRects.get(id2); + const rect = droppableRects.get(id3); if (rect) { const intersectionRatio = getIntersectionRatio(rect, collisionRect); if (intersectionRatio > 0) { collisions.push({ - id: id2, + id: id3, data: { droppableContainer, value: intersectionRatio @@ -28105,16 +28479,16 @@ function useScrollIntent(_ref2) { }; }, [disabled, delta, previousDelta]); } -function useCachedNode(draggableNodes, id2) { - const draggableNode = id2 !== null ? draggableNodes.get(id2) : void 0; +function useCachedNode(draggableNodes, id3) { + const draggableNode = id3 !== null ? draggableNodes.get(id3) : void 0; const node = draggableNode ? draggableNode.node.current : null; return useLazyMemo((cachedNode) => { var _ref; - if (id2 === null) { + if (id3 === null) { return null; } return (_ref = node != null ? node : cachedNode) != null ? _ref : null; - }, [node, id2]); + }, [node, id3]); } function useCombineActivators(sensors, getSyntheticHandler) { return F2(() => sensors.reduce((accumulator, sensor) => { @@ -28165,7 +28539,7 @@ function useDroppableMeasuring(containers, _ref) { if (value === null) { return ids2; } - return value.concat(ids2.filter((id2) => !value.includes(id2))); + return value.concat(ids2.filter((id3) => !value.includes(id3))); }); }, [disabledRef]); const timeoutId = _2(null); @@ -28476,7 +28850,7 @@ function useSensorSetup(sensors) { }) ); } -function useSyntheticListeners(listeners, id2) { +function useSyntheticListeners(listeners, id3) { return F2(() => { return listeners.reduce((acc, _ref) => { let { @@ -28484,11 +28858,11 @@ function useSyntheticListeners(listeners, id2) { handler } = _ref; acc[eventName] = (event) => { - handler(event, id2); + handler(event, id3); }; return acc; }, {}); - }, [listeners, id2]); + }, [listeners, id3]); } function useWindowRect(element) { return F2(() => element ? getWindowClientRect(element) : null, [element]); @@ -28597,9 +28971,9 @@ var defaultMeasuringConfiguration = { } }; var DroppableContainersMap = class extends Map { - get(id2) { + get(id3) { var _super$get; - return id2 != null ? (_super$get = super.get(id2)) != null ? _super$get : void 0 : void 0; + return id3 != null ? (_super$get = super.get(id3)) != null ? _super$get : void 0 : void 0; } toArray() { return Array.from(this.values()); @@ -28612,9 +28986,9 @@ var DroppableContainersMap = class extends Map { return !disabled; }); } - getNodeFor(id2) { + getNodeFor(id3) { var _this$get$node$curren, _this$get; - return (_this$get$node$curren = (_this$get = this.get(id2)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0; + return (_this$get$node$curren = (_this$get = this.get(id3)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0; } }; var defaultPublicContext = { @@ -28723,10 +29097,10 @@ function reducer(state, action) { element } = action; const { - id: id2 + id: id3 } = element; const containers = new DroppableContainersMap(state.droppable.containers); - containers.set(id2, element); + containers.set(id3, element); return { ...state, droppable: { @@ -28737,16 +29111,16 @@ function reducer(state, action) { } case Action.SetDroppableDisabled: { const { - id: id2, + id: id3, key: key2, disabled } = action; - const element = state.droppable.containers.get(id2); + const element = state.droppable.containers.get(id3); if (!element || key2 !== element.key) { return state; } const containers = new DroppableContainersMap(state.droppable.containers); - containers.set(id2, { + containers.set(id3, { ...element, disabled }); @@ -28760,15 +29134,15 @@ function reducer(state, action) { } case Action.UnregisterDroppable: { const { - id: id2, + id: id3, key: key2 } = action; - const element = state.droppable.containers.get(id2); + const element = state.droppable.containers.get(id3); if (!element || key2 !== element.key) { return state; } const containers = new DroppableContainersMap(state.droppable.containers); - containers.delete(id2); + containers.delete(id3); return { ...state, droppable: { @@ -28924,7 +29298,7 @@ var Status; var DndContext = /* @__PURE__ */ x3(function DndContext2(_ref) { var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect; let { - id: id2, + id: id3, accessibility, autoScroll = true, children, @@ -28966,7 +29340,7 @@ var DndContext = /* @__PURE__ */ x3(function DndContext2(_ref) { const [activeSensor, setActiveSensor] = h2(null); const [activatorEvent, setActivatorEvent] = h2(null); const latestProps = useLatestValue(props2, Object.values(props2)); - const draggableDescribedById = useUniqueId("DndDescribedBy", id2); + const draggableDescribedById = useUniqueId("DndDescribedBy", id3); const enabledDroppableContainers = F2(() => droppableContainers.getEnabled(), [droppableContainers]); const measuringConfiguration = useMeasuringConfiguration(measuring); const { @@ -29072,11 +29446,11 @@ var DndContext = /* @__PURE__ */ x3(function DndContext2(_ref) { options, context: sensorContext, onStart(initialCoordinates) { - const id3 = activeRef.current; - if (id3 == null) { + const id4 = activeRef.current; + if (id4 == null) { return; } - const draggableNode = draggableNodes.get(id3); + const draggableNode = draggableNodes.get(id4); if (!draggableNode) { return; } @@ -29085,7 +29459,7 @@ var DndContext = /* @__PURE__ */ x3(function DndContext2(_ref) { } = latestProps.current; const event2 = { active: { - id: id3, + id: id4, data: draggableNode.data, rect: activeRects } @@ -29096,7 +29470,7 @@ var DndContext = /* @__PURE__ */ x3(function DndContext2(_ref) { dispatch({ type: Action.DragStart, initialCoordinates, - active: id3 + active: id4 }); dispatchMonitorEvent({ type: "onDragStart", @@ -29373,7 +29747,7 @@ var defaultRole = "button"; var ID_PREFIX = "Droppable"; function useDraggable(_ref) { let { - id: id2, + id: id3, data: data2, disabled = false, attributes @@ -29393,29 +29767,29 @@ function useDraggable(_ref) { roleDescription = "draggable", tabIndex = 0 } = attributes != null ? attributes : {}; - const isDragging = (active == null ? void 0 : active.id) === id2; + const isDragging = (active == null ? void 0 : active.id) === id3; const transform = q2(isDragging ? ActiveDraggableContext : NullContext); const [node, setNodeRef] = useNodeRef(); const [activatorNode, setActivatorNodeRef] = useNodeRef(); - const listeners = useSyntheticListeners(activators, id2); + const listeners = useSyntheticListeners(activators, id3); const dataRef = useLatestValue(data2); useIsomorphicLayoutEffect( () => { - draggableNodes.set(id2, { - id: id2, + draggableNodes.set(id3, { + id: id3, key: key2, node, activatorNode, data: dataRef }); return () => { - const node2 = draggableNodes.get(id2); + const node2 = draggableNodes.get(id3); if (node2 && node2.key === key2) { - draggableNodes.delete(id2); + draggableNodes.delete(id3); } }; }, - [draggableNodes, id2] + [draggableNodes, id3] ); const memoizedAttributes = F2(() => ({ role, @@ -29450,7 +29824,7 @@ function useDroppable(_ref) { let { data: data2, disabled = false, - id: id2, + id: id3, resizeObserverConfig } = _ref; const key2 = useUniqueId(ID_PREFIX$1); @@ -29474,7 +29848,7 @@ function useDroppable(_ref) { ...defaultResizeObserverConfig, ...resizeObserverConfig }; - const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id2); + const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id3); const handleResize = T2( () => { if (!resizeObserverConnected.current) { @@ -29522,7 +29896,7 @@ function useDroppable(_ref) { dispatch({ type: Action.RegisterDroppable, element: { - id: id2, + id: id3, key: key2, disabled, node: nodeRef, @@ -29533,26 +29907,26 @@ function useDroppable(_ref) { return () => dispatch({ type: Action.UnregisterDroppable, key: key2, - id: id2 + id: id3 }); }, - [id2] + [id3] ); p2(() => { if (disabled !== previous.current.disabled) { dispatch({ type: Action.SetDroppableDisabled, - id: id2, + id: id3, key: key2, disabled }); previous.current.disabled = disabled; } - }, [id2, key2, disabled, dispatch]); + }, [id3, key2, disabled, dispatch]); return { active, rect, - isOver: (over == null ? void 0 : over.id) === id2, + isOver: (over == null ? void 0 : over.id) === id3, node: nodeRef, over, setNodeRef @@ -29574,12 +29948,12 @@ function AnimationManager(_ref) { return; } const key2 = clonedChildren == null ? void 0 : clonedChildren.key; - const id2 = clonedChildren == null ? void 0 : clonedChildren.props.id; - if (key2 == null || id2 == null) { + const id3 = clonedChildren == null ? void 0 : clonedChildren.props.id; + if (key2 == null || id3 == null) { setClonedChildren(null); return; } - Promise.resolve(animation(id2, element)).then(() => { + Promise.resolve(animation(id3, element)).then(() => { setClonedChildren(null); }); }, [animation, clonedChildren, element]); @@ -29722,11 +30096,11 @@ function useDropAnimation(_ref3) { droppableContainers, measuringConfiguration } = _ref3; - return useEvent((id2, node) => { + return useEvent((id3, node) => { if (config === null) { return; } - const activeDraggable = draggableNodes.get(id2); + const activeDraggable = draggableNodes.get(id3); if (!activeDraggable) { return; } @@ -29749,7 +30123,7 @@ function useDropAnimation(_ref3) { scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure); return animation({ active: { - id: id2, + id: id3, data: activeDraggable.data, node: activeNode, rect: measuringConfiguration.draggable.measure(activeNode) @@ -29831,14 +30205,14 @@ function createDefaultDropAnimation(options) { }; } var key = 0; -function useKey(id2) { +function useKey(id3) { return F2(() => { - if (id2 == null) { + if (id3 == null) { return; } key++; return key; - }, [id2]); + }, [id3]); } var DragOverlay = /* @__PURE__ */ Cn.memo((_ref) => { let { @@ -29917,8 +30291,8 @@ function arrayMove(array, from, to) { return newArray; } function getSortedRects(items, rects) { - return items.reduce((accumulator, id2, index) => { - const rect = rects.get(id2); + return items.reduce((accumulator, id3, index) => { + const rect = rects.get(id3); if (rect) { accumulator[index] = rect; } @@ -29928,15 +30302,15 @@ function getSortedRects(items, rects) { function isValidIndex(index) { return index !== null && index >= 0; } -function itemsEqual(a5, b4) { - if (a5 === b4) { +function itemsEqual(a6, b4) { + if (a6 === b4) { return true; } - if (a5.length !== b4.length) { + if (a6.length !== b4.length) { return false; } - for (let i4 = 0; i4 < a5.length; i4++) { - if (a5[i4] !== b4[i4]) { + for (let i5 = 0; i5 < a6.length; i5++) { + if (a6[i5] !== b4[i5]) { return false; } } @@ -30111,7 +30485,7 @@ var Context = /* @__PURE__ */ Cn.createContext({ function SortableContext(_ref) { let { children, - id: id2, + id: id3, items: userDefinedItems, strategy = rectSortingStrategy, disabled: disabledProp = false @@ -30123,7 +30497,7 @@ function SortableContext(_ref) { over, measureDroppableContainers } = useDndContext(); - const containerId = useUniqueId(ID_PREFIX2, id2); + const containerId = useUniqueId(ID_PREFIX2, id3); const useDragOverlay = Boolean(dragOverlay.rect !== null); const items = F2(() => userDefinedItems.map((item) => typeof item === "object" && "id" in item ? item.id : item), [userDefinedItems]); const isDragging = active != null; @@ -30161,12 +30535,12 @@ function SortableContext(_ref) { } var defaultNewIndexGetter = (_ref) => { let { - id: id2, + id: id3, items, activeIndex, overIndex } = _ref; - return arrayMove(items, activeIndex, overIndex).indexOf(id2); + return arrayMove(items, activeIndex, overIndex).indexOf(id3); }; var defaultAnimateLayoutChanges = (_ref2) => { let { @@ -30249,7 +30623,7 @@ function useSortable(_ref) { disabled: localDisabled, data: customData, getNewIndex = defaultNewIndexGetter, - id: id2, + id: id3, strategy: localStrategy, resizeObserverConfig, transition = defaultTransition2 @@ -30266,7 +30640,7 @@ function useSortable(_ref) { strategy: globalStrategy } = q2(Context); const disabled = normalizeLocalDisabled(localDisabled, globalDisabled); - const index = items.indexOf(id2); + const index = items.indexOf(id3); const data2 = F2(() => ({ sortable: { containerId, @@ -30275,14 +30649,14 @@ function useSortable(_ref) { }, ...customData }), [containerId, customData, index, items]); - const itemsAfterCurrentSortable = F2(() => items.slice(items.indexOf(id2)), [items, id2]); + const itemsAfterCurrentSortable = F2(() => items.slice(items.indexOf(id3)), [items, id3]); const { rect, node, isOver, setNodeRef: setDroppableNodeRef } = useDroppable({ - id: id2, + id: id3, data: data2, disabled: disabled.droppable, resizeObserverConfig: { @@ -30302,7 +30676,7 @@ function useSortable(_ref) { setActivatorNodeRef, transform } = useDraggable({ - id: id2, + id: id3, data: data2, attributes: { ...defaultAttributes, @@ -30324,7 +30698,7 @@ function useSortable(_ref) { index }) : null; const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({ - id: id2, + id: id3, items, activeIndex, overIndex @@ -30342,7 +30716,7 @@ function useSortable(_ref) { containerId, isDragging, isSorting, - id: id2, + id: id3, index, items, newIndex: previous.current.newIndex, @@ -30531,20 +30905,20 @@ var sortableKeyboardCoordinates = (event, _ref) => { } return void 0; }; -function isSameContainer(a5, b4) { - if (!hasSortableData(a5) || !hasSortableData(b4)) { +function isSameContainer(a6, b4) { + if (!hasSortableData(a6) || !hasSortableData(b4)) { return false; } - return a5.data.current.sortable.containerId === b4.data.current.sortable.containerId; + return a6.data.current.sortable.containerId === b4.data.current.sortable.containerId; } -function isAfter(a5, b4) { - if (!hasSortableData(a5) || !hasSortableData(b4)) { +function isAfter(a6, b4) { + if (!hasSortableData(a6) || !hasSortableData(b4)) { return false; } - if (!isSameContainer(a5, b4)) { + if (!isSameContainer(a6, b4)) { return false; } - return a5.data.current.sortable.index < b4.data.current.sortable.index; + return a6.data.current.sortable.index < b4.data.current.sortable.index; } // src/components/Space/Editor/StickerMenu/emojis/default.ts @@ -35975,6 +36349,7 @@ var lucideIcon = (value) => { return (_a2 = (0, import_obsidian6.getIcon)(value)) == null ? void 0 : _a2.outerHTML; }; var uiIconSet = { + "mk-ui-rows": ``, "mk-ui-close": ` `, @@ -37390,12 +37765,12 @@ var allSpace = { // src/components/ui/modals/vaultChangeModals.ts var VaultChangeModal = class extends import_obsidian8.Modal { - constructor(plugin, file, action, space) { + constructor(plugin, file, action, space2) { super(plugin.app); this.file = file; this.action = action; this.plugin = plugin; - this.space = space; + this.space = space2; } onOpen() { const { contentEl } = this; @@ -37451,6 +37826,8 @@ var VaultChangeModal = class extends import_obsidian8.Modal { return; } this.app.vault.createFolder(path); + if (this.space) + insertSpaceItemAtIndex(this.plugin, this.space, path, 0); } this.close(); }; @@ -37485,27 +37862,43 @@ var MoveSuggestionModal = class extends import_obsidian8.FuzzySuggestModal { }); } }; +var FolderSelectModal = class extends import_obsidian8.FuzzySuggestModal { + constructor(plugin, selectedFolder) { + super(app); + this.plugin = plugin; + this.selectedFolder = selectedFolder; + } + getItemText(folder) { + return folder.name; + } + getItems() { + return getAllFoldersInVault(this.app); + } + onChooseItem(folder, evt) { + this.selectedFolder(folder); + } +}; var AddToSpaceModal = class extends import_obsidian8.FuzzySuggestModal { constructor(plugin, files) { super(app); this.plugin = plugin; this.files = files; } - getItemText(space) { - return space.name; + getItemText(space2) { + return space2.name; } getItems() { return [homeSpace, ...this.plugin.index.allSpaces().filter((f4) => f4.type == "links")]; } - onChooseItem(space, evt) { + onChooseItem(space2, evt) { this.files.forEach((f4) => { const path = uriByString(f4); if (path.type == "file" || path.type == "folder" || path.type == "vault") { - insertSpaceItemAtIndex(this.plugin, space, f4, 0); + insertSpaceItemAtIndex(this.plugin, space2, f4, 0); } else if (path.type == "space" || path.type == "tag") { const _space = this.plugin.index.spacesIndex.get(f4); if (_space) - insertSpaceItemAtIndex(this.plugin, space, f4, 0); + insertSpaceItemAtIndex(this.plugin, space2, f4, 0); } }); } @@ -37516,14 +37909,14 @@ var RemoveFromSpaceModal = class extends import_obsidian8.FuzzySuggestModal { this.plugin = plugin; this.file = this.plugin.index.filesIndex.get(file); } - getItemText(space) { - return space.name; + getItemText(space2) { + return space2.name; } getItems() { return this.file ? this.plugin.index.allSpaces().filter((f4) => f4.type == "links" && this.file.spaces.includes(f4.name)) : []; } - onChooseItem(space, evt) { - removePathsFromSpace(this.plugin, space, [this.file.path]); + onChooseItem(space2, evt) { + removePathsFromSpace(this.plugin, space2, [this.file.path]); } }; @@ -37623,23 +38016,23 @@ var parseFrontMatter = (field, value) => { case "option-multi": case "link-multi": if (typeof value === "string") { - return value; + return parseLinkString(value); } return serializeMultiString( - value.map((v3) => { - if (!v3) { + value.map((v4) => { + if (!v4) { return ""; } - if (typeof v3 === "string") { - return v3; + if (typeof v4 === "string") { + return parseLinkString(v4); } - if (v3.path) { - return v3.path; + if (v4.path) { + return v4.path; } - if (Array.isArray(value) && v3.length == 1 && Array.isArray(v3[0]) && v3[0].length == 1 && typeof v3[0][0] === "string") { - return v3[0][0]; + if (Array.isArray(value) && v4.length == 1 && Array.isArray(v4[0]) && v4[0].length == 1 && typeof v4[0][0] === "string") { + return v4[0][0]; } - return JSON.stringify(v3); + return JSON.stringify(v4); }) ); break; @@ -37648,7 +38041,7 @@ var parseFrontMatter = (field, value) => { if (Array.isArray(value) && value.length == 1 && Array.isArray(value[0]) && value[0].length == 1 && typeof value[0][0] === "string") { return value[0][0]; } else if (typeof value === "string") { - return value; + return parseLinkString(value); } return value.path; } @@ -37716,92 +38109,92 @@ var filterReturnForCol = (col, filter, row) => { var filterFnTypes = { isNotEmpty: { type: ["text", "file", "link", "link-multi", "fileprop", "image"], - fn: (v3, f4) => !empty2(v3, ""), + fn: (v4, f4) => !empty2(v4, ""), valueType: "none" }, isEmpty: { type: ["text", "file", "link", "link-multi", "fileprop", "image"], - fn: (v3, f4) => empty2(v3, ""), + fn: (v4, f4) => empty2(v4, ""), valueType: "none" }, include: { - fn: (v3, f4) => stringCompare(v3, f4), + fn: (v4, f4) => stringCompare(v4, f4), type: ["text", "file", "link", "link-multi", "fileprop", "image"], valueType: "text" }, notInclude: { type: ["text", "file", "link", "link-multi", "fileprop", "image"], - fn: (v3, f4) => !stringCompare(v3, f4), + fn: (v4, f4) => !stringCompare(v4, f4), valueType: "text" }, is: { type: ["text", "file", "link", "context", "fileprop"], - fn: (v3, f4) => stringEqual(v3, f4), + fn: (v4, f4) => stringEqual(v4, f4), valueType: "text" }, isNot: { type: ["text", "file", "link", "context", "fileprop"], - fn: (v3, f4) => !stringEqual(v3, f4), + fn: (v4, f4) => !stringEqual(v4, f4), valueType: "text" }, equal: { type: ["number"], - fn: (v3, f4) => stringEqual(v3, f4), + fn: (v4, f4) => stringEqual(v4, f4), valueType: "number" }, isGreatThan: { type: ["number"], - fn: (v3, f4) => greaterThan(v3, f4), + fn: (v4, f4) => greaterThan(v4, f4), valueType: "number" }, isLessThan: { type: ["number"], - fn: (v3, f4) => lessThan(v3, f4), + fn: (v4, f4) => lessThan(v4, f4), valueType: "number" }, isLessThanOrEqual: { type: ["number"], - fn: (v3, f4) => !greaterThan(v3, f4), + fn: (v4, f4) => !greaterThan(v4, f4), valueType: "number" }, isGreatThanOrEqual: { type: ["number"], - fn: (v3, f4) => !lessThan(v3, f4), + fn: (v4, f4) => !lessThan(v4, f4), valueType: "number" }, dateBefore: { type: ["date", "fileprop"], - fn: (v3, f4) => lessThan(v3, f4), + fn: (v4, f4) => lessThan(v4, f4), valueType: "date" }, dateAfter: { type: ["date", "fileprop"], - fn: (v3, f4) => greaterThan(v3, f4), + fn: (v4, f4) => greaterThan(v4, f4), valueType: "date" }, isSameDateAsToday: { type: ["date"], - fn: (v3, f4) => isSameDayAsToday(v3, f4), + fn: (v4, f4) => isSameDayAsToday(v4, f4), valueType: "none" }, isAnyInList: { type: ["option", "context", "option-multi", "context-multi", "tags-multi", "tags"], - fn: (v3, f4) => listIncludes(v3, f4), + fn: (v4, f4) => listIncludes(v4, f4), valueType: "list" }, isNoneInList: { type: ["option", "context", "option-multi", "context-multi", "tags-multi", "tags"], - fn: (v3, f4) => !listIncludes(v3, f4), + fn: (v4, f4) => !listIncludes(v4, f4), valueType: "list" }, isTrue: { type: ["boolean"], - fn: (v3, f4) => v3 == "true", + fn: (v4, f4) => v4 == "true", valueType: "none" }, isFalse: { type: ["boolean"], - fn: (v3, f4) => v3 != "true", + fn: (v4, f4) => v4 != "true", valueType: "none" } }; @@ -37878,16 +38271,16 @@ var fileByDef = (filters, file) => { }; // src/superstate/cacheParsers.ts -var fileMetadataToVaultItem = (cache) => { +var fileMetadataToVaultItem = (cache2) => { var _a2, _b2; return { - path: cache.path, - parent: cache.parent, - color: cache.color, - created: (_b2 = (_a2 = cache.ctime) == null ? void 0 : _a2.toString()) != null ? _b2 : "", - sticker: cache.sticker, - folder: cache.isFolder ? "true" : "false", - rank: cache.rank + path: cache2.path, + parent: cache2.parent, + color: cache2.color, + created: (_b2 = (_a2 = cache2.ctime) == null ? void 0 : _a2.toString()) != null ? _b2 : "", + sticker: cache2.sticker, + folder: cache2.isFolder ? "true" : "false", + rank: cache2.rank }; }; @@ -37896,11 +38289,11 @@ function toInteger(dirtyNumber) { if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) { return NaN; } - var number = Number(dirtyNumber); - if (isNaN(number)) { - return number; + var number2 = Number(dirtyNumber); + if (isNaN(number2)) { + return number2; } - return number < 0 ? Math.ceil(number) : Math.floor(number); + return number2 < 0 ? Math.ceil(number2) : Math.floor(number2); } // node_modules/date-fns/esm/_lib/requiredArgs/index.js @@ -38495,9 +38888,9 @@ function getUTCWeek(dirtyDate, options) { } // node_modules/date-fns/esm/_lib/addLeadingZeros/index.js -function addLeadingZeros(number, targetLength) { - var sign = number < 0 ? "-" : ""; - var output = Math.abs(number).toString(); +function addLeadingZeros(number2, targetLength) { + var sign = number2 < 0 ? "-" : ""; + var output = Math.abs(number2).toString(); while (output.length < targetLength) { output = "0" + output; } @@ -38515,10 +38908,10 @@ var formatters = { var month = date.getUTCMonth(); return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); }, - d: function d3(date, token) { + d: function d4(date, token) { return addLeadingZeros(date.getUTCDate(), token.length); }, - a: function a3(date, token) { + a: function a4(date, token) { var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? "pm" : "am"; switch (token) { case "a": @@ -38539,10 +38932,10 @@ var formatters = { H: function H3(date, token) { return addLeadingZeros(date.getUTCHours(), token.length); }, - m: function m3(date, token) { + m: function m4(date, token) { return addLeadingZeros(date.getUTCMinutes(), token.length); }, - s: function s3(date, token) { + s: function s4(date, token) { return addLeadingZeros(date.getUTCSeconds(), token.length); }, S: function S2(date, token) { @@ -38751,7 +39144,7 @@ var formatters2 = { } return addLeadingZeros(isoWeek, token.length); }, - d: function d4(date, token, localize2) { + d: function d5(date, token, localize2) { if (token === "do") { return localize2.ordinalNumber(date.getUTCDate(), { unit: "date" @@ -38866,7 +39259,7 @@ var formatters2 = { }); } }, - i: function i3(date, token, localize2) { + i: function i4(date, token, localize2) { var dayOfWeek = date.getUTCDay(); var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; switch (token) { @@ -38901,7 +39294,7 @@ var formatters2 = { }); } }, - a: function a4(date, token, localize2) { + a: function a5(date, token, localize2) { var hours = date.getUTCHours(); var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; switch (token) { @@ -39036,7 +39429,7 @@ var formatters2 = { } return addLeadingZeros(hours, token.length); }, - m: function m4(date, token, localize2) { + m: function m5(date, token, localize2) { if (token === "mo") { return localize2.ordinalNumber(date.getUTCMinutes(), { unit: "minute" @@ -39044,7 +39437,7 @@ var formatters2 = { } return lightFormatters_default.m(date, token); }, - s: function s4(date, token, localize2) { + s: function s5(date, token, localize2) { if (token === "so") { return localize2.ordinalNumber(date.getUTCSeconds(), { unit: "second" @@ -39506,19 +39899,19 @@ var formattingDayPeriodValues = { } }; var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) { - var number = Number(dirtyNumber); - var rem100 = number % 100; + var number2 = Number(dirtyNumber); + var rem100 = number2 % 100; if (rem100 > 20 || rem100 < 10) { switch (rem100 % 10) { case 1: - return number + "st"; + return number2 + "st"; case 2: - return number + "nd"; + return number2 + "nd"; case 3: - return number + "rd"; + return number2 + "rd"; } } - return number + "th"; + return number2 + "th"; }; var localize = { ordinalNumber, @@ -39552,11 +39945,11 @@ var localize_default = localize; // node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js function buildMatchFn(args) { - return function(string) { + return function(string2) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var width = options.width; var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; - var matchResult = string.match(matchPattern); + var matchResult = string2.match(matchPattern); if (!matchResult) { return null; } @@ -39570,7 +39963,7 @@ function buildMatchFn(args) { var value; value = args.valueCallback ? args.valueCallback(key2) : key2; value = options.valueCallback ? options.valueCallback(value) : value; - var rest = string.slice(matchedString.length); + var rest = string2.slice(matchedString.length); return { value, rest @@ -39596,18 +39989,18 @@ function findIndex(array, predicate) { // node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js function buildMatchPatternFn(args) { - return function(string) { + return function(string2) { var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - var matchResult = string.match(args.matchPattern); + var matchResult = string2.match(args.matchPattern); if (!matchResult) return null; var matchedString = matchResult[0]; - var parseResult = string.match(args.parsePattern); + var parseResult = string2.match(args.parsePattern); if (!parseResult) return null; var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; value = options.valueCallback ? options.valueCallback(value) : value; - var rest = string.slice(matchedString.length); + var rest = string2.slice(matchedString.length); return { value, rest @@ -40168,13 +40561,13 @@ async function replaceValues(plugin, fileOrFilePath, attribute, input, previousI throw Error("path doesn't correspond to a proper file"); } } - const content = (await plugin.app.vault.read(file)).split("\n"); + const content2 = (await plugin.app.vault.read(file)).split("\n"); const frontmatter = (_a2 = plugin.app.metadataCache.getFileCache(file)) == null ? void 0 : _a2.frontmatter; const skippedLines = []; const { position: { start, end } } = frontmatter ? frontmatter : { position: { start: void 0, end: void 0 } }; - const newContent = content.map((line, i4) => { + const newContent = content2.map((line, i5) => { const encodedInput = encodeLink(input); let encodedLine = encodeLink(line); const fullLineRegex2 = new RegExp( @@ -40236,7 +40629,7 @@ async function replaceValues(plugin, fileOrFilePath, attribute, input, previousI }); await plugin.app.vault.modify( file, - newContent.filter((line, i4) => !skippedLines.includes(i4)).join("\n") + newContent.filter((line, i5) => !skippedLines.includes(i5)).join("\n") ); const editor = (_b2 = plugin.app.workspace.getActiveViewOfType(import_obsidian9.MarkdownView)) == null ? void 0 : _b2.editor; if (editor) { @@ -40273,8 +40666,8 @@ var guestimateTypes = (_files, plugin, dv) => { const typesArray = _files.map((f4) => getAbstractFileAtPath(app, f4)).filter((f4) => f4).map((k5) => { const fm = dv && plugin.dataViewAPI() ? plugin.dataViewAPI().page(k5.path) : frontMatterForFile(k5); const fmKeys = dv ? Object.keys(fm != null ? fm : {}).filter( - (f4, i4, self2) => !self2.find( - (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 + (f4, i5, self2) => !self2.find( + (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i5 > j4 ) ? true : false ).filter((f4) => f4 != "file") : frontMatterKeys(fm); return fmKeys.reduce( @@ -40323,13 +40716,13 @@ var valueForDataview = (type, value) => { } return value; }; -var renameFrontmatterKey = (plugin, path, key2, name) => { +var renameFrontmatterKey = (plugin, path, key2, name2) => { const afile = getAbstractFileAtPath(app, path); if (afile && afile instanceof import_obsidian10.TFile) { if (app.fileManager.processFrontMatter) { app.fileManager.processFrontMatter(afile, (frontmatter) => { if (key2 in frontmatter) { - frontmatter[name] = frontmatter[key2]; + frontmatter[name2] = frontmatter[key2]; delete frontmatter[key2]; } }); @@ -40429,13 +40822,13 @@ var tagKeys = ["tag", "tags", "Tag", "Tags"]; var tagToTagPath = (tag) => { if (!tag) return null; - let string = tag; - if (string.charAt(0) != "#") - string = "#" + string; - return string.replace(/\//g, "+"); + let string2 = tag; + if (string2.charAt(0) != "#") + string2 = "#" + string2; + return string2.replace(/\//g, "+"); }; -var tagPathToTag = (string) => { - return filePathToString(string).replace(/\+/g, "/"); +var tagPathToTag = (string2) => { + return filePathToString(string2).replace(/\+/g, "/"); }; var loadTags = (plugin) => { var _a2; @@ -40481,11 +40874,11 @@ var addTagToNote = (tag, tFile) => { var positionsForTag = (tag, file) => { const currentCache = app.metadataCache.getFileCache(file); if (currentCache.tags) { - const positions = currentCache.tags.filter((f4) => f4.tag == tag).map((f4) => f4.position).sort((a5, b4) => { - if (a5.start.offset < b4.start.offset) { + const positions = currentCache.tags.filter((f4) => f4.tag == tag).map((f4) => f4.position).sort((a6, b4) => { + if (a6.start.offset < b4.start.offset) { return -1; } - if (a5.start.offset > b4.start.offset) { + if (a6.start.offset > b4.start.offset) { return 1; } return 0; @@ -40503,7 +40896,7 @@ var validateName = (tag) => { return tag.trim(); }; var renameTag = async (plugin, tag, toTag) => { - const tags = getAllSubtags(plugin, tag); + const tags2 = getAllSubtags(plugin, tag); const newTag = validateName(toTag); const files = getAllFilesForTag(tag); for (const file of files) { @@ -40519,13 +40912,13 @@ var renameTag = async (plugin, tag, toTag) => { } await renameSpaceFolder(plugin, tag, toTag); plugin.index.renameTag(tag, toTag); - for (const subtag of tags) { + for (const subtag of tags2) { await renameTag(plugin, subtag, subtag.replace(tag, newTag)); } }; var getAllSubtags = (plugin, tag) => { - const tags = loadTags(plugin); - return tags.filter((f4) => f4.startsWith(tag) && f4 != tag); + const tags2 = loadTags(plugin); + return tags2.filter((f4) => f4.startsWith(tag) && f4 != tag); }; var getAllParentTags = (str) => { if (str.startsWith("#")) { @@ -40533,11 +40926,11 @@ var getAllParentTags = (str) => { } const parts = str.split("/"); const result = []; - for (let i4 = 0; i4 < parts.length - 1; i4++) { - if (i4 === 0) { - result.push(parts[i4]); + for (let i5 = 0; i5 < parts.length - 1; i5++) { + if (i5 === 0) { + result.push(parts[i5]); } else { - result.push(result[i4 - 1] + "/" + parts[i4]); + result.push(result[i5 - 1] + "/" + parts[i5]); } } return result; @@ -40560,13 +40953,13 @@ var removeTagInFrontmatter = async (oldTag, file) => { return value; }; const editKeys = tagKeys.filter((f4) => { - let tags = []; + let tags2 = []; if (Array.isArray(fm[f4])) { - tags = fm[f4]; + tags2 = fm[f4]; } else if (typeof fm[f4] === "string") { - tags = fm[f4].replace(/\s/g, "").split(","); + tags2 = fm[f4].replace(/\s/g, "").split(","); } - if (tags.find((g4) => g4 == stringFromTag(oldTag))) + if (tags2.find((g4) => g4 == stringFromTag(oldTag))) return true; return false; }); @@ -40613,13 +41006,13 @@ var editTagInFrontmatter = async (oldTag, newTag, file) => { return value; }; const editKeys = tagKeys.filter((f4) => { - let tags = []; + let tags2 = []; if (Array.isArray(fm[f4])) { - tags = fm[f4]; + tags2 = fm[f4]; } else if (typeof fm[f4] === "string") { - tags = fm[f4].replace(/\s/g, "").split(","); + tags2 = fm[f4].replace(/\s/g, "").split(","); } - if (tags.find((g4) => g4 == stringFromTag(oldTag))) + if (tags2.find((g4) => g4 == stringFromTag(oldTag))) return true; return false; }); @@ -40697,12 +41090,12 @@ var folderChildren = (plugin, f4, exclusionList) => { return (_b2 = (_a2 = f4 == null ? void 0 : f4.children) == null ? void 0 : _a2.filter(excludeFilePredicate(plugin))) != null ? _b2 : []; }; var compareByField = (field, dir) => (_a2, _b2) => { - const a5 = dir ? _a2 : _b2; + const a6 = dir ? _a2 : _b2; const b4 = dir ? _b2 : _a2; - if (a5[field] < b4[field]) { + if (a6[field] < b4[field]) { return -1; } - if (a5[field] > b4[field]) { + if (a6[field] > b4[field]) { return 1; } return 0; @@ -40727,10 +41120,10 @@ var spaceDefKey = (plugin) => plugin.settings.fmKeyDef; var spaceLinksKey = (plugin) => plugin.settings.fmKeyLinks; var spaceSortKey = (plugin) => plugin.settings.fmKeySort; var FMSpaceKeys = (plugin) => [spaceContextsKey(plugin), spaceDefKey(plugin), spaceDefKey(plugin)]; -var defaultDefForSpace = (space, plugin) => { +var defaultDefForSpace = (space2, plugin) => { const defKey = spaceDefKey(plugin); const contextsKey = spaceContextsKey(plugin); - if (space.uri.type == "space") { + if (space2.uri.type == "space") { return { [contextsKey]: [], [defKey]: { @@ -40780,33 +41173,33 @@ var rebuildIndex = async (plugin, save) => { console.timeEnd("Make.md Vault Index"); }; var droppableTypesForSpace = (type) => type == "links" ? ["file", "folder", "links", "smart", "tag", "space"] : type == "folder" || type == "vault" || type == "tag" ? ["file", "folder"] : []; -var spaceToTreeNode = (space, collapsed, sortable, depth, parentId, parentPath) => { +var spaceToTreeNode = (space2, collapsed, sortable, depth, parentId, parentPath) => { var _a2; return { - id: parentId ? parentId + "/" + space.path : space.path, + id: parentId ? parentId + "/" + space2.path : space2.path, parentId, depth, index: 0, space: parentPath, - path: space.path, - item: space, - uri: (_a2 = space.space) == null ? void 0 : _a2.uri, + path: space2.path, + item: space2, + uri: (_a2 = space2.space) == null ? void 0 : _a2.uri, collapsed, sortable, childrenCount: 0, - type: space.type, - dropableTypes: droppableTypesForSpace(space.type) + type: space2.type, + dropableTypes: droppableTypesForSpace(space2.type) }; }; -var vaulItemToTreeNode = (item, space, path, depth, i4, collapsed, sortable, childrenCount, parentId) => ({ +var vaulItemToTreeNode = (item, space2, path, depth, i5, collapsed, sortable, childrenCount, parentId) => ({ item, file: getAbstractFileAtPath(app, item.path), - space, + space: space2, id: parentId + "/" + item.filename, parentId, depth, path, - index: i4, + index: i5, uri: uriByString(item.path), collapsed, sortable, @@ -40817,48 +41210,48 @@ var vaulItemToTreeNode = (item, space, path, depth, i4, collapsed, sortable, chi var spaceRowHeight = (plugin) => { return platformIsMobile() ? 40 : plugin.settings.spaceRowHeight; }; -var spaceSortFn = (sortStrategy, direction) => (a5, b4) => { +var spaceSortFn = (sortStrategy, direction) => (a6, b4) => { var _a2, _b2; if (sortStrategy == "rank") { - return ((_a2 = a5.rank) != null ? _a2 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); + return ((_a2 = a6.rank) != null ? _a2 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); } const sortFns = [ compareByField("isFolder", false), compareByField(sortStrategy, direction) ]; return sortFns.reduce((p3, c4) => { - return p3 == 0 ? c4(a5, b4) : p3; + return p3 == 0 ? c4(a6, b4) : p3; }, 0); }; -var flattenedTreeFromVaultItems = (plugin, root2, space, openNodes, depth, sortStrategy, direction) => { +var flattenedTreeFromVaultItems = (plugin, root2, space2, openNodes, depth, sortStrategy, direction) => { const _caches = plugin.index.getSpaceItems(root2); if (!_caches) { return []; } const flattenTree = (path, openNodes2, depth2, index, folderSort, caches) => { const items = []; - let i4 = index; + let i5 = index; const [sortStrat, dir] = folderSort.length > 0 ? parseSortStrat(folderSort) : [sortStrategy, direction]; caches.sort(spaceSortFn(sortStrat, dir)).forEach( (item) => { if (item.cacheType == "file") { item = item; - const id2 = path + "/" + item.filename; - const collapsed = !openNodes2.includes(id2); - i4 = i4 + 1; + const id3 = path + "/" + item.filename; + const collapsed = !openNodes2.includes(id3); + i5 = i5 + 1; const newItems = []; const newCaches = plugin.index.getSpaceItems(item.path); if (newCaches && !collapsed) { newItems.push( - ...flattenTree(item.path, openNodes2, depth2 + 1, i4, item.sortBy, newCaches) + ...flattenTree(item.path, openNodes2, depth2 + 1, i5, item.sortBy, newCaches) ); } const node = vaulItemToTreeNode( item, - space, + space2, path, depth2, - i4, + i5, collapsed, sortStrategy == "rank", newItems.length, @@ -40869,7 +41262,7 @@ var flattenedTreeFromVaultItems = (plugin, root2, space, openNodes, depth, sortS items.push(...newItems); } else { const collapsed = !openNodes2.includes(item.path); - items.push(spaceToTreeNode(item, collapsed, sortStrategy == "rank", depth2, path, space)); + items.push(spaceToTreeNode(item, collapsed, sortStrategy == "rank", depth2, path, space2)); } } ); @@ -40928,8 +41321,8 @@ var updateFileRank = async (plugin, item, rank) => { if (parseInt(item.rank) > rank) fixedRank = rank + 1; const newItems = insert( - plugin.index.vaultDBCache.filter((f4) => f4.parent == item.parent).filter((f4) => f4.path != item.path).map((f4, i4) => f4.rank ? f4 : { ...f4, rank: i4.toString() }).sort( - (a5, b4) => a5.rank.localeCompare(b4.rank, void 0, { numeric: true }) + plugin.index.vaultDBCache.filter((f4) => f4.parent == item.parent).filter((f4) => f4.path != item.path).map((f4, i5) => f4.rank ? f4 : { ...f4, rank: i5.toString() }).sort( + (a6, b4) => a6.rank.localeCompare(b4.rank, void 0, { numeric: true }) ), fixedRank, item @@ -40963,14 +41356,14 @@ var moveAFileToNewParentAtIndex = async (plugin, item, newParent, index) => { const allRows = plugin.index.vaultDBCache.filter((f4) => f4.parent == newParent); const rows = insert( (_a2 = allRows.sort( - (a5, b4) => { + (a6, b4) => { var _a3, _b2; - return ((_a3 = a5.rank) != null ? _a3 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); + return ((_a3 = a6.rank) != null ? _a3 : "").localeCompare((_b2 = b4.rank) != null ? _b2 : "", void 0, { numeric: true }); } )) != null ? _a2 : [], index, newItem - ).map((f4, i4) => ({ ...f4, rank: i4.toString() })); + ).map((f4, i5) => ({ ...f4, rank: i5.toString() })); const newVaultTable = [...plugin.index.vaultDBCache, newItem].filter((f4) => f4.path != item.path).map((f4) => { const newItem2 = rows.find((g4) => g4.path == f4.path); if (newItem2) { @@ -40985,19 +41378,19 @@ var moveAFileToNewParentAtIndex = async (plugin, item, newParent, index) => { await Promise.all(promises); plugin.index.broadcast("space"); }; -var insertContextInSpace = (plugin, space, newTag) => { - const spaceCache = plugin.index.spacesIndex.get(space.path); +var insertContextInSpace = (plugin, space2, newTag) => { + const spaceCache = plugin.index.spacesIndex.get(space2.path); const contexts = [...spaceCache.metadata.contexts.filter((f4) => f4 != newTag), newTag]; - saveSpaceDefValue(plugin, space.path, "contexts", contexts); + saveSpaceDefValue(plugin, space2.path, "contexts", contexts); }; -var removeContextInSpace = (plugin, space, oldTag) => { - const spaceCache = plugin.index.spacesIndex.get(space.path); +var removeContextInSpace = (plugin, space2, oldTag) => { + const spaceCache = plugin.index.spacesIndex.get(space2.path); const contexts = spaceCache.metadata.contexts.filter((f4) => f4 != oldTag); - saveSpaceDefValue(plugin, space.path, "contexts", contexts); + saveSpaceDefValue(plugin, space2.path, "contexts", contexts); }; -var canMoveCacheToSpace = (cache, toSpaceCache) => { +var canMoveCacheToSpace = (cache2, toSpaceCache) => { if (toSpaceCache.type == "folder" || toSpaceCache.type == "vault" || toSpaceCache.type == "tag") { - if (cache.cacheType == "file" || cache.type == "folder") + if (cache2.cacheType == "file" || cache2.type == "folder") return true; return false; } @@ -41017,16 +41410,16 @@ var movePathsToSpace = async (plugin, paths, newSpaceCache) => { } }; var movePathToSpace = async (plugin, path, oldSpaceCache, newSpaceCache, index) => { - let cache = plugin.index.spacesIndex.get(path); - if (!cache) { - cache = plugin.index.filesIndex.get(path); + let cache2 = plugin.index.spacesIndex.get(path); + if (!cache2) { + cache2 = plugin.index.filesIndex.get(path); } - if (!cache || !newSpaceCache) + if (!cache2 || !newSpaceCache) return false; - if (!canMoveCacheToSpace(cache, newSpaceCache)) + if (!canMoveCacheToSpace(cache2, newSpaceCache)) return false; if (newSpaceCache.type == "folder" || newSpaceCache.type == "vault") { - if (cache.cacheType == "file" || cache.type == "folder") { + if (cache2.cacheType == "file" || cache2.type == "folder") { if ((oldSpaceCache == null ? void 0 : oldSpaceCache.path) == newSpaceCache.path) { updateFileRank(plugin, plugin.index.filesIndex.get(path), index); } else { @@ -41044,14 +41437,14 @@ var movePathToSpace = async (plugin, path, oldSpaceCache, newSpaceCache, index) removePathsFromSpace(plugin, oldSpaceCache, [path]); } }; -var insertSpaceAtIndex = async (plugin, name, newSpace) => { - const spaces = plugin.index.allSpaces(); - const spaceInfo = spaceFromCustomSpace(plugin, name); - if (spaces.find((f4) => f4.path == spaceInfo.path)) { +var insertSpaceAtIndex = async (plugin, name2, newSpace) => { + const spaces2 = plugin.index.allSpaces(); + const spaceInfo = spaceFromCustomSpace(plugin, name2); + if (spaces2.find((f4) => f4.path == spaceInfo.path)) { await saveSpaceCache(plugin, spaceInfo, newSpace); } else { await app.vault.createFolder(spaceInfo.folderPath); - await createNewMarkdownFile(plugin, getAbstractFileAtPath(app, spaceInfo.folderPath), name, null, true); + await createNewMarkdownFile(plugin, getAbstractFileAtPath(app, spaceInfo.folderPath), name2, null, true); await saveSpaceCache(plugin, spaceInfo, newSpace); await plugin.index.reloadSpace(spaceInfo); await plugin.index.updateSpaceMetadata(spaceInfo.path, newSpace); @@ -41060,8 +41453,8 @@ var insertSpaceAtIndex = async (plugin, name, newSpace) => { plugin.settings.rootSpaces = [...plugin.settings.rootSpaces, spaceInfo.path]; plugin.saveSettings(); }; -var saveSpaceDefValue = async (plugin, space, key2, value) => { - const spaceCache = plugin.index.spacesIndex.get(space); +var saveSpaceDefValue = async (plugin, space2, key2, value) => { + const spaceCache = plugin.index.spacesIndex.get(space2); let file = getAbstractFileAtPath(app, spaceCache.space.defPath); if (!file) { file = await createNewMarkdownFile(plugin, getAbstractFileAtPath(app, spaceCache.space.folderPath), filePathToString(spaceCache.space.defPath), "", true); @@ -41071,7 +41464,7 @@ var saveSpaceDefValue = async (plugin, space, key2, value) => { frontmatter[key2] = value; }); } - plugin.index.updateSpaceMetadata(space, { ...spaceCache.metadata, [key2]: value }); + plugin.index.updateSpaceMetadata(space2, { ...spaceCache.metadata, [key2]: value }); }; var saveSpaceCache = async (plugin, spaceInfo, metadata) => { let file = getAbstractFileAtPath(app, spaceInfo.defPath); @@ -41090,10 +41483,10 @@ var saveSpaceCache = async (plugin, spaceInfo, metadata) => { } plugin.index.updateSpaceMetadata(spaceInfo.path, metadata); }; -var insertSpaceItemAtIndex = async (plugin, space, path, rank) => { +var insertSpaceItemAtIndex = async (plugin, space2, path, rank) => { var _a2; - if (space.type == "links") { - const spaceExists = (_a2 = ensureArray(space.metadata.links)) != null ? _a2 : []; + if (space2.type == "links") { + const spaceExists = (_a2 = ensureArray(space2.metadata.links)) != null ? _a2 : []; const pathExists = spaceExists.find((f4) => f4 == path); let fixedRank = rank; if (!pathExists) { @@ -41108,33 +41501,33 @@ var insertSpaceItemAtIndex = async (plugin, space, path, rank) => { fixedRank, path ); - await saveSpaceCache(plugin, space.space, { ...space.metadata, links: newSpaceItems }); + await saveSpaceCache(plugin, space2.space, { ...space2.metadata, links: newSpaceItems }); const promises = []; promises.push(...newSpaceItems.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4)))); - promises.push(plugin.index.reloadSpace(space.space)); + promises.push(plugin.index.reloadSpace(space2.space)); await Promise.all(promises); plugin.index.broadcast("vault"); - } else if (space.path == homeSpace.path) { + } else if (space2.path == homeSpace.path) { toggleSpacePin(plugin, path, "home", false, rank); plugin.index.broadcast("vault"); } }; -var removeSpace = async (plugin, space) => { - const spaceCache = plugin.index.spacesIndex.get(space); +var removeSpace = async (plugin, space2) => { + const spaceCache = plugin.index.spacesIndex.get(space2); if (spaceCache.type == "tag") { plugin.index.deleteTag(spaceCache.name); } else if (spaceCache.type == "folder") { - deleteFile(plugin, getAbstractFileAtPath(app, space)); + deleteFile(plugin, getAbstractFileAtPath(app, space2)); } else { deleteSpaceFolder(plugin, spaceCache.name); - plugin.index.deleteSpace(space); + plugin.index.deleteSpace(space2); } }; var updateSpaceSort = (plugin, spaceName, sort) => { - const space = plugin.index.spacesIndex.get(spaceName); - if (space) - saveSpaceCache(plugin, space.space, { - ...space.metadata, + const space2 = plugin.index.spacesIndex.get(spaceName); + if (space2) + saveSpaceCache(plugin, space2.space, { + ...space2.metadata, sort: JSON.stringify(sort) }); }; @@ -41160,22 +41553,13 @@ var toggleSpacePin = (plugin, spacePath, type, remove, rank) => { } plugin.saveSettings(); }; -var addPathsToSpace = async (plugin, spacePath, paths) => { - var _a2; - const space = plugin.index.spacesIndex.get(spacePath); - saveSpaceDefValue(plugin, spacePath, "links", [...(_a2 = space.metadata.links) != null ? _a2 : [], ...paths]); - await plugin.index.reloadSpace(space.space); - const promises = paths.map((f4) => plugin.index.reloadFile(getAbstractFileAtPath(app, f4))); - await Promise.all(promises); - plugin.index.broadcast("vault"); -}; -var removePathsFromSpace = async (plugin, space, paths) => { - if (space.type == "default" && space.path == "spaces://$home") { +var removePathsFromSpace = async (plugin, space2, paths) => { + if (space2.type == "default" && space2.path == "spaces://$home") { paths.forEach((path) => toggleSpacePin(plugin, path, "home", true)); plugin.index.broadcast("vault"); - } else if (space.type == "links") { - saveSpaceDefValue(plugin, space.path, "links", space.metadata.links.filter((f4) => !paths.some((g4) => g4 == f4))); - await plugin.index.reloadSpace(space.space); + } else if (space2.type == "links") { + saveSpaceDefValue(plugin, space2.path, "links", space2.metadata.links.filter((f4) => !paths.some((g4) => g4 == f4))); + await plugin.index.reloadSpace(space2.space); const promises = paths.map((f4) => pathIsSpace(f4) ? plugin.index.reloadSpaceByPath(f4) : plugin.index.reloadFile(getAbstractFileAtPath(app, f4))); await Promise.all(promises); plugin.index.broadcast("vault"); @@ -41197,7 +41581,7 @@ var initiateDB = (db) => { }); }; var indexCurrentFileTree = (plugin, vaultDB) => { - const treeItems = getAllAbstractFilesInVault(plugin, app).map((file) => { + const treeItems = getAllAbstractFilesInVault(plugin).map((file) => { var _a2; return { path: file.path, @@ -41208,16 +41592,16 @@ var indexCurrentFileTree = (plugin, vaultDB) => { }); const currentPaths = vaultDB; const deleteRows = currentPaths.filter( - (item) => !treeItems.some((i4) => i4.path == item.path) + (item) => !treeItems.some((i5) => i5.path == item.path) ); const fixRows = currentPaths.filter( - (item) => treeItems.some((i4) => i4.path == item.path && i4.parent != item.parent) + (item) => treeItems.some((i5) => i5.path == item.path && i5.parent != item.parent) ).map((item) => ({ ...item, - ...treeItems.find((i4) => i4.path == item.path) + ...treeItems.find((i5) => i5.path == item.path) })); const newRows = treeItems.filter( - (item) => !currentPaths.some((i4) => i4.path == item.path) + (item) => !currentPaths.some((i5) => i5.path == item.path) ); const newVaultRows = [...vaultDB.map((f4) => { const newItem = fixRows.find((g4) => g4.path == f4.path); @@ -41233,35 +41617,36 @@ var indexCurrentFileTree = (plugin, vaultDB) => { } }; }; -var newFolderInSpace = (plugin, space, activeFile) => { +var newFolderInSpace = (plugin, space2, activeFile) => { + var _a2, _b2; const vaultChangeModal = new VaultChangeModal( plugin, - space.folderPath.length > 0 ? getFolderFromPath(app, space.folderPath) : defaultNoteFolder(plugin, activeFile), + ((_b2 = (_a2 = space2.space) == null ? void 0 : _a2.folderPath) == null ? void 0 : _b2.length) > 0 ? getFolderFromPath(app, space2.space.folderPath) : defaultNoteFolder(plugin, activeFile), "create folder", - space.name + space2 ); vaultChangeModal.open(); }; -var newFileInSpace = async (plugin, space, activeFile, canvas, dontOpen) => { +var newFileInSpace = async (plugin, space2, activeFile, canvas, dontOpen) => { + var _a2, _b2, _c2, _d2; let newFile; if (canvas) { newFile = await createNewCanvasFile( plugin, - space.folderPath.length > 0 ? getFolderFromPath(app, space.folderPath) : defaultNoteFolder(plugin, activeFile), + ((_b2 = (_a2 = space2.space) == null ? void 0 : _a2.folderPath) == null ? void 0 : _b2.length) > 0 ? getFolderFromPath(app, space2.space.folderPath) : defaultNoteFolder(plugin, activeFile), "", dontOpen ); } else { newFile = await createNewMarkdownFile( plugin, - space.folderPath.length > 0 ? getFolderFromPath(app, space.folderPath) : defaultNoteFolder(plugin, activeFile), + ((_d2 = (_c2 = space2.space) == null ? void 0 : _c2.folderPath) == null ? void 0 : _d2.length) > 0 ? getFolderFromPath(app, space2.space.folderPath) : defaultNoteFolder(plugin, activeFile), "", null, dontOpen ); } - if (space.uri.type == "folder") - addPathsToSpace(plugin, space.path, [newFile.path]); + insertSpaceItemAtIndex(plugin, space2, newFile.path, 0); return newFile; }; @@ -41276,11 +41661,11 @@ var saveFileColors = (plugin, files, icon) => { saveFileColor(plugin, file, icon); }); }; -var saveSpaceIcon = (plugin, space, icon) => { - saveSpaceSticker(plugin, space, icon); +var saveSpaceIcon = (plugin, space2, icon) => { + saveSpaceSticker(plugin, space2, icon); }; -var removeSpaceIcon = (plugin, space) => { - saveSpaceSticker(plugin, space, ""); +var removeSpaceIcon = (plugin, space2) => { + saveSpaceSticker(plugin, space2, ""); }; var saveFileIcon = (plugin, data2, icon) => { saveFileSticker(plugin, data2.path, icon); @@ -41399,14 +41784,14 @@ var FileSticker = (props2) => { }; var FileStickerContainer = (props2) => { const [fileCache, setFileCache] = h2(null); - const [space, setSpace] = h2(null); + const [space2, setSpace] = h2(null); const reloadCache = () => { if (props2.path.type == "file" || props2.path.type == "folder") { const fileCache2 = props2.plugin.index.filesIndex.get(props2.path.path); setFileCache(fileCache2); } else if (props2.path.type == "space" || props2.path.type == "tag") { - const space2 = props2.plugin.index.spacesIndex.get(props2.path.fullPath); - setSpace(space2); + const space3 = props2.plugin.index.spacesIndex.get(props2.path.fullPath); + setSpace(space3); } }; const reloadIcon = (e4) => { @@ -41426,19 +41811,19 @@ var FileStickerContainer = (props2) => { return fileCache && fileCache.cacheType == "file" ? /* @__PURE__ */ Cn.createElement(FileSticker, { plugin: props2.plugin, fileCache - }) : space && /* @__PURE__ */ Cn.createElement("div", { - className: `mk-file-icon ${(space == null ? void 0 : space.metadata.sticker) ? "" : "mk-file-icon-placeholder"}` + }) : space2 && /* @__PURE__ */ Cn.createElement("div", { + className: `mk-file-icon ${(space2 == null ? void 0 : space2.metadata.sticker) ? "" : "mk-file-icon-placeholder"}` }, /* @__PURE__ */ Cn.createElement("button", { dangerouslySetInnerHTML: { - __html: (space == null ? void 0 : space.metadata.sticker) ? stickerFromString(space == null ? void 0 : space.metadata.sticker, props2.plugin) : uiIconSet["mk-ui-spaces"] + __html: (space2 == null ? void 0 : space2.metadata.sticker) ? stickerFromString(space2 == null ? void 0 : space2.metadata.sticker, props2.plugin) : uiIconSet["mk-ui-spaces"] }, onClick: () => { - if (!space) + if (!space2) return; const vaultChangeModal = new stickerModal( props2.plugin.app, props2.plugin, - (emoji) => saveSpaceIcon(props2.plugin, space.path, emoji) + (emoji) => saveSpaceIcon(props2.plugin, space2.path, emoji) ); vaultChangeModal.open(); } @@ -41446,14 +41831,14 @@ var FileStickerContainer = (props2) => { }; // src/components/ui/menus/selectMenu/concerns/matchers.js -function escapeForRegExp(string) { - return string.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); +function escapeForRegExp(string2) { + return string2.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); } -function matchAny(string) { - return new RegExp(escapeForRegExp(string), "gi"); +function matchAny(string2) { + return new RegExp(escapeForRegExp(string2), "gi"); } -function matchExact(string) { - return new RegExp(`^${escapeForRegExp(string)}$`, "i"); +function matchExact(string2) { + return new RegExp(`^${escapeForRegExp(string2)}$`, "i"); } // src/context/ContextEditorContext.tsx @@ -41462,10 +41847,10 @@ var import_obsidian17 = require("obsidian"); init_compat_module(); // src/utils/contexts/predicate/sort.ts -var simpleSort = (a5, b4) => { - if (a5 < b4) +var simpleSort = (a6, b4) => { + if (a6 < b4) return -1; - if (a5 > b4) + if (a6 > b4) return 1; return 0; }; @@ -41487,7 +41872,7 @@ var sortFnTypes = { }, reverseAlphabetical: { type: ["text", "file", "link", "context", "fileprop"], - fn: (v3, f4) => stringSort(v3, f4) * -1, + fn: (v4, f4) => stringSort(v4, f4) * -1, label: i18n_default.sortTypes.alphaDesc, desc: true }, @@ -41499,7 +41884,7 @@ var sortFnTypes = { }, latest: { type: ["date", "fileprop"], - fn: (v3, f4) => stringSort(v3, f4) * -1, + fn: (v4, f4) => stringSort(v4, f4) * -1, label: i18n_default.sortTypes.latest, desc: true }, @@ -41511,7 +41896,7 @@ var sortFnTypes = { }, booleanReverse: { type: ["boolean"], - fn: (v3, f4) => boolSort(v3, f4) * -1, + fn: (v4, f4) => boolSort(v4, f4) * -1, label: i18n_default.sortTypes.checkDesc, desc: true }, @@ -41523,7 +41908,7 @@ var sortFnTypes = { }, reverseNumber: { type: ["number", "fileprop"], - fn: (v3, f4) => numSort(v3, f4) * -1, + fn: (v4, f4) => numSort(v4, f4) * -1, label: "9 \u2192 1", desc: true }, @@ -41535,7 +41920,7 @@ var sortFnTypes = { }, reverseCount: { type: ["option-multi", "context-multi", "link-multi"], - fn: (v3, f4) => countSort(v3, f4) * -1, + fn: (v4, f4) => countSort(v4, f4) * -1, label: i18n_default.sortTypes.itemsAsc, desc: false } @@ -41772,14 +42157,14 @@ var ContextMDBProvider = (props2) => { "files", "context" ).then((f4) => { - setContextTable((t4) => ({ - ...t4, + setContextTable((t5) => ({ + ...t5, [tag]: f4 })); }); }, []); - const refreshTags = async (tags) => { - if (contexts.some((f4) => tags.some((g4) => g4 == f4))) + const refreshTags = async (tags2) => { + if (contexts.some((f4) => tags2.some((g4) => g4 == f4))) if (dbSchema.primary) { runDef(); } else { @@ -41797,7 +42182,7 @@ var ContextMDBProvider = (props2) => { } } else { const tag = Object.keys(contextTable).find( - (t4) => spaceFromTag(props2.plugin, t4).path == contextPath + (t5) => spaceFromTag(props2.plugin, t5).path == contextPath ); if (tag) loadContextFields(tag); @@ -41951,8 +42336,8 @@ var ContextMDBProvider = (props2) => { for (const c4 of contextFields) { loadContextFields(c4); } - setContextTable((t4) => ({ - ...t4, + setContextTable((t5) => ({ + ...t5, [tag]: f4 })); } @@ -41961,8 +42346,8 @@ var ContextMDBProvider = (props2) => { const saveContextDB = async (newTable, tag) => { const context = spaceFromTag(props2.plugin, tag); await saveMDBToPath(props2.plugin, context, newTable).then( - (f4) => f4 && setContextTable((t4) => ({ - ...t4, + (f4) => f4 && setContextTable((t5) => ({ + ...t5, [tag]: newTable })) ); @@ -42111,7 +42496,7 @@ var ContextEditorProvider = (props2) => { return cols.filter( (f4) => f4.hidden != "true" && !predicate.colsHidden.some((c4) => c4 == f4.name + f4.table) ).sort( - (a5, b4) => predicate.colsOrder.findIndex((x5) => x5 == a5.name + a5.table) - predicate.colsOrder.findIndex((x5) => x5 == b4.name + b4.table) + (a6, b4) => predicate.colsOrder.findIndex((x5) => x5 == a6.name + a6.table) - predicate.colsOrder.findIndex((x5) => x5 == b4.name + b4.table) ); }, [cols, predicate]); const filteredData = F2( @@ -42127,12 +42512,12 @@ var ContextEditorProvider = (props2) => { (f4) => (searchString == null ? void 0 : searchString.length) > 0 ? matchAny(searchString).test( Object.keys(f4).filter((g4) => g4.charAt(0) != "_").map((g4) => f4[g4]).join("|") ) : true - ).sort((a5, b4) => { + ).sort((a6, b4) => { return predicate.sort.reduce((p3, c4) => { return p3 == 0 ? sortReturnForCol( cols.find((col) => col.name + col.table == c4.field), c4, - a5, + a6, b4 ) : p3; }, 0); @@ -42157,7 +42542,7 @@ var ContextEditorProvider = (props2) => { saveDB2({ ...tableData, rows: tableData.rows.map( - (r3, i4) => i4 == index ? { + (r3, i5) => i5 == index ? { ...r3, [column]: value } : r3 @@ -42168,7 +42553,7 @@ var ContextEditorProvider = (props2) => { { ...contextTable[table], rows: contextTable[table].rows.map( - (r3, i4) => i4 == index ? { + (r3, i5) => i5 == index ? { ...r3, [column]: value } : r3 @@ -42188,9 +42573,9 @@ var ContextEditorProvider = (props2) => { savePredicate({ ...predicate, colsHidden: hidden ? [ - ...predicate.colsHidden.filter((s5) => s5 != col.name + col.table), + ...predicate.colsHidden.filter((s6) => s6 != col.name + col.table), col.name + col.table - ] : predicate.colsHidden.filter((s5) => s5 != col.name + col.table) + ] : predicate.colsHidden.filter((s6) => s6 != col.name + col.table) }); }; const updateFieldValue = (column, fieldValue, value, table, index, file) => { @@ -42208,13 +42593,13 @@ var ContextEditorProvider = (props2) => { const newTable = { ...tableData, cols: tableData.cols.map( - (m5) => m5.name == column ? { - ...m5, + (m6) => m6.name == column ? { + ...m6, value: fieldValue - } : m5 + } : m6 ), rows: tableData.rows.map( - (r3, i4) => i4 == index ? { + (r3, i5) => i5 == index ? { ...r3, [column]: value } : r3 @@ -42226,13 +42611,13 @@ var ContextEditorProvider = (props2) => { { ...contextTable[table], cols: contextTable[table].cols.map( - (m5) => m5.name == column ? { - ...m5, + (m6) => m6.name == column ? { + ...m6, value: fieldValue - } : m5 + } : m6 ), rows: contextTable[table].rows.map( - (r3, i4) => i4 == index ? { + (r3, i5) => i5 == index ? { ...r3, [column]: value } : r3 @@ -42307,7 +42692,7 @@ var ContextEditorProvider = (props2) => { return; } const tag = Object.keys(contextTable).find( - (t4) => spaceFromTag(props2.plugin, t4).path == contextPath + (t5) => spaceFromTag(props2.plugin, t5).path == contextPath ); if (tag) loadContextFields(tag); @@ -42387,8 +42772,8 @@ var ContextEditorProvider = (props2) => { for (const c4 of contextFields) { loadContextFields(c4); } - setContextTable((t4) => ({ - ...t4, + setContextTable((t5) => ({ + ...t5, [tag]: f4 })); } @@ -42401,8 +42786,8 @@ var ContextEditorProvider = (props2) => { "files", "context" ).then((f4) => { - setContextTable((t4) => ({ - ...t4, + setContextTable((t5) => ({ + ...t5, [tag]: f4 })); }); @@ -42410,8 +42795,8 @@ var ContextEditorProvider = (props2) => { const saveContextDB = async (newTable, tag) => { const context = spaceFromTag(props2.plugin, tag); await saveMDBToPath(props2.plugin, context, newTable).then( - (f4) => f4 && setContextTable((t4) => ({ - ...t4, + (f4) => f4 && setContextTable((t5) => ({ + ...t5, [tag]: newTable })) ); @@ -42446,7 +42831,7 @@ var ContextEditorProvider = (props2) => { mdbtable = contextTable[table]; } const newFields = mdbtable.cols.filter( - (f4, i4) => f4.name != column.name + (f4, i5) => f4.name != column.name ); const newTable = { ...mdbtable, @@ -42490,7 +42875,7 @@ var ContextEditorProvider = (props2) => { return false; } const oldFieldIndex = oldColumn ? mdbtable.cols.findIndex((f4) => f4.name == oldColumn.name) : -1; - const newFields = oldFieldIndex == -1 ? [...mdbtable.cols, column] : mdbtable.cols.map((f4, i4) => i4 == oldFieldIndex ? column : f4); + const newFields = oldFieldIndex == -1 ? [...mdbtable.cols, column] : mdbtable.cols.map((f4, i5) => i5 == oldFieldIndex ? column : f4); const newTable = { ...mdbtable, cols: newFields, @@ -42566,6 +42951,7 @@ var ContextEditorProvider = (props2) => { }; // src/components/Space/Contexts/ContextBuilder/ContextSelector.tsx +var import_obsidian18 = require("obsidian"); init_compat_module(); var ContextSelector = (props2) => { const { spaceInfo, contexts } = q2(SpaceContext); @@ -42576,6 +42962,24 @@ var ContextSelector = (props2) => { return; removeContextInSpace(props2.plugin, spaceInfo, value); }; + const viewContextMenu = (e4, space2) => { + const fileMenu = new import_obsidian18.Menu(); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Delete Context"); + menuItem.onClick(() => { + removeContext(space2); + }); + }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }; return contexts.length > 0 ? /* @__PURE__ */ Cn.createElement("div", { className: "mk-context-selector" }, /* @__PURE__ */ Cn.createElement("div", { @@ -42583,9 +42987,9 @@ var ContextSelector = (props2) => { dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-context"] } - }), contexts.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, - onContextMenu: (e4) => openSpace(tagSpacePathFromTag(f4), props2.plugin, false), + }), contexts.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, + onContextMenu: (e4) => viewContextMenu(e4, f4), onClick: (e4) => openSpace(tagSpacePathFromTag(f4), props2.plugin, false) }, /* @__PURE__ */ Cn.createElement("span", { className: "cm-hashtag cm-hashtag-begin cm-hashtag-end" @@ -42593,7 +42997,7 @@ var ContextSelector = (props2) => { }; // src/components/ui/menus/menuItems.tsx -var import_obsidian18 = require("obsidian"); +var import_obsidian19 = require("obsidian"); init_compat_module(); // src/components/ui/menus/selectMenu.tsx @@ -42701,9 +43105,9 @@ var Sticker = (props2) => { // src/components/ui/menus/selectMenu/SelectMenuSuggestions.tsx init_compat_module(); -function markIt(name, query) { +function markIt(name2, query) { const regexp = matchAny(query); - return name.replace(regexp, "$&"); + return name2.replace(regexp, "$&"); } var SelectMenuSuggestionsComponent = (props2) => { const ref2 = _2(null); @@ -42989,8 +43393,8 @@ var SelectMenuComponent = Cn.forwardRef( props2.onAddition(tag); clearInput(); }; - const deleteTag = (i4) => { - props2.onDelete(i4); + const deleteTag = (i5) => { + props2.onDelete(i5); }; const clearInput = () => { setQuery(""); @@ -43007,7 +43411,7 @@ var SelectMenuComponent = Cn.forwardRef( const pressDownKey = (e4) => { e4.preventDefault(); const size = options.length - 1; - setIndex((i4) => i4 >= size ? 0 : i4 + 1); + setIndex((i5) => i5 >= size ? 0 : i5 + 1); }; function pressBackspaceKey() { if (!query.length) { @@ -43038,11 +43442,11 @@ var SelectMenuComponent = Cn.forwardRef( className: classNames9.selected, "aria-relevant": "additions removals", "aria-live": "polite" - }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.tags.map((tag, i4) => /* @__PURE__ */ Cn.createElement(SelectMenuPill_default, { - key: i4, + }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, props2.tags.map((tag, i5) => /* @__PURE__ */ Cn.createElement(SelectMenuPill_default, { + key: i5, tag, classNames: classNames9, - onDelete: (e4) => onDeleteTag(i4, e4) + onDelete: (e4) => onDeleteTag(i5, e4) }))), /* @__PURE__ */ Cn.createElement("div", { className: classNames9.search }, /* @__PURE__ */ Cn.createElement(SelectMenuInput_default, { @@ -43078,64 +43482,64 @@ var SelectMenuComponent_default = SelectMenuComponent; var SelectMenu = Cn.forwardRef( (props2, ref2) => { var _a2; - const initialOptions = props2.options.map((o3, i4) => { + const initialOptions = props2.options.map((o3, i5) => { return { ...o3, - id: i4 + 1 + id: i5 + 1 }; }); p2(() => { setSuggestions( - props2.options.map((o3, i4) => { + props2.options.map((o3, i5) => { return { ...o3, - id: i4 + 1 + id: i5 + 1 }; }) ); }, [props2.options]); const [suggestions, setSuggestions] = h2(initialOptions); - const [tags, setTags] = h2( + const [tags2, setTags] = h2( props2.value.map( - (v3) => { + (v4) => { var _a3; - return (_a3 = initialOptions.find((f4) => f4.value == v3)) != null ? _a3 : { + return (_a3 = initialOptions.find((f4) => f4.value == v4)) != null ? _a3 : { id: 0, - name: v3, - value: v3 + name: v4, + value: v4 }; } ) ); const onDelete = T2( (tagIndex) => { - const newTags = tags.filter((_12, i4) => i4 !== tagIndex); + const newTags = tags2.filter((_12, i5) => i5 !== tagIndex); setTags(newTags); props2.saveOptions( suggestions.map((f4) => f4.value), newTags.map((f4) => f4.value) ); }, - [suggestions, tags, props2] + [suggestions, tags2, props2] ); const onDeleteOption = T2( (removeTag) => { const newSuggestions = suggestions.filter((f4) => f4.value != removeTag); - const newTags = tags.filter((f4) => f4.value != removeTag); + const newTags = tags2.filter((f4) => f4.value != removeTag); setSuggestions(newSuggestions); setTags(newTags); if (props2.removeOption) props2.removeOption(removeTag); props2.hide(); }, - [tags, suggestions, props2] + [tags2, suggestions, props2] ); const onAddition = T2( (newTag) => { let tag = newTag; let newSuggestions = suggestions; - let newTags = tags; - if (!suggestions.find((s5) => s5.value == newTag.value)) { + let newTags = tags2; + if (!suggestions.find((s6) => s6.value == newTag.value)) { tag = { id: suggestions.length + 1, name: newTag.name, @@ -43145,8 +43549,8 @@ var SelectMenu = Cn.forwardRef( setSuggestions(newSuggestions); } if (props2.multi) { - if (!tags.find((t4) => t4.value == tag.value)) { - newTags = [...tags, tag]; + if (!tags2.find((t5) => t5.value == tag.value)) { + newTags = [...tags2, tag]; setTags(newTags); } } else { @@ -43161,11 +43565,11 @@ var SelectMenu = Cn.forwardRef( props2.hide(); } }, - [tags, suggestions] + [tags2, suggestions] ); const onValidation = T2( (newTag) => { - if (!props2.editable && !suggestions.find((s5) => s5.value == newTag.value)) { + if (!props2.editable && !suggestions.find((s6) => s6.value == newTag.value)) { return false; } if (newTag.name.length == 0) { @@ -43176,7 +43580,7 @@ var SelectMenu = Cn.forwardRef( [suggestions] ); return /* @__PURE__ */ Cn.createElement(SelectMenuComponent_default, { - tags: props2.multi ? tags : [], + tags: props2.multi ? tags2 : [], suggestions, plugin: props2.plugin, ref: ref2, @@ -43223,7 +43627,7 @@ var inputMenuItem = (menuItem, value, setValue) => { return menuItem; }; var showSelectMenu = (point, optionProps) => { - const menu = new import_obsidian18.Menu(); + const menu = new import_obsidian19.Menu(); menu.dom.toggleClass("mk-menu", true); menu.setUseNativeMenu(false); const frag = document.createDocumentFragment(); @@ -43258,9 +43662,9 @@ var showSelectMenu = (point, optionProps) => { item.setTitle(frag); }); const keys2 = [...menu.scope.keys]; - for (let i4 = 0; i4 < keys2.length; i4++) { - if (keys2[i4].key != "Escape") { - menu.scope.unregister(keys2[i4]); + for (let i5 = 0; i5 < keys2.length; i5++) { + if (keys2[i5].key != "Escape") { + menu.scope.unregister(keys2[i5]); } } menu.showAtPosition(point); @@ -43307,7 +43711,7 @@ var NoteSpacesBar = (props2) => { multi: false, editable: true, value: [], - options: f4.map((m5) => ({ name: m5, value: m5 })), + options: f4.map((m6) => ({ name: m6, value: m6 })), saveOptions: (_12, value) => props2.addTag(value[0]), placeholder: i18n_default.labels.contextItemSelectPlaceholder, searchable: true, @@ -43318,7 +43722,7 @@ var NoteSpacesBar = (props2) => { const spacesFromPath = (path) => { return [...props2.plugin.index.spacesMap.get(path)].map((f4) => props2.plugin.index.spacesIndex.get(f4)).filter((f4) => f4 && f4.path != "/"); }; - const [spaces, setSpaces] = h2( + const [spaces2, setSpaces] = h2( spacesFromPath(props2.path) ); const refreshSpaces = (evt) => { @@ -43332,10 +43736,10 @@ var NoteSpacesBar = (props2) => { window.removeEventListener(eventTypes.spacesChange, refreshSpaces); }; }, [props2.path]); - return spaces.length > 0 ? /* @__PURE__ */ Cn.createElement("div", { + return spaces2.length > 0 ? /* @__PURE__ */ Cn.createElement("div", { className: "mk-tag-selector" - }, spaces.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, + }, spaces2.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, onContextMenu: (e4) => openSpace(f4.path, props2.plugin, false), onClick: (e4) => openSpace( f4.path, @@ -43360,13 +43764,371 @@ var NoteSpacesBar = (props2) => { }))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); }; -// src/components/ui/menus/newPropertyMenu.tsx -var import_obsidian21 = require("obsidian"); +// src/components/ui/menus/propertyMenu/newPropertyMenu.tsx +var import_obsidian22 = require("obsidian"); init_compat_module(); +// src/components/ui/menus/propertyMenu/propertyMenu.tsx +var import_obsidian20 = require("obsidian"); +init_compat_module(); +var selectPropertyTypeMenu = (e4, plugin, selectedType) => { + showSelectMenu(e4.target.getBoundingClientRect(), { + plugin, + multi: false, + editable: false, + searchable: false, + saveOptions: selectedType, + value: [], + showAll: true, + options: fieldTypes.filter((f4) => !f4.restricted).map((f4, i5) => ({ + id: i5 + 1, + name: f4.label, + value: f4.type, + icon: "" + })) + }); +}; +var PropertyMenuComponent = (props2) => { + var _a2; + const [field, setField] = h2(props2.field); + const selectedType = (_12, value) => { + const newField = { + ...field, + type: value[0], + value: getNewValueForType(field, value) + }; + setField(newField); + props2.saveField(newField); + }; + const selectedValue = (value) => { + const newField = { ...field, value }; + setField(newField); + props2.saveField(newField); + }; + const toggleMulti = () => { + const newField = { + ...field, + type: field.type == fieldType.multiType ? fieldType.type : fieldType.multiType + }; + setField(newField); + props2.saveField(newField); + }; + const fieldType = (_a2 = fieldTypeForType(field.type)) != null ? _a2 : fieldTypes[0]; + const getNewValueForType = (f4, value) => { + if (value[0].startsWith("option")) { + return serializeMultiString(props2.options); + } + return value[0] == fieldType.type || value[0] == fieldType.multiType ? f4.value : null; + }; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => selectPropertyTypeMenu(e4, props2.plugin, selectedType) + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyType), /* @__PURE__ */ Cn.createElement("span", null, fieldType.label)), fieldType.multi ? /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item" + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.multiple), /* @__PURE__ */ Cn.createElement("input", { + type: "checkbox", + checked: field.type == fieldType.multiType, + onChange: () => toggleMulti() + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { + className: "menu-separator" + }), /* @__PURE__ */ Cn.createElement(PropertyValueComponent, { + plugin: props2.plugin, + name: field.name, + table: field.table, + fields: props2.fields, + fieldType: fieldType.type, + value: field.value, + contextPath: props2.contextPath, + saveValue: selectedValue + })); +}; +var showPropertyMenu = (props2) => { + const { + plugin, + position, + editable, + options, + field, + fields, + contextPath, + saveField, + hide, + deleteColumn, + sortColumn, + editCode, + hidden + } = props2; + const menu = new import_obsidian20.Menu(); + menu.setUseNativeMenu(false); + if (editable) { + menu.addItem((menuItem) => { + var _a2; + inputMenuItem( + menuItem, + (_a2 = field == null ? void 0 : field.name) != null ? _a2 : "", + (value) => saveField({ ...field, name: value }) + ); + menuItem.setIcon("type"); + }); + menu.addSeparator(); + const frag = document.createDocumentFragment(); + const div = frag.createDiv(); + div.addEventListener("click", (e4) => { + e4.stopImmediatePropagation(); + }); + div.addEventListener("keydown", (e4) => { + }); + const root2 = createRoot(div); + root2.render( + /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(PropertyMenuComponent, { + plugin, + field, + fields, + contextPath, + options, + saveField + })) + ); + menu.addItem((menuItem) => { + menuItem.setTitle(frag); + menuItem.dom.toggleClass("mk-properties", true); + }); + menu.addSeparator(); + menu.addItem((menuItem) => { + menuItem.setIcon("gem"); + menuItem.setTitle("Set Icon"); + menuItem.onClick(() => { + const vaultChangeModal = new stickerModal( + props2.plugin.app, + props2.plugin, + (emoji) => saveField({ ...field, attrs: emoji }) + ); + vaultChangeModal.open(); + }); + }); + if (hide) { + if (!hidden) { + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.hideProperty); + menuItem.onClick(() => { + hide(field, true); + }); + menuItem.setIcon("eye-off"); + }); + } else { + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.unhideProperty); + menuItem.onClick(() => { + hide(field, false); + }); + menuItem.setIcon("eye"); + }); + } + } + if (editCode) { + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.editCode); + menuItem.onClick(() => { + editCode(); + }); + menuItem.setIcon("code"); + }); + } + if (deleteColumn) { + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.deleteProperty); + menuItem.onClick(() => { + deleteColumn(field); + }); + menuItem.setIcon("trash-2"); + }); + } + menu.addSeparator(); + } + const sortableString = normalizedSortForType(field.type, false); + if (sortableString && sortColumn) { + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.sortAscending); + menuItem.setIcon("sort-asc"); + menuItem.onClick(() => { + sortColumn({ + field: field.name + field.table, + fn: normalizedSortForType(field.type, false) + }); + }); + }); + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.sortDescending); + menuItem.setIcon("sort-desc"); + menuItem.onClick(() => { + sortColumn({ + field: field.name + field.table, + fn: normalizedSortForType(field.type, true) + }); + }); + }); + } + menu.showAtPosition(position); + return menu; +}; + +// src/hooks/useCombinedRef.tsx +init_compat_module(); +function useCombinedRefs2(...refs) { + return F2( + () => (node) => { + refs.forEach((ref2) => ref2(node)); + }, + refs + ); +} + +// src/components/Space/Contexts/TableView/ColumnHeader.tsx +init_compat_module(); +var filePropTypes = [ + { + name: i18n_default.properties.fileProperty.createdTime, + value: "ctime" + }, + { + name: i18n_default.properties.fileProperty.modifiedTime, + value: "mtime" + }, + { + name: i18n_default.properties.fileProperty.extension, + value: "extension" + }, + { + name: i18n_default.properties.fileProperty.size, + value: "size" + }, + { + name: i18n_default.properties.fileProperty.parentFolder, + value: "folder" + }, + { + name: "Links", + value: "links" + }, + { + name: "Tags", + value: "tags" + }, + { + name: "Spaces", + value: "spaces" + } +]; +var ColumnHeader = (props2) => { + var _a2, _b2; + const [field, setField] = h2(props2.column); + const menuRef = _2(null); + const { spaceInfo, contexts } = q2(SpaceContext); + const { tableData, contextTable } = q2(ContextMDBContext); + const { + predicate, + loadContextFields, + cols, + newColumn, + saveColumn, + hideColumn, + sortColumn, + delColumn + } = q2(ContextEditorContext); + p2(() => { + setField(props2.column); + }, [props2.column]); + const { + attributes, + listeners, + setNodeRef: setDraggableNodeRef, + transform + } = useDraggable({ + id: field.name + field.table, + data: { name: field.name } + }); + const { setNodeRef: setDroppableNodeRef } = useDroppable({ + id: field.name + field.table, + data: { name: field.name } + }); + const saveField = (field2) => { + if (field2.name.length > 0) { + if (field2.name != props2.column.name || field2.type != props2.column.type || field2.value != props2.column.value || field2.attrs != props2.column.attrs) { + const saveResult = saveColumn(field2, props2.column); + if (saveResult) { + if (props2.isNew) { + setField(props2.column); + } + } + } + } + }; + const showNewMenu = (e4) => { + const offset2 = ref2.current.getBoundingClientRect(); + showNewPropertyMenu( + props2.plugin, + { x: offset2.left, y: offset2.top + 30 }, + contexts, + cols, + (source, field2) => newColumn({ ...field2, table: source }), + tableData.schema.id, + spaceInfo.path, + false + ); + }; + const toggleMenu = (e4) => { + if (props2.isNew) { + showNewMenu(e4); + } else { + const offset2 = e4.target.getBoundingClientRect(); + const options = optionValuesForColumn( + field.name, + field.table == "" ? tableData : contextTable[field.table] + ); + showPropertyMenu({ + plugin: props2.plugin, + position: { x: offset2.left, y: offset2.top + 30 }, + editable: props2.editable, + options, + field, + fields: cols, + contextPath: spaceInfo.path, + saveField, + hide: hideColumn, + deleteColumn: delColumn, + sortColumn, + hidden: predicate.colsHidden.includes(field.name + field.table) + }); + } + }; + const ref2 = _2(null); + const setNodeRef = useCombinedRefs2(setDroppableNodeRef, setDraggableNodeRef); + return /* @__PURE__ */ Cn.createElement("div", { + ref: setNodeRef, + ...listeners, + ...attributes, + className: "mk-col-header", + onClick: (e4) => { + toggleMenu(e4); + } + }, /* @__PURE__ */ Cn.createElement("div", { + ref: ref2 + }, props2.column.name.length > 0 ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + dangerouslySetInnerHTML: { + __html: stickerFromString( + ((_a2 = props2.column.attrs) == null ? void 0 : _a2.length) > 0 ? props2.column.attrs : (_b2 = fieldTypeForType(props2.column.type)) == null ? void 0 : _b2.icon, + props2.plugin + ) + } + }), field.name) : "+", /* @__PURE__ */ Cn.createElement("span", { + className: "mk-col-header-context", + "aria-label": props2.column.table.length > 0 ? props2.column.table : "" + }, props2.column.table.length > 0 ? "#" : ""))); +}; + // src/dispatch/mdb.ts var import_lodash7 = __toESM(require_lodash()); -var import_obsidian19 = require("obsidian"); +var import_obsidian21 = require("obsidian"); // src/utils/contexts/file.ts var renameRowForFile = (folder, filePath, toFilePath) => { @@ -43481,20 +44243,20 @@ var parseDataview = (field, value) => { return value; } return serializeMultiString( - value.map((v3) => { - if (!v3) { + value.map((v4) => { + if (!v4) { return ""; } - if (typeof v3 === "string") { - return v3; + if (typeof v4 === "string") { + return v4; } - if (v3.path) { - return v3.path; + if (v4.path) { + return v4.path; } - if (Array.isArray(value) && v3.length == 1 && Array.isArray(v3[0]) && v3[0].length == 1 && typeof v3[0][0] === "string") { - return v3[0][0]; + if (Array.isArray(value) && v4.length == 1 && Array.isArray(v4[0]) && v4[0].length == 1 && typeof v4[0][0] === "string") { + return v4[0][0]; } - return JSON.stringify(v3); + return JSON.stringify(v4); }) ); break; @@ -43518,12 +44280,12 @@ var parseDataview = (field, value) => { }; // src/dispatch/mdb.ts -var processContextFile = async (plugin, space, processor, fallback) => { - const dbFileExists = await app.vault.adapter.exists(space.dbPath); +var processContextFile = async (plugin, space2, processor, fallback) => { + const dbFileExists = await app.vault.adapter.exists(space2.dbPath); if (dbFileExists) { - const contextDB = await getMDBTable(plugin, space, "files", "context"); + const contextDB = await getMDBTable(plugin, space2, "files", "context"); if (contextDB) { - await processor(contextDB, space); + await processor(contextDB, space2); return; } else if (fallback) { await fallback(); @@ -43537,7 +44299,7 @@ var saveDB = async (plugin, context, newTable) => { }; var insertColumns = (table, column) => { if (table.cols.find((f4) => f4.name == column.name)) { - new import_obsidian19.Notice(i18n_default.notice.duplicatePropertyName); + new import_obsidian21.Notice(i18n_default.notice.duplicatePropertyName); return; } return { @@ -43545,6 +44307,17 @@ var insertColumns = (table, column) => { cols: [...table.cols, column] }; }; +var deletePropertyMultiValue = (folder, lookupField, lookupValue, field, value) => { + return { + ...folder, + rows: folder.rows.map( + (f4) => f4[lookupField] == lookupValue ? { + ...f4, + [field]: serializeMultiString(parseMultiString(f4[field]).filter((g4) => g4 != value)) + } : f4 + ) + }; +}; var updateValue = (folder, lookupField, lookupValue, field, value) => { return { ...folder, @@ -43561,59 +44334,53 @@ var insertRowsIfUnique = (folder, rows) => { }; var saveContextToFrontmatter = (file, cols, context, plugin) => { const afile = getAbstractFileAtPath(app, file); - if (afile && afile instanceof import_obsidian19.TFile) + if (afile && afile instanceof import_obsidian21.TFile) saveContextToFile(afile, cols, context, plugin); }; -var initiateContextIfNotExists = async (plugin, tag) => { - const context = spaceFromTag(plugin, tag); - const tagFileExists = await app.vault.adapter.exists(context.dbPath); - if (tagFileExists) - return false; - return createContextMDB(plugin, context); -}; -var updateContextValue = async (plugin, space, file, field, value) => { - let tagFileExists = await app.vault.adapter.exists(space.dbPath); +var updateContextValue = async (plugin, space2, file, field, value, _updateFunction) => { + let tagFileExists = await app.vault.adapter.exists(space2.dbPath); if (!tagFileExists) { - tagFileExists = await createContextMDB(plugin, space); + tagFileExists = await createContextMDB(plugin, space2); } if (tagFileExists) - await getMDBTable(plugin, space, "files", "context").then( + await getMDBTable(plugin, space2, "files", "context").then( (tagDB) => { - const newMDB = updateValue(tagDB, FilePropertyName, file, field, value); - return saveDB(plugin, space, newMDB).then((f4) => newMDB); + const updateFunction = _updateFunction != null ? _updateFunction : updateValue; + const newMDB = updateFunction(tagDB, FilePropertyName, file, field, value); + return saveDB(plugin, space2, newMDB).then((f4) => newMDB); } ); }; -var insertContextColumn = async (plugin, space, field) => { - let tagFileExists = await app.vault.adapter.exists(space.dbPath); +var insertContextColumn = async (plugin, space2, field) => { + let tagFileExists = await app.vault.adapter.exists(space2.dbPath); if (!tagFileExists) { - tagFileExists = await createContextMDB(plugin, space); + tagFileExists = await createContextMDB(plugin, space2); } if (tagFileExists) - await getMDBTable(plugin, space, "files", "context").then((tagDB) => { + await getMDBTable(plugin, space2, "files", "context").then((tagDB) => { const newDB = insertColumns(tagDB, field); - saveDB(plugin, space, newDB).then((f4) => newDB); + saveDB(plugin, space2, newDB).then((f4) => newDB); return newDB; - }).then((f4) => plugin.index.reloadContext(space)); + }).then((f4) => plugin.index.reloadContext(space2)); }; -var insertContextItems = async (plugin, newPaths, t4) => { - const saveNewContextRows = async (tag, space2) => { +var insertContextItems = async (plugin, newPaths, t5) => { + const saveNewContextRows = async (tag, space3) => { const newRow = newPaths.map((newPath) => ({ File: newPath })); - await saveDB(plugin, space2, insertRowsIfUnique(tag, newRow)); + await saveDB(plugin, space3, insertRowsIfUnique(tag, newRow)); }; - const space = spaceFromTag(plugin, t4); - let tagFileExists = await app.vault.adapter.exists(space.dbPath); + const space2 = plugin.index.spacesIndex.get(t5); + let tagFileExists = await app.vault.adapter.exists(space2.space.dbPath); if (!tagFileExists) { - tagFileExists = await createContextMDB(plugin, space); + tagFileExists = await createContextMDB(plugin, space2.space); } if (tagFileExists) - await getMDBTable(plugin, space, "files", "context").then( - (tagDB) => saveNewContextRows(tagDB, space) + await getMDBTable(plugin, space2.space, "files", "context").then( + (tagDB) => saveNewContextRows(tagDB, space2.space) ); }; var fileToFM = (afile, cols, plugin) => { let file = afile; - if (afile instanceof import_obsidian19.TFolder) { + if (afile instanceof import_obsidian21.TFolder) { file = getAbstractFileAtPath(app, folderNotePathFromAFile(plugin.settings, tFileToAFile(afile))); } if (!file) @@ -43633,8 +44400,8 @@ var fileToDV = (file, cols, plugin) => { const dvValues = plugin.dataViewAPI().page(file.path); const fmKeys = uniqCaseInsensitive( Object.keys(dvValues != null ? dvValues : {}).filter( - (f4, i4, self2) => !self2.find( - (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 + (f4, i5, self2) => !self2.find( + (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i5 > j4 ) ? true : false ).filter((f4) => f4 != "file") ).filter((f4) => cols.some((g4) => f4 == g4)); @@ -43646,7 +44413,7 @@ var fileToDV = (file, cols, plugin) => { {} ); }; -var onMetadataChange = async (plugin, file, spaces) => { +var onMetadataChange = async (plugin, file, spaces2) => { const updateFile = (mdb) => { const objectExists = mdb.rows.some((item) => item.File === file.path); if (objectExists) { @@ -43674,58 +44441,58 @@ var onMetadataChange = async (plugin, file, spaces) => { ]; } }; - const promises = spaces.map((space) => { - return processContextFile(plugin, space, async (mdb, space2) => { + const promises = spaces2.map((space2) => { + return processContextFile(plugin, space2, async (mdb, space3) => { const newDB = { ...mdb, rows: updateFile(mdb) }; if (!import_lodash7.default.isEqual(mdb, newDB)) { - await saveDB(plugin, space2, newDB); + await saveDB(plugin, space3, newDB); } return newDB; }); }); return Promise.all(promises); }; -var updateValueInContext = async (plugin, row, field, value, space) => { +var updateValueInContext = async (plugin, row, field, value, space2) => { const changeTagInContextMDB = (mdb) => { return { ...mdb, rows: mdb.rows.map((f4) => f4.File == row ? { ...f4, [field]: value } : f4) }; }; - return processContextFile(plugin, space, async (mdb, space2) => { + return processContextFile(plugin, space2, async (mdb, space3) => { const newDB = changeTagInContextMDB(mdb); if (!import_lodash7.default.isEqual(mdb, newDB)) { - await saveDB(plugin, space2, newDB); + await saveDB(plugin, space3, newDB); } return newDB; }); }; -var renameTagInContexts = async (plugin, oldTag, newTag, spaces) => { +var renameTagInContexts = async (plugin, oldTag, newTag, spaces2) => { const changeTagInContextMDB = (mdb) => { const cols = mdb.cols.map((f4) => f4.type.startsWith("context") && f4.value == oldTag ? { ...f4, value: newTag } : f4); return { ...mdb, cols }; }; - const promises = spaces.map((space) => { - return processContextFile(plugin, space, async (mdb, space2) => { + const promises = spaces2.map((space2) => { + return processContextFile(plugin, space2, async (mdb, space3) => { const newDB = changeTagInContextMDB(mdb); if (!import_lodash7.default.isEqual(mdb, newDB)) { - await saveDB(plugin, space2, newDB); + await saveDB(plugin, space3, newDB); } return newDB; }); }); return Promise.all(promises); }; -var removeTagInContexts = async (plugin, tag, spaces) => { +var removeTagInContexts = async (plugin, tag, spaces2) => { const deleteTagInContextMDB = (mdb) => { const cols = mdb.cols.map((f4) => f4.type.startsWith("context") && f4.value == tag ? { ...f4, type: "link-multi" } : f4); return { ...mdb, cols }; }; - const promises = spaces.map((space) => { - return processContextFile(plugin, space, async (mdb, space2) => { + const promises = spaces2.map((space2) => { + return processContextFile(plugin, space2, async (mdb, space3) => { const newDB = deleteTagInContextMDB(mdb); if (!import_lodash7.default.isEqual(mdb, newDB)) { - await saveDB(plugin, space2, newDB); + await saveDB(plugin, space3, newDB); } return newDB; }); @@ -43733,79 +44500,79 @@ var removeTagInContexts = async (plugin, tag, spaces) => { return Promise.all(promises); }; var addFileInContexts = async (plugin, path, contexts) => { - const promises = contexts.map((space) => { - return processContextFile(plugin, space, async (mdb, space2) => { + const promises = contexts.map((space2) => { + return processContextFile(plugin, space2, async (mdb, space3) => { const newDB = insertRowsIfUnique(mdb, [{ File: path }]); if (!import_lodash7.default.isEqual(mdb, newDB)) { - await saveDB(plugin, space2, newDB); + await saveDB(plugin, space3, newDB); } return newDB; }); }); return Promise.all(promises); }; -var renameLinkInContexts = async (plugin, oldPath, newPath, spaces) => { - const promises = spaces.map((space) => { - return processContextFile(plugin, space, async (mdb, space2) => { +var renameLinkInContexts = async (plugin, oldPath, newPath, spaces2) => { + const promises = spaces2.map((space2) => { + return processContextFile(plugin, space2, async (mdb, space3) => { const linkCols = linkColumns(mdb.cols); const newDB = { ...mdb, rows: mdb.rows.map((r3) => renameLinksInRow(plugin, r3, oldPath, newPath, linkCols)) }; if (!import_lodash7.default.isEqual(mdb, newDB)) { - await saveDB(plugin, space2, newDB); + await saveDB(plugin, space3, newDB); } return newDB; }); }); return Promise.all(promises); }; -var removeLinkInContexts = async (plugin, path, spaces) => { - const promises = spaces.map((space) => { - return processContextFile(plugin, space, async (mdb, space2) => { +var removeLinkInContexts = async (plugin, path, spaces2) => { + const promises = spaces2.map((space2) => { + return processContextFile(plugin, space2, async (mdb, space3) => { const linkCols = linkColumns(mdb.cols); const newDB = { ...mdb, rows: mdb.rows.map((r3) => removeLinksInRow(plugin, r3, path, linkCols)) }; if (!import_lodash7.default.isEqual(mdb, newDB)) { - await saveDB(plugin, space2, newDB); + await saveDB(plugin, space3, newDB); } return newDB; }); }); return Promise.all(promises); }; -var renameFileInContexts = async (plugin, oldPath, newPath, spaces) => { - const promises = spaces.map((space) => { - return processContextFile(plugin, space, async (mdb, space2) => { +var renameFileInContexts = async (plugin, oldPath, newPath, spaces2) => { + const promises = spaces2.map((space2) => { + return processContextFile(plugin, space2, async (mdb, space3) => { const newDB = renameRowForFile(mdb, oldPath, newPath); if (!import_lodash7.default.isEqual(mdb, newDB)) { - await saveDB(plugin, space2, newDB); + await saveDB(plugin, space3, newDB); } return newDB; }); }); return Promise.all(promises); }; -var removeFileInContexts = async (plugin, path, spaces) => { - const promises = spaces.map((space) => { - return processContextFile(plugin, space, async (mdb, space2) => { +var removeFileInContexts = async (plugin, path, spaces2) => { + const promises = spaces2.map((space2) => { + return processContextFile(plugin, space2, async (mdb, space3) => { const removeRow = mdb.rows.find((f4) => f4.File == path); if (removeRow) { saveContextToFrontmatter(path, mdb.cols, removeRow, plugin); } const newDB = removeRowForFile(mdb, path); if (!import_lodash7.default.isEqual(mdb, newDB)) { - await saveDB(plugin, space2, newDB); + await saveDB(plugin, space3, newDB); } return newDB; }); }); return Promise.all(promises); }; -var removeFilesInContext = async (plugin, paths, space) => { - return processContextFile(plugin, space, async (mdb, context) => { +var removeFilesInContext = async (plugin, paths, space2) => { + return processContextFile(plugin, space2, async (mdb, context) => { mdb.rows.forEach((row) => { if (paths.includes(row.File)) saveContextToFrontmatter(row.File, mdb.cols, row, plugin); @@ -43818,240 +44585,92 @@ var removeFilesInContext = async (plugin, paths, space) => { }); }; -// src/hooks/useCombinedRef.tsx +// src/components/ui/menus/propertyMenu/PropertyValue.tsx init_compat_module(); -function useCombinedRefs2(...refs) { - return F2( - () => (node) => { - refs.forEach((ref2) => ref2(node)); - }, - refs - ); -} - -// src/components/Space/Contexts/TableView/ColumnHeader.tsx -init_compat_module(); -var filePropTypes = [ - { - name: i18n_default.properties.fileProperty.createdTime, - value: "ctime" - }, - { - name: i18n_default.properties.fileProperty.modifiedTime, - value: "mtime" - }, - { - name: i18n_default.properties.fileProperty.extension, - value: "extension" - }, - { - name: i18n_default.properties.fileProperty.size, - value: "size" - }, - { - name: i18n_default.properties.fileProperty.parentFolder, - value: "folder" - }, - { - name: "Links", - value: "links" - }, - { - name: "Tags", - value: "tags" - }, - { - name: "Spaces", - value: "spaces" - } -]; -var ColumnHeader = (props2) => { - var _a2; - const [field, setField] = h2(props2.column); - const menuRef = _2(null); - const { spaceInfo, contexts } = q2(SpaceContext); - const { tableData, contextTable } = q2(ContextMDBContext); - const { - predicate, - loadContextFields, - cols, - newColumn, - saveColumn, - hideColumn, - sortColumn, - delColumn - } = q2(ContextEditorContext); - p2(() => { - setField(props2.column); - }, [props2.column]); - const { - attributes, - listeners, - setNodeRef: setDraggableNodeRef, - transform - } = useDraggable({ - id: field.name + field.table, - data: { name: field.name } - }); - const { setNodeRef: setDroppableNodeRef } = useDroppable({ - id: field.name + field.table, - data: { name: field.name } - }); - const saveField = (field2) => { - if (field2.name.length > 0) { - if (field2.name != props2.column.name || field2.type != props2.column.type || field2.value != props2.column.value || field2.attrs != props2.column.attrs) { - const saveResult = saveColumn(field2, props2.column); - if (saveResult) { - if (props2.isNew) { - setField(props2.column); - } - } - } - } - }; - const saveContext = (field2, value) => { - const newContext = value[0]; - initiateContextIfNotExists(props2.plugin, newContext).then((f4) => { - if (f4) { - return insertContextItems( - props2.plugin, - optionValuesForColumn( - field2.name, - field2.table == "" ? tableData : contextTable[field2.table] - ), - newContext - ); - } - }).then((f4) => loadContextFields(newContext)); - const newField = { - ...field2, - value: newContext != null ? newContext : "" - }; - setField(newField); - saveColumn(newField, props2.column); - }; - const showNewMenu = (e4) => { - const offset2 = ref2.current.getBoundingClientRect(); - showNewPropertyMenu( - props2.plugin, - { x: offset2.left, y: offset2.top + 30 }, - contexts, - cols, - (source, field2) => newColumn({ ...field2, table: source }), - tableData.schema.id, - spaceInfo.path, - false - ); - }; - const toggleMenu = (e4) => { - if (props2.isNew) { - showNewMenu(e4); - } else { - const offset2 = e4.target.getBoundingClientRect(); - const options = optionValuesForColumn( - field.name, - field.table == "" ? tableData : contextTable[field.table] - ); - showPropertyMenu({ - plugin: props2.plugin, - position: { x: offset2.left, y: offset2.top + 30 }, - editable: props2.editable, - options, - field, - fields: cols, - contextPath: spaceInfo.path, - saveField, - saveContext, - hide: hideColumn, - deleteColumn: delColumn, - sortColumn, - hidden: predicate.colsHidden.includes(field.name + field.table) - }); - } - }; - const ref2 = _2(null); - const setNodeRef = useCombinedRefs2(setDroppableNodeRef, setDraggableNodeRef); - return /* @__PURE__ */ Cn.createElement("div", { - ref: setNodeRef, - ...listeners, - ...attributes, - className: "mk-col-header", - onClick: (e4) => { - toggleMenu(e4); - } - }, /* @__PURE__ */ Cn.createElement("div", { - ref: ref2 - }, ((_a2 = props2.column.attrs) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ Cn.createElement("div", { - dangerouslySetInnerHTML: { - __html: stickerFromString(props2.column.attrs, props2.plugin) - } - }), props2.column.name.length > 0 ? field.name : "+", /* @__PURE__ */ Cn.createElement("span", { - className: "mk-col-header-context", - "aria-label": props2.column.table.length > 0 ? props2.column.table : "" - }, props2.column.table.length > 0 ? "#" : ""))); -}; - -// src/components/ui/menus/propertyMenu.tsx -var import_obsidian20 = require("obsidian"); -init_compat_module(); -var selectPropertyTypeMenu = (e4, plugin, selectedType) => { - showSelectMenu(e4.target.getBoundingClientRect(), { - plugin, - multi: false, - editable: false, - searchable: false, - saveOptions: selectedType, - value: [], - showAll: true, - options: fieldTypes.filter((f4) => !f4.restricted).map((f4, i4) => ({ - id: i4 + 1, - name: f4.label, - value: f4.type, - icon: "" - })) - }); -}; var PropertyValueComponent = (props2) => { - const selectContext = (e4) => { - var _a2; + const showOptions = (e4, value, options, field, saveProperty) => { showSelectMenu(e4.target.getBoundingClientRect(), { plugin: props2.plugin, multi: false, editable: true, searchable: true, - saveOptions: (_12, v3) => props2.saveContext(v3[0]), - placeholder: i18n_default.labels.propertyContext, - value: [(_a2 = props2.value) != null ? _a2 : ""], - options: loadTags(props2.plugin).map((m5) => ({ name: m5, value: m5 })) + saveOptions: (_12, v4) => { + if (saveProperty) { + saveProperty(v4[0]); + } else { + saveParsedValue(field, v4[0]); + } + }, + placeholder: i18n_default.labels.propertyValueSpace, + value: [value != null ? value : ""], + options }); }; - const selectFileProp = (e4) => { + const parsedValue = F2( + () => parseFieldValue(props2.value, props2.fieldType), + [props2.value, props2.fieldType] + ); + const saveParsedValue = (field, value) => { + props2.saveValue(JSON.stringify({ ...parsedValue, [field]: value })); + }; + const saveSpaceProperty = (field) => { + var _a2, _b2; + const colExists = (_b2 = (_a2 = props2.plugin.index.contextsIndex.get(parsedValue.space)) == null ? void 0 : _a2.cols) == null ? void 0 : _b2.some((f4) => f4.name == field); + if (!colExists) { + insertContextColumn( + props2.plugin, + props2.plugin.index.spacesIndex.get(parsedValue.space).space, + { + name: field, + schemaId: "files", + type: "context", + value: props2.name + } + ); + } + saveParsedValue("space", field); + }; + const selectContext = (e4) => { + showOptions( + e4, + parsedValue.space, + props2.plugin.index.allSpaces().filter((f4) => f4.type != "default").map((m6) => ({ name: m6.name, value: m6.path })), + "space" + ); + }; + const selectSpaceProperty = (e4) => { var _a2; - const properties2 = (_a2 = props2.plugin.index.contextsIndex.get(props2.contextPath)) == null ? void 0 : _a2.tables["files"].cols.filter( + showOptions( + e4, + parsedValue.property, + (_a2 = props2.plugin.index.contextsIndex.get(parsedValue.space)) == null ? void 0 : _a2.cols.filter((f4) => { + return f4.type.startsWith("context") && parseFieldValue(f4.value, f4.type)["space"] == props2.contextPath ? true : false; + }).map((m6) => ({ name: m6.name, value: m6.name })), + "field", + saveSpaceProperty + ); + }; + const selectProperty = (e4) => { + var _a2, _b2; + const properties2 = (_b2 = (_a2 = props2.plugin.index.contextsIndex.get(props2.contextPath)) == null ? void 0 : _a2.cols.filter( (f4) => f4.type == "file" || f4.type == "link" || f4.type == "context" - ).reduce((p3, c4) => { - var _a3, _b2; - return [ - ...p3, - ...c4.type == "file" || c4.type == "link" ? filePropTypes.map((f4) => ({ - name: c4.name + "." + f4.name, - value: c4.name + "." + f4.value - })) : (_b2 = (_a3 = props2.plugin.index.contextsIndex.get(c4.value)) == null ? void 0 : _a3.tables["files"].cols.filter((f4) => f4.hidden != "true").map((f4) => ({ - name: c4.name + "." + f4.name, - value: c4.name + "." + f4.name - }))) != null ? _b2 : [] - ]; - }, []); - showSelectMenu(e4.target.getBoundingClientRect(), { - plugin: props2.plugin, - multi: false, - editable: false, - searchable: false, - saveOptions: (_12, v3) => props2.saveValue(v3[0]), - value: [], - options: properties2, - showAll: true - }); + ).map((f4) => ({ + name: f4.name, + value: f4.name + }))) != null ? _b2 : []; + showOptions(e4, null, properties2, "field"); + }; + const selectFileProp = (e4) => { + var _a2, _b2, _c2; + const property2 = (_a2 = props2.plugin.index.contextsIndex.get(props2.contextPath)) == null ? void 0 : _a2.cols.find((f4) => f4.name == parsedValue.field); + const fileProps2 = property2 ? property2.type == "file" || property2.type == "link" ? filePropTypes.map((f4) => ({ + name: f4.name, + value: f4.value + })) : (_c2 = (_b2 = props2.plugin.index.contextsIndex.get(parseFieldValue(property2.value, "context").space)) == null ? void 0 : _b2.cols.filter((f4) => f4.hidden != "true").map((f4) => ({ + name: f4.name, + value: f4.name + }))) != null ? _c2 : [] : []; + showOptions(e4, null, fileProps2, "value"); }; const selectDateFormat = (e4) => { const formats = [ @@ -44068,220 +44687,47 @@ var PropertyValueComponent = (props2) => { value: "EEE MMM d, yyyy" } ]; - showSelectMenu(e4.target.getBoundingClientRect(), { - plugin: props2.plugin, - multi: false, - editable: true, - searchable: false, - saveOptions: (_12, v3) => props2.saveValue(v3[0]), - value: [], - options: formats, - showAll: true, - placeholder: i18n_default.labels.selectDateFormat - }); + showOptions(e4, null, formats, "format"); }; return props2.fieldType.startsWith("date") ? /* @__PURE__ */ Cn.createElement("div", { className: "menu-item", onClick: (e4) => selectDateFormat(e4) - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.dateFormat), /* @__PURE__ */ Cn.createElement("span", null, props2.value)) : props2.fieldType.startsWith("context") ? /* @__PURE__ */ Cn.createElement("div", { + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.dateFormat), /* @__PURE__ */ Cn.createElement("span", null, parsedValue.format)) : props2.fieldType.startsWith("context") ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { className: "menu-item", onClick: (e4) => selectContext(e4) - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyContext), /* @__PURE__ */ Cn.createElement("span", null, props2.value)) : props2.fieldType == "fileprop" ? /* @__PURE__ */ Cn.createElement("div", { + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyValueSpace), /* @__PURE__ */ Cn.createElement("span", null, spaceNameFromSpacePath(parsedValue.space, props2.plugin))), parsedValue.space.length > 0 && /* @__PURE__ */ Cn.createElement("div", { className: "menu-item", - onClick: (e4) => selectFileProp(e4) - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyFileProp), /* @__PURE__ */ Cn.createElement("span", null, props2.value)) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); -}; -var PropertyMenuComponent = (props2) => { - var _a2; - const [field, setField] = h2(props2.field); - const selectedType = (_12, value) => { - const newField = { - ...field, - type: value[0], - value: getNewValueForType(field, value) - }; - setField(newField); - props2.saveField(newField); - }; - const selectedValue = (value) => { - const newField = { ...field, value }; - setField(newField); - props2.saveField(newField); - }; - const selectedContext = (context) => { - const newField = { ...field, value: context }; - setField(newField); - props2.saveContext(newField, [context]); - }; - const toggleMulti = () => { - const newField = { - ...field, - type: field.type == fieldType.multiType ? fieldType.type : fieldType.multiType - }; - setField(newField); - props2.saveField(newField); - }; - const fieldType = (_a2 = fieldTypeForType(field.type)) != null ? _a2 : fieldTypes[0]; - const getNewValueForType = (f4, value) => { - if (value[0].startsWith("option")) { - return serializeMultiString(props2.options); - } - return value[0] == fieldType.type || value[0] == fieldType.multiType ? f4.value : null; - }; - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => selectSpaceProperty(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyValueProperty), /* @__PURE__ */ Cn.createElement("span", null, parsedValue.field))) : props2.fieldType == "fileprop" ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { className: "menu-item", - onClick: (e4) => selectPropertyTypeMenu(e4, props2.plugin, selectedType) - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyType), /* @__PURE__ */ Cn.createElement("span", null, fieldType.label)), fieldType.multi ? /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => selectProperty(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyFileProp), /* @__PURE__ */ Cn.createElement("span", null, parsedValue.field)), parsedValue.field && /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => selectFileProp(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyValueProperty), /* @__PURE__ */ Cn.createElement("span", null, parsedValue.value))) : props2.fieldType == "super" ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { className: "menu-item" - }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.multiple), /* @__PURE__ */ Cn.createElement("input", { + }, /* @__PURE__ */ Cn.createElement("span", null, "Dynamic"), /* @__PURE__ */ Cn.createElement("input", { type: "checkbox", - checked: field.type == fieldType.multiType, - onChange: () => toggleMulti() - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { - className: "menu-separator" - }), /* @__PURE__ */ Cn.createElement(PropertyValueComponent, { - plugin: props2.plugin, - table: field.table, - fields: props2.fields, - fieldType: fieldType.type, - value: field.value, - contextPath: props2.contextPath, - saveValue: selectedValue, - saveContext: selectedContext - })); -}; -var showPropertyMenu = (props2) => { - const { - plugin, - position, - editable, - options, - field, - fields, - contextPath, - saveField, - saveContext, - hide, - deleteColumn, - sortColumn, - editCode, - hidden - } = props2; - const menu = new import_obsidian20.Menu(); - menu.setUseNativeMenu(false); - if (editable) { - menu.addItem((menuItem) => { - var _a2; - inputMenuItem( - menuItem, - (_a2 = field == null ? void 0 : field.name) != null ? _a2 : "", - (value) => saveField({ ...field, name: value }) - ); - menuItem.setIcon("type"); - }); - menu.addSeparator(); - const frag = document.createDocumentFragment(); - const div = frag.createDiv(); - div.addEventListener("click", (e4) => { - e4.stopImmediatePropagation(); - }); - div.addEventListener("keydown", (e4) => { - }); - const root2 = createRoot(div); - root2.render( - /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(PropertyMenuComponent, { - plugin, - field, - fields, - contextPath, - options, - saveField, - saveContext - })) - ); - menu.addItem((menuItem) => { - menuItem.setTitle(frag); - menuItem.dom.toggleClass("mk-properties", true); - }); - menu.addItem((menuItem) => { - menuItem.setTitle("Set Icon"); - menuItem.onClick(() => { - const vaultChangeModal = new stickerModal( - props2.plugin.app, - props2.plugin, - (emoji) => saveField({ ...field, attrs: emoji }) - ); - vaultChangeModal.open(); - }); - }); - menu.addSeparator(); - if (hide) { - if (!hidden) { - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.hideProperty); - menuItem.onClick(() => { - hide(field, true); - }); - menuItem.setIcon("eye-off"); - }); - } else { - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.unhideProperty); - menuItem.onClick(() => { - hide(field, false); - }); - menuItem.setIcon("eye"); - }); - } - } - if (editCode) { - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.editCode); - menuItem.onClick(() => { - editCode(); - }); - menuItem.setIcon("code"); - }); - } - if (deleteColumn) { - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.deleteProperty); - menuItem.onClick(() => { - deleteColumn(field); - }); - menuItem.setIcon("trash-2"); - }); - } - menu.addSeparator(); - } - const sortableString = normalizedSortForType(field.type, false); - if (sortableString && sortColumn) { - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.sortAscending); - menuItem.setIcon("sort-asc"); - menuItem.onClick(() => { - sortColumn({ - field: field.name + field.table, - fn: normalizedSortForType(field.type, false) - }); - }); - }); - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.sortDescending); - menuItem.setIcon("sort-desc"); - menuItem.onClick(() => { - sortColumn({ - field: field.name + field.table, - fn: normalizedSortForType(field.type, true) - }); - }); - }); - } - menu.showAtPosition(position); - return menu; + checked: parsedValue.dynamic == true, + onChange: () => saveParsedValue("dynamic", !parsedValue.dynamic) + })), !parsedValue.dynamic ? /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => showOptions( + e4, + parsedValue.field, + [...props2.plugin.index.superProperties.keys()].map((f4) => ({ + value: f4, + name: props2.plugin.index.superProperties.get(f4).name + })), + "field" + ) + }, /* @__PURE__ */ Cn.createElement("span", null, "Field"), /* @__PURE__ */ Cn.createElement("span", null, parsedValue.field)) : /* @__PURE__ */ Cn.createElement("div", { + className: "menu-item", + onClick: (e4) => selectProperty(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, i18n_default.labels.propertyFileProp), /* @__PURE__ */ Cn.createElement("span", null, parsedValue.field))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); }; -// src/components/ui/menus/newPropertyMenu.tsx +// src/components/ui/menus/propertyMenu/newPropertyMenu.tsx var NewPropertyMenuComponent = (props2) => { const [fieldName, setFieldName] = h2(""); const [fieldSource, setFieldSource] = h2( @@ -44339,8 +44785,8 @@ var NewPropertyMenuComponent = (props2) => { saveOptions: selectedType, value: [], showAll: true, - options: fieldTypes.filter((f4) => fieldSource == "fm" ? f4.metadata : !f4.restricted).map((f4, i4) => ({ - id: i4 + 1, + options: fieldTypes.filter((f4) => fieldSource == "fm" ? f4.metadata : !f4.restricted).map((f4, i5) => ({ + id: i5 + 1, name: f4.label, value: f4.type, icon: "" @@ -44371,7 +44817,7 @@ var NewPropertyMenuComponent = (props2) => { }; const saveField = () => { if (fieldName.length == 0) { - new import_obsidian21.Notice(i18n_default.notice.noPropertyName); + new import_obsidian22.Notice(i18n_default.notice.noPropertyName); return; } props2.saveField(fieldSource, { @@ -44425,8 +44871,7 @@ var NewPropertyMenuComponent = (props2) => { fieldType, value: fieldValue, contextPath: props2.contextPath, - saveValue: selectedValue, - saveContext: selectedContext + saveValue: selectedValue }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { className: "menu-separator" }), /* @__PURE__ */ Cn.createElement("div", { @@ -44437,8 +44882,8 @@ var NewPropertyMenuComponent = (props2) => { onClick: (e4) => props2.hide() }, /* @__PURE__ */ Cn.createElement("span", null, "Cancel"))); }; -var showNewPropertyMenu = (plugin, position, tags, fields, saveField, schemaId, contextPath, fileMetadata) => { - const menu = new import_obsidian21.Menu(); +var showNewPropertyMenu = (plugin, position, tags2, fields, saveField, schemaId, contextPath, fileMetadata) => { + const menu = new import_obsidian22.Menu(); menu.setUseNativeMenu(false); const frag = document.createDocumentFragment(); const div = frag.createDiv(); @@ -44451,7 +44896,7 @@ var showNewPropertyMenu = (plugin, position, tags, fields, saveField, schemaId, root2.render( /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(NewPropertyMenuComponent, { plugin, - tags, + tags: tags2, schemaId, contextPath, fields, @@ -44465,9 +44910,9 @@ var showNewPropertyMenu = (plugin, position, tags, fields, saveField, schemaId, menuItem.dom.toggleClass("mk-properties", true); }); const keys2 = [...menu.scope.keys]; - for (let i4 = 0; i4 < keys2.length; i4++) { - if (keys2[i4].key != "Escape") { - menu.scope.unregister(keys2[i4]); + for (let i5 = 0; i5 < keys2.length; i5++) { + if (keys2[i5].key != "Escape") { + menu.scope.unregister(keys2[i5]); } } menu.showAtPosition(position); @@ -44475,8 +44920,8 @@ var showNewPropertyMenu = (plugin, position, tags, fields, saveField, schemaId, }; // src/components/ui/modals/imageModal.tsx -var import_obsidian22 = require("obsidian"); -var imageModal = class extends import_obsidian22.FuzzySuggestModal { +var import_obsidian23 = require("obsidian"); +var imageModal = class extends import_obsidian23.FuzzySuggestModal { constructor(plugin, app2, selectImage) { super(app2); this.plugin = plugin; @@ -44506,14 +44951,14 @@ var imageModal = class extends import_obsidian22.FuzzySuggestModal { if (query.match(urlRegex)) allImages.push(query); allImages.push( - ...getAllAbstractFilesInVault(this.plugin, app).filter( - (f4) => f4 instanceof import_obsidian22.TFile && ["png", "jpg", "jpeg"].contains(f4.extension) + ...getAllAbstractFilesInVault(this.plugin).filter( + (f4) => f4 instanceof import_obsidian23.TFile && ["png", "jpg", "jpeg"].contains(f4.extension) ).map((f4) => f4.path) ); - return allImages.filter((f4) => f4.contains(query)).map((f4, i4) => ({ + return allImages.filter((f4) => f4.contains(query)).map((f4, i5) => ({ item: f4, match: { - score: i4, + score: i5, matches: [] } })); @@ -44521,8 +44966,8 @@ var imageModal = class extends import_obsidian22.FuzzySuggestModal { getItems() { const allImages = []; allImages.push( - ...getAllAbstractFilesInVault(this.plugin, app).filter( - (f4) => f4 instanceof import_obsidian22.TFile && ["png", "jpg", "jpeg"].contains(f4.extension) + ...getAllAbstractFilesInVault(this.plugin).filter( + (f4) => f4 instanceof import_obsidian23.TFile && ["png", "jpg", "jpeg"].contains(f4.extension) ).map((f4) => f4.path) ); return allImages; @@ -44560,15 +45005,15 @@ function makeStateUpdater(key2, instance) { }); }; } -function isFunction(d5) { - return d5 instanceof Function; +function isFunction(d6) { + return d6 instanceof Function; } -function flattenBy(arr, getChildren) { +function flattenBy(arr, getChildren2) { const flat = []; const recurse = (subArr) => { subArr.forEach((item) => { flat.push(item); - const children = getChildren(item); + const children = getChildren2(item); if (children != null && children.length) { recurse(children); } @@ -44624,7 +45069,7 @@ function createColumn(table, columnDef, depth, parent) { ...columnDef }; const accessorKey = resolvedColumnDef.accessorKey; - let id2 = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? accessorKey.replace(".", "_") : void 0) != null ? _ref : typeof resolvedColumnDef.header === "string" ? resolvedColumnDef.header : void 0; + let id3 = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? accessorKey.replace(".", "_") : void 0) != null ? _ref : typeof resolvedColumnDef.header === "string" ? resolvedColumnDef.header : void 0; let accessorFn; if (resolvedColumnDef.accessorFn) { accessorFn = resolvedColumnDef.accessorFn; @@ -44645,14 +45090,14 @@ function createColumn(table, columnDef, depth, parent) { accessorFn = (originalRow) => originalRow[resolvedColumnDef.accessorKey]; } } - if (!id2) { + if (!id3) { if (true) { throw new Error(resolvedColumnDef.accessorFn ? `Columns require an id when using an accessorFn` : `Columns require an id when using a non-string header`); } throw new Error(); } let column = { - id: `${String(id2)}`, + id: `${String(id3)}`, accessorFn, parent, depth, @@ -44660,7 +45105,7 @@ function createColumn(table, columnDef, depth, parent) { columns: [], getFlatColumns: memo(() => [true], () => { var _column$columns; - return [column, ...(_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap((d5) => d5.getFlatColumns())]; + return [column, ...(_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap((d6) => d6.getFlatColumns())]; }, { key: false, debug: () => { @@ -44690,9 +45135,9 @@ function createColumn(table, columnDef, depth, parent) { } function createHeader(table, column, options) { var _options$id; - const id2 = (_options$id = options.id) != null ? _options$id : column.id; + const id3 = (_options$id = options.id) != null ? _options$id : column.id; let header = { - id: id2, + id: id3, column, index: options.index, isPlaceholder: !!options.isPlaceholder, @@ -44729,8 +45174,8 @@ var Headers = { return { getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => { var _left$map$filter, _right$map$filter; - const leftColumns = (_left$map$filter = left == null ? void 0 : left.map((columnId) => leafColumns.find((d5) => d5.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; - const rightColumns = (_right$map$filter = right == null ? void 0 : right.map((columnId) => leafColumns.find((d5) => d5.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; + const leftColumns = (_left$map$filter = left == null ? void 0 : left.map((columnId) => leafColumns.find((d6) => d6.id === columnId)).filter(Boolean)) != null ? _left$map$filter : []; + const rightColumns = (_right$map$filter = right == null ? void 0 : right.map((columnId) => leafColumns.find((d6) => d6.id === columnId)).filter(Boolean)) != null ? _right$map$filter : []; const centerColumns = leafColumns.filter((column) => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id))); const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table); return headerGroups; @@ -44753,7 +45198,7 @@ var Headers = { }), getLeftHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => { var _left$map$filter2; - const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map((columnId) => leafColumns.find((d5) => d5.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; + const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map((columnId) => leafColumns.find((d6) => d6.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : []; return buildHeaderGroups(allColumns, orderedLeafColumns, table, "left"); }, { key: "getLeftHeaderGroups", @@ -44764,7 +45209,7 @@ var Headers = { }), getRightHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => { var _right$map$filter2; - const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map((columnId) => leafColumns.find((d5) => d5.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; + const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map((columnId) => leafColumns.find((d6) => d6.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : []; return buildHeaderGroups(allColumns, orderedLeafColumns, table, "right"); }, { key: "getRightHeaderGroups", @@ -44945,7 +45390,7 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) { const header = createHeader(table, column, { id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join("_"), isPlaceholder, - placeholderId: isPlaceholder ? `${pendingParentHeaders.filter((d5) => d5.column === column).length}` : void 0, + placeholderId: isPlaceholder ? `${pendingParentHeaders.filter((d6) => d6.column === column).length}` : void 0, depth, index: pendingParentHeaders.length }); @@ -45038,7 +45483,7 @@ var ColumnSizing = { }, getStart: (position) => { const columns = !position ? table.getVisibleLeafColumns() : position === "left" ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns(); - const index = columns.findIndex((d5) => d5.id === column.id); + const index = columns.findIndex((d6) => d6.id === column.id); if (index > 0) { const prevSiblingColumn = columns[index - 1]; return prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize(); @@ -45099,7 +45544,7 @@ var ColumnSizing = { } } const startSize = header.getSize(); - const columnSizingStart = header ? header.getLeafHeaders().map((d5) => [d5.column.id, d5.column.getSize()]) : [[column.id, column.getSize()]]; + const columnSizingStart = header ? header.getLeafHeaders().map((d6) => [d6.column.id, d6.column.getSize()]) : [[column.id, column.getSize()]]; const clientX = isTouchStartEvent(e4) ? Math.round(e4.touches[0].clientX) : e4.clientX; const newColumnSizing = {}; const updateOffset = (eventType, clientXPos) => { @@ -45331,8 +45776,8 @@ var Expanding = { getExpandedDepth: () => { let maxDepth = 0; const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded); - rowIds.forEach((id2) => { - const splitId = id2.split("."); + rowIds.forEach((id3) => { + const splitId = id3.split("."); maxDepth = Math.max(maxDepth, splitId.length); }); return maxDepth; @@ -45540,20 +45985,20 @@ var Filters = { getIsFiltered: () => column.getFilterIndex() > -1, getFilterValue: () => { var _table$getState$colum, _table$getState$colum2; - return (_table$getState$colum = table.getState().columnFilters) == null ? void 0 : (_table$getState$colum2 = _table$getState$colum.find((d5) => d5.id === column.id)) == null ? void 0 : _table$getState$colum2.value; + return (_table$getState$colum = table.getState().columnFilters) == null ? void 0 : (_table$getState$colum2 = _table$getState$colum.find((d6) => d6.id === column.id)) == null ? void 0 : _table$getState$colum2.value; }, getFilterIndex: () => { var _table$getState$colum3, _table$getState$colum4; - return (_table$getState$colum3 = (_table$getState$colum4 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum4.findIndex((d5) => d5.id === column.id)) != null ? _table$getState$colum3 : -1; + return (_table$getState$colum3 = (_table$getState$colum4 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum4.findIndex((d6) => d6.id === column.id)) != null ? _table$getState$colum3 : -1; }, setFilterValue: (value) => { table.setColumnFilters((old) => { const filterFn = column.getFilterFn(); - const previousfilter = old == null ? void 0 : old.find((d5) => d5.id === column.id); + const previousfilter = old == null ? void 0 : old.find((d6) => d6.id === column.id); const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : void 0); if (shouldAutoRemoveFilter(filterFn, newFilter, column)) { var _old$filter; - return (_old$filter = old == null ? void 0 : old.filter((d5) => d5.id !== column.id)) != null ? _old$filter : []; + return (_old$filter = old == null ? void 0 : old.filter((d6) => d6.id !== column.id)) != null ? _old$filter : []; } const newFilterObj = { id: column.id, @@ -45561,11 +46006,11 @@ var Filters = { }; if (previousfilter) { var _old$map; - return (_old$map = old == null ? void 0 : old.map((d5) => { - if (d5.id === column.id) { + return (_old$map = old == null ? void 0 : old.map((d6) => { + if (d6.id === column.id) { return newFilterObj; } - return d5; + return d6; })) != null ? _old$map : []; } if (old != null && old.length) { @@ -45620,7 +46065,7 @@ var Filters = { const updateFn = (old) => { var _functionalUpdate; return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter((filter) => { - const column = leafColumns.find((d5) => d5.id === filter.id); + const column = leafColumns.find((d6) => d6.id === filter.id); if (column) { const filterFn = column.getFilterFn(); if (shouldAutoRemoveFilter(filterFn, filter.value, column)) { @@ -45753,10 +46198,10 @@ var median = (columnId, leafRows) => { return (min3 + max3) / 2; }; var unique = (columnId, leafRows) => { - return Array.from(new Set(leafRows.map((d5) => d5.getValue(columnId))).values()); + return Array.from(new Set(leafRows.map((d6) => d6.getValue(columnId))).values()); }; var uniqueCount = (columnId, leafRows) => { - return new Set(leafRows.map((d5) => d5.getValue(columnId))).size; + return new Set(leafRows.map((d6) => d6.getValue(columnId))).size; }; var count = (_columnId, leafRows) => { return leafRows.length; @@ -45799,7 +46244,7 @@ var Grouping = { toggleGrouping: () => { table.setGrouping((old) => { if (old != null && old.includes(column.id)) { - return old.filter((d5) => d5 !== column.id); + return old.filter((d6) => d6 !== column.id); } return [...old != null ? old : [], column.id]; }); @@ -45918,7 +46363,7 @@ var Ordering = { const columnsCopy = [...columns]; while (columnsCopy.length && columnOrderCopy.length) { const targetColumnId = columnOrderCopy.shift(); - const foundIndex = columnsCopy.findIndex((d5) => d5.id === targetColumnId); + const foundIndex = columnsCopy.findIndex((d6) => d6.id === targetColumnId); if (foundIndex > -1) { orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]); } @@ -46031,7 +46476,7 @@ var Pagination = { getPageOptions: memo(() => [table.getPageCount()], (pageCount) => { let pageOptions = []; if (pageCount && pageCount > 0) { - pageOptions = [...new Array(pageCount)].fill(null).map((_12, i4) => i4); + pageOptions = [...new Array(pageCount)].fill(null).map((_12, i5) => i5); } return pageOptions; }, { @@ -46099,44 +46544,44 @@ var Pinning = { createColumn: (column, table) => { return { pin: (position) => { - const columnIds = column.getLeafColumns().map((d5) => d5.id).filter(Boolean); + const columnIds = column.getLeafColumns().map((d6) => d6.id).filter(Boolean); table.setColumnPinning((old) => { var _old$left3, _old$right3; if (position === "right") { var _old$left, _old$right; return { - left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), - right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), ...columnIds] + left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter((d6) => !(columnIds != null && columnIds.includes(d6))), + right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter((d6) => !(columnIds != null && columnIds.includes(d6))), ...columnIds] }; } if (position === "left") { var _old$left2, _old$right2; return { - left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), ...columnIds], - right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))) + left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter((d6) => !(columnIds != null && columnIds.includes(d6))), ...columnIds], + right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter((d6) => !(columnIds != null && columnIds.includes(d6))) }; } return { - left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))), - right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter((d5) => !(columnIds != null && columnIds.includes(d5))) + left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter((d6) => !(columnIds != null && columnIds.includes(d6))), + right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter((d6) => !(columnIds != null && columnIds.includes(d6))) }; }); }, getCanPin: () => { const leafColumns = column.getLeafColumns(); - return leafColumns.some((d5) => { + return leafColumns.some((d6) => { var _d$columnDef$enablePi, _table$options$enable; - return ((_d$columnDef$enablePi = d5.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true); + return ((_d$columnDef$enablePi = d6.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true); }); }, getIsPinned: () => { - const leafColumnIds = column.getLeafColumns().map((d5) => d5.id); + const leafColumnIds = column.getLeafColumns().map((d6) => d6.id); const { left, right } = table.getState().columnPinning; - const isLeft = leafColumnIds.some((d5) => left == null ? void 0 : left.includes(d5)); - const isRight = leafColumnIds.some((d5) => right == null ? void 0 : right.includes(d5)); + const isLeft = leafColumnIds.some((d6) => left == null ? void 0 : left.includes(d6)); + const isRight = leafColumnIds.some((d6) => right == null ? void 0 : right.includes(d6)); return isLeft ? "left" : isRight ? "right" : false; }, getPinnedIndex: () => { @@ -46150,7 +46595,7 @@ var Pinning = { return { getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => { const leftAndRight = [...left != null ? left : [], ...right != null ? right : []]; - return allCells.filter((d5) => !leftAndRight.includes(d5.column.id)); + return allCells.filter((d6) => !leftAndRight.includes(d6.column.id)); }, { key: false, debug: () => { @@ -46159,8 +46604,8 @@ var Pinning = { } }), getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, ,], (allCells, left) => { - const cells = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d5) => ({ - ...d5, + const cells = (left != null ? left : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d6) => ({ + ...d6, position: "left" })); return cells; @@ -46172,8 +46617,8 @@ var Pinning = { } }), getRightVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => { - const cells = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d5) => ({ - ...d5, + const cells = (right != null ? right : []).map((columnId) => allCells.find((cell) => cell.column.id === columnId)).filter(Boolean).map((d6) => ({ + ...d6, position: "right" })); return cells; @@ -46222,7 +46667,7 @@ var Pinning = { }), getCenterLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => { const leftAndRight = [...left != null ? left : [], ...right != null ? right : []]; - return allColumns.filter((d5) => !leftAndRight.includes(d5.id)); + return allColumns.filter((d6) => !leftAndRight.includes(d6.id)); }, { key: "getCenterLeafColumns", debug: () => { @@ -46367,7 +46812,7 @@ var RowSelection = { }, getIsSomePageRowsSelected: () => { const paginationFlatRows = table.getPaginationRowModel().flatRows; - return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.some((d5) => d5.getIsSelected() || d5.getIsSomeSelected()); + return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.some((d6) => d6.getIsSelected() || d6.getIsSomeSelected()); }, getToggleAllRowsSelectedHandler: () => { return (e4) => { @@ -46448,18 +46893,18 @@ var RowSelection = { }; } }; -var mutateRowIsSelected = (selectedRowIds, id2, value, table) => { +var mutateRowIsSelected = (selectedRowIds, id3, value, table) => { var _row$subRows; - const row = table.getRow(id2); + const row = table.getRow(id3); if (value) { if (!row.getCanMultiSelect()) { Object.keys(selectedRowIds).forEach((key2) => delete selectedRowIds[key2]); } if (row.getCanSelect()) { - selectedRowIds[id2] = true; + selectedRowIds[id3] = true; } } else { - delete selectedRowIds[id2]; + delete selectedRowIds[id3]; } if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) { row.subRows.forEach((row2) => mutateRowIsSelected(selectedRowIds, row2.id, value, table)); @@ -46530,33 +46975,33 @@ var textCaseSensitive = (rowA, rowB, columnId) => { return compareBasic(toString2(rowA.getValue(columnId)), toString2(rowB.getValue(columnId))); }; var datetime = (rowA, rowB, columnId) => { - const a5 = rowA.getValue(columnId); + const a6 = rowA.getValue(columnId); const b4 = rowB.getValue(columnId); - return a5 > b4 ? 1 : a5 < b4 ? -1 : 0; + return a6 > b4 ? 1 : a6 < b4 ? -1 : 0; }; var basic = (rowA, rowB, columnId) => { return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId)); }; -function compareBasic(a5, b4) { - return a5 === b4 ? 0 : a5 > b4 ? 1 : -1; +function compareBasic(a6, b4) { + return a6 === b4 ? 0 : a6 > b4 ? 1 : -1; } -function toString2(a5) { - if (typeof a5 === "number") { - if (isNaN(a5) || a5 === Infinity || a5 === -Infinity) { +function toString2(a6) { + if (typeof a6 === "number") { + if (isNaN(a6) || a6 === Infinity || a6 === -Infinity) { return ""; } - return String(a5); + return String(a6); } - if (typeof a5 === "string") { - return a5; + if (typeof a6 === "string") { + return a6; } return ""; } function compareAlphanumeric(aStr, bStr) { - const a5 = aStr.split(reSplitAlphaNumeric).filter(Boolean); + const a6 = aStr.split(reSplitAlphaNumeric).filter(Boolean); const b4 = bStr.split(reSplitAlphaNumeric).filter(Boolean); - while (a5.length && b4.length) { - const aa = a5.shift(); + while (a6.length && b4.length) { + const aa = a6.shift(); const bb = b4.shift(); const an2 = parseInt(aa, 10); const bn2 = parseInt(bb, 10); @@ -46580,7 +47025,7 @@ function compareAlphanumeric(aStr, bStr) { return -1; } } - return a5.length - b4.length; + return a6.length - b4.length; } var sortingFns = { alphanumeric, @@ -46651,8 +47096,8 @@ var Sorting = { const nextSortingOrder = column.getNextSortingOrder(); const hasManualValue = typeof desc !== "undefined" && desc !== null; table.setSorting((old) => { - const existingSorting = old == null ? void 0 : old.find((d5) => d5.id === column.id); - const existingIndex = old == null ? void 0 : old.findIndex((d5) => d5.id === column.id); + const existingSorting = old == null ? void 0 : old.find((d6) => d6.id === column.id); + const existingIndex = old == null ? void 0 : old.findIndex((d6) => d6.id === column.id); let newSorting = []; let sortAction; let nextDesc = hasManualValue ? desc : nextSortingOrder === "desc"; @@ -46686,17 +47131,17 @@ var Sorting = { }]; newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER)); } else if (sortAction === "toggle") { - newSorting = old.map((d5) => { - if (d5.id === column.id) { + newSorting = old.map((d6) => { + if (d6.id === column.id) { return { - ...d5, + ...d6, desc: nextDesc }; } - return d5; + return d6; }); } else if (sortAction === "remove") { - newSorting = old.filter((d5) => d5.id !== column.id); + newSorting = old.filter((d6) => d6.id !== column.id); } else { newSorting = [{ id: column.id, @@ -46733,15 +47178,15 @@ var Sorting = { }, getIsSorted: () => { var _table$getState$sorti; - const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find((d5) => d5.id === column.id); + const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find((d6) => d6.id === column.id); return !columnSort ? false : columnSort.desc ? "desc" : "asc"; }, getSortIndex: () => { var _table$getState$sorti2, _table$getState$sorti3; - return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex((d5) => d5.id === column.id)) != null ? _table$getState$sorti2 : -1; + return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex((d6) => d6.id === column.id)) != null ? _table$getState$sorti2 : -1; }, clearSorting: () => { - table.setSorting((old) => old != null && old.length ? old.filter((d5) => d5.id !== column.id) : []); + table.setSorting((old) => old != null && old.length ? old.filter((d6) => d6.id !== column.id) : []); }, getToggleSortingHandler: () => { const canSort = column.getCanSort(); @@ -46833,8 +47278,8 @@ var Visibility = { }, createTable: (table) => { const makeVisibleColumnsMethod = (key2, getColumns) => { - return memo(() => [getColumns(), getColumns().filter((d5) => d5.getIsVisible()).map((d5) => d5.id).join("_")], (columns) => { - return columns.filter((d5) => d5.getIsVisible == null ? void 0 : d5.getIsVisible()); + return memo(() => [getColumns(), getColumns().filter((d6) => d6.getIsVisible()).map((d6) => d6.id).join("_")], (columns) => { + return columns.filter((d6) => d6.getIsVisible == null ? void 0 : d6.getIsVisible()); }, { key: key2, debug: () => { @@ -46952,11 +47397,11 @@ function createTable(options) { getRowModel: () => { return table.getPaginationRowModel(); }, - getRow: (id2) => { - const row = table.getRowModel().rowsById[id2]; + getRow: (id3) => { + const row = table.getRowModel().rowsById[id3]; if (!row) { if (true) { - throw new Error(`getRow expected an ID, but got ${id2}`); + throw new Error(`getRow expected an ID, but got ${id3}`); } throw new Error(); } @@ -47088,9 +47533,9 @@ function createCell(table, row, column, columnId) { }, {}); return cell; } -var createRow = (table, id2, original, rowIndex, depth, subRows) => { +var createRow = (table, id3, original, rowIndex, depth, subRows) => { let row = { - id: id2, + id: id3, index: rowIndex, original, depth, @@ -47127,7 +47572,7 @@ var createRow = (table, id2, original, rowIndex, depth, subRows) => { return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue; }, subRows: subRows != null ? subRows : [], - getLeafRows: () => flattenBy(row.subRows, (d5) => d5.subRows), + getLeafRows: () => flattenBy(row.subRows, (d6) => d6.subRows), getAllCells: memo(() => [table.getAllLeafColumns()], (leafColumns) => { return leafColumns.map((column) => { return createCell(table, row, column, column.id); @@ -47152,8 +47597,8 @@ var createRow = (table, id2, original, rowIndex, depth, subRows) => { } }) }; - for (let i4 = 0; i4 < table._features.length; i4++) { - const feature = table._features[i4]; + for (let i5 = 0; i5 < table._features.length; i5++) { + const feature = table._features[i5]; Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table)); } return row; @@ -47170,14 +47615,14 @@ function getCoreRowModel() { depth = 0; } const rows = []; - for (let i4 = 0; i4 < originalRows.length; i4++) { - const row = createRow(table, table._getRowId(originalRows[i4], i4, parent), originalRows[i4], i4, depth); + for (let i5 = 0; i5 < originalRows.length; i5++) { + const row = createRow(table, table._getRowId(originalRows[i5], i5, parent), originalRows[i5], i5, depth); rowModel.flatRows.push(row); rowModel.rowsById[row.id] = row; rows.push(row); if (table.options.getSubRows) { var _row$originalSubRows; - row.originalSubRows = table.options.getSubRows(originalRows[i4], i4); + row.originalSubRows = table.options.getSubRows(originalRows[i5], i5); if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) { row.subRows = accessRows(row.originalSubRows, depth + 1, row); } @@ -47225,11 +47670,11 @@ function getGroupedRowModel() { const rowGroupsMap = groupBy(rows, columnId); const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map((_ref, index) => { let [groupingValue, groupedRows2] = _ref; - let id2 = `${columnId}:${groupingValue}`; - id2 = parentId ? `${parentId}>${id2}` : id2; - const subRows = groupUpRecursively(groupedRows2, depth + 1, id2); + let id3 = `${columnId}:${groupingValue}`; + id3 = parentId ? `${parentId}>${id3}` : id3; + const subRows = groupUpRecursively(groupedRows2, depth + 1, id3); const leafRows = depth ? flattenBy(groupedRows2, (row2) => row2.subRows) : groupedRows2; - const row = createRow(table, id2, leafRows[0].original, index, depth); + const row = createRow(table, id3, leafRows[0].original, index, depth); Object.assign(row, { groupingColumnId: columnId, groupingValue, @@ -47390,10 +47835,18 @@ init_compat_module(); var import_lodash8 = __toESM(require_lodash()); init_compat_module(); var OptionCell = (props2) => { - var _a2, _b2; + var _a2, _b2, _c2; + const parsedValue = F2( + () => parseFieldValue(props2.options, "option"), + [props2.options] + ); + const serializeValue = (newOptions, value2) => JSON.stringify({ + ...value2, + options: newOptions.map((f4) => ({ name: f4.name, value: f4.value })) + }); const initialValue = (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).filter((f4) => f4); const initialOptions = [ - ...(_b2 = parseMultiString(props2.options).filter((f4) => f4).map((t4) => ({ name: t4, value: t4, removeable: true }))) != null ? _b2 : [], + ...(_c2 = ((_b2 = parsedValue.options) != null ? _b2 : []).filter((f4) => f4.value).map((t5) => ({ name: t5.name, value: t5.value, removeable: true }))) != null ? _c2 : [], ...initialValue.map((f4) => ({ name: f4, value: f4, removeable: true })) ].filter(onlyUniqueProp("value")).filter((f4) => f4.value.length > 0); const [options, setOptions] = h2(initialOptions); @@ -47404,11 +47857,11 @@ var OptionCell = (props2) => { (props2.multi ? (_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : [] : [props2.initialValue]).filter((f4) => f4) ); }, [props2.initialValue]); - const removeValue = (v3) => { - const newValues = value.filter((f4) => f4 != v3); + const removeValue = (v4) => { + const newValues = value.filter((f4) => f4 != v4); setValue(newValues); props2.saveOptions( - serializeMultiString(options.map((f4) => f4.value)), + serializeValue(options, parsedValue), serializeMultiString(newValues) ); }; @@ -47418,28 +47871,37 @@ var OptionCell = (props2) => { setOptions(newOptions); setValue(newValues); props2.saveOptions( - serializeMultiString(newOptions.map((f4) => f4.value)), + serializeValue( + newOptions.map((f4) => f4.value), + parsedValue + ), serializeMultiString(newValues) ); }; const saveOptions = (_options, _value) => { if (!props2.multi) { setOptions( - _options.filter((f4) => f4.length > 0).map((t4) => ({ name: t4, value: t4, removeable: true })) + _options.filter((f4) => f4.length > 0).map((t5) => ({ name: t5, value: t5, removeable: true })) ); setValue(_value); props2.saveOptions( - serializeMultiString(_options.filter((f4) => f4.length > 0)), + serializeValue( + _options.filter((f4) => f4.length > 0).map((t5) => ({ name: t5, value: t5 })), + parsedValue + ), serializeMultiString(_value) ); } else { const newValues = (0, import_lodash8.uniq)([...value, _value[0]]); setOptions( - _options.map((t4) => ({ name: t4, value: t4, removeable: true })) + _options.map((t5) => ({ name: t5, value: t5, removeable: true })) ); setValue(newValues); props2.saveOptions( - serializeMultiString(_options.filter((f4) => f4.length > 0)), + serializeValue( + _options.filter((f4) => f4.length > 0).map((t5) => ({ name: t5, value: t5 })), + parsedValue + ), serializeMultiString(newValues) ); } @@ -47494,8 +47956,8 @@ var OptionCellBase = (props2) => { return /* @__PURE__ */ Cn.createElement("div", { className: props2.baseClass, ref: ref2 - }, value.length > 0 ? value.map((o3, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, + }, value.length > 0 ? value.map((o3, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, className: "mk-cell-option-item" }, (getLabelString ? getLabelString(o3).length > 0 : o3.length > 0) ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { className: valueClass && valueClass(o3), @@ -47531,24 +47993,57 @@ var ContextCell = (props2) => { const stringValueToLink = (strings) => strings.map((f4) => { return { label: parseLinkDisplayString(f4), - path: parseLinkString(f4) + path: parseLinkString(f4), + ref: false }; }); const initialValue = stringValueToLink( props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue] ); - const ref2 = _2(null); - const options = stringValueToLink( - (_c2 = (_b2 = props2.contextTable) == null ? void 0 : _b2.rows.map((f4) => f4[FilePropertyName])) != null ? _c2 : [] - ).map((f4) => ({ + const [propValues, setPropValues] = h2( + (_c2 = (_b2 = props2.plugin.index.contextsIndex.get(props2.space)) == null ? void 0 : _b2.spaceMap[props2.spaceField]) == null ? void 0 : _c2[props2.path] + ); + p2(() => { + var _a3, _b3; + setPropValues( + (_b3 = (_a3 = props2.plugin.index.contextsIndex.get(props2.space)) == null ? void 0 : _a3.spaceMap[props2.spaceField]) == null ? void 0 : _b3[props2.path] + ); + }, [props2.space, props2.spaceField]); + const options = stringValueToLink([ + ...props2.plugin.index.spacesMap.getInverse(props2.space) + ]).map((f4) => ({ name: f4.label, value: f4.path })); const [value, setValue] = h2(initialValue); - const removeValue = (v3) => { - const newValues = value.filter((f4) => f4.path != v3.path); - setValue(newValues); - props2.saveValue(serializeMultiString(newValues.map((f4) => f4.path))); + const allValues = F2( + () => [ + ...value, + ...(propValues != null ? propValues : []).map((f4) => ({ + label: parseLinkDisplayString(f4), + path: parseLinkString(f4), + ref: true + })) + ], + [value, propValues] + ); + const removeValue = (v4) => { + if (v4.ref) { + const newPropValues = propValues.filter((f4) => f4 != v4.path); + setPropValues(newPropValues); + updateContextValue( + props2.plugin, + props2.plugin.index.spacesIndex.get(props2.space).space, + v4.path, + props2.spaceField, + props2.path, + deletePropertyMultiValue + ); + } else { + const newValues = value.filter((f4) => f4.path != v4.path); + setValue(newValues); + props2.saveValue(serializeMultiString(newValues.map((f4) => f4.path))); + } }; p2(() => { var _a3; @@ -47559,12 +48054,13 @@ var ContextCell = (props2) => { ); }, [props2.initialValue]); const saveOptions = (_options, _value) => { - insertContextItems(props2.plugin, _options, props2.contextTag); + insertContextItems(props2.plugin, _value, props2.space); if (!props2.multi) { setValue( _value.map((f4) => ({ path: f4, - label: fileNameToString(folderPathToString(f4)) + label: fileNameToString(folderPathToString(f4)), + ref: false })) ); props2.saveValue(serializeMultiString(_value)); @@ -47575,7 +48071,8 @@ var ContextCell = (props2) => { setValue( newValues.map((f4) => ({ label: fileNameToString(folderPathToString(f4)), - path: f4 + path: f4, + ref: false })) ); props2.saveValue(serializeMultiString(newValues)); @@ -47594,7 +48091,7 @@ var ContextCell = (props2) => { plugin: props2.plugin, multi: false, editable: true, - value: value.map((f4) => f4.path), + value: allValues.map((f4) => f4.path), options: _options, saveOptions, placeholder: i18n_default.labels.contextItemSelectPlaceholder, @@ -47608,7 +48105,7 @@ var ContextCell = (props2) => { menuProps, openItem: openLink, getLabelString: (o3) => o3.label, - value, + value: allValues, multi: props2.multi, editMode: props2.editMode, removeValue @@ -47616,43 +48113,43 @@ var ContextCell = (props2) => { }; // src/components/ui/menus/datePickerMenu.tsx -var import_obsidian23 = require("obsidian"); +var import_obsidian24 = require("obsidian"); init_compat_module(); // node_modules/react-day-picker/dist/index.esm.js init_compat_module(); init_compat_module(); var __assign = function() { - __assign = Object.assign || function __assign5(t4) { - for (var s5, i4 = 1, n2 = arguments.length; i4 < n2; i4++) { - s5 = arguments[i4]; - for (var p3 in s5) - if (Object.prototype.hasOwnProperty.call(s5, p3)) - t4[p3] = s5[p3]; + __assign = Object.assign || function __assign5(t5) { + for (var s6, i5 = 1, n2 = arguments.length; i5 < n2; i5++) { + s6 = arguments[i5]; + for (var p3 in s6) + if (Object.prototype.hasOwnProperty.call(s6, p3)) + t5[p3] = s6[p3]; } - return t4; + return t5; }; return __assign.apply(this, arguments); }; -function __rest(s5, e4) { - var t4 = {}; - for (var p3 in s5) - if (Object.prototype.hasOwnProperty.call(s5, p3) && e4.indexOf(p3) < 0) - t4[p3] = s5[p3]; - if (s5 != null && typeof Object.getOwnPropertySymbols === "function") - for (var i4 = 0, p3 = Object.getOwnPropertySymbols(s5); i4 < p3.length; i4++) { - if (e4.indexOf(p3[i4]) < 0 && Object.prototype.propertyIsEnumerable.call(s5, p3[i4])) - t4[p3[i4]] = s5[p3[i4]]; +function __rest(s6, e4) { + var t5 = {}; + for (var p3 in s6) + if (Object.prototype.hasOwnProperty.call(s6, p3) && e4.indexOf(p3) < 0) + t5[p3] = s6[p3]; + if (s6 != null && typeof Object.getOwnPropertySymbols === "function") + for (var i5 = 0, p3 = Object.getOwnPropertySymbols(s6); i5 < p3.length; i5++) { + if (e4.indexOf(p3[i5]) < 0 && Object.prototype.propertyIsEnumerable.call(s6, p3[i5])) + t5[p3[i5]] = s6[p3[i5]]; } - return t4; + return t5; } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) - for (var i4 = 0, l3 = from.length, ar; i4 < l3; i4++) { - if (ar || !(i4 in from)) { + for (var i5 = 0, l3 = from.length, ar; i5 < l3; i5++) { + if (ar || !(i5 in from)) { if (!ar) - ar = Array.prototype.slice.call(from, 0, i4); - ar[i4] = from[i4]; + ar = Array.prototype.slice.call(from, 0, i5); + ar[i5] = from[i5]; } } return to.concat(ar || Array.prototype.slice.call(from)); @@ -47886,8 +48383,8 @@ function MonthsDropdown(props2) { props2.onChange(newMonth); }; var DropdownComponent2 = (_a2 = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a2 !== void 0 ? _a2 : Dropdown; - return Cn.createElement(DropdownComponent2, { name: "months", "aria-label": labelMonthDropdown2(), className: classNames9.dropdown_month, style: styles2.dropdown_month, onChange: handleChange, value: props2.displayMonth.getMonth(), caption: formatMonthCaption2(props2.displayMonth, { locale: locale2 }) }, dropdownMonths.map(function(m5) { - return Cn.createElement("option", { key: m5.getMonth(), value: m5.getMonth() }, formatMonthCaption2(m5, { locale: locale2 })); + return Cn.createElement(DropdownComponent2, { name: "months", "aria-label": labelMonthDropdown2(), className: classNames9.dropdown_month, style: styles2.dropdown_month, onChange: handleChange, value: props2.displayMonth.getMonth(), caption: formatMonthCaption2(props2.displayMonth, { locale: locale2 }) }, dropdownMonths.map(function(m6) { + return Cn.createElement("option", { key: m6.getMonth(), value: m6.getMonth() }, formatMonthCaption2(m6, { locale: locale2 })); })); } function YearsDropdown(props2) { @@ -47951,8 +48448,8 @@ function getDisplayMonths(month, _a2) { var end = startOfMonth(addMonths(start, numberOfMonths)); var monthsDiff = differenceInCalendarMonths(end, start); var months = []; - for (var i4 = 0; i4 < monthsDiff; i4++) { - var nextMonth = addMonths(start, i4); + for (var i5 = 0; i5 < monthsDiff; i5++) { + var nextMonth = addMonths(start, i5); months.push(nextMonth); } if (reverseMonths) @@ -48169,8 +48666,8 @@ function Footer(props2) { function getWeekdays(locale2, weekStartsOn, ISOWeek) { var start = ISOWeek ? startOfISOWeek(new Date()) : startOfWeek(new Date(), { locale: locale2, weekStartsOn }); var days = []; - for (var i4 = 0; i4 < 7; i4++) { - var day = addDays(start, i4); + for (var i5 = 0; i5 < 7; i5++) { + var day = addDays(start, i5); days.push(day); } return days; @@ -48182,8 +48679,8 @@ function HeadRow() { "tr", { style: styles2.head_row, className: classNames9.head_row }, showWeekNumber && Cn.createElement("th", { scope: "col", style: styles2.head_cell, className: classNames9.head_cell }), - weekdays.map(function(weekday, i4) { - return Cn.createElement("th", { key: i4, scope: "col", className: classNames9.head_cell, style: styles2.head_cell, "aria-label": labelWeekday2(weekday, { locale: locale2 }) }, formatWeekdayName2(weekday, { locale: locale2 })); + weekdays.map(function(weekday, i5) { + return Cn.createElement("th", { key: i5, scope: "col", className: classNames9.head_cell, style: styles2.head_cell, "aria-label": labelWeekday2(weekday, { locale: locale2 }) }, formatWeekdayName2(weekday, { locale: locale2 })); }) ); } @@ -48968,15 +49465,15 @@ function Day(props2) { function WeekNumber(props2) { var weekNumber = props2.number, dates = props2.dates; var _a2 = useDayPicker(), onWeekNumberClick = _a2.onWeekNumberClick, styles2 = _a2.styles, classNames9 = _a2.classNames, locale2 = _a2.locale, labelWeekNumber2 = _a2.labels.labelWeekNumber, formatWeekNumber2 = _a2.formatters.formatWeekNumber; - var content = formatWeekNumber2(Number(weekNumber), { locale: locale2 }); + var content2 = formatWeekNumber2(Number(weekNumber), { locale: locale2 }); if (!onWeekNumberClick) { - return Cn.createElement("span", { className: classNames9.weeknumber, style: styles2.weeknumber }, content); + return Cn.createElement("span", { className: classNames9.weeknumber, style: styles2.weeknumber }, content2); } var label = labelWeekNumber2(Number(weekNumber), { locale: locale2 }); var handleClick = function(e4) { onWeekNumberClick(weekNumber, dates, e4); }; - return Cn.createElement(Button, { name: "week-number", "aria-label": label, className: classNames9.weeknumber, style: styles2.weeknumber, onClick: handleClick }, content); + return Cn.createElement(Button, { name: "week-number", "aria-label": label, className: classNames9.weeknumber, style: styles2.weeknumber, onClick: handleClick }, content2); } function Row(props2) { var _a2, _b2; @@ -49009,8 +49506,8 @@ function daysToMonthWeeks(fromDate, toDate2, options) { var fromWeek = (options === null || options === void 0 ? void 0 : options.ISOWeek) ? startOfISOWeek(fromDate) : startOfWeek(fromDate, options); var nOfDays = differenceInCalendarDays(toWeek, fromWeek); var days = []; - for (var i4 = 0; i4 <= nOfDays; i4++) { - days.push(addDays(fromWeek, i4)); + for (var i5 = 0; i5 <= nOfDays; i5++) { + days.push(addDays(fromWeek, i5)); } var weeksInMonth = days.reduce(function(result, date) { var weekNumber = (options === null || options === void 0 ? void 0 : options.ISOWeek) ? getISOWeek(date) : getWeek(date, options); @@ -49078,9 +49575,9 @@ function genId2() { function useId(providedId) { var _a2; var initialId = providedId !== null && providedId !== void 0 ? providedId : serverHandoffComplete ? genId2() : null; - var _b2 = h2(initialId), id2 = _b2[0], setId = _b2[1]; + var _b2 = h2(initialId), id3 = _b2[0], setId = _b2[1]; useIsomorphicLayoutEffect2(function() { - if (id2 === null) { + if (id3 === null) { setId(genId2()); } }, []); @@ -49089,7 +49586,7 @@ function useId(providedId) { serverHandoffComplete = true; } }, []); - return (_a2 = providedId !== null && providedId !== void 0 ? providedId : id2) !== null && _a2 !== void 0 ? _a2 : void 0; + return (_a2 = providedId !== null && providedId !== void 0 ? providedId : id3) !== null && _a2 !== void 0 ? _a2 : void 0; } function Month(props2) { var _a2; @@ -49158,8 +49655,8 @@ function Root2() { return Cn.createElement( "div", { className: classNames9.join(" "), style, dir: dayPicker.dir }, - Cn.createElement("div", { className: dayPicker.classNames.months, style: dayPicker.styles.months }, navigation.displayMonths.map(function(month, i4) { - return Cn.createElement(Month, { key: i4, displayIndex: i4, displayMonth: month }); + Cn.createElement("div", { className: dayPicker.classNames.months, style: dayPicker.styles.months }, navigation.displayMonths.map(function(month, i5) { + return Cn.createElement(Month, { key: i5, displayIndex: i5, displayMonth: month }); })) ); } @@ -49201,7 +49698,7 @@ function DayPicker(props2) { // src/components/ui/menus/datePickerMenu.tsx var showDatePickerMenu = (point, value, setValue, format2) => { - const menu = new import_obsidian23.Menu(); + const menu = new import_obsidian24.Menu(); menu.dom.toggleClass("mk-menu", true); menu.setUseNativeMenu(false); const frag = document.createDocumentFragment(); @@ -49243,9 +49740,9 @@ var showDatePickerMenu = (point, value, setValue, format2) => { item.setTitle(frag); }); const keys2 = [...menu.scope.keys]; - for (let i4 = 0; i4 < keys2.length; i4++) { - if (keys2[i4].key != "Escape") { - menu.scope.unregister(keys2[i4]); + for (let i5 = 0; i5 < keys2.length; i5++) { + if (keys2[i5].key != "Escape") { + menu.scope.unregister(keys2[i5]); } } menu.showAtPosition(point); @@ -49336,2021 +49833,1472 @@ var DateCell = (props2) => { }, date ? formatDate(props2.plugin, date, props2.propertyValue) : value)); }; -// src/components/ui/modals/editSpaceModal.tsx -var import_obsidian24 = require("obsidian"); -var EditSpaceModal = class extends import_obsidian24.Modal { - constructor(plugin, space, action, def) { - super(plugin.app); - this.space = space; - this.action = action; - this.plugin = plugin; - this.def = def; - } - onOpen() { - const { contentEl } = this; - let headerText; - if (this.action === "rename") { - headerText = i18n_default.labels.renameSection; - } else if (this.action === "create") { - headerText = i18n_default.labels.createSection; - } - const headerEl = contentEl.createEl("div", { text: headerText }); - headerEl.addClass("modal-title"); - const inputEl = contentEl.createEl("input"); - inputEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; - if (this.action === "rename") { - inputEl.value = this.space.name; - } - inputEl.focus(); - let changeButtonText; - if (this.action === "rename") { - changeButtonText = i18n_default.buttons.saveSpace; - } else if (this.action === "create") { - changeButtonText = i18n_default.buttons.saveSpace; - } - const changeButton = contentEl.createEl("button", { - text: changeButtonText - }); - const cancelButton = contentEl.createEl("button", { - text: i18n_default.buttons.cancel - }); - cancelButton.style.cssText = "float: right;"; - cancelButton.addEventListener("click", () => { - this.close(); - }); - const onClickAction = async () => { - var _a2; - const newName = inputEl.value.replace(/\//g, ""); - if (newName.length == 0) { - new import_obsidian24.Notice(i18n_default.notice.newSpaceName); - return; +// src/context/FrameEditorContext.tsx +var import_lodash9 = __toESM(require_lodash()); +var import_obsidian25 = require("obsidian"); +init_compat_module(); + +// src/utils/frames/frames.ts +var frameEmbedStringFromContext = (space2, schema) => { + return `![![${space2.path}#*${schema}]]`; +}; +var stringIsConst = (str) => { + const hasQuotesAtStartEndOnly = /^["'][^"']*["'](?:;)?$/.test(str); + const isNumber = !isNaN(parseFloat(str)) && isFinite(str); + return hasQuotesAtStartEndOnly || isNumber || str == null || str == ""; +}; +var moveFrameToNewSpace = async (plugin, space2, schemaId, newSpace) => { + const table = await getMFrameTable(plugin, space2, schemaId); + const schemas = await getMDBTableSchemas(plugin, newSpace, "frames"); + const newSchemaId = uniqueNameFromString(schemaId, schemas.map((f4) => f4.id)); + const newTable = { + schema: { ...table.schema, id: newSchemaId }, + cols: table.cols.map((f4) => ({ ...f4, schemaId: newSchemaId })), + rows: table.rows.map((f4) => f4.id == schemaId ? { ...f4, id: newSchemaId, schemaId: newSchemaId } : f4.parentId == schemaId ? { ...f4, parentId: newSchemaId, schemaId: newSchemaId } : { ...f4, schemaId: newSchemaId }) + }; + await saveMFramesToPath(plugin, newSpace, newTable); + await deleteMDBTable(plugin, newSpace, schemaId, "frames"); +}; +var newUniqueNode = (node, parent, otherNodes, schemaId) => { + const id3 = uniqueNameFromString( + node.node.id, + otherNodes.map((f4) => f4.id) + ); + return { + ...node.node, + id: id3, + schemaId, + parentId: parent + }; +}; + +// src/utils/frames/runner.ts +function extractDependencies(code) { + const dependencies = []; + function visit(node, parts = []) { + if (node.type === "Identifier") { + parts.push(node.name); + return parts; + } else if (node.type === "MemberExpression") { + const objectParts = visit(node.object, parts); + if (objectParts && node.computed) { + if (node.property.type === "Literal") { + objectParts.push(String(node.property.value)); + return objectParts; + } else { + return null; + } + } else if (objectParts) { + return visit(node.property, objectParts); } - if (this.plugin.index.spacesIndex.has(newName) && newName != this.space.name) { - new import_obsidian24.Notice(i18n_default.notice.duplicateSpaceName); - return; + } else if (node.type === "Literal") { + parts.push(String(node.value)); + return parts; + } + return null; + } + function explore(node) { + if (node.type === "MemberExpression") { + const parts = visit(node); + if (parts) { + dependencies.push(parts); } - if (this.action === "rename") { - renamePath(this.plugin, this.space.space.uri, newName); - } else if (this.action === "create") { - await insertSpaceAtIndex(this.plugin, newName, { - def: (_a2 = this.def) != null ? _a2 : { - type: "links" - }, - contexts: [] - }); - openSpace(spacePathFromName(newName), this.plugin, false); + return; + } + for (const key2 in node) { + if (typeof node[key2] === "object" && node[key2] !== null) { + explore(node[key2]); } - this.close(); - }; - changeButton.addEventListener("click", onClickAction); - inputEl.addEventListener("keydown", (e4) => { - if (e4.key === "Enter") - onClickAction(); - }); + } } - onClose() { - const { contentEl } = this; - contentEl.empty(); + try { + const ast = parse3(code.replace("return ", ""), { ecmaVersion: 2020 }); + explore(ast); + } catch (e4) { + return []; } -}; - -// src/components/ui/menus/fileMenu.tsx -var import_obsidian25 = require("obsidian"); - -// src/utils/color.ts -var colors = [ - ["Red", "#eb3b5a"], - ["Orange", "#fa8231"], - ["Yellow", "#f7b731"], - ["Green", "#20bf6b"], - ["Turquoise", "#0fb9b1"], - ["Teal", "#2d98da"], - ["Blue", "#3867d6"], - ["Purple", "#8854d0"], - ["Charcoal", "#4b6584"] -]; - -// src/components/ui/menus/fileMenu.tsx -var triggerSectionAddMenu = (plugin, e4, space, activeFile) => { - const fileMenu = new import_obsidian25.Menu(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("edit"); - menuItem.setTitle(i18n_default.buttons.createNote); - menuItem.onClick((ev) => { - newFileInSpace(plugin, space.space, activeFile); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("layout-dashboard"); - menuItem.setTitle(i18n_default.buttons.createCanvas); - menuItem.onClick((ev) => { - newFileInSpace(plugin, space.space, activeFile, true); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("folder-plus"); - menuItem.setTitle(i18n_default.buttons.createFolder); - menuItem.onClick((ev) => { - newFolderInSpace(plugin, space.space, activeFile); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("plus"); - menuItem.setTitle(i18n_default.buttons.createSection); - menuItem.onClick((ev) => { - const vaultChangeModal = new EditSpaceModal(plugin, null, "create"); - vaultChangeModal.open(); - }); - }); - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY + return dependencies; +} +function sortKeysByDependencies(codeBlockStore, identifier) { + const graph = /* @__PURE__ */ new Map(); + const dependencies = /* @__PURE__ */ new Map(); + const allDependencies = /* @__PURE__ */ new Map(); + for (const key2 in codeBlockStore) { + const code = codeBlockStore[key2]; + const extractedDependencies = extractDependencies(code); + const localDependencies = extractedDependencies.filter((dep) => { + return dep.slice(0, -1).join(".") === identifier; }); + dependencies.set(key2, localDependencies); + allDependencies.set(key2, extractedDependencies); + if (!graph.has(key2)) { + graph.set(key2, /* @__PURE__ */ new Set()); + } + for (const dep of localDependencies) { + const depStr = dep[dep.length - 1]; + if (depStr === key2) + continue; + graph.get(key2).add(depStr); + } } - return false; -}; -var triggerSpaceMenu = (plugin, space, e4, activeFile, parentSpace) => { - if (!space) - return; - const spaceMenu = new import_obsidian25.Menu(); - spaceMenu.addItem((menuItem) => { - menuItem.setIcon("arrow-up-right"); - menuItem.setTitle("Reveal in Finder"); - menuItem.onClick((ev) => { - const file = getAbstractFileAtPath( - app, - space.type == "folder" ? space.path : `${plugin.settings.spacesFolder}/${space.name}` - ); - if (file instanceof import_obsidian25.TFolder) { - const leaf = app.workspace.getLeaf(false); - app.workspace.setActiveLeaf(leaf, { focus: true }); - leaf.openFile(file, { eState: { focus: true } }); + const visited = /* @__PURE__ */ new Set(); + const result = []; + const temp = /* @__PURE__ */ new Set(); + const visit = (key2) => { + if (temp.has(key2)) + throw new Error("Circular dependency detected"); + if (!visited.has(key2)) { + temp.add(key2); + const edges = graph.get(key2) || /* @__PURE__ */ new Set(); + for (const dep of edges) { + visit(dep); } - }); - }); - spaceMenu.addItem((menuItem) => { - menuItem.setIcon("edit"); - menuItem.setTitle(i18n_default.buttons.createNote); - menuItem.onClick((ev) => { - newFileInSpace(plugin, space.space, activeFile); - }); - }); - spaceMenu.addItem((menuItem) => { - menuItem.setIcon("layout-dashboard"); - menuItem.setTitle(i18n_default.buttons.createCanvas); - menuItem.onClick((ev) => { - newFileInSpace(plugin, space.space, activeFile, true); - }); - }); - spaceMenu.addItem((menuItem) => { - menuItem.setIcon("folder-plus"); - menuItem.setTitle(i18n_default.buttons.createFolder); - menuItem.onClick((ev) => { - newFolderInSpace(plugin, space.space, activeFile); - }); - }); - spaceMenu.addSeparator(); - spaceMenu.addItem((menuItem) => { - menuItem.setIcon("plus-square"); - menuItem.setTitle("Add to Space"); - menuItem.onClick((ev) => { - const vaultChangeModal = new AddToSpaceModal(plugin, [space.path]); - vaultChangeModal.open(); - }); - }); - spaceMenu.addItem((menuItem) => { - const pinned = plugin.settings.waypoints.some((f4) => f4 == space.path); - menuItem.setTitle(pinned ? i18n_default.menu.unpinSpace : i18n_default.menu.pinSpace); - menuItem.setIcon("pin"); - menuItem.onClick((ev) => { - toggleSpacePin(plugin, space.path, "pinned", pinned); - }); - }); - if (space) { - const spaceCache = plugin.index.spacesIndex.get(parentSpace); - if (spaceCache) { - spaceMenu.addItem((menuItem) => { - menuItem.setIcon("minus-square"); - menuItem.setTitle("Remove from Space"); - menuItem.onClick((ev) => { - removePathsFromSpace(plugin, spaceCache, [space.path]); - }); - }); + visited.add(key2); + temp.delete(key2); + result.push(key2); + } + }; + for (const key2 in codeBlockStore) { + if (!visited.has(key2)) { + visit(key2); } } - spaceMenu.addSeparator(); - if (plugin.settings.spacesStickers) { - spaceMenu.addSeparator(); - spaceMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.changeIcon); - menuItem.setIcon("lucide-sticker"); - menuItem.onClick((ev) => { - const vaultChangeModal = new stickerModal( - plugin.app, - plugin, - (emoji) => saveSpaceIcon(plugin, space.path, emoji) - ); - vaultChangeModal.open(); - }); - }); - spaceMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.removeIcon); - menuItem.setIcon("lucide-file-minus"); - menuItem.onClick((ev) => { - removeSpaceIcon(plugin, space.path); - }); - }); + return { sortedKeys: result, dependencies: allDependencies }; +} +var executeTreeNode = async (_treeNode, state, api, saveState, root2, runID, newState) => { + var _a2, _b2, _c2; + const treeNode = _treeNode; + let execState = await executeNode(treeNode.node, { state, newState }, api); + if (treeNode.node.type == "list") { + let uid = 0; + treeNode.children = parseMultiString(execState.state[treeNode.id].props.value).flatMap((f4, i5) => treeNode.children.map((n2) => { + const [tree, m6] = linkTreeNodes({ ...n2, node: { ...n2.node, props: { ...n2.node.props, value: wrapQuotes(f4) } } }, uid); + uid = m6; + return tree; + })); } - spaceMenu.addSeparator(); - spaceMenu.addSeparator(); - if (space.type == "links" || space.type == "folder" || space.type == "vault") { - spaceMenu.addItem((menuItem) => { - const sortOption = ["rank", true]; - menuItem.setIcon("arrow-up-down"); - menuItem.setTitle(i18n_default.menu.customSort); - menuItem.setChecked( - space.metadata.sort == JSON.stringify(sortOption) || space.metadata.sort == "" - ); - menuItem.onClick((ev) => { - updateSpaceSort(plugin, space.path, sortOption); - }); - }); + if (typeof ((_b2 = (_a2 = execState.state[treeNode.id]) == null ? void 0 : _a2.actions) == null ? void 0 : _b2.onRun) == "function") { + (_c2 = execState.state[treeNode.id].actions) == null ? void 0 : _c2.onRun( + execState, + (s6) => { + saveState(s6, { state: execState.state, root: root2, id: runID }); + }, + api + ); } - spaceMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.sortBy); - menuItem.setIcon("sort-desc"); - menuItem.onClick((ev) => { - const sortMenu = new import_obsidian25.Menu(); - sortMenu.addItem((menuItem2) => { - const sortOption = ["name", true]; - menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaAsc); - menuItem2.setChecked(space.metadata.sort == JSON.stringify(sortOption)); - menuItem2.onClick((ev2) => { - updateSpaceSort(plugin, space.path, sortOption); - }); - }); - sortMenu.addItem((menuItem2) => { - const sortOption = ["name", false]; - menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaDesc); - menuItem2.setChecked(space.metadata.sort == JSON.stringify(sortOption)); - menuItem2.onClick((ev2) => { - updateSpaceSort(plugin, space.path, sortOption); - }); - }); - sortMenu.addSeparator(); - sortMenu.addItem((menuItem2) => { - const sortOption = ["ctime", false]; - menuItem2.setTitle(i18n_default.menu.createdTimeSortAsc); - menuItem2.setChecked(space.metadata.sort == JSON.stringify(sortOption)); - menuItem2.onClick((ev2) => { - updateSpaceSort(plugin, space.path, sortOption); - }); - }); - sortMenu.addItem((menuItem2) => { - const sortOption = ["ctime", true]; - menuItem2.setTitle(i18n_default.menu.createdTimeSortDesc); - menuItem2.setChecked(space.metadata.sort == JSON.stringify(sortOption)); - menuItem2.onClick((ev2) => { - updateSpaceSort(plugin, space.path, sortOption); - }); - }); - const offset2 = e4.target.getBoundingClientRect(); - if (isMouseEvent(e4)) { - sortMenu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); - } else { - sortMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } - }); - }); - spaceMenu.addSeparator(); - if (space.type != "vault") - spaceMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.edit); - menuItem.setIcon("pencil"); - menuItem.onClick((ev) => { - const vaultChangeModal = new EditSpaceModal(plugin, space, "rename"); - vaultChangeModal.open(); - }); - }); - if (space.type != "vault") - spaceMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.deleteSpace); - menuItem.setIcon("trash"); - menuItem.onClick((ev) => { - removeSpace(plugin, space.path); - }); - }); - if (isMouseEvent(e4)) { - spaceMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - spaceMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); + for (let i5 = 0; i5 < treeNode.children.length; i5++) { + const [newState2, newNode] = await executeTreeNode(treeNode.children[i5], execState.state, api, saveState, root2, runID, execState.newState).then((f4) => [{ state: f4.state, newState: f4.newState }, f4.root]); + execState = newState2; + treeNode.children[i5] = newNode; } - return false; + return { id: runID, root: treeNode, state: execState.state, newState: execState.newState }; }; -var triggerMultiFileMenu = (plugin, selectedFiles, e4) => { - const files = selectedFiles.map((s5) => s5.item.path); - const fileMenu = new import_obsidian25.Menu(); - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("plus"); - menuItem.setTitle("Add to Space"); - menuItem.onClick((ev) => { - const vaultChangeModal = new AddToSpaceModal( - plugin, - selectedFiles.map((f4) => f4.path) - ); - vaultChangeModal.open(); - }); +var executeNode = async (node, results, api) => { + const propResults = await executePropsCodeBlocks(node, results, api); + const stylesResults = executeCodeBlocks(node, "styles", propResults); + const actions = executeCodeBlocks(node, "actions", stylesResults); + return actions; +}; +var executePropsCodeBlocks = async (node, results, api) => { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j, _k; + const { type, props: props2, id: id3 } = node; + const codeBlockStore = props2 != null ? props2 : {}; + const { sortedKeys, dependencies } = sortKeysByDependencies(codeBlockStore, `${node.id}.props`); + const runKeys = results.newState ? sortedKeys.filter((f4) => { + var _a3, _b3, _c3, _d3, _e3, _f2; + const deps = dependencies.get(f4); + if (f4 in ((_c3 = (_b3 = (_a3 = results.newState) == null ? void 0 : _a3[node.id]) == null ? void 0 : _b3["props"]) != null ? _c3 : {})) { + return true; + } + for (const dep of deps) { + if (dep[0] == "api") + return true; + if ((_f2 = (_e3 = (_d3 = results.newState) == null ? void 0 : _d3[dep[0]]) == null ? void 0 : _e3[dep[1]]) == null ? void 0 : _f2[dep[2]]) { + return true; + } + } + return false; + }) : sortedKeys.filter((f4) => { + var _a3; + return ((_a3 = codeBlockStore[f4]) == null ? void 0 : _a3.length) > 0; }); - if (plugin.settings.spacesStickers) { - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("palette"); - disclosureMenuItem( - plugin, - menuItem, - false, - false, - i18n_default.menu.changeColor, - "", - [ - { name: "None", value: "" }, - ...colors.map((f4) => ({ name: f4[0], value: f4[1] })) - ], - (_12, values) => { - saveFileColors(plugin, files, values[0]); + const environment = results.state; + environment[id3] = { + props: (_b2 = (_a2 = results.state[id3]) == null ? void 0 : _a2.props) != null ? _b2 : {}, + actions: (_d2 = (_c2 = results.state[id3]) == null ? void 0 : _c2.actions) != null ? _d2 : {}, + styles: (_f = (_e2 = results.state[id3]) == null ? void 0 : _e2.styles) != null ? _f : {}, + contexts: (_h = (_g = results.state[id3]) == null ? void 0 : _g.contexts) != null ? _h : {} + }; + environment.api = api; + for (const key2 of runKeys) { + try { + let result; + if (key2 in (((_j = (_i = results.newState) == null ? void 0 : _i[node.id]) == null ? void 0 : _j["props"]) || {})) { + result = results.newState[node.id]["props"][key2]; + } else { + const isMultiLine = codeBlockStore[key2].includes("\n"); + const func = isMultiLine ? new Function(`with(this) { ${codeBlockStore[key2]} }`) : new Function(`with(this) { return ${codeBlockStore[key2]}; }`); + result = func.call(environment); + if (result instanceof Promise) { + result = await result; } - ); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.changeIcon); - menuItem.setIcon("lucide-sticker"); - menuItem.onClick((ev) => { - const vaultChangeModal = new stickerModal( - plugin.app, - plugin, - (emoji) => saveFileIcons(plugin, files, emoji) - ); - vaultChangeModal.open(); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.removeIcon); - menuItem.setIcon("lucide-file-minus"); - menuItem.onClick((ev) => { - removeFileIcons(plugin, files); - }); - }); + } + environment[id3]["props"][key2] = result; + results.state[id3]["props"][key2] = result; + if (results.newState) { + results.newState[id3] = (_k = results.newState[id3]) != null ? _k : { props: {}, styles: {}, actions: {}, contexts: {} }; + results.newState[id3]["props"][key2] = result; + } + } catch (error) { + console.log(error); + } } - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.deleteFiles); - menuItem.setIcon("trash"); - menuItem.onClick((ev) => { - deleteFiles(plugin, files); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("go-to-file"); - menuItem.setTitle(i18n_default.menu.openFilePane); - menuItem.onClick((ev) => { - files.forEach( - (file) => openAFile(getAbstractFileAtPath(app, file), plugin, true) - ); - }); - }); - if (!internalPluginLoaded("file-explorer", plugin.app)) { - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.moveFile); - menuItem.setIcon("paper-plane"); - menuItem.onClick((ev) => { - const fileMoveSuggester = new MoveSuggestionModal(plugin.app, files); - fileMoveSuggester.open(); - }); - }); - } - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } - return false; + return results; }; -var triggerFileMenu = (plugin, file, isFolder, e4, space) => { - const cache = plugin.index.filesIndex.get(file.path); - const fileMenu = new import_obsidian25.Menu(); - if (isFolder) { - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("edit"); - menuItem.setTitle(i18n_default.buttons.createNote); - menuItem.onClick((ev) => { - newFileInFolder(plugin, file); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("layout-dashboard"); - menuItem.setTitle(i18n_default.buttons.createCanvas); - menuItem.onClick((ev) => { - createNewCanvasFile(plugin, file, ""); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("folder-plus"); - menuItem.setTitle(i18n_default.buttons.createFolder); - menuItem.onClick((ev) => { - const vaultChangeModal = new VaultChangeModal( - plugin, - file, - "create folder", - "/" - ); - vaultChangeModal.open(); - }); - }); +function executeCodeBlocks(node, type, results) { + var _a2; + const codeBlockStore = (_a2 = node[type]) != null ? _a2 : {}; + for (const key2 of Object.keys(codeBlockStore)) { + try { + const isMultiLine = typeof codeBlockStore[key2] === "string" || codeBlockStore[key2] instanceof String ? codeBlockStore[key2].includes("\n") : false; + const func = isMultiLine && !(type == "actions") ? new Function(`with(this) { ${codeBlockStore[key2]} }`) : new Function(`with(this) { return ${codeBlockStore[key2]}; }`); + const result = func.call(results.state); + parseKeyResult(results.state[node.id][type], key2, result); + } catch (error) { + console.log(error); + } } - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("plus-square"); - menuItem.setTitle("Add to Space"); - menuItem.onClick((ev) => { - const vaultChangeModal = new AddToSpaceModal(plugin, [file.path]); - vaultChangeModal.open(); - }); - }); - if (space) { - const spaceCache = plugin.index.spacesIndex.get(space); - if (spaceCache) { - fileMenu.addItem((menuItem) => { - menuItem.setIcon("minus-square"); - menuItem.setTitle("Remove from Space"); - menuItem.onClick((ev) => { - removePathsFromSpace(plugin, spaceCache, [file.path]); - }); - }); + return results; +} +var parseKeyResult = (resultStore, key2, result) => { + if (key2 == "layout") { + if (result == "row" || result == "column") { + resultStore["display"] = "flex"; + resultStore["flexDirection"] = result; + return; } + resultStore["display"] = result; + return; } - if (isFolder && cache) { - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.customSort); - menuItem.setIcon("arrow-up-down"); - menuItem.setChecked(cache.sortBy == ""); - menuItem.onClick((ev) => { - saveFolderSort(plugin, file.path, ""); - }); + resultStore[key2] = result; +}; + +// src/context/FrameEditorContext.tsx +var FramesEditorContext = F({ + root: null, + runRoot: () => null, + instance: { state: {}, id: null, root: null }, + saveState: () => null, + fastSaveState: () => null, + nodes: [], + properties: [], + dragNode: null, + setDragNode: () => null, + hoverNode: null, + selectableNodeBounds: null, + setHoverNode: () => null, + selectedNodes: [], + selectNodes: () => null, + saveProperty: () => false, + newProperty: () => false, + delProperty: () => null, + groupNodes: () => null, + ungroupNode: () => null, + renameNode: () => null, + addNode: () => null, + deleteNode: () => null, + saveNodes: () => null, + moveUp: () => null, + moveDown: () => null, + moveToRank: () => null, + moveNodeFromSchema: () => null +}); +var FramesEditorProvider = (props2) => { + var _a2; + const { spaceInfo } = q2(SpaceContext); + const { + frameSchema, + setFrameSchema: setDBSchema, + saveFrame, + frameSchemas: schemas, + tableData, + getMDBData + } = q2(FramesMDBContext); + const [hoverNode, setHoverNode] = h2(null); + const [dragNode, setDragNode] = h2(null); + const [selectedNodes, setSelectedNodes] = h2([]); + const nodes = F2(() => { + var _a3; + if (!frameSchema) + return []; + const frames2 = (_a3 = tableData == null ? void 0 : tableData.rows.map( + (f4) => f4.id == frameSchema.id ? { + ...frameToNode(f4), + types: tableData.cols.reduce( + (p3, c4) => ({ ...p3, [c4.name]: c4.type }), + {} + ) + } : frameToNode(f4) + )) != null ? _a3 : []; + const _root = schemaToRoot(frameSchema); + if (frames2.some((f4) => f4.id == _root.id)) { + return frames2; + } + return [...frames2, _root]; + }, [tableData, frameSchema]); + const [root2, setRoot] = h2(null); + const [instance, setInstance] = h2({ + state: {}, + id: null, + root: null + }); + const activeRunID = _2(null); + const saveState = (newState, instance2) => { + const { root: _root, id: runID, state } = instance2; + if (activeRunID.current != runID) + return; + executeTreeNode( + applyPropsToRoot(_root, props2.props), + state, + props2.plugin.index.api, + saveState, + _root, + runID, + newState + ).then( + (s6) => setInstance((p3) => { + return s6; + }) + ); + }; + const selectableNodeBounds = _2({}); + const fastSaveState = (newState) => { + setInstance((p3) => { + return { ...p3, state: newState }; }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.sortBy); - menuItem.setIcon("sort-desc"); - menuItem.onClick((ev) => { - const sortMenu = new import_obsidian25.Menu(); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaAsc); - menuItem2.setChecked(cache.sortBy == "name_asc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "name_asc"); - }); - }); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaDesc); - menuItem2.setChecked(cache.sortBy == "name_desc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "name_desc"); - }); - }); - sortMenu.addSeparator(); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.createdTimeSortAsc); - menuItem2.setChecked(cache.sortBy == "ctime_asc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "ctime_asc"); - }); - }); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.createdTimeSortDesc); - menuItem2.setChecked(cache.sortBy == "ctime_desc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "ctime_desc"); - }); - }); - sortMenu.addSeparator(); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.modifiedTimeSortAsc); - menuItem2.setChecked(cache.sortBy == "mtime_asc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "mtime_asc"); - }); - }); - sortMenu.addItem((menuItem2) => { - menuItem2.setTitle(i18n_default.menu.modifiedTimeSortDesc); - menuItem2.setChecked(cache.sortBy == "mtime_desc"); - menuItem2.onClick((ev2) => { - saveFolderSort(plugin, file.path, "mtime_desc"); + }; + p2( + () => () => { + activeRunID.current = null; + }, + [] + ); + const runRoot = () => { + var _a3; + if ((frameSchema == null ? void 0 : frameSchema.type) == "frame" || (frameSchema == null ? void 0 : frameSchema.type) == "listitem") { + const _newRoot = buildRoot( + frameSchema, + (_a3 = tableData == null ? void 0 : tableData.cols) != null ? _a3 : [], + nodes, + props2.plugin + ); + setRoot(_newRoot); + if (_newRoot) { + const newRoot = import_lodash9.default.cloneDeep(_newRoot); + const runID = (0, import_lodash9.uniqueId)(); + activeRunID.current = runID; + executeTreeNode( + applyPropsToRoot(newRoot, props2.props), + {}, + props2.plugin.index.api, + saveState, + newRoot, + runID + ).then((s6) => { + setInstance((p3) => { + return s6; }); + activeRunID.current = s6.id; }); - const offset2 = e4.target.getBoundingClientRect(); - if (isMouseEvent(e4)) { - sortMenu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); + if (selectedNodes.length == 0) { } else { - sortMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } - }); - }); - } - if (plugin.settings.spacesStickers) { - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setIcon("palette"); - disclosureMenuItem( - plugin, - menuItem, - false, - false, - i18n_default.menu.changeColor, - "", - [ - { name: "None", value: "" }, - ...colors.map((f4) => ({ name: f4[0], value: f4[1] })) - ], - (_12, values) => { - saveFileColor(plugin, file.path, values[0]); + setSelectedNodes( + nodes.filter((f4) => selectedNodes.find((g4) => g4.id == f4.id)) + ); } - ); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.changeIcon); - menuItem.setIcon("lucide-sticker"); - menuItem.onClick((ev) => { - const vaultChangeModal = new stickerModal( - plugin.app, - plugin, - (emoji) => saveFileIcon(plugin, file, emoji) - ); - vaultChangeModal.open(); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.buttons.removeIcon); - menuItem.setIcon("lucide-file-minus"); - menuItem.onClick((ev) => { - removeFileIcon(plugin, file); - }); - }); - } - fileMenu.addSeparator(); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.rename); - menuItem.setIcon("pencil"); - menuItem.onClick((ev) => { - const vaultChangeModal = new VaultChangeModal(plugin, file, "rename"); - vaultChangeModal.open(); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.delete); - menuItem.setIcon("trash"); - menuItem.onClick((ev) => { - const deleteOption = plugin.settings.deleteFileOption; - if (deleteOption === "permanent") { - plugin.app.vault.delete(file, true); - } else if (deleteOption === "system-trash") { - plugin.app.vault.trash(file, true); - } else if (deleteOption === "trash") { - plugin.app.vault.trash(file, false); } - }); - }); - if (!isFolder) { - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.changeToFolderNote); - menuItem.setIcon("file-plus-2"); - menuItem.onClick((ev) => { - if (file instanceof import_obsidian25.TFile) - noteToFolderNote(plugin, file, true); - }); - }); - } - fileMenu.addItem((menuItem) => { - menuItem.setIcon("go-to-file"); - menuItem.setTitle(i18n_default.menu.openFilePane); - menuItem.onClick((ev) => { - openFileInNewPane(plugin, { ...file, isFolder }); - }); - }); - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.duplicate); - menuItem.setIcon("documents"); - menuItem.onClick((ev) => { - if (file.basename && file.extension) - plugin.app.vault.copy( - file, - `${file.parent.path}/${file.basename} 1.${file.extension}` - ); - }); - }); - if (!internalPluginLoaded("file-explorer", plugin.app)) { - fileMenu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.moveFile); - menuItem.setIcon("paper-plane"); - menuItem.onClick((ev) => { - const fileMoveSuggester = new MoveSuggestionModal(plugin.app, [ - file.path - ]); - fileMoveSuggester.open(); - }); - }); - } - plugin.app.workspace.trigger("file-menu", fileMenu, file, "file-explorer"); - if (isMouseEvent(e4)) { - fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - fileMenu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } - return false; -}; - -// src/components/Space/Contexts/DataTypeView/FileCell.tsx -var import_obsidian26 = require("obsidian"); -init_compat_module(); -var FileCell = (props2) => { - const fileOrCleanPath = (f4) => { - if (!f4) - return { - path: "" - }; - const fileCache = props2.plugin.index.filesIndex.get(f4); - return fileCache ? { path: f4, fileCache } : { path: f4 }; - }; - const value = F2( - () => { - var _a2; - return (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).map((f4) => fileOrCleanPath(f4)); - }, - [props2.initialValue] - ); - const ref2 = _2(null); - const onKeyDown = (e4) => { - e4.stopPropagation(); - e4.key == "Enter" && e4.target.blur(); + } }; - const fileExists = (name) => { - if (!name) - return false; - return getAbstractFileAtPath(app, name) ? true : false; + const refreshFrame = (e4) => { + if (e4.detail.type == "frames" && e4.detail.name == spaceInfo.path) { + runRoot(); + } }; - const onBlur = () => { - var _a2; - if (!ref2.current) + p2(() => { + window.addEventListener(eventTypes.spacesChange, refreshFrame); + return () => { + window.removeEventListener(eventTypes.spacesChange, refreshFrame); + }; + }, [spaceInfo]); + p2(() => { + runRoot(); + }, [frameSchema, nodes, tableData, props2.props]); + const moveUp = (node) => { + const items = nodes.filter((f4) => f4.parentId == node.parentId).sort((a6, b4) => a6.rank - b4.rank).map((f4, i5) => ({ ...f4, rank: i5 })); + const itemIndex = items.findIndex((item2) => item2.id === node.id); + if (itemIndex <= 0) { + saveNodes(items); return; - if (fileExists((_a2 = ref2.current) == null ? void 0 : _a2.value)) { - new import_obsidian26.Notice(i18n_default.notice.fileExists); - } else { - props2.saveValue(ref2.current.value); - props2.setEditMode(null); } + const item = items[itemIndex]; + const swappedItem = items[itemIndex - 1]; + [item.rank, swappedItem.rank] = [swappedItem.rank, item.rank]; + saveNodes(items); }; - const newFile = async (file) => { - const filePath = file.path.replace(/\//g, "").replace(/\./g, ""); - const path = `${props2.folder}/${filePath}.md`; - if (filePath.length == 0) { + const moveDown = (node) => { + const items = nodes.filter((f4) => f4.parentId == node.parentId).sort((a6, b4) => a6.rank - b4.rank).map((f4, i5) => ({ ...f4, rank: i5 })); + const itemIndex = items.findIndex((item2) => item2.id === node.id); + if (itemIndex < 0 || itemIndex >= items.length - 1) { + saveNodes(items); return; } - if (fileExists(path)) { - new import_obsidian26.Notice(i18n_default.notice.fileExists); - } else { - await createNewMarkdownFile( - props2.plugin, - getAbstractFileAtPath(app, props2.folder), - filePath - ); + const item = items[itemIndex]; + const swappedItem = items[itemIndex + 1]; + [item.rank, swappedItem.rank] = [swappedItem.rank, item.rank]; + saveNodes(items.sort((a6, b4) => a6.rank - b4.rank)); + }; + const ungroupNode = (node) => { + const children = nodes.filter((f4) => f4.parentId == node.id); + const newRank = node.rank; + const items = nodes.filter((f4) => f4.parentId == node.parentId).sort((a6, b4) => a6.rank - b4.rank); + const newItems = insertMulti( + items, + newRank, + children.map((f4) => ({ ...f4, parentId: node.parentId })) + ).filter((f4) => f4.id != node.id).map((f4, i5) => ({ ...f4, rank: i5 })); + return saveNodes(newItems, [node]); + }; + const moveToRank = (node, newRank) => { + const items = nodes.filter((f4) => f4.parentId == node.parentId).sort((a6, b4) => a6.rank - b4.rank).map((f4, i5) => ({ ...f4, rank: i5 })); + const itemIndex = items.findIndex((item2) => item2.id === node.id); + if (itemIndex < 0 || newRank < 0 || newRank >= items.length) { + saveNodes(items); + return; } + const item = items[itemIndex]; + item.rank = newRank; + const newItems = arrayMove(items, itemIndex, newRank).map((f4, i5) => ({ + ...f4, + rank: i5 + })); + saveNodes(newItems); }; - const deleteRow = () => { - props2.deleteRow(); + const groupNodes = (treeNodes, style) => { + const parentId = treeNodes[0].id == frameSchema.id ? "" : treeNodes[0].parentId; + const group = { + ...newUniqueNode(groupNode, parentId, nodes, frameSchema.id) + }; + const newNodes = treeNodes.map((f4) => { + const node = import_lodash9.default.cloneDeep(f4); + node.parentId = group.id; + return node; + }); + saveNodes([ + { ...group, styles: { ...group.styles, ...style } }, + ...newNodes + ]); }; - p2(() => { - var _a2; - if (props2.editMode == 2) { - (_a2 = ref2 == null ? void 0 : ref2.current) == null ? void 0 : _a2.focus(); + const addNode = (treeNode, target) => { + const id3 = uniqueNameFromString( + treeNode.id, + nodes.map((f4) => f4.id) + ); + let parent = target ? target : selectedNodes.length > 0 ? selectedNodes[0] : root2.node; + let rank = target ? target.rank + 1 : parent.rank; + if (!groupableTypes.some((f4) => parent.type == f4)) { + parent = findParent(root2, parent.id).node; + } else { + rank = nodes.filter((f4) => f4.parentId == parent.id).length; } - }, [props2.editMode]); - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file" - }, value.map((v3, i4) => { - var _a2; - if (props2.editMode == 0) { - if (v3.fileCache) { - return /* @__PURE__ */ Cn.createElement("div", { - key: i4, - className: "mk-cell-file-title" - }, v3 && v3.fileCache ? v3.fileCache.name : "", ((_a2 = v3.fileCache.extension) == null ? void 0 : _a2.length) > 0 && v3.fileCache.extension != "md" && /* @__PURE__ */ Cn.createElement("span", { - className: "nav-file-tag" - }, v3.fileCache.extension), /* @__PURE__ */ Cn.createElement("button", { - "aria-label": i18n_default.buttons.toggleFlow, - className: "mk-cell-file-flow mk-inline-button", - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-flow-hover"] - }, - onClick: (e4) => { - if (props2.openFlow) { - props2.openFlow(e4); - e4.stopPropagation(); - } - } - })); - } else { - return /* @__PURE__ */ Cn.createElement("div", { - key: i4, - className: "mk-cell-file-title" - }, v3.path); + const newTreeNode = { + ...treeNode, + id: id3, + schemaId: frameSchema.id, + parentId: parent.id + }; + saveNodes([{ ...newTreeNode, rank }]).then( + (f4) => selectNodes([newTreeNode]) + ); + }; + const saveNodes = async (treeNodes, deleteNodes) => { + var _a3, _b2, _c2; + if (!tableData) { + return; + } + const newRows = ((_a3 = tableData == null ? void 0 : tableData.rows) == null ? void 0 : _a3.some((f4) => f4.id == root2.id)) ? tableData.rows : [...(_b2 = tableData == null ? void 0 : tableData.rows) != null ? _b2 : [], nodeToFrame(root2.node)]; + const insertRows = treeNodes.filter((f4) => !newRows.some((g4) => g4.id == f4.id)).map((f4) => nodeToFrame(f4)); + const modRows = treeNodes.filter((f4) => newRows.some((g4) => g4.id == f4.id)).map((f4) => nodeToFrame(f4)); + const newTable = { + ...tableData, + cols: (_c2 = tableData.cols) != null ? _c2 : [], + rows: [ + ...newRows.map((f4) => { + var _a4; + return (_a4 = modRows.find((g4) => g4.id == f4.id)) != null ? _a4 : f4; + }), + ...insertRows + ].filter( + (f4) => deleteNodes ? !deleteNodes.some((g4) => g4.id == f4.id) : f4 + ) + }; + await saveFrame(newTable); + }; + const moveNodeFromSchema = async (nodeId, schemaId, newParentId, styles2) => { + const oldTable = await getMDBData(); + if (!oldTable[schemaId]) + return; + const tableNodes = oldTable[schemaId].rows.map( + (g4) => frameToNode(g4) + ); + const oldSchema = schemas.find((f4) => f4.id == schemaId); + const treeNode = tableNodes.find((f4) => f4.id == nodeId); + if (!oldSchema || !treeNode) + return; + const tree = buildFrameTree( + treeNode, + tableNodes, + props2.plugin, + 0, + false + )[0]; + const deleteNodes = flattenToFrameNodes(tree); + const newTreeNodes = deleteNodes.map((f4) => ({ + ...f4, + schemaId: frameSchema.id, + styles: f4.id == nodeId && styles2 ? { + ...f4.styles, + ...styles2 + } : f4.styles, + parentId: f4.id == nodeId ? newParentId : f4.parentId + })); + await saveFrame({ + ...oldTable[frameSchema.id], + rows: oldTable[frameSchema.id].rows.filter( + (f4) => !deleteNodes.some((g4) => f4.schemaId == g4.schemaId && f4.id == g4.id) + ) + }); + await saveFrame({ + ...tableData, + rows: [ + ...tableData.rows, + ...newTreeNodes.map((f4) => nodeToFrame(f4)) + ] + }); + }; + const deleteNode = (treeNode) => { + const tree = buildFrameTree(treeNode, nodes, props2.plugin, 0, false)[0]; + const parent = findParent(root2, treeNode.id); + const deleteNodes = flattenToFrameNodes(tree); + if (parent) { + if (parent.children.length == 1 && parent.node.type == "column") + deleteNodes.push(parent.node); + const grandParent = findParent(root2, parent.id); + if ((grandParent == null ? void 0 : grandParent.children.length) == 1 && grandParent.node.type == "container") { + deleteNodes.push(grandParent.node); } } - if (v3.fileCache) { - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file-item", - onContextMenu: (e4) => triggerFileMenu( - props2.plugin, - getAbstractFileAtPath(app, v3.fileCache.path), - v3.fileCache.isFolder, - e4, - null - ) - }, /* @__PURE__ */ Cn.createElement(FileSticker, { - plugin: props2.plugin, - fileCache: v3.fileCache - }), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file-name", - onClick: (e4) => openAFile( - getAbstractFileAtPath(app, v3.fileCache.path), - props2.plugin, - e4.ctrlKey || e4.metaKey - ) - }, v3 && v3.fileCache ? filePathToString(v3.fileCache.name) : ""))); + saveFrame({ + ...tableData, + rows: tableData.rows.filter( + (f4) => !deleteNodes.some((g4) => f4.schemaId == g4.schemaId && f4.id == g4.id) + ) + }); + }; + const properties2 = (_a2 = tableData == null ? void 0 : tableData.cols) != null ? _a2 : []; + const selectNodes = (frames2) => { + setSelectedNodes(frames2); + }; + const delProperty = (column) => { + const mdbtable = tableData; + const newFields = mdbtable.cols.filter( + (f4, i5) => f4.name != column.name + ); + const newTable = { + ...mdbtable, + cols: newFields != null ? newFields : [] + }; + saveFrame(newTable); + }; + const newProperty = (col) => { + return saveProperty(col); + }; + const renameNode = (node, newName) => { + }; + const saveProperty = (newColumn, oldColumn) => { + const column = { + ...newColumn, + name: sanitizeColumnName(newColumn.name) + }; + const mdbtable = tableData; + if (column.name == "") { + new import_obsidian25.Notice(i18n_default.notice.noPropertyName); + return false; } - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file-item" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-icon" - }, /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => newFile(v3), - dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-new-file"] - } - })), props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { - className: "mk-cell-file-name", - type: "text", - placeholder: "Untitled", - ref: ref2, - value: v3.path, - onKeyDown, - onBlur - }) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-file-name" - }, v3.path))); - })); + if (!oldColumn && mdbtable.cols.find( + (f4) => f4.name.toLowerCase() == column.name.toLowerCase() + ) || oldColumn && oldColumn.name != column.name && mdbtable.cols.find( + (f4) => f4.name.toLowerCase() == column.name.toLowerCase() + )) { + new import_obsidian25.Notice(i18n_default.notice.duplicatePropertyName); + return false; + } + const oldFieldIndex = oldColumn ? mdbtable.cols.findIndex((f4) => f4.name == oldColumn.name) : -1; + const newFields = oldFieldIndex == -1 ? [...mdbtable.cols, column] : mdbtable.cols.map((f4, i5) => i5 == oldFieldIndex ? column : f4); + const newTable = { + ...mdbtable, + cols: newFields != null ? newFields : [] + }; + saveFrame(newTable); + return true; + }; + return /* @__PURE__ */ Cn.createElement(FramesEditorContext.Provider, { + value: { + root: root2, + runRoot, + instance, + dragNode, + fastSaveState, + setDragNode, + hoverNode, + setHoverNode, + saveState, + nodes, + properties: properties2, + addNode, + deleteNode, + selectedNodes, + selectNodes, + saveProperty, + newProperty, + selectableNodeBounds, + renameNode, + delProperty, + saveNodes, + ungroupNode, + moveUp, + moveDown, + moveToRank, + moveNodeFromSchema, + groupNodes + } + }, props2.children); }; -// src/components/Space/Contexts/DataTypeView/FilePropertyCell.tsx +// src/components/Space/Frames/FrameEditorView.tsx +var import_obsidian35 = require("obsidian"); init_compat_module(); -var humanFileSize = (bytes, si = false, dp = 1) => { - const thresh = si ? 1e3 : 1024; - if (Math.abs(bytes) < thresh) { - return bytes + " B"; - } - const units = si ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]; - let u4 = -1; - const r3 = 10 ** dp; - do { - bytes /= thresh; - ++u4; - } while (Math.round(Math.abs(bytes) * r3) / r3 >= thresh && u4 < units.length - 1); - return bytes.toFixed(dp) + " " + units[u4]; -}; -var LookUpCell = (props2) => { - const [cache, setCache] = h2(null); - const initialValue = props2.initialValue; - const { field, property: property2 } = parsePropString(props2.propertyValue); - if (property2 == "folder") { - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop", - onClick: () => { - openTFolder( - getAbstractFileAtPath(app, initialValue), - props2.plugin, - false - ); - } - }, folderPathToString(initialValue)); - } - if (property2 == "extension") { - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop" - }, initialValue); - } else if (property2 == "ctime" || property2 == "mtime") { - const date = new Date(parseInt(initialValue)).getTime() ? new Date(parseInt(initialValue)) : null; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop" - }, date && formatDistance3(new Date(date), new Date(), { addSuffix: true })); - } else if (property2 == "size" || property2 == "File.size") { - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop" - }, humanFileSize(parseInt(initialValue))); - } - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-fileprop" - }, initialValue); -}; -// src/components/Space/Contexts/DataTypeView/NumberCell.tsx +// src/components/Space/Frames/FrameEditor.tsx init_compat_module(); -var NumberCell = (props2) => { - const { initialValue, saveValue } = props2; - const [value, setValue] = Cn.useState(initialValue); - const ref2 = _2(null); - const onBlur = () => { - if (initialValue != value) - saveValue(value); + +// src/components/Space/Frames/EditorNodes/FrameNodeView.tsx +var import_classnames4 = __toESM(require_classnames()); + +// node_modules/re-resizable/lib/index.js +init_compat_module(); +init_compat_module(); + +// node_modules/re-resizable/lib/resizer.js +init_compat_module(); +var __extends = function() { + var extendStatics = function(d6, b4) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d7, b5) { + d7.__proto__ = b5; + } || function(d7, b5) { + for (var p3 in b5) + if (Object.prototype.hasOwnProperty.call(b5, p3)) + d7[p3] = b5[p3]; + }; + return extendStatics(d6, b4); }; - const onKeyDown = (e4) => { - e4.stopPropagation(); - if (e4.key == "Enter") { - e4.target.blur(); - props2.setEditMode(null); - } - if (e4.key == "Escape") { - setValue(initialValue); - e4.target.blur(); - props2.setEditMode(null); + return function(d6, b4) { + extendStatics(d6, b4); + function __() { + this.constructor = d6; } + d6.prototype = b4 === null ? Object.create(b4) : (__.prototype = b4.prototype, new __()); }; - Cn.useEffect(() => { - setValue(initialValue); - }, [initialValue]); - p2(() => { - var _a2; - if (props2.editMode == 2) { - (_a2 = ref2 == null ? void 0 : ref2.current) == null ? void 0 : _a2.focus(); +}(); +var __assign2 = function() { + __assign2 = Object.assign || function(t5) { + for (var s6, i5 = 1, n2 = arguments.length; i5 < n2; i5++) { + s6 = arguments[i5]; + for (var p3 in s6) + if (Object.prototype.hasOwnProperty.call(s6, p3)) + t5[p3] = s6[p3]; } - }, [props2.editMode]); - return props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { - className: "mk-cell-text", - type: "number", - ref: ref2, - value, - onChange: (e4) => setValue(e4.target.value), - onKeyDown, - onBlur - }) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-number" - }, value); + return t5; + }; + return __assign2.apply(this, arguments); +}; +var rowSizeBase = { + width: "100%", + height: "10px", + top: "0px", + left: "0px", + cursor: "row-resize" +}; +var colSizeBase = { + width: "10px", + height: "100%", + top: "0px", + left: "0px", + cursor: "col-resize" +}; +var edgeBase = { + width: "20px", + height: "20px", + position: "absolute" +}; +var styles = { + top: __assign2(__assign2({}, rowSizeBase), { top: "-5px" }), + right: __assign2(__assign2({}, colSizeBase), { left: void 0, right: "-5px" }), + bottom: __assign2(__assign2({}, rowSizeBase), { top: void 0, bottom: "-5px" }), + left: __assign2(__assign2({}, colSizeBase), { left: "-5px" }), + topRight: __assign2(__assign2({}, edgeBase), { right: "-10px", top: "-10px", cursor: "ne-resize" }), + bottomRight: __assign2(__assign2({}, edgeBase), { right: "-10px", bottom: "-10px", cursor: "se-resize" }), + bottomLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }), + topLeft: __assign2(__assign2({}, edgeBase), { left: "-10px", top: "-10px", cursor: "nw-resize" }) }; +var Resizer = function(_super) { + __extends(Resizer2, _super); + function Resizer2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.onMouseDown = function(e4) { + _this.props.onResizeStart(e4, _this.props.direction); + }; + _this.onTouchStart = function(e4) { + _this.props.onResizeStart(e4, _this.props.direction); + }; + return _this; + } + Resizer2.prototype.render = function() { + return y("div", { className: this.props.className || "", style: __assign2(__assign2({ position: "absolute", userSelect: "none" }, styles[this.props.direction]), this.props.replaceStyles || {}), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children); + }; + return Resizer2; +}(w3); -// src/components/Space/Contexts/DataTypeView/TextCell.tsx -init_compat_module(); -var TextCell = (props2) => { - const { initialValue, saveValue } = props2; - const [value, setValue] = Cn.useState(initialValue); - const ref2 = _2(null); - const onBlur = () => { - if (initialValue != value) - saveValue(value); +// node_modules/re-resizable/lib/index.js +var __extends2 = function() { + var extendStatics = function(d6, b4) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d7, b5) { + d7.__proto__ = b5; + } || function(d7, b5) { + for (var p3 in b5) + if (Object.prototype.hasOwnProperty.call(b5, p3)) + d7[p3] = b5[p3]; + }; + return extendStatics(d6, b4); }; - const onKeyDown = (e4) => { - e4.stopPropagation(); - if (e4.key == "Enter") { - e4.target.blur(); - props2.setEditMode(null); - } - if (e4.key == "Escape") { - setValue(initialValue); - e4.target.blur(); - props2.setEditMode(null); + return function(d6, b4) { + extendStatics(d6, b4); + function __() { + this.constructor = d6; } + d6.prototype = b4 === null ? Object.create(b4) : (__.prototype = b4.prototype, new __()); }; - Cn.useEffect(() => { - setValue(initialValue); - }, [initialValue]); - p2(() => { - var _a2; - if (props2.editMode == 2) { - (_a2 = ref2 == null ? void 0 : ref2.current) == null ? void 0 : _a2.focus(); +}(); +var __assign3 = function() { + __assign3 = Object.assign || function(t5) { + for (var s6, i5 = 1, n2 = arguments.length; i5 < n2; i5++) { + s6 = arguments[i5]; + for (var p3 in s6) + if (Object.prototype.hasOwnProperty.call(s6, p3)) + t5[p3] = s6[p3]; } - }, [props2.editMode]); - return props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { - onClick: (e4) => e4.stopPropagation(), - className: "mk-cell-text", - ref: ref2, - type: "text", - value, - onChange: (e4) => setValue(e4.target.value), - onKeyDown, - onBlur - }) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-text" - }, value); + return t5; + }; + return __assign3.apply(this, arguments); }; - -// src/components/Space/Contexts/TableView/TableView.tsx -var import_lodash11 = __toESM(require_lodash()); -var import_obsidian39 = require("obsidian"); - -// src/utils/ui/selection.ts -var selectNextIndex = (currIndex, array) => { - if (!currIndex && array.length > 0) - return array[0]; - const pos = array.indexOf(currIndex); - if (pos < array.length - 1) - return array[pos + 1]; - return currIndex; +var DEFAULT_SIZE = { + width: "auto", + height: "auto" }; -var selectPrevIndex = (currIndex, array) => { - const pos = array.indexOf(currIndex); - if (pos > 0) - return array[pos - 1]; - return array[0]; +var clamp = function(n2, min3, max3) { + return Math.max(Math.min(n2, max3), min3); }; -var selectRange = (currSel, newSel, array) => { - const lastIndex = array.findIndex((f4) => f4 == currSel); - const newIndex = array.findIndex((f4) => f4 == newSel); - if (lastIndex < newIndex) { - return array.filter((f4, i4) => i4 > lastIndex && i4 <= newIndex); +var snap = function(n2, size) { + return Math.round(n2 / size) * size; +}; +var hasDirection = function(dir, target) { + return new RegExp(dir, "i").test(target); +}; +var isTouchEvent2 = function(event) { + return Boolean(event.touches && event.touches.length); +}; +var isMouseEvent2 = function(event) { + return Boolean((event.clientX || event.clientX === 0) && (event.clientY || event.clientY === 0)); +}; +var findClosestSnap = function(n2, snapArray, snapGap) { + if (snapGap === void 0) { + snapGap = 0; } - return array.filter((f4, i4) => i4 < lastIndex && i4 >= newIndex); + var closestGapIndex = snapArray.reduce(function(prev, curr, index) { + return Math.abs(curr - n2) < Math.abs(snapArray[prev] - n2) ? index : prev; + }, 0); + var gap = Math.abs(snapArray[closestGapIndex] - n2); + return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n2; }; - -// src/components/Space/Contexts/DataTypeView/ImageCell.tsx -init_compat_module(); -var ImageCell = (props2) => { - const { initialValue, saveValue } = props2; - const [value, setValue] = Cn.useState(initialValue); - const menuRef = _2(null); - p2(() => { - if (props2.editMode == 2 /* EditModeActive */) { - if (!menuRef.current) - showModal(); - } - }, []); - const file = F2(() => { - const f4 = getAbstractFileAtPath(app, value); - return f4 ? app.vault.getResourcePath(f4) : value; - }, [value]); - Cn.useEffect(() => { - setValue(initialValue); - }, [initialValue]); - const showModal = () => { - const vaultChangeModal = new imageModal( - props2.plugin, - props2.plugin.app, - (image) => saveValue(image) - ); - vaultChangeModal.open(); - props2.setEditMode(null); - }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-image" - }, /* @__PURE__ */ Cn.createElement("img", { - src: file - }), props2.editMode > 0 ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-image-selector" - }, /* @__PURE__ */ Cn.createElement("div", { - onClick: showModal, - className: "mk-hover-button mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-edit"] } - }), (value == null ? void 0 : value.length) > 0 && /* @__PURE__ */ Cn.createElement("div", { - onClick: () => saveValue(""), - className: "mk-hover-button mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); +var getStringSize = function(n2) { + n2 = n2.toString(); + if (n2 === "auto") { + return n2; + } + if (n2.endsWith("px")) { + return n2; + } + if (n2.endsWith("%")) { + return n2; + } + if (n2.endsWith("vh")) { + return n2; + } + if (n2.endsWith("vw")) { + return n2; + } + if (n2.endsWith("vmax")) { + return n2; + } + if (n2.endsWith("vmin")) { + return n2; + } + return n2 + "px"; }; - -// src/components/Space/Contexts/DataTypeView/LinkCell.tsx -init_compat_module(); - -// src/utils/flow/flowEditor.ts -var import_state5 = require("@codemirror/state"); - -// src/cm-extensions/flowEditor/atomic.ts -var import_state4 = require("@codemirror/state"); - -// src/cm-extensions/flowEditor/selectiveEditor.ts -var import_state3 = require("@codemirror/state"); -var import_view3 = require("@codemirror/view"); - -// node_modules/tslib/modules/index.js -var import_tslib = __toESM(require_tslib(), 1); -var { - __extends, - __assign: __assign2, - __rest: __rest2, - __decorate, - __param, - __esDecorate, - __runInitializers, - __propKey, - __setFunctionName, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray: __spreadArray2, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, - __classPrivateFieldIn -} = import_tslib.default; - -// src/cm-extensions/flowEditor/selectiveEditor.ts -var combinedRangeFacets = (rangeA, rangeB) => { - const startRange = !(rangeA == null ? void 0 : rangeA[0]) ? rangeB[0] : !(rangeB == null ? void 0 : rangeB[0]) ? rangeA[0] : Math.max(rangeA == null ? void 0 : rangeA[0], rangeB == null ? void 0 : rangeB[0]); - const endRange = !(rangeA == null ? void 0 : rangeA[1]) ? rangeB[1] : !(rangeB == null ? void 0 : rangeB[1]) ? rangeA[1] : Math.min(rangeA == null ? void 0 : rangeA[1], rangeB == null ? void 0 : rangeB[1]); - return [isNaN(startRange) ? null : startRange, isNaN(endRange) ? null : endRange]; -}; -var editableRange = import_state3.Annotation.define(); -var contentRange = import_state3.Annotation.define(); -var hiddenLine = import_view3.Decoration.replace({ inclusive: true, block: true }); -var hideLine = import_state3.StateField.define({ - create() { - return import_view3.Decoration.none; - }, - update(value, tr) { - const builder = new import_state3.RangeSetBuilder(); - const betterFacet = combinedRangeFacets(tr.state.field(selectiveLinesFacet, false), tr.state.field(frontmatterFacet, false)); - if ((betterFacet == null ? void 0 : betterFacet[0]) != null) { - const starterLine = Math.min( - tr.state.doc.lines, - betterFacet[0] - ); - builder.add( - tr.state.doc.line(1).from, - tr.state.doc.line(starterLine).from - 1, - hiddenLine - ); - if (tr.newDoc.lines != betterFacet[1]) - builder.add( - tr.state.doc.line( - Math.min(tr.newDoc.lines, betterFacet[1]) - ).to, - tr.state.doc.line(tr.newDoc.lines).to, - hiddenLine - ); +var getPixelSize = function(size, parentSize, innerWidth2, innerHeight2) { + if (size && typeof size === "string") { + if (size.endsWith("px")) { + return Number(size.replace("px", "")); } - const dec = builder.finish(); - return dec; - }, - provide: (f4) => import_view3.EditorView.decorations.from(f4) -}); -var frontmatterFacet = import_state3.StateField.define({ - create: () => [void 0, void 0], - update(value, tr) { - if (tr.annotation(contentRange)) { - if (tr.annotation(contentRange)[0]) { - return [ - tr.annotation(contentRange)[0], - Math.min(tr.state.doc.lines, tr.annotation(contentRange)[1]) - ]; - } - return tr.annotation(contentRange); + if (size.endsWith("%")) { + var ratio = Number(size.replace("%", "")) / 100; + return parentSize * ratio; } - return value; - } -}); -var selectiveLinesFacet = import_state3.StateField.define({ - create: () => [void 0, void 0], - update(value, tr) { - if (tr.annotation(editableRange)) { - if (tr.annotation(editableRange)[0]) { - return [ - tr.annotation(editableRange)[0], - Math.min(tr.state.doc.lines, tr.annotation(editableRange)[1]) - ]; - } - return tr.annotation(editableRange); + if (size.endsWith("vw")) { + var ratio = Number(size.replace("vw", "")) / 100; + return innerWidth2 * ratio; + } + if (size.endsWith("vh")) { + var ratio = Number(size.replace("vh", "")) / 100; + return innerHeight2 * ratio; } - return value; } -}); -var lineRangeToPosRange = (state, range) => { + return size; +}; +var calculateNewMax = function(parentSize, innerWidth2, innerHeight2, maxWidth, maxHeight, minWidth, minHeight) { + maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth2, innerHeight2); + maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth2, innerHeight2); + minWidth = getPixelSize(minWidth, parentSize.width, innerWidth2, innerHeight2); + minHeight = getPixelSize(minHeight, parentSize.height, innerWidth2, innerHeight2); return { - from: state.doc.line(range[0]).from, - to: state.doc.line(Math.min(state.doc.lines, range[1])).to + maxWidth: typeof maxWidth === "undefined" ? void 0 : Number(maxWidth), + maxHeight: typeof maxHeight === "undefined" ? void 0 : Number(maxHeight), + minWidth: typeof minWidth === "undefined" ? void 0 : Number(minWidth), + minHeight: typeof minHeight === "undefined" ? void 0 : Number(minHeight) }; }; -var smartDelete = import_state3.EditorState.transactionFilter.of( - (tr) => { - if (tr.isUserEvent("delete") && !tr.annotation(import_state3.Transaction.userEvent).endsWith(".smart")) { - const initialSelections = tr.startState.selection.ranges.map((range) => ({ - from: range.from, - to: range.to - })); - const betterFacet = combinedRangeFacets(tr.startState.field(selectiveLinesFacet, false), tr.startState.field(frontmatterFacet, false)); - if (initialSelections.length > 0 && (betterFacet == null ? void 0 : betterFacet[0])) { - const posRange = lineRangeToPosRange( - tr.startState, - betterFacet - ); - if (tr.changes.touchesRange(0, posRange.from - 1)) { - const minFrom = Math.max(posRange.from, initialSelections[0].from); - const minTo = Math.min(posRange.to, initialSelections[0].to); - return [{ - changes: { - from: Math.min(minFrom, minTo), - to: Math.max(minFrom, minTo) - }, - annotations: import_state3.Transaction.userEvent.of( - `${tr.annotation(import_state3.Transaction.userEvent)}.smart` - ) - }]; - } +var definedProps = [ + "as", + "style", + "className", + "grid", + "snap", + "bounds", + "boundsByDirection", + "size", + "defaultSize", + "minWidth", + "minHeight", + "maxWidth", + "maxHeight", + "lockAspectRatio", + "lockAspectRatioExtraWidth", + "lockAspectRatioExtraHeight", + "enable", + "handleStyles", + "handleClasses", + "handleWrapperStyle", + "handleWrapperClass", + "children", + "onResizeStart", + "onResize", + "onResizeStop", + "handleComponent", + "scale", + "resizeRatio", + "snapGap" +]; +var baseClassName = "__resizable_base__"; +var Resizable = function(_super) { + __extends2(Resizable2, _super); + function Resizable2(props2) { + var _this = _super.call(this, props2) || this; + _this.ratio = 1; + _this.resizable = null; + _this.parentLeft = 0; + _this.parentTop = 0; + _this.resizableLeft = 0; + _this.resizableRight = 0; + _this.resizableTop = 0; + _this.resizableBottom = 0; + _this.targetLeft = 0; + _this.targetTop = 0; + _this.appendBase = function() { + if (!_this.resizable || !_this.window) { + return null; } - } - return tr; - } -); -var preventModifyTargetRanges = import_state3.EditorState.transactionFilter.of( - (tr) => { - const newTrans = []; - try { - const editableLines = tr.startState.field(selectiveLinesFacet, false); - const contentLines = tr.startState.field(frontmatterFacet, false); - const selectiveLines = combinedRangeFacets(editableLines, contentLines); - if (tr.isUserEvent("input") || tr.isUserEvent("delete") || tr.isUserEvent("move")) { - if (selectiveLines == null ? void 0 : selectiveLines[0]) { - const posRange = lineRangeToPosRange( - tr.startState, - selectiveLines - ); - if (!tr.changes.touchesRange(posRange.from, posRange.to)) { - return []; - } - } + var parent = _this.parentNode; + if (!parent) { + return null; } - if (tr.state.doc.lines != tr.startState.doc.lines) { - const numberNewLines = tr.state.doc.lines - tr.startState.doc.lines; - if (selectiveLines == null ? void 0 : selectiveLines[0]) { - const posRange = lineRangeToPosRange( - tr.startState, - selectiveLines - ); - if (tr.changes.touchesRange(0, posRange.from - 1)) { - const newAnnotations = []; - if (editableLines[0]) { - newAnnotations.push(editableRange.of([ - editableLines[0] + numberNewLines, - editableLines[1] + numberNewLines - ])); - } - if (contentLines[0]) { - newAnnotations.push(contentRange.of([ - contentLines[0] + numberNewLines, - contentLines[1] + numberNewLines - ])); - } - newTrans.push({ - annotations: newAnnotations - }); - } else if (tr.changes.touchesRange(posRange.from - 1, posRange.to)) { - const newAnnotations = []; - if (editableLines[0]) { - newAnnotations.push(editableRange.of([ - editableLines[0], - editableLines[1] + numberNewLines - ])); - } - if (contentLines[0]) { - newAnnotations.push(contentRange.of([ - contentLines[0], - contentLines[1] + numberNewLines - ])); - } - newTrans.push({ - annotations: newAnnotations - }); - } - } + var element = _this.window.document.createElement("div"); + element.style.width = "100%"; + element.style.height = "100%"; + element.style.position = "absolute"; + element.style.transform = "scale(0, 0)"; + element.style.left = "0"; + element.style.flex = "0 0 100%"; + if (element.classList) { + element.classList.add(baseClassName); + } else { + element.className += baseClassName; } - } catch (e4) { - return []; - } - return [tr, ...newTrans]; + parent.appendChild(element); + return element; + }; + _this.removeBase = function(base2) { + var parent = _this.parentNode; + if (!parent) { + return; + } + parent.removeChild(base2); + }; + _this.ref = function(c4) { + if (c4) { + _this.resizable = c4; + } + }; + _this.state = { + isResizing: false, + width: typeof (_this.propsSize && _this.propsSize.width) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.width, + height: typeof (_this.propsSize && _this.propsSize.height) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.height, + direction: "right", + original: { + x: 0, + y: 0, + width: 0, + height: 0 + }, + backgroundStyle: { + height: "100%", + width: "100%", + backgroundColor: "rgba(0,0,0,0)", + cursor: "auto", + opacity: 0, + position: "fixed", + zIndex: 9999, + top: "0", + left: "0", + bottom: "0", + right: "0" + }, + flexBasis: void 0 + }; + _this.onResizeStart = _this.onResizeStart.bind(_this); + _this.onMouseMove = _this.onMouseMove.bind(_this); + _this.onMouseUp = _this.onMouseUp.bind(_this); + return _this; } -); -var readOnlyRangesExtension = [smartDelete, preventModifyTargetRanges]; -var editBlockExtensions = () => [ - readOnlyRangesExtension, - hideLine, - selectiveLinesFacet, - frontmatterFacet -]; - -// src/cm-extensions/flowEditor/atomic.ts -var arrowKeyAnnotation = import_state4.Annotation.define(); -var atomicSelect = import_state4.EditorState.transactionFilter.of( - (tr) => { - if (tr.isUserEvent("delete") || tr.isUserEvent("input")) { - return tr; - } - const flowID = tr.startState.field(flowIDStateField, false); - if (tr.annotation(arrowKeyAnnotation) && flowID) { - const oldSel = tr.startState.selection.main; - const lineRange = tr.state.field(selectiveLinesFacet, false); - const posRange = lineRange && lineRange[0] != void 0 ? lineRangeToPosRange(tr.startState, lineRange) : { from: 0, to: tr.startState.doc.length }; - if (oldSel.from <= posRange.from && tr.annotation(arrowKeyAnnotation) == 3) { - focusFlowEditorParent(flowID, true); + Object.defineProperty(Resizable2.prototype, "parentNode", { + get: function() { + if (!this.resizable) { + return null; } - if (oldSel.to >= posRange.to && tr.annotation(arrowKeyAnnotation) == 4) { - focusFlowEditorParent(flowID, false); + return this.resizable.parentNode; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Resizable2.prototype, "window", { + get: function() { + if (!this.resizable) { + return null; } - return tr; - } - const selection = tr.newSelection.main; - if (selection.from == 0 && selection.to == 0 || selection.from != selection.to) - return tr; - const flowEditors = tr.state.field(flowEditorInfo, false); - if (flowEditors) { - for (const info of flowEditors) { - if (info.embed == 1) { - if (info.from - 3 <= selection.from && info.to + 2 >= selection.to && info.expandedState == 2) { - const top = tr.annotation(arrowKeyAnnotation) == 1 || tr.startState.selection.main.from > selection.from ? false : true; - focusFlowEditor(info.id, top); - return { - selection: import_state4.EditorSelection.single(info.from - 4) - }; - break; - } + if (!this.resizable.ownerDocument) { + return null; + } + return this.resizable.ownerDocument.defaultView; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Resizable2.prototype, "propsSize", { + get: function() { + return this.props.size || this.props.defaultSize || DEFAULT_SIZE; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Resizable2.prototype, "size", { + get: function() { + var width = 0; + var height = 0; + if (this.resizable && this.window) { + var orgWidth = this.resizable.offsetWidth; + var orgHeight = this.resizable.offsetHeight; + var orgPosition = this.resizable.style.position; + if (orgPosition !== "relative") { + this.resizable.style.position = "relative"; } + width = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : orgWidth; + height = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : orgHeight; + this.resizable.style.position = orgPosition; } - } - return tr; - } -); - -// src/components/Space/Editor/EmbedView/EmbedContextView.tsx -var import_obsidian36 = require("obsidian"); -init_compat_module(); - -// src/components/Space/Frames/ViewNodes/FrameRoot.tsx -var import_lodash10 = __toESM(require_lodash()); -init_compat_module(); - -// src/utils/frames/runner.ts -function extractDependencies(code) { - const dependencies = []; - function visit(node, parts = []) { - if (node.type === "Identifier") { - parts.push(node.name); - return parts; - } else if (node.type === "MemberExpression") { - const objectParts = visit(node.object, parts); - if (objectParts && node.computed) { - if (node.property.type === "Literal") { - objectParts.push(String(node.property.value)); - return objectParts; - } else { - return null; + return { width, height }; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Resizable2.prototype, "sizeStyle", { + get: function() { + var _this = this; + var size = this.props.size; + var getSize = function(key2) { + if (typeof _this.state[key2] === "undefined" || _this.state[key2] === "auto") { + return "auto"; } - } else if (objectParts) { - return visit(node.property, objectParts); + if (_this.propsSize && _this.propsSize[key2] && _this.propsSize[key2].toString().endsWith("%")) { + if (_this.state[key2].toString().endsWith("%")) { + return _this.state[key2].toString(); + } + var parentSize = _this.getParentSize(); + var value = Number(_this.state[key2].toString().replace("px", "")); + var percent = value / parentSize[key2] * 100; + return percent + "%"; + } + return getStringSize(_this.state[key2]); + }; + var width = size && typeof size.width !== "undefined" && !this.state.isResizing ? getStringSize(size.width) : getSize("width"); + var height = size && typeof size.height !== "undefined" && !this.state.isResizing ? getStringSize(size.height) : getSize("height"); + return { width, height }; + }, + enumerable: false, + configurable: true + }); + Resizable2.prototype.getParentSize = function() { + if (!this.parentNode) { + if (!this.window) { + return { width: 0, height: 0 }; } - } else if (node.type === "Literal") { - parts.push(String(node.value)); - return parts; + return { width: this.window.innerWidth, height: this.window.innerHeight }; } - return null; - } - function explore(node) { - if (node.type === "MemberExpression") { - const parts = visit(node); - if (parts) { - dependencies.push(parts); - } - return; + var base2 = this.appendBase(); + if (!base2) { + return { width: 0, height: 0 }; } - for (const key2 in node) { - if (typeof node[key2] === "object" && node[key2] !== null) { - explore(node[key2]); - } + var wrapChanged = false; + var wrap = this.parentNode.style.flexWrap; + if (wrap !== "wrap") { + wrapChanged = true; + this.parentNode.style.flexWrap = "wrap"; } - } - try { - const ast = parse3(code.replace("return ", ""), { ecmaVersion: 2020 }); - explore(ast); - } catch (e4) { - return []; - } - return dependencies; -} -function sortKeysByDependencies(codeBlockStore, identifier) { - const graph = /* @__PURE__ */ new Map(); - const dependencies = /* @__PURE__ */ new Map(); - const allDependencies = /* @__PURE__ */ new Map(); - for (const key2 in codeBlockStore) { - const code = codeBlockStore[key2]; - const extractedDependencies = extractDependencies(code); - const localDependencies = extractedDependencies.filter((dep) => { - return dep.slice(0, -1).join(".") === identifier; - }); - dependencies.set(key2, localDependencies); - allDependencies.set(key2, extractedDependencies); - if (!graph.has(key2)) { - graph.set(key2, /* @__PURE__ */ new Set()); + base2.style.position = "relative"; + base2.style.minWidth = "100%"; + base2.style.minHeight = "100%"; + var size = { + width: base2.offsetWidth, + height: base2.offsetHeight + }; + if (wrapChanged) { + this.parentNode.style.flexWrap = wrap; } - for (const dep of localDependencies) { - const depStr = dep[dep.length - 1]; - if (depStr === key2) - continue; - graph.get(key2).add(depStr); + this.removeBase(base2); + return size; + }; + Resizable2.prototype.bindEvents = function() { + if (this.window) { + this.window.addEventListener("mouseup", this.onMouseUp); + this.window.addEventListener("mousemove", this.onMouseMove); + this.window.addEventListener("mouseleave", this.onMouseUp); + this.window.addEventListener("touchmove", this.onMouseMove, { + capture: true, + passive: false + }); + this.window.addEventListener("touchend", this.onMouseUp); } - } - const visited = /* @__PURE__ */ new Set(); - const result = []; - const temp = /* @__PURE__ */ new Set(); - const visit = (key2) => { - if (temp.has(key2)) - throw new Error("Circular dependency detected"); - if (!visited.has(key2)) { - temp.add(key2); - const edges = graph.get(key2) || /* @__PURE__ */ new Set(); - for (const dep of edges) { - visit(dep); - } - visited.add(key2); - temp.delete(key2); - result.push(key2); + }; + Resizable2.prototype.unbindEvents = function() { + if (this.window) { + this.window.removeEventListener("mouseup", this.onMouseUp); + this.window.removeEventListener("mousemove", this.onMouseMove); + this.window.removeEventListener("mouseleave", this.onMouseUp); + this.window.removeEventListener("touchmove", this.onMouseMove, true); + this.window.removeEventListener("touchend", this.onMouseUp); } }; - for (const key2 in codeBlockStore) { - if (!visited.has(key2)) { - visit(key2); + Resizable2.prototype.componentDidMount = function() { + if (!this.resizable || !this.window) { + return; } - } - return { sortedKeys: result, dependencies: allDependencies }; -} -var executeTreeNode = async (_treeNode, state, api, saveState, root2, runID, newState) => { - var _a2, _b2, _c2; - const treeNode = _treeNode; - let execState = await executeNode(treeNode.node, { state, newState }, api); - if (treeNode.node.type == "list") { - let uid = 0; - treeNode.children = parseMultiString(execState.state[treeNode.id].props.value).flatMap((f4, i4) => treeNode.children.map((n2) => { - const [tree, m5] = linkTreeNodes({ ...n2, node: { ...n2.node, props: { ...n2.node.props, value: wrapQuotes(f4) } } }, uid); - uid = m5; - return tree; - })); - } - if (typeof ((_b2 = (_a2 = execState.state[treeNode.id]) == null ? void 0 : _a2.actions) == null ? void 0 : _b2.onRun) == "function") { - (_c2 = execState.state[treeNode.id].actions) == null ? void 0 : _c2.onRun( - execState, - (s5) => { - saveState(s5, { state: execState.state, root: root2, id: runID }); - }, - api - ); - } - for (let i4 = 0; i4 < treeNode.children.length; i4++) { - const [newState2, newNode] = await executeTreeNode(treeNode.children[i4], execState.state, api, saveState, root2, runID, execState.newState).then((f4) => [{ state: f4.state, newState: f4.newState }, f4.root]); - execState = newState2; - treeNode.children[i4] = newNode; - } - return { id: runID, root: treeNode, state: execState.state, newState: execState.newState }; -}; -var executeNode = async (node, results, api) => { - const propResults = await executePropsCodeBlocks(node, results, api); - const stylesResults = executeCodeBlocks(node, "styles", propResults); - const actions = executeCodeBlocks(node, "actions", stylesResults); - return actions; -}; -var executePropsCodeBlocks = async (node, results, api) => { - var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j, _k; - const { type, props: props2, id: id2 } = node; - const codeBlockStore = props2 != null ? props2 : {}; - const { sortedKeys, dependencies } = sortKeysByDependencies(codeBlockStore, `${node.id}.props`); - const runKeys = results.newState ? sortedKeys.filter((f4) => { - var _a3, _b3, _c3, _d3, _e3, _f2; - const deps = dependencies.get(f4); - if (f4 in ((_c3 = (_b3 = (_a3 = results.newState) == null ? void 0 : _a3[node.id]) == null ? void 0 : _b3["props"]) != null ? _c3 : {})) { - return true; + var computedStyle = this.window.getComputedStyle(this.resizable); + this.setState({ + width: this.state.width || this.size.width, + height: this.state.height || this.size.height, + flexBasis: computedStyle.flexBasis !== "auto" ? computedStyle.flexBasis : void 0 + }); + }; + Resizable2.prototype.componentWillUnmount = function() { + if (this.window) { + this.unbindEvents(); } - for (const dep of deps) { - if (dep[0] == "api") - return true; - if ((_f2 = (_e3 = (_d3 = results.newState) == null ? void 0 : _d3[dep[0]]) == null ? void 0 : _e3[dep[1]]) == null ? void 0 : _f2[dep[2]]) { - return true; + }; + Resizable2.prototype.createSizeForCssProperty = function(newSize, kind) { + var propsSize = this.propsSize && this.propsSize[kind]; + return this.state[kind] === "auto" && this.state.original[kind] === newSize && (typeof propsSize === "undefined" || propsSize === "auto") ? "auto" : newSize; + }; + Resizable2.prototype.calculateNewMaxFromBoundary = function(maxWidth, maxHeight) { + var boundsByDirection = this.props.boundsByDirection; + var direction = this.state.direction; + var widthByDirection = boundsByDirection && hasDirection("left", direction); + var heightByDirection = boundsByDirection && hasDirection("top", direction); + var boundWidth; + var boundHeight; + if (this.props.bounds === "parent") { + var parent_1 = this.parentNode; + if (parent_1) { + boundWidth = widthByDirection ? this.resizableRight - this.parentLeft : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft); + boundHeight = heightByDirection ? this.resizableBottom - this.parentTop : parent_1.offsetHeight + (this.parentTop - this.resizableTop); + } + } else if (this.props.bounds === "window") { + if (this.window) { + boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft; + boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop; } + } else if (this.props.bounds) { + boundWidth = widthByDirection ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft); + boundHeight = heightByDirection ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop); } - return false; - }) : sortedKeys.filter((f4) => { - var _a3; - return ((_a3 = codeBlockStore[f4]) == null ? void 0 : _a3.length) > 0; - }); - const environment = results.state; - environment[id2] = { - props: (_b2 = (_a2 = results.state[id2]) == null ? void 0 : _a2.props) != null ? _b2 : {}, - actions: (_d2 = (_c2 = results.state[id2]) == null ? void 0 : _c2.actions) != null ? _d2 : {}, - styles: (_f = (_e2 = results.state[id2]) == null ? void 0 : _e2.styles) != null ? _f : {}, - contexts: (_h = (_g = results.state[id2]) == null ? void 0 : _g.contexts) != null ? _h : {} + if (boundWidth && Number.isFinite(boundWidth)) { + maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth; + } + if (boundHeight && Number.isFinite(boundHeight)) { + maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight; + } + return { maxWidth, maxHeight }; }; - environment.api = api; - for (const key2 of runKeys) { - try { - let result; - if (key2 in (((_j = (_i = results.newState) == null ? void 0 : _i[node.id]) == null ? void 0 : _j["props"]) || {})) { - result = results.newState[node.id]["props"][key2]; - } else { - const isMultiLine = codeBlockStore[key2].includes("\n"); - const func = isMultiLine ? new Function(`with(this) { ${codeBlockStore[key2]} }`) : new Function(`with(this) { return ${codeBlockStore[key2]}; }`); - result = func.call(environment); - if (result instanceof Promise) { - result = await result; - } - } - environment[id2]["props"][key2] = result; - results.state[id2]["props"][key2] = result; - if (results.newState) { - results.newState[id2] = (_k = results.newState[id2]) != null ? _k : { props: {}, styles: {}, actions: {}, contexts: {} }; - results.newState[id2]["props"][key2] = result; + Resizable2.prototype.calculateNewSizeFromDirection = function(clientX, clientY) { + var scale = this.props.scale || 1; + var resizeRatio = this.props.resizeRatio || 1; + var _a2 = this.state, direction = _a2.direction, original = _a2.original; + var _b2 = this.props, lockAspectRatio = _b2.lockAspectRatio, lockAspectRatioExtraHeight = _b2.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b2.lockAspectRatioExtraWidth; + var newWidth = original.width; + var newHeight = original.height; + var extraHeight = lockAspectRatioExtraHeight || 0; + var extraWidth = lockAspectRatioExtraWidth || 0; + if (hasDirection("right", direction)) { + newWidth = original.width + (clientX - original.x) * resizeRatio / scale; + if (lockAspectRatio) { + newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; } - } catch (error) { - console.log(error); } - } - return results; -}; -function executeCodeBlocks(node, type, results) { - var _a2; - const codeBlockStore = (_a2 = node[type]) != null ? _a2 : {}; - for (const key2 of Object.keys(codeBlockStore)) { - try { - const isMultiLine = typeof codeBlockStore[key2] === "string" || codeBlockStore[key2] instanceof String ? codeBlockStore[key2].includes("\n") : false; - const func = isMultiLine && !(type == "actions") ? new Function(`with(this) { ${codeBlockStore[key2]} }`) : new Function(`with(this) { return ${codeBlockStore[key2]}; }`); - const result = func.call(results.state); - parseKeyResult(results.state[node.id][type], key2, result); - } catch (error) { - console.log(error); + if (hasDirection("left", direction)) { + newWidth = original.width - (clientX - original.x) * resizeRatio / scale; + if (lockAspectRatio) { + newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; + } } - } - return results; -} -var parseKeyResult = (resultStore, key2, result) => { - if (key2 == "layout") { - if (result == "row" || result == "column") { - resultStore["display"] = "flex"; - resultStore["flexDirection"] = result; - return; + if (hasDirection("bottom", direction)) { + newHeight = original.height + (clientY - original.y) * resizeRatio / scale; + if (lockAspectRatio) { + newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; + } } - resultStore["display"] = result; - return; - } - resultStore[key2] = result; -}; - -// src/components/Space/Frames/ViewNodes/FrameView.tsx -init_compat_module(); - -// src/components/Space/Editor/FlowView.tsx -init_compat_module(); -var FlowView = (props2) => { - var _a2; - const ref2 = _2(null); - const loadFile = async () => { - var _a3; - const div = ref2.current; - const path = uriByString(props2.path, props2.source); - const { ref: refStr, type } = path; - let from = props2.from; - let to = props2.to; - if (((_a3 = path.refStr) == null ? void 0 : _a3.length) > 0 && path.type == "file") { - [from, to] = getLineRangeFromRef( - getAbstractFileAtPath(app, path.path), - path.refStr, - props2.plugin - ); + if (hasDirection("top", direction)) { + newHeight = original.height - (clientY - original.y) * resizeRatio / scale; + if (lockAspectRatio) { + newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; + } } - const portalType = type == "tag" || type == "folder" ? "context" : "doc"; - await spawnLeafFromFile( - props2.plugin, - props2.leaf, - props2.source, - path, - div, - portalType, - from, - to - ); + return { newWidth, newHeight }; }; - const toggleFlow = () => { - if (props2.load) { - loadFile(); + Resizable2.prototype.calculateNewSizeFromAspectRatio = function(newWidth, newHeight, max3, min3) { + var _a2 = this.props, lockAspectRatio = _a2.lockAspectRatio, lockAspectRatioExtraHeight = _a2.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a2.lockAspectRatioExtraWidth; + var computedMinWidth = typeof min3.width === "undefined" ? 10 : min3.width; + var computedMaxWidth = typeof max3.width === "undefined" || max3.width < 0 ? newWidth : max3.width; + var computedMinHeight = typeof min3.height === "undefined" ? 10 : min3.height; + var computedMaxHeight = typeof max3.height === "undefined" || max3.height < 0 ? newHeight : max3.height; + var extraHeight = lockAspectRatioExtraHeight || 0; + var extraWidth = lockAspectRatioExtraWidth || 0; + if (lockAspectRatio) { + var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth; + var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth; + var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight; + var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight; + var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth); + var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth); + var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight); + var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight); + newWidth = clamp(newWidth, lockedMinWidth, lockedMaxWidth); + newHeight = clamp(newHeight, lockedMinHeight, lockedMaxHeight); } else { - ref2.current.empty(); + newWidth = clamp(newWidth, computedMinWidth, computedMaxWidth); + newHeight = clamp(newHeight, computedMinHeight, computedMaxHeight); } + return { newWidth, newHeight }; }; - p2(() => { - toggleFlow(); - }, [props2.load, props2.path, props2.from, props2.to]); - return /* @__PURE__ */ Cn.createElement("div", { - className: `${(_a2 = props2.classname) != null ? _a2 : ""} "mk-flowspace-editor"`, - ref: ref2 - }); -}; - -// src/components/ui/menus/linkMenu.tsx -var showLinkMenu = (e4, plugin, saveLink) => { - const offset2 = e4.target.getBoundingClientRect(); - const options = getAllAbstractFilesInVault(plugin, app).map((f4) => ({ - name: fileNameToString(f4.name), - value: f4.path - })); - showSelectMenu( - { x: offset2.left, y: offset2.top + 30 }, - { - plugin, - multi: false, - editable: false, - value: [], - options, - saveOptions: (_12, value) => { - saveLink(value[0]); - }, - placeholder: i18n_default.labels.linkItemSelectPlaceholder, - detail: true, - searchable: true + Resizable2.prototype.setBoundingClientRect = function() { + if (this.props.bounds === "parent") { + var parent_2 = this.parentNode; + if (parent_2) { + var parentRect = parent_2.getBoundingClientRect(); + this.parentLeft = parentRect.left; + this.parentTop = parentRect.top; + } } - ); -}; - -// src/context/FrameEditorContext.tsx -var import_lodash9 = __toESM(require_lodash()); -var import_obsidian27 = require("obsidian"); -init_compat_module(); - -// src/utils/frames/frames.ts -var stringIsConst = (str) => { - const hasQuotesAtStartEndOnly = /^["'][^"']*["'](?:;)?$/.test(str); - const isNumber = !isNaN(parseFloat(str)) && isFinite(str); - return hasQuotesAtStartEndOnly || isNumber || str == null || str == ""; -}; -var newUniqueNode = (node, parent, otherNodes, schemaId) => { - const id2 = uniqueNameFromString( - node.node.id, - otherNodes.map((f4) => f4.id) - ); - return { - ...node.node, - id: id2, - schemaId, - parentId: parent - }; -}; - -// src/context/FrameEditorContext.tsx -var FramesEditorContext = F({ - root: null, - runRoot: () => null, - instance: { state: {}, id: null, root: null }, - saveState: () => null, - fastSaveState: () => null, - nodes: [], - properties: [], - dragNode: null, - setDragNode: () => null, - hoverNode: null, - setHoverNode: () => null, - selectedNodes: [], - selectNodes: () => null, - saveProperty: () => false, - newProperty: () => false, - delProperty: () => null, - groupNodes: () => null, - renameNode: () => null, - addNode: () => null, - deleteNode: () => null, - saveNodes: () => null, - moveUp: () => null, - moveDown: () => null, - moveToRank: () => null, - moveNodeFromSchema: () => null -}); -var FramesEditorProvider = (props2) => { - var _a2; - const { spaceInfo } = q2(SpaceContext); - const { - frameSchema, - setFrameSchema: setDBSchema, - saveFrame, - frameSchemas: schemas, - tableData, - getMDBData - } = q2(FramesMDBContext); - const [hoverNode, setHoverNode] = h2(null); - const [dragNode, setDragNode] = h2(null); - const [selectedNodes, setSelectedNodes] = h2([]); - const nodes = F2(() => { - var _a3; - if (!frameSchema) - return []; - const frames2 = (_a3 = tableData == null ? void 0 : tableData.rows.map( - (f4) => f4.id == frameSchema.id ? { - ...frameToNode(f4), - types: tableData.cols.reduce( - (p3, c4) => ({ ...p3, [c4.name]: c4.type }), - {} - ) - } : frameToNode(f4) - )) != null ? _a3 : []; - const _root = schemaToRoot(frameSchema); - if (frames2.some((f4) => f4.id == _root.id)) { - return frames2; + if (this.props.bounds && typeof this.props.bounds !== "string") { + var targetRect = this.props.bounds.getBoundingClientRect(); + this.targetLeft = targetRect.left; + this.targetTop = targetRect.top; + } + if (this.resizable) { + var _a2 = this.resizable.getBoundingClientRect(), left = _a2.left, top_1 = _a2.top, right = _a2.right, bottom = _a2.bottom; + this.resizableLeft = left; + this.resizableRight = right; + this.resizableTop = top_1; + this.resizableBottom = bottom; } - return [...frames2, _root]; - }, [tableData, frameSchema]); - const [root2, setRoot] = h2(null); - const [instance, setInstance] = h2({ - state: {}, - id: null, - root: null - }); - const activeRunID = _2(null); - const saveState = (newState, instance2) => { - const { root: _root, id: runID, state } = instance2; - if (activeRunID.current != runID) - return; - executeTreeNode( - applyPropsToRoot(_root, props2.props), - state, - props2.plugin.index.api, - saveState, - _root, - runID, - newState - ).then( - (s5) => setInstance((p3) => { - return s5; - }) - ); - }; - const fastSaveState = (newState) => { - setInstance((p3) => { - return { ...p3, state: newState }; - }); }; - p2( - () => () => { - activeRunID.current = null; - }, - [] - ); - const runRoot = () => { - var _a3; - if ((frameSchema == null ? void 0 : frameSchema.type) == "frame" || (frameSchema == null ? void 0 : frameSchema.type) == "listitem") { - const _newRoot = buildRoot( - frameSchema, - (_a3 = tableData == null ? void 0 : tableData.cols) != null ? _a3 : [], - nodes, - props2.plugin - ); - setRoot(_newRoot); - if (_newRoot) { - const newRoot = import_lodash9.default.cloneDeep(_newRoot); - const runID = (0, import_lodash9.uniqueId)(); - activeRunID.current = runID; - executeTreeNode( - applyPropsToRoot(newRoot, props2.props), - {}, - props2.plugin.index.api, - saveState, - newRoot, - runID - ).then((s5) => { - setInstance((p3) => { - return s5; - }); - activeRunID.current = s5.id; - }); - if (selectedNodes.length == 0) { - setSelectedNodes([newRoot.node]); - } else { - setSelectedNodes( - nodes.filter((f4) => selectedNodes.find((g4) => g4.id == f4.id)) - ); + Resizable2.prototype.onResizeStart = function(event, direction) { + if (!this.resizable || !this.window) { + return; + } + var clientX = 0; + var clientY = 0; + if (event.nativeEvent && isMouseEvent2(event.nativeEvent)) { + clientX = event.nativeEvent.clientX; + clientY = event.nativeEvent.clientY; + } else if (event.nativeEvent && isTouchEvent2(event.nativeEvent)) { + clientX = event.nativeEvent.touches[0].clientX; + clientY = event.nativeEvent.touches[0].clientY; + } + if (this.props.onResizeStart) { + if (this.resizable) { + var startResize = this.props.onResizeStart(event, direction, this.resizable); + if (startResize === false) { + return; } } } - }; - const refreshFrame = (e4) => { - if (e4.detail.type == "frames" && e4.detail.name == spaceInfo.path) { - runRoot(); + if (this.props.size) { + if (typeof this.props.size.height !== "undefined" && this.props.size.height !== this.state.height) { + this.setState({ height: this.props.size.height }); + } + if (typeof this.props.size.width !== "undefined" && this.props.size.width !== this.state.width) { + this.setState({ width: this.props.size.width }); + } } - }; - p2(() => { - window.addEventListener(eventTypes.spacesChange, refreshFrame); - return () => { - window.removeEventListener(eventTypes.spacesChange, refreshFrame); - }; - }, [spaceInfo]); - p2(() => { - runRoot(); - }, [frameSchema, nodes, tableData, props2.props]); - const moveUp = (node) => { - const items = nodes.filter((f4) => f4.parentId == node.parentId).sort((a5, b4) => a5.rank - b4.rank).map((f4, i4) => ({ ...f4, rank: i4 })); - const itemIndex = items.findIndex((item2) => item2.id === node.id); - if (itemIndex <= 0) { - saveNodes(items); - return; + this.ratio = typeof this.props.lockAspectRatio === "number" ? this.props.lockAspectRatio : this.size.width / this.size.height; + var flexBasis; + var computedStyle = this.window.getComputedStyle(this.resizable); + if (computedStyle.flexBasis !== "auto") { + var parent_3 = this.parentNode; + if (parent_3) { + var dir = this.window.getComputedStyle(parent_3).flexDirection; + this.flexDir = dir.startsWith("row") ? "row" : "column"; + flexBasis = computedStyle.flexBasis; + } } - const item = items[itemIndex]; - const swappedItem = items[itemIndex - 1]; - [item.rank, swappedItem.rank] = [swappedItem.rank, item.rank]; - saveNodes(items); + this.setBoundingClientRect(); + this.bindEvents(); + var state = { + original: { + x: clientX, + y: clientY, + width: this.size.width, + height: this.size.height + }, + isResizing: true, + backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || "auto" }), + direction, + flexBasis + }; + this.setState(state); }; - const moveDown = (node) => { - const items = nodes.filter((f4) => f4.parentId == node.parentId).sort((a5, b4) => a5.rank - b4.rank).map((f4, i4) => ({ ...f4, rank: i4 })); - const itemIndex = items.findIndex((item2) => item2.id === node.id); - if (itemIndex < 0 || itemIndex >= items.length - 1) { - saveNodes(items); + Resizable2.prototype.onMouseMove = function(event) { + var _this = this; + if (!this.state.isResizing || !this.resizable || !this.window) { return; } - const item = items[itemIndex]; - const swappedItem = items[itemIndex + 1]; - [item.rank, swappedItem.rank] = [swappedItem.rank, item.rank]; - saveNodes(items.sort((a5, b4) => a5.rank - b4.rank)); - }; - const moveToRank = (node, newRank) => { - const items = nodes.filter((f4) => f4.parentId == node.parentId).sort((a5, b4) => a5.rank - b4.rank).map((f4, i4) => ({ ...f4, rank: i4 })); - const itemIndex = items.findIndex((item2) => item2.id === node.id); - if (itemIndex < 0 || newRank < 0 || newRank >= items.length) { - saveNodes(items); - return; + if (this.window.TouchEvent && isTouchEvent2(event)) { + try { + event.preventDefault(); + event.stopPropagation(); + } catch (e4) { + } } - const item = items[itemIndex]; - const currentRank = item.rank; - item.rank = newRank; - items.forEach((otherItem) => { - if (otherItem.id !== node.id) { - if (currentRank < newRank && otherItem.rank > currentRank && otherItem.rank <= newRank) { - otherItem.rank--; - } else if (currentRank > newRank && otherItem.rank >= newRank && otherItem.rank < currentRank) { - otherItem.rank++; - } + var _a2 = this.props, maxWidth = _a2.maxWidth, maxHeight = _a2.maxHeight, minWidth = _a2.minWidth, minHeight = _a2.minHeight; + var clientX = isTouchEvent2(event) ? event.touches[0].clientX : event.clientX; + var clientY = isTouchEvent2(event) ? event.touches[0].clientY : event.clientY; + var _b2 = this.state, direction = _b2.direction, original = _b2.original, width = _b2.width, height = _b2.height; + var parentSize = this.getParentSize(); + var max3 = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight); + maxWidth = max3.maxWidth; + maxHeight = max3.maxHeight; + minWidth = max3.minWidth; + minHeight = max3.minHeight; + var _c2 = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c2.newHeight, newWidth = _c2.newWidth; + var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight); + if (this.props.snap && this.props.snap.x) { + newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap); + } + if (this.props.snap && this.props.snap.y) { + newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap); + } + var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight }); + newWidth = newSize.newWidth; + newHeight = newSize.newHeight; + if (this.props.grid) { + var newGridWidth = snap(newWidth, this.props.grid[0]); + var newGridHeight = snap(newHeight, this.props.grid[1]); + var gap = this.props.snapGap || 0; + newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth; + newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight; + } + var delta = { + width: newWidth - original.width, + height: newHeight - original.height + }; + if (width && typeof width === "string") { + if (width.endsWith("%")) { + var percent = newWidth / parentSize.width * 100; + newWidth = percent + "%"; + } else if (width.endsWith("vw")) { + var vw = newWidth / this.window.innerWidth * 100; + newWidth = vw + "vw"; + } else if (width.endsWith("vh")) { + var vh = newWidth / this.window.innerHeight * 100; + newWidth = vh + "vh"; } - }); - saveNodes(items); - }; - const groupNodes = (treeNodes) => { - const parentId = treeNodes[0].id == frameSchema.id ? "" : treeNodes[0].parentId; - const group = { - ...newUniqueNode(groupNode, parentId, nodes, frameSchema.id) + } + if (height && typeof height === "string") { + if (height.endsWith("%")) { + var percent = newHeight / parentSize.height * 100; + newHeight = percent + "%"; + } else if (height.endsWith("vw")) { + var vw = newHeight / this.window.innerWidth * 100; + newHeight = vw + "vw"; + } else if (height.endsWith("vh")) { + var vh = newHeight / this.window.innerHeight * 100; + newHeight = vh + "vh"; + } + } + var newState = { + width: this.createSizeForCssProperty(newWidth, "width"), + height: this.createSizeForCssProperty(newHeight, "height") }; - const newNodes = treeNodes.map((f4) => { - const node = import_lodash9.default.cloneDeep(f4); - node.parentId = group.id; - return node; + if (this.flexDir === "row") { + newState.flexBasis = newState.width; + } else if (this.flexDir === "column") { + newState.flexBasis = newState.height; + } + pn(function() { + _this.setState(newState); }); - saveNodes([group, ...newNodes]); - }; - const addNode = (treeNode, target) => { - const id2 = uniqueNameFromString( - treeNode.id, - nodes.map((f4) => f4.id) - ); - let parent = target ? target : selectedNodes.length > 0 ? selectedNodes[0] : root2.node; - let rank = parent.rank; - if (!groupableTypes.some((f4) => parent.type == f4)) { - parent = findParent(root2, parent.id).node; - } else { - rank = nodes.filter((f4) => f4.parentId == parent.id).length; + if (this.props.onResize) { + this.props.onResize(event, direction, this.resizable, delta); } - const newTreeNode = { - ...treeNode, - id: id2, - schemaId: frameSchema.id, - parentId: parent.id - }; - saveNodes([{ ...newTreeNode, rank }]); }; - const saveNodes = async (treeNodes) => { - var _a3, _b2, _c2; - if (!tableData) { + Resizable2.prototype.onMouseUp = function(event) { + var _a2 = this.state, isResizing = _a2.isResizing, direction = _a2.direction, original = _a2.original; + if (!isResizing || !this.resizable) { return; } - const newRows = ((_a3 = tableData == null ? void 0 : tableData.rows) == null ? void 0 : _a3.some((f4) => f4.id == root2.id)) ? tableData.rows : [...(_b2 = tableData == null ? void 0 : tableData.rows) != null ? _b2 : [], nodeToFrame(root2.node)]; - const insertRows = treeNodes.filter((f4) => !newRows.some((g4) => g4.id == f4.id)).map((f4) => nodeToFrame(f4)); - const modRows = treeNodes.filter((f4) => newRows.some((g4) => g4.id == f4.id)).map((f4) => nodeToFrame(f4)); - const newTable = { - ...tableData, - cols: (_c2 = tableData.cols) != null ? _c2 : [], - rows: [ - ...newRows.map((f4) => { - var _a4; - return (_a4 = modRows.find((g4) => g4.id == f4.id)) != null ? _a4 : f4; - }), - ...insertRows - ] + var delta = { + width: this.size.width - original.width, + height: this.size.height - original.height }; - await saveFrame(newTable); - }; - const moveNodeFromSchema = async (nodeId, schemaId, newParentId, styles2) => { - const oldTable = await getMDBData(); - if (!oldTable[schemaId]) - return; - const tableNodes = oldTable[schemaId].rows.map( - (g4) => frameToNode(g4) - ); - const oldSchema = schemas.find((f4) => f4.id == schemaId); - const treeNode = tableNodes.find((f4) => f4.id == nodeId); - if (!oldSchema || !treeNode) - return; - const tree = buildFrameTree( - treeNode, - tableNodes, - props2.plugin, - 0, - false - )[0]; - const deleteNodes = flattenToFrameNodes(tree); - const newTreeNodes = deleteNodes.map((f4) => ({ - ...f4, - schemaId: frameSchema.id, - styles: f4.id == nodeId && styles2 ? { - ...f4.styles, - ...styles2 - } : f4.styles, - parentId: f4.id == nodeId ? newParentId : f4.parentId - })); - await saveFrame({ - ...oldTable[frameSchema.id], - rows: oldTable[frameSchema.id].rows.filter( - (f4) => !deleteNodes.some((g4) => f4.schemaId == g4.schemaId && f4.id == g4.id) - ) - }); - await saveFrame({ - ...tableData, - rows: [ - ...tableData.rows, - ...newTreeNodes.map((f4) => nodeToFrame(f4)) - ] - }); - }; - const deleteNode = (treeNode) => { - const tree = buildFrameTree(treeNode, nodes, props2.plugin, 0, false)[0]; - const parent = findParent(root2, treeNode.id); - const deleteNodes = flattenToFrameNodes(tree); - if ((parent == null ? void 0 : parent.children.length) == 1 && parent.node.type == "column") - deleteNodes.push(parent.node); - saveFrame({ - ...tableData, - rows: tableData.rows.filter( - (f4) => !deleteNodes.some((g4) => f4.schemaId == g4.schemaId && f4.id == g4.id) - ) + if (this.props.onResizeStop) { + this.props.onResizeStop(event, direction, this.resizable, delta); + } + if (this.props.size) { + this.setState(this.props.size); + } + this.unbindEvents(); + this.setState({ + isResizing: false, + backgroundStyle: __assign3(__assign3({}, this.state.backgroundStyle), { cursor: "auto" }) }); }; - const properties2 = (_a2 = tableData == null ? void 0 : tableData.cols) != null ? _a2 : []; - const selectNodes = (frames2) => { - setSelectedNodes(frames2); - }; - const delProperty = (column) => { - const mdbtable = tableData; - const newFields = mdbtable.cols.filter( - (f4, i4) => f4.name != column.name - ); - const newTable = { - ...mdbtable, - cols: newFields != null ? newFields : [] - }; - saveFrame(newTable); - }; - const newProperty = (col) => { - return saveProperty(col); - }; - const renameNode = (node, newName) => { + Resizable2.prototype.updateSize = function(size) { + this.setState({ width: size.width, height: size.height }); }; - const saveProperty = (newColumn, oldColumn) => { - const column = { - ...newColumn, - name: sanitizeColumnName(newColumn.name) - }; - const mdbtable = tableData; - if (column.name == "") { - new import_obsidian27.Notice(i18n_default.notice.noPropertyName); - return false; - } - if (!oldColumn && mdbtable.cols.find( - (f4) => f4.name.toLowerCase() == column.name.toLowerCase() - ) || oldColumn && oldColumn.name != column.name && mdbtable.cols.find( - (f4) => f4.name.toLowerCase() == column.name.toLowerCase() - )) { - new import_obsidian27.Notice(i18n_default.notice.duplicatePropertyName); - return false; + Resizable2.prototype.renderResizer = function() { + var _this = this; + var _a2 = this.props, enable = _a2.enable, handleStyles = _a2.handleStyles, handleClasses = _a2.handleClasses, handleWrapperStyle = _a2.handleWrapperStyle, handleWrapperClass = _a2.handleWrapperClass, handleComponent = _a2.handleComponent; + if (!enable) { + return null; } - const oldFieldIndex = oldColumn ? mdbtable.cols.findIndex((f4) => f4.name == oldColumn.name) : -1; - const newFields = oldFieldIndex == -1 ? [...mdbtable.cols, column] : mdbtable.cols.map((f4, i4) => i4 == oldFieldIndex ? column : f4); - const newTable = { - ...mdbtable, - cols: newFields != null ? newFields : [] - }; - saveFrame(newTable); - return true; + var resizers = Object.keys(enable).map(function(dir) { + if (enable[dir] !== false) { + return y(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null); + } + return null; + }); + return y("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers); }; - return /* @__PURE__ */ Cn.createElement(FramesEditorContext.Provider, { - value: { - root: root2, - runRoot, - instance, - dragNode, - fastSaveState, - setDragNode, - hoverNode, - setHoverNode, - saveState, - nodes, - properties: properties2, - addNode, - deleteNode, - selectedNodes, - selectNodes, - saveProperty, - newProperty, - renameNode, - delProperty, - saveNodes, - moveUp, - moveDown, - moveToRank, - moveNodeFromSchema, - groupNodes + Resizable2.prototype.render = function() { + var _this = this; + var extendsProps = Object.keys(this.props).reduce(function(acc, key2) { + if (definedProps.indexOf(key2) !== -1) { + return acc; + } + acc[key2] = _this.props[key2]; + return acc; + }, {}); + var style = __assign3(__assign3(__assign3({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 }); + if (this.state.flexBasis) { + style.flexBasis = this.state.flexBasis; } - }, props2.children); -}; - -// src/components/Space/Frames/EditorNodes/FlowNodeView.tsx -init_compat_module(); -function parseContent(input) { - const regex1 = /!\[!\[(.*?)\]\]/; - const regex2 = /!!\[\[(.*?)\]\]/; - const match1 = input.match(regex1); - const match2 = input.match(regex2); - return match1 ? match1[1] : match2 ? match2[1] : input; -} -var FlowNodeView = (props2) => { - var _a2, _b2; - const fullPath = (_b2 = (_a2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _a2.props) == null ? void 0 : _b2.value; - const path = fullPath ? parseContent(fullPath) : null; - const { saveNodes } = q2(FramesEditorContext); - const selectLink = (e4) => { - showLinkMenu( - e4, - props2.plugin, - (link) => saveNodes([ - { - ...props2.treeNode.node, - props: { ...props2.treeNode.node.props, value: wrapQuotes(link) } - } - ]) + var Wrapper = this.props.as || "div"; + return y( + Wrapper, + __assign3({ ref: this.ref, style, className: this.props.className }, extendsProps), + this.state.isResizing && y("div", { style: this.state.backgroundStyle }), + this.props.children, + this.renderResizer() ); }; - return props2.instance.state[props2.treeNode.id] && path ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(FlowView, { - source: props2.source, - plugin: props2.plugin, - path, - load: true, - classname: "mk-flow-node" - })) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-placeholder", - onClick: (e4) => selectLink(e4) - }, "Select Note"); -}; + Resizable2.defaultProps = { + as: "div", + onResizeStart: function() { + }, + onResize: function() { + }, + onResizeStop: function() { + }, + enable: { + top: true, + right: true, + bottom: true, + left: true, + topRight: true, + bottomRight: true, + bottomLeft: true, + topLeft: true + }, + style: {}, + grid: [1, 1], + lockAspectRatio: false, + lockAspectRatioExtraWidth: 0, + lockAspectRatioExtraHeight: 0, + scale: 1, + resizeRatio: 1, + snapGap: 0 + }; + return Resizable2; +}(w3); // src/components/Space/Frames/EditorNodes/FrameNodeView.tsx -var import_classnames = __toESM(require_classnames()); +init_compat_module(); // src/utils/contexts/mdtable.ts var createTable2 = (object, columns) => { @@ -51378,17 +51326,17 @@ var createInlineTable = async (plugin, path) => { }; // src/components/ui/menus/newFrameMenu.tsx -var showNewFrameMenu = (e4, plugin, space, addNode) => { +var showNewFrameMenu = (e4, plugin, space2, addNode) => { const offset2 = e4.target.getBoundingClientRect(); - const kits = plugin.settings.quickFrames.flatMap((s5) => { + const kits = plugin.settings.quickFrames.flatMap((s6) => { var _a2, _b2; - const frameSchemas = (_b2 = (_a2 = plugin.index.framesIndex.get(s5)) == null ? void 0 : _a2.schemas) != null ? _b2 : []; + const frameSchemas = (_b2 = (_a2 = plugin.index.framesIndex.get(s6)) == null ? void 0 : _a2.schemas) != null ? _b2 : []; return frameSchemas.map((f4) => mdbSchemaToFrameSchema(f4)).map((f4) => ({ - id: `${s5}#*${f4.id}`, + id: `${s6}#*${f4.id}`, def: f4.def, node: { ...schemaToFrame(f4), - ref: `${s5}#*${f4.id}` + ref: `${s6}#*${f4.id}` } })); }); @@ -51452,10 +51400,10 @@ var showNewFrameMenu = (e4, plugin, space, addNode) => { const insertNode = async (item) => { if (item.type == "preset") { if (item.value == "note") { - if (space.uri.type == "folder") { + if (space2.uri.type == "folder") { const newFile = await createNewMarkdownFile( plugin, - getAbstractFileAtPath(app, space.path), + getAbstractFileAtPath(app, space2.path), "", null, true @@ -51465,12 +51413,12 @@ var showNewFrameMenu = (e4, plugin, space, addNode) => { props: { value: `'${newFile.path}'` } }); } else { - const _space = plugin.index.spacesIndex.get(space.path); + const _space = plugin.index.spacesIndex.get(space2.path); if (_space) { const newFile = await newFileInSpace( plugin, - space, - uriByString(space.path), + _space, + uriByString(space2.path), false, true ); @@ -51481,10 +51429,10 @@ var showNewFrameMenu = (e4, plugin, space, addNode) => { } } } else if (item.value == "table") { - const table = await createInlineTable(plugin, space.uri.fullPath); + const table = await createInlineTable(plugin, space2.uri.fullPath); addNode({ ...spaceNode.node, - props: { value: `'${space.uri.fullPath}/#^${table}'` } + props: { value: `'${space2.uri.fullPath}/#^${table}'` } }); } else if (item.value == "link") { } @@ -51515,8 +51463,128 @@ var showNewFrameMenu = (e4, plugin, space, addNode) => { ); }; -// src/components/ui/menus/showFramePropsMenu.tsx -var import_obsidian28 = require("obsidian"); +// src/components/Space/Frames/FrameHoverMenu/FrameHoverMenu.tsx +init_compat_module(); +var FrameHoverMenu = (props2) => { + const { spaceInfo } = q2(SpaceContext); + const { addNode, selectNodes, selectedNodes } = q2(FramesEditorContext); + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-hover-menu-container" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-hover-menu" + }, props2.dragRef && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-small mk-hover-button", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-handle"] }, + ref: props2.dragRef, + onClick: (e4) => { + e4.stopPropagation(); + if (e4.shiftKey) { + selectNodes( + [...selectedNodes, props2.node].sort( + (a6, b4) => a6.rank - b4.rank + ) + ); + } else { + selectNodes([props2.node]); + } + }, + ...props2.listeners + })), /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => showNewFrameMenu( + e4, + props2.plugin, + spaceInfo, + (newNode) => addNode(newNode, props2.node) + ), + className: "mk-icon-small mk-hover-button", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } + })))); +}; + +// src/components/Space/Frames/FrameHoverMenu/HoverMultiMenu.tsx +init_compat_module(); +var HoverMultiMenu = (props2) => { + const { selectedNodes, groupNodes, selectNodes } = q2(FramesEditorContext); + const showSelectNodeMenu = (e4) => { + const offset2 = e4.target.getBoundingClientRect(); + const options = selectedNodes.map((f4) => ({ + name: f4.name, + value: f4.id + })); + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: false, + editable: false, + value: [], + options, + saveOptions: (_12, value) => { + selectNodes(selectedNodes.filter((f4) => f4.id == value[0])); + }, + placeholder: i18n_default.labels.linkItemSelectPlaceholder, + detail: true, + searchable: false, + showAll: true + } + ); + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-props-editor menu", + onClick: (e4) => e4.stopPropagation() + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-mark", + onClick: (e4) => showSelectNodeMenu(e4) + }, /* @__PURE__ */ Cn.createElement("div", { + dangerouslySetInnerHTML: { + __html: stickerFromString("lucide//copy-check", props2.plugin) + } + }), selectedNodes.length, " Selected"), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-divider" + }), /* @__PURE__ */ Cn.createElement("div", { + "aria-label": "Create Vertical Section", + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: stickerFromString("ui//mk-ui-rows", props2.plugin) + }, + onClick: () => groupNodes(selectedNodes, { + alignItems: `'flex-start'`, + gap: `'8px'` + }) + }), /* @__PURE__ */ Cn.createElement("div", { + "aria-label": "Create Horizontal Section", + className: "mk-mark", + dangerouslySetInnerHTML: { + __html: stickerFromString("lucide//columns", props2.plugin) + }, + onClick: () => groupNodes(selectedNodes, { layout: `'row'`, gap: `'8px'` }) + })); +}; + +// src/components/ui/menus/linkMenu.tsx +var showLinkMenu = (e4, plugin, saveLink) => { + const offset2 = e4.target.getBoundingClientRect(); + const options = getAllAbstractFilesInVault(plugin).map((f4) => ({ + name: fileNameToString(f4.name), + value: f4.path + })); + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin, + multi: false, + editable: false, + value: [], + options, + saveOptions: (_12, value) => { + saveLink(value[0]); + }, + placeholder: i18n_default.labels.linkItemSelectPlaceholder, + detail: true, + searchable: true + } + ); +}; // src/components/ui/menus/spaceMenu.tsx var showSpacesMenu = (e4, plugin, saveLink) => { @@ -51543,26 +51611,31 @@ var showSpacesMenu = (e4, plugin, saveLink) => { ); }; -// src/components/ui/menus/showFramePropsMenu.tsx -var showFramePropsMenu = (props2) => { - const { - plugin, - position, - fields, - deleteFrame, - duplicateFrame, - frameProps, - savePropValue, - saveStyleValue - } = props2; +// src/components/Space/Frames/FrameHoverMenu/HoverPropsMenu.tsx +var import_obsidian26 = require("obsidian"); +init_compat_module(); +var HoverPropsMenu = (props2) => { + const { deleteFrame, duplicateFrame, fields } = props2; + const { ungroupNode } = q2(FramesEditorContext); + const [frameProps, setFrameProps] = h2(props2.frameProps); + p2(() => { + setFrameProps(props2.frameProps); + }, [props2.frameProps]); + const savePropValue = (prop, value) => { + setFrameProps((p3) => ({ ...p3, [prop]: value })); + props2.savePropValue(prop, value); + }; const showValueMenu = (e4, field) => { + var _a2, _b2; + e4.stopPropagation(); + e4.preventDefault(); const currentValue = removeQuotes(frameProps[field.name]); switch (field.type) { case "space": { - const menu2 = new import_obsidian28.Menu(); - menu2.setUseNativeMenu(false); - menu2.addItem((menuItem) => { + const menu = new import_obsidian26.Menu(); + menu.setUseNativeMenu(false); + menu.addItem((menuItem) => { menuItem.setIcon("type"); menuItem.setTitle("Select Space"); menuItem.onClick( @@ -51573,9 +51646,9 @@ var showFramePropsMenu = (props2) => { ) ); }); - menu2.addSeparator(); + menu.addSeparator(); props2.schemaProps.filter((f4) => f4.type == field.type).forEach((f4) => { - menu2.addItem((menuItem) => { + menu.addItem((menuItem) => { menuItem.setTitle(f4.name); menuItem.setIcon("type"); menuItem.onClick((e5) => { @@ -51584,14 +51657,31 @@ var showFramePropsMenu = (props2) => { }); }); const offset2 = e4.target.getBoundingClientRect(); - menu2.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); + menu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); + } + break; + case "option": + { + const parsedValue = parseFieldValue(field.value, field.type); + const options = (_a2 = parsedValue.options) != null ? _a2 : []; + showSelectMenu(e4.target.getBoundingClientRect(), { + plugin: props2.plugin, + multi: false, + editable: false, + searchable: true, + saveOptions: (_12, v4) => { + savePropValue(field.name, `'${v4[0]}'`); + }, + value: [currentValue != null ? currentValue : ""], + options + }); } break; case "link": { - const menu2 = new import_obsidian28.Menu(); - menu2.setUseNativeMenu(false); - menu2.addItem((menuItem) => { + const menu = new import_obsidian26.Menu(); + menu.setUseNativeMenu(false); + menu.addItem((menuItem) => { menuItem.setIcon("type"); menuItem.setTitle("Select Note"); menuItem.onClick( @@ -51602,9 +51692,9 @@ var showFramePropsMenu = (props2) => { ) ); }); - menu2.addSeparator(); + menu.addSeparator(); props2.schemaProps.filter((f4) => f4.type == field.type).forEach((f4) => { - menu2.addItem((menuItem) => { + menu.addItem((menuItem) => { menuItem.setTitle(f4.name); menuItem.setIcon("type"); menuItem.onClick((e5) => { @@ -51613,7 +51703,7 @@ var showFramePropsMenu = (props2) => { }); }); const offset2 = e4.target.getBoundingClientRect(); - menu2.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); + menu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); } break; case "icon": @@ -51639,9 +51729,9 @@ var showFramePropsMenu = (props2) => { case "text": case "number": { - const menu2 = new import_obsidian28.Menu(); - menu2.setUseNativeMenu(false); - menu2.addItem((menuItem) => { + const menu = new import_obsidian26.Menu(); + menu.setUseNativeMenu(false); + menu.addItem((menuItem) => { inputMenuItem( menuItem, currentValue, @@ -51650,7 +51740,7 @@ var showFramePropsMenu = (props2) => { menuItem.setIcon("type"); }); props2.schemaProps.forEach((f4) => { - menu2.addItem((menuItem) => { + menu.addItem((menuItem) => { menuItem.setTitle(f4.name); menuItem.setIcon("type"); menuItem.onClick((e5) => { @@ -51659,69 +51749,89 @@ var showFramePropsMenu = (props2) => { }); }); const offset2 = e4.target.getBoundingClientRect(); - menu2.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); + menu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); } break; - case "date": + case "date": { + const offset2 = e4.target.getBoundingClientRect(); + const date = new Date(currentValue); + showDatePickerMenu( + { x: offset2.left, y: offset2.top + 30 }, + date.getTime() ? date : null, + (date2) => savePropValue(field.name, date2.valueOf().toString()) + ); + break; + } + case "super": { - const offset2 = e4.target.getBoundingClientRect(); - const date = new Date(currentValue); - showDatePickerMenu( - { x: offset2.left, y: offset2.top + 30 }, - date.getTime() ? date : null, - (date2) => savePropValue(field.name, date2.valueOf().toString()) - ); + const parsedValue = parseFieldValue(field.value, field.type); + const superPropertyName = parsedValue.dynamic ? removeQuotes(frameProps[(_b2 = parsedValue.field) != null ? _b2 : ""]) : parsedValue.field; + if (superPropertyName) { + const property2 = props2.plugin.index.superProperties.get(superPropertyName); + const superProperty = property2 ? { + ...property2, + name: field.name, + value: JSON.stringify( + props2.plugin.index.valueForSuperproperty( + superPropertyName, + property2 + ) + ) + } : null; + if (superProperty) + showValueMenu(e4, superProperty); + } break; } break; } }; const showTypographyMenu = (e4) => { - const menu2 = new import_obsidian28.Menu(); - menu2.setUseNativeMenu(false); - menu2.addItem((menuItem) => { + const menu = new import_obsidian26.Menu(); + menu.setUseNativeMenu(false); + menu.addItem((menuItem) => { menuItem.setTitle("H1"); menuItem.setIcon("type"); menuItem.onClick((e5) => { savePropValue("style", `'h1'`); }); }); - menu2.addItem((menuItem) => { + menu.addItem((menuItem) => { menuItem.setTitle("H2"); menuItem.setIcon("type"); menuItem.onClick((e5) => { savePropValue("style", `'h2'`); }); }); - menu2.addItem((menuItem) => { + menu.addItem((menuItem) => { menuItem.setTitle("H3"); menuItem.setIcon("type"); menuItem.onClick((e5) => { savePropValue("style", `'h3'`); }); }); - menu2.addItem((menuItem) => { + menu.addItem((menuItem) => { menuItem.setTitle("H4"); menuItem.setIcon("type"); menuItem.onClick((e5) => { savePropValue("style", `'h4'`); }); }); - menu2.addItem((menuItem) => { + menu.addItem((menuItem) => { menuItem.setTitle("H5"); menuItem.setIcon("type"); menuItem.onClick((e5) => { savePropValue("style", `'h5'`); }); }); - menu2.addItem((menuItem) => { + menu.addItem((menuItem) => { menuItem.setTitle("H6"); menuItem.setIcon("type"); menuItem.onClick((e5) => { savePropValue("style", `'h6'`); }); }); - menu2.addItem((menuItem) => { + menu.addItem((menuItem) => { menuItem.setTitle("Text"); menuItem.setIcon("type"); menuItem.onClick((e5) => { @@ -51729,1180 +51839,573 @@ var showFramePropsMenu = (props2) => { }); }); const offset2 = e4.target.getBoundingClientRect(); - menu2.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); + menu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); }; - const menu = new import_obsidian28.Menu(); - menu.setUseNativeMenu(false); - if (props2.node.type == "text") { - menu.addItem((menuItem) => { - menuItem.setTitle("Style"); - menuItem.setIcon("sort-asc"); - menuItem.onClick((e4) => showTypographyMenu(e4)); - }); - menu.addItem((menuItem) => { - menuItem.setIcon("palette"); - disclosureMenuItem( - plugin, - menuItem, - false, - false, - i18n_default.menu.changeColor, - "", - [ - { name: "Default", value: "" }, - ...colors.map((f4) => ({ name: f4[0], value: f4[1] })) - ], - (_12, values) => { - saveStyleValue("color", wrapQuotes(values[0])); - } - ); - }); - } - fields.forEach( - (f4) => menu.addItem((menuItem) => { - var _a2; - const icon = (_a2 = fieldTypeForType(f4.type)) == null ? void 0 : _a2.icon; - menuItem.setTitle(f4.name); - menuItem.iconEl.innerHTML = stickerFromString(icon, props2.plugin); - menuItem.onClick((e4) => showValueMenu(e4, f4)); - }) - ); - menu.addSeparator(); - menu.addItem((menuItem) => { - menuItem.setTitle("Duplicate"); - menuItem.setIcon("copy"); - menuItem.onClick(() => duplicateFrame()); - }); - menu.addItem((menuItem) => { - menuItem.setTitle("Delete"); - menuItem.setIcon("trash"); - menuItem.onClick(() => deleteFrame()); - }); - menu.showAtPosition(position); - return menu; -}; - -// src/components/Space/Frames/FrameHoverMenu.tsx -init_compat_module(); - -// src/components/Space/Frames/Setters/PropSetter.tsx -init_compat_module(); - -// src/components/Space/Frames/Setters/CodeEditorSetter.tsx -init_compat_module(); -var CodeEditorSetter = (props2) => { return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-setter-code" - }, /* @__PURE__ */ Cn.createElement("div", { - onClick: () => props2.editCode(props2.node, props2.name, props2.type), - dangerouslySetInnerHTML: { __html: uiIconSet["mk-mark-code"] } + className: "mk-frame-props-editor menu" + }, fields.map((f4, i5) => { + var _a2, _b2, _c2, _d2, _e2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-mark", + key: i5, + onClick: (e4) => showValueMenu(e4, f4) + }, /* @__PURE__ */ Cn.createElement("div", { + "aria-label": (_b2 = (_a2 = safelyParseJSON(f4.attrs)) == null ? void 0 : _a2.name) != null ? _b2 : f4.name, + dangerouslySetInnerHTML: { + __html: stickerFromString( + (_e2 = (_c2 = safelyParseJSON(f4.attrs)) == null ? void 0 : _c2.icon) != null ? _e2 : (_d2 = fieldTypeForType(f4.type)) == null ? void 0 : _d2.icon, + props2.plugin + ) + } + }), f4.type == "text" && stringIsConst(frameProps[f4.name]) && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-menu-input" + }, /* @__PURE__ */ Cn.createElement("input", { + value: removeQuotes(frameProps[f4.name]), + onClick: (e4) => e4.stopPropagation(), + onKeyDown: (e4) => { + if (e4.key == "Enter") + e4.target.blur(); + }, + onBlur: (e4) => { + savePropValue(f4.name, wrapQuotes(e4.target.value)); + } + }))); }), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-setter-code-value" - }, props2.value)); -}; - -// src/components/Space/Frames/Setters/PropSetter.tsx -var PropSetter = (props2) => { - return stringIsConst(props2.value) ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(DataTypeView, { - plugin: props2.plugin, - initialValue: removeQuotes(props2.value), - column: { ...props2.field, table: "" }, - editable: true, - updateValue: (value) => props2.saveValue(`${value}`) - })) : /* @__PURE__ */ Cn.createElement(CodeEditorSetter, { - name: props2.field.name, - value: props2.value, - type: "props", - node: props2.node.id, - editCode: props2.editCode - }); -}; - -// src/components/Space/Frames/FrameHoverMenu.tsx -var HoverPropsMenu = (props2) => { - const deleteNode = (node) => { - props2.deleteNode(node); - }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-props-editor" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-small", + className: "mk-divider" + }), props2.node.type == "text" ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-mark", + onClick: (e4) => showTypographyMenu(e4), dangerouslySetInnerHTML: { - __html: stickerFromString(props2.node.icon, props2.plugin) + __html: stickerFromString("lucide//type", props2.plugin) } - }), props2.fields.map((f4, i4) => { - var _a2, _b2; - return /* @__PURE__ */ Cn.createElement(PropSetter, { - key: i4, - node: props2.node, - plugin: props2.plugin, - value: (_b2 = (_a2 = props2.node) == null ? void 0 : _a2.props) == null ? void 0 : _b2[f4.name], - field: f4, - saveValue: (value) => { - props2.saveNodeValue({ [f4.name]: wrapQuotes(value) }, props2.node); - }, - editCode: () => { - } - }); - }), /* @__PURE__ */ Cn.createElement("button", { - onClick: () => props2.deleteNode(props2.node), + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-divider" + }), props2.node.type == "group" ? /* @__PURE__ */ Cn.createElement("div", { + "aria-label": "Ungroup", + className: "mk-mark", + onClick: () => ungroupNode(props2.node), + dangerouslySetInnerHTML: { + __html: stickerFromString("lucide//copy-x", props2.plugin) + } + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-mark", + "aria-label": "Duplicate", + onClick: () => duplicateFrame(), + dangerouslySetInnerHTML: { + __html: stickerFromString("lucide//copy", props2.plugin) + } + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-mark", + "aria-label": "Delete", + onClick: () => deleteFrame(), dangerouslySetInnerHTML: { - __html: lucideIcon("trash") + __html: stickerFromString("lucide//trash", props2.plugin) } })); }; -var FrameHoverMenu = (props2) => { - const { spaceInfo } = q2(SpaceContext); - const { saveNodes, addNode, deleteNode, nodes, root: root2 } = q2(FramesEditorContext); - const fields = props2.node ? propertiesForNode(props2.node) : []; - const saveNodeValue = (values, node) => { - const newNodes = { - ...node, - props: { - ...node.props, - ...values - } - }; - saveNodes([newNodes]); - }; - const saveStyleValue = (values, node) => { - const newNodes = { - ...node, - styles: { - ...node.styles, - ...values - } - }; - saveNodes([newNodes]); - }; - const showPropsMenu = (e4) => { - const offset2 = e4.target.getBoundingClientRect(); - showFramePropsMenu({ - position: offset2, - plugin: props2.plugin, - node: props2.node, - duplicateFrame: () => { - addNode(props2.node); - }, - deleteFrame: () => deleteNode(props2.node), - fields, - frameProps: props2.node.props, - schemaProps: props2.rootProps, - savePropValue: (key2, value) => saveNodeValue({ [key2]: value }, props2.node), - saveStyleValue: (key2, value) => saveStyleValue({ [key2]: value }, props2.node) - }); - }; - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-hover-menu-container" + +// src/components/Space/Frames/Placeholders/ColumnPlaceholder.tsx +init_compat_module(); +var ColumnPlaceholder = (props2) => { + const { frameSchema } = q2(FramesMDBContext); + const { hoverNode } = q2(FramesEditorContext); + const { setNodeRef } = useDroppable({ + id: props2.id, + data: { + id: props2.id, + type: "item", + parent: props2.parentId, + frame: frameSchema.id + } + }); + return /* @__PURE__ */ Cn.createElement("div", { + className: `mk-frame-drop-placeholder`, + style: { width: props2.width, height: props2.height } }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-hover-menu" - }, props2.dragRef && /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-small mk-hover-button", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-handle"] }, - ref: props2.dragRef, - onClick: (e4) => { - showPropsMenu(e4); - }, - ...props2.listeners + className: `${props2.bottom && "mk-indicator-bottom"}`, + style: { width: props2.width, height: props2.height }, + ref: props2.type < 3 && props2.dropRef }), /* @__PURE__ */ Cn.createElement("div", { - onClick: (e4) => showNewFrameMenu( - e4, - props2.plugin, - spaceInfo, - (newNode) => addNode(newNode, props2.node) - ), - className: "mk-icon-small mk-hover-button", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } - })))); + className: `mk-frame-column-placeholder ${props2.right && "mk-indicator-right"}`, + style: { height: props2.height }, + ref: setNodeRef + })); }; -// src/components/ui/menus/nodePropsMenu.tsx -var import_obsidian29 = require("obsidian"); +// src/components/Space/Frames/Placeholders/RowPlaceholder.tsx init_compat_module(); -var showNodePropsMenu = (e4, plugin, node, saveNodes, deleteNode) => { - const fields = node ? propertiesForNode(node) : []; - const saveNodeValue = (values, node2) => { - const newNodes = { - ...node2, - props: { - ...node2.props, - ...values - } - }; - saveNodes([newNodes]); - }; - const menu = new import_obsidian29.Menu(); - menu.dom.toggleClass("mk-menu", true); - menu.setUseNativeMenu(false); - const frag = document.createDocumentFragment(); - const div = frag.createDiv("mk-options-container"); - div.style.minHeight = "200px"; - div.addEventListener("click", (e5) => { - e5.stopImmediatePropagation(); - }); - div.addEventListener("mousedown", (e5) => { - e5.stopImmediatePropagation(); - }); - div.addEventListener("mouseup", (e5) => { - e5.stopImmediatePropagation(); - }); - const root2 = createRoot(div); - root2.render( - /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(HoverPropsMenu, { - plugin, - fields, - saveNodeValue, - deleteNode, - node - })) - ); - menu.addItem((item) => { - item.setTitle(frag); +var RowPlaceholder = (props2) => { + const { hoverNode, root: root2, deleteNode, nodes } = q2(FramesEditorContext); + const { setNodeRef } = useDroppable({ + id: props2.id, + data: { + id: props2.id, + type: "item", + parent: props2.parentId + } }); - const keys2 = [...menu.scope.keys]; - for (let i4 = 0; i4 < keys2.length; i4++) { - if (keys2[i4].key != "Escape") { - menu.scope.unregister(keys2[i4]); + const presets = [ + { + name: "New Note", + value: { type: "preset", value: "note" }, + section: "default", + icon: "ui//mk-make-flow" + }, + { + name: "Table", + value: { type: "preset", value: "table" }, + section: "default", + icon: "ui//mk-make-table" } - } - const offset2 = e4.target.getBoundingClientRect(); - menu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); - return menu; + ]; + const defaultElements = [ + flowNode, + spaceNode, + textNode, + imageNode, + iconNode + ]; + const defaultFrames = [ + buttonNode, + linkNode, + cardNode, + progressNode + ]; + const [queryStr, setQueryStr] = h2(""); + const allOptions = [ + ...presets, + ...defaultElements.map((f4) => { + var _a2; + return { + name: f4.node.name, + value: { type: "element", value: f4 }, + section: "element", + icon: (_a2 = f4.def) == null ? void 0 : _a2.icon + }; + }), + ...defaultFrames.map((f4) => { + var _a2; + return { + name: f4.node.name, + value: { type: "default", value: f4 }, + section: "element", + icon: (_a2 = f4.def) == null ? void 0 : _a2.icon + }; + }) + ]; + const options = F2(() => { + return queryStr.length == 0 ? allOptions : allOptions.filter((f4) => matchAny(queryStr).test(f4.name)); + }, [queryStr]); + const onKeyDown = (e4) => { + e4.stopPropagation(); + if (e4.key == "Backspace" && e4.target.textContent.length == 0) { + if (props2.id) + deleteNode(nodes.find((f4) => f4.id == props2.id)); + } + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-f" + }, /* @__PURE__ */ Cn.createElement("div", { + className: `mk-frame-row-placeholder ${hoverNode == props2.id && "mk-indicator-bottom"}`, + ref: setNodeRef + }, /* @__PURE__ */ Cn.createElement("div", { + contentEditable: true, + onKeyDown: (e4) => onKeyDown(e4), + onInput: (e4) => setQueryStr(e4.currentTarget.textContent) + }), queryStr.length > 0 && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-add-menu" + }, options.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5 + }, f4.name)))), /* @__PURE__ */ Cn.createElement(FrameHoverMenu, { + plugin: props2.plugin, + node: root2.node, + listeners: null, + dragRef: null + })); }; -// node_modules/re-resizable/lib/index.js -init_compat_module(); +// src/components/Space/Editor/FlowView.tsx init_compat_module(); -// node_modules/re-resizable/lib/resizer.js -init_compat_module(); -var __extends2 = function() { - var extendStatics = function(d5, b4) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d6, b5) { - d6.__proto__ = b5; - } || function(d6, b5) { - for (var p3 in b5) - if (Object.prototype.hasOwnProperty.call(b5, p3)) - d6[p3] = b5[p3]; - }; - return extendStatics(d5, b4); - }; - return function(d5, b4) { - extendStatics(d5, b4); - function __() { - this.constructor = d5; +// src/utils/flow/flowEditor.ts +var import_state5 = require("@codemirror/state"); + +// src/cm-extensions/flowEditor/atomic.ts +var import_state4 = require("@codemirror/state"); + +// src/cm-extensions/flowEditor/selectiveEditor.ts +var import_state3 = require("@codemirror/state"); +var import_view3 = require("@codemirror/view"); + +// node_modules/tslib/modules/index.js +var import_tslib = __toESM(require_tslib(), 1); +var { + __extends: __extends3, + __assign: __assign4, + __rest: __rest2, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray: __spreadArray2, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn +} = import_tslib.default; + +// src/cm-extensions/flowEditor/selectiveEditor.ts +var combinedRangeFacets = (rangeA, rangeB) => { + const startRange = !(rangeA == null ? void 0 : rangeA[0]) ? rangeB[0] : !(rangeB == null ? void 0 : rangeB[0]) ? rangeA[0] : Math.max(rangeA == null ? void 0 : rangeA[0], rangeB == null ? void 0 : rangeB[0]); + const endRange = !(rangeA == null ? void 0 : rangeA[1]) ? rangeB[1] : !(rangeB == null ? void 0 : rangeB[1]) ? rangeA[1] : Math.min(rangeA == null ? void 0 : rangeA[1], rangeB == null ? void 0 : rangeB[1]); + return [isNaN(startRange) ? null : startRange, isNaN(endRange) ? null : endRange]; +}; +var editableRange = import_state3.Annotation.define(); +var contentRange = import_state3.Annotation.define(); +var hiddenLine = import_view3.Decoration.replace({ inclusive: true, block: true }); +var hideLine = import_state3.StateField.define({ + create() { + return import_view3.Decoration.none; + }, + update(value, tr) { + const builder = new import_state3.RangeSetBuilder(); + const betterFacet = combinedRangeFacets(tr.state.field(selectiveLinesFacet, false), tr.state.field(frontmatterFacet, false)); + if ((betterFacet == null ? void 0 : betterFacet[0]) != null) { + const starterLine = Math.min( + tr.state.doc.lines, + betterFacet[0] + ); + builder.add( + tr.state.doc.line(1).from, + tr.state.doc.line(starterLine).from - 1, + hiddenLine + ); + if (tr.newDoc.lines != betterFacet[1]) + builder.add( + tr.state.doc.line( + Math.min(tr.newDoc.lines, betterFacet[1]) + ).to, + tr.state.doc.line(tr.newDoc.lines).to, + hiddenLine + ); } - d5.prototype = b4 === null ? Object.create(b4) : (__.prototype = b4.prototype, new __()); - }; -}(); -var __assign3 = function() { - __assign3 = Object.assign || function(t4) { - for (var s5, i4 = 1, n2 = arguments.length; i4 < n2; i4++) { - s5 = arguments[i4]; - for (var p3 in s5) - if (Object.prototype.hasOwnProperty.call(s5, p3)) - t4[p3] = s5[p3]; + const dec = builder.finish(); + return dec; + }, + provide: (f4) => import_view3.EditorView.decorations.from(f4) +}); +var frontmatterFacet = import_state3.StateField.define({ + create: () => [void 0, void 0], + update(value, tr) { + if (tr.annotation(contentRange)) { + if (tr.annotation(contentRange)[0]) { + return [ + tr.annotation(contentRange)[0], + Math.min(tr.state.doc.lines, tr.annotation(contentRange)[1]) + ]; + } + return tr.annotation(contentRange); } - return t4; - }; - return __assign3.apply(this, arguments); -}; -var rowSizeBase = { - width: "100%", - height: "10px", - top: "0px", - left: "0px", - cursor: "row-resize" -}; -var colSizeBase = { - width: "10px", - height: "100%", - top: "0px", - left: "0px", - cursor: "col-resize" -}; -var edgeBase = { - width: "20px", - height: "20px", - position: "absolute" -}; -var styles = { - top: __assign3(__assign3({}, rowSizeBase), { top: "-5px" }), - right: __assign3(__assign3({}, colSizeBase), { left: void 0, right: "-5px" }), - bottom: __assign3(__assign3({}, rowSizeBase), { top: void 0, bottom: "-5px" }), - left: __assign3(__assign3({}, colSizeBase), { left: "-5px" }), - topRight: __assign3(__assign3({}, edgeBase), { right: "-10px", top: "-10px", cursor: "ne-resize" }), - bottomRight: __assign3(__assign3({}, edgeBase), { right: "-10px", bottom: "-10px", cursor: "se-resize" }), - bottomLeft: __assign3(__assign3({}, edgeBase), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }), - topLeft: __assign3(__assign3({}, edgeBase), { left: "-10px", top: "-10px", cursor: "nw-resize" }) -}; -var Resizer = function(_super) { - __extends2(Resizer2, _super); - function Resizer2() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.onMouseDown = function(e4) { - _this.props.onResizeStart(e4, _this.props.direction); - }; - _this.onTouchStart = function(e4) { - _this.props.onResizeStart(e4, _this.props.direction); - }; - return _this; + return value; } - Resizer2.prototype.render = function() { - return y("div", { className: this.props.className || "", style: __assign3(__assign3({ position: "absolute", userSelect: "none" }, styles[this.props.direction]), this.props.replaceStyles || {}), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children); - }; - return Resizer2; -}(w3); - -// node_modules/re-resizable/lib/index.js -var __extends3 = function() { - var extendStatics = function(d5, b4) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d6, b5) { - d6.__proto__ = b5; - } || function(d6, b5) { - for (var p3 in b5) - if (Object.prototype.hasOwnProperty.call(b5, p3)) - d6[p3] = b5[p3]; - }; - return extendStatics(d5, b4); - }; - return function(d5, b4) { - extendStatics(d5, b4); - function __() { - this.constructor = d5; - } - d5.prototype = b4 === null ? Object.create(b4) : (__.prototype = b4.prototype, new __()); - }; -}(); -var __assign4 = function() { - __assign4 = Object.assign || function(t4) { - for (var s5, i4 = 1, n2 = arguments.length; i4 < n2; i4++) { - s5 = arguments[i4]; - for (var p3 in s5) - if (Object.prototype.hasOwnProperty.call(s5, p3)) - t4[p3] = s5[p3]; +}); +var selectiveLinesFacet = import_state3.StateField.define({ + create: () => [void 0, void 0], + update(value, tr) { + if (tr.annotation(editableRange)) { + if (tr.annotation(editableRange)[0]) { + return [ + tr.annotation(editableRange)[0], + Math.min(tr.state.doc.lines, tr.annotation(editableRange)[1]) + ]; + } + return tr.annotation(editableRange); } - return t4; + return value; + } +}); +var lineRangeToPosRange = (state, range) => { + return { + from: state.doc.line(range[0]).from, + to: state.doc.line(Math.min(state.doc.lines, range[1])).to }; - return __assign4.apply(this, arguments); -}; -var DEFAULT_SIZE = { - width: "auto", - height: "auto" -}; -var clamp = function(n2, min3, max3) { - return Math.max(Math.min(n2, max3), min3); }; -var snap = function(n2, size) { - return Math.round(n2 / size) * size; -}; -var hasDirection = function(dir, target) { - return new RegExp(dir, "i").test(target); -}; -var isTouchEvent2 = function(event) { - return Boolean(event.touches && event.touches.length); -}; -var isMouseEvent2 = function(event) { - return Boolean((event.clientX || event.clientX === 0) && (event.clientY || event.clientY === 0)); -}; -var findClosestSnap = function(n2, snapArray, snapGap) { - if (snapGap === void 0) { - snapGap = 0; - } - var closestGapIndex = snapArray.reduce(function(prev, curr, index) { - return Math.abs(curr - n2) < Math.abs(snapArray[prev] - n2) ? index : prev; - }, 0); - var gap = Math.abs(snapArray[closestGapIndex] - n2); - return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n2; -}; -var getStringSize = function(n2) { - n2 = n2.toString(); - if (n2 === "auto") { - return n2; - } - if (n2.endsWith("px")) { - return n2; - } - if (n2.endsWith("%")) { - return n2; - } - if (n2.endsWith("vh")) { - return n2; - } - if (n2.endsWith("vw")) { - return n2; - } - if (n2.endsWith("vmax")) { - return n2; - } - if (n2.endsWith("vmin")) { - return n2; - } - return n2 + "px"; -}; -var getPixelSize = function(size, parentSize, innerWidth2, innerHeight2) { - if (size && typeof size === "string") { - if (size.endsWith("px")) { - return Number(size.replace("px", "")); - } - if (size.endsWith("%")) { - var ratio = Number(size.replace("%", "")) / 100; - return parentSize * ratio; - } - if (size.endsWith("vw")) { - var ratio = Number(size.replace("vw", "")) / 100; - return innerWidth2 * ratio; - } - if (size.endsWith("vh")) { - var ratio = Number(size.replace("vh", "")) / 100; - return innerHeight2 * ratio; +var smartDelete = import_state3.EditorState.transactionFilter.of( + (tr) => { + if (tr.isUserEvent("delete") && !tr.annotation(import_state3.Transaction.userEvent).endsWith(".smart")) { + const initialSelections = tr.startState.selection.ranges.map((range) => ({ + from: range.from, + to: range.to + })); + const betterFacet = combinedRangeFacets(tr.startState.field(selectiveLinesFacet, false), tr.startState.field(frontmatterFacet, false)); + if (initialSelections.length > 0 && (betterFacet == null ? void 0 : betterFacet[0])) { + const posRange = lineRangeToPosRange( + tr.startState, + betterFacet + ); + if (tr.changes.touchesRange(0, posRange.from - 1)) { + const minFrom = Math.max(posRange.from, initialSelections[0].from); + const minTo = Math.min(posRange.to, initialSelections[0].to); + return [{ + changes: { + from: Math.min(minFrom, minTo), + to: Math.max(minFrom, minTo) + }, + annotations: import_state3.Transaction.userEvent.of( + `${tr.annotation(import_state3.Transaction.userEvent)}.smart` + ) + }]; + } + } } + return tr; } - return size; -}; -var calculateNewMax = function(parentSize, innerWidth2, innerHeight2, maxWidth, maxHeight, minWidth, minHeight) { - maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth2, innerHeight2); - maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth2, innerHeight2); - minWidth = getPixelSize(minWidth, parentSize.width, innerWidth2, innerHeight2); - minHeight = getPixelSize(minHeight, parentSize.height, innerWidth2, innerHeight2); - return { - maxWidth: typeof maxWidth === "undefined" ? void 0 : Number(maxWidth), - maxHeight: typeof maxHeight === "undefined" ? void 0 : Number(maxHeight), - minWidth: typeof minWidth === "undefined" ? void 0 : Number(minWidth), - minHeight: typeof minHeight === "undefined" ? void 0 : Number(minHeight) - }; -}; -var definedProps = [ - "as", - "style", - "className", - "grid", - "snap", - "bounds", - "boundsByDirection", - "size", - "defaultSize", - "minWidth", - "minHeight", - "maxWidth", - "maxHeight", - "lockAspectRatio", - "lockAspectRatioExtraWidth", - "lockAspectRatioExtraHeight", - "enable", - "handleStyles", - "handleClasses", - "handleWrapperStyle", - "handleWrapperClass", - "children", - "onResizeStart", - "onResize", - "onResizeStop", - "handleComponent", - "scale", - "resizeRatio", - "snapGap" -]; -var baseClassName = "__resizable_base__"; -var Resizable = function(_super) { - __extends3(Resizable2, _super); - function Resizable2(props2) { - var _this = _super.call(this, props2) || this; - _this.ratio = 1; - _this.resizable = null; - _this.parentLeft = 0; - _this.parentTop = 0; - _this.resizableLeft = 0; - _this.resizableRight = 0; - _this.resizableTop = 0; - _this.resizableBottom = 0; - _this.targetLeft = 0; - _this.targetTop = 0; - _this.appendBase = function() { - if (!_this.resizable || !_this.window) { - return null; - } - var parent = _this.parentNode; - if (!parent) { - return null; - } - var element = _this.window.document.createElement("div"); - element.style.width = "100%"; - element.style.height = "100%"; - element.style.position = "absolute"; - element.style.transform = "scale(0, 0)"; - element.style.left = "0"; - element.style.flex = "0 0 100%"; - if (element.classList) { - element.classList.add(baseClassName); - } else { - element.className += baseClassName; - } - parent.appendChild(element); - return element; - }; - _this.removeBase = function(base2) { - var parent = _this.parentNode; - if (!parent) { - return; +); +var preventModifyTargetRanges = import_state3.EditorState.transactionFilter.of( + (tr) => { + const newTrans = []; + try { + const editableLines = tr.startState.field(selectiveLinesFacet, false); + const contentLines = tr.startState.field(frontmatterFacet, false); + const selectiveLines = combinedRangeFacets(editableLines, contentLines); + if (tr.isUserEvent("input") || tr.isUserEvent("delete") || tr.isUserEvent("move")) { + if (selectiveLines == null ? void 0 : selectiveLines[0]) { + const posRange = lineRangeToPosRange( + tr.startState, + selectiveLines + ); + if (!tr.changes.touchesRange(posRange.from, posRange.to)) { + return []; + } + } } - parent.removeChild(base2); - }; - _this.ref = function(c4) { - if (c4) { - _this.resizable = c4; + if (tr.state.doc.lines != tr.startState.doc.lines) { + const numberNewLines = tr.state.doc.lines - tr.startState.doc.lines; + if (selectiveLines == null ? void 0 : selectiveLines[0]) { + const posRange = lineRangeToPosRange( + tr.startState, + selectiveLines + ); + if (tr.changes.touchesRange(0, posRange.from - 1)) { + const newAnnotations = []; + if (editableLines[0]) { + newAnnotations.push(editableRange.of([ + editableLines[0] + numberNewLines, + editableLines[1] + numberNewLines + ])); + } + if (contentLines[0]) { + newAnnotations.push(contentRange.of([ + contentLines[0] + numberNewLines, + contentLines[1] + numberNewLines + ])); + } + newTrans.push({ + annotations: newAnnotations + }); + } else if (tr.changes.touchesRange(posRange.from - 1, posRange.to)) { + const newAnnotations = []; + if (editableLines[0]) { + newAnnotations.push(editableRange.of([ + editableLines[0], + editableLines[1] + numberNewLines + ])); + } + if (contentLines[0]) { + newAnnotations.push(contentRange.of([ + contentLines[0], + contentLines[1] + numberNewLines + ])); + } + newTrans.push({ + annotations: newAnnotations + }); + } + } } - }; - _this.state = { - isResizing: false, - width: typeof (_this.propsSize && _this.propsSize.width) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.width, - height: typeof (_this.propsSize && _this.propsSize.height) === "undefined" ? "auto" : _this.propsSize && _this.propsSize.height, - direction: "right", - original: { - x: 0, - y: 0, - width: 0, - height: 0 - }, - backgroundStyle: { - height: "100%", - width: "100%", - backgroundColor: "rgba(0,0,0,0)", - cursor: "auto", - opacity: 0, - position: "fixed", - zIndex: 9999, - top: "0", - left: "0", - bottom: "0", - right: "0" - }, - flexBasis: void 0 - }; - _this.onResizeStart = _this.onResizeStart.bind(_this); - _this.onMouseMove = _this.onMouseMove.bind(_this); - _this.onMouseUp = _this.onMouseUp.bind(_this); - return _this; + } catch (e4) { + return []; + } + return [tr, ...newTrans]; } - Object.defineProperty(Resizable2.prototype, "parentNode", { - get: function() { - if (!this.resizable) { - return null; - } - return this.resizable.parentNode; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Resizable2.prototype, "window", { - get: function() { - if (!this.resizable) { - return null; +); +var readOnlyRangesExtension = [smartDelete, preventModifyTargetRanges]; +var editBlockExtensions = () => [ + readOnlyRangesExtension, + hideLine, + selectiveLinesFacet, + frontmatterFacet +]; + +// src/cm-extensions/flowEditor/atomic.ts +var arrowKeyAnnotation = import_state4.Annotation.define(); +var atomicSelect = import_state4.EditorState.transactionFilter.of( + (tr) => { + if (tr.isUserEvent("delete") || tr.isUserEvent("input")) { + return tr; + } + const flowID = tr.startState.field(flowIDStateField, false); + if (tr.annotation(arrowKeyAnnotation) && flowID) { + const oldSel = tr.startState.selection.main; + const lineRange = tr.state.field(selectiveLinesFacet, false); + const posRange = lineRange && lineRange[0] != void 0 ? lineRangeToPosRange(tr.startState, lineRange) : { from: 0, to: tr.startState.doc.length }; + if (oldSel.from <= posRange.from && tr.annotation(arrowKeyAnnotation) == 3) { + focusFlowEditorParent(flowID, true); } - if (!this.resizable.ownerDocument) { - return null; + if (oldSel.to >= posRange.to && tr.annotation(arrowKeyAnnotation) == 4) { + focusFlowEditorParent(flowID, false); } - return this.resizable.ownerDocument.defaultView; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Resizable2.prototype, "propsSize", { - get: function() { - return this.props.size || this.props.defaultSize || DEFAULT_SIZE; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Resizable2.prototype, "size", { - get: function() { - var width = 0; - var height = 0; - if (this.resizable && this.window) { - var orgWidth = this.resizable.offsetWidth; - var orgHeight = this.resizable.offsetHeight; - var orgPosition = this.resizable.style.position; - if (orgPosition !== "relative") { - this.resizable.style.position = "relative"; + return tr; + } + const selection = tr.newSelection.main; + if (selection.from == 0 && selection.to == 0 || selection.from != selection.to) + return tr; + const flowEditors = tr.state.field(flowEditorInfo, false); + if (flowEditors) { + for (const info of flowEditors) { + if (info.embed == 1) { + if (info.from - 3 <= selection.from && info.to + 2 >= selection.to && info.expandedState == 2) { + const top = tr.annotation(arrowKeyAnnotation) == 1 || tr.startState.selection.main.from > selection.from ? false : true; + focusFlowEditor(info.id, top); + return { + selection: import_state4.EditorSelection.single(info.from - 4) + }; + break; + } } - width = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : orgWidth; - height = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : orgHeight; - this.resizable.style.position = orgPosition; } - return { width, height }; + } + return tr; + } +); + +// src/components/Space/Editor/EmbedView/EmbedContextView.tsx +var import_obsidian32 = require("obsidian"); +init_compat_module(); + +// src/components/Space/Frames/ViewNodes/FrameRoot.tsx +var import_lodash10 = __toESM(require_lodash()); +init_compat_module(); + +// src/components/Space/Frames/ViewNodes/FrameView.tsx +init_compat_module(); + +// src/components/Space/Frames/EditorNodes/IconNodeView.tsx +init_compat_module(); +var IconNodeView = (props2) => { + var _a2, _b2, _c2; + const { saveNodes } = q2(FramesEditorContext); + const selectIcon = () => { + const vaultChangeModal = new stickerModal( + props2.plugin.app, + props2.plugin, + (emoji) => saveNodes([ + { + ...props2.treeNode.node, + props: { ...props2.treeNode.node.props, value: wrapQuotes(emoji) } + } + ]) + ); + vaultChangeModal.open(); + }; + return props2.instance.state[props2.treeNode.id] && (((_b2 = (_a2 = props2.instance.state[props2.treeNode.id].props) == null ? void 0 : _a2.value) == null ? void 0 : _b2.length) > 0 ? /* @__PURE__ */ Cn.createElement(Sticker, { + sticker: (_c2 = props2.instance.state[props2.treeNode.id].props) == null ? void 0 : _c2.value, + plugin: props2.plugin + }) : props2.editable ? /* @__PURE__ */ Cn.createElement("div", { + onClick: () => selectIcon(), + className: "mk-frame-placeholder" + }, "Select Icon") : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); +}; + +// src/components/Space/Frames/EditorNodes/ImageNodeView.tsx +init_compat_module(); +var ImageNodeView = (props2) => { + var _a2, _b2; + const value = props2.instance.state[props2.treeNode.id].props.value; + const file = F2(() => { + const f4 = getAbstractFileAtPath(app, value); + return f4 ? app.vault.getResourcePath(f4) : value; + }, [value]); + return props2.instance.state[props2.treeNode.id] && /* @__PURE__ */ Cn.createElement("img", { + style: { + width: (_a2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _a2.styles.width, + height: (_b2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _b2.styles.height }, - enumerable: false, - configurable: true + src: file }); - Object.defineProperty(Resizable2.prototype, "sizeStyle", { - get: function() { - var _this = this; - var size = this.props.size; - var getSize = function(key2) { - if (typeof _this.state[key2] === "undefined" || _this.state[key2] === "auto") { - return "auto"; - } - if (_this.propsSize && _this.propsSize[key2] && _this.propsSize[key2].toString().endsWith("%")) { - if (_this.state[key2].toString().endsWith("%")) { - return _this.state[key2].toString(); +}; + +// src/components/Space/Frames/EditorNodes/SpaceNodeView.tsx +init_compat_module(); +function parseContent(input) { + const regex1 = /!\[!\[(.*?)\]\]/; + const regex2 = /!!\[\[(.*?)\]\]/; + const match1 = input.match(regex1); + const match2 = input.match(regex2); + return match1 ? match1[1] : match2 ? match2[1] : input; +} +var SpaceNodeView = (props2) => { + var _a2, _b2; + const fullPath = (_b2 = (_a2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _a2.props) == null ? void 0 : _b2.value; + const path = fullPath ? uriByString(parseContent(fullPath)) : null; + const { saveNodes } = q2(FramesEditorContext); + const selectLink = (e4) => { + showSpacesMenu( + e4, + props2.plugin, + (link) => saveNodes([ + { + ...props2.treeNode.node, + props: { + ...props2.treeNode.node.props, + value: wrapQuotes(link + "#^files") } - var parentSize = _this.getParentSize(); - var value = Number(_this.state[key2].toString().replace("px", "")); - var percent = value / parentSize[key2] * 100; - return percent + "%"; } - return getStringSize(_this.state[key2]); - }; - var width = size && typeof size.width !== "undefined" && !this.state.isResizing ? getStringSize(size.width) : getSize("width"); - var height = size && typeof size.height !== "undefined" && !this.state.isResizing ? getStringSize(size.height) : getSize("height"); - return { width, height }; - }, - enumerable: false, - configurable: true - }); - Resizable2.prototype.getParentSize = function() { - if (!this.parentNode) { - if (!this.window) { - return { width: 0, height: 0 }; - } - return { width: this.window.innerWidth, height: this.window.innerHeight }; - } - var base2 = this.appendBase(); - if (!base2) { - return { width: 0, height: 0 }; - } - var wrapChanged = false; - var wrap = this.parentNode.style.flexWrap; - if (wrap !== "wrap") { - wrapChanged = true; - this.parentNode.style.flexWrap = "wrap"; - } - base2.style.position = "relative"; - base2.style.minWidth = "100%"; - base2.style.minHeight = "100%"; - var size = { - width: base2.offsetWidth, - height: base2.offsetHeight - }; - if (wrapChanged) { - this.parentNode.style.flexWrap = wrap; - } - this.removeBase(base2); - return size; - }; - Resizable2.prototype.bindEvents = function() { - if (this.window) { - this.window.addEventListener("mouseup", this.onMouseUp); - this.window.addEventListener("mousemove", this.onMouseMove); - this.window.addEventListener("mouseleave", this.onMouseUp); - this.window.addEventListener("touchmove", this.onMouseMove, { - capture: true, - passive: false - }); - this.window.addEventListener("touchend", this.onMouseUp); - } - }; - Resizable2.prototype.unbindEvents = function() { - if (this.window) { - this.window.removeEventListener("mouseup", this.onMouseUp); - this.window.removeEventListener("mousemove", this.onMouseMove); - this.window.removeEventListener("mouseleave", this.onMouseUp); - this.window.removeEventListener("touchmove", this.onMouseMove, true); - this.window.removeEventListener("touchend", this.onMouseUp); - } - }; - Resizable2.prototype.componentDidMount = function() { - if (!this.resizable || !this.window) { - return; - } - var computedStyle = this.window.getComputedStyle(this.resizable); - this.setState({ - width: this.state.width || this.size.width, - height: this.state.height || this.size.height, - flexBasis: computedStyle.flexBasis !== "auto" ? computedStyle.flexBasis : void 0 - }); - }; - Resizable2.prototype.componentWillUnmount = function() { - if (this.window) { - this.unbindEvents(); - } - }; - Resizable2.prototype.createSizeForCssProperty = function(newSize, kind) { - var propsSize = this.propsSize && this.propsSize[kind]; - return this.state[kind] === "auto" && this.state.original[kind] === newSize && (typeof propsSize === "undefined" || propsSize === "auto") ? "auto" : newSize; - }; - Resizable2.prototype.calculateNewMaxFromBoundary = function(maxWidth, maxHeight) { - var boundsByDirection = this.props.boundsByDirection; - var direction = this.state.direction; - var widthByDirection = boundsByDirection && hasDirection("left", direction); - var heightByDirection = boundsByDirection && hasDirection("top", direction); - var boundWidth; - var boundHeight; - if (this.props.bounds === "parent") { - var parent_1 = this.parentNode; - if (parent_1) { - boundWidth = widthByDirection ? this.resizableRight - this.parentLeft : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft); - boundHeight = heightByDirection ? this.resizableBottom - this.parentTop : parent_1.offsetHeight + (this.parentTop - this.resizableTop); - } - } else if (this.props.bounds === "window") { - if (this.window) { - boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft; - boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop; - } - } else if (this.props.bounds) { - boundWidth = widthByDirection ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft); - boundHeight = heightByDirection ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop); - } - if (boundWidth && Number.isFinite(boundWidth)) { - maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth; - } - if (boundHeight && Number.isFinite(boundHeight)) { - maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight; - } - return { maxWidth, maxHeight }; - }; - Resizable2.prototype.calculateNewSizeFromDirection = function(clientX, clientY) { - var scale = this.props.scale || 1; - var resizeRatio = this.props.resizeRatio || 1; - var _a2 = this.state, direction = _a2.direction, original = _a2.original; - var _b2 = this.props, lockAspectRatio = _b2.lockAspectRatio, lockAspectRatioExtraHeight = _b2.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b2.lockAspectRatioExtraWidth; - var newWidth = original.width; - var newHeight = original.height; - var extraHeight = lockAspectRatioExtraHeight || 0; - var extraWidth = lockAspectRatioExtraWidth || 0; - if (hasDirection("right", direction)) { - newWidth = original.width + (clientX - original.x) * resizeRatio / scale; - if (lockAspectRatio) { - newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; - } - } - if (hasDirection("left", direction)) { - newWidth = original.width - (clientX - original.x) * resizeRatio / scale; - if (lockAspectRatio) { - newHeight = (newWidth - extraWidth) / this.ratio + extraHeight; - } - } - if (hasDirection("bottom", direction)) { - newHeight = original.height + (clientY - original.y) * resizeRatio / scale; - if (lockAspectRatio) { - newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; - } - } - if (hasDirection("top", direction)) { - newHeight = original.height - (clientY - original.y) * resizeRatio / scale; - if (lockAspectRatio) { - newWidth = (newHeight - extraHeight) * this.ratio + extraWidth; - } - } - return { newWidth, newHeight }; - }; - Resizable2.prototype.calculateNewSizeFromAspectRatio = function(newWidth, newHeight, max3, min3) { - var _a2 = this.props, lockAspectRatio = _a2.lockAspectRatio, lockAspectRatioExtraHeight = _a2.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a2.lockAspectRatioExtraWidth; - var computedMinWidth = typeof min3.width === "undefined" ? 10 : min3.width; - var computedMaxWidth = typeof max3.width === "undefined" || max3.width < 0 ? newWidth : max3.width; - var computedMinHeight = typeof min3.height === "undefined" ? 10 : min3.height; - var computedMaxHeight = typeof max3.height === "undefined" || max3.height < 0 ? newHeight : max3.height; - var extraHeight = lockAspectRatioExtraHeight || 0; - var extraWidth = lockAspectRatioExtraWidth || 0; - if (lockAspectRatio) { - var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth; - var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth; - var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight; - var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight; - var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth); - var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth); - var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight); - var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight); - newWidth = clamp(newWidth, lockedMinWidth, lockedMaxWidth); - newHeight = clamp(newHeight, lockedMinHeight, lockedMaxHeight); - } else { - newWidth = clamp(newWidth, computedMinWidth, computedMaxWidth); - newHeight = clamp(newHeight, computedMinHeight, computedMaxHeight); - } - return { newWidth, newHeight }; - }; - Resizable2.prototype.setBoundingClientRect = function() { - if (this.props.bounds === "parent") { - var parent_2 = this.parentNode; - if (parent_2) { - var parentRect = parent_2.getBoundingClientRect(); - this.parentLeft = parentRect.left; - this.parentTop = parentRect.top; - } - } - if (this.props.bounds && typeof this.props.bounds !== "string") { - var targetRect = this.props.bounds.getBoundingClientRect(); - this.targetLeft = targetRect.left; - this.targetTop = targetRect.top; - } - if (this.resizable) { - var _a2 = this.resizable.getBoundingClientRect(), left = _a2.left, top_1 = _a2.top, right = _a2.right, bottom = _a2.bottom; - this.resizableLeft = left; - this.resizableRight = right; - this.resizableTop = top_1; - this.resizableBottom = bottom; - } - }; - Resizable2.prototype.onResizeStart = function(event, direction) { - if (!this.resizable || !this.window) { - return; - } - var clientX = 0; - var clientY = 0; - if (event.nativeEvent && isMouseEvent2(event.nativeEvent)) { - clientX = event.nativeEvent.clientX; - clientY = event.nativeEvent.clientY; - } else if (event.nativeEvent && isTouchEvent2(event.nativeEvent)) { - clientX = event.nativeEvent.touches[0].clientX; - clientY = event.nativeEvent.touches[0].clientY; - } - if (this.props.onResizeStart) { - if (this.resizable) { - var startResize = this.props.onResizeStart(event, direction, this.resizable); - if (startResize === false) { - return; - } - } - } - if (this.props.size) { - if (typeof this.props.size.height !== "undefined" && this.props.size.height !== this.state.height) { - this.setState({ height: this.props.size.height }); - } - if (typeof this.props.size.width !== "undefined" && this.props.size.width !== this.state.width) { - this.setState({ width: this.props.size.width }); - } - } - this.ratio = typeof this.props.lockAspectRatio === "number" ? this.props.lockAspectRatio : this.size.width / this.size.height; - var flexBasis; - var computedStyle = this.window.getComputedStyle(this.resizable); - if (computedStyle.flexBasis !== "auto") { - var parent_3 = this.parentNode; - if (parent_3) { - var dir = this.window.getComputedStyle(parent_3).flexDirection; - this.flexDir = dir.startsWith("row") ? "row" : "column"; - flexBasis = computedStyle.flexBasis; - } - } - this.setBoundingClientRect(); - this.bindEvents(); - var state = { - original: { - x: clientX, - y: clientY, - width: this.size.width, - height: this.size.height - }, - isResizing: true, - backgroundStyle: __assign4(__assign4({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || "auto" }), - direction, - flexBasis - }; - this.setState(state); - }; - Resizable2.prototype.onMouseMove = function(event) { - var _this = this; - if (!this.state.isResizing || !this.resizable || !this.window) { - return; - } - if (this.window.TouchEvent && isTouchEvent2(event)) { - try { - event.preventDefault(); - event.stopPropagation(); - } catch (e4) { - } - } - var _a2 = this.props, maxWidth = _a2.maxWidth, maxHeight = _a2.maxHeight, minWidth = _a2.minWidth, minHeight = _a2.minHeight; - var clientX = isTouchEvent2(event) ? event.touches[0].clientX : event.clientX; - var clientY = isTouchEvent2(event) ? event.touches[0].clientY : event.clientY; - var _b2 = this.state, direction = _b2.direction, original = _b2.original, width = _b2.width, height = _b2.height; - var parentSize = this.getParentSize(); - var max3 = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight); - maxWidth = max3.maxWidth; - maxHeight = max3.maxHeight; - minWidth = max3.minWidth; - minHeight = max3.minHeight; - var _c2 = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c2.newHeight, newWidth = _c2.newWidth; - var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight); - if (this.props.snap && this.props.snap.x) { - newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap); - } - if (this.props.snap && this.props.snap.y) { - newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap); - } - var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight }); - newWidth = newSize.newWidth; - newHeight = newSize.newHeight; - if (this.props.grid) { - var newGridWidth = snap(newWidth, this.props.grid[0]); - var newGridHeight = snap(newHeight, this.props.grid[1]); - var gap = this.props.snapGap || 0; - newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth; - newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight; - } - var delta = { - width: newWidth - original.width, - height: newHeight - original.height - }; - if (width && typeof width === "string") { - if (width.endsWith("%")) { - var percent = newWidth / parentSize.width * 100; - newWidth = percent + "%"; - } else if (width.endsWith("vw")) { - var vw = newWidth / this.window.innerWidth * 100; - newWidth = vw + "vw"; - } else if (width.endsWith("vh")) { - var vh = newWidth / this.window.innerHeight * 100; - newWidth = vh + "vh"; - } - } - if (height && typeof height === "string") { - if (height.endsWith("%")) { - var percent = newHeight / parentSize.height * 100; - newHeight = percent + "%"; - } else if (height.endsWith("vw")) { - var vw = newHeight / this.window.innerWidth * 100; - newHeight = vw + "vw"; - } else if (height.endsWith("vh")) { - var vh = newHeight / this.window.innerHeight * 100; - newHeight = vh + "vh"; - } - } - var newState = { - width: this.createSizeForCssProperty(newWidth, "width"), - height: this.createSizeForCssProperty(newHeight, "height") - }; - if (this.flexDir === "row") { - newState.flexBasis = newState.width; - } else if (this.flexDir === "column") { - newState.flexBasis = newState.height; - } - pn(function() { - _this.setState(newState); - }); - if (this.props.onResize) { - this.props.onResize(event, direction, this.resizable, delta); - } - }; - Resizable2.prototype.onMouseUp = function(event) { - var _a2 = this.state, isResizing = _a2.isResizing, direction = _a2.direction, original = _a2.original; - if (!isResizing || !this.resizable) { - return; - } - var delta = { - width: this.size.width - original.width, - height: this.size.height - original.height - }; - if (this.props.onResizeStop) { - this.props.onResizeStop(event, direction, this.resizable, delta); - } - if (this.props.size) { - this.setState(this.props.size); - } - this.unbindEvents(); - this.setState({ - isResizing: false, - backgroundStyle: __assign4(__assign4({}, this.state.backgroundStyle), { cursor: "auto" }) - }); - }; - Resizable2.prototype.updateSize = function(size) { - this.setState({ width: size.width, height: size.height }); - }; - Resizable2.prototype.renderResizer = function() { - var _this = this; - var _a2 = this.props, enable = _a2.enable, handleStyles = _a2.handleStyles, handleClasses = _a2.handleClasses, handleWrapperStyle = _a2.handleWrapperStyle, handleWrapperClass = _a2.handleWrapperClass, handleComponent = _a2.handleComponent; - if (!enable) { - return null; - } - var resizers = Object.keys(enable).map(function(dir) { - if (enable[dir] !== false) { - return y(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null); - } - return null; - }); - return y("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers); - }; - Resizable2.prototype.render = function() { - var _this = this; - var extendsProps = Object.keys(this.props).reduce(function(acc, key2) { - if (definedProps.indexOf(key2) !== -1) { - return acc; - } - acc[key2] = _this.props[key2]; - return acc; - }, {}); - var style = __assign4(__assign4(__assign4({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 }); - if (this.state.flexBasis) { - style.flexBasis = this.state.flexBasis; - } - var Wrapper = this.props.as || "div"; - return y( - Wrapper, - __assign4({ ref: this.ref, style, className: this.props.className }, extendsProps), - this.state.isResizing && y("div", { style: this.state.backgroundStyle }), - this.props.children, - this.renderResizer() - ); - }; - Resizable2.defaultProps = { - as: "div", - onResizeStart: function() { - }, - onResize: function() { - }, - onResizeStop: function() { - }, - enable: { - top: true, - right: true, - bottom: true, - left: true, - topRight: true, - bottomRight: true, - bottomLeft: true, - topLeft: true - }, - style: {}, - grid: [1, 1], - lockAspectRatio: false, - lockAspectRatioExtraWidth: 0, - lockAspectRatioExtraHeight: 0, - scale: 1, - resizeRatio: 1, - snapGap: 0 - }; - return Resizable2; -}(w3); - -// src/components/Space/Frames/EditorNodes/FrameNodeView.tsx -init_compat_module(); - -// src/components/Space/Frames/Placeholders/ColumnPlaceholder.tsx -init_compat_module(); -var ColumnPlaceholder = (props2) => { - const { frameSchema } = q2(FramesMDBContext); - const { hoverNode } = q2(FramesEditorContext); - const { setNodeRef } = useDroppable({ - id: props2.id, - data: { - id: props2.id, - type: "item", - parent: props2.parentId, - frame: frameSchema.id - } - }); - return /* @__PURE__ */ Cn.createElement("div", { - className: `mk-frame-drop-placeholder`, - style: { width: props2.width, height: props2.height } - }, /* @__PURE__ */ Cn.createElement("div", { - className: `${props2.bottom && "mk-indicator-bottom"}`, - style: { width: props2.width, height: props2.height }, - ref: props2.type < 3 && props2.dropRef - }), /* @__PURE__ */ Cn.createElement("div", { - className: `mk-frame-column-placeholder ${props2.right && "mk-indicator-right"}`, - style: { height: props2.height }, - ref: setNodeRef - })); -}; - -// src/components/Space/Frames/EditorNodes/IconNodeView.tsx -init_compat_module(); -var IconNodeView = (props2) => { - var _a2, _b2, _c2; - const { saveNodes } = q2(FramesEditorContext); - const selectIcon = () => { - const vaultChangeModal = new stickerModal( - props2.plugin.app, - props2.plugin, - (emoji) => saveNodes([ - { - ...props2.treeNode.node, - props: { ...props2.treeNode.node.props, value: wrapQuotes(emoji) } - } - ]) - ); - vaultChangeModal.open(); - }; - return props2.instance.state[props2.treeNode.id] && (((_b2 = (_a2 = props2.instance.state[props2.treeNode.id].props) == null ? void 0 : _a2.value) == null ? void 0 : _b2.length) > 0 ? /* @__PURE__ */ Cn.createElement(Sticker, { - sticker: (_c2 = props2.instance.state[props2.treeNode.id].props) == null ? void 0 : _c2.value, - plugin: props2.plugin - }) : props2.editable ? /* @__PURE__ */ Cn.createElement("div", { - onClick: () => selectIcon(), - className: "mk-frame-placeholder" - }, "Select Icon") : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); -}; - -// src/components/Space/Frames/EditorNodes/ImageNodeView.tsx -init_compat_module(); -var ImageNodeView = (props2) => { - var _a2, _b2; - const value = props2.instance.state[props2.treeNode.id].props.value; - const file = F2(() => { - const f4 = getAbstractFileAtPath(app, value); - return f4 ? app.vault.getResourcePath(f4) : value; - }, [value]); - return props2.instance.state[props2.treeNode.id] && /* @__PURE__ */ Cn.createElement("img", { - style: { - width: (_a2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _a2.styles.width, - height: (_b2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _b2.styles.height - }, - src: file - }); -}; - -// src/components/Space/Frames/EditorNodes/SpaceNodeView.tsx -init_compat_module(); -function parseContent2(input) { - const regex1 = /!\[!\[(.*?)\]\]/; - const regex2 = /!!\[\[(.*?)\]\]/; - const match1 = input.match(regex1); - const match2 = input.match(regex2); - return match1 ? match1[1] : match2 ? match2[1] : input; -} -var SpaceNodeView = (props2) => { - var _a2, _b2; - const fullPath = (_b2 = (_a2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _a2.props) == null ? void 0 : _b2.value; - const path = fullPath ? uriByString(parseContent2(fullPath)) : null; - const { saveNodes } = q2(FramesEditorContext); - const selectLink = (e4) => { - showSpacesMenu( - e4, - props2.plugin, - (link) => saveNodes([ - { - ...props2.treeNode.node, - props: { - ...props2.treeNode.node.props, - value: wrapQuotes(link + "#^files") - } - } - ]) - ); - }; - return props2.instance.state[props2.treeNode.id] && path ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(EmbedContextView, { - plugin: props2.plugin, - path - })) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-placeholder", - onClick: (e4) => selectLink(e4) - }, "Select Space"); -}; - -// src/components/Space/Frames/EditorNodes/TextNodeView.tsx -init_compat_module(); -var TextNodeView = (props2) => { - var _a2, _b2; - const fileNameRef = _2(null); - const { saveNodes } = q2(FramesEditorContext); - const onBlur = (e4) => { - var _a3; - const newValue = e4.target.innerHTML; - if (newValue != ((_a3 = props2.instance.state[props2.treeNode.id].props) == null ? void 0 : _a3.value)) { - saveNodes([ - { - ...props2.treeNode.node, - props: { ...props2.treeNode.node.props, value: wrapQuotes(newValue) } - } - ]); + ]) + ); + }; + return props2.instance.state[props2.treeNode.id] && path ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(EmbedContextView, { + plugin: props2.plugin, + path + })) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-placeholder", + onClick: (e4) => selectLink(e4) + }, "Select Space"); +}; + +// src/components/Space/Frames/EditorNodes/TextNodeView.tsx +init_compat_module(); +var TextNodeView = (props2) => { + var _a2, _b2; + const fileNameRef = _2(null); + const { saveNodes } = q2(FramesEditorContext); + const onBlur = (e4) => { + var _a3; + const newValue = e4.target.innerHTML; + if (newValue != ((_a3 = props2.instance.state[props2.treeNode.id].props) == null ? void 0 : _a3.value)) { + saveNodes([ + { + ...props2.treeNode.node, + props: { ...props2.treeNode.node.props, value: wrapQuotes(newValue) } + } + ]); } }; const onKeyPress = (e4) => { @@ -52965,263 +52468,6 @@ var TextNodeView = (props2) => { }); }; -// src/components/Space/Frames/EditorNodes/FrameNodeView.tsx -var defaultFrameStyles = { - position: "relative" -}; -var FrameEditorNodeView = (props2) => { - var _a2, _b2; - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(Resizable, { - className: (0, import_classnames.default)( - props2.column ? "mk-frame-column" : "mk-frame-bounds" - ), - enable: props2.column ? { right: true } : { - top: true, - right: true, - bottom: true, - left: true, - topRight: true, - bottomRight: true, - bottomLeft: true, - topLeft: true - }, - onResizeStop: (e4, direction, ref2, d5) => { - props2.resize({ - width: ref2.clientWidth, - height: props2.column ? "" : ref2.clientHeight - }); - }, - onResizeStart: (e4) => { - e4.stopPropagation(); - }, - size: { - width: (_a2 = props2.size.width) != null ? _a2 : "100%", - height: (_b2 = props2.size.height) != null ? _b2 : "100%" - }, - ...props2.listeners - })); -}; -var FrameNodeView = (props2) => { - var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s; - const { - selectedNodes, - saveState, - hoverNode, - saveNodes, - deleteNode, - dragNode - } = q2(FramesEditorContext); - const { frameSchema } = q2(FramesMDBContext); - const { - attributes, - listeners, - setNodeRef, - setDraggableNodeRef, - transform, - transition - } = useSortable({ - id: frameSchema.id + props2.treeNode.id, - data: { - id: props2.treeNode.id, - type: "item", - parent: props2.treeNode.node.parentId, - frame: frameSchema.id - }, - disabled: dragNode === props2.treeNode.id, - transition: null - }); - const ref2 = _2(null); - const isSelected = selectedNodes.some((f4) => props2.treeNode.id == f4.id); - const innerComponents = props2.treeNode.node.type == "text" ? /* @__PURE__ */ Cn.createElement(TextNodeView, { - treeNode: props2.treeNode, - instance: props2.instance, - editable: !props2.treeNode.isRef - }) : props2.treeNode.node.type == "icon" ? /* @__PURE__ */ Cn.createElement(IconNodeView, { - plugin: props2.plugin, - treeNode: props2.treeNode, - instance: props2.instance, - editable: !props2.treeNode.isRef - }) : props2.treeNode.node.type == "image" ? /* @__PURE__ */ Cn.createElement(ImageNodeView, { - treeNode: props2.treeNode, - instance: props2.instance, - editable: !props2.treeNode.isRef - }) : props2.treeNode.node.type == "space" ? /* @__PURE__ */ Cn.createElement(SpaceNodeView, { - treeNode: props2.treeNode, - instance: props2.instance, - plugin: props2.plugin, - editable: !props2.treeNode.isRef - }) : props2.treeNode.node.type == "flow" ? /* @__PURE__ */ Cn.createElement(FlowNodeView, { - treeNode: props2.treeNode, - instance: props2.instance, - plugin: props2.plugin, - editable: !props2.treeNode.isRef - }) : props2.treeNode.children.map((c4, i4) => /* @__PURE__ */ Cn.createElement(SortableContext, { - key: i4, - items: props2.treeNode.children, - strategy: verticalListSortingStrategy - }, /* @__PURE__ */ Cn.createElement(FrameNodeView, { - editMode: props2.editMode, - plugin: props2.plugin, - key: i4, - treeNode: c4, - instance: props2.instance - }))); - const parseAs = (role) => role == "checkbox" || role == "text" || role == "range" || role == "number" ? "input" : role; - const tag = (_c2 = parseAs((_b2 = (_a2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _a2.styles) == null ? void 0 : _b2.as)) != null ? _c2 : "div"; - const type = tag == "input" ? (_e2 = (_d2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _d2.styles) == null ? void 0 : _e2.as : null; - const onResize = (size) => { - saveNodes([ - { - ...props2.treeNode.node, - styles: { ...props2.treeNode.node.styles, ...size } - } - ]); - }; - const selectNode = (nodes) => { - const evt = new CustomEvent(eventTypes.frameLayerSelected, { - detail: { selection: nodes.map((f4) => f4.id) } - }); - window.dispatchEvent(evt); - }; - const onClick = (e4) => { - var _a3, _b3; - if (isSelected) - return; - if (typeof ((_a3 = props2.instance.state[props2.treeNode.id].actions) == null ? void 0 : _a3.onClick) == "function") { - (_b3 = props2.instance.state[props2.treeNode.id].actions) == null ? void 0 : _b3.onClick( - e4, - props2.instance.state, - (s5) => saveState(s5, props2.instance), - props2.plugin.index.api - ); - e4.stopPropagation(); - } else if (props2.editMode > 1) { - if (e4.shiftKey) { - selectNode([ - ...selectedNodes.filter((f4) => f4.id != props2.treeNode.node.id), - props2.treeNode.node - ]); - } else { - selectNode([props2.treeNode.node]); - } - e4.stopPropagation(); - } - }; - const onKeyDown = (e4) => { - if (e4.key == "Backspace" || e4.key == "Delete") { - deleteNode(props2.treeNode.node); - } - }; - const canInteract = props2.editMode > 0 && !props2.treeNode.isRef && (props2.treeNode.node.type != "group" || props2.treeNode.parentType == "column" || props2.treeNode.children.length == 0); - const canDrag = canInteract && ((_f = props2.treeNode.node.parentId) == null ? void 0 : _f.length) > 0; - const canResize = props2.editMode > 1 && isSelected && canDrag || props2.treeNode.node.type == "image" || props2.treeNode.node.type == "column"; - const hasDragHandle = canInteract && props2.treeNode.node.type != "column" && ((_g = props2.treeNode.node.parentId) == null ? void 0 : _g.length) > 0 && props2.editMode == 1; - const columnPlaceholderPosition = dragNode && props2.editMode == 1 && props2.treeNode.node.id != props2.instance.root.id && !props2.treeNode.isRef ? props2.treeNode.node.type != "column" ? props2.treeNode.parentType != "column" ? 1 : 2 : 3 : 0; - const canDrop = canInteract || props2.editMode == 2; - const hasContextMenu = hasDragHandle || props2.editMode == 2 && props2.treeNode.node.parentId == props2.instance.root.id; - const inner = tag == "input" ? /* @__PURE__ */ Cn.createElement("input", { - "data-path": props2.treeNode.id, - type, - onChange: (e4) => { - var _a3, _b3; - if (typeof ((_a3 = props2.instance.state[props2.treeNode.id].actions) == null ? void 0 : _a3.onChange) == "function") { - (_b3 = props2.instance.state[props2.treeNode.id].actions) == null ? void 0 : _b3.onChange( - e4.target.value, - props2.instance.state, - (s5) => saveState(s5, props2.instance), - props2.plugin.index.api - ); - } - }, - style: { - "--translate-x": `${(_h = transform == null ? void 0 : transform.x) != null ? _h : 0}px`, - "--translate-y": `${(_i = transform == null ? void 0 : transform.y) != null ? _i : 0}px`, - ...(_j = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _j.styles - } - }) : Cn.createElement( - tag, - { - type, - ref: (el) => { - ref2.current = el; - }, - className: `mk-frame ${(_m = (_l = (_k = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _k.styles) == null ? void 0 : _l.class) != null ? _m : ""}`, - "data-path": props2.treeNode.id, - onContextMenu: (e4) => { - hasContextMenu && showNodePropsMenu( - e4, - props2.plugin, - props2.treeNode.node, - saveNodes, - deleteNode - ); - }, - onClick, - style: { - ...defaultFrameStyles, - ...(_n2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _n2.styles, - "--translate-x": `${(_o = transform == null ? void 0 : transform.x) != null ? _o : 0}px`, - "--translate-y": `${(_p = transform == null ? void 0 : transform.y) != null ? _p : 0}px`, - transition, - ...props2.editMode == -1 && props2.treeNode.node.parentId == props2.instance.root.id ? { left: 0, top: 0 } : {} - }, - ...props2.editMode == 2 || canDrag ? { ...attributes } : {} - }, - [ - ...[ - columnPlaceholderPosition > 0 ? /* @__PURE__ */ Cn.createElement(ColumnPlaceholder, { - parentId: props2.treeNode.node.parentId, - key: `|${props2.treeNode.node.id}`, - bottom: hoverNode == props2.treeNode.id, - right: hoverNode == `|${props2.treeNode.node.id}`, - plugin: props2.plugin, - height: `100%`, - width: `${columnPlaceholderPosition != 3 ? (_q = ref2.current) == null ? void 0 : _q.parentElement.clientWidth : (_r = ref2.current) == null ? void 0 : _r.clientWidth}px`, - id: `|${props2.treeNode.node.id}`, - type: columnPlaceholderPosition, - dropRef: setNodeRef - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) - ], - ...canResize ? [ - /* @__PURE__ */ Cn.createElement(FrameEditorNodeView, { - key: props2.treeNode.id, - size: (_s = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _s.styles, - column: props2.treeNode.node.type == "column", - resize: onResize, - listeners - }) - ] : [], - ...canDrag && props2.editMode > 1 && !isSelected ? [ - /* @__PURE__ */ Cn.createElement("div", { - key: props2.treeNode.id, - tabIndex: -1, - className: (0, import_classnames.default)( - "mk-frame-bounds", - dragNode == props2.treeNode.id ? "is-selected" : "" - ), - onKeyDown, - ...listeners - }) - ] : [], - innerComponents - ] - ); - return props2.instance.state[props2.treeNode.id] && (hasDragHandle ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-f" - }, inner, /* @__PURE__ */ Cn.createElement(FrameHoverMenu, { - key: props2.treeNode.id, - plugin: props2.plugin, - node: props2.treeNode.node, - rootProps: Object.keys(props2.instance.root.node.props).map((f4) => ({ - name: f4, - schemaId: props2.instance.root.id, - type: props2.instance.root.node.types[f4] - })), - dragRef: setDraggableNodeRef, - listeners - })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, inner)); -}; - // src/components/Space/Frames/ViewNodes/FrameView.tsx var FrameView = (props2) => { var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i; @@ -53249,9 +52495,9 @@ var FrameView = (props2) => { plugin: props2.plugin, source: props2.source, editable: false - }) : props2.treeNode.children.map((c4, i4) => /* @__PURE__ */ Cn.createElement(FrameView, { + }) : props2.treeNode.children.map((c4, i5) => /* @__PURE__ */ Cn.createElement(FrameView, { plugin: props2.plugin, - key: i4, + key: i5, treeNode: c4, instance: props2.instance, saveState: props2.saveState, @@ -53271,7 +52517,7 @@ var FrameView = (props2) => { (_b3 = props2.instance.state[props2.treeNode.id].actions) == null ? void 0 : _b3.onClick( e4, props2.instance.state, - (s5) => props2.saveState(s5, props2.instance), + (s6) => props2.saveState(s6, props2.instance), props2.plugin.index.api ); e4.stopPropagation(); @@ -53306,9 +52552,9 @@ var FrameRootView = (props2) => { saveState, root2, runID - ).then((s5) => { - setInstance((p3) => s5); - activeRunID.current = s5.id; + ).then((s6) => { + setInstance((p3) => s6); + activeRunID.current = s6.id; }); } }; @@ -53329,9 +52575,9 @@ var FrameRootView = (props2) => { runID, state ).then( - (s5) => setInstance((p3) => ({ - ...s5, - root: replaceSubtree(p3.root, s5.root) + (s6) => setInstance((p3) => ({ + ...s6, + root: replaceSubtree(p3.root, s6.root) })) ); }; @@ -53358,16 +52604,40 @@ init_hooks_module(); init_compat_module(); // src/components/Space/Contexts/CardsView/CardsView.tsx -var import_classnames4 = __toESM(require_classnames()); +var import_classnames3 = __toESM(require_classnames()); init_compat_module(); init_compat_module(); +// src/utils/ui/selection.ts +var selectNextIndex = (currIndex, array) => { + if (!currIndex && array.length > 0) + return array[0]; + const pos = array.indexOf(currIndex); + if (pos < array.length - 1) + return array[pos + 1]; + return currIndex; +}; +var selectPrevIndex = (currIndex, array) => { + const pos = array.indexOf(currIndex); + if (pos > 0) + return array[pos - 1]; + return array[0]; +}; +var selectRange = (currSel, newSel, array) => { + const lastIndex = array.findIndex((f4) => f4 == currSel); + const newIndex = array.findIndex((f4) => f4 == newSel); + if (lastIndex < newIndex) { + return array.filter((f4, i5) => i5 > lastIndex && i5 <= newIndex); + } + return array.filter((f4, i5) => i5 < lastIndex && i5 >= newIndex); +}; + // src/components/Space/Contexts/CardsView/CardColumnView.tsx -var import_classnames2 = __toESM(require_classnames()); +var import_classnames = __toESM(require_classnames()); init_compat_module(); var CardColumnView = k3( ({ - id: id2, + id: id3, children, columns = 1, handleProps, @@ -53395,7 +52665,7 @@ var CardColumnView = k3( ...style, "--columns": columns }, - className: (0, import_classnames2.default)( + className: (0, import_classnames.default)( "mk-list-group", unstyled && "unstyled", horizontal && "horizontal", @@ -53411,14 +52681,14 @@ var CardColumnView = k3( }, /* @__PURE__ */ Cn.createElement(DataTypeView, { initialValue: label, plugin, - file, + row: { File: file }, column: field, editable: false, updateValue: (value) => updateValue2( field.name, value, field.table, - parseInt(id2) * -1, + parseInt(id3) * -1, file ), updateFieldValue: (value, fieldValue) => updateFieldValue( @@ -53426,7 +52696,7 @@ var CardColumnView = k3( fieldValue, value, field.table, - parseInt(id2) * -1, + parseInt(id3) * -1, file ), contextTable @@ -53456,8 +52726,62 @@ var CardFrame = (props2) => { }; // src/components/Space/Contexts/CardsView/CardView.tsx -var import_classnames3 = __toESM(require_classnames()); +var import_classnames2 = __toESM(require_classnames()); init_compat_module(); + +// src/components/Space/Contexts/DataTypeView/PreviewCell.tsx +init_compat_module(); +var PreviewCell = (props2) => { + var _a2; + const [vaultItem, setVaultItem] = h2(null); + const previewImage = F2(() => { + if (vaultItem == null ? void 0 : vaultItem.banner) + return vaultItem.banner; + if (props2.initialValue) + return props2.initialValue; + if (!props2.row || !props2.columns) + return null; + const imageCol = props2.columns.find((f4) => f4.type == "image"); + if (!imageCol) + return null; + return props2.row[imageCol.name + imageCol.table]; + }, [props2.row, props2.columns]); + const previewFile = F2(() => { + return getAbstractFileAtPath(app, previewImage); + }, [previewImage]); + const loadIcon = () => { + setVaultItem(props2.plugin.index.filesIndex.get(props2.file)); + }; + p2(() => { + loadIcon(); + window.addEventListener(eventTypes.spacesChange, loadIcon); + return () => { + window.removeEventListener(eventTypes.spacesChange, loadIcon); + }; + }, [props2.file]); + return previewImage ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-preview", + style: { + backgroundSize: "cover", + backgroundPositionY: "50%", + backgroundImage: `url(${previewFile ? app.vault.getResourcePath(previewFile) : previewImage})` + } + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-preview", + style: ((_a2 = vaultItem == null ? void 0 : vaultItem.color) == null ? void 0 : _a2.length) > 0 ? { + "--label-color": `${vaultItem.color}`, + "--icon-color": `#ffffff` + } : { + "--label-color": `var(--background-secondary-alt)`, + "--icon-color": `var(--text-muted)` + } + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-icon", + dangerouslySetInnerHTML: (vaultItem == null ? void 0 : vaultItem.sticker) ? { __html: stickerFromString(vaultItem.sticker, props2.plugin) } : (vaultItem == null ? void 0 : vaultItem.isFolder) ? { __html: uiIconSet["mk-ui-folder"] } : { __html: uiIconSet["mk-ui-file"] } + })); +}; + +// src/components/Space/Contexts/CardsView/CardView.tsx var CardView = Cn.memo( Cn.forwardRef( ({ @@ -53476,7 +52800,7 @@ var CardView = Cn.memo( renderItem, plugin, leaf, - id: id2, + id: id3, sorting, style, transition, @@ -53508,7 +52832,7 @@ var CardView = Cn.memo( }, [dragOverlay]); const [openFlow, setOpenFlow] = h2(false); return renderItem ? /* @__PURE__ */ Cn.createElement("li", { - className: (0, import_classnames3.default)( + className: (0, import_classnames2.default)( fadeIn && "fadeIn", sorting && "sorting", dragOverlay && "dragOverlay", @@ -53540,7 +52864,7 @@ var CardView = Cn.memo( value, predicate })) : /* @__PURE__ */ Cn.createElement("li", { - className: (0, import_classnames3.default)( + className: (0, import_classnames2.default)( "mk-list-item", fadeIn && "fadeIn", sorting && "sorting", @@ -53559,35 +52883,18 @@ var CardView = Cn.memo( "--color": color }, ref: ref2 - }, value && cols.filter((f4) => f4.type == "preview" && f4.table == "").map((f4, i4) => /* @__PURE__ */ Cn.createElement(DataTypeView, { + }, value && /* @__PURE__ */ Cn.createElement(PreviewCell, { row: value, - key: i4, - cols, + columns: cols, plugin, - initialValue: value[f4.name + f4.table], - column: f4, - file: value[FilePropertyName], - editable: false, - updateValue: (v3) => updateValue2( - f4.name, - v3, - f4.table, - parseInt(id2), - value[FilePropertyName] - ), - updateFieldValue: (v3, fv) => updateFieldValue( - f4.name, - fv, - v3, - f4.table, - parseInt(id2), - value[FilePropertyName] - ), - contextTable - })), /* @__PURE__ */ Cn.createElement("div", { + initialValue: "", + saveValue: () => { + }, + file: value[FilePropertyName] + }), /* @__PURE__ */ Cn.createElement("div", { className: "mk-list-content" }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames3.default)( + className: (0, import_classnames2.default)( "mk-list-fields", dragging && "dragging", handle && "withHandle", @@ -53607,21 +52914,21 @@ var CardView = Cn.memo( plugin, initialValue: value[f4.name + f4.table], column: f4, - file: value[FilePropertyName], + row: value, editable: false, - updateValue: (v3) => updateValue2( + updateValue: (v4) => updateValue2( f4.name, - v3, + v4, f4.table, - parseInt(id2), + parseInt(id3), value[FilePropertyName] ), - updateFieldValue: (v3, fv) => updateFieldValue( + updateFieldValue: (v4, fv) => updateFieldValue( f4.name, fv, - v3, + v4, f4.table, - parseInt(id2), + parseInt(id3), value[FilePropertyName] ), contextTable @@ -53642,7 +52949,7 @@ function DroppableContainer({ children, columns = 1, disabled, - id: id2, + id: id3, items, style, ...props2 @@ -53658,15 +52965,15 @@ function DroppableContainer({ transition, transform } = useSortable({ - id: id2, + id: id3, data: { type: "container" }, animateLayoutChanges }); - const isOverContainer = over ? id2 === over.id && ((_a2 = active == null ? void 0 : active.data.current) == null ? void 0 : _a2.type) !== "container" || items.includes(over.id) : false; + const isOverContainer = over ? id3 === over.id && ((_a2 = active == null ? void 0 : active.data.current) == null ? void 0 : _a2.type) !== "container" || items.includes(over.id) : false; return /* @__PURE__ */ Cn.createElement(CardColumnView_default, { - id: id2, + id: id3, ref: disabled ? void 0 : setNodeRef, style: { ...style, @@ -53768,7 +53075,7 @@ var CardsView = ({ }; }, [filteredData, predicate]); const containers = F2( - () => Object.keys(items).map((f4, i4) => "-" + i4.toString()), + () => Object.keys(items).map((f4, i5) => "-" + i5.toString()), [items] ); const [activeId, setActiveId] = h2(null); @@ -53792,18 +53099,18 @@ var CardsView = ({ coordinateGetter: sortableKeyboardCoordinates }) ); - const findContainer = (id2) => { - if (id2.charAt(0) == "-") { - return id2; + const findContainer = (id3) => { + if (id3.charAt(0) == "-") { + return id3; } - return "-" + Object.keys(items).findIndex((key2) => items[key2].includes(id2)).toString(); + return "-" + Object.keys(items).findIndex((key2) => items[key2].includes(id3)).toString(); }; - const getIndex = (id2) => { - const container = findContainer(id2); + const getIndex = (id3) => { + const container = findContainer(id3); if (!container) { return -1; } - const index = items[Object.keys(items)[parseInt(container) * -1]].indexOf(id2); + const index = items[Object.keys(items)[parseInt(container) * -1]].indexOf(id3); return index; }; const resetState = () => { @@ -53945,7 +53252,7 @@ var CardsView = ({ onDragCancel, modifiers }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames4.default)( + className: (0, import_classnames3.default)( viewType == "card" ? "mk-cards-container" : "mk-list-container", viewType == "card" && containers.length == 1 && "mk-cards-grid" ), @@ -53995,25 +53302,25 @@ var CardsView = ({ }, activeId ? containers.includes(activeId) ? renderContainerDragOverlay(activeId) : renderSortableItemDragOverlay(activeId) : null), document.body )); - function renderSortableItemDragOverlay(id2) { + function renderSortableItemDragOverlay(id3) { return /* @__PURE__ */ Cn.createElement("div", { className: viewType == "card" ? "mk-cards-container" : "mk-list-container" }, /* @__PURE__ */ Cn.createElement(CardView, { plugin, - value: filteredData.find((f4) => f4._index == id2), + value: filteredData.find((f4) => f4._index == id3), handle, - id: id2, + id: id3, cols: displayCols, style: getItemStyles({ - containerId: findContainer(id2), + containerId: findContainer(id3), overIndex: -1, - index: getIndex(id2), - value: id2, + index: getIndex(id3), + value: id3, isSorting: true, isDragging: true, isDragOverlay: true }), - color: getColor(id2), + color: getColor(id3), wrapperStyle: wrapperStyle({ index: 0 }), renderItem, dragOverlay: true @@ -54062,8 +53369,8 @@ var CardsView = ({ return String.fromCharCode(lastContaineId.charCodeAt(0) + 1); } }; -function getColor(id2) { - switch (id2[0]) { +function getColor(id3) { + switch (id3[0]) { case "A": return "#7193f1"; case "B": @@ -54077,7 +53384,7 @@ function getColor(id2) { } function SortableItem({ disabled, - id: id2, + id: id3, plugin, index, handle, @@ -54101,7 +53408,7 @@ function SortableItem({ transform, transition } = useSortable({ - id: id2 + id: id3 }); const mounted = useMountStatus(); const mountedWhileDragging = isDragging && !mounted; @@ -54109,7 +53416,7 @@ function SortableItem({ ref: disabled ? void 0 : setNodeRef, value, plugin, - id: id2, + id: id3, cols, dragging: isDragging, sorting: isSorting, @@ -54118,7 +53425,7 @@ function SortableItem({ wrapperStyle: wrapperStyle({ index }), style: style({ index, - value: id2, + value: id3, isDragging, isSorting, overIndex: over ? getIndex(over.id) : overIndex, @@ -54126,7 +53433,7 @@ function SortableItem({ }), onSelect, selected, - color: getColor(id2), + color: getColor(id3), transition, transform, fadeIn: mountedWhileDragging, @@ -54283,32 +53590,12 @@ function SortableItem2(props2) { } } }; - const saveContext = (field2, oldField, value) => { - const newContext = value[0]; - initiateContextIfNotExists(props2.plugin, newContext).then((f4) => { - if (f4) { - return insertContextItems( - props2.plugin, - optionValuesForColumn( - field2.name, - field2.table == "" ? tableData : contextTable[field2.table] - ), - newContext - ); - } - }).then((f4) => loadContextFields(newContext)); - const newField = { - ...field2, - value: newContext != null ? newContext : "" - }; - saveColumn(newField, oldField); - }; const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: props2.id }); const style = { transform: CSS.Transform.toString(transform), transition }; - const icon = (_b2 = props2.field.attrs) != null ? _b2 : (_a2 = fieldTypeForType(props2.field.type)) == null ? void 0 : _a2.icon; + const icon = ((_a2 = props2.field.attrs) == null ? void 0 : _a2.length) > 0 ? props2.field.attrs : (_b2 = fieldTypeForType(props2.field.type)) == null ? void 0 : _b2.icon; const selectedType = (_12, value) => { const newField = { ...props2.field, @@ -54345,7 +53632,6 @@ function SortableItem2(props2) { fields: cols, contextPath: spaceInfo.path, saveField: (newField) => saveField(newField, field), - saveContext: (newField, val) => saveContext(newField, field, val), hide: hideColumn, deleteColumn: delColumn, sortColumn, @@ -54355,320 +53641,9 @@ function SortableItem2(props2) { })); } -// src/components/Space/Frames/FrameEditorView.tsx -var import_obsidian30 = require("obsidian"); -init_compat_module(); - -// src/components/Space/Frames/FrameEditor.tsx -init_compat_module(); - -// src/components/Space/Frames/Panels/PropsPanel.tsx -init_compat_module(); -var PropsPanel = (props2) => { - const { spaceInfo } = q2(SpaceContext); - const { saveNodes, root: root2, selectedNodes } = q2(FramesEditorContext); - const saveContexts = (values, node) => { - const newRoot = { - ...node, - contexts: { - ...node.contexts, - ...values - } - }; - saveNodes([newRoot]); - }; - const saveNodeValue = (values, node) => { - const newNodes = { - ...node, - props: { - ...node.props, - ...values - } - }; - saveNodes([newNodes]); - }; - const saveRootProperty = (name) => { - saveProperty({ - schemaId: root2.node.id, - type: "text", - name - }); - }; - const { properties: properties2, saveProperty, delProperty } = q2(FramesEditorContext); - const showMenu = (e4, field) => { - const offset2 = e4.target.getBoundingClientRect(); - showPropertyMenu({ - plugin: props2.plugin, - position: { x: offset2.left, y: offset2.top + 30 }, - editable: true, - options: [], - field: { ...field, table: "" }, - fields: properties2.map((f4) => ({ ...f4, table: "" })), - contextPath: spaceInfo.path, - saveField: (newField) => saveProperty(newField, field), - saveContext: () => null, - deleteColumn: delProperty, - editCode: () => props2.editCode(root2.node.id, "props", field.name) - }); - }; - const showContextMenu = (e4) => { - const offset2 = e4.target.getBoundingClientRect(); - const f4 = loadTags(props2.plugin); - showSelectMenu( - { x: offset2.left, y: offset2.top + 30 }, - { - plugin: props2.plugin, - multi: false, - editable: true, - value: [], - options: f4.map((m5) => ({ name: m5, value: m5 })), - saveOptions: (_12, value) => addTag(value[0]), - placeholder: i18n_default.labels.contextItemSelectPlaceholder, - searchable: true, - showAll: true - } - ); - }; - const addTag = (tag) => { - saveContexts({ ...props2.contexts, [tag]: "" }, root2.node); - }; - const [newProp, setNewProp] = h2(""); - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-component" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-title" - }, "Properties"), properties2.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-row", - key: i4 - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-field", - onClick: (e4) => showMenu(e4, f4), - "aria-label": f4.type - }, f4.name), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-context-value" - }, stringIsConst(root2.node.props[f4.name]) ? /* @__PURE__ */ Cn.createElement(DataTypeView, { - plugin: props2.plugin, - initialValue: removeQuotes(root2.node.props[f4.name]), - column: { ...f4, table: "" }, - editable: !spaceInfo.readOnly, - updateFieldValue: (fieldValue, value) => { - saveProperty({ ...f4, value: fieldValue }, f4); - saveNodeValue({ [f4.name]: `"${value}"` }, root2.node); - }, - updateValue: (value) => saveNodeValue({ [f4.name]: `"${value}"` }, root2.node) - }) : /* @__PURE__ */ Cn.createElement(CodeEditorSetter, { - name: f4.name, - value: root2.node.props[f4.name], - type: "props", - node: root2.id, - editCode: props2.editCode - })))), /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement(TextCell, { - initialValue: newProp, - saveValue: (value) => saveRootProperty(value), - editMode: 2 /* EditModeActive */, - setEditMode: () => null, - plugin: props2.plugin, - propertyValue: "" - }))); -}; - -// src/components/Space/Frames/FrameEditor.tsx -var FrameEditor = (props2) => { - var _a2; - const activationConstraint = { - distance: { y: 0 }, - tolerance: { x: 0 } - }; - const mouseSensor = useSensor(MouseSensor, { - activationConstraint - }); - const touchSensor = useSensor(TouchSensor, { - activationConstraint - }); - const keyboardSensor = useSensor(KeyboardSensor, {}); - const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor); - const [tab, setTab] = h2(0); - const { frameSchema } = q2(FramesMDBContext); - const [preselectedProp, setPreselectedProp] = h2(null); - const [preselectedPropType, setPreselectedPropType] = h2(null); - const { - root: root2, - instance, - nodes, - saveNodes: saveFrames, - saveProperty, - setHoverNode, - selectNodes, - selectedNodes, - properties: properties2 - } = q2(FramesEditorContext); - const nodesSelected = (evt) => { - selectNodes( - evt.detail.selection.map((f4) => nodes.find((n2) => n2.id == f4)).filter((f4) => f4) - ); - }; - p2(() => { - window.addEventListener(eventTypes.frameLayerSelected, nodesSelected); - return () => { - window.removeEventListener(eventTypes.frameLayerSelected, nodesSelected); - }; - }, [nodes]); - const editCode = (node, key2, type) => { - setTab(1); - if (!((selectedNodes == null ? void 0 : selectedNodes.length) > 0)) { - if (selectedNodes[0].id != node) { - selectNodes(nodes); - } - } else { - } - setPreselectedProp(key2); - setPreselectedPropType(type); - }; - return /* @__PURE__ */ Cn.createElement(DndContext, { - sensors - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-editor" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-container" - }, instance.root && /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-main" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-canvas" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-props-editor" - }, /* @__PURE__ */ Cn.createElement(PropsPanel, { - contexts: (_a2 = root2.node.contexts) != null ? _a2 : {}, - plugin: props2.plugin, - editCode - })), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-frame-canvas-editor" - }, /* @__PURE__ */ Cn.createElement(FrameNodeView, { - editMode: 2, - plugin: props2.plugin, - treeNode: instance.root, - instance - }))))))); -}; - -// src/components/Space/Frames/FrameEditorView.tsx -var FRAME_EDITOR_TYPE = "mk-frame-editor"; -var openFrameEditor = async (plugin, path, schema) => { - const leaf = app.workspace.getLeaf(false); - plugin.openFileContextLeaf(); - const viewType = FRAME_EDITOR_TYPE; - app.workspace.setActiveLeaf(leaf, { focus: true }); - await leaf.setViewState({ - type: viewType, - state: { path, schema } - }); - await app.workspace.requestSaveLayout(); - if (path) { - const evt2 = new CustomEvent(eventTypes.activePathChange, { - detail: { path: uriByString(path) } - }); - window.dispatchEvent(evt2); - const evt = new CustomEvent(eventTypes.frameSelected, { - detail: { path: uriByString(path + "#*" + schema) } - }); - window.dispatchEvent(evt); - } -}; -var FrameEditorView = class extends import_obsidian30.ItemView { - constructor(leaf, plugin, viewType) { - super(leaf); - this.navigation = true; - this.plugin = plugin; - this.viewType = viewType; - } - getViewType() { - return FRAME_EDITOR_TYPE; - } - getDisplayText() { - var _a2; - return (_a2 = this.space) == null ? void 0 : _a2.name; - } - async onClose() { - this.destroy(); - } - destroy() { - if (this.root) - this.root.unmount(); - } - async onOpen() { - this.destroy(); - } - async setState(state, result) { - this.space = spaceInfoByPath(this.plugin, state.path); - this.schema = state.schema; - if (!this.space) - return; - this.constructNote(this.space, this.schema); - const displayName = pathDisplayName(this.space.uri); - await super.setState(state, result); - this.leaf.tabHeaderInnerTitleEl.innerText = displayName; - this.leaf.view.titleEl = displayName; - const headerEl = this.leaf.view.headerEl; - if (headerEl) { - headerEl.querySelector(".view-header-title").innerText = displayName; - } - result.history = true; - return; - } - getState() { - var _a2, _b2; - const state = super.getState(); - state.path = (_b2 = (_a2 = this.space) == null ? void 0 : _a2.uri) == null ? void 0 : _b2.fullPath; - state.schema = this.schema; - return state; - } - constructNote(space, schema) { - this.destroy(); - this.root = createRoot(this.contentEl); - this.root.render( - /* @__PURE__ */ Cn.createElement("div", { - className: "mk-space-view" - }, /* @__PURE__ */ Cn.createElement(SpaceContextProvider, { - plugin: this.plugin, - space - }, /* @__PURE__ */ Cn.createElement(FramesMDBProvider, { - plugin: this.plugin, - schema - }, /* @__PURE__ */ Cn.createElement(FramesEditorProvider, { - plugin: this.plugin, - props: {} - }, /* @__PURE__ */ Cn.createElement(FrameEditor, { - plugin: this.plugin - }))))) - ); - } -}; - -// src/components/Space/Frames/Placeholders/RowPlaceholder.tsx -init_compat_module(); -var RowPlaceholder = (props2) => { - const { hoverNode, root: root2 } = q2(FramesEditorContext); - const { setNodeRef } = useDroppable({ - id: props2.id, - data: { - id: props2.id, - type: "item", - parent: props2.parentId - } - }); - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: `mk-frame-row-placeholder ${hoverNode == props2.id && "mk-indicator-bottom"}`, - ref: setNodeRef - }, /* @__PURE__ */ Cn.createElement(FrameHoverMenu, { - plugin: props2.plugin, - node: root2.node, - listeners: null, - dragRef: null - }))); -}; - // src/components/ui/modals/saveViewModal.ts -var import_obsidian31 = require("obsidian"); -var SaveViewModal = class extends import_obsidian31.Modal { +var import_obsidian27 = require("obsidian"); +var SaveViewModal = class extends import_obsidian27.Modal { constructor(schema, saveSchema, action) { super(app); this.schema = schema; @@ -54795,20 +53770,21 @@ var ContextFrameView = (props2) => { cols })))) : predicate.view == "table" ? /* @__PURE__ */ Cn.createElement("div", { className: "mk-table" - }, /* @__PURE__ */ Cn.createElement("table", null, /* @__PURE__ */ Cn.createElement("tr", null, cols.map((f4, i4) => /* @__PURE__ */ Cn.createElement("th", { - key: i4, + }, /* @__PURE__ */ Cn.createElement("table", null, /* @__PURE__ */ Cn.createElement("tr", null, cols.map((f4, i5) => /* @__PURE__ */ Cn.createElement("th", { + key: i5, className: "mk-th" }, /* @__PURE__ */ Cn.createElement("div", { className: "mk-col-header" - }, f4.name)))), /* @__PURE__ */ Cn.createElement("tr", null, cols.map((f4, i4) => { + }, f4.name)))), /* @__PURE__ */ Cn.createElement("tr", null, cols.map((f4, i5) => { var _a2; return /* @__PURE__ */ Cn.createElement("td", { - key: i4, + key: i5, className: "mk-td" }, /* @__PURE__ */ Cn.createElement(DataTypeView, { column: f4, editable: false, initialValue: (_a2 = data2[0]) == null ? void 0 : _a2[f4.name], + row: data2[0], plugin: props2.plugin })); })))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)), /* @__PURE__ */ Cn.createElement("div", { @@ -54837,8 +53813,8 @@ var ContextFrameView = (props2) => { dangerouslySetInnerHTML: { __html: stickerFromString("lucide//infinity", props2.plugin) } - }), "Flow"), frameSchemas.filter((f4) => f4.type == "listitem").map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, + }), "Flow"), frameSchemas.filter((f4) => f4.type == "listitem").map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, onClick: () => selectFrame(`${spaceInfo.path}/#^${f4.id}`), onContextMenu: () => openFrameEditor(props2.plugin, spaceInfo.path, f4.id) }, /* @__PURE__ */ Cn.createElement("div", { @@ -55079,12 +54055,12 @@ var FrameListView = (props2) => { }; // src/components/ui/modals/contextEditorModal.tsx -var import_obsidian32 = require("obsidian"); +var import_obsidian28 = require("obsidian"); init_compat_module(); -var ContextEditorModal = class extends import_obsidian32.Modal { - constructor(plugin, space, db, view, type) { +var ContextEditorModal = class extends import_obsidian28.Modal { + constructor(plugin, space2, db, view, type) { super(plugin.app); - this.space = space; + this.space = space2; this.view = view; this.db = db; this.plugin = plugin; @@ -55122,8 +54098,8 @@ var ContextEditorModal = class extends import_obsidian32.Modal { }; // src/components/ui/modals/mergeColumnModal.ts -var import_obsidian33 = require("obsidian"); -var MergeColumnModal = class extends import_obsidian33.Modal { +var import_obsidian29 = require("obsidian"); +var MergeColumnModal = class extends import_obsidian29.Modal { constructor(columns, mergeColumn) { super(app); this.columns = columns; @@ -55137,17 +54113,17 @@ var MergeColumnModal = class extends import_obsidian33.Modal { const containerEl = contentEl.createEl("div"); containerEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; const select = containerEl.createEl("select"); - for (let i4 = 0; i4 < this.columns.length; i4++) { + for (let i5 = 0; i5 < this.columns.length; i5++) { const opt = document.createElement("option"); - opt.value = i4.toString(); - opt.innerHTML = this.columns[i4].name + this.columns[i4].table; + opt.value = i5.toString(); + opt.innerHTML = this.columns[i5].name + this.columns[i5].table; select.appendChild(opt); } const select2 = containerEl.createEl("select"); - for (let i4 = 0; i4 < this.columns.length; i4++) { + for (let i5 = 0; i5 < this.columns.length; i5++) { const opt = document.createElement("option"); - opt.value = i4.toString(); - opt.innerHTML = this.columns[i4].name + this.columns[i4].table; + opt.value = i5.toString(); + opt.innerHTML = this.columns[i5].name + this.columns[i5].table; select2.appendChild(opt); } const changeButtonText = i18n_default.buttons.merge; @@ -55177,7 +54153,7 @@ var MergeColumnModal = class extends import_obsidian33.Modal { }; // src/components/Space/Contexts/FilterBar/FilterBar.tsx -var import_obsidian34 = require("obsidian"); +var import_obsidian30 = require("obsidian"); init_compat_module(); // src/utils/contexts/predicate/filterFns/filterFnLabels.ts @@ -55202,26 +54178,6 @@ var filterFnLabels = { isFalse: i18n_default.filterTypes.unchecked }; -// src/components/Space/Contexts/FilterBar/SearchBar.tsx -init_compat_module(); -var SearchBar = (props2) => { - const clearSearch = () => { - props2.setSearchString(""); - }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-view-search" - }, /* @__PURE__ */ Cn.createElement("button", { - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-search"] } - }), /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("input", { - onChange: (e4) => props2.setSearchString(e4.target.value), - placeholder: i18n_default.labels.searchPlaceholder, - className: "mk-search-bar" - }), /* @__PURE__ */ Cn.createElement("button", { - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-clear"] }, - onClick: () => clearSearch() - }))); -}; - // src/components/Space/Contexts/FilterBar/FilterBar.tsx var FilterBar = (props2) => { const ctxRef = _2(null); @@ -55282,7 +54238,7 @@ var FilterBar = (props2) => { multi: false, editable: false, value: contexts, - options: views2.map((m5) => ({ name: m5.name, value: m5.id })), + options: views2.map((m6) => ({ name: m6.name, value: m6.id })), saveOptions: (_12, value) => selectView(_dbschema, value[0]), placeholder: i18n_default.labels.viewItemSelectPlaceholder, searchable: false, @@ -55313,7 +54269,7 @@ var FilterBar = (props2) => { }); }; const viewContextMenu = (e4, _schema) => { - const fileMenu = new import_obsidian34.Menu(); + const fileMenu = new import_obsidian30.Menu(); fileMenu.addSeparator(); fileMenu.addItem((menuItem) => { menuItem.setTitle("Copy Embed Link"); @@ -55328,7 +54284,7 @@ var FilterBar = (props2) => { menuItem.onClick(() => { const vaultChangeModal = new SaveViewModal( _schema, - (s5) => saveSchema(s5), + (s6) => saveSchema(s6), "rename view" ); vaultChangeModal.open(); @@ -55350,38 +54306,7 @@ var FilterBar = (props2) => { } }; const showFilterMenu = (e4) => { - const menu = new import_obsidian34.Menu(); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.tableView); - item.setIcon("table-2"); - item.onClick(() => { - saveViewType("table"); - }); - }); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.cardView); - item.setIcon("layout-grid"); - item.onClick(() => { - saveViewType("card"); - }); - }); - menu.addItem((item) => { - item.setTitle(i18n_default.menu.listView); - item.setIcon("layout-list"); - item.onClick(() => { - saveViewType("list"); - }); - }); - if (dbSchema == null ? void 0 : dbSchema.primary) { - menu.addItem((item) => { - item.setTitle(i18n_default.menu.flowView); - item.setIcon("infinity"); - item.onClick(() => { - saveViewType("flow"); - }); - }); - } - menu.addSeparator(); + const menu = new import_obsidian30.Menu(); menu.addItem((item) => { item.setTitle(i18n_default.menu.groupBy); item.setIcon("columns"); @@ -55435,7 +54360,7 @@ var FilterBar = (props2) => { savePredicate({ ...predicate, sort: [ - ...predicate.sort.filter((s5) => s5.field != newSort.field), + ...predicate.sort.filter((s6) => s6.field != newSort.field), newSort ] }); @@ -55472,7 +54397,7 @@ var FilterBar = (props2) => { savePredicate({ ...predicate, filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), + ...predicate.filters.filter((s6) => s6.field != newFilter.field), newFilter ] }); @@ -55490,7 +54415,7 @@ var FilterBar = (props2) => { savePredicate({ ...predicate, sort: [ - ...predicate.sort.filter((s5) => s5.field != newSort.field), + ...predicate.sort.filter((s6) => s6.field != newSort.field), newSort ] }); @@ -55559,8 +54484,6 @@ var FilterBar = (props2) => { fields: cols, contextPath: spaceInfo.path, saveField: (newField) => saveField(newField, field), - saveContext: (newField, val) => { - }, hide: hideColumn, deleteColumn: delColumn, sortColumn, @@ -55579,7 +54502,7 @@ var FilterBar = (props2) => { savePredicate({ ...predicate, filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), + ...predicate.filters.filter((s6) => s6.field != newFilter.field), newFilter ] }); @@ -55667,7 +54590,7 @@ var FilterBar = (props2) => { ); }; const showAddMenu = (e4) => { - const fileMenu = new import_obsidian34.Menu(); + const fileMenu = new import_obsidian30.Menu(); const folder = getAbstractFileAtPath(app, spaceInfo.path); fileMenu.addItem((menuItem) => { menuItem.setIcon("edit"); @@ -55690,8 +54613,7 @@ var FilterBar = (props2) => { const vaultChangeModal = new VaultChangeModal( props2.plugin, folder, - "create folder", - "/" + "create folder" ); vaultChangeModal.open(); }); @@ -55707,7 +54629,7 @@ var FilterBar = (props2) => { return false; }; const showFMMenu2 = (e4) => { - const menu = new import_obsidian34.Menu(); + const menu = new import_obsidian30.Menu(); menu.addItem((menuItem) => { menuItem.setIcon("log-in"); menuItem.setTitle(i18n_default.menu.mergeProperties); @@ -55723,7 +54645,7 @@ var FilterBar = (props2) => { if (toCol.table == "") { saveDB2({ ...tableData, - rows: tableData.rows.map((r3, i4) => { + rows: tableData.rows.map((r3, i5) => { const foundRow = fromTable.rows.find((f4) => f4.File == r3.File); return foundRow ? { ...r3, [toCol.name]: foundRow[fromCol.name] } : r3; }) @@ -55732,7 +54654,7 @@ var FilterBar = (props2) => { saveContextDB( { ...contextTable[toCol.table], - rows: contextTable[toCol.table].rows.map((r3, i4) => { + rows: contextTable[toCol.table].rows.map((r3, i5) => { const foundRow = fromTable.rows.find((f4) => f4.File == r3.File); return foundRow ? { ...r3, [toCol.name]: foundRow[fromCol.name] } : r3; }) @@ -55781,7 +54703,7 @@ var FilterBar = (props2) => { case "text": case "number": { - const menu = new import_obsidian34.Menu(); + const menu = new import_obsidian30.Menu(); menu.setUseNativeMenu(false); const saveFilterValue = (value) => { const newFilter = { @@ -55791,7 +54713,7 @@ var FilterBar = (props2) => { savePredicate({ ...predicate, filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), + ...predicate.filters.filter((s6) => s6.field != newFilter.field), newFilter ] }); @@ -55817,7 +54739,7 @@ var FilterBar = (props2) => { savePredicate({ ...predicate, filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), + ...predicate.filters.filter((s6) => s6.field != newFilter.field), newFilter ] }); @@ -55842,7 +54764,7 @@ var FilterBar = (props2) => { savePredicate({ ...predicate, filters: [ - ...predicate.filters.filter((s5) => s5.field != newFilter.field), + ...predicate.filters.filter((s6) => s6.field != newFilter.field), newFilter ] }); @@ -55895,8 +54817,8 @@ var FilterBar = (props2) => { className: "mk-view-config" }, /* @__PURE__ */ Cn.createElement("div", { className: "mk-view-selector" - }, views.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, + }, views.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, className: `${(schema == null ? void 0 : schema.id) == f4.id ? "mk-is-active" : ""}`, onContextMenu: (e4) => viewContextMenu(e4, f4) }, /* @__PURE__ */ Cn.createElement("button", { @@ -55905,16 +54827,37 @@ var FilterBar = (props2) => { onClick: (e4) => showSaveViewModal() }, "+")), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("div", { className: "mk-view-options" - }, /* @__PURE__ */ Cn.createElement(SearchBar, { - setSearchString + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-view-type-selector" + }, /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => saveViewType("table"), + dangerouslySetInnerHTML: { + __html: stickerFromString("lucide//table-2", props2.plugin) + } }), /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => showFilterMenu(e4), + onClick: (e4) => saveViewType("card"), dangerouslySetInnerHTML: { - __html: uiIconSet["mk-ui-view-options"] + __html: stickerFromString( + "lucide//layout-grid", + props2.plugin + ) + } + }), /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => saveViewType("list"), + dangerouslySetInnerHTML: { + __html: stickerFromString( + "lucide//layout-list", + props2.plugin + ) } }), /* @__PURE__ */ Cn.createElement("button", { onClick: (e4) => showViewsMenu(e4), dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-build"] } + })), /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => showFilterMenu(e4), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-view-options"] + } }), /* @__PURE__ */ Cn.createElement("button", { onClick: (e4) => showColsMenu(e4), dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-list"] } @@ -55931,18 +54874,18 @@ var FilterBar = (props2) => { }, predicate.groupBy[0]), /* @__PURE__ */ Cn.createElement("div", { onClick: () => saveGroupBy(null, []), dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - })), predicate.sort.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, + })), predicate.sort.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, className: "mk-filter" }, /* @__PURE__ */ Cn.createElement("span", null, f4.field), /* @__PURE__ */ Cn.createElement("span", { onClick: (e4) => changeSortMenu(e4, f4) }, sortFnTypes[f4.fn].label), /* @__PURE__ */ Cn.createElement("div", { onClick: () => removeSort(f4), dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - }))), predicate.filters.map((f4, i4) => { + }))), predicate.filters.map((f4, i5) => { var _a2; return /* @__PURE__ */ Cn.createElement("div", { - key: i4, + key: i5, className: "mk-filter" }, /* @__PURE__ */ Cn.createElement("span", null, f4.field), /* @__PURE__ */ Cn.createElement("span", { onClick: (e4) => changeFilterMenu(e4, f4) @@ -55969,8 +54912,8 @@ var FilterValueSpan = (props2) => { const options = parseMultiString(filter.value); return /* @__PURE__ */ Cn.createElement("span", { onClick: (e4) => selectFilterValue(e4, filter) - }, " ", options.map((f4, i4) => /* @__PURE__ */ Cn.createElement("span", { - key: i4 + }, " ", options.map((f4, i5) => /* @__PURE__ */ Cn.createElement("span", { + key: i5 }, f4))); } return /* @__PURE__ */ Cn.createElement("span", { @@ -55980,16 +54923,16 @@ var FilterValueSpan = (props2) => { // src/components/Space/Contexts/FlowListView/FlowListView.tsx init_compat_module(); -var import_obsidian35 = require("obsidian"); +var import_obsidian31 = require("obsidian"); var FlowListView = (props2) => { const { filteredData: data2 } = q2(ContextEditorContext); const flowItems = F2(() => { - return data2.map((f4) => getAbstractFileAtPath(app, f4.File)).filter((f4) => f4 instanceof import_obsidian35.TFile && f4.extension == "md"); + return data2.map((f4) => getAbstractFileAtPath(app, f4.File)).filter((f4) => f4 instanceof import_obsidian31.TFile && f4.extension == "md"); }, [data2]); return /* @__PURE__ */ Cn.createElement("div", { className: "mk-flow-container" - }, flowItems.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4 + }, flowItems.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5 }, /* @__PURE__ */ Cn.createElement("span", null, fileNameToString(f4.name)), /* @__PURE__ */ Cn.createElement(FlowView, { leaf: props2.leaf, plugin: props2.plugin, @@ -56021,8 +54964,8 @@ var EmbedFrameView = (props2) => { const getFileCache = (file) => { if (!file || file.path == "/") return null; - const cache = props2.plugin.index.filesIndex.get(file.path); - return cache; + const cache2 = props2.plugin.index.filesIndex.get(file.path); + return cache2; }; const [fileCache, setFileCache] = h2( getFileCache(getAbstractFileAtPath(app, props2.source)) @@ -56094,7 +55037,7 @@ var EmbedViewComponent = (props2) => { // src/components/Space/Editor/EmbedView/EmbedContextView.tsx var EMBED_CONTEXT_VIEW_TYPE = "make-inline-context"; -var EmbedContextView2 = class extends import_obsidian36.ItemView { +var EmbedContextView2 = class extends import_obsidian32.ItemView { constructor(leaf, plugin) { super(leaf); this.navigation = true; @@ -56125,7 +55068,7 @@ var EmbedContextView2 = class extends import_obsidian36.ItemView { this.constructInlineContext(this.path); await super.setState(state, result); const context = uriByString(this.path); - const title = pathDisplayName(context); + const title = pathDisplayName(context, this.plugin); this.leaf.tabHeaderInnerTitleEl.innerText = title; this.leaf.view.titleEl = title; const headerEl = this.leaf.view.headerEl; @@ -56154,27 +55097,27 @@ var EmbedContextView2 = class extends import_obsidian36.ItemView { }; // src/components/Space/Editor/FlowEditor.tsx -var import_obsidian37 = require("obsidian"); +var import_obsidian33 = require("obsidian"); var popovers = /* @__PURE__ */ new WeakMap(); var mouseCoords = { x: 0, y: 0 }; function nosuper(base2) { const derived = function() { - return Object.setPrototypeOf(new import_obsidian37.Component(), new.target.prototype); + return Object.setPrototypeOf(new import_obsidian33.Component(), new.target.prototype); }; derived.prototype = base2.prototype; return Object.setPrototypeOf(derived, base2); } var _a, _b, _c, _d, _e; -var FlowEditor = class extends nosuper(import_obsidian37.HoverPopover) { +var FlowEditor = class extends nosuper(import_obsidian33.HoverPopover) { constructor(parent, targetEl, plugin, waitTime, onShowCallback) { super(); this.targetEl = targetEl; this.plugin = plugin; this.onShowCallback = onShowCallback; - this.abortController = this.addChild(new import_obsidian37.Component()); + this.abortController = this.addChild(new import_obsidian33.Component()); this.detaching = false; this.opening = false; - this.rootSplit = new import_obsidian37.WorkspaceSplit( + this.rootSplit = new import_obsidian33.WorkspaceSplit( window.app.workspace, "vertical" ); @@ -56192,7 +55135,7 @@ var FlowEditor = class extends nosuper(import_obsidian37.HoverPopover) { this.onTarget = true; this.parent = parent; this.waitTime = waitTime; - this.state = import_obsidian37.PopoverState.Showing; + this.state = import_obsidian33.PopoverState.Showing; const { hoverEl } = this; this.abortController.load(); this.timer = window.setTimeout(this.show.bind(this), waitTime); @@ -56287,7 +55230,7 @@ var FlowEditor = class extends nosuper(import_obsidian37.HoverPopover) { this.registerEvent( app.workspace.on("layout-change", () => { this.rootSplit.children.forEach((item, index) => { - if (item instanceof import_obsidian37.WorkspaceTabs) { + if (item instanceof import_obsidian33.WorkspaceTabs) { this.rootSplit.replaceChild(index, item.children[0]); } }); @@ -56331,16 +55274,16 @@ var FlowEditor = class extends nosuper(import_obsidian37.HoverPopover) { } transition() { if (this.shouldShow()) { - if (this.state === import_obsidian37.PopoverState.Hiding) { - this.state = import_obsidian37.PopoverState.Shown; + if (this.state === import_obsidian33.PopoverState.Hiding) { + this.state = import_obsidian33.PopoverState.Shown; clearTimeout(this.timer); } } else { - if (this.state === import_obsidian37.PopoverState.Showing) { + if (this.state === import_obsidian33.PopoverState.Showing) { this.hide(); } else { - if (this.state === import_obsidian37.PopoverState.Shown) { - this.state = import_obsidian37.PopoverState.Hiding; + if (this.state === import_obsidian33.PopoverState.Shown) { + this.state = import_obsidian33.PopoverState.Hiding; this.timer = window.setTimeout(() => { if (this.shouldShow()) { this.transition(); @@ -56364,13 +55307,13 @@ var FlowEditor = class extends nosuper(import_obsidian37.HoverPopover) { }); } shouldShowSelf() { - return !this.detaching && !!(this.onTarget || this.state == import_obsidian37.PopoverState.Shown || this.document.querySelector( + return !this.detaching && !!(this.onTarget || this.state == import_obsidian33.PopoverState.Shown || this.document.querySelector( `body>.modal-container, body > #he${this.id} ~ .menu, body > #he${this.id} ~ .suggestion-container` )); } show() { if (!this.targetEl || this.document.body.contains(this.targetEl)) { - this.state = import_obsidian37.PopoverState.Shown; + this.state = import_obsidian33.PopoverState.Shown; this.timer = 0; this.shownPos = mouseCoords; this.targetEl.replaceChildren(this.hoverEl); @@ -56414,7 +55357,7 @@ var FlowEditor = class extends nosuper(import_obsidian37.HoverPopover) { nativeHide() { var _a2; const { hoverEl, targetEl } = this; - this.state = import_obsidian37.PopoverState.Hidden; + this.state = import_obsidian33.PopoverState.Hidden; hoverEl.detach(); if (targetEl) { const parent = targetEl.matchParent(".mk-hover-popover"); @@ -56425,7 +55368,7 @@ var FlowEditor = class extends nosuper(import_obsidian37.HoverPopover) { this.unload(); } resolveLink(linkText, sourcePath) { - const link = (0, import_obsidian37.parseLinktext)(linkText); + const link = (0, import_obsidian33.parseLinktext)(linkText); const tFile = link ? this.plugin.app.metadataCache.getFirstLinkpathDest( link.path, sourcePath != null ? sourcePath : "" @@ -56472,8 +55415,8 @@ var FlowEditor = class extends nosuper(import_obsidian37.HoverPopover) { }; } buildEphemeralState(file, link) { - const cache = this.plugin.app.metadataCache.getFileCache(file); - const subpath = cache ? (0, import_obsidian37.resolveSubpath)(cache, (link == null ? void 0 : link.subpath) || "") : void 0; + const cache2 = this.plugin.app.metadataCache.getFileCache(file); + const subpath = cache2 ? (0, import_obsidian33.resolveSubpath)(cache2, (link == null ? void 0 : link.subpath) || "") : void 0; const eState = { subpath: link == null ? void 0 : link.subpath }; if (subpath) { eState.line = subpath.start.line; @@ -56485,7 +55428,7 @@ var FlowEditor = class extends nosuper(import_obsidian37.HoverPopover) { }; // src/utils/flow/flowEditor.ts -var import_obsidian38 = require("obsidian"); +var import_obsidian34 = require("obsidian"); var parseOutReferences = (ostr) => { const str = ostr.split("|")[0]; const refIndex = str.lastIndexOf("#"); @@ -56499,24 +55442,24 @@ var getLineRangeFromRef = (file, ref2, plugin) => { if (!ref2) { return [void 0, void 0]; } - const cache = app.metadataCache.getFileCache(file); - const headings = cache.headings; - const blocks = cache.blocks; - const sections = cache.sections; + const cache2 = app.metadataCache.getFileCache(file); + const headings = cache2.headings; + const blocks = cache2.blocks; + const sections = cache2.sections; if (blocks && ref2.charAt(0) == "^" && blocks[ref2.substring(1)]) { return [ blocks[ref2.substring(1)].position.start.line + 1, blocks[ref2.substring(1)].position.end.line + 1 ]; } - const heading = headings == null ? void 0 : headings.find((f4) => f4.heading.replace("#", " ") == ref2); - if (heading) { - const index = headings.findIndex((f4) => f4.heading == heading.heading); + const heading2 = headings == null ? void 0 : headings.find((f4) => f4.heading.replace("#", " ") == ref2); + if (heading2) { + const index = headings.findIndex((f4) => f4.heading == heading2.heading); const level = (_a2 = headings[index]) == null ? void 0 : _a2.level; const nextIndex2 = headings.findIndex( - (f4, i4) => i4 > index && f4.level <= level + (f4, i5) => i5 > index && f4.level <= level ); - const start = plugin.settings.editorFlowStyle == "classic" ? heading.position.start.line + 1 : heading.position.start.line + 2; + const start = plugin.settings.editorFlowStyle == "classic" ? heading2.position.start.line + 1 : heading2.position.start.line + 2; if (index < headings.length - 1 && nextIndex2 != -1) { return [start, headings[nextIndex2].position.end.line]; } @@ -56524,7 +55467,7 @@ var getLineRangeFromRef = (file, ref2, plugin) => { } return [void 0, void 0]; }; -var loadFlowEditorByDOM2 = (make, el, view, id2) => { +var loadFlowEditorByDOM2 = (make, el, view, id3) => { setTimeout(async () => { let counter = 0; while (!el.parentElement && counter++ <= 50) @@ -56552,7 +55495,7 @@ var loadFlowEditorByDOM2 = (make, el, view, id2) => { app.workspace.activeEditor.editor.cm, (_b3 = app.workspace.activeEditor.file) == null ? void 0 : _b3.path, make, - id2 + id3 ); } }, app.workspace["rootSplit"]); @@ -56569,7 +55512,7 @@ var loadFlowEditorByDOM2 = (make, el, view, id2) => { cm, (_b3 = leaf.view.file) == null ? void 0 : _b3.path, make, - id2 + id3 ); } }, app.workspace["rootSplit"]); @@ -56577,11 +55520,11 @@ var loadFlowEditorByDOM2 = (make, el, view, id2) => { }); }); }; -var loadFlowEditorsForLeafForID = (leaf, cm, source, make, id2) => { +var loadFlowEditorsForLeafForID = (leaf, cm, source, make, id3) => { const stateField = cm.state.field(flowEditorInfo, false); if (!stateField) return; - const flowInfo = stateField.find((f4) => f4.id == id2); + const flowInfo = stateField.find((f4) => f4.id == id3); if (flowInfo && flowInfo.expandedState == 2) { loadFlowEditor(leaf, cm, flowInfo, source, make); } @@ -56624,7 +55567,7 @@ var loadFlowEditor = (leaf, cm, flowEditorInfo2, source, make) => { ); } } else { - if (aFile instanceof import_obsidian38.TFolder) { + if (aFile instanceof import_obsidian34.TFolder) { if (!dom.hasAttribute("ready")) { dom.setAttribute("ready", ""); createFlowEditorInElement( @@ -56654,7 +55597,7 @@ var loadFlowEditor = (leaf, cm, flowEditorInfo2, source, make) => { } }; var focusPortal = async (plugin, evt) => { - const { id: id2, parent, top } = evt.detail; + const { id: id3, parent, top } = evt.detail; if (parent) { app.workspace.iterateLeaves((leaf) => { var _a2; @@ -56662,7 +55605,7 @@ var focusPortal = async (plugin, evt) => { if (cm) { const stateField = cm.state.field(flowEditorInfo, false); if (stateField) { - const foundInfo = stateField.find((f4) => f4.id == id2); + const foundInfo = stateField.find((f4) => f4.id == id3); if (foundInfo) { cm.focus(); if (top) { @@ -56700,7 +55643,7 @@ var focusPortal = async (plugin, evt) => { const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; if (cm) { const stateField = cm.state.field(flowIDStateField, false); - if (stateField && stateField == id2) { + if (stateField && stateField == id3) { cm.focus(); const lineRange = cm.state.field(selectiveLinesFacet, false); const posRange = lineRange && lineRange[0] != void 0 ? lineRangeToPosRange(cm.state, lineRange) : { from: 0, to: cm.state.doc.length }; @@ -56829,1373 +55772,3270 @@ var spawnPortal = (plugin, parentLeaf, initiatingEl, fileName, onShowCallback) = ); }; -// src/components/Space/Contexts/DataTypeView/LinkCell.tsx -var LinkCell = (props2) => { +// src/components/Space/Editor/FlowView.tsx +var FlowView = (props2) => { var _a2; - const initialValue = (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).filter((f4) => f4); - const stringValueToLink = (strings) => strings.map((f4) => { - return { - label: parseLinkDisplayString(f4), - value: parseLinkString(f4) - }; - }); - p2(() => { - var _a3; - setValue( - resolveLinks( - stringValueToLink( - props2.multi ? (_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : [] : [props2.initialValue] - ) - ) - ); - }, [props2.initialValue]); - const resolveLinks = (links) => links.map((f4) => ({ - value: f4.value, - label: filePathToString(f4.value), - file: getFileFromString(f4.value, getFolderPathFromString(props2.file)) - })); const ref2 = _2(null); - const [value, setValue] = h2( - resolveLinks(stringValueToLink(initialValue)) - ); - const removeValue = (v3) => { - const newValues = value.filter((f4) => f4.value != v3.value); - setValue(newValues); - props2.saveValue(serializeMultiString(newValues.map((f4) => f4.value))); - }; - const saveOptions = (_12, _value) => { - if (!props2.multi) { - setValue(resolveLinks(stringValueToLink(_value))); - props2.saveValue(serializeMultiString(_value)); - } else { - const newValue = _value[0]; - if (newValue) { - const newValues = uniq([...value.map((f4) => f4.value), newValue]); - setValue(resolveLinks(stringValueToLink(newValues))); - props2.saveValue(serializeMultiString(newValues)); - } + const loadFile = async () => { + var _a3; + const div = ref2.current; + const path = uriByString(props2.path, props2.source); + const { ref: refStr, type } = path; + let from = props2.from; + let to = props2.to; + if (((_a3 = path.refStr) == null ? void 0 : _a3.length) > 0 && path.type == "file") { + [from, to] = getLineRangeFromRef( + getAbstractFileAtPath(app, path.path), + path.refStr, + props2.plugin + ); } + const portalType = type == "tag" || type == "folder" ? "context" : "doc"; + await spawnLeafFromFile( + props2.plugin, + props2.leaf, + props2.source, + path, + div, + portalType, + from, + to + ); }; - const menuProps = () => { - const options = getAllAbstractFilesInVault(props2.plugin, app).map((f4) => ({ - name: fileNameToString(f4.name), - value: f4.path, - description: f4.path - })); - const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; - return { - plugin: props2.plugin, - multi: false, - editable: true, - value: value.map((f4) => f4.value), - options: _options, - saveOptions, - placeholder: i18n_default.labels.linkItemSelectPlaceholder, - detail: true, - searchable: true - }; - }; - const openLink = async (o3) => { - if (o3.file) { - openTFile(o3.file, props2.plugin, false); + const toggleFlow = () => { + if (props2.load) { + loadFile(); } else { - const file = await app.fileManager.createNewMarkdownFile( - app.vault.getRoot(), - o3.value - ); - openTFile(file, props2.plugin, false); - setValue(resolveLinks(value)); + ref2.current.empty(); } }; - return /* @__PURE__ */ Cn.createElement(OptionCellBase, { - baseClass: "mk-cell-link", - menuProps, - getLabelString: (o3) => o3.label, - valueClass: (o3) => o3.file ? "mk-cell-link-item" : "mk-cell-link-unresolved", - openItem: openLink, - value, - multi: props2.multi, - editMode: props2.editMode, - removeValue + p2(() => { + toggleFlow(); + }, [props2.load, props2.path, props2.from, props2.to]); + return /* @__PURE__ */ Cn.createElement("div", { + className: `${(_a2 = props2.classname) != null ? _a2 : ""} "mk-flowspace-editor"`, + ref: ref2 }); }; -// src/components/Space/Contexts/DataTypeView/TagCell.tsx +// src/components/Space/Frames/EditorNodes/FlowNodeView.tsx init_compat_module(); -var TagCell = (props2) => { - var _a2; - const initialValue = ((_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : []).filter( - (f4) => (f4 == null ? void 0 : f4.length) > 0 - ); - const [value, setValue] = h2(initialValue); - p2(() => { - var _a3; - setValue((_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : []); - }, [props2.initialValue]); - const removeValue = (v3) => { - const newValues = value.filter((f4) => f4 != v3); - setValue(newValues); - props2.saveValue(serializeMultiString(newValues)); - }; - const saveOptions = (_options, _value) => { - if (!props2.multi) { - setValue(_value); - props2.saveValue(serializeMultiString(_value)); - } else { - const newValue = _value[0]; - if (newValue) { - const newValues = uniq([...value, newValue]); - setValue(newValues); - props2.saveValue(serializeMultiString(newValues)); - } - } - }; - const menuProps = () => { - const options = loadTags(props2.plugin).map((f4) => ({ - name: f4, - value: f4 - })); - const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; - return { - plugin: props2.plugin, - multi: false, - editable: true, - value, - options: _options, - saveOptions, - placeholder: i18n_default.labels.tagItemSelectPlaceholder, - searchable: true, - showAll: true, - onHide: () => props2.setEditMode(null) - }; +function parseContent2(input) { + const regex1 = /!\[!\[(.*?)\]\]/; + const regex2 = /!!\[\[(.*?)\]\]/; + const match1 = input.match(regex1); + const match2 = input.match(regex2); + return match1 ? match1[1] : match2 ? match2[1] : input; +} +var FlowNodeView = (props2) => { + var _a2, _b2; + const fullPath = (_b2 = (_a2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _a2.props) == null ? void 0 : _b2.value; + const path = fullPath ? parseContent2(fullPath) : null; + const { saveNodes } = q2(FramesEditorContext); + const selectLink = (e4) => { + showLinkMenu( + e4, + props2.plugin, + (link) => saveNodes([ + { + ...props2.treeNode.node, + props: { ...props2.treeNode.node.props, value: wrapQuotes(link) } + } + ]) + ); }; - return /* @__PURE__ */ Cn.createElement(OptionCellBase, { - baseClass: "mk-cell-tag", - menuProps, - value, - multi: props2.multi, - editMode: props2.editMode, - removeValue - }); + return props2.instance.state[props2.treeNode.id] && path ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(FlowView, { + source: props2.source, + plugin: props2.plugin, + path, + load: true, + classname: "mk-flow-node" + })) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-placeholder", + onClick: (e4) => selectLink(e4) + }, "Select Note"); }; -// src/components/Space/Contexts/TableView/TableView.tsx -var TableView = (props2) => { - const { spaceInfo, contexts, readMode } = q2(SpaceContext); +// src/components/Space/Frames/EditorNodes/FrameNodeView.tsx +var defaultFrameStyles = { + position: "relative" +}; +var FrameEditorNodeView = (props2) => { + var _a2, _b2; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(Resizable, { + className: (0, import_classnames4.default)( + props2.column ? "mk-frame-column" : "mk-frame-bounds" + ), + enable: props2.column ? { right: true } : { + top: true, + right: true, + bottom: true, + left: true, + topRight: true, + bottomRight: true, + bottomLeft: true, + topLeft: true + }, + onResizeStop: (e4, direction, ref2, d6) => { + props2.resize({ + width: ref2.clientWidth, + height: props2.column ? "" : ref2.clientHeight + }); + }, + onResizeStart: (e4) => { + e4.stopPropagation(); + }, + size: { + width: (_a2 = props2.size.width) != null ? _a2 : "100%", + height: (_b2 = props2.size.height) != null ? _b2 : "100%" + }, + ...props2.listeners + })); +}; +var FrameNodeView = (props2) => { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s; const { - tableData, - dbSchema, - contextTable, - saveDB: saveDB2 - } = q2(ContextMDBContext); + selectedNodes, + saveState, + hoverNode, + saveNodes, + addNode, + deleteNode, + dragNode + } = q2(FramesEditorContext); + const { frameSchema } = q2(FramesMDBContext); const { - selectedRows, - selectRows, - sortedColumns: cols, - filteredData: data2, - predicate, - savePredicate, - updateFieldValue, - updateValue: updateValue2 - } = q2(ContextEditorContext); - const [activeId, setActiveId] = h2(null); - const [lastSelectedIndex, setLastSelectedIndex] = h2(null); - const [selectedColumn, setSelectedColumn] = h2(null); - const [currentEdit, setCurrentEdit] = h2(null); - const [overId, setOverId] = h2(null); - const [openFlows, setOpenFlows] = h2([]); - const [colsSize, setColsSize] = h2({}); + attributes, + listeners, + setNodeRef, + setDraggableNodeRef, + transform, + transition + } = useSortable({ + id: frameSchema.id + props2.treeNode.id, + data: { + id: props2.treeNode.id, + type: "item", + parent: props2.treeNode.node.parentId, + frame: frameSchema.id + }, + disabled: dragNode === props2.treeNode.id, + transition: null + }); const ref2 = _2(null); - p2(() => { - setColsSize({ ...predicate.colsSize, "+": 30 }); - }, [predicate]); - p2(() => { - setCurrentEdit(null); - }, [selectedColumn, lastSelectedIndex]); - p2(() => { - if (currentEdit == null) { - ref2.current.focus(); - } - }, [currentEdit]); - const saveColsSize = (colSize) => { - const newColSize = colSize(colsSize); - setColsSize(newColSize); - debouncedSavePredicate(newColSize); + const saveNodeValue = (values, node) => { + const newNodes = { + ...node, + props: { + ...node.props, + ...values + } + }; + saveNodes([newNodes]); }; - const debouncedSavePredicate = T2( - (0, import_lodash11.debounce)( - (nextValue) => savePredicate({ - ...predicate, - colsSize: nextValue - }), - 1e3 - ), - [predicate] - ); - const newRow = (index, data3) => { - saveDB2(createNewRow(tableData, { File: "", ...data3 != null ? data3 : {} }, index)); + const saveStyleValue = (values, node) => { + const newNodes = { + ...node, + styles: { + ...node.styles, + ...values + } + }; + saveNodes([newNodes]); }; - const deleteRow = (rowIndex) => { - const row = tableData.rows.find((f4, i4) => i4 == rowIndex); - if (getAbstractFileAtPath(app, row.File)) { - deleteFile(props2.plugin, getAbstractFileAtPath(app, row.File)); - } - if (row) { - saveDB2({ - ...tableData, - rows: tableData.rows.filter((f4, i4) => i4 != rowIndex) - }); - } + const isSelected = selectedNodes.some((f4) => props2.treeNode.id == f4.id); + const innerComponents = props2.treeNode.node.type == "text" ? /* @__PURE__ */ Cn.createElement(TextNodeView, { + treeNode: props2.treeNode, + instance: props2.instance, + editable: !props2.treeNode.isRef + }) : props2.treeNode.node.type == "icon" ? /* @__PURE__ */ Cn.createElement(IconNodeView, { + plugin: props2.plugin, + treeNode: props2.treeNode, + instance: props2.instance, + editable: !props2.treeNode.isRef + }) : props2.treeNode.node.type == "image" ? /* @__PURE__ */ Cn.createElement(ImageNodeView, { + treeNode: props2.treeNode, + instance: props2.instance, + editable: !props2.treeNode.isRef + }) : props2.treeNode.node.type == "space" ? /* @__PURE__ */ Cn.createElement(SpaceNodeView, { + treeNode: props2.treeNode, + instance: props2.instance, + plugin: props2.plugin, + editable: !props2.treeNode.isRef + }) : props2.treeNode.node.type == "flow" ? /* @__PURE__ */ Cn.createElement(FlowNodeView, { + treeNode: props2.treeNode, + instance: props2.instance, + plugin: props2.plugin, + editable: !props2.treeNode.isRef + }) : props2.treeNode.node.type == "column" && props2.treeNode.children.length == 0 ? /* @__PURE__ */ Cn.createElement(RowPlaceholder, { + plugin: props2.plugin, + id: props2.treeNode.id, + parentId: props2.treeNode.node.parentId + }) : props2.treeNode.children.map((c4, i5) => /* @__PURE__ */ Cn.createElement(SortableContext, { + key: i5, + items: props2.treeNode.children, + strategy: verticalListSortingStrategy + }, /* @__PURE__ */ Cn.createElement(FrameNodeView, { + editMode: props2.editMode, + plugin: props2.plugin, + key: i5, + treeNode: c4, + instance: props2.instance + }))); + const parseAs = (role) => role == "checkbox" || role == "text" || role == "range" || role == "number" ? "input" : role; + const tag = (_c2 = parseAs((_b2 = (_a2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _a2.styles) == null ? void 0 : _b2.as)) != null ? _c2 : "div"; + const type = tag == "input" ? (_e2 = (_d2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _d2.styles) == null ? void 0 : _e2.as : null; + const onResize = (size) => { + saveNodes([ + { + ...props2.treeNode.node, + styles: { ...props2.treeNode.node.styles, ...size } + } + ]); }; - const toggleFlow = (path) => { - setOpenFlows( - (f4) => f4.find((p3) => p3 == path) ? f4.filter((p3) => p3 != path) : uniq([...f4, path]) - ); + const selectNode = (nodes) => { + const evt = new CustomEvent(eventTypes.frameLayerSelected, { + detail: { selection: nodes.map((f4) => f4.id) } + }); + window.dispatchEvent(evt); }; - const selectItem = (modifier, index) => { - if (modifier == 3) { - const file = getAbstractFileAtPath( - app, - tableData.rows[parseInt(index)].File - ); - if (file) - openAFile(file, props2.plugin, false); + const onClick = (e4) => { + var _a3, _b3; + if (isSelected) return; - } - if (modifier == 2) { - selectedRows.some((f4) => f4 == index) ? selectRows( - null, - selectedRows.filter((f4) => f4 != index) - ) : selectRows(index, uniq([...selectedRows, index])); - } else if (modifier == 1) { - selectRows( - index, - uniq([ - ...selectedRows, - ...selectRange( - lastSelectedIndex, - index, - data2.map((f4) => f4._index) - ) - ]) + if (typeof ((_a3 = props2.instance.state[props2.treeNode.id].actions) == null ? void 0 : _a3.onClick) == "function") { + (_b3 = props2.instance.state[props2.treeNode.id].actions) == null ? void 0 : _b3.onClick( + e4, + props2.instance.state, + (s6) => saveState(s6, props2.instance), + props2.plugin.index.api ); - } else { - selectRows(index, [index]); + e4.stopPropagation(); + } else if (props2.editMode > 1) { + if (e4.shiftKey) { + selectNode([ + ...selectedNodes.filter((f4) => f4.id != props2.treeNode.node.id), + props2.treeNode.node + ]); + } else { + selectNode([props2.treeNode.node]); + } + e4.stopPropagation(); } - setLastSelectedIndex(index); }; const onKeyDown = (e4) => { - const setCellValue = (value) => { - var _a2; - const columnTuple = selectedColumn.split("#"); - updateValue2( - columnTuple[0], - value, - (_a2 = columnTuple[1]) != null ? _a2 : "", - parseInt(lastSelectedIndex), - "" - ); - }; - const clearCell = () => { - setCellValue(""); - }; - const copyCell = () => { - navigator.clipboard.writeText( - tableData.rows[parseInt(lastSelectedIndex)][selectedColumn] - ); - }; - const nextRow = () => { - const newIndex = selectNextIndex( - lastSelectedIndex, - data2.map((f4) => f4._index) - ); - selectRows(newIndex, [newIndex]); - setLastSelectedIndex(newIndex); - }; - const lastRow = () => { - const newIndex = selectPrevIndex( - lastSelectedIndex, - data2.map((f4) => f4._index) - ); - selectRows(newIndex, [newIndex]); - setLastSelectedIndex(newIndex); - }; - if (e4.key == "c" && e4.metaKey) { - copyCell(); - } - if (e4.key == "x" && e4.metaKey) { - copyCell(); - clearCell(); - } - if (e4.key == "v" && e4.metaKey) { - navigator.clipboard.readText().then((f4) => setCellValue(f4)); - } - if (e4.key == "Escape") { - selectRows(null, []); - setLastSelectedIndex(null); - } if (e4.key == "Backspace" || e4.key == "Delete") { - clearCell(); - } - if (e4.key == "Enter") { - if (selectedColumn && lastSelectedIndex) { - if (e4.shiftKey) { - newRow(parseInt(lastSelectedIndex) + 1); - nextRow(); - } else { - setCurrentEdit([selectedColumn, lastSelectedIndex]); - } - } - return; - } - if (e4.key == "ArrowDown") { - nextRow(); - e4.preventDefault(); - } - if (e4.key == "ArrowUp") { - lastRow(); - e4.preventDefault(); - } - if (e4.key == "ArrowLeft") { - const newIndex = selectPrevIndex( - selectedColumn, - columns.map((f4) => f4.accessorKey).filter((f4) => f4 != "+") - ); - setSelectedColumn(newIndex); - } - if (e4.key == "ArrowRight") { - const newIndex = selectNextIndex( - selectedColumn, - columns.map((f4) => f4.accessorKey).filter((f4) => f4 != "+") - ); - setSelectedColumn(newIndex); + deleteNode(props2.treeNode.node); } }; - const columns = F2( - () => { - var _a2; - return [ - ...(_a2 = cols == null ? void 0 : cols.filter((f4) => f4.type != "preview").map((f4) => { - return { - header: f4.name, - accessorKey: f4.name + f4.table, - meta: { - table: f4.table, - editable: f4.primary != "true", - schemaId: dbSchema == null ? void 0 : dbSchema.id - }, - cell: ({ - getValue: getValue2, - row: { index }, - column: { colId }, - cell, - table: table2 - }) => { - const initialValue = getValue2(); - const rowIndex = parseInt( - data2[index]["_index" + f4.table] - ); - const tableIndex = parseInt(data2[index]["_index"]); - const saveValue = (value) => { - var _a3; - setCurrentEdit(null); - if (initialValue != value) - (_a3 = table2.options.meta) == null ? void 0 : _a3.updateData( - f4.name, - value, - f4.table, - rowIndex - ); - }; - const saveFieldValue = (fieldValue, value) => { - var _a3; - (_a3 = table2.options.meta) == null ? void 0 : _a3.updateFieldValue( - f4.name, - fieldValue, - value, - f4.table, - rowIndex - ); - }; - const editMode = readMode ? -1 /* EditModeReadOnly */ : !cell.getIsGrouped() ? platformIsMobile() ? 3 /* EditModeAlways */ : currentEdit && currentEdit[0] == f4.name + f4.table && currentEdit[1] == tableIndex.toString() ? 2 /* EditModeActive */ : 1 /* EditModeView */ : -1 /* EditModeReadOnly */; - const cellProps = { - initialValue, - saveValue, - plugin: props2.plugin, - setEditMode: setCurrentEdit, - editMode, - propertyValue: f4.value - }; - const fieldType = fieldTypeForType(f4.type); - if (!fieldType) { - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, initialValue); - } - if (fieldType.type == "file") { - return /* @__PURE__ */ Cn.createElement(FileCell, { - ...cellProps, - multi: fieldType.multiType == f4.type, - folder: spaceInfo.path, - isFolder: spaceInfo.uri.type == "folder", - openFlow: () => toggleFlow(initialValue), - deleteRow: () => deleteRow(index) - }); - } else if (fieldType.type == "boolean") { - return /* @__PURE__ */ Cn.createElement(BooleanCell, { - ...cellProps, - column: f4 - }); - } else if (fieldType.type == "option") { - return /* @__PURE__ */ Cn.createElement(OptionCell, { - ...cellProps, - options: f4.value, - multi: fieldType.multiType == f4.type, - saveOptions: saveFieldValue - }); - } else if (fieldType.type == "date") { - return /* @__PURE__ */ Cn.createElement(DateCell, { - ...cellProps - }); - } else if (fieldType.type == "context") { - return /* @__PURE__ */ Cn.createElement(ContextCell, { - ...cellProps, - multi: fieldType.multiType == f4.type, - contextTable: contextTable[f4.value], - contextTag: f4.value - }); - } else if (fieldType.type == "fileprop") { - return /* @__PURE__ */ Cn.createElement(LookUpCell, { - ...cellProps, - file: data2[index][FilePropertyName] - }); - } else if (fieldType.type == "tag") { - return /* @__PURE__ */ Cn.createElement(TagCell, { - ...cellProps, - multi: fieldType.multiType == f4.type - }); - } else if (fieldType.type == "number") { - return /* @__PURE__ */ Cn.createElement(NumberCell, { - ...cellProps - }); - } else if (fieldType.type == "link") { - return /* @__PURE__ */ Cn.createElement(LinkCell, { - ...cellProps, - multi: fieldType.multiType == f4.type, - file: data2[index][FilePropertyName] - }); - } else if (fieldType.type == "image") { - return /* @__PURE__ */ Cn.createElement(ImageCell, { - ...cellProps - }); - } else { - return /* @__PURE__ */ Cn.createElement(TextCell, { - ...cellProps - }); - } - } - }; - })) != null ? _a2 : [], - ...readMode ? [] : [ - { - header: "+", - meta: { schemaId: dbSchema == null ? void 0 : dbSchema.id }, - accessorKey: "+", - size: 20, - cell: () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) - } - ] - ]; + const canInteract = props2.editMode > 0 && !props2.treeNode.isRef && (props2.treeNode.node.parentId == props2.instance.root.id && props2.treeNode.node.type != "container" || props2.treeNode.parentType == "column"); + const canDrag = canInteract && ((_f = props2.treeNode.node.parentId) == null ? void 0 : _f.length) > 0; + const canResize = props2.editMode > 1 && isSelected && canDrag || props2.treeNode.node.type == "image" || props2.treeNode.node.type == "column"; + const hasDragHandle = canInteract && props2.treeNode.node.type != "column" && ((_g = props2.treeNode.node.parentId) == null ? void 0 : _g.length) > 0 && props2.editMode == 1; + const columnPlaceholderPosition = dragNode && props2.editMode == 1 && props2.treeNode.node.id != props2.instance.root.id && !props2.treeNode.isRef ? props2.treeNode.node.type != "column" ? props2.treeNode.parentType != "column" ? 1 : 2 : 3 : 0; + const canDrop = canInteract || props2.editMode == 2; + const hasContextMenu = hasDragHandle || props2.editMode == 2 && props2.treeNode.node.parentId == props2.instance.root.id; + const inner = tag == "input" ? /* @__PURE__ */ Cn.createElement("input", { + "data-path": props2.treeNode.id, + type, + onChange: (e4) => { + var _a3, _b3; + if (typeof ((_a3 = props2.instance.state[props2.treeNode.id].actions) == null ? void 0 : _a3.onChange) == "function") { + (_b3 = props2.instance.state[props2.treeNode.id].actions) == null ? void 0 : _b3.onChange( + e4.target.value, + props2.instance.state, + (s6) => saveState(s6, props2.instance), + props2.plugin.index.api + ); + } }, - [cols, currentEdit, predicate, contextTable, toggleFlow, openFlows] - ); - const groupBy2 = F2( - () => { - var _a2; - return ((_a2 = predicate.groupBy) == null ? void 0 : _a2.length) > 0 && cols.find((f4) => f4.name + f4.table == predicate.groupBy[0]) ? predicate.groupBy : []; + style: { + "--translate-x": `${(_h = transform == null ? void 0 : transform.x) != null ? _h : 0}px`, + "--translate-y": `${(_i = transform == null ? void 0 : transform.y) != null ? _i : 0}px`, + ...(_j = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _j.styles + } + }) : Cn.createElement( + tag, + { + type, + ref: (el) => { + ref2.current = el; + }, + className: `mk-frame ${(_m = (_l = (_k = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _k.styles) == null ? void 0 : _l.class) != null ? _m : ""}`, + "data-path": props2.treeNode.id, + onClick, + style: { + ...defaultFrameStyles, + ...(_n2 = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _n2.styles, + "--translate-x": `${(_o = transform == null ? void 0 : transform.x) != null ? _o : 0}px`, + "--translate-y": `${(_p = transform == null ? void 0 : transform.y) != null ? _p : 0}px`, + transition, + ...props2.editMode == -1 && props2.treeNode.node.parentId == props2.instance.root.id ? { left: 0, top: 0 } : {} + }, + ...props2.editMode == 2 || canDrag ? { ...attributes } : {} }, - [predicate, cols] + [ + ...[ + columnPlaceholderPosition > 0 ? /* @__PURE__ */ Cn.createElement(ColumnPlaceholder, { + parentId: props2.treeNode.node.parentId, + key: `|${props2.treeNode.node.id}`, + bottom: hoverNode == props2.treeNode.id, + right: hoverNode == `|${props2.treeNode.node.id}`, + plugin: props2.plugin, + height: `100%`, + width: `${columnPlaceholderPosition != 3 ? (_q = ref2.current) == null ? void 0 : _q.parentElement.clientWidth : (_r = ref2.current) == null ? void 0 : _r.clientWidth}px`, + id: `|${props2.treeNode.node.id}`, + type: columnPlaceholderPosition, + dropRef: setNodeRef + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) + ], + ...canResize ? [ + /* @__PURE__ */ Cn.createElement(FrameEditorNodeView, { + key: props2.treeNode.id, + size: (_s = props2.instance.state[props2.treeNode.id]) == null ? void 0 : _s.styles, + column: props2.treeNode.node.type == "column", + resize: onResize, + listeners + }) + ] : [], + ...canDrag && props2.editMode > 1 && !isSelected ? [ + /* @__PURE__ */ Cn.createElement("div", { + key: props2.treeNode.id, + tabIndex: -1, + className: (0, import_classnames4.default)( + "mk-frame-bounds", + dragNode == props2.treeNode.id ? "is-selected" : "" + ), + onKeyDown, + ...listeners + }) + ] : [], + innerComponents + ] ); - const table = useReactTable({ - data: data2, - columns, - columnResizeMode: "onChange", - state: { - columnVisibility: predicate.colsHidden.reduce( - (p3, c4) => ({ ...p3, [c4]: false }), - {} - ), - columnOrder: predicate.colsOrder, - columnSizing: { - ...columns.reduce((p3, c4) => ({ ...p3, [c4.accessorKey]: 150 }), {}), - ...colsSize - }, - grouping: groupBy2, - expanded: true + return props2.instance.state[props2.treeNode.id] && (hasDragHandle ? /* @__PURE__ */ Cn.createElement(SelectableFrameNode, { + node: props2.treeNode.id, + selected: selectedNodes.some((f4) => props2.treeNode.id == f4.id) + }, selectedNodes.length == 1 && selectedNodes[0].id == props2.treeNode.id ? /* @__PURE__ */ Cn.createElement(HoverPropsMenu, { + plugin: props2.plugin, + node: props2.treeNode.node, + duplicateFrame: () => { + addNode(props2.treeNode.node, props2.treeNode.node); }, - onColumnSizingChange: saveColsSize, - getCoreRowModel: getCoreRowModel(), - getExpandedRowModel: getExpandedRowModel(), - getGroupedRowModel: getGroupedRowModel(), - meta: { - updateData: updateValue2, - updateFieldValue + deleteFrame: () => deleteNode(props2.treeNode.node), + fields: propertiesForNode(props2.treeNode.node), + frameProps: props2.treeNode.node.props, + schemaProps: Object.keys(props2.instance.root.node.props).map( + (f4) => ({ + name: f4, + schemaId: props2.instance.root.id, + type: props2.instance.root.node.types[f4] + }) + ), + savePropValue: (key2, value) => saveNodeValue({ [key2]: value }, props2.treeNode.node), + saveStyleValue: (key2, value) => saveStyleValue({ [key2]: value }, props2.treeNode.node) + }) : selectedNodes.length > 1 && selectedNodes[0].id == props2.treeNode.id ? /* @__PURE__ */ Cn.createElement(HoverMultiMenu, { + plugin: props2.plugin + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), inner, /* @__PURE__ */ Cn.createElement(FrameHoverMenu, { + key: props2.treeNode.id, + plugin: props2.plugin, + node: props2.treeNode.node, + dragRef: setDraggableNodeRef, + listeners + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, inner)); +}; +var SelectableFrameNode = (props2) => { + const ref2 = _2(null); + const { selectableNodeBounds, selectNodes } = q2(FramesEditorContext); + p2(() => { + if (ref2.current) { + const { left, top, width, height } = ref2.current.getBoundingClientRect(); + selectableNodeBounds.current[props2.node] = { + left, + top, + width, + height + }; } - }); - const sensors = useSensors( - useSensor(MouseSensor, { - activationConstraint: { - distance: 10 - } - }), - useSensor(TouchSensor, { - activationConstraint: { - delay: 250, - tolerance: 5 - } - }) - ); - const measuring = { - droppable: { - strategy: MeasuringStrategy.Always + }, []); + return /* @__PURE__ */ Cn.createElement("div", { + className: `mk-f ${props2.selected ? "is-selected" : ""}`, + ref: ref2, + onClick: () => !props2.selected && selectNodes([]) + }, props2.children); +}; + +// src/components/Space/Contexts/DataTypeView/TextCell.tsx +init_compat_module(); +var TextCell = (props2) => { + const { initialValue, saveValue } = props2; + const [value, setValue] = Cn.useState(initialValue); + const ref2 = _2(null); + const onBlur = () => { + if (initialValue != value) + saveValue(value); + }; + const onKeyDown = (e4) => { + e4.stopPropagation(); + if (e4.key == "Enter") { + e4.target.blur(); + props2.setEditMode(null); + } + if (e4.key == "Escape") { + setValue(initialValue); + e4.target.blur(); + props2.setEditMode(null); } }; - function handleDragStart(event) { - const { - active: { id: activeId2 } - } = event; - setActiveId(activeId2); - setOverId(overId); - document.body.style.setProperty("cursor", "grabbing"); - } - function handleDragOver({ over }) { + Cn.useEffect(() => { + setValue(initialValue); + }, [initialValue]); + p2(() => { var _a2; - const overId2 = over == null ? void 0 : over.id; - if (overId2) { - setOverId((_a2 = over == null ? void 0 : over.id) != null ? _a2 : null); + if (props2.editMode == 2) { + (_a2 = ref2 == null ? void 0 : ref2.current) == null ? void 0 : _a2.focus(); } - } - const saveFilter = (filter) => { - savePredicate({ - ...predicate, - filters: [ - ...predicate.filters.filter((s5) => s5.field != filter.field), - filter - ] - }); + }, [props2.editMode]); + return props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { + onClick: (e4) => e4.stopPropagation(), + className: "mk-cell-text", + ref: ref2, + type: "text", + value, + onChange: (e4) => setValue(e4.target.value), + onKeyDown, + onBlur + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-text" + }, value); +}; + +// src/components/Space/Frames/Panels/PropsPanel.tsx +init_compat_module(); + +// src/components/Space/Frames/Setters/CodeEditorSetter.tsx +init_compat_module(); +var CodeEditorSetter = (props2) => { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-setter-code" + }, /* @__PURE__ */ Cn.createElement("div", { + onClick: () => props2.editCode(props2.node, props2.name, props2.type), + dangerouslySetInnerHTML: { __html: uiIconSet["mk-mark-code"] } + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-setter-code-value" + }, props2.value)); +}; + +// src/components/Space/Frames/Panels/PropsPanel.tsx +var PropsPanel = (props2) => { + const { spaceInfo } = q2(SpaceContext); + const { saveNodes, root: root2, selectedNodes } = q2(FramesEditorContext); + const saveContexts = (values, node) => { + const newRoot = { + ...node, + contexts: { + ...node.contexts, + ...values + } + }; + saveNodes([newRoot]); }; - const selectCell = (e4, index, column) => { - if (platformIsMobile() || column == "+") - return; - selectItem(0, data2[index]["_index"]); - setSelectedColumn(column); - if (e4.detail === 1) { - } else if (e4.detail === 2) { - setCurrentEdit([column, data2[index]["_index"]]); - } + const saveNodeValue = (values, node) => { + const newNodes = { + ...node, + props: { + ...node.props, + ...values + } + }; + saveNodes([newNodes]); }; - const showContextMenu = (e4, index) => { - e4.preventDefault(); - const menu = new import_obsidian39.Menu(); - menu.addItem((item) => { - item.setIcon("trash"); - item.setTitle(i18n_default.menu.deleteRow); - item.onClick(() => { - deleteRow(index); - }); + const saveRootProperty = (name2) => { + saveProperty({ + schemaId: root2.node.id, + type: "text", + name: name2 }); - if (isMouseEvent(e4)) { - menu.showAtPosition({ x: e4.pageX, y: e4.pageY }); - } else { - menu.showAtPosition({ - x: e4.nativeEvent.locationX, - y: e4.nativeEvent.locationY - }); - } }; - function handleDragEnd({ active, over }) { - resetState(); - savePredicate({ - ...predicate, - colsOrder: arrayMove( - predicate.colsOrder, - predicate.colsOrder.findIndex((f4) => f4 == activeId), - predicate.colsOrder.findIndex((f4) => f4 == overId) - ) + const { properties: properties2, saveProperty, delProperty } = q2(FramesEditorContext); + const showMenu = (e4, field) => { + const offset2 = e4.target.getBoundingClientRect(); + showPropertyMenu({ + plugin: props2.plugin, + position: { x: offset2.left, y: offset2.top + 30 }, + editable: true, + options: [], + field: { ...field, table: "" }, + fields: properties2.map((f4) => ({ ...f4, table: "" })), + contextPath: spaceInfo.path, + saveField: (newField) => saveProperty(newField, field), + deleteColumn: delProperty, + editCode: () => props2.editCode(root2.node.id, "props", field.name) }); - } - function handleDragCancel() { - resetState(); - } - function resetState() { - setOverId(null); - setActiveId(null); - document.body.style.setProperty("cursor", ""); - } - return /* @__PURE__ */ Cn.createElement(DndContext, { - sensors, - collisionDetection: closestCenter, - measuring, - onDragStart: handleDragStart, - onDragOver: handleDragOver, - onDragEnd: handleDragEnd, - onDragCancel: handleDragCancel - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-table", - ref: ref2, - tabIndex: 1, - onKeyDown - }, /* @__PURE__ */ Cn.createElement("table", { - ...{} - }, /* @__PURE__ */ Cn.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ Cn.createElement("tr", { - key: headerGroup.id - }, /* @__PURE__ */ Cn.createElement("th", null), headerGroup.headers.map((header) => { - var _a2; - return /* @__PURE__ */ Cn.createElement("th", { - className: "mk-th", - key: header.id, - style: { - minWidth: header.column.getIsGrouped() ? "0px" : (_a2 = colsSize[header.column.columnDef.accessorKey]) != null ? _a2 : "150px" - } - }, header.isPlaceholder ? null : header.column.columnDef.header != "+" ? header.column.getIsGrouped() ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) : /* @__PURE__ */ Cn.createElement(ColumnHeader, { - plugin: props2.plugin, - editable: header.column.columnDef.meta.editable, - column: cols.find( - (f4) => f4.name == header.column.columnDef.header && f4.table == header.column.columnDef.meta.table - ) - }) : /* @__PURE__ */ Cn.createElement(ColumnHeader, { - plugin: props2.plugin, - isNew: true, - editable: true, - column: { - name: "", - schemaId: header.column.columnDef.meta.schemaId, - type: "text", - table: "" - } - }), /* @__PURE__ */ Cn.createElement("div", { - ...{ - onMouseDown: header.getResizeHandler(), - onTouchStart: header.getResizeHandler(), - className: `mk-resizer ${header.column.getIsResizing() ? "isResizing" : ""}` + }; + const showContextMenu = (e4) => { + const offset2 = e4.target.getBoundingClientRect(); + const f4 = loadTags(props2.plugin); + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: false, + editable: true, + value: [], + options: f4.map((m6) => ({ name: m6, value: m6 })), + saveOptions: (_12, value) => addTag(value[0]), + placeholder: i18n_default.labels.contextItemSelectPlaceholder, + searchable: true, + showAll: true } - })); - })))), /* @__PURE__ */ Cn.createElement("tbody", null, table.getRowModel().rows.map((row) => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("tr", { - className: (selectedRows == null ? void 0 : selectedRows.some( - (f4) => f4 == data2[row.index]["_index"] - )) && "mk-is-active", - onContextMenu: (e4) => { - const rowIndex = parseInt( - data2[row.index]["_index"] - ); - showContextMenu(e4, rowIndex); + ); + }; + const addTag = (tag) => { + saveContexts({ ...props2.contexts, [tag]: "" }, root2.node); + }; + const [newProp, setNewProp] = h2(""); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-component" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-title" + }, "Properties"), properties2.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-row", + key: i5 + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field", + onClick: (e4) => showMenu(e4, f4), + "aria-label": f4.type + }, f4.name), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-value" + }, stringIsConst(root2.node.props[f4.name]) ? /* @__PURE__ */ Cn.createElement(DataTypeView, { + plugin: props2.plugin, + initialValue: removeQuotes(root2.node.props[f4.name]), + column: { ...f4, table: "" }, + editable: !spaceInfo.readOnly, + updateFieldValue: (fieldValue, value) => { + saveProperty({ ...f4, value: fieldValue }, f4); + saveNodeValue({ [f4.name]: `"${value}"` }, root2.node); }, - key: row.id - }, /* @__PURE__ */ Cn.createElement("td", null), row.getVisibleCells().map( - (cell, i4) => { - var _a2, _b2; - return cell.getIsGrouped() ? /* @__PURE__ */ Cn.createElement("td", { - key: i4, - className: "mk-td-group", - colSpan: cols.length + (readMode ? 0 : 1) - }, /* @__PURE__ */ Cn.createElement("div", { - ...{ - onClick: row.getToggleExpandedHandler(), - style: { - display: "flex", - alignItems: "center", - cursor: "normal" - } - } - }, flexRender( - cell.column.columnDef.cell, - cell.getContext() - ), " ", "(", row.subRows.length, ")")) : cell.getIsAggregated() ? flexRender( - (_a2 = cell.column.columnDef.aggregatedCell) != null ? _a2 : cell.column.columnDef.cell, - cell.getContext() - ) : /* @__PURE__ */ Cn.createElement("td", { - onClick: (e4) => selectCell( - e4, - cell.row.index, - cell.column.columnDef.accessorKey - ), - className: `${cell.column.columnDef.accessorKey == selectedColumn ? "mk-selected-cell " : ""} mk-td ${cell.getIsPlaceholder() ? "mk-td-empty" : ""}`, - key: cell.id, - style: { - minWidth: cell.getIsPlaceholder() ? "0px" : (_b2 = colsSize[cell.column.columnDef.accessorKey]) != null ? _b2 : "50px" - } - }, cell.getIsPlaceholder() ? null : flexRender( - cell.column.columnDef.cell, - cell.getContext() - )); - } - ))))), /* @__PURE__ */ Cn.createElement("tfoot", null, !readMode ? /* @__PURE__ */ Cn.createElement("tr", null, /* @__PURE__ */ Cn.createElement("th", { - className: "mk-row-new", - colSpan: cols.length + (readMode ? 1 : 2), - onClick: () => { - newRow(); - } - }, "+ New")) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null))), z3( - /* @__PURE__ */ Cn.createElement(DragOverlay, { - dropAnimation: null, - zIndex: 1600 - }, activeId ? /* @__PURE__ */ Cn.createElement(ColumnHeader, { - plugin: props2.plugin, - editable: false, - column: { - name: activeId, - schemaId: tableData.schema.id, - type: "text", - table: "" - } - }) : null), - document.body - ))); + updateValue: (value) => saveNodeValue({ [f4.name]: `"${value}"` }, root2.node) + }) : /* @__PURE__ */ Cn.createElement(CodeEditorSetter, { + name: f4.name, + value: root2.node.props[f4.name], + type: "props", + node: root2.id, + editCode: props2.editCode + })))), /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement(TextCell, { + initialValue: newProp, + saveValue: (value) => saveRootProperty(value), + editMode: 2 /* EditModeActive */, + setEditMode: () => null, + plugin: props2.plugin, + propertyValue: "" + }))); }; -// src/components/Space/Contexts/DataTypeView/BooleanCell.tsx -var BooleanCell = (props2) => { - const { initialValue, saveValue } = props2; - const [value, setValue] = Cn.useState(initialValue == "true"); - const onChange = () => { - if (props2.editMode == -1 /* EditModeReadOnly */) { - return; - } - setValue(!value); - saveValue(!value ? "true" : "false"); +// src/components/Space/Frames/FrameEditor.tsx +var FrameEditor = (props2) => { + var _a2; + const activationConstraint = { + distance: { y: 0 }, + tolerance: { x: 0 } + }; + const mouseSensor = useSensor(MouseSensor, { + activationConstraint + }); + const touchSensor = useSensor(TouchSensor, { + activationConstraint + }); + const keyboardSensor = useSensor(KeyboardSensor, {}); + const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor); + const [tab, setTab] = h2(0); + const { frameSchema } = q2(FramesMDBContext); + const [preselectedProp, setPreselectedProp] = h2(null); + const [preselectedPropType, setPreselectedPropType] = h2(null); + const { + root: root2, + instance, + nodes, + saveNodes: saveFrames, + saveProperty, + setHoverNode, + selectNodes, + selectedNodes, + properties: properties2 + } = q2(FramesEditorContext); + const nodesSelected = (evt) => { + selectNodes( + evt.detail.selection.map((f4) => nodes.find((n2) => n2.id == f4)).filter((f4) => f4) + ); }; p2(() => { - if (props2.editMode == 2 /* EditModeActive */) { - setValue(!value); - saveValue(!value ? "true" : "false"); - props2.setEditMode(null); + window.addEventListener(eventTypes.frameLayerSelected, nodesSelected); + return () => { + window.removeEventListener(eventTypes.frameLayerSelected, nodesSelected); + }; + }, [nodes]); + const editCode = (node, key2, type) => { + setTab(1); + if (!((selectedNodes == null ? void 0 : selectedNodes.length) > 0)) { + if (selectedNodes[0].id != node) { + selectNodes(nodes); + } + } else { } - }, [props2.editMode]); - Cn.useEffect(() => { - setValue(initialValue == "true"); - }, [initialValue]); - if (props2.editMode < 1 /* EditModeView */) { - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-boolean" - }, /* @__PURE__ */ Cn.createElement("input", { - type: "checkbox", - checked: value, - onChange - }), /* @__PURE__ */ Cn.createElement("div", null, props2.column.name)); - } - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-text" - }, /* @__PURE__ */ Cn.createElement("input", { - type: "checkbox", - checked: value, - onChange - })); + setPreselectedProp(key2); + setPreselectedPropType(type); + }; + return /* @__PURE__ */ Cn.createElement(DndContext, { + sensors + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-editor" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-container" + }, instance.root && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-main" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-canvas" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-props-editor" + }, /* @__PURE__ */ Cn.createElement(PropsPanel, { + contexts: (_a2 = root2.node.contexts) != null ? _a2 : {}, + plugin: props2.plugin, + editCode + })), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-canvas-editor" + }, /* @__PURE__ */ Cn.createElement(FrameNodeView, { + editMode: 2, + plugin: props2.plugin, + treeNode: instance.root, + instance + }))))))); }; -// src/components/ui/menus/colorPickerMenu.tsx -var import_obsidian40 = require("obsidian"); -init_compat_module(); - -// node_modules/react-color/es/components/alpha/Alpha.js -init_compat_module(); -var import_reactcss9 = __toESM(require_lib()); - -// node_modules/react-color/es/components/common/Alpha.js -init_compat_module(); -var import_reactcss2 = __toESM(require_lib()); - -// node_modules/react-color/es/helpers/alpha.js -var calculateChange = function calculateChange2(e4, hsl, direction, initialA, container) { - var containerWidth = container.clientWidth; - var containerHeight = container.clientHeight; - var x5 = typeof e4.pageX === "number" ? e4.pageX : e4.touches[0].pageX; - var y5 = typeof e4.pageY === "number" ? e4.pageY : e4.touches[0].pageY; - var left = x5 - (container.getBoundingClientRect().left + window.pageXOffset); - var top = y5 - (container.getBoundingClientRect().top + window.pageYOffset); - if (direction === "vertical") { - var a5 = void 0; - if (top < 0) { - a5 = 0; - } else if (top > containerHeight) { - a5 = 1; - } else { - a5 = Math.round(top * 100 / containerHeight) / 100; - } - if (hsl.a !== a5) { - return { - h: hsl.h, - s: hsl.s, - l: hsl.l, - a: a5, - source: "rgb" - }; - } - } else { - var _a2 = void 0; - if (left < 0) { - _a2 = 0; - } else if (left > containerWidth) { - _a2 = 1; - } else { - _a2 = Math.round(left * 100 / containerWidth) / 100; - } - if (initialA !== _a2) { - return { - h: hsl.h, - s: hsl.s, - l: hsl.l, - a: _a2, - source: "rgb" - }; - } +// src/components/Space/Frames/FrameEditorView.tsx +var FRAME_EDITOR_TYPE = "mk-frame-editor"; +var openFrameEditor = async (plugin, path, schema) => { + const leaf = app.workspace.getLeaf(false); + plugin.openFileContextLeaf(); + const viewType = FRAME_EDITOR_TYPE; + app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { path, schema } + }); + await app.workspace.requestSaveLayout(); + if (path) { + const evt2 = new CustomEvent(eventTypes.activePathChange, { + detail: { path: uriByString(path) } + }); + window.dispatchEvent(evt2); + const evt = new CustomEvent(eventTypes.frameSelected, { + detail: { path: uriByString(path + "#*" + schema) } + }); + window.dispatchEvent(evt); } - return null; }; - -// node_modules/react-color/es/components/common/Checkboard.js -init_compat_module(); -var import_reactcss = __toESM(require_lib()); - -// node_modules/react-color/es/helpers/checkboard.js -var checkboardCache = {}; -var render = function render2(c1, c22, size, serverCanvas) { - if (typeof document === "undefined" && !serverCanvas) { - return null; +var FrameEditorView = class extends import_obsidian35.ItemView { + constructor(leaf, plugin, viewType) { + super(leaf); + this.navigation = true; + this.plugin = plugin; + this.viewType = viewType; } - var canvas = serverCanvas ? new serverCanvas() : document.createElement("canvas"); - canvas.width = size * 2; - canvas.height = size * 2; - var ctx = canvas.getContext("2d"); - if (!ctx) { - return null; + getViewType() { + return FRAME_EDITOR_TYPE; } - ctx.fillStyle = c1; - ctx.fillRect(0, 0, canvas.width, canvas.height); - ctx.fillStyle = c22; - ctx.fillRect(0, 0, size, size); - ctx.translate(size, size); - ctx.fillRect(0, 0, size, size); - return canvas.toDataURL(); -}; -var get = function get2(c1, c22, size, serverCanvas) { - var key2 = c1 + "-" + c22 + "-" + size + (serverCanvas ? "-server" : ""); - if (checkboardCache[key2]) { - return checkboardCache[key2]; + getDisplayText() { + var _a2; + return (_a2 = this.space) == null ? void 0 : _a2.name; } - var checkboard = render(c1, c22, size, serverCanvas); - checkboardCache[key2] = checkboard; - return checkboard; -}; - -// node_modules/react-color/es/components/common/Checkboard.js -var _extends = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; - for (var key2 in source) { - if (Object.prototype.hasOwnProperty.call(source, key2)) { - target[key2] = source[key2]; - } - } + async onClose() { + this.destroy(); } - return target; -}; -var Checkboard = function Checkboard2(_ref) { - var white = _ref.white, grey = _ref.grey, size = _ref.size, renderers = _ref.renderers, borderRadius = _ref.borderRadius, boxShadow = _ref.boxShadow, children = _ref.children; - var styles2 = (0, import_reactcss.default)({ - "default": { - grid: { - borderRadius, - boxShadow, - absolute: "0px 0px 0px 0px", - background: "url(" + get(white, grey, size, renderers.canvas) + ") center left" - } - } - }); - return an(children) ? Cn.cloneElement(children, _extends({}, children.props, { style: _extends({}, children.props.style, styles2.grid) })) : Cn.createElement("div", { style: styles2.grid }); -}; -Checkboard.defaultProps = { - size: 8, - white: "transparent", - grey: "rgba(0,0,0,.08)", - renderers: {} -}; -var Checkboard_default = Checkboard; - -// node_modules/react-color/es/components/common/Alpha.js -var _extends2 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; - for (var key2 in source) { - if (Object.prototype.hasOwnProperty.call(source, key2)) { - target[key2] = source[key2]; - } - } + destroy() { + if (this.root) + this.root.unmount(); } - return target; -}; -var _createClass = function() { - function defineProperties(target, props2) { - for (var i4 = 0; i4 < props2.length; i4++) { - var descriptor = props2[i4]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); + async onOpen() { + this.destroy(); + } + async setState(state, result) { + this.space = spaceInfoByPath(this.plugin, state.path); + this.schema = state.schema; + if (!this.space) + return; + this.constructNote(this.space, this.schema); + const displayName = pathDisplayName(this.space.uri, this.plugin); + await super.setState(state, result); + this.leaf.tabHeaderInnerTitleEl.innerText = displayName; + this.leaf.view.titleEl = displayName; + const headerEl = this.leaf.view.headerEl; + if (headerEl) { + headerEl.querySelector(".view-header-title").innerText = displayName; } + result.history = true; + return; } - return function(Constructor, protoProps, staticProps) { - if (protoProps) - defineProperties(Constructor.prototype, protoProps); - if (staticProps) - defineProperties(Constructor, staticProps); - return Constructor; - }; -}(); -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + getState() { + var _a2, _b2; + const state = super.getState(); + state.path = (_b2 = (_a2 = this.space) == null ? void 0 : _a2.uri) == null ? void 0 : _b2.fullPath; + state.schema = this.schema; + return state; } -} -function _possibleConstructorReturn(self2, call) { - if (!self2) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + constructNote(space2, schema) { + this.destroy(); + this.root = createRoot(this.contentEl); + this.root.render( + /* @__PURE__ */ Cn.createElement("div", { + className: "mk-space-view" + }, /* @__PURE__ */ Cn.createElement(SpaceContextProvider, { + plugin: this.plugin, + space: space2 + }, /* @__PURE__ */ Cn.createElement(FramesMDBProvider, { + plugin: this.plugin, + schema + }, /* @__PURE__ */ Cn.createElement(FramesEditorProvider, { + plugin: this.plugin, + props: {} + }, /* @__PURE__ */ Cn.createElement(FrameEditor, { + plugin: this.plugin + }))))) + ); } - return call && (typeof call === "object" || typeof call === "function") ? call : self2; -} -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); +}; + +// src/components/ui/modals/editSpaceModal.tsx +var import_obsidian36 = require("obsidian"); +var EditSpaceModal = class extends import_obsidian36.Modal { + constructor(plugin, space2, action, def) { + super(plugin.app); + this.space = space2; + this.action = action; + this.plugin = plugin; + this.def = def; } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); - if (superClass) - Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; -} -var Alpha = function(_ref) { - _inherits(Alpha2, _ref); - function Alpha2() { - var _ref2; - var _temp, _this, _ret; - _classCallCheck(this, Alpha2); - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref2 = Alpha2.__proto__ || Object.getPrototypeOf(Alpha2)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function(e4) { - var change = calculateChange(e4, _this.props.hsl, _this.props.direction, _this.props.a, _this.container); - change && typeof _this.props.onChange === "function" && _this.props.onChange(change, e4); - }, _this.handleMouseDown = function(e4) { - _this.handleChange(e4); - window.addEventListener("mousemove", _this.handleChange); - window.addEventListener("mouseup", _this.handleMouseUp); - }, _this.handleMouseUp = function() { - _this.unbindEventListeners(); - }, _this.unbindEventListeners = function() { - window.removeEventListener("mousemove", _this.handleChange); - window.removeEventListener("mouseup", _this.handleMouseUp); - }, _temp), _possibleConstructorReturn(_this, _ret); - } - _createClass(Alpha2, [{ - key: "componentWillUnmount", - value: function componentWillUnmount() { - this.unbindEventListeners(); + onOpen() { + const { contentEl } = this; + let headerText; + if (this.action === "rename") { + headerText = i18n_default.labels.renameSection; + } else if (this.action === "create") { + headerText = i18n_default.labels.createSection; } - }, { - key: "render", - value: function render3() { - var _this2 = this; - var rgb = this.props.rgb; - var styles2 = (0, import_reactcss2.default)({ - "default": { - alpha: { - absolute: "0px 0px 0px 0px", - borderRadius: this.props.radius - }, - checkboard: { - absolute: "0px 0px 0px 0px", - overflow: "hidden", - borderRadius: this.props.radius - }, - gradient: { - absolute: "0px 0px 0px 0px", - background: "linear-gradient(to right, rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 0) 0%,\n rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 1) 100%)", - boxShadow: this.props.shadow, - borderRadius: this.props.radius - }, - container: { - position: "relative", - height: "100%", - margin: "0 3px" - }, - pointer: { - position: "absolute", - left: rgb.a * 100 + "%" - }, - slider: { - width: "4px", - borderRadius: "1px", - height: "8px", - boxShadow: "0 0 2px rgba(0, 0, 0, .6)", - background: "#fff", - marginTop: "1px", - transform: "translateX(-2px)" - } - }, - "vertical": { - gradient: { - background: "linear-gradient(to bottom, rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 0) 0%,\n rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 1) 100%)" - }, - pointer: { - left: 0, - top: rgb.a * 100 + "%" - } - }, - "overwrite": _extends2({}, this.props.style) - }, { - vertical: this.props.direction === "vertical", - overwrite: true - }); - return Cn.createElement( - "div", - { style: styles2.alpha }, - Cn.createElement( - "div", - { style: styles2.checkboard }, - Cn.createElement(Checkboard_default, { renderers: this.props.renderers }) - ), - Cn.createElement("div", { style: styles2.gradient }), - Cn.createElement( - "div", - { - style: styles2.container, - ref: function ref2(container) { - return _this2.container = container; - }, - onMouseDown: this.handleMouseDown, - onTouchMove: this.handleChange, - onTouchStart: this.handleChange - }, - Cn.createElement( - "div", - { style: styles2.pointer }, - this.props.pointer ? Cn.createElement(this.props.pointer, this.props) : Cn.createElement("div", { style: styles2.slider }) - ) - ) - ); + const headerEl = contentEl.createEl("div", { text: headerText }); + headerEl.addClass("modal-title"); + const inputEl = contentEl.createEl("input"); + inputEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; + if (this.action === "rename") { + inputEl.value = this.space.name; } - }]); - return Alpha2; -}(w3 || k); -var Alpha_default = Alpha; - -// node_modules/react-color/es/components/common/EditableInput.js -init_compat_module(); -var import_reactcss3 = __toESM(require_lib()); -var _createClass2 = function() { - function defineProperties(target, props2) { - for (var i4 = 0; i4 < props2.length; i4++) { - var descriptor = props2[i4]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); + inputEl.focus(); + let changeButtonText; + if (this.action === "rename") { + changeButtonText = i18n_default.buttons.saveSpace; + } else if (this.action === "create") { + changeButtonText = i18n_default.buttons.saveSpace; } - } - return function(Constructor, protoProps, staticProps) { - if (protoProps) - defineProperties(Constructor.prototype, protoProps); - if (staticProps) - defineProperties(Constructor, staticProps); - return Constructor; - }; -}(); -function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; - } - return obj; -} -function _classCallCheck2(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} -function _possibleConstructorReturn2(self2, call) { - if (!self2) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return call && (typeof call === "object" || typeof call === "function") ? call : self2; -} -function _inherits2(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); - if (superClass) - Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; -} -var DEFAULT_ARROW_OFFSET = 1; -var UP_KEY_CODE = 38; -var DOWN_KEY_CODE = 40; -var VALID_KEY_CODES = [UP_KEY_CODE, DOWN_KEY_CODE]; -var isValidKeyCode = function isValidKeyCode2(keyCode) { - return VALID_KEY_CODES.indexOf(keyCode) > -1; -}; -var getNumberValue = function getNumberValue2(value) { - return Number(String(value).replace(/%/g, "")); -}; -var idCounter = 1; -var EditableInput = function(_ref) { - _inherits2(EditableInput2, _ref); - function EditableInput2(props2) { - _classCallCheck2(this, EditableInput2); - var _this = _possibleConstructorReturn2(this, (EditableInput2.__proto__ || Object.getPrototypeOf(EditableInput2)).call(this)); - _this.handleBlur = function() { - if (_this.state.blurValue) { - _this.setState({ value: _this.state.blurValue, blurValue: null }); - } - }; - _this.handleChange = function(e4) { - _this.setUpdatedValue(e4.target.value, e4); - }; - _this.handleKeyDown = function(e4) { - var value = getNumberValue(e4.target.value); - if (!isNaN(value) && isValidKeyCode(e4.keyCode)) { - var offset2 = _this.getArrowOffset(); - var updatedValue = e4.keyCode === UP_KEY_CODE ? value + offset2 : value - offset2; - _this.setUpdatedValue(updatedValue, e4); + const changeButton = contentEl.createEl("button", { + text: changeButtonText + }); + const cancelButton = contentEl.createEl("button", { + text: i18n_default.buttons.cancel + }); + cancelButton.style.cssText = "float: right;"; + cancelButton.addEventListener("click", () => { + this.close(); + }); + const onClickAction = async () => { + var _a2; + const newName = inputEl.value.replace(/\//g, ""); + if (newName.length == 0) { + new import_obsidian36.Notice(i18n_default.notice.newSpaceName); + return; } - }; - _this.handleDrag = function(e4) { - if (_this.props.dragLabel) { - var newValue = Math.round(_this.props.value + e4.movementX); - if (newValue >= 0 && newValue <= _this.props.dragMax) { - _this.props.onChange && _this.props.onChange(_this.getValueObjectWithLabel(newValue), e4); - } + if (this.plugin.index.spacesIndex.has(newName) && newName != this.space.name) { + new import_obsidian36.Notice(i18n_default.notice.duplicateSpaceName); + return; } - }; - _this.handleMouseDown = function(e4) { - if (_this.props.dragLabel) { - e4.preventDefault(); - _this.handleDrag(e4); - window.addEventListener("mousemove", _this.handleDrag); - window.addEventListener("mouseup", _this.handleMouseUp); + if (this.action === "rename") { + renamePath(this.plugin, this.space.space.uri, newName); + } else if (this.action === "create") { + await insertSpaceAtIndex(this.plugin, newName, { + def: (_a2 = this.def) != null ? _a2 : { + type: "links" + }, + contexts: [] + }); + openSpace(spacePathFromName(newName), this.plugin, false); } + this.close(); }; - _this.handleMouseUp = function() { - _this.unbindEventListeners(); - }; - _this.unbindEventListeners = function() { - window.removeEventListener("mousemove", _this.handleDrag); - window.removeEventListener("mouseup", _this.handleMouseUp); - }; - _this.state = { - value: String(props2.value).toUpperCase(), - blurValue: String(props2.value).toUpperCase() - }; - _this.inputId = "rc-editable-input-" + idCounter++; - return _this; + changeButton.addEventListener("click", onClickAction); + inputEl.addEventListener("keydown", (e4) => { + if (e4.key === "Enter") + onClickAction(); + }); } - _createClass2(EditableInput2, [{ - key: "componentDidUpdate", - value: function componentDidUpdate(prevProps, prevState) { - if (this.props.value !== this.state.value && (prevProps.value !== this.props.value || prevState.value !== this.state.value)) { - if (this.input === document.activeElement) { - this.setState({ blurValue: String(this.props.value).toUpperCase() }); - } else { - this.setState({ value: String(this.props.value).toUpperCase(), blurValue: !this.state.blurValue && String(this.props.value).toUpperCase() }); - } - } - } - }, { - key: "componentWillUnmount", - value: function componentWillUnmount() { - this.unbindEventListeners(); - } - }, { - key: "getValueObjectWithLabel", - value: function getValueObjectWithLabel(value) { - return _defineProperty({}, this.props.label, value); - } - }, { - key: "getArrowOffset", - value: function getArrowOffset() { - return this.props.arrowOffset || DEFAULT_ARROW_OFFSET; - } - }, { - key: "setUpdatedValue", - value: function setUpdatedValue(value, e4) { - var onChangeValue = this.props.label ? this.getValueObjectWithLabel(value) : value; - this.props.onChange && this.props.onChange(onChangeValue, e4); - this.setState({ value }); - } - }, { - key: "render", - value: function render3() { - var _this2 = this; - var styles2 = (0, import_reactcss3.default)({ - "default": { - wrap: { - position: "relative" - } - }, - "user-override": { - wrap: this.props.style && this.props.style.wrap ? this.props.style.wrap : {}, - input: this.props.style && this.props.style.input ? this.props.style.input : {}, - label: this.props.style && this.props.style.label ? this.props.style.label : {} - }, - "dragLabel-true": { - label: { - cursor: "ew-resize" - } - } - }, { - "user-override": true - }, this.props); - return Cn.createElement( - "div", - { style: styles2.wrap }, - Cn.createElement("input", { - id: this.inputId, - style: styles2.input, - ref: function ref2(input) { - return _this2.input = input; - }, - value: this.state.value, - onKeyDown: this.handleKeyDown, - onChange: this.handleChange, - onBlur: this.handleBlur, - placeholder: this.props.placeholder, - spellCheck: "false" - }), - this.props.label && !this.props.hideLabel ? Cn.createElement( - "label", - { - htmlFor: this.inputId, - style: styles2.label, - onMouseDown: this.handleMouseDown - }, - this.props.label - ) : null - ); - } - }]); - return EditableInput2; -}(w3 || k); -var EditableInput_default = EditableInput; + onClose() { + const { contentEl } = this; + contentEl.empty(); + } +}; -// node_modules/react-color/es/components/common/Hue.js -init_compat_module(); -var import_reactcss4 = __toESM(require_lib()); +// src/components/ui/menus/fileMenu.tsx +var import_obsidian37 = require("obsidian"); -// node_modules/react-color/es/helpers/hue.js -var calculateChange3 = function calculateChange4(e4, direction, hsl, container) { - var containerWidth = container.clientWidth; - var containerHeight = container.clientHeight; - var x5 = typeof e4.pageX === "number" ? e4.pageX : e4.touches[0].pageX; - var y5 = typeof e4.pageY === "number" ? e4.pageY : e4.touches[0].pageY; - var left = x5 - (container.getBoundingClientRect().left + window.pageXOffset); - var top = y5 - (container.getBoundingClientRect().top + window.pageYOffset); - if (direction === "vertical") { - var h5 = void 0; - if (top < 0) { - h5 = 359; - } else if (top > containerHeight) { - h5 = 0; - } else { - var percent = -(top * 100 / containerHeight) + 100; - h5 = 360 * percent / 100; - } - if (hsl.h !== h5) { - return { - h: h5, - s: hsl.s, - l: hsl.l, - a: hsl.a, - source: "hsl" - }; - } +// src/utils/color.ts +var colors = [ + ["Red", "#eb3b5a"], + ["Orange", "#fa8231"], + ["Yellow", "#f7b731"], + ["Green", "#20bf6b"], + ["Turquoise", "#0fb9b1"], + ["Teal", "#2d98da"], + ["Blue", "#3867d6"], + ["Purple", "#8854d0"], + ["Charcoal", "#4b6584"] +]; + +// src/components/ui/menus/fileMenu.tsx +var triggerSectionAddMenu = (plugin, e4, space2, activeFile) => { + const fileMenu = new import_obsidian37.Menu(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("edit"); + menuItem.setTitle(i18n_default.buttons.createNote); + menuItem.onClick((ev) => { + newFileInSpace(plugin, space2, null); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("layout-dashboard"); + menuItem.setTitle(i18n_default.buttons.createCanvas); + menuItem.onClick((ev) => { + newFileInSpace(plugin, space2, activeFile, true); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("folder-plus"); + menuItem.setTitle(i18n_default.buttons.createFolder); + menuItem.onClick((ev) => { + newFolderInSpace(plugin, space2, activeFile); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("plus"); + menuItem.setTitle(i18n_default.buttons.createSection); + menuItem.onClick((ev) => { + const vaultChangeModal = new EditSpaceModal(plugin, null, "create"); + vaultChangeModal.open(); + }); + }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); } else { - var _h = void 0; - if (left < 0) { - _h = 0; - } else if (left > containerWidth) { - _h = 359; - } else { - var _percent = left * 100 / containerWidth; - _h = 360 * _percent / 100; - } - if (hsl.h !== _h) { - return { - h: _h, - s: hsl.s, - l: hsl.l, - a: hsl.a, - source: "hsl" - }; - } + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); } - return null; + return false; }; - -// node_modules/react-color/es/components/common/Hue.js -var _createClass3 = function() { - function defineProperties(target, props2) { - for (var i4 = 0; i4 < props2.length; i4++) { - var descriptor = props2[i4]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - return function(Constructor, protoProps, staticProps) { - if (protoProps) - defineProperties(Constructor.prototype, protoProps); - if (staticProps) - defineProperties(Constructor, staticProps); - return Constructor; - }; -}(); -function _classCallCheck3(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} -function _possibleConstructorReturn3(self2, call) { - if (!self2) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return call && (typeof call === "object" || typeof call === "function") ? call : self2; -} -function _inherits3(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); - if (superClass) - Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; -} -var Hue = function(_ref) { - _inherits3(Hue2, _ref); - function Hue2() { - var _ref2; - var _temp, _this, _ret; - _classCallCheck3(this, Hue2); - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - return _ret = (_temp = (_this = _possibleConstructorReturn3(this, (_ref2 = Hue2.__proto__ || Object.getPrototypeOf(Hue2)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function(e4) { - var change = calculateChange3(e4, _this.props.direction, _this.props.hsl, _this.container); - change && typeof _this.props.onChange === "function" && _this.props.onChange(change, e4); - }, _this.handleMouseDown = function(e4) { - _this.handleChange(e4); - window.addEventListener("mousemove", _this.handleChange); - window.addEventListener("mouseup", _this.handleMouseUp); - }, _this.handleMouseUp = function() { - _this.unbindEventListeners(); - }, _temp), _possibleConstructorReturn3(_this, _ret); +var triggerSpaceMenu = (plugin, space2, e4, activeFile, parentSpace) => { + if (!space2) + return; + const spaceMenu = new import_obsidian37.Menu(); + spaceMenu.addItem((menuItem) => { + menuItem.setIcon("arrow-up-right"); + menuItem.setTitle("Reveal in Finder"); + menuItem.onClick((ev) => { + const file = getAbstractFileAtPath( + app, + space2.type == "folder" ? space2.path : `${plugin.settings.spacesFolder}/${space2.name}` + ); + if (file instanceof import_obsidian37.TFolder) { + const leaf = app.workspace.getLeaf(false); + app.workspace.setActiveLeaf(leaf, { focus: true }); + leaf.openFile(file, { eState: { focus: true } }); + } + }); + }); + spaceMenu.addItem((menuItem) => { + menuItem.setIcon("edit"); + menuItem.setTitle(i18n_default.buttons.createNote); + menuItem.onClick((ev) => { + newFileInSpace(plugin, space2, activeFile); + }); + }); + spaceMenu.addItem((menuItem) => { + menuItem.setIcon("layout-dashboard"); + menuItem.setTitle(i18n_default.buttons.createCanvas); + menuItem.onClick((ev) => { + newFileInSpace(plugin, space2, activeFile, true); + }); + }); + spaceMenu.addItem((menuItem) => { + menuItem.setIcon("folder-plus"); + menuItem.setTitle(i18n_default.buttons.createFolder); + menuItem.onClick((ev) => { + newFolderInSpace(plugin, space2, activeFile); + }); + }); + spaceMenu.addSeparator(); + spaceMenu.addItem((menuItem) => { + menuItem.setIcon("plus-square"); + menuItem.setTitle("Edit Frame"); + menuItem.onClick((ev) => { + openFrameEditor(plugin, space2.path, "main"); + }); + }); + spaceMenu.addItem((menuItem) => { + menuItem.setIcon("plus-square"); + menuItem.setTitle("Add to Space"); + menuItem.onClick((ev) => { + const vaultChangeModal = new AddToSpaceModal(plugin, [space2.path]); + vaultChangeModal.open(); + }); + }); + spaceMenu.addItem((menuItem) => { + const pinned = plugin.settings.waypoints.some((f4) => f4 == space2.path); + menuItem.setTitle(pinned ? i18n_default.menu.unpinSpace : i18n_default.menu.pinSpace); + menuItem.setIcon("pin"); + menuItem.onClick((ev) => { + toggleSpacePin(plugin, space2.path, "pinned", pinned); + }); + }); + if (space2) { + const spaceCache = plugin.index.spacesIndex.get(parentSpace); + if (spaceCache) { + spaceMenu.addItem((menuItem) => { + menuItem.setIcon("minus-square"); + menuItem.setTitle("Remove from Space"); + menuItem.onClick((ev) => { + removePathsFromSpace(plugin, spaceCache, [space2.path]); + }); + }); + } + } + spaceMenu.addSeparator(); + if (plugin.settings.spacesStickers) { + spaceMenu.addSeparator(); + spaceMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.changeIcon); + menuItem.setIcon("lucide-sticker"); + menuItem.onClick((ev) => { + const vaultChangeModal = new stickerModal( + plugin.app, + plugin, + (emoji) => saveSpaceIcon(plugin, space2.path, emoji) + ); + vaultChangeModal.open(); + }); + }); + spaceMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.removeIcon); + menuItem.setIcon("lucide-file-minus"); + menuItem.onClick((ev) => { + removeSpaceIcon(plugin, space2.path); + }); + }); + } + spaceMenu.addSeparator(); + spaceMenu.addSeparator(); + if (space2.type == "links" || space2.type == "folder" || space2.type == "vault") { + spaceMenu.addItem((menuItem) => { + const sortOption = ["rank", true]; + menuItem.setIcon("arrow-up-down"); + menuItem.setTitle(i18n_default.menu.customSort); + menuItem.setChecked( + space2.metadata.sort == JSON.stringify(sortOption) || space2.metadata.sort == "" + ); + menuItem.onClick((ev) => { + updateSpaceSort(plugin, space2.path, sortOption); + }); + }); + } + spaceMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.sortBy); + menuItem.setIcon("sort-desc"); + menuItem.onClick((ev) => { + const sortMenu = new import_obsidian37.Menu(); + sortMenu.addItem((menuItem2) => { + const sortOption = ["name", true]; + menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaAsc); + menuItem2.setChecked(space2.metadata.sort == JSON.stringify(sortOption)); + menuItem2.onClick((ev2) => { + updateSpaceSort(plugin, space2.path, sortOption); + }); + }); + sortMenu.addItem((menuItem2) => { + const sortOption = ["name", false]; + menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaDesc); + menuItem2.setChecked(space2.metadata.sort == JSON.stringify(sortOption)); + menuItem2.onClick((ev2) => { + updateSpaceSort(plugin, space2.path, sortOption); + }); + }); + sortMenu.addSeparator(); + sortMenu.addItem((menuItem2) => { + const sortOption = ["ctime", false]; + menuItem2.setTitle(i18n_default.menu.createdTimeSortAsc); + menuItem2.setChecked(space2.metadata.sort == JSON.stringify(sortOption)); + menuItem2.onClick((ev2) => { + updateSpaceSort(plugin, space2.path, sortOption); + }); + }); + sortMenu.addItem((menuItem2) => { + const sortOption = ["ctime", true]; + menuItem2.setTitle(i18n_default.menu.createdTimeSortDesc); + menuItem2.setChecked(space2.metadata.sort == JSON.stringify(sortOption)); + menuItem2.onClick((ev2) => { + updateSpaceSort(plugin, space2.path, sortOption); + }); + }); + const offset2 = e4.target.getBoundingClientRect(); + if (isMouseEvent(e4)) { + sortMenu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); + } else { + sortMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }); + }); + spaceMenu.addSeparator(); + if (space2.type != "vault") + spaceMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.edit); + menuItem.setIcon("pencil"); + menuItem.onClick((ev) => { + const vaultChangeModal = new EditSpaceModal(plugin, space2, "rename"); + vaultChangeModal.open(); + }); + }); + if (space2.type != "vault") + spaceMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.deleteSpace); + menuItem.setIcon("trash"); + menuItem.onClick((ev) => { + removeSpace(plugin, space2.path); + }); + }); + if (isMouseEvent(e4)) { + spaceMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + spaceMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + return false; +}; +var triggerMultiFileMenu = (plugin, selectedFiles, e4) => { + const files = selectedFiles.map((s6) => s6.item.path); + const fileMenu = new import_obsidian37.Menu(); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("plus"); + menuItem.setTitle("Add to Space"); + menuItem.onClick((ev) => { + const vaultChangeModal = new AddToSpaceModal( + plugin, + selectedFiles.map((f4) => f4.path) + ); + vaultChangeModal.open(); + }); + }); + if (plugin.settings.spacesStickers) { + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("palette"); + disclosureMenuItem( + plugin, + menuItem, + false, + false, + i18n_default.menu.changeColor, + "", + [ + { name: "None", value: "" }, + ...colors.map((f4) => ({ name: f4[0], value: f4[1] })) + ], + (_12, values) => { + saveFileColors(plugin, files, values[0]); + } + ); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.changeIcon); + menuItem.setIcon("lucide-sticker"); + menuItem.onClick((ev) => { + const vaultChangeModal = new stickerModal( + plugin.app, + plugin, + (emoji) => saveFileIcons(plugin, files, emoji) + ); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.removeIcon); + menuItem.setIcon("lucide-file-minus"); + menuItem.onClick((ev) => { + removeFileIcons(plugin, files); + }); + }); + } + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.deleteFiles); + menuItem.setIcon("trash"); + menuItem.onClick((ev) => { + deleteFiles(plugin, files); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("go-to-file"); + menuItem.setTitle(i18n_default.menu.openFilePane); + menuItem.onClick((ev) => { + files.forEach( + (file) => openAFile(getAbstractFileAtPath(app, file), plugin, true) + ); + }); + }); + if (!internalPluginLoaded("file-explorer", plugin.app)) { + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.moveFile); + menuItem.setIcon("paper-plane"); + menuItem.onClick((ev) => { + const fileMoveSuggester = new MoveSuggestionModal(plugin.app, files); + fileMoveSuggester.open(); + }); + }); + } + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + return false; +}; +var triggerFileMenu = (plugin, file, isFolder, e4, space2) => { + const cache2 = plugin.index.filesIndex.get(file.path); + const fileMenu = new import_obsidian37.Menu(); + if (isFolder) { + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("edit"); + menuItem.setTitle(i18n_default.buttons.createNote); + menuItem.onClick((ev) => { + newFileInFolder(plugin, file); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("layout-dashboard"); + menuItem.setTitle(i18n_default.buttons.createCanvas); + menuItem.onClick((ev) => { + createNewCanvasFile(plugin, file, ""); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("folder-plus"); + menuItem.setTitle(i18n_default.buttons.createFolder); + menuItem.onClick((ev) => { + const vaultChangeModal = new VaultChangeModal( + plugin, + file, + "create folder" + ); + vaultChangeModal.open(); + }); + }); + } + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("plus-square"); + menuItem.setTitle("Add to Space"); + menuItem.onClick((ev) => { + const vaultChangeModal = new AddToSpaceModal(plugin, [file.path]); + vaultChangeModal.open(); + }); + }); + if (space2) { + const spaceCache = plugin.index.spacesIndex.get(space2); + if (spaceCache) { + fileMenu.addItem((menuItem) => { + menuItem.setIcon("minus-square"); + menuItem.setTitle("Remove from Space"); + menuItem.onClick((ev) => { + removePathsFromSpace(plugin, spaceCache, [file.path]); + }); + }); + } + } + if (isFolder && cache2) { + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.customSort); + menuItem.setIcon("arrow-up-down"); + menuItem.setChecked(cache2.sortBy == ""); + menuItem.onClick((ev) => { + saveFolderSort(plugin, file.path, ""); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.sortBy); + menuItem.setIcon("sort-desc"); + menuItem.onClick((ev) => { + const sortMenu = new import_obsidian37.Menu(); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaAsc); + menuItem2.setChecked(cache2.sortBy == "name_asc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "name_asc"); + }); + }); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.fileNameSortAlphaDesc); + menuItem2.setChecked(cache2.sortBy == "name_desc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "name_desc"); + }); + }); + sortMenu.addSeparator(); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.createdTimeSortAsc); + menuItem2.setChecked(cache2.sortBy == "ctime_asc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "ctime_asc"); + }); + }); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.createdTimeSortDesc); + menuItem2.setChecked(cache2.sortBy == "ctime_desc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "ctime_desc"); + }); + }); + sortMenu.addSeparator(); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.modifiedTimeSortAsc); + menuItem2.setChecked(cache2.sortBy == "mtime_asc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "mtime_asc"); + }); + }); + sortMenu.addItem((menuItem2) => { + menuItem2.setTitle(i18n_default.menu.modifiedTimeSortDesc); + menuItem2.setChecked(cache2.sortBy == "mtime_desc"); + menuItem2.onClick((ev2) => { + saveFolderSort(plugin, file.path, "mtime_desc"); + }); + }); + const offset2 = e4.target.getBoundingClientRect(); + if (isMouseEvent(e4)) { + sortMenu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); + } else { + sortMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }); + }); + } + if (plugin.settings.spacesStickers) { + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setIcon("palette"); + disclosureMenuItem( + plugin, + menuItem, + false, + false, + i18n_default.menu.changeColor, + "", + [ + { name: "None", value: "" }, + ...colors.map((f4) => ({ name: f4[0], value: f4[1] })) + ], + (_12, values) => { + saveFileColor(plugin, file.path, values[0]); + } + ); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.changeIcon); + menuItem.setIcon("lucide-sticker"); + menuItem.onClick((ev) => { + const vaultChangeModal = new stickerModal( + plugin.app, + plugin, + (emoji) => saveFileIcon(plugin, file, emoji) + ); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.buttons.removeIcon); + menuItem.setIcon("lucide-file-minus"); + menuItem.onClick((ev) => { + removeFileIcon(plugin, file); + }); + }); + } + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.rename); + menuItem.setIcon("pencil"); + menuItem.onClick((ev) => { + const vaultChangeModal = new VaultChangeModal(plugin, file, "rename"); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.delete); + menuItem.setIcon("trash"); + menuItem.onClick((ev) => { + const deleteOption = plugin.settings.deleteFileOption; + if (deleteOption === "permanent") { + plugin.app.vault.delete(file, true); + } else if (deleteOption === "system-trash") { + plugin.app.vault.trash(file, true); + } else if (deleteOption === "trash") { + plugin.app.vault.trash(file, false); + } + }); + }); + if (!isFolder) { + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.changeToFolderNote); + menuItem.setIcon("file-plus-2"); + menuItem.onClick((ev) => { + if (file instanceof import_obsidian37.TFile) + noteToFolderNote(plugin, file, true); + }); + }); + } + fileMenu.addItem((menuItem) => { + menuItem.setIcon("go-to-file"); + menuItem.setTitle(i18n_default.menu.openFilePane); + menuItem.onClick((ev) => { + openFileInNewPane(plugin, { ...file, isFolder }); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.duplicate); + menuItem.setIcon("documents"); + menuItem.onClick((ev) => { + if (file.basename && file.extension) + plugin.app.vault.copy( + file, + `${file.parent.path}/${file.basename} 1.${file.extension}` + ); + }); + }); + if (!internalPluginLoaded("file-explorer", plugin.app)) { + fileMenu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.moveFile); + menuItem.setIcon("paper-plane"); + menuItem.onClick((ev) => { + const fileMoveSuggester = new MoveSuggestionModal(plugin.app, [ + file.path + ]); + fileMoveSuggester.open(); + }); + }); + } + plugin.app.workspace.trigger("file-menu", fileMenu, file, "file-explorer"); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + return false; +}; + +// src/components/Space/Contexts/DataTypeView/FileCell.tsx +var import_obsidian38 = require("obsidian"); +init_compat_module(); +var FileCell = (props2) => { + const fileOrCleanPath = (f4) => { + if (!f4) + return { + path: "" + }; + const fileCache = props2.plugin.index.filesIndex.get(f4); + return fileCache ? { path: f4, fileCache } : { path: f4 }; + }; + const value = F2( + () => { + var _a2; + return (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).map((f4) => fileOrCleanPath(f4)); + }, + [props2.initialValue] + ); + const ref2 = _2(null); + const onKeyDown = (e4) => { + e4.stopPropagation(); + e4.key == "Enter" && e4.target.blur(); + }; + const fileExists = (name2) => { + if (!name2) + return false; + return getAbstractFileAtPath(app, name2) ? true : false; + }; + const onBlur = () => { + var _a2; + if (!ref2.current) + return; + if (fileExists((_a2 = ref2.current) == null ? void 0 : _a2.value)) { + new import_obsidian38.Notice(i18n_default.notice.fileExists); + } else { + props2.saveValue(ref2.current.value); + props2.setEditMode(null); + } + }; + const newFile = async (file) => { + const filePath = file.path.replace(/\//g, "").replace(/\./g, ""); + const path = `${props2.folder}/${filePath}.md`; + if (filePath.length == 0) { + return; + } + if (fileExists(path)) { + new import_obsidian38.Notice(i18n_default.notice.fileExists); + } else { + await createNewMarkdownFile( + props2.plugin, + getAbstractFileAtPath(app, props2.folder), + filePath + ); + } + }; + const deleteRow = () => { + props2.deleteRow(); + }; + p2(() => { + var _a2; + if (props2.editMode == 2) { + (_a2 = ref2 == null ? void 0 : ref2.current) == null ? void 0 : _a2.focus(); + } + }, [props2.editMode]); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file" + }, value.map((v4, i5) => { + var _a2; + if (props2.editMode == 0) { + if (v4.fileCache) { + return /* @__PURE__ */ Cn.createElement("div", { + key: i5, + className: "mk-cell-file-title" + }, v4 && v4.fileCache ? v4.fileCache.name : "", ((_a2 = v4.fileCache.extension) == null ? void 0 : _a2.length) > 0 && v4.fileCache.extension != "md" && /* @__PURE__ */ Cn.createElement("span", { + className: "nav-file-tag" + }, v4.fileCache.extension), /* @__PURE__ */ Cn.createElement("button", { + "aria-label": i18n_default.buttons.toggleFlow, + className: "mk-cell-file-flow mk-inline-button", + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-flow-hover"] + }, + onClick: (e4) => { + if (props2.openFlow) { + props2.openFlow(e4); + e4.stopPropagation(); + } + } + })); + } else { + return /* @__PURE__ */ Cn.createElement("div", { + key: i5, + className: "mk-cell-file-title" + }, v4.path); + } + } + if (v4.fileCache) { + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file-item", + onContextMenu: (e4) => triggerFileMenu( + props2.plugin, + getAbstractFileAtPath(app, v4.fileCache.path), + v4.fileCache.isFolder, + e4, + null + ) + }, /* @__PURE__ */ Cn.createElement(FileSticker, { + plugin: props2.plugin, + fileCache: v4.fileCache + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file-name", + onClick: (e4) => openAFile( + getAbstractFileAtPath(app, v4.fileCache.path), + props2.plugin, + e4.ctrlKey || e4.metaKey + ) + }, v4 && v4.fileCache ? filePathToString(v4.fileCache.name) : ""))); + } + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file-item" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-icon" + }, /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => newFile(v4), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-new-file"] + } + })), props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { + className: "mk-cell-file-name", + type: "text", + placeholder: "Untitled", + ref: ref2, + value: v4.path, + onKeyDown, + onBlur + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-file-name" + }, v4.path))); + })); +}; + +// src/components/Space/Contexts/DataTypeView/FilePropertyCell.tsx +init_compat_module(); +var humanFileSize = (bytes, si = false, dp = 1) => { + const thresh = si ? 1e3 : 1024; + if (Math.abs(bytes) < thresh) { + return bytes + " B"; + } + const units = si ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]; + let u4 = -1; + const r3 = 10 ** dp; + do { + bytes /= thresh; + ++u4; + } while (Math.round(Math.abs(bytes) * r3) / r3 >= thresh && u4 < units.length - 1); + return bytes.toFixed(dp) + " " + units[u4]; +}; +var LookUpCell = (props2) => { + const [cache2, setCache] = h2(null); + const initialValue = props2.initialValue; + const { field, property: property2 } = parsePropString(props2.propertyValue); + if (property2 == "folder") { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop", + onClick: () => { + openTFolder( + getAbstractFileAtPath(app, initialValue), + props2.plugin, + false + ); + } + }, folderPathToString(initialValue)); + } + if (property2 == "extension") { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop" + }, initialValue); + } else if (property2 == "ctime" || property2 == "mtime") { + const date = new Date(parseInt(initialValue)).getTime() ? new Date(parseInt(initialValue)) : null; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop" + }, date && formatDistance3(new Date(date), new Date(), { addSuffix: true })); + } else if (property2 == "size" || property2 == "File.size") { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop" + }, humanFileSize(parseInt(initialValue))); + } + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-fileprop" + }, initialValue); +}; + +// src/components/Space/Contexts/DataTypeView/NumberCell.tsx +init_compat_module(); +var NumberCell = (props2) => { + const { initialValue, saveValue } = props2; + const [value, setValue] = Cn.useState(initialValue); + const ref2 = _2(null); + const onBlur = () => { + if (initialValue != value) + saveValue(value); + }; + const onKeyDown = (e4) => { + e4.stopPropagation(); + if (e4.key == "Enter") { + e4.target.blur(); + props2.setEditMode(null); + } + if (e4.key == "Escape") { + setValue(initialValue); + e4.target.blur(); + props2.setEditMode(null); + } + }; + Cn.useEffect(() => { + setValue(initialValue); + }, [initialValue]); + p2(() => { + var _a2; + if (props2.editMode == 2) { + (_a2 = ref2 == null ? void 0 : ref2.current) == null ? void 0 : _a2.focus(); + } + }, [props2.editMode]); + return props2.editMode > 1 ? /* @__PURE__ */ Cn.createElement("input", { + className: "mk-cell-text", + type: "number", + ref: ref2, + value, + onChange: (e4) => setValue(e4.target.value), + onKeyDown, + onBlur + }) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-number" + }, value); +}; + +// src/components/Space/Contexts/TableView/TableView.tsx +var import_lodash11 = __toESM(require_lodash()); +var import_obsidian39 = require("obsidian"); + +// src/components/Space/Contexts/DataTypeView/ImageCell.tsx +init_compat_module(); +var ImageCell = (props2) => { + const { initialValue, saveValue } = props2; + const [value, setValue] = Cn.useState(initialValue); + const menuRef = _2(null); + p2(() => { + if (props2.editMode == 2 /* EditModeActive */) { + if (!menuRef.current) + showModal(); + } + }, []); + const file = F2(() => { + const f4 = getAbstractFileAtPath(app, value); + return f4 ? app.vault.getResourcePath(f4) : value; + }, [value]); + Cn.useEffect(() => { + setValue(initialValue); + }, [initialValue]); + const showModal = () => { + const vaultChangeModal = new imageModal( + props2.plugin, + props2.plugin.app, + (image) => saveValue(image) + ); + vaultChangeModal.open(); + props2.setEditMode(null); + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-image" + }, /* @__PURE__ */ Cn.createElement("img", { + src: file + }), props2.editMode > 0 ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-image-selector" + }, /* @__PURE__ */ Cn.createElement("div", { + onClick: showModal, + className: "mk-hover-button mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-edit"] } + }), (value == null ? void 0 : value.length) > 0 && /* @__PURE__ */ Cn.createElement("div", { + onClick: () => saveValue(""), + className: "mk-hover-button mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); +}; + +// src/components/Space/Contexts/DataTypeView/LinkCell.tsx +init_compat_module(); +var LinkCell = (props2) => { + var _a2; + const initialValue = (props2.multi ? (_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : [] : [props2.initialValue]).filter((f4) => f4); + const stringValueToLink = (strings) => strings.map((f4) => { + return { + label: parseLinkDisplayString(f4), + value: parseLinkString(f4) + }; + }); + p2(() => { + var _a3; + setValue( + resolveLinks( + stringValueToLink( + props2.multi ? (_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : [] : [props2.initialValue] + ) + ) + ); + }, [props2.initialValue]); + const resolveLinks = (links) => links.map((f4) => ({ + value: f4.value, + label: filePathToString(f4.value), + file: getFileFromString(f4.value, getFolderPathFromString(props2.file)) + })); + const ref2 = _2(null); + const [value, setValue] = h2( + resolveLinks(stringValueToLink(initialValue)) + ); + const removeValue = (v4) => { + const newValues = value.filter((f4) => f4.value != v4.value); + setValue(newValues); + props2.saveValue(serializeMultiString(newValues.map((f4) => f4.value))); + }; + const saveOptions = (_12, _value) => { + if (!props2.multi) { + setValue(resolveLinks(stringValueToLink(_value))); + props2.saveValue(serializeMultiString(_value)); + } else { + const newValue = _value[0]; + if (newValue) { + const newValues = uniq([...value.map((f4) => f4.value), newValue]); + setValue(resolveLinks(stringValueToLink(newValues))); + props2.saveValue(serializeMultiString(newValues)); + } + } + }; + const menuProps = () => { + const options = getAllAbstractFilesInVault(props2.plugin).map((f4) => ({ + name: fileNameToString(f4.name), + value: f4.path, + description: f4.path + })); + const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; + return { + plugin: props2.plugin, + multi: false, + editable: true, + value: value.map((f4) => f4.value), + options: _options, + saveOptions, + placeholder: i18n_default.labels.linkItemSelectPlaceholder, + detail: true, + searchable: true + }; + }; + const openLink = async (o3) => { + if (o3.file) { + openTFile(o3.file, props2.plugin, false); + } else { + const file = await app.fileManager.createNewMarkdownFile( + app.vault.getRoot(), + o3.value + ); + openTFile(file, props2.plugin, false); + setValue(resolveLinks(value)); + } + }; + return /* @__PURE__ */ Cn.createElement(OptionCellBase, { + baseClass: "mk-cell-link", + menuProps, + getLabelString: (o3) => o3.label, + valueClass: (o3) => o3.file ? "mk-cell-link-item" : "mk-cell-link-unresolved", + openItem: openLink, + value, + multi: props2.multi, + editMode: props2.editMode, + removeValue + }); +}; + +// src/components/Space/Contexts/DataTypeView/ObjectCell.tsx +init_compat_module(); +var ObjectEditor = (props2) => { + const { value, type, saveValue, saveType } = props2; + const saveKey = (key2, newKey) => { + if (key2 != newKey) + saveValue({ + ...value, + [newKey]: value[key2], + [key2]: void 0 + }); + }; + const saveVal = (key2, val) => { + saveValue({ + ...value, + [key2]: val + }); + }; + const selectType = (e4, key2) => { + showSelectMenu(e4.target.getBoundingClientRect(), { + plugin: props2.plugin, + multi: false, + editable: false, + searchable: false, + saveOptions: (_12, values) => { + var _a2; + return saveType({ + ...type != null ? type : {}, + [key2]: { ...(_a2 = type == null ? void 0 : type[key2]) != null ? _a2 : {}, type: values[0] } + }); + }, + value: [], + showAll: true, + options: fieldTypes.map((f4, i5) => ({ + id: i5 + 1, + name: f4.label, + value: f4.type, + icon: "" + })) + }); + }; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, Object.keys(value).map((f4, i5) => { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + key: i5, + className: "mk-cell-object-row" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field-icon", + onClick: (e4) => selectType(e4, f4), + dangerouslySetInnerHTML: { + __html: stickerFromString( + (_b2 = fieldTypeForType((_a2 = type == null ? void 0 : type[f4]) == null ? void 0 : _a2.type)) == null ? void 0 : _b2.icon, + props2.plugin + ) + } + }), /* @__PURE__ */ Cn.createElement("input", { + onClick: (e4) => e4.stopPropagation(), + className: "mk-file-context-field-key", + type: "text", + value: f4, + onBlur: (e4) => saveKey(f4, e4.target.value) + })), !((_c2 = type == null ? void 0 : type[f4]) == null ? void 0 : _c2.type) || !type[f4].type.startsWith("object") && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-value" + }, /* @__PURE__ */ Cn.createElement(DataTypeView, { + initialValue: value[f4], + plugin: props2.plugin, + row: value, + column: { + name: f4, + schemaId: "", + table: "", + type: (_e2 = (_d2 = type == null ? void 0 : type[f4]) == null ? void 0 : _d2.type) != null ? _e2 : "text", + value: (_f = type == null ? void 0 : type[f4]) == null ? void 0 : _f.value + }, + editable: true, + updateValue: (value2) => saveVal(f4, value2), + updateFieldValue: (fieldValue, value2) => { + var _a3, _b3, _c3; + return saveType({ + ...type != null ? type : {}, + [f4]: { + ...(_a3 = type == null ? void 0 : type[f4]) != null ? _a3 : {}, + type: (_c3 = (_b3 = type == null ? void 0 : type[f4]) == null ? void 0 : _b3.type) != null ? _c3 : "text", + value: fieldValue + } + }); + } + }))), ((_g = type == null ? void 0 : type[f4]) == null ? void 0 : _g.type) && type[f4].type.startsWith("object") && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-value" + }, /* @__PURE__ */ Cn.createElement(DataTypeView, { + initialValue: value[f4], + plugin: props2.plugin, + row: value, + column: { + name: f4, + schemaId: "", + table: "", + type: (_i = (_h = type == null ? void 0 : type[f4]) == null ? void 0 : _h.type) != null ? _i : "text", + value: (_j = type == null ? void 0 : type[f4]) == null ? void 0 : _j.value + }, + editable: true, + updateValue: (value2) => saveVal(f4, value2), + updateFieldValue: (fieldValue, value2) => { + var _a3, _b3, _c3; + return saveType({ + ...type != null ? type : {}, + [f4]: { + ...(_a3 = type == null ? void 0 : type[f4]) != null ? _a3 : {}, + type: (_c3 = (_b3 = type == null ? void 0 : type[f4]) == null ? void 0 : _b3.type) != null ? _c3 : "text", + value: fieldValue + } + }); + } + }))); + })); +}; +var ObjectCell = (props2) => { + var _a2; + const parsedValue = parseFieldValue(props2.propertyValue, "object"); + const type = parsedValue.type; + const { initialValue, plugin } = props2; + const [value, setValue] = Cn.useState((_a2 = safelyParseJSON(initialValue)) != null ? _a2 : {}); + const saveType = (newType) => { + props2.savePropValue( + JSON.stringify({ ...parsedValue, type: newType }), + JSON.stringify(value) + ); + }; + const saveValue = (newValue) => { + props2.saveValue(JSON.stringify(newValue)); + }; + const saveMultiValue = (newValue, index) => { + props2.saveValue( + JSON.stringify( + value.map( + (f4, i5) => i5 == index ? newValue : f4 + ) + ) + ); + }; + const newKey = (key2) => { + if (key2) + saveValue({ + ...value, + [key2]: "" + }); + }; + Cn.useEffect(() => { + var _a3; + setValue((_a3 = safelyParseJSON(initialValue)) != null ? _a3 : {}); + }, [initialValue]); + return props2.editMode <= 1 /* EditModeView */ ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-object" + }, props2.multi ? value.map((f4, i5) => /* @__PURE__ */ Cn.createElement(ObjectEditor, { + saveType, + value: f4, + type, + plugin, + key: i5, + saveValue: (val) => saveMultiValue(val, i5) + })) : /* @__PURE__ */ Cn.createElement(ObjectEditor, { + plugin, + value, + type, + saveValue, + saveType + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field" + }, /* @__PURE__ */ Cn.createElement("input", { + onClick: (e4) => e4.stopPropagation(), + className: "mk-cell-text", + type: "text", + placeholder: "New Property", + value: "", + onBlur: (e4) => newKey(e4.target.value) + }))); +}; + +// src/components/Space/Contexts/DataTypeView/SuperCell.tsx +init_compat_module(); +var SuperCell = (props2) => { + const superProperty = F2(() => { + var _a2; + const parsedValue = parseFieldValue(props2.propertyValue, "super"); + const superPropertyName = parsedValue.dynamic ? (_a2 = props2.row) == null ? void 0 : _a2[parsedValue.field] : parsedValue.field; + const property2 = props2.plugin.index.superProperties.get(superPropertyName); + return property2 ? { + ...property2, + value: JSON.stringify( + props2.plugin.index.valueForSuperproperty( + superPropertyName, + property2 + ) + ) + } : null; + }, [props2.propertyValue]); + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, superProperty && /* @__PURE__ */ Cn.createElement(DataTypeView, { + ...props2, + updateFieldValue: (_12, f4) => props2.saveValue(f4), + updateValue: props2.saveValue, + column: { ...superProperty, table: "" }, + editable: true + })); +}; + +// src/components/Space/Contexts/DataTypeView/TagCell.tsx +init_compat_module(); +var TagCell = (props2) => { + var _a2; + const initialValue = ((_a2 = parseMultiString(props2.initialValue)) != null ? _a2 : []).filter( + (f4) => (f4 == null ? void 0 : f4.length) > 0 + ); + const [value, setValue] = h2(initialValue); + p2(() => { + var _a3; + setValue((_a3 = parseMultiString(props2.initialValue)) != null ? _a3 : []); + }, [props2.initialValue]); + const removeValue = (v4) => { + const newValues = value.filter((f4) => f4 != v4); + setValue(newValues); + props2.saveValue(serializeMultiString(newValues)); + }; + const saveOptions = (_options, _value) => { + if (!props2.multi) { + setValue(_value); + props2.saveValue(serializeMultiString(_value)); + } else { + const newValue = _value[0]; + if (newValue) { + const newValues = uniq([...value, newValue]); + setValue(newValues); + props2.saveValue(serializeMultiString(newValues)); + } + } + }; + const menuProps = () => { + const options = loadTags(props2.plugin).map((f4) => ({ + name: f4, + value: f4 + })); + const _options = !props2.multi ? [{ name: i18n_default.menu.none, value: "" }, ...options] : options; + return { + plugin: props2.plugin, + multi: false, + editable: true, + value, + options: _options, + saveOptions, + placeholder: i18n_default.labels.tagItemSelectPlaceholder, + searchable: true, + showAll: true, + onHide: () => props2.setEditMode(null) + }; + }; + return /* @__PURE__ */ Cn.createElement(OptionCellBase, { + baseClass: "mk-cell-tag", + menuProps, + value, + multi: props2.multi, + editMode: props2.editMode, + removeValue + }); +}; + +// src/components/Space/Contexts/TableView/TableView.tsx +var TableView = (props2) => { + const { spaceInfo, contexts, readMode } = q2(SpaceContext); + const { + tableData, + dbSchema, + contextTable, + saveDB: saveDB2 + } = q2(ContextMDBContext); + const { + selectedRows, + selectRows, + sortedColumns: cols, + filteredData: data2, + predicate, + savePredicate, + updateFieldValue, + updateValue: updateValue2 + } = q2(ContextEditorContext); + const [activeId, setActiveId] = h2(null); + const [lastSelectedIndex, setLastSelectedIndex] = h2(null); + const [selectedColumn, setSelectedColumn] = h2(null); + const [currentEdit, setCurrentEdit] = h2(null); + const [overId, setOverId] = h2(null); + const [openFlows, setOpenFlows] = h2([]); + const [colsSize, setColsSize] = h2({}); + const ref2 = _2(null); + p2(() => { + setColsSize({ ...predicate.colsSize, "+": 30 }); + }, [predicate]); + p2(() => { + setCurrentEdit(null); + }, [selectedColumn, lastSelectedIndex]); + p2(() => { + if (currentEdit == null) { + ref2.current.focus(); + } + }, [currentEdit]); + const saveColsSize = (colSize) => { + const newColSize = colSize(colsSize); + setColsSize(newColSize); + debouncedSavePredicate(newColSize); + }; + const debouncedSavePredicate = T2( + (0, import_lodash11.debounce)( + (nextValue) => savePredicate({ + ...predicate, + colsSize: nextValue + }), + 1e3 + ), + [predicate] + ); + const newRow = (index, data3) => { + saveDB2(createNewRow(tableData, { File: "", ...data3 != null ? data3 : {} }, index)); + }; + const deleteRow = (rowIndex) => { + const row = tableData.rows.find((f4, i5) => i5 == rowIndex); + if (getAbstractFileAtPath(app, row.File)) { + deleteFile(props2.plugin, getAbstractFileAtPath(app, row.File)); + } + if (row) { + saveDB2({ + ...tableData, + rows: tableData.rows.filter((f4, i5) => i5 != rowIndex) + }); + } + }; + const toggleFlow = (path) => { + setOpenFlows( + (f4) => f4.find((p3) => p3 == path) ? f4.filter((p3) => p3 != path) : uniq([...f4, path]) + ); + }; + const selectItem = (modifier, index) => { + if (modifier == 3) { + const file = getAbstractFileAtPath( + app, + tableData.rows[parseInt(index)].File + ); + if (file) + openAFile(file, props2.plugin, false); + return; + } + if (modifier == 2) { + selectedRows.some((f4) => f4 == index) ? selectRows( + null, + selectedRows.filter((f4) => f4 != index) + ) : selectRows(index, uniq([...selectedRows, index])); + } else if (modifier == 1) { + selectRows( + index, + uniq([ + ...selectedRows, + ...selectRange( + lastSelectedIndex, + index, + data2.map((f4) => f4._index) + ) + ]) + ); + } else { + selectRows(index, [index]); + } + setLastSelectedIndex(index); + }; + const onKeyDown = (e4) => { + const setCellValue = (value) => { + var _a2; + const columnTuple = selectedColumn.split("#"); + updateValue2( + columnTuple[0], + value, + (_a2 = columnTuple[1]) != null ? _a2 : "", + parseInt(lastSelectedIndex), + "" + ); + }; + const clearCell = () => { + setCellValue(""); + }; + const copyCell = () => { + navigator.clipboard.writeText( + tableData.rows[parseInt(lastSelectedIndex)][selectedColumn] + ); + }; + const nextRow = () => { + const newIndex = selectNextIndex( + lastSelectedIndex, + data2.map((f4) => f4._index) + ); + selectRows(newIndex, [newIndex]); + setLastSelectedIndex(newIndex); + }; + const lastRow = () => { + const newIndex = selectPrevIndex( + lastSelectedIndex, + data2.map((f4) => f4._index) + ); + selectRows(newIndex, [newIndex]); + setLastSelectedIndex(newIndex); + }; + if (e4.key == "c" && e4.metaKey) { + copyCell(); + } + if (e4.key == "x" && e4.metaKey) { + copyCell(); + clearCell(); + } + if (e4.key == "v" && e4.metaKey) { + navigator.clipboard.readText().then((f4) => setCellValue(f4)); + } + if (e4.key == "Escape") { + selectRows(null, []); + setLastSelectedIndex(null); + } + if (e4.key == "Backspace" || e4.key == "Delete") { + clearCell(); + } + if (e4.key == "Enter") { + if (selectedColumn && lastSelectedIndex) { + if (e4.shiftKey) { + newRow(parseInt(lastSelectedIndex) + 1); + nextRow(); + } else { + setCurrentEdit([selectedColumn, lastSelectedIndex]); + } + } + return; + } + if (e4.key == "ArrowDown") { + nextRow(); + e4.preventDefault(); + } + if (e4.key == "ArrowUp") { + lastRow(); + e4.preventDefault(); + } + if (e4.key == "ArrowLeft") { + const newIndex = selectPrevIndex( + selectedColumn, + columns.map((f4) => f4.accessorKey).filter((f4) => f4 != "+") + ); + setSelectedColumn(newIndex); + } + if (e4.key == "ArrowRight") { + const newIndex = selectNextIndex( + selectedColumn, + columns.map((f4) => f4.accessorKey).filter((f4) => f4 != "+") + ); + setSelectedColumn(newIndex); + } + }; + const columns = F2( + () => { + var _a2; + return [ + ...(_a2 = cols.map((f4) => { + return { + header: f4.name, + accessorKey: f4.name + f4.table, + meta: { + table: f4.table, + editable: f4.primary != "true", + schemaId: dbSchema == null ? void 0 : dbSchema.id + }, + cell: ({ + getValue: getValue2, + row: { index }, + column: { colId }, + cell, + table: table2 + }) => { + const initialValue = getValue2(); + const rowIndex = parseInt( + data2[index]["_index" + f4.table] + ); + const tableIndex = parseInt(data2[index]["_index"]); + const saveValue = (value2) => { + var _a3; + setCurrentEdit(null); + if (initialValue != value2) + (_a3 = table2.options.meta) == null ? void 0 : _a3.updateData( + f4.name, + value2, + f4.table, + rowIndex + ); + }; + const saveFieldValue = (fieldValue, value2) => { + var _a3; + (_a3 = table2.options.meta) == null ? void 0 : _a3.updateFieldValue( + f4.name, + fieldValue, + value2, + f4.table, + rowIndex + ); + }; + const editMode = readMode ? -1 /* EditModeReadOnly */ : !cell.getIsGrouped() ? platformIsMobile() ? 3 /* EditModeAlways */ : currentEdit && currentEdit[0] == f4.name + f4.table && currentEdit[1] == tableIndex.toString() ? 2 /* EditModeActive */ : 1 /* EditModeView */ : -1 /* EditModeReadOnly */; + const cellProps = { + initialValue, + saveValue, + plugin: props2.plugin, + setEditMode: setCurrentEdit, + editMode, + propertyValue: f4.value + }; + const value = parseFieldValue(f4.value, f4.type); + const fieldType = fieldTypeForType(f4.type); + if (!fieldType) { + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, initialValue); + } + if (fieldType.type == "file") { + return /* @__PURE__ */ Cn.createElement(FileCell, { + ...cellProps, + multi: fieldType.multiType == f4.type, + folder: spaceInfo.path, + isFolder: spaceInfo.uri.type == "folder", + openFlow: () => toggleFlow(initialValue), + deleteRow: () => deleteRow(index) + }); + } else if (fieldType.type == "boolean") { + return /* @__PURE__ */ Cn.createElement(BooleanCell, { + ...cellProps, + column: f4 + }); + } else if (fieldType.type == "option") { + return /* @__PURE__ */ Cn.createElement(OptionCell, { + ...cellProps, + options: f4.value, + multi: fieldType.multiType == f4.type, + saveOptions: saveFieldValue + }); + } else if (fieldType.type == "date") { + return /* @__PURE__ */ Cn.createElement(DateCell, { + ...cellProps + }); + } else if (fieldType.type == "context") { + return /* @__PURE__ */ Cn.createElement(ContextCell, { + ...cellProps, + multi: fieldType.multiType == f4.type, + space: value.space, + spaceField: value.field, + path: data2[index][FilePropertyName] + }); + } else if (fieldType.type == "fileprop") { + return /* @__PURE__ */ Cn.createElement(LookUpCell, { + ...cellProps, + file: data2[index][FilePropertyName] + }); + } else if (fieldType.type == "tag") { + return /* @__PURE__ */ Cn.createElement(TagCell, { + ...cellProps, + multi: fieldType.multiType == f4.type + }); + } else if (fieldType.type == "number") { + return /* @__PURE__ */ Cn.createElement(NumberCell, { + ...cellProps + }); + } else if (fieldType.type == "link") { + return /* @__PURE__ */ Cn.createElement(LinkCell, { + ...cellProps, + multi: fieldType.multiType == f4.type, + file: data2[index][FilePropertyName] + }); + } else if (fieldType.type == "image") { + return /* @__PURE__ */ Cn.createElement(ImageCell, { + ...cellProps + }); + } else if (fieldType.type == "object") { + return /* @__PURE__ */ Cn.createElement(ObjectCell, { + ...cellProps, + multi: fieldType.multiType == f4.type, + savePropValue: saveFieldValue + }); + } else if (fieldType.type == "super") { + return /* @__PURE__ */ Cn.createElement(SuperCell, { + ...cellProps, + row: data2[index] + }); + } else { + return /* @__PURE__ */ Cn.createElement(TextCell, { + ...cellProps + }); + } + } + }; + })) != null ? _a2 : [], + ...readMode ? [] : [ + { + header: "+", + meta: { schemaId: dbSchema == null ? void 0 : dbSchema.id }, + accessorKey: "+", + size: 20, + cell: () => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) + } + ] + ]; + }, + [cols, currentEdit, predicate, contextTable, toggleFlow, openFlows] + ); + const groupBy2 = F2( + () => { + var _a2; + return ((_a2 = predicate.groupBy) == null ? void 0 : _a2.length) > 0 && cols.find((f4) => f4.name + f4.table == predicate.groupBy[0]) ? predicate.groupBy : []; + }, + [predicate, cols] + ); + const table = useReactTable({ + data: data2, + columns, + columnResizeMode: "onChange", + state: { + columnVisibility: predicate.colsHidden.reduce( + (p3, c4) => ({ ...p3, [c4]: false }), + {} + ), + columnOrder: predicate.colsOrder, + columnSizing: { + ...columns.reduce((p3, c4) => ({ ...p3, [c4.accessorKey]: 150 }), {}), + ...colsSize + }, + grouping: groupBy2, + expanded: true + }, + onColumnSizingChange: saveColsSize, + getCoreRowModel: getCoreRowModel(), + getExpandedRowModel: getExpandedRowModel(), + getGroupedRowModel: getGroupedRowModel(), + meta: { + updateData: updateValue2, + updateFieldValue + } + }); + const sensors = useSensors( + useSensor(MouseSensor, { + activationConstraint: { + distance: 10 + } + }), + useSensor(TouchSensor, { + activationConstraint: { + delay: 250, + tolerance: 5 + } + }) + ); + const measuring = { + droppable: { + strategy: MeasuringStrategy.Always + } + }; + function handleDragStart(event) { + const { + active: { id: activeId2 } + } = event; + setActiveId(activeId2); + setOverId(overId); + document.body.style.setProperty("cursor", "grabbing"); + } + function handleDragOver({ over }) { + var _a2; + const overId2 = over == null ? void 0 : over.id; + if (overId2) { + setOverId((_a2 = over == null ? void 0 : over.id) != null ? _a2 : null); + } + } + const saveFilter = (filter) => { + savePredicate({ + ...predicate, + filters: [ + ...predicate.filters.filter((s6) => s6.field != filter.field), + filter + ] + }); + }; + const selectCell = (e4, index, column) => { + if (platformIsMobile() || column == "+") + return; + selectItem(0, data2[index]["_index"]); + setSelectedColumn(column); + if (e4.detail === 1) { + } else if (e4.detail === 2) { + setCurrentEdit([column, data2[index]["_index"]]); + } + }; + const showContextMenu = (e4, index) => { + e4.preventDefault(); + const menu = new import_obsidian39.Menu(); + menu.addItem((item) => { + item.setIcon("trash"); + item.setTitle(i18n_default.menu.deleteRow); + item.onClick(() => { + deleteRow(index); + }); + }); + if (isMouseEvent(e4)) { + menu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + menu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }; + function handleDragEnd({ active, over }) { + resetState(); + savePredicate({ + ...predicate, + colsOrder: arrayMove( + predicate.colsOrder, + predicate.colsOrder.findIndex((f4) => f4 == activeId), + predicate.colsOrder.findIndex((f4) => f4 == overId) + ) + }); + } + function handleDragCancel() { + resetState(); + } + function resetState() { + setOverId(null); + setActiveId(null); + document.body.style.setProperty("cursor", ""); + } + return /* @__PURE__ */ Cn.createElement(DndContext, { + sensors, + collisionDetection: closestCenter, + measuring, + onDragStart: handleDragStart, + onDragOver: handleDragOver, + onDragEnd: handleDragEnd, + onDragCancel: handleDragCancel + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-table", + ref: ref2, + tabIndex: 1, + onKeyDown + }, /* @__PURE__ */ Cn.createElement("table", { + ...{} + }, /* @__PURE__ */ Cn.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ Cn.createElement("tr", { + key: headerGroup.id + }, /* @__PURE__ */ Cn.createElement("th", null), headerGroup.headers.map((header) => { + var _a2; + return /* @__PURE__ */ Cn.createElement("th", { + className: "mk-th", + key: header.id, + style: { + minWidth: header.column.getIsGrouped() ? "0px" : (_a2 = colsSize[header.column.columnDef.accessorKey]) != null ? _a2 : "150px" + } + }, header.isPlaceholder ? null : header.column.columnDef.header != "+" ? header.column.getIsGrouped() ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) : /* @__PURE__ */ Cn.createElement(ColumnHeader, { + plugin: props2.plugin, + editable: header.column.columnDef.meta.editable, + column: cols.find( + (f4) => f4.name == header.column.columnDef.header && f4.table == header.column.columnDef.meta.table + ) + }) : /* @__PURE__ */ Cn.createElement(ColumnHeader, { + plugin: props2.plugin, + isNew: true, + editable: true, + column: { + name: "", + schemaId: header.column.columnDef.meta.schemaId, + type: "text", + table: "" + } + }), /* @__PURE__ */ Cn.createElement("div", { + ...{ + onMouseDown: header.getResizeHandler(), + onTouchStart: header.getResizeHandler(), + className: `mk-resizer ${header.column.getIsResizing() ? "isResizing" : ""}` + } + })); + })))), /* @__PURE__ */ Cn.createElement("tbody", null, table.getRowModel().rows.map((row) => /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("tr", { + className: (selectedRows == null ? void 0 : selectedRows.some( + (f4) => f4 == data2[row.index]["_index"] + )) && "mk-is-active", + onContextMenu: (e4) => { + const rowIndex = parseInt( + data2[row.index]["_index"] + ); + showContextMenu(e4, rowIndex); + }, + key: row.id + }, /* @__PURE__ */ Cn.createElement("td", null), row.getVisibleCells().map( + (cell, i5) => { + var _a2, _b2; + return cell.getIsGrouped() ? /* @__PURE__ */ Cn.createElement("td", { + key: i5, + className: "mk-td-group", + colSpan: cols.length + (readMode ? 0 : 1) + }, /* @__PURE__ */ Cn.createElement("div", { + ...{ + onClick: row.getToggleExpandedHandler(), + style: { + display: "flex", + alignItems: "center", + cursor: "normal" + } + } + }, flexRender( + cell.column.columnDef.cell, + cell.getContext() + ), " ", "(", row.subRows.length, ")")) : cell.getIsAggregated() ? flexRender( + (_a2 = cell.column.columnDef.aggregatedCell) != null ? _a2 : cell.column.columnDef.cell, + cell.getContext() + ) : /* @__PURE__ */ Cn.createElement("td", { + onClick: (e4) => selectCell( + e4, + cell.row.index, + cell.column.columnDef.accessorKey + ), + className: `${cell.column.columnDef.accessorKey == selectedColumn ? "mk-selected-cell " : ""} mk-td ${cell.getIsPlaceholder() ? "mk-td-empty" : ""}`, + key: cell.id, + style: { + minWidth: cell.getIsPlaceholder() ? "0px" : (_b2 = colsSize[cell.column.columnDef.accessorKey]) != null ? _b2 : "50px" + } + }, cell.getIsPlaceholder() ? null : flexRender( + cell.column.columnDef.cell, + cell.getContext() + )); + } + ))))), /* @__PURE__ */ Cn.createElement("tfoot", null, !readMode ? /* @__PURE__ */ Cn.createElement("tr", null, /* @__PURE__ */ Cn.createElement("th", { + className: "mk-row-new", + colSpan: cols.length + (readMode ? 1 : 2), + onClick: () => { + newRow(); + } + }, "+ New")) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null))), z3( + /* @__PURE__ */ Cn.createElement(DragOverlay, { + dropAnimation: null, + zIndex: 1600 + }, activeId ? /* @__PURE__ */ Cn.createElement(ColumnHeader, { + plugin: props2.plugin, + editable: false, + column: { + name: activeId, + schemaId: tableData.schema.id, + type: "text", + table: "" + } + }) : null), + document.body + ))); +}; + +// src/components/Space/Contexts/DataTypeView/BooleanCell.tsx +var BooleanCell = (props2) => { + const { initialValue, saveValue } = props2; + const [value, setValue] = Cn.useState(initialValue == "true"); + const onChange = () => { + if (props2.editMode == -1 /* EditModeReadOnly */) { + return; + } + setValue(!value); + saveValue(!value ? "true" : "false"); + }; + p2(() => { + if (props2.editMode == 2 /* EditModeActive */) { + setValue(!value); + saveValue(!value ? "true" : "false"); + props2.setEditMode(null); + } + }, [props2.editMode]); + Cn.useEffect(() => { + setValue(initialValue == "true"); + }, [initialValue]); + if (props2.editMode < 1 /* EditModeView */) { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-boolean" + }, /* @__PURE__ */ Cn.createElement("input", { + type: "checkbox", + checked: value, + onChange + }), /* @__PURE__ */ Cn.createElement("div", null, props2.column.name)); + } + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-text" + }, /* @__PURE__ */ Cn.createElement("input", { + type: "checkbox", + checked: value, + onChange + })); +}; + +// src/components/ui/menus/colorPickerMenu.tsx +var import_obsidian40 = require("obsidian"); +init_compat_module(); + +// node_modules/react-color/es/components/alpha/Alpha.js +init_compat_module(); +var import_reactcss9 = __toESM(require_lib()); + +// node_modules/react-color/es/components/common/Alpha.js +init_compat_module(); +var import_reactcss2 = __toESM(require_lib()); + +// node_modules/react-color/es/helpers/alpha.js +var calculateChange = function calculateChange2(e4, hsl, direction, initialA, container) { + var containerWidth = container.clientWidth; + var containerHeight = container.clientHeight; + var x5 = typeof e4.pageX === "number" ? e4.pageX : e4.touches[0].pageX; + var y5 = typeof e4.pageY === "number" ? e4.pageY : e4.touches[0].pageY; + var left = x5 - (container.getBoundingClientRect().left + window.pageXOffset); + var top = y5 - (container.getBoundingClientRect().top + window.pageYOffset); + if (direction === "vertical") { + var a6 = void 0; + if (top < 0) { + a6 = 0; + } else if (top > containerHeight) { + a6 = 1; + } else { + a6 = Math.round(top * 100 / containerHeight) / 100; + } + if (hsl.a !== a6) { + return { + h: hsl.h, + s: hsl.s, + l: hsl.l, + a: a6, + source: "rgb" + }; + } + } else { + var _a2 = void 0; + if (left < 0) { + _a2 = 0; + } else if (left > containerWidth) { + _a2 = 1; + } else { + _a2 = Math.round(left * 100 / containerWidth) / 100; + } + if (initialA !== _a2) { + return { + h: hsl.h, + s: hsl.s, + l: hsl.l, + a: _a2, + source: "rgb" + }; + } + } + return null; +}; + +// node_modules/react-color/es/components/common/Checkboard.js +init_compat_module(); +var import_reactcss = __toESM(require_lib()); + +// node_modules/react-color/es/helpers/checkboard.js +var checkboardCache = {}; +var render = function render2(c1, c22, size, serverCanvas) { + if (typeof document === "undefined" && !serverCanvas) { + return null; + } + var canvas = serverCanvas ? new serverCanvas() : document.createElement("canvas"); + canvas.width = size * 2; + canvas.height = size * 2; + var ctx = canvas.getContext("2d"); + if (!ctx) { + return null; + } + ctx.fillStyle = c1; + ctx.fillRect(0, 0, canvas.width, canvas.height); + ctx.fillStyle = c22; + ctx.fillRect(0, 0, size, size); + ctx.translate(size, size); + ctx.fillRect(0, 0, size, size); + return canvas.toDataURL(); +}; +var get = function get2(c1, c22, size, serverCanvas) { + var key2 = c1 + "-" + c22 + "-" + size + (serverCanvas ? "-server" : ""); + if (checkboardCache[key2]) { + return checkboardCache[key2]; + } + var checkboard = render(c1, c22, size, serverCanvas); + checkboardCache[key2] = checkboard; + return checkboard; +}; + +// node_modules/react-color/es/components/common/Checkboard.js +var _extends = Object.assign || function(target) { + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; + for (var key2 in source) { + if (Object.prototype.hasOwnProperty.call(source, key2)) { + target[key2] = source[key2]; + } + } + } + return target; +}; +var Checkboard = function Checkboard2(_ref) { + var white = _ref.white, grey = _ref.grey, size = _ref.size, renderers = _ref.renderers, borderRadius = _ref.borderRadius, boxShadow = _ref.boxShadow, children = _ref.children; + var styles2 = (0, import_reactcss.default)({ + "default": { + grid: { + borderRadius, + boxShadow, + absolute: "0px 0px 0px 0px", + background: "url(" + get(white, grey, size, renderers.canvas) + ") center left" + } + } + }); + return an(children) ? Cn.cloneElement(children, _extends({}, children.props, { style: _extends({}, children.props.style, styles2.grid) })) : Cn.createElement("div", { style: styles2.grid }); +}; +Checkboard.defaultProps = { + size: 8, + white: "transparent", + grey: "rgba(0,0,0,.08)", + renderers: {} +}; +var Checkboard_default = Checkboard; + +// node_modules/react-color/es/components/common/Alpha.js +var _extends2 = Object.assign || function(target) { + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; + for (var key2 in source) { + if (Object.prototype.hasOwnProperty.call(source, key2)) { + target[key2] = source[key2]; + } + } + } + return target; +}; +var _createClass = function() { + function defineProperties(target, props2) { + for (var i5 = 0; i5 < props2.length; i5++) { + var descriptor = props2[i5]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} +function _possibleConstructorReturn(self2, call) { + if (!self2) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self2; +} +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; +} +var Alpha = function(_ref) { + _inherits(Alpha2, _ref); + function Alpha2() { + var _ref2; + var _temp, _this, _ret; + _classCallCheck(this, Alpha2); + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref2 = Alpha2.__proto__ || Object.getPrototypeOf(Alpha2)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function(e4) { + var change = calculateChange(e4, _this.props.hsl, _this.props.direction, _this.props.a, _this.container); + change && typeof _this.props.onChange === "function" && _this.props.onChange(change, e4); + }, _this.handleMouseDown = function(e4) { + _this.handleChange(e4); + window.addEventListener("mousemove", _this.handleChange); + window.addEventListener("mouseup", _this.handleMouseUp); + }, _this.handleMouseUp = function() { + _this.unbindEventListeners(); + }, _this.unbindEventListeners = function() { + window.removeEventListener("mousemove", _this.handleChange); + window.removeEventListener("mouseup", _this.handleMouseUp); + }, _temp), _possibleConstructorReturn(_this, _ret); + } + _createClass(Alpha2, [{ + key: "componentWillUnmount", + value: function componentWillUnmount() { + this.unbindEventListeners(); + } + }, { + key: "render", + value: function render3() { + var _this2 = this; + var rgb = this.props.rgb; + var styles2 = (0, import_reactcss2.default)({ + "default": { + alpha: { + absolute: "0px 0px 0px 0px", + borderRadius: this.props.radius + }, + checkboard: { + absolute: "0px 0px 0px 0px", + overflow: "hidden", + borderRadius: this.props.radius + }, + gradient: { + absolute: "0px 0px 0px 0px", + background: "linear-gradient(to right, rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 0) 0%,\n rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 1) 100%)", + boxShadow: this.props.shadow, + borderRadius: this.props.radius + }, + container: { + position: "relative", + height: "100%", + margin: "0 3px" + }, + pointer: { + position: "absolute", + left: rgb.a * 100 + "%" + }, + slider: { + width: "4px", + borderRadius: "1px", + height: "8px", + boxShadow: "0 0 2px rgba(0, 0, 0, .6)", + background: "#fff", + marginTop: "1px", + transform: "translateX(-2px)" + } + }, + "vertical": { + gradient: { + background: "linear-gradient(to bottom, rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 0) 0%,\n rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 1) 100%)" + }, + pointer: { + left: 0, + top: rgb.a * 100 + "%" + } + }, + "overwrite": _extends2({}, this.props.style) + }, { + vertical: this.props.direction === "vertical", + overwrite: true + }); + return Cn.createElement( + "div", + { style: styles2.alpha }, + Cn.createElement( + "div", + { style: styles2.checkboard }, + Cn.createElement(Checkboard_default, { renderers: this.props.renderers }) + ), + Cn.createElement("div", { style: styles2.gradient }), + Cn.createElement( + "div", + { + style: styles2.container, + ref: function ref2(container) { + return _this2.container = container; + }, + onMouseDown: this.handleMouseDown, + onTouchMove: this.handleChange, + onTouchStart: this.handleChange + }, + Cn.createElement( + "div", + { style: styles2.pointer }, + this.props.pointer ? Cn.createElement(this.props.pointer, this.props) : Cn.createElement("div", { style: styles2.slider }) + ) + ) + ); + } + }]); + return Alpha2; +}(w3 || k); +var Alpha_default = Alpha; + +// node_modules/react-color/es/components/common/EditableInput.js +init_compat_module(); +var import_reactcss3 = __toESM(require_lib()); +var _createClass2 = function() { + function defineProperties(target, props2) { + for (var i5 = 0; i5 < props2.length; i5++) { + var descriptor = props2[i5]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); +function _defineProperty(obj, key2, value) { + if (key2 in obj) { + Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); + } else { + obj[key2] = value; + } + return obj; +} +function _classCallCheck2(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} +function _possibleConstructorReturn2(self2, call) { + if (!self2) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self2; +} +function _inherits2(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; +} +var DEFAULT_ARROW_OFFSET = 1; +var UP_KEY_CODE = 38; +var DOWN_KEY_CODE = 40; +var VALID_KEY_CODES = [UP_KEY_CODE, DOWN_KEY_CODE]; +var isValidKeyCode = function isValidKeyCode2(keyCode) { + return VALID_KEY_CODES.indexOf(keyCode) > -1; +}; +var getNumberValue = function getNumberValue2(value) { + return Number(String(value).replace(/%/g, "")); +}; +var idCounter = 1; +var EditableInput = function(_ref) { + _inherits2(EditableInput2, _ref); + function EditableInput2(props2) { + _classCallCheck2(this, EditableInput2); + var _this = _possibleConstructorReturn2(this, (EditableInput2.__proto__ || Object.getPrototypeOf(EditableInput2)).call(this)); + _this.handleBlur = function() { + if (_this.state.blurValue) { + _this.setState({ value: _this.state.blurValue, blurValue: null }); + } + }; + _this.handleChange = function(e4) { + _this.setUpdatedValue(e4.target.value, e4); + }; + _this.handleKeyDown = function(e4) { + var value = getNumberValue(e4.target.value); + if (!isNaN(value) && isValidKeyCode(e4.keyCode)) { + var offset2 = _this.getArrowOffset(); + var updatedValue = e4.keyCode === UP_KEY_CODE ? value + offset2 : value - offset2; + _this.setUpdatedValue(updatedValue, e4); + } + }; + _this.handleDrag = function(e4) { + if (_this.props.dragLabel) { + var newValue = Math.round(_this.props.value + e4.movementX); + if (newValue >= 0 && newValue <= _this.props.dragMax) { + _this.props.onChange && _this.props.onChange(_this.getValueObjectWithLabel(newValue), e4); + } + } + }; + _this.handleMouseDown = function(e4) { + if (_this.props.dragLabel) { + e4.preventDefault(); + _this.handleDrag(e4); + window.addEventListener("mousemove", _this.handleDrag); + window.addEventListener("mouseup", _this.handleMouseUp); + } + }; + _this.handleMouseUp = function() { + _this.unbindEventListeners(); + }; + _this.unbindEventListeners = function() { + window.removeEventListener("mousemove", _this.handleDrag); + window.removeEventListener("mouseup", _this.handleMouseUp); + }; + _this.state = { + value: String(props2.value).toUpperCase(), + blurValue: String(props2.value).toUpperCase() + }; + _this.inputId = "rc-editable-input-" + idCounter++; + return _this; + } + _createClass2(EditableInput2, [{ + key: "componentDidUpdate", + value: function componentDidUpdate(prevProps, prevState) { + if (this.props.value !== this.state.value && (prevProps.value !== this.props.value || prevState.value !== this.state.value)) { + if (this.input === document.activeElement) { + this.setState({ blurValue: String(this.props.value).toUpperCase() }); + } else { + this.setState({ value: String(this.props.value).toUpperCase(), blurValue: !this.state.blurValue && String(this.props.value).toUpperCase() }); + } + } + } + }, { + key: "componentWillUnmount", + value: function componentWillUnmount() { + this.unbindEventListeners(); + } + }, { + key: "getValueObjectWithLabel", + value: function getValueObjectWithLabel(value) { + return _defineProperty({}, this.props.label, value); + } + }, { + key: "getArrowOffset", + value: function getArrowOffset() { + return this.props.arrowOffset || DEFAULT_ARROW_OFFSET; + } + }, { + key: "setUpdatedValue", + value: function setUpdatedValue(value, e4) { + var onChangeValue = this.props.label ? this.getValueObjectWithLabel(value) : value; + this.props.onChange && this.props.onChange(onChangeValue, e4); + this.setState({ value }); + } + }, { + key: "render", + value: function render3() { + var _this2 = this; + var styles2 = (0, import_reactcss3.default)({ + "default": { + wrap: { + position: "relative" + } + }, + "user-override": { + wrap: this.props.style && this.props.style.wrap ? this.props.style.wrap : {}, + input: this.props.style && this.props.style.input ? this.props.style.input : {}, + label: this.props.style && this.props.style.label ? this.props.style.label : {} + }, + "dragLabel-true": { + label: { + cursor: "ew-resize" + } + } + }, { + "user-override": true + }, this.props); + return Cn.createElement( + "div", + { style: styles2.wrap }, + Cn.createElement("input", { + id: this.inputId, + style: styles2.input, + ref: function ref2(input) { + return _this2.input = input; + }, + value: this.state.value, + onKeyDown: this.handleKeyDown, + onChange: this.handleChange, + onBlur: this.handleBlur, + placeholder: this.props.placeholder, + spellCheck: "false" + }), + this.props.label && !this.props.hideLabel ? Cn.createElement( + "label", + { + htmlFor: this.inputId, + style: styles2.label, + onMouseDown: this.handleMouseDown + }, + this.props.label + ) : null + ); + } + }]); + return EditableInput2; +}(w3 || k); +var EditableInput_default = EditableInput; + +// node_modules/react-color/es/components/common/Hue.js +init_compat_module(); +var import_reactcss4 = __toESM(require_lib()); + +// node_modules/react-color/es/helpers/hue.js +var calculateChange3 = function calculateChange4(e4, direction, hsl, container) { + var containerWidth = container.clientWidth; + var containerHeight = container.clientHeight; + var x5 = typeof e4.pageX === "number" ? e4.pageX : e4.touches[0].pageX; + var y5 = typeof e4.pageY === "number" ? e4.pageY : e4.touches[0].pageY; + var left = x5 - (container.getBoundingClientRect().left + window.pageXOffset); + var top = y5 - (container.getBoundingClientRect().top + window.pageYOffset); + if (direction === "vertical") { + var h5 = void 0; + if (top < 0) { + h5 = 359; + } else if (top > containerHeight) { + h5 = 0; + } else { + var percent = -(top * 100 / containerHeight) + 100; + h5 = 360 * percent / 100; + } + if (hsl.h !== h5) { + return { + h: h5, + s: hsl.s, + l: hsl.l, + a: hsl.a, + source: "hsl" + }; + } + } else { + var _h = void 0; + if (left < 0) { + _h = 0; + } else if (left > containerWidth) { + _h = 359; + } else { + var _percent = left * 100 / containerWidth; + _h = 360 * _percent / 100; + } + if (hsl.h !== _h) { + return { + h: _h, + s: hsl.s, + l: hsl.l, + a: hsl.a, + source: "hsl" + }; + } + } + return null; +}; + +// node_modules/react-color/es/components/common/Hue.js +var _createClass3 = function() { + function defineProperties(target, props2) { + for (var i5 = 0; i5 < props2.length; i5++) { + var descriptor = props2[i5]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); +function _classCallCheck3(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} +function _possibleConstructorReturn3(self2, call) { + if (!self2) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return call && (typeof call === "object" || typeof call === "function") ? call : self2; +} +function _inherits3(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; +} +var Hue = function(_ref) { + _inherits3(Hue2, _ref); + function Hue2() { + var _ref2; + var _temp, _this, _ret; + _classCallCheck3(this, Hue2); + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + return _ret = (_temp = (_this = _possibleConstructorReturn3(this, (_ref2 = Hue2.__proto__ || Object.getPrototypeOf(Hue2)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function(e4) { + var change = calculateChange3(e4, _this.props.direction, _this.props.hsl, _this.container); + change && typeof _this.props.onChange === "function" && _this.props.onChange(change, e4); + }, _this.handleMouseDown = function(e4) { + _this.handleChange(e4); + window.addEventListener("mousemove", _this.handleChange); + window.addEventListener("mouseup", _this.handleMouseUp); + }, _this.handleMouseUp = function() { + _this.unbindEventListeners(); + }, _temp), _possibleConstructorReturn3(_this, _ret); } _createClass3(Hue2, [{ key: "componentWillUnmount", @@ -59239,11 +60079,11 @@ function constant(value) { var constant_default = constant; // node_modules/lodash-es/_baseSetToString.js -var baseSetToString = !defineProperty_default ? identity_default : function(func, string) { +var baseSetToString = !defineProperty_default ? identity_default : function(func, string2) { return defineProperty_default(func, "toString", { "configurable": true, "enumerable": false, - "value": constant_default(string), + "value": constant_default(string2), "writable": true }); }; @@ -59417,9 +60257,9 @@ var now_default = now; // node_modules/lodash-es/_trimmedEndIndex.js var reWhitespace = /\s/; -function trimmedEndIndex(string) { - var index = string.length; - while (index-- && reWhitespace.test(string.charAt(index))) { +function trimmedEndIndex(string2) { + var index = string2.length; + while (index-- && reWhitespace.test(string2.charAt(index))) { } return index; } @@ -59427,8 +60267,8 @@ var trimmedEndIndex_default = trimmedEndIndex; // node_modules/lodash-es/_baseTrim.js var reTrimStart = /^\s+/; -function baseTrim(string) { - return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string; +function baseTrim(string2) { + return string2 ? string2.slice(0, trimmedEndIndex_default(string2) + 1).replace(reTrimStart, "") : string2; } var baseTrim_default = baseTrim; @@ -59602,8 +60442,8 @@ var calculateChange5 = function calculateChange6(e4, hsl, container) { // node_modules/react-color/es/components/common/Saturation.js var _createClass4 = function() { function defineProperties(target, props2) { - for (var i4 = 0; i4 < props2.length; i4++) { - var descriptor = props2[i4]; + for (var i5 = 0; i5 < props2.length; i5++) { + var descriptor = props2[i5]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) @@ -59935,8 +60775,8 @@ tinycolor.prototype = { }, toHsvString: function toHsvString() { var hsv = rgbToHsv(this._r, this._g, this._b); - var h5 = Math.round(hsv.h * 360), s5 = Math.round(hsv.s * 100), v3 = Math.round(hsv.v * 100); - return this._a == 1 ? "hsv(" + h5 + ", " + s5 + "%, " + v3 + "%)" : "hsva(" + h5 + ", " + s5 + "%, " + v3 + "%, " + this._roundA + ")"; + var h5 = Math.round(hsv.h * 360), s6 = Math.round(hsv.s * 100), v4 = Math.round(hsv.v * 100); + return this._a == 1 ? "hsv(" + h5 + ", " + s6 + "%, " + v4 + "%)" : "hsva(" + h5 + ", " + s6 + "%, " + v4 + "%, " + this._roundA + ")"; }, toHsl: function toHsl() { var hsl = rgbToHsl(this._r, this._g, this._b); @@ -59949,8 +60789,8 @@ tinycolor.prototype = { }, toHslString: function toHslString() { var hsl = rgbToHsl(this._r, this._g, this._b); - var h5 = Math.round(hsl.h * 360), s5 = Math.round(hsl.s * 100), l3 = Math.round(hsl.l * 100); - return this._a == 1 ? "hsl(" + h5 + ", " + s5 + "%, " + l3 + "%)" : "hsla(" + h5 + ", " + s5 + "%, " + l3 + "%, " + this._roundA + ")"; + var h5 = Math.round(hsl.h * 360), s6 = Math.round(hsl.s * 100), l3 = Math.round(hsl.l * 100); + return this._a == 1 ? "hsl(" + h5 + ", " + s6 + "%, " + l3 + "%)" : "hsla(" + h5 + ", " + s6 + "%, " + l3 + "%, " + this._roundA + ")"; }, toHex: function toHex(allow3Char) { return rgbToHex(this._r, this._g, this._b, allow3Char); @@ -60000,8 +60840,8 @@ tinycolor.prototype = { var secondHex8String = hex8String; var gradientType = this._gradientType ? "GradientType = 1, " : ""; if (secondColor) { - var s5 = tinycolor(secondColor); - secondHex8String = "#" + rgbaToArgbHex(s5._r, s5._g, s5._b, s5._a); + var s6 = tinycolor(secondColor); + secondHex8String = "#" + rgbaToArgbHex(s6._r, s6._g, s6._b, s6._a); } return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")"; }, @@ -60103,12 +60943,12 @@ tinycolor.prototype = { tinycolor.fromRatio = function(color, opts) { if (_typeof5(color) == "object") { var newColor = {}; - for (var i4 in color) { - if (color.hasOwnProperty(i4)) { - if (i4 === "a") { - newColor[i4] = color[i4]; + for (var i5 in color) { + if (color.hasOwnProperty(i5)) { + if (i5 === "a") { + newColor[i5] = color[i5]; } else { - newColor[i4] = convertToPercentage(color[i4]); + newColor[i5] = convertToPercentage(color[i5]); } } } @@ -60122,9 +60962,9 @@ function inputToRGB(color) { g: 0, b: 0 }; - var a5 = 1; - var s5 = null; - var v3 = null; + var a6 = 1; + var s6 = null; + var v4 = null; var l3 = null; var ok = false; var format2 = false; @@ -60137,30 +60977,30 @@ function inputToRGB(color) { ok = true; format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { - s5 = convertToPercentage(color.s); - v3 = convertToPercentage(color.v); - rgb = hsvToRgb(color.h, s5, v3); + s6 = convertToPercentage(color.s); + v4 = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, s6, v4); ok = true; format2 = "hsv"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { - s5 = convertToPercentage(color.s); + s6 = convertToPercentage(color.s); l3 = convertToPercentage(color.l); - rgb = hslToRgb(color.h, s5, l3); + rgb = hslToRgb(color.h, s6, l3); ok = true; format2 = "hsl"; } if (color.hasOwnProperty("a")) { - a5 = color.a; + a6 = color.a; } } - a5 = boundAlpha(a5); + a6 = boundAlpha(a6); return { ok, format: color.format || format2, r: Math.min(255, Math.max(rgb.r, 0)), g: Math.min(255, Math.max(rgb.g, 0)), b: Math.min(255, Math.max(rgb.b, 0)), - a: a5 + a: a6 }; } function rgbToRgb(r3, g4, b4) { @@ -60175,53 +61015,53 @@ function rgbToHsl(r3, g4, b4) { g4 = bound01(g4, 255); b4 = bound01(b4, 255); var max3 = Math.max(r3, g4, b4), min3 = Math.min(r3, g4, b4); - var h5, s5, l3 = (max3 + min3) / 2; + var h5, s6, l3 = (max3 + min3) / 2; if (max3 == min3) { - h5 = s5 = 0; + h5 = s6 = 0; } else { - var d5 = max3 - min3; - s5 = l3 > 0.5 ? d5 / (2 - max3 - min3) : d5 / (max3 + min3); + var d6 = max3 - min3; + s6 = l3 > 0.5 ? d6 / (2 - max3 - min3) : d6 / (max3 + min3); switch (max3) { case r3: - h5 = (g4 - b4) / d5 + (g4 < b4 ? 6 : 0); + h5 = (g4 - b4) / d6 + (g4 < b4 ? 6 : 0); break; case g4: - h5 = (b4 - r3) / d5 + 2; + h5 = (b4 - r3) / d6 + 2; break; case b4: - h5 = (r3 - g4) / d5 + 4; + h5 = (r3 - g4) / d6 + 4; break; } h5 /= 6; } return { h: h5, - s: s5, + s: s6, l: l3 }; } -function hslToRgb(h5, s5, l3) { +function hslToRgb(h5, s6, l3) { var r3, g4, b4; h5 = bound01(h5, 360); - s5 = bound01(s5, 100); + s6 = bound01(s6, 100); l3 = bound01(l3, 100); - function hue2rgb(p4, q6, t4) { - if (t4 < 0) - t4 += 1; - if (t4 > 1) - t4 -= 1; - if (t4 < 1 / 6) - return p4 + (q6 - p4) * 6 * t4; - if (t4 < 1 / 2) + function hue2rgb(p4, q6, t5) { + if (t5 < 0) + t5 += 1; + if (t5 > 1) + t5 -= 1; + if (t5 < 1 / 6) + return p4 + (q6 - p4) * 6 * t5; + if (t5 < 1 / 2) return q6; - if (t4 < 2 / 3) - return p4 + (q6 - p4) * (2 / 3 - t4) * 6; + if (t5 < 2 / 3) + return p4 + (q6 - p4) * (2 / 3 - t5) * 6; return p4; } - if (s5 === 0) { + if (s6 === 0) { r3 = g4 = b4 = l3; } else { - var q5 = l3 < 0.5 ? l3 * (1 + s5) : l3 + s5 - l3 * s5; + var q5 = l3 < 0.5 ? l3 * (1 + s6) : l3 + s6 - l3 * s6; var p3 = 2 * l3 - q5; r3 = hue2rgb(p3, q5, h5 + 1 / 3); g4 = hue2rgb(p3, q5, h5); @@ -60238,36 +61078,36 @@ function rgbToHsv(r3, g4, b4) { g4 = bound01(g4, 255); b4 = bound01(b4, 255); var max3 = Math.max(r3, g4, b4), min3 = Math.min(r3, g4, b4); - var h5, s5, v3 = max3; - var d5 = max3 - min3; - s5 = max3 === 0 ? 0 : d5 / max3; + var h5, s6, v4 = max3; + var d6 = max3 - min3; + s6 = max3 === 0 ? 0 : d6 / max3; if (max3 == min3) { h5 = 0; } else { switch (max3) { case r3: - h5 = (g4 - b4) / d5 + (g4 < b4 ? 6 : 0); + h5 = (g4 - b4) / d6 + (g4 < b4 ? 6 : 0); break; case g4: - h5 = (b4 - r3) / d5 + 2; + h5 = (b4 - r3) / d6 + 2; break; case b4: - h5 = (r3 - g4) / d5 + 4; + h5 = (r3 - g4) / d6 + 4; break; } h5 /= 6; } return { h: h5, - s: s5, - v: v3 + s: s6, + v: v4 }; } -function hsvToRgb(h5, s5, v3) { +function hsvToRgb(h5, s6, v4) { h5 = bound01(h5, 360) * 6; - s5 = bound01(s5, 100); - v3 = bound01(v3, 100); - var i4 = Math.floor(h5), f4 = h5 - i4, p3 = v3 * (1 - s5), q5 = v3 * (1 - f4 * s5), t4 = v3 * (1 - (1 - f4) * s5), mod = i4 % 6, r3 = [v3, q5, p3, p3, t4, v3][mod], g4 = [t4, v3, v3, q5, p3, p3][mod], b4 = [p3, p3, t4, v3, v3, q5][mod]; + s6 = bound01(s6, 100); + v4 = bound01(v4, 100); + var i5 = Math.floor(h5), f4 = h5 - i5, p3 = v4 * (1 - s6), q5 = v4 * (1 - f4 * s6), t5 = v4 * (1 - (1 - f4) * s6), mod = i5 % 6, r3 = [v4, q5, p3, p3, t5, v4][mod], g4 = [t5, v4, v4, q5, p3, p3][mod], b4 = [p3, p3, t5, v4, v4, q5][mod]; return { r: r3 * 255, g: g4 * 255, @@ -60281,15 +61121,15 @@ function rgbToHex(r3, g4, b4, allow3Char) { } return hex.join(""); } -function rgbaToHex(r3, g4, b4, a5, allow4Char) { - var hex = [pad2(Math.round(r3).toString(16)), pad2(Math.round(g4).toString(16)), pad2(Math.round(b4).toString(16)), pad2(convertDecimalToHex(a5))]; +function rgbaToHex(r3, g4, b4, a6, allow4Char) { + var hex = [pad2(Math.round(r3).toString(16)), pad2(Math.round(g4).toString(16)), pad2(Math.round(b4).toString(16)), pad2(convertDecimalToHex(a6))]; if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); } return hex.join(""); } -function rgbaToArgbHex(r3, g4, b4, a5) { - var hex = [pad2(convertDecimalToHex(a5)), pad2(Math.round(r3).toString(16)), pad2(Math.round(g4).toString(16)), pad2(Math.round(b4).toString(16))]; +function rgbaToArgbHex(r3, g4, b4, a6) { + var hex = [pad2(convertDecimalToHex(a6)), pad2(Math.round(r3).toString(16)), pad2(Math.round(g4).toString(16)), pad2(Math.round(b4).toString(16))]; return hex.join(""); } tinycolor.equals = function(color1, color2) { @@ -60354,16 +61194,16 @@ function _complement(color) { hsl.h = (hsl.h + 180) % 360; return tinycolor(hsl); } -function polyad(color, number) { - if (isNaN(number) || number <= 0) { +function polyad(color, number2) { + if (isNaN(number2) || number2 <= 0) { throw new Error("Argument to polyad must be a positive number"); } var hsl = tinycolor(color).toHsl(); var result = [tinycolor(color)]; - var step = 360 / number; - for (var i4 = 1; i4 < number; i4++) { + var step = 360 / number2; + for (var i5 = 1; i5 < number2; i5++) { result.push(tinycolor({ - h: (hsl.h + i4 * step) % 360, + h: (hsl.h + i5 * step) % 360, s: hsl.s, l: hsl.l })); @@ -60398,16 +61238,16 @@ function _analogous(color, results, slices) { function _monochromatic(color, results) { results = results || 6; var hsv = tinycolor(color).toHsv(); - var h5 = hsv.h, s5 = hsv.s, v3 = hsv.v; + var h5 = hsv.h, s6 = hsv.s, v4 = hsv.v; var ret = []; var modification = 1 / results; while (results--) { ret.push(tinycolor({ h: h5, - s: s5, - v: v3 + s: s6, + v: v4 })); - v3 = (v3 + modification) % 1; + v4 = (v4 + modification) % 1; } return ret; } @@ -60457,11 +61297,11 @@ tinycolor.mostReadable = function(baseColor, colorList, args) { includeFallbackColors = args.includeFallbackColors; level = args.level; size = args.size; - for (var i4 = 0; i4 < colorList.length; i4++) { - readability = tinycolor.readability(baseColor, colorList[i4]); + for (var i5 = 0; i5 < colorList.length; i5++) { + readability = tinycolor.readability(baseColor, colorList[i5]); if (readability > bestScore) { bestScore = readability; - bestColor = tinycolor(colorList[i4]); + bestColor = tinycolor(colorList[i5]); } } if (tinycolor.isReadable(baseColor, bestColor, { @@ -60628,19 +61468,19 @@ var names = tinycolor.names = { var hexNames = tinycolor.hexNames = flip(names); function flip(o3) { var flipped = {}; - for (var i4 in o3) { - if (o3.hasOwnProperty(i4)) { - flipped[o3[i4]] = i4; + for (var i5 in o3) { + if (o3.hasOwnProperty(i5)) { + flipped[o3[i5]] = i5; } } return flipped; } -function boundAlpha(a5) { - a5 = parseFloat(a5); - if (isNaN(a5) || a5 < 0 || a5 > 1) { - a5 = 1; +function boundAlpha(a6) { + a6 = parseFloat(a6); + if (isNaN(a6) || a6 < 0 || a6 > 1) { + a6 = 1; } - return a5; + return a6; } function bound01(n2, max3) { if (isOnePointZero(n2)) @@ -60676,8 +61516,8 @@ function convertToPercentage(n2) { } return n2; } -function convertDecimalToHex(d5) { - return Math.round(parseFloat(d5) * 255).toString(16); +function convertDecimalToHex(d6) { + return Math.round(parseFloat(d6) * 255).toString(16); } function convertHexToDecimal(h5) { return parseIntFromHex(h5) / 255; @@ -60881,15 +61721,15 @@ var getContrastingColor = function getContrastingColor2(data2) { var yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1e3; return yiq >= 128 ? "#000" : "#fff"; }; -var isvalidColorString = function isvalidColorString2(string, type) { - var stringWithoutDegree = string.replace("\xB0", ""); +var isvalidColorString = function isvalidColorString2(string2, type) { + var stringWithoutDegree = string2.replace("\xB0", ""); return tinycolor(type + " (" + stringWithoutDegree + ")")._ok; }; // node_modules/react-color/es/components/common/ColorWrap.js var _extends3 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -60900,8 +61740,8 @@ var _extends3 = Object.assign || function(target) { }; var _createClass5 = function() { function defineProperties(target, props2) { - for (var i4 = 0; i4 < props2.length; i4++) { - var descriptor = props2[i4]; + for (var i5 = 0; i5 < props2.length; i5++) { + var descriptor = props2[i5]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) @@ -61003,8 +61843,8 @@ var import_reactcss7 = __toESM(require_lib()); // node_modules/react-color/es/helpers/interaction.js init_compat_module(); var _extends4 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -61015,8 +61855,8 @@ var _extends4 = Object.assign || function(target) { }; var _createClass6 = function() { function defineProperties(target, props2) { - for (var i4 = 0; i4 < props2.length; i4++) { - var descriptor = props2[i4]; + for (var i5 = 0; i5 < props2.length; i5++) { + var descriptor = props2[i5]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) @@ -61084,8 +61924,8 @@ var handleFocus = function handleFocus2(Component4) { // node_modules/react-color/es/components/common/Swatch.js var _extends5 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -61170,8 +62010,8 @@ var AlphaPointer_default = AlphaPointer; // node_modules/react-color/es/components/alpha/Alpha.js var _extends6 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -61274,8 +62114,8 @@ function arraySome(array, predicate) { var arraySome_default = arraySome; // node_modules/lodash-es/_cacheHas.js -function cacheHas(cache, key2) { - return cache.has(key2); +function cacheHas(cache2, key2) { + return cache2.has(key2); } var cacheHas_default = cacheHas; @@ -61717,12 +62557,12 @@ function memoize(func, resolver) { throw new TypeError(FUNC_ERROR_TEXT3); } var memoized = function() { - var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; - if (cache.has(key2)) { - return cache.get(key2); + var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache; + if (cache2.has(key2)) { + return cache2.get(key2); } var result = func.apply(this, args); - memoized.cache = cache.set(key2, result) || cache; + memoized.cache = cache2.set(key2, result) || cache2; return result; }; memoized.cache = new (memoize.Cache || MapCache_default)(); @@ -61735,12 +62575,12 @@ var memoize_default = memoize; var MAX_MEMOIZE_SIZE = 500; function memoizeCapped(func) { var result = memoize_default(func, function(key2) { - if (cache.size === MAX_MEMOIZE_SIZE) { - cache.clear(); + if (cache2.size === MAX_MEMOIZE_SIZE) { + cache2.clear(); } return key2; }); - var cache = result.cache; + var cache2 = result.cache; return result; } var memoizeCapped_default = memoizeCapped; @@ -61748,13 +62588,13 @@ var memoizeCapped_default = memoizeCapped; // node_modules/lodash-es/_stringToPath.js var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; var reEscapeChar = /\\(\\)?/g; -var stringToPath = memoizeCapped_default(function(string) { +var stringToPath = memoizeCapped_default(function(string2) { var result = []; - if (string.charCodeAt(0) === 46) { + if (string2.charCodeAt(0) === 46) { result.push(""); } - string.replace(rePropName, function(match2, number, quote, subString) { - result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match2); + string2.replace(rePropName, function(match2, number2, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, "$1") : number2 || match2); }); return result; }); @@ -62212,8 +63052,8 @@ var isUndefined_default = isUndefined; var import_UnfoldMoreHorizontalIcon = __toESM(require_UnfoldMoreHorizontalIcon()); var _createClass7 = function() { function defineProperties(target, props2) { - for (var i4 = 0; i4 < props2.length; i4++) { - var descriptor = props2[i4]; + for (var i5 = 0; i5 < props2.length; i5++) { + var descriptor = props2[i5]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) @@ -63187,8 +64027,8 @@ var HuePointer_default = SliderPointer; // node_modules/react-color/es/components/hue/Hue.js var _extends7 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -63721,8 +64561,8 @@ var PhotoshopPreviews_default = PhotoshopPreviews; // node_modules/react-color/es/components/photoshop/Photoshop.js var _createClass8 = function() { function defineProperties(target, props2) { - for (var i4 = 0; i4 < props2.length; i4++) { - var descriptor = props2[i4]; + for (var i5 = 0; i5 < props2.length; i5++) { + var descriptor = props2[i5]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) @@ -64052,8 +64892,8 @@ init_compat_module(); var import_prop_types9 = __toESM(require_prop_types()); var import_reactcss33 = __toESM(require_lib()); var _extends8 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -64130,8 +64970,8 @@ var SketchPresetColors_default = SketchPresetColors; // node_modules/react-color/es/components/sketch/Sketch.js var _extends9 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -64586,13 +65426,13 @@ var SwatchesGroup = function SwatchesGroup2(_ref) { return Cn.createElement( "div", { style: styles2.group }, - map_default(group, function(color, i4) { + map_default(group, function(color, i5) { return Cn.createElement(SwatchesColor_default, { key: color, color, active: color.toLowerCase() === active, - first: i4 === 0, - last: i4 === group.length - 1, + first: i5 === 0, + last: i5 === group.length - 1, onClick, onSwatchHover }); @@ -64787,9 +65627,9 @@ var Twitter = function Twitter2(_ref) { Cn.createElement( "div", { style: styles2.body }, - map_default(colors2, function(c4, i4) { + map_default(colors2, function(c4, i5) { return Cn.createElement(Swatch_default, { - key: i4, + key: i5, color: c4, hex: c4, style: styles2.swatch, @@ -65257,9 +66097,9 @@ var showColorPickerMenu = (point, value, setValue) => { item.setTitle(frag); }); const keys2 = [...menu.scope.keys]; - for (let i4 = 0; i4 < keys2.length; i4++) { - if (keys2[i4].key != "Escape") { - menu.scope.unregister(keys2[i4]); + for (let i5 = 0; i5 < keys2.length; i5++) { + if (keys2[i5].key != "Escape") { + menu.scope.unregister(keys2[i5]); } } menu.showAtPosition(point); @@ -65319,126 +66159,16 @@ var IconCell = (props2) => { }; return /* @__PURE__ */ Cn.createElement("div", { className: "mk-cell-icon" - }, value.map((v3, i4) => /* @__PURE__ */ Cn.createElement("button", { - key: i4, + }, value.map((v4, i5) => /* @__PURE__ */ Cn.createElement("button", { + key: i5, "aria-label": i18n_default.buttons.changeIcon, dangerouslySetInnerHTML: { - __html: stickerFromString(v3, props2.plugin) + __html: stickerFromString(v4, props2.plugin) }, onClick: (e4) => triggerStickerMenu(e4) }))); }; -// src/components/Space/Contexts/DataTypeView/ObjectCell.tsx -init_compat_module(); -var ObjectCell = (props2) => { - const { initialValue } = props2; - const [value, setValue] = Cn.useState(safelyParseJSON(initialValue)); - const saveValue = (value2) => { - props2.saveValue(JSON.stringify(value2)); - }; - const newKey = (key2) => { - if (key2) - saveValue({ - ...value, - [key2]: "" - }); - }; - const saveKey = (key2, newKey2) => { - if (key2 != newKey2) - saveValue({ - ...value, - [newKey2]: value[key2], - [key2]: void 0 - }); - }; - const saveVal = (key2, val) => { - saveValue({ - ...value, - [key2]: val - }); - }; - Cn.useEffect(() => { - setValue(safelyParseJSON(initialValue)); - }, [initialValue]); - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-cell-object" - }, Object.keys(value).map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, - className: "mk-cell-object-row" - }, /* @__PURE__ */ Cn.createElement("input", { - onClick: (e4) => e4.stopPropagation(), - className: "mk-cell-text", - type: "text", - value: f4, - onBlur: (e4) => saveKey(f4, e4.target.value) - }), /* @__PURE__ */ Cn.createElement("input", { - onClick: (e4) => e4.stopPropagation(), - className: "mk-cell-text", - type: "text", - value: value[f4], - onBlur: (e4) => saveVal(f4, e4.target.value) - }))), /* @__PURE__ */ Cn.createElement("input", { - onClick: (e4) => e4.stopPropagation(), - className: "mk-cell-text", - type: "text", - value: "", - onBlur: (e4) => newKey(e4.target.value) - })); -}; - -// src/components/Space/Contexts/DataTypeView/PreviewCell.tsx -init_compat_module(); -var PreviewCell = (props2) => { - var _a2; - const [vaultItem, setVaultItem] = h2(null); - const previewImage = F2(() => { - if (vaultItem == null ? void 0 : vaultItem.banner) - return vaultItem.banner; - if (props2.initialValue) - return props2.initialValue; - if (!props2.row || !props2.columns) - return null; - const imageCol = props2.columns.find((f4) => f4.type == "image"); - if (!imageCol) - return null; - return props2.row[imageCol.name + imageCol.table]; - }, [props2.row, props2.columns]); - const previewFile = F2(() => { - return getAbstractFileAtPath(app, previewImage); - }, [previewImage]); - const loadIcon = () => { - setVaultItem(props2.plugin.index.filesIndex.get(props2.file)); - }; - p2(() => { - loadIcon(); - window.addEventListener(eventTypes.spacesChange, loadIcon); - return () => { - window.removeEventListener(eventTypes.spacesChange, loadIcon); - }; - }, [props2.file]); - return previewImage ? /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-preview", - style: { - backgroundSize: "cover", - backgroundPositionY: "50%", - backgroundImage: `url(${previewFile ? app.vault.getResourcePath(previewFile) : previewImage})` - } - }) : /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-preview", - style: ((_a2 = vaultItem == null ? void 0 : vaultItem.color) == null ? void 0 : _a2.length) > 0 ? { - "--label-color": `${vaultItem.color}`, - "--icon-color": `#ffffff` - } : { - "--label-color": `var(--background-secondary-alt)`, - "--icon-color": `var(--text-muted)` - } - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-icon", - dangerouslySetInnerHTML: (vaultItem == null ? void 0 : vaultItem.sticker) ? { __html: stickerFromString(vaultItem.sticker, props2.plugin) } : (vaultItem == null ? void 0 : vaultItem.isFolder) ? { __html: uiIconSet["mk-ui-folder"] } : { __html: uiIconSet["mk-ui-file"] } - })); -}; - // src/components/Space/Contexts/DataTypeView/SpaceCell.tsx init_compat_module(); var SpaceCell = (props2) => { @@ -65495,12 +66225,12 @@ var SpaceCell = (props2) => { // src/components/Space/Contexts/DataTypeView/DataTypeView.tsx var DataTypeView = (props2) => { - const { initialValue, column, file } = props2; - const saveValue = (value) => { - props2.updateValue(value); + const { initialValue, column, row } = props2; + const saveValue = (value2) => { + props2.updateValue(value2); }; - const saveFieldValue = (fieldValue, value) => { - props2.updateFieldValue(fieldValue, value); + const saveFieldValue = (fieldValue, value2) => { + props2.updateFieldValue(fieldValue, value2); }; const viewProps = { initialValue, @@ -65512,18 +66242,11 @@ var DataTypeView = (props2) => { propertyValue: column.value }; const fieldType = fieldTypeForType(column.type); + const value = parseFieldValue(column.value, column.type); if (!fieldType) { return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); } - if (fieldType.type == "preview") { - return /* @__PURE__ */ Cn.createElement(PreviewCell, { - ...viewProps, - file, - row: props2.row, - columns: props2.cols, - plugin: props2.plugin - }); - } else if (fieldType.type == "file") { + if (fieldType.type == "file") { return /* @__PURE__ */ Cn.createElement(FileCell, { isFolder: false, ...viewProps, @@ -65555,13 +66278,14 @@ var DataTypeView = (props2) => { return /* @__PURE__ */ Cn.createElement(ContextCell, { ...viewProps, multi: fieldType.multiType == column.type, - contextTable: props2.contextTable[column.value], - contextTag: column.value + space: value.space, + spaceField: value.field, + path: row["File"] }); } else if (fieldType.type == "fileprop") { return /* @__PURE__ */ Cn.createElement(LookUpCell, { ...viewProps, - file + file: row["File"] }); } else if (fieldType.type == "number") { return /* @__PURE__ */ Cn.createElement(NumberCell, { @@ -65571,7 +66295,7 @@ var DataTypeView = (props2) => { return /* @__PURE__ */ Cn.createElement(LinkCell, { ...viewProps, multi: fieldType.multiType == column.type, - file + file: row["File"] }); } else if (fieldType.type == "tag") { return /* @__PURE__ */ Cn.createElement(TagCell, { @@ -65584,17 +66308,25 @@ var DataTypeView = (props2) => { }); } else if (fieldType.type == "object") { return /* @__PURE__ */ Cn.createElement(ObjectCell, { - ...viewProps + ...viewProps, + multi: fieldType.multiType == column.type, + savePropValue: saveFieldValue }); } else if (fieldType.type == "color") { return /* @__PURE__ */ Cn.createElement(ColorCell, { ...viewProps }); - } else if (fieldType.type == "SpaceCell") { + } else if (fieldType.type == "space") { return /* @__PURE__ */ Cn.createElement(SpaceCell, { ...viewProps }); } + if (fieldType.type == "super") { + return /* @__PURE__ */ Cn.createElement(SuperCell, { + ...viewProps, + row + }); + } return /* @__PURE__ */ Cn.createElement(TextCell, { ...viewProps }); @@ -65625,7 +66357,7 @@ var FileContextList = (props2) => { const fileContext = F2(() => { return tableData ? { cols: tableData.cols.filter( - (f4) => f4.name != FilePropertyName && !(f4.type == "fileprop" && (f4.value.startsWith(FilePropertyName) || f4.value.indexOf(".") == -1)) && f4.hidden != "true" && f4.type != "preview" + (f4) => f4.name != FilePropertyName && !(f4.type == "fileprop" && (f4.value.startsWith(FilePropertyName) || f4.value.indexOf(".") == -1)) && f4.hidden != "true" ), data: tableData.rows.find((r3) => r3.File == path), dataIndex: tableData.rows.findIndex((r3) => r3.File == path) @@ -65638,14 +66370,6 @@ var FileContextList = (props2) => { } } }; - const saveContext = (field, oldField, value) => { - const newContext = value[0]; - const newField = { - ...field, - value: newContext != null ? newContext : "" - }; - saveColumn(newField, oldField); - }; const showMenu = (e4, field) => { const offset2 = e4.target.getBoundingClientRect(); const options = optionValuesForColumn(field.name, tableData); @@ -65658,7 +66382,6 @@ var FileContextList = (props2) => { fields: cols, contextPath: spaceInfo.path, saveField: (newField) => saveField(newField, field), - saveContext: (newField, val) => saveContext(newField, field, val), hide: hideColumn, deleteColumn: delColumn, sortColumn, @@ -65683,10 +66406,10 @@ var FileContextList = (props2) => { dangerouslySetInnerHTML: { __html: iconForSpace(spaceInfo) } - }), contextDisplayName(spaceInfo)), !collapsed ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, fileContext.cols.map((f4, i4) => { - var _a2, _b2, _c2; - return /* @__PURE__ */ Cn.createElement("div", { - key: i4, + }), contextDisplayName(spaceInfo, props2.plugin)), !collapsed ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, fileContext.cols.map((f4, i5) => { + var _a2, _b2, _c2, _d2, _e2, _f; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + key: i5, className: "mk-file-context-row" }, /* @__PURE__ */ Cn.createElement("div", { className: "mk-file-context-field", @@ -65695,36 +66418,66 @@ var FileContextList = (props2) => { className: "mk-file-context-field-icon", dangerouslySetInnerHTML: { __html: stickerFromString( - (_a2 = fieldTypeForType(f4.type)) == null ? void 0 : _a2.icon, + ((_a2 = f4.attrs) == null ? void 0 : _a2.length) > 0 ? f4.attrs : (_b2 = fieldTypeForType(f4.type)) == null ? void 0 : _b2.icon, props2.plugin ) } }), /* @__PURE__ */ Cn.createElement("div", { className: "mk-file-context-field-key" - }, f4.name)), /* @__PURE__ */ Cn.createElement("div", { + }, f4.name)), !f4.type.startsWith("object") && /* @__PURE__ */ Cn.createElement("div", { className: "mk-file-context-value" }, /* @__PURE__ */ Cn.createElement(DataTypeView, { plugin: props2.plugin, - initialValue: (_b2 = fileContext.data) == null ? void 0 : _b2[f4.name], - file: (_c2 = fileContext.data) == null ? void 0 : _c2[FilePropertyName], + initialValue: (_c2 = fileContext.data) == null ? void 0 : _c2[f4.name], + row: (_d2 = fileContext.data) != null ? _d2 : {}, + column: { ...f4, table: "" }, + editable: !spaceInfo.readOnly, + updateValue: (v4) => { + var _a3; + return updateValue2( + f4.name, + v4, + "", + fileContext.dataIndex, + (_a3 = fileContext.data) == null ? void 0 : _a3[FilePropertyName] + ); + }, + updateFieldValue: (fv, v4) => { + var _a3; + return updateFieldValue( + f4.name, + fv, + v4, + "", + fileContext.dataIndex, + (_a3 = fileContext.data) == null ? void 0 : _a3[FilePropertyName] + ); + }, + contextTable: {} + }))), f4.type.startsWith("object") && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-row" + }, /* @__PURE__ */ Cn.createElement(DataTypeView, { + plugin: props2.plugin, + initialValue: (_e2 = fileContext.data) == null ? void 0 : _e2[f4.name], + row: (_f = fileContext.data) != null ? _f : {}, column: { ...f4, table: "" }, editable: !spaceInfo.readOnly, - updateValue: (v3) => { + updateValue: (v4) => { var _a3; return updateValue2( f4.name, - v3, + v4, "", fileContext.dataIndex, (_a3 = fileContext.data) == null ? void 0 : _a3[FilePropertyName] ); }, - updateFieldValue: (fv, v3) => { + updateFieldValue: (fv, v4) => { var _a3; return updateFieldValue( f4.name, fv, - v3, + v4, "", fileContext.dataIndex, (_a3 = fileContext.data) == null ? void 0 : _a3[FilePropertyName] @@ -65822,7 +66575,7 @@ var MovePropertyComponent = (props2) => { }; const showContextMenu = async (e4) => { const offset2 = e4.target.getBoundingClientRect(); - const tags = allTagsForFile(props2.file); + const tags2 = allTagsForFile(props2.file); showSelectMenu( { x: offset2.left, y: offset2.top + 30 }, { @@ -65832,7 +66585,7 @@ var MovePropertyComponent = (props2) => { value: [], options: [ { name: props2.file.parent.name, value: "" }, - ...tags.map((m5) => ({ name: m5, value: m5 })) + ...tags2.map((m6) => ({ name: m6, value: m6 })) ], saveOptions: saveContexts, placeholder: i18n_default.labels.tagItemSelectPlaceholder, @@ -65917,8 +66670,8 @@ var FrontmatterView = (props2) => { const dvValues = props2.plugin.dataViewAPI().page(metadataPath); const dvKeys = uniqCaseInsensitive( Object.keys(dvValues != null ? dvValues : {}).filter( - (f4, i4, self2) => !self2.find( - (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 + (f4, i5, self2) => !self2.find( + (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i5 > j4 ) ? true : false ).filter((f4) => f4 != "file").filter((f4) => f4 != "tag" && f4 != "tags").filter((f4) => !fmKeys2.includes(f4)).filter((f4) => !columns.some((g4) => g4.name == f4)) ); @@ -66008,8 +66761,8 @@ var FrontmatterView = (props2) => { ); vaultChangeModal.open(); }; - const renameFMKey = (key2, name) => { - renameFrontmatterKey(props2.plugin, metadataPath, key2, name); + const renameFMKey = (key2, name2) => { + renameFrontmatterKey(props2.plugin, metadataPath, key2, name2); }; const selectedType = (value, key2) => { changeFrontmatterType(props2.plugin, metadataPath, key2, value[0]); @@ -66020,11 +66773,11 @@ var FrontmatterView = (props2) => { multi: false, editable: false, searchable: false, - saveOptions: (_12, v3) => selectedType(v3, key2), + saveOptions: (_12, v4) => selectedType(v4, key2), value: [], showAll: true, - options: fieldTypes.filter((f4) => f4.metadata).map((f4, i4) => ({ - id: i4 + 1, + options: fieldTypes.filter((f4) => f4.metadata).map((f4, i5) => ({ + id: i5 + 1, name: f4.label, value: f4.type, icon: "" @@ -66046,8 +66799,8 @@ var FrontmatterView = (props2) => { const propertiesPlugin = corePluginEnabled(app, "properties"); return !propertiesPlugin ? cols.length > 0 ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { className: "mk-file-context-section" - }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, cols.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, + }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, cols.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, className: "mk-file-context-row" }, /* @__PURE__ */ Cn.createElement("div", { className: "mk-file-context-field", @@ -66057,7 +66810,7 @@ var FrontmatterView = (props2) => { }, /* @__PURE__ */ Cn.createElement(DataTypeView, { plugin: props2.plugin, initialValue: values[f4.name], - file: metadataPath, + row: { File: metadataPath }, column: { ...f4, table: "" }, editable: props2.editable, updateValue: (value) => saveFMValue(value, f4), @@ -66065,7 +66818,7 @@ var FrontmatterView = (props2) => { contextTable: {} }))))))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) : excludeKeys.length > 0 ? /* @__PURE__ */ Cn.createElement("style", null, `${excludeKeys.map((f4) => `.metadata-property[data-property-key="${f4}"]`).join(", ")} { - display: none; + // display: none; }`) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); }; @@ -66156,13 +66909,13 @@ var InlineFileContextView = (props2) => { const getFileCache = (file2) => { if (!file2 || file2.path == "/") return null; - const cache = props2.plugin.index.filesIndex.get(file2.path); - if (!cache) { + const cache2 = props2.plugin.index.filesIndex.get(file2.path); + if (!cache2) { return props2.plugin.index.filesIndex.get( folderPathFromFolderNoteFile(props2.plugin.settings, tFileToAFile(file2)) ); } - return cache; + return cache2; }; const [fileCache, setFileCache] = h2( getFileCache(props2.file) @@ -66179,8 +66932,8 @@ var InlineFileContextView = (props2) => { const [collapsed, setCollapsed] = h2( !showHeader ? false : !props2.plugin.settings.inlineContextExpanded ); - const tags = (_b2 = fileCache == null ? void 0 : fileCache.tags) != null ? _b2 : []; - const [spaces, setSpaces] = h2( + const tags2 = (_b2 = fileCache == null ? void 0 : fileCache.tags) != null ? _b2 : []; + const [spaces2, setSpaces] = h2( spacesFromFileCache(fileCache, props2.plugin) ); const banner = fileCache == null ? void 0 : fileCache.banner; @@ -66202,7 +66955,7 @@ var InlineFileContextView = (props2) => { if (evt.detail.type == "file" && (evt.detail.name == (file == null ? void 0 : file.path) || evt.detail.name == ((_a3 = fileCache == null ? void 0 : fileCache.folderNote) == null ? void 0 : _a3.folderPath))) { refreshFile(); } - if (evt.detail.type == "space" && spaces.some((f4) => f4.path == evt.detail.name)) { + if (evt.detail.type == "space" && spaces2.some((f4) => f4.path == evt.detail.name)) { refreshFile(); } }; @@ -66237,7 +66990,7 @@ var InlineFileContextView = (props2) => { multi: false, editable: true, value: [], - options: f4.map((m5) => ({ name: m5, value: m5 })), + options: f4.map((m6) => ({ name: m6, value: m6 })), saveOptions: (_12, value) => addTag(value[0]), placeholder: i18n_default.labels.contextItemSelectPlaceholder, searchable: true, @@ -66292,7 +67045,7 @@ var InlineFileContextView = (props2) => { showNewPropertyMenu( props2.plugin, { x: offset2.left, y: offset2.top + 30 }, - tags, + tags2, [], saveField, "files", @@ -66380,7 +67133,7 @@ var InlineFileContextView = (props2) => { multi: false, editable: true, value: [], - options: f4.map((m5) => ({ name: m5, value: m5 })), + options: f4.map((m6) => ({ name: m6, value: m6 })), saveOptions: (_12, value) => addTag2(value[0]), placeholder: i18n_default.labels.contextItemSelectPlaceholder, searchable: true, @@ -66397,7 +67150,7 @@ var InlineFileContextView = (props2) => { }, props2.showBanner && banner && /* @__PURE__ */ Cn.createElement("div", { className: `mk-spacer`, style: { - "--header-height": ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!props2.plugin.settings.spacesStickers || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" + "--mk-header-height": ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!props2.plugin.settings.spacesStickers || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" }, onContextMenu: (e4) => e4.preventDefault() }), showHeader && /* @__PURE__ */ Cn.createElement("div", { @@ -66467,15 +67220,15 @@ var InlineFileContextView = (props2) => { path: fileCache.path, metadataPath: metadataFilePath, folder: folderPath, - tags, + tags: tags2, excludeKeys: (_c2 = props2.hiddenFields) != null ? _c2 : [], editable: props2.editable - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), spaces.map((space, i4) => /* @__PURE__ */ Cn.createElement(SpaceContextProvider, { - key: i4, + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), spaces2.map((space2, i5) => /* @__PURE__ */ Cn.createElement(SpaceContextProvider, { + key: i5, plugin: props2.plugin, - space + space: space2 }, /* @__PURE__ */ Cn.createElement(ContextMDBProvider, { - key: i4, + key: i5, plugin: props2.plugin, file: fileCache.path }, /* @__PURE__ */ Cn.createElement(ContextEditorProvider, { @@ -66667,7 +67420,6 @@ var SpaceBodyView = (props2) => { return; } if ((overParentNode == null ? void 0 : overParentNode.id) == (activeParentNode == null ? void 0 : activeParentNode.id)) { - console.group("same parent", overNode); if (overNode) moveToRank(activeNode.node, overNode.node.rank); } else { @@ -66705,10 +67457,10 @@ var SpaceBodyView = (props2) => { init_compat_module(); var TitleComponent = (props2) => { const fileNameRef = _2(null); - const name = pathDisplayName(props2.path); + const name2 = pathDisplayName(props2.path, props2.plugin); const onBlur = (e4) => { const newValue = e4.target.innerHTML; - if (newValue != name) { + if (newValue != name2) { renamePath(props2.plugin, props2.path, newValue); } }; @@ -66752,7 +67504,7 @@ var TitleComponent = (props2) => { onKeyPress, onKeyUp, dangerouslySetInnerHTML: { - __html: name + __html: name2 } }))); }; @@ -66844,11 +67596,9 @@ var SpaceComponent = (props2) => { }), (spaceCache == null ? void 0 : spaceCache.metadata.banner) && /* @__PURE__ */ Cn.createElement("div", { className: "mk-spacer", style: { - "--header-height": ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!props2.plugin.settings.spacesStickers || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" + "--mk-header-height": ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!props2.plugin.settings.spacesStickers || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" } - }), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-space-outer cm-line" - }, /* @__PURE__ */ Cn.createElement("div", { + }), /* @__PURE__ */ Cn.createElement(SpaceOuter, null, /* @__PURE__ */ Cn.createElement("div", { className: "mk-space-header" }, /* @__PURE__ */ Cn.createElement("div", { className: `mk-file-context-file ${props2.plugin.settings.inlineContextNameLayout == "horizontal" ? "mk-file-context-file-horizontal" : ""}` @@ -66877,6 +67627,75 @@ var SpaceComponent = (props2) => { plugin: props2.plugin })))))); }; +var SpaceOuter = (props2) => { + const { selectNodes, selectableNodeBounds, selectedNodes, nodes } = q2(FramesEditorContext); + const [selectionBox, setSelectionBox] = h2(); + const selectableItems = _2([]); + const ref2 = _2(null); + const [dragging, setDragging] = h2(false); + const onKeyDown = (e4) => { + if (e4.key === "Escape") { + selectNodes([]); + } + }; + p2(() => { + window.addEventListener("keydown", onKeyDown); + return () => { + window.removeEventListener("keydown", onKeyDown); + }; + }, []); + const { DragSelection } = v3({ + eventsElement: ref2.current, + onSelectionChange: (box) => { + const scroller = ref2.current.parentElement; + const scrollAwareBox = { + ...box, + top: box.top + scroller.scrollTop - 32, + left: box.left + scroller.scrollLeft + }; + setSelectionBox(scrollAwareBox); + const nodesToSelect = []; + Object.keys(selectableNodeBounds.current).forEach((item) => { + if (m3(scrollAwareBox, selectableNodeBounds.current[item])) { + nodesToSelect.push(item); + } + }); + selectNodes( + nodes.filter((f4) => nodesToSelect.some((g4) => g4 == f4.id)).sort((a6, b4) => a6.rank - b4.rank) + ); + }, + onSelectionStart: () => { + setDragging(true); + }, + onSelectionEnd: (e4) => { + setTimeout(function() { + setDragging(false); + }, 100); + }, + selectionProps: { + style: { + backgroundColor: "hsla(var(--color-accent-hsl), 0.1)", + border: "2px solid var(--color-accent)", + borderRadius: 2, + opacity: 0.5 + } + }, + isEnabled: true, + shouldStartSelecting: (target) => { + if (target instanceof HTMLElement && target.className.contains("mk-space-outer")) + return true; + return false; + } + }); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-space-outer cm-line", + ref: ref2, + onClick: () => { + if (!dragging) + selectNodes([]); + } + }, /* @__PURE__ */ Cn.createElement(DragSelection, null), props2.children); +}; // src/components/Space/Contexts/SpaceView.tsx var SPACE_VIEW_TYPE = "mk-space"; @@ -66891,7 +67710,7 @@ var SpaceView = class extends import_obsidian46.ItemView { return SPACE_VIEW_TYPE; } getDisplayText() { - return pathDisplayName(this.path); + return pathDisplayName(this.path, this.plugin); } async onClose() { this.destroy(); @@ -66908,7 +67727,7 @@ var SpaceView = class extends import_obsidian46.ItemView { if (!this.path) return; this.constructNote(this.path); - const displayName = pathDisplayName(this.path); + const displayName = pathDisplayName(this.path, this.plugin); await super.setState(state, result); this.leaf.tabHeaderInnerTitleEl.innerText = displayName; this.leaf.view.titleEl = displayName; @@ -66927,13 +67746,13 @@ var SpaceView = class extends import_obsidian46.ItemView { constructNote(path) { this.destroy(); this.root = createRoot(this.contentEl); - const space = spaceInfoByPath(this.plugin, path.fullPath); + const space2 = spaceInfoByPath(this.plugin, path.fullPath); this.root.render( /* @__PURE__ */ Cn.createElement("div", { className: "mk-space-view" - }, space && /* @__PURE__ */ Cn.createElement(SpaceContextProvider, { + }, space2 && /* @__PURE__ */ Cn.createElement(SpaceContextProvider, { plugin: this.plugin, - space + space: space2 }, /* @__PURE__ */ Cn.createElement(FramesMDBProvider, { plugin: this.plugin, schema: "main" @@ -66973,7 +67792,7 @@ var tFileToAFile = (file) => { }; var defaultNoteFolder = (plugin, activeFile) => { var _a2; - return (_a2 = plugin.settings.newFileLocation == "folder" ? getFolderFromPath(app, plugin.settings.newFileFolderPath) : plugin.settings.newFileLocation == "current" && activeFile ? getFolderFromPath(app, activeFile.path) : plugin.app.vault.getRoot()) != null ? _a2 : plugin.app.vault.getRoot(); + return (_a2 = plugin.settings.newFileLocation == "folder" ? getFolderFromPath(app, plugin.settings.newFileFolderPath) : plugin.settings.newFileLocation == "current" && activeFile && activeFile.type == "folder" ? getFolderFromPath(app, activeFile.path) : plugin.app.vault.getRoot()) != null ? _a2 : plugin.app.vault.getRoot(); }; var defaultConfigFile = async (app2) => { return await app2.vault.adapter.read( @@ -67014,8 +67833,8 @@ var appendFileMetaData = (propType, file) => { var moveFile = async (folder, file) => { await app.vault.rename(file, folder.path + "/" + file.name); }; -var uniqueFileName = (oldName, name, extension, folder) => { - let newName = sanitizeFileName(name); +var uniqueFileName = (oldName, name2, extension, folder) => { + let newName = sanitizeFileName(name2); let uniqueName = false; let append = 1; while (!uniqueName) { @@ -67028,8 +67847,8 @@ var uniqueFileName = (oldName, name, extension, folder) => { } return `${newName}.${extension}`; }; -var uniqueFolderName = (oldName, name, folder) => { - let newName = sanitizeFolderName(name); +var uniqueFolderName = (oldName, name2, folder) => { + let newName = sanitizeFolderName(name2); let uniqueName = false; let append = 1; while (!uniqueName) { @@ -67071,9 +67890,9 @@ var folderRenamed = async (plugin, oldPath, newPath) => { ); } }; -function getAllAbstractFilesInVault(plugin, app2) { +function getAllAbstractFilesInVault(plugin) { const files = []; - const rootFolder = app2.vault.getRoot(); + const rootFolder = plugin.app.vault.getRoot(); function recursiveFx(folder) { for (const child of folderChildren(plugin, folder)) { if (child instanceof import_obsidian47.TFolder) { @@ -67286,13 +68105,13 @@ var createNewCanvasFile = async (plugin, folder, newFileName, dontOpen) => { window.dispatchEvent(evt); return newFile; }; -var createNewMarkdownFile = async (plugin, folder, newFileName, content, dontOpen) => { +var createNewMarkdownFile = async (plugin, folder, newFileName, content2, dontOpen) => { const newFile = await app.fileManager.createNewMarkdownFile( folder, newFileName ); - if (content && content !== "") - await app.vault.modify(newFile, content); + if (content2 && content2 !== "") + await app.vault.modify(newFile, content2); if (dontOpen) { return newFile; } @@ -67396,10 +68215,10 @@ var spaceFolderForMDBPath = (path, plugin) => { } return parentPath; }; -var folderForSpace = (space, plugin) => getFolderPathFromString(plugin.settings.spacesFolder) + "/" + space; -var spacesFromFileCache = (cache, plugin) => { +var folderForSpace = (space2, plugin) => getFolderPathFromString(plugin.settings.spacesFolder) + "/" + space2; +var spacesFromFileCache = (cache2, plugin) => { var _a2; - return ((_a2 = cache == null ? void 0 : cache.spaces) != null ? _a2 : []).map((f4) => plugin.index.spacesIndex.get(f4)).filter((f4) => f4).map((f4) => f4.space); + return ((_a2 = cache2 == null ? void 0 : cache2.spaces) != null ? _a2 : []).map((f4) => plugin.index.spacesIndex.get(f4)).filter((f4) => f4).map((f4) => f4.space); }; // src/utils/contexts/contexts.ts @@ -67408,37 +68227,37 @@ var renamePath = async (plugin, path, newName) => { if (path.type == "tag") { await renameTag(plugin, path.space, newName); } else if (path.type == "space") { - const space = (_a2 = plugin.index.spacesIndex.get(path.fullPath)) == null ? void 0 : _a2.space; - if (space) { - const spaceName = uniqueFolderName(space.name, newName, getAbstractFileAtPath(app, plugin.settings.spacesFolder)); - if (space.name != spaceName) - await plugin.index.renameSpace(space.name, spaceName); + const space2 = (_a2 = plugin.index.spacesIndex.get(path.fullPath)) == null ? void 0 : _a2.space; + if (space2) { + const spaceName = uniqueFolderName(space2.name, newName, getAbstractFileAtPath(app, plugin.settings.spacesFolder)); + if (space2.name != spaceName) + await plugin.index.renameSpace(space2.name, spaceName); return spaceName; } } else if (path.type == "folder") { return await renameFile(plugin, getAbstractFileAtPath(app, path.path), newName); } }; -var contextEmbedStringFromContext = (space, schema) => { - if (space.uri.type == "folder") { - return `![![${space.path}/#^${schema}]]`; +var contextEmbedStringFromContext = (space2, schema) => { + if (space2.uri.type == "folder") { + return `![![${space2.path}/#^${schema}]]`; } - if (space.uri.type == "vault") { + if (space2.uri.type == "vault") { return `![![/#^${schema}]]`; } - return `![![${space.path}#^${schema}]]`; + return `![![${space2.path}#^${schema}]]`; }; -var spaceFromCustomSpace = (plugin, space, readOnly) => { - const path = spacePathFromName(space); - const folderPath = folderForSpace(space, plugin); +var spaceFromCustomSpace = (plugin, space2, readOnly) => { + const path = spacePathFromName(space2); + const folderPath = folderForSpace(space2, plugin); return { - name: space, + name: space2, uri: uriByString(path), path, folderPath, isRemote: false, readOnly, - defPath: `${folderPath}/${space}.md`, + defPath: `${folderPath}/${space2}.md`, dbPath: spaceFolderPathFromSpace(folderPath + "/", plugin) + plugin.settings.folderContextFile + ".mdb", framePath: spaceFolderPathFromSpace(folderPath + "/", plugin) + "views.mdb" }; @@ -67702,8 +68521,8 @@ var internalLinkHover = hoverTooltip((view, pos, side) => { const { from: lineFrom, to: lineTo } = view.state.doc.lineAt(pos); let hovObject = null; iterateTreeInSelection({ from: lineFrom, to: lineTo }, view.state, { - enter: ({ name, from, to }) => { - if (name.contains("hmd-internal-link") && pos <= to && pos >= from) { + enter: ({ name: name2, from, to }) => { + if (name2.contains("hmd-internal-link") && pos <= to && pos >= from) { const stateField = view.state.field(flowEditorInfo, false); const info = stateField.find((f4) => f4.to == to); if (info) { @@ -67760,17 +68579,17 @@ var flowEditorInfo = import_state6.StateField.define({ const existingLinks = previous.filter((f4) => f4.link == link); const offset2 = usedContainers.filter((f4) => f4 == link).length; const existingInfo = existingLinks[offset2]; - const id2 = existingInfo ? existingInfo.id : genId(); + const id3 = existingInfo ? existingInfo.id : genId(); usedContainers.push(link); const info = { - id: id2, + id: id3, link: match2[1], startOfLineFix: false, from: match2.index + 4, to: match2.index + 4 + match2[1].length, embed: 1, - height: existingInfo ? ((_a2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _a2[0]) == id2 && ((_b2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _b2[1]) != 0 ? (_c2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _c2[1] : existingInfo.height : -1, - expandedState: existingInfo ? ((_d2 = tr.annotation(toggleFlowEditor)) == null ? void 0 : _d2[0]) == id2 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 + height: existingInfo ? ((_a2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _a2[0]) == id3 && ((_b2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _b2[1]) != 0 ? (_c2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _c2[1] : existingInfo.height : -1, + expandedState: existingInfo ? ((_d2 = tr.annotation(toggleFlowEditor)) == null ? void 0 : _d2[0]) == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 }; newValues.push(info); } @@ -67780,17 +68599,17 @@ var flowEditorInfo = import_state6.StateField.define({ const existingLinks = previous.filter((f4) => f4.link == link); const offset2 = usedContainers.filter((f4) => f4 == link).length; const existingInfo = existingLinks[offset2]; - const id2 = existingInfo ? existingInfo.id : genId(); + const id3 = existingInfo ? existingInfo.id : genId(); usedContainers.push(link); const info = { - id: id2, + id: id3, link: match2[1], startOfLineFix: false, from: match2.index + 2, to: match2.index + 2 + match2[1].length, embed: 0, - height: existingInfo ? ((_e2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _e2[0]) == id2 && ((_f = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _f[1]) != 0 ? (_g = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _g[1] : existingInfo.height : -1, - expandedState: existingInfo ? ((_h = tr.annotation(toggleFlowEditor)) == null ? void 0 : _h[0]) == id2 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 0 + height: existingInfo ? ((_e2 = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _e2[0]) == id3 && ((_f = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _f[1]) != 0 ? (_g = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _g[1] : existingInfo.height : -1, + expandedState: existingInfo ? ((_h = tr.annotation(toggleFlowEditor)) == null ? void 0 : _h[0]) == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 0 }; newValues.push(info); } else if (str.charAt(match2.index - 2) != "!") { @@ -67798,17 +68617,17 @@ var flowEditorInfo = import_state6.StateField.define({ const existingLinks = previous.filter((f4) => f4.link == link); const offset2 = usedContainers.filter((f4) => f4 == link).length; const existingInfo = existingLinks[offset2]; - const id2 = existingInfo ? existingInfo.id : genId(); + const id3 = existingInfo ? existingInfo.id : genId(); usedContainers.push(link); const info = { - id: id2, + id: id3, link: match2[1], startOfLineFix: false, from: match2.index + 3, to: match2.index + 3 + match2[1].length, embed: 2, - height: existingInfo ? ((_i = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _i[0]) == id2 && ((_j = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _j[1]) != 0 ? (_k = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _k[1] : existingInfo.height : -1, - expandedState: existingInfo ? ((_l = tr.annotation(toggleFlowEditor)) == null ? void 0 : _l[0]) == id2 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 + height: existingInfo ? ((_i = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _i[0]) == id3 && ((_j = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _j[1]) != 0 ? (_k = tr.annotation(cacheFlowEditorHeight)) == null ? void 0 : _k[1] : existingInfo.height : -1, + expandedState: existingInfo ? ((_l = tr.annotation(toggleFlowEditor)) == null ? void 0 : _l[0]) == id3 ? reverseExpandedState(existingInfo.expandedState) : existingInfo.expandedState : 1 }; newValues.push(info); } @@ -67921,12 +68740,12 @@ var flowEditorWidgetDecoration = (info) => import_view4.Decoration.widget({ // src/cm-extensions/flowEditor/flowViewUpdates.ts var import_view5 = require("@codemirror/view"); -var flowViewUpdates = import_view5.EditorView.updateListener.of((v3) => { - if (v3.heightChanged) { +var flowViewUpdates = import_view5.EditorView.updateListener.of((v4) => { + if (v4.heightChanged) { app.workspace.iterateRootLeaves((leaf) => { var _a2, _b2; const cm = (_a2 = leaf.view.editor) == null ? void 0 : _a2.cm; - if (cm && v3.view.dom == cm.dom && cm.state.field(flowTypeStateField, false)) { + if (cm && v4.view.dom == cm.dom && cm.state.field(flowTypeStateField, false)) { if ((_b2 = leaf.containerEl.parentElement) == null ? void 0 : _b2.hasClass("workspace-tab-container")) { if (cm.state.field(flowTypeStateField, false) != "doc") { cm.dispatch({ @@ -67937,8 +68756,8 @@ var flowViewUpdates = import_view5.EditorView.updateListener.of((v3) => { } }); } - if (v3.heightChanged) { - const flowID = v3.state.field(flowIDStateField, false); + if (v4.heightChanged) { + const flowID = v4.state.field(flowIDStateField, false); if (flowID) { app.workspace.iterateLeaves((leaf) => { var _a2; @@ -67950,7 +68769,7 @@ var flowViewUpdates = import_view5.EditorView.updateListener.of((v3) => { cm.dispatch({ annotations: cacheFlowEditorHeight.of([ flowID, - v3.view.contentHeight + v4.view.contentHeight ]) }); } @@ -68053,15 +68872,15 @@ var rangeIsMark = (state, mark, selection) => posIsMark(selection.from, state, m var posIsMark = (pos, state, markString) => { let isMark = false; iterateTreeAtPos(pos, state, { - enter: ({ name, from, to }) => { - if (nodeNameContainsMark(name, markString)) + enter: ({ name: name2, from, to }) => { + if (nodeNameContainsMark(name2, markString)) isMark = true; } }); return isMark; }; -var nodeNameContainsMark = (name, markString) => { - return name.contains(markString); +var nodeNameContainsMark = (name2, markString) => { + return name2.contains(markString); }; var edgeIsMark = (pos, state, mark) => posIsMark(pos, state, mark.mark); var edgeIsMarkFormat = (pos, state, mark) => posIsMark(pos, state, mark.formatting) ? true : mark.altFormatting ? posIsMark(pos, state, mark.altFormatting) : false; @@ -68093,8 +68912,8 @@ var transactionChangesForMark = (range, mark, state) => { var removeAllInternalMarks = (sel, state, mark) => { const returnTrans = []; iterateTreeInSelection({ from: sel.from, to: sel.to }, state, { - enter: ({ name, from, to }) => { - if (nodeNameContainsMark(name, mark.formatting) || (mark.altFormatting ? nodeNameContainsMark(name, mark.altFormatting) : false)) + enter: ({ name: name2, from, to }) => { + if (nodeNameContainsMark(name2, mark.formatting) || (mark.altFormatting ? nodeNameContainsMark(name2, mark.altFormatting) : false)) returnTrans.push({ from, to: from + mark.formatChar.length @@ -68159,9 +68978,9 @@ init_compat_module(); // src/cm-extensions/inlineStylerView/Mark.tsx init_compat_module(); var Mark = (props2) => { - const { i: i4, style, active, toggleMarkAction } = props2; + const { i: i5, style, active, toggleMarkAction } = props2; return /* @__PURE__ */ Cn.createElement("div", { - key: i4, + key: i5, "aria-label": !platformIsMobile() ? i18n_default.styles[style.label] : void 0, className: `mk-mark ${style.mark && active ? "mk-mark-active" : ""}`, dangerouslySetInnerHTML: { __html: uiIconSet[style.icon] }, @@ -68253,15 +69072,15 @@ var InlineMenuComponent = (props2) => { } }); }; - const toggleMarkAction = (e4, s5) => { + const toggleMarkAction = (e4, s6) => { var _a2; e4.preventDefault(); const cm = (_a2 = props2.cm) != null ? _a2 : getActiveCM(); if (!cm) return; - if (s5.mark) { + if (s6.mark) { cm.dispatch({ - annotations: toggleMark.of(s5.mark) + annotations: toggleMark.of(s6.mark) }); return; } @@ -68271,14 +69090,14 @@ var InlineMenuComponent = (props2) => { changes: { from: selection.from, to: selection.to, - insert: s5.value.substring(0, s5.insertOffset) + selectedText + s5.value.substring(s5.insertOffset) + insert: s6.value.substring(0, s6.insertOffset) + selectedText + s6.value.substring(s6.insertOffset) }, - selection: s5.cursorOffset ? { - anchor: selection.from + s5.value.substring(0, s5.insertOffset).length + selectedText.length + s5.cursorOffset, - head: selection.from + s5.value.substring(0, s5.insertOffset).length + selectedText.length + s5.cursorOffset + selection: s6.cursorOffset ? { + anchor: selection.from + s6.value.substring(0, s6.insertOffset).length + selectedText.length + s6.cursorOffset, + head: selection.from + s6.value.substring(0, s6.insertOffset).length + selectedText.length + s6.cursorOffset } : { - anchor: selection.from + s5.value.substring(0, s5.insertOffset).length, - head: selection.from + s5.value.substring(0, s5.insertOffset).length + selectedText.length + anchor: selection.from + s6.value.substring(0, s6.insertOffset).length, + head: selection.from + s6.value.substring(0, s6.insertOffset).length + selectedText.length } }); }; @@ -68320,8 +69139,8 @@ var InlineMenuComponent = (props2) => { setMode(1); }, dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - }), colors.map((c4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, + }), colors.map((c4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, onMouseDown: () => { var _a2; setMode(1); @@ -68351,12 +69170,12 @@ var InlineMenuComponent = (props2) => { setMode(0); }, dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), resolveStyles().map((s5, i4) => { + }) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), resolveStyles().map((s6, i5) => { return /* @__PURE__ */ Cn.createElement(Mark, { - key: i4, - i: i4, - style: s5, - active: props2.activeMarks.find((f4) => f4 == s5.mark) ? true : false, + key: i5, + i: i5, + style: s6, + active: props2.activeMarks.find((f4) => f4 == s6.mark) ? true : false, toggleMarkAction }); }), props2.plugin.settings.inlineStylerColors ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { @@ -68679,7 +69498,7 @@ function resolveCommands(plugin) { icon: (_a2 = safelyParseJSON(f4.def)) == null ? void 0 : _a2.icon }; }); - return [...default_default2, ...allFrames]; + return [...default_default2]; } // src/components/Space/Editor/MakeMenu/MakeMenu.tsx @@ -68924,9 +69743,9 @@ var replaceMarkdownForReadingMode = (el, callback) => { var replaceAllEmbed = (el, ctx, plugin) => { replaceMarkdownForEmbeds(el, (dom) => { var nodes = dom.querySelectorAll(".markdown-embed-link"); - for (var i4 = 0; i4 < nodes.length; i4++) { - if (nodes[i4].parentNode === dom) { - dom.removeChild(nodes[i4]); + for (var i5 = 0; i5 < nodes.length; i5++) { + if (nodes[i5].parentNode === dom) { + dom.removeChild(nodes[i5]); const div = dom.createDiv("mk-floweditor-selector"); const reactEl = createRoot(div); const cm = getCMFromElement(dom); @@ -68984,12 +69803,12 @@ var SidebarProvider = (props2) => { const [waypointPaths, setWaypointPaths] = h2( props2.plugin.settings.waypoints ); - const [spaces, setSpaces] = h2( + const [spaces2, setSpaces] = h2( props2.plugin.index.allSpaces() ); const waypoints = F2( - () => waypointPaths.map((f4) => spaces.find((g4) => g4.path == f4)).filter((f4) => f4), - [spaces, waypointPaths] + () => waypointPaths.map((f4) => spaces2.find((g4) => g4.path == f4)).filter((f4) => f4), + [spaces2, waypointPaths] ); const queryResults = F2(() => { const paths = []; @@ -69001,9 +69820,9 @@ var SidebarProvider = (props2) => { return paths; }, [activeQuery]); const activeViewSpace = F2(() => { - const activeSpace = spaces.find((f4) => f4.path == activeViewSpacePath); + const activeSpace = spaces2.find((f4) => f4.path == activeViewSpacePath); return activeSpace; - }, [activeViewSpacePath, spaces]); + }, [activeViewSpacePath, spaces2]); p2(() => { settingsReloaded(); loadCachedSpaces(); @@ -69046,7 +69865,7 @@ var SidebarProvider = (props2) => { setActiveQuery, waypoints, setWaypoints, - spaces, + spaces: spaces2, setSpaces, saveActiveSpace: setActiveViewSpaceByPath, queryResults, @@ -69161,10 +69980,10 @@ function toFileWithPath(file, path) { return f4; } function withMimeType(file) { - var name = file.name; - var hasExtension = name && name.lastIndexOf(".") !== -1; + var name2 = file.name; + var hasExtension = name2 && name2.lastIndexOf(".") !== -1; if (hasExtension && !file.type) { - var ext = name.split(".").pop().toLowerCase(); + var ext = name2.split(".").pop().toLowerCase(); var type = COMMON_MIME_TYPES.get(ext); if (type) { Object.defineProperty(file, "type", { @@ -69205,8 +70024,8 @@ function isDataTransfer(value) { function isChangeEvt(value) { return isObject2(value) && isObject2(value.target); } -function isObject2(v3) { - return typeof v3 === "object" && v3 !== null; +function isObject2(v4) { + return typeof v4 === "object" && v4 !== null; } function getInputFiles(evt) { return fromList(evt.target.files).map(function(file) { @@ -69267,8 +70086,8 @@ function fromList(items) { return []; } var files = []; - for (var i4 = 0; i4 < items.length; i4++) { - var file = items[i4]; + for (var i5 = 0; i5 < items.length; i5++) { + var file = items[i5]; files.push(file); } return files; @@ -69390,9 +70209,9 @@ function ownKeys(object, enumerableOnly) { return keys2; } function _objectSpread(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = null != arguments[i4] ? arguments[i4] : {}; - i4 % 2 ? ownKeys(Object(source), true).forEach(function(key2) { + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = null != arguments[i5] ? arguments[i5] : {}; + i5 % 2 ? ownKeys(Object(source), true).forEach(function(key2) { _defineProperty2(target, key2, source[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); @@ -69408,8 +70227,8 @@ function _defineProperty2(obj, key2, value) { } return obj; } -function _slicedToArray(arr, i4) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i4) || _unsupportedIterableToArray(arr, i4) || _nonIterableRest(); +function _slicedToArray(arr, i5) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i5) || _unsupportedIterableToArray(arr, i5) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); @@ -69430,12 +70249,12 @@ function _unsupportedIterableToArray(o3, minLen) { function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; - for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) { - arr2[i4] = arr[i4]; + for (var i5 = 0, arr2 = new Array(len); i5 < len; i5++) { + arr2[i5] = arr[i5]; } return arr2; } -function _iterableToArrayLimit(arr, i4) { +function _iterableToArrayLimit(arr, i5) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; @@ -69446,7 +70265,7 @@ function _iterableToArrayLimit(arr, i4) { try { for (_i = _i.call(arr); !(_n2 = (_s = _i.next()).done); _n2 = true) { _arr.push(_s.value); - if (i4 && _arr.length === i4) + if (i5 && _arr.length === i5) break; } } catch (err) { @@ -69603,26 +70422,26 @@ function pickerOptionsFromAccept(accept) { } function acceptPropAsAcceptAttr(accept) { if (isDefined(accept)) { - return Object.entries(accept).reduce(function(a5, _ref6) { + return Object.entries(accept).reduce(function(a6, _ref6) { var _ref7 = _slicedToArray(_ref6, 2), mimeType = _ref7[0], ext = _ref7[1]; - return [].concat(_toConsumableArray(a5), [mimeType], _toConsumableArray(ext)); - }, []).filter(function(v3) { - return isMIMEType(v3) || isExt(v3); + return [].concat(_toConsumableArray(a6), [mimeType], _toConsumableArray(ext)); + }, []).filter(function(v4) { + return isMIMEType(v4) || isExt(v4); }).join(","); } return void 0; } -function isAbort(v3) { - return v3 instanceof DOMException && (v3.name === "AbortError" || v3.code === v3.ABORT_ERR); +function isAbort(v4) { + return v4 instanceof DOMException && (v4.name === "AbortError" || v4.code === v4.ABORT_ERR); } -function isSecurityError(v3) { - return v3 instanceof DOMException && (v3.name === "SecurityError" || v3.code === v3.SECURITY_ERR); +function isSecurityError(v4) { + return v4 instanceof DOMException && (v4.name === "SecurityError" || v4.code === v4.SECURITY_ERR); } -function isMIMEType(v3) { - return v3 === "audio/*" || v3 === "video/*" || v3 === "image/*" || v3 === "text/*" || /\w+\/[-+.\w]+/g.test(v3); +function isMIMEType(v4) { + return v4 === "audio/*" || v4 === "video/*" || v4 === "image/*" || v4 === "text/*" || /\w+\/[-+.\w]+/g.test(v4); } -function isExt(v3) { - return /^.*\.[\w]+$/.test(v3); +function isExt(v4) { + return /^.*\.[\w]+$/.test(v4); } // node_modules/react-dropzone/dist/es/index.js @@ -69644,8 +70463,8 @@ function _arrayWithoutHoles2(arr) { if (Array.isArray(arr)) return _arrayLikeToArray2(arr); } -function _slicedToArray2(arr, i4) { - return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i4) || _unsupportedIterableToArray2(arr, i4) || _nonIterableRest2(); +function _slicedToArray2(arr, i5) { + return _arrayWithHoles2(arr) || _iterableToArrayLimit2(arr, i5) || _unsupportedIterableToArray2(arr, i5) || _nonIterableRest2(); } function _nonIterableRest2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); @@ -69666,12 +70485,12 @@ function _unsupportedIterableToArray2(o3, minLen) { function _arrayLikeToArray2(arr, len) { if (len == null || len > arr.length) len = arr.length; - for (var i4 = 0, arr2 = new Array(len); i4 < len; i4++) { - arr2[i4] = arr[i4]; + for (var i5 = 0, arr2 = new Array(len); i5 < len; i5++) { + arr2[i5] = arr[i5]; } return arr2; } -function _iterableToArrayLimit2(arr, i4) { +function _iterableToArrayLimit2(arr, i5) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; @@ -69682,7 +70501,7 @@ function _iterableToArrayLimit2(arr, i4) { try { for (_i = _i.call(arr); !(_n2 = (_s = _i.next()).done); _n2 = true) { _arr.push(_s.value); - if (i4 && _arr.length === i4) + if (i5 && _arr.length === i5) break; } } catch (err) { @@ -69714,9 +70533,9 @@ function ownKeys2(object, enumerableOnly) { return keys2; } function _objectSpread2(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = null != arguments[i4] ? arguments[i4] : {}; - i4 % 2 ? ownKeys2(Object(source), true).forEach(function(key2) { + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = null != arguments[i5] ? arguments[i5] : {}; + i5 % 2 ? ownKeys2(Object(source), true).forEach(function(key2) { _defineProperty3(target, key2, source[key2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys2(Object(source)).forEach(function(key2) { Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); @@ -69736,11 +70555,11 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); - var key2, i4; + var key2, i5; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i4 = 0; i4 < sourceSymbolKeys.length; i4++) { - key2 = sourceSymbolKeys[i4]; + for (i5 = 0; i5 < sourceSymbolKeys.length; i5++) { + key2 = sourceSymbolKeys[i5]; if (excluded.indexOf(key2) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key2)) @@ -69755,9 +70574,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { return {}; var target = {}; var sourceKeys = Object.keys(source); - var key2, i4; - for (i4 = 0; i4 < sourceKeys.length; i4++) { - key2 = sourceKeys[i4]; + var key2, i5; + for (i5 = 0; i5 < sourceKeys.length; i5++) { + key2 = sourceKeys[i5]; if (excluded.indexOf(key2) >= 0) continue; target[key2] = source[key2]; @@ -70226,7 +71045,7 @@ var animateLayoutChanges2 = ({ wasDragging }) => isSorting || wasDragging ? false : true; var SortableTreeItem = ({ - id: id2, + id: id3, data: data2, depth, disabled, @@ -70247,7 +71066,7 @@ var SortableTreeItem = ({ transform, transition } = useSortable({ - id: id2, + id: id3, animateLayoutChanges: animateLayoutChanges2, disabled, data: data2 @@ -70446,8 +71265,8 @@ var TreeItem = k3( setHoverTarget(null); }; const newAction = (e4) => { - const space = data2.item; - newFileInSpace(plugin, space.space, space.space.uri); + const space2 = data2.item; + newFileInSpace(plugin, space2, space2.space.uri); }; const handleRightClick = (e4) => { if (data2.item.cacheType == "space") { @@ -70729,7 +71548,7 @@ var dropFilesInTree = async (plugin, paths, active, over, projected, flattenedTr return; } if (projected) { - const overIndex = flattenedTree.findIndex(({ id: id2 }) => id2 === over); + const overIndex = flattenedTree.findIndex(({ id: id3 }) => id3 === over); const overItem = flattenedTree[overIndex]; const dropTarget = overItem.type == "file" ? overItem.depth == 0 ? activeSpace : (_a2 = flattenedTree.find((f4) => f4.id == overItem.parentId)) == null ? void 0 : _a2.item : overItem.item; const dropableTypes = droppableTypesForSpace(dropTarget.type); @@ -70737,7 +71556,7 @@ var dropFilesInTree = async (plugin, paths, active, over, projected, flattenedTr (f4) => dropableTypes.some((g4) => g4 == f4.type) && !nodeIsAncestorOfTarget(f4, dropTarget.space.uri) ); const parentId = projected.insert ? over : projected.parentId; - const newSpace = (_b2 = flattenedTree.find(({ id: id2 }) => id2 === parentId)) == null ? void 0 : _b2.item; + const newSpace = (_b2 = flattenedTree.find(({ id: id3 }) => id3 === parentId)) == null ? void 0 : _b2.item; if (!newSpace) return; movePathsToSpace(plugin, droppable.map((f4) => f4.path), newSpace); @@ -70747,10 +71566,10 @@ var dropFileInTree = async (plugin, path, active, over, projected, flattenedTree var _a2, _b2, _c2, _d2; if (projected) { const clonedItems = flattenedTree; - const overIndex = clonedItems.findIndex(({ id: id2 }) => id2 === over); + const overIndex = clonedItems.findIndex(({ id: id3 }) => id3 === over); const overItem = clonedItems[overIndex]; const parentId = projected.insert ? over : projected.parentId; - const newSpace = projected.depth == 0 && !projected.insert ? activeSpace : (_a2 = clonedItems.find(({ id: id2 }) => id2 === parentId)) == null ? void 0 : _a2.item; + const newSpace = projected.depth == 0 && !projected.insert ? activeSpace : (_a2 = clonedItems.find(({ id: id3 }) => id3 === parentId)) == null ? void 0 : _a2.item; let newRank = parentId == overItem.id ? "-1" : (_c2 = (_b2 = overItem.item) == null ? void 0 : _b2.rank) != null ? _c2 : "-1"; if (!newSpace) return; @@ -70761,9 +71580,9 @@ var dropFileInTree = async (plugin, path, active, over, projected, flattenedTree movePathToSpace(plugin, path, null, newSpace, parseInt(newRank)); return; } - const activeIndex = clonedItems.findIndex(({ id: id2 }) => id2 === active); + const activeIndex = clonedItems.findIndex(({ id: id3 }) => id3 === active); const activeItem = clonedItems[activeIndex]; - const oldSpace = activeItem.parentId == activeSpace.path ? activeSpace : (_d2 = clonedItems.find(({ id: id2 }) => id2 === activeItem.parentId)) == null ? void 0 : _d2.item; + const oldSpace = activeItem.parentId == activeSpace.path ? activeSpace : (_d2 = clonedItems.find(({ id: id3 }) => id3 === activeItem.parentId)) == null ? void 0 : _d2.item; movePathToSpace(plugin, activeItem.item.path, oldSpace, newSpace, parseInt(newRank)); } }; @@ -70773,8 +71592,8 @@ init_compat_module(); init_compat_module(); function _extends10() { _extends10 = Object.assign || function(target) { - for (var i4 = 1; i4 < arguments.length; i4++) { - var source = arguments[i4]; + for (var i5 = 1; i5 < arguments.length; i5++) { + var source = arguments[i5]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -70790,9 +71609,9 @@ function _objectWithoutPropertiesLoose2(source, excluded) { return {}; var target = {}; var sourceKeys = Object.keys(source); - var key2, i4; - for (i4 = 0; i4 < sourceKeys.length; i4++) { - key2 = sourceKeys[i4]; + var key2, i5; + for (i5 = 0; i5 < sourceKeys.length; i5++) { + key2 = sourceKeys[i5]; if (excluded.indexOf(key2) >= 0) continue; target[key2] = source[key2]; @@ -70800,15 +71619,15 @@ function _objectWithoutPropertiesLoose2(source, excluded) { return target; } var props = ["bottom", "height", "left", "right", "top", "width"]; -var rectChanged = function rectChanged2(a5, b4) { - if (a5 === void 0) { - a5 = {}; +var rectChanged = function rectChanged2(a6, b4) { + if (a6 === void 0) { + a6 = {}; } if (b4 === void 0) { b4 = {}; } return props.some(function(prop) { - return a5[prop] !== b4[prop]; + return a6[prop] !== b4[prop]; }); }; var observedNodes = /* @__PURE__ */ new Map(); @@ -71015,8 +71834,8 @@ var useVirtual = function useVirtual2(_ref) { var virtualItems = F2(function() { var virtualItems2 = []; var _loop = function _loop2(k6, len2) { - var i4 = indexes[k6]; - var measurement = measurements[i4]; + var i5 = indexes[k6]; + var measurement = measurements[i5]; var item = _extends10({}, measurement, { measureRef: function measureRef(el) { if (el) { @@ -71026,7 +71845,7 @@ var useVirtual = function useVirtual2(_ref) { if (item.start < _scrollOffset) { defaultScrollToFn(_scrollOffset + (measuredSize - item.size)); } - pendingMeasuredCacheIndexesRef.current.push(i4); + pendingMeasuredCacheIndexesRef.current.push(i5); setMeasuredCache(function(old) { var _extends22; return _extends10({}, old, (_extends22 = {}, _extends22[item.key] = measuredSize, _extends22)); @@ -71280,7 +72099,7 @@ var FileExplorerComponent = (props2) => { setSelectedFiles, dragPaths, queryResults, - spaces, + spaces: spaces2, queryMode } = q2(SidebarContext); const [activeId, setActiveId] = h2(null); @@ -71292,9 +72111,9 @@ var FileExplorerComponent = (props2) => { const treeForPaths = (paths) => { const tree = []; paths.map((f4) => { - const s5 = uriByString(f4); + const s6 = uriByString(f4); const fileCache = props2.plugin.index.filesIndex.get(f4); - if (s5.type == "tag" || s5.type == "space" || s5.type == "folder" || s5.type == "vault") { + if (s6.type == "tag" || s6.type == "space" || s6.type == "folder" || s6.type == "vault") { if (fileCache) { return { ...props2.plugin.index.spacesIndex.get(f4) @@ -71309,8 +72128,8 @@ var FileExplorerComponent = (props2) => { var _a2; if (item.cacheType == "file") { item = item; - const id2 = item.filename; - const itemCollapsed = !expandedSpaces.includes(id2); + const id3 = item.filename; + const itemCollapsed = !expandedSpaces.includes(id3); const items = []; if (!itemCollapsed) { const [sortStrat, dir] = ((_a2 = item.sortBy) == null ? void 0 : _a2.length) > 0 ? parseSortStrat(item.sortBy) : ["rank", true]; @@ -71358,19 +72177,19 @@ var FileExplorerComponent = (props2) => { }); return tree; }; - const treeForSpace = (space, depth, parentId, activeId2, sortable, root2, parentPath) => { + const treeForSpace = (space2, depth, parentId, activeId2, sortable, root2, parentPath) => { var _a2, _b2, _c2; const tree = []; - const id2 = parentId ? parentId + "/" + space.path : space.path; - const spaceCollapsed = !expandedSpaces.includes(id2) || activeId2 == id2; - const spaceSort = (_b2 = safelyParseJSON((_a2 = space.metadata) == null ? void 0 : _a2.sort)) != null ? _b2 : [ - space.type == "smart" || space.type == "tag" ? "path" : "rank", + const id3 = parentId ? parentId + "/" + space2.path : space2.path; + const spaceCollapsed = !expandedSpaces.includes(id3) || activeId2 == id3; + const spaceSort = (_b2 = safelyParseJSON((_a2 = space2.metadata) == null ? void 0 : _a2.sort)) != null ? _b2 : [ + space2.type == "smart" || space2.type == "tag" ? "path" : "rank", true ]; if (!root2) tree.push( spaceToTreeNode( - space, + space2, spaceCollapsed, sortable, depth, @@ -71379,13 +72198,13 @@ var FileExplorerComponent = (props2) => { ) ); if (!spaceCollapsed || root2) - ((_c2 = plugin.index.getSpaceItems(space.path)) != null ? _c2 : []).sort(spaceSortFn(spaceSort[0], spaceSort[1])).forEach((item) => { + ((_c2 = plugin.index.getSpaceItems(space2.path)) != null ? _c2 : []).sort(spaceSortFn(spaceSort[0], spaceSort[1])).forEach((item) => { var _a3; - const _parentId = parentId ? parentId + "/" + space.path : space.path; + const _parentId = parentId ? parentId + "/" + space2.path : space2.path; if (item.cacheType == "file") { item = item; - const id3 = _parentId + "/" + item.filename; - const itemCollapsed = !expandedSpaces.includes(id3); + const id4 = _parentId + "/" + item.filename; + const itemCollapsed = !expandedSpaces.includes(id4); const items = []; if (!itemCollapsed) { const [sortStrat, dir] = ((_a3 = item.sortBy) == null ? void 0 : _a3.length) > 0 ? parseSortStrat(item.sortBy) : spaceSort; @@ -71393,7 +72212,7 @@ var FileExplorerComponent = (props2) => { ...flattenedTreeFromVaultItems( plugin, item.path, - space.path, + space2.path, expandedSpaces != null ? expandedSpaces : [], depth + 2, sortStrat, @@ -71406,12 +72225,12 @@ var FileExplorerComponent = (props2) => { 0, vaulItemToTreeNode( item, - space.path, + space2.path, item.path, depth + 1, 0, itemCollapsed, - space.sortable, + space2.sortable, items.length, _parentId ) @@ -71424,9 +72243,9 @@ var FileExplorerComponent = (props2) => { depth + 1, _parentId, activeId2, - space.sortable, + space2.sortable, false, - space.path + space2.path ) ); } @@ -71453,2285 +72272,5980 @@ var FileExplorerComponent = (props2) => { activeViewSpace.path ) ); - if (nextTreeScrollPath.current) { - const index = tree.findIndex( - (f4) => { - var _a2; - return ((_a2 = f4.item) == null ? void 0 : _a2.path) == nextTreeScrollPath.current; - } - ); - if (index != -1) { - listRef.current.scrollToIndex(index); - nextTreeScrollPath.current = null; - } - } - setFlattenedTree(tree); + if (nextTreeScrollPath.current) { + const index = tree.findIndex( + (f4) => { + var _a2; + return ((_a2 = f4.item) == null ? void 0 : _a2.path) == nextTreeScrollPath.current; + } + ); + if (index != -1) { + listRef.current.scrollToIndex(index); + nextTreeScrollPath.current = null; + } + } + setFlattenedTree(tree); + }; + p2(() => { + if (selectedFiles.length <= 1) { + if (!selectedFiles[0] || selectedFiles[0].item.path != (activeFile == null ? void 0 : activeFile.fullPath)) + setSelectedFiles([]); + if (plugin.settings.revealActiveFile) + revealFile(activeFile); + } + window.addEventListener(eventTypes.activePathChange, changeActiveFile); + return () => { + window.removeEventListener(eventTypes.activePathChange, changeActiveFile); + }; + }, [activeFile]); + p2(() => { + window.addEventListener(eventTypes.refreshView, forceUpdate); + window.addEventListener(eventTypes.settingsChanged, settingsChanged); + return () => { + window.removeEventListener(eventTypes.refreshView, forceUpdate); + window.removeEventListener(eventTypes.settingsChanged, settingsChanged); + }; + }, [activeViewSpace]); + p2(() => { + window.addEventListener(eventTypes.revealFile, handleRevealFileEvent); + return () => { + window.removeEventListener(eventTypes.revealFile, handleRevealFileEvent); + }; + }, [activeViewSpace]); + const revealFile = (path) => { + var _a2; + const space2 = spaces2.find((f4) => f4.path == "/"); + if (!space2 || !path || activeViewSpace.path != space2.path) + return; + const file = getAbstractFileAtPath(app, path.path); + const folders = file.path.split("/"); + const openPaths = folders.reduce( + (p3, c4, index) => [...p3, index == 0 ? c4 : `/${p3[index]}/${c4}`], + ["/"] + ).slice(0, -1); + const newOpenFolders = [ + ...(_a2 = expandedSpaces.filter((f4) => !openPaths.find((g4) => g4 == f4))) != null ? _a2 : [], + ...openPaths + ]; + plugin.settings.expandedSpaces = newOpenFolders; + nextTreeScrollPath.current = "/" + file.path; + plugin.saveSettings(); + }; + const handleRevealFileEvent = (evt) => { + if (evt.detail) + revealFile(uriByString(evt.detail.file.path)); + }; + p2(() => { + retrieveData(); + window.addEventListener(eventTypes.spacesChange, spaceChangeEvent); + return () => { + window.removeEventListener(eventTypes.spacesChange, spaceChangeEvent); + }; + }, [expandedSpaces, activeViewSpace, activeId, queryResults, queryMode]); + const spaceChangeEvent = (evt) => { + if (evt.detail.type == "vault" || evt.detail.type == "space") { + retrieveData(); + } + }; + const changeActiveFile = (evt) => { + const path = evt.detail.path; + setActiveFile(path); + }; + const settingsChanged = () => { + setExpandedSpaces(plugin.settings.expandedSpaces); + }; + const overIndex = F2( + () => flattenedTree.findIndex((f4) => f4.id == overId), + [overId, flattenedTree] + ); + const activeIndex = F2( + () => flattenedTree.findIndex((f4) => f4.id == activeId), + [activeId, flattenedTree] + ); + const [currentPosition, setCurrentPosition] = h2(null); + const sortedIds = F2( + () => flattenedTree.map(({ id: id3 }) => id3), + [flattenedTree] + ); + const selectRange2 = (fromId) => { + const startIndex = sortedIds.findIndex((f4) => f4 == fromId); + const selectedFilesStartIndex = sortedIds.findIndex( + (f4) => { + var _a2; + return f4 == ((_a2 = selectedFiles[0]) == null ? void 0 : _a2.id); + } + ); + const selectedFilesEndIndex = sortedIds.findIndex( + (f4) => { + var _a2; + return f4 == ((_a2 = selectedFiles[selectedFiles.length - 1]) == null ? void 0 : _a2.id); + } + ); + if (startIndex < selectedFilesStartIndex) { + setSelectedFiles( + flattenedTree.slice(startIndex, selectedFilesEndIndex + 1).filter((f4) => f4.item) + ); + } else { + setSelectedFiles( + flattenedTree.slice(selectedFilesStartIndex, startIndex + 1).filter((f4) => f4.item) + ); + } + }; + const [projected, setProjected] = h2(null); + p2(() => { + const dragDepth = getDragDepth(offset2.x, indentationWidth); + const _projected = overId ? getProjection(flattenedTree, dragPaths, overIndex, dragDepth, offset2.y) : null; + setProjected(_projected); + }, [flattenedTree, overId, overIndex, dragPaths, offset2]); + function handleDragStart(event) { + const { + active: { id: activeId2 } + } = event; + dragStarted(activeId2); + } + const dragStarted = (activeId2) => { + const activeItem = flattenedTree.find(({ id: id3 }) => id3 === activeId2); + setActiveId(activeId2); + setOverId(activeId2); + if (activeItem) { + setCurrentPosition({ + parentId: activeItem.parentId, + overId: activeId2 + }); + } + }; + function handleDragMove({ delta }) { + setOffset({ x: Math.max(1, delta.x), y: delta.y }); + } + function handleDragOver({ over }) { + const overId2 = over == null ? void 0 : over.id; + if (overId2) { + setOverId(overId2); + } + } + const dragOver = (_overId, position) => { + if (dragPaths.length > 1) { + if (_overId && _overId != overId) + setOverId(_overId); + return; + } + if (_overId && _overId != overId) + setOverId(_overId); + setOffset({ + x: Math.max(1, position.x - indentationWidth - 20), + y: position.y + }); + }; + function handleDragEnd({ active, over }) { + dropFilesInTree( + plugin, + dragPaths, + activeId, + over.id, + projected, + flattenedTree, + activeViewSpace + ); + resetState(); + } + const dragEnded = (overId2) => { + dropFilesInTree( + plugin, + dragPaths, + activeId, + overId2, + projected, + flattenedTree, + activeViewSpace + ); + resetState(); + }; + const adjustTranslate = ({ transform }) => { + return { + ...transform, + x: transform.x, + y: transform.y - 10 + }; + }; + function handleDragCancel() { + resetState(); + } + const handleCollapse = T2( + (folder, open) => { + const folderOpen = expandedSpaces == null ? void 0 : expandedSpaces.includes(folder.id); + const newOpenFolders = !folderOpen || open ? [...expandedSpaces, folder.id] : expandedSpaces.filter( + (openFolder) => folder.id !== openFolder + ); + plugin.settings.expandedSpaces = newOpenFolders; + plugin.saveSettings(); + }, + [plugin, expandedSpaces] + ); + function resetState() { + setOverId(null); + setActiveId(null); + setOffset({ x: 0, y: 0 }); + setProjected(null); + dragCounter.current = 0; + document.body.style.setProperty("cursor", ""); + } + useDndMonitor({ + onDragStart: handleDragStart, + onDragMove: handleDragMove, + onDragOver: handleDragOver, + onDragEnd: handleDragEnd, + onDragCancel: handleDragCancel + }); + const dragCounter = _2(0); + const dragEnter = () => { + dragCounter.current++; + }; + const dragLeave = () => { + dragCounter.current--; + if (dragCounter.current == 0) { + setOverId(null); + setOffset({ x: 0, y: 0 }); + setProjected(null); + dragCounter.current = 0; + } + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-tree", + onDragEnter: () => dragEnter(), + onDragLeave: () => dragLeave(), + onDragOver: (e4) => e4.preventDefault(), + onDrop: (e4) => { + if (overId) { + dragEnded(overId); + } else { + resetState(); + } + } + }, /* @__PURE__ */ Cn.createElement(SortableContext, { + items: flattenedTree, + strategy: verticalListSortingStrategy + }, /* @__PURE__ */ Cn.createElement(VirtualizedList, { + vRef: listRef, + flattenedTree, + projected, + handleCollapse, + activeFile, + plugin, + selectedFiles, + selectRange: selectRange2, + indentationWidth, + dragStarted, + dragOver, + dragEnded, + overIndex, + activeIndex + }), z3( + /* @__PURE__ */ Cn.createElement(DragOverlay, { + dropAnimation: null, + modifiers: [adjustTranslate], + zIndex: 1600 + }, activeId ? /* @__PURE__ */ Cn.createElement(SortableTreeItem, { + id: activeId, + data: flattenedTree.find((f4) => f4.id == activeId), + indicator: null, + depth: 0, + disabled: false, + plugin, + selected: false, + highlighted: false, + active: false, + clone: true, + childCount: 0, + style: {}, + indentationWidth, + dragStarted, + dragOver, + dragEnded, + dragActive: false + }) : null), + document.body + ))); +}; + +// src/components/Sidebar/MainList.tsx +init_hooks_module(); +init_compat_module(); + +// src/components/Sidebar/MainMenu.tsx +var import_classnames7 = __toESM(require_classnames()); + +// src/components/ui/modals/hiddenFilesModal.tsx +var import_obsidian53 = require("obsidian"); +init_compat_module(); +var HiddenItemsModal = class extends import_obsidian53.Modal { + constructor(plugin) { + super(plugin.app); + this.plugin = plugin; + } + onOpen() { + const { contentEl } = this; + const myModal = this; + let headerText; + const headerEl = contentEl.createEl("div", { text: headerText }); + headerEl.addClass("modal-title"); + headerEl.innerHTML = i18n_default.labels.hiddenFiles; + const listEl = contentEl.createEl("div"); + const root2 = createRoot(listEl); + root2.render(/* @__PURE__ */ Cn.createElement(HiddenFiles, { + plugin: this.plugin + })); + const cancelButton = contentEl.createEl("button", { + text: i18n_default.buttons.cancel + }); + cancelButton.style.cssText = "float: right;"; + cancelButton.addEventListener("click", () => { + myModal.close(); + }); + const onClickAction = async () => { + myModal.close(); + }; + } + onClose() { + const { contentEl } = this; + contentEl.empty(); + } +}; +var HiddenFiles = (props2) => { + const { plugin } = props2; + const ref2 = _2(null); + const [hiddenFiles, setHiddenFiles] = h2(plugin.settings.hiddenFiles); + const [hiddenExtensions, setHiddenExtensions] = h2( + plugin.settings.hiddenExtensions + ); + const saveExtension = (value) => { + plugin.settings.hiddenExtensions = [ + ...plugin.settings.hiddenExtensions, + value + ]; + plugin.saveSettings(); + }; + const saveFile = (_12, value) => { + plugin.settings.hiddenFiles = [...plugin.settings.hiddenFiles, ...value]; + plugin.saveSettings(); + }; + const removeExtension = (index) => { + plugin.settings.hiddenExtensions = plugin.settings.hiddenExtensions.filter( + (f4, i5) => i5 != index + ); + plugin.saveSettings(); + }; + const removeItem = (index) => { + plugin.settings.hiddenFiles = plugin.settings.hiddenFiles.filter( + (f4, i5) => i5 != index + ); + plugin.saveSettings(); }; - p2(() => { - if (selectedFiles.length <= 1) { - if (!selectedFiles[0] || selectedFiles[0].item.path != (activeFile == null ? void 0 : activeFile.fullPath)) - setSelectedFiles([]); - if (plugin.settings.revealActiveFile) - revealFile(activeFile); + const addExtension = () => { + if ((ref2 == null ? void 0 : ref2.current.value.length) > 0) { + saveExtension(ref2.current.value); + ref2.current.empty(); } - window.addEventListener(eventTypes.activePathChange, changeActiveFile); - return () => { - window.removeEventListener(eventTypes.activePathChange, changeActiveFile); - }; - }, [activeFile]); + }; + const settingsChanged = () => { + setHiddenFiles(plugin.settings.hiddenFiles); + setHiddenExtensions(plugin.settings.hiddenExtensions); + }; p2(() => { - window.addEventListener(eventTypes.refreshView, forceUpdate); window.addEventListener(eventTypes.settingsChanged, settingsChanged); return () => { - window.removeEventListener(eventTypes.refreshView, forceUpdate); window.removeEventListener(eventTypes.settingsChanged, settingsChanged); }; - }, [activeViewSpace]); - p2(() => { - window.addEventListener(eventTypes.revealFile, handleRevealFileEvent); - return () => { - window.removeEventListener(eventTypes.revealFile, handleRevealFileEvent); - }; - }, [activeViewSpace]); - const revealFile = (path) => { - var _a2; - const space = spaces.find((f4) => f4.path == "/"); - if (!space || !path || activeViewSpace.path != space.path) - return; - const file = getAbstractFileAtPath(app, path.path); - const folders = file.path.split("/"); - const openPaths = folders.reduce( - (p3, c4, index) => [...p3, index == 0 ? c4 : `/${p3[index]}/${c4}`], - ["/"] - ).slice(0, -1); - const newOpenFolders = [ - ...(_a2 = expandedSpaces.filter((f4) => !openPaths.find((g4) => g4 == f4))) != null ? _a2 : [], - ...openPaths - ]; - plugin.settings.expandedSpaces = newOpenFolders; - nextTreeScrollPath.current = "/" + file.path; - plugin.saveSettings(); - }; - const handleRevealFileEvent = (evt) => { - if (evt.detail) - revealFile(uriByString(evt.detail.file.path)); + }, []); + const addMenu = (e4) => { + const offset2 = e4.target.getBoundingClientRect(); + const options = getAllAbstractFilesInVault(props2.plugin).map((f4) => ({ + name: fileNameToString(f4.name), + value: f4.path + })); + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: false, + editable: false, + value: [], + options, + saveOptions: saveFile, + placeholder: i18n_default.labels.linkItemSelectPlaceholder, + detail: true, + searchable: true + } + ); }; - p2(() => { - retrieveData(); - window.addEventListener(eventTypes.spacesChange, spaceChangeEvent); - return () => { - window.removeEventListener(eventTypes.spacesChange, spaceChangeEvent); + return /* @__PURE__ */ Cn.createElement("div", { + className: "modal-content" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item setting-item-heading" + }, "Extensions"), /* @__PURE__ */ Cn.createElement("div", null, hiddenExtensions.map((f4, index) => /* @__PURE__ */ Cn.createElement("div", { + key: index, + className: "mobile-option-setting-item" + }, /* @__PURE__ */ Cn.createElement("span", { + className: "mobile-option-setting-item-name" + }, f4), /* @__PURE__ */ Cn.createElement("div", { + className: "clickable-icon mobile-option-setting-item-option-icon", + "aria-label": i18n_default.buttons.delete, + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] }, + onClick: () => removeExtension(index) + })))), /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item" + }, /* @__PURE__ */ Cn.createElement("input", { + placeholder: i18n_default.labels.addExtension, + type: "text", + ref: ref2 + }), /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => addExtension() + }, "+ Add")), /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item setting-item-heading" + }, "Files"), /* @__PURE__ */ Cn.createElement("div", null, hiddenFiles.map((f4, index) => /* @__PURE__ */ Cn.createElement("div", { + key: index, + className: "mobile-option-setting-item" + }, /* @__PURE__ */ Cn.createElement("span", { + className: "mobile-option-setting-item-name" + }, f4), /* @__PURE__ */ Cn.createElement("div", { + className: "clickable-icon mobile-option-setting-item-option-icon", + "aria-label": i18n_default.buttons.delete, + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] }, + onClick: () => removeItem(index) + })))), /* @__PURE__ */ Cn.createElement("div", { + className: "setting-item" + }, /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => addMenu(e4) + }, "+ ", i18n_default.buttons.addFile))); +}; + +// src/components/Sidebar/MainMenu.tsx +var import_obsidian56 = require("obsidian"); +init_compat_module(); + +// src/components/Space/Contexts/ContextBuilder/BuilderMetadataFields.tsx +var import_obsidian54 = require("obsidian"); +init_compat_module(); +var allMetadataForFiles = (plugin, files) => { + return files.reduce((p3, c4) => { + const fm = frontMatterForFile(c4); + const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)); + if (plugin.dataViewAPI()) { + const dvValues = plugin.dataViewAPI().page(c4.path); + const dvKeys = uniqCaseInsensitive( + Object.keys(dvValues != null ? dvValues : {}).filter( + (f4, i5, self2) => !self2.find( + (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i5 > j4 + ) ? true : false + ).filter((f4) => f4 != "file" && !fmKeys.some((g4) => f4 == g4)) + ); + return [ + ...p3, + ...fmKeys.map((f4) => ({ name: f4, type: "fm" })), + ...dvKeys.map((f4) => ({ name: f4, type: "dv" })) + ].filter(metadatTypeFilterPredicate); + } + return [ + ...p3, + ...fmKeys.map((f4) => ({ name: f4, type: "fm" })) + ].filter(metadatTypeFilterPredicate); + }, []); +}; +var metadatTypeFilterPredicate = (value, index, self2) => { + return self2.findIndex( + (v4) => value["type"] == v4["type"] && value["name"] == v4["name"] + ) === index; +}; + +// src/components/Sidebar/SpaceQuery.tsx +var import_obsidian55 = require("obsidian"); +init_compat_module(); + +// src/types/metadata.ts +var fileProps = { + "name": { + label: "File Name", + field: "name", + vType: "text", + type: "fileprop" + }, + "path": { + label: "Path", + field: "path", + vType: "text", + type: "fileprop" + }, + "parent": { + label: "Folder", + field: "parent", + vType: "text", + type: "fileprop" + }, + "sticker": { + label: "Sticker", + field: "sticker", + vType: "text", + type: "fileprop" + }, + "color": { + label: "Color", + field: "color", + vType: "text", + type: "fileprop" + }, + "ctime": { + label: "Created", + field: "ctime", + vType: "date", + type: "fileprop" + }, + "mtime": { + label: "Last Modified", + field: "mtime", + vType: "date", + type: "fileprop" + }, + "extension": { + label: "Extension", + field: "extension", + vType: "text", + type: "fileprop" + }, + "size": { + label: "Size", + field: "size", + vType: "number", + type: "fileprop" + } +}; +var fileMeta = { + "tags": { + label: "Tags", + field: "tags", + vType: "tags-multi", + type: "filemeta" + }, + "inlinks": { + label: "Linked Mentions", + field: "inlinks", + vType: "link-multi", + type: "filemeta" + }, + "outlinks": { + label: "Links", + field: "outlinks", + vType: "link-multi", + type: "filemeta" + } +}; + +// src/components/Sidebar/SpaceQuery.tsx +var SpaceQuery = (props2) => { + const { filters, setFilters } = props2; + const selectFilterValue = (e4, filter, i5, k5) => { + var _a2; + const saveFilterValue = (value) => { + setDefFilterValue(value, i5, k5); }; - }, [expandedSpaces, activeViewSpace, activeId, queryResults, queryMode]); - const spaceChangeEvent = (evt) => { - if (evt.detail.type == "vault" || evt.detail.type == "space") { - retrieveData(); + switch ((_a2 = filterFnTypes[filter.fn]) == null ? void 0 : _a2.valueType) { + case "text": + case "number": + { + const menu = new import_obsidian55.Menu(); + menu.setUseNativeMenu(false); + menu.addItem((menuItem) => { + inputMenuItem( + menuItem, + filter.value, + (value) => saveFilterValue(value) + ); + menuItem.setIcon("type"); + }); + const offset2 = e4.target.getBoundingClientRect(); + menu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); + } + break; + case "date": { + const saveValue = (date2) => { + saveFilterValue(date2.valueOf().toString()); + }; + const offset2 = e4.target.getBoundingClientRect(); + const date = new Date(filter.value); + showDatePickerMenu( + { x: offset2.left, y: offset2.top + 30 }, + date.getTime() ? date : null, + saveValue + ); + break; + } + case "list": + { + const fieldType = filter.fType; + const saveOptions = (options2, values) => { + saveFilterValue(serializeMultiString(values)); + }; + let options = []; + if (fieldType.startsWith("option")) { + options = parseMultiString(filter.value).map((f4) => ({ + name: f4, + value: f4 + })); + } else if (fieldType.startsWith("tags")) { + options = loadTags(props2.plugin).map((f4) => ({ + value: f4, + name: f4 + })); + } else if (fieldType.startsWith("links")) { + options = getAllAbstractFilesInVault(props2.plugin).map((f4) => ({ + name: fileNameToString(f4.name), + value: f4.path, + description: f4.path + })); + } + const offset2 = e4.target.getBoundingClientRect(); + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: true, + editable: true, + value: parseMultiString(filter.value), + options, + saveOptions, + placeholder: i18n_default.labels.optionItemSelectPlaceholder, + searchable: false, + showAll: true + } + ); + } + break; } }; - const changeActiveFile = (evt) => { - const path = evt.detail.path; - setActiveFile(path); + const addDefGroup = () => { + setFilters((p3) => [ + ...p3, + { + type: "any", + trueFalse: true, + filters: [] + } + ]); }; - const settingsChanged = () => { - setExpandedSpaces(plugin.settings.expandedSpaces); + const removeDefGroup = (groupIndex) => { + setFilters(filters.filter((f4, i5) => i5 == groupIndex ? false : true)); }; - const overIndex = F2( - () => flattenedTree.findIndex((f4) => f4.id == overId), - [overId, flattenedTree] - ); - const activeIndex = F2( - () => flattenedTree.findIndex((f4) => f4.id == activeId), - [activeId, flattenedTree] - ); - const [currentPosition, setCurrentPosition] = h2(null); - const sortedIds = F2( - () => flattenedTree.map(({ id: id2 }) => id2), - [flattenedTree] - ); - const selectRange2 = (fromId) => { - const startIndex = sortedIds.findIndex((f4) => f4 == fromId); - const selectedFilesStartIndex = sortedIds.findIndex( - (f4) => { - var _a2; - return f4 == ((_a2 = selectedFiles[0]) == null ? void 0 : _a2.id); - } - ); - const selectedFilesEndIndex = sortedIds.findIndex( - (f4) => { - var _a2; - return f4 == ((_a2 = selectedFiles[selectedFiles.length - 1]) == null ? void 0 : _a2.id); - } - ); - if (startIndex < selectedFilesStartIndex) { - setSelectedFiles( - flattenedTree.slice(startIndex, selectedFilesEndIndex + 1).filter((f4) => f4.item) - ); - } else { - setSelectedFiles( - flattenedTree.slice(selectedFilesStartIndex, startIndex + 1).filter((f4) => f4.item) - ); + const typeForField = (type, field) => { + if (type == "frontmatter") { + return "text"; } - }; - const [projected, setProjected] = h2(null); - p2(() => { - const dragDepth = getDragDepth(offset2.x, indentationWidth); - const _projected = overId ? getProjection(flattenedTree, dragPaths, overIndex, dragDepth, offset2.y) : null; - setProjected(_projected); - }, [flattenedTree, overId, overIndex, dragPaths, offset2]); - function handleDragStart(event) { - const { - active: { id: activeId2 } - } = event; - dragStarted(activeId2); - } - const dragStarted = (activeId2) => { - const activeItem = flattenedTree.find(({ id: id2 }) => id2 === activeId2); - setActiveId(activeId2); - setOverId(activeId2); - if (activeItem) { - setCurrentPosition({ - parentId: activeItem.parentId, - overId: activeId2 - }); + if (type == "filemeta") { + return fileMeta[field].vType; + } + if (type == "fileprop") { + return fileProps[field].vType; } + return "text"; }; - function handleDragMove({ delta }) { - setOffset({ x: Math.max(1, delta.x), y: delta.y }); - } - function handleDragOver({ over }) { - const overId2 = over == null ? void 0 : over.id; - if (overId2) { - setOverId(overId2); + const setDefFilter = (filter, groupIndex, filterIndex) => { + var _a2; + let field; + let fType; + const filterTuple = filter.split("."); + const type = filterTuple[0]; + if (type == "frontmatter") { + fType = filterTuple[1]; + field = filterTuple[2]; + } else { + field = filterTuple[1]; + fType = typeForField(type, field); } - } - const dragOver = (_overId, position) => { - if (dragPaths.length > 1) { - if (_overId && _overId != overId) - setOverId(_overId); + if (filters.length == 0) { + setFilters([ + { + type: "any", + trueFalse: true, + filters: [ + { + type, + field, + fType, + fn: "", + value: "" + } + ] + } + ]); return; } - if (_overId && _overId != overId) - setOverId(_overId); - setOffset({ - x: Math.max(1, position.x - indentationWidth - 20), - y: position.y - }); + if (((_a2 = filters[groupIndex]) == null ? void 0 : _a2.filters.length) == 0) { + setFilters( + filters.map( + (f4, i5) => i5 == groupIndex ? { + ...f4, + filters: [ + { + type, + field, + fType, + fn: "", + value: "" + } + ] + } : f4 + ) + ); + return; + } + setFilters( + filters.map( + (f4, i5) => { + var _a3; + return i5 == groupIndex ? { + ...f4, + filters: !f4.filters || filterIndex == f4.filters.length ? [ + ...(_a3 = f4.filters) != null ? _a3 : [], + { + type, + fType, + field, + fn: "", + value: "" + } + ] : f4.filters.map( + (g4, k5) => k5 == filterIndex ? { + ...g4, + type, + fType, + field + } : g4 + ) + } : f4; + } + ) + ); }; - function handleDragEnd({ active, over }) { - dropFilesInTree( - plugin, - dragPaths, - activeId, - over.id, - projected, - flattenedTree, - activeViewSpace + const setDefFilterFn = (fn2, groupIndex, filterIndex) => { + setFilters( + filters.map( + (f4, i5) => i5 == groupIndex ? { + ...f4, + filters: f4.filters.map( + (g4, k5) => k5 == filterIndex ? { + ...g4, + fn: fn2 + } : g4 + ) + } : f4 + ) ); - resetState(); - } - const dragEnded = (overId2) => { - dropFilesInTree( - plugin, - dragPaths, - activeId, - overId2, - projected, - flattenedTree, - activeViewSpace + }; + const setDefFilterValue = (value, groupIndex, filterIndex) => { + setFilters( + filters.map( + (f4, i5) => i5 == groupIndex ? { + ...f4, + filters: f4.filters.map( + (g4, k5) => k5 == filterIndex ? { + ...g4, + value + } : g4 + ) + } : f4 + ) ); - resetState(); }; - const adjustTranslate = ({ transform }) => { - return { - ...transform, - x: transform.x, - y: transform.y - 10 - }; + const removeDefFilter = (filterIndex, groupIndex) => { + setFilters( + filters.map( + (f4, i5) => i5 == groupIndex ? { + ...f4, + filters: f4.filters.filter( + (g4, k5) => k5 == filterIndex ? false : true + ) + } : f4 + ) + ); }; - function handleDragCancel() { - resetState(); - } - const handleCollapse = T2( - (folder, open) => { - const folderOpen = expandedSpaces == null ? void 0 : expandedSpaces.includes(folder.id); - const newOpenFolders = !folderOpen || open ? [...expandedSpaces, folder.id] : expandedSpaces.filter( - (openFolder) => folder.id !== openFolder + const setGroupType = (groupIndex, type) => { + if (groupIndex == 0 && filters.length == 0) { + setFilters([ + { + type, + trueFalse: true, + filters: [] + } + ]); + } else { + setFilters( + filters.map( + (f4, i5) => i5 == groupIndex ? { + ...f4, + type + } : f4 + ) ); - plugin.settings.expandedSpaces = newOpenFolders; - plugin.saveSettings(); - }, - [plugin, expandedSpaces] - ); - function resetState() { - setOverId(null); - setActiveId(null); - setOffset({ x: 0, y: 0 }); - setProjected(null); - dragCounter.current = 0; - document.body.style.setProperty("cursor", ""); - } - useDndMonitor({ - onDragStart: handleDragStart, - onDragMove: handleDragMove, - onDragOver: handleDragOver, - onDragEnd: handleDragEnd, - onDragCancel: handleDragCancel - }); - const dragCounter = _2(0); - const dragEnter = () => { - dragCounter.current++; - }; - const dragLeave = () => { - dragCounter.current--; - if (dragCounter.current == 0) { - setOverId(null); - setOffset({ x: 0, y: 0 }); - setProjected(null); - dragCounter.current = 0; } }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-file-tree", - onDragEnter: () => dragEnter(), - onDragLeave: () => dragLeave(), - onDragOver: (e4) => e4.preventDefault(), - onDrop: (e4) => { - if (overId) { - dragEnded(overId); - } else { - resetState(); + const selectGroupType = (e4, i5) => { + const offset2 = e4.target.getBoundingClientRect(); + const filters2 = ["any", "all"]; + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: false, + editable: false, + value: [], + options: filters2.map((f4) => ({ name: f4, value: f4 })), + saveOptions: (_12, value) => setGroupType(i5, value[0]), + searchable: false, + showAll: true + } + ); + }; + const selectFilter = (e4, i5, k5) => { + const offset2 = e4.target.getBoundingClientRect(); + const { type, field, fType } = filters[i5].filters[k5]; + const _filters = predicateFnsForType(fType, filterFnTypes); + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: false, + editable: true, + value: [], + options: _filters.map((f4) => ({ name: filterFnLabels[f4], value: f4 })), + saveOptions: (_12, value) => setDefFilterFn(value[0], i5, k5), + placeholder: i18n_default.labels.contextItemSelectPlaceholder, + searchable: true, + showAll: true + } + ); + }; + const selectField = (e4, i5, k5) => { + const offset2 = e4.target.getBoundingClientRect(); + const allFiles = retrieveAllFiles( + props2.plugin.index.vaultDBCache, + props2.plugin.settings + ); + const frontmatter = allMetadataForFiles( + props2.plugin, + allFiles.map((f5) => getAbstractFileAtPath(app, f5.path)).filter((f5) => f5 instanceof import_obsidian55.TFile) + ); + const fmTypes = guestimateTypes( + allFiles.map((f5) => f5.path), + props2.plugin, + false + ); + const f4 = [ + ...Object.keys(fileMeta).map((f5) => ({ + name: fileMeta[f5].label, + value: "filemeta." + f5 + })), + ...Object.keys(fileProps).map((f5) => ({ + name: fileProps[f5].label, + value: "fileprop." + f5 + })), + ...frontmatter.map((f5) => ({ + name: f5.name, + value: "frontmatter." + fmTypes[f5.name] + "." + f5.name + })) + ]; + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: false, + editable: false, + value: [], + options: f4, + saveOptions: (_12, value) => setDefFilter(value[0], i5, k5), + placeholder: i18n_default.labels.contextItemSelectPlaceholder, + searchable: true, + showAll: true } + ); + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-query" + }, filters.length == 0 ? /* @__PURE__ */ Cn.createElement(DefFilterGroup, { + selectGroupType, + group: null, + addDefGroup, + selectField, + i: 0, + removeDefGroup + }) : filters.map((f4, i5) => /* @__PURE__ */ Cn.createElement(DefFilterGroup, { + key: i5, + group: f4, + selectGroupType, + addDefGroup, + selectField, + i: i5, + removeDefGroup + }, f4.filters.map((filter, k5) => /* @__PURE__ */ Cn.createElement(DefFilter, { + key: k5, + filter, + i: i5, + k: k5, + selectField, + selectFilter, + selectFilterValue, + removeDefFilter + }))))); +}; +var DefFilter = (props2) => { + var _a2; + const { + filter, + selectField, + selectFilter, + selectFilterValue, + removeDefFilter, + i: i5, + k: k5 + } = props2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter" + }, /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectField(e4, i5, k5) + }, filter.field.length == 0 ? "Select" : filter.field), filter.field.length > 0 && /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectFilter(e4, i5, k5) + }, !filterFnLabels[filter.fn] ? "Select" : filterFnLabels[filter.fn]), filter.field.length > 0 && filterFnLabels[filter.fn] && ((_a2 = filterFnTypes[filter.fn]) == null ? void 0 : _a2.valueType) != "none" && /* @__PURE__ */ Cn.createElement("span", null, /* @__PURE__ */ Cn.createElement(FilterValueSpan, { + fieldType: filter.fType, + filter, + selectFilterValue: (e4, h5) => selectFilterValue(e4, h5, i5, k5) + })), /* @__PURE__ */ Cn.createElement("span", { + onClick: () => removeDefFilter(k5, i5) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + }))); +}; +var DefFilterGroup = (props2) => { + var _a2; + const { + group, + selectGroupType, + addDefGroup, + selectField, + i: i5, + removeDefGroup + } = props2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-query-group" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-query-group-type" + }, /* @__PURE__ */ Cn.createElement("span", { + onClick: (e4) => selectGroupType(e4, i5), + dangerouslySetInnerHTML: { + __html: uiIconSet[`mk-ui-${(_a2 = group == null ? void 0 : group.type) != null ? _a2 : "any"}`] } - }, /* @__PURE__ */ Cn.createElement(SortableContext, { - items: flattenedTree, - strategy: verticalListSortingStrategy - }, /* @__PURE__ */ Cn.createElement(VirtualizedList, { - vRef: listRef, - flattenedTree, - projected, - handleCollapse, - activeFile, - plugin, - selectedFiles, - selectRange: selectRange2, - indentationWidth, - dragStarted, - dragOver, - dragEnded, - overIndex, - activeIndex - }), z3( - /* @__PURE__ */ Cn.createElement(DragOverlay, { - dropAnimation: null, - modifiers: [adjustTranslate], - zIndex: 1600 - }, activeId ? /* @__PURE__ */ Cn.createElement(SortableTreeItem, { - id: activeId, - data: flattenedTree.find((f4) => f4.id == activeId), - indicator: null, - depth: 0, - disabled: false, - plugin, - selected: false, - highlighted: false, - active: false, - clone: true, - childCount: 0, - style: {}, - indentationWidth, - dragStarted, - dragOver, - dragEnded, - dragActive: false - }) : null), - document.body - ))); + })), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter-bar mk-query-filters" + }, props2.children, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-filter", + onClick: (e4) => { + var _a3; + return selectField(e4, i5, (_a3 = group == null ? void 0 : group.filters.length) != null ? _a3 : 0); + } + }, /* @__PURE__ */ Cn.createElement("span", null, /* @__PURE__ */ Cn.createElement("span", { + className: "mk-icon-xsmall", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } + }), "Filter")))); }; -// src/components/Sidebar/MainList.tsx -init_hooks_module(); -init_compat_module(); - // src/components/Sidebar/MainMenu.tsx -var import_classnames7 = __toESM(require_classnames()); - -// src/components/ui/modals/hiddenFilesModal.tsx -var import_obsidian53 = require("obsidian"); -init_compat_module(); -var HiddenItemsModal = class extends import_obsidian53.Modal { - constructor(plugin) { - super(plugin.app); - this.plugin = plugin; - } - onOpen() { - const { contentEl } = this; - const myModal = this; - let headerText; - const headerEl = contentEl.createEl("div", { text: headerText }); - headerEl.addClass("modal-title"); - headerEl.innerHTML = i18n_default.labels.hiddenFiles; - const listEl = contentEl.createEl("div"); - const root2 = createRoot(listEl); - root2.render(/* @__PURE__ */ Cn.createElement(HiddenFiles, { - plugin: this.plugin - })); - const cancelButton = contentEl.createEl("button", { - text: i18n_default.buttons.cancel - }); - cancelButton.style.cssText = "float: right;"; - cancelButton.addEventListener("click", () => { - myModal.close(); - }); - const onClickAction = async () => { - myModal.close(); - }; - } - onClose() { - const { contentEl } = this; - contentEl.empty(); +var replaceMobileMainMenu = (plugin) => { + return; + if (platformIsMobile()) { + const header = app.workspace.containerEl.querySelector( + ".workspace-drawer.mod-left .workspace-drawer-header-left" + ); + header.empty(); + const reactEl = createRoot(header); + reactEl.render( + /* @__PURE__ */ Cn.createElement(SidebarProvider, { + plugin + }, /* @__PURE__ */ Cn.createElement(MainMenu, { + plugin + })) + ); } }; -var HiddenFiles = (props2) => { +var MainMenu = (props2) => { + var _a2, _b2; const { plugin } = props2; - const ref2 = _2(null); - const [hiddenFiles, setHiddenFiles] = h2(plugin.settings.hiddenFiles); - const [hiddenExtensions, setHiddenExtensions] = h2( - plugin.settings.hiddenExtensions - ); - const saveExtension = (value) => { - plugin.settings.hiddenExtensions = [ - ...plugin.settings.hiddenExtensions, - value - ]; + const { + activeFile, + activeViewSpace, + spaces: spaces2, + setDragPaths, + saveActiveSpace: setActiveViewSpaceByPath, + waypoints: pinnedSpaces, + activeQuery, + queryMode, + setQueryMode, + setActiveQuery + } = q2(SidebarContext); + const folder = defaultNoteFolder(props2.plugin, activeFile); + const ref2 = _2(); + const inputRef = _2(); + const [queryString, setQueryString] = h2(""); + const [filters, setFilters] = h2([]); + const [hover, setHover] = h2(false); + const queries = F2(() => { + return queryString.length > 0 ? [ + { + type: "any", + trueFalse: true, + filters: [ + { + type: "fileprop", + fType: "text", + field: "name", + fn: "include", + value: queryString + } + ] + }, + ...filters + ] : filters; + }, [queryString, filters]); + p2(() => { + setActiveQuery(queries); + }, [queries]); + const toggleSections = (collapse) => { + const newSections = collapse ? [] : spaces2.map((f4) => f4.name); + plugin.settings.expandedSpaces = newSections; plugin.saveSettings(); }; - const saveFile = (_12, value) => { - plugin.settings.hiddenFiles = [...plugin.settings.hiddenFiles, ...value]; - plugin.saveSettings(); + const newFile = async () => { + await createNewMarkdownFile(props2.plugin, folder, "", ""); + }; + p2(() => { + refreshLeafs(); + }, []); + const refreshLeafs = () => { + const leafs = []; + let spaceActive = true; + if (plugin.app.workspace.leftSplit && platformIsMobile()) { + const mobileDrawer = plugin.app.workspace.leftSplit; + const leaves = mobileDrawer.children; + const index = leaves.reduce((p3, c4, i5) => { + return c4.getViewState().type == FILE_TREE_VIEW_TYPE ? i5 : p3; + }, -1); + spaceActive = index == mobileDrawer.currentTab; + leafs.push(...leaves.filter((l3, i5) => i5 != index)); + } + return { leafs, spaceActive }; + }; + const showMenu = (e4) => { + const { spaceActive, leafs } = refreshLeafs(); + const menu = new import_obsidian56.Menu(); + !spaceActive && menu.addItem((menuItem) => { + menuItem.setIcon("lucide-arrow-left"); + menuItem.setTitle(i18n_default.menu.backToSpace); + menuItem.onClick((ev) => { + const leaves = plugin.app.workspace.getLeavesOfType(FILE_TREE_VIEW_TYPE); + if (leaves.length > 0) { + plugin.app.workspace.revealLeaf(leaves[0]); + } + }); + }); + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.home); + menuItem.onClick((ev) => { + setActiveViewSpaceByPath("spaces://$home"); + }); + }); + menu.addItem((menuItem) => { + menuItem.setTitle("Vault"); + menuItem.onClick((ev) => { + setActiveViewSpaceByPath("/"); + }); + }); + menu.addItem((menuItem) => { + menuItem.setTitle(i18n_default.menu.tags); + menuItem.onClick((ev) => { + setActiveViewSpaceByPath("spaces://$tags"); + }); + }); + menu.addItem((menuItem) => { + menuItem.setTitle("All Spaces"); + menuItem.onClick((ev) => { + setActiveViewSpaceByPath("spaces://$all"); + }); + }); + menu.addSeparator(); + menu.addItem((menuItem) => { + menuItem.setIcon("lucide-chevrons-down-up"); + menuItem.setTitle(i18n_default.menu.collapseAllSections); + menuItem.onClick((ev) => { + toggleSections(true); + }); + }); + menu.addItem((menuItem) => { + menuItem.setIcon("lucide-chevrons-up-down"); + menuItem.setTitle(i18n_default.menu.expandAllSections); + menuItem.onClick((ev) => { + toggleSections(false); + }); + }); + menu.addSeparator(); + menu.addItem((menuItem) => { + menuItem.setIcon("eye-off"); + menuItem.setTitle(i18n_default.menu.manageHiddenFiles); + menuItem.onClick((ev) => { + const vaultChangeModal = new HiddenItemsModal(plugin); + vaultChangeModal.open(); + }); + }); + menu.addSeparator(); + leafs.map( + (l3) => menu.addItem((menuItem) => { + menuItem.setIcon(l3.view.icon); + menuItem.setTitle(l3.getDisplayText()); + menuItem.onClick((ev) => { + plugin.app.workspace.revealLeaf(l3); + }); + }) + ); + menu.addItem((menuItem) => { + menuItem.setIcon("lucide-settings"); + menuItem.setTitle(i18n_default.menu.obSettings); + menuItem.onClick((ev) => { + plugin.app.commands.commands["app:open-settings"].callback(); + }); + }); + menu.addItem((menuItem) => { + menuItem.setIcon("vault"); + menuItem.setTitle(i18n_default.menu.openVault); + menuItem.onClick((ev) => { + plugin.app.commands.commands["app:open-vault"].callback(); + }); + }); + menu.addSeparator(); + menu.addItem((menuItem) => { + menuItem.setIcon("mk-logo"); + menuItem.setTitle(i18n_default.menu.getHelp); + menuItem.onClick((ev) => { + window.open("https://make.md/community"); + }); + }); + const offset2 = ref2.current.getBoundingClientRect(); + menu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); }; - const removeExtension = (index) => { - plugin.settings.hiddenExtensions = plugin.settings.hiddenExtensions.filter( - (f4, i4) => i4 != index - ); - plugin.saveSettings(); + const { dragPaths, saveActiveSpace } = q2(SidebarContext); + const onDragOver = (e4) => { + e4.preventDefault(); + if (dragPaths.length == 1) { + setHover(true); + } }; - const removeItem = (index) => { - plugin.settings.hiddenFiles = plugin.settings.hiddenFiles.filter( - (f4, i4) => i4 != index - ); - plugin.saveSettings(); + const dragLeave = () => { + setHover(false); }; - const addExtension = () => { - if ((ref2 == null ? void 0 : ref2.current.value.length) > 0) { - saveExtension(ref2.current.value); - ref2.current.empty(); + const onDrop = () => { + if (dragPaths.length == 1) { + saveActiveSpace(dragPaths[0]); + setHover(false); } }; - const settingsChanged = () => { - setHiddenFiles(plugin.settings.hiddenFiles); - setHiddenExtensions(plugin.settings.hiddenExtensions); - }; - p2(() => { - window.addEventListener(eventTypes.settingsChanged, settingsChanged); - return () => { - window.removeEventListener(eventTypes.settingsChanged, settingsChanged); - }; - }, []); - const addMenu = (e4) => { - const offset2 = e4.target.getBoundingClientRect(); - const options = getAllAbstractFilesInVault(props2.plugin, app).map((f4) => ({ - name: fileNameToString(f4.name), - value: f4.path - })); - showSelectMenu( - { x: offset2.left, y: offset2.top + 30 }, - { - plugin: props2.plugin, - multi: false, - editable: false, - value: [], - options, - saveOptions: saveFile, - placeholder: i18n_default.labels.linkItemSelectPlaceholder, - detail: true, - searchable: true - } - ); + const saveQuerySpace = () => { + const vaultChangeModal = new EditSpaceModal(plugin, null, "create", { + type: "smart", + filters: activeQuery + }); + vaultChangeModal.open(); }; return /* @__PURE__ */ Cn.createElement("div", { - className: "modal-content" + className: "mk-flow-bar" }, /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item setting-item-heading" - }, "Extensions"), /* @__PURE__ */ Cn.createElement("div", null, hiddenExtensions.map((f4, index) => /* @__PURE__ */ Cn.createElement("div", { - key: index, - className: "mobile-option-setting-item" - }, /* @__PURE__ */ Cn.createElement("span", { - className: "mobile-option-setting-item-name" - }, f4), /* @__PURE__ */ Cn.createElement("div", { - className: "clickable-icon mobile-option-setting-item-option-icon", - "aria-label": i18n_default.buttons.delete, - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] }, - onClick: () => removeExtension(index) - })))), /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item" - }, /* @__PURE__ */ Cn.createElement("input", { - placeholder: i18n_default.labels.addExtension, + className: "mk-flow-bar-compact" + }, /* @__PURE__ */ Cn.createElement("div", { + className: (0, import_classnames7.default)( + "mk-main-menu-container", + queryMode && "mk-hidden" + ) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-main-menu-button", + ref: ref2, + onClick: (e4) => showMenu(e4), + onDragLeave: () => dragLeave(), + onDragOver: (e4) => onDragOver(e4), + onDrop: () => onDrop() + }, activeViewSpace ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: (0, import_classnames7.default)( + "mk-waypoints-item", + hover && "is-active" + ), + dangerouslySetInnerHTML: { + __html: ((_b2 = (_a2 = activeViewSpace == null ? void 0 : activeViewSpace.metadata) == null ? void 0 : _a2.sticker) == null ? void 0 : _b2.length) > 0 ? stickerFromString( + activeViewSpace.metadata.sticker, + props2.plugin + ) : "F" + }, + draggable: true, + onDragStart: () => setDragPaths([activeViewSpace.path]) + }), activeViewSpace.alias) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-expand"] } + })), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-inline-button", + onClick: () => setQueryMode((p3) => !p3) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-small", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-search"] } + }))), /* @__PURE__ */ Cn.createElement("div", { + className: (0, import_classnames7.default)( + "mk-main-menu-search", + !queryMode && "mk-hidden" + ) + }, /* @__PURE__ */ Cn.createElement("div", { + "aria-label": i18n_default.buttons.blink, + className: "mk-inline-button", + onClick: () => setQueryMode((p3) => !p3) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-small", + dangerouslySetInnerHTML: { __html: lucideIcon("arrow-left") } + })), /* @__PURE__ */ Cn.createElement("input", { + onClick: (e4) => e4.stopPropagation(), + className: "mk-cell-text", + ref: inputRef, type: "text", - ref: ref2 - }), /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => addExtension() - }, "+ Add")), /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item setting-item-heading" - }, "Files"), /* @__PURE__ */ Cn.createElement("div", null, hiddenFiles.map((f4, index) => /* @__PURE__ */ Cn.createElement("div", { - key: index, - className: "mobile-option-setting-item" - }, /* @__PURE__ */ Cn.createElement("span", { - className: "mobile-option-setting-item-name" - }, f4), /* @__PURE__ */ Cn.createElement("div", { - className: "clickable-icon mobile-option-setting-item-option-icon", - "aria-label": i18n_default.buttons.delete, - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] }, - onClick: () => removeItem(index) - })))), /* @__PURE__ */ Cn.createElement("div", { - className: "setting-item" - }, /* @__PURE__ */ Cn.createElement("button", { - onClick: (e4) => addMenu(e4) - }, "+ ", i18n_default.buttons.addFile))); + value: queryString, + onChange: (e4) => setQueryString(e4.target.value) + }), /* @__PURE__ */ Cn.createElement("div", { + "aria-label": i18n_default.buttons.blink, + className: "mk-inline-button", + onClick: () => saveQuerySpace() + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-small", + dangerouslySetInnerHTML: { __html: lucideIcon("save") } + }))), /* @__PURE__ */ Cn.createElement("div", { + "aria-label": i18n_default.buttons.newNote, + className: "mk-inline-button", + onClick: (e4) => triggerSectionAddMenu(props2.plugin, e4, activeViewSpace, activeFile) + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-small", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-new-note"] } + }))), queryMode && /* @__PURE__ */ Cn.createElement(SpaceQuery, { + plugin, + filters, + setFilters + })); }; -// src/components/Sidebar/MainMenu.tsx -var import_obsidian56 = require("obsidian"); +// src/components/Sidebar/SpaceSwitcher/SpaceSwitcher.tsx init_compat_module(); - -// src/components/Space/Contexts/ContextBuilder/BuilderMetadataFields.tsx -var import_obsidian54 = require("obsidian"); init_compat_module(); -var allMetadataForFiles = (plugin, files) => { - return files.reduce((p3, c4) => { - const fm = frontMatterForFile(c4); - const fmKeys = uniqCaseInsensitive(frontMatterKeys(fm)); - if (plugin.dataViewAPI()) { - const dvValues = plugin.dataViewAPI().page(c4.path); - const dvKeys = uniqCaseInsensitive( - Object.keys(dvValues != null ? dvValues : {}).filter( - (f4, i4, self2) => !self2.find( - (g4, j4) => g4.toLowerCase().replace(/\s/g, "-") == f4.toLowerCase().replace(/\s/g, "-") && i4 > j4 - ) ? true : false - ).filter((f4) => f4 != "file" && !fmKeys.some((g4) => f4 == g4)) - ); - return [ - ...p3, - ...fmKeys.map((f4) => ({ name: f4, type: "fm" })), - ...dvKeys.map((f4) => ({ name: f4, type: "dv" })) - ].filter(metadatTypeFilterPredicate); - } - return [ - ...p3, - ...fmKeys.map((f4) => ({ name: f4, type: "fm" })) - ].filter(metadatTypeFilterPredicate); - }, []); -}; -var metadatTypeFilterPredicate = (value, index, self2) => { - return self2.findIndex( - (v3) => value["type"] == v3["type"] && value["name"] == v3["name"] - ) === index; -}; -// src/components/Sidebar/SpaceQuery.tsx -var import_obsidian55 = require("obsidian"); +// src/components/Sidebar/SpaceSwitcher/PinnedSpace.tsx +var import_classnames8 = __toESM(require_classnames()); init_compat_module(); - -// src/types/metadata.ts -var fileProps = { - "name": { - label: "File Name", - field: "name", - vType: "text", - type: "fileprop" - }, - "path": { - label: "Path", - field: "path", - vType: "text", - type: "fileprop" - }, - "parent": { - label: "Folder", - field: "parent", - vType: "text", - type: "fileprop" - }, - "sticker": { - label: "Sticker", - field: "sticker", - vType: "text", - type: "fileprop" - }, - "color": { - label: "Color", - field: "color", - vType: "text", - type: "fileprop" - }, - "ctime": { - label: "Created", - field: "ctime", - vType: "date", - type: "fileprop" - }, - "mtime": { - label: "Last Modified", - field: "mtime", - vType: "date", - type: "fileprop" - }, - "extension": { - label: "Extension", - field: "extension", - vType: "text", - type: "fileprop" - }, - "size": { - label: "Size", - field: "size", - vType: "number", - type: "fileprop" - } -}; -var fileMeta = { - "tags": { - label: "Tags", - field: "tags", - vType: "tags-multi", - type: "filemeta" - }, - "inlinks": { - label: "Linked Mentions", - field: "inlinks", - vType: "link-multi", - type: "filemeta" - }, - "outlinks": { - label: "Links", - field: "outlinks", - vType: "link-multi", - type: "filemeta" - } +var animateLayoutChanges3 = ({ + isSorting, + wasDragging +}) => isSorting || wasDragging ? false : true; +var SortablePinnedSpaceItem = ({ + id: id3, + index, + ...props2 +}) => { + const { + attributes, + isDragging, + isSorting, + listeners, + setNodeRef, + transform, + transition + } = useSortable({ + id: id3, + animateLayoutChanges: animateLayoutChanges3 + }); + const memoListeners = F2(() => { + return { + ...attributes, + ...listeners + }; + }, [isSorting]); + return /* @__PURE__ */ Cn.createElement(PinnedSpace, { + index, + ref: setNodeRef, + handleProps: memoListeners, + ...props2 + }); }; - -// src/components/Sidebar/SpaceQuery.tsx -var SpaceQuery = (props2) => { - const { filters, setFilters } = props2; - const selectFilterValue = (e4, filter, i4, k5) => { +var PinnedSpace = k3( + ({ + pin, + handleProps, + indicator, + highlighted, + plugin, + style, + clone: clone2, + ghost, + dragStart, + dragOver, + dragEnded, + index + }, ref2) => { var _a2; - const saveFilterValue = (value) => { - setDefFilterValue(value, i4, k5); + const innerRef = _2(null); + const { setDragPaths, activeViewSpace, activeFile, saveActiveSpace } = q2(SidebarContext); + const onDragStarted = (e4) => { + if (dragStart && pin) { + dragStart(index); + setDragPaths([pin.path]); + } }; - switch ((_a2 = filterFnTypes[filter.fn]) == null ? void 0 : _a2.valueType) { - case "text": - case "number": - { - const menu = new import_obsidian55.Menu(); - menu.setUseNativeMenu(false); - menu.addItem((menuItem) => { - inputMenuItem( - menuItem, - filter.value, - (value) => saveFilterValue(value) - ); - menuItem.setIcon("type"); - }); - const offset2 = e4.target.getBoundingClientRect(); - menu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); - } - break; - case "date": { - const saveValue = (date2) => { - saveFilterValue(date2.valueOf().toString()); + const onDragEnded = (e4) => { + if (dragEnded) { + dragEnded(); + } + }; + const innerProps = !platformIsMobile() ? { + draggable: true, + onDragStart: onDragStarted, + onDrop: onDragEnded + } : handleProps; + return /* @__PURE__ */ Cn.createElement("div", { + ref: innerRef, + className: "mk-waypoint", + onClick: () => saveActiveSpace(pin.path), + onContextMenu: (e4) => triggerSpaceMenu(plugin, pin, e4, activeFile, null), + onDragOver: (e4) => { + e4.preventDefault(); + if (!innerRef.current) + return; + const rect = innerRef.current.getBoundingClientRect(); + const x5 = e4.clientX - rect.left; + if (dragOver) + dragOver(index, x5); + }, + ...innerProps + }, /* @__PURE__ */ Cn.createElement("div", { + ref: ref2, + className: (0, import_classnames8.default)( + "mk-waypoints-item", + "clickable-icon", + "nav-action-button", + (activeViewSpace == null ? void 0 : activeViewSpace.path) == (pin == null ? void 0 : pin.path) && "mk-active", + highlighted && "mk-active", + indicator && "mk-indicator", + clone2 && "mk-clone", + ghost && "mk-ghost" + ), + dangerouslySetInnerHTML: ((_a2 = pin == null ? void 0 : pin.metadata.sticker) == null ? void 0 : _a2.length) > 0 ? { + __html: stickerFromString(pin.metadata.sticker, plugin) + } : null, + style: { + ...style, + ...{ pointerEvents: "none" } + } + }, pin == null ? void 0 : pin.name.substring(0, 1))); + } +); +PinnedSpace.displayName = "PinnedSpace"; + +// src/components/Sidebar/SpaceSwitcher/SpaceSwitcher.tsx +var SpaceSwitcher = (props2) => { + const { activeFile, waypoints } = q2(SidebarContext); + const folder = defaultNoteFolder(props2.plugin, activeFile); + const { plugin } = props2; + const newFile = async () => { + await createNewMarkdownFile(props2.plugin, folder, "", ""); + }; + const { dragPaths } = q2(SidebarContext); + const [activeId, setActiveId] = h2(null); + const [overId, setOverId] = h2(null); + const dragCounter = _2(0); + const [offset2, setOffset] = h2(0); + const [projected, setProjected] = h2(null); + const [dropPlaceholder, setDragPlaceholder] = h2(null); + p2(() => { + if (overId === null || dragPaths.length == 0) { + setProjected(null); + return; + } + const waypoint = waypoints[overId]; + const dropableTypes = droppableTypesForSpace(waypoint.type); + if (dragPaths.length > 1) { + const droppable = dragPaths.map((f4) => uriByString(f4)).filter((f4) => dropableTypes.some((g4) => g4 == f4.type)); + if (droppable.length > 0) { + const _projected = { + depth: 0, + overId, + parentId: null, + sortable: false, + insert: offset2 > 20, + droppable: true }; - const offset2 = e4.target.getBoundingClientRect(); - const date = new Date(filter.value); - showDatePickerMenu( - { x: offset2.left, y: offset2.top + 30 }, - date.getTime() ? date : null, - saveValue - ); - break; + setProjected(_projected); + return; + } else { + return null; } - case "list": - { - const fieldType = filter.fType; - const saveOptions = (options2, values) => { - saveFilterValue(serializeMultiString(values)); - }; - let options = []; - if (fieldType.startsWith("option")) { - options = parseMultiString(filter.value).map((f4) => ({ - name: f4, - value: f4 - })); - } else if (fieldType.startsWith("tags")) { - options = loadTags(props2.plugin).map((f4) => ({ - value: f4, - name: f4 - })); - } else if (fieldType.startsWith("links")) { - options = getAllAbstractFilesInVault(props2.plugin, app).map( - (f4) => ({ - name: fileNameToString(f4.name), - value: f4.path, - description: f4.path - }) - ); - } - const offset2 = e4.target.getBoundingClientRect(); - showSelectMenu( - { x: offset2.left, y: offset2.top + 30 }, - { - plugin: props2.plugin, - multi: true, - editable: true, - value: parseMultiString(filter.value), - options, - saveOptions, - placeholder: i18n_default.labels.optionItemSelectPlaceholder, - searchable: false, - showAll: true - } - ); - } - break; + } else { + const path = uriByString(dragPaths[0]); + const droppable = dropableTypes.some((f4) => path.type == f4); + const _projected = { + depth: 0, + overId, + parentId: null, + sortable: false, + insert: offset2 > 20, + droppable + }; + setProjected(_projected); + } + }, [overId, dragPaths, offset2]); + const resetState = () => { + setOverId(null); + setActiveId(null); + setProjected(null); + setOffset(0); + dragCounter.current = 0; + }; + const handleDragCancel = () => { + resetState(); + }; + const dragEnter = () => { + dragCounter.current++; + }; + const dragLeave = () => { + dragCounter.current--; + if (dragCounter.current == 0) { + setOverId(null); + setProjected(null); + setOffset(0); + dragCounter.current = 0; } }; - const addDefGroup = () => { - setFilters((p3) => [ - ...p3, - { - type: "any", - trueFalse: true, - filters: [] - } - ]); + const adjustTranslate = ({ transform }) => { + return { + ...transform, + x: transform.x, + y: transform.y - 10 + }; }; - const removeDefGroup = (groupIndex) => { - setFilters(filters.filter((f4, i4) => i4 == groupIndex ? false : true)); + const dragStarted = (id3) => { + setActiveId(id3); }; - const typeForField = (type, field) => { - if (type == "frontmatter") { - return "text"; + const dragOver = (id3, x5) => { + setOffset(x5); + setOverId(id3); + }; + const dragEnded = () => { + if (dragPaths.length == 1) { + if (activeId !== null) { + plugin.settings.waypoints = arrayMove( + waypoints.map((f4) => f4.path), + activeId, + overId + ); + plugin.saveSettings(); + } else { + plugin.settings.waypoints = insert( + waypoints.map((f4) => f4.path).filter((f4) => f4 != dragPaths[0]), + overId, + dragPaths[0] + ); + plugin.saveSettings(); + } } - if (type == "filemeta") { - return fileMeta[field].vType; + resetState(); + }; + useDndMonitor({ + onDragStart: handleDragStart, + onDragMove: handleDragMove, + onDragOver: handleDragOver, + onDragEnd: handleDragEnd, + onDragCancel: handleDragCancel + }); + function handleDragStart(event) { + const { + active: { id: activeId2 } + } = event; + dragStarted(activeId2); + } + function handleDragMove({ delta }) { + } + function handleDragOver({ over }) { + const overId2 = over == null ? void 0 : over.id; + if (overId2) { + setOverId(overId2); } - if (type == "fileprop") { - return fileProps[field].vType; + } + function handleDragEnd({ active, over }) { + dragEnded(); + } + const width = 32; + const calcXOffset = (index) => { + if (!projected) + return 0; + const targetIndex = overId; + if (activeId == null) { + if (index >= overId) + return width; + return 0; + } + if (index == activeId) { + return width * (targetIndex - activeId); + } else if (index > activeId && index <= targetIndex) { + return -width; + } else if (index < activeId && index >= targetIndex) { + return width; + } else { + return 0; } - return "text"; }; - const setDefFilter = (filter, groupIndex, filterIndex) => { - var _a2; - let field; - let fType; - const filterTuple = filter.split("."); - const type = filterTuple[0]; - if (type == "frontmatter") { - fType = filterTuple[1]; - field = filterTuple[2]; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-waypoints nav-header", + onDragEnter: () => dragEnter(), + onDragLeave: () => dragLeave(), + onDragOver: (e4) => e4.preventDefault() + }, /* @__PURE__ */ Cn.createElement("div", { + className: "nav-buttons-container" + }, waypoints.map((pin, i5) => /* @__PURE__ */ Cn.createElement(SortablePinnedSpaceItem, { + id: i5, + plugin: props2.plugin, + highlighted: overId == i5 && projected && projected.insert && projected.droppable, + style: { + transform: CSS.Translate.toString({ + x: calcXOffset(i5), + y: 0, + scaleX: 0, + scaleY: 0 + }) + }, + index: i5, + pin, + key: pin.path, + dragStart: dragStarted, + dragOver, + dragEnded, + dragActive: activeId !== null, + ghost: activeId === i5 + })), overId != null && activeId == null && /* @__PURE__ */ Cn.createElement(SortablePinnedSpaceItem, { + id: waypoints.length, + plugin: props2.plugin, + highlighted: false, + index: waypoints.length, + pin: null + })), z3( + /* @__PURE__ */ Cn.createElement(DragOverlay, { + dropAnimation: null, + modifiers: [adjustTranslate], + zIndex: 1600 + }, activeId !== null ? /* @__PURE__ */ Cn.createElement(SortablePinnedSpaceItem, { + id: -1, + plugin: props2.plugin, + highlighted: false, + clone: true, + index: activeId, + indicator: false, + pin: waypoints[activeId] + }) : null), + document.body + ))); +}; + +// src/components/Sidebar/MainList.tsx +var MainList = (props2) => { + const { activeViewSpace } = q2(SidebarContext); + const [error, resetError] = P2(); + if (error) + console.log(error); + const sensors = useSensors( + useSensor(MouseSensor, { + activationConstraint: { + distance: 10 + } + }), + useSensor(TouchSensor, { + activationConstraint: { + delay: 250, + tolerance: 5 + } + }) + ); + const measuring = { + droppable: { + strategy: MeasuringStrategy.Always + } + }; + return /* @__PURE__ */ Cn.createElement(DndContext, { + sensors, + collisionDetection: closestCenter, + measuring + }, /* @__PURE__ */ Cn.createElement(SpaceSwitcher, { + plugin: props2.plugin + }), /* @__PURE__ */ Cn.createElement(MainMenu, { + plugin: props2.plugin + }), /* @__PURE__ */ Cn.createElement(FileExplorerComponent, { + plugin: props2.plugin + })); +}; + +// src/components/Sidebar/FileTreeView.tsx +var FILE_TREE_VIEW_TYPE = "mk-file-view"; +var VIEW_DISPLAY_TEXT = "Spaces"; +var ICON = "layout-grid"; +var FileTreeView = class extends import_obsidian57.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.navigation = false; + this.plugin = plugin; + } + revealInFolder(file) { + if (file instanceof import_obsidian57.TFolder) { + this.plugin.app.workspace.activeLeaf.setViewState({ + type: SPACE_VIEW_TYPE, + state: { path: file.path } + }); + this.plugin.app.workspace.requestSaveLayout(); } else { - field = filterTuple[1]; - fType = typeForField(type, field); + const evt = new CustomEvent(eventTypes.revealFile, { + detail: { file } + }); + window.dispatchEvent(evt); } - if (filters.length == 0) { - setFilters([ - { - type: "any", - trueFalse: true, - filters: [ - { - type, - field, - fType, - fn: "", - value: "" - } - ] - } - ]); - return; + } + getViewType() { + return FILE_TREE_VIEW_TYPE; + } + getDisplayText() { + return VIEW_DISPLAY_TEXT; + } + getIcon() { + return ICON; + } + async onClose() { + const leafs = this.app.workspace.getLeavesOfType(FILE_TREE_VIEW_TYPE); + if (leafs.length == 0) { + const leaf = this.app.workspace.getLeftLeaf(false); + await leaf.setViewState({ type: FILE_TREE_VIEW_TYPE }); } - if (((_a2 = filters[groupIndex]) == null ? void 0 : _a2.filters.length) == 0) { - setFilters( - filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: [ - { - type, - field, - fType, - fn: "", - value: "" - } - ] - } : f4 - ) + this.destroy(); + } + destroy() { + if (this.root) + this.root.unmount(); + } + async onOpen() { + this.destroy(); + this.constructFileTree(this.app.vault.getRoot().path, ""); + } + constructFileTree(folderPath, vaultChange) { + this.destroy(); + this.root = createRoot(this.contentEl); + this.root.render( + /* @__PURE__ */ Cn.createElement("div", { + className: "mk-sidebar" + }, /* @__PURE__ */ Cn.createElement(SidebarProvider, { + plugin: this.plugin + }, /* @__PURE__ */ Cn.createElement(MainList, { + plugin: this.plugin + }))) + ); + } +}; + +// src/settings/settings.ts +var import_obsidian58 = require("obsidian"); +var DEFAULT_SETTINGS = { + defaultInitialization: false, + filePreviewOnHover: false, + flowMenuEnabled: true, + markSans: false, + blinkEnabled: true, + makeMenuPlaceholder: true, + mobileMakeBar: true, + inlineStyler: true, + makerMode: true, + spacesMDBInHidden: true, + inlineStylerColors: false, + editorFlow: true, + internalLinkClickFlow: true, + contextEnabled: true, + saveAllContextToFrontmatter: true, + editorFlowStyle: "seamless", + autoOpenFileContext: false, + activeView: "root", + hideFrontmatter: true, + activeSpace: "", + spacesCompactMode: false, + defaultDateFormat: "MMM dd yyyy", + spacesEnabled: true, + spacesPerformance: false, + collapsedTags: [], + enableFolderNote: true, + folderIndentationLines: true, + revealActiveFile: false, + spacesStickers: true, + spaceRowHeight: 29, + spacesDisablePatch: false, + folderNoteInsideFolder: true, + folderNoteDefaultView: true, + sidebarTabs: true, + showRibbon: true, + deleteFileOption: "trash", + expandedSpaces: ["/"], + expandFolderOnClick: true, + openFolders: [], + fileIcons: [], + cachedSpaces: [], + menuTriggerChar: "/", + inlineStickerMenu: true, + emojiTriggerChar: ":", + folderContextFile: "context", + folderFrameFile: "frames", + spacesFolder: "Spaces", + hiddenFiles: ["Spaces"], + lineNumbers: false, + hiddenExtensions: ["mdb"], + newFileLocation: "root", + newFileFolderPath: "", + inlineBacklinks: false, + inlineContext: true, + inlineBacklinksExpanded: false, + inlineContextExpanded: true, + inlineContextSectionsExpanded: true, + dataviewInlineContext: false, + inlineContextNameLayout: "vertical", + waypoints: [], + rootSpaces: [], + spacesUseAlias: false, + precreateVaultSpace: false, + fmKeyAlias: "aliases", + fmKeyBanner: "banner", + fmKeyColor: "color", + fmKeySticker: "sticker", + fmKeyContexts: "contexts", + fmKeySort: "sort", + fmKeyDef: "def", + fmKeyLinks: "links", + openSpacesOnLaunch: true, + indexSVG: false, + quickFrames: [], + readableLineWidth: true, + autoAddContextsToSubtags: true, + autoMigration08: false +}; +var MakeMDPluginSettingsTab = class extends import_obsidian58.PluginSettingTab { + constructor(app2, plugin) { + super(app2, plugin); + this.plugin = plugin; + } + refreshView() { + this.display(); + } + display() { + const { containerEl } = this; + containerEl.empty(); + containerEl.createEl("h1", { text: i18n_default.settings.sectionSidebar }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.spaces.name).setDesc(i18n_default.settings.spaces.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.spacesEnabled).onChange((value) => { + this.plugin.settings.spacesEnabled = value; + this.plugin.saveSettings(); + if (value) { + this.plugin.openFileTreeLeaf(true); + } else { + this.plugin.detachFileTreeLeafs(); + } + this.refreshView(); + }) + ); + if (this.plugin.settings.spacesEnabled) { + containerEl.createEl("h3", { text: i18n_default.settings.sectionAppearance }); + const spaceAppearances = containerEl.createEl("div"); + new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.sidebarTabs.name).setDesc(i18n_default.settings.sidebarTabs.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.sidebarTabs).onChange((value) => { + this.plugin.settings.sidebarTabs = value; + this.plugin.saveSettings(); + document.body.classList.toggle("mk-hide-tabs", !value); + }) + ); + new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.hideRibbon.name).setDesc(i18n_default.settings.hideRibbon.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.showRibbon).onChange((value) => { + this.plugin.settings.showRibbon = value; + this.plugin.saveSettings(); + document.body.classList.toggle("mk-hide-ribbon", !value); + }) + ); + new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.compactMode.name).setDesc(i18n_default.settings.compactMode.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.spacesCompactMode).onChange((value) => { + this.plugin.settings.spacesCompactMode = value; + this.plugin.detachFileTreeLeafs(); + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.folderIndentationLines.name).setDesc(i18n_default.settings.folderIndentationLines.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.folderIndentationLines).onChange((value) => { + this.plugin.settings.folderIndentationLines = value; + this.plugin.saveSettings(); + document.body.classList.toggle("mk-folder-lines", value); + }) + ); + new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.spacesStickers.name).setDesc(i18n_default.settings.spacesStickers.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.spacesStickers).onChange((value) => { + this.plugin.settings.spacesStickers = value; + this.plugin.saveSettings(); + this.refreshView(); + }) + ); + new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.spacesAlias.name).setDesc(i18n_default.settings.spacesAlias.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.spacesUseAlias).onChange((value) => { + this.plugin.settings.spacesUseAlias = value; + this.plugin.saveSettings(); + this.refreshView(); + }) + ); + new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.readableLineWidth.name).setDesc(i18n_default.settings.readableLineWidth.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.readableLineWidth).onChange((value) => { + this.plugin.settings.readableLineWidth = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.openSpacesOnLaunch.name).setDesc(i18n_default.settings.openSpacesOnLaunch.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.openSpacesOnLaunch).onChange((value) => { + this.plugin.settings.openSpacesOnLaunch = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.spaceRowHeight.name).setDesc(i18n_default.settings.spaceRowHeight.desc).addText((text2) => { + text2.setValue(this.plugin.settings.spaceRowHeight.toString()).onChange(async (value) => { + text2.setValue(parseInt(value).toString()); + this.plugin.settings.spaceRowHeight = parseInt(value); + await this.plugin.saveSettings(); + }); + }); + containerEl.createEl("h3", { text: "Folder Note" }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.folderNote.name).setDesc(i18n_default.settings.folderNote.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.enableFolderNote).onChange((value) => { + this.plugin.settings.enableFolderNote = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.folderNoteLocation.name).setDesc(i18n_default.settings.folderNoteLocation.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.folderNoteInsideFolder).onChange((value) => { + this.plugin.settings.folderNoteInsideFolder = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.folderViewDefault.name).setDesc(i18n_default.settings.folderViewDefault.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.folderNoteDefaultView).onChange((value) => { + this.plugin.settings.folderNoteDefaultView = value; + this.plugin.saveSettings(); + }) + ); + containerEl.createEl("h3", { text: "Advanced" }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.expandFolder.name).setDesc(i18n_default.settings.expandFolder.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.expandFolderOnClick).onChange((value) => { + this.plugin.settings.expandFolderOnClick = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.hoverPreview.name).setDesc(i18n_default.settings.hoverPreview.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.filePreviewOnHover).onChange((value) => { + this.plugin.settings.filePreviewOnHover = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.activeFile.name).setDesc(i18n_default.settings.activeFile.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.revealActiveFile).onChange((value) => { + this.plugin.settings.revealActiveFile = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.spacesFileExplorerDual.name).setDesc(i18n_default.settings.spacesFileExplorerDual.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.spacesDisablePatch).onChange((value) => { + this.plugin.settings.spacesDisablePatch = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.spacesPerformance.name).setDesc(i18n_default.settings.spacesPerformance.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.spacesPerformance).onChange((value) => { + this.plugin.settings.spacesPerformance = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.indexSVG.name).setDesc(i18n_default.settings.indexSVG.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.indexSVG).onChange((value) => { + this.plugin.settings.indexSVG = value; + this.plugin.saveSettings(); + }) ); - return; + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.spacesDeleteOption.name).setDesc(i18n_default.settings.spacesDeleteOption.desc).addDropdown((dropdown) => { + dropdown.addOption( + "permanent", + i18n_default.settings.spacesDeleteOptions.permanant + ); + dropdown.addOption("trash", i18n_default.settings.spacesDeleteOptions.trash); + dropdown.addOption( + "system-trash", + i18n_default.settings.spacesDeleteOptions["system-trash"] + ); + dropdown.setValue(this.plugin.settings.deleteFileOption); + dropdown.onChange((option) => { + this.plugin.settings.deleteFileOption = option; + this.plugin.saveSettings(); + }); + }); } - setFilters( - filters.map( - (f4, i4) => { - var _a3; - return i4 == groupIndex ? { - ...f4, - filters: !f4.filters || filterIndex == f4.filters.length ? [ - ...(_a3 = f4.filters) != null ? _a3 : [], - { - type, - fType, - field, - fn: "", - value: "" - } - ] : f4.filters.map( - (g4, k5) => k5 == filterIndex ? { - ...g4, - type, - fType, - field - } : g4 - ) - } : f4; - } - ) + containerEl.createEl("h1", { text: "Context" }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.contexts.name).setDesc(i18n_default.settings.contexts.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.contextEnabled).onChange((value) => { + this.plugin.settings.contextEnabled = value; + this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) ); - }; - const setDefFilterFn = (fn2, groupIndex, filterIndex) => { - setFilters( - filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: f4.filters.map( - (g4, k5) => k5 == filterIndex ? { - ...g4, - fn: fn2 - } : g4 - ) - } : f4 - ) + containerEl.createEl("h3", { text: i18n_default.settings.sectionAppearance }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.defaultDateFormat.name).setDesc(i18n_default.settings.defaultDateFormat.desc).addText((text2) => { + text2.setValue(this.plugin.settings.defaultDateFormat).onChange(async (value) => { + this.plugin.settings.defaultDateFormat = value; + await this.plugin.saveSettings(); + }); + }); + containerEl.createEl("h3", { text: i18n_default.settings.sectionAdvanced }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.openFileContext.name).setDesc(i18n_default.settings.openFileContext.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.autoOpenFileContext).onChange((value) => { + this.plugin.settings.autoOpenFileContext = value; + this.plugin.saveSettings(); + }) ); - }; - const setDefFilterValue = (value, groupIndex, filterIndex) => { - setFilters( - filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: f4.filters.map( - (g4, k5) => k5 == filterIndex ? { - ...g4, - value - } : g4 - ) - } : f4 - ) + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.syncContextToFrontmatter.name).setDesc(i18n_default.settings.syncContextToFrontmatter.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.saveAllContextToFrontmatter).onChange((value) => { + this.plugin.settings.saveAllContextToFrontmatter = value; + this.plugin.saveSettings(); + }) ); - }; - const removeDefFilter = (filterIndex, groupIndex) => { - setFilters( - filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - filters: f4.filters.filter( - (g4, k5) => k5 == filterIndex ? false : true - ) - } : f4 - ) + containerEl.createEl("h1", { text: "Blink" }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.blink.name).setDesc(i18n_default.settings.blink.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.blinkEnabled).onChange(async (value) => { + this.plugin.settings.blinkEnabled = value; + await this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) ); - }; - const setGroupType = (groupIndex, type) => { - if (groupIndex == 0 && filters.length == 0) { - setFilters([ - { - type, - trueFalse: true, - filters: [] - } - ]); - } else { - setFilters( - filters.map( - (f4, i4) => i4 == groupIndex ? { - ...f4, - type - } : f4 - ) + containerEl.createEl("h1", { text: i18n_default.settings.sectionFlow }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorMakerMode.name).setDesc(i18n_default.settings.editorMakerMode.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.makerMode).onChange((value) => { + this.plugin.settings.makerMode = value; + this.plugin.saveSettings(); + this.refreshView(); + }) + ); + if (this.plugin.settings.makerMode) { + containerEl.createEl("h3", { text: "Inline Context" }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineContextExplorer.name).setDesc(i18n_default.settings.inlineContextExplorer.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.inlineContext).onChange((value) => { + this.plugin.settings.inlineContext = value; + this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.lineNumbers.name).setDesc(i18n_default.settings.lineNumbers.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.lineNumbers).onChange(async (value) => { + this.plugin.settings.lineNumbers = value; + await this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineContextExpanded.name).setDesc(i18n_default.settings.inlineContextExpanded.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.inlineContextSectionsExpanded).onChange((value) => { + this.plugin.settings.inlineContextSectionsExpanded = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineContextHorizontal.name).setDesc(i18n_default.settings.inlineContextHorizontal.desc).addDropdown((dropdown) => { + dropdown.addOption("vertical", i18n_default.settings.layoutVertical); + dropdown.addOption("horizontal", i18n_default.settings.layoutHorizontal); + dropdown.setValue(this.plugin.settings.inlineContextNameLayout); + dropdown.onChange((option) => { + this.plugin.settings.inlineContextNameLayout = option; + this.plugin.saveSettings(); + }); + }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.hideFrontmatter.name).setDesc(i18n_default.settings.hideFrontmatter.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.hideFrontmatter).onChange(async (value) => { + this.plugin.settings.hideFrontmatter = value; + await this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.dataviewInlineContext.name).setDesc(i18n_default.settings.dataviewInlineContext.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.dataviewInlineContext).onChange((value) => { + this.plugin.settings.dataviewInlineContext = value; + this.plugin.saveSettings(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineBacklinks.name).setDesc(i18n_default.settings.inlineBacklinks.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.inlineBacklinks).onChange(async (value) => { + this.plugin.settings.inlineBacklinks = value; + await this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) + ); + containerEl.createEl("h3", { text: "Flow Block" }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorFlowReplace.name).setDesc(i18n_default.settings.editorFlowReplace.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.editorFlow).onChange((value) => { + this.plugin.settings.editorFlow = value; + this.plugin.saveSettings(); + this.refreshView(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.internalLinkFlowEditor.name).setDesc(i18n_default.settings.internalLinkFlowEditor.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.internalLinkClickFlow).onChange(async (value) => { + this.plugin.settings.internalLinkClickFlow = value; + await this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorFlowStyle.name).setDesc(i18n_default.settings.editorFlowStyle.desc).addDropdown((dropdown) => { + dropdown.addOption("classic", i18n_default.settings.editorFlowStyle.classic); + dropdown.addOption("seamless", i18n_default.settings.editorFlowStyle.seamless); + dropdown.addOption("minimal", i18n_default.settings.editorFlowStyle.minimal); + dropdown.setValue(this.plugin.settings.editorFlowStyle).onChange(async (value) => { + this.plugin.settings.editorFlowStyle = value; + document.body.classList.toggle("mk-flow-classic", false); + document.body.classList.toggle("mk-flow-seamless", false); + document.body.classList.toggle("mk-flow-minimal", false); + if (value == "seamless") + document.body.classList.toggle("mk-flow-seamless", true); + if (value == "classic") + document.body.classList.toggle("mk-flow-classic", true); + if (value == "minimal") + document.body.classList.toggle("mk-flow-minimal", true); + }); + }); + containerEl.createEl("h3", { text: "Flow Menu" }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorMakeMenu.name).setDesc(i18n_default.settings.editorMakeMenu.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.flowMenuEnabled).onChange(async (value) => { + this.plugin.settings.flowMenuEnabled = value; + await this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.makeChar.name).setDesc(i18n_default.settings.makeChar.desc).addText((text2) => { + text2.setValue(this.plugin.settings.menuTriggerChar).onChange(async (value) => { + if (value.trim().length < 1) { + text2.setValue(this.plugin.settings.menuTriggerChar); + return; + } + let char = value[0]; + if (value.trim().length === 2) { + char = value.replace(this.plugin.settings.menuTriggerChar, ""); + } + text2.setValue(char); + this.plugin.settings.menuTriggerChar = char; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorMakePlacholder.name).setDesc(i18n_default.settings.editorMakePlacholder.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.makeMenuPlaceholder).onChange(async (value) => { + this.plugin.settings.makeMenuPlaceholder = value; + await this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) + ); + containerEl.createEl("h3", { text: "Flow Styler" }); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineStyler.name).setDesc(i18n_default.settings.inlineStyler.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.inlineStyler).onChange(async (value) => { + this.plugin.settings.inlineStyler = value; + await this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineStickerMenu.name).setDesc(i18n_default.settings.inlineStickerMenu.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.inlineStickerMenu).onChange(async (value) => { + this.plugin.settings.inlineStickerMenu = value; + await this.plugin.saveSettings(); + this.plugin.reloadExtensions(false); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineStylerColor.name).setDesc(i18n_default.settings.inlineStylerColor.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.inlineStylerColors).onChange((value) => { + this.plugin.settings.inlineStylerColors = value; + this.plugin.saveSettings(); + this.refreshView(); + }) + ); + new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.mobileMakeBar.name).setDesc(i18n_default.settings.mobileMakeBar.desc).addToggle( + (toggle) => toggle.setValue(this.plugin.settings.mobileMakeBar).onChange((value) => { + this.plugin.settings.mobileMakeBar = value; + this.plugin.saveSettings(); + this.refreshView(); + }) ); } - }; - const selectGroupType = (e4, i4) => { - const offset2 = e4.target.getBoundingClientRect(); - const filters2 = ["any", "all"]; - showSelectMenu( - { x: offset2.left, y: offset2.top + 30 }, - { - plugin: props2.plugin, - multi: false, - editable: false, - value: [], - options: filters2.map((f4) => ({ name: f4, value: f4 })), - saveOptions: (_12, value) => setGroupType(i4, value[0]), - searchable: false, - showAll: true - } + } +}; + +// src/components/Blink/Blink.tsx +var import_obsidian59 = require("obsidian"); +init_compat_module(); + +// src/components/Blink/BlinkComponent.tsx +init_compat_module(); +var BlinkComponent = Cn.forwardRef( + (props2, ref2) => { + const [previewPath, setPreviewPath] = h2(null); + const [allItems, setAllItems] = h2([]); + const defaultOptions4 = F2( + () => app.workspace.getLastOpenFiles().filter((f4) => getAbstractFileAtPath(app, f4)).map((f4) => ({ + description: f4, + value: f4, + name: filePathToString(f4) + })), + [] ); - }; - const selectFilter = (e4, i4, k5) => { - const offset2 = e4.target.getBoundingClientRect(); - const { type, field, fType } = filters[i4].filters[k5]; - const _filters = predicateFnsForType(fType, filterFnTypes); - showSelectMenu( - { x: offset2.left, y: offset2.top + 30 }, - { - plugin: props2.plugin, - multi: false, - editable: true, - value: [], - options: _filters.map((f4) => ({ name: filterFnLabels[f4], value: f4 })), - saveOptions: (_12, value) => setDefFilterFn(value[0], i4, k5), - placeholder: i18n_default.labels.contextItemSelectPlaceholder, - searchable: true, - showAll: true + p2(() => { + const allTags = loadTags(props2.plugin).map((f4) => ({ + value: f4, + name: f4 + })); + const allNotes = getAllAbstractFilesInVault( + props2.plugin + ).map((f4) => ({ + name: fileNameToString(f4.name), + description: f4.path, + value: f4.path + })); + setAllItems([...allNotes, ...allTags]); + }, []); + const loadPreview = (path) => { + if (previewPath != path && getAbstractFileAtPath(app, path)) { + setPreviewPath(path); } - ); - }; - const selectField = (e4, i4, k5) => { - const offset2 = e4.target.getBoundingClientRect(); - const allFiles = retrieveAllFiles( - props2.plugin.index.vaultDBCache, - props2.plugin.settings - ); - const frontmatter = allMetadataForFiles( - props2.plugin, - allFiles.map((f5) => getAbstractFileAtPath(app, f5.path)).filter((f5) => f5 instanceof import_obsidian55.TFile) - ); - const fmTypes = guestimateTypes( - allFiles.map((f5) => f5.path), - props2.plugin, - false - ); - const f4 = [ - ...Object.keys(fileMeta).map((f5) => ({ - name: fileMeta[f5].label, - value: "filemeta." + f5 - })), - ...Object.keys(fileProps).map((f5) => ({ - name: fileProps[f5].label, - value: "fileprop." + f5 - })), - ...frontmatter.map((f5) => ({ - name: f5.name, - value: "frontmatter." + fmTypes[f5.name] + "." + f5.name - })) - ]; - showSelectMenu( - { x: offset2.left, y: offset2.top + 30 }, - { + }; + const hoverItem = (item) => { + loadPreview(item); + }; + const selectItem = (item) => { + if (!item) + return; + openPath(props2.plugin, uriByString(item)); + }; + const optionProps = { + multi: false, + editable: true, + plugin: props2.plugin, + onHover: hoverItem, + value: [], + options: allItems, + defaultOptions: defaultOptions4, + saveOptions: (_12, items) => selectItem(items[0]), + placeholder: i18n_default.labels.blinkPlaceholder, + searchable: true, + showAll: true + }; + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(selectMenu_default, { + ref: ref2, + plugin: props2.plugin, + ...optionProps, + hide: props2.hide, + previewComponent: previewPath && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-blink-preview" + }, /* @__PURE__ */ Cn.createElement(FlowView, { plugin: props2.plugin, - multi: false, - editable: false, - value: [], - options: f4, - saveOptions: (_12, value) => setDefFilter(value[0], i4, k5), - placeholder: i18n_default.labels.contextItemSelectPlaceholder, - searchable: true, - showAll: true - } - ); - }; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-query" - }, filters.length == 0 ? /* @__PURE__ */ Cn.createElement(DefFilterGroup, { - selectGroupType, - group: null, - addDefGroup, - selectField, - i: 0, - removeDefGroup - }) : filters.map((f4, i4) => /* @__PURE__ */ Cn.createElement(DefFilterGroup, { - key: i4, - group: f4, - selectGroupType, - addDefGroup, - selectField, - i: i4, - removeDefGroup - }, f4.filters.map((filter, k5) => /* @__PURE__ */ Cn.createElement(DefFilter, { - key: k5, - filter, - i: i4, - k: k5, - selectField, - selectFilter, - selectFilterValue, - removeDefFilter - }))))); -}; -var DefFilter = (props2) => { - var _a2; - const { - filter, - selectField, - selectFilter, - selectFilterValue, - removeDefFilter, - i: i4, - k: k5 - } = props2; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter" - }, /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectField(e4, i4, k5) - }, filter.field.length == 0 ? "Select" : filter.field), filter.field.length > 0 && /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectFilter(e4, i4, k5) - }, !filterFnLabels[filter.fn] ? "Select" : filterFnLabels[filter.fn]), filter.field.length > 0 && filterFnLabels[filter.fn] && ((_a2 = filterFnTypes[filter.fn]) == null ? void 0 : _a2.valueType) != "none" && /* @__PURE__ */ Cn.createElement("span", null, /* @__PURE__ */ Cn.createElement(FilterValueSpan, { - fieldType: filter.fType, - filter, - selectFilterValue: (e4, h5) => selectFilterValue(e4, h5, i4, k5) - })), /* @__PURE__ */ Cn.createElement("span", { - onClick: () => removeDefFilter(k5, i4) - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } - }))); -}; -var DefFilterGroup = (props2) => { - var _a2; - const { - group, - selectGroupType, - addDefGroup, - selectField, - i: i4, - removeDefGroup - } = props2; - return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-query-group" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-query-group-type" - }, /* @__PURE__ */ Cn.createElement("span", { - onClick: (e4) => selectGroupType(e4, i4), - dangerouslySetInnerHTML: { - __html: uiIconSet[`mk-ui-${(_a2 = group == null ? void 0 : group.type) != null ? _a2 : "any"}`] - } - })), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter-bar mk-query-filters" - }, props2.children, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-filter", - onClick: (e4) => { - var _a3; - return selectField(e4, i4, (_a3 = group == null ? void 0 : group.filters.length) != null ? _a3 : 0); + path: previewPath, + load: true + })) + })); + } +); +BlinkComponent.displayName = "BlinkComponent"; +var BlinkComponent_default = BlinkComponent; + +// src/components/Blink/Blink.tsx +var Blink = class extends import_obsidian59.Modal { + constructor(app2, plugin) { + super(app2); + this.ref = Cn.createRef(); + this.plugin = plugin; + this.modalEl.toggleClass("mk-blink-modal", true); + this.modalEl.toggleClass("modal", false); + this.modalEl.toggleClass("prompt", true); + const keys2 = [...this.scope.keys]; + for (let i5 = 0; i5 < keys2.length; i5++) { + if (keys2[i5].key == "Escape") { + this.scope.unregister(keys2[i5]); + this.scope.register([], "Escape", () => { + var _a2; + const blurred = (_a2 = this.ref) == null ? void 0 : _a2.current(); + if (blurred) { + this.close(); + } + }); + } } - }, /* @__PURE__ */ Cn.createElement("span", null, /* @__PURE__ */ Cn.createElement("span", { - className: "mk-icon-xsmall", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-plus"] } - }), "Filter")))); -}; - -// src/components/Sidebar/MainMenu.tsx -var replaceMobileMainMenu = (plugin) => { - if (platformIsMobile()) { - const header = app.workspace.containerEl.querySelector( - ".workspace-drawer.mod-left .workspace-drawer-header-left" - ); - header.empty(); - const reactEl = createRoot(header); - reactEl.render( - /* @__PURE__ */ Cn.createElement(SidebarProvider, { - plugin - }, /* @__PURE__ */ Cn.createElement(MainMenu, { - plugin - })) + this.root = createRoot(this.modalEl); + this.root.render( + /* @__PURE__ */ Cn.createElement(BlinkComponent_default, { + ref: this.ref, + plugin, + hide: () => this.close() + }) ); } }; -var MainMenu = (props2) => { - var _a2, _b2; - const { plugin } = props2; - const { - activeFile, - activeViewSpace, - spaces, - setDragPaths, - saveActiveSpace: setActiveViewSpaceByPath, - waypoints: pinnedSpaces, - activeQuery, - queryMode, - setQueryMode, - setActiveQuery - } = q2(SidebarContext); - const folder = defaultNoteFolder(props2.plugin, activeFile); - const ref2 = _2(); - const inputRef = _2(); - const [queryString, setQueryString] = h2(""); - const [filters, setFilters] = h2([]); - const [hover, setHover] = h2(false); - const queries = F2(() => { - return queryString.length > 0 ? [ - { - type: "any", - trueFalse: true, - filters: [ - { - type: "fileprop", - fType: "text", - field: "name", - fn: "include", - value: queryString - } - ] - }, - ...filters - ] : filters; - }, [queryString, filters]); - p2(() => { - setActiveQuery(queries); - }, [queries]); - const toggleSections = (collapse) => { - const newSections = collapse ? [] : spaces.map((f4) => f4.name); - plugin.settings.expandedSpaces = newSections; - plugin.saveSettings(); - }; - const newFile = async () => { - await createNewMarkdownFile(props2.plugin, folder, "", ""); - }; - p2(() => { - refreshLeafs(); - }, []); - const refreshLeafs = () => { - const leafs = []; - let spaceActive = true; - if (plugin.app.workspace.leftSplit && platformIsMobile()) { - const mobileDrawer = plugin.app.workspace.leftSplit; - const leaves = mobileDrawer.children; - const index = leaves.reduce((p3, c4, i4) => { - return c4.getViewState().type == FILE_TREE_VIEW_TYPE ? i4 : p3; - }, -1); - spaceActive = index == mobileDrawer.currentTab; - leafs.push(...leaves.filter((l3, i4) => i4 != index)); - } - return { leafs, spaceActive }; - }; + +// src/components/FileContexts/ContextExplorer.tsx +init_compat_module(); + +// src/components/Space/Frames/FrameInspector.tsx +init_compat_module(); + +// src/components/Space/Frames/FrameStyler.tsx +init_compat_module(); + +// src/components/Space/Frames/Panels/BorderPanel.tsx +init_compat_module(); + +// src/components/Space/Frames/Setters/ColorSetter.tsx +init_compat_module(); +var ColorPicker2 = (props2) => { const showMenu = (e4) => { - const { spaceActive, leafs } = refreshLeafs(); - const menu = new import_obsidian56.Menu(); - !spaceActive && menu.addItem((menuItem) => { - menuItem.setIcon("lucide-arrow-left"); - menuItem.setTitle(i18n_default.menu.backToSpace); - menuItem.onClick((ev) => { - const leaves = plugin.app.workspace.getLeavesOfType(FILE_TREE_VIEW_TYPE); - if (leaves.length > 0) { - plugin.app.workspace.revealLeaf(leaves[0]); - } - }); - }); - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.home); - menuItem.onClick((ev) => { - setActiveViewSpaceByPath("spaces://$home"); - }); - }); - menu.addItem((menuItem) => { - menuItem.setTitle("Vault"); - menuItem.onClick((ev) => { - setActiveViewSpaceByPath("/"); - }); - }); - menu.addItem((menuItem) => { - menuItem.setTitle(i18n_default.menu.tags); - menuItem.onClick((ev) => { - setActiveViewSpaceByPath("spaces://$tags"); - }); - }); - menu.addItem((menuItem) => { - menuItem.setTitle("All Spaces"); - menuItem.onClick((ev) => { - setActiveViewSpaceByPath("spaces://$all"); - }); - }); - menu.addSeparator(); - menu.addItem((menuItem) => { - menuItem.setIcon("lucide-chevrons-down-up"); - menuItem.setTitle(i18n_default.menu.collapseAllSections); - menuItem.onClick((ev) => { - toggleSections(true); - }); - }); - menu.addItem((menuItem) => { - menuItem.setIcon("lucide-chevrons-up-down"); - menuItem.setTitle(i18n_default.menu.expandAllSections); - menuItem.onClick((ev) => { - toggleSections(false); - }); - }); - menu.addSeparator(); - menu.addItem((menuItem) => { - menuItem.setIcon("eye-off"); - menuItem.setTitle(i18n_default.menu.manageHiddenFiles); - menuItem.onClick((ev) => { - const vaultChangeModal = new HiddenItemsModal(plugin); - vaultChangeModal.open(); - }); - }); - menu.addSeparator(); - leafs.map( - (l3) => menu.addItem((menuItem) => { - menuItem.setIcon(l3.view.icon); - menuItem.setTitle(l3.getDisplayText()); - menuItem.onClick((ev) => { - plugin.app.workspace.revealLeaf(l3); - }); - }) + const handleChangeComplete = (color) => { + props2.setValue(color); + }; + const offset2 = e4.target.getBoundingClientRect(); + showColorPickerMenu( + { x: offset2.left, y: offset2.top + 30 }, + props2.value, + handleChangeComplete ); - menu.addItem((menuItem) => { - menuItem.setIcon("lucide-settings"); - menuItem.setTitle(i18n_default.menu.obSettings); - menuItem.onClick((ev) => { - plugin.app.commands.commands["app:open-settings"].callback(); - }); - }); - menu.addItem((menuItem) => { - menuItem.setIcon("vault"); - menuItem.setTitle(i18n_default.menu.openVault); - menuItem.onClick((ev) => { - plugin.app.commands.commands["app:open-vault"].callback(); - }); - }); - menu.addSeparator(); - menu.addItem((menuItem) => { - menuItem.setIcon("mk-logo"); - menuItem.setTitle(i18n_default.menu.getHelp); - menuItem.onClick((ev) => { - window.open("https://make.md/community"); - }); - }); - const offset2 = ref2.current.getBoundingClientRect(); - menu.showAtPosition({ x: offset2.left, y: offset2.top + 30 }); - }; - const { dragPaths, saveActiveSpace } = q2(SidebarContext); - const onDragOver = (e4) => { - e4.preventDefault(); - if (dragPaths.length == 1) { - setHover(true); - } }; - const dragLeave = () => { - setHover(false); - }; - const onDrop = () => { - if (dragPaths.length == 1) { - saveActiveSpace(dragPaths[0]); - setHover(false); + return /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-setter-color", + onClick: (e4) => showMenu(e4), + style: { + backgroundColor: props2.value, + width: 30, + height: 30 } - }; - const saveQuerySpace = () => { - const vaultChangeModal = new EditSpaceModal(plugin, null, "create", { - type: "smart", - filters: activeQuery - }); - vaultChangeModal.open(); - }; + })); +}; + +// src/components/Space/Frames/Setters/StepSetter.tsx +init_compat_module(); +var StepSetter = (props2) => { return /* @__PURE__ */ Cn.createElement("div", { - className: "mk-flow-bar" - }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-flow-bar-compact" - }, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames7.default)( - "mk-main-menu-container", - queryMode && "mk-hidden" - ) + className: "mk-setter-step" + }, /* @__PURE__ */ Cn.createElement(NumberCell, { + initialValue: props2.value, + saveValue: props2.setValue, + editMode: 2 /* EditModeActive */, + setEditMode: () => null, + plugin: props2.plugin, + propertyValue: "" + }), /* @__PURE__ */ Cn.createElement("span", null, props2.name)); +}; + +// src/components/Space/Frames/Panels/CornersPanel.tsx +init_compat_module(); + +// src/components/Space/Frames/Setters/SliderSetter.tsx +init_compat_module(); +var Slider3 = (props2) => { + const [value, setValue] = h2(props2.value); + return /* @__PURE__ */ Cn.createElement("input", { + className: "mk-setter-slider", + type: "range", + value, + min: 0, + max: 10, + onChange: (e4) => setValue(e4.target.value), + onMouseUp: (e4) => props2.setValue(value) + }); +}; + +// src/components/Space/Frames/Panels/CornersPanel.tsx +var CornersPanel = (props2) => { + var _a2, _b2, _c2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-setter-group" + }, /* @__PURE__ */ Cn.createElement(Slider3, { + value: (_a2 = props2.styles) == null ? void 0 : _a2.borderRadius, + setValue: (value) => props2.saveStyle({ borderRadius: `${value.toString()}` }) + }), (_b2 = props2.styles) == null ? void 0 : _b2.borderRadius, /* @__PURE__ */ Cn.createElement(StepSetter, { + value: (_c2 = props2.styles) == null ? void 0 : _c2.borderRadius, + setValue: (value) => props2.saveStyle({ borderRadius: `${value}` }), + name: "Radius", + plugin: props2.plugin + })); +}; + +// src/components/Space/Frames/Panels/BorderPanel.tsx +var BorderPanel = (props2) => { + var _a2, _b2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-main-menu-button", - ref: ref2, - onClick: (e4) => showMenu(e4), - onDragLeave: () => dragLeave(), - onDragOver: (e4) => onDragOver(e4), - onDrop: () => onDrop() - }, activeViewSpace ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames7.default)( - "mk-waypoints-item", - hover && "is-active" - ), - dangerouslySetInnerHTML: { - __html: ((_b2 = (_a2 = activeViewSpace == null ? void 0 : activeViewSpace.metadata) == null ? void 0 : _a2.sticker) == null ? void 0 : _b2.length) > 0 ? stickerFromString( - activeViewSpace.metadata.sticker, - props2.plugin - ) : "F" - }, - draggable: true, - onDragStart: () => setDragPaths([activeViewSpace.path]) - }), activeViewSpace.alias) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-expand"] } - })), /* @__PURE__ */ Cn.createElement("div", { - className: "mk-inline-button", - onClick: () => setQueryMode((p3) => !p3) + className: "mk-file-context-title" + }, "Border"), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-component" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-small", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-search"] } + className: "mk-setter-group" + }, /* @__PURE__ */ Cn.createElement(ColorPicker2, { + value: removeQuotes((_a2 = props2.styles) == null ? void 0 : _a2.borderColor), + setValue: (value) => props2.saveStyle({ borderColor: wrapQuotes(value) }) + }), /* @__PURE__ */ Cn.createElement(StepSetter, { + value: (_b2 = props2.styles) == null ? void 0 : _b2.borderWidth, + setValue: (value) => props2.saveStyle({ borderWidth: `${value}` }), + name: "Width", + plugin: props2.plugin }))), /* @__PURE__ */ Cn.createElement("div", { - className: (0, import_classnames7.default)( - "mk-main-menu-search", - !queryMode && "mk-hidden" - ) + className: "mk-file-context-title" + }, "Corners"), /* @__PURE__ */ Cn.createElement(CornersPanel, { + ...props2 + })); +}; + +// src/components/Space/Frames/Panels/ColorPanel.tsx +init_compat_module(); + +// src/components/Space/Frames/Setters/TextSetter.tsx +init_compat_module(); +var TextSetter = (props2) => { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-setter-text" + }, /* @__PURE__ */ Cn.createElement(TextCell, { + initialValue: props2.value, + saveValue: props2.setValue, + editMode: 2 /* EditModeActive */, + setEditMode: () => null, + plugin: props2.plugin, + propertyValue: "" + }), /* @__PURE__ */ Cn.createElement("span", null, props2.name)); +}; + +// src/components/Space/Frames/Panels/ColorPanel.tsx +var ColorPanel = (props2) => { + var _a2, _b2, _c2, _d2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" }, /* @__PURE__ */ Cn.createElement("div", { - "aria-label": i18n_default.buttons.blink, - className: "mk-inline-button", - onClick: () => setQueryMode((p3) => !p3) + className: "mk-file-context-title" + }, "Color"), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-component" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-small", - dangerouslySetInnerHTML: { __html: lucideIcon("arrow-left") } - })), /* @__PURE__ */ Cn.createElement("input", { - onClick: (e4) => e4.stopPropagation(), - className: "mk-cell-text", - ref: inputRef, - type: "text", - value: queryString, - onChange: (e4) => setQueryString(e4.target.value) - }), /* @__PURE__ */ Cn.createElement("div", { - "aria-label": i18n_default.buttons.blink, - className: "mk-inline-button", - onClick: () => saveQuerySpace() + className: "mk-setter-group" + }, /* @__PURE__ */ Cn.createElement(ColorPicker2, { + value: removeQuotes((_a2 = props2.styles) == null ? void 0 : _a2.color), + setValue: (value) => props2.saveStyle({ color: wrapQuotes(value) }) + }), /* @__PURE__ */ Cn.createElement(TextSetter, { + value: (_b2 = props2.styles) == null ? void 0 : _b2.color, + setValue: (value) => props2.saveStyle({ color: value.toString() }), + plugin: props2.plugin, + name: "HEX" + })), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-title" + }, "Background"), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-setter-group" + }, /* @__PURE__ */ Cn.createElement(ColorPicker2, { + value: removeQuotes((_c2 = props2.styles) == null ? void 0 : _c2.backgroundColor), + setValue: (value) => props2.saveStyle({ backgroundColor: wrapQuotes(value) }) + }), /* @__PURE__ */ Cn.createElement(TextSetter, { + value: (_d2 = props2.styles) == null ? void 0 : _d2.color, + setValue: (value) => props2.saveStyle({ color: value.toString() }), + plugin: props2.plugin, + name: "HEX" + })))); +}; + +// src/components/Space/Frames/Panels/LayoutPanel.tsx +init_compat_module(); + +// src/components/Space/Frames/Setters/RadioGroupSetter.tsx +init_compat_module(); +var RadioGroup = (props2) => { + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-radio-group" + }, props2.options.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, + onClick: () => props2.setValue(f4.value) + }, /* @__PURE__ */ Cn.createElement(Sticker, { + sticker: f4.icon, + plugin: props2.plugin + })))); +}; + +// src/components/Space/Frames/Panels/LayoutPanel.tsx +var LayoutPanel = (props2) => { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o; + const { selectedNodes } = q2(FramesEditorContext); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-small", - dangerouslySetInnerHTML: { __html: lucideIcon("save") } - }))), /* @__PURE__ */ Cn.createElement("div", { - "aria-label": i18n_default.buttons.newNote, - className: "mk-inline-button", - onClick: (e4) => triggerSectionAddMenu(props2.plugin, e4, activeViewSpace, activeFile) + className: "mk-file-context-title" + }, /* @__PURE__ */ Cn.createElement("span", null, "Layout")), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-component" }, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-icon-small", - dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-new-note"] } - }))), queryMode && /* @__PURE__ */ Cn.createElement(SpaceQuery, { - plugin, - filters, - setFilters - })); + className: "mk-file-context-subtitle" + }, /* @__PURE__ */ Cn.createElement("span", null, "Element")), stringIsConst((_a2 = props2.styles) == null ? void 0 : _a2.as) ? /* @__PURE__ */ Cn.createElement(RadioGroup, { + name: "Name", + plugin: props2.plugin, + value: (_b2 = props2.styles) == null ? void 0 : _b2.as, + options: [ + { label: "div", value: "div", icon: "lucide//square" }, + { label: "button", value: "button", icon: "lucide//inspect" }, + { label: "input", value: "input", icon: "i" } + ], + setValue: (value) => props2.saveStyle({ as: `"${value}"` }) + }) : /* @__PURE__ */ Cn.createElement(CodeEditorSetter, { + name: "as", + node: selectedNodes[0].id, + type: "styles", + value: (_c2 = props2.styles) == null ? void 0 : _c2.as, + editCode: props2.editCode + })), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-subtitle" + }, /* @__PURE__ */ Cn.createElement("span", null, "Layout")), stringIsConst((_d2 = props2.styles) == null ? void 0 : _d2.layout) ? /* @__PURE__ */ Cn.createElement(RadioGroup, { + name: "Display", + plugin: props2.plugin, + value: (_e2 = props2.styles) == null ? void 0 : _e2.layout, + options: [ + { + label: "hidden", + value: `"none"`, + icon: "lucide//eye-off" + }, + { + label: "horizontal", + value: `"row"`, + icon: "lucide//align-justify" + }, + { + label: "vertical", + value: `"column"`, + icon: "lucide//columns" + }, + { + label: "custom", + value: `"custom"`, + icon: "lucide//square-stack" + } + ], + setValue: (value) => props2.saveStyle({ layout: `${value}` }) + }) : /* @__PURE__ */ Cn.createElement(CodeEditorSetter, { + name: "as", + node: selectedNodes[0].id, + type: "styles", + value: (_f = props2.styles) == null ? void 0 : _f.layout, + editCode: props2.editCode + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-subtitle" + }, /* @__PURE__ */ Cn.createElement("span", null, "Alignment")), stringIsConst((_g = props2.styles) == null ? void 0 : _g.alignItems) ? /* @__PURE__ */ Cn.createElement(RadioGroup, { + name: "Alignment", + plugin: props2.plugin, + value: (_h = props2.styles) == null ? void 0 : _h.alignItems, + options: [ + { + label: "left", + value: "flex-start", + icon: "lucide//align-horizontal-justify-start" + }, + { + label: "center", + value: "center", + icon: "lucide//align-horizontal-justify-center" + }, + { + label: "right", + value: "flex-end", + icon: "lucide//align-horizontal-justify-end" + } + ], + setValue: (value) => props2.saveStyle({ alignItems: `"${value}"` }) + }) : /* @__PURE__ */ Cn.createElement(CodeEditorSetter, { + name: "as", + node: selectedNodes[0].id, + type: "styles", + value: (_i = props2.styles) == null ? void 0 : _i.alignItems, + editCode: props2.editCode + }), /* @__PURE__ */ Cn.createElement(RadioGroup, { + name: "Alignment 2", + plugin: props2.plugin, + value: (_j = props2.styles) == null ? void 0 : _j.justifyContent, + options: [ + { + label: "left", + value: "flex-start", + icon: "lucide//align-horizontal-justify-start" + }, + { + label: "center", + value: "center", + icon: "lucide//align-horizontal-justify-center" + }, + { + label: "right", + value: "flex-end", + icon: "lucide//align-horizontal-justify-end" + } + ], + setValue: (value) => props2.saveStyle({ justifyContent: `"${value}"` }) + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-setter-group" + }, /* @__PURE__ */ Cn.createElement(StepSetter, { + value: (_k = props2.styles) == null ? void 0 : _k.margin, + setValue: (value) => props2.saveStyle({ margin: value }), + plugin: props2.plugin, + name: "Margin" + }), /* @__PURE__ */ Cn.createElement(StepSetter, { + value: (_l = props2.styles) == null ? void 0 : _l.padding, + setValue: (value) => props2.saveStyle({ padding: value }), + plugin: props2.plugin, + name: "Padding" + })), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-setter-group" + }, /* @__PURE__ */ Cn.createElement(StepSetter, { + value: (_m = props2.styles) == null ? void 0 : _m.gap, + setValue: (value) => props2.saveStyle({ gap: value }), + plugin: props2.plugin, + name: "Gap" + })), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-setter-group" + }, /* @__PURE__ */ Cn.createElement(StepSetter, { + value: (_n2 = props2.styles) == null ? void 0 : _n2.width, + setValue: (value) => props2.saveStyle({ width: value }), + plugin: props2.plugin, + name: "Width" + }), /* @__PURE__ */ Cn.createElement(StepSetter, { + value: (_o = props2.styles) == null ? void 0 : _o.height, + setValue: (value) => props2.saveStyle({ height: value }), + plugin: props2.plugin, + name: "Height" + }))); }; -// src/components/Sidebar/SpaceSwitcher/SpaceSwitcher.tsx -init_compat_module(); +// src/components/Space/Frames/Panels/TypographyPanel.tsx init_compat_module(); -// src/components/Sidebar/SpaceSwitcher/PinnedSpace.tsx -var import_classnames8 = __toESM(require_classnames()); +// src/utils/fonts.ts +function listFonts() { + const { fonts } = document; + const it = fonts.entries(); + const arr = []; + let done = false; + while (!done) { + const font = it.next(); + if (!font.done) { + arr.push(font.value[0].family); + } else { + done = font.done; + } + } + return Array.from(new Set(arr)); +} + +// src/components/Space/Frames/Setters/OptionsSetter.tsx init_compat_module(); -var animateLayoutChanges3 = ({ - isSorting, - wasDragging -}) => isSorting || wasDragging ? false : true; -var SortablePinnedSpaceItem = ({ - id: id2, - index, - ...props2 -}) => { - const { - attributes, - isDragging, - isSorting, - listeners, - setNodeRef, - transform, - transition - } = useSortable({ - id: id2, - animateLayoutChanges: animateLayoutChanges3 +var OptionSetter = (props2) => { + const viewProps = { + initialValue: props2.value, + saveValue: props2.saveValue, + editMode: 3, + setEditMode: () => { + }, + plugin: props2.plugin + }; + return /* @__PURE__ */ Cn.createElement(OptionCell, { + ...viewProps, + options: props2.options.join(","), + multi: false, + saveOptions: (_12, value) => props2.saveValue(value) }); - const memoListeners = F2(() => { - return { - ...attributes, - ...listeners +}; + +// src/components/Space/Frames/Panels/TypographyPanel.tsx +var TypographyPanel = (props2) => { + var _a2, _b2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-title" + }, "Typography"), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-component" + }, /* @__PURE__ */ Cn.createElement(OptionSetter, { + value: "", + options: listFonts(), + plugin: props2.plugin, + saveValue: (value) => props2.saveStyle({ fontFamily: `"${value}"` }) + }), /* @__PURE__ */ Cn.createElement(RadioGroup, { + plugin: props2.plugin, + name: "Alignment", + value: (_a2 = props2.styles) == null ? void 0 : _a2.textAlign, + options: [ + { label: "left", value: "left", icon: "lucide//align-left" }, + { label: "center", value: "center", icon: "lucide//align-center" }, + { label: "right", value: "right", icon: "lucide//align-right" } + ], + setValue: (value) => props2.saveStyle({ textAlign: `"${value}"` }) + }), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-row" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field" + }, "Size"), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-value" + }, /* @__PURE__ */ Cn.createElement(TextCell, { + initialValue: (_b2 = props2.styles) == null ? void 0 : _b2.fontSize, + saveValue: (value) => props2.saveStyle({ fontSize: value }), + editMode: 2 /* EditModeActive */, + setEditMode: () => null, + plugin: props2.plugin, + propertyValue: "" + }))))); +}; + +// src/components/Space/Frames/FrameStyler.tsx +var FrameStyler = (props2) => { + const { + selectedNodes, + nodes, + saveNodes: saveFrames, + root: root2, + saveProperty + } = q2(FramesEditorContext); + const { frameSchema } = q2(FramesMDBContext); + const [tab, setTab] = h2(0); + const saveStyleValues = (values) => { + const newNodes = selectedNodes.map((f4) => ({ + ...f4, + styles: mergePropObjects(f4.styles, values) + })); + saveFrames(newNodes); + }; + const saveContexts = (values) => { + const newNodes = selectedNodes.map((f4) => ({ + ...f4, + contexts: { + ...f4.contexts, + ...values + } + })); + saveFrames(newNodes); + }; + const savePropsValue = (values) => { + const newNodes = selectedNodes.map((f4) => ({ + ...f4, + props: mergePropObjects(f4.props, values) + })); + saveFrames(newNodes); + }; + return (frameSchema == null ? void 0 : frameSchema.type) != "frame" || !root2 ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null) : /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-menu" + }, selectedNodes.length > 0 && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(LayoutPanel, { + styles: selectedNodes[0].styles, + saveStyle: saveStyleValues, + plugin: props2.plugin, + editCode: props2.editCode + }), /* @__PURE__ */ Cn.createElement(TypographyPanel, { + styles: selectedNodes[0].styles, + saveStyle: saveStyleValues, + plugin: props2.plugin + }), /* @__PURE__ */ Cn.createElement(ColorPanel, { + styles: selectedNodes[0].styles, + saveStyle: saveStyleValues, + plugin: props2.plugin + }), /* @__PURE__ */ Cn.createElement(BorderPanel, { + styles: selectedNodes[0].styles, + saveStyle: saveStyleValues, + plugin: props2.plugin + }))); +}; + +// node_modules/@lezer/common/dist/index.js +var DefaultBufferLength = 1024; +var nextPropID = 0; +var Range = class { + constructor(from, to) { + this.from = from; + this.to = to; + } +}; +var NodeProp = class { + constructor(config = {}) { + this.id = nextPropID++; + this.perNode = !!config.perNode; + this.deserialize = config.deserialize || (() => { + throw new Error("This node type doesn't define a deserialize function"); + }); + } + add(match2) { + if (this.perNode) + throw new RangeError("Can't add per-node props to node types"); + if (typeof match2 != "function") + match2 = NodeType.match(match2); + return (type) => { + let result = match2(type); + return result === void 0 ? null : [this, result]; }; - }, [isSorting]); - return /* @__PURE__ */ Cn.createElement(PinnedSpace, { - index, - ref: setNodeRef, - handleProps: memoListeners, - ...props2 - }); + } }; -var PinnedSpace = k3( - ({ - pin, - handleProps, - indicator, - highlighted, - plugin, - style, - clone: clone2, - ghost, - dragStart, - dragOver, - dragEnded, - index - }, ref2) => { - var _a2; - const innerRef = _2(null); - const { setDragPaths, activeViewSpace, activeFile, saveActiveSpace } = q2(SidebarContext); - const onDragStarted = (e4) => { - if (dragStart && pin) { - dragStart(index); - setDragPaths([pin.path]); +NodeProp.closedBy = new NodeProp({ deserialize: (str) => str.split(" ") }); +NodeProp.openedBy = new NodeProp({ deserialize: (str) => str.split(" ") }); +NodeProp.group = new NodeProp({ deserialize: (str) => str.split(" ") }); +NodeProp.contextHash = new NodeProp({ perNode: true }); +NodeProp.lookAhead = new NodeProp({ perNode: true }); +NodeProp.mounted = new NodeProp({ perNode: true }); +var noProps = /* @__PURE__ */ Object.create(null); +var NodeType = class { + constructor(name2, props2, id3, flags = 0) { + this.name = name2; + this.props = props2; + this.id = id3; + this.flags = flags; + } + static define(spec) { + let props2 = spec.props && spec.props.length ? /* @__PURE__ */ Object.create(null) : noProps; + let flags = (spec.top ? 1 : 0) | (spec.skipped ? 2 : 0) | (spec.error ? 4 : 0) | (spec.name == null ? 8 : 0); + let type = new NodeType(spec.name || "", props2, spec.id, flags); + if (spec.props) + for (let src of spec.props) { + if (!Array.isArray(src)) + src = src(type); + if (src) { + if (src[0].perNode) + throw new RangeError("Can't store a per-node prop on a node type"); + props2[src[0].id] = src[1]; + } } - }; - const onDragEnded = (e4) => { - if (dragEnded) { - dragEnded(); + return type; + } + prop(prop) { + return this.props[prop.id]; + } + get isTop() { + return (this.flags & 1) > 0; + } + get isSkipped() { + return (this.flags & 2) > 0; + } + get isError() { + return (this.flags & 4) > 0; + } + get isAnonymous() { + return (this.flags & 8) > 0; + } + is(name2) { + if (typeof name2 == "string") { + if (this.name == name2) + return true; + let group = this.prop(NodeProp.group); + return group ? group.indexOf(name2) > -1 : false; + } + return this.id == name2; + } + static match(map2) { + let direct = /* @__PURE__ */ Object.create(null); + for (let prop in map2) + for (let name2 of prop.split(" ")) + direct[name2] = map2[prop]; + return (node) => { + for (let groups = node.prop(NodeProp.group), i5 = -1; i5 < (groups ? groups.length : 0); i5++) { + let found = direct[i5 < 0 ? node.name : groups[i5]]; + if (found) + return found; } }; - const innerProps = !platformIsMobile() ? { - draggable: true, - onDragStart: onDragStarted, - onDrop: onDragEnded - } : handleProps; - return /* @__PURE__ */ Cn.createElement("div", { - ref: innerRef, - className: "mk-waypoint", - onClick: () => saveActiveSpace(pin.path), - onContextMenu: (e4) => triggerSpaceMenu(plugin, pin, e4, activeFile, null), - onDragOver: (e4) => { - e4.preventDefault(); - if (!innerRef.current) + } +}; +NodeType.none = new NodeType("", /* @__PURE__ */ Object.create(null), 0, 8); +var NodeSet = class { + constructor(types2) { + this.types = types2; + for (let i5 = 0; i5 < types2.length; i5++) + if (types2[i5].id != i5) + throw new RangeError("Node type ids should correspond to array positions when creating a node set"); + } + extend(...props2) { + let newTypes = []; + for (let type of this.types) { + let newProps = null; + for (let source of props2) { + let add2 = source(type); + if (add2) { + if (!newProps) + newProps = Object.assign({}, type.props); + newProps[add2[0].id] = add2[1]; + } + } + newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type); + } + return new NodeSet(newTypes); + } +}; +var CachedNode = /* @__PURE__ */ new WeakMap(); +var CachedInnerNode = /* @__PURE__ */ new WeakMap(); +var IterMode; +(function(IterMode2) { + IterMode2[IterMode2["ExcludeBuffers"] = 1] = "ExcludeBuffers"; + IterMode2[IterMode2["IncludeAnonymous"] = 2] = "IncludeAnonymous"; + IterMode2[IterMode2["IgnoreMounts"] = 4] = "IgnoreMounts"; + IterMode2[IterMode2["IgnoreOverlays"] = 8] = "IgnoreOverlays"; +})(IterMode || (IterMode = {})); +var Tree = class { + constructor(type, children, positions, length, props2) { + this.type = type; + this.children = children; + this.positions = positions; + this.length = length; + this.props = null; + if (props2 && props2.length) { + this.props = /* @__PURE__ */ Object.create(null); + for (let [prop, value] of props2) + this.props[typeof prop == "number" ? prop : prop.id] = value; + } + } + toString() { + let mounted = this.prop(NodeProp.mounted); + if (mounted && !mounted.overlay) + return mounted.tree.toString(); + let children = ""; + for (let ch of this.children) { + let str = ch.toString(); + if (str) { + if (children) + children += ","; + children += str; + } + } + return !this.type.name ? children : (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (children.length ? "(" + children + ")" : ""); + } + cursor(mode = 0) { + return new TreeCursor(this.topNode, mode); + } + cursorAt(pos, side = 0, mode = 0) { + let scope = CachedNode.get(this) || this.topNode; + let cursor = new TreeCursor(scope); + cursor.moveTo(pos, side); + CachedNode.set(this, cursor._tree); + return cursor; + } + get topNode() { + return new TreeNode6(this, 0, 0, null); + } + resolve(pos, side = 0) { + let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false); + CachedNode.set(this, node); + return node; + } + resolveInner(pos, side = 0) { + let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true); + CachedInnerNode.set(this, node); + return node; + } + iterate(spec) { + let { enter, leave, from = 0, to = this.length } = spec; + for (let c4 = this.cursor((spec.mode || 0) | IterMode.IncludeAnonymous); ; ) { + let entered = false; + if (c4.from <= to && c4.to >= from && (c4.type.isAnonymous || enter(c4) !== false)) { + if (c4.firstChild()) + continue; + entered = true; + } + for (; ; ) { + if (entered && leave && !c4.type.isAnonymous) + leave(c4); + if (c4.nextSibling()) + break; + if (!c4.parent()) return; - const rect = innerRef.current.getBoundingClientRect(); - const x5 = e4.clientX - rect.left; - if (dragOver) - dragOver(index, x5); - }, - ...innerProps - }, /* @__PURE__ */ Cn.createElement("div", { - ref: ref2, - className: (0, import_classnames8.default)( - "mk-waypoints-item", - "clickable-icon", - "nav-action-button", - (activeViewSpace == null ? void 0 : activeViewSpace.path) == (pin == null ? void 0 : pin.path) && "mk-active", - highlighted && "mk-active", - indicator && "mk-indicator", - clone2 && "mk-clone", - ghost && "mk-ghost" - ), - dangerouslySetInnerHTML: ((_a2 = pin == null ? void 0 : pin.metadata.sticker) == null ? void 0 : _a2.length) > 0 ? { - __html: stickerFromString(pin.metadata.sticker, plugin) - } : null, - style: { - ...style, - ...{ pointerEvents: "none" } + entered = true; } - }, pin == null ? void 0 : pin.name.substring(0, 1))); + } } -); -PinnedSpace.displayName = "PinnedSpace"; - -// src/components/Sidebar/SpaceSwitcher/SpaceSwitcher.tsx -var SpaceSwitcher = (props2) => { - const { activeFile, waypoints } = q2(SidebarContext); - const folder = defaultNoteFolder(props2.plugin, activeFile); - const { plugin } = props2; - const newFile = async () => { - await createNewMarkdownFile(props2.plugin, folder, "", ""); - }; - const { dragPaths } = q2(SidebarContext); - const [activeId, setActiveId] = h2(null); - const [overId, setOverId] = h2(null); - const dragCounter = _2(0); - const [offset2, setOffset] = h2(0); - const [projected, setProjected] = h2(null); - const [dropPlaceholder, setDragPlaceholder] = h2(null); - p2(() => { - if (overId === null || dragPaths.length == 0) { - setProjected(null); - return; + prop(prop) { + return !prop.perNode ? this.type.prop(prop) : this.props ? this.props[prop.id] : void 0; + } + get propValues() { + let result = []; + if (this.props) + for (let id3 in this.props) + result.push([+id3, this.props[id3]]); + return result; + } + balance(config = {}) { + return this.children.length <= 8 ? this : balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length))); + } + static build(data2) { + return buildTree(data2); + } +}; +Tree.empty = new Tree(NodeType.none, [], [], 0); +var FlatBufferCursor = class { + constructor(buffer, index) { + this.buffer = buffer; + this.index = index; + } + get id() { + return this.buffer[this.index - 4]; + } + get start() { + return this.buffer[this.index - 3]; + } + get end() { + return this.buffer[this.index - 2]; + } + get size() { + return this.buffer[this.index - 1]; + } + get pos() { + return this.index; + } + next() { + this.index -= 4; + } + fork() { + return new FlatBufferCursor(this.buffer, this.index); + } +}; +var TreeBuffer = class { + constructor(buffer, length, set) { + this.buffer = buffer; + this.length = length; + this.set = set; + } + get type() { + return NodeType.none; + } + toString() { + let result = []; + for (let index = 0; index < this.buffer.length; ) { + result.push(this.childString(index)); + index = this.buffer[index + 3]; + } + return result.join(","); + } + childString(index) { + let id3 = this.buffer[index], endIndex = this.buffer[index + 3]; + let type = this.set.types[id3], result = type.name; + if (/\W/.test(result) && !type.isError) + result = JSON.stringify(result); + index += 4; + if (endIndex == index) + return result; + let children = []; + while (index < endIndex) { + children.push(this.childString(index)); + index = this.buffer[index + 3]; + } + return result + "(" + children.join(",") + ")"; + } + findChild(startIndex, endIndex, dir, pos, side) { + let { buffer } = this, pick = -1; + for (let i5 = startIndex; i5 != endIndex; i5 = buffer[i5 + 3]) { + if (checkSide(side, pos, buffer[i5 + 1], buffer[i5 + 2])) { + pick = i5; + if (dir > 0) + break; + } } - const waypoint = waypoints[overId]; - const dropableTypes = droppableTypesForSpace(waypoint.type); - if (dragPaths.length > 1) { - const droppable = dragPaths.map((f4) => uriByString(f4)).filter((f4) => dropableTypes.some((g4) => g4 == f4.type)); - if (droppable.length > 0) { - const _projected = { - depth: 0, - overId, - parentId: null, - sortable: false, - insert: offset2 > 20, - droppable: true - }; - setProjected(_projected); - return; - } else { + return pick; + } + slice(startI, endI, from) { + let b4 = this.buffer; + let copy = new Uint16Array(endI - startI), len = 0; + for (let i5 = startI, j4 = 0; i5 < endI; ) { + copy[j4++] = b4[i5++]; + copy[j4++] = b4[i5++] - from; + let to = copy[j4++] = b4[i5++] - from; + copy[j4++] = b4[i5++] - startI; + len = Math.max(len, to); + } + return new TreeBuffer(copy, len, this.set); + } +}; +function checkSide(side, pos, from, to) { + switch (side) { + case -2: + return from < pos; + case -1: + return to >= pos && from < pos; + case 0: + return from < pos && to > pos; + case 1: + return from <= pos && to > pos; + case 2: + return to > pos; + case 4: + return true; + } +} +function enterUnfinishedNodesBefore(node, pos) { + let scan = node.childBefore(pos); + while (scan) { + let last = scan.lastChild; + if (!last || last.to != scan.to) + break; + if (last.type.isError && last.from == last.to) { + node = scan; + scan = last.prevSibling; + } else { + scan = last; + } + } + return node; +} +function resolveNode(node, pos, side, overlays) { + var _a2; + while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) { + let parent = !overlays && node instanceof TreeNode6 && node.index < 0 ? null : node.parent; + if (!parent) + return node; + node = parent; + } + let mode = overlays ? 0 : IterMode.IgnoreOverlays; + if (overlays) + for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) { + if (scan instanceof TreeNode6 && scan.index < 0 && ((_a2 = parent.enter(pos, side, mode)) === null || _a2 === void 0 ? void 0 : _a2.from) != scan.from) + node = parent; + } + for (; ; ) { + let inner = node.enter(pos, side, mode); + if (!inner) + return node; + node = inner; + } +} +var TreeNode6 = class { + constructor(_tree, from, index, _parent) { + this._tree = _tree; + this.from = from; + this.index = index; + this._parent = _parent; + } + get type() { + return this._tree.type; + } + get name() { + return this._tree.type.name; + } + get to() { + return this.from + this._tree.length; + } + nextChild(i5, dir, pos, side, mode = 0) { + for (let parent = this; ; ) { + for (let { children, positions } = parent._tree, e4 = dir > 0 ? children.length : -1; i5 != e4; i5 += dir) { + let next = children[i5], start = positions[i5] + parent.from; + if (!checkSide(side, pos, start, start + next.length)) + continue; + if (next instanceof TreeBuffer) { + if (mode & IterMode.ExcludeBuffers) + continue; + let index = next.findChild(0, next.buffer.length, dir, pos - start, side); + if (index > -1) + return new BufferNode(new BufferContext(parent, next, i5, start), null, index); + } else if (mode & IterMode.IncludeAnonymous || (!next.type.isAnonymous || hasChild(next))) { + let mounted; + if (!(mode & IterMode.IgnoreMounts) && next.props && (mounted = next.prop(NodeProp.mounted)) && !mounted.overlay) + return new TreeNode6(mounted.tree, start, i5, parent); + let inner = new TreeNode6(next, start, i5, parent); + return mode & IterMode.IncludeAnonymous || !inner.type.isAnonymous ? inner : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, pos, side); + } + } + if (mode & IterMode.IncludeAnonymous || !parent.type.isAnonymous) + return null; + if (parent.index >= 0) + i5 = parent.index + dir; + else + i5 = dir < 0 ? -1 : parent._parent._tree.children.length; + parent = parent._parent; + if (!parent) return null; + } + } + get firstChild() { + return this.nextChild(0, 1, 0, 4); + } + get lastChild() { + return this.nextChild(this._tree.children.length - 1, -1, 0, 4); + } + childAfter(pos) { + return this.nextChild(0, 1, pos, 2); + } + childBefore(pos) { + return this.nextChild(this._tree.children.length - 1, -1, pos, -2); + } + enter(pos, side, mode = 0) { + let mounted; + if (!(mode & IterMode.IgnoreOverlays) && (mounted = this._tree.prop(NodeProp.mounted)) && mounted.overlay) { + let rPos = pos - this.from; + for (let { from, to } of mounted.overlay) { + if ((side > 0 ? from <= rPos : from < rPos) && (side < 0 ? to >= rPos : to > rPos)) + return new TreeNode6(mounted.tree, mounted.overlay[0].from + this.from, -1, this); } + } + return this.nextChild(0, 1, pos, side, mode); + } + nextSignificantParent() { + let val = this; + while (val.type.isAnonymous && val._parent) + val = val._parent; + return val; + } + get parent() { + return this._parent ? this._parent.nextSignificantParent() : null; + } + get nextSibling() { + return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4) : null; + } + get prevSibling() { + return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4) : null; + } + cursor(mode = 0) { + return new TreeCursor(this, mode); + } + get tree() { + return this._tree; + } + toTree() { + return this._tree; + } + resolve(pos, side = 0) { + return resolveNode(this, pos, side, false); + } + resolveInner(pos, side = 0) { + return resolveNode(this, pos, side, true); + } + enterUnfinishedNodesBefore(pos) { + return enterUnfinishedNodesBefore(this, pos); + } + getChild(type, before = null, after = null) { + let r3 = getChildren(this, type, before, after); + return r3.length ? r3[0] : null; + } + getChildren(type, before = null, after = null) { + return getChildren(this, type, before, after); + } + toString() { + return this._tree.toString(); + } + get node() { + return this; + } + matchContext(context) { + return matchNodeContext(this, context); + } +}; +function getChildren(node, type, before, after) { + let cur = node.cursor(), result = []; + if (!cur.firstChild()) + return result; + if (before != null) { + while (!cur.type.is(before)) + if (!cur.nextSibling()) + return result; + } + for (; ; ) { + if (after != null && cur.type.is(after)) + return result; + if (cur.type.is(type)) + result.push(cur.node); + if (!cur.nextSibling()) + return after == null ? result : []; + } +} +function matchNodeContext(node, context, i5 = context.length - 1) { + for (let p3 = node.parent; i5 >= 0; p3 = p3.parent) { + if (!p3) + return false; + if (!p3.type.isAnonymous) { + if (context[i5] && context[i5] != p3.name) + return false; + i5--; + } + } + return true; +} +var BufferContext = class { + constructor(parent, buffer, index, start) { + this.parent = parent; + this.buffer = buffer; + this.index = index; + this.start = start; + } +}; +var BufferNode = class { + get name() { + return this.type.name; + } + get from() { + return this.context.start + this.context.buffer.buffer[this.index + 1]; + } + get to() { + return this.context.start + this.context.buffer.buffer[this.index + 2]; + } + constructor(context, _parent, index) { + this.context = context; + this._parent = _parent; + this.index = index; + this.type = context.buffer.set.types[context.buffer.buffer[index]]; + } + child(dir, pos, side) { + let { buffer } = this.context; + let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side); + return index < 0 ? null : new BufferNode(this.context, this, index); + } + get firstChild() { + return this.child(1, 0, 4); + } + get lastChild() { + return this.child(-1, 0, 4); + } + childAfter(pos) { + return this.child(1, pos, 2); + } + childBefore(pos) { + return this.child(-1, pos, -2); + } + enter(pos, side, mode = 0) { + if (mode & IterMode.ExcludeBuffers) + return null; + let { buffer } = this.context; + let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side); + return index < 0 ? null : new BufferNode(this.context, this, index); + } + get parent() { + return this._parent || this.context.parent.nextSignificantParent(); + } + externalSibling(dir) { + return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4); + } + get nextSibling() { + let { buffer } = this.context; + let after = buffer.buffer[this.index + 3]; + if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length)) + return new BufferNode(this.context, this._parent, after); + return this.externalSibling(1); + } + get prevSibling() { + let { buffer } = this.context; + let parentStart = this._parent ? this._parent.index + 4 : 0; + if (this.index == parentStart) + return this.externalSibling(-1); + return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4)); + } + cursor(mode = 0) { + return new TreeCursor(this, mode); + } + get tree() { + return null; + } + toTree() { + let children = [], positions = []; + let { buffer } = this.context; + let startI = this.index + 4, endI = buffer.buffer[this.index + 3]; + if (endI > startI) { + let from = buffer.buffer[this.index + 1]; + children.push(buffer.slice(startI, endI, from)); + positions.push(0); + } + return new Tree(this.type, children, positions, this.to - this.from); + } + resolve(pos, side = 0) { + return resolveNode(this, pos, side, false); + } + resolveInner(pos, side = 0) { + return resolveNode(this, pos, side, true); + } + enterUnfinishedNodesBefore(pos) { + return enterUnfinishedNodesBefore(this, pos); + } + toString() { + return this.context.buffer.childString(this.index); + } + getChild(type, before = null, after = null) { + let r3 = getChildren(this, type, before, after); + return r3.length ? r3[0] : null; + } + getChildren(type, before = null, after = null) { + return getChildren(this, type, before, after); + } + get node() { + return this; + } + matchContext(context) { + return matchNodeContext(this, context); + } +}; +var TreeCursor = class { + get name() { + return this.type.name; + } + constructor(node, mode = 0) { + this.mode = mode; + this.buffer = null; + this.stack = []; + this.index = 0; + this.bufferNode = null; + if (node instanceof TreeNode6) { + this.yieldNode(node); } else { - const path = uriByString(dragPaths[0]); - const droppable = dropableTypes.some((f4) => path.type == f4); - const _projected = { - depth: 0, - overId, - parentId: null, - sortable: false, - insert: offset2 > 20, - droppable - }; - setProjected(_projected); + this._tree = node.context.parent; + this.buffer = node.context; + for (let n2 = node._parent; n2; n2 = n2._parent) + this.stack.unshift(n2.index); + this.bufferNode = node; + this.yieldBuf(node.index); } - }, [overId, dragPaths, offset2]); - const resetState = () => { - setOverId(null); - setActiveId(null); - setProjected(null); - setOffset(0); - dragCounter.current = 0; - }; - const handleDragCancel = () => { - resetState(); - }; - const dragEnter = () => { - dragCounter.current++; - }; - const dragLeave = () => { - dragCounter.current--; - if (dragCounter.current == 0) { - setOverId(null); - setProjected(null); - setOffset(0); - dragCounter.current = 0; + } + yieldNode(node) { + if (!node) + return false; + this._tree = node; + this.type = node.type; + this.from = node.from; + this.to = node.to; + return true; + } + yieldBuf(index, type) { + this.index = index; + let { start, buffer } = this.buffer; + this.type = type || buffer.set.types[buffer.buffer[index]]; + this.from = start + buffer.buffer[index + 1]; + this.to = start + buffer.buffer[index + 2]; + return true; + } + yield(node) { + if (!node) + return false; + if (node instanceof TreeNode6) { + this.buffer = null; + return this.yieldNode(node); } - }; - const adjustTranslate = ({ transform }) => { - return { - ...transform, - x: transform.x, - y: transform.y - 10 - }; - }; - const dragStarted = (id2) => { - setActiveId(id2); - }; - const dragOver = (id2, x5) => { - setOffset(x5); - setOverId(id2); - }; - const dragEnded = () => { - if (dragPaths.length == 1) { - if (activeId !== null) { - plugin.settings.waypoints = arrayMove( - waypoints.map((f4) => f4.path), - activeId, - overId - ); - plugin.saveSettings(); + this.buffer = node.context; + return this.yieldBuf(node.index, node.type); + } + toString() { + return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString(); + } + enterChild(dir, pos, side) { + if (!this.buffer) + return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode)); + let { buffer } = this.buffer; + let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side); + if (index < 0) + return false; + this.stack.push(this.index); + return this.yieldBuf(index); + } + firstChild() { + return this.enterChild(1, 0, 4); + } + lastChild() { + return this.enterChild(-1, 0, 4); + } + childAfter(pos) { + return this.enterChild(1, pos, 2); + } + childBefore(pos) { + return this.enterChild(-1, pos, -2); + } + enter(pos, side, mode = this.mode) { + if (!this.buffer) + return this.yield(this._tree.enter(pos, side, mode)); + return mode & IterMode.ExcludeBuffers ? false : this.enterChild(1, pos, side); + } + parent() { + if (!this.buffer) + return this.yieldNode(this.mode & IterMode.IncludeAnonymous ? this._tree._parent : this._tree.parent); + if (this.stack.length) + return this.yieldBuf(this.stack.pop()); + let parent = this.mode & IterMode.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent(); + this.buffer = null; + return this.yieldNode(parent); + } + sibling(dir) { + if (!this.buffer) + return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode)); + let { buffer } = this.buffer, d6 = this.stack.length - 1; + if (dir < 0) { + let parentStart = d6 < 0 ? 0 : this.stack[d6] + 4; + if (this.index != parentStart) + return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4)); + } else { + let after = buffer.buffer[this.index + 3]; + if (after < (d6 < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d6] + 3])) + return this.yieldBuf(after); + } + return d6 < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false; + } + nextSibling() { + return this.sibling(1); + } + prevSibling() { + return this.sibling(-1); + } + atLastNode(dir) { + let index, parent, { buffer } = this; + if (buffer) { + if (dir > 0) { + if (this.index < buffer.buffer.buffer.length) + return false; } else { - plugin.settings.waypoints = insert( - waypoints.map((f4) => f4.path).filter((f4) => f4 != dragPaths[0]), - overId, - dragPaths[0] - ); - plugin.saveSettings(); + for (let i5 = 0; i5 < this.index; i5++) + if (buffer.buffer.buffer[i5 + 3] < this.index) + return false; } + ({ index, parent } = buffer); + } else { + ({ index, _parent: parent } = this._tree); } - resetState(); - }; - useDndMonitor({ - onDragStart: handleDragStart, - onDragMove: handleDragMove, - onDragOver: handleDragOver, - onDragEnd: handleDragEnd, - onDragCancel: handleDragCancel - }); - function handleDragStart(event) { - const { - active: { id: activeId2 } - } = event; - dragStarted(activeId2); + for (; parent; { index, _parent: parent } = parent) { + if (index > -1) + for (let i5 = index + dir, e4 = dir < 0 ? -1 : parent._tree.children.length; i5 != e4; i5 += dir) { + let child = parent._tree.children[i5]; + if (this.mode & IterMode.IncludeAnonymous || child instanceof TreeBuffer || !child.type.isAnonymous || hasChild(child)) + return false; + } + } + return true; } - function handleDragMove({ delta }) { + move(dir, enter) { + if (enter && this.enterChild(dir, 0, 4)) + return true; + for (; ; ) { + if (this.sibling(dir)) + return true; + if (this.atLastNode(dir) || !this.parent()) + return false; + } } - function handleDragOver({ over }) { - const overId2 = over == null ? void 0 : over.id; - if (overId2) { - setOverId(overId2); + next(enter = true) { + return this.move(1, enter); + } + prev(enter = true) { + return this.move(-1, enter); + } + moveTo(pos, side = 0) { + while (this.from == this.to || (side < 1 ? this.from >= pos : this.from > pos) || (side > -1 ? this.to <= pos : this.to < pos)) + if (!this.parent()) + break; + while (this.enterChild(1, pos, side)) { } + return this; } - function handleDragEnd({ active, over }) { - dragEnded(); + get node() { + if (!this.buffer) + return this._tree; + let cache2 = this.bufferNode, result = null, depth = 0; + if (cache2 && cache2.context == this.buffer) { + scan: + for (let index = this.index, d6 = this.stack.length; d6 >= 0; ) { + for (let c4 = cache2; c4; c4 = c4._parent) + if (c4.index == index) { + if (index == this.index) + return c4; + result = c4; + depth = d6 + 1; + break scan; + } + index = this.stack[--d6]; + } + } + for (let i5 = depth; i5 < this.stack.length; i5++) + result = new BufferNode(this.buffer, result, this.stack[i5]); + return this.bufferNode = new BufferNode(this.buffer, result, this.index); } - const width = 32; - const calcXOffset = (index) => { - if (!projected) - return 0; - const targetIndex = overId; - if (activeId == null) { - if (index >= overId) - return width; - return 0; + get tree() { + return this.buffer ? null : this._tree._tree; + } + iterate(enter, leave) { + for (let depth = 0; ; ) { + let mustLeave = false; + if (this.type.isAnonymous || enter(this) !== false) { + if (this.firstChild()) { + depth++; + continue; + } + if (!this.type.isAnonymous) + mustLeave = true; + } + for (; ; ) { + if (mustLeave && leave) + leave(this); + mustLeave = this.type.isAnonymous; + if (this.nextSibling()) + break; + if (!depth) + return; + this.parent(); + depth--; + mustLeave = true; + } + } + } + matchContext(context) { + if (!this.buffer) + return matchNodeContext(this.node, context); + let { buffer } = this.buffer, { types: types2 } = buffer.set; + for (let i5 = context.length - 1, d6 = this.stack.length - 1; i5 >= 0; d6--) { + if (d6 < 0) + return matchNodeContext(this.node, context, i5); + let type = types2[buffer.buffer[this.stack[d6]]]; + if (!type.isAnonymous) { + if (context[i5] && context[i5] != type.name) + return false; + i5--; + } } - if (index == activeId) { - return width * (targetIndex - activeId); - } else if (index > activeId && index <= targetIndex) { - return -width; - } else if (index < activeId && index >= targetIndex) { - return width; + return true; + } +}; +function hasChild(tree) { + return tree.children.some((ch) => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch)); +} +function buildTree(data2) { + var _a2; + let { buffer, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data2; + let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer; + let types2 = nodeSet.types; + let contextHash = 0, lookAhead = 0; + function takeNode(parentStart, minPos, children2, positions2, inRepeat) { + let { id: id3, start, end, size } = cursor; + let lookAheadAtStart = lookAhead; + while (size < 0) { + cursor.next(); + if (size == -1) { + let node2 = reused[id3]; + children2.push(node2); + positions2.push(start - parentStart); + return; + } else if (size == -3) { + contextHash = id3; + return; + } else if (size == -4) { + lookAhead = id3; + return; + } else { + throw new RangeError(`Unrecognized record size: ${size}`); + } + } + let type = types2[id3], node, buffer2; + let startPos = start - parentStart; + if (end - start <= maxBufferLength && (buffer2 = findBufferSize(cursor.pos - minPos, inRepeat))) { + let data3 = new Uint16Array(buffer2.size - buffer2.skip); + let endPos = cursor.pos - buffer2.size, index = data3.length; + while (cursor.pos > endPos) + index = copyToBuffer(buffer2.start, data3, index); + node = new TreeBuffer(data3, end - buffer2.start, nodeSet); + startPos = buffer2.start - parentStart; } else { - return 0; + let endPos = cursor.pos - size; + cursor.next(); + let localChildren = [], localPositions = []; + let localInRepeat = id3 >= minRepeatType ? id3 : -1; + let lastGroup = 0, lastEnd = end; + while (cursor.pos > endPos) { + if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) { + if (cursor.end <= lastEnd - maxBufferLength) { + makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart); + lastGroup = localChildren.length; + lastEnd = cursor.end; + } + cursor.next(); + } else { + takeNode(start, endPos, localChildren, localPositions, localInRepeat); + } + } + if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length) + makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, lookAheadAtStart); + localChildren.reverse(); + localPositions.reverse(); + if (localInRepeat > -1 && lastGroup > 0) { + let make = makeBalanced(type); + node = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make); + } else { + node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end); + } } - }; - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { - className: "mk-waypoints nav-header", - onDragEnter: () => dragEnter(), - onDragLeave: () => dragLeave(), - onDragOver: (e4) => e4.preventDefault() - }, /* @__PURE__ */ Cn.createElement("div", { - className: "nav-buttons-container" - }, waypoints.map((pin, i4) => /* @__PURE__ */ Cn.createElement(SortablePinnedSpaceItem, { - id: i4, - plugin: props2.plugin, - highlighted: overId == i4 && projected && projected.insert && projected.droppable, - style: { - transform: CSS.Translate.toString({ - x: calcXOffset(i4), - y: 0, - scaleX: 0, - scaleY: 0 - }) - }, - index: i4, - pin, - key: pin.path, - dragStart: dragStarted, - dragOver, - dragEnded, - dragActive: activeId !== null, - ghost: activeId === i4 - })), overId != null && activeId == null && /* @__PURE__ */ Cn.createElement(SortablePinnedSpaceItem, { - id: waypoints.length, - plugin: props2.plugin, - highlighted: false, - index: waypoints.length, - pin: null - })), z3( - /* @__PURE__ */ Cn.createElement(DragOverlay, { - dropAnimation: null, - modifiers: [adjustTranslate], - zIndex: 1600 - }, activeId !== null ? /* @__PURE__ */ Cn.createElement(SortablePinnedSpaceItem, { - id: -1, - plugin: props2.plugin, - highlighted: false, - clone: true, - index: activeId, - indicator: false, - pin: waypoints[activeId] - }) : null), - document.body - ))); -}; - -// src/components/Sidebar/MainList.tsx -var MainList = (props2) => { - const { activeViewSpace } = q2(SidebarContext); - const [error, resetError] = P2(); - if (error) - console.log(error); - const sensors = useSensors( - useSensor(MouseSensor, { - activationConstraint: { - distance: 10 + children2.push(node); + positions2.push(startPos); + } + function makeBalanced(type) { + return (children2, positions2, length2) => { + let lookAhead2 = 0, lastI = children2.length - 1, last, lookAheadProp; + if (lastI >= 0 && (last = children2[lastI]) instanceof Tree) { + if (!lastI && last.type == type && last.length == length2) + return last; + if (lookAheadProp = last.prop(NodeProp.lookAhead)) + lookAhead2 = positions2[lastI] + last.length + lookAheadProp; } - }), - useSensor(TouchSensor, { - activationConstraint: { - delay: 250, - tolerance: 5 + return makeTree(type, children2, positions2, length2, lookAhead2); + }; + } + function makeRepeatLeaf(children2, positions2, base2, i5, from, to, type, lookAhead2) { + let localChildren = [], localPositions = []; + while (children2.length > i5) { + localChildren.push(children2.pop()); + localPositions.push(positions2.pop() + base2 - from); + } + children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to - from, lookAhead2 - to)); + positions2.push(from - base2); + } + function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props2) { + if (contextHash) { + let pair2 = [NodeProp.contextHash, contextHash]; + props2 = props2 ? [pair2].concat(props2) : [pair2]; + } + if (lookAhead2 > 25) { + let pair2 = [NodeProp.lookAhead, lookAhead2]; + props2 = props2 ? [pair2].concat(props2) : [pair2]; + } + return new Tree(type, children2, positions2, length2, props2); + } + function findBufferSize(maxSize, inRepeat) { + let fork = cursor.fork(); + let size = 0, start = 0, skip = 0, minStart = fork.end - maxBufferLength; + let result = { size: 0, start: 0, skip: 0 }; + scan: + for (let minPos = fork.pos - maxSize; fork.pos > minPos; ) { + let nodeSize2 = fork.size; + if (fork.id == inRepeat && nodeSize2 >= 0) { + result.size = size; + result.start = start; + result.skip = skip; + skip += 4; + size += 4; + fork.next(); + continue; + } + let startPos = fork.pos - nodeSize2; + if (nodeSize2 < 0 || startPos < minPos || fork.start < minStart) + break; + let localSkipped = fork.id >= minRepeatType ? 4 : 0; + let nodeStart = fork.start; + fork.next(); + while (fork.pos > startPos) { + if (fork.size < 0) { + if (fork.size == -3) + localSkipped += 4; + else + break scan; + } else if (fork.id >= minRepeatType) { + localSkipped += 4; + } + fork.next(); + } + start = nodeStart; + size += nodeSize2; + skip += localSkipped; + } + if (inRepeat < 0 || size == maxSize) { + result.size = size; + result.start = start; + result.skip = skip; + } + return result.size > 4 ? result : void 0; + } + function copyToBuffer(bufferStart, buffer2, index) { + let { id: id3, start, end, size } = cursor; + cursor.next(); + if (size >= 0 && id3 < minRepeatType) { + let startIndex = index; + if (size > 4) { + let endPos = cursor.pos - (size - 4); + while (cursor.pos > endPos) + index = copyToBuffer(bufferStart, buffer2, index); + } + buffer2[--index] = startIndex; + buffer2[--index] = end - bufferStart; + buffer2[--index] = start - bufferStart; + buffer2[--index] = id3; + } else if (size == -3) { + contextHash = id3; + } else if (size == -4) { + lookAhead = id3; + } + return index; + } + let children = [], positions = []; + while (cursor.pos > 0) + takeNode(data2.start || 0, data2.bufferStart || 0, children, positions, -1); + let length = (_a2 = data2.length) !== null && _a2 !== void 0 ? _a2 : children.length ? positions[0] + children[0].length : 0; + return new Tree(types2[data2.topID], children.reverse(), positions.reverse(), length); +} +var nodeSizeCache = /* @__PURE__ */ new WeakMap(); +function nodeSize(balanceType, node) { + if (!balanceType.isAnonymous || node instanceof TreeBuffer || node.type != balanceType) + return 1; + let size = nodeSizeCache.get(node); + if (size == null) { + size = 1; + for (let child of node.children) { + if (child.type != balanceType || !(child instanceof Tree)) { + size = 1; + break; } - }) - ); - const measuring = { - droppable: { - strategy: MeasuringStrategy.Always + size += nodeSize(balanceType, child); + } + nodeSizeCache.set(node, size); + } + return size; +} +function balanceRange(balanceType, children, positions, from, to, start, length, mkTop, mkTree) { + let total = 0; + for (let i5 = from; i5 < to; i5++) + total += nodeSize(balanceType, children[i5]); + let maxChild = Math.ceil(total * 1.5 / 8); + let localChildren = [], localPositions = []; + function divide(children2, positions2, from2, to2, offset2) { + for (let i5 = from2; i5 < to2; ) { + let groupFrom = i5, groupStart = positions2[i5], groupSize = nodeSize(balanceType, children2[i5]); + i5++; + for (; i5 < to2; i5++) { + let nextSize = nodeSize(balanceType, children2[i5]); + if (groupSize + nextSize >= maxChild) + break; + groupSize += nextSize; + } + if (i5 == groupFrom + 1) { + if (groupSize > maxChild) { + let only = children2[groupFrom]; + divide(only.children, only.positions, 0, only.children.length, positions2[groupFrom] + offset2); + continue; + } + localChildren.push(children2[groupFrom]); + } else { + let length2 = positions2[i5 - 1] + children2[i5 - 1].length - groupStart; + localChildren.push(balanceRange(balanceType, children2, positions2, groupFrom, i5, groupStart, length2, null, mkTree)); + } + localPositions.push(groupStart + offset2 - start); + } + } + divide(children, positions, from, to, 0); + return (mkTop || mkTree)(localChildren, localPositions, length); +} +var NodeWeakMap = class { + constructor() { + this.map = /* @__PURE__ */ new WeakMap(); + } + setBuffer(buffer, index, value) { + let inner = this.map.get(buffer); + if (!inner) + this.map.set(buffer, inner = /* @__PURE__ */ new Map()); + inner.set(index, value); + } + getBuffer(buffer, index) { + let inner = this.map.get(buffer); + return inner && inner.get(index); + } + set(node, value) { + if (node instanceof BufferNode) + this.setBuffer(node.context.buffer, node.index, value); + else if (node instanceof TreeNode6) + this.map.set(node.tree, value); + } + get(node) { + return node instanceof BufferNode ? this.getBuffer(node.context.buffer, node.index) : node instanceof TreeNode6 ? this.map.get(node.tree) : void 0; + } + cursorSet(cursor, value) { + if (cursor.buffer) + this.setBuffer(cursor.buffer.buffer, cursor.index, value); + else + this.map.set(cursor.tree, value); + } + cursorGet(cursor) { + return cursor.buffer ? this.getBuffer(cursor.buffer.buffer, cursor.index) : this.map.get(cursor.tree); + } +}; +var Parser3 = class { + startParse(input, fragments, ranges) { + if (typeof input == "string") + input = new StringInput(input); + ranges = !ranges ? [new Range(0, input.length)] : ranges.length ? ranges.map((r3) => new Range(r3.from, r3.to)) : [new Range(0, 0)]; + return this.createParse(input, fragments || [], ranges); + } + parse(input, fragments, ranges) { + let parse5 = this.startParse(input, fragments, ranges); + for (; ; ) { + let done = parse5.advance(); + if (done) + return done; } - }; - return /* @__PURE__ */ Cn.createElement(DndContext, { - sensors, - collisionDetection: closestCenter, - measuring - }, /* @__PURE__ */ Cn.createElement(SpaceSwitcher, { - plugin: props2.plugin - }), /* @__PURE__ */ Cn.createElement(MainMenu, { - plugin: props2.plugin - }), /* @__PURE__ */ Cn.createElement(FileExplorerComponent, { - plugin: props2.plugin - })); + } }; - -// src/components/Sidebar/FileTreeView.tsx -var FILE_TREE_VIEW_TYPE = "mk-file-view"; -var VIEW_DISPLAY_TEXT = "Spaces"; -var ICON = "layout-grid"; -var FileTreeView = class extends import_obsidian57.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.navigation = false; - this.plugin = plugin; +var StringInput = class { + constructor(string2) { + this.string = string2; } - revealInFolder(file) { - if (file instanceof import_obsidian57.TFolder) { - this.plugin.app.workspace.activeLeaf.setViewState({ - type: SPACE_VIEW_TYPE, - state: { path: file.path } - }); - this.plugin.app.workspace.requestSaveLayout(); + get length() { + return this.string.length; + } + chunk(from) { + return this.string.slice(from); + } + get lineChunks() { + return false; + } + read(from, to) { + return this.string.slice(from, to); + } +}; +var stoppedInner = new NodeProp({ perNode: true }); + +// node_modules/@lezer/lr/dist/index.js +var Stack2 = class { + constructor(p3, stack, state, reducePos, pos, score, buffer, bufferBase, curContext, lookAhead = 0, parent) { + this.p = p3; + this.stack = stack; + this.state = state; + this.reducePos = reducePos; + this.pos = pos; + this.score = score; + this.buffer = buffer; + this.bufferBase = bufferBase; + this.curContext = curContext; + this.lookAhead = lookAhead; + this.parent = parent; + } + toString() { + return `[${this.stack.filter((_12, i5) => i5 % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`; + } + static start(p3, state, pos = 0) { + let cx = p3.parser.context; + return new Stack2(p3, [], state, pos, pos, 0, [], 0, cx ? new StackContext(cx, cx.start) : null, 0, null); + } + get context() { + return this.curContext ? this.curContext.context : null; + } + pushState(state, start) { + this.stack.push(this.state, start, this.bufferBase + this.buffer.length); + this.state = state; + } + reduce(action) { + var _a2; + let depth = action >> 19, type = action & 65535; + let { parser: parser2 } = this.p; + let dPrec = parser2.dynamicPrecedence(type); + if (dPrec) + this.score += dPrec; + if (depth == 0) { + this.pushState(parser2.getGoto(this.state, type, true), this.reducePos); + if (type < parser2.minRepeatTerm) + this.storeNode(type, this.reducePos, this.reducePos, 4, true); + this.reduceContext(type, this.reducePos); + return; + } + let base2 = this.stack.length - (depth - 1) * 3 - (action & 262144 ? 6 : 0); + let start = base2 ? this.stack[base2 - 2] : this.p.ranges[0].from, size = this.reducePos - start; + if (size >= 2e3 && !((_a2 = this.p.parser.nodeSet.types[type]) === null || _a2 === void 0 ? void 0 : _a2.isAnonymous)) { + if (start == this.p.lastBigReductionStart) { + this.p.bigReductionCount++; + this.p.lastBigReductionSize = size; + } else if (this.p.lastBigReductionSize < size) { + this.p.bigReductionCount = 1; + this.p.lastBigReductionStart = start; + this.p.lastBigReductionSize = size; + } + } + let bufferBase = base2 ? this.stack[base2 - 1] : 0, count2 = this.bufferBase + this.buffer.length - bufferBase; + if (type < parser2.minRepeatTerm || action & 131072) { + let pos = parser2.stateFlag(this.state, 1) ? this.pos : this.reducePos; + this.storeNode(type, start, pos, count2 + 4, true); + } + if (action & 262144) { + this.state = this.stack[base2]; } else { - const evt = new CustomEvent(eventTypes.revealFile, { - detail: { file } - }); - window.dispatchEvent(evt); + let baseStateID = this.stack[base2 - 3]; + this.state = parser2.getGoto(baseStateID, type, true); + } + while (this.stack.length > base2) + this.stack.pop(); + this.reduceContext(type, start); + } + storeNode(term, start, end, size = 4, isReduce = false) { + if (term == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) { + let cur = this, top = this.buffer.length; + if (top == 0 && cur.parent) { + top = cur.bufferBase - cur.parent.bufferBase; + cur = cur.parent; + } + if (top > 0 && cur.buffer[top - 4] == 0 && cur.buffer[top - 1] > -1) { + if (start == end) + return; + if (cur.buffer[top - 2] >= start) { + cur.buffer[top - 2] = end; + return; + } + } + } + if (!isReduce || this.pos == end) { + this.buffer.push(term, start, end, size); + } else { + let index = this.buffer.length; + if (index > 0 && this.buffer[index - 4] != 0) + while (index > 0 && this.buffer[index - 2] > end) { + this.buffer[index] = this.buffer[index - 4]; + this.buffer[index + 1] = this.buffer[index - 3]; + this.buffer[index + 2] = this.buffer[index - 2]; + this.buffer[index + 3] = this.buffer[index - 1]; + index -= 4; + if (size > 4) + size -= 4; + } + this.buffer[index] = term; + this.buffer[index + 1] = start; + this.buffer[index + 2] = end; + this.buffer[index + 3] = size; + } + } + shift(action, next, nextEnd) { + let start = this.pos; + if (action & 131072) { + this.pushState(action & 65535, this.pos); + } else if ((action & 262144) == 0) { + let nextState = action, { parser: parser2 } = this.p; + if (nextEnd > this.pos || next <= parser2.maxNode) { + this.pos = nextEnd; + if (!parser2.stateFlag(nextState, 1)) + this.reducePos = nextEnd; + } + this.pushState(nextState, start); + this.shiftContext(next, start); + if (next <= parser2.maxNode) + this.buffer.push(next, start, nextEnd, 4); + } else { + this.pos = nextEnd; + this.shiftContext(next, start); + if (next <= this.p.parser.maxNode) + this.buffer.push(next, start, nextEnd, 4); } } - getViewType() { - return FILE_TREE_VIEW_TYPE; + apply(action, next, nextEnd) { + if (action & 65536) + this.reduce(action); + else + this.shift(action, next, nextEnd); + } + useNode(value, next) { + let index = this.p.reused.length - 1; + if (index < 0 || this.p.reused[index] != value) { + this.p.reused.push(value); + index++; + } + let start = this.pos; + this.reducePos = this.pos = start + value.length; + this.pushState(next, start); + this.buffer.push(index, start, this.reducePos, -1); + if (this.curContext) + this.updateContext(this.curContext.tracker.reuse(this.curContext.context, value, this, this.p.stream.reset(this.pos - value.length))); + } + split() { + let parent = this; + let off = parent.buffer.length; + while (off > 0 && parent.buffer[off - 2] > parent.reducePos) + off -= 4; + let buffer = parent.buffer.slice(off), base2 = parent.bufferBase + off; + while (parent && base2 == parent.bufferBase) + parent = parent.parent; + return new Stack2(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, buffer, base2, this.curContext, this.lookAhead, parent); + } + recoverByDelete(next, nextEnd) { + let isNode2 = next <= this.p.parser.maxNode; + if (isNode2) + this.storeNode(next, this.pos, nextEnd, 4); + this.storeNode(0, this.pos, nextEnd, isNode2 ? 8 : 4); + this.pos = this.reducePos = nextEnd; + this.score -= 190; + } + canShift(term) { + for (let sim = new SimulatedStack(this); ; ) { + let action = this.p.parser.stateSlot(sim.state, 4) || this.p.parser.hasAction(sim.state, term); + if (action == 0) + return false; + if ((action & 65536) == 0) + return true; + sim.reduce(action); + } } - getDisplayText() { - return VIEW_DISPLAY_TEXT; + recoverByInsert(next) { + if (this.stack.length >= 300) + return []; + let nextStates = this.p.parser.nextStates(this.state); + if (nextStates.length > 4 << 1 || this.stack.length >= 120) { + let best = []; + for (let i5 = 0, s6; i5 < nextStates.length; i5 += 2) { + if ((s6 = nextStates[i5 + 1]) != this.state && this.p.parser.hasAction(s6, next)) + best.push(nextStates[i5], s6); + } + if (this.stack.length < 120) + for (let i5 = 0; best.length < 4 << 1 && i5 < nextStates.length; i5 += 2) { + let s6 = nextStates[i5 + 1]; + if (!best.some((v4, i6) => i6 & 1 && v4 == s6)) + best.push(nextStates[i5], s6); + } + nextStates = best; + } + let result = []; + for (let i5 = 0; i5 < nextStates.length && result.length < 4; i5 += 2) { + let s6 = nextStates[i5 + 1]; + if (s6 == this.state) + continue; + let stack = this.split(); + stack.pushState(s6, this.pos); + stack.storeNode(0, stack.pos, stack.pos, 4, true); + stack.shiftContext(nextStates[i5], this.pos); + stack.score -= 200; + result.push(stack); + } + return result; } - getIcon() { - return ICON; + forceReduce() { + let reduce = this.p.parser.stateSlot(this.state, 5); + if ((reduce & 65536) == 0) + return false; + let { parser: parser2 } = this.p; + if (!parser2.validAction(this.state, reduce)) { + let depth = reduce >> 19, term = reduce & 65535; + let target = this.stack.length - depth * 3; + if (target < 0 || parser2.getGoto(this.stack[target], term, false) < 0) + return false; + this.storeNode(0, this.reducePos, this.reducePos, 4, true); + this.score -= 100; + } + this.reducePos = this.pos; + this.reduce(reduce); + return true; } - async onClose() { - const leafs = this.app.workspace.getLeavesOfType(FILE_TREE_VIEW_TYPE); - if (leafs.length == 0) { - const leaf = this.app.workspace.getLeftLeaf(false); - await leaf.setViewState({ type: FILE_TREE_VIEW_TYPE }); + forceAll() { + while (!this.p.parser.stateFlag(this.state, 2)) { + if (!this.forceReduce()) { + this.storeNode(0, this.pos, this.pos, 4, true); + break; + } } - this.destroy(); + return this; } - destroy() { - if (this.root) - this.root.unmount(); + get deadEnd() { + if (this.stack.length != 3) + return false; + let { parser: parser2 } = this.p; + return parser2.data[parser2.stateSlot(this.state, 1)] == 65535 && !parser2.stateSlot(this.state, 4); } - async onOpen() { - this.destroy(); - this.constructFileTree(this.app.vault.getRoot().path, ""); + restart() { + this.state = this.stack[0]; + this.stack.length = 0; } - constructFileTree(folderPath, vaultChange) { - this.destroy(); - this.root = createRoot(this.contentEl); - this.root.render( - /* @__PURE__ */ Cn.createElement("div", { - className: "mk-sidebar" - }, /* @__PURE__ */ Cn.createElement(SidebarProvider, { - plugin: this.plugin - }, /* @__PURE__ */ Cn.createElement(MainList, { - plugin: this.plugin - }))) - ); + sameState(other) { + if (this.state != other.state || this.stack.length != other.stack.length) + return false; + for (let i5 = 0; i5 < this.stack.length; i5 += 3) + if (this.stack[i5] != other.stack[i5]) + return false; + return true; + } + get parser() { + return this.p.parser; + } + dialectEnabled(dialectID) { + return this.p.parser.dialect.flags[dialectID]; + } + shiftContext(term, start) { + if (this.curContext) + this.updateContext(this.curContext.tracker.shift(this.curContext.context, term, this, this.p.stream.reset(start))); + } + reduceContext(term, start) { + if (this.curContext) + this.updateContext(this.curContext.tracker.reduce(this.curContext.context, term, this, this.p.stream.reset(start))); + } + emitContext() { + let last = this.buffer.length - 1; + if (last < 0 || this.buffer[last] != -3) + this.buffer.push(this.curContext.hash, this.reducePos, this.reducePos, -3); + } + emitLookAhead() { + let last = this.buffer.length - 1; + if (last < 0 || this.buffer[last] != -4) + this.buffer.push(this.lookAhead, this.reducePos, this.reducePos, -4); + } + updateContext(context) { + if (context != this.curContext.context) { + let newCx = new StackContext(this.curContext.tracker, context); + if (newCx.hash != this.curContext.hash) + this.emitContext(); + this.curContext = newCx; + } + } + setLookAhead(lookAhead) { + if (lookAhead > this.lookAhead) { + this.emitLookAhead(); + this.lookAhead = lookAhead; + } + } + close() { + if (this.curContext && this.curContext.tracker.strict) + this.emitContext(); + if (this.lookAhead > 0) + this.emitLookAhead(); + } +}; +var StackContext = class { + constructor(tracker, context) { + this.tracker = tracker; + this.context = context; + this.hash = tracker.strict ? tracker.hash(context) : 0; + } +}; +var Recover; +(function(Recover2) { + Recover2[Recover2["Insert"] = 200] = "Insert"; + Recover2[Recover2["Delete"] = 190] = "Delete"; + Recover2[Recover2["Reduce"] = 100] = "Reduce"; + Recover2[Recover2["MaxNext"] = 4] = "MaxNext"; + Recover2[Recover2["MaxInsertStackDepth"] = 300] = "MaxInsertStackDepth"; + Recover2[Recover2["DampenInsertStackDepth"] = 120] = "DampenInsertStackDepth"; + Recover2[Recover2["MinBigReduction"] = 2e3] = "MinBigReduction"; +})(Recover || (Recover = {})); +var SimulatedStack = class { + constructor(start) { + this.start = start; + this.state = start.state; + this.stack = start.stack; + this.base = this.stack.length; + } + reduce(action) { + let term = action & 65535, depth = action >> 19; + if (depth == 0) { + if (this.stack == this.start.stack) + this.stack = this.stack.slice(); + this.stack.push(this.state, 0, 0); + this.base += 3; + } else { + this.base -= (depth - 1) * 3; + } + let goto = this.start.p.parser.getGoto(this.stack[this.base - 3], term, true); + this.state = goto; } }; - -// src/settings/settings.ts -var import_obsidian58 = require("obsidian"); -var DEFAULT_SETTINGS = { - defaultInitialization: false, - filePreviewOnHover: false, - flowMenuEnabled: true, - markSans: false, - blinkEnabled: true, - makeMenuPlaceholder: true, - mobileMakeBar: true, - inlineStyler: true, - makerMode: true, - spacesMDBInHidden: true, - inlineStylerColors: false, - editorFlow: true, - internalLinkClickFlow: true, - contextEnabled: true, - saveAllContextToFrontmatter: true, - editorFlowStyle: "seamless", - autoOpenFileContext: false, - activeView: "root", - hideFrontmatter: true, - activeSpace: "", - spacesCompactMode: false, - defaultDateFormat: "MMM dd yyyy", - spacesEnabled: true, - spacesPerformance: false, - collapsedTags: [], - enableFolderNote: true, - folderIndentationLines: true, - revealActiveFile: false, - spacesStickers: true, - spaceRowHeight: 29, - spacesDisablePatch: false, - folderNoteInsideFolder: true, - folderNoteDefaultView: true, - sidebarTabs: true, - showRibbon: true, - deleteFileOption: "trash", - expandedSpaces: ["/"], - expandFolderOnClick: true, - openFolders: [], - fileIcons: [], - cachedSpaces: [], - menuTriggerChar: "/", - inlineStickerMenu: true, - emojiTriggerChar: ":", - folderContextFile: "context", - folderFrameFile: "frames", - spacesFolder: "Spaces", - hiddenFiles: ["Spaces"], - lineNumbers: false, - hiddenExtensions: ["mdb"], - newFileLocation: "root", - newFileFolderPath: "", - inlineBacklinks: false, - inlineContext: true, - inlineBacklinksExpanded: false, - inlineContextExpanded: true, - inlineContextSectionsExpanded: true, - dataviewInlineContext: false, - inlineContextNameLayout: "vertical", - waypoints: [], - rootSpaces: [], - spacesUseAlias: false, - precreateVaultSpace: false, - fmKeyAlias: "aliases", - fmKeyBanner: "banner", - fmKeyColor: "color", - fmKeySticker: "sticker", - fmKeyContexts: "contexts", - fmKeySort: "sort", - fmKeyDef: "def", - fmKeyLinks: "links", - openSpacesOnLaunch: true, - indexSVG: false, - quickFrames: [], - readableLineWidth: true, - autoAddContextsToSubtags: true, - autoMigration08: false -}; -var MakeMDPluginSettingsTab = class extends import_obsidian58.PluginSettingTab { - constructor(app2, plugin) { - super(app2, plugin); - this.plugin = plugin; +var StackBufferCursor = class { + constructor(stack, pos, index) { + this.stack = stack; + this.pos = pos; + this.index = index; + this.buffer = stack.buffer; + if (this.index == 0) + this.maybeNext(); } - refreshView() { - this.display(); + static create(stack, pos = stack.bufferBase + stack.buffer.length) { + return new StackBufferCursor(stack, pos, pos - stack.bufferBase); } - display() { - const { containerEl } = this; - containerEl.empty(); - containerEl.createEl("h1", { text: i18n_default.settings.sectionSidebar }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.spaces.name).setDesc(i18n_default.settings.spaces.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.spacesEnabled).onChange((value) => { - this.plugin.settings.spacesEnabled = value; - this.plugin.saveSettings(); - if (value) { - this.plugin.openFileTreeLeaf(true); - } else { - this.plugin.detachFileTreeLeafs(); - } - this.refreshView(); - }) - ); - if (this.plugin.settings.spacesEnabled) { - containerEl.createEl("h3", { text: i18n_default.settings.sectionAppearance }); - const spaceAppearances = containerEl.createEl("div"); - new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.sidebarTabs.name).setDesc(i18n_default.settings.sidebarTabs.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.sidebarTabs).onChange((value) => { - this.plugin.settings.sidebarTabs = value; - this.plugin.saveSettings(); - document.body.classList.toggle("mk-hide-tabs", !value); - }) - ); - new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.hideRibbon.name).setDesc(i18n_default.settings.hideRibbon.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.showRibbon).onChange((value) => { - this.plugin.settings.showRibbon = value; - this.plugin.saveSettings(); - document.body.classList.toggle("mk-hide-ribbon", !value); - }) - ); - new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.compactMode.name).setDesc(i18n_default.settings.compactMode.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.spacesCompactMode).onChange((value) => { - this.plugin.settings.spacesCompactMode = value; - this.plugin.detachFileTreeLeafs(); - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.folderIndentationLines.name).setDesc(i18n_default.settings.folderIndentationLines.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.folderIndentationLines).onChange((value) => { - this.plugin.settings.folderIndentationLines = value; - this.plugin.saveSettings(); - document.body.classList.toggle("mk-folder-lines", value); - }) - ); - new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.spacesStickers.name).setDesc(i18n_default.settings.spacesStickers.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.spacesStickers).onChange((value) => { - this.plugin.settings.spacesStickers = value; - this.plugin.saveSettings(); - this.refreshView(); - }) - ); - new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.spacesAlias.name).setDesc(i18n_default.settings.spacesAlias.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.spacesUseAlias).onChange((value) => { - this.plugin.settings.spacesUseAlias = value; - this.plugin.saveSettings(); - this.refreshView(); - }) - ); - new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.readableLineWidth.name).setDesc(i18n_default.settings.readableLineWidth.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.readableLineWidth).onChange((value) => { - this.plugin.settings.readableLineWidth = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.openSpacesOnLaunch.name).setDesc(i18n_default.settings.openSpacesOnLaunch.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.openSpacesOnLaunch).onChange((value) => { - this.plugin.settings.openSpacesOnLaunch = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(spaceAppearances).setName(i18n_default.settings.spaceRowHeight.name).setDesc(i18n_default.settings.spaceRowHeight.desc).addText((text2) => { - text2.setValue(this.plugin.settings.spaceRowHeight.toString()).onChange(async (value) => { - text2.setValue(parseInt(value).toString()); - this.plugin.settings.spaceRowHeight = parseInt(value); - await this.plugin.saveSettings(); - }); - }); - containerEl.createEl("h3", { text: "Folder Note" }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.folderNote.name).setDesc(i18n_default.settings.folderNote.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.enableFolderNote).onChange((value) => { - this.plugin.settings.enableFolderNote = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.folderNoteLocation.name).setDesc(i18n_default.settings.folderNoteLocation.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.folderNoteInsideFolder).onChange((value) => { - this.plugin.settings.folderNoteInsideFolder = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.folderViewDefault.name).setDesc(i18n_default.settings.folderViewDefault.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.folderNoteDefaultView).onChange((value) => { - this.plugin.settings.folderNoteDefaultView = value; - this.plugin.saveSettings(); - }) - ); - containerEl.createEl("h3", { text: "Advanced" }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.expandFolder.name).setDesc(i18n_default.settings.expandFolder.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.expandFolderOnClick).onChange((value) => { - this.plugin.settings.expandFolderOnClick = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.hoverPreview.name).setDesc(i18n_default.settings.hoverPreview.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.filePreviewOnHover).onChange((value) => { - this.plugin.settings.filePreviewOnHover = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.activeFile.name).setDesc(i18n_default.settings.activeFile.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.revealActiveFile).onChange((value) => { - this.plugin.settings.revealActiveFile = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.spacesFileExplorerDual.name).setDesc(i18n_default.settings.spacesFileExplorerDual.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.spacesDisablePatch).onChange((value) => { - this.plugin.settings.spacesDisablePatch = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.spacesPerformance.name).setDesc(i18n_default.settings.spacesPerformance.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.spacesPerformance).onChange((value) => { - this.plugin.settings.spacesPerformance = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.indexSVG.name).setDesc(i18n_default.settings.indexSVG.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.indexSVG).onChange((value) => { - this.plugin.settings.indexSVG = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.spacesDeleteOption.name).setDesc(i18n_default.settings.spacesDeleteOption.desc).addDropdown((dropdown) => { - dropdown.addOption( - "permanent", - i18n_default.settings.spacesDeleteOptions.permanant - ); - dropdown.addOption("trash", i18n_default.settings.spacesDeleteOptions.trash); - dropdown.addOption( - "system-trash", - i18n_default.settings.spacesDeleteOptions["system-trash"] - ); - dropdown.setValue(this.plugin.settings.deleteFileOption); - dropdown.onChange((option) => { - this.plugin.settings.deleteFileOption = option; - this.plugin.saveSettings(); - }); - }); + maybeNext() { + let next = this.stack.parent; + if (next != null) { + this.index = this.stack.bufferBase - next.bufferBase; + this.stack = next; + this.buffer = next.buffer; } - containerEl.createEl("h1", { text: "Context" }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.contexts.name).setDesc(i18n_default.settings.contexts.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.contextEnabled).onChange((value) => { - this.plugin.settings.contextEnabled = value; - this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - containerEl.createEl("h3", { text: i18n_default.settings.sectionAppearance }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.defaultDateFormat.name).setDesc(i18n_default.settings.defaultDateFormat.desc).addText((text2) => { - text2.setValue(this.plugin.settings.defaultDateFormat).onChange(async (value) => { - this.plugin.settings.defaultDateFormat = value; - await this.plugin.saveSettings(); - }); - }); - containerEl.createEl("h3", { text: i18n_default.settings.sectionAdvanced }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.openFileContext.name).setDesc(i18n_default.settings.openFileContext.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.autoOpenFileContext).onChange((value) => { - this.plugin.settings.autoOpenFileContext = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.syncContextToFrontmatter.name).setDesc(i18n_default.settings.syncContextToFrontmatter.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.saveAllContextToFrontmatter).onChange((value) => { - this.plugin.settings.saveAllContextToFrontmatter = value; - this.plugin.saveSettings(); - }) - ); - containerEl.createEl("h1", { text: "Blink" }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.blink.name).setDesc(i18n_default.settings.blink.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.blinkEnabled).onChange(async (value) => { - this.plugin.settings.blinkEnabled = value; - await this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - containerEl.createEl("h1", { text: i18n_default.settings.sectionFlow }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorMakerMode.name).setDesc(i18n_default.settings.editorMakerMode.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.makerMode).onChange((value) => { - this.plugin.settings.makerMode = value; - this.plugin.saveSettings(); - this.refreshView(); - }) - ); - if (this.plugin.settings.makerMode) { - containerEl.createEl("h3", { text: "Inline Context" }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineContextExplorer.name).setDesc(i18n_default.settings.inlineContextExplorer.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.inlineContext).onChange((value) => { - this.plugin.settings.inlineContext = value; - this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.lineNumbers.name).setDesc(i18n_default.settings.lineNumbers.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.lineNumbers).onChange(async (value) => { - this.plugin.settings.lineNumbers = value; - await this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineContextExpanded.name).setDesc(i18n_default.settings.inlineContextExpanded.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.inlineContextSectionsExpanded).onChange((value) => { - this.plugin.settings.inlineContextSectionsExpanded = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineContextHorizontal.name).setDesc(i18n_default.settings.inlineContextHorizontal.desc).addDropdown((dropdown) => { - dropdown.addOption("vertical", i18n_default.settings.layoutVertical); - dropdown.addOption("horizontal", i18n_default.settings.layoutHorizontal); - dropdown.setValue(this.plugin.settings.inlineContextNameLayout); - dropdown.onChange((option) => { - this.plugin.settings.inlineContextNameLayout = option; - this.plugin.saveSettings(); - }); - }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.hideFrontmatter.name).setDesc(i18n_default.settings.hideFrontmatter.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.hideFrontmatter).onChange(async (value) => { - this.plugin.settings.hideFrontmatter = value; - await this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.dataviewInlineContext.name).setDesc(i18n_default.settings.dataviewInlineContext.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.dataviewInlineContext).onChange((value) => { - this.plugin.settings.dataviewInlineContext = value; - this.plugin.saveSettings(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineBacklinks.name).setDesc(i18n_default.settings.inlineBacklinks.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.inlineBacklinks).onChange(async (value) => { - this.plugin.settings.inlineBacklinks = value; - await this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - containerEl.createEl("h3", { text: "Flow Block" }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorFlowReplace.name).setDesc(i18n_default.settings.editorFlowReplace.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.editorFlow).onChange((value) => { - this.plugin.settings.editorFlow = value; - this.plugin.saveSettings(); - this.refreshView(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.internalLinkFlowEditor.name).setDesc(i18n_default.settings.internalLinkFlowEditor.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.internalLinkClickFlow).onChange(async (value) => { - this.plugin.settings.internalLinkClickFlow = value; - await this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorFlowStyle.name).setDesc(i18n_default.settings.editorFlowStyle.desc).addDropdown((dropdown) => { - dropdown.addOption("classic", i18n_default.settings.editorFlowStyle.classic); - dropdown.addOption("seamless", i18n_default.settings.editorFlowStyle.seamless); - dropdown.addOption("minimal", i18n_default.settings.editorFlowStyle.minimal); - dropdown.setValue(this.plugin.settings.editorFlowStyle).onChange(async (value) => { - this.plugin.settings.editorFlowStyle = value; - document.body.classList.toggle("mk-flow-classic", false); - document.body.classList.toggle("mk-flow-seamless", false); - document.body.classList.toggle("mk-flow-minimal", false); - if (value == "seamless") - document.body.classList.toggle("mk-flow-seamless", true); - if (value == "classic") - document.body.classList.toggle("mk-flow-classic", true); - if (value == "minimal") - document.body.classList.toggle("mk-flow-minimal", true); - }); - }); - containerEl.createEl("h3", { text: "Flow Menu" }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorMakeMenu.name).setDesc(i18n_default.settings.editorMakeMenu.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.flowMenuEnabled).onChange(async (value) => { - this.plugin.settings.flowMenuEnabled = value; - await this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.makeChar.name).setDesc(i18n_default.settings.makeChar.desc).addText((text2) => { - text2.setValue(this.plugin.settings.menuTriggerChar).onChange(async (value) => { - if (value.trim().length < 1) { - text2.setValue(this.plugin.settings.menuTriggerChar); - return; + } + get id() { + return this.buffer[this.index - 4]; + } + get start() { + return this.buffer[this.index - 3]; + } + get end() { + return this.buffer[this.index - 2]; + } + get size() { + return this.buffer[this.index - 1]; + } + next() { + this.index -= 4; + this.pos -= 4; + if (this.index == 0) + this.maybeNext(); + } + fork() { + return new StackBufferCursor(this.stack, this.pos, this.index); + } +}; +function decodeArray(input, Type = Uint16Array) { + if (typeof input != "string") + return input; + let array = null; + for (let pos = 0, out = 0; pos < input.length; ) { + let value = 0; + for (; ; ) { + let next = input.charCodeAt(pos++), stop = false; + if (next == 126) { + value = 65535; + break; + } + if (next >= 92) + next--; + if (next >= 34) + next--; + let digit = next - 32; + if (digit >= 46) { + digit -= 46; + stop = true; + } + value += digit; + if (stop) + break; + value *= 46; + } + if (array) + array[out++] = value; + else + array = new Type(value); + } + return array; +} +var CachedToken = class { + constructor() { + this.start = -1; + this.value = -1; + this.end = -1; + this.extended = -1; + this.lookAhead = 0; + this.mask = 0; + this.context = 0; + } +}; +var nullToken = new CachedToken(); +var InputStream = class { + constructor(input, ranges) { + this.input = input; + this.ranges = ranges; + this.chunk = ""; + this.chunkOff = 0; + this.chunk2 = ""; + this.chunk2Pos = 0; + this.next = -1; + this.token = nullToken; + this.rangeIndex = 0; + this.pos = this.chunkPos = ranges[0].from; + this.range = ranges[0]; + this.end = ranges[ranges.length - 1].to; + this.readNext(); + } + resolveOffset(offset2, assoc) { + let range = this.range, index = this.rangeIndex; + let pos = this.pos + offset2; + while (pos < range.from) { + if (!index) + return null; + let next = this.ranges[--index]; + pos -= range.from - next.to; + range = next; + } + while (assoc < 0 ? pos > range.to : pos >= range.to) { + if (index == this.ranges.length - 1) + return null; + let next = this.ranges[++index]; + pos += next.from - range.to; + range = next; + } + return pos; + } + clipPos(pos) { + if (pos >= this.range.from && pos < this.range.to) + return pos; + for (let range of this.ranges) + if (range.to > pos) + return Math.max(pos, range.from); + return this.end; + } + peek(offset2) { + let idx = this.chunkOff + offset2, pos, result; + if (idx >= 0 && idx < this.chunk.length) { + pos = this.pos + offset2; + result = this.chunk.charCodeAt(idx); + } else { + let resolved = this.resolveOffset(offset2, 1); + if (resolved == null) + return -1; + pos = resolved; + if (pos >= this.chunk2Pos && pos < this.chunk2Pos + this.chunk2.length) { + result = this.chunk2.charCodeAt(pos - this.chunk2Pos); + } else { + let i5 = this.rangeIndex, range = this.range; + while (range.to <= pos) + range = this.ranges[++i5]; + this.chunk2 = this.input.chunk(this.chunk2Pos = pos); + if (pos + this.chunk2.length > range.to) + this.chunk2 = this.chunk2.slice(0, range.to - pos); + result = this.chunk2.charCodeAt(0); + } + } + if (pos >= this.token.lookAhead) + this.token.lookAhead = pos + 1; + return result; + } + acceptToken(token, endOffset = 0) { + let end = endOffset ? this.resolveOffset(endOffset, -1) : this.pos; + if (end == null || end < this.token.start) + throw new RangeError("Token end out of bounds"); + this.token.value = token; + this.token.end = end; + } + getChunk() { + if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) { + let { chunk, chunkPos } = this; + this.chunk = this.chunk2; + this.chunkPos = this.chunk2Pos; + this.chunk2 = chunk; + this.chunk2Pos = chunkPos; + this.chunkOff = this.pos - this.chunkPos; + } else { + this.chunk2 = this.chunk; + this.chunk2Pos = this.chunkPos; + let nextChunk = this.input.chunk(this.pos); + let end = this.pos + nextChunk.length; + this.chunk = end > this.range.to ? nextChunk.slice(0, this.range.to - this.pos) : nextChunk; + this.chunkPos = this.pos; + this.chunkOff = 0; + } + } + readNext() { + if (this.chunkOff >= this.chunk.length) { + this.getChunk(); + if (this.chunkOff == this.chunk.length) + return this.next = -1; + } + return this.next = this.chunk.charCodeAt(this.chunkOff); + } + advance(n2 = 1) { + this.chunkOff += n2; + while (this.pos + n2 >= this.range.to) { + if (this.rangeIndex == this.ranges.length - 1) + return this.setDone(); + n2 -= this.range.to - this.pos; + this.range = this.ranges[++this.rangeIndex]; + this.pos = this.range.from; + } + this.pos += n2; + if (this.pos >= this.token.lookAhead) + this.token.lookAhead = this.pos + 1; + return this.readNext(); + } + setDone() { + this.pos = this.chunkPos = this.end; + this.range = this.ranges[this.rangeIndex = this.ranges.length - 1]; + this.chunk = ""; + return this.next = -1; + } + reset(pos, token) { + if (token) { + this.token = token; + token.start = pos; + token.lookAhead = pos + 1; + token.value = token.extended = -1; + } else { + this.token = nullToken; + } + if (this.pos != pos) { + this.pos = pos; + if (pos == this.end) { + this.setDone(); + return this; + } + while (pos < this.range.from) + this.range = this.ranges[--this.rangeIndex]; + while (pos >= this.range.to) + this.range = this.ranges[++this.rangeIndex]; + if (pos >= this.chunkPos && pos < this.chunkPos + this.chunk.length) { + this.chunkOff = pos - this.chunkPos; + } else { + this.chunk = ""; + this.chunkOff = 0; + } + this.readNext(); + } + return this; + } + read(from, to) { + if (from >= this.chunkPos && to <= this.chunkPos + this.chunk.length) + return this.chunk.slice(from - this.chunkPos, to - this.chunkPos); + if (from >= this.chunk2Pos && to <= this.chunk2Pos + this.chunk2.length) + return this.chunk2.slice(from - this.chunk2Pos, to - this.chunk2Pos); + if (from >= this.range.from && to <= this.range.to) + return this.input.read(from, to); + let result = ""; + for (let r3 of this.ranges) { + if (r3.from >= to) + break; + if (r3.to > from) + result += this.input.read(Math.max(r3.from, from), Math.min(r3.to, to)); + } + return result; + } +}; +var TokenGroup = class { + constructor(data2, id3) { + this.data = data2; + this.id = id3; + } + token(input, stack) { + let { parser: parser2 } = stack.p; + readToken(this.data, input, stack, this.id, parser2.data, parser2.tokenPrecTable); + } +}; +TokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false; +var LocalTokenGroup = class { + constructor(data2, precTable, elseToken) { + this.precTable = precTable; + this.elseToken = elseToken; + this.data = typeof data2 == "string" ? decodeArray(data2) : data2; + } + token(input, stack) { + let start = input.pos, cur; + for (; ; ) { + cur = input.pos; + readToken(this.data, input, stack, 0, this.data, this.precTable); + if (input.token.value > -1) + break; + if (this.elseToken == null) + return; + if (input.next < 0) + break; + input.advance(); + input.reset(cur + 1, input.token); + } + if (cur > start) { + input.reset(start, input.token); + input.acceptToken(this.elseToken, cur - start); + } + } +}; +LocalTokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false; +var ExternalTokenizer = class { + constructor(token, options = {}) { + this.token = token; + this.contextual = !!options.contextual; + this.fallback = !!options.fallback; + this.extend = !!options.extend; + } +}; +function readToken(data2, input, stack, group, precTable, precOffset) { + let state = 0, groupMask = 1 << group, { dialect } = stack.p.parser; + scan: + for (; ; ) { + if ((groupMask & data2[state]) == 0) + break; + let accEnd = data2[state + 1]; + for (let i5 = state + 3; i5 < accEnd; i5 += 2) + if ((data2[i5 + 1] & groupMask) > 0) { + let term = data2[i5]; + if (dialect.allows(term) && (input.token.value == -1 || input.token.value == term || overrides(term, input.token.value, precTable, precOffset))) { + input.acceptToken(term); + break; } - let char = value[0]; - if (value.trim().length === 2) { - char = value.replace(this.plugin.settings.menuTriggerChar, ""); + } + let next = input.next, low = 0, high = data2[state + 2]; + if (input.next < 0 && high > low && data2[accEnd + high * 3 - 3] == 65535 && data2[accEnd + high * 3 - 3] == 65535) { + state = data2[accEnd + high * 3 - 1]; + continue scan; + } + for (; low < high; ) { + let mid = low + high >> 1; + let index = accEnd + mid + (mid << 1); + let from = data2[index], to = data2[index + 1] || 65536; + if (next < from) + high = mid; + else if (next >= to) + low = mid + 1; + else { + state = data2[index + 2]; + input.advance(); + continue scan; + } + } + break; + } +} +function findOffset(data2, start, term) { + for (let i5 = start, next; (next = data2[i5]) != 65535; i5++) + if (next == term) + return i5 - start; + return -1; +} +function overrides(token, prev, tableData, tableOffset) { + let iPrev = findOffset(tableData, tableOffset, prev); + return iPrev < 0 || findOffset(tableData, tableOffset, token) < iPrev; +} +var verbose = typeof process != "undefined" && process.env && /\bparse\b/.test(process.env.LOG); +var stackIDs = null; +var Safety; +(function(Safety2) { + Safety2[Safety2["Margin"] = 25] = "Margin"; +})(Safety || (Safety = {})); +function cutAt(tree, pos, side) { + let cursor = tree.cursor(IterMode.IncludeAnonymous); + cursor.moveTo(pos); + for (; ; ) { + if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos))) + for (; ; ) { + if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError) + return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25)) : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25)); + if (side < 0 ? cursor.prevSibling() : cursor.nextSibling()) + break; + if (!cursor.parent()) + return side < 0 ? 0 : tree.length; + } + } +} +var FragmentCursor = class { + constructor(fragments, nodeSet) { + this.fragments = fragments; + this.nodeSet = nodeSet; + this.i = 0; + this.fragment = null; + this.safeFrom = -1; + this.safeTo = -1; + this.trees = []; + this.start = []; + this.index = []; + this.nextFragment(); + } + nextFragment() { + let fr = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++]; + if (fr) { + this.safeFrom = fr.openStart ? cutAt(fr.tree, fr.from + fr.offset, 1) - fr.offset : fr.from; + this.safeTo = fr.openEnd ? cutAt(fr.tree, fr.to + fr.offset, -1) - fr.offset : fr.to; + while (this.trees.length) { + this.trees.pop(); + this.start.pop(); + this.index.pop(); + } + this.trees.push(fr.tree); + this.start.push(-fr.offset); + this.index.push(0); + this.nextStart = this.safeFrom; + } else { + this.nextStart = 1e9; + } + } + nodeAt(pos) { + if (pos < this.nextStart) + return null; + while (this.fragment && this.safeTo <= pos) + this.nextFragment(); + if (!this.fragment) + return null; + for (; ; ) { + let last = this.trees.length - 1; + if (last < 0) { + this.nextFragment(); + return null; + } + let top = this.trees[last], index = this.index[last]; + if (index == top.children.length) { + this.trees.pop(); + this.start.pop(); + this.index.pop(); + continue; + } + let next = top.children[index]; + let start = this.start[last] + top.positions[index]; + if (start > pos) { + this.nextStart = start; + return null; + } + if (next instanceof Tree) { + if (start == pos) { + if (start < this.safeFrom) + return null; + let end = start + next.length; + if (end <= this.safeTo) { + let lookAhead = next.prop(NodeProp.lookAhead); + if (!lookAhead || end + lookAhead < this.fragment.to) + return next; } - text2.setValue(char); - this.plugin.settings.menuTriggerChar = char; - await this.plugin.saveSettings(); - }); - }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.editorMakePlacholder.name).setDesc(i18n_default.settings.editorMakePlacholder.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.makeMenuPlaceholder).onChange(async (value) => { - this.plugin.settings.makeMenuPlaceholder = value; - await this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - containerEl.createEl("h3", { text: "Flow Styler" }); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineStyler.name).setDesc(i18n_default.settings.inlineStyler.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.inlineStyler).onChange(async (value) => { - this.plugin.settings.inlineStyler = value; - await this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineStickerMenu.name).setDesc(i18n_default.settings.inlineStickerMenu.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.inlineStickerMenu).onChange(async (value) => { - this.plugin.settings.inlineStickerMenu = value; - await this.plugin.saveSettings(); - this.plugin.reloadExtensions(false); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.inlineStylerColor.name).setDesc(i18n_default.settings.inlineStylerColor.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.inlineStylerColors).onChange((value) => { - this.plugin.settings.inlineStylerColors = value; - this.plugin.saveSettings(); - this.refreshView(); - }) - ); - new import_obsidian58.Setting(containerEl).setName(i18n_default.settings.mobileMakeBar.name).setDesc(i18n_default.settings.mobileMakeBar.desc).addToggle( - (toggle) => toggle.setValue(this.plugin.settings.mobileMakeBar).onChange((value) => { - this.plugin.settings.mobileMakeBar = value; - this.plugin.saveSettings(); - this.refreshView(); - }) - ); + } + this.index[last]++; + if (start + next.length >= Math.max(this.safeFrom, pos)) { + this.trees.push(next); + this.start.push(start); + this.index.push(0); + } + } else { + this.index[last]++; + this.nextStart = start + next.length; + } } } }; - -// src/components/Blink/Blink.tsx -var import_obsidian59 = require("obsidian"); -init_compat_module(); - -// src/components/Blink/BlinkComponent.tsx -init_compat_module(); -var BlinkComponent = Cn.forwardRef( - (props2, ref2) => { - const [previewPath, setPreviewPath] = h2(null); - const [allItems, setAllItems] = h2([]); - const defaultOptions4 = F2( - () => app.workspace.getLastOpenFiles().filter((f4) => getAbstractFileAtPath(app, f4)).map((f4) => ({ - description: f4, - value: f4, - name: filePathToString(f4) - })), - [] - ); - p2(() => { - const allTags = loadTags(props2.plugin).map((f4) => ({ - value: f4, - name: f4 - })); - const allNotes = getAllAbstractFilesInVault( - props2.plugin, - app - ).map((f4) => ({ - name: fileNameToString(f4.name), - description: f4.path, - value: f4.path - })); - setAllItems([...allNotes, ...allTags]); - }, []); - const loadPreview = (path) => { - if (previewPath != path && getAbstractFileAtPath(app, path)) { - setPreviewPath(path); +var TokenCache = class { + constructor(parser2, stream) { + this.stream = stream; + this.tokens = []; + this.mainToken = null; + this.actions = []; + this.tokens = parser2.tokenizers.map((_12) => new CachedToken()); + } + getActions(stack) { + let actionIndex = 0; + let main = null; + let { parser: parser2 } = stack.p, { tokenizers } = parser2; + let mask = parser2.stateSlot(stack.state, 3); + let context = stack.curContext ? stack.curContext.hash : 0; + let lookAhead = 0; + for (let i5 = 0; i5 < tokenizers.length; i5++) { + if ((1 << i5 & mask) == 0) + continue; + let tokenizer2 = tokenizers[i5], token = this.tokens[i5]; + if (main && !tokenizer2.fallback) + continue; + if (tokenizer2.contextual || token.start != stack.pos || token.mask != mask || token.context != context) { + this.updateCachedToken(token, tokenizer2, stack); + token.mask = mask; + token.context = context; + } + if (token.lookAhead > token.end + 25) + lookAhead = Math.max(token.lookAhead, lookAhead); + if (token.value != 0) { + let startIndex = actionIndex; + if (token.extended > -1) + actionIndex = this.addActions(stack, token.extended, token.end, actionIndex); + actionIndex = this.addActions(stack, token.value, token.end, actionIndex); + if (!tokenizer2.extend) { + main = token; + if (actionIndex > startIndex) + break; + } } + } + while (this.actions.length > actionIndex) + this.actions.pop(); + if (lookAhead) + stack.setLookAhead(lookAhead); + if (!main && stack.pos == this.stream.end) { + main = new CachedToken(); + main.value = stack.p.parser.eofTerm; + main.start = main.end = stack.pos; + actionIndex = this.addActions(stack, main.value, main.end, actionIndex); + } + this.mainToken = main; + return this.actions; + } + getMainToken(stack) { + if (this.mainToken) + return this.mainToken; + let main = new CachedToken(), { pos, p: p3 } = stack; + main.start = pos; + main.end = Math.min(pos + 1, p3.stream.end); + main.value = pos == p3.stream.end ? p3.parser.eofTerm : 0; + return main; + } + updateCachedToken(token, tokenizer2, stack) { + let start = this.stream.clipPos(stack.pos); + tokenizer2.token(this.stream.reset(start, token), stack); + if (token.value > -1) { + let { parser: parser2 } = stack.p; + for (let i5 = 0; i5 < parser2.specialized.length; i5++) + if (parser2.specialized[i5] == token.value) { + let result = parser2.specializers[i5](this.stream.read(token.start, token.end), stack); + if (result >= 0 && stack.p.parser.dialect.allows(result >> 1)) { + if ((result & 1) == 0) + token.value = result >> 1; + else + token.extended = result >> 1; + break; + } + } + } else { + token.value = 0; + token.end = this.stream.clipPos(start + 1); + } + } + putAction(action, token, end, index) { + for (let i5 = 0; i5 < index; i5 += 3) + if (this.actions[i5] == action) + return index; + this.actions[index++] = action; + this.actions[index++] = token; + this.actions[index++] = end; + return index; + } + addActions(stack, token, end, index) { + let { state } = stack, { parser: parser2 } = stack.p, { data: data2 } = parser2; + for (let set = 0; set < 2; set++) { + for (let i5 = parser2.stateSlot(state, set ? 2 : 1); ; i5 += 3) { + if (data2[i5] == 65535) { + if (data2[i5 + 1] == 1) { + i5 = pair(data2, i5 + 2); + } else { + if (index == 0 && data2[i5 + 1] == 2) + index = this.putAction(pair(data2, i5 + 2), token, end, index); + break; + } + } + if (data2[i5] == token) + index = this.putAction(pair(data2, i5 + 1), token, end, index); + } + } + return index; + } +}; +var Rec; +(function(Rec2) { + Rec2[Rec2["Distance"] = 5] = "Distance"; + Rec2[Rec2["MaxRemainingPerStep"] = 3] = "MaxRemainingPerStep"; + Rec2[Rec2["MinBufferLengthPrune"] = 500] = "MinBufferLengthPrune"; + Rec2[Rec2["ForceReduceLimit"] = 10] = "ForceReduceLimit"; + Rec2[Rec2["CutDepth"] = 15e3] = "CutDepth"; + Rec2[Rec2["CutTo"] = 9e3] = "CutTo"; + Rec2[Rec2["MaxLeftAssociativeReductionCount"] = 300] = "MaxLeftAssociativeReductionCount"; + Rec2[Rec2["MaxStackCount"] = 12] = "MaxStackCount"; +})(Rec || (Rec = {})); +var Parse = class { + constructor(parser2, input, fragments, ranges) { + this.parser = parser2; + this.input = input; + this.ranges = ranges; + this.recovering = 0; + this.nextStackID = 9812; + this.minStackPos = 0; + this.reused = []; + this.stoppedAt = null; + this.lastBigReductionStart = -1; + this.lastBigReductionSize = 0; + this.bigReductionCount = 0; + this.stream = new InputStream(input, ranges); + this.tokens = new TokenCache(parser2, this.stream); + this.topTerm = parser2.top[1]; + let { from } = ranges[0]; + this.stacks = [Stack2.start(this, parser2.top[0], from)]; + this.fragments = fragments.length && this.stream.end - from > parser2.bufferLength * 4 ? new FragmentCursor(fragments, parser2.nodeSet) : null; + } + get parsedPos() { + return this.minStackPos; + } + advance() { + let stacks = this.stacks, pos = this.minStackPos; + let newStacks = this.stacks = []; + let stopped, stoppedTokens; + if (this.bigReductionCount > 300 && stacks.length == 1) { + let [s6] = stacks; + while (s6.forceReduce() && s6.stack.length && s6.stack[s6.stack.length - 2] >= this.lastBigReductionStart) { + } + this.bigReductionCount = this.lastBigReductionSize = 0; + } + for (let i5 = 0; i5 < stacks.length; i5++) { + let stack = stacks[i5]; + for (; ; ) { + this.tokens.mainToken = null; + if (stack.pos > pos) { + newStacks.push(stack); + } else if (this.advanceStack(stack, newStacks, stacks)) { + continue; + } else { + if (!stopped) { + stopped = []; + stoppedTokens = []; + } + stopped.push(stack); + let tok = this.tokens.getMainToken(stack); + stoppedTokens.push(tok.value, tok.end); + } + break; + } + } + if (!newStacks.length) { + let finished = stopped && findFinished(stopped); + if (finished) + return this.stackToTree(finished); + if (this.parser.strict) { + if (verbose && stopped) + console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none")); + throw new SyntaxError("No parse at " + pos); + } + if (!this.recovering) + this.recovering = 5; + } + if (this.recovering && stopped) { + let finished = this.stoppedAt != null && stopped[0].pos > this.stoppedAt ? stopped[0] : this.runRecovery(stopped, stoppedTokens, newStacks); + if (finished) + return this.stackToTree(finished.forceAll()); + } + if (this.recovering) { + let maxRemaining = this.recovering == 1 ? 1 : this.recovering * 3; + if (newStacks.length > maxRemaining) { + newStacks.sort((a6, b4) => b4.score - a6.score); + while (newStacks.length > maxRemaining) + newStacks.pop(); + } + if (newStacks.some((s6) => s6.reducePos > pos)) + this.recovering--; + } else if (newStacks.length > 1) { + outer: + for (let i5 = 0; i5 < newStacks.length - 1; i5++) { + let stack = newStacks[i5]; + for (let j4 = i5 + 1; j4 < newStacks.length; j4++) { + let other = newStacks[j4]; + if (stack.sameState(other) || stack.buffer.length > 500 && other.buffer.length > 500) { + if ((stack.score - other.score || stack.buffer.length - other.buffer.length) > 0) { + newStacks.splice(j4--, 1); + } else { + newStacks.splice(i5--, 1); + continue outer; + } + } + } + } + if (newStacks.length > 12) + newStacks.splice(12, newStacks.length - 12); + } + this.minStackPos = newStacks[0].pos; + for (let i5 = 1; i5 < newStacks.length; i5++) + if (newStacks[i5].pos < this.minStackPos) + this.minStackPos = newStacks[i5].pos; + return null; + } + stopAt(pos) { + if (this.stoppedAt != null && this.stoppedAt < pos) + throw new RangeError("Can't move stoppedAt forward"); + this.stoppedAt = pos; + } + advanceStack(stack, stacks, split) { + let start = stack.pos, { parser: parser2 } = this; + let base2 = verbose ? this.stackID(stack) + " -> " : ""; + if (this.stoppedAt != null && start > this.stoppedAt) + return stack.forceReduce() ? stack : null; + if (this.fragments) { + let strictCx = stack.curContext && stack.curContext.tracker.strict, cxHash = strictCx ? stack.curContext.hash : 0; + for (let cached = this.fragments.nodeAt(start); cached; ) { + let match2 = this.parser.nodeSet.types[cached.type.id] == cached.type ? parser2.getGoto(stack.state, cached.type.id) : -1; + if (match2 > -1 && cached.length && (!strictCx || (cached.prop(NodeProp.contextHash) || 0) == cxHash)) { + stack.useNode(cached, match2); + if (verbose) + console.log(base2 + this.stackID(stack) + ` (via reuse of ${parser2.getName(cached.type.id)})`); + return true; + } + if (!(cached instanceof Tree) || cached.children.length == 0 || cached.positions[0] > 0) + break; + let inner = cached.children[0]; + if (inner instanceof Tree && cached.positions[0] == 0) + cached = inner; + else + break; + } + } + let defaultReduce = parser2.stateSlot(stack.state, 4); + if (defaultReduce > 0) { + stack.reduce(defaultReduce); + if (verbose) + console.log(base2 + this.stackID(stack) + ` (via always-reduce ${parser2.getName(defaultReduce & 65535)})`); + return true; + } + if (stack.stack.length >= 15e3) { + while (stack.stack.length > 9e3 && stack.forceReduce()) { + } + } + let actions = this.tokens.getActions(stack); + for (let i5 = 0; i5 < actions.length; ) { + let action = actions[i5++], term = actions[i5++], end = actions[i5++]; + let last = i5 == actions.length || !split; + let localStack = last ? stack : stack.split(); + localStack.apply(action, term, end); + if (verbose) + console.log(base2 + this.stackID(localStack) + ` (via ${(action & 65536) == 0 ? "shift" : `reduce of ${parser2.getName(action & 65535)}`} for ${parser2.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`); + if (last) + return true; + else if (localStack.pos > start) + stacks.push(localStack); + else + split.push(localStack); + } + return false; + } + advanceFully(stack, newStacks) { + let pos = stack.pos; + for (; ; ) { + if (!this.advanceStack(stack, null, null)) + return false; + if (stack.pos > pos) { + pushStackDedup(stack, newStacks); + return true; + } + } + } + runRecovery(stacks, tokens, newStacks) { + let finished = null, restarted = false; + for (let i5 = 0; i5 < stacks.length; i5++) { + let stack = stacks[i5], token = tokens[i5 << 1], tokenEnd = tokens[(i5 << 1) + 1]; + let base2 = verbose ? this.stackID(stack) + " -> " : ""; + if (stack.deadEnd) { + if (restarted) + continue; + restarted = true; + stack.restart(); + if (verbose) + console.log(base2 + this.stackID(stack) + " (restarted)"); + let done = this.advanceFully(stack, newStacks); + if (done) + continue; + } + let force = stack.split(), forceBase = base2; + for (let j4 = 0; force.forceReduce() && j4 < 10; j4++) { + if (verbose) + console.log(forceBase + this.stackID(force) + " (via force-reduce)"); + let done = this.advanceFully(force, newStacks); + if (done) + break; + if (verbose) + forceBase = this.stackID(force) + " -> "; + } + for (let insert2 of stack.recoverByInsert(token)) { + if (verbose) + console.log(base2 + this.stackID(insert2) + " (via recover-insert)"); + this.advanceFully(insert2, newStacks); + } + if (this.stream.end > stack.pos) { + if (tokenEnd == stack.pos) { + tokenEnd++; + token = 0; + } + stack.recoverByDelete(token, tokenEnd); + if (verbose) + console.log(base2 + this.stackID(stack) + ` (via recover-delete ${this.parser.getName(token)})`); + pushStackDedup(stack, newStacks); + } else if (!finished || finished.score < stack.score) { + finished = stack; + } + } + return finished; + } + stackToTree(stack) { + stack.close(); + return Tree.build({ + buffer: StackBufferCursor.create(stack), + nodeSet: this.parser.nodeSet, + topID: this.topTerm, + maxBufferLength: this.parser.bufferLength, + reused: this.reused, + start: this.ranges[0].from, + length: stack.pos - this.ranges[0].from, + minRepeatType: this.parser.minRepeatTerm + }); + } + stackID(stack) { + let id3 = (stackIDs || (stackIDs = /* @__PURE__ */ new WeakMap())).get(stack); + if (!id3) + stackIDs.set(stack, id3 = String.fromCodePoint(this.nextStackID++)); + return id3 + stack; + } +}; +function pushStackDedup(stack, newStacks) { + for (let i5 = 0; i5 < newStacks.length; i5++) { + let other = newStacks[i5]; + if (other.pos == stack.pos && other.sameState(stack)) { + if (newStacks[i5].score < stack.score) + newStacks[i5] = stack; + return; + } + } + newStacks.push(stack); +} +var Dialect = class { + constructor(source, flags, disabled) { + this.source = source; + this.flags = flags; + this.disabled = disabled; + } + allows(term) { + return !this.disabled || this.disabled[term] == 0; + } +}; +var id2 = (x5) => x5; +var ContextTracker = class { + constructor(spec) { + this.start = spec.start; + this.shift = spec.shift || id2; + this.reduce = spec.reduce || id2; + this.reuse = spec.reuse || id2; + this.hash = spec.hash || (() => 0); + this.strict = spec.strict !== false; + } +}; +var LRParser = class extends Parser3 { + constructor(spec) { + super(); + this.wrappers = []; + if (spec.version != 14) + throw new RangeError(`Parser version (${spec.version}) doesn't match runtime version (${14})`); + let nodeNames = spec.nodeNames.split(" "); + this.minRepeatTerm = nodeNames.length; + for (let i5 = 0; i5 < spec.repeatNodeCount; i5++) + nodeNames.push(""); + let topTerms = Object.keys(spec.topRules).map((r3) => spec.topRules[r3][1]); + let nodeProps = []; + for (let i5 = 0; i5 < nodeNames.length; i5++) + nodeProps.push([]); + function setProp(nodeID, prop, value) { + nodeProps[nodeID].push([prop, prop.deserialize(String(value))]); + } + if (spec.nodeProps) + for (let propSpec of spec.nodeProps) { + let prop = propSpec[0]; + if (typeof prop == "string") + prop = NodeProp[prop]; + for (let i5 = 1; i5 < propSpec.length; ) { + let next = propSpec[i5++]; + if (next >= 0) { + setProp(next, prop, propSpec[i5++]); + } else { + let value = propSpec[i5 + -next]; + for (let j4 = -next; j4 > 0; j4--) + setProp(propSpec[i5++], prop, value); + i5++; + } + } + } + this.nodeSet = new NodeSet(nodeNames.map((name2, i5) => NodeType.define({ + name: i5 >= this.minRepeatTerm ? void 0 : name2, + id: i5, + props: nodeProps[i5], + top: topTerms.indexOf(i5) > -1, + error: i5 == 0, + skipped: spec.skippedNodes && spec.skippedNodes.indexOf(i5) > -1 + }))); + if (spec.propSources) + this.nodeSet = this.nodeSet.extend(...spec.propSources); + this.strict = false; + this.bufferLength = DefaultBufferLength; + let tokenArray = decodeArray(spec.tokenData); + this.context = spec.context; + this.specializerSpecs = spec.specialized || []; + this.specialized = new Uint16Array(this.specializerSpecs.length); + for (let i5 = 0; i5 < this.specializerSpecs.length; i5++) + this.specialized[i5] = this.specializerSpecs[i5].term; + this.specializers = this.specializerSpecs.map(getSpecializer); + this.states = decodeArray(spec.states, Uint32Array); + this.data = decodeArray(spec.stateData); + this.goto = decodeArray(spec.goto); + this.maxTerm = spec.maxTerm; + this.tokenizers = spec.tokenizers.map((value) => typeof value == "number" ? new TokenGroup(tokenArray, value) : value); + this.topRules = spec.topRules; + this.dialects = spec.dialects || {}; + this.dynamicPrecedences = spec.dynamicPrecedences || null; + this.tokenPrecTable = spec.tokenPrec; + this.termNames = spec.termNames || null; + this.maxNode = this.nodeSet.types.length - 1; + this.dialect = this.parseDialect(); + this.top = this.topRules[Object.keys(this.topRules)[0]]; + } + createParse(input, fragments, ranges) { + let parse5 = new Parse(this, input, fragments, ranges); + for (let w5 of this.wrappers) + parse5 = w5(parse5, input, fragments, ranges); + return parse5; + } + getGoto(state, term, loose = false) { + let table = this.goto; + if (term >= table[0]) + return -1; + for (let pos = table[term + 1]; ; ) { + let groupTag = table[pos++], last = groupTag & 1; + let target = table[pos++]; + if (last && loose) + return target; + for (let end = pos + (groupTag >> 1); pos < end; pos++) + if (table[pos] == state) + return target; + if (last) + return -1; + } + } + hasAction(state, terminal) { + let data2 = this.data; + for (let set = 0; set < 2; set++) { + for (let i5 = this.stateSlot(state, set ? 2 : 1), next; ; i5 += 3) { + if ((next = data2[i5]) == 65535) { + if (data2[i5 + 1] == 1) + next = data2[i5 = pair(data2, i5 + 2)]; + else if (data2[i5 + 1] == 2) + return pair(data2, i5 + 2); + else + break; + } + if (next == terminal || next == 0) + return pair(data2, i5 + 1); + } + } + return 0; + } + stateSlot(state, slot) { + return this.states[state * 6 + slot]; + } + stateFlag(state, flag) { + return (this.stateSlot(state, 0) & flag) > 0; + } + validAction(state, action) { + if (action == this.stateSlot(state, 4)) + return true; + for (let i5 = this.stateSlot(state, 1); ; i5 += 3) { + if (this.data[i5] == 65535) { + if (this.data[i5 + 1] == 1) + i5 = pair(this.data, i5 + 2); + else + return false; + } + if (action == pair(this.data, i5 + 1)) + return true; + } + } + nextStates(state) { + let result = []; + for (let i5 = this.stateSlot(state, 1); ; i5 += 3) { + if (this.data[i5] == 65535) { + if (this.data[i5 + 1] == 1) + i5 = pair(this.data, i5 + 2); + else + break; + } + if ((this.data[i5 + 2] & 65536 >> 16) == 0) { + let value = this.data[i5 + 1]; + if (!result.some((v4, i6) => i6 & 1 && v4 == value)) + result.push(this.data[i5], value); + } + } + return result; + } + configure(config) { + let copy = Object.assign(Object.create(LRParser.prototype), this); + if (config.props) + copy.nodeSet = this.nodeSet.extend(...config.props); + if (config.top) { + let info = this.topRules[config.top]; + if (!info) + throw new RangeError(`Invalid top rule name ${config.top}`); + copy.top = info; + } + if (config.tokenizers) + copy.tokenizers = this.tokenizers.map((t5) => { + let found = config.tokenizers.find((r3) => r3.from == t5); + return found ? found.to : t5; + }); + if (config.specializers) { + copy.specializers = this.specializers.slice(); + copy.specializerSpecs = this.specializerSpecs.map((s6, i5) => { + let found = config.specializers.find((r3) => r3.from == s6.external); + if (!found) + return s6; + let spec = Object.assign(Object.assign({}, s6), { external: found.to }); + copy.specializers[i5] = getSpecializer(spec); + return spec; + }); + } + if (config.contextTracker) + copy.context = config.contextTracker; + if (config.dialect) + copy.dialect = this.parseDialect(config.dialect); + if (config.strict != null) + copy.strict = config.strict; + if (config.wrap) + copy.wrappers = copy.wrappers.concat(config.wrap); + if (config.bufferLength != null) + copy.bufferLength = config.bufferLength; + return copy; + } + hasWrappers() { + return this.wrappers.length > 0; + } + getName(term) { + return this.termNames ? this.termNames[term] : String(term <= this.maxNode && this.nodeSet.types[term].name || term); + } + get eofTerm() { + return this.maxNode + 1; + } + get topNode() { + return this.nodeSet.types[this.top[1]]; + } + dynamicPrecedence(term) { + let prec = this.dynamicPrecedences; + return prec == null ? 0 : prec[term] || 0; + } + parseDialect(dialect) { + let values = Object.keys(this.dialects), flags = values.map(() => false); + if (dialect) + for (let part of dialect.split(" ")) { + let id3 = values.indexOf(part); + if (id3 >= 0) + flags[id3] = true; + } + let disabled = null; + for (let i5 = 0; i5 < values.length; i5++) + if (!flags[i5]) { + for (let j4 = this.dialects[values[i5]], id3; (id3 = this.data[j4++]) != 65535; ) + (disabled || (disabled = new Uint8Array(this.maxTerm + 1)))[id3] = 1; + } + return new Dialect(dialect, flags, disabled); + } + static deserialize(spec) { + return new LRParser(spec); + } +}; +function pair(data2, off) { + return data2[off] | data2[off + 1] << 16; +} +function findFinished(stacks) { + let best = null; + for (let stack of stacks) { + let stopped = stack.p.stoppedAt; + if ((stack.pos == stack.p.stream.end || stopped != null && stack.pos > stopped) && stack.p.parser.stateFlag(stack.state, 2) && (!best || best.score < stack.score)) + best = stack; + } + return best; +} +function getSpecializer(spec) { + if (spec.external) { + let mask = spec.extend ? 1 : 0; + return (value, stack) => spec.external(value, stack) << 1 | mask; + } + return spec.get; +} + +// node_modules/@lezer/highlight/dist/index.js +var nextTagID = 0; +var Tag = class { + constructor(set, base2, modified) { + this.set = set; + this.base = base2; + this.modified = modified; + this.id = nextTagID++; + } + static define(parent) { + if (parent === null || parent === void 0 ? void 0 : parent.base) + throw new Error("Can not derive from a modified tag"); + let tag = new Tag([], null, []); + tag.set.push(tag); + if (parent) + for (let t5 of parent.set) + tag.set.push(t5); + return tag; + } + static defineModifier() { + let mod = new Modifier3(); + return (tag) => { + if (tag.modified.indexOf(mod) > -1) + return tag; + return Modifier3.get(tag.base || tag, tag.modified.concat(mod).sort((a6, b4) => a6.id - b4.id)); }; - const hoverItem = (item) => { - loadPreview(item); - }; - const selectItem = (item) => { - if (!item) - return; - openPath(props2.plugin, uriByString(item)); - }; - const optionProps = { - multi: false, - editable: true, - plugin: props2.plugin, - onHover: hoverItem, - value: [], - options: allItems, - defaultOptions: defaultOptions4, - saveOptions: (_12, items) => selectItem(items[0]), - placeholder: i18n_default.labels.blinkPlaceholder, - searchable: true, - showAll: true - }; - return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(selectMenu_default, { - ref: ref2, - plugin: props2.plugin, - ...optionProps, - hide: props2.hide, - previewComponent: previewPath && /* @__PURE__ */ Cn.createElement("div", { - className: "mk-blink-preview" - }, /* @__PURE__ */ Cn.createElement(FlowView, { - plugin: props2.plugin, - path: previewPath, - load: true - })) - })); } -); -BlinkComponent.displayName = "BlinkComponent"; -var BlinkComponent_default = BlinkComponent; - -// src/components/Blink/Blink.tsx -var Blink = class extends import_obsidian59.Modal { - constructor(app2, plugin) { - super(app2); - this.ref = Cn.createRef(); - this.plugin = plugin; - this.modalEl.toggleClass("mk-blink-modal", true); - this.modalEl.toggleClass("modal", false); - this.modalEl.toggleClass("prompt", true); - const keys2 = [...this.scope.keys]; - for (let i4 = 0; i4 < keys2.length; i4++) { - if (keys2[i4].key == "Escape") { - this.scope.unregister(keys2[i4]); - this.scope.register([], "Escape", () => { - var _a2; - const blurred = (_a2 = this.ref) == null ? void 0 : _a2.current(); - if (blurred) { - this.close(); +}; +var nextModifierID = 0; +var Modifier3 = class { + constructor() { + this.instances = []; + this.id = nextModifierID++; + } + static get(base2, mods) { + if (!mods.length) + return base2; + let exists = mods[0].instances.find((t5) => t5.base == base2 && sameArray(mods, t5.modified)); + if (exists) + return exists; + let set = [], tag = new Tag(set, base2, mods); + for (let m6 of mods) + m6.instances.push(tag); + let configs = powerSet(mods); + for (let parent of base2.set) + if (!parent.modified.length) + for (let config of configs) + set.push(Modifier3.get(parent, config)); + return tag; + } +}; +function sameArray(a6, b4) { + return a6.length == b4.length && a6.every((x5, i5) => x5 == b4[i5]); +} +function powerSet(array) { + let sets = [[]]; + for (let i5 = 0; i5 < array.length; i5++) { + for (let j4 = 0, e4 = sets.length; j4 < e4; j4++) { + sets.push(sets[j4].concat(array[i5])); + } + } + return sets.sort((a6, b4) => b4.length - a6.length); +} +function styleTags(spec) { + let byName = /* @__PURE__ */ Object.create(null); + for (let prop in spec) { + let tags2 = spec[prop]; + if (!Array.isArray(tags2)) + tags2 = [tags2]; + for (let part of prop.split(" ")) + if (part) { + let pieces = [], mode = 2, rest = part; + for (let pos = 0; ; ) { + if (rest == "..." && pos > 0 && pos + 3 == part.length) { + mode = 1; + break; } - }); + let m6 = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest); + if (!m6) + throw new RangeError("Invalid path: " + part); + pieces.push(m6[0] == "*" ? "" : m6[0][0] == '"' ? JSON.parse(m6[0]) : m6[0]); + pos += m6[0].length; + if (pos == part.length) + break; + let next = part[pos++]; + if (pos == part.length && next == "!") { + mode = 0; + break; + } + if (next != "/") + throw new RangeError("Invalid path: " + part); + rest = part.slice(pos); + } + let last = pieces.length - 1, inner = pieces[last]; + if (!inner) + throw new RangeError("Invalid path: " + part); + let rule = new Rule(tags2, mode, last > 0 ? pieces.slice(0, last) : null); + byName[inner] = rule.sort(byName[inner]); } + } + return ruleNodeProp.add(byName); +} +var ruleNodeProp = new NodeProp(); +var Rule = class { + constructor(tags2, mode, context, next) { + this.tags = tags2; + this.mode = mode; + this.context = context; + this.next = next; + } + get opaque() { + return this.mode == 0; + } + get inherit() { + return this.mode == 1; + } + sort(other) { + if (!other || other.depth < this.depth) { + this.next = other; + return this; } - this.root = createRoot(this.modalEl); - this.root.render( - /* @__PURE__ */ Cn.createElement(BlinkComponent_default, { - ref: this.ref, - plugin, - hide: () => this.close() - }) - ); + other.next = this.sort(other.next); + return other; + } + get depth() { + return this.context ? this.context.length : 0; } }; +Rule.empty = new Rule([], 2, null); +function tagHighlighter(tags2, options) { + let map2 = /* @__PURE__ */ Object.create(null); + for (let style of tags2) { + if (!Array.isArray(style.tag)) + map2[style.tag.id] = style.class; + else + for (let tag of style.tag) + map2[tag.id] = style.class; + } + let { scope, all = null } = options || {}; + return { + style: (tags3) => { + let cls = all; + for (let tag of tags3) { + for (let sub of tag.set) { + let tagClass = map2[sub.id]; + if (tagClass) { + cls = cls ? cls + " " + tagClass : tagClass; + break; + } + } + } + return cls; + }, + scope + }; +} +var t4 = Tag.define; +var comment = t4(); +var name = t4(); +var typeName = t4(name); +var propertyName = t4(name); +var literal2 = t4(); +var string = t4(literal2); +var number = t4(literal2); +var content = t4(); +var heading = t4(content); +var keyword = t4(); +var operator = t4(); +var punctuation = t4(); +var bracket = t4(punctuation); +var meta = t4(); +var tags = { + comment, + lineComment: t4(comment), + blockComment: t4(comment), + docComment: t4(comment), + name, + variableName: t4(name), + typeName, + tagName: t4(typeName), + propertyName, + attributeName: t4(propertyName), + className: t4(name), + labelName: t4(name), + namespace: t4(name), + macroName: t4(name), + literal: literal2, + string, + docString: t4(string), + character: t4(string), + attributeValue: t4(string), + number, + integer: t4(number), + float: t4(number), + bool: t4(literal2), + regexp: t4(literal2), + escape: t4(literal2), + color: t4(literal2), + url: t4(literal2), + keyword, + self: t4(keyword), + null: t4(keyword), + atom: t4(keyword), + unit: t4(keyword), + modifier: t4(keyword), + operatorKeyword: t4(keyword), + controlKeyword: t4(keyword), + definitionKeyword: t4(keyword), + moduleKeyword: t4(keyword), + operator, + derefOperator: t4(operator), + arithmeticOperator: t4(operator), + logicOperator: t4(operator), + bitwiseOperator: t4(operator), + compareOperator: t4(operator), + updateOperator: t4(operator), + definitionOperator: t4(operator), + typeOperator: t4(operator), + controlOperator: t4(operator), + punctuation, + separator: t4(punctuation), + bracket, + angleBracket: t4(bracket), + squareBracket: t4(bracket), + paren: t4(bracket), + brace: t4(bracket), + content, + heading, + heading1: t4(heading), + heading2: t4(heading), + heading3: t4(heading), + heading4: t4(heading), + heading5: t4(heading), + heading6: t4(heading), + contentSeparator: t4(content), + list: t4(content), + quote: t4(content), + emphasis: t4(content), + strong: t4(content), + link: t4(content), + monospace: t4(content), + strikethrough: t4(content), + inserted: t4(), + deleted: t4(), + changed: t4(), + invalid: t4(), + meta, + documentMeta: t4(meta), + annotation: t4(meta), + processingInstruction: t4(meta), + definition: Tag.defineModifier(), + constant: Tag.defineModifier(), + function: Tag.defineModifier(), + standard: Tag.defineModifier(), + local: Tag.defineModifier(), + special: Tag.defineModifier() +}; +var classHighlighter = tagHighlighter([ + { tag: tags.link, class: "tok-link" }, + { tag: tags.heading, class: "tok-heading" }, + { tag: tags.emphasis, class: "tok-emphasis" }, + { tag: tags.strong, class: "tok-strong" }, + { tag: tags.keyword, class: "tok-keyword" }, + { tag: tags.atom, class: "tok-atom" }, + { tag: tags.bool, class: "tok-bool" }, + { tag: tags.url, class: "tok-url" }, + { tag: tags.labelName, class: "tok-labelName" }, + { tag: tags.inserted, class: "tok-inserted" }, + { tag: tags.deleted, class: "tok-deleted" }, + { tag: tags.literal, class: "tok-literal" }, + { tag: tags.string, class: "tok-string" }, + { tag: tags.number, class: "tok-number" }, + { tag: [tags.regexp, tags.escape, tags.special(tags.string)], class: "tok-string2" }, + { tag: tags.variableName, class: "tok-variableName" }, + { tag: tags.local(tags.variableName), class: "tok-variableName tok-local" }, + { tag: tags.definition(tags.variableName), class: "tok-variableName tok-definition" }, + { tag: tags.special(tags.variableName), class: "tok-variableName2" }, + { tag: tags.definition(tags.propertyName), class: "tok-propertyName tok-definition" }, + { tag: tags.typeName, class: "tok-typeName" }, + { tag: tags.namespace, class: "tok-namespace" }, + { tag: tags.className, class: "tok-className" }, + { tag: tags.macroName, class: "tok-macroName" }, + { tag: tags.propertyName, class: "tok-propertyName" }, + { tag: tags.operator, class: "tok-operator" }, + { tag: tags.comment, class: "tok-comment" }, + { tag: tags.meta, class: "tok-meta" }, + { tag: tags.invalid, class: "tok-invalid" }, + { tag: tags.punctuation, class: "tok-punctuation" } +]); -// src/components/FileContexts/ContextExplorer.tsx -init_compat_module(); - -// src/components/Space/Frames/FrameInspector.tsx -init_compat_module(); - -// src/components/Space/Frames/FrameStyler.tsx -init_compat_module(); - -// src/components/Space/Frames/Panels/BorderPanel.tsx -init_compat_module(); - -// src/components/Space/Frames/Setters/ColorSetter.tsx -init_compat_module(); - -// src/components/Space/Frames/Setters/StepSetter.tsx -init_compat_module(); - -// src/components/Space/Frames/Panels/CornersPanel.tsx -init_compat_module(); - -// src/components/Space/Frames/Setters/SliderSetter.tsx -init_compat_module(); - -// src/components/Space/Frames/Panels/ColorPanel.tsx -init_compat_module(); - -// src/components/Space/Frames/Setters/TextSetter.tsx -init_compat_module(); - -// src/components/Space/Frames/Panels/LayoutPanel.tsx -init_compat_module(); - -// src/components/Space/Frames/Setters/RadioGroupSetter.tsx -init_compat_module(); - -// src/components/Space/Frames/Panels/TypographyPanel.tsx -init_compat_module(); +// node_modules/@lezer/javascript/dist/index.es.js +var noSemi = 302; +var incdec = 1; +var incdecPrefix = 2; +var insertSemi = 303; +var spaces = 305; +var newline = 306; +var LineComment = 3; +var BlockComment = 4; +var space = [ + 9, + 10, + 11, + 12, + 13, + 32, + 133, + 160, + 5760, + 8192, + 8193, + 8194, + 8195, + 8196, + 8197, + 8198, + 8199, + 8200, + 8201, + 8202, + 8232, + 8233, + 8239, + 8287, + 12288 +]; +var braceR = 125; +var semicolon = 59; +var slash = 47; +var star = 42; +var plus = 43; +var minus = 45; +var trackNewline = new ContextTracker({ + start: false, + shift(context, term) { + return term == LineComment || term == BlockComment || term == spaces ? context : term == newline; + }, + strict: false +}); +var insertSemicolon = new ExternalTokenizer((input, stack) => { + let { next } = input; + if ((next == braceR || next == -1 || stack.context) && stack.canShift(insertSemi)) + input.acceptToken(insertSemi); +}, { contextual: true, fallback: true }); +var noSemicolon = new ExternalTokenizer((input, stack) => { + let { next } = input, after; + if (space.indexOf(next) > -1) + return; + if (next == slash && ((after = input.peek(1)) == slash || after == star)) + return; + if (next != braceR && next != semicolon && next != -1 && !stack.context && stack.canShift(noSemi)) + input.acceptToken(noSemi); +}, { contextual: true }); +var incdecToken = new ExternalTokenizer((input, stack) => { + let { next } = input; + if (next == plus || next == minus) { + input.advance(); + if (next == input.next) { + input.advance(); + let mayPostfix = !stack.context && stack.canShift(incdec); + input.acceptToken(mayPostfix ? incdec : incdecPrefix); + } + } +}, { contextual: true }); +var jsHighlight = styleTags({ + "get set async static": tags.modifier, + "for while do if else switch try catch finally return throw break continue default case": tags.controlKeyword, + "in of await yield void typeof delete instanceof": tags.operatorKeyword, + "let var const function class extends": tags.definitionKeyword, + "import export from": tags.moduleKeyword, + "with debugger as new": tags.keyword, + TemplateString: tags.special(tags.string), + super: tags.atom, + BooleanLiteral: tags.bool, + this: tags.self, + null: tags.null, + Star: tags.modifier, + VariableName: tags.variableName, + "CallExpression/VariableName TaggedTemplateExpression/VariableName": tags.function(tags.variableName), + VariableDefinition: tags.definition(tags.variableName), + Label: tags.labelName, + PropertyName: tags.propertyName, + PrivatePropertyName: tags.special(tags.propertyName), + "CallExpression/MemberExpression/PropertyName": tags.function(tags.propertyName), + "FunctionDeclaration/VariableDefinition": tags.function(tags.definition(tags.variableName)), + "ClassDeclaration/VariableDefinition": tags.definition(tags.className), + PropertyDefinition: tags.definition(tags.propertyName), + PrivatePropertyDefinition: tags.definition(tags.special(tags.propertyName)), + UpdateOp: tags.updateOperator, + LineComment: tags.lineComment, + BlockComment: tags.blockComment, + Number: tags.number, + String: tags.string, + Escape: tags.escape, + ArithOp: tags.arithmeticOperator, + LogicOp: tags.logicOperator, + BitOp: tags.bitwiseOperator, + CompareOp: tags.compareOperator, + RegExp: tags.regexp, + Equals: tags.definitionOperator, + Arrow: tags.function(tags.punctuation), + ": Spread": tags.punctuation, + "( )": tags.paren, + "[ ]": tags.squareBracket, + "{ }": tags.brace, + "InterpolationStart InterpolationEnd": tags.special(tags.brace), + ".": tags.derefOperator, + ", ;": tags.separator, + "@": tags.meta, + TypeName: tags.typeName, + TypeDefinition: tags.definition(tags.typeName), + "type enum interface implements namespace module declare": tags.definitionKeyword, + "abstract global Privacy readonly override": tags.modifier, + "is keyof unique infer": tags.operatorKeyword, + JSXAttributeValue: tags.attributeValue, + JSXText: tags.content, + "JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag": tags.angleBracket, + "JSXIdentifier JSXNameSpacedName": tags.tagName, + "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": tags.attributeName, + "JSXBuiltin/JSXIdentifier": tags.standard(tags.tagName) +}); +var spec_identifier = { __proto__: null, export: 14, as: 19, from: 27, default: 30, async: 35, function: 36, extends: 46, this: 50, true: 58, false: 58, null: 70, void: 74, typeof: 78, super: 96, new: 130, delete: 146, yield: 155, await: 159, class: 164, public: 221, private: 221, protected: 221, readonly: 223, instanceof: 242, satisfies: 245, in: 246, const: 248, import: 280, keyof: 335, unique: 339, infer: 345, is: 381, abstract: 401, implements: 403, type: 405, let: 408, var: 410, interface: 417, enum: 421, namespace: 427, module: 429, declare: 433, global: 437, for: 456, of: 465, while: 468, with: 472, do: 476, if: 480, else: 482, switch: 486, case: 492, try: 498, catch: 502, finally: 506, return: 510, throw: 514, break: 518, continue: 522, debugger: 526 }; +var spec_word = { __proto__: null, async: 117, get: 119, set: 121, declare: 181, public: 183, private: 183, protected: 183, static: 185, abstract: 187, override: 189, readonly: 195, accessor: 197, new: 385 }; +var spec_LessThan = { __proto__: null, "<": 137 }; +var parser = LRParser.deserialize({ + version: 14, + states: "$6[O`QUOOO%QQUOOO'TQWOOP(bOSOOO*pQ(CjO'#CfO*wOpO'#CgO+VO!bO'#CgO+eO07`O'#DZO-vQUO'#DaO.WQUO'#DlO%QQUO'#DvO0[QUO'#EOOOQ(CY'#EW'#EWO0uQSO'#ETOOQO'#Ei'#EiOOQO'#Ib'#IbO0}QSO'#GkO1YQSO'#EhO1_QSO'#EhO3aQ(CjO'#JcO6QQ(CjO'#JdO6nQSO'#FWO6sQ#tO'#FoOOQ(CY'#F`'#F`O7OO&jO'#F`O7^Q,UO'#FvO8tQSO'#FuOOQ(CY'#Jd'#JdOOQ(CW'#Jc'#JcOOQQ'#KO'#KOO8yQSO'#IOO9OQ(C[O'#IPOOQQ'#JP'#JPOOQQ'#IT'#ITQ`QUOOO%QQUO'#DnO9WQUO'#DzO%QQUO'#D|O9_QSO'#GkO9dQ,UO'#ClO9rQSO'#EgO9}QSO'#ErO:SQ,UO'#F_O:qQSO'#GkO:vQSO'#GoO;RQSO'#GoO;aQSO'#GrO;aQSO'#GsO;aQSO'#GuO9_QSO'#GxOQQSO'#HnO>VQ(C]O'#HtO%QQUO'#HvO>bQ(C]O'#HxO>mQ(C]O'#HzO9OQ(C[O'#H|O>xQ(CjO'#CfO?zQWO'#DfQOQSOOO@bQSO'#EPO9dQ,UO'#EgO@mQSO'#EgO@xQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jg'#JgO%QQUO'#JgOOQO'#Jk'#JkOOQO'#I_'#I_OAxQWO'#E`OOQ(CW'#E_'#E_OBtQ(C`O'#E`OCOQWO'#ESOOQO'#Jj'#JjOCdQWO'#JkODqQWO'#ESOCOQWO'#E`PEOO?MpO'#C`POOO)CDn)CDnOOOO'#IU'#IUOEZOpO,59ROOQ(CY,59R,59ROOOO'#IV'#IVOEiO!bO,59RO%QQUO'#D]OOOO'#IX'#IXOEwO07`O,59uOOQ(CY,59u,59uOFVQUO'#IYOFjQSO'#JeOHlQbO'#JeO+sQUO'#JeOHsQSO,59{OIZQSO'#EiOIhQSO'#JsOIsQSO'#JrOIsQSO'#JrOI{QSO,5;VOJQQSO'#JqOOQ(CY,5:W,5:WOJXQUO,5:WOLYQ(CjO,5:bOLyQSO,5:jOMdQ(C[O'#JpOMkQSO'#JoO:vQSO'#JoONPQSO'#JoONXQSO,5;UON^QSO'#JoO!!fQbO'#JdOOQ(CY'#Cf'#CfO%QQUO'#EOO!#UQ`O,5:oOOQO'#Jl'#JlOOQO-E<`-E<`O9_QSO,5=VO!#lQSO,5=VO!#qQUO,5;SO!%tQ,UO'#EdO!'XQSO,5;SO!(qQ,UO'#DpO!(xQUO'#DuO!)SQWO,5;]O!)[QWO,5;]O%QQUO,5;]OOQQ'#FO'#FOOOQQ'#FQ'#FQO%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^O%QQUO,5;^OOQQ'#FU'#FUO!)jQUO,5;oOOQ(CY,5;t,5;tOOQ(CY,5;u,5;uO!+mQSO,5;uOOQ(CY,5;v,5;vO%QQUO'#IfO!+uQ(C[O,5jOOQQ'#JX'#JXOOQQ,5>k,5>kOOQQ-ERQ(C[O'#JYO8tQSO'#JYO!>dQ(C[O,59WO!>oQWO,59WO!>wQ,UO,59WO9dQ,UO,59WO!?SQSO,5;SO!?[QSO'#HWO!?mQSO'#KSO%QQUO,5;wO!?uQWO,5;yO!?zQSO,5=qO!@PQSO,5=qO!@UQSO,5=qO9OQ(C[O,5=qO!@dQSO'#EkO!A^QWO'#ElOOQ(CW'#Jq'#JqO!AeQ(C[O'#KPO9OQ(C[O,5=ZO;aQSO,5=aOOQO'#Cr'#CrO!ApQWO,5=^O!AxQ,UO,5=_O!BTQSO,5=aO!BYQ`O,5=dO>QQSO'#G}O9_QSO'#HPO!BbQSO'#HPO9dQ,UO'#HRO!BgQSO'#HROOQQ,5=g,5=gO!BlQSO'#HSO!BtQSO'#ClO!ByQSO,58|O!CTQSO,58|O!E]QUO,58|OOQQ,58|,58|O!EjQ(C[O,58|O%QQUO,58|O!EuQUO'#HZOOQQ'#H['#H[OOQQ'#H]'#H]O`QUO,5=sO!FVQSO,5=sO`QUO,5=yO`QUO,5={O!F[QSO,5=}O`QUO,5>PO!FaQSO,5>SO!FfQUO,5>YOOQQ,5>`,5>`O%QQUO,5>`O9OQ(C[O,5>bOOQQ,5>d,5>dO!JmQSO,5>dOOQQ,5>f,5>fO!JmQSO,5>fOOQQ,5>h,5>hO!JrQWO'#DXO%QQUO'#JgO!KaQWO'#JgO!LOQWO'#DgO!LaQWO'#DgO!NrQUO'#DgO!NyQSO'#JfO# RQSO,5:QO# WQSO'#EmO# fQSO'#JtO# nQSO,5;WO# sQWO'#DgO#!QQWO'#EROOQ(CY,5:k,5:kO%QQUO,5:kO#!XQSO,5:kO>QQSO,5;RO!>oQWO,5;RO!>wQ,UO,5;RO9dQ,UO,5;RO#!aQSO,5@RO#!fQ!LQO,5:oOOQO-E<]-E<]O##lQ(C`O,5:zOCOQWO,5:nO##vQWO,5:nOCOQWO,5:zO!>dQ(C[O,5:nOOQ(CW'#Ec'#EcOOQO,5:z,5:zO%QQUO,5:zO#$TQ(C[O,5:zO#$`Q(C[O,5:zO!>oQWO,5:nOOQO,5;Q,5;QO#$nQ(C[O,5:zPOOO'#IS'#ISP#%SO?MpO,58zPOOO,58z,58zOOOO-EtO+sQUO,5>tOOQO,5>z,5>zO#%nQUO'#IYOOQO-EdQ(C[O1G.rO!>oQWO1G.rO!>wQ,UO1G.rO$%YQSO1G0nO$%_QSO'#CfO$%jQSO'#KTO$%rQSO,5=rO$%wQSO'#KTO$%|QSO'#KTO$&XQSO'#IsO$&gQSO,5@nO$&oQbO1G1cOOQ(CY1G1e1G1eO9_QSO1G3]O?rQSO1G3]O$&vQSO1G3]O$&{QSO1G3]OOQQ1G3]1G3]O:vQSO'#JrO:vQSO'#EmO%QQUO'#EmO:vQSO'#ImO$'QQ(C[O,5@kOOQQ1G2u1G2uO!BTQSO1G2{O!%tQ,UO1G2xO$']QSO1G2xOOQQ1G2y1G2yO!%tQ,UO1G2yO$'bQSO1G2yO$'jQWO'#GwOOQQ1G2{1G2{O!3cQWO'#IoO!BYQ`O1G3OOOQQ1G3O1G3OOOQQ,5=i,5=iO$'rQ,UO,5=kO9_QSO,5=kO#K`QSO,5=mO8tQSO,5=mO!>oQWO,5=mO!>wQ,UO,5=mO9dQ,UO,5=mO$(QQSO'#KRO$(]QSO,5=nOOQQ1G.h1G.hO$(bQ(C[O1G.hO?rQSO1G.hO$(mQSO1G.hO9OQ(C[O1G.hO$*rQbO,5@pO$+SQSO,5@pO$+_QUO,5=uO$+fQSO,5=uO:vQSO,5@pOOQQ1G3_1G3_O`QUO1G3_OOQQ1G3e1G3eOOQQ1G3g1G3gO={QSO1G3iO$+kQUO1G3kO$/lQUO'#HjOOQQ1G3n1G3nO$/yQSO'#HpO>QQSO'#HrOOQQ1G3t1G3tO$0RQUO1G3tO9OQ(C[O1G3zOOQQ1G3|1G3|OOQ(CW'#GW'#GWO9OQ(C[O1G4OO9OQ(C[O1G4QO$4VQSO,5@RO!)jQUO,5;XO:vQSO,5;XO>QQSO,5:RO!)jQUO,5:RO!>oQWO,5:RO$4[Q$IUO,5:ROOQO,5;X,5;XO$4fQWO'#IZO$4|QSO,5@QOOQ(CY1G/l1G/lO$5UQWO'#IaO$5`QSO,5@`OOQ(CW1G0r1G0rO!LaQWO,5:ROOQO'#I^'#I^O$5hQWO,5:mOOQ(CY,5:m,5:mO#![QSO1G0VOOQ(CY1G0V1G0VO%QQUO1G0VOOQ(CY1G0m1G0mO>QQSO1G0mO!>oQWO1G0mO!>wQ,UO1G0mOOQ(CW1G5m1G5mO!>dQ(C[O1G0YOOQO1G0f1G0fO%QQUO1G0fO$5oQ(C[O1G0fO$5zQ(C[O1G0fO!>oQWO1G0YOCOQWO1G0YO$6YQ(C[O1G0fOOQO1G0Y1G0YO$6nQ(CjO1G0fPOOO-EtO$7[QSO1G5kO$7dQSO1G5xO$7lQbO1G5yO:vQSO,5>zO$7vQ(CjO1G5vO%QQUO1G5vO$8WQ(C[O1G5vO$8iQSO1G5uO$8iQSO1G5uO:vQSO1G5uO$8qQSO,5>}O:vQSO,5>}OOQO,5>},5>}O$9VQSO,5>}O$ mQSO,5>}OOQO-EcQ(CjO,5oQWO,5dQ(C[O7+$^O!>oQWO7+$^O!#qQUO7+&YO$NgQSO'#IrO$N{QSO,5@oOOQO1G3^1G3^O9_QSO,5@oO$N{QSO,5@oO% TQSO,5@oOOQO,5?_,5?_OOQO-EoQWO1G3XO!>wQ,UO1G3XO%$RQSO'#IqO%$^QSO,5@mO%$fQWO,5@mOOQ(CW1G3Y1G3YOOQQ7+$S7+$SO?rQSO7+$SO9OQ(C[O7+$SO%$qQSO7+$SO%QQUO1G6[O%QQUO1G6]O%$vQUO1G3aO%$}QSO1G3aO%%SQUO1G3aO%%ZQ(C[O1G6[OOQQ7+(y7+(yO9OQ(C[O7+)TO`QUO7+)VOOQQ'#KW'#KWOOQQ'#It'#ItO%%eQUO,5>UOOQQ,5>U,5>UO%QQUO'#HkO%%rQSO'#HmOOQQ,5>[,5>[O:vQSO,5>[OOQQ,5>^,5>^OOQQ7+)`7+)`OOQQ7+)f7+)fOOQQ7+)j7+)jOOQQ7+)l7+)lO%%wQWO1G5mO%&]Q$IUO1G0sO%&gQSO1G0sOOQO1G/m1G/mO%&rQ$IUO1G/mO>QQSO1G/mO!)jQUO'#DgOOQO,5>u,5>uOOQO-E{,5>{OOQO-E<_-E<_O!>oQWO1G/mOOQO-E<[-E<[OOQ(CY1G0X1G0XOOQ(CY7+%q7+%qO#![QSO7+%qOOQ(CY7+&X7+&XO>QQSO7+&XO!>oQWO7+&XOOQO7+%t7+%tO$6nQ(CjO7+&QOOQO7+&Q7+&QO%QQUO7+&QO%&|Q(C[O7+&QO!>dQ(C[O7+%tO!>oQWO7+%tO%'XQ(C[O7+&QO%'gQ(CjO7++bO%QQUO7++bO%'wQSO7++aO%'wQSO7++aOOQO1G4i1G4iO:vQSO1G4iO%(PQSO1G4iOOQO7+%y7+%yO#![QSO<vOOQO-EwO%QQUO,5>wOOQO-ESQ(CjO<oQWO1G2bOBoQSO1G2cO%EsQSO1G2dO%E{QSO1G2cO!'^Q,UO7+*}OOQ(CY1G/[1G/[O%FWQSO1G/[OOQ(CY7+'n7+'nO%F]Q,UO7+'uO%FmQ(CjO<dQ(C[O<oQWO7+(sO%JhQSO,5?]OOQO-EVOOQQ,5>X,5>XO%KmQSO1G3vO:vQSO7+&_O!)jQUO7+&_OOQO7+%X7+%XO%KrQ$IUO1G5yO>QQSO7+%XOOQ(CY<QQSO<dQ(C[O<QQSO7+)bO&3ZQSO<zAN>zO%QQUOAN?WOOQO<OQ$IUO7+'uO&?tQ,UOG26{OOQO<QOP$YOX:TOk9wOy#vOz#wO|#xO!e9yO!f#tO!h#uO!l$YO#g9uO#h9vO#i9vO#j9vO#k9xO#l9yO#m9yO#n:SO#o9yO#q9zO#s9|O#u:OO#v:PO(RVO(b$WO(i#yO(j#zO~O#y.dO~P#@_O#X:UO#{:UO#y(WX!W(WX~PNlO^'Ya!V'Ya'k'Ya'i'Ya!g'Ya!S'Yao'Ya!X'Ya%a'Ya!a'Ya~P!6UOP#fiX#fi^#fik#fiz#fi!V#fi!e#fi!f#fi!h#fi!l#fi#g#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi'k#fi(R#fi(b#fi'i#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~P#)tO^#zi!V#zi'k#zi'i#zi!S#zi!g#zio#zi!X#zi%a#zi!a#zi~P!6UO$W.iO$Y.iO~O$W.jO$Y.jO~O!a)YO#X.kO!X$^X$T$^X$W$^X$Y$^X$a$^X~O!U.lO~O!X)]O$T.nO$W)[O$Y)[O$a.oO~O!V:QO!W(VX~P#@_O!W.pO~O!a)YO$a(kX~O$a.rO~Oq)lO(S)mO(T.uO~Ol.xO!S.yO'vTO'yUO~O!VcX!acX!gcX!g$sX(bcX~P!.xO!g/PO~P#)tO!V/QO!a#rO(b'bO!g(oX~O!g/VO~O!U)}O't%eO!g(oP~O#d/XO~O!S$sX!V$sX!a$zX~P!.xO!V/YO!S(pX~P#)tO!a/[O~O!S/^O~Ok/bO!a#rO!h%ZO'}%OO(b'bO~O't/dO~O!a*}O~O^%^O!V/hO'k%^O~O!W/jO~P!2vO!]/kO!^/kO'u!iO(U!jO~O|/mO(U!jO~O#T/nO~O't%|Od'_X!V'_X~O!V*gOd(Oa~Od/sO~Oy/tOz/tO|/uOgva(iva(jva!Vva#Xva~Odva#yva~P#L|Oy)qO|)rOg$la(i$la(j$la!V$la#X$la~Od$la#y$la~P#MrOy)qO|)rOg$na(i$na(j$na!V$na#X$na~Od$na#y$na~P#NeO#d/wO~Od$|a!V$|a#X$|a#y$|a~P!0RO!a#rO~O#d/zO~Oy#vOz#wO|#xO!f#tO!h#uO(RVOP!niX!nik!ni!V!ni!e!ni!l!ni#g!ni#h!ni#i!ni#j!ni#k!ni#l!ni#m!ni#n!ni#o!ni#q!ni#s!ni#u!ni#v!ni(b!ni(i!ni(j!ni~O^!ni'k!ni'i!ni!S!ni!g!nio!ni!X!ni%a!ni!a!ni~P$ wOg.PO!X'QO%a.OO~Oi0RO't0QO~P!0sO!a*}O^'|a!X'|a'k'|a!V'|a~O#d0XO~OXYX!VcX!WcX~O!V0YO!W(wX~O!W0[O~OX0]O~O't+VO'vTO'yUO~O!X%nO't%eO]'gX!V'gX~O!V+[O](va~O!g0bO~P!6UOX0eO~O]0fO~O!V+hO^(sa'k(sa~O#X0lO~Og0oO!X$yO~O(U(oO!W(tP~Og0xO!X0uO%a0wO'}%OO~OX1SO!V1QO!W(uX~O!W1TO~O]1VO^%^O'k%^O~O't#jO'vTO'yUO~O#X$bO#{$bOP(WXX(WXk(WXy(WXz(WX|(WX!V(WX!e(WX!h(WX!l(WX#g(WX#h(WX#i(WX#j(WX#k(WX#l(WX#m(WX#n(WX#q(WX#s(WX#u(WX#v(WX(R(WX(b(WX(i(WX(j(WX~O#o1YO&Q1ZO^(WX!f(WX~P$(xO#X$bO#o1YO&Q1ZO~O^1[O~P%QO^1^O~O&Z1bOP&XiQ&XiV&Xi^&Xia&Xib&Xii&Xik&Xil&Xim&Xis&Xiu&Xiw&Xi|&Xi!Q&Xi!R&Xi!X&Xi!c&Xi!h&Xi!k&Xi!l&Xi!m&Xi!o&Xi!q&Xi!t&Xi!x&Xi#p&Xi$Q&Xi$U&Xi%`&Xi%b&Xi%d&Xi%e&Xi%h&Xi%j&Xi%m&Xi%n&Xi%p&Xi%|&Xi&S&Xi&U&Xi&W&Xi&Y&Xi&]&Xi&c&Xi&i&Xi&k&Xi&m&Xi&o&Xi&q&Xi'i&Xi't&Xi'v&Xi'y&Xi(R&Xi(a&Xi(n&Xi!W&Xi_&Xi&`&Xi~O_1hO!W1fO&`1gO~P`O!XXO!h1jO~O&g,eOP&biQ&biV&bi^&bia&bib&bii&bik&bil&bim&bis&biu&biw&bi|&bi!Q&bi!R&bi!X&bi!c&bi!h&bi!k&bi!l&bi!m&bi!o&bi!q&bi!t&bi!x&bi#p&bi$Q&bi$U&bi%`&bi%b&bi%d&bi%e&bi%h&bi%j&bi%m&bi%n&bi%p&bi%|&bi&S&bi&U&bi&W&bi&Y&bi&]&bi&c&bi&i&bi&k&bi&m&bi&o&bi&q&bi'i&bi't&bi'v&bi'y&bi(R&bi(a&bi(n&bi!W&bi&Z&bi_&bi&`&bi~O!S1pO~O!V!Za!W!Za~P#@_Ol!kO|!lO!U1vO(U!jO!V&}X!W&}X~P?fO!V,uO!W(Ya~O!V'TX!W'TX~P!@xO!V,xO!W(ha~O!W1}O~P'TO^%^O#X2WO'k%^O~O^%^O!a#rO#X2WO'k%^O~O^%^O!a#rO!l2[O#X2WO'k%^O(b'bO~O^%^O'k%^O~P!6UO!V$^Oo$ka~O!S&|i!V&|i~P!6UO!V'vO!S(Xi~O!V'}O!S(fi~O!S(gi!V(gi~P!6UO!V(di!g(di^(di'k(di~P!6UO#X2^O!V(di!g(di^(di'k(di~O!V(ZO!g(ci~O|%vO!X%wO!x]O#b2cO#c2bO't%eO~O|%vO!X%wO#c2bO't%eO~Og2jO!X'QO%a2iO~Og2jO!X'QO%a2iO'}%OO~O#dvaPvaXva^vakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva'kva(Rva(bva!gva!Sva'ivaova!Xva%ava!ava~P#L|O#d$laP$laX$la^$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la'k$la(R$la(b$la!g$la!S$la'i$lao$la!X$la%a$la!a$la~P#MrO#d$naP$naX$na^$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na'k$na(R$na(b$na!g$na!S$na'i$nao$na!X$na%a$na!a$na~P#NeO#d$|aP$|aX$|a^$|ak$|az$|a!V$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a'k$|a(R$|a(b$|a!g$|a!S$|a'i$|a#X$|ao$|a!X$|a%a$|a!a$|a~P#)tO^#[q!V#[q'k#[q'i#[q!S#[q!g#[qo#[q!X#[q%a#[q!a#[q~P!6UOd'OX!V'OX~P!'^O!V.YOd([a~O!U2rO!V'PX!g'PX~P%QO!V.]O!g(]a~O!V.]O!g(]a~P!6UO!S2uO~O#y!ja!W!ja~PJ`O#y!ba!V!ba!W!ba~P#@_O#y!na!W!na~P!8oO#y!pa!W!pa~P!;YO!X3XO$UfO$_3YO~O!W3^O~Oo3_O~P#)tO^$hq!V$hq'k$hq'i$hq!S$hq!g$hqo$hq!X$hq%a$hq!a$hq~P!6UO!S3`O~Ol.xO'vTO'yUO~Oy)qO|)rO(j)vOg%Xi(i%Xi!V%Xi#X%Xi~Od%Xi#y%Xi~P$GeOy)qO|)rOg%Zi(i%Zi(j%Zi!V%Zi#X%Zi~Od%Zi#y%Zi~P$HWO(b$WO~P#)tO!U3cO't%eO!V'ZX!g'ZX~O!V/QO!g(oa~O!V/QO!a#rO!g(oa~O!V/QO!a#rO(b'bO!g(oa~Od$ui!V$ui#X$ui#y$ui~P!0RO!U3kO't*SO!S']X!V']X~P!0pO!V/YO!S(pa~O!V/YO!S(pa~P#)tO!a#rO#o3sO~Ok3vO!a#rO(b'bO~Od(Pi!V(Pi~P!0RO#X3yOd(Pi!V(Pi~P!0RO!g3|O~O^$iq!V$iq'k$iq'i$iq!S$iq!g$iqo$iq!X$iq%a$iq!a$iq~P!6UO!V4QO!X(qX~P#)tO!f#tO~P3}O^$sX!X$sX%UYX'k$sX!V$sX~P!.xO%U4SO^hXghXyhX|hX!XhX'khX(ihX(jhX!VhX~O%U4SO~O%b4ZO't+VO'vTO'yUO!V'fX!W'fX~O!V0YO!W(wa~OX4_O~O]4`O~O!S4dO~O^%^O'k%^O~P#)tO!X$yO~P#)tO!V4iO#X4kO!W(tX~O!W4lO~Ol!kO|4mO![!uO!]!rO!^!rO!x9mO!|!mO!}!mO#O!mO#P!mO#Q!mO#T4rO#U!vO'u!iO'vTO'yUO(U!jO(a!pO~O!W4qO~P%!VOg4wO!X0uO%a4vO~Og4wO!X0uO%a4vO'}%OO~O't#jO!V'eX!W'eX~O!V1QO!W(ua~O'vTO'yUO(U5QO~O]5UO~O!g5XO~P%QO^5ZO~O^5ZO~P%QO#o5]O&Q5^O~PMOO_1hO!W5bO&`1gO~P`O!a5dO~O!a5fO!V(Zi!W(Zi!a(Zi!h(Zi'}(Zi~O!V#ai!W#ai~P#@_O#X5gO!V#ai!W#ai~O!V!Zi!W!Zi~P#@_O^%^O#X5pO'k%^O~O^%^O!a#rO#X5pO'k%^O~O!V(dq!g(dq^(dq'k(dq~P!6UO!V(ZO!g(cq~O|%vO!X%wO#c5wO't%eO~O!X'QO%a5zO~Og5}O!X'QO%a5zO~O#d%XiP%XiX%Xi^%Xik%Xiz%Xi!e%Xi!f%Xi!h%Xi!l%Xi#g%Xi#h%Xi#i%Xi#j%Xi#k%Xi#l%Xi#m%Xi#n%Xi#o%Xi#q%Xi#s%Xi#u%Xi#v%Xi'k%Xi(R%Xi(b%Xi!g%Xi!S%Xi'i%Xio%Xi!X%Xi%a%Xi!a%Xi~P$GeO#d%ZiP%ZiX%Zi^%Zik%Ziz%Zi!e%Zi!f%Zi!h%Zi!l%Zi#g%Zi#h%Zi#i%Zi#j%Zi#k%Zi#l%Zi#m%Zi#n%Zi#o%Zi#q%Zi#s%Zi#u%Zi#v%Zi'k%Zi(R%Zi(b%Zi!g%Zi!S%Zi'i%Zio%Zi!X%Zi%a%Zi!a%Zi~P$HWO#d$uiP$uiX$ui^$uik$uiz$ui!V$ui!e$ui!f$ui!h$ui!l$ui#g$ui#h$ui#i$ui#j$ui#k$ui#l$ui#m$ui#n$ui#o$ui#q$ui#s$ui#u$ui#v$ui'k$ui(R$ui(b$ui!g$ui!S$ui'i$ui#X$uio$ui!X$ui%a$ui!a$ui~P#)tOd'Oa!V'Oa~P!0RO!V'Pa!g'Pa~P!6UO!V.]O!g(]i~O#y#[i!V#[i!W#[i~P#@_OP$YOy#vOz#wO|#xO!f#tO!h#uO!l$YO(RVOX#fik#fi!e#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi#y#fi(b#fi(i#fi(j#fi!V#fi!W#fi~O#g#fi~P%0fO#g9uO~P%0fOP$YOy#vOz#wO|#xO!f#tO!h#uO!l$YO#g9uO#h9vO#i9vO#j9vO(RVOX#fi!e#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi#y#fi(b#fi(i#fi(j#fi!V#fi!W#fi~Ok#fi~P%2qOk9wO~P%2qOP$YOk9wOy#vOz#wO|#xO!f#tO!h#uO!l$YO#g9uO#h9vO#i9vO#j9vO#k9xO(RVO#q#fi#s#fi#u#fi#v#fi#y#fi(b#fi(i#fi(j#fi!V#fi!W#fi~OX#fi!e#fi#l#fi#m#fi#n#fi#o#fi~P%4|OX:TO!e9yO#l9yO#m9yO#n:SO#o9yO~P%4|OP$YOX:TOk9wOy#vOz#wO|#xO!e9yO!f#tO!h#uO!l$YO#g9uO#h9vO#i9vO#j9vO#k9xO#l9yO#m9yO#n:SO#o9yO#q9zO(RVO#s#fi#u#fi#v#fi#y#fi(b#fi(j#fi!V#fi!W#fi~O(i#fi~P%7hO(i#yO~P%7hOP$YOX:TOk9wOy#vOz#wO|#xO!e9yO!f#tO!h#uO!l$YO#g9uO#h9vO#i9vO#j9vO#k9xO#l9yO#m9yO#n:SO#o9yO#q9zO#s9|O(RVO(i#yO#u#fi#v#fi#y#fi(b#fi!V#fi!W#fi~O(j#fi~P%9sO(j#zO~P%9sOP$YOX:TOk9wOy#vOz#wO|#xO!e9yO!f#tO!h#uO!l$YO#g9uO#h9vO#i9vO#j9vO#k9xO#l9yO#m9yO#n:SO#o9yO#q9zO#s9|O#u:OO(RVO(i#yO(j#zO~O#v#fi#y#fi(b#fi!V#fi!W#fi~P%vO!f#tOP(QXX(QXg(QXk(QXy(QXz(QX|(QX!e(QX!h(QX!l(QX#g(QX#h(QX#i(QX#j(QX#k(QX#l(QX#m(QX#n(QX#o(QX#q(QX#s(QX#u(QX#v(QX#y(QX(R(QX(b(QX(i(QX(j(QX!V(QX!W(QX~O#y#zi!V#zi!W#zi~P#@_O#y!ni!W!ni~P$ wO!W6ZO~O!V'Ya!W'Ya~P#@_O!a#rO(b'bO!V'Za!g'Za~O!V/QO!g(oi~O!V/QO!a#rO!g(oi~Od$uq!V$uq#X$uq#y$uq~P!0RO!S']a!V']a~P#)tO!a6bO~O!V/YO!S(pi~P#)tO!V/YO!S(pi~O!S6fO~O!a#rO#o6kO~Ok6lO!a#rO(b'bO~O!S6nO~Od$wq!V$wq#X$wq#y$wq~P!0RO^$iy!V$iy'k$iy'i$iy!S$iy!g$iyo$iy!X$iy%a$iy!a$iy~P!6UO!V4QO!X(qa~O^#[y!V#[y'k#[y'i#[y!S#[y!g#[yo#[y!X#[y%a#[y!a#[y~P!6UOX6sO~O!V0YO!W(wi~O]6yO~O!a5fO~O(U(oO!V'bX!W'bX~O!V4iO!W(ta~OikO't7QO~P._O!W7TO~P%!VOl!kO|7UO'vTO'yUO(U!jO(a!pO~O!X0uO~O!X0uO%a7WO~Og7ZO!X0uO%a7WO~OX7`O!V'ea!W'ea~O!V1QO!W(ui~O!g7dO~O!g7eO~O!g7fO~O!g7fO~P%QO^7hO~O!a7kO~O!g7lO~O!V(gi!W(gi~P#@_O^%^O#X7tO'k%^O~O!V(dy!g(dy^(dy'k(dy~P!6UO!V(ZO!g(cy~O!X'QO%a7wO~O#d$uqP$uqX$uq^$uqk$uqz$uq!V$uq!e$uq!f$uq!h$uq!l$uq#g$uq#h$uq#i$uq#j$uq#k$uq#l$uq#m$uq#n$uq#o$uq#q$uq#s$uq#u$uq#v$uq'k$uq(R$uq(b$uq!g$uq!S$uq'i$uq#X$uqo$uq!X$uq%a$uq!a$uq~P#)tO#d$wqP$wqX$wq^$wqk$wqz$wq!V$wq!e$wq!f$wq!h$wq!l$wq#g$wq#h$wq#i$wq#j$wq#k$wq#l$wq#m$wq#n$wq#o$wq#q$wq#s$wq#u$wq#v$wq'k$wq(R$wq(b$wq!g$wq!S$wq'i$wq#X$wqo$wq!X$wq%a$wq!a$wq~P#)tO!V'Pi!g'Pi~P!6UO#y#[q!V#[q!W#[q~P#@_Oy/tOz/tO|/uOPvaXvagvakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva#yva(Rva(bva(iva(jva!Vva!Wva~Oy)qO|)rOP$laX$lag$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la#y$la(R$la(b$la(i$la(j$la!V$la!W$la~Oy)qO|)rOP$naX$nag$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na#y$na(R$na(b$na(i$na(j$na!V$na!W$na~OP$|aX$|ak$|az$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a#y$|a(R$|a(b$|a!V$|a!W$|a~P%>vO#y$hq!V$hq!W$hq~P#@_O#y$iq!V$iq!W$iq~P#@_O!W8RO~O#y8SO~P!0RO!a#rO!V'Zi!g'Zi~O!a#rO(b'bO!V'Zi!g'Zi~O!V/QO!g(oq~O!S']i!V']i~P#)tO!V/YO!S(pq~O!S8YO~P#)tO!S8YO~Od(Py!V(Py~P!0RO!V'`a!X'`a~P#)tO^%Tq!X%Tq'k%Tq!V%Tq~P#)tOX8_O~O!V0YO!W(wq~O#X8cO!V'ba!W'ba~O!V4iO!W(ti~P#@_OPYXXYXkYXyYXzYX|YX!SYX!VYX!eYX!fYX!hYX!lYX#XYX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(RYX(bYX(iYX(jYX~O!a%RX#o%RX~P&/vO!X0uO%a8gO~O'vTO'yUO(U8lO~O!V1QO!W(uq~O!g8oO~O!g8oO~P%QO!g8qO~O!g8rO~O#X8tO!V#ay!W#ay~O!V#ay!W#ay~P#@_O!X'QO%a8yO~O#y#wy!V#wy!W#wy~P#@_OP$uiX$uik$uiz$ui!e$ui!f$ui!h$ui!l$ui#g$ui#h$ui#i$ui#j$ui#k$ui#l$ui#m$ui#n$ui#o$ui#q$ui#s$ui#u$ui#v$ui#y$ui(R$ui(b$ui!V$ui!W$ui~P%>vOy)qO|)rO(j)vOP%XiX%Xig%Xik%Xiz%Xi!e%Xi!f%Xi!h%Xi!l%Xi#g%Xi#h%Xi#i%Xi#j%Xi#k%Xi#l%Xi#m%Xi#n%Xi#o%Xi#q%Xi#s%Xi#u%Xi#v%Xi#y%Xi(R%Xi(b%Xi(i%Xi!V%Xi!W%Xi~Oy)qO|)rOP%ZiX%Zig%Zik%Ziz%Zi!e%Zi!f%Zi!h%Zi!l%Zi#g%Zi#h%Zi#i%Zi#j%Zi#k%Zi#l%Zi#m%Zi#n%Zi#o%Zi#q%Zi#s%Zi#u%Zi#v%Zi#y%Zi(R%Zi(b%Zi(i%Zi(j%Zi!V%Zi!W%Zi~O#y$iy!V$iy!W$iy~P#@_O#y#[y!V#[y!W#[y~P#@_O!a#rO!V'Zq!g'Zq~O!V/QO!g(oy~O!S']q!V']q~P#)tO!S9QO~P#)tO!V0YO!W(wy~O!V4iO!W(tq~O!X0uO%a9XO~O!g9[O~O!X'QO%a9aO~OP$uqX$uqk$uqz$uq!e$uq!f$uq!h$uq!l$uq#g$uq#h$uq#i$uq#j$uq#k$uq#l$uq#m$uq#n$uq#o$uq#q$uq#s$uq#u$uq#v$uq#y$uq(R$uq(b$uq!V$uq!W$uq~P%>vOP$wqX$wqk$wqz$wq!e$wq!f$wq!h$wq!l$wq#g$wq#h$wq#i$wq#j$wq#k$wq#l$wq#m$wq#n$wq#o$wq#q$wq#s$wq#u$wq#v$wq#y$wq(R$wq(b$wq!V$wq!W$wq~P%>vOd%]!Z!V%]!Z#X%]!Z#y%]!Z~P!0RO!V'bq!W'bq~P#@_O!V#a!Z!W#a!Z~P#@_O#d%]!ZP%]!ZX%]!Z^%]!Zk%]!Zz%]!Z!V%]!Z!e%]!Z!f%]!Z!h%]!Z!l%]!Z#g%]!Z#h%]!Z#i%]!Z#j%]!Z#k%]!Z#l%]!Z#m%]!Z#n%]!Z#o%]!Z#q%]!Z#s%]!Z#u%]!Z#v%]!Z'k%]!Z(R%]!Z(b%]!Z!g%]!Z!S%]!Z'i%]!Z#X%]!Zo%]!Z!X%]!Z%a%]!Z!a%]!Z~P#)tOP%]!ZX%]!Zk%]!Zz%]!Z!e%]!Z!f%]!Z!h%]!Z!l%]!Z#g%]!Z#h%]!Z#i%]!Z#j%]!Z#k%]!Z#l%]!Z#m%]!Z#n%]!Z#o%]!Z#q%]!Z#s%]!Z#u%]!Z#v%]!Z#y%]!Z(R%]!Z(b%]!Z!V%]!Z!W%]!Z~P%>vOo(VX~P1gO'u!iO~P!)jO!ScX!VcX#XcX~P&/vOPYXXYXkYXyYXzYX|YX!VYX!VcX!eYX!fYX!hYX!lYX#XYX#XcX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(RYX(bYX(iYX(jYX~O!acX!gYX!gcX(bcX~P&E^OP9lOQ9lOa;]Ob!fOikOk9lOlkOmkOskOu9lOw9lO|WO!QkO!RkO!XXO!c9oO!hZO!k9lO!l9lO!m9lO!o9pO!q9qO!t!eO$Q!hO$UfO't)PO'vTO'yUO(RVO(a[O(n;ZO~O!V:QO!W$ka~Oi%POk$qOl$pOm$pOs%QOu%ROw:WO|$xO!X$yO!c;bO!h$uO#c:^O$Q%VO$m:YO$o:[O$r%WO't(gO'vTO'yUO'}%OO(R$rO~O#p)WO~P&JSO!WYX!WcX~P&E^O#d9tO~O!a#rO#d9tO~O#X:UO~O#o9yO~O#X:`O!V(gX!W(gX~O#X:UO!V(eX!W(eX~O#d:aO~Od:cO~P!0RO#d:hO~O#d:iO~O!a#rO#d:jO~O!a#rO#d:aO~O#y:kO~P#@_O#d:lO~O#d:mO~O#d:nO~O#d:oO~O#d:pO~O#d:qO~O#y:rO~P!0RO#y:sO~P!0RO$U~!f!|!}#P#Q#T#b#c#n(n$m$o$r%U%`%a%b%h%j%m%n%p%r~'oR$U(n#h!R'm'u#il#g#jky'n(U'n't$W$Y$W~", + goto: "$%Z({PPPP(|P)PP)aP*p.rPPPP5SPP5iP;d>iP>|P>|PPP>|P@lP>|P>|P>|P@pPP@uPA`PFUPPPFYPPPPFYIXPPPI_JYPFYPLgPPPPNuFYPPPFYPFYP!#TFYP!&g!'i!'rP!(e!(i!(ePPPPP!+r!'iPP!,`!-YP!/|FYFY!0R!3Z!7n!7n!;cPPP!;jFYPPPPPPPPPPP!>uP!@WPPFY!AePFYPFYFYFYFYPFY!BwPP!E}P!IPP!IT!I_!Ic!IcP!EzP!Ig!IgP!LiP!LmFYFY!Ls# t>|P>|P>|>|P##O>|>|#$x>|#'V>|#(y>|>|#)g#+c#+c#+g#+o#+c#+wP#+cP>|#,a>|#-i>|>|5SPPP#.tPP#/^#/^P#/^P#/s#/^PP#/yP#/pP#/p#0]#/p#0w#0}5P)P#1Q)PP#1X#1X#1XP)PP)PP)PP)PPP)PP#1_#1bP#1b)PP#1fP#1iP)PP)PP)PP)PP)PP)P)PPP#1o#1u#2P#2V#2]#2c#2i#2w#2}#3T#3_#3e#3o#4O#4U#4u#5X#5_#5e#5s#6Y#7j#7x#8O#8U#8[#8b#8l#8r#8x#9S#9f#9lPPPPPPPPPP#9rPPPPPPP#:f#=mP#>|#?T#?]PPPP#Cg#F]#Lr#Lu#Lx#Mq#Mt#Mw#NO#NWPP#N^#Nb$ Z$!Z$!_$!sPP$!w$!}$#RP$#U$#Y$#]$$R$$i$$n$$q$$t$$z$$}$%R$%VR!xRmpOXr!X#`%]&d&f&g&i,],b1b1eY!rQ'Q,}0u4pQ%ctQ%kwQ%rzQ&[!TS&x!c,uQ'W!fS'^!o!uS*Y$y*_Q+T%lQ+b%tQ+|&UQ,{'PQ-V'XQ-_'_Q/k*aQ1P+}R:_9p$zdOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$^$b%]%c%p&]&`&d&f&g&i&m&u'S'd't'v'|(T(i(m(q)p*s+g,X,],b-R-Z-i-o.].d/u/z0X0x1Y1Z1[1^1b1e1g2W2^2r4m4w5Z5]5^5p7U7Z7h7tS#m]9m!r)R$X$j&y)e,n,q.l1v3X4k5g8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^Q*j%SQ+Y%nQ,O&XQ,V&aQ.S:VQ0O*{Q0S*}Q0_+ZQ1X,TQ2f.PQ4Y0YQ5O1QQ5|2jQ6S:WQ6u4ZR7z5}&xkOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$X$^$b$j%]%c%p&]&`&a&d&f&g&i&m&u&y'S'd't'v'|(T(i(m(q)e)p*s*{+g,X,],b,n,q-R-Z-i-o.P.].d.l/u/z0X0x1Y1Z1[1^1b1e1g1v2W2^2j2r3X4k4m4w5Z5]5^5g5p5}7U7Z7h7t8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^t!kQ!o!r!u!v&x'P'Q'^'_'`,u,{,}-_0u4p4r$Y$pi#r#t$`$a$u$x%T%U%Y)l)u)w)x*P*V*e*f*z*}+l+o.O.Y/X/Y/[/w0l0o0w2i3a3k3s3y4Q4S4v5z6b6k7W7w8S8g8y9X9a:S:T:X:Y:Z:[:]:^:d:e:f:g:h:i:l:m:n:o:r:s;Z;c;d;g;hQ%uzQ&v!cS&|%w,xQ+Y%nS.x)r.zQ/v*nQ0_+ZQ0d+aQ1W,SQ1X,TQ4Y0YQ4c0fQ5R1SQ5S1VQ6u4ZQ6x4`Q7c5UQ8b6yR8m7`pmOXr!T!X#`%]&Z&d&f&g&i,],b1b1eR,Q&]&r^OPXYrstux!X!^!g!l#O#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$X$^$b$j%]%c%p&]&`&a&d&f&g&i&m&u'S'd'v'|(T(i(m(q)e)p*s*{+g,X,],b,n,q-R-Z-i-o.P.].d.l/u/z0X0x1Y1Z1[1^1b1e1g1v2W2^2j2r3X4k4m4w5Z5]5^5g5p5}7U7Z7h7t8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;];^[#XWZ#S#V&y'tQ%fvQ%jwS%oz%t!U%x|}#d#e#h%Z%v'}(X(Y(Z+e+f+h,Z,o-m-s-t-u-w1j2b2c5f5wQ&Q!RQ'T!eQ'V!fQ(b#oS)|$u*QS+S%k%lQ+W%nQ+w&SQ+{&US-U'W'XQ.R(cQ/U)}Q0W+TQ0^+ZQ0`+[Q0c+`Q0z+xS1O+|+}Q2S-VQ3b/QQ4X0YQ4]0]Q4b0eQ4}1PQ6_3cQ6t4ZQ6w4_Q8^6sR9S8_v$wi#t%T%U%Y)u)w*P*e*f.Y/X/w3a3y8S;Z;c;d!S%hw!f!q%j%k%l&w'V'W'X']'g*X+S+T,r-U-V-^/c0W1{2S2Z3uQ*|%fQ+m%}Q+p&OQ+z&UQ.Q(bQ0y+wU0}+{+|+}Q2k.RQ4x0zS4|1O1PQ7_4}!z;_#r$`$a$u$x)l)x*V*z*}+l+o.O/Y/[0l0o0w2i3k3s4Q4S4v5z6b6k7W7w8g8y9X9a:X:Z:]:d:f:h:l:n:r;g;hg;`:S:T:Y:[:^:e:g:i:m:o:sW$|i%O*g;ZS%}!O&ZQ&O!PQ&P!QR+k%{$Z${i#r#t$`$a$u$x%T%U%Y)l)u)w)x*P*V*e*f*z*}+l+o.O.Y/X/Y/[/w0l0o0w2i3a3k3s3y4Q4S4v5z6b6k7W7w8S8g8y9X9a:S:T:X:Y:Z:[:]:^:d:e:f:g:h:i:l:m:n:o:r:s;Z;c;d;g;hT)m$r)nV*k%S:V:WU&|!c%w,xS(p#v#wQ+_%qS-z(^(_Q0p+qQ3z/tR6}4i&xkOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$X$^$b$j%]%c%p&]&`&a&d&f&g&i&m&u&y'S'd't'v'|(T(i(m(q)e)p*s*{+g,X,],b,n,q-R-Z-i-o.P.].d.l/u/z0X0x1Y1Z1[1^1b1e1g1v2W2^2j2r3X4k4m4w5Z5]5^5g5p5}7U7Z7h7t8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^$i$]c#U#a%a%b%d's'y(e(l(t(u(v(w(x(y(z({(|(})O)Q)T)X)c*x+^,s-b-g-l-n.X._.c.e.f.g.v/x1q1t2U2]2q2v2w2x2y2z2{2|2}3O3P3Q3R3S3V3W3]4O4V5i5o5t6Q6R6W6X7P7n7r7{8P8Q8v9U9]9n;QT#PV#Q&ykOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$X$^$b$j%]%c%p&]&`&a&d&f&g&i&m&u&y'S'd't'v'|(T(i(m(q)e)p*s*{+g,X,],b,n,q-R-Z-i-o.P.].d.l/u/z0X0x1Y1Z1[1^1b1e1g1v2W2^2j2r3X4k4m4w5Z5]5^5g5p5}7U7Z7h7t8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^Q&z!cR1w,uv!kQ!c!o!r!u!v&x'P'Q'^'_'`,u,{,}-_0u4p4rS*X$y*_S/c*Y*aQ/l*bQ0r+sQ3u/kR3x/nlpOXr!X#`%]&d&f&g&i,],b1b1eQ&k![Q'h!tS(d#q9tQ+Q%iQ+u&QQ+v&RQ-S'UQ-a'aS.W(i:aS/y*s:jQ0U+RQ0t+tQ1i,dQ1k,eQ1s,pQ2Q-TQ2T-XS4P/z:pQ4T0VS4W0X:qQ5h1uQ5l2RQ5q2YQ6r4UQ7o5jQ7p5mQ7s5rR8s7l$d$[c#U#a%b%d's'y(e(l(t(u(v(w(x(y(z({(|(})O)Q)T)X)c*x+^,s-b-g-l-n.X._.c.f.g.v/x1q1t2U2]2q2v2w2x2y2z2{2|2}3O3P3Q3R3S3V3W3]4O4V5i5o5t6Q6R6W6X7P7n7r7{8P8Q8v9U9]9n;QS(a#l'ZU*d$z(h3US*w%a.eQ2g0OQ5y2fQ7y5|R8z7z$d$Zc#U#a%b%d's'y(e(l(t(u(v(w(x(y(z({(|(})O)Q)T)X)c*x+^,s-b-g-l-n.X._.c.f.g.v/x1q1t2U2]2q2v2w2x2y2z2{2|2}3O3P3Q3R3S3V3W3]4O4V5i5o5t6Q6R6W6X7P7n7r7{8P8Q8v9U9]9n;QS(`#l'ZS(r#w$[S*v%a.eS-{(_(aQ.h)SQ/{*wR2d-|&xkOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$X$^$b$j%]%c%p&]&`&a&d&f&g&i&m&u&y'S'd't'v'|(T(i(m(q)e)p*s*{+g,X,],b,n,q-R-Z-i-o.P.].d.l/u/z0X0x1Y1Z1[1^1b1e1g1v2W2^2j2r3X4k4m4w5Z5]5^5g5p5}7U7Z7h7t8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^S#m]9mQ&f!VQ&g!WQ&i!YQ&j!ZR1a,`Q'R!eQ*y%fQ-Q'TS-}(b*|Q2O-PW2h.Q.R/}0PQ5k2PU5x2e2g2kS7v5y5{S8x7x7yS9_8w8zQ9g9`R9j9hU!sQ'Q,}T4n0u4p!O_OXZ`r!T!X#`#d%Z%]&Z&]&d&f&g&i(Z,],b-t1b1e]!mQ!o'Q,}0u4pT#m]9m%UyOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$^$b%]%c%p&]&`&a&d&f&g&i&m&u'S'd't'v'|(T(i(m(q)p*s*{+g,X,],b-R-Z-i-o.P.].d/u/z0X0x1Y1Z1[1^1b1e1g2W2^2j2r4m4w5Z5]5^5p5}7U7Z7h7tS(p#v#wS-z(^(_!s:w$X$j&y)e,n,q.l1v3X4k5g8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^Y!qQ'Q,}0u4pQ']!oS'g!r!uS'i!v4rS-^'^'_Q-`'`R2Z-_Q'f!qS(V#c1_S-]']'iQ/T)|Q/a*XQ2[-`Q3g/US3p/b/lQ6^3bS6i3v3xQ8U6_R8]6lQ#sbQ'e!qS(U#c1_S(W#i*rQ*t%[Q+O%gQ+U%mU-[']'f'iQ-p(VQ/S)|Q/`*XQ/f*[Q0T+PQ0{+yS2X-]-`Q2a-xS3f/T/US3o/a/lQ3r/eQ3t/gQ4z0|Q5s2[Q6]3bQ6a3gS6e3p3xQ6j3wQ7]4{S8T6^6_Q8X6fQ8Z6iQ8j7^Q9O8UQ9P8YQ9R8]Q9Z8kQ9c9QQ:z:uQ;V;OR;W;PV!sQ'Q,}%UaOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$^$b%]%c%p&]&`&a&d&f&g&i&m&u'S'd't'v'|(T(i(m(q)p*s*{+g,X,],b-R-Z-i-o.P.].d/u/z0X0x1Y1Z1[1^1b1e1g2W2^2j2r4m4w5Z5]5^5p5}7U7Z7h7tS#sx!g!r:t$X$j&y)e,n,q.l1v3X4k5g8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^R:z;]%UbOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$^$b%]%c%p&]&`&a&d&f&g&i&m&u'S'd't'v'|(T(i(m(q)p*s*{+g,X,],b-R-Z-i-o.P.].d/u/z0X0x1Y1Z1[1^1b1e1g2W2^2j2r4m4w5Z5]5^5p5}7U7Z7h7tQ%[j!S%gw!f!q%j%k%l&w'V'W'X']'g*X+S+T,r-U-V-^/c0W1{2S2Z3uS%mx!gQ+P%hQ+y&UW0|+z+{+|+}U4{0}1O1PS7^4|4}Q8k7_!r:u$X$j&y)e,n,q.l1v3X4k5g8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^Q;O;[R;P;]$xeOPXYrstu!X!^!l#O#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$^$b%]%c%p&]&`&d&f&g&i&m&u'S'd'v'|(T(i(m(q)p*s*{+g,X,],b-R-Z-i-o.P.].d/u/z0X0x1Y1Z1[1^1b1e1g2W2^2j2r4m4w5Z5]5^5p5}7U7Z7h7tY#^WZ#S#V't!U%x|}#d#e#h%Z%v'}(X(Y(Z+e+f+h,Z,o-m-s-t-u-w1j2b2c5f5wQ,W&a!p:v$X$j)e,n,q.l1v3X4k5g8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^R:y&yS&}!c%wR1y,x$zdOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$^$b%]%c%p&]&`&d&f&g&i&m&u'S'd't'v'|(T(i(m(q)p*s+g,X,],b-R-Z-i-o.].d/u/z0X0x1Y1Z1[1^1b1e1g2W2^2r4m4w5Z5]5^5p7U7Z7h7t!r)R$X$j&y)e,n,q.l1v3X4k5g8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^Q,V&aQ0O*{Q2f.PQ5|2jR7z5}!f$Rc#U%a's'y(e(l({(|(})O)T)X+^-b-g-l-n.X._.v/x2U2]2q3S4O4V5o5t6Q7r8v9n!T9{)Q)c,s.e1q1t2v3O3P3Q3R3V3]5i6R6W6X7P7n7{8P8Q9U9];Q!b$Tc#U%a's'y(e(l(})O)T)X+^-b-g-l-n.X._.v/x2U2]2q3S4O4V5o5t6Q7r8v9n!P9})Q)c,s.e1q1t2v3Q3R3V3]5i6R6W6X7P7n7{8P8Q9U9];Q!^$Xc#U%a's'y(e(l)T)X+^-b-g-l-n.X._.v/x2U2]2q3S4O4V5o5t6Q7r8v9nQ3a/Oz;^)Q)c,s.e1q1t2v3V3]5i6R6W6X7P7n7{8P8Q9U9];QQ;c;eR;d;f&xkOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$X$^$b$j%]%c%p&]&`&a&d&f&g&i&m&u&y'S'd't'v'|(T(i(m(q)e)p*s*{+g,X,],b,n,q-R-Z-i-o.P.].d.l/u/z0X0x1Y1Z1[1^1b1e1g1v2W2^2j2r3X4k4m4w5Z5]5^5g5p5}7U7Z7h7t8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^S$kh$lR3Y.k'PgOPWXYZhrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$X$^$b$j$l%]%c%p&]&`&a&d&f&g&i&m&u&y'S'd't'v'|(T(i(m(q)e)p*s*{+g,X,],b,n,q-R-Z-i-o.P.].d.k.l/u/z0X0x1Y1Z1[1^1b1e1g1v2W2^2j2r3X4k4m4w5Z5]5^5g5p5}7U7Z7h7t8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^T$gf$mQ$efS)[$h)`R)h$mT$ff$mT)^$h)`'PhOPWXYZhrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$X$^$b$j$l%]%c%p&]&`&a&d&f&g&i&m&u&y'S'd't'v'|(T(i(m(q)e)p*s*{+g,X,],b,n,q-R-Z-i-o.P.].d.k.l/u/z0X0x1Y1Z1[1^1b1e1g1v2W2^2j2r3X4k4m4w5Z5]5^5g5p5}7U7Z7h7t8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^T$kh$lQ$nhR)g$l%UjOPWXYZrstu!X!^!l#O#S#V#`#k#q#u#x#{#|#}$O$P$Q$R$S$T$U$V$^$b%]%c%p&]&`&a&d&f&g&i&m&u'S'd't'v'|(T(i(m(q)p*s*{+g,X,],b-R-Z-i-o.P.].d/u/z0X0x1Y1Z1[1^1b1e1g2W2^2j2r4m4w5Z5]5^5p5}7U7Z7h7t!s;[$X$j&y)e,n,q.l1v3X4k5g8c8t9l9o9p9q9t9u9v9w9x9y9z9{9|9}:O:P:Q:U:_:`:a:c:j:k:p:q;^#alOPXZr!X!^!l#O#`#k#x$j%]&]&`&a&d&f&g&i&m&u'S(q)e*{+g,X,],b-R.P.l/u0x1Y1Z1[1^1b1e1g2j3X4m4w5Z5]5^5}7U7Z7hv$zi#t%T%U%Y)u)w*P*e*f.Y/X/w3a3y8S;Z;c;d!z(h#r$`$a$u$x)l)x*V*z*}+l+o.O/Y/[0l0o0w2i3k3s4Q4S4v5z6b6k7W7w8g8y9X9a:X:Z:]:d:f:h:l:n:r;g;hQ*o%WQ.w)qg3U:S:T:Y:[:^:e:g:i:m:o:sv$vi#t%T%U%Y)u)w*P*e*f.Y/X/w3a3y8S;Z;c;dQ*R$wS*[$y*_Q*p%XQ/g*]!z:|#r$`$a$u$x)l)x*V*z*}+l+o.O/Y/[0l0o0w2i3k3s4Q4S4v5z6b6k7W7w8g8y9X9a:X:Z:]:d:f:h:l:n:r;g;hf:}:S:T:Y:[:^:e:g:i:m:o:sQ;R;_Q;S;`Q;T;aR;U;bv$zi#t%T%U%Y)u)w*P*e*f.Y/X/w3a3y8S;Z;c;d!z(h#r$`$a$u$x)l)x*V*z*}+l+o.O/Y/[0l0o0w2i3k3s4Q4S4v5z6b6k7W7w8g8y9X9a:X:Z:]:d:f:h:l:n:r;g;hg3U:S:T:Y:[:^:e:g:i:m:o:slnOXr!X#`%]&d&f&g&i,],b1b1eQ*U$xQ,k&pQ,l&rR3j/Y$Y${i#r#t$`$a$u$x%T%U%Y)l)u)w)x*P*V*e*f*z*}+l+o.O.Y/X/Y/[/w0l0o0w2i3a3k3s3y4Q4S4v5z6b6k7W7w8S8g8y9X9a:S:T:X:Y:Z:[:]:^:d:e:f:g:h:i:l:m:n:o:r:s;Z;c;d;g;hQ+n&OQ0n+pQ4g0mR6|4hT*^$y*_S*^$y*_T4o0u4pS/e*Z4mT3w/m7UQ+O%gQ/f*[Q0T+PQ0{+yQ4z0|Q7]4{Q8j7^R9Z8kn)u$s(j*q/W/o/p2o3h3}6[6m8}:{;X;Y!W:d(f)V){*T.V.s/O/]/|0k0m2n3i3m4f4h6O6P6c6g6o6q8W8[9b;e;f]:e3T6V7|8{8|9kp)w$s(j*q.|/W/o/p2o3h3}6[6m8}:{;X;Y!Y:f(f)V){*T.V.s/O/]/|0k0m2l2n3i3m4f4h6O6P6c6g6o6q8W8[9b;e;f_:g3T6V7|7}8{8|9kpmOXr!T!X#`%]&Z&d&f&g&i,],b1b1eQ&W!SR,X&apmOXr!T!X#`%]&Z&d&f&g&i,],b1b1eR&W!SQ+r&PR0j+kqmOXr!T!X#`%]&Z&d&f&g&i,],b1b1eQ0v+wS4u0y0zU7V4s4t4xS8f7X7YS9V8e8hQ9d9WR9i9eQ&_!TR,R&ZR5R1SS%oz%tR0`+[Q&d!UR,]&eR,c&jT1c,b1eR,g&kQ,f&kR1l,gQ'k!wR-c'kQrOQ#`XT%`r#`Q!zTR'm!zQ!}UR'o!}Q)n$rR.t)nQ#QVR'q#QQ#TWU'w#T'x-jQ'x#UR-j'yQ,v&zR1x,vQ.Z(jR2p.ZQ.^(lS2s.^2tR2t._Q,}'QR1|,}Y!oQ'Q,}0u4pR'[!oS#ZW%vU(O#Z(P-kQ(P#[R-k'zQ,y&}R1z,yr`OXr!T!X#`%]&Z&]&d&f&g&i,],b1b1eS#dZ%ZU#n`#d-tR-t(ZQ([#fQ-q(WW-y([-q2_5uQ2_-rR5u2`Q)`$hR.m)`Q$lhR)f$lQ$_cU)U$_-f:RQ-f9nR:R)cQ/R)|W3d/R3e6`8VU3e/S/T/US6`3f3gR8V6a#m)s$s(f(j)V){*T*l*m*q.T.U.V.s.|.}/O/W/]/o/p/|0k0m2l2m2n2o3T3h3i3m3}4f4h6O6P6T6U6V6[6c6g6m6o6q7|7}8O8W8[8{8|8}9b9k:{;X;Y;e;fQ/Z*TU3l/Z3n6dQ3n/]R6d3mQ*_$yR/i*_Q*h$}R/r*hQ4R/|R6p4RQ+i%yR0i+iQ4j0pS7O4j8dR8d7PQ+t&QR0s+tQ4p0uR7S4pQ1R,OS5P1R7aR7a5RQ0Z+WW4[0Z4^6v8`Q4^0^Q6v4]R8`6wQ+]%oR0a+]Q1e,bR5a1eWqOXr#`Q&h!XQ*u%]Q,[&dQ,^&fQ,_&gQ,a&iQ1`,]S1c,b1eR5`1bQ%_oQ&l!]Q&o!_Q&q!`Q&s!aQ'c!qQ+Q%iQ+d%uQ+j%zQ,Q&_Q,i&nW-Y']'e'f'iQ-a'aQ/h*^Q0U+RS1U,R,UQ1m,hQ1n,kQ1o,lQ2T-XW2V-[-]-`-bQ4T0VQ4a0dQ4e0kQ4y0{Q5T1WQ5_1aU5n2U2X2[Q5q2YQ6r4UQ6z4cQ6{4fQ7R4oQ7[4zQ7b5SS7q5o5sQ7s5rQ8a6xQ8i7]Q8n7cQ8u7rQ9T8bQ9Y8jQ9^8vR9f9ZQ%iwQ'U!fQ'a!qU+R%j%k%lQ,p&wU-T'V'W'XS-X']'gQ/_*XS0V+S+TQ1u,rS2R-U-VQ2Y-^Q3q/cQ4U0WQ5j1{Q5m2SQ5r2ZR6h3uS$ti;ZR*i%OU$}i%O;ZR/q*gQ$siS(f#r*}Q(j#tS)V$`$aQ){$uQ*T$xQ*l%TQ*m%UQ*q%YQ.T:XQ.U:ZQ.V:]Q.s)lQ.|)uQ.})wQ/O)xQ/W*PQ/]*VQ/o*eQ/p*fh/|*z.O0w2i4v5z7W7w8g8y9X9aQ0k+lQ0m+oQ2l:dQ2m:fQ2n:hQ2o.YS3T:S:TQ3h/XQ3i/YQ3m/[Q3}/wQ4f0lQ4h0oQ6O:lQ6P:nQ6T:YQ6U:[Q6V:^Q6[3aQ6c3kQ6g3sQ6m3yQ6o4QQ6q4SQ7|:iQ7}:eQ8O:gQ8W6bQ8[6kQ8{:mQ8|:oQ8}8SQ9b:rQ9k:sQ:{;ZQ;X;cQ;Y;dQ;e;gR;f;hloOXr!X#`%]&d&f&g&i,],b1b1eQ!dPS#bZ#kQ&n!^U'Y!l4m7UQ'p#OQ(s#xQ)d$jS,U&]&`Q,Y&aQ,h&mQ,m&uQ-P'SQ.a(qQ.q)eQ0P*{Q0g+gQ1],XQ2P-RQ2g.PQ3[.lQ3{/uQ4t0xQ5V1YQ5W1ZQ5Y1[Q5[1^Q5c1gQ5y2jQ6Y3XQ7Y4wQ7g5ZQ7i5]Q7j5^Q7y5}Q8h7ZR8p7h#UcOPXZr!X!^!l#`#k#x%]&]&`&a&d&f&g&i&m&u'S(q*{+g,X,],b-R.P/u0x1Y1Z1[1^1b1e1g2j4m4w5Z5]5^5}7U7Z7hQ#UWQ#aYQ%asQ%btQ%duS's#S'vQ'y#VQ(e#qQ(l#uQ(t#{Q(u#|Q(v#}Q(w$OQ(x$PQ(y$QQ(z$RQ({$SQ(|$TQ(}$UQ)O$VQ)Q$XQ)T$^Q)X$bW)c$j)e.l3XQ*x%cQ+^%pS,s&y1vQ-b'dS-g't-iQ-l'|Q-n(TQ.X(iQ._(mQ.c9lQ.e9oQ.f9pQ.g9qQ.v)pQ/x*sQ1q,nQ1t,qQ2U-ZQ2]-oQ2q.]Q2v9tQ2w9uQ2x9vQ2y9wQ2z9xQ2{9yQ2|9zQ2}9{Q3O9|Q3P9}Q3Q:OQ3R:PQ3S.dQ3V:UQ3W:_Q3]:QQ4O/zQ4V0XQ5i:`Q5o2WQ5t2^Q6Q2rQ6R:aQ6W:cQ6X:jQ7P4kQ7n5gQ7r5pQ7{:kQ8P:pQ8Q:qQ8v7tQ9U8cQ9]8tQ9n#OR;Q;^R#WWR&{!cY!qQ'Q,}0u4pS&w!c,uQ']!oS'g!r!uS'i!v4rS,r&x'PS-^'^'_Q-`'`Q1{,{R2Z-_R(k#tR(n#uQ!dQT,|'Q,}]!nQ!o'Q,}0u4pQ#l]R'Z9mT#gZ%ZS#fZ%ZU%y|},ZU(W#d#e#hS-r(X(YQ-v(ZQ0h+hQ2`-sU2a-t-u-wS5v2b2cR7u5w`#YW#S#V%v't'}+e-mt#cZ|}#d#e#h%Z(X(Y(Z+h-s-t-u-w2b2c5wQ1_,ZQ1r,oQ5e1jQ7m5fT:x&y+fT#]W%vS#[W%vS'u#S'}S'z#V+eS,t&y+fT-h't-mT'O!c%wQ$hfR)j$mT)_$h)`R3Z.kT*O$u*QR*W$xQ/}*zQ2e.OQ4s0wQ5{2iQ7X4vQ7x5zQ8e7WQ8w7wQ9W8gQ9`8yQ9e9XR9h9alpOXr!X#`%]&d&f&g&i,],b1b1eQ&^!TR,Q&ZV%z|},ZR0q+qR,P&XQ%szR+c%tR+X%nT&b!U&eT&c!U&eT1d,b1e", + nodeNames: "\u26A0 ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem", + maxTerm: 364, + context: trackNewline, + nodeProps: [ + ["group", -26, 6, 14, 16, 62, 199, 203, 206, 207, 209, 212, 215, 225, 227, 233, 235, 237, 239, 242, 248, 254, 256, 258, 260, 262, 264, 265, "Statement", -32, 10, 11, 25, 28, 29, 35, 45, 48, 49, 51, 56, 64, 72, 76, 78, 80, 81, 103, 104, 113, 114, 131, 134, 136, 137, 138, 139, 141, 142, 162, 163, 165, "Expression", -23, 24, 26, 30, 34, 36, 38, 166, 168, 170, 171, 173, 174, 175, 177, 178, 179, 181, 182, 183, 193, 195, 197, 198, "Type", -3, 84, 96, 102, "ClassItem"], + ["openedBy", 31, "InterpolationStart", 50, "[", 54, "{", 69, "(", 143, "JSXStartTag", 155, "JSXStartTag JSXStartCloseTag"], + ["closedBy", 33, "InterpolationEnd", 44, "]", 55, "}", 70, ")", 144, "JSXSelfCloseEndTag JSXEndTag", 160, "JSXEndTag"] + ], + propSources: [jsHighlight], + skippedNodes: [0, 3, 4, 268], + repeatNodeCount: 33, + tokenData: "$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(n%d_$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$d&j'z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$d&j'wpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU'wpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX'wp'z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$d&j'wp'z!b'm(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST'x#S$d&j'n(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$d&j'wp'z!b'n(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$d&j!l$Ip'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#q$Id$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#q$Id$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$2b3l_'v$(n$d&j'z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k*r4r_$d&j'z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k)`5vX$d&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q)`6jT$_#t$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c#t6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y#t7bO$_#t#t7eP;=`<%l6y)`7kP;=`<%l5q*r7w]$_#t$d&j'z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}%W8uZ'z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p%W9oU$_#t'z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}%W:UP;=`<%l8p*r:[P;=`<%l4k#%|:hg$d&j'wp'z!bOY%ZYZ&cZr%Zrs&}st%Ztu`k$d&j'wp'z!b(U!LY't&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P+d@`k$d&j'wp'z!b$W#tOY%ZYZ&cZr%Zrs&}st%Ztu@Tuw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![@T![!^%Z!^!_*g!_!c%Z!c!}@T!}#O%Z#O#P&c#P#R%Z#R#S@T#S#T%Z#T#o@T#o#p*g#p$g%Z$g;'S@T;'S;=`BT<%lO@T+dBWP;=`<%l@T(CSB^P;=`<%l>P%#SBl`$d&j'wp'z!b#i$IdOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#SCy_$d&j#{$Id'wp'z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%DfETa(j%Z![!^%Z!^!_*g!_!c%Z!c!i#>Z!i#O%Z#O#P&c#P#R%Z#R#S#>Z#S#T%Z#T#Z#>Z#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#>fi$d&j'wp'z!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#>Z![!^%Z!^!_*g!_!c%Z!c!i#>Z!i#O%Z#O#P&c#P#R%Z#R#S#>Z#S#T%Z#T#Z#>Z#Z#b%Z#b#c#5T#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%Gh#@b_!a$b$d&j#y%Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$JT>P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(CS$=Uk$d&j'wp'z!b'n(;d(U!LY't&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P", + tokenizers: [noSemicolon, incdecToken, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, insertSemicolon, new LocalTokenGroup("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(T~~", 141, 326), new LocalTokenGroup("j~RQYZXz{^~^O'q~~aP!P!Qd~iO'r~~", 25, 308)], + topRules: { "Script": [0, 5], "SingleExpression": [1, 266], "SingleClassItem": [2, 267] }, + dialects: { jsx: 12686, ts: 12688 }, + dynamicPrecedences: { "76": 1, "78": 1, "163": 1, "191": 1 }, + specialized: [{ term: 312, get: (value) => spec_identifier[value] || -1 }, { term: 328, get: (value) => spec_word[value] || -1 }, { term: 67, get: (value) => spec_LessThan[value] || -1 }], + tokenPrec: 12712 +}); -// src/components/Space/Frames/Setters/OptionsSetter.tsx -init_compat_module(); +// node_modules/@codemirror/lang-javascript/dist/index.js +var import_language3 = require("@codemirror/language"); +var import_state11 = require("@codemirror/state"); +var import_view8 = require("@codemirror/view"); +var import_autocomplete = require("@codemirror/autocomplete"); +var snippets = [ + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("function ${name}(${params}) {\n ${}\n}", { + label: "function", + detail: "definition", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}", { + label: "for", + detail: "loop", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("for (let ${name} of ${collection}) {\n ${}\n}", { + label: "for", + detail: "of loop", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("do {\n ${}\n} while (${})", { + label: "do", + detail: "loop", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("while (${}) {\n ${}\n}", { + label: "while", + detail: "loop", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("try {\n ${}\n} catch (${error}) {\n ${}\n}", { + label: "try", + detail: "/ catch block", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("if (${}) {\n ${}\n}", { + label: "if", + detail: "block", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("if (${}) {\n ${}\n} else {\n ${}\n}", { + label: "if", + detail: "/ else block", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("class ${name} {\n constructor(${params}) {\n ${}\n }\n}", { + label: "class", + detail: "definition", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)('import {${names}} from "${module}"\n${}', { + label: "import", + detail: "named", + type: "keyword" + }), + /* @__PURE__ */ (0, import_autocomplete.snippetCompletion)('import ${name} from "${module}"\n${}', { + label: "import", + detail: "default", + type: "keyword" + }) +]; +var cache = /* @__PURE__ */ new NodeWeakMap(); +var ScopeNodes = /* @__PURE__ */ new Set([ + "Script", + "Block", + "FunctionExpression", + "FunctionDeclaration", + "ArrowFunction", + "MethodDeclaration", + "ForStatement" +]); +function defID(type) { + return (node, def) => { + let id3 = node.node.getChild("VariableDefinition"); + if (id3) + def(id3, type); + return true; + }; +} +var functionContext = ["FunctionDeclaration"]; +var gatherCompletions = { + FunctionDeclaration: /* @__PURE__ */ defID("function"), + ClassDeclaration: /* @__PURE__ */ defID("class"), + ClassExpression: () => true, + EnumDeclaration: /* @__PURE__ */ defID("constant"), + TypeAliasDeclaration: /* @__PURE__ */ defID("type"), + NamespaceDeclaration: /* @__PURE__ */ defID("namespace"), + VariableDefinition(node, def) { + if (!node.matchContext(functionContext)) + def(node, "variable"); + }, + TypeDefinition(node, def) { + def(node, "type"); + }, + __proto__: null +}; +function getScope(doc, node) { + let cached = cache.get(node); + if (cached) + return cached; + let completions = [], top = true; + function def(node2, type) { + let name2 = doc.sliceString(node2.from, node2.to); + completions.push({ label: name2, type }); + } + node.cursor(IterMode.IncludeAnonymous).iterate((node2) => { + if (top) { + top = false; + } else if (node2.name) { + let gather = gatherCompletions[node2.name]; + if (gather && gather(node2, def) || ScopeNodes.has(node2.name)) + return false; + } else if (node2.to - node2.from > 8192) { + for (let c4 of getScope(doc, node2.node)) + completions.push(c4); + return false; + } + }); + cache.set(node, completions); + return completions; +} +var Identifier = /^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/; +var dontComplete = [ + "TemplateString", + "String", + "RegExp", + "LineComment", + "BlockComment", + "VariableDefinition", + "TypeDefinition", + "Label", + "PropertyDefinition", + "PropertyName", + "PrivatePropertyDefinition", + "PrivatePropertyName", + ".", + "?." +]; +function localCompletionSource(context) { + let inner = (0, import_language3.syntaxTree)(context.state).resolveInner(context.pos, -1); + if (dontComplete.indexOf(inner.name) > -1) + return null; + let isWord = inner.name == "VariableName" || inner.to - inner.from < 20 && Identifier.test(context.state.sliceDoc(inner.from, inner.to)); + if (!isWord && !context.explicit) + return null; + let options = []; + for (let pos = inner; pos; pos = pos.parent) { + if (ScopeNodes.has(pos.name)) + options = options.concat(getScope(context.state.doc, pos)); + } + return { + options, + from: isWord ? inner.from : context.pos, + validFor: Identifier + }; +} +var javascriptLanguage = /* @__PURE__ */ import_language3.LRLanguage.define({ + name: "javascript", + parser: /* @__PURE__ */ parser.configure({ + props: [ + /* @__PURE__ */ import_language3.indentNodeProp.add({ + IfStatement: /* @__PURE__ */ (0, import_language3.continuedIndent)({ except: /^\s*({|else\b)/ }), + TryStatement: /* @__PURE__ */ (0, import_language3.continuedIndent)({ except: /^\s*({|catch\b|finally\b)/ }), + LabeledStatement: import_language3.flatIndent, + SwitchBody: (context) => { + let after = context.textAfter, closed = /^\s*\}/.test(after), isCase = /^\s*(case|default)\b/.test(after); + return context.baseIndent + (closed ? 0 : isCase ? 1 : 2) * context.unit; + }, + Block: /* @__PURE__ */ (0, import_language3.delimitedIndent)({ closing: "}" }), + ArrowFunction: (cx) => cx.baseIndent + cx.unit, + "TemplateString BlockComment": () => null, + "Statement Property": /* @__PURE__ */ (0, import_language3.continuedIndent)({ except: /^{/ }), + JSXElement(context) { + let closed = /^\s*<\//.test(context.textAfter); + return context.lineIndent(context.node.from) + (closed ? 0 : context.unit); + }, + JSXEscape(context) { + let closed = /\s*\}/.test(context.textAfter); + return context.lineIndent(context.node.from) + (closed ? 0 : context.unit); + }, + "JSXOpenTag JSXSelfClosingTag"(context) { + return context.column(context.node.from) + context.unit; + } + }), + /* @__PURE__ */ import_language3.foldNodeProp.add({ + "Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType": import_language3.foldInside, + BlockComment(tree) { + return { from: tree.from + 2, to: tree.to - 2 }; + } + }) + ] + }), + languageData: { + closeBrackets: { brackets: ["(", "[", "{", "'", '"', "`"] }, + commentTokens: { line: "//", block: { open: "/*", close: "*/" } }, + indentOnInput: /^\s*(?:case |default:|\{|\}|<\/)$/, + wordChars: "$" + } +}); +var jsxSublanguage = { + test: (node) => /^JSX/.test(node.name), + facet: /* @__PURE__ */ (0, import_language3.defineLanguageFacet)({ commentTokens: { block: { open: "{/*", close: "*/}" } } }) +}; +var typescriptLanguage = /* @__PURE__ */ javascriptLanguage.configure({ dialect: "ts" }, "typescript"); +var jsxLanguage = /* @__PURE__ */ javascriptLanguage.configure({ + dialect: "jsx", + props: [/* @__PURE__ */ import_language3.sublanguageProp.add((n2) => n2.isTop ? [jsxSublanguage] : void 0)] +}); +var tsxLanguage = /* @__PURE__ */ javascriptLanguage.configure({ + dialect: "jsx ts", + props: [/* @__PURE__ */ import_language3.sublanguageProp.add((n2) => n2.isTop ? [jsxSublanguage] : void 0)] +}, "typescript"); +var keywords2 = /* @__PURE__ */ "break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((kw2) => ({ label: kw2, type: "keyword" })); +function javascript(config = {}) { + let lang = config.jsx ? config.typescript ? tsxLanguage : jsxLanguage : config.typescript ? typescriptLanguage : javascriptLanguage; + return new import_language3.LanguageSupport(lang, [ + javascriptLanguage.data.of({ + autocomplete: (0, import_autocomplete.ifNotIn)(dontComplete, (0, import_autocomplete.completeFromList)(snippets.concat(keywords2))) + }), + javascriptLanguage.data.of({ + autocomplete: localCompletionSource + }), + config.jsx ? autoCloseTags : [] + ]); +} +function findOpenTag(node) { + for (; ; ) { + if (node.name == "JSXOpenTag" || node.name == "JSXSelfClosingTag" || node.name == "JSXFragmentTag") + return node; + if (node.name == "JSXEscape" || !node.parent) + return null; + node = node.parent; + } +} +function elementName(doc, tree, max3 = doc.length) { + for (let ch = tree === null || tree === void 0 ? void 0 : tree.firstChild; ch; ch = ch.nextSibling) { + if (ch.name == "JSXIdentifier" || ch.name == "JSXBuiltin" || ch.name == "JSXNamespacedName" || ch.name == "JSXMemberExpression") + return doc.sliceString(ch.from, Math.min(ch.to, max3)); + } + return ""; +} +function isEndTag(node) { + return node && (node.name == "JSXEndTag" || node.name == "JSXSelfCloseEndTag"); +} +var android = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent); +var autoCloseTags = /* @__PURE__ */ import_view8.EditorView.inputHandler.of((view, from, to, text2) => { + if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to || text2 != ">" && text2 != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1)) + return false; + let { state } = view; + let changes = state.changeByRange((range) => { + var _a2; + let { head } = range, around2 = (0, import_language3.syntaxTree)(state).resolveInner(head, -1), name2; + if (around2.name == "JSXStartTag") + around2 = around2.parent; + if (around2.name == "JSXAttributeValue" && around2.to > head) + ; + else if (text2 == ">" && around2.name == "JSXFragmentTag") { + return { range: import_state11.EditorSelection.cursor(head + 1), changes: { from: head, insert: `>` } }; + } else if (text2 == "/" && around2.name == "JSXFragmentTag") { + let empty3 = around2.parent, base2 = empty3 === null || empty3 === void 0 ? void 0 : empty3.parent; + if (empty3.from == head - 1 && ((_a2 = base2.lastChild) === null || _a2 === void 0 ? void 0 : _a2.name) != "JSXEndTag" && (name2 = elementName(state.doc, base2 === null || base2 === void 0 ? void 0 : base2.firstChild, head))) { + let insert2 = `/${name2}>`; + return { range: import_state11.EditorSelection.cursor(head + insert2.length), changes: { from: head, insert: insert2 } }; + } + } else if (text2 == ">") { + let openTag = findOpenTag(around2); + if (openTag && !isEndTag(openTag.lastChild) && state.sliceDoc(head, head + 2) != "` } }; + } + return { range }; + }); + if (changes.changes.empty) + return false; + view.dispatch(changes, { userEvent: "input.type", scrollIntoView: true }); + return true; +}); // src/components/Space/Contexts/DataTypeView/CodeCell.tsx -var import_language3 = require("@codemirror/language"); -var import_state12 = require("@codemirror/state"); -var import_view9 = require("@codemirror/view"); +var import_language4 = require("@codemirror/language"); +var import_state13 = require("@codemirror/state"); +var import_view10 = require("@codemirror/view"); // src/cm-extensions/frames/code.ts -var import_state11 = require("@codemirror/state"); -var import_view8 = require("@codemirror/view"); -var codeBlockLine = import_view8.Decoration.line({ +var import_state12 = require("@codemirror/state"); +var import_view9 = require("@codemirror/view"); +var codeBlockLine = import_view9.Decoration.line({ class: "HyperMD-codeblock HyperMD-codeblock-bg" }); function codeBlockClass(view) { - const builder = new import_state11.RangeSetBuilder(); + const builder = new import_state12.RangeSetBuilder(); for (const { from, to } of view.visibleRanges) { for (let pos = from; pos <= to; ) { const line = view.state.doc.lineAt(pos); @@ -73741,37 +78255,730 @@ function codeBlockClass(view) { } return builder.finish(); } -var codeBlock = import_view8.ViewPlugin.fromClass(class { +var codeBlock = import_view9.ViewPlugin.fromClass(class { constructor(view) { this.decorations = codeBlockClass(view); } - update(update) { - if (update.docChanged || update.viewportChanged) - this.decorations = codeBlockClass(update.view); + update(update) { + if (update.docChanged || update.viewportChanged) + this.decorations = codeBlockClass(update.view); + } +}, { + decorations: (v4) => v4.decorations +}); + +// src/components/Space/Contexts/DataTypeView/CodeCell.tsx +var import_lodash13 = __toESM(require_lodash()); +init_compat_module(); +var CodeCell = (props2) => { + const { initialValue, saveValue } = props2; + const [value, setValue] = Cn.useState(initialValue); + Cn.useEffect(() => { + setValue(initialValue); + }, [initialValue]); + const [valChanged, setValChanged] = h2(false); + const [element, setElement] = h2(); + const editorRef = _2(null); + const ref2 = T2((node) => { + if (!node) + return; + setElement(node); + }, []); + const extensions = () => [ + (0, import_view10.highlightSpecialChars)(), + (0, import_language4.foldGutter)(), + (0, import_language4.indentOnInput)(), + (0, import_language4.syntaxHighlighting)(import_language4.defaultHighlightStyle, { fallback: true }), + (0, import_language4.bracketMatching)(), + javascript(), + codeBlock, + import_view10.EditorView.updateListener.of((v4) => { + if (v4.docChanged) { + if (v4.state.doc.toString() != props2.initialValue) { + debounceNeedSave(); + } + } + }) + ]; + const debounceNeedSave = T2( + (0, import_lodash13.debounce)(() => setValChanged(true), 100), + [] + ); + p2(() => { + if (!ref2) + return; + const view = new import_view10.EditorView({ + state: import_state13.EditorState.create({ + extensions: extensions(), + doc: ensureString(value) + }), + parent: element + }); + editorRef.current = view; + return () => { + editorRef.current = null; + view.destroy(); + }; + }, [element]); + p2(() => { + var _a2; + if (editorRef.current.state.doc.toString() != initialValue) + editorRef.current.setState( + import_state13.EditorState.create({ + extensions: extensions(), + doc: (_a2 = ensureString(initialValue)) != null ? _a2 : "" + }) + ); + }, [initialValue]); + return /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-cell-code cm-s-obsidian markdown-source-view mod-cm6", + ref: ref2 + }), valChanged && /* @__PURE__ */ Cn.createElement("div", { + onClick: () => { + saveValue(editorRef.current.state.doc.toString()); + setValChanged(false); + } + }, /* @__PURE__ */ Cn.createElement("span", null, "Save Changes"), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-small", + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-check"] } + }))); +}; + +// src/components/ui/modals/textModal.tsx +var import_obsidian60 = require("obsidian"); +var TextEditModal = class extends import_obsidian60.Modal { + constructor(title, saveAction) { + super(app); + this.title = title; + this.saveAction = saveAction; + } + onOpen() { + let { contentEl } = this; + let myModal = this; + let headerText = this.title; + const headerEl = contentEl.createEl("div", { text: headerText }); + headerEl.addClass("modal-title"); + const inputEl = contentEl.createEl("textarea"); + inputEl.style.cssText = "width: 100%; height: 10em; margin-bottom: 15px;"; + inputEl.focus(); + let changeButtonText = "Save"; + const changeButton = contentEl.createEl("button", { + text: changeButtonText + }); + const cancelButton = contentEl.createEl("button", { + text: i18n_default.buttons.cancel + }); + cancelButton.style.cssText = "float: right;"; + cancelButton.addEventListener("click", () => { + myModal.close(); + }); + const onClickAction = async () => { + let newName = inputEl.value; + this.saveAction(newName); + myModal.close(); + }; + changeButton.addEventListener("click", onClickAction); + inputEl.addEventListener("keydown", (e4) => { + if (e4.key === "Enter") { + e4.preventDefault(); + onClickAction(); + } + }); + } + onClose() { + let { contentEl } = this; + contentEl.empty(); } -}, { - decorations: (v3) => v3.decorations -}); +}; -// src/components/Space/Contexts/DataTypeView/CodeCell.tsx -var import_lodash13 = __toESM(require_lodash()); +// src/components/Space/Frames/Panels/CodePanel.tsx init_compat_module(); -// src/components/ui/modals/textModal.tsx -var import_obsidian60 = require("obsidian"); +// src/schemas/code.ts +var commonActionsKeys = [ + "onClick", + "onRun" +]; +var commonStyleKeys = [ + "alignContent", + "alignItems", + "alignSelf", + "backgroundColor", + "border", + "borderBottom", + "borderBottomColor", + "borderBottomStyle", + "borderBottomWidth", + "borderColor", + "borderLeft", + "borderLeftColor", + "borderLeftStyle", + "borderLeftWidth", + "borderRadius", + "borderRight", + "borderRightColor", + "borderRightStyle", + "borderRightWidth", + "borderStyle", + "borderTop", + "borderTopColor", + "borderTopStyle", + "borderTopWidth", + "borderWidth", + "boxShadow", + "boxSizing", + "color", + "display", + "flex", + "flexBasis", + "flexDirection", + "flexFlow", + "flexGrow", + "flexShrink", + "flexWrap", + "fontFamily", + "fontSize", + "fontWeight", + "height", + "justifyContent", + "letterSpacing", + "lineHeight", + "margin", + "marginBottom", + "marginLeft", + "marginRight", + "marginTop", + "maxHeight", + "maxWidth", + "minHeight", + "minWidth", + "opacity", + "order", + "outline", + "outlineColor", + "outlineStyle", + "outlineWidth", + "overflow", + "overflowX", + "overflowY", + "padding", + "paddingBottom", + "paddingLeft", + "paddingRight", + "paddingTop", + "position", + "textAlign", + "textDecoration", + "textTransform", + "top", + "right", + "bottom", + "left", + "transform", + "transition", + "verticalAlign", + "visibility", + "whiteSpace", + "width", + "wordSpacing", + "zIndex" +]; // src/components/Space/Frames/Panels/CodePanel.tsx -init_compat_module(); +var CodeEditBlock = (props2) => { + const [lProps, setLProps] = h2(props2.props); + p2(() => { + setLProps(props2.props); + }, [props2.props]); + const saveProps = (newProps) => { + setLProps((p3) => ({ ...p3, ...newProps })); + props2.saveProps(newProps); + }; + const showAddMenu = (e4) => { + const offset2 = e4.target.getBoundingClientRect(); + const f4 = props2.type == "styles" ? commonStyleKeys : commonActionsKeys; + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: false, + editable: true, + value: [], + options: f4.map((m6) => ({ name: m6, value: m6 })), + saveOptions: (_12, value) => saveProps({ [value[0]]: "" }), + searchable: true + } + ); + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-code-section" + }, /* @__PURE__ */ Cn.createElement("span", null, props2.type), Object.keys(lProps != null ? lProps : {}).map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, + className: "mk-frame-code-block" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-code-block-prop" + }, /* @__PURE__ */ Cn.createElement("span", null, f4), props2.removeProp && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-icon-small", + onClick: () => { + props2.removeProp(f4); + }, + dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-close"] } + })), /* @__PURE__ */ Cn.createElement(CodeCell, { + setEditMode: () => null, + plugin: props2.plugin, + propertyValue: "", + initialValue: lProps[f4], + saveValue: (value) => saveProps({ [f4]: value }), + editMode: 2 /* EditModeActive */ + }))), props2.canAdd && /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-code-add", + onClick: (e4) => showAddMenu(e4) + }, "Add Property"), /* @__PURE__ */ Cn.createElement("div", { + onClick: () => { + let cssEditModal = new TextEditModal("Paste CSS", (value) => { + function parseCSS(cssString) { + const cssObject = {}; + const properties2 = cssString.split(";").filter((property2) => property2.trim() !== ""); + properties2.forEach((property2) => { + let [key2, value2] = property2.split(":").map((s6) => s6.trim()); + key2 = key2.replace( + /-([a-z])/g, + (match2, letter) => letter.toUpperCase() + ); + cssObject[key2] = `"${value2}"`; + }); + return cssObject; + } + saveProps(parseCSS(value)); + }); + cssEditModal.open(); + } + }, "Paste CSS"))); +}; +var CodePanel = (props2) => { + const { selectedNodes, nodes, saveNodes, root: root2, saveProperty, properties: properties2 } = q2(FramesEditorContext); + const saveStyleValues = (values) => { + const newNodes = selectedNodes.map((f4) => ({ + ...f4, + styles: mergePropObjects(f4.styles, values) + })); + saveNodes(newNodes); + }; + const removeKeyFromProp = (key2, type) => { + const newNodes = selectedNodes.map((f4) => { + var _a2; + return { + ...f4, + [type]: removeKey((_a2 = f4[type]) != null ? _a2 : {}, key2) + }; + }); + saveNodes(newNodes); + }; + const saveActionValue = (values) => { + const newNodes = selectedNodes.map((f4) => ({ + ...f4, + actions: mergePropObjects(f4.actions, values) + })); + saveNodes(newNodes); + }; + const savePropsValue = (values) => { + const newNodes = selectedNodes.map((f4) => ({ + ...f4, + props: mergePropObjects(f4.props, values) + })); + saveNodes(newNodes); + }; + const mergeRootProperty = (fields, props3) => fields.reduce( + (p3, c4) => ({ + ...p3, + [c4["name"]]: props3 == null ? void 0 : props3[c4["name"]] + }), + {} + ); + const editableProps = selectedNodes[0].id == root2.id ? mergeRootProperty(properties2, root2.node.props) : selectedNodes[0].props; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-code-editor" + }, selectedNodes.length > 0 && /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, Object.keys(editableProps != null ? editableProps : {}).length > 0 && /* @__PURE__ */ Cn.createElement(CodeEditBlock, { + type: "props", + plugin: props2.plugin, + props: editableProps, + saveProps: savePropsValue, + selectedProp: props2.selectedType == "props" ? props2.selectedProp : null, + canAdd: false + }), /* @__PURE__ */ Cn.createElement(CodeEditBlock, { + type: "styles", + plugin: props2.plugin, + props: selectedNodes[0].styles, + saveProps: saveStyleValues, + selectedProp: props2.selectedType == "styles" ? props2.selectedProp : null, + removeProp: (key2) => removeKeyFromProp(key2, "styles"), + canAdd: true + }), /* @__PURE__ */ Cn.createElement(CodeEditBlock, { + type: "actions", + plugin: props2.plugin, + props: selectedNodes[0].actions, + saveProps: saveActionValue, + selectedProp: props2.selectedType == "actions" ? props2.selectedProp : null, + removeProp: (key2) => removeKeyFromProp(key2, "actions"), + canAdd: true + }))); +}; // src/components/Space/Frames/Panels/EventsPanel.tsx init_compat_module(); +var EventsPanel = (props2) => { + var _a2; + return /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-row" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field" + }, "On Click"), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-value" + }, /* @__PURE__ */ Cn.createElement(TextCell, { + initialValue: (_a2 = props2.events) == null ? void 0 : _a2.onClick, + saveValue: (value) => props2.saveEvent({ onClick: value }), + editMode: 2 /* EditModeActive */, + setEditMode: () => null, + plugin: props2.plugin, + propertyValue: "" + })))); +}; // src/components/Space/Frames/Panels/NodeInfoPanel.tsx init_compat_module(); +var NodeInfoPanel = (props2) => { + const { saveNodes, root: root2, selectedNodes, properties: properties2 } = q2(FramesEditorContext); + const { spaceInfo } = q2(SpaceContext); + const selectedProps = F2( + () => { + var _a2, _b2; + return selectedNodes.length > 0 && selectedNodes[0].id != root2.id ? (_b2 = (_a2 = selectedNodes == null ? void 0 : selectedNodes[0]) == null ? void 0 : _a2.props) != null ? _b2 : {} : {}; + }, + [selectedNodes] + ); + const selectedFields = F2( + () => selectedNodes.length > 0 && selectedNodes[0].id != root2.id ? propertiesForNode(selectedNodes[0]) : [], + [selectedNodes] + ); + const { + deleteNode: delFrame, + selectNodes, + moveUp, + moveDown + } = q2(FramesEditorContext); + const saveNodeValue = (values, node) => { + const newNodes = { + ...node, + props: { + ...node.props, + ...values + } + }; + saveNodes([newNodes]); + }; + const showLinkMenu2 = (e4, name2) => { + const offset2 = e4.target.getBoundingClientRect(); + const f4 = properties2; + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: false, + editable: true, + value: [], + options: f4.map((m6) => ({ name: m6.name, value: m6.name })), + saveOptions: (_12, value) => saveNodeValue( + { [name2]: `${root2.node.id}.props.${value[0]}` }, + selectedNodes[0] + ), + placeholder: i18n_default.labels.contextItemSelectPlaceholder, + searchable: true, + showAll: true + } + ); + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-node-info" + }, selectedProps && selectedFields.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-row", + key: i5 + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-field" + }, f4.name), /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-value" + }, stringIsConst(selectedProps[f4.name]) ? /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(DataTypeView, { + plugin: props2.plugin, + initialValue: removeQuotes(selectedProps[f4.name]), + column: { ...f4, table: "" }, + editable: !spaceInfo.readOnly, + updateValue: (value) => saveNodeValue( + { [f4.name]: `"${value}"` }, + selectedNodes[0] + ) + }), /* @__PURE__ */ Cn.createElement("div", { + onClick: () => props2.editCode(selectedNodes[0].id, f4.name, "props"), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-mark-code"] + } + }), /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => showLinkMenu2(e4, f4.name), + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-mark-link"] + } + })) : /* @__PURE__ */ Cn.createElement(CodeEditorSetter, { + name: f4.name, + value: selectedProps[f4.name], + type: "props", + node: selectedNodes[0].id, + editCode: props2.editCode + }))))); +}; + +// src/components/Space/Frames/FrameInspector.tsx +var FrameInspector = (props2) => { + var _a2; + const activationConstraint = { + distance: { y: 0 }, + tolerance: { x: 0 } + }; + const mouseSensor = useSensor(MouseSensor, { + activationConstraint + }); + const touchSensor = useSensor(TouchSensor, { + activationConstraint + }); + const keyboardSensor = useSensor(KeyboardSensor, {}); + const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor); + const [tab, setTab] = h2(0); + const { frameSchema } = q2(FramesMDBContext); + const [preselectedProp, setPreselectedProp] = h2(null); + const [preselectedPropType, setPreselectedPropType] = h2(null); + const { + root: root2, + instance, + nodes, + saveNodes: saveFrames, + saveProperty, + setHoverNode, + selectNodes, + selectedNodes, + properties: properties2 + } = q2(FramesEditorContext); + const editCode = (node, key2, type) => { + setTab(1); + if (!((selectedNodes == null ? void 0 : selectedNodes.length) > 0)) { + if (selectedNodes[0].id != node) { + selectNodes(nodes); + } + } else { + } + setPreselectedProp(key2); + setPreselectedPropType(type); + }; + const saveActionValue = (values) => { + const newNodes = selectedNodes.map((f4) => ({ + ...f4, + actions: mergePropObjects(f4.actions, values) + })); + saveFrames(newNodes); + }; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-inspector" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-main-tabs" + }, (selectedNodes == null ? void 0 : selectedNodes.length) == 1 ? selectedNodes[0].name : selectedNodes.length > 1 ? `${selectedNodes.length} Layers` : "", /* @__PURE__ */ Cn.createElement("button", { + onClick: () => setTab(0) + }, "Props"), /* @__PURE__ */ Cn.createElement("button", { + onClick: () => setTab(1) + }, "Styles"), /* @__PURE__ */ Cn.createElement("button", { + onClick: () => setTab(2) + }, "Events"), /* @__PURE__ */ Cn.createElement("button", { + onClick: () => setTab(3) + }, "Code")), tab == 0 ? /* @__PURE__ */ Cn.createElement(NodeInfoPanel, { + plugin: props2.plugin, + editCode + }) : tab == 1 ? /* @__PURE__ */ Cn.createElement(FrameStyler, { + plugin: props2.plugin, + editCode + }) : tab == 2 ? /* @__PURE__ */ Cn.createElement(EventsPanel, { + events: (_a2 = selectedNodes[0].actions) != null ? _a2 : {}, + saveEvent: saveActionValue, + plugin: props2.plugin + }) : /* @__PURE__ */ Cn.createElement(CodePanel, { + plugin: props2.plugin, + selectedProp: preselectedProp, + selectedType: preselectedPropType + })); +}; // src/components/Space/Frames/FrameLayerList.tsx var import_obsidian61 = require("obsidian"); init_compat_module(); +var FrameLayerList = (props2) => { + const [elements, setElements] = h2([]); + const { spaceInfo } = q2(SpaceContext); + const { + frameSchema, + deleteSchema, + saveFrame, + tableData, + frameSchemas: schemas, + setFrameSchema, + saveSchema + } = q2(FramesMDBContext); + const { + selectNodes, + root: root2, + nodes, + delProperty, + deleteNode: delFrame, + selectedNodes + } = q2(FramesEditorContext); + const [collapsed, setCollapsed] = h2(false); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-sidebar" + }, /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => { + setCollapsed(!collapsed); + e4.stopPropagation(); + }, + className: "mk-file-context-title" + }, "Layers", /* @__PURE__ */ Cn.createElement("button", { + className: `mk-collapse mk-inline-button mk-icon-xsmall ${collapsed ? "mk-collapsed" : ""}`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse-sm"] + } + })), root2 && !collapsed && /* @__PURE__ */ Cn.createElement("div", { + className: "mk-frame-layers" + }, /* @__PURE__ */ Cn.createElement(FrameLayerGroup, { + plugin: props2.plugin, + node: root2, + depth: 0 + }), (nodes != null ? nodes : []).filter( + (f4) => (!f4.parentId || f4.parentId.length == 0) && f4.id != root2.id + ).map((f4) => /* @__PURE__ */ Cn.createElement(FrameLayerGroup, { + key: f4.id, + plugin: props2.plugin, + node: { id: f4.id, node: f4, children: [], isRef: false }, + depth: 0 + })))); +}; +var FrameLayerGroup = (props2) => { + const { spaceInfo } = q2(SpaceContext); + const { + selectNodes, + root: root2, + delProperty, + deleteNode, + moveUp, + moveDown, + addNode, + nodes, + groupNodes, + selectedNodes, + saveNodes + } = q2(FramesEditorContext); + const viewContextMenu = (e4) => { + const fileMenu = new import_obsidian61.Menu(); + const node = props2.node.node; + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Group Nodes"); + menuItem.onClick(() => { + groupNodes(selectedNodes); + }); + }); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Move Up"); + menuItem.onClick(() => { + moveUp(node); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Move Down"); + menuItem.onClick(() => { + moveDown(node); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Move To"); + menuItem.onClick(() => { + showMoveMenu(e4, node); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Delete"); + menuItem.onClick(() => { + deleteNode(node); + }); + }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }; + const showMoveMenu = (e4, node) => { + const offset2 = e4.target.getBoundingClientRect(); + const f4 = nodes.filter((n2) => groupableTypes.some((t5) => t5 == n2.type)); + showSelectMenu( + { x: offset2.left, y: offset2.top + 30 }, + { + plugin: props2.plugin, + multi: false, + editable: true, + value: [], + options: f4.map((m6) => ({ name: m6.id, value: m6.id })), + saveOptions: (_12, value) => saveNodes([{ ...node, parentId: value[0] }]), + searchable: true, + showAll: true + } + ); + }; + const selectNode = () => { + const evt = new CustomEvent(eventTypes.frameLayerSelected, { + detail: { selection: [props2.node.node.id] } + }); + window.dispatchEvent(evt); + }; + const nodesSelected = (evt) => { + selectNodes( + evt.detail.selection.map((f4) => nodes.find((n2) => n2.id == f4)).filter((f4) => f4) + ); + }; + p2(() => { + window.addEventListener(eventTypes.frameLayerSelected, nodesSelected); + return () => { + window.removeEventListener(eventTypes.frameLayerSelected, nodesSelected); + }; + }, []); + return /* @__PURE__ */ Cn.createElement("div", null, /* @__PURE__ */ Cn.createElement("div", { + className: `mk-frame-layer ${selectedNodes.some((f4) => f4.id == props2.node.id) ? "is-selected" : ""}`, + style: { + "--spacing": `${10 * props2.depth}px` + }, + onClick: () => selectNode(), + onContextMenu: (e4) => viewContextMenu(e4) + }, /* @__PURE__ */ Cn.createElement("span", null, props2.node.id), !props2.node.isRef && props2.node.children.length > 0 && /* @__PURE__ */ Cn.createElement("button", { + className: "mk-inline-button mk-icon-xsmall", + onClick: (e4) => { + showNewFrameMenu(e4, props2.plugin, spaceInfo, addNode); + e4.stopPropagation(); + }, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-plus"] + } + })), props2.node.children.filter((f4) => !f4.isRef).map((f4, i5) => /* @__PURE__ */ Cn.createElement(FrameLayerGroup, { + plugin: props2.plugin, + key: i5, + node: f4, + depth: props2.depth + 1 + }))); +}; // src/components/FileContexts/ContextExplorer.tsx var import_obsidian67 = require("obsidian"); @@ -73782,9 +78989,206 @@ init_compat_module(); // src/components/FileContexts/Backlinks.tsx init_compat_module(); +var BacklinkItem = (props2) => { + const file = F2( + () => getAbstractFileAtPath(app, props2.path), + [props2.path] + ); + const [block, setBlock] = h2([null, null]); + const refreshBlock = (path) => { + var _a2, _b2; + const fCache = app.metadataCache.getCache(path); + const link = [...(_a2 = fCache.links) != null ? _a2 : [], ...(_b2 = fCache.embeds) != null ? _b2 : []].find( + (f4) => props2.source.includes(f4.displayText) + ); + if (link) { + const block2 = fCache.sections.find( + (f4) => f4.position.start.offset <= link.position.start.offset && f4.position.end.offset >= link.position.end.offset + ); + setBlock([ + Math.max(1, block2.position.start.line), + Math.max(block2.position.start.line + 1, block2.position.end.line + 1) + ]); + } else { + setBlock([null, null]); + } + }; + p2(() => { + refreshBlock(props2.path); + }, []); + p2(() => { + refreshBlock(props2.path); + }, [props2.path]); + const [collapsed, setCollapsed] = h2(false); + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-title" + }, /* @__PURE__ */ Cn.createElement("button", { + className: `mk-collapse mk-inline-button mk-icon-xsmall ${collapsed ? "mk-collapsed" : ""}`, + onClick: (e4) => { + setCollapsed(!collapsed); + e4.stopPropagation(); + }, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse"] + } + }), /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => { + openAFile(file, props2.plugin, false); + e4.stopPropagation(); + } + }, fileNameToString(file.name))), !collapsed ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-backlink" + }, /* @__PURE__ */ Cn.createElement(FlowView, { + plugin: props2.plugin, + load: true, + path: props2.path, + from: block[0], + to: block[1] + })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null)); +}; +var Backlinks = (props2) => { + const [collapsed, setCollapsed] = h2( + !props2.plugin.settings.inlineBacklinksExpanded + ); + const [backlinks, setBacklinks] = h2([]); + p2(() => { + if (!props2.file) + return; + const bls = uniq([ + ...props2.plugin.index.linksMap.getInverse(props2.file.path), + ...Object.keys(app.metadataCache.resolvedLinks).filter( + (f4) => props2.file.path in app.metadataCache.resolvedLinks[f4] + ) + ]).filter((f4) => abstractFileAtPathExists(app, f4)); + setBacklinks(bls); + }, [props2.file]); + p2(() => { + props2.plugin.settings.inlineBacklinksExpanded = !collapsed; + props2.plugin.saveSettings(); + }, [collapsed]); + const toggleBacklinks = () => { + setCollapsed(!collapsed); + }; + p2(() => { + window.addEventListener(eventTypes.toggleBacklinks, toggleBacklinks); + return () => { + window.removeEventListener(eventTypes.toggleBacklinks, toggleBacklinks); + }; + }, [collapsed]); + return backlinks.length > 0 && props2.file ? /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-component mk-note-footer" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" + }, /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => { + setCollapsed(!collapsed); + e4.stopPropagation(); + }, + className: "mk-file-context-title" + }, /* @__PURE__ */ Cn.createElement("div", { + className: `mk-icon-xsmall`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-backlink"] + } + }), i18n_default.labels.backlinks, /* @__PURE__ */ Cn.createElement("button", { + className: `mk-collapse mk-inline-button mk-icon-xsmall ${collapsed ? "mk-collapsed" : ""}`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse-sm"] + } + })), /* @__PURE__ */ Cn.createElement("div", null, !collapsed && backlinks.map((f4, i5) => { + var _a2; + return /* @__PURE__ */ Cn.createElement(BacklinkItem, { + path: f4, + key: i5, + plugin: props2.plugin, + source: (_a2 = props2.file) == null ? void 0 : _a2.path + }); + })))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null); +}; + +// src/components/FileContexts/NoteExplorer.tsx +var NoteExplorer = (props2) => { + const { file } = props2; + const folderNoteFile = F2(() => { + if (file instanceof import_obsidian62.TFolder) { + const afile2 = getAbstractFileAtPath(app, file.path + ".md"); + return afile2; + } + return file; + }, [file]); + return /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement(InlineFileContextView, { + plugin: props2.plugin, + file: props2.file, + showHeader: true, + showBanner: false, + editable: true, + hiddenFields: FMMetadataKeys(props2.plugin), + cacheType: "file" + }), /* @__PURE__ */ Cn.createElement(Backlinks, { + plugin: props2.plugin, + file: folderNoteFile + })); +}; // src/components/ui/modals/saveTableModal.ts var import_obsidian63 = require("obsidian"); +var SaveTableModal = class extends import_obsidian63.Modal { + constructor(schema, saveSchema, action) { + super(app); + this.schema = schema; + this.saveSchema = saveSchema; + this.action = action; + } + onOpen() { + const { contentEl } = this; + let headerText; + if (this.action == "new table") + headerText = i18n_default.labels.saveTable; + if (this.action == "rename table") + headerText = i18n_default.labels.renameTable; + const headerEl = contentEl.createEl("div", { text: headerText }); + headerEl.addClass("modal-title"); + const inputEl = contentEl.createEl("input"); + inputEl.style.cssText = "width: 100%; height: 2.5em; margin-bottom: 15px;"; + inputEl.focus(); + let changeButtonText; + if (this.action == "new table") + changeButtonText = i18n_default.buttons.saveTable; + changeButtonText = i18n_default.buttons.renameView; + if (this.action == "rename table") + changeButtonText = i18n_default.buttons.renameTable; + const changeButton = contentEl.createEl("button", { + text: changeButtonText + }); + const cancelButton = contentEl.createEl("button", { + text: i18n_default.buttons.cancel + }); + cancelButton.style.cssText = "float: right;"; + cancelButton.addEventListener("click", () => { + this.close(); + }); + const onClickAction = async () => { + const newName = inputEl.value; + if (this.action == "new table") { + this.saveSchema({ ...this.schema, id: newName.replace(/\//g, "+"), name: newName }); + } else { + this.saveSchema({ ...this.schema, name: newName }); + } + this.close(); + }; + changeButton.addEventListener("click", onClickAction); + inputEl.addEventListener("keydown", (e4) => { + if (e4.key === "Enter") { + e4.preventDefault(); + onClickAction(); + } + }); + } + onClose() { + const { contentEl } = this; + contentEl.empty(); + } +}; // src/components/Space/Contexts/FilterBar/TableSelector.tsx var import_obsidian65 = require("obsidian"); @@ -73794,6 +79198,16 @@ init_compat_module(); var import_obsidian64 = require("obsidian"); init_compat_module(); var MDB_FILE_VIEWER_TYPE = "make-mdb-viewer"; +var openContextEditor = async (file, schema) => { + const leaf = app.workspace.getLeaf(false); + const viewType = MDB_FILE_VIEWER_TYPE; + app.workspace.setActiveLeaf(leaf, { focus: true }); + await leaf.setViewState({ + type: viewType, + state: { file, schema } + }); + await app.workspace.requestSaveLayout(); +}; var MDBFileViewer = class extends import_obsidian64.FileView { constructor(leaf, plugin) { super(leaf); @@ -73837,14 +79251,14 @@ var MDBFileViewer = class extends import_obsidian64.FileView { return state; } constructInlineContext(path, schema) { - const space = spaceInfoByPath(this.plugin, getParentPathFromString(path)); + const space2 = spaceInfoByPath(this.plugin, getParentPathFromString(path)); this.destroy(); this.root = createRoot(this.contentEl); - if (space) + if (space2) this.root.render( /* @__PURE__ */ Cn.createElement(SpaceContextProvider, { plugin: this.plugin, - space + space: space2 }, /* @__PURE__ */ Cn.createElement(ContextMDBProvider, { plugin: this.plugin, schema @@ -73859,23 +79273,402 @@ var MDBFileViewer = class extends import_obsidian64.FileView { } }; +// src/components/Space/Contexts/FilterBar/TableSelector.tsx +var TableSelector = (props2) => { + const { spaceInfo } = q2(SpaceContext); + const { + dbSchemas: schemas, + setDBSchema, + deleteSchema, + saveSchema, + saveDB: saveDB2, + dbSchema + } = q2(ContextMDBContext); + const saveNewSchemas = (_schema) => { + const newSchema = { + ..._schema, + id: uniqueNameFromString( + sanitizeTableName(_schema.id), + schemas.map((f4) => f4.id) + ) + }; + saveSchema(newSchema).then( + (f4) => saveDB2({ + schema: newSchema, + cols: defaultTableFields.map((f5) => ({ ...f5, schemaId: newSchema.id })), + rows: [] + }) + ); + }; + const newTable = (e4) => { + const vaultChangeModal = new SaveTableModal( + { + id: "", + name: "", + type: "db" + }, + saveNewSchemas, + "new table" + ); + vaultChangeModal.open(); + }; + const openView = (e4, _dbschema) => { + openContextEditor(spaceInfo.dbPath, _dbschema.id); + }; + const viewContextMenu = (e4, _schema) => { + const fileMenu = new import_obsidian65.Menu(); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Rename Table"); + menuItem.onClick(() => { + const vaultChangeModal = new SaveTableModal( + _schema, + (s6) => saveSchema(s6), + "rename table" + ); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Delete Table"); + menuItem.onClick(() => { + deleteSchema(_schema); + }); + }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }; + const [collapsed, setCollapsed] = h2(false); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-table-selector" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" + }, /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => { + setCollapsed(!collapsed); + e4.stopPropagation(); + }, + className: "mk-file-context-title" + }, /* @__PURE__ */ Cn.createElement("button", { + className: `mk-collapse mk-inline-button mk-icon-xsmall ${collapsed ? "mk-collapsed" : ""}`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse-sm"] + } + }), "Tables", /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => newTable(e4) + }, "+")), /* @__PURE__ */ Cn.createElement("div", null)), schemas.filter((f4) => f4.type == "db" && f4.primary != "true").map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-title", + key: i5 + }, /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => openView(e4, f4) + }, f4.name)))); +}; + // src/components/Space/Frames/FramesSelector.tsx var import_obsidian66 = require("obsidian"); init_compat_module(); +var FramesSelector = (props2) => { + const { spaceInfo } = q2(SpaceContext); + const { + frameSchemas: schemas, + frameSchema, + setFrameSchema, + deleteSchema, + saveFrame, + saveSchema + } = q2(FramesMDBContext); + const viewContextMenu = (e4, _schema) => { + const fileMenu = new import_obsidian66.Menu(); + fileMenu.addSeparator(); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Copy Embed Link"); + menuItem.onClick(() => { + navigator.clipboard.writeText( + frameEmbedStringFromContext(spaceInfo, _schema.id) + ); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Set Icon"); + menuItem.onClick(() => { + const vaultChangeModal = new stickerModal( + props2.plugin.app, + props2.plugin, + (emoji) => saveSchema({ + ..._schema, + def: { + icon: emoji + } + }) + ); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Move Frame"); + menuItem.onClick(() => { + const vaultChangeModal = new FolderSelectModal( + props2.plugin, + (folder) => moveFrameToNewSpace( + props2.plugin, + spaceInfo, + _schema.id, + spaceInfoByPath(props2.plugin, folder.path) + ) + ); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Rename Frame"); + menuItem.onClick(() => { + const vaultChangeModal = new SaveViewModal( + _schema, + saveSchema, + "rename view" + ); + vaultChangeModal.open(); + }); + }); + fileMenu.addItem((menuItem) => { + menuItem.setTitle("Delete Frame"); + menuItem.onClick(() => { + deleteSchema(_schema); + }); + }); + if (isMouseEvent(e4)) { + fileMenu.showAtPosition({ x: e4.pageX, y: e4.pageY }); + } else { + fileMenu.showAtPosition({ + x: e4.nativeEvent.locationX, + y: e4.nativeEvent.locationY + }); + } + }; + const saveNewFrame = (_schema) => { + const newSchema = { + ..._schema, + id: uniqueNameFromString( + sanitizeTableName(_schema.id), + schemas.map((f4) => f4.id) + ) + }; + saveSchema(mdbSchemaToFrameSchema(newSchema)).then( + (f4) => saveFrame({ + schema: newSchema, + cols: [], + rows: [] + }) + ); + }; + const newFrame = (e4) => { + const vaultChangeModal = new SaveViewModal( + { + id: "", + name: "", + type: "frame" + }, + (_schema) => saveNewFrame(frameSchemaToMDBSchema(_schema)), + "new view" + ); + vaultChangeModal.open(); + }; + const [collapsed, setCollapsed] = h2(false); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-table-selector" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-section" + }, /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => { + setCollapsed(!collapsed); + e4.stopPropagation(); + }, + className: "mk-file-context-title" + }, /* @__PURE__ */ Cn.createElement("div", { + className: `mk-icon-xsmall`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-backlink"] + } + }), "Frames", /* @__PURE__ */ Cn.createElement("button", { + className: `mk-collapse mk-inline-button mk-icon-xsmall ${collapsed ? "mk-collapsed" : ""}`, + dangerouslySetInnerHTML: { + __html: uiIconSet["mk-ui-collapse-sm"] + } + }), /* @__PURE__ */ Cn.createElement("span", null), /* @__PURE__ */ Cn.createElement("button", { + onClick: (e4) => newFrame(e4) + }, "+")), /* @__PURE__ */ Cn.createElement("div", null)), schemas.filter((f4) => f4.type == "frame").map((f4, i5) => { + var _a2; + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-title", + key: i5 + }, /* @__PURE__ */ Cn.createElement(Sticker, { + plugin: props2.plugin, + sticker: (_a2 = f4.def) == null ? void 0 : _a2.icon + }), /* @__PURE__ */ Cn.createElement("div", { + onClick: (e4) => openFrameEditor(props2.plugin, spaceInfo.path, f4.id), + onContextMenu: (e4) => viewContextMenu(e4, f4) + }, f4.name)); + })); +}; // src/components/FileContexts/SpaceExplorer.tsx init_compat_module(); +var SpaceExplorer = (props2) => { + const [selectedRow, setSelectedRow] = h2(null); + const space2 = F2(() => { + return props2.space.space; + }, [props2.space]); + return /* @__PURE__ */ Cn.createElement("div", null, selectedRow && /* @__PURE__ */ Cn.createElement(InlineFileContextView, { + plugin: props2.plugin, + file: selectedRow, + showHeader: true, + showBanner: false, + showFolder: props2.space.space.uri.type == "folder", + editable: true, + cacheType: "file" + }), space2 && /* @__PURE__ */ Cn.createElement(SpaceContextProvider, { + plugin: props2.plugin, + space: space2 + }, /* @__PURE__ */ Cn.createElement(ContextMDBProvider, { + plugin: props2.plugin + }, /* @__PURE__ */ Cn.createElement(TableSelector, { + plugin: props2.plugin + })), /* @__PURE__ */ Cn.createElement(FramesMDBProvider, { + plugin: props2.plugin + }, /* @__PURE__ */ Cn.createElement(FramesSelector, { + plugin: props2.plugin + })))); +}; // src/components/FileContexts/ContextExplorer.tsx var FILE_CONTEXT_VIEW_TYPE = "make-context-view"; +var ICON2 = "component"; +var VIEW_DISPLAY_TEXT2 = "Context Explorer"; +var ContextExplorerLeafView = class extends import_obsidian67.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.navigation = false; + this.plugin = plugin; + } + getViewType() { + return FILE_CONTEXT_VIEW_TYPE; + } + getDisplayText() { + return VIEW_DISPLAY_TEXT2; + } + getIcon() { + return ICON2; + } + async onClose() { + this.destroy(); + } + destroy() { + if (this.root) + this.root.unmount(); + } + async onOpen() { + this.destroy(); + this.constructFileContext(); + } + async setState(state, result) { + this.constructFileContext(); + await super.setState(state, result); + return; + } + getState() { + const state = super.getState(); + return state; + } + constructFileContext() { + this.destroy(); + this.root = createRoot(this.contentEl); + this.root.render(/* @__PURE__ */ Cn.createElement(FileContextView, { + plugin: this.plugin + })); + } +}; +var FileContextView = (props2) => { + const [selectedPath, setSelectedPath] = h2(null); + const [selectedFrame, setSelectedFrame] = h2(null); + const file = F2(() => { + const afile = getAbstractFileAtPath(app, selectedPath == null ? void 0 : selectedPath.path); + if (afile instanceof import_obsidian67.TFile) + return afile; + return null; + }, [selectedPath]); + const spaceCache = F2(() => { + return selectedPath ? props2.plugin.index.spacesIndex.get(selectedPath.fullPath) : null; + }, [selectedPath]); + const changeSelectedFrame = (evt) => { + const path = evt.detail.path; + if (evt.detail.path) { + setSelectedPath(evt.detail.path); + setSelectedFrame(spaceInfoByPath(props2.plugin, evt.detail.path.fullPath)); + } else { + setSelectedPath(path); + } + }; + const changeSelectedFile = (evt) => { + const path = evt.detail.path; + setSelectedFrame(null); + if (evt.detail.selection) { + setSelectedPath(uriByString(evt.detail.selection)); + } else { + setSelectedPath(path); + } + }; + p2(() => { + props2.plugin.activeFileChange(); + }, []); + p2(() => { + window.addEventListener(eventTypes.activePathChange, changeSelectedFile); + window.addEventListener(eventTypes.frameSelected, changeSelectedFrame); + return () => { + window.removeEventListener( + eventTypes.activePathChange, + changeSelectedFile + ); + window.removeEventListener(eventTypes.frameSelected, changeSelectedFile); + }; + }, [file]); + return /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context" + }, /* @__PURE__ */ Cn.createElement("div", { + className: "mk-file-context-header" + }, selectedPath == null ? void 0 : selectedPath.basePath), selectedFrame ? /* @__PURE__ */ Cn.createElement(SpaceContextProvider, { + plugin: props2.plugin, + space: selectedFrame + }, /* @__PURE__ */ Cn.createElement(FramesMDBProvider, { + plugin: props2.plugin, + schema: selectedPath.ref + }, /* @__PURE__ */ Cn.createElement(FramesEditorProvider, { + plugin: props2.plugin + }, /* @__PURE__ */ Cn.createElement(FrameLayerList, { + plugin: props2.plugin + }), /* @__PURE__ */ Cn.createElement(FrameInspector, { + plugin: props2.plugin + })))) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, file && /* @__PURE__ */ Cn.createElement(NoteExplorer, { + plugin: props2.plugin, + file + }), spaceCache && /* @__PURE__ */ Cn.createElement(SpaceExplorer, { + plugin: props2.plugin, + space: spaceCache + }))); +}; // src/dispatch/spaces.ts -var dispatchSpaceDatabaseFileChanged = (type, action, name, newName) => { +var dispatchSpaceDatabaseFileChanged = (type, action, name2, newName) => { let evt = new CustomEvent(eventTypes.spacesChange, { detail: { type, action, - name, + name: name2, newName } }); @@ -74063,8 +79856,8 @@ var isFolderNote = (settings, aFile) => { }; // src/utils/superstate/parser.ts -var parseFileCache = (cache) => { - return safelyParseJSON(cache); +var parseFileCache = (cache2) => { + return safelyParseJSON(cache2); }; // src/utils/superstate/serializer.ts @@ -74077,15 +79870,19 @@ var stringifyJob = (job) => `${job.type}:${job.path}`; var API = class { constructor(plugin) { this.buttonCommand = (action, actionValue) => { - if (action == "command") { + if (action == "$commands") { this.runObsidianCommand(actionValue); } - if (action == "open") { + if (action == "$links") { this.openLink(actionValue, false); } }; this.runObsidianCommand = (command) => { - this.plugin.app.commands.commands[command].callback(); + if (this.plugin.app.commands.commands[command].callback) { + this.plugin.app.commands.commands[command].callback(); + } else if (this.plugin.app.commands.commands[command].checkCallback) { + this.plugin.app.commands.commands[command].checkCallback(false); + } }; this.formatDate = (date, format2) => { return formatDate(this.plugin, date, format2); @@ -74106,9 +79903,9 @@ var API = class { return (_a2 = this.plugin.index.contextsIndex.get(path)) == null ? void 0 : _a2.tables[table]; } setContextValue(path, file, field, value) { - const space = this.plugin.index.spacesIndex.get(path); - if (space) - updateValueInContext(this.plugin, file, field, value, space.space); + const space2 = this.plugin.index.spacesIndex.get(path); + if (space2) + updateValueInContext(this.plugin, file, field, value, space2.space); } }; @@ -74178,15 +79975,15 @@ function inlineWorker(scriptText) { // src/superstate/workers/entry.worker.ts function Worker2() { - return inlineWorker('var Gd=Object.create;var nu=Object.defineProperty,qd=Object.defineProperties,$d=Object.getOwnPropertyDescriptor,Hd=Object.getOwnPropertyDescriptors,Kd=Object.getOwnPropertyNames,Bo=Object.getOwnPropertySymbols,kd=Object.getPrototypeOf,No=Object.prototype.hasOwnProperty,zd=Object.prototype.propertyIsEnumerable;var Uo=(i,l,x)=>l in i?nu(i,l,{enumerable:!0,configurable:!0,writable:!0,value:x}):i[l]=x,It=(i,l)=>{for(var x in l||(l={}))No.call(l,x)&&Uo(i,x,l[x]);if(Bo)for(var x of Bo(l))zd.call(l,x)&&Uo(i,x,l[x]);return i},Mt=(i,l)=>qd(i,Hd(l));var Yd=(i,l)=>()=>(l||i((l={exports:{}}).exports,l),l.exports);var Zd=(i,l,x,m)=>{if(l&&typeof l=="object"||typeof l=="function")for(let w of Kd(l))!No.call(i,w)&&w!==x&&nu(i,w,{get:()=>l[w],enumerable:!(m=$d(l,w))||m.enumerable});return i};var Jd=(i,l,x)=>(x=i!=null?Gd(kd(i)):{},Zd(l||!i||!i.__esModule?nu(x,"default",{value:i,enumerable:!0}):x,i));var Go=Yd((ie,Ie)=>{(function(){var i,l="4.17.21",x=200,m="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",w="Expected a function",N="Invalid `variable` option passed into `_.template`",z="__lodash_hash_undefined__",ln=500,G="__lodash_placeholder__",W=1,cn=2,Q=4,on=1,Cn=2,V=1,Z=2,tt=4,hn=8,$=16,j=32,rn=64,pn=128,Jn=256,Rt=512,et=30,Er="...",Le=800,_t=16,Xn=1,fe=2,be=3,Qn=1/0,Hn=9007199254740991,Ee=17976931348623157e292,Lt=0/0,In=4294967295,Oe=In-1,De=In>>>1,Pe=[["ary",pn],["bind",V],["bindKey",Z],["curry",hn],["curryRight",$],["flip",Rt],["partial",j],["partialRight",rn],["rearg",Jn]],rt="[object Arguments]",bt="[object Array]",We="[object AsyncFunction]",H="[object Boolean]",en="[object Date]",_n="[object DOMException]",gn="[object Error]",Et="[object Function]",oe="[object GeneratorFunction]",Mn="[object Map]",Ot="[object Number]",Ht="[object Null]",it="[object Object]",uu="[object Promise]",is="[object Proxy]",se="[object RegExp]",Kn="[object Set]",ae="[object String]",Be="[object Symbol]",us="[object Undefined]",le="[object WeakMap]",fs="[object WeakSet]",ce="[object ArrayBuffer]",Kt="[object DataView]",Or="[object Float32Array]",Dr="[object Float64Array]",Pr="[object Int8Array]",Wr="[object Int16Array]",Br="[object Int32Array]",Ur="[object Uint8Array]",Nr="[object Uint8ClampedArray]",Gr="[object Uint16Array]",qr="[object Uint32Array]",os=/\\b__p \\+= \'\';/g,ss=/\\b(__p \\+=) \'\' \\+/g,as=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n\'\';/g,fu=/&(?:amp|lt|gt|quot|#39);/g,ou=/[&<>"\']/g,ls=RegExp(fu.source),cs=RegExp(ou.source),hs=/<%-([\\s\\S]+?)%>/g,ps=/<%([\\s\\S]+?)%>/g,su=/<%=([\\s\\S]+?)%>/g,gs=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,ds=/^\\w*$/,_s=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,$r=/[\\\\^$.*+?()[\\]{}|]/g,vs=RegExp($r.source),Hr=/^\\s+/,ms=/\\s/,xs=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,ys=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,ws=/,? & /,As=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,Ss=/[()=,{}\\[\\]\\/\\s]/,Ts=/\\\\(\\\\)?/g,Fs=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,au=/\\w*$/,Cs=/^[-+]0x[0-9a-f]+$/i,Is=/^0b[01]+$/i,Ms=/^\\[object .+?Constructor\\]$/,Rs=/^0o[0-7]+$/i,Ls=/^(?:0|[1-9]\\d*)$/,bs=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,Ue=/($^)/,Es=/[\'\\n\\r\\u2028\\u2029\\\\]/g,Ne="\\\\ud800-\\\\udfff",Os="\\\\u0300-\\\\u036f",Ds="\\\\ufe20-\\\\ufe2f",Ps="\\\\u20d0-\\\\u20ff",lu=Os+Ds+Ps,cu="\\\\u2700-\\\\u27bf",hu="a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff",Ws="\\\\xac\\\\xb1\\\\xd7\\\\xf7",Bs="\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf",Us="\\\\u2000-\\\\u206f",Ns=" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000",pu="A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde",gu="\\\\ufe0e\\\\ufe0f",du=Ws+Bs+Us+Ns,Kr="[\'\\u2019]",Gs="["+Ne+"]",_u="["+du+"]",Ge="["+lu+"]",vu="\\\\d+",qs="["+cu+"]",mu="["+hu+"]",xu="[^"+Ne+du+vu+cu+hu+pu+"]",kr="\\\\ud83c[\\\\udffb-\\\\udfff]",$s="(?:"+Ge+"|"+kr+")",yu="[^"+Ne+"]",zr="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Yr="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",kt="["+pu+"]",wu="\\\\u200d",Au="(?:"+mu+"|"+xu+")",Hs="(?:"+kt+"|"+xu+")",Su="(?:"+Kr+"(?:d|ll|m|re|s|t|ve))?",Tu="(?:"+Kr+"(?:D|LL|M|RE|S|T|VE))?",Fu=$s+"?",Cu="["+gu+"]?",Ks="(?:"+wu+"(?:"+[yu,zr,Yr].join("|")+")"+Cu+Fu+")*",ks="\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])",zs="\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])",Iu=Cu+Fu+Ks,Ys="(?:"+[qs,zr,Yr].join("|")+")"+Iu,Zs="(?:"+[yu+Ge+"?",Ge,zr,Yr,Gs].join("|")+")",Js=RegExp(Kr,"g"),Xs=RegExp(Ge,"g"),Zr=RegExp(kr+"(?="+kr+")|"+Zs+Iu,"g"),Qs=RegExp([kt+"?"+mu+"+"+Su+"(?="+[_u,kt,"$"].join("|")+")",Hs+"+"+Tu+"(?="+[_u,kt+Au,"$"].join("|")+")",kt+"?"+Au+"+"+Su,kt+"+"+Tu,zs,ks,vu,Ys].join("|"),"g"),Vs=RegExp("["+wu+Ne+lu+gu+"]"),js=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,na=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ta=-1,k={};k[Or]=k[Dr]=k[Pr]=k[Wr]=k[Br]=k[Ur]=k[Nr]=k[Gr]=k[qr]=!0,k[rt]=k[bt]=k[ce]=k[H]=k[Kt]=k[en]=k[gn]=k[Et]=k[Mn]=k[Ot]=k[it]=k[se]=k[Kn]=k[ae]=k[le]=!1;var K={};K[rt]=K[bt]=K[ce]=K[Kt]=K[H]=K[en]=K[Or]=K[Dr]=K[Pr]=K[Wr]=K[Br]=K[Mn]=K[Ot]=K[it]=K[se]=K[Kn]=K[ae]=K[Be]=K[Ur]=K[Nr]=K[Gr]=K[qr]=!0,K[gn]=K[Et]=K[le]=!1;var ea={\\u00C0:"A",\\u00C1:"A",\\u00C2:"A",\\u00C3:"A",\\u00C4:"A",\\u00C5:"A",\\u00E0:"a",\\u00E1:"a",\\u00E2:"a",\\u00E3:"a",\\u00E4:"a",\\u00E5:"a",\\u00C7:"C",\\u00E7:"c",\\u00D0:"D",\\u00F0:"d",\\u00C8:"E",\\u00C9:"E",\\u00CA:"E",\\u00CB:"E",\\u00E8:"e",\\u00E9:"e",\\u00EA:"e",\\u00EB:"e",\\u00CC:"I",\\u00CD:"I",\\u00CE:"I",\\u00CF:"I",\\u00EC:"i",\\u00ED:"i",\\u00EE:"i",\\u00EF:"i",\\u00D1:"N",\\u00F1:"n",\\u00D2:"O",\\u00D3:"O",\\u00D4:"O",\\u00D5:"O",\\u00D6:"O",\\u00D8:"O",\\u00F2:"o",\\u00F3:"o",\\u00F4:"o",\\u00F5:"o",\\u00F6:"o",\\u00F8:"o",\\u00D9:"U",\\u00DA:"U",\\u00DB:"U",\\u00DC:"U",\\u00F9:"u",\\u00FA:"u",\\u00FB:"u",\\u00FC:"u",\\u00DD:"Y",\\u00FD:"y",\\u00FF:"y",\\u00C6:"Ae",\\u00E6:"ae",\\u00DE:"Th",\\u00FE:"th",\\u00DF:"ss",\\u0100:"A",\\u0102:"A",\\u0104:"A",\\u0101:"a",\\u0103:"a",\\u0105:"a",\\u0106:"C",\\u0108:"C",\\u010A:"C",\\u010C:"C",\\u0107:"c",\\u0109:"c",\\u010B:"c",\\u010D:"c",\\u010E:"D",\\u0110:"D",\\u010F:"d",\\u0111:"d",\\u0112:"E",\\u0114:"E",\\u0116:"E",\\u0118:"E",\\u011A:"E",\\u0113:"e",\\u0115:"e",\\u0117:"e",\\u0119:"e",\\u011B:"e",\\u011C:"G",\\u011E:"G",\\u0120:"G",\\u0122:"G",\\u011D:"g",\\u011F:"g",\\u0121:"g",\\u0123:"g",\\u0124:"H",\\u0126:"H",\\u0125:"h",\\u0127:"h",\\u0128:"I",\\u012A:"I",\\u012C:"I",\\u012E:"I",\\u0130:"I",\\u0129:"i",\\u012B:"i",\\u012D:"i",\\u012F:"i",\\u0131:"i",\\u0134:"J",\\u0135:"j",\\u0136:"K",\\u0137:"k",\\u0138:"k",\\u0139:"L",\\u013B:"L",\\u013D:"L",\\u013F:"L",\\u0141:"L",\\u013A:"l",\\u013C:"l",\\u013E:"l",\\u0140:"l",\\u0142:"l",\\u0143:"N",\\u0145:"N",\\u0147:"N",\\u014A:"N",\\u0144:"n",\\u0146:"n",\\u0148:"n",\\u014B:"n",\\u014C:"O",\\u014E:"O",\\u0150:"O",\\u014D:"o",\\u014F:"o",\\u0151:"o",\\u0154:"R",\\u0156:"R",\\u0158:"R",\\u0155:"r",\\u0157:"r",\\u0159:"r",\\u015A:"S",\\u015C:"S",\\u015E:"S",\\u0160:"S",\\u015B:"s",\\u015D:"s",\\u015F:"s",\\u0161:"s",\\u0162:"T",\\u0164:"T",\\u0166:"T",\\u0163:"t",\\u0165:"t",\\u0167:"t",\\u0168:"U",\\u016A:"U",\\u016C:"U",\\u016E:"U",\\u0170:"U",\\u0172:"U",\\u0169:"u",\\u016B:"u",\\u016D:"u",\\u016F:"u",\\u0171:"u",\\u0173:"u",\\u0174:"W",\\u0175:"w",\\u0176:"Y",\\u0177:"y",\\u0178:"Y",\\u0179:"Z",\\u017B:"Z",\\u017D:"Z",\\u017A:"z",\\u017C:"z",\\u017E:"z",\\u0132:"IJ",\\u0133:"ij",\\u0152:"Oe",\\u0153:"oe",\\u0149:"\'n",\\u017F:"s"},ra={"&":"&","<":"<",">":">",\'"\':""","\'":"'"},ia={"&":"&","<":"<",">":">",""":\'"\',"'":"\'"},ua={"\\\\":"\\\\","\'":"\'","\\n":"n","\\r":"r","\\u2028":"u2028","\\u2029":"u2029"},fa=parseFloat,oa=parseInt,Mu=typeof global=="object"&&global&&global.Object===Object&&global,sa=typeof self=="object"&&self&&self.Object===Object&&self,sn=Mu||sa||Function("return this")(),Jr=typeof ie=="object"&&ie&&!ie.nodeType&&ie,Dt=Jr&&typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,Ru=Dt&&Dt.exports===Jr,Xr=Ru&&Mu.process,Pn=function(){try{var c=Dt&&Dt.require&&Dt.require("util").types;return c||Xr&&Xr.binding&&Xr.binding("util")}catch(g){}}(),Lu=Pn&&Pn.isArrayBuffer,bu=Pn&&Pn.isDate,Eu=Pn&&Pn.isMap,Ou=Pn&&Pn.isRegExp,Du=Pn&&Pn.isSet,Pu=Pn&&Pn.isTypedArray;function Rn(c,g,p){switch(p.length){case 0:return c.call(g);case 1:return c.call(g,p[0]);case 2:return c.call(g,p[0],p[1]);case 3:return c.call(g,p[0],p[1],p[2])}return c.apply(g,p)}function aa(c,g,p,A){for(var I=-1,P=c==null?0:c.length;++I-1}function Qr(c,g,p){for(var A=-1,I=c==null?0:c.length;++A-1;);return p}function Hu(c,g){for(var p=c.length;p--&&zt(g,c[p],0)>-1;);return p}function ma(c,g){for(var p=c.length,A=0;p--;)c[p]===g&&++A;return A}var xa=ti(ea),ya=ti(ra);function wa(c){return"\\\\"+ua[c]}function Aa(c,g){return c==null?i:c[g]}function Yt(c){return Vs.test(c)}function Sa(c){return js.test(c)}function Ta(c){for(var g,p=[];!(g=c.next()).done;)p.push(g.value);return p}function ui(c){var g=-1,p=Array(c.size);return c.forEach(function(A,I){p[++g]=[I,A]}),p}function Ku(c,g){return function(p){return c(g(p))}}function xt(c,g){for(var p=-1,A=c.length,I=0,P=[];++p-1}function cl(n,t){var e=this.__data__,r=ir(e,n);return r<0?(++this.size,e.push([n,t])):e[r][1]=t,this}ut.prototype.clear=ol,ut.prototype.delete=sl,ut.prototype.get=al,ut.prototype.has=ll,ut.prototype.set=cl;function ft(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t=t?n:t)),n}function Nn(n,t,e,r,u,o){var s,a=t&W,h=t&cn,d=t&Q;if(e&&(s=u?e(n,r,u,o):e(n)),s!==i)return s;if(!J(n))return n;var _=M(n);if(_){if(s=dc(n),!a)return An(n,s)}else{var v=mn(n),y=v==Et||v==oe;if(Ct(n))return If(n,a);if(v==it||v==rt||y&&!u){if(s=h||y?{}:zf(n),!a)return h?ic(n,Il(s,n)):rc(n,ef(s,n))}else{if(!K[v])return u?n:{};s=_c(n,v,a)}}o||(o=new zn);var S=o.get(n);if(S)return S;o.set(n,s),Ao(n)?n.forEach(function(C){s.add(Nn(C,t,e,C,n,o))}):yo(n)&&n.forEach(function(C,E){s.set(E,Nn(C,t,e,E,n,o))});var F=d?h?bi:Li:h?Tn:an,L=_?i:F(n);return Wn(L||n,function(C,E){L&&(E=C,C=n[E]),me(s,E,Nn(C,t,e,E,n,o))}),s}function Ml(n){var t=an(n);return function(e){return rf(e,n,t)}}function rf(n,t,e){var r=e.length;if(n==null)return!r;for(n=q(n);r--;){var u=e[r],o=t[u],s=n[u];if(s===i&&!(u in n)||!o(s))return!1}return!0}function uf(n,t,e){if(typeof n!="function")throw new Bn(w);return Fe(function(){n.apply(i,e)},t)}function xe(n,t,e,r){var u=-1,o=qe,s=!0,a=n.length,h=[],d=t.length;if(!a)return h;e&&(t=Y(t,Ln(e))),r?(o=Qr,s=!1):t.length>=x&&(o=he,s=!1,t=new Bt(t));n:for(;++uu?0:u+e),r=r===i||r>u?u:R(r),r<0&&(r+=u),r=e>r?0:To(r);e0&&e(a)?t>1?dn(a,t-1,e,r,u):mt(u,a):r||(u[u.length]=a)}return u}var hi=Of(),sf=Of(!0);function Vn(n,t){return n&&hi(n,t,an)}function pi(n,t){return n&&sf(n,t,an)}function fr(n,t){return vt(t,function(e){return ct(n[e])})}function Nt(n,t){t=Tt(t,n);for(var e=0,r=t.length;n!=null&&et}function bl(n,t){return n!=null&&U.call(n,t)}function El(n,t){return n!=null&&t in q(n)}function Ol(n,t,e){return n>=vn(t,e)&&n=120&&_.length>=120)?new Bt(s&&_):i}_=n[0];var v=-1,y=a[0];n:for(;++v-1;)a!==n&&Qe.call(a,h,1),Qe.call(n,h,1);return n}function xf(n,t){for(var e=n?t.length:0,r=e-1;e--;){var u=t[e];if(e==r||u!==o){var o=u;lt(u)?Qe.call(n,u,1):Si(n,u)}}return n}function yi(n,t){return n+nr(Vu()*(t-n+1))}function zl(n,t,e,r){for(var u=-1,o=fn(je((t-n)/(e||1)),0),s=p(o);o--;)s[r?o:++u]=n,n+=e;return s}function wi(n,t){var e="";if(!n||t<1||t>Hn)return e;do t%2&&(e+=n),t=nr(t/2),t&&(n+=n);while(t);return e}function b(n,t){return Ui(Jf(n,t,Fn),n+"")}function Yl(n){return tf(re(n))}function Zl(n,t){var e=re(n);return vr(e,Ut(t,0,e.length))}function Ae(n,t,e,r){if(!J(n))return n;t=Tt(t,n);for(var u=-1,o=t.length,s=o-1,a=n;a!=null&&++uu?0:u+t),e=e>u?u:e,e<0&&(e+=u),u=t>e?0:e-t>>>0,t>>>=0;for(var o=p(u);++r>>1,s=n[o];s!==null&&!En(s)&&(e?s<=t:s=x){var d=t?null:sc(n);if(d)return He(d);s=!1,u=he,h=new Bt}else h=t?[]:a;n:for(;++r=r?n:Gn(n,t,e)}var Cf=Na||function(n){return sn.clearTimeout(n)};function If(n,t){if(t)return n.slice();var e=n.length,r=Yu?Yu(e):new n.constructor(e);return n.copy(r),r}function Ii(n){var t=new n.constructor(n.byteLength);return new Je(t).set(new Je(n)),t}function jl(n,t){var e=t?Ii(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}function nc(n){var t=new n.constructor(n.source,au.exec(n));return t.lastIndex=n.lastIndex,t}function tc(n){return ve?q(ve.call(n)):{}}function Mf(n,t){var e=t?Ii(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.length)}function Rf(n,t){if(n!==t){var e=n!==i,r=n===null,u=n===n,o=En(n),s=t!==i,a=t===null,h=t===t,d=En(t);if(!a&&!d&&!o&&n>t||o&&s&&h&&!a&&!d||r&&s&&h||!e&&h||!u)return 1;if(!r&&!o&&!d&&n=a)return h;var d=e[r];return h*(d=="desc"?-1:1)}}return n.index-t.index}function Lf(n,t,e,r){for(var u=-1,o=n.length,s=e.length,a=-1,h=t.length,d=fn(o-s,0),_=p(h+d),v=!r;++a1?e[u-1]:i,s=u>2?e[2]:i;for(o=n.length>3&&typeof o=="function"?(u--,o):i,s&&yn(e[0],e[1],s)&&(o=u<3?i:o,u=1),t=q(t);++r-1?u[o?t[s]:s]:i}}function Wf(n){return at(function(t){var e=t.length,r=e,u=Un.prototype.thru;for(n&&t.reverse();r--;){var o=t[r];if(typeof o!="function")throw new Bn(w);if(u&&!s&&dr(o)=="wrapper")var s=new Un([],!0)}for(r=s?r:e;++r1&&D.reverse(),_&&ha))return!1;var d=o.get(n),_=o.get(t);if(d&&_)return d==t&&_==n;var v=-1,y=!0,S=e&Cn?new Bt:i;for(o.set(n,t),o.set(t,n);++v1?"& ":"")+t[r],t=t.join(e>2?", ":" "),n.replace(xs,`{\n/* [wrapped with `+t+`] */\n`)}function mc(n){return M(n)||$t(n)||!!(Xu&&n&&n[Xu])}function lt(n,t){var e=typeof n;return t=t==null?Hn:t,!!t&&(e=="number"||e!="symbol"&&Ls.test(n))&&n>-1&&n%1==0&&n0){if(++t>=Le)return arguments[0]}else t=0;return n.apply(i,arguments)}}function vr(n,t){var e=-1,r=n.length,u=r-1;for(t=t===i?r:t;++e1?n[t-1]:i;return e=typeof e=="function"?(n.pop(),e):i,oo(n,e)});function so(n){var t=f(n);return t.__chain__=!0,t}function Rh(n,t){return t(n),n}function mr(n,t){return t(n)}var Lh=at(function(n){var t=n.length,e=t?n[0]:0,r=this.__wrapped__,u=function(o){return ci(o,n)};return t>1||this.__actions__.length||!(r instanceof O)||!lt(e)?this.thru(u):(r=r.slice(e,+e+(t?1:0)),r.__actions__.push({func:mr,args:[u],thisArg:i}),new Un(r,this.__chain__).thru(function(o){return t&&!o.length&&o.push(i),o}))});function bh(){return so(this)}function Eh(){return new Un(this.value(),this.__chain__)}function Oh(){this.__values__===i&&(this.__values__=So(this.value()));var n=this.__index__>=this.__values__.length,t=n?i:this.__values__[this.__index__++];return{done:n,value:t}}function Dh(){return this}function Ph(n){for(var t,e=this;e instanceof rr;){var r=to(e);r.__index__=0,r.__values__=i,t?u.__wrapped__=r:t=r;var u=r;e=e.__wrapped__}return u.__wrapped__=n,t}function Wh(){var n=this.__wrapped__;if(n instanceof O){var t=n;return this.__actions__.length&&(t=new O(this)),t=t.reverse(),t.__actions__.push({func:mr,args:[Ni],thisArg:i}),new Un(t,this.__chain__)}return this.thru(Ni)}function Bh(){return Tf(this.__wrapped__,this.__actions__)}var Uh=lr(function(n,t,e){U.call(n,e)?++n[e]:ot(n,e,1)});function Nh(n,t,e){var r=M(n)?Wu:Rl;return e&&yn(n,t,e)&&(t=i),r(n,T(t,3))}function Gh(n,t){var e=M(n)?vt:of;return e(n,T(t,3))}var qh=Pf(eo),$h=Pf(ro);function Hh(n,t){return dn(xr(n,t),1)}function Kh(n,t){return dn(xr(n,t),Qn)}function kh(n,t,e){return e=e===i?1:R(e),dn(xr(n,t),e)}function ao(n,t){var e=M(n)?Wn:At;return e(n,T(t,3))}function lo(n,t){var e=M(n)?la:ff;return e(n,T(t,3))}var zh=lr(function(n,t,e){U.call(n,e)?n[e].push(t):ot(n,e,[t])});function Yh(n,t,e,r){n=Sn(n)?n:re(n),e=e&&!r?R(e):0;var u=n.length;return e<0&&(e=fn(u+e,0)),Tr(n)?e<=u&&n.indexOf(t,e)>-1:!!u&&zt(n,t,e)>-1}var Zh=b(function(n,t,e){var r=-1,u=typeof t=="function",o=Sn(n)?p(n.length):[];return At(n,function(s){o[++r]=u?Rn(t,s,e):ye(s,t,e)}),o}),Jh=lr(function(n,t,e){ot(n,e,t)});function xr(n,t){var e=M(n)?Y:pf;return e(n,T(t,3))}function Xh(n,t,e,r){return n==null?[]:(M(t)||(t=t==null?[]:[t]),e=r?i:e,M(e)||(e=e==null?[]:[e]),vf(n,t,e))}var Qh=lr(function(n,t,e){n[e?0:1].push(t)},function(){return[[],[]]});function Vh(n,t,e){var r=M(n)?Vr:Gu,u=arguments.length<3;return r(n,T(t,4),e,u,At)}function jh(n,t,e){var r=M(n)?ca:Gu,u=arguments.length<3;return r(n,T(t,4),e,u,ff)}function np(n,t){var e=M(n)?vt:of;return e(n,Ar(T(t,3)))}function tp(n){var t=M(n)?tf:Yl;return t(n)}function ep(n,t,e){(e?yn(n,t,e):t===i)?t=1:t=R(t);var r=M(n)?Tl:Zl;return r(n,t)}function rp(n){var t=M(n)?Fl:Xl;return t(n)}function ip(n){if(n==null)return 0;if(Sn(n))return Tr(n)?Zt(n):n.length;var t=mn(n);return t==Mn||t==Kn?n.size:vi(n).length}function up(n,t,e){var r=M(n)?jr:Ql;return e&&yn(n,t,e)&&(t=i),r(n,T(t,3))}var fp=b(function(n,t){if(n==null)return[];var e=t.length;return e>1&&yn(n,t[0],t[1])?t=[]:e>2&&yn(t[0],t[1],t[2])&&(t=[t[0]]),vf(n,dn(t,1),[])}),yr=Ga||function(){return sn.Date.now()};function op(n,t){if(typeof t!="function")throw new Bn(w);return n=R(n),function(){if(--n<1)return t.apply(this,arguments)}}function co(n,t,e){return t=e?i:t,t=n&&t==null?n.length:t,st(n,pn,i,i,i,i,t)}function ho(n,t){var e;if(typeof t!="function")throw new Bn(w);return n=R(n),function(){return--n>0&&(e=t.apply(this,arguments)),n<=1&&(t=i),e}}var qi=b(function(n,t,e){var r=V;if(e.length){var u=xt(e,te(qi));r|=j}return st(n,r,t,e,u)}),po=b(function(n,t,e){var r=V|Z;if(e.length){var u=xt(e,te(po));r|=j}return st(t,r,n,e,u)});function go(n,t,e){t=e?i:t;var r=st(n,hn,i,i,i,i,i,t);return r.placeholder=go.placeholder,r}function _o(n,t,e){t=e?i:t;var r=st(n,$,i,i,i,i,i,t);return r.placeholder=_o.placeholder,r}function vo(n,t,e){var r,u,o,s,a,h,d=0,_=!1,v=!1,y=!0;if(typeof n!="function")throw new Bn(w);t=$n(t)||0,J(e)&&(_=!!e.leading,v="maxWait"in e,o=v?fn($n(e.maxWait)||0,t):o,y="trailing"in e?!!e.trailing:y);function S(tn){var Zn=r,pt=u;return r=u=i,d=tn,s=n.apply(pt,Zn),s}function F(tn){return d=tn,a=Fe(E,t),_?S(tn):s}function L(tn){var Zn=tn-h,pt=tn-d,Wo=t-Zn;return v?vn(Wo,o-pt):Wo}function C(tn){var Zn=tn-h,pt=tn-d;return h===i||Zn>=t||Zn<0||v&&pt>=o}function E(){var tn=yr();if(C(tn))return D(tn);a=Fe(E,L(tn))}function D(tn){return a=i,y&&r?S(tn):(r=u=i,s)}function On(){a!==i&&Cf(a),d=0,r=h=u=a=i}function wn(){return a===i?s:D(yr())}function Dn(){var tn=yr(),Zn=C(tn);if(r=arguments,u=this,h=tn,Zn){if(a===i)return F(h);if(v)return Cf(a),a=Fe(E,t),S(h)}return a===i&&(a=Fe(E,t)),s}return Dn.cancel=On,Dn.flush=wn,Dn}var sp=b(function(n,t){return uf(n,1,t)}),ap=b(function(n,t,e){return uf(n,$n(t)||0,e)});function lp(n){return st(n,Rt)}function wr(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new Bn(w);var e=function(){var r=arguments,u=t?t.apply(this,r):r[0],o=e.cache;if(o.has(u))return o.get(u);var s=n.apply(this,r);return e.cache=o.set(u,s)||o,s};return e.cache=new(wr.Cache||ft),e}wr.Cache=ft;function Ar(n){if(typeof n!="function")throw new Bn(w);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function cp(n){return ho(2,n)}var hp=Vl(function(n,t){t=t.length==1&&M(t[0])?Y(t[0],Ln(T())):Y(dn(t,1),Ln(T()));var e=t.length;return b(function(r){for(var u=-1,o=vn(r.length,e);++u=t}),$t=lf(function(){return arguments}())?lf:function(n){return X(n)&&U.call(n,"callee")&&!Ju.call(n,"callee")},M=p.isArray,Ip=Lu?Ln(Lu):Pl;function Sn(n){return n!=null&&Sr(n.length)&&!ct(n)}function nn(n){return X(n)&&Sn(n)}function Mp(n){return n===!0||n===!1||X(n)&&xn(n)==H}var Ct=$a||ji,Rp=bu?Ln(bu):Wl;function Lp(n){return X(n)&&n.nodeType===1&&!Ce(n)}function bp(n){if(n==null)return!0;if(Sn(n)&&(M(n)||typeof n=="string"||typeof n.splice=="function"||Ct(n)||ee(n)||$t(n)))return!n.length;var t=mn(n);if(t==Mn||t==Kn)return!n.size;if(Te(n))return!vi(n).length;for(var e in n)if(U.call(n,e))return!1;return!0}function Ep(n,t){return we(n,t)}function Op(n,t,e){e=typeof e=="function"?e:i;var r=e?e(n,t):i;return r===i?we(n,t,i,e):!!r}function Hi(n){if(!X(n))return!1;var t=xn(n);return t==gn||t==_n||typeof n.message=="string"&&typeof n.name=="string"&&!Ce(n)}function Dp(n){return typeof n=="number"&&Qu(n)}function ct(n){if(!J(n))return!1;var t=xn(n);return t==Et||t==oe||t==We||t==is}function xo(n){return typeof n=="number"&&n==R(n)}function Sr(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=Hn}function J(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}function X(n){return n!=null&&typeof n=="object"}var yo=Eu?Ln(Eu):Ul;function Pp(n,t){return n===t||_i(n,t,Oi(t))}function Wp(n,t,e){return e=typeof e=="function"?e:i,_i(n,t,Oi(t),e)}function Bp(n){return wo(n)&&n!=+n}function Up(n){if(wc(n))throw new I(m);return cf(n)}function Np(n){return n===null}function Gp(n){return n==null}function wo(n){return typeof n=="number"||X(n)&&xn(n)==Ot}function Ce(n){if(!X(n)||xn(n)!=it)return!1;var t=Xe(n);if(t===null)return!0;var e=U.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&ze.call(e)==Wa}var Ki=Ou?Ln(Ou):Nl;function qp(n){return xo(n)&&n>=-Hn&&n<=Hn}var Ao=Du?Ln(Du):Gl;function Tr(n){return typeof n=="string"||!M(n)&&X(n)&&xn(n)==ae}function En(n){return typeof n=="symbol"||X(n)&&xn(n)==Be}var ee=Pu?Ln(Pu):ql;function $p(n){return n===i}function Hp(n){return X(n)&&mn(n)==le}function Kp(n){return X(n)&&xn(n)==fs}var kp=gr(mi),zp=gr(function(n,t){return n<=t});function So(n){if(!n)return[];if(Sn(n))return Tr(n)?kn(n):An(n);if(pe&&n[pe])return Ta(n[pe]());var t=mn(n),e=t==Mn?ui:t==Kn?He:re;return e(n)}function ht(n){if(!n)return n===0?n:0;if(n=$n(n),n===Qn||n===-Qn){var t=n<0?-1:1;return t*Ee}return n===n?n:0}function R(n){var t=ht(n),e=t%1;return t===t?e?t-e:t:0}function To(n){return n?Ut(R(n),0,In):0}function $n(n){if(typeof n=="number")return n;if(En(n))return Lt;if(J(n)){var t=typeof n.valueOf=="function"?n.valueOf():n;n=J(t)?t+"":t}if(typeof n!="string")return n===0?n:+n;n=qu(n);var e=Is.test(n);return e||Rs.test(n)?oa(n.slice(2),e?2:8):Cs.test(n)?Lt:+n}function Fo(n){return jn(n,Tn(n))}function Yp(n){return n?Ut(R(n),-Hn,Hn):n===0?n:0}function B(n){return n==null?"":bn(n)}var Zp=jt(function(n,t){if(Te(t)||Sn(t)){jn(t,an(t),n);return}for(var e in t)U.call(t,e)&&me(n,e,t[e])}),Co=jt(function(n,t){jn(t,Tn(t),n)}),Fr=jt(function(n,t,e,r){jn(t,Tn(t),n,r)}),Jp=jt(function(n,t,e,r){jn(t,an(t),n,r)}),Xp=at(ci);function Qp(n,t){var e=Vt(n);return t==null?e:ef(e,t)}var Vp=b(function(n,t){n=q(n);var e=-1,r=t.length,u=r>2?t[2]:i;for(u&&yn(t[0],t[1],u)&&(r=1);++e1),o}),jn(n,bi(n),e),r&&(e=Nn(e,W|cn|Q,ac));for(var u=t.length;u--;)Si(e,t[u]);return e});function _g(n,t){return Mo(n,Ar(T(t)))}var vg=at(function(n,t){return n==null?{}:Kl(n,t)});function Mo(n,t){if(n==null)return{};var e=Y(bi(n),function(r){return[r]});return t=T(t),mf(n,e,function(r,u){return t(r,u[0])})}function mg(n,t,e){t=Tt(t,n);var r=-1,u=t.length;for(u||(u=1,n=i);++rt){var r=n;n=t,t=r}if(e||n%1||t%1){var u=Vu();return vn(n+u*(t-n+fa("1e-"+((u+"").length-1))),t)}return yi(n,t)}var Rg=ne(function(n,t,e){return t=t.toLowerCase(),n+(e?bo(t):t)});function bo(n){return Yi(B(n).toLowerCase())}function Eo(n){return n=B(n),n&&n.replace(bs,xa).replace(Xs,"")}function Lg(n,t,e){n=B(n),t=bn(t);var r=n.length;e=e===i?r:Ut(R(e),0,r);var u=e;return e-=t.length,e>=0&&n.slice(e,u)==t}function bg(n){return n=B(n),n&&cs.test(n)?n.replace(ou,ya):n}function Eg(n){return n=B(n),n&&vs.test(n)?n.replace($r,"\\\\$&"):n}var Og=ne(function(n,t,e){return n+(e?"-":"")+t.toLowerCase()}),Dg=ne(function(n,t,e){return n+(e?" ":"")+t.toLowerCase()}),Pg=Df("toLowerCase");function Wg(n,t,e){n=B(n),t=R(t);var r=t?Zt(n):0;if(!t||r>=t)return n;var u=(t-r)/2;return pr(nr(u),e)+n+pr(je(u),e)}function Bg(n,t,e){n=B(n),t=R(t);var r=t?Zt(n):0;return t&&r>>0,e?(n=B(n),n&&(typeof t=="string"||t!=null&&!Ki(t))&&(t=bn(t),!t&&Yt(n))?Ft(kn(n),0,e):n.split(t,e)):[]}var Kg=ne(function(n,t,e){return n+(e?" ":"")+Yi(t)});function kg(n,t,e){return n=B(n),e=e==null?0:Ut(R(e),0,n.length),t=bn(t),n.slice(e,e+t.length)==t}function zg(n,t,e){var r=f.templateSettings;e&&yn(n,t,e)&&(t=i),n=B(n),t=Fr({},t,r,qf);var u=Fr({},t.imports,r.imports,qf),o=an(u),s=ii(u,o),a,h,d=0,_=t.interpolate||Ue,v="__p += \'",y=fi((t.escape||Ue).source+"|"+_.source+"|"+(_===su?Fs:Ue).source+"|"+(t.evaluate||Ue).source+"|$","g"),S="//# sourceURL="+(U.call(t,"sourceURL")?(t.sourceURL+"").replace(/\\s/g," "):"lodash.templateSources["+ ++ta+"]")+`\n`;n.replace(y,function(C,E,D,On,wn,Dn){return D||(D=On),v+=n.slice(d,Dn).replace(Es,wa),E&&(a=!0,v+=`\' +\n__e(`+E+`) +\n\'`),wn&&(h=!0,v+=`\';\n`+wn+`;\n__p += \'`),D&&(v+=`\' +\n((__t = (`+D+`)) == null ? \'\' : __t) +\n\'`),d=Dn+C.length,C}),v+=`\';\n`;var F=U.call(t,"variable")&&t.variable;if(!F)v=`with (obj) {\n`+v+`\n}\n`;else if(Ss.test(F))throw new I(N);v=(h?v.replace(os,""):v).replace(ss,"$1").replace(as,"$1;"),v="function("+(F||"obj")+`) {\n`+(F?"":`obj || (obj = {});\n`)+"var __t, __p = \'\'"+(a?", __e = _.escape":"")+(h?`, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, \'\') }\n`:`;\n`)+v+`return __p\n}`;var L=Do(function(){return P(o,S+"return "+v).apply(i,s)});if(L.source=v,Hi(L))throw L;return L}function Yg(n){return B(n).toLowerCase()}function Zg(n){return B(n).toUpperCase()}function Jg(n,t,e){if(n=B(n),n&&(e||t===i))return qu(n);if(!n||!(t=bn(t)))return n;var r=kn(n),u=kn(t),o=$u(r,u),s=Hu(r,u)+1;return Ft(r,o,s).join("")}function Xg(n,t,e){if(n=B(n),n&&(e||t===i))return n.slice(0,ku(n)+1);if(!n||!(t=bn(t)))return n;var r=kn(n),u=Hu(r,kn(t))+1;return Ft(r,0,u).join("")}function Qg(n,t,e){if(n=B(n),n&&(e||t===i))return n.replace(Hr,"");if(!n||!(t=bn(t)))return n;var r=kn(n),u=$u(r,kn(t));return Ft(r,u).join("")}function Vg(n,t){var e=et,r=Er;if(J(t)){var u="separator"in t?t.separator:u;e="length"in t?R(t.length):e,r="omission"in t?bn(t.omission):r}n=B(n);var o=n.length;if(Yt(n)){var s=kn(n);o=s.length}if(e>=o)return n;var a=e-Zt(r);if(a<1)return r;var h=s?Ft(s,0,a).join(""):n.slice(0,a);if(u===i)return h+r;if(s&&(a+=h.length-a),Ki(u)){if(n.slice(a).search(u)){var d,_=h;for(u.global||(u=fi(u.source,B(au.exec(u))+"g")),u.lastIndex=0;d=u.exec(_);)var v=d.index;h=h.slice(0,v===i?a:v)}}else if(n.indexOf(bn(u),a)!=a){var y=h.lastIndexOf(u);y>-1&&(h=h.slice(0,y))}return h+r}function jg(n){return n=B(n),n&&ls.test(n)?n.replace(fu,Ma):n}var nd=ne(function(n,t,e){return n+(e?" ":"")+t.toUpperCase()}),Yi=Df("toUpperCase");function Oo(n,t,e){return n=B(n),t=e?i:t,t===i?Sa(n)?ba(n):ga(n):n.match(t)||[]}var Do=b(function(n,t){try{return Rn(n,i,t)}catch(e){return Hi(e)?e:new I(e)}}),td=at(function(n,t){return Wn(t,function(e){e=nt(e),ot(n,e,qi(n[e],n))}),n});function ed(n){var t=n==null?0:n.length,e=T();return n=t?Y(n,function(r){if(typeof r[1]!="function")throw new Bn(w);return[e(r[0]),r[1]]}):[],b(function(r){for(var u=-1;++uHn)return[];var e=In,r=vn(n,In);t=T(t),n-=In;for(var u=ri(r,t);++e0||t<0)?new O(e):(n<0?e=e.takeRight(-n):n&&(e=e.drop(n)),t!==i&&(t=R(t),e=t<0?e.dropRight(-t):e.take(t-n)),e)},O.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},O.prototype.toArray=function(){return this.take(In)},Vn(O.prototype,function(n,t){var e=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),u=f[r?"take"+(t=="last"?"Right":""):t],o=r||/^find/.test(t);!u||(f.prototype[t]=function(){var s=this.__wrapped__,a=r?[1]:arguments,h=s instanceof O,d=a[0],_=h||M(s),v=function(E){var D=u.apply(f,mt([E],a));return r&&y?D[0]:D};_&&e&&typeof d=="function"&&d.length!=1&&(h=_=!1);var y=this.__chain__,S=!!this.__actions__.length,F=o&&!y,L=h&&!S;if(!o&&_){s=L?s:new O(this);var C=n.apply(s,a);return C.__actions__.push({func:mr,args:[v],thisArg:i}),new Un(C,y)}return F&&L?n.apply(this,a):(C=this.thru(v),F?r?C.value()[0]:C.value():C)})}),Wn(["pop","push","shift","sort","splice","unshift"],function(n){var t=Ke[n],e=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",r=/^(?:pop|shift)$/.test(n);f.prototype[n]=function(){var u=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(M(o)?o:[],u)}return this[e](function(s){return t.apply(M(s)?s:[],u)})}}),Vn(O.prototype,function(n,t){var e=f[t];if(e){var r=e.name+"";U.call(Qt,r)||(Qt[r]=[]),Qt[r].push({name:t,func:e})}}),Qt[cr(i,Z).name]=[{name:"wrapper",func:i}],O.prototype.clone=ja,O.prototype.reverse=nl,O.prototype.value=tl,f.prototype.at=Lh,f.prototype.chain=bh,f.prototype.commit=Eh,f.prototype.next=Oh,f.prototype.plant=Ph,f.prototype.reverse=Wh,f.prototype.toJSON=f.prototype.valueOf=f.prototype.value=Bh,f.prototype.first=f.prototype.head,pe&&(f.prototype[pe]=Dh),f},yt=Ea();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(sn._=yt,define(function(){return yt})):Dt?((Dt.exports=yt)._=yt,Jr._=yt):sn._=yt}).call(ie)});var br=Jd(Go());var gt=i=>[...new Set(i)],qo=i=>[...new Map(i.map(l=>[l.toLowerCase(),l])).values()];function $o(i){return Array.isArray(i)?i:[]}var Ho=(i,l)=>l.indexOf(i)>0?l.indexOf(i):l.length;var Cr=i=>"spaces://"+i;var dt=i=>{var l;return(l=i==null?void 0:i.match(/(\\\\.|[^,])+/g))!=null?l:[]},tu=i=>{if(!i)return"";let l=/\\[\\[(.*?)\\]\\]/g.exec(i),x=(l==null?void 0:l.length)>1?l[1].substring(0,Ho("|",l[1])):i;return x||i};var Me=(i,l)=>{if(typeof i=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(i)||i.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(i))return"date";if(l=="tag"||l=="tags")return"tag";if(/\\[\\[.*?\\]\\]/.test(i))return"link"}else{if(typeof i=="number")return"number";if(typeof i=="boolean")return"boolean";if(i)if(Array.isArray(i)||typeof i=="string"&&i.indexOf(",")>-1){let x=Array.isArray(i)?i:[];if(typeof i=="string"&&i.indexOf(",")>-1&&(x=dt(i)),l=="tag"||l=="tags")return"tag-multi";if(x.length==1&&Array.isArray(x[0])&&x[0].length==1&&typeof x[0][0]=="string")return"link";let m=gt(x.map(w=>Me(w,l)));return m.length==1&&m[0]=="link"?"link-multi":"option-multi"}else{if(i.isLuxonDateTime)return"date";if(i.isLuxonDuration)return"duration";if(i.type=="file")return"link";if(typeof i=="object"&&!Array.isArray(i)&&i!==null)return"object"}else return"unknown"}return"text"};var Ko=i=>Object.keys(i!=null?i:{}).filter(l=>l!="position").filter(l=>l!="tag"&&l!="tags");var ue=i=>i.join(","),ko=i=>i.join(", ");var Ir=(i,l)=>{switch(Me(l,i)){case"object":return JSON.stringify(l);case"number":return l.toString();case"boolean":return l?"true":"false";case"date":return l;case"duration":return ko(Object.keys(l.values).reduce((m,w)=>[...m,...l.values[w]>0?[l.values[w]+" "+w]:[]],[]));case"option-multi":case"link-multi":return typeof l=="string"?l:ue(l.map(m=>m?typeof m=="string"?m:m.path?m.path:Array.isArray(l)&&m.length==1&&Array.isArray(m[0])&&m[0].length==1&&typeof m[0][0]=="string"?m[0][0]:JSON.stringify(m):""));case"link":return Array.isArray(l)&&l.length==1&&Array.isArray(l[0])&&l[0].length==1&&typeof l[0][0]=="string"?l[0][0]:typeof l=="string"?l:l.path;case"text":case"tag":case"image":return l}return""};var zo=i=>{switch(i){case"duration":return"text";case"unknown":return"text"}return i};var Mr=(i,l)=>i==l,eu=(i,l)=>(i!=null?i:"").length==0,ru=(i,l)=>(i!=null?i:"").toLowerCase().includes((l!=null?l:"").toLowerCase()),Rr=(i,l)=>parseFloat(i)>parseFloat(l),Lr=(i,l)=>parseInt(i)>parseInt(l),iu=(i,l)=>{let x=i?dt(i):[];return(l?dt(l):[]).some(w=>x.some(N=>N==w))},Yo=i=>{let l=new Date(`${i}T00:00`),x=new Date;return l.getMonth()===x.getMonth()&&l.getDate()===x.getDate()};var Re={isNotEmpty:{type:["text","file","link","link-multi","fileprop","image"],fn:(i,l)=>!eu(i,""),valueType:"none"},isEmpty:{type:["text","file","link","link-multi","fileprop","image"],fn:(i,l)=>eu(i,""),valueType:"none"},include:{fn:(i,l)=>ru(i,l),type:["text","file","link","link-multi","fileprop","image"],valueType:"text"},notInclude:{type:["text","file","link","link-multi","fileprop","image"],fn:(i,l)=>!ru(i,l),valueType:"text"},is:{type:["text","file","link","context","fileprop"],fn:(i,l)=>Mr(i,l),valueType:"text"},isNot:{type:["text","file","link","context","fileprop"],fn:(i,l)=>!Mr(i,l),valueType:"text"},equal:{type:["number"],fn:(i,l)=>Mr(i,l),valueType:"number"},isGreatThan:{type:["number"],fn:(i,l)=>Rr(i,l),valueType:"number"},isLessThan:{type:["number"],fn:(i,l)=>Lr(i,l),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(i,l)=>!Rr(i,l),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(i,l)=>!Lr(i,l),valueType:"number"},dateBefore:{type:["date","fileprop"],fn:(i,l)=>Lr(i,l),valueType:"date"},dateAfter:{type:["date","fileprop"],fn:(i,l)=>Rr(i,l),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(i,l)=>Yo(i,l),valueType:"none"},isAnyInList:{type:["option","context","option-multi","context-multi","tags-multi","tags"],fn:(i,l)=>iu(i,l),valueType:"list"},isNoneInList:{type:["option","context","option-multi","context-multi","tags-multi","tags"],fn:(i,l)=>!iu(i,l),valueType:"list"},isTrue:{type:["boolean"],fn:(i,l)=>i=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(i,l)=>i!="true",valueType:"none"}};var Xd=(i,l)=>l.reduce((m,w)=>{let[N,z]=m,ln=w.type=="fileprop"?Xo(z,w):w.type=="filemeta"?Jo(z,w):w.type=="frontmatter"?Zo(z,w):[],G=z.filter(W=>!ln.includes(W));return[[...N,...ln],G]},[[],i])[0],Qd=(i,l)=>l.reduce((x,m)=>m.type=="fileprop"?Xo(x,m):m.type=="filemeta"?Jo(x,m):m.type=="frontmatter"?Zo(x,m):[],i),Zo=(i,l)=>i.filter(x=>{let m=x.frontmatter;if(!m||!m[l.field])return!1;let w=Re[l.fn],N=!0;return w&&(N=w.fn(Ir(l.field,m[l.field]),l.value)),N}),Jo=(i,l)=>i.filter(x=>{let m="";l.field=="outlinks"?m=ue(x.outlinks):l.field=="inlinks"?m=ue(x.inlinks):l.field=="tags"&&(m=ue(x.tags));let w=Re[l.fn],N=!0;return w&&(N=w.fn(m,l.value)),N}),Xo=(i,l)=>i.filter(x=>{if(["name","path","sticker","color","isFolder","extension","ctime","mtime","size","parent"].includes(l.field)){let w=Re[l.fn],N=!0;return w&&(N=w.fn(x[l.field],l.value)),N}return!0}),Qo=(i,l)=>i.reduce((m,w)=>!m||w.filters.length==0?m:w.type=="any"?Xd([l],w.filters).length>0:Qd([l],w.filters).length>0,!0);var Vo=(i,l,x)=>{if(!l)return{changed:!1,cache:{path:i.path,frames:{},schemas:[],listitems:{}}};let m=l.schemas,w=m.filter(G=>G.type=="frame").reduce((G,W)=>{var cn,Q;return Mt(It({},G),{[W.id]:{schema:W,cols:l.fields.filter(on=>on.schemaId==W.id),rows:(Q=(cn=l.tables[W.id])==null?void 0:cn.rows)!=null?Q:[]}})},{}),N=m.filter(G=>G.type=="listitem").reduce((G,W)=>{var cn,Q;return Mt(It({},G),{[W.id]:{schema:W,cols:l.fields.filter(on=>on.schemaId==W.id),rows:(Q=(cn=l.tables[W.id])==null?void 0:cn.rows)!=null?Q:[]}})},{}),z={path:i.path,frames:w,schemas:m,listitems:N},ln=!0;return x&&br.default.isEqual(z,x)&&(ln=!1),{changed:ln,cache:z}},jo=(i,l,x)=>{var on,Cn,V,Z,tt,hn;if(!l)return{changed:!1,cache:{path:i.path,schemas:[],outlinks:[],contexts:[],tables:{}}};let m=l.schemas.find($=>$.primary=="true"),w={schema:m,cols:l.fields.filter($=>$.schemaId==m.id),rows:(Cn=(on=l.tables[m.id])==null?void 0:on.rows)!=null?Cn:[]},N=l.schemas.filter($=>$.type=="db").reduce(($,j)=>{var rn,pn;return Mt(It({},$),{[j.id]:{schema:j,cols:l.fields.filter(Jn=>Jn.schemaId==j.id),rows:(pn=(rn=l.tables[j.id])==null?void 0:rn.rows)!=null?pn:[]}})},{}),z=(Z=(V=w.cols)==null?void 0:V.filter($=>$.type.startsWith("context")))!=null?Z:[],ln=(hn=(tt=w.cols)==null?void 0:tt.filter($=>$.type.startsWith("link")))!=null?hn:[],G=gt(z.map($=>$.value)),W=gt(w.rows.reduce(($,j)=>gt([...$,...[...z,...ln].flatMap(rn=>dt(j[rn.name]).map(pn=>tu(pn)))]),[])),cn={path:i.path,contexts:G,outlinks:W,tables:N,schemas:l.schemas},Q=!0;return x&&br.default.isEqual(cn,x)&&(Q=!0),{changed:Q,cache:cn}},Vd=i=>{var x,m,w,N,z,ln,G,W,cn,Q,on,Cn,V;let l=[];return i&&i.tags&&l.push(...(m=(x=i.tags)==null?void 0:x.map(Z=>Z.tag))!=null?m:[]),i&&((w=i.frontmatter)==null?void 0:w.tags)&&l.push(...(typeof((N=i.frontmatter)==null?void 0:N.tags)=="string"?dt(i.frontmatter.tags.replace(/ /g,"")):Array.isArray((z=i.frontmatter)==null?void 0:z.tags)?(G=(ln=i.frontmatter)==null?void 0:ln.tags)!=null?G:[]:[]).filter(Z=>typeof Z=="string").map(Z=>"#"+Z)),i&&((W=i.frontmatter)==null?void 0:W.tag)&&l.push(...(typeof((cn=i.frontmatter)==null?void 0:cn.tag)=="string"?dt(i.frontmatter.tag.replace(/ /g,"")):Array.isArray((Q=i.frontmatter)==null?void 0:Q.tag)?(Cn=(on=i.frontmatter)==null?void 0:on.tag)!=null?Cn:[]:[]).filter(Z=>typeof Z=="string").map(Z=>"#"+Z)),(V=gt(l))!=null?V:[]};var ns=(i,l,x,m,w,N,z,ln)=>{var Ee,Lt,In,Oe,De,Pe,rt,bt,We;let G={cacheType:"file",path:i.path,name:i.name,filename:i.filename};i.stat&&(G.ctime=i.stat.ctime,G.mtime=i.stat.mtime,G.size=i.stat.size,G.extension=i.extension);let W=[],cn=Vd(w),Q=(H,en,_n=new Set)=>{var Et,oe;let gn=[];for(let Mn of en){let Ot=(oe=(Et=H.get(Mn))==null?void 0:Et.contexts)!=null?oe:[];for(let Ht of Ot)_n.has(Ht)||(gn.push(Ht),_n.add(Ht),gn.push(...Q(H,[Cr(Ht)],_n)))}return gn};if(x.has(i.parent))for(let H of(Ee=x.get(i.parent).contexts)!=null?Ee:[])W.push(H);W.push(...cn);let on=i.name,Cn=i.name,V=(Lt=m==null?void 0:m.sticker)!=null?Lt:"",Z=(In=m==null?void 0:m.color)!=null?In:"",tt=(Oe=m==null?void 0:m.rank)!=null?Oe:"",hn=(De=m==null?void 0:m.folder)!=null?De:"";hn=="true"&&(hn="");let $=i.parent,j=i.isFolder,rn={},pn={},Jn=[],Rt=[],et=w==null?void 0:w.frontmatter;w!=null&&w.links&&Rt.push(...w.links.map(H=>H.link));let Er=z&&j?z.folderNotePath:i.path;for(let H of Object.keys(N))Er in N[H]&&Jn.push(H);let Le="";if(et){let en=qo(Ko(et)).reduce((_n,gn)=>Mt(It({},_n),{[gn]:{name:gn,type:zo(Me(et[gn],gn))}}),{});Object.keys(en).forEach(_n=>{rn[_n]=Ir(_n,et[_n]),pn[_n]=en[_n].type,en[_n].type.startsWith("link")&&Rt.push(tu(rn[_n]))}),Le=(Pe=rn[l.fmKeyBanner])!=null?Pe:"",rn[l.fmKeySticker]&&(V=et[l.fmKeySticker]),rn[l.fmKeyColor]&&(Z=et[l.fmKeyColor]),rn[l.fmKeyAlias]&&(Cn=(rt=$o(et[l.fmKeyAlias]))==null?void 0:rt[0])}let _t=Mt(It({},G),{name:on,tags:gt(W),alias:Cn,fileTags:cn,folderNote:z,sticker:V,color:Z,rank:tt,parent:$,banner:Le,isFolder:j,sortBy:hn,frontmatter:rn,frontmatterTypes:pn,inlinks:Jn,outlinks:Rt}),Xn=[],fe={[$]:tt};for(let H of W)Xn.push(Cr(H));for(let[H,en]of x)en.type=="smart"?Qo(en.metadata.def.filters,_t)&&Xn.push(H):en.type=="folder"||en.type=="vault"?en.space.folderPath==$&&en.space.defPath!=i.path&&(Xn.push(H),fe[H]=tt):((We=(bt=en.metadata)==null?void 0:bt.links)!=null?We:[]).find(gn=>gn==_t.path)&&(Xn.push(H),fe[H]=en.metadata.links.findIndex(gn=>gn==_t.path).toString());let be=Q(x,Xn);Xn.push(...be.map(H=>Cr(H))),_t.tags.push(...be);let Qn=z&&!j?Mt(It({},_t),{spaces:[],contexts:[]}):Mt(It({},_t),{spaces:gt(Xn),spaceRanks:fe}),Hn=!0;return ln&&br.default.isEqual(Qn,ln)&&(Hn=!1),{changed:Hn,cache:Qn}};function ts(i){let{file:l,settings:x,spacesCache:m,vaultItem:w,metadataCache:N,resolvedLinks:z,folderNote:ln,oldMetadata:G}=i;return ns(l,x,m,w,N,z,ln,G)}function es(i){let{space:l,mdb:x,oldCache:m}=i;return jo(l,x,m)}function rs(i){let{space:l,mdb:x,oldCache:m}=i;return Vo(l,x,m)}var jd=self;jd.onmessage=async i=>{let{payload:l,job:x}=i.data,m;x.type=="file"?m=ts(l):x.type=="context"?m=es(l):x.type=="frames"&&(m=rs(l));try{postMessage({job:x,result:m})}catch(w){console.log(w),postMessage({job:x,result:{$error:`Failed to index ${x.type} ${x.path}: ${w}`}})}};\n/**\n * @license\n * Lodash \n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n'); + return inlineWorker('var Gd=Object.create;var tu=Object.defineProperty,qd=Object.defineProperties,$d=Object.getOwnPropertyDescriptor,kd=Object.getOwnPropertyDescriptors,Hd=Object.getOwnPropertyNames,Bo=Object.getOwnPropertySymbols,Kd=Object.getPrototypeOf,No=Object.prototype.hasOwnProperty,zd=Object.prototype.propertyIsEnumerable;var Uo=(i,l,x)=>l in i?tu(i,l,{enumerable:!0,configurable:!0,writable:!0,value:x}):i[l]=x,It=(i,l)=>{for(var x in l||(l={}))No.call(l,x)&&Uo(i,x,l[x]);if(Bo)for(var x of Bo(l))zd.call(l,x)&&Uo(i,x,l[x]);return i},Rt=(i,l)=>qd(i,kd(l));var Yd=(i,l)=>()=>(l||i((l={exports:{}}).exports,l),l.exports);var Zd=(i,l,x,m)=>{if(l&&typeof l=="object"||typeof l=="function")for(let w of Hd(l))!No.call(i,w)&&w!==x&&tu(i,w,{get:()=>l[w],enumerable:!(m=$d(l,w))||m.enumerable});return i};var Jd=(i,l,x)=>(x=i!=null?Gd(Kd(i)):{},Zd(l||!i||!i.__esModule?tu(x,"default",{value:i,enumerable:!0}):x,i));var Go=Yd((ue,Ie)=>{(function(){var i,l="4.17.21",x=200,m="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",w="Expected a function",B="Invalid `variable` option passed into `_.template`",Z="__lodash_hash_undefined__",un=500,q="__lodash_placeholder__",U=1,gn=2,V=4,sn=1,Cn=2,j=1,J=2,et=4,cn=8,Mn=16,E=32,z=64,en=128,dn=256,rt=512,it=30,Or="...",be=800,vt=16,Xn=1,oe=2,Ee=3,Qn=1/0,Hn=9007199254740991,Oe=17976931348623157e292,Lt=0/0,In=4294967295,De=In-1,Pe=In>>>1,We=[["ary",en],["bind",j],["bindKey",J],["curry",cn],["curryRight",Mn],["flip",rt],["partial",E],["partialRight",z],["rearg",dn]],ut="[object Arguments]",bt="[object Array]",Be="[object AsyncFunction]",k="[object Boolean]",rn="[object Date]",_n="[object DOMException]",hn="[object Error]",Et="[object Function]",se="[object GeneratorFunction]",Rn="[object Map]",Ot="[object Number]",Ht="[object Null]",ft="[object Object]",uu="[object Promise]",is="[object Proxy]",ae="[object RegExp]",Kn="[object Set]",le="[object String]",Ue="[object Symbol]",us="[object Undefined]",ce="[object WeakMap]",fs="[object WeakSet]",he="[object ArrayBuffer]",Kt="[object DataView]",Dr="[object Float32Array]",Pr="[object Float64Array]",Wr="[object Int8Array]",Br="[object Int16Array]",Ur="[object Int32Array]",Nr="[object Uint8Array]",Gr="[object Uint8ClampedArray]",qr="[object Uint16Array]",$r="[object Uint32Array]",os=/\\b__p \\+= \'\';/g,ss=/\\b(__p \\+=) \'\' \\+/g,as=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n\'\';/g,fu=/&(?:amp|lt|gt|quot|#39);/g,ou=/[&<>"\']/g,ls=RegExp(fu.source),cs=RegExp(ou.source),hs=/<%-([\\s\\S]+?)%>/g,ps=/<%([\\s\\S]+?)%>/g,su=/<%=([\\s\\S]+?)%>/g,gs=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,ds=/^\\w*$/,_s=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,kr=/[\\\\^$.*+?()[\\]{}|]/g,vs=RegExp(kr.source),Hr=/^\\s+/,ms=/\\s/,xs=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,ys=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,ws=/,? & /,As=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,Ss=/[()=,{}\\[\\]\\/\\s]/,Ts=/\\\\(\\\\)?/g,Fs=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,au=/\\w*$/,Cs=/^[-+]0x[0-9a-f]+$/i,Ms=/^0b[01]+$/i,Is=/^\\[object .+?Constructor\\]$/,Rs=/^0o[0-7]+$/i,Ls=/^(?:0|[1-9]\\d*)$/,bs=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,Ne=/($^)/,Es=/[\'\\n\\r\\u2028\\u2029\\\\]/g,Ge="\\\\ud800-\\\\udfff",Os="\\\\u0300-\\\\u036f",Ds="\\\\ufe20-\\\\ufe2f",Ps="\\\\u20d0-\\\\u20ff",lu=Os+Ds+Ps,cu="\\\\u2700-\\\\u27bf",hu="a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff",Ws="\\\\xac\\\\xb1\\\\xd7\\\\xf7",Bs="\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf",Us="\\\\u2000-\\\\u206f",Ns=" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000",pu="A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde",gu="\\\\ufe0e\\\\ufe0f",du=Ws+Bs+Us+Ns,Kr="[\'\\u2019]",Gs="["+Ge+"]",_u="["+du+"]",qe="["+lu+"]",vu="\\\\d+",qs="["+cu+"]",mu="["+hu+"]",xu="[^"+Ge+du+vu+cu+hu+pu+"]",zr="\\\\ud83c[\\\\udffb-\\\\udfff]",$s="(?:"+qe+"|"+zr+")",yu="[^"+Ge+"]",Yr="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Zr="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",zt="["+pu+"]",wu="\\\\u200d",Au="(?:"+mu+"|"+xu+")",ks="(?:"+zt+"|"+xu+")",Su="(?:"+Kr+"(?:d|ll|m|re|s|t|ve))?",Tu="(?:"+Kr+"(?:D|LL|M|RE|S|T|VE))?",Fu=$s+"?",Cu="["+gu+"]?",Hs="(?:"+wu+"(?:"+[yu,Yr,Zr].join("|")+")"+Cu+Fu+")*",Ks="\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])",zs="\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])",Mu=Cu+Fu+Hs,Ys="(?:"+[qs,Yr,Zr].join("|")+")"+Mu,Zs="(?:"+[yu+qe+"?",qe,Yr,Zr,Gs].join("|")+")",Js=RegExp(Kr,"g"),Xs=RegExp(qe,"g"),Jr=RegExp(zr+"(?="+zr+")|"+Zs+Mu,"g"),Qs=RegExp([zt+"?"+mu+"+"+Su+"(?="+[_u,zt,"$"].join("|")+")",ks+"+"+Tu+"(?="+[_u,zt+Au,"$"].join("|")+")",zt+"?"+Au+"+"+Su,zt+"+"+Tu,zs,Ks,vu,Ys].join("|"),"g"),Vs=RegExp("["+wu+Ge+lu+gu+"]"),js=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,na=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ta=-1,K={};K[Dr]=K[Pr]=K[Wr]=K[Br]=K[Ur]=K[Nr]=K[Gr]=K[qr]=K[$r]=!0,K[ut]=K[bt]=K[he]=K[k]=K[Kt]=K[rn]=K[hn]=K[Et]=K[Rn]=K[Ot]=K[ft]=K[ae]=K[Kn]=K[le]=K[ce]=!1;var H={};H[ut]=H[bt]=H[he]=H[Kt]=H[k]=H[rn]=H[Dr]=H[Pr]=H[Wr]=H[Br]=H[Ur]=H[Rn]=H[Ot]=H[ft]=H[ae]=H[Kn]=H[le]=H[Ue]=H[Nr]=H[Gr]=H[qr]=H[$r]=!0,H[hn]=H[Et]=H[ce]=!1;var ea={\\u00C0:"A",\\u00C1:"A",\\u00C2:"A",\\u00C3:"A",\\u00C4:"A",\\u00C5:"A",\\u00E0:"a",\\u00E1:"a",\\u00E2:"a",\\u00E3:"a",\\u00E4:"a",\\u00E5:"a",\\u00C7:"C",\\u00E7:"c",\\u00D0:"D",\\u00F0:"d",\\u00C8:"E",\\u00C9:"E",\\u00CA:"E",\\u00CB:"E",\\u00E8:"e",\\u00E9:"e",\\u00EA:"e",\\u00EB:"e",\\u00CC:"I",\\u00CD:"I",\\u00CE:"I",\\u00CF:"I",\\u00EC:"i",\\u00ED:"i",\\u00EE:"i",\\u00EF:"i",\\u00D1:"N",\\u00F1:"n",\\u00D2:"O",\\u00D3:"O",\\u00D4:"O",\\u00D5:"O",\\u00D6:"O",\\u00D8:"O",\\u00F2:"o",\\u00F3:"o",\\u00F4:"o",\\u00F5:"o",\\u00F6:"o",\\u00F8:"o",\\u00D9:"U",\\u00DA:"U",\\u00DB:"U",\\u00DC:"U",\\u00F9:"u",\\u00FA:"u",\\u00FB:"u",\\u00FC:"u",\\u00DD:"Y",\\u00FD:"y",\\u00FF:"y",\\u00C6:"Ae",\\u00E6:"ae",\\u00DE:"Th",\\u00FE:"th",\\u00DF:"ss",\\u0100:"A",\\u0102:"A",\\u0104:"A",\\u0101:"a",\\u0103:"a",\\u0105:"a",\\u0106:"C",\\u0108:"C",\\u010A:"C",\\u010C:"C",\\u0107:"c",\\u0109:"c",\\u010B:"c",\\u010D:"c",\\u010E:"D",\\u0110:"D",\\u010F:"d",\\u0111:"d",\\u0112:"E",\\u0114:"E",\\u0116:"E",\\u0118:"E",\\u011A:"E",\\u0113:"e",\\u0115:"e",\\u0117:"e",\\u0119:"e",\\u011B:"e",\\u011C:"G",\\u011E:"G",\\u0120:"G",\\u0122:"G",\\u011D:"g",\\u011F:"g",\\u0121:"g",\\u0123:"g",\\u0124:"H",\\u0126:"H",\\u0125:"h",\\u0127:"h",\\u0128:"I",\\u012A:"I",\\u012C:"I",\\u012E:"I",\\u0130:"I",\\u0129:"i",\\u012B:"i",\\u012D:"i",\\u012F:"i",\\u0131:"i",\\u0134:"J",\\u0135:"j",\\u0136:"K",\\u0137:"k",\\u0138:"k",\\u0139:"L",\\u013B:"L",\\u013D:"L",\\u013F:"L",\\u0141:"L",\\u013A:"l",\\u013C:"l",\\u013E:"l",\\u0140:"l",\\u0142:"l",\\u0143:"N",\\u0145:"N",\\u0147:"N",\\u014A:"N",\\u0144:"n",\\u0146:"n",\\u0148:"n",\\u014B:"n",\\u014C:"O",\\u014E:"O",\\u0150:"O",\\u014D:"o",\\u014F:"o",\\u0151:"o",\\u0154:"R",\\u0156:"R",\\u0158:"R",\\u0155:"r",\\u0157:"r",\\u0159:"r",\\u015A:"S",\\u015C:"S",\\u015E:"S",\\u0160:"S",\\u015B:"s",\\u015D:"s",\\u015F:"s",\\u0161:"s",\\u0162:"T",\\u0164:"T",\\u0166:"T",\\u0163:"t",\\u0165:"t",\\u0167:"t",\\u0168:"U",\\u016A:"U",\\u016C:"U",\\u016E:"U",\\u0170:"U",\\u0172:"U",\\u0169:"u",\\u016B:"u",\\u016D:"u",\\u016F:"u",\\u0171:"u",\\u0173:"u",\\u0174:"W",\\u0175:"w",\\u0176:"Y",\\u0177:"y",\\u0178:"Y",\\u0179:"Z",\\u017B:"Z",\\u017D:"Z",\\u017A:"z",\\u017C:"z",\\u017E:"z",\\u0132:"IJ",\\u0133:"ij",\\u0152:"Oe",\\u0153:"oe",\\u0149:"\'n",\\u017F:"s"},ra={"&":"&","<":"<",">":">",\'"\':""","\'":"'"},ia={"&":"&","<":"<",">":">",""":\'"\',"'":"\'"},ua={"\\\\":"\\\\","\'":"\'","\\n":"n","\\r":"r","\\u2028":"u2028","\\u2029":"u2029"},fa=parseFloat,oa=parseInt,Iu=typeof global=="object"&&global&&global.Object===Object&&global,sa=typeof self=="object"&&self&&self.Object===Object&&self,an=Iu||sa||Function("return this")(),Xr=typeof ue=="object"&&ue&&!ue.nodeType&&ue,Dt=Xr&&typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,Ru=Dt&&Dt.exports===Xr,Qr=Ru&&Iu.process,Wn=function(){try{var c=Dt&&Dt.require&&Dt.require("util").types;return c||Qr&&Qr.binding&&Qr.binding("util")}catch(g){}}(),Lu=Wn&&Wn.isArrayBuffer,bu=Wn&&Wn.isDate,Eu=Wn&&Wn.isMap,Ou=Wn&&Wn.isRegExp,Du=Wn&&Wn.isSet,Pu=Wn&&Wn.isTypedArray;function Ln(c,g,p){switch(p.length){case 0:return c.call(g);case 1:return c.call(g,p[0]);case 2:return c.call(g,p[0],p[1]);case 3:return c.call(g,p[0],p[1],p[2])}return c.apply(g,p)}function aa(c,g,p,A){for(var M=-1,W=c==null?0:c.length;++M-1}function Vr(c,g,p){for(var A=-1,M=c==null?0:c.length;++A-1;);return p}function ku(c,g){for(var p=c.length;p--&&Yt(g,c[p],0)>-1;);return p}function ma(c,g){for(var p=c.length,A=0;p--;)c[p]===g&&++A;return A}var xa=ei(ea),ya=ei(ra);function wa(c){return"\\\\"+ua[c]}function Aa(c,g){return c==null?i:c[g]}function Zt(c){return Vs.test(c)}function Sa(c){return js.test(c)}function Ta(c){for(var g,p=[];!(g=c.next()).done;)p.push(g.value);return p}function fi(c){var g=-1,p=Array(c.size);return c.forEach(function(A,M){p[++g]=[M,A]}),p}function Hu(c,g){return function(p){return c(g(p))}}function yt(c,g){for(var p=-1,A=c.length,M=0,W=[];++p-1}function cl(n,t){var e=this.__data__,r=ur(e,n);return r<0?(++this.size,e.push([n,t])):e[r][1]=t,this}ot.prototype.clear=ol,ot.prototype.delete=sl,ot.prototype.get=al,ot.prototype.has=ll,ot.prototype.set=cl;function st(n){var t=-1,e=n==null?0:n.length;for(this.clear();++t=t?n:t)),n}function Gn(n,t,e,r,u,o){var s,a=t&U,h=t&gn,d=t&V;if(e&&(s=u?e(n,r,u,o):e(n)),s!==i)return s;if(!X(n))return n;var _=I(n);if(_){if(s=dc(n),!a)return An(n,s)}else{var v=mn(n),y=v==Et||v==se;if(Mt(n))return Mf(n,a);if(v==ft||v==ut||y&&!u){if(s=h||y?{}:zf(n),!a)return h?ic(n,Ml(s,n)):rc(n,ef(s,n))}else{if(!H[v])return u?n:{};s=_c(n,v,a)}}o||(o=new Yn);var S=o.get(n);if(S)return S;o.set(n,s),Ao(n)?n.forEach(function(C){s.add(Gn(C,t,e,C,n,o))}):yo(n)&&n.forEach(function(C,O){s.set(O,Gn(C,t,e,O,n,o))});var F=d?h?Ei:bi:h?Tn:ln,L=_?i:F(n);return Bn(L||n,function(C,O){L&&(O=C,C=n[O]),xe(s,O,Gn(C,t,e,O,n,o))}),s}function Il(n){var t=ln(n);return function(e){return rf(e,n,t)}}function rf(n,t,e){var r=e.length;if(n==null)return!r;for(n=$(n);r--;){var u=e[r],o=t[u],s=n[u];if(s===i&&!(u in n)||!o(s))return!1}return!0}function uf(n,t,e){if(typeof n!="function")throw new Un(w);return Ce(function(){n.apply(i,e)},t)}function ye(n,t,e,r){var u=-1,o=$e,s=!0,a=n.length,h=[],d=t.length;if(!a)return h;e&&(t=Y(t,bn(e))),r?(o=Vr,s=!1):t.length>=x&&(o=pe,s=!1,t=new Bt(t));n:for(;++uu?0:u+e),r=r===i||r>u?u:R(r),r<0&&(r+=u),r=e>r?0:To(r);e0&&e(a)?t>1?pn(a,t-1,e,r,u):xt(u,a):r||(u[u.length]=a)}return u}var pi=Of(),sf=Of(!0);function Vn(n,t){return n&&pi(n,t,ln)}function gi(n,t){return n&&sf(n,t,ln)}function or(n,t){return mt(t,function(e){return pt(n[e])})}function Nt(n,t){t=Ft(t,n);for(var e=0,r=t.length;n!=null&&et}function bl(n,t){return n!=null&&G.call(n,t)}function El(n,t){return n!=null&&t in $(n)}function Ol(n,t,e){return n>=vn(t,e)&&n=120&&_.length>=120)?new Bt(s&&_):i}_=n[0];var v=-1,y=a[0];n:for(;++v-1;)a!==n&&Ve.call(a,h,1),Ve.call(n,h,1);return n}function xf(n,t){for(var e=n?t.length:0,r=e-1;e--;){var u=t[e];if(e==r||u!==o){var o=u;ht(u)?Ve.call(n,u,1):Ti(n,u)}}return n}function wi(n,t){return n+tr(Vu()*(t-n+1))}function zl(n,t,e,r){for(var u=-1,o=on(nr((t-n)/(e||1)),0),s=p(o);o--;)s[r?o:++u]=n,n+=e;return s}function Ai(n,t){var e="";if(!n||t<1||t>Hn)return e;do t%2&&(e+=n),t=tr(t/2),t&&(n+=n);while(t);return e}function b(n,t){return Ni(Jf(n,t,Fn),n+"")}function Yl(n){return tf(ie(n))}function Zl(n,t){var e=ie(n);return mr(e,Ut(t,0,e.length))}function Se(n,t,e,r){if(!X(n))return n;t=Ft(t,n);for(var u=-1,o=t.length,s=o-1,a=n;a!=null&&++uu?0:u+t),e=e>u?u:e,e<0&&(e+=u),u=t>e?0:e-t>>>0,t>>>=0;for(var o=p(u);++r>>1,s=n[o];s!==null&&!On(s)&&(e?s<=t:s=x){var d=t?null:sc(n);if(d)return He(d);s=!1,u=pe,h=new Bt}else h=t?[]:a;n:for(;++r=r?n:qn(n,t,e)}var Cf=Na||function(n){return an.clearTimeout(n)};function Mf(n,t){if(t)return n.slice();var e=n.length,r=Yu?Yu(e):new n.constructor(e);return n.copy(r),r}function Ii(n){var t=new n.constructor(n.byteLength);return new Xe(t).set(new Xe(n)),t}function jl(n,t){var e=t?Ii(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}function nc(n){var t=new n.constructor(n.source,au.exec(n));return t.lastIndex=n.lastIndex,t}function tc(n){return me?$(me.call(n)):{}}function If(n,t){var e=t?Ii(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.length)}function Rf(n,t){if(n!==t){var e=n!==i,r=n===null,u=n===n,o=On(n),s=t!==i,a=t===null,h=t===t,d=On(t);if(!a&&!d&&!o&&n>t||o&&s&&h&&!a&&!d||r&&s&&h||!e&&h||!u)return 1;if(!r&&!o&&!d&&n=a)return h;var d=e[r];return h*(d=="desc"?-1:1)}}return n.index-t.index}function Lf(n,t,e,r){for(var u=-1,o=n.length,s=e.length,a=-1,h=t.length,d=on(o-s,0),_=p(h+d),v=!r;++a1?e[u-1]:i,s=u>2?e[2]:i;for(o=n.length>3&&typeof o=="function"?(u--,o):i,s&&yn(e[0],e[1],s)&&(o=u<3?i:o,u=1),t=$(t);++r-1?u[o?t[s]:s]:i}}function Wf(n){return ct(function(t){var e=t.length,r=e,u=Nn.prototype.thru;for(n&&t.reverse();r--;){var o=t[r];if(typeof o!="function")throw new Un(w);if(u&&!s&&_r(o)=="wrapper")var s=new Nn([],!0)}for(r=s?r:e;++r1&&P.reverse(),_&&ha))return!1;var d=o.get(n),_=o.get(t);if(d&&_)return d==t&&_==n;var v=-1,y=!0,S=e&Cn?new Bt:i;for(o.set(n,t),o.set(t,n);++v1?"& ":"")+t[r],t=t.join(e>2?", ":" "),n.replace(xs,`{\n/* [wrapped with `+t+`] */\n`)}function mc(n){return I(n)||$t(n)||!!(Xu&&n&&n[Xu])}function ht(n,t){var e=typeof n;return t=t==null?Hn:t,!!t&&(e=="number"||e!="symbol"&&Ls.test(n))&&n>-1&&n%1==0&&n0){if(++t>=be)return arguments[0]}else t=0;return n.apply(i,arguments)}}function mr(n,t){var e=-1,r=n.length,u=r-1;for(t=t===i?r:t;++e1?n[t-1]:i;return e=typeof e=="function"?(n.pop(),e):i,oo(n,e)});function so(n){var t=f(n);return t.__chain__=!0,t}function Rh(n,t){return t(n),n}function xr(n,t){return t(n)}var Lh=ct(function(n){var t=n.length,e=t?n[0]:0,r=this.__wrapped__,u=function(o){return hi(o,n)};return t>1||this.__actions__.length||!(r instanceof D)||!ht(e)?this.thru(u):(r=r.slice(e,+e+(t?1:0)),r.__actions__.push({func:xr,args:[u],thisArg:i}),new Nn(r,this.__chain__).thru(function(o){return t&&!o.length&&o.push(i),o}))});function bh(){return so(this)}function Eh(){return new Nn(this.value(),this.__chain__)}function Oh(){this.__values__===i&&(this.__values__=So(this.value()));var n=this.__index__>=this.__values__.length,t=n?i:this.__values__[this.__index__++];return{done:n,value:t}}function Dh(){return this}function Ph(n){for(var t,e=this;e instanceof ir;){var r=to(e);r.__index__=0,r.__values__=i,t?u.__wrapped__=r:t=r;var u=r;e=e.__wrapped__}return u.__wrapped__=n,t}function Wh(){var n=this.__wrapped__;if(n instanceof D){var t=n;return this.__actions__.length&&(t=new D(this)),t=t.reverse(),t.__actions__.push({func:xr,args:[Gi],thisArg:i}),new Nn(t,this.__chain__)}return this.thru(Gi)}function Bh(){return Tf(this.__wrapped__,this.__actions__)}var Uh=cr(function(n,t,e){G.call(n,e)?++n[e]:at(n,e,1)});function Nh(n,t,e){var r=I(n)?Wu:Rl;return e&&yn(n,t,e)&&(t=i),r(n,T(t,3))}function Gh(n,t){var e=I(n)?mt:of;return e(n,T(t,3))}var qh=Pf(eo),$h=Pf(ro);function kh(n,t){return pn(yr(n,t),1)}function Hh(n,t){return pn(yr(n,t),Qn)}function Kh(n,t,e){return e=e===i?1:R(e),pn(yr(n,t),e)}function ao(n,t){var e=I(n)?Bn:St;return e(n,T(t,3))}function lo(n,t){var e=I(n)?la:ff;return e(n,T(t,3))}var zh=cr(function(n,t,e){G.call(n,e)?n[e].push(t):at(n,e,[t])});function Yh(n,t,e,r){n=Sn(n)?n:ie(n),e=e&&!r?R(e):0;var u=n.length;return e<0&&(e=on(u+e,0)),Fr(n)?e<=u&&n.indexOf(t,e)>-1:!!u&&Yt(n,t,e)>-1}var Zh=b(function(n,t,e){var r=-1,u=typeof t=="function",o=Sn(n)?p(n.length):[];return St(n,function(s){o[++r]=u?Ln(t,s,e):we(s,t,e)}),o}),Jh=cr(function(n,t,e){at(n,e,t)});function yr(n,t){var e=I(n)?Y:pf;return e(n,T(t,3))}function Xh(n,t,e,r){return n==null?[]:(I(t)||(t=t==null?[]:[t]),e=r?i:e,I(e)||(e=e==null?[]:[e]),vf(n,t,e))}var Qh=cr(function(n,t,e){n[e?0:1].push(t)},function(){return[[],[]]});function Vh(n,t,e){var r=I(n)?jr:Gu,u=arguments.length<3;return r(n,T(t,4),e,u,St)}function jh(n,t,e){var r=I(n)?ca:Gu,u=arguments.length<3;return r(n,T(t,4),e,u,ff)}function np(n,t){var e=I(n)?mt:of;return e(n,Sr(T(t,3)))}function tp(n){var t=I(n)?tf:Yl;return t(n)}function ep(n,t,e){(e?yn(n,t,e):t===i)?t=1:t=R(t);var r=I(n)?Tl:Zl;return r(n,t)}function rp(n){var t=I(n)?Fl:Xl;return t(n)}function ip(n){if(n==null)return 0;if(Sn(n))return Fr(n)?Jt(n):n.length;var t=mn(n);return t==Rn||t==Kn?n.size:mi(n).length}function up(n,t,e){var r=I(n)?ni:Ql;return e&&yn(n,t,e)&&(t=i),r(n,T(t,3))}var fp=b(function(n,t){if(n==null)return[];var e=t.length;return e>1&&yn(n,t[0],t[1])?t=[]:e>2&&yn(t[0],t[1],t[2])&&(t=[t[0]]),vf(n,pn(t,1),[])}),wr=Ga||function(){return an.Date.now()};function op(n,t){if(typeof t!="function")throw new Un(w);return n=R(n),function(){if(--n<1)return t.apply(this,arguments)}}function co(n,t,e){return t=e?i:t,t=n&&t==null?n.length:t,lt(n,en,i,i,i,i,t)}function ho(n,t){var e;if(typeof t!="function")throw new Un(w);return n=R(n),function(){return--n>0&&(e=t.apply(this,arguments)),n<=1&&(t=i),e}}var $i=b(function(n,t,e){var r=j;if(e.length){var u=yt(e,ee($i));r|=E}return lt(n,r,t,e,u)}),po=b(function(n,t,e){var r=j|J;if(e.length){var u=yt(e,ee(po));r|=E}return lt(t,r,n,e,u)});function go(n,t,e){t=e?i:t;var r=lt(n,cn,i,i,i,i,i,t);return r.placeholder=go.placeholder,r}function _o(n,t,e){t=e?i:t;var r=lt(n,Mn,i,i,i,i,i,t);return r.placeholder=_o.placeholder,r}function vo(n,t,e){var r,u,o,s,a,h,d=0,_=!1,v=!1,y=!0;if(typeof n!="function")throw new Un(w);t=kn(t)||0,X(e)&&(_=!!e.leading,v="maxWait"in e,o=v?on(kn(e.maxWait)||0,t):o,y="trailing"in e?!!e.trailing:y);function S(tn){var Jn=r,dt=u;return r=u=i,d=tn,s=n.apply(dt,Jn),s}function F(tn){return d=tn,a=Ce(O,t),_?S(tn):s}function L(tn){var Jn=tn-h,dt=tn-d,Wo=t-Jn;return v?vn(Wo,o-dt):Wo}function C(tn){var Jn=tn-h,dt=tn-d;return h===i||Jn>=t||Jn<0||v&&dt>=o}function O(){var tn=wr();if(C(tn))return P(tn);a=Ce(O,L(tn))}function P(tn){return a=i,y&&r?S(tn):(r=u=i,s)}function Dn(){a!==i&&Cf(a),d=0,r=h=u=a=i}function wn(){return a===i?s:P(wr())}function Pn(){var tn=wr(),Jn=C(tn);if(r=arguments,u=this,h=tn,Jn){if(a===i)return F(h);if(v)return Cf(a),a=Ce(O,t),S(h)}return a===i&&(a=Ce(O,t)),s}return Pn.cancel=Dn,Pn.flush=wn,Pn}var sp=b(function(n,t){return uf(n,1,t)}),ap=b(function(n,t,e){return uf(n,kn(t)||0,e)});function lp(n){return lt(n,rt)}function Ar(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new Un(w);var e=function(){var r=arguments,u=t?t.apply(this,r):r[0],o=e.cache;if(o.has(u))return o.get(u);var s=n.apply(this,r);return e.cache=o.set(u,s)||o,s};return e.cache=new(Ar.Cache||st),e}Ar.Cache=st;function Sr(n){if(typeof n!="function")throw new Un(w);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function cp(n){return ho(2,n)}var hp=Vl(function(n,t){t=t.length==1&&I(t[0])?Y(t[0],bn(T())):Y(pn(t,1),bn(T()));var e=t.length;return b(function(r){for(var u=-1,o=vn(r.length,e);++u=t}),$t=lf(function(){return arguments}())?lf:function(n){return Q(n)&&G.call(n,"callee")&&!Ju.call(n,"callee")},I=p.isArray,Mp=Lu?bn(Lu):Pl;function Sn(n){return n!=null&&Tr(n.length)&&!pt(n)}function nn(n){return Q(n)&&Sn(n)}function Ip(n){return n===!0||n===!1||Q(n)&&xn(n)==k}var Mt=$a||nu,Rp=bu?bn(bu):Wl;function Lp(n){return Q(n)&&n.nodeType===1&&!Me(n)}function bp(n){if(n==null)return!0;if(Sn(n)&&(I(n)||typeof n=="string"||typeof n.splice=="function"||Mt(n)||re(n)||$t(n)))return!n.length;var t=mn(n);if(t==Rn||t==Kn)return!n.size;if(Fe(n))return!mi(n).length;for(var e in n)if(G.call(n,e))return!1;return!0}function Ep(n,t){return Ae(n,t)}function Op(n,t,e){e=typeof e=="function"?e:i;var r=e?e(n,t):i;return r===i?Ae(n,t,i,e):!!r}function Hi(n){if(!Q(n))return!1;var t=xn(n);return t==hn||t==_n||typeof n.message=="string"&&typeof n.name=="string"&&!Me(n)}function Dp(n){return typeof n=="number"&&Qu(n)}function pt(n){if(!X(n))return!1;var t=xn(n);return t==Et||t==se||t==Be||t==is}function xo(n){return typeof n=="number"&&n==R(n)}function Tr(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=Hn}function X(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}function Q(n){return n!=null&&typeof n=="object"}var yo=Eu?bn(Eu):Ul;function Pp(n,t){return n===t||vi(n,t,Di(t))}function Wp(n,t,e){return e=typeof e=="function"?e:i,vi(n,t,Di(t),e)}function Bp(n){return wo(n)&&n!=+n}function Up(n){if(wc(n))throw new M(m);return cf(n)}function Np(n){return n===null}function Gp(n){return n==null}function wo(n){return typeof n=="number"||Q(n)&&xn(n)==Ot}function Me(n){if(!Q(n)||xn(n)!=ft)return!1;var t=Qe(n);if(t===null)return!0;var e=G.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&Ye.call(e)==Wa}var Ki=Ou?bn(Ou):Nl;function qp(n){return xo(n)&&n>=-Hn&&n<=Hn}var Ao=Du?bn(Du):Gl;function Fr(n){return typeof n=="string"||!I(n)&&Q(n)&&xn(n)==le}function On(n){return typeof n=="symbol"||Q(n)&&xn(n)==Ue}var re=Pu?bn(Pu):ql;function $p(n){return n===i}function kp(n){return Q(n)&&mn(n)==ce}function Hp(n){return Q(n)&&xn(n)==fs}var Kp=dr(xi),zp=dr(function(n,t){return n<=t});function So(n){if(!n)return[];if(Sn(n))return Fr(n)?zn(n):An(n);if(ge&&n[ge])return Ta(n[ge]());var t=mn(n),e=t==Rn?fi:t==Kn?He:ie;return e(n)}function gt(n){if(!n)return n===0?n:0;if(n=kn(n),n===Qn||n===-Qn){var t=n<0?-1:1;return t*Oe}return n===n?n:0}function R(n){var t=gt(n),e=t%1;return t===t?e?t-e:t:0}function To(n){return n?Ut(R(n),0,In):0}function kn(n){if(typeof n=="number")return n;if(On(n))return Lt;if(X(n)){var t=typeof n.valueOf=="function"?n.valueOf():n;n=X(t)?t+"":t}if(typeof n!="string")return n===0?n:+n;n=qu(n);var e=Ms.test(n);return e||Rs.test(n)?oa(n.slice(2),e?2:8):Cs.test(n)?Lt:+n}function Fo(n){return jn(n,Tn(n))}function Yp(n){return n?Ut(R(n),-Hn,Hn):n===0?n:0}function N(n){return n==null?"":En(n)}var Zp=ne(function(n,t){if(Fe(t)||Sn(t)){jn(t,ln(t),n);return}for(var e in t)G.call(t,e)&&xe(n,e,t[e])}),Co=ne(function(n,t){jn(t,Tn(t),n)}),Cr=ne(function(n,t,e,r){jn(t,Tn(t),n,r)}),Jp=ne(function(n,t,e,r){jn(t,ln(t),n,r)}),Xp=ct(hi);function Qp(n,t){var e=jt(n);return t==null?e:ef(e,t)}var Vp=b(function(n,t){n=$(n);var e=-1,r=t.length,u=r>2?t[2]:i;for(u&&yn(t[0],t[1],u)&&(r=1);++e1),o}),jn(n,Ei(n),e),r&&(e=Gn(e,U|gn|V,ac));for(var u=t.length;u--;)Ti(e,t[u]);return e});function _g(n,t){return Io(n,Sr(T(t)))}var vg=ct(function(n,t){return n==null?{}:Hl(n,t)});function Io(n,t){if(n==null)return{};var e=Y(Ei(n),function(r){return[r]});return t=T(t),mf(n,e,function(r,u){return t(r,u[0])})}function mg(n,t,e){t=Ft(t,n);var r=-1,u=t.length;for(u||(u=1,n=i);++rt){var r=n;n=t,t=r}if(e||n%1||t%1){var u=Vu();return vn(n+u*(t-n+fa("1e-"+((u+"").length-1))),t)}return wi(n,t)}var Rg=te(function(n,t,e){return t=t.toLowerCase(),n+(e?bo(t):t)});function bo(n){return Zi(N(n).toLowerCase())}function Eo(n){return n=N(n),n&&n.replace(bs,xa).replace(Xs,"")}function Lg(n,t,e){n=N(n),t=En(t);var r=n.length;e=e===i?r:Ut(R(e),0,r);var u=e;return e-=t.length,e>=0&&n.slice(e,u)==t}function bg(n){return n=N(n),n&&cs.test(n)?n.replace(ou,ya):n}function Eg(n){return n=N(n),n&&vs.test(n)?n.replace(kr,"\\\\$&"):n}var Og=te(function(n,t,e){return n+(e?"-":"")+t.toLowerCase()}),Dg=te(function(n,t,e){return n+(e?" ":"")+t.toLowerCase()}),Pg=Df("toLowerCase");function Wg(n,t,e){n=N(n),t=R(t);var r=t?Jt(n):0;if(!t||r>=t)return n;var u=(t-r)/2;return gr(tr(u),e)+n+gr(nr(u),e)}function Bg(n,t,e){n=N(n),t=R(t);var r=t?Jt(n):0;return t&&r>>0,e?(n=N(n),n&&(typeof t=="string"||t!=null&&!Ki(t))&&(t=En(t),!t&&Zt(n))?Ct(zn(n),0,e):n.split(t,e)):[]}var Hg=te(function(n,t,e){return n+(e?" ":"")+Zi(t)});function Kg(n,t,e){return n=N(n),e=e==null?0:Ut(R(e),0,n.length),t=En(t),n.slice(e,e+t.length)==t}function zg(n,t,e){var r=f.templateSettings;e&&yn(n,t,e)&&(t=i),n=N(n),t=Cr({},t,r,qf);var u=Cr({},t.imports,r.imports,qf),o=ln(u),s=ui(u,o),a,h,d=0,_=t.interpolate||Ne,v="__p += \'",y=oi((t.escape||Ne).source+"|"+_.source+"|"+(_===su?Fs:Ne).source+"|"+(t.evaluate||Ne).source+"|$","g"),S="//# sourceURL="+(G.call(t,"sourceURL")?(t.sourceURL+"").replace(/\\s/g," "):"lodash.templateSources["+ ++ta+"]")+`\n`;n.replace(y,function(C,O,P,Dn,wn,Pn){return P||(P=Dn),v+=n.slice(d,Pn).replace(Es,wa),O&&(a=!0,v+=`\' +\n__e(`+O+`) +\n\'`),wn&&(h=!0,v+=`\';\n`+wn+`;\n__p += \'`),P&&(v+=`\' +\n((__t = (`+P+`)) == null ? \'\' : __t) +\n\'`),d=Pn+C.length,C}),v+=`\';\n`;var F=G.call(t,"variable")&&t.variable;if(!F)v=`with (obj) {\n`+v+`\n}\n`;else if(Ss.test(F))throw new M(B);v=(h?v.replace(os,""):v).replace(ss,"$1").replace(as,"$1;"),v="function("+(F||"obj")+`) {\n`+(F?"":`obj || (obj = {});\n`)+"var __t, __p = \'\'"+(a?", __e = _.escape":"")+(h?`, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, \'\') }\n`:`;\n`)+v+`return __p\n}`;var L=Do(function(){return W(o,S+"return "+v).apply(i,s)});if(L.source=v,Hi(L))throw L;return L}function Yg(n){return N(n).toLowerCase()}function Zg(n){return N(n).toUpperCase()}function Jg(n,t,e){if(n=N(n),n&&(e||t===i))return qu(n);if(!n||!(t=En(t)))return n;var r=zn(n),u=zn(t),o=$u(r,u),s=ku(r,u)+1;return Ct(r,o,s).join("")}function Xg(n,t,e){if(n=N(n),n&&(e||t===i))return n.slice(0,Ku(n)+1);if(!n||!(t=En(t)))return n;var r=zn(n),u=ku(r,zn(t))+1;return Ct(r,0,u).join("")}function Qg(n,t,e){if(n=N(n),n&&(e||t===i))return n.replace(Hr,"");if(!n||!(t=En(t)))return n;var r=zn(n),u=$u(r,zn(t));return Ct(r,u).join("")}function Vg(n,t){var e=it,r=Or;if(X(t)){var u="separator"in t?t.separator:u;e="length"in t?R(t.length):e,r="omission"in t?En(t.omission):r}n=N(n);var o=n.length;if(Zt(n)){var s=zn(n);o=s.length}if(e>=o)return n;var a=e-Jt(r);if(a<1)return r;var h=s?Ct(s,0,a).join(""):n.slice(0,a);if(u===i)return h+r;if(s&&(a+=h.length-a),Ki(u)){if(n.slice(a).search(u)){var d,_=h;for(u.global||(u=oi(u.source,N(au.exec(u))+"g")),u.lastIndex=0;d=u.exec(_);)var v=d.index;h=h.slice(0,v===i?a:v)}}else if(n.indexOf(En(u),a)!=a){var y=h.lastIndexOf(u);y>-1&&(h=h.slice(0,y))}return h+r}function jg(n){return n=N(n),n&&ls.test(n)?n.replace(fu,Ia):n}var nd=te(function(n,t,e){return n+(e?" ":"")+t.toUpperCase()}),Zi=Df("toUpperCase");function Oo(n,t,e){return n=N(n),t=e?i:t,t===i?Sa(n)?ba(n):ga(n):n.match(t)||[]}var Do=b(function(n,t){try{return Ln(n,i,t)}catch(e){return Hi(e)?e:new M(e)}}),td=ct(function(n,t){return Bn(t,function(e){e=nt(e),at(n,e,$i(n[e],n))}),n});function ed(n){var t=n==null?0:n.length,e=T();return n=t?Y(n,function(r){if(typeof r[1]!="function")throw new Un(w);return[e(r[0]),r[1]]}):[],b(function(r){for(var u=-1;++uHn)return[];var e=In,r=vn(n,In);t=T(t),n-=In;for(var u=ii(r,t);++e0||t<0)?new D(e):(n<0?e=e.takeRight(-n):n&&(e=e.drop(n)),t!==i&&(t=R(t),e=t<0?e.dropRight(-t):e.take(t-n)),e)},D.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},D.prototype.toArray=function(){return this.take(In)},Vn(D.prototype,function(n,t){var e=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),u=f[r?"take"+(t=="last"?"Right":""):t],o=r||/^find/.test(t);!u||(f.prototype[t]=function(){var s=this.__wrapped__,a=r?[1]:arguments,h=s instanceof D,d=a[0],_=h||I(s),v=function(O){var P=u.apply(f,xt([O],a));return r&&y?P[0]:P};_&&e&&typeof d=="function"&&d.length!=1&&(h=_=!1);var y=this.__chain__,S=!!this.__actions__.length,F=o&&!y,L=h&&!S;if(!o&&_){s=L?s:new D(this);var C=n.apply(s,a);return C.__actions__.push({func:xr,args:[v],thisArg:i}),new Nn(C,y)}return F&&L?n.apply(this,a):(C=this.thru(v),F?r?C.value()[0]:C.value():C)})}),Bn(["pop","push","shift","sort","splice","unshift"],function(n){var t=Ke[n],e=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",r=/^(?:pop|shift)$/.test(n);f.prototype[n]=function(){var u=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(I(o)?o:[],u)}return this[e](function(s){return t.apply(I(s)?s:[],u)})}}),Vn(D.prototype,function(n,t){var e=f[t];if(e){var r=e.name+"";G.call(Vt,r)||(Vt[r]=[]),Vt[r].push({name:t,func:e})}}),Vt[hr(i,J).name]=[{name:"wrapper",func:i}],D.prototype.clone=ja,D.prototype.reverse=nl,D.prototype.value=tl,f.prototype.at=Lh,f.prototype.chain=bh,f.prototype.commit=Eh,f.prototype.next=Oh,f.prototype.plant=Ph,f.prototype.reverse=Wh,f.prototype.toJSON=f.prototype.valueOf=f.prototype.value=Bh,f.prototype.first=f.prototype.head,ge&&(f.prototype[ge]=Dh),f},wt=Ea();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(an._=wt,define(function(){return wt})):Dt?((Dt.exports=wt)._=wt,Xr._=wt):an._=wt}).call(ue)});var Er=Jd(Go());var _t=i=>[...new Set(i)],qo=i=>[...new Map(i.map(l=>[l.toLowerCase(),l])).values()];function $o(i){return Array.isArray(i)?i:[]}var ko=(i,l)=>l.indexOf(i)>0?l.indexOf(i):l.length;var Mr=i=>"spaces://"+i;var tt=i=>{var l;return(l=i==null?void 0:i.match(/(\\\\.|[^,])+/g))!=null?l:[]},kt=i=>{if(!i)return"";let l=/\\[\\[(.*?)\\]\\]/g.exec(i),x=(l==null?void 0:l.length)>1?l[1].substring(0,ko("|",l[1])):i;return x||i};var Re=(i,l)=>{if(typeof i=="string"){if(/\\/\\/(\\S+?(?:jpe?g|png|gif|svg))/gi.test(i)||i.includes("unsplash"))return"image";if(/^\\d{4}-\\d{2}-\\d{2}$/.test(i))return"date";if(l=="tag"||l=="tags")return"tag";if(/\\[\\[.*?\\]\\]/.test(i))return"link"}else{if(typeof i=="number")return"number";if(typeof i=="boolean")return"boolean";if(i)if(Array.isArray(i)||typeof i=="string"&&i.indexOf(",")>-1){let x=Array.isArray(i)?i:[];if(typeof i=="string"&&i.indexOf(",")>-1&&(x=tt(i)),l=="tag"||l=="tags")return"tag-multi";if(x.length==1&&Array.isArray(x[0])&&x[0].length==1&&typeof x[0][0]=="string")return"link";let m=_t(x.map(w=>Re(w,l)));return m.length==1&&m[0]=="link"?"link-multi":"option-multi"}else{if(i.isLuxonDateTime)return"date";if(i.isLuxonDuration)return"duration";if(i.type=="file")return"link";if(typeof i=="object"&&!Array.isArray(i)&&i!==null)return"object"}else return"unknown"}return"text"};var Ho=i=>Object.keys(i!=null?i:{}).filter(l=>l!="position").filter(l=>l!="tag"&&l!="tags");var fe=i=>i.join(","),Ko=i=>i.join(", ");var Ir=(i,l)=>{switch(Re(l,i)){case"object":return JSON.stringify(l);case"number":return l.toString();case"boolean":return l?"true":"false";case"date":return l;case"duration":return Ko(Object.keys(l.values).reduce((m,w)=>[...m,...l.values[w]>0?[l.values[w]+" "+w]:[]],[]));case"option-multi":case"link-multi":return typeof l=="string"?kt(l):fe(l.map(m=>m?typeof m=="string"?kt(m):m.path?m.path:Array.isArray(l)&&m.length==1&&Array.isArray(m[0])&&m[0].length==1&&typeof m[0][0]=="string"?m[0][0]:JSON.stringify(m):""));case"link":return Array.isArray(l)&&l.length==1&&Array.isArray(l[0])&&l[0].length==1&&typeof l[0][0]=="string"?l[0][0]:typeof l=="string"?kt(l):l.path;case"text":case"tag":case"image":return l}return""};var zo=i=>{switch(i){case"duration":return"text";case"unknown":return"text"}return i};var Rr=(i,l)=>i==l,eu=(i,l)=>(i!=null?i:"").length==0,ru=(i,l)=>(i!=null?i:"").toLowerCase().includes((l!=null?l:"").toLowerCase()),Lr=(i,l)=>parseFloat(i)>parseFloat(l),br=(i,l)=>parseInt(i)>parseInt(l),iu=(i,l)=>{let x=i?tt(i):[];return(l?tt(l):[]).some(w=>x.some(B=>B==w))},Yo=i=>{let l=new Date(`${i}T00:00`),x=new Date;return l.getMonth()===x.getMonth()&&l.getDate()===x.getDate()};var Le={isNotEmpty:{type:["text","file","link","link-multi","fileprop","image"],fn:(i,l)=>!eu(i,""),valueType:"none"},isEmpty:{type:["text","file","link","link-multi","fileprop","image"],fn:(i,l)=>eu(i,""),valueType:"none"},include:{fn:(i,l)=>ru(i,l),type:["text","file","link","link-multi","fileprop","image"],valueType:"text"},notInclude:{type:["text","file","link","link-multi","fileprop","image"],fn:(i,l)=>!ru(i,l),valueType:"text"},is:{type:["text","file","link","context","fileprop"],fn:(i,l)=>Rr(i,l),valueType:"text"},isNot:{type:["text","file","link","context","fileprop"],fn:(i,l)=>!Rr(i,l),valueType:"text"},equal:{type:["number"],fn:(i,l)=>Rr(i,l),valueType:"number"},isGreatThan:{type:["number"],fn:(i,l)=>Lr(i,l),valueType:"number"},isLessThan:{type:["number"],fn:(i,l)=>br(i,l),valueType:"number"},isLessThanOrEqual:{type:["number"],fn:(i,l)=>!Lr(i,l),valueType:"number"},isGreatThanOrEqual:{type:["number"],fn:(i,l)=>!br(i,l),valueType:"number"},dateBefore:{type:["date","fileprop"],fn:(i,l)=>br(i,l),valueType:"date"},dateAfter:{type:["date","fileprop"],fn:(i,l)=>Lr(i,l),valueType:"date"},isSameDateAsToday:{type:["date"],fn:(i,l)=>Yo(i,l),valueType:"none"},isAnyInList:{type:["option","context","option-multi","context-multi","tags-multi","tags"],fn:(i,l)=>iu(i,l),valueType:"list"},isNoneInList:{type:["option","context","option-multi","context-multi","tags-multi","tags"],fn:(i,l)=>!iu(i,l),valueType:"list"},isTrue:{type:["boolean"],fn:(i,l)=>i=="true",valueType:"none"},isFalse:{type:["boolean"],fn:(i,l)=>i!="true",valueType:"none"}};var Xd=(i,l)=>l.reduce((m,w)=>{let[B,Z]=m,un=w.type=="fileprop"?Xo(Z,w):w.type=="filemeta"?Jo(Z,w):w.type=="frontmatter"?Zo(Z,w):[],q=Z.filter(U=>!un.includes(U));return[[...B,...un],q]},[[],i])[0],Qd=(i,l)=>l.reduce((x,m)=>m.type=="fileprop"?Xo(x,m):m.type=="filemeta"?Jo(x,m):m.type=="frontmatter"?Zo(x,m):[],i),Zo=(i,l)=>i.filter(x=>{let m=x.frontmatter;if(!m||!m[l.field])return!1;let w=Le[l.fn],B=!0;return w&&(B=w.fn(Ir(l.field,m[l.field]),l.value)),B}),Jo=(i,l)=>i.filter(x=>{let m="";l.field=="outlinks"?m=fe(x.outlinks):l.field=="inlinks"?m=fe(x.inlinks):l.field=="tags"&&(m=fe(x.tags));let w=Le[l.fn],B=!0;return w&&(B=w.fn(m,l.value)),B}),Xo=(i,l)=>i.filter(x=>{if(["name","path","sticker","color","isFolder","extension","ctime","mtime","size","parent"].includes(l.field)){let w=Le[l.fn],B=!0;return w&&(B=w.fn(x[l.field],l.value)),B}return!0}),Qo=(i,l)=>i.reduce((m,w)=>!m||w.filters.length==0?m:w.type=="any"?Xd([l],w.filters).length>0:Qd([l],w.filters).length>0,!0);var Vo=(i,l,x)=>{if(!l)return{changed:!1,cache:{path:i.path,frames:{},schemas:[],listitems:{}}};let m=l.schemas,w=m.filter(q=>q.type=="frame").reduce((q,U)=>{var gn,V;return Rt(It({},q),{[U.id]:{schema:U,cols:l.fields.filter(sn=>sn.schemaId==U.id),rows:(V=(gn=l.tables[U.id])==null?void 0:gn.rows)!=null?V:[]}})},{}),B=m.filter(q=>q.type=="listitem").reduce((q,U)=>{var gn,V;return Rt(It({},q),{[U.id]:{schema:U,cols:l.fields.filter(sn=>sn.schemaId==U.id),rows:(V=(gn=l.tables[U.id])==null?void 0:gn.rows)!=null?V:[]}})},{}),Z={path:i.path,frames:w,schemas:m,listitems:B},un=!0;return x&&Er.default.isEqual(Z,x)&&(un=!1),{changed:un,cache:Z}},jo=(i,l,x)=>{var Cn,j,J,et,cn,Mn;let m={};if(!l)return{changed:!1,cache:{cols:[],path:i.path,schemas:[],outlinks:[],contexts:[],tables:{},spaceMap:m}};let w=l.schemas.find(E=>E.primary=="true"),B={schema:w,cols:l.fields.filter(E=>E.schemaId==w.id),rows:(j=(Cn=l.tables[w.id])==null?void 0:Cn.rows)!=null?j:[]},Z=l.schemas.filter(E=>E.type=="db").reduce((E,z)=>{var en,dn;return Rt(It({},E),{[z.id]:{schema:z,cols:l.fields.filter(rt=>rt.schemaId==z.id),rows:(dn=(en=l.tables[z.id])==null?void 0:en.rows)!=null?dn:[]}})},{}),un=(et=(J=B.cols)==null?void 0:J.filter(E=>E.type.startsWith("context")))!=null?et:[],q=(Mn=(cn=B.cols)==null?void 0:cn.filter(E=>E.type.startsWith("link")))!=null?Mn:[],U=_t(un.map(E=>E.value));un.forEach(E=>{m[E.name]={},B.rows.forEach(z=>{tt(z[E.name]).forEach(en=>{var dn;return m[E.name][en]=[...(dn=m[E.name][en])!=null?dn:[],z.File]})})});let gn=_t(B.rows.reduce((E,z)=>_t([...E,...[...un,...q].flatMap(en=>tt(z[en.name]).map(dn=>kt(dn)))]),[])),V={cols:l.fields.filter(E=>E.schemaId==w.id),path:i.path,contexts:U,outlinks:gn,tables:Z,schemas:l.schemas,spaceMap:m},sn=!0;return x&&Er.default.isEqual(V,x)&&(sn=!0),{changed:sn,cache:V}},Vd=i=>{var x,m,w,B,Z,un,q,U,gn,V,sn,Cn,j;let l=[];return i&&i.tags&&l.push(...(m=(x=i.tags)==null?void 0:x.map(J=>J.tag))!=null?m:[]),i&&((w=i.frontmatter)==null?void 0:w.tags)&&l.push(...(typeof((B=i.frontmatter)==null?void 0:B.tags)=="string"?tt(i.frontmatter.tags.replace(/ /g,"")):Array.isArray((Z=i.frontmatter)==null?void 0:Z.tags)?(q=(un=i.frontmatter)==null?void 0:un.tags)!=null?q:[]:[]).filter(J=>typeof J=="string").map(J=>"#"+J)),i&&((U=i.frontmatter)==null?void 0:U.tag)&&l.push(...(typeof((gn=i.frontmatter)==null?void 0:gn.tag)=="string"?tt(i.frontmatter.tag.replace(/ /g,"")):Array.isArray((V=i.frontmatter)==null?void 0:V.tag)?(Cn=(sn=i.frontmatter)==null?void 0:sn.tag)!=null?Cn:[]:[]).filter(J=>typeof J=="string").map(J=>"#"+J)),(j=_t(l))!=null?j:[]};var ns=(i,l,x,m,w,B,Z,un)=>{var Oe,Lt,In,De,Pe,We,ut,bt,Be;let q={cacheType:"file",path:i.path,name:i.name,filename:i.filename};i.stat&&(q.ctime=i.stat.ctime,q.mtime=i.stat.mtime,q.size=i.stat.size,q.extension=i.extension);let U=[],gn=Vd(w),V=(k,rn,_n=new Set)=>{var Et,se;let hn=[];for(let Rn of rn){let Ot=(se=(Et=k.get(Rn))==null?void 0:Et.contexts)!=null?se:[];for(let Ht of Ot)_n.has(Ht)||(hn.push(Ht),_n.add(Ht),hn.push(...V(k,[Mr(Ht)],_n)))}return hn};if(x.has(i.parent))for(let k of(Oe=x.get(i.parent).contexts)!=null?Oe:[])U.push(k);U.push(...gn);let sn=i.name,Cn=i.name,j=(Lt=m==null?void 0:m.sticker)!=null?Lt:"",J=(In=m==null?void 0:m.color)!=null?In:"",et=(De=m==null?void 0:m.rank)!=null?De:"",cn=(Pe=m==null?void 0:m.folder)!=null?Pe:"";cn=="true"&&(cn="");let Mn=i.parent,E=i.isFolder,z={},en={},dn=[],rt=[],it=w==null?void 0:w.frontmatter;w!=null&&w.links&&rt.push(...w.links.map(k=>k.link));let Or=Z&&E?Z.folderNotePath:i.path;for(let k of Object.keys(B))Or in B[k]&&dn.push(k);let be="";if(it){let rn=qo(Ho(it)).reduce((_n,hn)=>Rt(It({},_n),{[hn]:{name:hn,type:zo(Re(it[hn],hn))}}),{});Object.keys(rn).forEach(_n=>{z[_n]=Ir(_n,it[_n]),en[_n]=rn[_n].type,rn[_n].type.startsWith("link")&&rt.push(kt(z[_n]))}),be=(We=z[l.fmKeyBanner])!=null?We:"",z[l.fmKeySticker]&&(j=it[l.fmKeySticker]),z[l.fmKeyColor]&&(J=it[l.fmKeyColor]),z[l.fmKeyAlias]&&(Cn=(ut=$o(it[l.fmKeyAlias]))==null?void 0:ut[0])}let vt=Rt(It({},q),{name:sn,tags:_t(U),alias:Cn,fileTags:gn,folderNote:Z,sticker:j,color:J,rank:et,parent:Mn,banner:be,isFolder:E,sortBy:cn,frontmatter:z,frontmatterTypes:en,inlinks:dn,outlinks:rt}),Xn=[],oe={[Mn]:et};for(let k of U)Xn.push(Mr(k));for(let[k,rn]of x)rn.type=="smart"?Qo(rn.metadata.def.filters,vt)&&Xn.push(k):rn.type=="folder"||rn.type=="vault"?rn.space.folderPath==Mn&&rn.space.defPath!=i.path&&(Xn.push(k),oe[k]=et):((Be=(bt=rn.metadata)==null?void 0:bt.links)!=null?Be:[]).find(hn=>hn==vt.path)&&(Xn.push(k),oe[k]=rn.metadata.links.findIndex(hn=>hn==vt.path).toString());let Ee=V(x,Xn);Xn.push(...Ee.map(k=>Mr(k))),vt.tags.push(...Ee);let Qn=Z&&!E?Rt(It({},vt),{spaces:[],contexts:[]}):Rt(It({},vt),{spaces:_t(Xn),spaceRanks:oe}),Hn=!0;return un&&Er.default.isEqual(Qn,un)&&(Hn=!1),{changed:Hn,cache:Qn}};function ts(i){let{file:l,settings:x,spacesCache:m,vaultItem:w,metadataCache:B,resolvedLinks:Z,folderNote:un,oldMetadata:q}=i;return ns(l,x,m,w,B,Z,un,q)}function es(i){let{space:l,mdb:x,oldCache:m}=i;return jo(l,x,m)}function rs(i){let{space:l,mdb:x,oldCache:m}=i;return Vo(l,x,m)}var jd=self;jd.onmessage=async i=>{let{payload:l,job:x}=i.data,m;x.type=="file"?m=ts(l):x.type=="context"?m=es(l):x.type=="frames"&&(m=rs(l));try{postMessage({job:x,result:m})}catch(w){console.log(w),postMessage({job:x,result:{$error:`Failed to index ${x.type} ${x.path}: ${w}`}})}};\n/**\n * @license\n * Lodash \n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n'); } // src/superstate/workers/manager.ts var Manager = class extends import_obsidian68.Component { - constructor(numWorkers, cache) { + constructor(numWorkers, cache2) { super(); this.numWorkers = numWorkers; - this.cache = cache; + this.cache = cache2; this.workers = []; this.busy = []; this.reloadQueue = []; @@ -74261,15 +80058,15 @@ var Manager = class extends import_obsidian68.Component { this.busy[workerId] = true; } if (job.type == "context") { - const space = spaceInfoByPath(this.cache.plugin, job.path); - if (!space || !space.path) { + const space2 = spaceInfoByPath(this.cache.plugin, job.path); + if (!space2 || !space2.path) { return; } - getContextMDB(this.cache.plugin, space).then((mdb) => { + getContextMDB(this.cache.plugin, space2).then((mdb) => { this.workers[workerId].postMessage({ job, payload: { - space, + space: space2, mdb, oldCache: this.cache.contextsIndex.get(job.path) } @@ -74278,15 +80075,15 @@ var Manager = class extends import_obsidian68.Component { }); } if (job.type == "frames") { - const space = spaceInfoByPath(this.cache.plugin, job.path); - if (!space) { + const space2 = spaceInfoByPath(this.cache.plugin, job.path); + if (!space2) { return; } - getFramesMDB(this.cache.plugin, space).then((mdb) => { + getFramesMDB(this.cache.plugin, space2).then((mdb) => { this.workers[workerId].postMessage({ job, payload: { - space, + space: space2, mdb, oldCache: this.cache.framesIndex.get(job.path) } @@ -74374,6 +80171,7 @@ var Superstate = class extends import_obsidian69.Component { this.spacesMap = new IndexMap(); this.linksMap = new IndexMap(); this.tagsMap = new IndexMap(); + this.superProperties = /* @__PURE__ */ new Map(); this.iconsCache = /* @__PURE__ */ new Map(); this.fontsCache = /* @__PURE__ */ new Map(); this.contextStoreQueue = Promise.resolve(); @@ -74381,10 +80179,24 @@ var Superstate = class extends import_obsidian69.Component { this.vaultDBCache = []; this.persister = new LocalStorageCache(app2.appId || "shared", indexVersion); this.addChild(this.indexer = new Manager(2, this)); + this.loadSuperProperties(); } static create(app2, indexVersion, onChange, plugin) { return new Superstate(app2, indexVersion, onChange, plugin); } + loadSuperProperties() { + this.superProperties.set("$commands", { name: "Obsidian Commands", schemaId: "$super", type: "option" }); + this.superProperties.set("$links", { name: "Links", schemaId: "$super", type: "option" }); + } + valueForSuperproperty(superProperty, property2) { + if (superProperty == "$commands") { + return { options: Object.values(this.plugin.app.commands.commands).map((f4) => ({ name: f4.name, value: f4.id })) }; + } else if (superProperty == "$links") { + return { options: getAllAbstractFilesInVault(this.plugin).map((f4) => ({ name: f4.name, value: f4.path })) }; + } else { + return parseFieldValue(property2.value, property2.type); + } + } async initializeIndex() { await Promise.race([new Promise((resolve) => setTimeout(resolve, 1e3)), this.loadFromCache()]); this.loadSpacesDatabaseFromDisk(); @@ -74435,7 +80247,7 @@ var Superstate = class extends import_obsidian69.Component { sticker: f4.sticker, def: spaceDef, contexts: [], - links: spaceDef.type == "links" ? currentSpaceItems.filter((s5) => s5.space == f4.name).map((s5) => s5.path) : null + links: spaceDef.type == "links" ? currentSpaceItems.filter((s6) => s6.space == f4.name).map((s6) => s6.path) : null }); } }); @@ -74514,9 +80326,9 @@ var Superstate = class extends import_obsidian69.Component { } return items.map((f4) => { var _a2, _b2; - const s5 = uriByString(f4); + const s6 = uriByString(f4); const fileCache = this.filesIndex.get(f4); - if (s5.type == "tag" || s5.type == "space" || s5.type == "folder" || s5.type == "vault") { + if (s6.type == "tag" || s6.type == "space" || s6.type == "folder" || s6.type == "vault") { if (fileCache) { return { ...this.spacesIndex.get(f4), @@ -74552,43 +80364,43 @@ var Superstate = class extends import_obsidian69.Component { this.addToContextStoreQueue(() => removeFilesInContext(this.plugin, removeFiles.map((f4) => f4.File), this.spacesIndex.get(context.path).space).then((f4) => this.reloadSpaceByPath(context.path))); } }); - this.spacesIndex.forEach((space) => { - const removeFiles = [...this.spacesMap.getInverse(space.path)]; + this.spacesIndex.forEach((space2) => { + const removeFiles = [...this.spacesMap.getInverse(space2.path)]; }); } async loadFromCache() { - const allFiles = getAllAbstractFilesInVault(this.plugin, app); + const allFiles = getAllAbstractFilesInVault(this.plugin); if (this.plugin.settings.indexSVG) { - const cacheIcons = allFiles.filter((f4) => f4 instanceof import_obsidian69.TFile && f4.extension == "svg").map((s5) => this.persister.load(s5.path, "icon").then((string) => { - if ((string == null ? void 0 : string.length) > 0) - this.iconsCache.set(s5.path, string); + const cacheIcons = allFiles.filter((f4) => f4 instanceof import_obsidian69.TFile && f4.extension == "svg").map((s6) => this.persister.load(s6.path, "icon").then((string2) => { + if ((string2 == null ? void 0 : string2.length) > 0) + this.iconsCache.set(s6.path, string2); })); await Promise.all(cacheIcons); } const cachePromises = allFiles.map((file) => this.persister.load(file.path, "file").then((f4) => { if (!f4) return; - const cache = parseFileCache(f4); - this.filesIndex.set(file.path, cache); - this.tagsMap.set(file.path, new Set(cache.tags)); - this.spacesMap.set(file.path, new Set(cache.spaces)); - this.linksMap.set(file.path, new Set(cache.outlinks)); + const cache2 = parseFileCache(f4); + this.filesIndex.set(file.path, cache2); + this.tagsMap.set(file.path, new Set(cache2.tags)); + this.spacesMap.set(file.path, new Set(cache2.spaces)); + this.linksMap.set(file.path, new Set(cache2.outlinks)); this.broadcast("file", "change", file.path); })); await Promise.all(cachePromises); const allSpaces = this.plugin.settings.cachedSpaces; - const cacheSpacePromises = allSpaces.map((s5) => this.persister.load(s5, "space").then((serializedSpace) => { - const space = safelyParseJSON(serializedSpace); - if (space && space.type) { - this.spacesIndex.set(s5, space); - this.broadcast("space", "change", s5); + const cacheSpacePromises = allSpaces.map((s6) => this.persister.load(s6, "space").then((serializedSpace) => { + const space2 = safelyParseJSON(serializedSpace); + if (space2 && space2.type) { + this.spacesIndex.set(s6, space2); + this.broadcast("space", "change", s6); } })); await Promise.all(cacheSpacePromises); this.broadcast("vault"); } async initalizeFiles() { - const allFiles = getAllAbstractFilesInVault(this.plugin, app); + const allFiles = getAllAbstractFilesInVault(this.plugin); const promises = allFiles.map((l3) => this.reloadFile(l3, true)); await Promise.all(promises); this.broadcast("vault"); @@ -74822,47 +80634,47 @@ var Superstate = class extends import_obsidian69.Component { } }, app.workspace["rootSplit"]); } - deleteSpace(space) { - if (this.spacesIndex.has(space)) { - this.spacesIndex.delete(space); - this.contextsIndex.delete(space); - this.framesIndex.delete(space); + deleteSpace(space2) { + if (this.spacesIndex.has(space2)) { + this.spacesIndex.delete(space2); + this.contextsIndex.delete(space2); + this.framesIndex.delete(space2); } - this.spacesMap.deleteInverse(space); - this.persister.remove(space, "space"); + this.spacesMap.deleteInverse(space2); + this.persister.remove(space2, "space"); this.plugin.settings.cachedSpaces = this.allSpaces().map((f4) => f4.name); this.plugin.saveSettings(); - spaceFolderDelete(space); + spaceFolderDelete(space2); this.broadcast("space"); } - async reloadFrames(space) { - if (!space) + async reloadFrames(space2) { + if (!space2) return false; - return this.indexer.reload({ type: "frames", path: space.path }).then((r3) => { - const { changed, cache } = r3; + return this.indexer.reload({ type: "frames", path: space2.path }).then((r3) => { + const { changed, cache: cache2 } = r3; if (!changed) { return false; } - this.framesIndex.set(space.path, cache); - this.broadcast("frames", "change", space.path); + this.framesIndex.set(space2.path, cache2); + this.broadcast("frames", "change", space2.path); return true; }); } - async reloadContext(space) { - if (!space) + async reloadContext(space2) { + if (!space2) return false; - return this.indexer.reload({ type: "context", path: space.path }).then((r3) => { - const { changed, cache } = r3; + return this.indexer.reload({ type: "context", path: space2.path }).then((r3) => { + const { changed, cache: cache2 } = r3; if (!changed) { return false; } - this.contextsIndex.set(space.path, cache); - this.broadcast("context", "change", space.path); + this.contextsIndex.set(space2.path, cache2); + this.broadcast("context", "change", space2.path); return true; }); } - broadcast(type, action, name, newName) { - dispatchSpaceDatabaseFileChanged(type, action, name, newName); + broadcast(type, action, name2, newName) { + dispatchSpaceDatabaseFileChanged(type, action, name2, newName); } async reloadVault() { this.broadcast("vault"); @@ -74871,53 +80683,53 @@ var Superstate = class extends import_obsidian69.Component { return [...this.spacesIndex.values()]; } allFrames() { - return [...this.framesIndex.values()].filter((f4) => f4).flatMap((f4) => f4.schemas.filter((f5) => f5.type == "frame").map((s5) => ({ schema: s5, path: f4.path }))); + return [...this.framesIndex.values()].filter((f4) => f4).flatMap((f4) => f4.schemas.filter((f5) => f5.type == "frame").map((s6) => ({ schema: s6, path: f4.path }))); } allListItems() { - return [...this.framesIndex.values()].filter((f4) => f4).flatMap((f4) => f4.schemas.filter((f5) => f5.type == "listitem").map((s5) => ({ schema: s5, path: f4.path }))); + return [...this.framesIndex.values()].filter((f4) => f4).flatMap((f4) => f4.schemas.filter((f5) => f5.type == "listitem").map((s6) => ({ schema: s6, path: f4.path }))); } updateSpaceMetadata(spacePath, metadata) { var _a2, _b2; - const space = this.spacesIndex.get(spacePath); - if (!space) { + const space2 = this.spacesIndex.get(spacePath); + if (!space2) { this.reloadSpaceByPath(spacePath); return; } - const spaceSort = (_a2 = safelyParseJSON(metadata == null ? void 0 : metadata.sort)) != null ? _a2 : [space.type == "smart" || space.type == "tag" ? "path" : "rank", true]; + const spaceSort = (_a2 = safelyParseJSON(metadata == null ? void 0 : metadata.sort)) != null ? _a2 : [space2.type == "smart" || space2.type == "tag" ? "path" : "rank", true]; const sortable = spaceSort[0] == "rank" || spaceSort[0] == ""; this.spacesIndex.set(spacePath, { - ...space, + ...space2, metadata, contexts: (_b2 = metadata == null ? void 0 : metadata.contexts) != null ? _b2 : [], sortable }); this.broadcast("space", "change", spacePath); } - async reloadSpace(space, initialized = true) { + async reloadSpace(space2, initialized = true) { var _a2, _b2, _c2, _d2, _e2; - if (!space) + if (!space2) return; - const defFile = getAbstractFileAtPath(app, space.defPath); + const defFile = getAbstractFileAtPath(app, space2.defPath); const metaCache = defFile ? this.metadataCache.getFileCache(defFile) : null; - const spaceDef = (metaCache == null ? void 0 : metaCache.frontmatter) ? metaCache.frontmatter : defaultDefForSpace(space, this.plugin); - const metadata = parseSpaceMetadata(spaceDef, space, this.plugin); + const spaceDef = (metaCache == null ? void 0 : metaCache.frontmatter) ? metaCache.frontmatter : defaultDefForSpace(space2, this.plugin); + const metadata = parseSpaceMetadata(spaceDef, space2, this.plugin); const frontmatter = metaCache == null ? void 0 : metaCache.frontmatter; - const vaultItem = vaultItemForPath(this.plugin, space.path); - const type = space.uri.type == "tag" ? "tag" : space.uri.type == "folder" ? "folder" : space.uri.type == "vault" ? "vault" : (_a2 = metadata.def) == null ? void 0 : _a2.type; + const vaultItem = vaultItemForPath(this.plugin, space2.path); + const type = space2.uri.type == "tag" ? "tag" : space2.uri.type == "folder" ? "folder" : space2.uri.type == "vault" ? "vault" : (_a2 = metadata.def) == null ? void 0 : _a2.type; const spaceSort = (_b2 = safelyParseJSON(metadata == null ? void 0 : metadata.sort)) != null ? _b2 : [type == "smart" || type == "tag" ? "path" : "rank", true]; const sortable = spaceSort[0] == "rank" || spaceSort[0] == ""; const rank = type == "folder" ? vaultItem == null ? void 0 : vaultItem.rank : metadata == null ? void 0 : metadata.rank; const contexts = (_c2 = metadata.contexts) != null ? _c2 : []; if (type == "tag" && this.plugin.settings.autoAddContextsToSubtags) { - const parentTags = getAllParentTags(space.name); + const parentTags = getAllParentTags(space2.name); contexts.push(...parentTags); } - const cache = { - name: space.name, - space, - alias: (_e2 = (_d2 = ensureArray(metadata.aliases)) == null ? void 0 : _d2[0]) != null ? _e2 : space.name, + const cache2 = { + name: space2.name, + space: space2, + alias: (_e2 = (_d2 = ensureArray(metadata.aliases)) == null ? void 0 : _d2[0]) != null ? _e2 : space2.name, cacheType: "space", - path: space.path, + path: space2.path, frontmatter, type, contexts: contexts.map((f4) => tagToTagPath(f4)), @@ -74925,43 +80737,43 @@ var Superstate = class extends import_obsidian69.Component { sortable, rank }; - this.spacesIndex.set(space.path, cache); - this.persister.store(space.path, JSON.stringify(cache), "space"); - cache.metadata.links.forEach((f4) => { + this.spacesIndex.set(space2.path, cache2); + this.persister.store(space2.path, JSON.stringify(cache2), "space"); + cache2.metadata.links.forEach((f4) => { if (pathIsSpace(f4)) { - this.spacesMap.set(f4, /* @__PURE__ */ new Set([...this.spacesMap.get(f4), space.path])); + this.spacesMap.set(f4, /* @__PURE__ */ new Set([...this.spacesMap.get(f4), space2.path])); } }); if (initialized) { this.plugin.settings.cachedSpaces = this.allSpaces().map((f4) => f4.path); this.plugin.saveSettings(); - this.broadcast("space", "change", space.path); + this.broadcast("space", "change", space2.path); } } async reloadFile(file, force) { if (!file) return false; return this.indexer.reload({ type: "file", path: file.path }).then((r3) => { - const { changed, cache } = r3; + const { changed, cache: cache2 } = r3; if (!changed && !force) { return false; } - this.filesIndex.set(file.path, cache); - this.tagsMap.set(file.path, new Set(cache.tags)); - this.linksMap.set(file.path, new Set(cache.outlinks)); - if (!import_lodash14.default.isEqual(cache.spaces, Array.from(this.spacesMap.get(file.path)))) { - this.spacesMap.set(file.path, new Set(cache.spaces)); - cache.tags.map((f4) => this.spacesIndex.has(tagSpacePathFromTag(f4)) ? null : spaceFromTag(this.plugin, f4)).filter((f4) => f4).forEach((f4) => this.reloadSpace(f4).then((f5) => this.broadcast("file", "change", file.path))); + this.filesIndex.set(file.path, cache2); + this.tagsMap.set(file.path, new Set(cache2.tags)); + this.linksMap.set(file.path, new Set(cache2.outlinks)); + if (!import_lodash14.default.isEqual(cache2.spaces, Array.from(this.spacesMap.get(file.path)))) { + this.spacesMap.set(file.path, new Set(cache2.spaces)); + cache2.tags.map((f4) => this.spacesIndex.has(tagSpacePathFromTag(f4)) ? null : spaceFromTag(this.plugin, f4)).filter((f4) => f4).forEach((f4) => this.reloadSpace(f4).then((f5) => this.broadcast("file", "change", file.path))); this.broadcast("space"); } if (force) { - const allContextsWithFile = cache.spaces.map((f4) => { + const allContextsWithFile = cache2.spaces.map((f4) => { var _a2; return (_a2 = this.spacesIndex.get(f4)) == null ? void 0 : _a2.space; }).filter((f4) => f4); this.addToContextStoreQueue(() => onMetadataChange(this.plugin, file, allContextsWithFile)); } - if (cache.extension == "svg" && this.plugin.settings.indexSVG) { + if (cache2.extension == "svg" && this.plugin.settings.indexSVG) { app.vault.read(file).then((f4) => { this.iconsCache.set(file.path, f4); this.persister.store(file.path, f4, "icon"); @@ -75006,10 +80818,10 @@ var Superstate = class extends import_obsidian69.Component { init_compat_module(); var FileHeaderContextView = (props2) => { var _a2; - const { name, fm } = props2; - const file = getAbstractFileAtPath(app, name); + const { name: name2, fm } = props2; + const file = getAbstractFileAtPath(app, name2); const [collapsed, setCollapsed] = h2(false); - const tags = (_a2 = fm.tags) != null ? _a2 : []; + const tags2 = (_a2 = fm.tags) != null ? _a2 : []; const [values, setValues] = h2({}); const [columns, setColumns] = h2([]); p2(() => { @@ -75039,7 +80851,7 @@ var FileHeaderContextView = (props2) => { }, /* @__PURE__ */ Cn.createElement("div", { className: `mk-spacer`, style: { - "--header-height": fm && fm[props2.plugin.settings.fmKeyBanner] ? ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!fm.icon || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" : 0 + "--mk-header-height": fm && fm[props2.plugin.settings.fmKeyBanner] ? ((platformIsMobile() ? 1 : 0) * 26 + 138 + (!fm.icon || props2.plugin.settings.inlineContextNameLayout == "horizontal" ? 1 : 0) * 50).toString() + "px" : 0 }, onContextMenu: (e4) => e4.preventDefault() }), /* @__PURE__ */ Cn.createElement("div", { @@ -75052,15 +80864,15 @@ var FileHeaderContextView = (props2) => { } })) : /* @__PURE__ */ Cn.createElement(Cn.Fragment, null), /* @__PURE__ */ Cn.createElement("div", { className: "mk-inline-title inline-title" - }, fileNameToString(name)), /* @__PURE__ */ Cn.createElement(NoteSpacesBar, { + }, fileNameToString(name2)), /* @__PURE__ */ Cn.createElement(NoteSpacesBar, { path: file.path, plugin: props2.plugin })))), !collapsed ? /* @__PURE__ */ Cn.createElement("div", { className: "mk-file-context-component" }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, /* @__PURE__ */ Cn.createElement("div", { className: "mk-file-context-section" - }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, columns.map((f4, i4) => /* @__PURE__ */ Cn.createElement("div", { - key: i4, + }, /* @__PURE__ */ Cn.createElement(Cn.Fragment, null, columns.map((f4, i5) => /* @__PURE__ */ Cn.createElement("div", { + key: i5, className: "mk-file-context-row" }, /* @__PURE__ */ Cn.createElement("div", { className: "mk-file-context-field" @@ -75069,7 +80881,7 @@ var FileHeaderContextView = (props2) => { }, /* @__PURE__ */ Cn.createElement(DataTypeView, { plugin: props2.plugin, initialValue: values[f4.name], - file: null, + row: {}, column: { ...f4, table: "" }, editable: false, updateValue: () => { @@ -75298,7 +81110,7 @@ var patchWorkspace = (plugin) => { // src/components/FileContextView/Backlinks.tsx init_compat_module(); -var BacklinkItem = (props2) => { +var BacklinkItem2 = (props2) => { const file = F2( () => getAbstractFileAtPath(app, props2.path), [props2.path] @@ -75405,11 +81217,11 @@ var Backlinks2 = (props2) => { dangerouslySetInnerHTML: { __html: uiIconSet["mk-ui-collapse-sm"] } - })), /* @__PURE__ */ Cn.createElement("div", null, !collapsed && backlinks.map((f4, i4) => { + })), /* @__PURE__ */ Cn.createElement("div", null, !collapsed && backlinks.map((f4, i5) => { var _a2; - return /* @__PURE__ */ Cn.createElement(BacklinkItem, { + return /* @__PURE__ */ Cn.createElement(BacklinkItem2, { path: f4, - key: i4, + key: i5, leaf: props2.leaf, plugin: props2.plugin, source: (_a2 = props2.file) == null ? void 0 : _a2.path @@ -75522,10 +81334,14 @@ var MakeMDPlugin = class extends import_obsidian72.Plugin { } }; this.detachFileContextLeafs = () => { - return; + const leafs = this.app.workspace.getLeavesOfType(FILE_CONTEXT_VIEW_TYPE); + for (const leaf of leafs) { + if (leaf.view instanceof ContextExplorerLeafView) + leaf.view.destroy(); + leaf.detach(); + } }; this.openFileContextLeaf = async (reveal) => { - return; const leafs = this.app.workspace.getLeavesOfType(FILE_CONTEXT_VIEW_TYPE); if (leafs.length == 0) { const leaf = this.app.workspace.getRightLeaf(false); @@ -75772,6 +81588,11 @@ var MakeMDPlugin = class extends import_obsidian72.Plugin { }); } if (this.settings.contextEnabled) { + this.addCommand({ + id: "mk-open-file-context", + name: i18n_default.commandPalette.openFileContext, + callback: () => this.openFileContextLeaf(true) + }); } if (this.settings.inlineBacklinks) { this.addCommand({ @@ -75836,6 +81657,9 @@ var MakeMDPlugin = class extends import_obsidian72.Plugin { this.app.vault.createFolder(this.settings.spacesFolder); } }); + this.registerView(FILE_CONTEXT_VIEW_TYPE, (leaf) => { + return new ContextExplorerLeafView(leaf, this); + }); this.registerView(EMBED_CONTEXT_VIEW_TYPE, (leaf) => { return new EmbedContextView2(leaf, this); }); diff --git a/manifest.json b/manifest.json index 9efb91c..8167336 100755 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "make-md", "name": "MAKE.md", - "version": "0.8.0", + "version": "0.8.1", "minAppVersion": "0.16.0", "description": "Make.md brings you features that supercharges Obsidian. Sort your files in custom order and add file icons using Spaces. Edit inline embeds with Flow Editor. And style your text and add new markdown blocks without writing markdown using Maker Mode.", "author": "MAKE.md", diff --git a/styles.css b/styles.css index 5e39c3e..d7509e1 100644 --- a/styles.css +++ b/styles.css @@ -571,6 +571,18 @@ body { .mk-cell-object { display: flex; flex-direction: column; + margin-left: 10px; + padding-left: 10px; + border-left: thin solid var(--divider-color); +} +.mk-cell-object .mk-file-context-field-key { + width: 100%; + border: none; + border-radius: 0px; + height: 24px; +} +.mk-cell-object .mk-file-context-field-key:not(:focus) { + background: unset !important; } .mk-cell-object-row { display: flex; @@ -619,7 +631,7 @@ body { } .mk-button-new { background: var(--interactive-accent) !important; - color: var(--text-normal) !important; + color: var(--text-on-accent) !important; } .mk-image-selector { position: absolute; @@ -838,860 +850,910 @@ body { filter: var(--link-unresolved-filter); } -/* src/css/SpaceView.css */ -.mk-space-scroller { - display: flex !important; - flex-direction: column; - align-items: flex-start !important; - line-height: 1.4; - height: 100%; - overflow-x: auto; - position: relative; - z-index: 0; - padding-bottom: 0; +/* src/css/Frame.css */ +.mk-frame-view > div { } -.mk-context-selector { - font-size: var(--font-ui-small); - --tag-background: var(--background-secondary); - position: relative; +.mk-setter-code { display: flex; + border: var(--input-border-width) solid var(--background-modifier-border); + width: 120px; + overflow: hidden; + align-items: center; + border-radius: var(--input-radius); } -.mk-context-selector .mk-fold { - top: 0; +.mk-setter-code .mk-setter-code-value { + padding: 2px 4px; + background-color: var(--background-modifier-form-field); + height: 100%; } -.mk-context-selector:hover .mk-fold { - left: -12px; - opacity: 1; +.mk-frame-code-block .cm-gutters { + padding-inline-end: 0 !important; } -.mk-context-selector-menu { +.mk-frame-code-add { + margin-left: 10px; } -.mk-context-header { - margin: var(--file-margins); - margin-bottom: 0; +.mk-frame-code-section > span { + margin-left: 10px; } -.mk-title-container { - display: flex; - font-size: var(--inline-title-size); - font-weight: var(--inline-title-weight); +.mk-frame-view p { + margin-block-start: 0; + margin-block-end: 0; } -.mk-context-header { +.mk-frame-row-placeholder:hover > .mk-frame-hover-menu-container, +.mk-f:hover > .mk-frame-hover-menu-container, +.mk-frame-hover-menu-container:hover { display: flex; - flex-direction: column; - max-width: var(--file-line-width); - width: 100%; } -.markdown-source-view.mod-cm6.is-readable-line-width .mk-space-outer { - padding: var(--file-margins); - max-width: 100%; +.mk-f { + position: relative; width: 100%; - margin-left: auto; - margin-right: auto; } -.mk-space-header { - margin-left: auto; - margin-right: auto; - width: 100%; - max-width: var(--file-line-width); +.mk-f.is-selected { + background: var(--background-modifier-active-hover); + border-radius: 4px; } -.mk-space-header .inline-title { - flex-grow: 1; - margin-bottom: 0; +.mk-frame-hover-menu-container { + position: absolute; + display: none; + left: -36px; + top: -6px; + padding: 6px; + z-index: var(--layer-popover); } -.mk-space-sizer { +.mk-frame-hover-menu-container .mk-hover-button:hover { + background: var(--nav-item-background-hover); + border-radius: 4px; +} +.mk-frame-hover-props-editor { +} +.mk-frame-hover-menu { + border-radius: var(--radius-s); display: flex; flex-direction: column; - align-items: stretch; - margin-left: auto; - margin-right: auto; -} -.mk-file-table-header { - margin-top: 24px; - color: var(--text-faint); + font-size: var(--font-ui-smaller); + background: var(--background-primary); } -.mk-file-table { - border-collapse: collapse; - table-layout: fixed; +.mk-frame-bounds { + position: absolute !important; width: 100%; + height: 100%; + z-index: var(--layer-popover); } -.mk-space-body { - max-width: var(--file-line-width); - margin: 0 auto; +.mk-frame-bounds.is-selected { + border: 2px solid var(--color-accent); } -.mk-space-body .cm-content { - padding-bottom: 0px !important; +.mk-frame-sidebar .mk-frame-selector { + flex-direction: column; + height: 200px; + overflow: scroll; } -.mk-space-body > .mk-frame { - align-items: flex-start; +.mk-frame-selector { display: flex; - flex-direction: column; - gap: 8px; } -.mk-file-row { +.mk-space-scroller .mk-frame-selector { + flex-wrap: wrap; + margin-left: auto; + margin-right: auto; + margin-top: var(--file-margins); + width: 100%; + max-width: var(--file-line-width); } -.mk-file-row:hover { - background: var(--background-modifier-hover) !important; +.mk-space-scroller .mk-frame-selector > div { + width: 100px; + height: 80px; } -.mk-file-table tr:nth-child(even) { - background: var(--color-base-10); +.mk-frame-editor { + display: flex; + flex-direction: row; + width: 100%; + height: 100%; + flex: 1; } -.mk-file-row td { - padding: 10px 10px; +.mk-frame-main { + flex: 1; + display: flex; + flex-direction: column; + align-items: flex-start; } -.mk-file-row .mk-column-file { - width: 99%; +.mk-frame-main-tabs { + border-bottom: thin solid var(--divider-color); + width: 100%; } -.mk-file-row p { - text-overflow: ellipsis; - overflow: hidden; - font-size: var(--font-ui-smaller); +.mk-frame-main-tabs button { + background: rgba(var(--nav-item-background-active), 0.3); + border: none; + box-shadow: none; color: var(--text-faint); - margin: 0; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - display: -webkit-box; } -.mk-file-row .mk-file-name { - font-weight: var(--font-medium); +.mk-frame-builder { + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 2px; } -.mk-file-date { - font-size: var(--font-ui-smaller); +.mk-frame-builder > div { + width: 74px; + display: flex; + flex-direction: column; + align-items: center; + background: var(--background-primary); + padding: 8px; +} +.mk-frame-builder-icon svg { + width: 24px; + height: 24px; color: var(--text-muted); - width: 100px; } -.mk-column-icon { - width: 40px; +.mk-frame-canvas { + background: var(--background-secondary); + display: flex; + flex-direction: column; + flex: 1; + padding: 12px; + width: 100%; + gap: 16px; } -.mk-column-icon svg { - width: 16px; - height: 16px; - color: var(--text-muted); +.mk-cell-code.markdown-source-view.mod-cm6 .cm-content { + white-space: pre-wrap; } -.mk-flowspace-title svg { - width: 16px; - height: 16px; - color: var(--text-muted); +.mk-cell-code .cm-editor { + min-height: inherit !important; } -.mk-flowspace-title p { - margin: 0; - padding: 0; - margin-left: 8px; +.mk-frame-props { + display: flex; + flex-direction: column; } -.mk-flowspace-title .mk-flowspace-date { - font-size: var(--font-ui-smaller); - color: var(--text-muted); +.mk-frame-canvas-editor { + background: var(--background-primary); + max-width: var(--file-line-width); + min-height: 100px; + box-shadow: var(--shadow-s); } -.mk-flowspace-title { +.mk-frame-canvas-editor p { + margin-block-start: 0; + margin-block-end: 0; + margin-inline-start: 0px; + margin-inline-end: 0px; +} +.mk-frame-container { + flex: 1; + height: 100%; display: flex; - align-items: center; - padding: 8px 12px; + justify-content: center; + position: relative; border-top: 1px solid var(--divider-color); } -.mk-flowspace-editor { - padding: 0px 12px; +.mk-cell-code { + font-family: var(--font-monospace); +} +.mk-frame-code-editor { width: 100%; + height: 100%; + background: var(--code-background); } -.mk-flowspace-editor:not(.mk-flow-node) .mk-floweditor { - padding: 12px 0px; -} -.mk-frame-view .mk-flowspace-editor:not(.mk-flow-node) .mk-floweditor { - padding: 0; -} -.mk-flow-node { - padding: 8px 0px; -} -.mk-flowspace-editor.mk-foldernote { - width: var(--file-line-width); - max-width: 100%; - margin-left: auto; - margin-right: auto; -} -.mk-foldernote .mk-floweditor { - height: 100% !important; -} -.mk-flowspace-title span { - flex-grow: 1; -} -.mk-flowspace-title button { +.mk-frame-code-section { + display: flex; + flex-direction: column; + align-items: flex-start; padding: 8px; - margin-left: 8px; - width: unset; -} -.mk-flowspace-title button.mk-open { - background: var(--icon-color-active); + font-size: 12px; + border-left: var(--nav-indentation-guide-width) solid var(--nav-indentation-guide-color); } -.mk-flowspace-title:hover { - background: var(--color-base-10); +.mk-frame-code-editor .\37c e { + color: var(--code-string); } -.mk-space-empty { - width: 100%; - height: 100%; - display: flex; - align-items: center; - justify-content: center; - font-size: var(--font-ui-small); - font-style: italic; +.mk-frame-code-section > span { + background: var(--background-modifier-active); + padding: 2px 4px; + border-radius: 4px; + font-size: 12px; } -.mk-flow-container { +.mk-frame-code-block { width: 100%; + border-left: var(--nav-indentation-guide-width) solid var(--nav-indentation-guide-color); } -.mk-flow-container > div { - border-bottom: thin dotted var(--divider-color); +.mk-frame-code-block-prop { + display: flex; + margin-left: 40px; + border-left: var(--nav-indentation-guide-width) solid var(--nav-indentation-guide-color); } -.mk-flow-container > div > span { - font-size: var(--font-smallest); - padding: var(--size-4-1) var(--context-padding); - color: var(--text-faint); +.mk-frame-menu-container { + display: flex; + align-items: flex-start; + overflow: scroll; } -.mk-space-scroller .mk-flowspace-editor { - padding: 0; +.mk-frame-sidebar { + position: relative; + display: flex; + flex-direction: column; + padding: 0 var(--size-4-3); + border-bottom: 1px solid var(--divider-color); } -.mk-space-scroller .cm-sizer { +.mk-frame-node-info { + padding: 8px; } -.mk-smart-note-view { +.mk-frame-inspector { display: flex; + overflow: scroll; + flex-direction: column; + flex: 1; + border-left: 1px solid var(--divider-color); } -.mk-smart-note-view div { - padding: 4px; -} -.mk-context-type-selector { - max-width: 100%; +.mk-frame-row-placeholder { width: 100%; - padding-top: 4px; - margin-left: auto; - margin-right: auto; -} -.mk-context-type-selector button { - background: rgba(var(--nav-item-background-active), 0.3); - border: none; - box-shadow: none; - color: var(--text-faint); + position: relative; } - -/* src/css/CardsView.css */ -.mk-space-scroller > .mk-cards-container { - padding-bottom: 60px; +.mk-frame-drop-placeholder { + position: absolute; + top: 0; + left: 0; } -.mk-cards-container { +.mk-frame-column { + display: none; + position: absolute !important; width: 100%; height: 100%; - overflow-x: auto; - overflow-y: visible; -} -.mk-cards-container .mk-list-content > .mk-flowspace-editor { - padding-left: 12px !important; - padding-right: 12px !important; -} -.mk-cards-container .mk-list-view { - display: inline-grid; - grid-auto-flow: column; - gap: 20px; -} -.mk-space-scroller > .mk-cards-container .mk-list-view { - padding: 20px; -} -.mk-cards-container .mk-list-item { - border-radius: 4px; - list-style: none; - background: var(--background-secondary); - overflow: hidden; - font-size: var(--font-ui-small); - color: var(--text-muted); - box-shadow: - 0px 1px 2px rgba(0, 0, 0, 0.06), - 0px 3.4px 6.7px rgba(0, 0, 0, 0.06), - 0px 15px 30px rgba(0, 0, 0, 0.15); + z-index: var(--layer-popover); + border-left: var(--nav-indentation-guide-width) solid var(--nav-indentation-guide-color); } -.mk-cards-container .mk-list-group { - width: 200px; +.mk-frame-column-placeholder { + position: absolute; + right: -16px; + width: 16px; + bottom: 0; } -.mk-cards-grid .mk-list-item { - width: 250px; +.mk-frame-layers { + position: relative; + max-height: 200px; + overflow: scroll; } -.mk-cards-container .mk-file-icon svg { - display: none; +.mk-frame-layer > span { + flex: 1; } -.mk-cards-grid .mk-list-group { - width: 100% !important; +.mk-frame-row-placeholder.mk-indicator-bottom::before, +.mk-frame-drop-placeholder .mk-indicator-bottom::before { + position: absolute; + content: " "; + display: block; + width: 100%; + height: 2px; + bottom: 0; + border-radius: 1px; + background: var(--interactive-accent); } -.mk-cards-grid .mk-list-group ul { - flex-direction: row !important; - flex-wrap: wrap; +.mk-frame-column-placeholder.mk-indicator-right::before { + content: " "; + display: block; + height: 100%; + width: 2px; + border-radius: 1px; + background: var(--interactive-accent); } -.mk-cards-container .mk-list-group ul { - list-style: none; - padding-inline-start: 0px; +.mk-frame-menu-bar { display: flex; flex-direction: column; - gap: 10px; + position: absolute; + overflow: scroll; + left: 40px; + height: 100px; + margin: 0 !important; } -.mk-list-container .mk-list-group-header { +.mk-frame-menu-bar > div { display: flex; - padding: 12px 24px 4px 24px; - background-color: var(--titlebar-background); -} -.mk-list-container .mk-list-group-header > div { - background: none !important; -} -.mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > div > .mk-list-container { - padding-bottom: 0; -} -.mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > div > .mk-list-container .mk-list-item { - padding: 8px; } -.mk-space-scroller > .mk-list-container { - padding-bottom: 100px; -} -.mk-list-container { - width: 100%; - height: 100%; - overflow-y: auto; +.mk-frame-placeholder { + color: var(--text-faint); } -.mk-list-container .mk-list-view { - display: flex; - flex-direction: column; +.mk-frame-text { + display: inline; + color: inherit; } -.mk-cards-container .mk-list-item.mk-is-active, -.mk-list-container .mk-list-item.mk-is-active { - background: var(--background-modifier-active-hover); +.mk-frame-text p { + display: inline; } -.mk-list-container .mk-list-item { - display: flex; +.mk-frame-menu-bar div { padding: 8px; - list-style: none; - font-size: var(--font-ui-small); - color: var(--text-muted); - align-items: flex-start; } -.mk-list-container .mk-list-content { - flex-grow: 1; +.mk-frame-menu { display: flex; + overflow: scroll; flex-direction: column; - border-bottom: thin solid var(--divider-color); - min-height: 69px; + position: relative; } -.mk-list-container .mk-list-fields { +.mk-setter-group { display: flex; flex-wrap: wrap; align-items: center; - gap: 8px; - padding-bottom: 8px; -} -.mk-list-container .mk-list-fields > div { - margin-bottom: -8px; } -.mk-list-container .mk-list-fields > div:not(.mk-cell-file):not(.mk-cell-image) { - width: unset !important; +.mk-setter-color { + border-radius: var(--input-radius); + border: var(--input-border-width) solid var(--background-modifier-border); } -.mk-list-container .mk-list-fields > .mk-cell-image { - width: 100%; +.mk-setter-group .mk-setter-slider { + flex: 1; } -.mk-list-container .mk-list-group { - width: 100%; +.mk-setter-step input { + width: 40px; + padding-right: 0px; } -.mk-cards-container .mk-cell-file-title, -.mk-list-container .mk-cell-file-title { +.mk-setter-step input[type=number]::-webkit-outer-spin-button, +.mk-setter-step input[type=number]::-webkit-inner-spin-button { + -webkit-appearance: inner-spin-button !important; +} +.mk-setter-text span, +.mk-setter-step span { + font-size: var(--font-ui-smaller); padding: 4px; - color: var(--text-normal); - margin-bottom: 0; } -.mk-list-container .mk-list-fields .mk-cell-file { - width: 100%; - font-weight: var(--bold-weight); +.mk-frame-label { + position: absolute; + font-size: 9px; + background-color: var(--color-accent); + top: -10px; + left: 0; } -.mk-cards-container .mk-list-fields { - padding: 12px; - align-items: flex-start; +.mk-frame-schema { display: flex; - flex-direction: column; -} -.mk-list-fields .mk-cell-file-preview { - width: 100%; - color: var(--text-normal); - margin-bottom: -8px; - color: var(--text-faint); - text-overflow: ellipsis; - overflow: hidden; - -webkit-line-clamp: 1; - -webkit-box-orient: vertical; - display: -webkit-box; + padding: 4px 8px; + font-size: var(--font-ui-small); } -.mk-list-container .mk-list-group ul { - list-style: none; - padding-inline-start: 0px; +.mk-frame-layer { + margin-left: var(--spacing); + padding: 4px 8px; + font-size: var(--font-ui-small); display: flex; - flex-direction: column; - margin-top: 0; - margin-bottom: 0; } -.mk-file-preview { - background: var(--label-color); +.mk-frame-layer.is-selected { + background-color: var(--nav-item-background-active); } -.mk-list-container .mk-file-preview { - min-width: 48px; - height: 48px; - border-radius: 8px; - margin-right: 8px; - margin-top: 8px; +.mk-frame-schema.is-selected { + background-color: var(--nav-item-background-active); +} +.mk-frame-sidebar-title { display: flex; - align-items: center; - justify-content: center; + padding: 4px 8px; + font-size: var(--font-ui-small); + font-weight: var(--bold-weight); + background: var(--background-primary-alt); } -.mk-list-group-header .mk-cell-option-item { - background: none !important; +.mk-frame-text { + min-height: 40px; } -.mk-cards-container .mk-file-preview { - position: relative; - margin-bottom: 4px; - height: 80px; +.mk-frame-text[placeholder]:empty::before { + content: attr(placeholder); + color: var(--text-faint); } -.mk-cards-container .mk-file-icon { - position: absolute; - bottom: -6px; - font-size: 24px; - left: 14px; +.mk-frame-text[placeholder]:empty:focus::before { + content: ""; } -.mk-list-container .mk-file-icon { - font-size: 20px; - display: flex; +.mk-button { + -webkit-app-region: no-drag; + display: inline-flex; align-items: center; justify-content: center; + color: var(--text-normal); + font-size: var(--font-ui-small); + border-radius: var(--button-radius); + border: 0; + padding: var(--size-4-1) var(--size-4-3); + height: var(--input-height); + font-weight: var(--input-font-weight); + cursor: var(--cursor); + font-family: inherit; + outline: none; + user-select: none; + white-space: nowrap; + background-color: var(--interactive-normal); + box-shadow: var(--input-shadow); } -.mk-context-view-editor { - flex: 1; - padding: 40px; +.mk-a { + color: var(--link-color); + outline: none; + text-decoration-line: var(--link-decoration); + text-decoration-thickness: var(--link-decoration-thickness); + cursor: var(--cursor-link); } -.mk-context-view-editor .mk-td { - white-space: nowrap; + +/* src/css/FrameProps.css */ +body:not(.is-mobile) .mk-frame-props-editor { } -.mk-context-view-selector { +.mk-frame-props-editor { display: flex; - padding: 12px 24px; - gap: 8px; - border-top: thin solid var(--divider-color); + position: absolute; + top: -40px; + padding: 0; + z-index: var(--layer-popover); + background: var(--background-primary); + max-height: unset; } -.mk-context-view-selector > div { - width: 50px; - overflow: hidden; - display: -webkit-box; - -webkit-line-clamp: 2; - line-clamp: 2; - -webkit-box-orient: vertical; - text-align: center; +.is-mobile .mk-frame-props-editor svg { + width: 32px; + height: 32px; } - -/* src/css/Frame.css */ -.mk-frame-view > div { +.is-mobile .mk-frame-props-editor { + --mobile-toolbar-height: 48px; + border-radius: 0; + width: 100%; + margin-top: 0; + overflow-x: auto; + justify-content: center; + height: var(--mobile-toolbar-height); + border-top: var(--divider-width) solid var(--divider-color); } -.mk-setter-code { +.mk-frame-props-editor .mk-mark { + margin: 4px; + padding: 4px; + border-radius: 4px; display: flex; - border: var(--input-border-width) solid var(--background-modifier-border); - width: 120px; - overflow: hidden; + font-size: var(--font-ui-small); align-items: center; - border-radius: var(--input-radius); + gap: 4px; } -.mk-setter-code .mk-setter-code-value { - padding: 2px 4px; - background-color: var(--background-modifier-form-field); - height: 100%; +.mk-frame-props-editor .mk-mark:hover { + background: var(--background-modifier-hover); } -.mk-frame-code-block .cm-gutters { - padding-inline-end: 0 !important; +.mk-frame-props-editor .mk-mark-active { + background: var(--background-modifier-hover); } -.mk-frame-code-add { - margin-left: 10px; +.mk-frame-props-editor svg { + color: var(--text-muted); } -.mk-frame-code-section > span { - margin-left: 10px; +.mk-divider { + border-left: thin solid var(--background-modifier-hover); + width: 1px; } -.mk-frame-view p { - margin-block-start: 0; - margin-block-end: 0; +.mk-color { + width: 24px; + height: 24px; + border-radius: 12px; + margin: 8px; } -.mk-frame-row-placeholder:hover > .mk-frame-hover-menu-container, -.mk-f:hover > .mk-frame-hover-menu-container, -.mk-frame-hover-menu-container:hover { - display: flex; +.mk-color:hover { + opacity: 0.8; } -.mk-f { +mark { + color: unset; + border-radius: 2px; + margin: 0px 2px; + padding: 0px 2px; +} + +/* src/css/SpaceView.css */ +.mk-space-scroller { + display: flex !important; + flex-direction: column; + align-items: flex-start !important; + line-height: 1.4; + height: 100%; + overflow-x: auto; position: relative; - width: 100%; + z-index: 0; + padding-bottom: 0; } -.mk-frame-hover-menu-container { - position: absolute; - display: none; - left: -36px; - top: 0px; - padding: 6px; - z-index: var(--layer-popover); +.mk-context-selector { + font-size: var(--font-ui-small); + --tag-background: var(--background-secondary); + position: relative; + display: flex; } -.mk-frame-hover-props-editor { +.mk-context-selector .mk-fold { + top: 0; } -.mk-frame-hover-menu { - border-radius: var(--radius-s); +.mk-context-selector:hover .mk-fold { + left: -12px; + opacity: 1; +} +.mk-context-selector-menu { +} +.mk-context-header { + margin: var(--file-margins); + margin-bottom: 0; +} +.mk-title-container { + display: flex; + font-size: var(--inline-title-size); + font-weight: var(--inline-title-weight); +} +.mk-context-header { display: flex; flex-direction: column; - font-size: var(--font-ui-smaller); - background: var(--background-primary); + max-width: var(--file-line-width); + width: 100%; } -.mk-frame-bounds { - position: absolute !important; +.markdown-source-view.mod-cm6.is-readable-line-width .mk-space-outer { + padding: var(--file-margins); + max-width: 100%; width: 100%; - height: 100%; - z-index: var(--layer-popover); + margin-left: auto; + margin-right: auto; } -.mk-frame-bounds.is-selected { - border: 2px solid var(--color-accent); +.mk-space-header { + margin-left: auto; + margin-right: auto; + width: 100%; + max-width: var(--file-line-width); } -.mk-frame-sidebar .mk-frame-selector { - flex-direction: column; - height: 200px; - overflow: scroll; +.mk-space-header .inline-title { + flex-grow: 1; + margin-bottom: 0; } -.mk-frame-selector { +.mk-space-sizer { display: flex; -} -.mk-space-scroller .mk-frame-selector { - flex-wrap: wrap; + flex-direction: column; + align-items: stretch; margin-left: auto; margin-right: auto; - margin-top: var(--file-margins); +} +.mk-file-table-header { + margin-top: 24px; + color: var(--text-faint); +} +.mk-file-table { + border-collapse: collapse; + table-layout: fixed; width: 100%; +} +.mk-space-body { max-width: var(--file-line-width); + margin: 0 auto; +} +.mk-space-body .cm-content { + padding-bottom: 0px !important; +} +.mk-space-body > .mk-frame { + align-items: flex-start; + display: flex; + flex-direction: column; + gap: 8px; +} +.mk-file-row { +} +.mk-file-row:hover { + background: var(--background-modifier-hover) !important; +} +.mk-file-table tr:nth-child(even) { + background: var(--color-base-10); +} +.mk-file-row td { + padding: 10px 10px; +} +.mk-file-row .mk-column-file { + width: 99%; +} +.mk-file-row p { + text-overflow: ellipsis; + overflow: hidden; + font-size: var(--font-ui-smaller); + color: var(--text-faint); + margin: 0; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + display: -webkit-box; } -.mk-space-scroller .mk-frame-selector > div { +.mk-file-row .mk-file-name { + font-weight: var(--font-medium); +} +.mk-file-date { + font-size: var(--font-ui-smaller); + color: var(--text-muted); width: 100px; - height: 80px; } -.mk-frame-editor { - display: flex; - flex-direction: row; - width: 100%; - height: 100%; - flex: 1; +.mk-column-icon { + width: 40px; } -.mk-frame-main { - flex: 1; - display: flex; - flex-direction: column; - align-items: flex-start; +.mk-column-icon svg { + width: 16px; + height: 16px; + color: var(--text-muted); } -.mk-frame-main-tabs { - border-bottom: thin solid var(--divider-color); - width: 100%; +.mk-flowspace-title svg { + width: 16px; + height: 16px; + color: var(--text-muted); } -.mk-frame-main-tabs button { - background: rgba(var(--nav-item-background-active), 0.3); - border: none; - box-shadow: none; - color: var(--text-faint); +.mk-flowspace-title p { + margin: 0; + padding: 0; + margin-left: 8px; } -.mk-frame-builder { - display: flex; - flex-direction: row; - flex-wrap: wrap; - gap: 2px; +.mk-flowspace-title .mk-flowspace-date { + font-size: var(--font-ui-smaller); + color: var(--text-muted); } -.mk-frame-builder > div { - width: 74px; +.mk-flowspace-title { display: flex; - flex-direction: column; align-items: center; - background: var(--background-primary); - padding: 8px; -} -.mk-frame-builder-icon svg { - width: 24px; - height: 24px; - color: var(--text-muted); + padding: 8px 12px; + border-top: 1px solid var(--divider-color); } -.mk-frame-canvas { - background: var(--background-secondary); - display: flex; - flex-direction: column; - flex: 1; - padding: 12px; +.mk-flowspace-editor { + padding: 0px 12px; width: 100%; - gap: 16px; } -.mk-cell-code.markdown-source-view.mod-cm6 .cm-content { - white-space: pre-wrap; +.mk-flowspace-editor:not(.mk-flow-node) .mk-floweditor { + padding: 12px 0px; } -.mk-cell-code .cm-editor { - min-height: inherit !important; +.mk-frame-view .mk-flowspace-editor:not(.mk-flow-node) .mk-floweditor { + padding: 0; } -.mk-frame-props { - display: flex; - flex-direction: column; +.mk-flowspace-editor.mk-foldernote { + width: var(--file-line-width); + max-width: 100%; + margin-left: auto; + margin-right: auto; } -.mk-frame:hover > .mk-frame-props-editor, -.mk-frame-props-editor:hover { - display: flex; +.mk-foldernote .mk-floweditor { + height: 100% !important; } -.mk-frame-props-editor { - display: none; - background: var(--background-primary-alt); - position: absolute; - top: -32px; - height: 32px; - padding: 4px; - border-radius: 4px; - max-width: var(--file-line-width); - z-index: var(--layer-popover); +.mk-flowspace-title span { + flex-grow: 1; } -.mk-frame-canvas-editor { - background: var(--background-primary); - max-width: var(--file-line-width); - min-height: 100px; - box-shadow: var(--shadow-s); +.mk-flowspace-title button { + padding: 8px; + margin-left: 8px; + width: unset; } -.mk-frame-canvas-editor p { - margin-block-start: 0; - margin-block-end: 0; - margin-inline-start: 0px; - margin-inline-end: 0px; +.mk-flowspace-title button.mk-open { + background: var(--icon-color-active); } -.mk-frame-container { - flex: 1; +.mk-flowspace-title:hover { + background: var(--color-base-10); +} +.mk-space-empty { + width: 100%; height: 100%; display: flex; + align-items: center; justify-content: center; - position: relative; - border-top: 1px solid var(--divider-color); -} -.mk-cell-code { - font-family: var(--font-monospace); + font-size: var(--font-ui-small); + font-style: italic; } -.mk-frame-code-editor { +.mk-flow-container { width: 100%; - height: 100%; - background: var(--code-background); } -.mk-frame-code-section { - display: flex; - flex-direction: column; - align-items: flex-start; - padding: 8px; - font-size: 12px; - border-left: var(--nav-indentation-guide-width) solid var(--nav-indentation-guide-color); +.mk-flow-container > div { + border-bottom: thin dotted var(--divider-color); } -.mk-frame-code-editor .\37c e { - color: var(--code-string); +.mk-flow-container > div > span { + font-size: var(--font-smallest); + padding: var(--size-4-1) var(--context-padding); + color: var(--text-faint); } -.mk-frame-code-section > span { - background: var(--background-modifier-active); - padding: 2px 4px; - border-radius: 4px; - font-size: 12px; +.mk-space-scroller .mk-flowspace-editor { + padding: 0; } -.mk-frame-code-block { - width: 100%; - border-left: var(--nav-indentation-guide-width) solid var(--nav-indentation-guide-color); +.mk-space-scroller .cm-sizer { } -.mk-frame-code-block-prop { +.mk-smart-note-view { display: flex; - margin-left: 40px; - border-left: var(--nav-indentation-guide-width) solid var(--nav-indentation-guide-color); } -.mk-frame-menu-container { - display: flex; - align-items: flex-start; - overflow: scroll; +.mk-smart-note-view div { + padding: 4px; } -.mk-frame-sidebar { - position: relative; - display: flex; - flex-direction: column; - padding: 0 var(--size-4-3); - border-bottom: 1px solid var(--divider-color); +.mk-context-type-selector { + max-width: 100%; + width: 100%; + padding-top: 4px; + margin-left: auto; + margin-right: auto; } -.mk-frame-node-info { - padding: 8px; +.mk-context-type-selector button { + background: rgba(var(--nav-item-background-active), 0.3); + border: none; + box-shadow: none; + color: var(--text-faint); } -.mk-frame-inspector { - display: flex; - overflow: scroll; - flex-direction: column; - flex: 1; - border-left: 1px solid var(--divider-color); + +/* src/css/CardsView.css */ +.mk-space-scroller > .mk-cards-container { + padding-bottom: 60px; } -.mk-frame-row-placeholder { +.mk-cards-container { width: 100%; - height: 100px; - position: relative; + height: 100%; + overflow-x: auto; + overflow-y: visible; } -.mk-frame-drop-placeholder { - position: absolute; - top: 0; - left: 0; +.mk-cards-container .mk-list-content > .mk-flowspace-editor { + padding-left: 12px !important; + padding-right: 12px !important; } -.mk-frame-column { - display: none; - position: absolute !important; - width: 100%; - height: 100%; - z-index: var(--layer-popover); - border-left: var(--nav-indentation-guide-width) solid var(--nav-indentation-guide-color); +.mk-cards-container .mk-list-view { + display: inline-grid; + grid-auto-flow: column; + gap: 20px; } -.mk-frame-column-placeholder { - position: absolute; - right: -16px; - width: 16px; - bottom: 0; +.mk-space-scroller > .mk-cards-container .mk-list-view { + padding: 20px; } -.mk-frame-layers { - position: relative; - max-height: 200px; - overflow: scroll; +.mk-cards-container .mk-list-item { + border-radius: 4px; + list-style: none; + background: var(--background-secondary); + overflow: hidden; + font-size: var(--font-ui-small); + color: var(--text-muted); + box-shadow: + 0px 1px 2px rgba(0, 0, 0, 0.06), + 0px 3.4px 6.7px rgba(0, 0, 0, 0.06), + 0px 15px 30px rgba(0, 0, 0, 0.15); +} +.mk-cards-container .mk-list-group { + width: 200px; +} +.mk-cards-grid .mk-list-item { + width: 250px; } -.mk-frame-layer > span { - flex: 1; +.mk-cards-container .mk-file-icon svg { + display: none; } -.mk-frame-row-placeholder.mk-indicator-bottom::before, -.mk-frame-drop-placeholder .mk-indicator-bottom::before { - position: absolute; - content: " "; - display: block; - width: 100%; - height: 2px; - bottom: 0; - border-radius: 1px; - background: var(--interactive-accent); +.mk-cards-grid .mk-list-group { + width: 100% !important; } -.mk-frame-column-placeholder.mk-indicator-right::before { - content: " "; - display: block; - height: 100%; - width: 2px; - border-radius: 1px; - background: var(--interactive-accent); +.mk-cards-grid .mk-list-group ul { + flex-direction: row !important; + flex-wrap: wrap; } -.mk-frame-menu-bar { +.mk-cards-container .mk-list-group ul { + list-style: none; + padding-inline-start: 0px; display: flex; flex-direction: column; - position: absolute; - overflow: scroll; - left: 40px; - height: 100px; - margin: 0 !important; + gap: 10px; } -.mk-frame-menu-bar > div { +.mk-list-container .mk-list-group-header { display: flex; + padding: 12px 24px 4px 24px; + background-color: var(--titlebar-background); } -.mk-frame-placeholder { - color: var(--text-faint); +.mk-list-container .mk-list-group-header > div { + background: none !important; } -.mk-frame-text { - display: inline; - color: inherit; +.mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > div > .mk-list-container { + padding-bottom: 0; } -.mk-frame-text p { - display: inline; +.mk-floweditor > .workspace-leaf > .workspace-leaf-content > .view-content > div > .mk-list-container .mk-list-item { + padding: 8px; } -.mk-frame-menu-bar div { +.mk-space-scroller > .mk-list-container { + padding-bottom: 100px; +} +.mk-list-container { + width: 100%; + height: 100%; + overflow-y: auto; +} +.mk-list-container .mk-list-view { + display: flex; + flex-direction: column; +} +.mk-cards-container .mk-list-item.mk-is-active, +.mk-list-container .mk-list-item.mk-is-active { + background: var(--background-modifier-active-hover); +} +.mk-list-container .mk-list-item { + display: flex; padding: 8px; + list-style: none; + font-size: var(--font-ui-small); + color: var(--text-muted); + align-items: flex-start; } -.mk-frame-menu { +.mk-list-container .mk-list-content { + flex-grow: 1; display: flex; - overflow: scroll; flex-direction: column; - position: relative; + border-bottom: thin solid var(--divider-color); + min-height: 69px; } -.mk-setter-group { +.mk-list-container .mk-list-fields { display: flex; flex-wrap: wrap; align-items: center; + gap: 8px; + padding-bottom: 8px; } -.mk-setter-color { - border-radius: var(--input-radius); - border: var(--input-border-width) solid var(--background-modifier-border); +.mk-list-container .mk-list-fields > div { + margin-bottom: -8px; } -.mk-setter-group .mk-setter-slider { - flex: 1; +.mk-list-container .mk-list-fields > div:not(.mk-cell-file):not(.mk-cell-image) { + width: unset !important; } -.mk-setter-step input { - width: 40px; - padding-right: 0px; +.mk-list-container .mk-list-fields > .mk-cell-image { + width: 100%; } -.mk-setter-step input[type=number]::-webkit-outer-spin-button, -.mk-setter-step input[type=number]::-webkit-inner-spin-button { - -webkit-appearance: inner-spin-button !important; +.mk-list-container .mk-list-group { + width: 100%; } -.mk-setter-text span, -.mk-setter-step span { - font-size: var(--font-ui-smaller); +.mk-cards-container .mk-cell-file-title, +.mk-list-container .mk-cell-file-title { padding: 4px; + color: var(--text-normal); + margin-bottom: 0; } -.mk-frame-label { - position: absolute; - font-size: 9px; - background-color: var(--color-accent); - top: -10px; - left: 0; +.mk-list-container .mk-list-fields .mk-cell-file { + width: 100%; + font-weight: var(--bold-weight); } -.mk-frame-schema { +.mk-cards-container .mk-list-fields { + padding: 12px; + align-items: flex-start; display: flex; - padding: 4px 8px; - font-size: var(--font-ui-small); + flex-direction: column; } -.mk-frame-layer { - margin-left: var(--spacing); - padding: 4px 8px; - font-size: var(--font-ui-small); - display: flex; +.mk-list-fields .mk-cell-file-preview { + width: 100%; + color: var(--text-normal); + margin-bottom: -8px; + color: var(--text-faint); + text-overflow: ellipsis; + overflow: hidden; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; + display: -webkit-box; } -.mk-frame-layer.is-selected { - background-color: var(--nav-item-background-active); +.mk-list-container .mk-list-group ul { + list-style: none; + padding-inline-start: 0px; + display: flex; + flex-direction: column; + margin-top: 0; + margin-bottom: 0; } -.mk-frame-schema.is-selected { - background-color: var(--nav-item-background-active); +.mk-file-preview { + background: var(--label-color); } -.mk-frame-sidebar-title { +.mk-list-container .mk-file-preview { + min-width: 48px; + height: 48px; + border-radius: 8px; + margin-right: 8px; + margin-top: 8px; display: flex; - padding: 4px 8px; - font-size: var(--font-ui-small); - font-weight: var(--bold-weight); - background: var(--background-primary-alt); + align-items: center; + justify-content: center; } -.mk-frame-text { - min-height: 40px; +.mk-list-group-header .mk-cell-option-item { + background: none !important; } -.mk-frame-text[placeholder]:empty::before { - content: attr(placeholder); - color: var(--text-faint); +.mk-cards-container .mk-file-preview { + position: relative; + margin-bottom: 4px; + height: 80px; } -.mk-frame-text[placeholder]:empty:focus::before { - content: ""; +.mk-cards-container .mk-file-icon { + position: absolute; + bottom: -6px; + font-size: 24px; + left: 14px; } -.mk-button { - -webkit-app-region: no-drag; - display: inline-flex; +.mk-list-container .mk-file-icon { + font-size: 20px; + display: flex; align-items: center; justify-content: center; - color: var(--text-normal); - font-size: var(--font-ui-small); - border-radius: var(--button-radius); - border: 0; - padding: var(--size-4-1) var(--size-4-3); - height: var(--input-height); - font-weight: var(--input-font-weight); - cursor: var(--cursor); - font-family: inherit; - outline: none; - user-select: none; +} +.mk-context-view-editor { + flex: 1; + padding: 40px; +} +.mk-context-view-editor .mk-td { white-space: nowrap; - background-color: var(--interactive-normal); - box-shadow: var(--input-shadow); } -.mk-a { - color: var(--link-color); - outline: none; - text-decoration-line: var(--link-decoration); - text-decoration-thickness: var(--link-decoration-thickness); - cursor: var(--cursor-link); +.mk-context-view-selector { + display: flex; + padding: 12px 24px; + gap: 8px; + border-top: thin solid var(--divider-color); } -.mk-frame:empty { - display: none; +.mk-context-view-selector > div { + width: 50px; + overflow: hidden; + display: -webkit-box; + -webkit-line-clamp: 2; + line-clamp: 2; + -webkit-box-orient: vertical; + text-align: center; } /* src/css/ContextBuilder.css */ @@ -1816,11 +1878,21 @@ body { } .mk-table-selector button, .mk-view-config button { + font-size: max(var(--font-ui-small), 1em); + font-weight: var(--font-medium); background: rgba(var(--nav-item-background-active), 0.3); border: none; box-shadow: none; color: var(--text-faint); } +.mk-view-config .mk-view-options, +.mk-view-config .mk-view-selector > *:not(.mk-is-active) { + opacity: 0; +} +.mk-view-config:hover .mk-view-options, +.mk-view-config:hover .mk-view-selector > *:not(.mk-is-active) { + opacity: 1; +} .mk-view-config button:hover { color: var(--text-normal); } @@ -1828,7 +1900,7 @@ body { width: 100%; display: flex; color: var(--text-faint); - align-items: stretch; + align-items: center; border-bottom: thin solid var(--divider-color); flex-wrap: wrap; } @@ -1868,8 +1940,6 @@ body { color: var(--text-normal) !important; min-height: 48px; padding-left: var(--context-padding); - padding-right: var(--size-4-3); - flex-grow: 1; } .mk-view-config span { flex-grow: 10; @@ -2270,7 +2340,7 @@ div:not(.mk-flowspace-editor) > .mk-floweditor .cm-content { height: 100%; } .mk-file-context-header { - height: var(--header-height); + height: var(--mk-header-height); border-bottom: var(--divider-color); background-color: var(--background-primary); z-index: 1; @@ -2362,9 +2432,17 @@ div:not(.mk-flowspace-editor) > .mk-floweditor .cm-content { align-items: center; gap: 10px; } +.mk-file-context-field-key { + padding: var(--size-4-1) var(--size-4-2); + min-width: 122px; +} .mk-file-context-field-icon { - width: 24px; - height: 24px; + min-width: 18px; + height: 18px; + display: flex; + align-items: center; + text-align: center; + justify-content: center; } .mk-file-context-field-new:hover { color: var(--text-normal); @@ -2387,7 +2465,6 @@ div:not(.mk-flowspace-editor) > .mk-floweditor .cm-content { } .mk-file-context-field { min-width: 100px; - width: 100px; font-size: var(--font-ui-small); color: var(--text-faint); min-height: 24px; @@ -2507,11 +2584,8 @@ c .mk-section-title, .mk-space-gallery-controls:hover { color: var(--text-normal); } -.mk-space-outer { - min-height: 100vh; -} .mk-space-scroller > .mk-spacer { - min-height: var(--header-height); + min-height: var(--mk-header-height); } .mk-space-gallery-controls button { background: none !important; @@ -2623,7 +2697,7 @@ c .mk-section-title, padding: 0; } .markdown-source-view.mod-cm6 .cm-content > .mk-header { - --header-height: 0px; + --mk-header-height: 0px; gap: 16px; display: flex; flex-direction: column; @@ -2639,7 +2713,7 @@ c .mk-section-title, .mk-inline-context .mk-file-context-component .mk-spacer, .markdown-source-view.mod-cm6 .cm-content > .mk-header .mk-spacer, .mk-space-view .mk-space-header .mk-spacer { - height: var(--header-height) !important; + height: var(--mk-header-height) !important; pointer-events: none; } .mk-file-context .inline-title { @@ -2878,7 +2952,6 @@ mark { visibility: hidden; } .mk-spaces-enabled.is-mobile.mk-hide-ribbon .workspace-drawer.mod-left .workspace-drawer-inner { - padding-left: 0 !important; } .mk-hide-ribbon .workspace-ribbon { display: none; @@ -2890,16 +2963,12 @@ mark { padding-left: calc(var(--frame-left-space) + var(--ribbon-width)); } .mk-spaces-enabled.is-mobile.mk-hide-ribbon .workspace-drawer-ribbon { - display: none; } .mk-spaces-enabled.is-mobile .workspace-drawer.mod-left .workspace-drawer-inner .workspace-drawer-header { - padding-left: 0 !important; } .mk-spaces-enabled.is-mobile .workspace-drawer.mod-left .workspace-drawer-active-tab-header { - display: none; } .mk-spaces-enabled.is-mobile .workspace-drawer.mod-left .workspace-drawer-inner .mod-settings { - display: none; } .is-mobile .workspace-drawer.mod-left .workspace-drawer-header-left { }